JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 235741
  • Score
    100M100P100Q177495F
  • License AGPL-3.0

Support for class fields in acorn

Package Exports

  • acorn-class-fields
  • acorn-class-fields/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-class-fields) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Class fields support for Acorn

NPM version

This is a plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

It implements support for class fields as defined in the stage 3 proposal Class field declarations for JavaScript. The emitted AST follows an ESTree proposal.

Usage

You can use this module directly in order to get an Acorn instance with the plugin installed:

var acorn = require('acorn-class-fields');

Or you can use inject.js for injecting the plugin into your own version of Acorn like this:

var acorn = require('acorn-class-fields/inject')(require('./custom-acorn'));

Then, use the plugins option to enable the plugiin:

var ast = acorn.parse(code, {
  plugins: { classFields: true }
});

License

This plugin is released under the GNU Affero General Public License.