Package detail

acorn-class-fields

acornjs963.3kMIT1.0.0

Support for class fields in acorn

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 the ESTree experimental Class Features design.

Usage

This module provides a plugin that can be used to extend the Acorn Parser class:

const {Parser} = require('acorn');
const classFields = require('acorn-class-fields');
Parser.extend(classFields).parse('class X { x = 0 }');

License

This plugin is released under an MIT License.

changelog

1.0.0 (2021-02-08)

  • Update AST node names to match ESTree

0.3.7 (2020-08-13)

  • Don't break methods with line break after name
  • Mark as compatible with acorn@8
  • Support await in field initializers

0.3.6 (2020-06-11)

  • Don't break acorn's optional chaining support

0.3.5 (2020-06-11)

  • Don't break keyword method names

0.3.4 (2020-05-21)

  • Allow keyword field names

0.3.3 (2020-05-20)

  • Support numeric field names

0.3.2 (2020-04-24)

  • Make compatible with acorn@7
  • Use injected acorn instance if available
  • Evaluate class heritage with outer private environment
  • Don't allow private element access on super
  • Uses Object.getPrototypeOf if available instead of __proto__
  • Fix usage of super in field initializers

0.3.1 (2019-02-09)

  • Restore compatibility with acorn-private-methods

0.3.0 (2019-02-09)

  • Require acorn >= 6.1.0

0.2.1 (2018-11-06)

  • Adapt to changes in acorn 6.0.3

0.2.0 (2018-09-14)

  • Update to new acorn 6 interface
  • Change license to MIT

0.1.2 (2018-01-26)

  • Don't accept whitespace between hash and private name

0.1.1 (2018-01-17)

  • Correctly parse all fields named async

0.1.0 (2018-01-13)

Initial release