# hermes-parser

> A JavaScript parser built from the Hermes engine

Latest version **0.37.0** (published 2026-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install hermes-parser
pnpm add hermes-parser
yarn add hermes-parser
bun add hermes-parser
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.37.0 |
| Published | 2026-07-14 |
| First published | 2021-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11316 |
| Maintainers | fb, flowtype, hermes-team |

## Links

- npm: https://www.npmjs.com/package/hermes-parser
- Repository: https://github.com/facebook/hermes
- npm.io page: https://npm.io/package/hermes-parser

## Dependencies (1)

- [hermes-estree](https://npm.io/package/hermes-estree.md) 0.37.0

## Recent versions

- 0.37.0 (latest) — 2026-07-14
- 0.36.1 — 2026-05-06
- 0.36.0 — 2026-04-28
- 0.35.0 — 2026-04-09
- 0.34.0 — 2026-03-13
- 0.33.3 — 2026-01-07
- 0.33.2 — 2025-12-29
- 0.33.1 — 2025-12-21
- 0.33.0 — 2025-12-12
- 0.32.1 — 2025-09-22
- 0.32.0 — 2025-08-20
- 0.31.2 — 2025-08-16
- 0.31.0 — 2025-07-30
- 0.30.0 — 2025-07-24
- 0.29.1 — 2025-06-27
- … 49 more at https://npm.io/package/hermes-parser/versions

## README

# 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.
- **transformOptions**: `object`. Options to be supplied to relevant transforms.
  - `TransformEnumSyntax`
    - `enable`: `boolean` - Whether to enable the transform. By default, `false`.
    - `getRuntime` (optional): `() => Expression` - The expression which should be a reference to the Flow Enums runtime. By default, is `require('flow-enums-runtime')`.

---
_Source: https://npm.io/package/hermes-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
