babel-file

Easily create a Babel File object

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-file
3.0.04 years ago6 years agoMinified + gzip package size for babel-file in KB

Readme

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.