babel-file

3.0.0 • Public • Published

babel-file

Easily create a Babel File object

  • Constructs File object
  • Adds/parses code with nice errors
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.

/babel-file/

    Package Sidebar

    Install

    npm i babel-file

    Weekly Downloads

    1,011

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    10.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • thejameskyle