Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function render(el, opts, prefix) {
opts = options(opts);
const $ = opts.vdom
, babel = require('babel-core')
, t = babel.types
, body = [];
function getTemplateLiteralExpression(val) {
return babel.transform(
'`' + val + '`', opts.babel).ast.program.body[0].expression;
}
function attributeIterator(key, val) {
if(key && ON_PATTERN.test(key)) {
const ast = babel.transform(val, opts.babel).ast;
t.assertExpressionStatement(ast.program.body[0]);
return ast.program.body[0].expression;
}else if(val === true || val === false) {
return t.booleanLiteral(val);
// treat as string
}else{
*
* export function foo(a, b, c) {
* // implementation
* }
*
* export function genFoo(a, b, c) {
* return delegateName('foo', [a, b, c]);
* }
*
*/
'use strict';
var babel = require('babel-core');
var path = require('path');
var t = babel.types;
var Transformer = babel.Transformer;
/**
* This builds the call to the delegate function, i.e.
*
* return delegateName('functionName', args);
*/
function buildCallTo(delegateName, functionName, args) {
return t.returnStatement(
t.callExpression(
t.identifier(delegateName),
[
t.literal(functionName),
t.arrayExpression(args)
]
)
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
* @format
*/
'use strict';
const babel = require('babel-core');
const invariant = require('fbjs/lib/invariant');
import type {IntermediateTransformResult} from './types.flow';
const t = babel.types;
const Conditional = {
exit(path) {
const node = path.node;
const test = node.test;
if (t.isLiteral(test)) {
if (test.value || node.alternate) {
path.replaceWith(test.value ? node.consequent : node.alternate);
} else if (!test.value) {
path.remove();
}
}
},
};
const constantFoldingPlugin = {
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
* @format
*/
'use strict';
const babel = require('babel-core');
const t = babel.types;
const Conditional = {
exit(path) {
const node = path.node;
const test = node.test;
if (t.isLiteral(test)) {
if (test.value || node.alternate) {
path.replaceWith(test.value ? node.consequent : node.alternate);
} else if (!test.value) {
path.remove();
}
}
}
};
function makeIdentifier(name) {
return babel.types.identifier(name);
}
"use strict";
const t = require("babel-core").types;
const _ = require("lodash");
let isExtendInScope = false;
module.exports = function() {
return {
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("asyncGenerators");
parserOpts.plugins.push("classProperties");
parserOpts.plugins.push("decorators");
parserOpts.plugins.push("doExpressions");
parserOpts.plugins.push("dynamicImport");
parserOpts.plugins.push("flow");
parserOpts.plugins.push("functionBind");
parserOpts.plugins.push("functionSent");
parserOpts.plugins.push("jsx");
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const babel = require('babel-core');
const t = babel.types;
const react = {name: 'React'};
const platform = {name: 'Platform'};
const os = {name: 'OS'};
const requirePattern = {name: 'require'};
const env = {name: 'env'};
const nodeEnv = {name: 'NODE_ENV'};
const processId = {name: 'process'};
const dev = {name: '__DEV__'};
const isGlobal = (binding) => !binding;
const isToplevelBinding = (binding) => isGlobal(binding) || !binding.scope.parent;
function functionFromProgram(
program,
parameters) {
const t = babel.types;
return t.functionExpression(
t.identifier(''),
parameters.map(makeIdentifier),
t.blockStatement(program.body, program.directives));
}
import Visitor from './visitor'
import { relative, resolve, basename, join as pathJoin } from 'path'
import * as babel from 'babel-core'
import sourceMap from 'source-map'
import Parser from 'message-format/parser'
import Transpiler from './transpiler'
const types = babel.types
/**
* Transforms source code, translating and inlining `formatMessage` calls
**/
export default class Inliner extends Visitor {
constructor (options) {
super(options)
this.declarations = []
}
inline ({ sourceCode, sourceFileName, sourceMapName, inputSourceMap }) {
this.declarations.length = 0
return this.run({ sourceCode, sourceFileName, sourceMapName, inputSourceMap })
}
var traverse = require("babel-core").traverse;
var tt = require("babel-core").acorn.tokTypes;
var t = require("babel-core").types;
var source = "";
exports.toToken = function (token) {
var type = token.type;
token.range = [token.start, token.end];
if (type === tt.name) {
token.type = "Identifier";
} else if (type === tt.semi || type === tt.comma ||
type === tt.parenL || type === tt.parenR ||
type === tt.braceL || type === tt.braceR ||
type === tt.slash || type === tt.dot ||
type === tt.bracketL || type === tt.bracketR ||
type === tt.ellipsis || type === tt.arrow ||
type === tt.star || type === tt.incDec ||