acorn-class-fields

Support for class fields in acorn

Usage no npm install needed!

<script type="module">
  import acornClassFields from 'https://cdn.skypack.dev/acorn-class-fields';
</script>

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.