condenser 0.0.12 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/condenser/asset.rb +1 -1
- data/lib/condenser/build_cache.rb +47 -24
- data/lib/condenser/environment.rb +0 -6
- data/lib/condenser/processors/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/node/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/node/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/resolve/README.md +16 -16
- data/lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/index.js +107 -107
- data/lib/condenser/processors/node_modules/color-name/.npmignore +106 -106
- data/lib/condenser/processors/node_modules/color-name/LICENSE +7 -7
- data/lib/condenser/processors/node_modules/color-name/README.md +11 -11
- data/lib/condenser/processors/node_modules/color-name/index.js +152 -152
- data/lib/condenser/processors/node_modules/color-name/test.js +7 -7
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/index.d.ts +548 -548
- data/lib/condenser/resolve.rb +12 -8
- data/lib/condenser/version.rb +1 -1
- data/test/cache_test.rb +16 -0
- data/test/test_helper.rb +5 -1
- metadata +2 -2
@@ -1,7 +1,7 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
var names = require('./');
|
4
|
-
var assert = require('assert');
|
5
|
-
|
6
|
-
assert.deepEqual(names.red, [255,0,0]);
|
7
|
-
assert.deepEqual(names.aliceblue, [240,248,255]);
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
var names = require('./');
|
4
|
+
var assert = require('assert');
|
5
|
+
|
6
|
+
assert.deepEqual(names.red, [255,0,0]);
|
7
|
+
assert.deepEqual(names.aliceblue, [240,248,255]);
|
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE
|
data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
# Installation
|
2
|
-
> `npm install --save @types/estree`
|
3
|
-
|
4
|
-
# Summary
|
5
|
-
This package contains type definitions for ESTree AST specification (https://github.com/estree/estree).
|
6
|
-
|
7
|
-
# Details
|
8
|
-
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree
|
9
|
-
|
10
|
-
Additional Details
|
11
|
-
* Last updated: Tue, 17 Apr 2018 20:22:09 GMT
|
12
|
-
* Dependencies: none
|
13
|
-
* Global values: none
|
14
|
-
|
15
|
-
# Credits
|
16
|
-
These definitions were written by RReverser <https://github.com/RReverser>.
|
1
|
+
# Installation
|
2
|
+
> `npm install --save @types/estree`
|
3
|
+
|
4
|
+
# Summary
|
5
|
+
This package contains type definitions for ESTree AST specification (https://github.com/estree/estree).
|
6
|
+
|
7
|
+
# Details
|
8
|
+
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree
|
9
|
+
|
10
|
+
Additional Details
|
11
|
+
* Last updated: Tue, 17 Apr 2018 20:22:09 GMT
|
12
|
+
* Dependencies: none
|
13
|
+
* Global values: none
|
14
|
+
|
15
|
+
# Credits
|
16
|
+
These definitions were written by RReverser <https://github.com/RReverser>.
|
data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/index.d.ts
CHANGED
@@ -1,548 +1,548 @@
|
|
1
|
-
// Type definitions for ESTree AST specification
|
2
|
-
// Project: https://github.com/estree/estree
|
3
|
-
// Definitions by: RReverser <https://github.com/RReverser>
|
4
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5
|
-
|
6
|
-
// This definition file follows a somewhat unusual format. ESTree allows
|
7
|
-
// runtime type checks based on the `type` parameter. In order to explain this
|
8
|
-
// to typescript we want to use discriminated union types:
|
9
|
-
// https://github.com/Microsoft/TypeScript/pull/9163
|
10
|
-
//
|
11
|
-
// For ESTree this is a bit tricky because the high level interfaces like
|
12
|
-
// Node or Function are pulling double duty. We want to pass common fields down
|
13
|
-
// to the interfaces that extend them (like Identifier or
|
14
|
-
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
15
|
-
// common fields on them. So we've split the high level interfaces into two
|
16
|
-
// types, a base type which passes down inhereted fields, and a type union of
|
17
|
-
// all types which extend the base type. Only the type union is exported, and
|
18
|
-
// the union is how other types refer to the collection of inheriting types.
|
19
|
-
//
|
20
|
-
// This makes the definitions file here somewhat more difficult to maintain,
|
21
|
-
// but it has the notable advantage of making ESTree much easier to use as
|
22
|
-
// an end user.
|
23
|
-
|
24
|
-
interface BaseNodeWithoutComments {
|
25
|
-
// Every leaf interface that extends BaseNode must specify a type property.
|
26
|
-
// The type property should be a string literal. For example, Identifier
|
27
|
-
// has: `type: "Identifier"`
|
28
|
-
type: string;
|
29
|
-
loc?: SourceLocation | null;
|
30
|
-
range?: [number, number];
|
31
|
-
}
|
32
|
-
|
33
|
-
interface BaseNode extends BaseNodeWithoutComments {
|
34
|
-
leadingComments?: Array<Comment>;
|
35
|
-
trailingComments?: Array<Comment>;
|
36
|
-
}
|
37
|
-
|
38
|
-
export type Node =
|
39
|
-
Identifier | Literal | Program | Function | SwitchCase | CatchClause |
|
40
|
-
VariableDeclarator | Statement | Expression | Property |
|
41
|
-
AssignmentProperty | Super | TemplateElement | SpreadElement | Pattern |
|
42
|
-
ClassBody | Class | MethodDefinition | ModuleDeclaration | ModuleSpecifier;
|
43
|
-
|
44
|
-
export interface Comment extends BaseNodeWithoutComments {
|
45
|
-
type: "Line" | "Block";
|
46
|
-
value: string;
|
47
|
-
}
|
48
|
-
|
49
|
-
interface SourceLocation {
|
50
|
-
source?: string | null;
|
51
|
-
start: Position;
|
52
|
-
end: Position;
|
53
|
-
}
|
54
|
-
|
55
|
-
export interface Position {
|
56
|
-
/** >= 1 */
|
57
|
-
line: number;
|
58
|
-
/** >= 0 */
|
59
|
-
column: number;
|
60
|
-
}
|
61
|
-
|
62
|
-
export interface Program extends BaseNode {
|
63
|
-
type: "Program";
|
64
|
-
sourceType: "script" | "module";
|
65
|
-
body: Array<Statement | ModuleDeclaration>;
|
66
|
-
comments?: Array<Comment>;
|
67
|
-
}
|
68
|
-
|
69
|
-
interface BaseFunction extends BaseNode {
|
70
|
-
params: Array<Pattern>;
|
71
|
-
generator?: boolean;
|
72
|
-
async?: boolean;
|
73
|
-
// The body is either BlockStatement or Expression because arrow functions
|
74
|
-
// can have a body that's either. FunctionDeclarations and
|
75
|
-
// FunctionExpressions have only BlockStatement bodies.
|
76
|
-
body: BlockStatement | Expression;
|
77
|
-
}
|
78
|
-
|
79
|
-
export type Function =
|
80
|
-
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
81
|
-
|
82
|
-
export type Statement =
|
83
|
-
ExpressionStatement | BlockStatement | EmptyStatement |
|
84
|
-
DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement |
|
85
|
-
BreakStatement | ContinueStatement | IfStatement | SwitchStatement |
|
86
|
-
ThrowStatement | TryStatement | WhileStatement | DoWhileStatement |
|
87
|
-
ForStatement | ForInStatement | ForOfStatement | Declaration;
|
88
|
-
|
89
|
-
interface BaseStatement extends BaseNode { }
|
90
|
-
|
91
|
-
export interface EmptyStatement extends BaseStatement {
|
92
|
-
type: "EmptyStatement";
|
93
|
-
}
|
94
|
-
|
95
|
-
export interface BlockStatement extends BaseStatement {
|
96
|
-
type: "BlockStatement";
|
97
|
-
body: Array<Statement>;
|
98
|
-
innerComments?: Array<Comment>;
|
99
|
-
}
|
100
|
-
|
101
|
-
export interface ExpressionStatement extends BaseStatement {
|
102
|
-
type: "ExpressionStatement";
|
103
|
-
expression: Expression;
|
104
|
-
}
|
105
|
-
|
106
|
-
export interface IfStatement extends BaseStatement {
|
107
|
-
type: "IfStatement";
|
108
|
-
test: Expression;
|
109
|
-
consequent: Statement;
|
110
|
-
alternate?: Statement | null;
|
111
|
-
}
|
112
|
-
|
113
|
-
export interface LabeledStatement extends BaseStatement {
|
114
|
-
type: "LabeledStatement";
|
115
|
-
label: Identifier;
|
116
|
-
body: Statement;
|
117
|
-
}
|
118
|
-
|
119
|
-
export interface BreakStatement extends BaseStatement {
|
120
|
-
type: "BreakStatement";
|
121
|
-
label?: Identifier | null;
|
122
|
-
}
|
123
|
-
|
124
|
-
export interface ContinueStatement extends BaseStatement {
|
125
|
-
type: "ContinueStatement";
|
126
|
-
label?: Identifier | null;
|
127
|
-
}
|
128
|
-
|
129
|
-
export interface WithStatement extends BaseStatement {
|
130
|
-
type: "WithStatement";
|
131
|
-
object: Expression;
|
132
|
-
body: Statement;
|
133
|
-
}
|
134
|
-
|
135
|
-
export interface SwitchStatement extends BaseStatement {
|
136
|
-
type: "SwitchStatement";
|
137
|
-
discriminant: Expression;
|
138
|
-
cases: Array<SwitchCase>;
|
139
|
-
}
|
140
|
-
|
141
|
-
export interface ReturnStatement extends BaseStatement {
|
142
|
-
type: "ReturnStatement";
|
143
|
-
argument?: Expression | null;
|
144
|
-
}
|
145
|
-
|
146
|
-
export interface ThrowStatement extends BaseStatement {
|
147
|
-
type: "ThrowStatement";
|
148
|
-
argument: Expression;
|
149
|
-
}
|
150
|
-
|
151
|
-
export interface TryStatement extends BaseStatement {
|
152
|
-
type: "TryStatement";
|
153
|
-
block: BlockStatement;
|
154
|
-
handler?: CatchClause | null;
|
155
|
-
finalizer?: BlockStatement | null;
|
156
|
-
}
|
157
|
-
|
158
|
-
export interface WhileStatement extends BaseStatement {
|
159
|
-
type: "WhileStatement";
|
160
|
-
test: Expression;
|
161
|
-
body: Statement;
|
162
|
-
}
|
163
|
-
|
164
|
-
export interface DoWhileStatement extends BaseStatement {
|
165
|
-
type: "DoWhileStatement";
|
166
|
-
body: Statement;
|
167
|
-
test: Expression;
|
168
|
-
}
|
169
|
-
|
170
|
-
export interface ForStatement extends BaseStatement {
|
171
|
-
type: "ForStatement";
|
172
|
-
init?: VariableDeclaration | Expression | null;
|
173
|
-
test?: Expression | null;
|
174
|
-
update?: Expression | null;
|
175
|
-
body: Statement;
|
176
|
-
}
|
177
|
-
|
178
|
-
interface BaseForXStatement extends BaseStatement {
|
179
|
-
left: VariableDeclaration | Pattern;
|
180
|
-
right: Expression;
|
181
|
-
body: Statement;
|
182
|
-
}
|
183
|
-
|
184
|
-
export interface ForInStatement extends BaseForXStatement {
|
185
|
-
type: "ForInStatement";
|
186
|
-
}
|
187
|
-
|
188
|
-
export interface DebuggerStatement extends BaseStatement {
|
189
|
-
type: "DebuggerStatement";
|
190
|
-
}
|
191
|
-
|
192
|
-
export type Declaration =
|
193
|
-
FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
194
|
-
|
195
|
-
interface BaseDeclaration extends BaseStatement { }
|
196
|
-
|
197
|
-
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
198
|
-
type: "FunctionDeclaration";
|
199
|
-
/** It is null when a function declaration is a part of the `export default function` statement */
|
200
|
-
id: Identifier | null;
|
201
|
-
body: BlockStatement;
|
202
|
-
}
|
203
|
-
|
204
|
-
export interface VariableDeclaration extends BaseDeclaration {
|
205
|
-
type: "VariableDeclaration";
|
206
|
-
declarations: Array<VariableDeclarator>;
|
207
|
-
kind: "var" | "let" | "const";
|
208
|
-
}
|
209
|
-
|
210
|
-
export interface VariableDeclarator extends BaseNode {
|
211
|
-
type: "VariableDeclarator";
|
212
|
-
id: Pattern;
|
213
|
-
init?: Expression | null;
|
214
|
-
}
|
215
|
-
|
216
|
-
type Expression =
|
217
|
-
ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression |
|
218
|
-
ArrowFunctionExpression | YieldExpression | Literal | UnaryExpression |
|
219
|
-
UpdateExpression | BinaryExpression | AssignmentExpression |
|
220
|
-
LogicalExpression | MemberExpression | ConditionalExpression |
|
221
|
-
CallExpression | NewExpression | SequenceExpression | TemplateLiteral |
|
222
|
-
TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier |
|
223
|
-
AwaitExpression;
|
224
|
-
|
225
|
-
export interface BaseExpression extends BaseNode { }
|
226
|
-
|
227
|
-
export interface ThisExpression extends BaseExpression {
|
228
|
-
type: "ThisExpression";
|
229
|
-
}
|
230
|
-
|
231
|
-
export interface ArrayExpression extends BaseExpression {
|
232
|
-
type: "ArrayExpression";
|
233
|
-
elements: Array<Expression | SpreadElement>;
|
234
|
-
}
|
235
|
-
|
236
|
-
export interface ObjectExpression extends BaseExpression {
|
237
|
-
type: "ObjectExpression";
|
238
|
-
properties: Array<Property>;
|
239
|
-
}
|
240
|
-
|
241
|
-
export interface Property extends BaseNode {
|
242
|
-
type: "Property";
|
243
|
-
key: Expression;
|
244
|
-
value: Expression | Pattern; // Could be an AssignmentProperty
|
245
|
-
kind: "init" | "get" | "set";
|
246
|
-
method: boolean;
|
247
|
-
shorthand: boolean;
|
248
|
-
computed: boolean;
|
249
|
-
}
|
250
|
-
|
251
|
-
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
252
|
-
id?: Identifier | null;
|
253
|
-
type: "FunctionExpression";
|
254
|
-
body: BlockStatement;
|
255
|
-
}
|
256
|
-
|
257
|
-
export interface SequenceExpression extends BaseExpression {
|
258
|
-
type: "SequenceExpression";
|
259
|
-
expressions: Array<Expression>;
|
260
|
-
}
|
261
|
-
|
262
|
-
export interface UnaryExpression extends BaseExpression {
|
263
|
-
type: "UnaryExpression";
|
264
|
-
operator: UnaryOperator;
|
265
|
-
prefix: true;
|
266
|
-
argument: Expression;
|
267
|
-
}
|
268
|
-
|
269
|
-
export interface BinaryExpression extends BaseExpression {
|
270
|
-
type: "BinaryExpression";
|
271
|
-
operator: BinaryOperator;
|
272
|
-
left: Expression;
|
273
|
-
right: Expression;
|
274
|
-
}
|
275
|
-
|
276
|
-
export interface AssignmentExpression extends BaseExpression {
|
277
|
-
type: "AssignmentExpression";
|
278
|
-
operator: AssignmentOperator;
|
279
|
-
left: Pattern | MemberExpression;
|
280
|
-
right: Expression;
|
281
|
-
}
|
282
|
-
|
283
|
-
export interface UpdateExpression extends BaseExpression {
|
284
|
-
type: "UpdateExpression";
|
285
|
-
operator: UpdateOperator;
|
286
|
-
argument: Expression;
|
287
|
-
prefix: boolean;
|
288
|
-
}
|
289
|
-
|
290
|
-
export interface LogicalExpression extends BaseExpression {
|
291
|
-
type: "LogicalExpression";
|
292
|
-
operator: LogicalOperator;
|
293
|
-
left: Expression;
|
294
|
-
right: Expression;
|
295
|
-
}
|
296
|
-
|
297
|
-
export interface ConditionalExpression extends BaseExpression {
|
298
|
-
type: "ConditionalExpression";
|
299
|
-
test: Expression;
|
300
|
-
alternate: Expression;
|
301
|
-
consequent: Expression;
|
302
|
-
}
|
303
|
-
|
304
|
-
interface BaseCallExpression extends BaseExpression {
|
305
|
-
callee: Expression | Super;
|
306
|
-
arguments: Array<Expression | SpreadElement>;
|
307
|
-
}
|
308
|
-
export type CallExpression = SimpleCallExpression | NewExpression;
|
309
|
-
|
310
|
-
export interface SimpleCallExpression extends BaseCallExpression {
|
311
|
-
type: "CallExpression";
|
312
|
-
}
|
313
|
-
|
314
|
-
export interface NewExpression extends BaseCallExpression {
|
315
|
-
type: "NewExpression";
|
316
|
-
}
|
317
|
-
|
318
|
-
export interface MemberExpression extends BaseExpression, BasePattern {
|
319
|
-
type: "MemberExpression";
|
320
|
-
object: Expression | Super;
|
321
|
-
property: Expression;
|
322
|
-
computed: boolean;
|
323
|
-
}
|
324
|
-
|
325
|
-
export type Pattern =
|
326
|
-
Identifier | ObjectPattern | ArrayPattern | RestElement |
|
327
|
-
AssignmentPattern | MemberExpression;
|
328
|
-
|
329
|
-
interface BasePattern extends BaseNode { }
|
330
|
-
|
331
|
-
export interface SwitchCase extends BaseNode {
|
332
|
-
type: "SwitchCase";
|
333
|
-
test?: Expression | null;
|
334
|
-
consequent: Array<Statement>;
|
335
|
-
}
|
336
|
-
|
337
|
-
export interface CatchClause extends BaseNode {
|
338
|
-
type: "CatchClause";
|
339
|
-
param: Pattern;
|
340
|
-
body: BlockStatement;
|
341
|
-
}
|
342
|
-
|
343
|
-
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
344
|
-
type: "Identifier";
|
345
|
-
name: string;
|
346
|
-
}
|
347
|
-
|
348
|
-
export type Literal = SimpleLiteral | RegExpLiteral;
|
349
|
-
|
350
|
-
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
351
|
-
type: "Literal";
|
352
|
-
value: string | boolean | number | null;
|
353
|
-
raw?: string;
|
354
|
-
}
|
355
|
-
|
356
|
-
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
357
|
-
type: "Literal";
|
358
|
-
value?: RegExp | null;
|
359
|
-
regex: {
|
360
|
-
pattern: string;
|
361
|
-
flags: string;
|
362
|
-
};
|
363
|
-
raw?: string;
|
364
|
-
}
|
365
|
-
|
366
|
-
export type UnaryOperator =
|
367
|
-
"-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
368
|
-
|
369
|
-
export type BinaryOperator =
|
370
|
-
"==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" |
|
371
|
-
">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" |
|
372
|
-
"instanceof";
|
373
|
-
|
374
|
-
export type LogicalOperator = "||" | "&&";
|
375
|
-
|
376
|
-
export type AssignmentOperator =
|
377
|
-
"=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" |
|
378
|
-
"|=" | "^=" | "&=";
|
379
|
-
|
380
|
-
export type UpdateOperator = "++" | "--";
|
381
|
-
|
382
|
-
export interface ForOfStatement extends BaseForXStatement {
|
383
|
-
type: "ForOfStatement";
|
384
|
-
}
|
385
|
-
|
386
|
-
export interface Super extends BaseNode {
|
387
|
-
type: "Super";
|
388
|
-
}
|
389
|
-
|
390
|
-
export interface SpreadElement extends BaseNode {
|
391
|
-
type: "SpreadElement";
|
392
|
-
argument: Expression;
|
393
|
-
}
|
394
|
-
|
395
|
-
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
396
|
-
type: "ArrowFunctionExpression";
|
397
|
-
expression: boolean;
|
398
|
-
body: BlockStatement | Expression;
|
399
|
-
}
|
400
|
-
|
401
|
-
export interface YieldExpression extends BaseExpression {
|
402
|
-
type: "YieldExpression";
|
403
|
-
argument?: Expression | null;
|
404
|
-
delegate: boolean;
|
405
|
-
}
|
406
|
-
|
407
|
-
export interface TemplateLiteral extends BaseExpression {
|
408
|
-
type: "TemplateLiteral";
|
409
|
-
quasis: Array<TemplateElement>;
|
410
|
-
expressions: Array<Expression>;
|
411
|
-
}
|
412
|
-
|
413
|
-
export interface TaggedTemplateExpression extends BaseExpression {
|
414
|
-
type: "TaggedTemplateExpression";
|
415
|
-
tag: Expression;
|
416
|
-
quasi: TemplateLiteral;
|
417
|
-
}
|
418
|
-
|
419
|
-
export interface TemplateElement extends BaseNode {
|
420
|
-
type: "TemplateElement";
|
421
|
-
tail: boolean;
|
422
|
-
value: {
|
423
|
-
cooked: string;
|
424
|
-
raw: string;
|
425
|
-
};
|
426
|
-
}
|
427
|
-
|
428
|
-
export interface AssignmentProperty extends Property {
|
429
|
-
value: Pattern;
|
430
|
-
kind: "init";
|
431
|
-
method: boolean; // false
|
432
|
-
}
|
433
|
-
|
434
|
-
export interface ObjectPattern extends BasePattern {
|
435
|
-
type: "ObjectPattern";
|
436
|
-
properties: Array<AssignmentProperty>;
|
437
|
-
}
|
438
|
-
|
439
|
-
export interface ArrayPattern extends BasePattern {
|
440
|
-
type: "ArrayPattern";
|
441
|
-
elements: Array<Pattern>;
|
442
|
-
}
|
443
|
-
|
444
|
-
export interface RestElement extends BasePattern {
|
445
|
-
type: "RestElement";
|
446
|
-
argument: Pattern;
|
447
|
-
}
|
448
|
-
|
449
|
-
export interface AssignmentPattern extends BasePattern {
|
450
|
-
type: "AssignmentPattern";
|
451
|
-
left: Pattern;
|
452
|
-
right: Expression;
|
453
|
-
}
|
454
|
-
|
455
|
-
export type Class = ClassDeclaration | ClassExpression;
|
456
|
-
interface BaseClass extends BaseNode {
|
457
|
-
superClass?: Expression | null;
|
458
|
-
body: ClassBody;
|
459
|
-
}
|
460
|
-
|
461
|
-
export interface ClassBody extends BaseNode {
|
462
|
-
type: "ClassBody";
|
463
|
-
body: Array<MethodDefinition>;
|
464
|
-
}
|
465
|
-
|
466
|
-
export interface MethodDefinition extends BaseNode {
|
467
|
-
type: "MethodDefinition";
|
468
|
-
key: Expression;
|
469
|
-
value: FunctionExpression;
|
470
|
-
kind: "constructor" | "method" | "get" | "set";
|
471
|
-
computed: boolean;
|
472
|
-
static: boolean;
|
473
|
-
}
|
474
|
-
|
475
|
-
export interface ClassDeclaration extends BaseClass, BaseDeclaration {
|
476
|
-
type: "ClassDeclaration";
|
477
|
-
/** It is null when a class declaration is a part of the `export default class` statement */
|
478
|
-
id: Identifier | null;
|
479
|
-
}
|
480
|
-
|
481
|
-
export interface ClassExpression extends BaseClass, BaseExpression {
|
482
|
-
type: "ClassExpression";
|
483
|
-
id?: Identifier | null;
|
484
|
-
}
|
485
|
-
|
486
|
-
export interface MetaProperty extends BaseExpression {
|
487
|
-
type: "MetaProperty";
|
488
|
-
meta: Identifier;
|
489
|
-
property: Identifier;
|
490
|
-
}
|
491
|
-
|
492
|
-
export type ModuleDeclaration =
|
493
|
-
ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration |
|
494
|
-
ExportAllDeclaration;
|
495
|
-
interface BaseModuleDeclaration extends BaseNode { }
|
496
|
-
|
497
|
-
export type ModuleSpecifier =
|
498
|
-
ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier |
|
499
|
-
ExportSpecifier;
|
500
|
-
interface BaseModuleSpecifier extends BaseNode {
|
501
|
-
local: Identifier;
|
502
|
-
}
|
503
|
-
|
504
|
-
export interface ImportDeclaration extends BaseModuleDeclaration {
|
505
|
-
type: "ImportDeclaration";
|
506
|
-
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
507
|
-
source: Literal;
|
508
|
-
}
|
509
|
-
|
510
|
-
export interface ImportSpecifier extends BaseModuleSpecifier {
|
511
|
-
type: "ImportSpecifier";
|
512
|
-
imported: Identifier;
|
513
|
-
}
|
514
|
-
|
515
|
-
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
516
|
-
type: "ImportDefaultSpecifier";
|
517
|
-
}
|
518
|
-
|
519
|
-
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
520
|
-
type: "ImportNamespaceSpecifier";
|
521
|
-
}
|
522
|
-
|
523
|
-
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
524
|
-
type: "ExportNamedDeclaration";
|
525
|
-
declaration?: Declaration | null;
|
526
|
-
specifiers: Array<ExportSpecifier>;
|
527
|
-
source?: Literal | null;
|
528
|
-
}
|
529
|
-
|
530
|
-
export interface ExportSpecifier extends BaseModuleSpecifier {
|
531
|
-
type: "ExportSpecifier";
|
532
|
-
exported: Identifier;
|
533
|
-
}
|
534
|
-
|
535
|
-
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
536
|
-
type: "ExportDefaultDeclaration";
|
537
|
-
declaration: Declaration | Expression;
|
538
|
-
}
|
539
|
-
|
540
|
-
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
541
|
-
type: "ExportAllDeclaration";
|
542
|
-
source: Literal;
|
543
|
-
}
|
544
|
-
|
545
|
-
export interface AwaitExpression extends BaseExpression {
|
546
|
-
type: "AwaitExpression";
|
547
|
-
argument: Expression;
|
548
|
-
}
|
1
|
+
// Type definitions for ESTree AST specification
|
2
|
+
// Project: https://github.com/estree/estree
|
3
|
+
// Definitions by: RReverser <https://github.com/RReverser>
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5
|
+
|
6
|
+
// This definition file follows a somewhat unusual format. ESTree allows
|
7
|
+
// runtime type checks based on the `type` parameter. In order to explain this
|
8
|
+
// to typescript we want to use discriminated union types:
|
9
|
+
// https://github.com/Microsoft/TypeScript/pull/9163
|
10
|
+
//
|
11
|
+
// For ESTree this is a bit tricky because the high level interfaces like
|
12
|
+
// Node or Function are pulling double duty. We want to pass common fields down
|
13
|
+
// to the interfaces that extend them (like Identifier or
|
14
|
+
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
15
|
+
// common fields on them. So we've split the high level interfaces into two
|
16
|
+
// types, a base type which passes down inhereted fields, and a type union of
|
17
|
+
// all types which extend the base type. Only the type union is exported, and
|
18
|
+
// the union is how other types refer to the collection of inheriting types.
|
19
|
+
//
|
20
|
+
// This makes the definitions file here somewhat more difficult to maintain,
|
21
|
+
// but it has the notable advantage of making ESTree much easier to use as
|
22
|
+
// an end user.
|
23
|
+
|
24
|
+
interface BaseNodeWithoutComments {
|
25
|
+
// Every leaf interface that extends BaseNode must specify a type property.
|
26
|
+
// The type property should be a string literal. For example, Identifier
|
27
|
+
// has: `type: "Identifier"`
|
28
|
+
type: string;
|
29
|
+
loc?: SourceLocation | null;
|
30
|
+
range?: [number, number];
|
31
|
+
}
|
32
|
+
|
33
|
+
interface BaseNode extends BaseNodeWithoutComments {
|
34
|
+
leadingComments?: Array<Comment>;
|
35
|
+
trailingComments?: Array<Comment>;
|
36
|
+
}
|
37
|
+
|
38
|
+
export type Node =
|
39
|
+
Identifier | Literal | Program | Function | SwitchCase | CatchClause |
|
40
|
+
VariableDeclarator | Statement | Expression | Property |
|
41
|
+
AssignmentProperty | Super | TemplateElement | SpreadElement | Pattern |
|
42
|
+
ClassBody | Class | MethodDefinition | ModuleDeclaration | ModuleSpecifier;
|
43
|
+
|
44
|
+
export interface Comment extends BaseNodeWithoutComments {
|
45
|
+
type: "Line" | "Block";
|
46
|
+
value: string;
|
47
|
+
}
|
48
|
+
|
49
|
+
interface SourceLocation {
|
50
|
+
source?: string | null;
|
51
|
+
start: Position;
|
52
|
+
end: Position;
|
53
|
+
}
|
54
|
+
|
55
|
+
export interface Position {
|
56
|
+
/** >= 1 */
|
57
|
+
line: number;
|
58
|
+
/** >= 0 */
|
59
|
+
column: number;
|
60
|
+
}
|
61
|
+
|
62
|
+
export interface Program extends BaseNode {
|
63
|
+
type: "Program";
|
64
|
+
sourceType: "script" | "module";
|
65
|
+
body: Array<Statement | ModuleDeclaration>;
|
66
|
+
comments?: Array<Comment>;
|
67
|
+
}
|
68
|
+
|
69
|
+
interface BaseFunction extends BaseNode {
|
70
|
+
params: Array<Pattern>;
|
71
|
+
generator?: boolean;
|
72
|
+
async?: boolean;
|
73
|
+
// The body is either BlockStatement or Expression because arrow functions
|
74
|
+
// can have a body that's either. FunctionDeclarations and
|
75
|
+
// FunctionExpressions have only BlockStatement bodies.
|
76
|
+
body: BlockStatement | Expression;
|
77
|
+
}
|
78
|
+
|
79
|
+
export type Function =
|
80
|
+
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
81
|
+
|
82
|
+
export type Statement =
|
83
|
+
ExpressionStatement | BlockStatement | EmptyStatement |
|
84
|
+
DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement |
|
85
|
+
BreakStatement | ContinueStatement | IfStatement | SwitchStatement |
|
86
|
+
ThrowStatement | TryStatement | WhileStatement | DoWhileStatement |
|
87
|
+
ForStatement | ForInStatement | ForOfStatement | Declaration;
|
88
|
+
|
89
|
+
interface BaseStatement extends BaseNode { }
|
90
|
+
|
91
|
+
export interface EmptyStatement extends BaseStatement {
|
92
|
+
type: "EmptyStatement";
|
93
|
+
}
|
94
|
+
|
95
|
+
export interface BlockStatement extends BaseStatement {
|
96
|
+
type: "BlockStatement";
|
97
|
+
body: Array<Statement>;
|
98
|
+
innerComments?: Array<Comment>;
|
99
|
+
}
|
100
|
+
|
101
|
+
export interface ExpressionStatement extends BaseStatement {
|
102
|
+
type: "ExpressionStatement";
|
103
|
+
expression: Expression;
|
104
|
+
}
|
105
|
+
|
106
|
+
export interface IfStatement extends BaseStatement {
|
107
|
+
type: "IfStatement";
|
108
|
+
test: Expression;
|
109
|
+
consequent: Statement;
|
110
|
+
alternate?: Statement | null;
|
111
|
+
}
|
112
|
+
|
113
|
+
export interface LabeledStatement extends BaseStatement {
|
114
|
+
type: "LabeledStatement";
|
115
|
+
label: Identifier;
|
116
|
+
body: Statement;
|
117
|
+
}
|
118
|
+
|
119
|
+
export interface BreakStatement extends BaseStatement {
|
120
|
+
type: "BreakStatement";
|
121
|
+
label?: Identifier | null;
|
122
|
+
}
|
123
|
+
|
124
|
+
export interface ContinueStatement extends BaseStatement {
|
125
|
+
type: "ContinueStatement";
|
126
|
+
label?: Identifier | null;
|
127
|
+
}
|
128
|
+
|
129
|
+
export interface WithStatement extends BaseStatement {
|
130
|
+
type: "WithStatement";
|
131
|
+
object: Expression;
|
132
|
+
body: Statement;
|
133
|
+
}
|
134
|
+
|
135
|
+
export interface SwitchStatement extends BaseStatement {
|
136
|
+
type: "SwitchStatement";
|
137
|
+
discriminant: Expression;
|
138
|
+
cases: Array<SwitchCase>;
|
139
|
+
}
|
140
|
+
|
141
|
+
export interface ReturnStatement extends BaseStatement {
|
142
|
+
type: "ReturnStatement";
|
143
|
+
argument?: Expression | null;
|
144
|
+
}
|
145
|
+
|
146
|
+
export interface ThrowStatement extends BaseStatement {
|
147
|
+
type: "ThrowStatement";
|
148
|
+
argument: Expression;
|
149
|
+
}
|
150
|
+
|
151
|
+
export interface TryStatement extends BaseStatement {
|
152
|
+
type: "TryStatement";
|
153
|
+
block: BlockStatement;
|
154
|
+
handler?: CatchClause | null;
|
155
|
+
finalizer?: BlockStatement | null;
|
156
|
+
}
|
157
|
+
|
158
|
+
export interface WhileStatement extends BaseStatement {
|
159
|
+
type: "WhileStatement";
|
160
|
+
test: Expression;
|
161
|
+
body: Statement;
|
162
|
+
}
|
163
|
+
|
164
|
+
export interface DoWhileStatement extends BaseStatement {
|
165
|
+
type: "DoWhileStatement";
|
166
|
+
body: Statement;
|
167
|
+
test: Expression;
|
168
|
+
}
|
169
|
+
|
170
|
+
export interface ForStatement extends BaseStatement {
|
171
|
+
type: "ForStatement";
|
172
|
+
init?: VariableDeclaration | Expression | null;
|
173
|
+
test?: Expression | null;
|
174
|
+
update?: Expression | null;
|
175
|
+
body: Statement;
|
176
|
+
}
|
177
|
+
|
178
|
+
interface BaseForXStatement extends BaseStatement {
|
179
|
+
left: VariableDeclaration | Pattern;
|
180
|
+
right: Expression;
|
181
|
+
body: Statement;
|
182
|
+
}
|
183
|
+
|
184
|
+
export interface ForInStatement extends BaseForXStatement {
|
185
|
+
type: "ForInStatement";
|
186
|
+
}
|
187
|
+
|
188
|
+
export interface DebuggerStatement extends BaseStatement {
|
189
|
+
type: "DebuggerStatement";
|
190
|
+
}
|
191
|
+
|
192
|
+
export type Declaration =
|
193
|
+
FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
194
|
+
|
195
|
+
interface BaseDeclaration extends BaseStatement { }
|
196
|
+
|
197
|
+
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
198
|
+
type: "FunctionDeclaration";
|
199
|
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
200
|
+
id: Identifier | null;
|
201
|
+
body: BlockStatement;
|
202
|
+
}
|
203
|
+
|
204
|
+
export interface VariableDeclaration extends BaseDeclaration {
|
205
|
+
type: "VariableDeclaration";
|
206
|
+
declarations: Array<VariableDeclarator>;
|
207
|
+
kind: "var" | "let" | "const";
|
208
|
+
}
|
209
|
+
|
210
|
+
export interface VariableDeclarator extends BaseNode {
|
211
|
+
type: "VariableDeclarator";
|
212
|
+
id: Pattern;
|
213
|
+
init?: Expression | null;
|
214
|
+
}
|
215
|
+
|
216
|
+
type Expression =
|
217
|
+
ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression |
|
218
|
+
ArrowFunctionExpression | YieldExpression | Literal | UnaryExpression |
|
219
|
+
UpdateExpression | BinaryExpression | AssignmentExpression |
|
220
|
+
LogicalExpression | MemberExpression | ConditionalExpression |
|
221
|
+
CallExpression | NewExpression | SequenceExpression | TemplateLiteral |
|
222
|
+
TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier |
|
223
|
+
AwaitExpression;
|
224
|
+
|
225
|
+
export interface BaseExpression extends BaseNode { }
|
226
|
+
|
227
|
+
export interface ThisExpression extends BaseExpression {
|
228
|
+
type: "ThisExpression";
|
229
|
+
}
|
230
|
+
|
231
|
+
export interface ArrayExpression extends BaseExpression {
|
232
|
+
type: "ArrayExpression";
|
233
|
+
elements: Array<Expression | SpreadElement>;
|
234
|
+
}
|
235
|
+
|
236
|
+
export interface ObjectExpression extends BaseExpression {
|
237
|
+
type: "ObjectExpression";
|
238
|
+
properties: Array<Property>;
|
239
|
+
}
|
240
|
+
|
241
|
+
export interface Property extends BaseNode {
|
242
|
+
type: "Property";
|
243
|
+
key: Expression;
|
244
|
+
value: Expression | Pattern; // Could be an AssignmentProperty
|
245
|
+
kind: "init" | "get" | "set";
|
246
|
+
method: boolean;
|
247
|
+
shorthand: boolean;
|
248
|
+
computed: boolean;
|
249
|
+
}
|
250
|
+
|
251
|
+
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
252
|
+
id?: Identifier | null;
|
253
|
+
type: "FunctionExpression";
|
254
|
+
body: BlockStatement;
|
255
|
+
}
|
256
|
+
|
257
|
+
export interface SequenceExpression extends BaseExpression {
|
258
|
+
type: "SequenceExpression";
|
259
|
+
expressions: Array<Expression>;
|
260
|
+
}
|
261
|
+
|
262
|
+
export interface UnaryExpression extends BaseExpression {
|
263
|
+
type: "UnaryExpression";
|
264
|
+
operator: UnaryOperator;
|
265
|
+
prefix: true;
|
266
|
+
argument: Expression;
|
267
|
+
}
|
268
|
+
|
269
|
+
export interface BinaryExpression extends BaseExpression {
|
270
|
+
type: "BinaryExpression";
|
271
|
+
operator: BinaryOperator;
|
272
|
+
left: Expression;
|
273
|
+
right: Expression;
|
274
|
+
}
|
275
|
+
|
276
|
+
export interface AssignmentExpression extends BaseExpression {
|
277
|
+
type: "AssignmentExpression";
|
278
|
+
operator: AssignmentOperator;
|
279
|
+
left: Pattern | MemberExpression;
|
280
|
+
right: Expression;
|
281
|
+
}
|
282
|
+
|
283
|
+
export interface UpdateExpression extends BaseExpression {
|
284
|
+
type: "UpdateExpression";
|
285
|
+
operator: UpdateOperator;
|
286
|
+
argument: Expression;
|
287
|
+
prefix: boolean;
|
288
|
+
}
|
289
|
+
|
290
|
+
export interface LogicalExpression extends BaseExpression {
|
291
|
+
type: "LogicalExpression";
|
292
|
+
operator: LogicalOperator;
|
293
|
+
left: Expression;
|
294
|
+
right: Expression;
|
295
|
+
}
|
296
|
+
|
297
|
+
export interface ConditionalExpression extends BaseExpression {
|
298
|
+
type: "ConditionalExpression";
|
299
|
+
test: Expression;
|
300
|
+
alternate: Expression;
|
301
|
+
consequent: Expression;
|
302
|
+
}
|
303
|
+
|
304
|
+
interface BaseCallExpression extends BaseExpression {
|
305
|
+
callee: Expression | Super;
|
306
|
+
arguments: Array<Expression | SpreadElement>;
|
307
|
+
}
|
308
|
+
export type CallExpression = SimpleCallExpression | NewExpression;
|
309
|
+
|
310
|
+
export interface SimpleCallExpression extends BaseCallExpression {
|
311
|
+
type: "CallExpression";
|
312
|
+
}
|
313
|
+
|
314
|
+
export interface NewExpression extends BaseCallExpression {
|
315
|
+
type: "NewExpression";
|
316
|
+
}
|
317
|
+
|
318
|
+
export interface MemberExpression extends BaseExpression, BasePattern {
|
319
|
+
type: "MemberExpression";
|
320
|
+
object: Expression | Super;
|
321
|
+
property: Expression;
|
322
|
+
computed: boolean;
|
323
|
+
}
|
324
|
+
|
325
|
+
export type Pattern =
|
326
|
+
Identifier | ObjectPattern | ArrayPattern | RestElement |
|
327
|
+
AssignmentPattern | MemberExpression;
|
328
|
+
|
329
|
+
interface BasePattern extends BaseNode { }
|
330
|
+
|
331
|
+
export interface SwitchCase extends BaseNode {
|
332
|
+
type: "SwitchCase";
|
333
|
+
test?: Expression | null;
|
334
|
+
consequent: Array<Statement>;
|
335
|
+
}
|
336
|
+
|
337
|
+
export interface CatchClause extends BaseNode {
|
338
|
+
type: "CatchClause";
|
339
|
+
param: Pattern;
|
340
|
+
body: BlockStatement;
|
341
|
+
}
|
342
|
+
|
343
|
+
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
344
|
+
type: "Identifier";
|
345
|
+
name: string;
|
346
|
+
}
|
347
|
+
|
348
|
+
export type Literal = SimpleLiteral | RegExpLiteral;
|
349
|
+
|
350
|
+
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
351
|
+
type: "Literal";
|
352
|
+
value: string | boolean | number | null;
|
353
|
+
raw?: string;
|
354
|
+
}
|
355
|
+
|
356
|
+
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
357
|
+
type: "Literal";
|
358
|
+
value?: RegExp | null;
|
359
|
+
regex: {
|
360
|
+
pattern: string;
|
361
|
+
flags: string;
|
362
|
+
};
|
363
|
+
raw?: string;
|
364
|
+
}
|
365
|
+
|
366
|
+
export type UnaryOperator =
|
367
|
+
"-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
368
|
+
|
369
|
+
export type BinaryOperator =
|
370
|
+
"==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" |
|
371
|
+
">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" |
|
372
|
+
"instanceof";
|
373
|
+
|
374
|
+
export type LogicalOperator = "||" | "&&";
|
375
|
+
|
376
|
+
export type AssignmentOperator =
|
377
|
+
"=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" |
|
378
|
+
"|=" | "^=" | "&=";
|
379
|
+
|
380
|
+
export type UpdateOperator = "++" | "--";
|
381
|
+
|
382
|
+
export interface ForOfStatement extends BaseForXStatement {
|
383
|
+
type: "ForOfStatement";
|
384
|
+
}
|
385
|
+
|
386
|
+
export interface Super extends BaseNode {
|
387
|
+
type: "Super";
|
388
|
+
}
|
389
|
+
|
390
|
+
export interface SpreadElement extends BaseNode {
|
391
|
+
type: "SpreadElement";
|
392
|
+
argument: Expression;
|
393
|
+
}
|
394
|
+
|
395
|
+
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
396
|
+
type: "ArrowFunctionExpression";
|
397
|
+
expression: boolean;
|
398
|
+
body: BlockStatement | Expression;
|
399
|
+
}
|
400
|
+
|
401
|
+
export interface YieldExpression extends BaseExpression {
|
402
|
+
type: "YieldExpression";
|
403
|
+
argument?: Expression | null;
|
404
|
+
delegate: boolean;
|
405
|
+
}
|
406
|
+
|
407
|
+
export interface TemplateLiteral extends BaseExpression {
|
408
|
+
type: "TemplateLiteral";
|
409
|
+
quasis: Array<TemplateElement>;
|
410
|
+
expressions: Array<Expression>;
|
411
|
+
}
|
412
|
+
|
413
|
+
export interface TaggedTemplateExpression extends BaseExpression {
|
414
|
+
type: "TaggedTemplateExpression";
|
415
|
+
tag: Expression;
|
416
|
+
quasi: TemplateLiteral;
|
417
|
+
}
|
418
|
+
|
419
|
+
export interface TemplateElement extends BaseNode {
|
420
|
+
type: "TemplateElement";
|
421
|
+
tail: boolean;
|
422
|
+
value: {
|
423
|
+
cooked: string;
|
424
|
+
raw: string;
|
425
|
+
};
|
426
|
+
}
|
427
|
+
|
428
|
+
export interface AssignmentProperty extends Property {
|
429
|
+
value: Pattern;
|
430
|
+
kind: "init";
|
431
|
+
method: boolean; // false
|
432
|
+
}
|
433
|
+
|
434
|
+
export interface ObjectPattern extends BasePattern {
|
435
|
+
type: "ObjectPattern";
|
436
|
+
properties: Array<AssignmentProperty>;
|
437
|
+
}
|
438
|
+
|
439
|
+
export interface ArrayPattern extends BasePattern {
|
440
|
+
type: "ArrayPattern";
|
441
|
+
elements: Array<Pattern>;
|
442
|
+
}
|
443
|
+
|
444
|
+
export interface RestElement extends BasePattern {
|
445
|
+
type: "RestElement";
|
446
|
+
argument: Pattern;
|
447
|
+
}
|
448
|
+
|
449
|
+
export interface AssignmentPattern extends BasePattern {
|
450
|
+
type: "AssignmentPattern";
|
451
|
+
left: Pattern;
|
452
|
+
right: Expression;
|
453
|
+
}
|
454
|
+
|
455
|
+
export type Class = ClassDeclaration | ClassExpression;
|
456
|
+
interface BaseClass extends BaseNode {
|
457
|
+
superClass?: Expression | null;
|
458
|
+
body: ClassBody;
|
459
|
+
}
|
460
|
+
|
461
|
+
export interface ClassBody extends BaseNode {
|
462
|
+
type: "ClassBody";
|
463
|
+
body: Array<MethodDefinition>;
|
464
|
+
}
|
465
|
+
|
466
|
+
export interface MethodDefinition extends BaseNode {
|
467
|
+
type: "MethodDefinition";
|
468
|
+
key: Expression;
|
469
|
+
value: FunctionExpression;
|
470
|
+
kind: "constructor" | "method" | "get" | "set";
|
471
|
+
computed: boolean;
|
472
|
+
static: boolean;
|
473
|
+
}
|
474
|
+
|
475
|
+
export interface ClassDeclaration extends BaseClass, BaseDeclaration {
|
476
|
+
type: "ClassDeclaration";
|
477
|
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
478
|
+
id: Identifier | null;
|
479
|
+
}
|
480
|
+
|
481
|
+
export interface ClassExpression extends BaseClass, BaseExpression {
|
482
|
+
type: "ClassExpression";
|
483
|
+
id?: Identifier | null;
|
484
|
+
}
|
485
|
+
|
486
|
+
export interface MetaProperty extends BaseExpression {
|
487
|
+
type: "MetaProperty";
|
488
|
+
meta: Identifier;
|
489
|
+
property: Identifier;
|
490
|
+
}
|
491
|
+
|
492
|
+
export type ModuleDeclaration =
|
493
|
+
ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration |
|
494
|
+
ExportAllDeclaration;
|
495
|
+
interface BaseModuleDeclaration extends BaseNode { }
|
496
|
+
|
497
|
+
export type ModuleSpecifier =
|
498
|
+
ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier |
|
499
|
+
ExportSpecifier;
|
500
|
+
interface BaseModuleSpecifier extends BaseNode {
|
501
|
+
local: Identifier;
|
502
|
+
}
|
503
|
+
|
504
|
+
export interface ImportDeclaration extends BaseModuleDeclaration {
|
505
|
+
type: "ImportDeclaration";
|
506
|
+
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
507
|
+
source: Literal;
|
508
|
+
}
|
509
|
+
|
510
|
+
export interface ImportSpecifier extends BaseModuleSpecifier {
|
511
|
+
type: "ImportSpecifier";
|
512
|
+
imported: Identifier;
|
513
|
+
}
|
514
|
+
|
515
|
+
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
516
|
+
type: "ImportDefaultSpecifier";
|
517
|
+
}
|
518
|
+
|
519
|
+
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
520
|
+
type: "ImportNamespaceSpecifier";
|
521
|
+
}
|
522
|
+
|
523
|
+
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
524
|
+
type: "ExportNamedDeclaration";
|
525
|
+
declaration?: Declaration | null;
|
526
|
+
specifiers: Array<ExportSpecifier>;
|
527
|
+
source?: Literal | null;
|
528
|
+
}
|
529
|
+
|
530
|
+
export interface ExportSpecifier extends BaseModuleSpecifier {
|
531
|
+
type: "ExportSpecifier";
|
532
|
+
exported: Identifier;
|
533
|
+
}
|
534
|
+
|
535
|
+
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
536
|
+
type: "ExportDefaultDeclaration";
|
537
|
+
declaration: Declaration | Expression;
|
538
|
+
}
|
539
|
+
|
540
|
+
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
541
|
+
type: "ExportAllDeclaration";
|
542
|
+
source: Literal;
|
543
|
+
}
|
544
|
+
|
545
|
+
export interface AwaitExpression extends BaseExpression {
|
546
|
+
type: "AwaitExpression";
|
547
|
+
argument: Expression;
|
548
|
+
}
|