meriyah 6.1.4 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +49 -32
- package/dist/meriyah.cjs +1116 -1069
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +1116 -1070
- package/dist/meriyah.umd.js +9230 -9183
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +5 -5
- package/dist/types/errors.d.ts +2 -1
- package/dist/types/estree.d.ts +36 -22
- package/dist/types/lexer/comments.d.ts +1 -1
- package/dist/types/lexer/common.d.ts +1 -1
- package/dist/types/lexer/identifier.d.ts +1 -1
- package/dist/types/lexer/jsx.d.ts +1 -1
- package/dist/types/lexer/scan.d.ts +1 -1
- package/dist/types/meriyah.d.ts +3 -2
- package/dist/types/options.d.ts +7 -4
- package/dist/types/parser/parser.d.ts +12 -11
- package/dist/types/parser/private-scope.d.ts +1 -1
- package/dist/types/parser/scope.d.ts +1 -1
- package/dist/types/parser.d.ts +1 -6
- package/dist/types/token.d.ts +3 -3
- package/dist/types/utilities.d.ts +1 -0
- package/package.json +2 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
# [7.1.0](https://github.com/meriyah/meriyah/compare/v7.0.0...v7.1.0) (2026-02-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add `isParseError()` for brand check ([#541](https://github.com/meriyah/meriyah/issues/541)) ([c5443c4](https://github.com/meriyah/meriyah/commit/c5443c4ac0abb9f25e6f176a7947f9b61e299c5d))
|
|
7
|
+
* assign to CallExpression is now runtime error in annexB ([#546](https://github.com/meriyah/meriyah/issues/546)) ([5835016](https://github.com/meriyah/meriyah/commit/5835016ddcf3f16807ef87c41661a18c3038f131))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# [7.0.0](https://github.com/meriyah/meriyah/compare/v6.1.4...v7.0.0) (2025-11-27)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* allow `new.target` in `commonjs` module root ([#524](https://github.com/meriyah/meriyah/issues/524)) ([5053d99](https://github.com/meriyah/meriyah/commit/5053d99dce77ea86edfc0ee33c94654078dd25ab))
|
|
17
|
+
* fix start location of `HTMLClose` comment ([#522](https://github.com/meriyah/meriyah/issues/522)) ([5ea7b96](https://github.com/meriyah/meriyah/commit/5ea7b96fab1f47a7aac39eaf69ba9c973108874e))
|
|
18
|
+
* **parser:** generate unique location info for shorthand pattern ([#515](https://github.com/meriyah/meriyah/issues/515)) ([42bb9bc](https://github.com/meriyah/meriyah/commit/42bb9bcc4fdbb3b384d98643890c8864cb557f8a))
|
|
19
|
+
* remove misspelled `ForInitialiser` in ESTree ([#520](https://github.com/meriyah/meriyah/issues/520)) ([2349d2c](https://github.com/meriyah/meriyah/commit/2349d2c901e03faf735c62eaf04aad2d3b0cd14a))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* allow skip regular expression validation ([#346](https://github.com/meriyah/meriyah/issues/346)) ([224d167](https://github.com/meriyah/meriyah/commit/224d167a3d3361d360a16f2b63a6a2ca1ea694b0))
|
|
25
|
+
* support unicode 17 ([#532](https://github.com/meriyah/meriyah/issues/532)) ([de36a18](https://github.com/meriyah/meriyah/commit/de36a1894c8098695f2a80bd1092dc627ded6dec))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
- drop support of Node.js below v20 (#518)
|
|
31
|
+
- remove `uniqueKeyInpattern` option, nodes are always unique in shorthand pattern (#519)
|
|
32
|
+
- add `sourceType`, deprecate `module` option (#521)
|
|
33
|
+
- add `sourceType: 'commonjs'`, deprecate `globalReturn` option (#523)
|
|
34
|
+
- forbid passing option `sourceType` in `parseScript` and `parseModule` APIs (#465)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
1
38
|
## [6.1.4](https://github.com/meriyah/meriyah/compare/v6.1.3...v6.1.4) (2025-07-02)
|
|
2
39
|
|
|
3
40
|
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ These features need to be enabled with the `next` option.
|
|
|
43
43
|
## RegExp support
|
|
44
44
|
|
|
45
45
|
Meriyah doesn't parse RegExp internal syntax, ESTree spec didn't require internal structure of RegExp. Meriyah
|
|
46
|
-
does use JavaScript runtime to validate the RegExp literal. That means Meriyah's RegExp support is only as good
|
|
46
|
+
does use JavaScript runtime to validate the RegExp literal by default. That means Meriyah's RegExp support is only as good
|
|
47
47
|
as JavaScript runtime's RegExp support.
|
|
48
48
|
|
|
49
49
|
As of May 2025, some latest RegExp features requires Node.js>=24.
|
|
@@ -51,7 +51,7 @@ As of May 2025, some latest RegExp features requires Node.js>=24.
|
|
|
51
51
|
- [RegExp modifiers](https://github.com/tc39/proposal-regexp-modifiers)
|
|
52
52
|
- [RegExp duplicate named groups](https://github.com/tc39/proposal-duplicate-named-capturing-groups)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Use `validateRegex: false` if you want consistent behavior in different environments or don't need errors for invalid RegExp.
|
|
55
55
|
|
|
56
56
|
## Installation
|
|
57
57
|
|
|
@@ -66,59 +66,58 @@ Meriyah generates `AST` according to [ESTree AST format](https://github.com/estr
|
|
|
66
66
|
The `parse` method exposed by meriyah takes an optional `options` object which allows you to specify whether to parse in [`script`](https://tc39.github.io/ecma262/#sec-parse-script) mode (the default) or in [`module`](https://tc39.github.io/ecma262/#sec-parsemodule) mode.
|
|
67
67
|
|
|
68
68
|
```js
|
|
69
|
-
// There are also "parseScript" and "parseModule" exported.
|
|
70
69
|
import { parse } from 'meriyah';
|
|
71
70
|
const result = parse('let some = "code";', { ranges: true });
|
|
72
71
|
```
|
|
73
72
|
|
|
74
73
|
The available options:
|
|
75
74
|
|
|
76
|
-
```
|
|
75
|
+
```ts
|
|
77
76
|
{
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// The flag to enable stage 3 support (ESNext)
|
|
82
|
-
next: false;
|
|
77
|
+
// Indicate the mode the code should be parsed in 'script', 'module', or 'commonjs' mode, default `'script'`
|
|
78
|
+
sourceType: 'script' | 'module' | 'commonjs';
|
|
83
79
|
|
|
84
|
-
// The flag to enable
|
|
85
|
-
|
|
80
|
+
// The flag to enable stage 3 support (ESNext), default `false`
|
|
81
|
+
next: boolean;
|
|
86
82
|
|
|
87
|
-
//
|
|
88
|
-
|
|
83
|
+
// The flag to enable start, end offsets and range: [start, end] to each node, default `false`
|
|
84
|
+
ranges: boolean;
|
|
89
85
|
|
|
90
|
-
//
|
|
91
|
-
|
|
86
|
+
// Enable web compatibility, default `false`
|
|
87
|
+
webcompat: boolean;
|
|
92
88
|
|
|
93
|
-
// The flag to
|
|
94
|
-
|
|
89
|
+
// The flag to enable line/column location information to each node, default `false`
|
|
90
|
+
loc: boolean;
|
|
95
91
|
|
|
96
|
-
// The flag to
|
|
97
|
-
|
|
92
|
+
// The flag to attach raw property to each literal and identifier node, default `false`
|
|
93
|
+
raw: boolean;
|
|
98
94
|
|
|
99
|
-
// The flag to enable implied strict mode
|
|
100
|
-
impliedStrict:
|
|
95
|
+
// The flag to enable implied strict mode, default `false`
|
|
96
|
+
impliedStrict: boolean;
|
|
101
97
|
|
|
102
|
-
// Allows comment extraction. Accepts either a function or array
|
|
98
|
+
// Allows comment extraction. Accepts either a function or array, default `undefined`
|
|
103
99
|
onComment: [];
|
|
104
100
|
|
|
105
|
-
// Allows detection of automatic semicolon insertion. Accepts a callback function that will be passed the character offset where the semicolon was inserted
|
|
106
|
-
onInsertedSemicolon: (
|
|
101
|
+
// Allows detection of automatic semicolon insertion. Accepts a callback function that will be passed the character offset where the semicolon was inserted, default `undefined`
|
|
102
|
+
onInsertedSemicolon: (position: number) => {};
|
|
107
103
|
|
|
108
|
-
// Allows token extraction. Accepts either a function or array
|
|
104
|
+
// Allows token extraction. Accepts either a function or array, default `undefined`
|
|
109
105
|
onToken: [];
|
|
110
106
|
|
|
111
|
-
// Enable non-standard parenthesized expression node
|
|
112
|
-
preserveParens:
|
|
107
|
+
// Enable non-standard parenthesized expression node, default `false`
|
|
108
|
+
preserveParens: boolean;
|
|
113
109
|
|
|
114
|
-
// Enable lexical binding and scope tracking
|
|
115
|
-
lexical:
|
|
110
|
+
// Enable lexical binding and scope tracking, default `false`
|
|
111
|
+
lexical: boolean;
|
|
116
112
|
|
|
117
113
|
// Adds a source attribute in every node’s loc object when the locations option is `true`
|
|
118
|
-
source:
|
|
114
|
+
source: string; // Set to source: 'source-file.js'
|
|
119
115
|
|
|
120
|
-
// Enable React JSX parsing
|
|
121
|
-
jsx:
|
|
116
|
+
// Enable React JSX parsing, default `false`
|
|
117
|
+
jsx: boolean;
|
|
118
|
+
|
|
119
|
+
// Validate regular expressions with runtime, default `true`
|
|
120
|
+
validateRegex: boolean;
|
|
122
121
|
}
|
|
123
122
|
```
|
|
124
123
|
|
|
@@ -144,6 +143,24 @@ If a function callback is supplied, the signature must be
|
|
|
144
143
|
declare function onInsertedSemicolon(position: number): void;
|
|
145
144
|
```
|
|
146
145
|
|
|
146
|
+
### `isParseError`
|
|
147
|
+
|
|
148
|
+
Exposed for error instance checking.
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
import { parse, isParseError } from './meriyah';
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
parse('invalid code');
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (isParseError(error)) {
|
|
157
|
+
console.error(error.description);
|
|
158
|
+
} else {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
147
164
|
## Example usage
|
|
148
165
|
|
|
149
166
|
```js
|