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.
Files changed (65) hide show
  1. package/CHANGELOG.md +340 -449
  2. package/README.md +22 -28
  3. package/dist/meriyah.amd.js +8916 -8806
  4. package/dist/meriyah.amd.min.js +1 -1
  5. package/dist/meriyah.cjs +8916 -8806
  6. package/dist/meriyah.cjs.js +8916 -8806
  7. package/dist/meriyah.cjs.min.js +1 -1
  8. package/dist/meriyah.esm.js +8916 -8806
  9. package/dist/meriyah.esm.min.js +1 -1
  10. package/dist/meriyah.esm.min.mjs +1 -1
  11. package/dist/meriyah.esm.mjs +8916 -8806
  12. package/dist/meriyah.iife.js +8916 -8806
  13. package/dist/meriyah.iife.min.js +1 -1
  14. package/dist/meriyah.min.cjs +1 -1
  15. package/dist/meriyah.system.js +8916 -8806
  16. package/dist/meriyah.system.min.js +1 -1
  17. package/dist/meriyah.umd.cjs +8916 -8806
  18. package/dist/meriyah.umd.es5.js +8925 -8830
  19. package/dist/meriyah.umd.es5.min.js +1 -1
  20. package/dist/meriyah.umd.js +8916 -8806
  21. package/dist/meriyah.umd.min.cjs +1 -1
  22. package/dist/meriyah.umd.min.js +1 -1
  23. package/dist/src/chars.d.ts +135 -135
  24. package/dist/src/common.d.ts +201 -200
  25. package/dist/src/common.d.ts.map +1 -1
  26. package/dist/src/errors.d.ts +188 -187
  27. package/dist/src/errors.d.ts.map +1 -1
  28. package/dist/src/estree.d.ts +515 -507
  29. package/dist/src/estree.d.ts.map +1 -1
  30. package/dist/src/lexer/charClassifier.d.ts +24 -24
  31. package/dist/src/lexer/charClassifier.d.ts.map +1 -1
  32. package/dist/src/lexer/comments.d.ts +14 -14
  33. package/dist/src/lexer/common.d.ts +26 -26
  34. package/dist/src/lexer/decodeHTML.d.ts +1 -1
  35. package/dist/src/lexer/decodeHTML.d.ts.map +1 -1
  36. package/dist/src/lexer/identifier.d.ts +8 -8
  37. package/dist/src/lexer/index.d.ts +9 -9
  38. package/dist/src/lexer/jsx.d.ts +6 -6
  39. package/dist/src/lexer/jsx.d.ts.map +1 -1
  40. package/dist/src/lexer/numeric.d.ts +5 -5
  41. package/dist/src/lexer/regexp.d.ts +3 -3
  42. package/dist/src/lexer/scan.d.ts +6 -6
  43. package/dist/src/lexer/scan.d.ts.map +1 -1
  44. package/dist/src/lexer/string.d.ts +12 -12
  45. package/dist/src/lexer/template.d.ts +4 -4
  46. package/dist/src/meriyah.d.ts +7 -7
  47. package/dist/src/meriyah.d.ts.map +1 -1
  48. package/dist/src/parser.d.ts +119 -118
  49. package/dist/src/parser.d.ts.map +1 -1
  50. package/dist/src/token.d.ts +167 -167
  51. package/dist/src/unicode.d.ts +5 -5
  52. package/package.json +32 -27
  53. package/src/common.ts +42 -49
  54. package/src/errors.ts +3 -1
  55. package/src/estree.ts +11 -1
  56. package/src/lexer/comments.ts +1 -1
  57. package/src/lexer/decodeHTML.ts +3 -5
  58. package/src/lexer/identifier.ts +4 -4
  59. package/src/lexer/jsx.ts +13 -12
  60. package/src/lexer/numeric.ts +2 -2
  61. package/src/lexer/regexp.ts +3 -3
  62. package/src/lexer/scan.ts +8 -6
  63. package/src/lexer/string.ts +2 -2
  64. package/src/meriyah.ts +1 -2
  65. package/src/parser.ts +681 -533
@@ -1,168 +1,168 @@
1
- export declare const enum Token {
2
- Type = 255,
3
- PrecStart = 8,
4
- Precedence = 3840,
5
- Keyword = 4096,
6
- Contextual = 12288,
7
- Reserved = 20480,
8
- FutureReserved = 36864,
9
- IsExpressionStart = 65536,
10
- IsIdentifier = 143360,
11
- IsInOrOf = 262144,
12
- IsLogical = 524288,
13
- IsAutoSemicolon = 1048576,
14
- IsPatternStart = 2097152,
15
- IsAssignOp = 4194304,
16
- IsBinaryOp = 8454144,
17
- IsUnaryOp = 16842752,
18
- IsUpdateOp = 33619968,
19
- IsMemberOrCallExpression = 67108864,
20
- IsStringOrNumber = 134217728,
21
- IsCoalesc = 268435456,
22
- IsEvalOrArguments = 537079808,
23
- IsClassField = 1073741824,
24
- EOF = 1048576,
25
- Identifier = 208897,
26
- NumericLiteral = 134283266,
27
- StringLiteral = 134283267,
28
- RegularExpression = 65540,
29
- FalseKeyword = 86021,
30
- TrueKeyword = 86022,
31
- NullKeyword = 86023,
32
- TemplateContinuation = 67174408,
33
- TemplateSpan = 67174409,
34
- Arrow = 10,
35
- LeftParen = 67174411,
36
- LeftBrace = 2162700,
37
- Period = 67108877,
38
- Ellipsis = 14,
39
- RightBrace = 1074790415,
40
- RightParen = 16,
41
- Semicolon = 1074790417,
42
- Comma = 18,
43
- LeftBracket = 69271571,
44
- RightBracket = 20,
45
- Colon = 21,
46
- QuestionMark = 22,
47
- SingleQuote = 23,
48
- DoubleQuote = 24,
49
- JSXClose = 25,
50
- JSXAutoClose = 26,
51
- Increment = 33619995,
52
- Decrement = 33619996,
53
- Assign = 1077936157,
54
- ShiftLeftAssign = 4194334,
55
- ShiftRightAssign = 4194335,
56
- LogicalShiftRightAssign = 4194336,
57
- ExponentiateAssign = 4194337,
58
- AddAssign = 4194338,
59
- SubtractAssign = 4194339,
60
- MultiplyAssign = 4194340,
61
- DivideAssign = 4259877,
62
- ModuloAssign = 4194342,
63
- BitwiseXorAssign = 4194343,
64
- BitwiseOrAssign = 4194344,
65
- BitwiseAndAssign = 4194345,
66
- LogicalOrAssign = 4194346,
67
- LogicalAndAssign = 4194347,
68
- CoalesceAssign = 4194348,
69
- TypeofKeyword = 16863277,
70
- DeleteKeyword = 16863278,
71
- VoidKeyword = 16863279,
72
- Negate = 16842800,
73
- Complement = 16842801,
74
- Add = 25233970,
75
- Subtract = 25233971,
76
- InKeyword = 8738868,
77
- InstanceofKeyword = 8476725,
78
- Multiply = 8457014,
79
- Modulo = 8457015,
80
- Divide = 8457016,
81
- Exponentiate = 8457273,
82
- LogicalAnd = 8979258,
83
- LogicalOr = 8979003,
84
- StrictEqual = 8455996,
85
- StrictNotEqual = 8455997,
86
- LooseEqual = 8455998,
87
- LooseNotEqual = 8455999,
88
- LessThanOrEqual = 8456256,
89
- GreaterThanOrEqual = 8456257,
90
- LessThan = 8456258,
91
- GreaterThan = 8456259,
92
- ShiftLeft = 8456516,
93
- ShiftRight = 8456517,
94
- LogicalShiftRight = 8456518,
95
- BitwiseAnd = 8455751,
96
- BitwiseOr = 8455240,
97
- BitwiseXor = 8455497,
98
- VarKeyword = 86090,
99
- LetKeyword = 241739,
100
- ConstKeyword = 86092,
101
- BreakKeyword = 20557,
102
- CaseKeyword = 20558,
103
- CatchKeyword = 20559,
104
- ClassKeyword = 86096,
105
- ContinueKeyword = 20561,
106
- DebuggerKeyword = 20562,
107
- DefaultKeyword = 20563,
108
- DoKeyword = 20564,
109
- ElseKeyword = 20565,
110
- ExportKeyword = 20566,
111
- ExtendsKeyword = 20567,
112
- FinallyKeyword = 20568,
113
- ForKeyword = 20569,
114
- FunctionKeyword = 86106,
115
- IfKeyword = 20571,
116
- ImportKeyword = 86108,
117
- NewKeyword = 86109,
118
- ReturnKeyword = 20574,
119
- SuperKeyword = 86111,
120
- SwitchKeyword = 86112,
121
- ThisKeyword = 86113,
122
- ThrowKeyword = 86114,
123
- TryKeyword = 20579,
124
- WhileKeyword = 20580,
125
- WithKeyword = 20581,
126
- ImplementsKeyword = 36966,
127
- InterfaceKeyword = 36967,
128
- PackageKeyword = 36968,
129
- PrivateKeyword = 36969,
130
- ProtectedKeyword = 36970,
131
- PublicKeyword = 36971,
132
- StaticKeyword = 36972,
133
- YieldKeyword = 241773,
134
- AsKeyword = 77934,
135
- AsyncKeyword = 209007,
136
- AwaitKeyword = 209008,
137
- ConstructorKeyword = 12401,
138
- GetKeyword = 12402,
139
- SetKeyword = 12403,
140
- FromKeyword = 12404,
141
- OfKeyword = 274549,
142
- EnumKeyword = 86134,
143
- Eval = 537079927,
144
- Arguments = 537079928,
145
- EscapedReserved = 121,
146
- EscapedFutureReserved = 122,
147
- AnyIdentifier = 143483,
148
- PrivateIdentifier = 124,
149
- BigIntLiteral = 134283389,
150
- Coalesce = 276889982,
151
- QuestionMarkPeriod = 67108991,
152
- WhiteSpace = 128,
153
- Illegal = 129,
154
- CarriageReturn = 130,
155
- PrivateField = 131,
156
- Template = 132,
157
- Decorator = 133,
158
- Target = 143494,
159
- Meta = 143495,
160
- LineFeed = 136,
161
- EscapedIdentifier = 137,
162
- JSXText = 138
163
- }
164
- export declare const KeywordDescTable: string[];
165
- export declare const descKeywordTable: {
166
- [key: string]: Token;
167
- };
1
+ export declare const enum Token {
2
+ Type = 255,
3
+ PrecStart = 8,
4
+ Precedence = 3840,
5
+ Keyword = 4096,
6
+ Contextual = 12288,
7
+ Reserved = 20480,
8
+ FutureReserved = 36864,
9
+ IsExpressionStart = 65536,
10
+ IsIdentifier = 143360,
11
+ IsInOrOf = 262144,
12
+ IsLogical = 524288,
13
+ IsAutoSemicolon = 1048576,
14
+ IsPatternStart = 2097152,
15
+ IsAssignOp = 4194304,
16
+ IsBinaryOp = 8454144,
17
+ IsUnaryOp = 16842752,
18
+ IsUpdateOp = 33619968,
19
+ IsMemberOrCallExpression = 67108864,
20
+ IsStringOrNumber = 134217728,
21
+ IsCoalesc = 268435456,
22
+ IsEvalOrArguments = 537079808,
23
+ IsClassField = 1073741824,
24
+ EOF = 1048576,
25
+ Identifier = 208897,
26
+ NumericLiteral = 134283266,
27
+ StringLiteral = 134283267,
28
+ RegularExpression = 65540,
29
+ FalseKeyword = 86021,
30
+ TrueKeyword = 86022,
31
+ NullKeyword = 86023,
32
+ TemplateContinuation = 67174408,
33
+ TemplateSpan = 67174409,
34
+ Arrow = 10,
35
+ LeftParen = 67174411,
36
+ LeftBrace = 2162700,
37
+ Period = 67108877,
38
+ Ellipsis = 14,
39
+ RightBrace = 1074790415,
40
+ RightParen = 16,
41
+ Semicolon = 1074790417,
42
+ Comma = 18,
43
+ LeftBracket = 69271571,
44
+ RightBracket = 20,
45
+ Colon = 21,
46
+ QuestionMark = 22,
47
+ SingleQuote = 23,
48
+ DoubleQuote = 24,
49
+ JSXClose = 25,
50
+ JSXAutoClose = 26,
51
+ Increment = 33619995,
52
+ Decrement = 33619996,
53
+ Assign = 1077936157,
54
+ ShiftLeftAssign = 4194334,
55
+ ShiftRightAssign = 4194335,
56
+ LogicalShiftRightAssign = 4194336,
57
+ ExponentiateAssign = 4194337,
58
+ AddAssign = 4194338,
59
+ SubtractAssign = 4194339,
60
+ MultiplyAssign = 4194340,
61
+ DivideAssign = 4259877,
62
+ ModuloAssign = 4194342,
63
+ BitwiseXorAssign = 4194343,
64
+ BitwiseOrAssign = 4194344,
65
+ BitwiseAndAssign = 4194345,
66
+ LogicalOrAssign = 4194346,
67
+ LogicalAndAssign = 4194347,
68
+ CoalesceAssign = 4194348,
69
+ TypeofKeyword = 16863277,
70
+ DeleteKeyword = 16863278,
71
+ VoidKeyword = 16863279,
72
+ Negate = 16842800,
73
+ Complement = 16842801,
74
+ Add = 25233970,
75
+ Subtract = 25233971,
76
+ InKeyword = 8738868,
77
+ InstanceofKeyword = 8476725,
78
+ Multiply = 8457014,
79
+ Modulo = 8457015,
80
+ Divide = 8457016,
81
+ Exponentiate = 8457273,
82
+ LogicalAnd = 8979258,
83
+ LogicalOr = 8979003,
84
+ StrictEqual = 8455996,
85
+ StrictNotEqual = 8455997,
86
+ LooseEqual = 8455998,
87
+ LooseNotEqual = 8455999,
88
+ LessThanOrEqual = 8456256,
89
+ GreaterThanOrEqual = 8456257,
90
+ LessThan = 8456258,
91
+ GreaterThan = 8456259,
92
+ ShiftLeft = 8456516,
93
+ ShiftRight = 8456517,
94
+ LogicalShiftRight = 8456518,
95
+ BitwiseAnd = 8455751,
96
+ BitwiseOr = 8455240,
97
+ BitwiseXor = 8455497,
98
+ VarKeyword = 86090,
99
+ LetKeyword = 241739,
100
+ ConstKeyword = 86092,
101
+ BreakKeyword = 20557,
102
+ CaseKeyword = 20558,
103
+ CatchKeyword = 20559,
104
+ ClassKeyword = 86096,
105
+ ContinueKeyword = 20561,
106
+ DebuggerKeyword = 20562,
107
+ DefaultKeyword = 20563,
108
+ DoKeyword = 20564,
109
+ ElseKeyword = 20565,
110
+ ExportKeyword = 20566,
111
+ ExtendsKeyword = 20567,
112
+ FinallyKeyword = 20568,
113
+ ForKeyword = 20569,
114
+ FunctionKeyword = 86106,
115
+ IfKeyword = 20571,
116
+ ImportKeyword = 86108,
117
+ NewKeyword = 86109,
118
+ ReturnKeyword = 20574,
119
+ SuperKeyword = 86111,
120
+ SwitchKeyword = 86112,
121
+ ThisKeyword = 86113,
122
+ ThrowKeyword = 86114,
123
+ TryKeyword = 20579,
124
+ WhileKeyword = 20580,
125
+ WithKeyword = 20581,
126
+ ImplementsKeyword = 36966,
127
+ InterfaceKeyword = 36967,
128
+ PackageKeyword = 36968,
129
+ PrivateKeyword = 36969,
130
+ ProtectedKeyword = 36970,
131
+ PublicKeyword = 36971,
132
+ StaticKeyword = 36972,
133
+ YieldKeyword = 241773,
134
+ AsKeyword = 77934,
135
+ AsyncKeyword = 209007,
136
+ AwaitKeyword = 209008,
137
+ ConstructorKeyword = 12401,
138
+ GetKeyword = 12402,
139
+ SetKeyword = 12403,
140
+ FromKeyword = 12404,
141
+ OfKeyword = 274549,
142
+ EnumKeyword = 86134,
143
+ Eval = 537079927,
144
+ Arguments = 537079928,
145
+ EscapedReserved = 121,
146
+ EscapedFutureReserved = 122,
147
+ AnyIdentifier = 143483,
148
+ PrivateIdentifier = 124,
149
+ BigIntLiteral = 134283389,
150
+ Coalesce = 276889982,
151
+ QuestionMarkPeriod = 67108991,
152
+ WhiteSpace = 128,
153
+ Illegal = 129,
154
+ CarriageReturn = 130,
155
+ PrivateField = 131,
156
+ Template = 132,
157
+ Decorator = 133,
158
+ Target = 143494,
159
+ Meta = 143495,
160
+ LineFeed = 136,
161
+ EscapedIdentifier = 137,
162
+ JSXText = 138
163
+ }
164
+ export declare const KeywordDescTable: string[];
165
+ export declare const descKeywordTable: {
166
+ [key: string]: Token;
167
+ };
168
168
  //# sourceMappingURL=token.d.ts.map
@@ -1,6 +1,6 @@
1
- declare function isIDContinue(code: number): boolean;
2
- declare function isIDStart(code: number): boolean;
3
- declare function mustEscape(code: number): boolean;
4
- export declare const unicodeLookup: Uint32Array;
5
- export { isIDContinue, isIDStart, mustEscape };
1
+ declare function isIDContinue(code: number): boolean;
2
+ declare function isIDStart(code: number): boolean;
3
+ declare function mustEscape(code: number): boolean;
4
+ export declare const unicodeLookup: Uint32Array;
5
+ export { isIDContinue, isIDStart, mustEscape };
6
6
  //# sourceMappingURL=unicode.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meriyah",
3
- "version": "4.5.0",
3
+ "version": "5.0.0",
4
4
  "description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",
5
5
  "main": "dist/meriyah.cjs",
6
6
  "module": "dist/meriyah.esm.js",
@@ -62,11 +62,14 @@
62
62
  "scripts": {
63
63
  "build": "tsc",
64
64
  "build:watch": "tsc -w",
65
- "lint": "eslint \"{src,test}/**/*.{ts,js}\"",
66
- "prettier": "node ./scripts/prettier.js write-changed",
67
- "prettier-all": "node ./scripts/prettier.js write",
68
- "bundle": "rimraf dist && node scripts/bundle.js",
69
- "bundle:bench": "rimraf dist && node scripts/bundle.js bench",
65
+ "lint": "npm run lint:eslint && npm run lint:prettier",
66
+ "lint:eslint": "eslint",
67
+ "lint:prettier": "prettier . --check",
68
+ "fix": "npm run fix:eslint && npm run fix:prettier",
69
+ "fix:eslint": "eslint --fix",
70
+ "fix:prettier": "prettier . --write",
71
+ "bundle": "node scripts/bundle.js",
72
+ "bundle:bench": "node scripts/bundle.js bench",
70
73
  "test": "mocha --\"test/**/*.ts\"",
71
74
  "test-single": "mocha",
72
75
  "test:watch": "npm run test -- --watch --watch-extensions ts",
@@ -79,41 +82,43 @@
79
82
  "preversion": "npm test",
80
83
  "version": "standard-changelog && git add CHANGELOG.md",
81
84
  "postversion": "git push && git push --tags && npm publish",
82
- "prepare": "husky"
85
+ "prepare": "husky",
86
+ "generate-test262-whitelist": "node scripts/generate-test262-whitelist.js"
83
87
  },
84
88
  "devDependencies": {
89
+ "@eslint/js": "^9.4.0",
85
90
  "@rollup/plugin-json": "^6.1.0",
86
91
  "@rollup/plugin-terser": "^0.4.4",
87
- "@types/mocha": "^9.1.1",
88
- "@types/node": "^18.6.3",
89
- "@typescript-eslint/eslint-plugin": "^5.32.0",
90
- "@typescript-eslint/parser": "^5.32.0",
92
+ "@types/mocha": "^10.0.6",
93
+ "@types/node": "^20.14.2",
91
94
  "@unicode/unicode-15.1.0": "^1.5.2",
92
- "chalk": "^4.1.2",
93
95
  "coveralls": "^3.1.1",
94
96
  "cross-env": "^7.0.3",
95
- "eslint": "^8.21.0",
96
- "eslint-plugin-import": "^2.26.0",
97
- "eslint-plugin-node": "^11.1.0",
98
- "glob": "^8.0.3",
97
+ "eslint": "^9.7.0",
98
+ "eslint-plugin-import-x": "^3.0.1",
99
+ "eslint-plugin-n": "^17.8.1",
99
100
  "husky": "^9.0.11",
100
- "mocha": "^10.0.0",
101
+ "lint-staged": "^15.2.7",
102
+ "mocha": "^10.4.0",
101
103
  "nyc": "^15.1.0",
102
- "path": "^0.12.7",
103
- "prettier": "^2.7.1",
104
- "rimraf": "^3.0.2",
104
+ "prettier": "3.3.1",
105
105
  "rollup": "^4.18.0",
106
106
  "rollup-plugin-typescript2": "^0.36.0",
107
107
  "source-map-support": "^0.5.21",
108
- "standard-changelog": "^2.0.27",
109
- "test262-parser-tests": "0.0.5",
110
- "ts-node": "^10.9.1",
111
- "tsconfig-paths": "^4.0.0",
112
- "tslib": "^2.4.0",
113
- "typescript": "^4.7.4",
114
- "unexpected": "^13.0.0"
108
+ "standard-changelog": "^6.0.0",
109
+ "test262": "tc39/test262#880f8a5ba64d4e9df02e4c961e5abb9dec380f2b",
110
+ "test262-parser-runner": "^0.5.0",
111
+ "ts-node": "^10.9.2",
112
+ "tsconfig-paths": "^4.2.0",
113
+ "typescript": "^5.4.5",
114
+ "typescript-eslint": "rc-v8",
115
+ "unexpected": "^13.2.1"
115
116
  },
116
117
  "engines": {
117
118
  "node": ">=10.4.0"
119
+ },
120
+ "lint-staged": {
121
+ "*.{ts,mts,cts,js,mjs,cjs}": "eslint --fix",
122
+ "*": "prettier --write --ignore-unknown"
118
123
  }
119
124
  }