yuku-parser 0.4.2 → 0.4.4

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 (4) hide show
  1. package/README.md +11 -9
  2. package/index.d.ts +636 -372
  3. package/index.js +2 -2
  4. package/package.json +16 -16
package/README.md CHANGED
@@ -15,8 +15,8 @@ import { parse } from "yuku-parser";
15
15
 
16
16
  const result = parse("const x = 1 + 2;");
17
17
 
18
- console.log(result.program); // ESTree / TypeScript-ESTree Program node
19
- console.log(result.comments); // all comments
18
+ console.log(result.program); // ESTree / TypeScript-ESTree Program node
19
+ console.log(result.comments); // all comments
20
20
  console.log(result.diagnostics); // errors and warnings
21
21
  ```
22
22
 
@@ -75,17 +75,19 @@ All options are optional.
75
75
  const result = parse(source, {
76
76
  sourceType: "module",
77
77
  lang: "jsx",
78
- preserveParens: false,
78
+ preserveParens: true,
79
+ allowReturnOutsideFunction: false,
79
80
  semanticErrors: false,
80
81
  });
81
82
  ```
82
83
 
83
- | Option | Values | Default | Description |
84
- |--------|--------|---------|-------------|
85
- | `sourceType` | `"module"`, `"script"` | `"module"` | Module mode enables `import`/`export`, `import.meta`, top-level `await`, and strict mode. |
86
- | `lang` | `"js"`, `"ts"`, `"jsx"`, `"tsx"`, `"dts"` | `"js"` | Language variant controls which syntax extensions are enabled. |
87
- | `preserveParens` | `true`, `false` | `false` | Keep `ParenthesizedExpression` nodes in the AST. When false, parentheses are stripped and only the inner expression is kept. |
88
- | `semanticErrors` | `true`, `false` | `false` | Run semantic analysis and report semantic errors alongside syntax errors. |
84
+ | Option | Values | Default | Description |
85
+ | ---------------- | ----------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
86
+ | `sourceType` | `"module"`, `"script"` | `"module"` | Module mode enables `import`/`export`, `import.meta`, top-level `await`, and strict mode. |
87
+ | `lang` | `"js"`, `"ts"`, `"jsx"`, `"tsx"`, `"dts"` | `"js"` | Language variant controls which syntax extensions are enabled. |
88
+ | `preserveParens` | `true`, `false` | `true` | Keep `ParenthesizedExpression` nodes in the AST. When false, parentheses are stripped and only the inner expression is kept. |
89
+ | `allowReturnOutsideFunction` | `true`, `false` | `false` | Allow `return` statements outside of functions, at the top level. |
90
+ | `semanticErrors` | `true`, `false` | `false` | Run semantic analysis and report semantic errors alongside syntax errors. |
89
91
 
90
92
  ## Result
91
93
 
package/index.d.ts CHANGED
@@ -6,53 +6,53 @@ type SourceLang = "js" | "ts" | "jsx" | "tsx" | "dts";
6
6
 
7
7
  /** Options for configuring the parser. */
8
8
  interface ParseOptions {
9
- /**
10
- * Parse as a classic script or an ES module.
11
- * Module mode enables `import`/`export`, `import.meta`, top-level `await`,
12
- * and strict mode.
13
- * @default "module"
14
- */
15
- sourceType?: SourceType;
16
- /**
17
- * Language variant controls which syntax extensions are enabled.
18
- * @default "js"
19
- */
20
- lang?: SourceLang;
21
- /**
22
- * When true, parenthesized expressions are represented as
23
- * `ParenthesizedExpression` nodes in the AST. When false,
24
- * parentheses are stripped and only the inner expression is kept.
25
- * @default false
26
- */
27
- preserveParens?: boolean;
28
- /**
29
- * Run semantic analysis after parsing and include semantic errors
30
- * (e.g. duplicate declarations, invalid `break`/`continue` targets)
31
- * alongside syntax errors. This requires a separate AST pass and may
32
- * affect performance slightly.
33
- * @default false
34
- */
35
- semanticErrors?: boolean;
9
+ /**
10
+ * Parse as a classic script or an ES module.
11
+ * Module mode enables `import`/`export`, `import.meta`, top-level `await`,
12
+ * and strict mode.
13
+ * @default "module"
14
+ */
15
+ sourceType?: SourceType;
16
+ /**
17
+ * Language variant controls which syntax extensions are enabled.
18
+ * @default "js"
19
+ */
20
+ lang?: SourceLang;
21
+ /**
22
+ * When true, parenthesized expressions are represented as
23
+ * `ParenthesizedExpression` nodes in the AST. When false,
24
+ * parentheses are stripped and only the inner expression is kept.
25
+ * @default false
26
+ */
27
+ preserveParens?: boolean;
28
+ /**
29
+ * Run semantic analysis after parsing and include semantic errors
30
+ * (e.g. duplicate declarations, invalid `break`/`continue` targets)
31
+ * alongside syntax errors. This requires a separate AST pass and may
32
+ * affect performance slightly.
33
+ * @default false
34
+ */
35
+ semanticErrors?: boolean;
36
36
  }
37
37
 
38
38
  /** A source code comment. */
39
39
  interface Comment {
40
- type: "Line" | "Block";
41
- /** Comment text without the delimiters. */
42
- value: string;
43
- /** Byte offset. */
44
- start: number;
45
- /** Byte offset. */
46
- end: number;
40
+ type: "Line" | "Block";
41
+ /** Comment text without the delimiters. */
42
+ value: string;
43
+ /** Byte offset. */
44
+ start: number;
45
+ /** Byte offset. */
46
+ end: number;
47
47
  }
48
48
 
49
49
  /** A labeled source span attached to a {@link Diagnostic}. */
50
50
  interface DiagnosticLabel {
51
- /** Byte offset. */
52
- start: number;
53
- /** Byte offset. */
54
- end: number;
55
- message: string;
51
+ /** Byte offset. */
52
+ start: number;
53
+ /** Byte offset. */
54
+ end: number;
55
+ message: string;
56
56
  }
57
57
 
58
58
  /**
@@ -60,26 +60,26 @@ interface DiagnosticLabel {
60
60
  * The parser is error tolerant: an AST is always produced even when diagnostics exist.
61
61
  */
62
62
  interface Diagnostic {
63
- severity: "error" | "warning" | "hint" | "info";
64
- message: string;
65
- /** Fix suggestion, or `null` if unavailable. */
66
- help: string | null;
67
- /** Byte offset. */
68
- start: number;
69
- /** Byte offset. */
70
- end: number;
71
- /** Additional source spans providing context. */
72
- labels: DiagnosticLabel[];
63
+ severity: "error" | "warning" | "hint" | "info";
64
+ message: string;
65
+ /** Fix suggestion, or `null` if unavailable. */
66
+ help: string | null;
67
+ /** Byte offset. */
68
+ start: number;
69
+ /** Byte offset. */
70
+ end: number;
71
+ /** Additional source spans providing context. */
72
+ labels: DiagnosticLabel[];
73
73
  }
74
74
 
75
75
  /** The result returned by the parser. */
76
76
  interface ParseResult {
77
- /** Root ESTree/TypeScript-ESTree AST node. */
78
- program: Program;
79
- /** All comments in source order. */
80
- comments: Comment[];
81
- /** Syntax diagnostics, and semantic diagnostics when {@link ParseOptions.semanticErrors} is enabled. */
82
- diagnostics: Diagnostic[];
77
+ /** Root ESTree/TypeScript-ESTree AST node. */
78
+ program: Program;
79
+ /** All comments in source order. */
80
+ comments: Comment[];
81
+ /** Syntax diagnostics, and semantic diagnostics when {@link ParseOptions.semanticErrors} is enabled. */
82
+ diagnostics: Diagnostic[];
83
83
  }
84
84
 
85
85
  /**
@@ -90,539 +90,803 @@ export function parse(source: string, options?: ParseOptions): ParseResult;
90
90
  // AST node types
91
91
 
92
92
  interface BaseNode {
93
- start: number;
94
- end: number;
93
+ start: number;
94
+ end: number;
95
95
  }
96
96
 
97
- type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "<<" | ">>" | ">>>" | "in" | "instanceof";
97
+ type BinaryOperator =
98
+ | "=="
99
+ | "!="
100
+ | "==="
101
+ | "!=="
102
+ | "<"
103
+ | "<="
104
+ | ">"
105
+ | ">="
106
+ | "+"
107
+ | "-"
108
+ | "*"
109
+ | "/"
110
+ | "%"
111
+ | "**"
112
+ | "|"
113
+ | "^"
114
+ | "&"
115
+ | "<<"
116
+ | ">>"
117
+ | ">>>"
118
+ | "in"
119
+ | "instanceof";
98
120
  type LogicalOperator = "&&" | "||" | "??";
99
121
  type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
100
122
  type UpdateOperator = "++" | "--";
101
- type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
123
+ type AssignmentOperator =
124
+ | "="
125
+ | "+="
126
+ | "-="
127
+ | "*="
128
+ | "/="
129
+ | "%="
130
+ | "**="
131
+ | "<<="
132
+ | ">>="
133
+ | ">>>="
134
+ | "|="
135
+ | "^="
136
+ | "&="
137
+ | "||="
138
+ | "&&="
139
+ | "??=";
102
140
 
103
141
  interface Identifier extends BaseNode {
104
- type: "Identifier";
105
- name: string;
142
+ type: "Identifier";
143
+ name: string;
106
144
  }
107
145
  interface PrivateIdentifier extends BaseNode {
108
- type: "PrivateIdentifier";
109
- name: string;
146
+ type: "PrivateIdentifier";
147
+ name: string;
110
148
  }
111
149
  interface StringLiteral extends BaseNode {
112
- type: "Literal";
113
- value: string;
114
- raw: string;
150
+ type: "Literal";
151
+ value: string;
152
+ raw: string;
115
153
  }
116
154
  interface NumericLiteral extends BaseNode {
117
- type: "Literal";
118
- value: number | null;
119
- raw: string;
155
+ type: "Literal";
156
+ value: number | null;
157
+ raw: string;
120
158
  }
121
159
  interface BigIntLiteral extends BaseNode {
122
- type: "Literal";
123
- value: bigint;
124
- raw: string;
125
- bigint: string;
160
+ type: "Literal";
161
+ value: bigint;
162
+ raw: string;
163
+ bigint: string;
126
164
  }
127
165
  interface BooleanLiteral extends BaseNode {
128
- type: "Literal";
129
- value: boolean;
130
- raw: string;
166
+ type: "Literal";
167
+ value: boolean;
168
+ raw: string;
131
169
  }
132
170
  interface NullLiteral extends BaseNode {
133
- type: "Literal";
134
- value: null;
135
- raw: "null";
171
+ type: "Literal";
172
+ value: null;
173
+ raw: "null";
136
174
  }
137
175
  interface RegExpLiteral extends BaseNode {
138
- type: "Literal";
139
- value: RegExp | null;
140
- raw: string;
141
- regex: {
142
- pattern: string;
143
- flags: string;
144
- };
145
- }
146
- type Literal = StringLiteral | NumericLiteral | BigIntLiteral | BooleanLiteral | NullLiteral | RegExpLiteral;
176
+ type: "Literal";
177
+ value: RegExp | null;
178
+ raw: string;
179
+ regex: {
180
+ pattern: string;
181
+ flags: string;
182
+ };
183
+ }
184
+ type Literal =
185
+ | StringLiteral
186
+ | NumericLiteral
187
+ | BigIntLiteral
188
+ | BooleanLiteral
189
+ | NullLiteral
190
+ | RegExpLiteral;
147
191
  interface ArrayPattern extends BaseNode {
148
- type: "ArrayPattern";
149
- elements: Array<BindingPattern | RestElement | null>;
192
+ type: "ArrayPattern";
193
+ elements: Array<BindingPattern | RestElement | null>;
150
194
  }
151
195
  interface ObjectPattern extends BaseNode {
152
- type: "ObjectPattern";
153
- properties: Array<Property | RestElement>;
196
+ type: "ObjectPattern";
197
+ properties: Array<Property | RestElement>;
154
198
  }
155
199
  interface AssignmentPattern extends BaseNode {
156
- type: "AssignmentPattern";
157
- left: BindingPattern;
158
- right: Expression;
200
+ type: "AssignmentPattern";
201
+ left: BindingPattern;
202
+ right: Expression;
159
203
  }
160
204
  interface RestElement extends BaseNode {
161
- type: "RestElement";
162
- argument: BindingPattern;
205
+ type: "RestElement";
206
+ argument: BindingPattern;
163
207
  }
164
208
  type BindingPattern = Identifier | ArrayPattern | ObjectPattern | AssignmentPattern;
165
209
  type FunctionParameter = BindingPattern | RestElement;
166
210
  interface Property extends BaseNode {
167
- type: "Property";
168
- kind: "init" | "get" | "set";
169
- key: Expression;
170
- value: Expression | BindingPattern;
171
- method: boolean;
172
- shorthand: boolean;
173
- computed: boolean;
211
+ type: "Property";
212
+ kind: "init" | "get" | "set";
213
+ key: Expression;
214
+ value: Expression | BindingPattern;
215
+ method: boolean;
216
+ shorthand: boolean;
217
+ computed: boolean;
174
218
  }
175
219
  interface SequenceExpression extends BaseNode {
176
- type: "SequenceExpression";
177
- expressions: Expression[];
220
+ type: "SequenceExpression";
221
+ expressions: Expression[];
178
222
  }
179
223
  interface ParenthesizedExpression extends BaseNode {
180
- type: "ParenthesizedExpression";
181
- expression: Expression;
224
+ type: "ParenthesizedExpression";
225
+ expression: Expression;
182
226
  }
183
227
  interface BinaryExpression extends BaseNode {
184
- type: "BinaryExpression";
185
- left: Expression;
186
- operator: BinaryOperator;
187
- right: Expression;
228
+ type: "BinaryExpression";
229
+ left: Expression;
230
+ operator: BinaryOperator;
231
+ right: Expression;
188
232
  }
189
233
  interface LogicalExpression extends BaseNode {
190
- type: "LogicalExpression";
191
- left: Expression;
192
- operator: LogicalOperator;
193
- right: Expression;
234
+ type: "LogicalExpression";
235
+ left: Expression;
236
+ operator: LogicalOperator;
237
+ right: Expression;
194
238
  }
195
239
  interface ConditionalExpression extends BaseNode {
196
- type: "ConditionalExpression";
197
- test: Expression;
198
- consequent: Expression;
199
- alternate: Expression;
240
+ type: "ConditionalExpression";
241
+ test: Expression;
242
+ consequent: Expression;
243
+ alternate: Expression;
200
244
  }
201
245
  interface UnaryExpression extends BaseNode {
202
- type: "UnaryExpression";
203
- operator: UnaryOperator;
204
- prefix: true;
205
- argument: Expression;
246
+ type: "UnaryExpression";
247
+ operator: UnaryOperator;
248
+ prefix: true;
249
+ argument: Expression;
206
250
  }
207
251
  interface UpdateExpression extends BaseNode {
208
- type: "UpdateExpression";
209
- operator: UpdateOperator;
210
- prefix: boolean;
211
- argument: Expression;
252
+ type: "UpdateExpression";
253
+ operator: UpdateOperator;
254
+ prefix: boolean;
255
+ argument: Expression;
212
256
  }
213
257
  interface AssignmentExpression extends BaseNode {
214
- type: "AssignmentExpression";
215
- operator: AssignmentOperator;
216
- left: Expression | BindingPattern;
217
- right: Expression;
258
+ type: "AssignmentExpression";
259
+ operator: AssignmentOperator;
260
+ left: Expression | BindingPattern;
261
+ right: Expression;
218
262
  }
219
263
  interface YieldExpression extends BaseNode {
220
- type: "YieldExpression";
221
- delegate: boolean;
222
- argument: Expression | null;
264
+ type: "YieldExpression";
265
+ delegate: boolean;
266
+ argument: Expression | null;
223
267
  }
224
268
  interface AwaitExpression extends BaseNode {
225
- type: "AwaitExpression";
226
- argument: Expression;
269
+ type: "AwaitExpression";
270
+ argument: Expression;
227
271
  }
228
272
  interface ArrayExpression extends BaseNode {
229
- type: "ArrayExpression";
230
- elements: Array<Expression | SpreadElement | null>;
273
+ type: "ArrayExpression";
274
+ elements: Array<Expression | SpreadElement | null>;
231
275
  }
232
276
  interface ObjectExpression extends BaseNode {
233
- type: "ObjectExpression";
234
- properties: Array<Property | SpreadElement>;
277
+ type: "ObjectExpression";
278
+ properties: Array<Property | SpreadElement>;
235
279
  }
236
280
  interface SpreadElement extends BaseNode {
237
- type: "SpreadElement";
238
- argument: Expression;
281
+ type: "SpreadElement";
282
+ argument: Expression;
239
283
  }
240
284
  interface MemberExpression extends BaseNode {
241
- type: "MemberExpression";
242
- object: Expression | Super;
243
- property: Expression | PrivateIdentifier;
244
- computed: boolean;
245
- optional: boolean;
285
+ type: "MemberExpression";
286
+ object: Expression | Super;
287
+ property: Expression | PrivateIdentifier;
288
+ computed: boolean;
289
+ optional: boolean;
246
290
  }
247
291
  interface CallExpression extends BaseNode {
248
- type: "CallExpression";
249
- callee: Expression | Super;
250
- arguments: Array<Expression | SpreadElement>;
251
- optional: boolean;
292
+ type: "CallExpression";
293
+ callee: Expression | Super;
294
+ arguments: Array<Expression | SpreadElement>;
295
+ optional: boolean;
252
296
  }
253
297
  interface ChainExpression extends BaseNode {
254
- type: "ChainExpression";
255
- expression: CallExpression | MemberExpression;
298
+ type: "ChainExpression";
299
+ expression: CallExpression | MemberExpression;
256
300
  }
257
301
  interface TaggedTemplateExpression extends BaseNode {
258
- type: "TaggedTemplateExpression";
259
- tag: Expression;
260
- quasi: TemplateLiteral;
302
+ type: "TaggedTemplateExpression";
303
+ tag: Expression;
304
+ quasi: TemplateLiteral;
261
305
  }
262
306
  interface NewExpression extends BaseNode {
263
- type: "NewExpression";
264
- callee: Expression;
265
- arguments: Array<Expression | SpreadElement>;
307
+ type: "NewExpression";
308
+ callee: Expression;
309
+ arguments: Array<Expression | SpreadElement>;
266
310
  }
267
311
  interface MetaProperty extends BaseNode {
268
- type: "MetaProperty";
269
- meta: Identifier;
270
- property: Identifier;
312
+ type: "MetaProperty";
313
+ meta: Identifier;
314
+ property: Identifier;
271
315
  }
272
316
  interface ImportExpression extends BaseNode {
273
- type: "ImportExpression";
274
- source: Expression;
275
- options: Expression | null;
276
- phase: "source" | "defer" | null;
317
+ type: "ImportExpression";
318
+ source: Expression;
319
+ options: Expression | null;
320
+ phase: "source" | "defer" | null;
277
321
  }
278
322
  interface TemplateLiteral extends BaseNode {
279
- type: "TemplateLiteral";
280
- quasis: TemplateElement[];
281
- expressions: Expression[];
323
+ type: "TemplateLiteral";
324
+ quasis: TemplateElement[];
325
+ expressions: Expression[];
282
326
  }
283
327
  interface TemplateElement extends BaseNode {
284
- type: "TemplateElement";
285
- value: {
286
- raw: string;
287
- cooked: string | null;
288
- };
289
- tail: boolean;
328
+ type: "TemplateElement";
329
+ value: {
330
+ raw: string;
331
+ cooked: string | null;
332
+ };
333
+ tail: boolean;
290
334
  }
291
335
  interface Super extends BaseNode {
292
- type: "Super";
336
+ type: "Super";
293
337
  }
294
338
  interface ThisExpression extends BaseNode {
295
- type: "ThisExpression";
339
+ type: "ThisExpression";
296
340
  }
297
341
  interface ExpressionStatement extends BaseNode {
298
- type: "ExpressionStatement";
299
- expression: Expression;
300
- directive?: string;
342
+ type: "ExpressionStatement";
343
+ expression: Expression;
344
+ directive?: string;
301
345
  }
302
346
  interface BlockStatement extends BaseNode {
303
- type: "BlockStatement";
304
- body: Statement[];
347
+ type: "BlockStatement";
348
+ body: Statement[];
305
349
  }
306
350
  interface IfStatement extends BaseNode {
307
- type: "IfStatement";
308
- test: Expression;
309
- consequent: Statement;
310
- alternate: Statement | null;
351
+ type: "IfStatement";
352
+ test: Expression;
353
+ consequent: Statement;
354
+ alternate: Statement | null;
311
355
  }
312
356
  interface SwitchStatement extends BaseNode {
313
- type: "SwitchStatement";
314
- discriminant: Expression;
315
- cases: SwitchCase[];
357
+ type: "SwitchStatement";
358
+ discriminant: Expression;
359
+ cases: SwitchCase[];
316
360
  }
317
361
  interface SwitchCase extends BaseNode {
318
- type: "SwitchCase";
319
- test: Expression | null;
320
- consequent: Statement[];
362
+ type: "SwitchCase";
363
+ test: Expression | null;
364
+ consequent: Statement[];
321
365
  }
322
366
  interface ForStatement extends BaseNode {
323
- type: "ForStatement";
324
- init: VariableDeclaration | Expression | null;
325
- test: Expression | null;
326
- update: Expression | null;
327
- body: Statement;
367
+ type: "ForStatement";
368
+ init: VariableDeclaration | Expression | null;
369
+ test: Expression | null;
370
+ update: Expression | null;
371
+ body: Statement;
328
372
  }
329
373
  interface ForInStatement extends BaseNode {
330
- type: "ForInStatement";
331
- left: VariableDeclaration | Expression;
332
- right: Expression;
333
- body: Statement;
374
+ type: "ForInStatement";
375
+ left: VariableDeclaration | Expression;
376
+ right: Expression;
377
+ body: Statement;
334
378
  }
335
379
  interface ForOfStatement extends BaseNode {
336
- type: "ForOfStatement";
337
- left: VariableDeclaration | Expression;
338
- right: Expression;
339
- body: Statement;
340
- await: boolean;
380
+ type: "ForOfStatement";
381
+ left: VariableDeclaration | Expression;
382
+ right: Expression;
383
+ body: Statement;
384
+ await: boolean;
341
385
  }
342
386
  interface WhileStatement extends BaseNode {
343
- type: "WhileStatement";
344
- test: Expression;
345
- body: Statement;
387
+ type: "WhileStatement";
388
+ test: Expression;
389
+ body: Statement;
346
390
  }
347
391
  interface DoWhileStatement extends BaseNode {
348
- type: "DoWhileStatement";
349
- body: Statement;
350
- test: Expression;
392
+ type: "DoWhileStatement";
393
+ body: Statement;
394
+ test: Expression;
351
395
  }
352
396
  interface BreakStatement extends BaseNode {
353
- type: "BreakStatement";
354
- label: Identifier | null;
397
+ type: "BreakStatement";
398
+ label: Identifier | null;
355
399
  }
356
400
  interface ContinueStatement extends BaseNode {
357
- type: "ContinueStatement";
358
- label: Identifier | null;
401
+ type: "ContinueStatement";
402
+ label: Identifier | null;
359
403
  }
360
404
  interface LabeledStatement extends BaseNode {
361
- type: "LabeledStatement";
362
- label: Identifier;
363
- body: Statement;
405
+ type: "LabeledStatement";
406
+ label: Identifier;
407
+ body: Statement;
364
408
  }
365
409
  interface WithStatement extends BaseNode {
366
- type: "WithStatement";
367
- object: Expression;
368
- body: Statement;
410
+ type: "WithStatement";
411
+ object: Expression;
412
+ body: Statement;
369
413
  }
370
414
  interface ReturnStatement extends BaseNode {
371
- type: "ReturnStatement";
372
- argument: Expression | null;
415
+ type: "ReturnStatement";
416
+ argument: Expression | null;
373
417
  }
374
418
  interface ThrowStatement extends BaseNode {
375
- type: "ThrowStatement";
376
- argument: Expression;
419
+ type: "ThrowStatement";
420
+ argument: Expression;
377
421
  }
378
422
  interface TryStatement extends BaseNode {
379
- type: "TryStatement";
380
- block: BlockStatement;
381
- handler: CatchClause | null;
382
- finalizer: BlockStatement | null;
423
+ type: "TryStatement";
424
+ block: BlockStatement;
425
+ handler: CatchClause | null;
426
+ finalizer: BlockStatement | null;
383
427
  }
384
428
  interface CatchClause extends BaseNode {
385
- type: "CatchClause";
386
- param: BindingPattern | null;
387
- body: BlockStatement;
429
+ type: "CatchClause";
430
+ param: BindingPattern | null;
431
+ body: BlockStatement;
388
432
  }
389
433
  interface DebuggerStatement extends BaseNode {
390
- type: "DebuggerStatement";
434
+ type: "DebuggerStatement";
391
435
  }
392
436
  interface EmptyStatement extends BaseNode {
393
- type: "EmptyStatement";
437
+ type: "EmptyStatement";
394
438
  }
395
439
  interface VariableDeclaration extends BaseNode {
396
- type: "VariableDeclaration";
397
- kind: "var" | "let" | "const" | "using" | "await using";
398
- declarations: VariableDeclarator[];
440
+ type: "VariableDeclaration";
441
+ kind: "var" | "let" | "const" | "using" | "await using";
442
+ declarations: VariableDeclarator[];
399
443
  }
400
444
  interface VariableDeclarator extends BaseNode {
401
- type: "VariableDeclarator";
402
- id: BindingPattern;
403
- init: Expression | null;
445
+ type: "VariableDeclarator";
446
+ id: BindingPattern;
447
+ init: Expression | null;
404
448
  }
405
449
  interface FunctionNodeBase extends BaseNode {
406
- id: Identifier | null;
407
- generator: boolean;
408
- async: boolean;
409
- declare?: boolean;
410
- params: FunctionParameter[];
411
- body: BlockStatement | null;
412
- expression: false;
450
+ id: Identifier | null;
451
+ generator: boolean;
452
+ async: boolean;
453
+ declare?: boolean;
454
+ params: FunctionParameter[];
455
+ body: BlockStatement | null;
456
+ expression: false;
413
457
  }
414
458
  interface FunctionDeclaration extends FunctionNodeBase {
415
- type: "FunctionDeclaration";
459
+ type: "FunctionDeclaration";
416
460
  }
417
461
  interface FunctionExpression extends FunctionNodeBase {
418
- type: "FunctionExpression";
462
+ type: "FunctionExpression";
419
463
  }
420
464
  interface TSDeclareFunction extends FunctionNodeBase {
421
- type: "TSDeclareFunction";
465
+ type: "TSDeclareFunction";
422
466
  }
423
467
  interface TSEmptyBodyFunctionExpression extends FunctionNodeBase {
424
- type: "TSEmptyBodyFunctionExpression";
468
+ type: "TSEmptyBodyFunctionExpression";
425
469
  }
426
470
  interface ArrowFunctionExpression extends BaseNode {
427
- type: "ArrowFunctionExpression";
428
- id: null;
429
- generator: false;
430
- async: boolean;
431
- params: FunctionParameter[];
432
- body: BlockStatement | Expression;
433
- expression: boolean;
471
+ type: "ArrowFunctionExpression";
472
+ id: null;
473
+ generator: false;
474
+ async: boolean;
475
+ params: FunctionParameter[];
476
+ body: BlockStatement | Expression;
477
+ expression: boolean;
434
478
  }
435
479
  interface ClassNodeBase extends BaseNode {
436
- decorators: Decorator[];
437
- id: Identifier | null;
438
- superClass: Expression | null;
439
- body: ClassBody;
480
+ decorators: Decorator[];
481
+ id: Identifier | null;
482
+ superClass: Expression | null;
483
+ body: ClassBody;
440
484
  }
441
485
  interface ClassDeclaration extends ClassNodeBase {
442
- type: "ClassDeclaration";
486
+ type: "ClassDeclaration";
443
487
  }
444
488
  interface ClassExpression extends ClassNodeBase {
445
- type: "ClassExpression";
489
+ type: "ClassExpression";
446
490
  }
447
491
  interface ClassBody extends BaseNode {
448
- type: "ClassBody";
449
- body: ClassElement[];
492
+ type: "ClassBody";
493
+ body: ClassElement[];
450
494
  }
451
495
  interface MethodDefinition extends BaseNode {
452
- type: "MethodDefinition";
453
- decorators: Decorator[];
454
- key: Expression | PrivateIdentifier;
455
- value: FunctionExpression | TSEmptyBodyFunctionExpression;
456
- kind: "constructor" | "method" | "get" | "set";
457
- computed: boolean;
458
- static: boolean;
496
+ type: "MethodDefinition";
497
+ decorators: Decorator[];
498
+ key: Expression | PrivateIdentifier;
499
+ value: FunctionExpression | TSEmptyBodyFunctionExpression;
500
+ kind: "constructor" | "method" | "get" | "set";
501
+ computed: boolean;
502
+ static: boolean;
459
503
  }
460
504
  interface PropertyDefinition extends BaseNode {
461
- type: "PropertyDefinition";
462
- decorators: Decorator[];
463
- key: Expression | PrivateIdentifier;
464
- value: Expression | null;
465
- computed: boolean;
466
- static: boolean;
505
+ type: "PropertyDefinition";
506
+ decorators: Decorator[];
507
+ key: Expression | PrivateIdentifier;
508
+ value: Expression | null;
509
+ computed: boolean;
510
+ static: boolean;
467
511
  }
468
512
  interface AccessorProperty extends BaseNode {
469
- type: "AccessorProperty";
470
- decorators: Decorator[];
471
- key: Expression | PrivateIdentifier;
472
- value: Expression | null;
473
- computed: boolean;
474
- static: boolean;
513
+ type: "AccessorProperty";
514
+ decorators: Decorator[];
515
+ key: Expression | PrivateIdentifier;
516
+ value: Expression | null;
517
+ computed: boolean;
518
+ static: boolean;
475
519
  }
476
520
  interface StaticBlock extends BaseNode {
477
- type: "StaticBlock";
478
- body: Statement[];
521
+ type: "StaticBlock";
522
+ body: Statement[];
479
523
  }
480
524
  interface Decorator extends BaseNode {
481
- type: "Decorator";
482
- expression: Expression;
525
+ type: "Decorator";
526
+ expression: Expression;
483
527
  }
484
528
  type ClassElement = MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock;
485
529
  interface ImportDeclaration extends BaseNode {
486
- type: "ImportDeclaration";
487
- specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
488
- source: StringLiteral;
489
- phase: "source" | "defer" | null;
490
- attributes: ImportAttribute[];
530
+ type: "ImportDeclaration";
531
+ specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
532
+ source: StringLiteral;
533
+ phase: "source" | "defer" | null;
534
+ attributes: ImportAttribute[];
491
535
  }
492
536
  interface ImportSpecifier extends BaseNode {
493
- type: "ImportSpecifier";
494
- imported: Identifier | StringLiteral;
495
- local: Identifier;
537
+ type: "ImportSpecifier";
538
+ imported: Identifier | StringLiteral;
539
+ local: Identifier;
496
540
  }
497
541
  interface ImportDefaultSpecifier extends BaseNode {
498
- type: "ImportDefaultSpecifier";
499
- local: Identifier;
542
+ type: "ImportDefaultSpecifier";
543
+ local: Identifier;
500
544
  }
501
545
  interface ImportNamespaceSpecifier extends BaseNode {
502
- type: "ImportNamespaceSpecifier";
503
- local: Identifier;
546
+ type: "ImportNamespaceSpecifier";
547
+ local: Identifier;
504
548
  }
505
549
  interface ImportAttribute extends BaseNode {
506
- type: "ImportAttribute";
507
- key: Identifier | StringLiteral;
508
- value: StringLiteral;
550
+ type: "ImportAttribute";
551
+ key: Identifier | StringLiteral;
552
+ value: StringLiteral;
509
553
  }
510
554
  interface ExportNamedDeclaration extends BaseNode {
511
- type: "ExportNamedDeclaration";
512
- declaration: Declaration | null;
513
- specifiers: ExportSpecifier[];
514
- source: StringLiteral | null;
515
- attributes: ImportAttribute[];
555
+ type: "ExportNamedDeclaration";
556
+ declaration: Declaration | null;
557
+ specifiers: ExportSpecifier[];
558
+ source: StringLiteral | null;
559
+ attributes: ImportAttribute[];
516
560
  }
517
561
  interface ExportDefaultDeclaration extends BaseNode {
518
- type: "ExportDefaultDeclaration";
519
- declaration: Declaration | Expression;
562
+ type: "ExportDefaultDeclaration";
563
+ declaration: Declaration | Expression;
520
564
  }
521
565
  interface ExportAllDeclaration extends BaseNode {
522
- type: "ExportAllDeclaration";
523
- exported: Identifier | StringLiteral | null;
524
- source: StringLiteral;
525
- attributes: ImportAttribute[];
566
+ type: "ExportAllDeclaration";
567
+ exported: Identifier | StringLiteral | null;
568
+ source: StringLiteral;
569
+ attributes: ImportAttribute[];
526
570
  }
527
571
  interface ExportSpecifier extends BaseNode {
528
- type: "ExportSpecifier";
529
- local: Identifier | StringLiteral;
530
- exported: Identifier | StringLiteral;
572
+ type: "ExportSpecifier";
573
+ local: Identifier | StringLiteral;
574
+ exported: Identifier | StringLiteral;
531
575
  }
532
576
  interface TSExportAssignment extends BaseNode {
533
- type: "TSExportAssignment";
534
- expression: Expression;
577
+ type: "TSExportAssignment";
578
+ expression: Expression;
535
579
  }
536
580
  interface TSNamespaceExportDeclaration extends BaseNode {
537
- type: "TSNamespaceExportDeclaration";
538
- id: Identifier;
581
+ type: "TSNamespaceExportDeclaration";
582
+ id: Identifier;
539
583
  }
540
584
  interface JSXElement extends BaseNode {
541
- type: "JSXElement";
542
- openingElement: JSXOpeningElement;
543
- children: JSXChild[];
544
- closingElement: JSXClosingElement | null;
585
+ type: "JSXElement";
586
+ openingElement: JSXOpeningElement;
587
+ children: JSXChild[];
588
+ closingElement: JSXClosingElement | null;
545
589
  }
546
590
  interface JSXOpeningElement extends BaseNode {
547
- type: "JSXOpeningElement";
548
- name: JSXTagName;
549
- attributes: Array<JSXAttribute | JSXSpreadAttribute>;
550
- selfClosing: boolean;
591
+ type: "JSXOpeningElement";
592
+ name: JSXTagName;
593
+ attributes: Array<JSXAttribute | JSXSpreadAttribute>;
594
+ selfClosing: boolean;
551
595
  }
552
596
  interface JSXClosingElement extends BaseNode {
553
- type: "JSXClosingElement";
554
- name: JSXTagName;
597
+ type: "JSXClosingElement";
598
+ name: JSXTagName;
555
599
  }
556
600
  interface JSXFragment extends BaseNode {
557
- type: "JSXFragment";
558
- openingFragment: JSXOpeningFragment;
559
- children: JSXChild[];
560
- closingFragment: JSXClosingFragment;
601
+ type: "JSXFragment";
602
+ openingFragment: JSXOpeningFragment;
603
+ children: JSXChild[];
604
+ closingFragment: JSXClosingFragment;
561
605
  }
562
606
  interface JSXOpeningFragment extends BaseNode {
563
- type: "JSXOpeningFragment";
564
- attributes: [];
565
- selfClosing: false;
607
+ type: "JSXOpeningFragment";
608
+ attributes: [];
609
+ selfClosing: false;
566
610
  }
567
611
  interface JSXClosingFragment extends BaseNode {
568
- type: "JSXClosingFragment";
612
+ type: "JSXClosingFragment";
569
613
  }
570
614
  interface JSXIdentifier extends BaseNode {
571
- type: "JSXIdentifier";
572
- name: string;
615
+ type: "JSXIdentifier";
616
+ name: string;
573
617
  }
574
618
  interface JSXNamespacedName extends BaseNode {
575
- type: "JSXNamespacedName";
576
- namespace: JSXIdentifier;
577
- name: JSXIdentifier;
619
+ type: "JSXNamespacedName";
620
+ namespace: JSXIdentifier;
621
+ name: JSXIdentifier;
578
622
  }
579
623
  interface JSXMemberExpression extends BaseNode {
580
- type: "JSXMemberExpression";
581
- object: JSXIdentifier | JSXMemberExpression;
582
- property: JSXIdentifier;
624
+ type: "JSXMemberExpression";
625
+ object: JSXIdentifier | JSXMemberExpression;
626
+ property: JSXIdentifier;
583
627
  }
584
628
  interface JSXAttribute extends BaseNode {
585
- type: "JSXAttribute";
586
- name: JSXIdentifier | JSXNamespacedName;
587
- value: StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment | null;
629
+ type: "JSXAttribute";
630
+ name: JSXIdentifier | JSXNamespacedName;
631
+ value: StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment | null;
588
632
  }
589
633
  interface JSXSpreadAttribute extends BaseNode {
590
- type: "JSXSpreadAttribute";
591
- argument: Expression;
634
+ type: "JSXSpreadAttribute";
635
+ argument: Expression;
592
636
  }
593
637
  interface JSXExpressionContainer extends BaseNode {
594
- type: "JSXExpressionContainer";
595
- expression: Expression | JSXEmptyExpression;
638
+ type: "JSXExpressionContainer";
639
+ expression: Expression | JSXEmptyExpression;
596
640
  }
597
641
  interface JSXEmptyExpression extends BaseNode {
598
- type: "JSXEmptyExpression";
642
+ type: "JSXEmptyExpression";
599
643
  }
600
644
  interface JSXText extends BaseNode {
601
- type: "JSXText";
602
- value: string;
603
- raw: string;
645
+ type: "JSXText";
646
+ value: string;
647
+ raw: string;
604
648
  }
605
649
  interface JSXSpreadChild extends BaseNode {
606
- type: "JSXSpreadChild";
607
- expression: Expression;
650
+ type: "JSXSpreadChild";
651
+ expression: Expression;
608
652
  }
609
653
  type JSXTagName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
610
654
  type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
611
655
  interface Program extends BaseNode {
612
- type: "Program";
613
- sourceType: "module" | "script";
614
- hashbang: string | null;
615
- body: Array<Statement | ModuleDeclaration>;
656
+ type: "Program";
657
+ sourceType: "module" | "script";
658
+ hashbang: string | null;
659
+ body: Array<Statement | ModuleDeclaration>;
616
660
  }
617
661
 
618
662
  type Declaration = FunctionDeclaration | ClassDeclaration | VariableDeclaration | TSDeclareFunction;
619
663
 
620
- type Expression = Identifier | Literal | ThisExpression | Super | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | ClassExpression | TaggedTemplateExpression | TemplateLiteral | MemberExpression | CallExpression | NewExpression | ChainExpression | SequenceExpression | ParenthesizedExpression | BinaryExpression | LogicalExpression | ConditionalExpression | UnaryExpression | UpdateExpression | AssignmentExpression | YieldExpression | AwaitExpression | ImportExpression | MetaProperty | SpreadElement | TSEmptyBodyFunctionExpression | JSXElement | JSXFragment;
664
+ type Expression =
665
+ | Identifier
666
+ | Literal
667
+ | ThisExpression
668
+ | Super
669
+ | ArrayExpression
670
+ | ObjectExpression
671
+ | FunctionExpression
672
+ | ArrowFunctionExpression
673
+ | ClassExpression
674
+ | TaggedTemplateExpression
675
+ | TemplateLiteral
676
+ | MemberExpression
677
+ | CallExpression
678
+ | NewExpression
679
+ | ChainExpression
680
+ | SequenceExpression
681
+ | ParenthesizedExpression
682
+ | BinaryExpression
683
+ | LogicalExpression
684
+ | ConditionalExpression
685
+ | UnaryExpression
686
+ | UpdateExpression
687
+ | AssignmentExpression
688
+ | YieldExpression
689
+ | AwaitExpression
690
+ | ImportExpression
691
+ | MetaProperty
692
+ | SpreadElement
693
+ | TSEmptyBodyFunctionExpression
694
+ | JSXElement
695
+ | JSXFragment;
621
696
 
622
- type Statement = ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | WithStatement | Declaration;
697
+ type Statement =
698
+ | ExpressionStatement
699
+ | BlockStatement
700
+ | EmptyStatement
701
+ | DebuggerStatement
702
+ | ReturnStatement
703
+ | LabeledStatement
704
+ | BreakStatement
705
+ | ContinueStatement
706
+ | IfStatement
707
+ | SwitchStatement
708
+ | ThrowStatement
709
+ | TryStatement
710
+ | WhileStatement
711
+ | DoWhileStatement
712
+ | ForStatement
713
+ | ForInStatement
714
+ | ForOfStatement
715
+ | WithStatement
716
+ | Declaration;
623
717
 
624
- type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;
718
+ type ModuleDeclaration =
719
+ | ImportDeclaration
720
+ | ExportNamedDeclaration
721
+ | ExportDefaultDeclaration
722
+ | ExportAllDeclaration
723
+ | TSExportAssignment
724
+ | TSNamespaceExportDeclaration;
625
725
 
626
- type Node = Program | Statement | Expression | ModuleDeclaration | Property | PrivateIdentifier | TemplateElement | VariableDeclarator | CatchClause | SwitchCase | RestElement | ArrayPattern | ObjectPattern | AssignmentPattern | ClassBody | MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock | Decorator | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportSpecifier | JSXOpeningElement | JSXClosingElement | JSXOpeningFragment | JSXClosingFragment | JSXIdentifier | JSXNamespacedName | JSXMemberExpression | JSXAttribute | JSXSpreadAttribute | JSXExpressionContainer | JSXEmptyExpression | JSXText | JSXSpreadChild;
726
+ type Node =
727
+ | Program
728
+ | Statement
729
+ | Expression
730
+ | ModuleDeclaration
731
+ | Property
732
+ | PrivateIdentifier
733
+ | TemplateElement
734
+ | VariableDeclarator
735
+ | CatchClause
736
+ | SwitchCase
737
+ | RestElement
738
+ | ArrayPattern
739
+ | ObjectPattern
740
+ | AssignmentPattern
741
+ | ClassBody
742
+ | MethodDefinition
743
+ | PropertyDefinition
744
+ | AccessorProperty
745
+ | StaticBlock
746
+ | Decorator
747
+ | ImportSpecifier
748
+ | ImportDefaultSpecifier
749
+ | ImportNamespaceSpecifier
750
+ | ImportAttribute
751
+ | ExportSpecifier
752
+ | JSXOpeningElement
753
+ | JSXClosingElement
754
+ | JSXOpeningFragment
755
+ | JSXClosingFragment
756
+ | JSXIdentifier
757
+ | JSXNamespacedName
758
+ | JSXMemberExpression
759
+ | JSXAttribute
760
+ | JSXSpreadAttribute
761
+ | JSXExpressionContainer
762
+ | JSXEmptyExpression
763
+ | JSXText
764
+ | JSXSpreadChild;
627
765
 
628
- export type { ParseOptions, ParseResult, Comment, Diagnostic, DiagnosticLabel, SourceType, SourceLang, BaseNode, Program, Statement, Expression, Declaration, ModuleDeclaration, Node, Identifier, PrivateIdentifier, Literal, StringLiteral, NumericLiteral, BigIntLiteral, BooleanLiteral, NullLiteral, RegExpLiteral, BindingPattern, FunctionParameter, Property, ArrayPattern, ObjectPattern, AssignmentPattern, RestElement, SequenceExpression, ParenthesizedExpression, BinaryExpression, LogicalExpression, ConditionalExpression, UnaryExpression, UpdateExpression, AssignmentExpression, YieldExpression, AwaitExpression, ArrayExpression, ObjectExpression, SpreadElement, MemberExpression, CallExpression, ChainExpression, TaggedTemplateExpression, NewExpression, MetaProperty, ImportExpression, TemplateLiteral, TemplateElement, Super, ThisExpression, ExpressionStatement, BlockStatement, IfStatement, SwitchStatement, SwitchCase, ForStatement, ForInStatement, ForOfStatement, WhileStatement, DoWhileStatement, BreakStatement, ContinueStatement, LabeledStatement, WithStatement, ReturnStatement, ThrowStatement, TryStatement, CatchClause, DebuggerStatement, EmptyStatement, VariableDeclaration, VariableDeclarator, FunctionDeclaration, FunctionExpression, TSDeclareFunction, TSEmptyBodyFunctionExpression, ArrowFunctionExpression, ClassDeclaration, ClassExpression, ClassBody, MethodDefinition, PropertyDefinition, AccessorProperty, StaticBlock, Decorator, ClassElement, ImportDeclaration, ImportSpecifier, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportAttribute, ExportNamedDeclaration, ExportDefaultDeclaration, ExportAllDeclaration, ExportSpecifier, TSExportAssignment, TSNamespaceExportDeclaration, JSXElement, JSXOpeningElement, JSXClosingElement, JSXFragment, JSXOpeningFragment, JSXClosingFragment, JSXIdentifier, JSXNamespacedName, JSXMemberExpression, JSXAttribute, JSXSpreadAttribute, JSXExpressionContainer, JSXEmptyExpression, JSXText, JSXSpreadChild, JSXTagName, JSXChild, BinaryOperator, LogicalOperator, UnaryOperator, UpdateOperator, AssignmentOperator, FunctionNodeBase, ClassNodeBase };
766
+ export type {
767
+ ParseOptions,
768
+ ParseResult,
769
+ Comment,
770
+ Diagnostic,
771
+ DiagnosticLabel,
772
+ SourceType,
773
+ SourceLang,
774
+ BaseNode,
775
+ Program,
776
+ Statement,
777
+ Expression,
778
+ Declaration,
779
+ ModuleDeclaration,
780
+ Node,
781
+ Identifier,
782
+ PrivateIdentifier,
783
+ Literal,
784
+ StringLiteral,
785
+ NumericLiteral,
786
+ BigIntLiteral,
787
+ BooleanLiteral,
788
+ NullLiteral,
789
+ RegExpLiteral,
790
+ BindingPattern,
791
+ FunctionParameter,
792
+ Property,
793
+ ArrayPattern,
794
+ ObjectPattern,
795
+ AssignmentPattern,
796
+ RestElement,
797
+ SequenceExpression,
798
+ ParenthesizedExpression,
799
+ BinaryExpression,
800
+ LogicalExpression,
801
+ ConditionalExpression,
802
+ UnaryExpression,
803
+ UpdateExpression,
804
+ AssignmentExpression,
805
+ YieldExpression,
806
+ AwaitExpression,
807
+ ArrayExpression,
808
+ ObjectExpression,
809
+ SpreadElement,
810
+ MemberExpression,
811
+ CallExpression,
812
+ ChainExpression,
813
+ TaggedTemplateExpression,
814
+ NewExpression,
815
+ MetaProperty,
816
+ ImportExpression,
817
+ TemplateLiteral,
818
+ TemplateElement,
819
+ Super,
820
+ ThisExpression,
821
+ ExpressionStatement,
822
+ BlockStatement,
823
+ IfStatement,
824
+ SwitchStatement,
825
+ SwitchCase,
826
+ ForStatement,
827
+ ForInStatement,
828
+ ForOfStatement,
829
+ WhileStatement,
830
+ DoWhileStatement,
831
+ BreakStatement,
832
+ ContinueStatement,
833
+ LabeledStatement,
834
+ WithStatement,
835
+ ReturnStatement,
836
+ ThrowStatement,
837
+ TryStatement,
838
+ CatchClause,
839
+ DebuggerStatement,
840
+ EmptyStatement,
841
+ VariableDeclaration,
842
+ VariableDeclarator,
843
+ FunctionDeclaration,
844
+ FunctionExpression,
845
+ TSDeclareFunction,
846
+ TSEmptyBodyFunctionExpression,
847
+ ArrowFunctionExpression,
848
+ ClassDeclaration,
849
+ ClassExpression,
850
+ ClassBody,
851
+ MethodDefinition,
852
+ PropertyDefinition,
853
+ AccessorProperty,
854
+ StaticBlock,
855
+ Decorator,
856
+ ClassElement,
857
+ ImportDeclaration,
858
+ ImportSpecifier,
859
+ ImportDefaultSpecifier,
860
+ ImportNamespaceSpecifier,
861
+ ImportAttribute,
862
+ ExportNamedDeclaration,
863
+ ExportDefaultDeclaration,
864
+ ExportAllDeclaration,
865
+ ExportSpecifier,
866
+ TSExportAssignment,
867
+ TSNamespaceExportDeclaration,
868
+ JSXElement,
869
+ JSXOpeningElement,
870
+ JSXClosingElement,
871
+ JSXFragment,
872
+ JSXOpeningFragment,
873
+ JSXClosingFragment,
874
+ JSXIdentifier,
875
+ JSXNamespacedName,
876
+ JSXMemberExpression,
877
+ JSXAttribute,
878
+ JSXSpreadAttribute,
879
+ JSXExpressionContainer,
880
+ JSXEmptyExpression,
881
+ JSXText,
882
+ JSXSpreadChild,
883
+ JSXTagName,
884
+ JSXChild,
885
+ BinaryOperator,
886
+ LogicalOperator,
887
+ UnaryOperator,
888
+ UpdateOperator,
889
+ AssignmentOperator,
890
+ FunctionNodeBase,
891
+ ClassNodeBase,
892
+ };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import binding from './binding.js';
2
- import { decode } from './decode.js';
1
+ import binding from "./binding.js";
2
+ import { decode } from "./decode.js";
3
3
 
4
4
  export function parse(source, options) {
5
5
  const buffer = binding.parseSync(source, options ?? {});
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
1
  {
2
2
  "name": "yuku-parser",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "High-performance JavaScript/TypeScript parser",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "https://github.com/yuku-toolchain/yuku.git"
8
9
  },
9
- "license": "MIT",
10
- "type": "module",
11
- "main": "index.js",
12
- "types": "index.d.ts",
13
10
  "files": [
14
11
  "index.js",
15
12
  "index.d.ts",
16
13
  "binding.js",
17
14
  "decode.js"
18
15
  ],
16
+ "type": "module",
17
+ "main": "index.js",
18
+ "types": "index.d.ts",
19
19
  "optionalDependencies": {
20
- "@yuku-parser/binding-linux-x64-gnu": "0.4.2",
21
- "@yuku-parser/binding-linux-arm64-gnu": "0.4.2",
22
- "@yuku-parser/binding-linux-arm-gnu": "0.4.2",
23
- "@yuku-parser/binding-linux-x64-musl": "0.4.2",
24
- "@yuku-parser/binding-linux-arm64-musl": "0.4.2",
25
- "@yuku-parser/binding-linux-arm-musl": "0.4.2",
26
- "@yuku-parser/binding-darwin-x64": "0.4.2",
27
- "@yuku-parser/binding-darwin-arm64": "0.4.2",
28
- "@yuku-parser/binding-win32-x64": "0.4.2",
29
- "@yuku-parser/binding-win32-arm64": "0.4.2",
30
- "@yuku-parser/binding-freebsd-x64": "0.4.2"
20
+ "@yuku-parser/binding-darwin-arm64": "0.4.4",
21
+ "@yuku-parser/binding-darwin-x64": "0.4.4",
22
+ "@yuku-parser/binding-freebsd-x64": "0.4.4",
23
+ "@yuku-parser/binding-linux-arm-gnu": "0.4.4",
24
+ "@yuku-parser/binding-linux-arm-musl": "0.4.4",
25
+ "@yuku-parser/binding-linux-arm64-gnu": "0.4.4",
26
+ "@yuku-parser/binding-linux-arm64-musl": "0.4.4",
27
+ "@yuku-parser/binding-linux-x64-gnu": "0.4.4",
28
+ "@yuku-parser/binding-linux-x64-musl": "0.4.4",
29
+ "@yuku-parser/binding-win32-arm64": "0.4.4",
30
+ "@yuku-parser/binding-win32-x64": "0.4.4"
31
31
  }
32
32
  }