How to use the transformFromAst function from babel-core
Find comprehensive JavaScript babel-core.transformFromAst code examples handpicked from public code repositorys.
GitHub: airuikun/front-core
18 19 20 21 22 23 24 25 26 27
dependencies.push(node.source.value); }, }); const id = ID++; const {code} = transformFromAst(ast, null, { presets: ['env'], }); const customCode = loader(filename, code)
87
0
63
+ 3 other calls in file
40 41 42 43 44 45 46 47 48 49
ImportDeclaration: ({ node }) => { dependencies.push(node.source.value) } }) // 通过 AST 将代码转为 ES5 const { code } = transformFromAst(ast, null, { presets: ['env'] }) return { filePath,
51
470
47
+ 3 other calls in file
GitHub: Flipkart/react-native
182 183 184 185 186 187 188 189 190 191
babelrc: false, compact: true, }; const result = transformResult.ast ? babel.transformFromAst(transformResult.ast, code, babelOptions) : babel.transform(code, babelOptions); const {ast} = result; invariant(ast != null, 'Missing AST in babel transform results.'); return {ast, code: result.code, map: result.map};
0
2
18
18 19 20 21 22 23 24 25 26 27
}, }); const id = ID++; const { code } = babel.transformFromAst(ast, null, { presets: ["env"], }); return {
0
1
0
GitHub: teemosauce/mini-webpack
59 60 61 62 63 64 65 66 67 68
module.styles.push(value) // css 依赖 后续未实现 } } }) let { code } = transformFromAst(ast, null, { presets: ['env'] }) // 移除代码中的CSS module
0
0
1
+ 33 other calls in file
babel-core.transform is the most popular function in babel-core (393 examples)