How to use the babel-helpers.list function in babel-helpers

To help you get started, we’ve selected a few babel-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / babel-helpers-lwc / src / index.js View on Github external
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
github LivelyKernel / lively4-core / src / external / plugin-babel / build-babel / systemjs-build-modular-babel-helpers.js View on Github external
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);
});
github ksherlock / better-babel-cli / babel-external-helpers.js View on Github external
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));
	});
}
github babel / babel / packages / babel-core / src / tools / build-external-helpers.js View on Github external
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") {

babel-helpers

Collection of helper functions used by Babel transforms.

MIT
Latest version published 8 years ago

Package Health Score

82 / 100
Full package analysis

Similar packages