$ npm install babel-file
Easily create a Babel File object
import createFile from 'babel-file';
import createBabylonOptions from 'babylon-options';
const file = createFile(code, {
filename: 'filename.js',
parserOpts: createBabylonOptions({
stage: 2,
}),
});
file.code;
file.ast;
file.path;
Accepts all the same options as the normal Babel File object.
© 2010 - cnpmjs.org x YWFE | Home | YWFE