Need help with meriyah?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

755 Stars 30 Forks ISC License 610 Commits 18 Opened issues


A 100% compliant, self-hosted javascript parser -

Services available


Need anything else?

Contributors list


100% compliant, self-hosted javascript parser with high focus on both performance and stability. Stable and already used in production.

Meriyah NPM GitHub license Total alerts Circle License



  • Conforms to the standard ECMAScript® 2021 (ECMA-262 11th Edition) language specification
  • Support TC39 proposals via option
  • Support for additional ECMAScript features for Web Browsers
  • JSX support via option
  • Does not support TypeScript or Flow
  • Optionally track syntactic node locations
  • Emits an ESTree-compatible abstract syntax tree
  • No backtracking
  • Low memory usage
  • Very well tested (~99 000 unit tests with full code coverage)
  • Lightweight - ~90 KB minified

ESNext features

Note: These features need to be enabled with the



npm install meriyah --save-dev


Meriyah generates

according to ESTree AST format, and can be used to perform syntactic analysis (parsing) of a JavaScript program, and with
and later a JavaScript program can be either a script or a module.


method exposed by meriyah takes an optional
object which allows you to specify whether to parse in
mode (the default) or in

This is the available options:

  // The flag to allow module code
  module: false;

// The flag to enable stage 3 support (ESNext) next: false;

// The flag to enable start, end offsets and range: [start, end] to each node ranges: false;

// Enable web compatibility webcompat: false;

// The flag to enable line/column location information to each node loc: false;

// The flag to attach raw property to each literal and identifier node raw: false;

// Enabled directives directives: false;

// The flag to allow return in the global scope globalReturn: false;

// The flag to enable implied strict mode impliedStrict: false;

// Allows comment extraction. Accepts either a function or array onComment: []

// Allows token extraction. Accepts either a function or array onToken: []

// Enable non-standard parenthesized expression node preserveParens: false;

// Enable lexical binding and scope tracking lexical: false;

// Adds a source attribute in every node’s loc object when the locations option is true source: false;

// Distinguish Identifier from IdentifierPattern identifierPattern: false;

// Enable React JSX parsing jsx: false

// Allow edge cases that deviate from the spec specDeviation: false }

onComment and onToken

If an array is supplied, comments/tokens will be pushed to the array, the item in the array contains

information when ranges flag is true, it will also contain
information when loc flag is true.

If a function callback is supplied, the signature must be

function onComment(type: string, value: string, start: number, end: number, loc: SourceLocation): void {}

function onToken(token: string, start: number, end: number, loc: SourceLocation): void {}

Note the

information are provided to the function callback regardless of the settings on ranges and loc flags. onComment callback has one extra argument
value: string
for the body string of the comment.

Example usage

import { parseScript } from './meriyah';

parseScript('({x: [y] = 0} = 1)');

This will return when serialized in json:

    type: "Program",
    sourceType: "script",
    body: [
            type: "ExpressionStatement",
            expression: {
                type: "AssignmentExpression",
                left: {
                    type: "ObjectPattern",
                    properties: [
                            type: "Property",
                            key: {
                                type: "Identifier",
                                name: "x"
                            value: {
                                type: "AssignmentPattern",
                                left: {
                                    type: "ArrayPattern",
                                    elements: [
                                            "type": "Identifier",
                                            "name": "y"
                                right: {
                                    type: "Literal",
                                    value: 0
                            kind: "init",
                            computed: false,
                            method: false,
                            shorthand: false
                operator: "=",
                right: {
                    type: "Literal",
                    value: 1

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.