https://github.com/browserify/acorn-node
the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions
https://github.com/browserify/acorn-node
Last synced: 4 months ago
JSON representation
the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions
- Host: GitHub
- URL: https://github.com/browserify/acorn-node
- Owner: browserify
- License: other
- Created: 2018-01-09T20:13:01.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-12-21T09:32:24.000Z (about 1 year ago)
- Last Synced: 2025-03-28T19:09:33.781Z (11 months ago)
- Language: JavaScript
- Size: 118 KB
- Stars: 13
- Watchers: 15
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# acorn-node
[Acorn](https://github.com/acornjs/acorn) preloaded with plugins for syntax parity with recent Node versions.
It also includes versions of the plugins compiled with [Babel](https://github.com/babel/babel), so they can be run on old Node versions (0.6 and up).
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]
[npm-image]: https://img.shields.io/npm/v/acorn-node.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/acorn-node
[travis-image]: https://img.shields.io/travis/browserify/acorn-node/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/browserify/acorn-node
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
## Install
```
npm install acorn-node
```
## Usage
```js
var acorn = require('acorn-node')
```
The API is the same as [acorn](https://github.com/acornjs/acorn), but with plugins to match Node.js behaviour.
- Currently no plugins are in use as the main `acorn` branch supports the same syntax as Node.js.
The following options have different defaults from acorn, to match Node modules:
- `ecmaVersion: 2022`
- `allowHashBang: true`
- `allowReturnOutsideFunction: true`
```js
var walk = require('acorn-node/walk')
```
The Acorn syntax tree walker. Comes preconfigured for the syntax plugins if necessary.
See the [acorn documentation](https://github.com/acornjs/acorn#distwalkjs) for details.
## License
The files in the repo root and the ./test folder are licensed as [Apache-2.0](LICENSE.md).