Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

meriyah

> 前端框架
Open source

A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah

1.2K stars0 likes3 views
WebsiteGitHub

About

A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah

Meriyah

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

Interactive Playground Benchmark

Features

  • Conforms to the standard ECMAScript® 2024 (ECMA-262 15th Edition) language specification
    • See RegExp support
  • Support some TC39 stage 3 proposals via option "next"
  • Support for additional ECMAScript features for Web Browsers (Annex B)
  • JSX support via option "jsx"
  • Does NOT support TypeScript or Flow syntax
  • Track syntactic node locations with option "ranges" or "loc"
  • Emits an ESTree-compatible abstract syntax tree
  • No backtracking
  • Low memory usage

ESNext Stage 3 features

Supported stage 3 features:

These features need to be enabled with the next option.

  • Decorators
  • Source Phase Imports
  • Deferring Module Evaluation

RegExp support

Meriyah doesn't parse RegExp internal syntax, ESTree spec didn't require internal structure of RegExp. Meriyah does use JavaScript runtime to validate the RegExp literal by default. That means Meriyah's RegExp support is only as good as JavaScript runtime's RegExp support.

As of May 2025, some latest RegExp features requires Node.js>=24.

  • RegExp modifiers
  • RegExp duplicate named groups

Use validateRegex: false if you want consistent behavior in different environments or don't need errors for invalid RegExp.

Installation

bash
npm install meriyah --save-dev

API

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

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

javascript
import { parse } from 'meriyah';
const result = parse('let some = "code";', { ranges: true });

The available options:

…

onComment and onToken

If an array is supplied, comments/tokens will be pushed to the array, the item in the array contains start/end/range information when ranges flag is true, it will also contain loc information when loc flag is true.

If a function callback is supplied, the signature must be

typescript
declare function onComment(type: string, value: string, start: number, end: number, loc: SourceLocation): void;

declare function onToken(token: string, start: number, end: number, loc: SourceLocation): void;

Note the start/end/loc 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.

onInsertedSemicolon

If a function callback is supplied, the signature must be

typescript
declare function onInsertedSemicolon(position: number): void;

isParseError

Exposed for error instance checking.

javascript
import { parse, isParseError } from './meriyah';

try {
  parse('invalid code');
} catch (error) {
  if (isParseError(error)) {
    console.error(error.description);
  } else {
    throw error;
  }
}

Example usage

javascript
import { parse } from './meriyah';

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

This will return when serialized in json:

…

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptacornastecmascriptesnext

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架