oxc-parser 0.90.0 → 0.92.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/README.md +30 -4
- package/generated/deserialize/{js.mjs → js.js} +20 -8
- package/generated/deserialize/{ts.mjs → ts.js} +20 -8
- package/generated/lazy/{constructors.mjs → constructors.js} +2 -2
- package/generated/lazy/{walk.mjs → walk.js} +1 -1
- package/generated/visit/keys.js +172 -0
- package/generated/visit/types.js +176 -0
- package/generated/visit/visitor.d.ts +383 -0
- package/generated/visit/walk.js +2460 -0
- package/package.json +53 -46
- package/{bindings.mjs → src-js/bindings.js} +51 -51
- package/{index.d.ts → src-js/index.d.ts} +12 -0
- package/{index.mjs → src-js/index.js} +11 -8
- package/{raw-transfer/common.mjs → src-js/raw-transfer/common.js} +3 -3
- package/{raw-transfer/eager.mjs → src-js/raw-transfer/eager.js} +3 -3
- package/{raw-transfer/lazy.mjs → src-js/raw-transfer/lazy.js} +7 -7
- package/{raw-transfer/node-array.mjs → src-js/raw-transfer/node-array.js} +1 -1
- package/{raw-transfer/supported.mjs → src-js/raw-transfer/supported.js} +1 -1
- package/{raw-transfer/visitor.mjs → src-js/raw-transfer/visitor.js} +1 -1
- package/src-js/visit/index.js +34 -0
- package/src-js/visit/visitor.js +402 -0
- package/{wasm.mjs → src-js/wasm.js} +1 -1
- package/{wrap.mjs → src-js/wrap.js} +1 -4
- /package/generated/{constants.mjs → constants.js} +0 -0
- /package/generated/lazy/{types.mjs → types.js} +0 -0
- /package/{raw-transfer/lazy-common.mjs → src-js/raw-transfer/lazy-common.js} +0 -0
- /package/{webcontainer-fallback.js → src-js/webcontainer-fallback.cjs} +0 -0
package/README.md
CHANGED
|
@@ -39,7 +39,13 @@ import { Statement } from '@oxc-project/types';
|
|
|
39
39
|
|
|
40
40
|
### Visitor
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
An AST visitor is provided. See example below.
|
|
43
|
+
|
|
44
|
+
This package also exports visitor keys which can be used with any other ESTree walker.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { visitorKeys } from 'oxc-parser';
|
|
48
|
+
```
|
|
43
49
|
|
|
44
50
|
### Fast Mode
|
|
45
51
|
|
|
@@ -93,15 +99,15 @@ export interface EcmaScriptModule {
|
|
|
93
99
|
## API
|
|
94
100
|
|
|
95
101
|
```javascript
|
|
96
|
-
import
|
|
102
|
+
import { parseSync, Visitor } from 'oxc-parser';
|
|
97
103
|
|
|
98
104
|
const code = 'const url: String = /* 🤨 */ import.meta.url;';
|
|
99
105
|
|
|
100
106
|
// File extension is used to determine which dialect to parse source as.
|
|
101
107
|
const filename = 'test.tsx';
|
|
102
108
|
|
|
103
|
-
const result =
|
|
104
|
-
// or `await
|
|
109
|
+
const result = parseSync(filename, code);
|
|
110
|
+
// or `await parseAsync(filename, code)`
|
|
105
111
|
|
|
106
112
|
// An array of errors, if any.
|
|
107
113
|
console.log(result.errors);
|
|
@@ -111,6 +117,26 @@ console.log(result.program, result.comments);
|
|
|
111
117
|
|
|
112
118
|
// ESM information - imports, exports, `import.meta`s.
|
|
113
119
|
console.log(result.module);
|
|
120
|
+
|
|
121
|
+
// Visit the AST
|
|
122
|
+
const visitations = [];
|
|
123
|
+
|
|
124
|
+
const visitor = new Visitor({
|
|
125
|
+
VariableDeclaration(decl) {
|
|
126
|
+
visitations.push(`enter ${decl.kind}`);
|
|
127
|
+
},
|
|
128
|
+
'VariableDeclaration:exit'(decl) {
|
|
129
|
+
visitations.push(`exit ${decl.kind}`);
|
|
130
|
+
},
|
|
131
|
+
Identifier(ident) {
|
|
132
|
+
visitations.push(ident.name);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
visitor.visit(result.program);
|
|
137
|
+
|
|
138
|
+
// Logs: [ 'enter const', 'url', 'String', 'import', 'meta', 'url', 'exit const' ]
|
|
139
|
+
console.log(visitations);
|
|
114
140
|
```
|
|
115
141
|
|
|
116
142
|
### Options
|
|
@@ -7,7 +7,15 @@ const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
|
7
7
|
decodeStr = textDecoder.decode.bind(textDecoder),
|
|
8
8
|
{ fromCodePoint } = String;
|
|
9
9
|
|
|
10
|
-
export function deserialize(buffer,
|
|
10
|
+
export function deserialize(buffer, sourceText, sourceByteLen, preserveParens) {
|
|
11
|
+
return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeRawTransferData);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function deserializeProgramOnly(buffer, sourceText, sourceByteLen, preserveParens) {
|
|
15
|
+
return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeProgram);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function deserializeWith(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput, deserialize) {
|
|
11
19
|
uint8 = buffer;
|
|
12
20
|
uint32 = buffer.uint32;
|
|
13
21
|
float64 = buffer.float64;
|
|
@@ -17,7 +25,7 @@ export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserv
|
|
|
17
25
|
sourceIsAscii = sourceText.length === sourceByteLen;
|
|
18
26
|
preserveParens = preserveParensInput;
|
|
19
27
|
|
|
20
|
-
const data =
|
|
28
|
+
const data = deserialize(uint32[536870902]);
|
|
21
29
|
|
|
22
30
|
uint8 =
|
|
23
31
|
uint32 =
|
|
@@ -1371,12 +1379,16 @@ function deserializeTSIntersectionType(pos) {
|
|
|
1371
1379
|
}
|
|
1372
1380
|
|
|
1373
1381
|
function deserializeTSParenthesizedType(pos) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1382
|
+
let node = deserializeTSType(pos + 8);
|
|
1383
|
+
if (preserveParens) {
|
|
1384
|
+
node = {
|
|
1385
|
+
type: 'TSParenthesizedType',
|
|
1386
|
+
typeAnnotation: node,
|
|
1387
|
+
start: deserializeU32(pos),
|
|
1388
|
+
end: deserializeU32(pos + 4),
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
return node;
|
|
1380
1392
|
}
|
|
1381
1393
|
|
|
1382
1394
|
function deserializeTSTypeOperator(pos) {
|
|
@@ -7,7 +7,15 @@ const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
|
7
7
|
decodeStr = textDecoder.decode.bind(textDecoder),
|
|
8
8
|
{ fromCodePoint } = String;
|
|
9
9
|
|
|
10
|
-
export function deserialize(buffer,
|
|
10
|
+
export function deserialize(buffer, sourceText, sourceByteLen, preserveParens) {
|
|
11
|
+
return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeRawTransferData);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function deserializeProgramOnly(buffer, sourceText, sourceByteLen, preserveParens) {
|
|
15
|
+
return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeProgram);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function deserializeWith(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput, deserialize) {
|
|
11
19
|
uint8 = buffer;
|
|
12
20
|
uint32 = buffer.uint32;
|
|
13
21
|
float64 = buffer.float64;
|
|
@@ -17,7 +25,7 @@ export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserv
|
|
|
17
25
|
sourceIsAscii = sourceText.length === sourceByteLen;
|
|
18
26
|
preserveParens = preserveParensInput;
|
|
19
27
|
|
|
20
|
-
const data =
|
|
28
|
+
const data = deserialize(uint32[536870902]);
|
|
21
29
|
|
|
22
30
|
uint8 =
|
|
23
31
|
uint32 =
|
|
@@ -1502,12 +1510,16 @@ function deserializeTSIntersectionType(pos) {
|
|
|
1502
1510
|
}
|
|
1503
1511
|
|
|
1504
1512
|
function deserializeTSParenthesizedType(pos) {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1513
|
+
let node = deserializeTSType(pos + 8);
|
|
1514
|
+
if (preserveParens) {
|
|
1515
|
+
node = {
|
|
1516
|
+
type: 'TSParenthesizedType',
|
|
1517
|
+
typeAnnotation: node,
|
|
1518
|
+
start: deserializeU32(pos),
|
|
1519
|
+
end: deserializeU32(pos + 4),
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
return node;
|
|
1511
1523
|
}
|
|
1512
1524
|
|
|
1513
1525
|
function deserializeTSTypeOperator(pos) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
2
2
|
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer_lazy.rs`.
|
|
3
3
|
|
|
4
|
-
import { constructorError, TOKEN } from '../../raw-transfer/lazy-common.
|
|
5
|
-
import { NodeArray } from '../../raw-transfer/node-array.
|
|
4
|
+
import { constructorError, TOKEN } from '../../src-js/raw-transfer/lazy-common.js';
|
|
5
|
+
import { NodeArray } from '../../src-js/raw-transfer/node-array.js';
|
|
6
6
|
|
|
7
7
|
const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
8
8
|
decodeStr = textDecoder.decode.bind(textDecoder),
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
2
|
+
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/estree_visit.rs`.
|
|
3
|
+
|
|
4
|
+
export default Object.freeze({
|
|
5
|
+
// Leaf nodes
|
|
6
|
+
DebuggerStatement: [],
|
|
7
|
+
EmptyStatement: [],
|
|
8
|
+
Literal: [],
|
|
9
|
+
PrivateIdentifier: [],
|
|
10
|
+
Super: [],
|
|
11
|
+
TemplateElement: [],
|
|
12
|
+
ThisExpression: [],
|
|
13
|
+
JSXClosingFragment: [],
|
|
14
|
+
JSXEmptyExpression: [],
|
|
15
|
+
JSXIdentifier: [],
|
|
16
|
+
JSXOpeningFragment: [],
|
|
17
|
+
JSXText: [],
|
|
18
|
+
TSAnyKeyword: [],
|
|
19
|
+
TSBigIntKeyword: [],
|
|
20
|
+
TSBooleanKeyword: [],
|
|
21
|
+
TSIntrinsicKeyword: [],
|
|
22
|
+
TSJSDocUnknownType: [],
|
|
23
|
+
TSNeverKeyword: [],
|
|
24
|
+
TSNullKeyword: [],
|
|
25
|
+
TSNumberKeyword: [],
|
|
26
|
+
TSObjectKeyword: [],
|
|
27
|
+
TSStringKeyword: [],
|
|
28
|
+
TSSymbolKeyword: [],
|
|
29
|
+
TSThisType: [],
|
|
30
|
+
TSUndefinedKeyword: [],
|
|
31
|
+
TSUnknownKeyword: [],
|
|
32
|
+
TSVoidKeyword: [],
|
|
33
|
+
// Non-leaf nodes
|
|
34
|
+
AccessorProperty: ['decorators', 'key', 'typeAnnotation', 'value'],
|
|
35
|
+
ArrayExpression: ['elements'],
|
|
36
|
+
ArrayPattern: ['decorators', 'elements', 'typeAnnotation'],
|
|
37
|
+
ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'],
|
|
38
|
+
AssignmentExpression: ['left', 'right'],
|
|
39
|
+
AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'],
|
|
40
|
+
AwaitExpression: ['argument'],
|
|
41
|
+
BinaryExpression: ['left', 'right'],
|
|
42
|
+
BlockStatement: ['body'],
|
|
43
|
+
BreakStatement: ['label'],
|
|
44
|
+
CallExpression: ['callee', 'typeArguments', 'arguments'],
|
|
45
|
+
CatchClause: ['param', 'body'],
|
|
46
|
+
ChainExpression: ['expression'],
|
|
47
|
+
ClassBody: ['body'],
|
|
48
|
+
ClassDeclaration: ['decorators', 'id', 'typeParameters', 'superClass', 'superTypeArguments', 'implements', 'body'],
|
|
49
|
+
ClassExpression: ['decorators', 'id', 'typeParameters', 'superClass', 'superTypeArguments', 'implements', 'body'],
|
|
50
|
+
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
|
51
|
+
ContinueStatement: ['label'],
|
|
52
|
+
Decorator: ['expression'],
|
|
53
|
+
DoWhileStatement: ['body', 'test'],
|
|
54
|
+
ExportAllDeclaration: ['exported', 'source', 'attributes'],
|
|
55
|
+
ExportDefaultDeclaration: ['declaration'],
|
|
56
|
+
ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'attributes'],
|
|
57
|
+
ExportSpecifier: ['local', 'exported'],
|
|
58
|
+
ExpressionStatement: ['expression'],
|
|
59
|
+
ForInStatement: ['left', 'right', 'body'],
|
|
60
|
+
ForOfStatement: ['left', 'right', 'body'],
|
|
61
|
+
ForStatement: ['init', 'test', 'update', 'body'],
|
|
62
|
+
FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'],
|
|
63
|
+
FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'],
|
|
64
|
+
Identifier: ['decorators', 'typeAnnotation'],
|
|
65
|
+
IfStatement: ['test', 'consequent', 'alternate'],
|
|
66
|
+
ImportAttribute: ['key', 'value'],
|
|
67
|
+
ImportDeclaration: ['specifiers', 'source', 'attributes'],
|
|
68
|
+
ImportDefaultSpecifier: ['local'],
|
|
69
|
+
ImportExpression: ['source', 'options'],
|
|
70
|
+
ImportNamespaceSpecifier: ['local'],
|
|
71
|
+
ImportSpecifier: ['imported', 'local'],
|
|
72
|
+
LabeledStatement: ['label', 'body'],
|
|
73
|
+
LogicalExpression: ['left', 'right'],
|
|
74
|
+
MemberExpression: ['object', 'property'],
|
|
75
|
+
MetaProperty: ['meta', 'property'],
|
|
76
|
+
MethodDefinition: ['decorators', 'key', 'value'],
|
|
77
|
+
NewExpression: ['callee', 'typeArguments', 'arguments'],
|
|
78
|
+
ObjectExpression: ['properties'],
|
|
79
|
+
ObjectPattern: ['decorators', 'properties', 'typeAnnotation'],
|
|
80
|
+
ParenthesizedExpression: ['expression'],
|
|
81
|
+
Program: ['body'],
|
|
82
|
+
Property: ['key', 'value'],
|
|
83
|
+
PropertyDefinition: ['decorators', 'key', 'typeAnnotation', 'value'],
|
|
84
|
+
RestElement: ['decorators', 'argument', 'typeAnnotation'],
|
|
85
|
+
ReturnStatement: ['argument'],
|
|
86
|
+
SequenceExpression: ['expressions'],
|
|
87
|
+
SpreadElement: ['argument'],
|
|
88
|
+
StaticBlock: ['body'],
|
|
89
|
+
SwitchCase: ['test', 'consequent'],
|
|
90
|
+
SwitchStatement: ['discriminant', 'cases'],
|
|
91
|
+
TaggedTemplateExpression: ['tag', 'typeArguments', 'quasi'],
|
|
92
|
+
TemplateLiteral: ['quasis', 'expressions'],
|
|
93
|
+
ThrowStatement: ['argument'],
|
|
94
|
+
TryStatement: ['block', 'handler', 'finalizer'],
|
|
95
|
+
UnaryExpression: ['argument'],
|
|
96
|
+
UpdateExpression: ['argument'],
|
|
97
|
+
V8IntrinsicExpression: ['name', 'arguments'],
|
|
98
|
+
VariableDeclaration: ['declarations'],
|
|
99
|
+
VariableDeclarator: ['id', 'init'],
|
|
100
|
+
WhileStatement: ['test', 'body'],
|
|
101
|
+
WithStatement: ['object', 'body'],
|
|
102
|
+
YieldExpression: ['argument'],
|
|
103
|
+
JSXAttribute: ['name', 'value'],
|
|
104
|
+
JSXClosingElement: ['name'],
|
|
105
|
+
JSXElement: ['openingElement', 'children', 'closingElement'],
|
|
106
|
+
JSXExpressionContainer: ['expression'],
|
|
107
|
+
JSXFragment: ['openingFragment', 'children', 'closingFragment'],
|
|
108
|
+
JSXMemberExpression: ['object', 'property'],
|
|
109
|
+
JSXNamespacedName: ['namespace', 'name'],
|
|
110
|
+
JSXOpeningElement: ['name', 'typeArguments', 'attributes'],
|
|
111
|
+
JSXSpreadAttribute: ['argument'],
|
|
112
|
+
JSXSpreadChild: ['expression'],
|
|
113
|
+
TSAbstractAccessorProperty: ['decorators', 'key', 'typeAnnotation'],
|
|
114
|
+
TSAbstractMethodDefinition: ['key', 'value'],
|
|
115
|
+
TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],
|
|
116
|
+
TSArrayType: ['elementType'],
|
|
117
|
+
TSAsExpression: ['expression', 'typeAnnotation'],
|
|
118
|
+
TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'],
|
|
119
|
+
TSClassImplements: ['expression', 'typeArguments'],
|
|
120
|
+
TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'],
|
|
121
|
+
TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'],
|
|
122
|
+
TSConstructorType: ['typeParameters', 'params', 'returnType'],
|
|
123
|
+
TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'],
|
|
124
|
+
TSEmptyBodyFunctionExpression: ['id', 'typeParameters', 'params', 'returnType'],
|
|
125
|
+
TSEnumBody: ['members'],
|
|
126
|
+
TSEnumDeclaration: ['id', 'body'],
|
|
127
|
+
TSEnumMember: ['id', 'initializer'],
|
|
128
|
+
TSExportAssignment: ['expression'],
|
|
129
|
+
TSExternalModuleReference: ['expression'],
|
|
130
|
+
TSFunctionType: ['typeParameters', 'params', 'returnType'],
|
|
131
|
+
TSImportEqualsDeclaration: ['id', 'moduleReference'],
|
|
132
|
+
TSImportType: ['argument', 'options', 'qualifier', 'typeArguments'],
|
|
133
|
+
TSIndexSignature: ['parameters', 'typeAnnotation'],
|
|
134
|
+
TSIndexedAccessType: ['objectType', 'indexType'],
|
|
135
|
+
TSInferType: ['typeParameter'],
|
|
136
|
+
TSInstantiationExpression: ['expression', 'typeArguments'],
|
|
137
|
+
TSInterfaceBody: ['body'],
|
|
138
|
+
TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],
|
|
139
|
+
TSInterfaceHeritage: ['expression', 'typeArguments'],
|
|
140
|
+
TSIntersectionType: ['types'],
|
|
141
|
+
TSJSDocNonNullableType: ['typeAnnotation'],
|
|
142
|
+
TSJSDocNullableType: ['typeAnnotation'],
|
|
143
|
+
TSLiteralType: ['literal'],
|
|
144
|
+
TSMappedType: ['key', 'constraint', 'nameType', 'typeAnnotation'],
|
|
145
|
+
TSMethodSignature: ['key', 'typeParameters', 'params', 'returnType'],
|
|
146
|
+
TSModuleBlock: ['body'],
|
|
147
|
+
TSModuleDeclaration: ['id', 'body'],
|
|
148
|
+
TSNamedTupleMember: ['label', 'elementType'],
|
|
149
|
+
TSNamespaceExportDeclaration: ['id'],
|
|
150
|
+
TSNonNullExpression: ['expression'],
|
|
151
|
+
TSOptionalType: ['typeAnnotation'],
|
|
152
|
+
TSParameterProperty: ['decorators', 'parameter'],
|
|
153
|
+
TSParenthesizedType: ['typeAnnotation'],
|
|
154
|
+
TSPropertySignature: ['key', 'typeAnnotation'],
|
|
155
|
+
TSQualifiedName: ['left', 'right'],
|
|
156
|
+
TSRestType: ['typeAnnotation'],
|
|
157
|
+
TSSatisfiesExpression: ['expression', 'typeAnnotation'],
|
|
158
|
+
TSTemplateLiteralType: ['quasis', 'types'],
|
|
159
|
+
TSTupleType: ['elementTypes'],
|
|
160
|
+
TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'],
|
|
161
|
+
TSTypeAnnotation: ['typeAnnotation'],
|
|
162
|
+
TSTypeAssertion: ['typeAnnotation', 'expression'],
|
|
163
|
+
TSTypeLiteral: ['members'],
|
|
164
|
+
TSTypeOperator: ['typeAnnotation'],
|
|
165
|
+
TSTypeParameter: ['name', 'constraint', 'default'],
|
|
166
|
+
TSTypeParameterDeclaration: ['params'],
|
|
167
|
+
TSTypeParameterInstantiation: ['params'],
|
|
168
|
+
TSTypePredicate: ['parameterName', 'typeAnnotation'],
|
|
169
|
+
TSTypeQuery: ['exprName', 'typeArguments'],
|
|
170
|
+
TSTypeReference: ['typeName', 'typeArguments'],
|
|
171
|
+
TSUnionType: ['types'],
|
|
172
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
2
|
+
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/estree_visit.rs`.
|
|
3
|
+
|
|
4
|
+
// Mapping from node type name to node type ID
|
|
5
|
+
export const NODE_TYPE_IDS_MAP = new Map([
|
|
6
|
+
// Leaf nodes
|
|
7
|
+
['DebuggerStatement', 0],
|
|
8
|
+
['EmptyStatement', 1],
|
|
9
|
+
['Literal', 2],
|
|
10
|
+
['PrivateIdentifier', 3],
|
|
11
|
+
['Super', 4],
|
|
12
|
+
['TemplateElement', 5],
|
|
13
|
+
['ThisExpression', 6],
|
|
14
|
+
['JSXClosingFragment', 7],
|
|
15
|
+
['JSXEmptyExpression', 8],
|
|
16
|
+
['JSXIdentifier', 9],
|
|
17
|
+
['JSXOpeningFragment', 10],
|
|
18
|
+
['JSXText', 11],
|
|
19
|
+
['TSAnyKeyword', 12],
|
|
20
|
+
['TSBigIntKeyword', 13],
|
|
21
|
+
['TSBooleanKeyword', 14],
|
|
22
|
+
['TSIntrinsicKeyword', 15],
|
|
23
|
+
['TSJSDocUnknownType', 16],
|
|
24
|
+
['TSNeverKeyword', 17],
|
|
25
|
+
['TSNullKeyword', 18],
|
|
26
|
+
['TSNumberKeyword', 19],
|
|
27
|
+
['TSObjectKeyword', 20],
|
|
28
|
+
['TSStringKeyword', 21],
|
|
29
|
+
['TSSymbolKeyword', 22],
|
|
30
|
+
['TSThisType', 23],
|
|
31
|
+
['TSUndefinedKeyword', 24],
|
|
32
|
+
['TSUnknownKeyword', 25],
|
|
33
|
+
['TSVoidKeyword', 26],
|
|
34
|
+
// Non-leaf nodes
|
|
35
|
+
['AccessorProperty', 27],
|
|
36
|
+
['ArrayExpression', 28],
|
|
37
|
+
['ArrayPattern', 29],
|
|
38
|
+
['ArrowFunctionExpression', 30],
|
|
39
|
+
['AssignmentExpression', 31],
|
|
40
|
+
['AssignmentPattern', 32],
|
|
41
|
+
['AwaitExpression', 33],
|
|
42
|
+
['BinaryExpression', 34],
|
|
43
|
+
['BlockStatement', 35],
|
|
44
|
+
['BreakStatement', 36],
|
|
45
|
+
['CallExpression', 37],
|
|
46
|
+
['CatchClause', 38],
|
|
47
|
+
['ChainExpression', 39],
|
|
48
|
+
['ClassBody', 40],
|
|
49
|
+
['ClassDeclaration', 41],
|
|
50
|
+
['ClassExpression', 42],
|
|
51
|
+
['ConditionalExpression', 43],
|
|
52
|
+
['ContinueStatement', 44],
|
|
53
|
+
['Decorator', 45],
|
|
54
|
+
['DoWhileStatement', 46],
|
|
55
|
+
['ExportAllDeclaration', 47],
|
|
56
|
+
['ExportDefaultDeclaration', 48],
|
|
57
|
+
['ExportNamedDeclaration', 49],
|
|
58
|
+
['ExportSpecifier', 50],
|
|
59
|
+
['ExpressionStatement', 51],
|
|
60
|
+
['ForInStatement', 52],
|
|
61
|
+
['ForOfStatement', 53],
|
|
62
|
+
['ForStatement', 54],
|
|
63
|
+
['FunctionDeclaration', 55],
|
|
64
|
+
['FunctionExpression', 56],
|
|
65
|
+
['Identifier', 57],
|
|
66
|
+
['IfStatement', 58],
|
|
67
|
+
['ImportAttribute', 59],
|
|
68
|
+
['ImportDeclaration', 60],
|
|
69
|
+
['ImportDefaultSpecifier', 61],
|
|
70
|
+
['ImportExpression', 62],
|
|
71
|
+
['ImportNamespaceSpecifier', 63],
|
|
72
|
+
['ImportSpecifier', 64],
|
|
73
|
+
['LabeledStatement', 65],
|
|
74
|
+
['LogicalExpression', 66],
|
|
75
|
+
['MemberExpression', 67],
|
|
76
|
+
['MetaProperty', 68],
|
|
77
|
+
['MethodDefinition', 69],
|
|
78
|
+
['NewExpression', 70],
|
|
79
|
+
['ObjectExpression', 71],
|
|
80
|
+
['ObjectPattern', 72],
|
|
81
|
+
['ParenthesizedExpression', 73],
|
|
82
|
+
['Program', 74],
|
|
83
|
+
['Property', 75],
|
|
84
|
+
['PropertyDefinition', 76],
|
|
85
|
+
['RestElement', 77],
|
|
86
|
+
['ReturnStatement', 78],
|
|
87
|
+
['SequenceExpression', 79],
|
|
88
|
+
['SpreadElement', 80],
|
|
89
|
+
['StaticBlock', 81],
|
|
90
|
+
['SwitchCase', 82],
|
|
91
|
+
['SwitchStatement', 83],
|
|
92
|
+
['TaggedTemplateExpression', 84],
|
|
93
|
+
['TemplateLiteral', 85],
|
|
94
|
+
['ThrowStatement', 86],
|
|
95
|
+
['TryStatement', 87],
|
|
96
|
+
['UnaryExpression', 88],
|
|
97
|
+
['UpdateExpression', 89],
|
|
98
|
+
['V8IntrinsicExpression', 90],
|
|
99
|
+
['VariableDeclaration', 91],
|
|
100
|
+
['VariableDeclarator', 92],
|
|
101
|
+
['WhileStatement', 93],
|
|
102
|
+
['WithStatement', 94],
|
|
103
|
+
['YieldExpression', 95],
|
|
104
|
+
['JSXAttribute', 96],
|
|
105
|
+
['JSXClosingElement', 97],
|
|
106
|
+
['JSXElement', 98],
|
|
107
|
+
['JSXExpressionContainer', 99],
|
|
108
|
+
['JSXFragment', 100],
|
|
109
|
+
['JSXMemberExpression', 101],
|
|
110
|
+
['JSXNamespacedName', 102],
|
|
111
|
+
['JSXOpeningElement', 103],
|
|
112
|
+
['JSXSpreadAttribute', 104],
|
|
113
|
+
['JSXSpreadChild', 105],
|
|
114
|
+
['TSAbstractAccessorProperty', 106],
|
|
115
|
+
['TSAbstractMethodDefinition', 107],
|
|
116
|
+
['TSAbstractPropertyDefinition', 108],
|
|
117
|
+
['TSArrayType', 109],
|
|
118
|
+
['TSAsExpression', 110],
|
|
119
|
+
['TSCallSignatureDeclaration', 111],
|
|
120
|
+
['TSClassImplements', 112],
|
|
121
|
+
['TSConditionalType', 113],
|
|
122
|
+
['TSConstructSignatureDeclaration', 114],
|
|
123
|
+
['TSConstructorType', 115],
|
|
124
|
+
['TSDeclareFunction', 116],
|
|
125
|
+
['TSEmptyBodyFunctionExpression', 117],
|
|
126
|
+
['TSEnumBody', 118],
|
|
127
|
+
['TSEnumDeclaration', 119],
|
|
128
|
+
['TSEnumMember', 120],
|
|
129
|
+
['TSExportAssignment', 121],
|
|
130
|
+
['TSExternalModuleReference', 122],
|
|
131
|
+
['TSFunctionType', 123],
|
|
132
|
+
['TSImportEqualsDeclaration', 124],
|
|
133
|
+
['TSImportType', 125],
|
|
134
|
+
['TSIndexSignature', 126],
|
|
135
|
+
['TSIndexedAccessType', 127],
|
|
136
|
+
['TSInferType', 128],
|
|
137
|
+
['TSInstantiationExpression', 129],
|
|
138
|
+
['TSInterfaceBody', 130],
|
|
139
|
+
['TSInterfaceDeclaration', 131],
|
|
140
|
+
['TSInterfaceHeritage', 132],
|
|
141
|
+
['TSIntersectionType', 133],
|
|
142
|
+
['TSJSDocNonNullableType', 134],
|
|
143
|
+
['TSJSDocNullableType', 135],
|
|
144
|
+
['TSLiteralType', 136],
|
|
145
|
+
['TSMappedType', 137],
|
|
146
|
+
['TSMethodSignature', 138],
|
|
147
|
+
['TSModuleBlock', 139],
|
|
148
|
+
['TSModuleDeclaration', 140],
|
|
149
|
+
['TSNamedTupleMember', 141],
|
|
150
|
+
['TSNamespaceExportDeclaration', 142],
|
|
151
|
+
['TSNonNullExpression', 143],
|
|
152
|
+
['TSOptionalType', 144],
|
|
153
|
+
['TSParameterProperty', 145],
|
|
154
|
+
['TSParenthesizedType', 146],
|
|
155
|
+
['TSPropertySignature', 147],
|
|
156
|
+
['TSQualifiedName', 148],
|
|
157
|
+
['TSRestType', 149],
|
|
158
|
+
['TSSatisfiesExpression', 150],
|
|
159
|
+
['TSTemplateLiteralType', 151],
|
|
160
|
+
['TSTupleType', 152],
|
|
161
|
+
['TSTypeAliasDeclaration', 153],
|
|
162
|
+
['TSTypeAnnotation', 154],
|
|
163
|
+
['TSTypeAssertion', 155],
|
|
164
|
+
['TSTypeLiteral', 156],
|
|
165
|
+
['TSTypeOperator', 157],
|
|
166
|
+
['TSTypeParameter', 158],
|
|
167
|
+
['TSTypeParameterDeclaration', 159],
|
|
168
|
+
['TSTypeParameterInstantiation', 160],
|
|
169
|
+
['TSTypePredicate', 161],
|
|
170
|
+
['TSTypeQuery', 162],
|
|
171
|
+
['TSTypeReference', 163],
|
|
172
|
+
['TSUnionType', 164],
|
|
173
|
+
]);
|
|
174
|
+
|
|
175
|
+
export const NODE_TYPES_COUNT = 165;
|
|
176
|
+
export const LEAF_NODE_TYPES_COUNT = 27;
|