meriyah 4.5.0 → 5.0.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 +340 -449
- package/README.md +22 -28
- package/dist/meriyah.amd.js +8916 -8806
- package/dist/meriyah.amd.min.js +1 -1
- package/dist/meriyah.cjs +8916 -8806
- package/dist/meriyah.cjs.js +8916 -8806
- package/dist/meriyah.cjs.min.js +1 -1
- package/dist/meriyah.esm.js +8916 -8806
- package/dist/meriyah.esm.min.js +1 -1
- package/dist/meriyah.esm.min.mjs +1 -1
- package/dist/meriyah.esm.mjs +8916 -8806
- package/dist/meriyah.iife.js +8916 -8806
- package/dist/meriyah.iife.min.js +1 -1
- package/dist/meriyah.min.cjs +1 -1
- package/dist/meriyah.system.js +8916 -8806
- package/dist/meriyah.system.min.js +1 -1
- package/dist/meriyah.umd.cjs +8916 -8806
- package/dist/meriyah.umd.es5.js +8925 -8830
- package/dist/meriyah.umd.es5.min.js +1 -1
- package/dist/meriyah.umd.js +8916 -8806
- package/dist/meriyah.umd.min.cjs +1 -1
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/src/chars.d.ts +135 -135
- package/dist/src/common.d.ts +201 -200
- package/dist/src/common.d.ts.map +1 -1
- package/dist/src/errors.d.ts +188 -187
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/estree.d.ts +515 -507
- package/dist/src/estree.d.ts.map +1 -1
- package/dist/src/lexer/charClassifier.d.ts +24 -24
- package/dist/src/lexer/charClassifier.d.ts.map +1 -1
- package/dist/src/lexer/comments.d.ts +14 -14
- package/dist/src/lexer/common.d.ts +26 -26
- package/dist/src/lexer/decodeHTML.d.ts +1 -1
- package/dist/src/lexer/decodeHTML.d.ts.map +1 -1
- package/dist/src/lexer/identifier.d.ts +8 -8
- package/dist/src/lexer/index.d.ts +9 -9
- package/dist/src/lexer/jsx.d.ts +6 -6
- package/dist/src/lexer/jsx.d.ts.map +1 -1
- package/dist/src/lexer/numeric.d.ts +5 -5
- package/dist/src/lexer/regexp.d.ts +3 -3
- package/dist/src/lexer/scan.d.ts +6 -6
- package/dist/src/lexer/scan.d.ts.map +1 -1
- package/dist/src/lexer/string.d.ts +12 -12
- package/dist/src/lexer/template.d.ts +4 -4
- package/dist/src/meriyah.d.ts +7 -7
- package/dist/src/meriyah.d.ts.map +1 -1
- package/dist/src/parser.d.ts +119 -118
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/token.d.ts +167 -167
- package/dist/src/unicode.d.ts +5 -5
- package/package.json +32 -27
- package/src/common.ts +42 -49
- package/src/errors.ts +3 -1
- package/src/estree.ts +11 -1
- package/src/lexer/comments.ts +1 -1
- package/src/lexer/decodeHTML.ts +3 -5
- package/src/lexer/identifier.ts +4 -4
- package/src/lexer/jsx.ts +13 -12
- package/src/lexer/numeric.ts +2 -2
- package/src/lexer/regexp.ts +3 -3
- package/src/lexer/scan.ts +8 -6
- package/src/lexer/string.ts +2 -2
- package/src/meriyah.ts +1 -2
- package/src/parser.ts +681 -533
package/README.md
CHANGED
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/meriyah"><img src="https://img.shields.io/npm/v/meriyah.svg?style=flat-square" alt="Meriyah NPM"/></a>
|
|
7
|
-
<a href="https://
|
|
8
|
-
<a href="https://lgtm.com/projects/g/meriyah/meriyah/alerts"><img src="https://img.shields.io/lgtm/alerts/g/meriyah/meriyah.svg?logo=lgtm&logoWidth=18" alt="Total alerts" /></a>
|
|
9
|
-
<a href="https://circleci.com/gh/meriyah/meriyah"><img src="https://circleci.com/gh/meriyah/meriyah.svg?style=svg" alt="Circle" /></a>
|
|
7
|
+
<a href="https://github.com/meriyah/meriyah/actions/workflows/node.js.yml"><img src="https://github.com/meriyah/meriyah/actions/workflows/node.js.yml/badge.svg" alt="Node.js CI"/></a>
|
|
10
8
|
<a href="https://github.com/meriyah/meriyah/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/meriyah/meriyah.svg" alt="License" /></a>
|
|
11
|
-
|
|
12
9
|
</p>
|
|
13
10
|
|
|
14
11
|
<br>
|
|
@@ -17,25 +14,23 @@
|
|
|
17
14
|
|
|
18
15
|
## Features
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
- Conforms to the standard ECMAScript® 2021 (ECMA-262 11th Edition) language specification
|
|
18
|
+
- Support TC39 proposals via option
|
|
19
|
+
- Support for additional ECMAScript features for Web Browsers
|
|
20
|
+
- JSX support via option
|
|
21
|
+
- Does **not** support TypeScript or Flow
|
|
22
|
+
- Optionally track syntactic node locations
|
|
23
|
+
- Emits an ESTree-compatible abstract syntax tree
|
|
24
|
+
- No backtracking
|
|
25
|
+
- Low memory usage
|
|
26
|
+
- Very well tested (~99 000 unit tests with full code coverage)
|
|
27
|
+
- Lightweight - ~90 KB minified
|
|
31
28
|
|
|
32
29
|
## ESNext features
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* [Private methods](https://github.com/tc39/proposal-private-methods)
|
|
38
|
-
* [Static class fields and private static methods](https://github.com/tc39/proposal-static-class-features/)
|
|
31
|
+
- [Decorators](https://github.com/tc39/proposal-decorators)
|
|
32
|
+
- [Import Attributes](https://github.com/tc39/proposal-import-attributes)
|
|
33
|
+
- [JSON Modules](https://github.com/tc39/proposal-json-modules)
|
|
39
34
|
|
|
40
35
|
**Note:** These features need to be enabled with the `next` option.
|
|
41
36
|
|
|
@@ -83,13 +78,13 @@ This is the available options:
|
|
|
83
78
|
impliedStrict: false;
|
|
84
79
|
|
|
85
80
|
// Allows comment extraction. Accepts either a function or array
|
|
86
|
-
onComment: []
|
|
81
|
+
onComment: [];
|
|
87
82
|
|
|
88
83
|
// Allows detection of automatic semicolon insertion. Accepts a callback function that will be passed the charater offset where the semicolon was inserted
|
|
89
|
-
onInsertedSemicolon: (pos) => {}
|
|
84
|
+
onInsertedSemicolon: (pos) => {};
|
|
90
85
|
|
|
91
86
|
// Allows token extraction. Accepts either a function or array
|
|
92
|
-
onToken: []
|
|
87
|
+
onToken: [];
|
|
93
88
|
|
|
94
89
|
// Enable non-standard parenthesized expression node
|
|
95
90
|
preserveParens: false;
|
|
@@ -100,13 +95,13 @@ This is the available options:
|
|
|
100
95
|
// Adds a source attribute in every node’s loc object when the locations option is `true`
|
|
101
96
|
source: false;
|
|
102
97
|
|
|
103
|
-
|
|
104
|
-
jsx: false
|
|
98
|
+
// Enable React JSX parsing
|
|
99
|
+
jsx: false;
|
|
105
100
|
}
|
|
106
|
-
|
|
107
101
|
```
|
|
108
102
|
|
|
109
103
|
### onComment and onToken
|
|
104
|
+
|
|
110
105
|
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.
|
|
111
106
|
|
|
112
107
|
If a function callback is supplied, the signature must be
|
|
@@ -120,6 +115,7 @@ declare function onToken(token: string, start: number, end: number, loc: SourceL
|
|
|
120
115
|
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.
|
|
121
116
|
|
|
122
117
|
### onInsertedSemicolon
|
|
118
|
+
|
|
123
119
|
If a function callback is supplied, the signature must be
|
|
124
120
|
|
|
125
121
|
```ts
|
|
@@ -129,11 +125,9 @@ declare function onInsertedSemicolon(position: number): void;
|
|
|
129
125
|
## Example usage
|
|
130
126
|
|
|
131
127
|
```js
|
|
132
|
-
|
|
133
128
|
import { parseScript } from './meriyah';
|
|
134
129
|
|
|
135
130
|
parseScript('({x: [y] = 0} = 1)');
|
|
136
|
-
|
|
137
131
|
```
|
|
138
132
|
|
|
139
133
|
This will return when serialized in json:
|