Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildHelpers(body, whitelist) {
helpers.list.forEach(function (name) {
if (whitelist && whitelist.indexOf(name) < 0) return;
const key = t.identifier(name);
// AST tree for: objectMember.helperName = function () { ... }
body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.identifier('babelHelpers'), key), helpers.get(name))));
});
}
// Regenerator is a special dependency that we want to include
var fs = require('fs');
var babel = require('babel');
var helpers = require('babel-helpers');
var t = babel.types;
// ES Module helpers based on https://github.com/babel/babel/blob/master/packages/babel-runtime/scripts/build-dist.js
helpers.list.forEach(function(helperName) {
var tree = t.program([
t.exportDefaultDeclaration(helpers.get(helperName))
]);
fs.writeFileSync('../babel-helpers/' + helperName + '.js', babel.transformFromAst(tree).code);
});
function iterate_functions(whitelist, callback) {
var list = bh.list;
list.forEach( function(fn){
if (whitelist && whitelist.indexOf(fn) < 0) return;
callback(fn, bh.get(fn));
});
}
function buildHelpers(body, namespace, whitelist) {
each(helpers.list, function (name) {
if (whitelist && whitelist.indexOf(name) < 0) return;
let key = t.identifier(name);
body.push(t.expressionStatement(
t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))
));
});
}
export default function (whitelist, outputType = "global") {