How to use the transformAsync function from @babel/core
Find comprehensive JavaScript @babel/core.transformAsync code examples handpicked from public code repositorys.
GitHub: taye/interact.js
50 51 52 53 54 55 56 57 58 59
} } async function write ({ destDir, filename, code, map }, env) { if (env) { ;({ code, map } = await babel.transformAsync(code, { filename, inputSourceMap: map, plugins: [[require.resolve('./babel/inline-env-vars'), { env }]], }))
763
0
188
+ 3 other calls in file
GitHub: zotero/zotero
63 64 65 66 67 68 69 70 71 72
else if ('ignore' in options && options.ignore.some(ignoreGlob => multimatch(sourcefile, ignoreGlob).length)) { transformed = contents; isSkipped = true; } else { try { ({ code: transformed } = await babel.transformAsync( contents, Object.assign( localOptions, options
597
0
122
+ 3 other calls in file
GitHub: mui/mui-x
89 90 91 92 93 94 95 96 97 98
require.resolve('docsx/src/modules/utils/babel-plugin-jsx-preview'), { maxLines: 16, outputFilename: `${tsxPath}.preview` }, ], ]); } const { code } = await babel.transformAsync(source, transformOptions); if (/import \w* from 'prop-types'/.test(code)) { throw new Error('TypeScript demo contains prop-types, please remove them'); }
590
0
48
+ 4 other calls in file
59 60 61 62 63 64 65 66 67 68
// mark source for omit from build result taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.OmitFromBuildResult, true); // transpile the source config.debug && log.info(`Transpiling resource ${resourcePath}`); const result = await babel.transformAsync( source, Object.assign({}, babelConfig, { filename: resourcePath // necessary for source map <-> source assoc })
69
161
16
+ 4 other calls in file
GitHub: johanholmerin/style9
43 44 45 46 47 48 49 50 51 52
} return null; }, async transform(stdin, id) { if (!filter(id)) return; const res = await babel.transformAsync(stdin, { plugins: [[babelPlugin, restOptions]], filename: id, sourceMaps: true, parserOpts: parserOptions,
25
494
6
+ 9 other calls in file
GitHub: johanholmerin/style9
9 10 11 12 13 14 15 16 17 18
async function transformStyle9( code, id, { parserOptions, restOptions, server, cssModules } ) { const res = await babel.transformAsync(code, { plugins: [[babelPlugin, restOptions]], filename: id, sourceMaps: true, parserOpts: parserOptions,
25
494
6
61 62 63 64 65 66 67 68 69
localOpts = Object.assign({}, localOpts, { presets: [], }); } return babelCore.transformAsync(code, localOpts); }, }; };
2
0
1
62 63 64 65 66 67 68 69 70 71 72 73
async function transpileFile(tsxPath, program) { const jsPath = tsxPath.replace(/\.tsx?$/, '.js'); try { const source = await fse.readFile(tsxPath, 'utf8'); const { code } = await babel.transformAsync(source, { ...babelConfig, filename: tsxPath }); if (/import \w* from 'prop-types'/.test(code)) { throw new Error('TypeScript demo contains prop-types, please remove them'); }
0
0
1
+ 5 other calls in file
20 21 22 23 24 25 26 27 28 29
let loader = "jsx"; if (args.path.endsWith(".tsx")) { plugins.push("typescript"); loader = "tsx"; } const result = await babel.transformAsync(code, { babelrc: false, configFile: false, ast: false, root,
0
0
0
GitHub: tailwindlabs/heroicons
7 8 9 10 11 12 13 14 15 16
const { dirname } = require('path') let transform = { react: async (svg, componentName, format) => { let component = await svgr(svg, { ref: true, titleProp: true }, { componentName }) let { code } = await babel.transformAsync(component, { plugins: [[require('@babel/plugin-transform-react-jsx'), { useBuiltIns: true }]], }) if (format === 'esm') {
0
0
157
+ 4 other calls in file
@babel/core.types is the most popular function in @babel/core (2111 examples)