How to use the buildExternalHelpers function from @babel/core
Find comprehensive JavaScript @babel/core.buildExternalHelpers code examples handpicked from public code repositorys.
GitHub: webmastuhB/mui

193 194 195 196 197 198 199 200 201 202
}); } function buildCdnReact(dirname) { var s = babelCore.buildExternalHelpers(reactBabelHelpers, 'global'); return makeTask('build-cdn-react: ' + dirname, function() { return browserifyStream( './build-targets/cdn-react.js',
GitHub: muicss/mui

215 216 217 218 219 220
}); } function buildCdnAngular(dirname) { var s = babelCore.buildExternalHelpers(angularBabelHelpers, 'global');
+ 15 other calls in file
71 72 73 74 75 76 77 78 79
} function createHelperModule(helpers, format, minify) { const helpersWithDependencies = getHelpersWithDependencies(helpers); const addRegeneratorRuntime = helpersWithDependencies.includes('regeneratorRuntime'); let helperSource = buildExternalHelpers( helpersWithDependencies.filter(h => h !== 'regeneratorRuntime'), 'module', );
+ 3 other calls in file
116 117 118 119 120 121 122 123 124 125
'interopRequireWildcard', ]; minifyAndWriteJs( // @ts-ignore babelCore.buildExternalHelpers([...mainHelpers, ...amdHelpers]), 'babel-helpers-full.min.js'); minifyAndWriteJs( // @ts-ignore
+ 3 other calls in file
142 143 144 145 146 147 148 149 150 151
'toArray', 'toConsumableArray', ]; gulp.task('gen-babel-helpers', () => { const helpersCode = babelCore.buildExternalHelpers(babelHelperWhitelist); const minified = babelCore.transform(helpersCode, {presets: [babelPresetMinify]}).code; fs.mkdirpSync('./lib/'); fs.writeFileSync('./lib/babel-helpers.min.js', minified, {encoding: 'utf-8'});
9 10 11 12 13 14 15 16 17 18
{}, { simplifyComparisons: false } ); minifyAndWriteJs( babelCore.buildExternalHelpers(helperWhitelist), 'babel-helpers.min.js' ); /**
GitHub: wya-team/wya-vc

39 40 41 42 43 44 45 46 47 48
const HELPERS = '\0rollupPluginBabelHelpers.js'; return { name: 'import2require', options: () => {}, resolveId: id => (id !== HELPERS ? null : id), load: id => (id !== HELPERS ? null : babel.buildExternalHelpers(null, 'module')), transform(code, filename) { if (filename === HELPERS) return null; // TODO: 优化匹配规则 if (code.includes(` import(`)) {
34 35 36 37 38 39 40 41 42
if (id === BABEL_HELPERS) return id; }, load(id) { if (id === BABEL_HELPERS) { return babelCore.buildExternalHelpers(null, 'module'); } return; },
@babel/core.types is the most popular function in @babel/core (2111 examples)