Package Exports
- acorn-stage3
- acorn-stage3/inject
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (acorn-stage3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
stage 3 proposal support for Acorn
This is a plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.
It implements support for all current ECMAScript stage 3 proposals. Neither loose mode nor walk are currently supported. Note that regular expression Literals don't have a value property due to acorn-parse-regexps.
- import() (ESTree) via acorn-dynamic-import
- BigInt: Arbitrary precision integers in JavaScript (ESTree) via acorn-bigint
- Numeric Separators via acorn-numeric-separator
- Optional catch binding (ESTree) via acorn-optional-catch-binding
- import.meta via acorn-import-meta
- Class field declarations via acorn-class-fields
- Private methods and getter/setters for JavaScript classes via acorn-private-methods
- Subsume JSON via acorn-json-superset
It also implements support for these stage 4 proposals that acorn doesn't support itself:
- RegExp Lookbehind Assertions via acorn-parse-regexps
- Unicode property escapes in regular expressions via acorn-parse-regexps
- RegExp Named Capture Groups via [acorn-parse-regexps](https://www.npmjs.org/package/acorn-parse-regexps]
Usage
You can use this module directly in order to get an Acorn instance with the plugin installed:
var acorn = require('acorn-stage3');Or you can use inject.js for injecting the plugin into your own version of Acorn like this:
var acorn = require('acorn-stage3/inject')(require('./custom-acorn'));Then, use the plugins option to enable the plugiin:
var ast = acorn.parse(code, {
plugins: { stage3: true }
});License
This plugin is released under the GNU Affero General Public License.