https://github.com/timothygu/babel-plugin-parser-opts
Pass arbitrary Babylon parser options to Babel
https://github.com/timothygu/babel-plugin-parser-opts
Last synced: 10 months ago
JSON representation
Pass arbitrary Babylon parser options to Babel
- Host: GitHub
- URL: https://github.com/timothygu/babel-plugin-parser-opts
- Owner: TimothyGu
- License: mit
- Created: 2016-09-04T00:18:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-01T16:16:32.000Z (over 9 years ago)
- Last Synced: 2025-08-09T02:17:47.334Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Deprecated
This module is deprecated. In Babel 6.16.0, an option `parserOpts` was added
that does [the exact same thing][babel blog].
[babel blog]: https://babeljs.io/blog/2016/09/28/6.16.0#new-feature
----
# babel-plugin-parser-opts
Pass arbitrary Babylon parser options to Babel.
[Babel] internally uses [Babylon] to parse JavaScript. However, it does
not expose all of Babylon's [options] to be changed by users. This plugin
makes it possible to change all of these options.
[](https://travis-ci.org/TimothyGu/babel-plugin-parser-opts)
[](https://www.npmjs.com/package/babel-plugin-parser-opts)
[Babel]: https://github.com/babel/babel
[Babylon]: https://github.com/babel/babylon
[options]: https://github.com/babel/babylon#options
## Installation
```sh
$ npm install babel-plugin-parser-opts
```
## Usage
### Via `.babelrc`
**.babelrc**
```json
{
"plugins": [
[ "parser-opts", { "allowReturnOutsideFunction": true } ]
]
}
```
### Via Node API
```javascript
require('babel-core').transform('code', {
plugins: [
[ 'parser-opts', { allowReturnOutsideFunction: true } ]
]
});
```
### Parser plugins
All provided options will overwrite existing options, with one exception:
`plugins`. If provided, `plugins` array will be merged with existing.