https://github.com/babel-utils/babylon-options
Simplified options for Babylon
https://github.com/babel-utils/babylon-options
babel babel-util babylon
Last synced: 2 months ago
JSON representation
Simplified options for Babylon
- Host: GitHub
- URL: https://github.com/babel-utils/babylon-options
- Owner: babel-utils
- License: mit
- Created: 2017-05-17T00:54:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T20:22:19.000Z (over 7 years ago)
- Last Synced: 2025-04-06T04:32:26.253Z (2 months ago)
- Topics: babel, babel-util, babylon
- Language: JavaScript
- Size: 7.81 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babylon-options
> Simplified options for [Babylon](https://github.com/babel/babylon)
**Before:**
```js
babylon.parse(code, {
sourceType: 'module',
plugins: [
'jsx',
'flow',
'doExpressions',
'objectRestSpread',
'decorators',
'classProperties',
'exportExtensions',
'asyncGenerators',
'functionBind',
'functionSent',
'dynamicImport',
],
});
```**After:**
```js
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