meriyah 7.3.2 → 7.4.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 +30 -0
- package/dist/meriyah.cjs +394 -2228
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +394 -2228
- package/dist/meriyah.umd.js +394 -2228
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +6 -5
- package/dist/types/estree.d.ts +37 -25
- package/dist/types/parser/parser.d.ts +5 -0
- package/dist/types/token.d.ts +2 -2
- package/package.json +1 -1
package/dist/types/common.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as ESTree from './estree.ts';
|
|
1
2
|
import { type Parser } from './parser/parser.ts';
|
|
2
3
|
import { Token } from './token.ts';
|
|
3
4
|
export declare const enum Context {
|
|
@@ -116,15 +117,15 @@ export declare function isValidStrictMode(parser: Parser, index: number, tokenIn
|
|
|
116
117
|
export declare function optionalBit(parser: Parser, context: Context, t: Token): 0 | 1;
|
|
117
118
|
export declare function consumeOpt(parser: Parser, context: Context, t: Token): boolean;
|
|
118
119
|
export declare function consume(parser: Parser, context: Context, t: Token): void;
|
|
119
|
-
export declare function reinterpretToPattern(parser: Parser, node:
|
|
120
|
+
export declare function reinterpretToPattern(parser: Parser, node: ESTree.Node): void;
|
|
120
121
|
export declare function validateBindingIdentifier(parser: Parser, context: Context, kind: BindingKind, t: Token, skipEvalArgCheck: 0 | 1): void;
|
|
121
122
|
export declare function validateFunctionName(parser: Parser, context: Context, t: Token): void;
|
|
122
123
|
export declare function isStrictReservedWord(parser: Parser, context: Context, t: Token): boolean;
|
|
123
|
-
export declare function isPropertyWithPrivateFieldKey(expr:
|
|
124
|
-
export declare function isValidLabel(parser: Parser, labels:
|
|
125
|
-
export declare function validateAndDeclareLabel(parser: Parser, labels:
|
|
124
|
+
export declare function isPropertyWithPrivateFieldKey(expr: ESTree.Expression): boolean;
|
|
125
|
+
export declare function isValidLabel(parser: Parser, labels: ESTree.Labels | undefined, name: string, isIterationStatement: 0 | 1): 0 | 1;
|
|
126
|
+
export declare function validateAndDeclareLabel(parser: Parser, labels: ESTree.Labels, name: string): void;
|
|
126
127
|
export declare function isValidIdentifier(context: Context, t: Token): boolean;
|
|
127
|
-
export declare function classifyIdentifier(parser: Parser, context: Context, t: Token):
|
|
128
|
+
export declare function classifyIdentifier(parser: Parser, context: Context, t: Token): void;
|
|
128
129
|
export type Location = {
|
|
129
130
|
readonly index: number;
|
|
130
131
|
readonly line: number;
|
package/dist/types/estree.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export interface Position {
|
|
|
13
13
|
line: number;
|
|
14
14
|
column: number;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export interface Labels {
|
|
17
|
+
parent?: Labels;
|
|
18
|
+
loop?: 1;
|
|
19
|
+
names?: Set<string>;
|
|
20
|
+
}
|
|
17
21
|
export type IdentifierOrExpression = Identifier | Expression | ArrowFunctionExpression;
|
|
18
22
|
export type ArgumentExpression = ArrayExpression | AssignmentExpression | ConditionalExpression | Literal | SpreadElement | BinaryExpression | LogicalExpression | SequenceExpression;
|
|
19
23
|
export type CommentType = 'SingleLine' | 'MultiLine' | 'HTMLOpen' | 'HTMLClose' | 'HashbangComment';
|
|
@@ -27,21 +31,22 @@ export type ClassElement = FunctionExpression | MethodDefinition;
|
|
|
27
31
|
export type DeclarationStatement = ClassDeclaration | ClassExpression | ExportDefaultDeclaration | ExportAllDeclaration | ExportNamedDeclaration | FunctionDeclaration;
|
|
28
32
|
export type EntityName = Identifier;
|
|
29
33
|
export type ExportDeclaration = ClassDeclaration | ClassExpression | FunctionDeclaration | VariableDeclaration;
|
|
30
|
-
export type Expression = ArrowFunctionExpression | AssignmentExpression | BinaryExpression | ConditionalExpression | MetaProperty | ChainExpression |
|
|
34
|
+
export type Expression = ArrowFunctionExpression | AssignmentExpression | BinaryExpression | ConditionalExpression | MetaProperty | ChainExpression | LogicalExpression | NewExpression | SequenceExpression | AwaitExpression | LeftHandSideExpression | UnaryExpression | UpdateExpression | YieldExpression;
|
|
31
35
|
export type ForInitializer = Expression | VariableDeclaration;
|
|
32
36
|
export type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier;
|
|
33
37
|
export type IterationStatement = DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | WhileStatement;
|
|
34
38
|
export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
|
|
35
39
|
export type JSXExpression = JSXEmptyExpression | JSXSpreadChild | JSXExpressionContainer;
|
|
36
40
|
export type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
|
|
37
|
-
export type LeftHandSideExpression = CallExpression | ChainExpression | ImportExpression | ClassExpression |
|
|
41
|
+
export type LeftHandSideExpression = CallExpression | ChainExpression | ImportExpression | ClassExpression | FunctionExpression | LiteralExpression | MemberExpression | PrimaryExpression | TaggedTemplateExpression;
|
|
38
42
|
export type LiteralExpression = Literal | TemplateLiteral;
|
|
43
|
+
export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
|
|
39
44
|
export type ObjectLiteralElementLike = MethodDefinition | Property | RestElement | SpreadElement;
|
|
40
45
|
export type Parameter = AssignmentPattern | RestElement | ArrayPattern | ObjectPattern | Identifier;
|
|
41
|
-
export type PrimaryExpression = ArrayExpression |
|
|
46
|
+
export type PrimaryExpression = ArrayExpression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | Literal | LiteralExpression | MetaProperty | ObjectExpression | TemplateLiteral | ThisExpression;
|
|
42
47
|
export type PrimaryExpressionExtended = ArrayExpression | ArrowFunctionExpression | ArrayPattern | AwaitExpression | Expression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | JSXOpeningElement | Literal | LiteralExpression | MetaProperty | ObjectExpression | ObjectPattern | PrivateIdentifier | NewExpression | Super | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression;
|
|
43
48
|
export type PropertyName = Identifier | Literal;
|
|
44
|
-
export type Statement = BlockStatement | BreakStatement |
|
|
49
|
+
export type Statement = BlockStatement | BreakStatement | ClassDeclaration | ContinueStatement | DebuggerStatement | EmptyStatement | ExpressionStatement | FunctionDeclaration | IfStatement | IterationStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WithStatement;
|
|
45
50
|
interface ClassDeclarationBase extends _Node {
|
|
46
51
|
id: Identifier | null;
|
|
47
52
|
body: ClassBody;
|
|
@@ -64,7 +69,7 @@ export interface ArrayExpression extends _Node {
|
|
|
64
69
|
}
|
|
65
70
|
export interface ArrayPattern extends _Node {
|
|
66
71
|
type: 'ArrayPattern';
|
|
67
|
-
elements:
|
|
72
|
+
elements: (Pattern | null)[];
|
|
68
73
|
}
|
|
69
74
|
export interface ArrowFunctionExpression extends _Node {
|
|
70
75
|
type: 'ArrowFunctionExpression';
|
|
@@ -74,10 +79,11 @@ export interface ArrowFunctionExpression extends _Node {
|
|
|
74
79
|
expression: boolean;
|
|
75
80
|
generator: false;
|
|
76
81
|
}
|
|
82
|
+
export type AssignmentOperator = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '**=' | '<<=' | '>>=' | '>>>=' | '|=' | '^=' | '&=' | '||=' | '&&=' | '??=';
|
|
77
83
|
export interface AssignmentExpression extends _Node {
|
|
78
84
|
type: 'AssignmentExpression';
|
|
79
|
-
operator:
|
|
80
|
-
left:
|
|
85
|
+
operator: AssignmentOperator;
|
|
86
|
+
left: Pattern | MemberExpression | CallExpression;
|
|
81
87
|
right: Expression;
|
|
82
88
|
}
|
|
83
89
|
export interface AssignmentPattern extends _Node {
|
|
@@ -89,9 +95,10 @@ export interface AwaitExpression extends _Node {
|
|
|
89
95
|
type: 'AwaitExpression';
|
|
90
96
|
argument: Expression;
|
|
91
97
|
}
|
|
98
|
+
export type BinaryOperator = '==' | '!=' | '===' | '!==' | '<' | '<=' | '>' | '>=' | '<<' | '>>' | '>>>' | '+' | '-' | '*' | '/' | '%' | '**' | '|' | '^' | '&' | 'in' | 'instanceof';
|
|
92
99
|
export interface BinaryExpression extends _Node {
|
|
93
100
|
type: 'BinaryExpression';
|
|
94
|
-
operator:
|
|
101
|
+
operator: BinaryOperator;
|
|
95
102
|
left: Expression | PrivateIdentifier;
|
|
96
103
|
right: Expression;
|
|
97
104
|
}
|
|
@@ -114,7 +121,7 @@ export interface ChainExpression extends _Node {
|
|
|
114
121
|
}
|
|
115
122
|
export interface CallExpression extends _Node {
|
|
116
123
|
type: 'CallExpression';
|
|
117
|
-
callee:
|
|
124
|
+
callee: Expression | Super;
|
|
118
125
|
arguments: (Expression | SpreadElement)[];
|
|
119
126
|
optional: boolean;
|
|
120
127
|
}
|
|
@@ -133,7 +140,7 @@ export interface ClassBody extends _Node {
|
|
|
133
140
|
export interface AccessorProperty extends _Node {
|
|
134
141
|
type: 'AccessorProperty';
|
|
135
142
|
key: PrivateIdentifier | Expression;
|
|
136
|
-
value:
|
|
143
|
+
value: Expression | null;
|
|
137
144
|
decorators?: Decorator[];
|
|
138
145
|
computed: boolean;
|
|
139
146
|
static: boolean;
|
|
@@ -141,7 +148,7 @@ export interface AccessorProperty extends _Node {
|
|
|
141
148
|
export interface PropertyDefinition extends _Node {
|
|
142
149
|
type: 'PropertyDefinition';
|
|
143
150
|
key: PrivateIdentifier | Expression;
|
|
144
|
-
value:
|
|
151
|
+
value: Expression | null;
|
|
145
152
|
decorators?: Decorator[];
|
|
146
153
|
computed: boolean;
|
|
147
154
|
static: boolean;
|
|
@@ -210,13 +217,13 @@ export interface ExpressionStatement extends _Node {
|
|
|
210
217
|
}
|
|
211
218
|
export interface ForInStatement extends _Node {
|
|
212
219
|
type: 'ForInStatement';
|
|
213
|
-
left:
|
|
220
|
+
left: VariableDeclaration | Pattern | CallExpression;
|
|
214
221
|
right: Expression;
|
|
215
222
|
body: Statement;
|
|
216
223
|
}
|
|
217
224
|
export interface ForOfStatement extends _Node {
|
|
218
225
|
type: 'ForOfStatement';
|
|
219
|
-
left:
|
|
226
|
+
left: VariableDeclaration | Pattern | CallExpression;
|
|
220
227
|
right: Expression;
|
|
221
228
|
body: Statement;
|
|
222
229
|
await: boolean;
|
|
@@ -271,7 +278,7 @@ export interface ImportSpecifier extends _Node {
|
|
|
271
278
|
}
|
|
272
279
|
export interface JSXNamespacedName extends _Node {
|
|
273
280
|
type: 'JSXNamespacedName';
|
|
274
|
-
namespace: JSXIdentifier
|
|
281
|
+
namespace: JSXIdentifier;
|
|
275
282
|
name: JSXIdentifier;
|
|
276
283
|
}
|
|
277
284
|
export type JSXAttributeValue = JSXIdentifier | Literal | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild | null;
|
|
@@ -312,7 +319,7 @@ export interface JSXIdentifier extends _Node {
|
|
|
312
319
|
}
|
|
313
320
|
export interface JSXMemberExpression extends _Node {
|
|
314
321
|
type: 'JSXMemberExpression';
|
|
315
|
-
object:
|
|
322
|
+
object: JSXIdentifier | JSXMemberExpression;
|
|
316
323
|
property: JSXIdentifier;
|
|
317
324
|
}
|
|
318
325
|
export interface JSXOpeningElement extends _Node {
|
|
@@ -370,9 +377,10 @@ export interface RegExpLiteral extends _LiteralBase {
|
|
|
370
377
|
flags: string;
|
|
371
378
|
};
|
|
372
379
|
}
|
|
380
|
+
export type LogicalOperator = '||' | '&&' | '??';
|
|
373
381
|
export interface LogicalExpression extends _Node {
|
|
374
382
|
type: 'LogicalExpression';
|
|
375
|
-
operator:
|
|
383
|
+
operator: LogicalOperator;
|
|
376
384
|
left: Expression;
|
|
377
385
|
right: Expression;
|
|
378
386
|
}
|
|
@@ -401,7 +409,7 @@ export interface MethodDefinition extends _Node {
|
|
|
401
409
|
export interface NewExpression extends _Node {
|
|
402
410
|
type: 'NewExpression';
|
|
403
411
|
callee: LeftHandSideExpression;
|
|
404
|
-
arguments: Expression[];
|
|
412
|
+
arguments: (Expression | SpreadElement)[];
|
|
405
413
|
}
|
|
406
414
|
export interface ObjectExpression extends _Node {
|
|
407
415
|
type: 'ObjectExpression';
|
|
@@ -409,11 +417,11 @@ export interface ObjectExpression extends _Node {
|
|
|
409
417
|
}
|
|
410
418
|
export interface ObjectPattern extends _Node {
|
|
411
419
|
type: 'ObjectPattern';
|
|
412
|
-
properties:
|
|
420
|
+
properties: (AssignmentProperty | RestElement)[];
|
|
413
421
|
}
|
|
414
422
|
export interface Program extends _Node {
|
|
415
423
|
type: 'Program';
|
|
416
|
-
body: Statement[];
|
|
424
|
+
body: (Statement | ModuleDeclaration)[];
|
|
417
425
|
sourceType: 'module' | 'script';
|
|
418
426
|
}
|
|
419
427
|
export interface ParenthesizedExpression extends _Node {
|
|
@@ -423,15 +431,20 @@ export interface ParenthesizedExpression extends _Node {
|
|
|
423
431
|
export interface Property extends _Node {
|
|
424
432
|
type: 'Property';
|
|
425
433
|
key: Expression;
|
|
426
|
-
value: Expression |
|
|
434
|
+
value: Expression | Pattern;
|
|
427
435
|
computed: boolean;
|
|
428
436
|
method: boolean;
|
|
429
437
|
shorthand: boolean;
|
|
430
438
|
kind: 'init' | 'get' | 'set';
|
|
431
439
|
}
|
|
440
|
+
export interface AssignmentProperty extends Property {
|
|
441
|
+
value: Pattern;
|
|
442
|
+
kind: 'init';
|
|
443
|
+
method: boolean;
|
|
444
|
+
}
|
|
432
445
|
export interface RestElement extends _Node {
|
|
433
446
|
type: 'RestElement';
|
|
434
|
-
argument:
|
|
447
|
+
argument: Pattern | CallExpression;
|
|
435
448
|
value?: AssignmentPattern;
|
|
436
449
|
}
|
|
437
450
|
export interface ReturnStatement extends _Node {
|
|
@@ -442,10 +455,9 @@ export interface SequenceExpression extends _Node {
|
|
|
442
455
|
type: 'SequenceExpression';
|
|
443
456
|
expressions: Expression[];
|
|
444
457
|
}
|
|
445
|
-
export type SpreadArgument = BindingPattern | Identifier | Expression | PropertyName | SpreadElement;
|
|
446
458
|
export interface SpreadElement extends _Node {
|
|
447
459
|
type: 'SpreadElement';
|
|
448
|
-
argument:
|
|
460
|
+
argument: Expression;
|
|
449
461
|
}
|
|
450
462
|
export interface Super extends _Node {
|
|
451
463
|
type: 'Super';
|
|
@@ -512,7 +524,7 @@ export interface VariableDeclaration extends _Node {
|
|
|
512
524
|
}
|
|
513
525
|
export interface VariableDeclarator extends _Node {
|
|
514
526
|
type: 'VariableDeclarator';
|
|
515
|
-
id:
|
|
527
|
+
id: BindingPattern;
|
|
516
528
|
init: Expression | null;
|
|
517
529
|
definite?: boolean;
|
|
518
530
|
}
|
|
@@ -39,6 +39,10 @@ export declare class Parser {
|
|
|
39
39
|
start: Location;
|
|
40
40
|
end: Location;
|
|
41
41
|
} | null;
|
|
42
|
+
firstYieldLocation: {
|
|
43
|
+
start: Location;
|
|
44
|
+
end: Location;
|
|
45
|
+
} | null;
|
|
42
46
|
leadingDecorators: {
|
|
43
47
|
start?: Location;
|
|
44
48
|
decorators: ESTree.Decorator[];
|
|
@@ -47,6 +51,7 @@ export declare class Parser {
|
|
|
47
51
|
getToken(): Token;
|
|
48
52
|
setToken(value: Token, replaceLast?: boolean): Token;
|
|
49
53
|
get tokenStart(): Location;
|
|
54
|
+
get startPosition(): Location;
|
|
50
55
|
get currentLocation(): Location;
|
|
51
56
|
finishNode<T extends ESTree.Node>(node: T, start: Location, end: Location | void): T;
|
|
52
57
|
addBindingToExports(name: string): void;
|
package/dist/types/token.d.ts
CHANGED
|
@@ -133,10 +133,10 @@ export declare const enum Token {
|
|
|
133
133
|
AsKeyword = 77932,
|
|
134
134
|
AsyncKeyword = 209005,
|
|
135
135
|
AwaitKeyword = 209006,
|
|
136
|
-
ConstructorKeyword =
|
|
136
|
+
ConstructorKeyword = 209007,
|
|
137
137
|
GetKeyword = 209008,
|
|
138
138
|
SetKeyword = 209009,
|
|
139
|
-
AccessorKeyword =
|
|
139
|
+
AccessorKeyword = 209010,
|
|
140
140
|
FromKeyword = 209011,
|
|
141
141
|
OfKeyword = 471156,
|
|
142
142
|
UsingKeyword = 209013,
|
package/package.json
CHANGED