Skip to content

Easily create a Babel File object

License

Notifications You must be signed in to change notification settings

babel-utils/babel-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Easily create a Babel File object

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published