hermes-parser
A JavaScript parser built from the Hermes engine
Last updated 2 years ago by hermes-team .
MIT · Repository · Original npm · Tarball · package.json
$ npm install hermes-parser 
SYNC missed versions from official npm registry.

hermes-parser

A JavaScript parser built from the Hermes engine's parser compiled to WebAssembly. Can parse ES6, Flow, and JSX syntax.

API

The Hermes parser exposes a single parse(code, [options]) function, where code is the source code to parse as a string, and options is an optional object that may contain the following properties:

  • babel: boolean, defaults to false. If true, output an AST conforming to Babel's AST format. If false, output an AST conforming to the ESTree AST format.
  • allowReturnOutsideFunction: boolean, defaults to false. If true, do not error on return statements found outside functions.
  • flow: "all" or "detect", defaults to "detect". If "detect", only parse syntax as Flow syntax where it is ambiguous whether it is a Flow feature or regular JavaScript when the @flow pragma is present in the file. Otherwise if "all", always parse ambiguous syntax as Flow syntax regardless of the presence of an @flow pragma. For example foo<T>(x) in a file without an @flow pragma will be parsed as two comparisons if set to "detect", otherwise if set to "all" or the @flow pragma is included it will be parsed as a call expression with a type argument.
  • sourceFilename: string, defaults to null. The filename corresponding to the code that is to be parsed. If non-null, the filename will be added to all source locations in the output AST.
  • sourceType: "module", "script", or "unambiguous" (default). If "unambiguous", source type will be automatically detected and set to "module" if any ES6 imports or exports are present in the code, otherwise source type will be set to "script".
  • tokens: boolean, defaults to false. If true, add all tokens to a tokens property on the root node.

Current Tags

  • 0.25.1                                ...           latest (a month ago)

44 Versions

  • 0.25.1                                ...           a month ago
  • 0.25.0                                ...           2 months ago
  • 0.24.0                                ...           3 months ago
  • 0.23.1                                ...           5 months ago
  • 0.23.0                                ...           5 months ago
  • 0.22.0                                ...           7 months ago
  • 0.21.1                                ...           7 months ago
  • 0.21.0                                ...           8 months ago
  • 0.20.1                                ...           10 months ago
  • 0.20.0                                ...           10 months ago
  • 0.19.2                                ...           10 months ago
  • 0.19.1                                ...           a year ago
  • 0.19.0                                ...           a year ago
  • 0.18.2                                ...           a year ago
  • 0.18.1                                ...           a year ago
  • 0.18.0                                ...           a year ago
  • 0.17.1                                ...           a year ago
  • 0.17.0                                ...           a year ago
  • 0.16.0                                ...           a year ago
  • 0.15.1                                ...           a year ago
  • 0.15.0                                ...           a year ago
  • 0.14.0                                ...           a year ago
  • 0.13.1                                ...           a year ago
  • 0.13.0                                ...           a year ago
  • 0.12.1                                ...           2 years ago
  • 0.12.0                                ...           2 years ago
  • 0.11.1                                ...           2 years ago
  • 0.11.0                                ...           2 years ago
  • 0.10.1                                ...           2 years ago
  • 0.10.0                                ...           2 years ago
  • 0.9.0                                ...           2 years ago
  • 0.8.0                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.8                                ...           3 years ago
  • 0.4.7                                ...           4 years ago
  • 0.4.6                                ...           4 years ago
  • 0.4.4                                ...           4 years ago
  • 0.4.3                                ...           4 years ago
  • 0.4.2 [deprecated]           ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
Downloads
Total 22
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE