babylon-options

2.0.1 • Public • Published

babylon-options

Simplified options for Babylon

Before:

babylon.parse(code, {
  sourceType: 'module',
  plugins: [
    'jsx',
    'flow',
    'doExpressions',
    'objectRestSpread',
    'decorators',
    'classProperties',
    'exportExtensions',
    'asyncGenerators',
    'functionBind',
    'functionSent',
    'dynamicImport',
  ],
});

After:

import * as babylon from 'babylon';
import createBabylonOptions from 'babylon-options';
 
babylon.parse(code, createBabylonOptions({
  stage: 2,
  plugins: ['flow', 'jsx'],
}));

Options

All Babylon options will be passed through, will some additions/modifications:

  • sourceType: Defaults to "module"
  • stage: Set plugins based on TC39 stages
  • plugins: You can still specify plugins, other options will add to this list

Readme

Keywords

none

Package Sidebar

Install

npm i babylon-options

Weekly Downloads

192

Version

2.0.1

License

MIT

Unpacked Size

3.76 kB

Total Files

6

Last publish

Collaborators

  • thejameskyle