meriyah 5.0.0 → 6.0.1
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 +88 -0
- package/README.md +38 -14
- package/dist/meriyah.cjs +2358 -2074
- package/dist/meriyah.min.mjs +1 -0
- package/dist/{meriyah.esm.js → meriyah.mjs} +2358 -2074
- package/dist/meriyah.umd.js +2358 -2074
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/src/common.d.ts +71 -47
- package/dist/src/common.d.ts.map +1 -1
- package/dist/src/errors.d.ts +186 -177
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/estree.d.ts +15 -6
- package/dist/src/estree.d.ts.map +1 -1
- package/dist/src/lexer/charClassifier.d.ts +2 -2
- package/dist/src/lexer/charClassifier.d.ts.map +1 -1
- package/dist/src/lexer/common.d.ts +1 -2
- package/dist/src/lexer/common.d.ts.map +1 -1
- package/dist/src/lexer/identifier.d.ts.map +1 -1
- package/dist/src/lexer/index.d.ts +1 -1
- package/dist/src/lexer/index.d.ts.map +1 -1
- package/dist/src/lexer/jsx.d.ts +2 -2
- package/dist/src/lexer/jsx.d.ts.map +1 -1
- package/dist/src/lexer/numeric.d.ts.map +1 -1
- package/dist/src/lexer/regexp.d.ts.map +1 -1
- package/dist/src/lexer/scan.d.ts.map +1 -1
- package/dist/src/lexer/string.d.ts +1 -1
- package/dist/src/lexer/string.d.ts.map +1 -1
- package/dist/src/lexer/template.d.ts.map +1 -1
- package/dist/src/parser.d.ts +72 -72
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/token.d.ts +115 -115
- package/dist/src/token.d.ts.map +1 -1
- package/package.json +26 -35
- package/dist/meriyah.amd.js +0 -8964
- package/dist/meriyah.amd.min.js +0 -1
- package/dist/meriyah.cjs.js +0 -8962
- package/dist/meriyah.cjs.min.js +0 -1
- package/dist/meriyah.esm.min.js +0 -1
- package/dist/meriyah.esm.min.mjs +0 -1
- package/dist/meriyah.esm.mjs +0 -8956
- package/dist/meriyah.iife.js +0 -8967
- package/dist/meriyah.iife.min.js +0 -1
- package/dist/meriyah.min.cjs +0 -1
- package/dist/meriyah.system.js +0 -8970
- package/dist/meriyah.system.min.js +0 -1
- package/dist/meriyah.umd.cjs +0 -8968
- package/dist/meriyah.umd.es5.js +0 -9022
- package/dist/meriyah.umd.es5.min.js +0 -1
- package/dist/meriyah.umd.min.cjs +0 -1
- package/src/chars.ts +0 -155
- package/src/common.ts +0 -834
- package/src/errors.ts +0 -421
- package/src/estree.ts +0 -827
- package/src/lexer/charClassifier.ts +0 -449
- package/src/lexer/comments.ts +0 -178
- package/src/lexer/common.ts +0 -140
- package/src/lexer/decodeHTML.ts +0 -2184
- package/src/lexer/identifier.ts +0 -196
- package/src/lexer/index.ts +0 -32
- package/src/lexer/jsx.ts +0 -127
- package/src/lexer/numeric.ts +0 -259
- package/src/lexer/regexp.ts +0 -156
- package/src/lexer/scan.ts +0 -657
- package/src/lexer/string.ts +0 -242
- package/src/lexer/template.ts +0 -108
- package/src/meriyah.ts +0 -28
- package/src/parser.ts +0 -9358
- package/src/token.ts +0 -307
- package/src/unicode.ts +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
|
1
|
+
## [6.0.1](https://github.com/meriyah/meriyah/compare/v6.0.0...v6.0.1) (2024-09-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **scanner:** proper EOF error for unterminated template ([cde6b2f](https://github.com/meriyah/meriyah/commit/cde6b2f7db3768c0fc254e65a68aa6debea62eab))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# [6.0.0](https://github.com/meriyah/meriyah/compare/v5.0.0...v6.0.0) (2024-09-16)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **lexer:** identifier starts with unicode-escape needs ID_Start check ([e1d5534](https://github.com/meriyah/meriyah/commit/e1d55340eb6b63e9e1e9eaf97f10c6bce9391833))
|
|
15
|
+
- **lexer:** in non-strict mode, future reserved keyword can be used as identifier ([5764ad7](https://github.com/meriyah/meriyah/commit/5764ad7e0dd66a60ed735141c38174d4bb5ffef4))
|
|
16
|
+
- **lexer:** no line break is allowed in regex literal ([773208b](https://github.com/meriyah/meriyah/commit/773208bc5d6ccdc47dd4a7af4c8b380c6f874ba9))
|
|
17
|
+
- **lexer:** private identifier can start with escaped unicode ([85a39e7](https://github.com/meriyah/meriyah/commit/85a39e7f66a13118b0cb1f2d2edab5468b5f5e18))
|
|
18
|
+
- **lexer:** unicode escaped "let" can not be let keyword ([406d72c](https://github.com/meriyah/meriyah/commit/406d72c4dff72eaee23fa068c90bcb65ebb23227))
|
|
19
|
+
- **parser:** "arguments" is not allowed in class property initializer or static block ([c9857c6](https://github.com/meriyah/meriyah/commit/c9857c6f24f64a460cccbbc87249720ee0e8e30d))
|
|
20
|
+
- **parser:** "use strict" directive could be after invalid string ([527ea97](https://github.com/meriyah/meriyah/commit/527ea9755512c3c9adc803799c5f0c00c4215679)), closes [#149](https://github.com/meriyah/meriyah/issues/149)
|
|
21
|
+
- **parser:** a newline may not precede the `*` token in a `yield` expression ([e0eeb89](https://github.com/meriyah/meriyah/commit/e0eeb894f78f133954e22d7c5fbede189c4320df))
|
|
22
|
+
- **parser:** add missing import-attributes support in ExportNamedDeclaration ([f7864a6](https://github.com/meriyah/meriyah/commit/f7864a6de51987411063c38c749185fbe25ab78a)), closes [#289](https://github.com/meriyah/meriyah/issues/289)
|
|
23
|
+
- **parser:** async function should not skip duplication error ([94d41ae](https://github.com/meriyah/meriyah/commit/94d41aedc87237bb3bc3ed8a08e8e0ec8ff4ab88)), closes [#291](https://github.com/meriyah/meriyah/issues/291)
|
|
24
|
+
- **parser:** catch block without catch-binding should have lexical scope ([db7b3ae](https://github.com/meriyah/meriyah/commit/db7b3aefd8e524ec0de8a332ea5bc016a127c1a3))
|
|
25
|
+
- **parser:** class is implicit strict mode, but decorator before class is not ([97f4927](https://github.com/meriyah/meriyah/commit/97f492783a4b78f5abb9645620f4b6611684fcd0))
|
|
26
|
+
- **parser:** class static block disallows "await" as identifier ([4c7f2c3](https://github.com/meriyah/meriyah/commit/4c7f2c388a24f78b4f3b07ea02d08bbe8fbc25ea))
|
|
27
|
+
- **parser:** class static block disllows "yield" as idenfifier ([1cb0d65](https://github.com/meriyah/meriyah/commit/1cb0d65a3e7c1f5276b83cf172df424407cb2d96))
|
|
28
|
+
- **parser:** class static block has no return statement ([f2b73ee](https://github.com/meriyah/meriyah/commit/f2b73ee4b43b48d49452a5e4f067b58968085659))
|
|
29
|
+
- **parser:** dot property name can be escaped reserved or future reserved ([eedce98](https://github.com/meriyah/meriyah/commit/eedce98913f6a8f8f16df60e73edc6ac231b2a28))
|
|
30
|
+
- **parser:** escaped reserved keyword can be used as class element name ([b8e4b3c](https://github.com/meriyah/meriyah/commit/b8e4b3c231d5fc5b57aff1bd2b8a15e2af20b11c))
|
|
31
|
+
- **parser:** fix an edge case of invalid escape in tagged template ([118fdae](https://github.com/meriyah/meriyah/commit/118fdae97ab0c5640b3ede9cdbc5dc2e0fe05070))
|
|
32
|
+
- **parser:** fix annexB behaviour (webcompat) of catch param ([359dcbe](https://github.com/meriyah/meriyah/commit/359dcbe34447a409cf87630188aafb3ce7729abf))
|
|
33
|
+
- **parser:** fix destruct pattern check ([1e5e394](https://github.com/meriyah/meriyah/commit/1e5e3945b3de6e2eed9e700688442f4bf069268f))
|
|
34
|
+
- **parser:** fix duplicated function params check ([d0aeda6](https://github.com/meriyah/meriyah/commit/d0aeda6586a67b0ad85d64bfc525762d812f7064))
|
|
35
|
+
- **parser:** fix duplicated proto check in async() and async() => {} ([66ad497](https://github.com/meriyah/meriyah/commit/66ad4976ae485a6cb4fb880c9fb0fe5334365872))
|
|
36
|
+
- **parser:** fix early error on escaped oct and \8 \9 ([33b68df](https://github.com/meriyah/meriyah/commit/33b68df6fbc0c60217c640d18dbb4f77f7b77e62))
|
|
37
|
+
- **parser:** fix import.meta check, await check and await in static block ([b269996](https://github.com/meriyah/meriyah/commit/b269996c44acec0d2cd2060fe1a3745a1efa05c3))
|
|
38
|
+
- **parser:** fix jsx parsing on '< / >' ([ad71155](https://github.com/meriyah/meriyah/commit/ad7115560f415248f99981da72cd31c9438c3b7d)), closes [#185](https://github.com/meriyah/meriyah/issues/185)
|
|
39
|
+
- **parser:** fix jsx with comments in tag ([a2e4767](https://github.com/meriyah/meriyah/commit/a2e4767d57ec2519e85197517975342f89b77ef6)), closes [#185](https://github.com/meriyah/meriyah/issues/185)
|
|
40
|
+
- **parser:** fix onToken callback for template and jsx ([407a2ca](https://github.com/meriyah/meriyah/commit/407a2ca5ba2a0d309a5bc0ba362d3ec37afbbaa4)), closes [#215](https://github.com/meriyah/meriyah/issues/215) [#216](https://github.com/meriyah/meriyah/issues/216)
|
|
41
|
+
- **parser:** fix scoped analysis for export binding and name ([22509b7](https://github.com/meriyah/meriyah/commit/22509b7384e625df5ebf9689544df984b4811ba7))
|
|
42
|
+
- **parser:** fix simple params list and strict reserved check on func ([635a41b](https://github.com/meriyah/meriyah/commit/635a41b9054e84924e6778bf8c2d1d8a8e7d1f1a)), closes [#295](https://github.com/meriyah/meriyah/issues/295) [#296](https://github.com/meriyah/meriyah/issues/296)
|
|
43
|
+
- **parser:** fix unicode identifier value and check ([36a5ef6](https://github.com/meriyah/meriyah/commit/36a5ef66557e853efd1d63c36b313697903b0560))
|
|
44
|
+
- **parser:** generator function should not skip duplication error ([d3c953b](https://github.com/meriyah/meriyah/commit/d3c953b2023d513333c8219a762aede08c454a87))
|
|
45
|
+
- **parser:** in strict mode, escaped future reserved can be used as identifier but not destructible ([762f8c1](https://github.com/meriyah/meriyah/commit/762f8c1fa2282d36985eb068963f9db10533c040))
|
|
46
|
+
- **parser:** iteration/switch cannot across class static block boundry ([c832eb6](https://github.com/meriyah/meriyah/commit/c832eb67e5d36edaced0e96d9f6ecb8ac3b6fe8a))
|
|
47
|
+
- **parser:** new.target is allowed in class static block ([2cec2a9](https://github.com/meriyah/meriyah/commit/2cec2a94868e6e14b80636a542709183c7934463))
|
|
48
|
+
- **parser:** object literal ({a b}) is invalid ([c069662](https://github.com/meriyah/meriyah/commit/c069662755085a0f85174898eacb299a631ea92f)), closes [#73](https://github.com/meriyah/meriyah/issues/73)
|
|
49
|
+
- **parser:** oct escape and \8 \9 are not allowed in template string if not tagged ([e12d75d](https://github.com/meriyah/meriyah/commit/e12d75d4845a76e08ac42a087d6142d1ffdbb23c))
|
|
50
|
+
- **parser:** only class static non-private property cannot be named 'prototype' ([03ef7bc](https://github.com/meriyah/meriyah/commit/03ef7bce129d43d1b17d03bc08a606704f1747d6))
|
|
51
|
+
- **parser:** partially fix duplicated proto check in parenthesis ([e998b9c](https://github.com/meriyah/meriyah/commit/e998b9c17933b0b178959cd83f336e81dbe491e9))
|
|
52
|
+
- **parser:** private identifier should work in optional chaining ([f22f7ad](https://github.com/meriyah/meriyah/commit/f22f7ada24bc0755d9717fca4a9f5e95a31a3716))
|
|
53
|
+
- **paser:** fix strict mode check for arrow function ([4ca184a](https://github.com/meriyah/meriyah/commit/4ca184a0e2ee369b959d2d514c9d614278dc7863))
|
|
54
|
+
- **paser:** private identifier cannot be accessed on super ([15d679d](https://github.com/meriyah/meriyah/commit/15d679df1a44de770b42ab872808f79ea95457bd))
|
|
55
|
+
- **scanner:** fix value for huge BigInt ([a09b497](https://github.com/meriyah/meriyah/commit/a09b497d4085bb491515ab50f450f92e4feb6014))
|
|
56
|
+
|
|
57
|
+
### chore
|
|
58
|
+
|
|
59
|
+
- drop support of Nodejs < 18 ([829835e](https://github.com/meriyah/meriyah/commit/829835ece5f7cb0ae1e5dc2971405c42277db7f0))
|
|
60
|
+
- reduce dist files to esm, cjs, and umd ([962af5f](https://github.com/meriyah/meriyah/commit/962af5f7c7fd1002668cd7c3c561ec2db5ca279f))
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
- **lexer:** support regexp v flag (unicodeSets) ([1d9a1ee](https://github.com/meriyah/meriyah/commit/1d9a1ee3de5d1dd31525f74bc5a117af1924d620))
|
|
65
|
+
- **parser:** expose start/end/range/loc:{start,end} to ParseError ([27691df](https://github.com/meriyah/meriyah/commit/27691dffbaeb09cf9e070d370838793195514f3d)), closes [#156](https://github.com/meriyah/meriyah/issues/156)
|
|
66
|
+
- **parser:** implement lexical analysis of private identifiers ([66217a1](https://github.com/meriyah/meriyah/commit/66217a1c44d6be91dd8391774c821a1cfee93afb)), closes [#322](https://github.com/meriyah/meriyah/issues/322)
|
|
67
|
+
- **parser:** support arbitrary module namespace names ([e43e93c](https://github.com/meriyah/meriyah/commit/e43e93c37c591e4315b53d4ed443d12adee1600f)), closes [#200](https://github.com/meriyah/meriyah/issues/200) [#214](https://github.com/meriyah/meriyah/issues/214)
|
|
68
|
+
- **parser:** support class auto-accessor through next option ([b0d1621](https://github.com/meriyah/meriyah/commit/b0d16211765d85fd8e32d771f20703eb99ef2561)), closes [#327](https://github.com/meriyah/meriyah/issues/327)
|
|
69
|
+
- remove option "directives" ([5d941e6](https://github.com/meriyah/meriyah/commit/5d941e6480115dabbb0358142bde7703f47980c1))
|
|
70
|
+
- support unicode 16 ([0514c83](https://github.com/meriyah/meriyah/commit/0514c83e8bfed18ed13a07a5c8d201ac5bb6c181))
|
|
71
|
+
|
|
72
|
+
### BREAKING CHANGES
|
|
73
|
+
|
|
74
|
+
- remove option "directives" as directives is in
|
|
75
|
+
ECMA spec, and ESTree spec. No point to make it an optional feature.
|
|
76
|
+
- **parser:** ParseError is changed from index,loc:{line,column}
|
|
77
|
+
to start,end,range:[start,end],loc:{start:{line,column},end:{line,column}}
|
|
78
|
+
just like what we have on AST node when options ranges and loc is
|
|
79
|
+
turned on.
|
|
80
|
+
- drop support of Nodejs < 18
|
|
81
|
+
- only distribute following files:
|
|
82
|
+
dist/meriyah.cjs
|
|
83
|
+
dist/meriyah.mjs
|
|
84
|
+
dist/meriyah.min.mjs
|
|
85
|
+
dist/meriyah.umd.js
|
|
86
|
+
dist/meriyah.umd.min.js
|
|
87
|
+
All transpiled with target: "ES2021"
|
|
88
|
+
|
|
1
89
|
# [5.0.0](https://github.com/meriyah/meriyah/compare/v4.5.0...v5.0.0) (2024-07-25)
|
|
2
90
|
|
|
3
91
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -14,25 +14,46 @@
|
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
|
-
- Conforms to the standard ECMAScript®
|
|
18
|
-
-
|
|
19
|
-
- Support
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
17
|
+
- Conforms to the standard ECMAScript® 2024 (ECMA-262 15th Edition) language specification
|
|
18
|
+
- Except RegExp duplicate named groups (See [RegExp support](#regexp-support))
|
|
19
|
+
- Support some TC39 stage 3 proposals via option "next"
|
|
20
|
+
- Support for additional ECMAScript features for Web Browsers (Annex B)
|
|
21
|
+
- JSX support via option "jsx"
|
|
22
|
+
- Does **NOT** support TypeScript or Flow syntax
|
|
23
|
+
- Track syntactic node locations with option "ranges" or "loc"
|
|
23
24
|
- Emits an ESTree-compatible abstract syntax tree
|
|
24
25
|
- No backtracking
|
|
25
26
|
- Low memory usage
|
|
26
|
-
- Very well tested (~99 000 unit tests with full code coverage)
|
|
27
|
-
- Lightweight - ~90 KB minified
|
|
28
27
|
|
|
29
|
-
## ESNext features
|
|
28
|
+
## ESNext Stage 3 features
|
|
29
|
+
|
|
30
|
+
### Supported stage 3 features:
|
|
31
|
+
|
|
32
|
+
These features need to be enabled with the `next` option.
|
|
30
33
|
|
|
31
34
|
- [Decorators](https://github.com/tc39/proposal-decorators)
|
|
32
35
|
- [Import Attributes](https://github.com/tc39/proposal-import-attributes)
|
|
33
36
|
- [JSON Modules](https://github.com/tc39/proposal-json-modules)
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
### Not yet supported stage 3 features:
|
|
39
|
+
|
|
40
|
+
- [Explicit resource management](https://github.com/tc39/proposal-explicit-resource-management)
|
|
41
|
+
- [Source phase import](https://github.com/tc39/proposal-source-phase-imports)
|
|
42
|
+
- [RegExp modifiers](https://github.com/tc39/proposal-regexp-modifiers) (See [RegExp support](#regexp-support))
|
|
43
|
+
|
|
44
|
+
## RegExp support
|
|
45
|
+
|
|
46
|
+
Meriyah doesn't parse RegExp internal syntax, ESTree spec didn't require internal structure of RegExp. Meriyah
|
|
47
|
+
does use JavaScript runtime to validate the RegExp literal. That means Meriyah's RegExp support is only as good
|
|
48
|
+
as JavaScript runtime's RegExp support.
|
|
49
|
+
|
|
50
|
+
As of Auguest 2024, some latest RegExp features are not supported due to missing implementation in general
|
|
51
|
+
JavaScript runtime.
|
|
52
|
+
|
|
53
|
+
- [RegExp modifiers](https://github.com/tc39/proposal-regexp-modifiers) (stage 3) is not supported
|
|
54
|
+
- [RegExp duplicate named groups](https://github.com/tc39/proposal-duplicate-named-capturing-groups) is not supported
|
|
55
|
+
|
|
56
|
+
In addition, RegExp v flag (unicodeSets) only works on Nodejs v20+ and latest browsers.
|
|
36
57
|
|
|
37
58
|
## Installation
|
|
38
59
|
|
|
@@ -46,7 +67,13 @@ Meriyah generates `AST` according to [ESTree AST format](https://github.com/estr
|
|
|
46
67
|
|
|
47
68
|
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.
|
|
48
69
|
|
|
49
|
-
|
|
70
|
+
```js
|
|
71
|
+
// There are also "parseScript" and "parseModule" exported.
|
|
72
|
+
import { parse } from 'meriyah';
|
|
73
|
+
const result = parse('let some = "code";', { ranges: true });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The available options:
|
|
50
77
|
|
|
51
78
|
```js
|
|
52
79
|
{
|
|
@@ -68,9 +95,6 @@ This is the available options:
|
|
|
68
95
|
// The flag to attach raw property to each literal and identifier node
|
|
69
96
|
raw: false;
|
|
70
97
|
|
|
71
|
-
// Enabled directives
|
|
72
|
-
directives: false;
|
|
73
|
-
|
|
74
98
|
// The flag to allow return in the global scope
|
|
75
99
|
globalReturn: false;
|
|
76
100
|
|