sveast 0.1.0 → 0.2.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 +12 -1
- package/index.d.ts +1203 -673
- package/index.js +1 -64
- package/package.json +1 -1
- package/parse-module.js +1 -0
- package/parse.js +2 -0
- package/shared-6xjb6x65.js +64 -0
package/index.d.ts
CHANGED
|
@@ -7,19 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function parse(source: string, options?: ParseOptions): AST.Root;
|
|
9
9
|
|
|
10
|
-
interface SourceLocation {
|
|
11
|
-
start: Location;
|
|
12
|
-
end: Location;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface Identifier {
|
|
16
|
-
type: "Identifier";
|
|
17
|
-
name: string;
|
|
18
|
-
start: number;
|
|
19
|
-
end: number;
|
|
20
|
-
loc?: SourceLocation;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
10
|
/**
|
|
24
11
|
* Options for {@link parse}. The defaults give svelte's own output, minus
|
|
25
12
|
* `loc` and `name_loc`.
|
|
@@ -39,638 +26,182 @@ export interface ParseOptions {
|
|
|
39
26
|
css?: boolean;
|
|
40
27
|
}
|
|
41
28
|
|
|
42
|
-
interface
|
|
29
|
+
export interface BaseNodeWithoutComments {
|
|
30
|
+
type: string;
|
|
31
|
+
start: number;
|
|
32
|
+
end: number;
|
|
33
|
+
loc?: SourceLocation | null | undefined;
|
|
34
|
+
range?: [number, number] | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface BaseNode extends BaseNodeWithoutComments {
|
|
38
|
+
leadingComments?: Comment[] | undefined;
|
|
39
|
+
trailingComments?: Comment[] | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface NodeMap {
|
|
43
|
+
AssignmentProperty: AssignmentProperty;
|
|
44
|
+
CatchClause: CatchClause;
|
|
45
|
+
Class: Class;
|
|
46
|
+
ClassBody: ClassBody;
|
|
47
|
+
Expression: Expression;
|
|
48
|
+
Function: Function;
|
|
49
|
+
Identifier: Identifier;
|
|
50
|
+
Literal: Literal;
|
|
51
|
+
MethodDefinition: MethodDefinition;
|
|
52
|
+
ModuleDeclaration: ModuleDeclaration;
|
|
53
|
+
ModuleSpecifier: ModuleSpecifier;
|
|
54
|
+
Pattern: Pattern;
|
|
55
|
+
PrivateIdentifier: PrivateIdentifier;
|
|
56
|
+
Program: Program;
|
|
57
|
+
Property: Property;
|
|
58
|
+
PropertyDefinition: PropertyDefinition;
|
|
59
|
+
SpreadElement: SpreadElement;
|
|
60
|
+
Statement: Statement;
|
|
61
|
+
Super: Super;
|
|
62
|
+
SwitchCase: SwitchCase;
|
|
63
|
+
TemplateElement: TemplateElement;
|
|
64
|
+
VariableDeclarator: VariableDeclarator;
|
|
65
|
+
ImportAttribute: ImportAttribute;
|
|
66
|
+
TSNode: TSNode;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type Node = NodeMap[keyof NodeMap];
|
|
70
|
+
|
|
71
|
+
export interface Comment extends BaseNodeWithoutComments {
|
|
72
|
+
type: "Line" | "Block";
|
|
73
|
+
value: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface SourceLocation {
|
|
77
|
+
source?: string | null | undefined;
|
|
78
|
+
start: Position;
|
|
79
|
+
end: Position;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface Position {
|
|
83
|
+
/** >= 1 */
|
|
43
84
|
line: number;
|
|
85
|
+
/** >= 0 */
|
|
44
86
|
column: number;
|
|
45
|
-
character: number;
|
|
46
87
|
}
|
|
47
88
|
|
|
48
|
-
|
|
89
|
+
export interface Program extends Omit<BaseNode, "leadingComments"> {
|
|
90
|
+
type: "Program";
|
|
91
|
+
sourceType: "script" | "module";
|
|
92
|
+
body: Array<Directive | Statement | ModuleDeclaration>;
|
|
93
|
+
comments?: Comment[] | undefined;
|
|
94
|
+
/** In a component's `<script>`, an HTML comment right before the tag becomes `{ type: "Line", value }`, without offsets, as in svelte. */
|
|
95
|
+
leadingComments?: Array<Comment | {
|
|
96
|
+
type: "Line";
|
|
97
|
+
value: string;
|
|
98
|
+
}> | undefined;
|
|
99
|
+
}
|
|
49
100
|
|
|
50
|
-
export
|
|
51
|
-
export interface BaseNode {
|
|
52
|
-
type: string;
|
|
53
|
-
start: number;
|
|
54
|
-
end: number;
|
|
55
|
-
}
|
|
56
|
-
export interface Fragment {
|
|
57
|
-
type: "Fragment";
|
|
58
|
-
nodes: Array<Text | Tag | ElementLike | Block | Comment>;
|
|
59
|
-
}
|
|
60
|
-
export interface Root extends BaseNode {
|
|
61
|
-
type: "Root";
|
|
62
|
-
/**
|
|
63
|
-
* Inline options provided by `<svelte:options>` — these override options passed to `compile(...)`
|
|
64
|
-
*/
|
|
65
|
-
options: SvelteOptions | null;
|
|
66
|
-
fragment: Fragment;
|
|
67
|
-
/** The parsed `<style>` element, if exists */
|
|
68
|
-
css: AST.CSS.StyleSheet | null;
|
|
69
|
-
/** The parsed `<script>` element, if exists */
|
|
70
|
-
instance?: Script | null;
|
|
71
|
-
/** The parsed `<script module>` element, if exists */
|
|
72
|
-
module?: Script | null;
|
|
73
|
-
/** Comments found in <script> and {expressions} */
|
|
74
|
-
comments: JSComment[];
|
|
75
|
-
}
|
|
76
|
-
export interface SvelteOptions {
|
|
77
|
-
start: number;
|
|
78
|
-
end: number;
|
|
79
|
-
runes?: boolean;
|
|
80
|
-
immutable?: boolean;
|
|
81
|
-
accessors?: boolean;
|
|
82
|
-
preserveWhitespace?: boolean;
|
|
83
|
-
namespace?: Namespace;
|
|
84
|
-
css?: "injected";
|
|
85
|
-
customElement?: {
|
|
86
|
-
tag?: string;
|
|
87
|
-
shadow?: "open" | "none" | ObjectExpression | undefined;
|
|
88
|
-
props?: Record<string, {
|
|
89
|
-
attribute?: string;
|
|
90
|
-
reflect?: boolean;
|
|
91
|
-
type?: "Array" | "Boolean" | "Number" | "Object" | "String";
|
|
92
|
-
}>;
|
|
93
|
-
/**
|
|
94
|
-
* Is of type
|
|
95
|
-
* ```ts
|
|
96
|
-
* (ceClass: new () => HTMLElement) => new () => HTMLElement
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
extend?: ArrowFunctionExpression | Identifier;
|
|
100
|
-
};
|
|
101
|
-
attributes: Attribute[];
|
|
102
|
-
}
|
|
103
|
-
/** Static text */
|
|
104
|
-
export interface Text extends BaseNode {
|
|
105
|
-
type: "Text";
|
|
106
|
-
/** Text with decoded HTML entities */
|
|
107
|
-
data: string;
|
|
108
|
-
/** The original text, with undecoded HTML entities */
|
|
109
|
-
raw: string;
|
|
110
|
-
}
|
|
111
|
-
/** A (possibly reactive) template expression — `{...}` */
|
|
112
|
-
export interface ExpressionTag extends BaseNode {
|
|
113
|
-
type: "ExpressionTag";
|
|
114
|
-
expression: Expression;
|
|
115
|
-
}
|
|
116
|
-
/** A (possibly reactive) HTML template expression — `{@html ...}` */
|
|
117
|
-
export interface HtmlTag extends BaseNode {
|
|
118
|
-
type: "HtmlTag";
|
|
119
|
-
expression: Expression;
|
|
120
|
-
}
|
|
121
|
-
/** An HTML comment */
|
|
122
|
-
export interface Comment extends BaseNode {
|
|
123
|
-
type: "Comment";
|
|
124
|
-
/** the contents of the comment */
|
|
125
|
-
data: string;
|
|
126
|
-
}
|
|
127
|
-
/** A `{@const ...}` tag */
|
|
128
|
-
export interface ConstTag extends BaseNode {
|
|
129
|
-
type: "ConstTag";
|
|
130
|
-
declaration: VariableDeclaration & {
|
|
131
|
-
declarations: [VariableDeclarator & {
|
|
132
|
-
id: Pattern;
|
|
133
|
-
init: Expression;
|
|
134
|
-
}];
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/** A `{let ...}` or `{const ...}` tag */
|
|
138
|
-
export interface DeclarationTag extends BaseNode {
|
|
139
|
-
type: "DeclarationTag";
|
|
140
|
-
declaration: VariableDeclaration;
|
|
141
|
-
}
|
|
142
|
-
/** A `{@debug ...}` tag */
|
|
143
|
-
export interface DebugTag extends BaseNode {
|
|
144
|
-
type: "DebugTag";
|
|
145
|
-
identifiers: Identifier[];
|
|
146
|
-
}
|
|
147
|
-
/** A `{@render foo(...)} tag */
|
|
148
|
-
export interface RenderTag extends BaseNode {
|
|
149
|
-
type: "RenderTag";
|
|
150
|
-
expression: SimpleCallExpression | (ChainExpression & {
|
|
151
|
-
expression: SimpleCallExpression;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/** A `{@attach foo(...)} tag */
|
|
155
|
-
export interface AttachTag extends BaseNode {
|
|
156
|
-
type: "AttachTag";
|
|
157
|
-
expression: Expression;
|
|
158
|
-
}
|
|
159
|
-
/** An `animate:` directive */
|
|
160
|
-
export interface AnimateDirective extends BaseAttribute {
|
|
161
|
-
type: "AnimateDirective";
|
|
162
|
-
/** The 'x' in `animate:x` */
|
|
163
|
-
name: string;
|
|
164
|
-
/** The y in `animate:x={y}` */
|
|
165
|
-
expression: null | Expression;
|
|
166
|
-
}
|
|
167
|
-
/** A `bind:` directive */
|
|
168
|
-
export interface BindDirective extends BaseAttribute {
|
|
169
|
-
type: "BindDirective";
|
|
170
|
-
/** The 'x' in `bind:x` */
|
|
171
|
-
name: string;
|
|
172
|
-
/** The y in `bind:x={y}` */
|
|
173
|
-
expression: Identifier | MemberExpression | SequenceExpression;
|
|
174
|
-
}
|
|
175
|
-
/** A `class:` directive */
|
|
176
|
-
export interface ClassDirective extends BaseAttribute {
|
|
177
|
-
type: "ClassDirective";
|
|
178
|
-
/** The 'x' in `class:x` */
|
|
179
|
-
name: "class";
|
|
180
|
-
/** The 'y' in `class:x={y}`, or the `x` in `class:x` */
|
|
181
|
-
expression: Expression;
|
|
182
|
-
}
|
|
183
|
-
/** A `let:` directive */
|
|
184
|
-
export interface LetDirective extends BaseAttribute {
|
|
185
|
-
type: "LetDirective";
|
|
186
|
-
/** The 'x' in `let:x` */
|
|
187
|
-
name: string;
|
|
188
|
-
/** The 'y' in `let:x={y}` */
|
|
189
|
-
expression: null | Identifier | ArrayExpression | ObjectExpression;
|
|
190
|
-
}
|
|
191
|
-
/** An `on:` directive */
|
|
192
|
-
export interface OnDirective extends BaseAttribute {
|
|
193
|
-
type: "OnDirective";
|
|
194
|
-
/** The 'x' in `on:x` */
|
|
195
|
-
name: string;
|
|
196
|
-
/** The 'y' in `on:x={y}` */
|
|
197
|
-
expression: null | Expression;
|
|
198
|
-
modifiers: Array<"capture" | "nonpassive" | "once" | "passive" | "preventDefault" | "self" | "stopImmediatePropagation" | "stopPropagation" | "trusted">;
|
|
199
|
-
}
|
|
200
|
-
/** A `style:` directive */
|
|
201
|
-
export interface StyleDirective extends BaseAttribute {
|
|
202
|
-
type: "StyleDirective";
|
|
203
|
-
/** The 'x' in `style:x` */
|
|
204
|
-
name: string;
|
|
205
|
-
/** The 'y' in `style:x={y}` */
|
|
206
|
-
value: true | ExpressionTag | Array<ExpressionTag | Text>;
|
|
207
|
-
modifiers: Array<"important">;
|
|
208
|
-
}
|
|
209
|
-
/** A `transition:`, `in:` or `out:` directive */
|
|
210
|
-
export interface TransitionDirective extends BaseAttribute {
|
|
211
|
-
type: "TransitionDirective";
|
|
212
|
-
/** The 'x' in `transition:x` */
|
|
213
|
-
name: string;
|
|
214
|
-
/** The 'y' in `transition:x={y}` */
|
|
215
|
-
expression: null | Expression;
|
|
216
|
-
modifiers: Array<"local" | "global">;
|
|
217
|
-
/** True if this is a `transition:` or `in:` directive */
|
|
218
|
-
intro: boolean;
|
|
219
|
-
/** True if this is a `transition:` or `out:` directive */
|
|
220
|
-
outro: boolean;
|
|
221
|
-
}
|
|
222
|
-
/** A `use:` directive */
|
|
223
|
-
export interface UseDirective extends BaseAttribute {
|
|
224
|
-
type: "UseDirective";
|
|
225
|
-
/** The 'x' in `use:x` */
|
|
226
|
-
name: string;
|
|
227
|
-
/** The 'y' in `use:x={y}` */
|
|
228
|
-
expression: null | Expression;
|
|
229
|
-
}
|
|
230
|
-
export interface BaseElement extends BaseNode {
|
|
231
|
-
name: string;
|
|
232
|
-
/** Only with `parse(source, { loc: true })`. */
|
|
233
|
-
name_loc?: SourceLocation;
|
|
234
|
-
attributes: Array<Attribute | SpreadAttribute | Directive | AttachTag>;
|
|
235
|
-
fragment: Fragment;
|
|
236
|
-
}
|
|
237
|
-
export interface Component extends BaseElement {
|
|
238
|
-
type: "Component";
|
|
239
|
-
}
|
|
240
|
-
export interface TitleElement extends BaseElement {
|
|
241
|
-
type: "TitleElement";
|
|
242
|
-
name: "title";
|
|
243
|
-
}
|
|
244
|
-
export interface SlotElement extends BaseElement {
|
|
245
|
-
type: "SlotElement";
|
|
246
|
-
name: "slot";
|
|
247
|
-
}
|
|
248
|
-
export interface RegularElement extends BaseElement {
|
|
249
|
-
type: "RegularElement";
|
|
250
|
-
}
|
|
251
|
-
export interface SvelteBody extends BaseElement {
|
|
252
|
-
type: "SvelteBody";
|
|
253
|
-
name: "svelte:body";
|
|
254
|
-
}
|
|
255
|
-
export interface SvelteComponent extends BaseElement {
|
|
256
|
-
type: "SvelteComponent";
|
|
257
|
-
name: "svelte:component";
|
|
258
|
-
expression: Expression;
|
|
259
|
-
}
|
|
260
|
-
export interface SvelteDocument extends BaseElement {
|
|
261
|
-
type: "SvelteDocument";
|
|
262
|
-
name: "svelte:document";
|
|
263
|
-
}
|
|
264
|
-
export interface SvelteElement extends BaseElement {
|
|
265
|
-
type: "SvelteElement";
|
|
266
|
-
name: "svelte:element";
|
|
267
|
-
tag: Expression;
|
|
268
|
-
}
|
|
269
|
-
export interface SvelteFragment extends BaseElement {
|
|
270
|
-
type: "SvelteFragment";
|
|
271
|
-
name: "svelte:fragment";
|
|
272
|
-
}
|
|
273
|
-
export interface SvelteBoundary extends BaseElement {
|
|
274
|
-
type: "SvelteBoundary";
|
|
275
|
-
name: "svelte:boundary";
|
|
276
|
-
}
|
|
277
|
-
export interface SvelteHead extends BaseElement {
|
|
278
|
-
type: "SvelteHead";
|
|
279
|
-
name: "svelte:head";
|
|
280
|
-
}
|
|
281
|
-
/** This is only an intermediate representation while parsing, it doesn't exist in the final AST */
|
|
282
|
-
export interface SvelteOptionsRaw extends BaseElement {
|
|
283
|
-
type: "SvelteOptions";
|
|
284
|
-
name: "svelte:options";
|
|
285
|
-
}
|
|
286
|
-
export interface SvelteSelf extends BaseElement {
|
|
287
|
-
type: "SvelteSelf";
|
|
288
|
-
name: "svelte:self";
|
|
289
|
-
}
|
|
290
|
-
export interface SvelteWindow extends BaseElement {
|
|
291
|
-
type: "SvelteWindow";
|
|
292
|
-
name: "svelte:window";
|
|
293
|
-
}
|
|
294
|
-
/** An `{#each ...}` block */
|
|
295
|
-
export interface EachBlock extends BaseNode {
|
|
296
|
-
type: "EachBlock";
|
|
297
|
-
expression: Expression;
|
|
298
|
-
/** The `entry` in `{#each item as entry}`. `null` if `as` part is omitted */
|
|
299
|
-
context: Pattern | null;
|
|
300
|
-
body: Fragment;
|
|
301
|
-
fallback?: Fragment;
|
|
302
|
-
index?: string;
|
|
303
|
-
key?: Expression;
|
|
304
|
-
}
|
|
305
|
-
/** An `{#if ...}` block */
|
|
306
|
-
export interface IfBlock extends BaseNode {
|
|
307
|
-
type: "IfBlock";
|
|
308
|
-
elseif: boolean;
|
|
309
|
-
test: Expression;
|
|
310
|
-
consequent: Fragment;
|
|
311
|
-
alternate: Fragment | null;
|
|
312
|
-
}
|
|
313
|
-
/** An `{#await ...}` block */
|
|
314
|
-
export interface AwaitBlock extends BaseNode {
|
|
315
|
-
type: "AwaitBlock";
|
|
316
|
-
expression: Expression;
|
|
317
|
-
/** The resolved value inside the `then` block */
|
|
318
|
-
value: Pattern | null;
|
|
319
|
-
/** The rejection reason inside the `catch` block */
|
|
320
|
-
error: Pattern | null;
|
|
321
|
-
pending: Fragment | null;
|
|
322
|
-
then: Fragment | null;
|
|
323
|
-
catch: Fragment | null;
|
|
324
|
-
}
|
|
325
|
-
export interface KeyBlock extends BaseNode {
|
|
326
|
-
type: "KeyBlock";
|
|
327
|
-
expression: Expression;
|
|
328
|
-
fragment: Fragment;
|
|
329
|
-
}
|
|
330
|
-
export interface SnippetBlock extends BaseNode {
|
|
331
|
-
type: "SnippetBlock";
|
|
332
|
-
expression: Identifier;
|
|
333
|
-
parameters: Pattern[];
|
|
334
|
-
typeParams?: string;
|
|
335
|
-
body: Fragment;
|
|
336
|
-
}
|
|
337
|
-
export interface BaseAttribute extends BaseNode {
|
|
338
|
-
name: string;
|
|
339
|
-
/** Only with `parse(source, { loc: true })`. */
|
|
340
|
-
name_loc?: SourceLocation | null;
|
|
341
|
-
}
|
|
342
|
-
export interface Attribute extends BaseAttribute {
|
|
343
|
-
type: "Attribute";
|
|
344
|
-
/**
|
|
345
|
-
* Quoted/string values are represented by an array, even if they contain a single expression like `"{x}"`
|
|
346
|
-
*/
|
|
347
|
-
value: true | ExpressionTag | Array<Text | ExpressionTag>;
|
|
348
|
-
}
|
|
349
|
-
export interface SpreadAttribute extends BaseNode {
|
|
350
|
-
type: "SpreadAttribute";
|
|
351
|
-
expression: Expression;
|
|
352
|
-
}
|
|
353
|
-
export interface Script extends BaseNode {
|
|
354
|
-
type: "Script";
|
|
355
|
-
context: "default" | "module";
|
|
356
|
-
content: Program;
|
|
357
|
-
attributes: Attribute[];
|
|
358
|
-
}
|
|
359
|
-
export interface JSComment {
|
|
360
|
-
type: "Line" | "Block";
|
|
361
|
-
value: string;
|
|
362
|
-
start: number;
|
|
363
|
-
end: number;
|
|
364
|
-
/** Only with `parse(source, { loc: true })`. */
|
|
365
|
-
loc?: {
|
|
366
|
-
start: {
|
|
367
|
-
line: number;
|
|
368
|
-
column: number;
|
|
369
|
-
};
|
|
370
|
-
end: {
|
|
371
|
-
line: number;
|
|
372
|
-
column: number;
|
|
373
|
-
};
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
export type AttributeLike = Attribute | SpreadAttribute | Directive;
|
|
377
|
-
export type Directive = AST.AnimateDirective | AST.BindDirective | AST.ClassDirective | AST.LetDirective | AST.OnDirective | AST.StyleDirective | AST.TransitionDirective | AST.UseDirective;
|
|
378
|
-
export type Block = AST.EachBlock | AST.IfBlock | AST.AwaitBlock | AST.KeyBlock | AST.SnippetBlock;
|
|
379
|
-
export type ElementLike = AST.Component | AST.TitleElement | AST.SlotElement | AST.RegularElement | AST.SvelteBody | AST.SvelteBoundary | AST.SvelteComponent | AST.SvelteDocument | AST.SvelteElement | AST.SvelteFragment | AST.SvelteHead | AST.SvelteOptionsRaw | AST.SvelteSelf | AST.SvelteWindow | AST.SvelteBoundary;
|
|
380
|
-
export type Tag = AST.AttachTag | AST.ConstTag | AST.DeclarationTag | AST.DebugTag | AST.ExpressionTag | AST.HtmlTag | AST.RenderTag;
|
|
381
|
-
export type TemplateNode = AST.Root | AST.Text | Tag | ElementLike | AST.Attribute | AST.SpreadAttribute | Directive | AST.AttachTag | AST.Comment | Block;
|
|
382
|
-
export type SvelteNode = Node | TemplateNode | AST.Fragment | _CSS.Node | Script;
|
|
383
|
-
export type { _CSS as CSS };
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
declare namespace _CSS {
|
|
387
|
-
interface BaseNode {
|
|
388
|
-
start: number;
|
|
389
|
-
end: number;
|
|
390
|
-
}
|
|
391
|
-
interface StyleSheetBase extends BaseNode {
|
|
392
|
-
children: Array<Atrule | Rule>;
|
|
393
|
-
/** CSS comments in source order */
|
|
394
|
-
comments: CSSComment[];
|
|
395
|
-
}
|
|
396
|
-
interface CSSComment extends BaseNode {
|
|
397
|
-
type: "CSSComment";
|
|
398
|
-
value: string;
|
|
399
|
-
/** Character offset in a containing declaration value or at-rule prelude */
|
|
400
|
-
position?: number;
|
|
401
|
-
}
|
|
402
|
-
interface StyleSheetFile extends StyleSheetBase {
|
|
403
|
-
type: "StyleSheetFile";
|
|
404
|
-
}
|
|
405
|
-
interface StyleSheet extends StyleSheetBase {
|
|
406
|
-
type: "StyleSheet";
|
|
407
|
-
attributes: any[];
|
|
408
|
-
content: {
|
|
409
|
-
start: number;
|
|
410
|
-
end: number;
|
|
411
|
-
styles: string;
|
|
412
|
-
/** Possible comment atop the style tag */
|
|
413
|
-
comment: AST.Comment | null;
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
interface Atrule extends BaseNode {
|
|
417
|
-
type: "Atrule";
|
|
418
|
-
name: string;
|
|
419
|
-
prelude: string;
|
|
420
|
-
block: Block | null;
|
|
421
|
-
}
|
|
422
|
-
interface Rule extends BaseNode {
|
|
423
|
-
type: "Rule";
|
|
424
|
-
prelude: SelectorList;
|
|
425
|
-
block: Block;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* A list of selectors, e.g. `a, b, c {}`
|
|
429
|
-
*/
|
|
430
|
-
interface SelectorList extends BaseNode {
|
|
431
|
-
type: "SelectorList";
|
|
432
|
-
/**
|
|
433
|
-
* The `a`, `b` and `c` in `a, b, c {}`
|
|
434
|
-
*/
|
|
435
|
-
children: ComplexSelector[];
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* A complex selector, e.g. `a b c {}`
|
|
439
|
-
*/
|
|
440
|
-
interface ComplexSelector extends BaseNode {
|
|
441
|
-
type: "ComplexSelector";
|
|
442
|
-
/**
|
|
443
|
-
* The `a`, `b` and `c` in `a b c {}`
|
|
444
|
-
*/
|
|
445
|
-
children: RelativeSelector[];
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* A relative selector, e.g the `a` and `> b` in `a > b {}`
|
|
449
|
-
*/
|
|
450
|
-
interface RelativeSelector extends BaseNode {
|
|
451
|
-
type: "RelativeSelector";
|
|
452
|
-
/**
|
|
453
|
-
* In `a > b`, `> b` forms one relative selector, and `>` is the combinator. `null` for the first selector.
|
|
454
|
-
*/
|
|
455
|
-
combinator: null | Combinator;
|
|
456
|
-
/**
|
|
457
|
-
* The `b:is(...)` in `> b:is(...)`
|
|
458
|
-
*/
|
|
459
|
-
selectors: SimpleSelector[];
|
|
460
|
-
}
|
|
461
|
-
interface TypeSelector extends BaseNode {
|
|
462
|
-
type: "TypeSelector";
|
|
463
|
-
name: string;
|
|
464
|
-
namespace?: string;
|
|
465
|
-
}
|
|
466
|
-
interface IdSelector extends BaseNode {
|
|
467
|
-
type: "IdSelector";
|
|
468
|
-
name: string;
|
|
469
|
-
}
|
|
470
|
-
interface ClassSelector extends BaseNode {
|
|
471
|
-
type: "ClassSelector";
|
|
472
|
-
name: string;
|
|
473
|
-
}
|
|
474
|
-
interface AttributeSelector extends BaseNode {
|
|
475
|
-
type: "AttributeSelector";
|
|
476
|
-
name: string;
|
|
477
|
-
matcher: string | null;
|
|
478
|
-
value: string | null;
|
|
479
|
-
flags: string | null;
|
|
480
|
-
}
|
|
481
|
-
interface PseudoElementSelector extends BaseNode {
|
|
482
|
-
type: "PseudoElementSelector";
|
|
483
|
-
name: string;
|
|
484
|
-
args?: SelectorList;
|
|
485
|
-
}
|
|
486
|
-
interface PseudoClassSelector extends BaseNode {
|
|
487
|
-
type: "PseudoClassSelector";
|
|
488
|
-
name: string;
|
|
489
|
-
args: SelectorList | null;
|
|
490
|
-
}
|
|
491
|
-
interface Percentage extends BaseNode {
|
|
492
|
-
type: "Percentage";
|
|
493
|
-
value: string;
|
|
494
|
-
}
|
|
495
|
-
interface NestingSelector extends BaseNode {
|
|
496
|
-
type: "NestingSelector";
|
|
497
|
-
name: "&";
|
|
498
|
-
}
|
|
499
|
-
interface Nth extends BaseNode {
|
|
500
|
-
type: "Nth";
|
|
501
|
-
value: string;
|
|
502
|
-
}
|
|
503
|
-
type SimpleSelector = TypeSelector | IdSelector | ClassSelector | AttributeSelector | PseudoElementSelector | PseudoClassSelector | Percentage | Nth | NestingSelector;
|
|
504
|
-
interface Combinator extends BaseNode {
|
|
505
|
-
type: "Combinator";
|
|
506
|
-
name: string;
|
|
507
|
-
}
|
|
508
|
-
interface Block extends BaseNode {
|
|
509
|
-
type: "Block";
|
|
510
|
-
children: Array<Declaration | Rule | Atrule>;
|
|
511
|
-
}
|
|
512
|
-
interface Declaration extends BaseNode {
|
|
513
|
-
type: "Declaration";
|
|
514
|
-
property: string;
|
|
515
|
-
value: string;
|
|
516
|
-
}
|
|
517
|
-
type Node = StyleSheet | Rule | Atrule | SelectorList | Block | ComplexSelector | RelativeSelector | Combinator | SimpleSelector | Declaration;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
interface BaseNodeWithoutComments {
|
|
521
|
-
type: string;
|
|
522
|
-
loc?: SourceLocation | null | undefined;
|
|
523
|
-
range?: [number, number] | undefined;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
interface BaseNode extends BaseNodeWithoutComments {
|
|
527
|
-
leadingComments?: Comment[] | undefined;
|
|
528
|
-
trailingComments?: Comment[] | undefined;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
interface NodeMap {
|
|
532
|
-
AssignmentProperty: AssignmentProperty;
|
|
533
|
-
CatchClause: CatchClause;
|
|
534
|
-
Class: Class;
|
|
535
|
-
ClassBody: ClassBody;
|
|
536
|
-
Expression: Expression;
|
|
537
|
-
Function: Function;
|
|
538
|
-
Identifier: Identifier;
|
|
539
|
-
Literal: Literal;
|
|
540
|
-
MethodDefinition: MethodDefinition;
|
|
541
|
-
ModuleDeclaration: ModuleDeclaration;
|
|
542
|
-
ModuleSpecifier: ModuleSpecifier;
|
|
543
|
-
Pattern: Pattern;
|
|
544
|
-
PrivateIdentifier: PrivateIdentifier;
|
|
545
|
-
Program: Program;
|
|
546
|
-
Property: Property;
|
|
547
|
-
PropertyDefinition: PropertyDefinition;
|
|
548
|
-
SpreadElement: SpreadElement;
|
|
549
|
-
Statement: Statement;
|
|
550
|
-
Super: Super;
|
|
551
|
-
SwitchCase: SwitchCase;
|
|
552
|
-
TemplateElement: TemplateElement;
|
|
553
|
-
VariableDeclarator: VariableDeclarator;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
type Node = NodeMap[keyof NodeMap];
|
|
557
|
-
|
|
558
|
-
interface Comment extends BaseNodeWithoutComments {
|
|
559
|
-
type: "Line" | "Block";
|
|
560
|
-
value: string;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
interface Program extends BaseNode {
|
|
564
|
-
type: "Program";
|
|
565
|
-
sourceType: "script" | "module";
|
|
566
|
-
body: Array<Directive | Statement | ModuleDeclaration>;
|
|
567
|
-
comments?: Comment[] | undefined;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
interface Directive extends BaseNode {
|
|
101
|
+
export interface Directive extends BaseNode {
|
|
571
102
|
type: "ExpressionStatement";
|
|
572
103
|
expression: Literal;
|
|
573
104
|
directive: string;
|
|
574
105
|
}
|
|
575
106
|
|
|
576
|
-
interface BaseFunction extends BaseNode {
|
|
577
|
-
params: Pattern
|
|
107
|
+
export interface BaseFunction extends BaseNode, TSFunctionFields {
|
|
108
|
+
params: Array<Pattern | TSParameterProperty>;
|
|
578
109
|
generator?: boolean | undefined;
|
|
579
110
|
async?: boolean | undefined;
|
|
580
111
|
body: BlockStatement | Expression;
|
|
581
112
|
}
|
|
582
113
|
|
|
583
|
-
type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
114
|
+
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
584
115
|
|
|
585
|
-
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
116
|
+
export type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
586
117
|
|
|
587
|
-
interface BaseStatement extends BaseNode {
|
|
118
|
+
export interface BaseStatement extends BaseNode {
|
|
588
119
|
}
|
|
589
120
|
|
|
590
|
-
interface EmptyStatement extends BaseStatement {
|
|
121
|
+
export interface EmptyStatement extends BaseStatement {
|
|
591
122
|
type: "EmptyStatement";
|
|
592
123
|
}
|
|
593
124
|
|
|
594
|
-
interface BlockStatement extends BaseStatement {
|
|
125
|
+
export interface BlockStatement extends BaseStatement {
|
|
595
126
|
type: "BlockStatement";
|
|
596
127
|
body: Statement[];
|
|
597
128
|
innerComments?: Comment[] | undefined;
|
|
598
129
|
}
|
|
599
130
|
|
|
600
|
-
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
131
|
+
export interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
601
132
|
type: "StaticBlock";
|
|
602
133
|
}
|
|
603
134
|
|
|
604
|
-
interface ExpressionStatement extends BaseStatement {
|
|
135
|
+
export interface ExpressionStatement extends BaseStatement {
|
|
605
136
|
type: "ExpressionStatement";
|
|
606
137
|
expression: Expression;
|
|
607
138
|
}
|
|
608
139
|
|
|
609
|
-
interface IfStatement extends BaseStatement {
|
|
140
|
+
export interface IfStatement extends BaseStatement {
|
|
610
141
|
type: "IfStatement";
|
|
611
142
|
test: Expression;
|
|
612
143
|
consequent: Statement;
|
|
613
144
|
alternate?: Statement | null | undefined;
|
|
614
145
|
}
|
|
615
146
|
|
|
616
|
-
interface LabeledStatement extends BaseStatement {
|
|
147
|
+
export interface LabeledStatement extends BaseStatement {
|
|
617
148
|
type: "LabeledStatement";
|
|
618
149
|
label: Identifier;
|
|
619
150
|
body: Statement;
|
|
620
151
|
}
|
|
621
152
|
|
|
622
|
-
interface BreakStatement extends BaseStatement {
|
|
153
|
+
export interface BreakStatement extends BaseStatement {
|
|
623
154
|
type: "BreakStatement";
|
|
624
155
|
label?: Identifier | null | undefined;
|
|
625
156
|
}
|
|
626
157
|
|
|
627
|
-
interface ContinueStatement extends BaseStatement {
|
|
158
|
+
export interface ContinueStatement extends BaseStatement {
|
|
628
159
|
type: "ContinueStatement";
|
|
629
160
|
label?: Identifier | null | undefined;
|
|
630
161
|
}
|
|
631
162
|
|
|
632
|
-
interface WithStatement extends BaseStatement {
|
|
163
|
+
export interface WithStatement extends BaseStatement {
|
|
633
164
|
type: "WithStatement";
|
|
634
165
|
object: Expression;
|
|
635
166
|
body: Statement;
|
|
636
167
|
}
|
|
637
168
|
|
|
638
|
-
interface SwitchStatement extends BaseStatement {
|
|
169
|
+
export interface SwitchStatement extends BaseStatement {
|
|
639
170
|
type: "SwitchStatement";
|
|
640
171
|
discriminant: Expression;
|
|
641
172
|
cases: SwitchCase[];
|
|
642
173
|
}
|
|
643
174
|
|
|
644
|
-
interface ReturnStatement extends BaseStatement {
|
|
175
|
+
export interface ReturnStatement extends BaseStatement {
|
|
645
176
|
type: "ReturnStatement";
|
|
646
177
|
argument?: Expression | null | undefined;
|
|
647
178
|
}
|
|
648
179
|
|
|
649
|
-
interface ThrowStatement extends BaseStatement {
|
|
180
|
+
export interface ThrowStatement extends BaseStatement {
|
|
650
181
|
type: "ThrowStatement";
|
|
651
182
|
argument: Expression;
|
|
652
183
|
}
|
|
653
184
|
|
|
654
|
-
interface TryStatement extends BaseStatement {
|
|
185
|
+
export interface TryStatement extends BaseStatement {
|
|
655
186
|
type: "TryStatement";
|
|
656
187
|
block: BlockStatement;
|
|
657
188
|
handler?: CatchClause | null | undefined;
|
|
658
189
|
finalizer?: BlockStatement | null | undefined;
|
|
659
190
|
}
|
|
660
191
|
|
|
661
|
-
interface WhileStatement extends BaseStatement {
|
|
192
|
+
export interface WhileStatement extends BaseStatement {
|
|
662
193
|
type: "WhileStatement";
|
|
663
194
|
test: Expression;
|
|
664
195
|
body: Statement;
|
|
665
196
|
}
|
|
666
197
|
|
|
667
|
-
interface DoWhileStatement extends BaseStatement {
|
|
198
|
+
export interface DoWhileStatement extends BaseStatement {
|
|
668
199
|
type: "DoWhileStatement";
|
|
669
200
|
body: Statement;
|
|
670
201
|
test: Expression;
|
|
671
202
|
}
|
|
672
203
|
|
|
673
|
-
interface ForStatement extends BaseStatement {
|
|
204
|
+
export interface ForStatement extends BaseStatement {
|
|
674
205
|
type: "ForStatement";
|
|
675
206
|
init?: VariableDeclaration | Expression | null | undefined;
|
|
676
207
|
test?: Expression | null | undefined;
|
|
@@ -678,49 +209,52 @@ interface ForStatement extends BaseStatement {
|
|
|
678
209
|
body: Statement;
|
|
679
210
|
}
|
|
680
211
|
|
|
681
|
-
interface BaseForXStatement extends BaseStatement {
|
|
212
|
+
export interface BaseForXStatement extends BaseStatement {
|
|
682
213
|
left: VariableDeclaration | Pattern;
|
|
683
214
|
right: Expression;
|
|
684
215
|
body: Statement;
|
|
685
216
|
}
|
|
686
217
|
|
|
687
|
-
interface ForInStatement extends BaseForXStatement {
|
|
218
|
+
export interface ForInStatement extends BaseForXStatement {
|
|
688
219
|
type: "ForInStatement";
|
|
689
220
|
}
|
|
690
221
|
|
|
691
|
-
interface DebuggerStatement extends BaseStatement {
|
|
222
|
+
export interface DebuggerStatement extends BaseStatement {
|
|
692
223
|
type: "DebuggerStatement";
|
|
693
224
|
}
|
|
694
225
|
|
|
695
|
-
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
226
|
+
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | TSDeclaration;
|
|
696
227
|
|
|
697
|
-
interface BaseDeclaration extends BaseStatement {
|
|
228
|
+
export interface BaseDeclaration extends BaseStatement {
|
|
698
229
|
}
|
|
699
230
|
|
|
700
|
-
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
231
|
+
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
701
232
|
type: "FunctionDeclaration";
|
|
702
233
|
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
703
234
|
id: Identifier | null;
|
|
704
235
|
body: BlockStatement;
|
|
236
|
+
expression: false;
|
|
705
237
|
}
|
|
706
238
|
|
|
707
|
-
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
239
|
+
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
708
240
|
id: Identifier;
|
|
709
241
|
}
|
|
710
242
|
|
|
711
|
-
interface VariableDeclaration extends BaseDeclaration {
|
|
243
|
+
export interface VariableDeclaration extends BaseDeclaration {
|
|
712
244
|
type: "VariableDeclaration";
|
|
713
245
|
declarations: VariableDeclarator[];
|
|
714
246
|
kind: "var" | "let" | "const" | "using" | "await using";
|
|
247
|
+
declare?: boolean;
|
|
715
248
|
}
|
|
716
249
|
|
|
717
|
-
interface VariableDeclarator extends BaseNode {
|
|
250
|
+
export interface VariableDeclarator extends BaseNode {
|
|
718
251
|
type: "VariableDeclarator";
|
|
719
252
|
id: Pattern;
|
|
720
253
|
init?: Expression | null | undefined;
|
|
254
|
+
definite?: boolean;
|
|
721
255
|
}
|
|
722
256
|
|
|
723
|
-
interface ExpressionMap {
|
|
257
|
+
export interface ExpressionMap {
|
|
724
258
|
ArrayExpression: ArrayExpression;
|
|
725
259
|
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
726
260
|
AssignmentExpression: AssignmentExpression;
|
|
@@ -746,40 +280,41 @@ interface ExpressionMap {
|
|
|
746
280
|
UnaryExpression: UnaryExpression;
|
|
747
281
|
UpdateExpression: UpdateExpression;
|
|
748
282
|
YieldExpression: YieldExpression;
|
|
283
|
+
TSExpression: TSExpression;
|
|
749
284
|
}
|
|
750
285
|
|
|
751
|
-
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
286
|
+
export type Expression = ExpressionMap[keyof ExpressionMap];
|
|
752
287
|
|
|
753
|
-
interface BaseExpression extends BaseNode {
|
|
288
|
+
export interface BaseExpression extends BaseNode {
|
|
754
289
|
}
|
|
755
290
|
|
|
756
|
-
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
291
|
+
export type ChainElement = SimpleCallExpression | MemberExpression;
|
|
757
292
|
|
|
758
|
-
interface ChainExpression extends BaseExpression {
|
|
293
|
+
export interface ChainExpression extends BaseExpression {
|
|
759
294
|
type: "ChainExpression";
|
|
760
295
|
expression: ChainElement;
|
|
761
296
|
}
|
|
762
297
|
|
|
763
|
-
interface ThisExpression extends BaseExpression {
|
|
298
|
+
export interface ThisExpression extends BaseExpression {
|
|
764
299
|
type: "ThisExpression";
|
|
765
300
|
}
|
|
766
301
|
|
|
767
|
-
interface ArrayExpression extends BaseExpression {
|
|
302
|
+
export interface ArrayExpression extends BaseExpression {
|
|
768
303
|
type: "ArrayExpression";
|
|
769
304
|
elements: Array<Expression | SpreadElement | null>;
|
|
770
305
|
}
|
|
771
306
|
|
|
772
|
-
interface ObjectExpression extends BaseExpression {
|
|
307
|
+
export interface ObjectExpression extends BaseExpression {
|
|
773
308
|
type: "ObjectExpression";
|
|
774
309
|
properties: Array<Property | SpreadElement>;
|
|
775
310
|
}
|
|
776
311
|
|
|
777
|
-
interface PrivateIdentifier extends BaseNode {
|
|
312
|
+
export interface PrivateIdentifier extends BaseNode {
|
|
778
313
|
type: "PrivateIdentifier";
|
|
779
314
|
name: string;
|
|
780
315
|
}
|
|
781
316
|
|
|
782
|
-
interface Property extends BaseNode {
|
|
317
|
+
export interface Property extends BaseNode {
|
|
783
318
|
type: "Property";
|
|
784
319
|
key: Expression;
|
|
785
320
|
value: Expression | Pattern;
|
|
@@ -787,119 +322,131 @@ interface Property extends BaseNode {
|
|
|
787
322
|
method: boolean;
|
|
788
323
|
shorthand: boolean;
|
|
789
324
|
computed: boolean;
|
|
325
|
+
decorators?: Decorator[];
|
|
790
326
|
}
|
|
791
327
|
|
|
792
|
-
interface PropertyDefinition extends BaseNode {
|
|
328
|
+
export interface PropertyDefinition extends BaseNode, TSClassMemberFields {
|
|
793
329
|
type: "PropertyDefinition";
|
|
794
330
|
key: Expression | PrivateIdentifier;
|
|
795
331
|
value?: Expression | null | undefined;
|
|
796
332
|
computed: boolean;
|
|
797
333
|
static: boolean;
|
|
334
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
335
|
+
definite?: boolean;
|
|
798
336
|
}
|
|
799
337
|
|
|
800
|
-
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
338
|
+
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
801
339
|
id?: Identifier | null | undefined;
|
|
802
340
|
type: "FunctionExpression";
|
|
803
341
|
body: BlockStatement;
|
|
342
|
+
expression: false;
|
|
804
343
|
}
|
|
805
344
|
|
|
806
|
-
interface SequenceExpression extends BaseExpression {
|
|
345
|
+
export interface SequenceExpression extends BaseExpression {
|
|
807
346
|
type: "SequenceExpression";
|
|
808
347
|
expressions: Expression[];
|
|
809
348
|
}
|
|
810
349
|
|
|
811
|
-
interface UnaryExpression extends BaseExpression {
|
|
350
|
+
export interface UnaryExpression extends BaseExpression {
|
|
812
351
|
type: "UnaryExpression";
|
|
813
352
|
operator: UnaryOperator;
|
|
814
353
|
prefix: true;
|
|
815
354
|
argument: Expression;
|
|
816
355
|
}
|
|
817
356
|
|
|
818
|
-
interface BinaryExpression extends BaseExpression {
|
|
357
|
+
export interface BinaryExpression extends BaseExpression {
|
|
819
358
|
type: "BinaryExpression";
|
|
820
359
|
operator: BinaryOperator;
|
|
821
360
|
left: Expression | PrivateIdentifier;
|
|
822
361
|
right: Expression;
|
|
823
362
|
}
|
|
824
363
|
|
|
825
|
-
interface AssignmentExpression extends BaseExpression {
|
|
364
|
+
export interface AssignmentExpression extends BaseExpression {
|
|
826
365
|
type: "AssignmentExpression";
|
|
827
366
|
operator: AssignmentOperator;
|
|
828
|
-
left: Pattern | MemberExpression;
|
|
367
|
+
left: Pattern | MemberExpression | TSAsExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion;
|
|
829
368
|
right: Expression;
|
|
830
369
|
}
|
|
831
370
|
|
|
832
|
-
interface UpdateExpression extends BaseExpression {
|
|
371
|
+
export interface UpdateExpression extends BaseExpression {
|
|
833
372
|
type: "UpdateExpression";
|
|
834
373
|
operator: UpdateOperator;
|
|
835
374
|
argument: Expression;
|
|
836
375
|
prefix: boolean;
|
|
837
376
|
}
|
|
838
377
|
|
|
839
|
-
interface LogicalExpression extends BaseExpression {
|
|
378
|
+
export interface LogicalExpression extends BaseExpression {
|
|
840
379
|
type: "LogicalExpression";
|
|
841
380
|
operator: LogicalOperator;
|
|
842
381
|
left: Expression;
|
|
843
382
|
right: Expression;
|
|
844
383
|
}
|
|
845
384
|
|
|
846
|
-
interface ConditionalExpression extends BaseExpression {
|
|
385
|
+
export interface ConditionalExpression extends BaseExpression {
|
|
847
386
|
type: "ConditionalExpression";
|
|
848
387
|
test: Expression;
|
|
849
388
|
alternate: Expression;
|
|
850
389
|
consequent: Expression;
|
|
851
390
|
}
|
|
852
391
|
|
|
853
|
-
interface BaseCallExpression extends BaseExpression {
|
|
392
|
+
export interface BaseCallExpression extends BaseExpression {
|
|
854
393
|
callee: Expression | Super;
|
|
855
394
|
arguments: Array<Expression | SpreadElement>;
|
|
395
|
+
typeArguments?: TSTypeParameterInstantiation;
|
|
856
396
|
}
|
|
857
397
|
|
|
858
|
-
type CallExpression = SimpleCallExpression | NewExpression;
|
|
398
|
+
export type CallExpression = SimpleCallExpression | NewExpression;
|
|
859
399
|
|
|
860
|
-
interface SimpleCallExpression extends BaseCallExpression {
|
|
400
|
+
export interface SimpleCallExpression extends BaseCallExpression {
|
|
861
401
|
type: "CallExpression";
|
|
862
|
-
|
|
402
|
+
/** Absent in a decorator, and on a call with type arguments, as in acorn-typescript. */
|
|
403
|
+
optional?: boolean;
|
|
863
404
|
}
|
|
864
405
|
|
|
865
|
-
interface NewExpression extends BaseCallExpression {
|
|
406
|
+
export interface NewExpression extends BaseCallExpression {
|
|
866
407
|
type: "NewExpression";
|
|
867
408
|
}
|
|
868
409
|
|
|
869
|
-
interface MemberExpression extends BaseExpression, BasePattern {
|
|
410
|
+
export interface MemberExpression extends BaseExpression, BasePattern {
|
|
870
411
|
type: "MemberExpression";
|
|
871
412
|
object: Expression | Super;
|
|
872
413
|
property: Expression | PrivateIdentifier;
|
|
873
414
|
computed: boolean;
|
|
874
|
-
|
|
415
|
+
/** Absent in a decorator, and on a call with type arguments, as in acorn-typescript. */
|
|
416
|
+
optional?: boolean;
|
|
875
417
|
}
|
|
876
418
|
|
|
877
|
-
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
419
|
+
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
878
420
|
|
|
879
|
-
interface BasePattern extends BaseNode {
|
|
421
|
+
export interface BasePattern extends BaseNode {
|
|
880
422
|
}
|
|
881
423
|
|
|
882
|
-
interface SwitchCase extends BaseNode {
|
|
424
|
+
export interface SwitchCase extends BaseNode {
|
|
883
425
|
type: "SwitchCase";
|
|
884
426
|
test?: Expression | null | undefined;
|
|
885
427
|
consequent: Statement[];
|
|
886
428
|
}
|
|
887
429
|
|
|
888
|
-
interface CatchClause extends BaseNode {
|
|
430
|
+
export interface CatchClause extends BaseNode {
|
|
889
431
|
type: "CatchClause";
|
|
890
432
|
param: Pattern | null;
|
|
891
433
|
body: BlockStatement;
|
|
892
434
|
}
|
|
893
435
|
|
|
894
|
-
|
|
436
|
+
export interface Identifier extends BaseNode, BaseExpression, BasePattern, TSBindingFields {
|
|
437
|
+
type: "Identifier";
|
|
438
|
+
name: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
895
442
|
|
|
896
|
-
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
443
|
+
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
897
444
|
type: "Literal";
|
|
898
445
|
value: string | boolean | number | null;
|
|
899
446
|
raw?: string | undefined;
|
|
900
447
|
}
|
|
901
448
|
|
|
902
|
-
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
449
|
+
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
903
450
|
type: "Literal";
|
|
904
451
|
value?: RegExp | null | undefined;
|
|
905
452
|
regex: {
|
|
@@ -909,62 +456,64 @@ interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
|
909
456
|
raw?: string | undefined;
|
|
910
457
|
}
|
|
911
458
|
|
|
912
|
-
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
459
|
+
export interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
913
460
|
type: "Literal";
|
|
914
461
|
value?: bigint | null | undefined;
|
|
915
462
|
bigint: string;
|
|
916
463
|
raw?: string | undefined;
|
|
917
464
|
}
|
|
918
465
|
|
|
919
|
-
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
466
|
+
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
920
467
|
|
|
921
|
-
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
468
|
+
export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
922
469
|
|
|
923
|
-
type LogicalOperator = "||" | "&&" | "??";
|
|
470
|
+
export type LogicalOperator = "||" | "&&" | "??";
|
|
924
471
|
|
|
925
|
-
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
472
|
+
export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
926
473
|
|
|
927
|
-
type UpdateOperator = "++" | "--";
|
|
474
|
+
export type UpdateOperator = "++" | "--";
|
|
928
475
|
|
|
929
|
-
interface ForOfStatement extends BaseForXStatement {
|
|
476
|
+
export interface ForOfStatement extends BaseForXStatement {
|
|
930
477
|
type: "ForOfStatement";
|
|
931
478
|
await: boolean;
|
|
932
479
|
}
|
|
933
480
|
|
|
934
|
-
interface Super extends BaseNode {
|
|
481
|
+
export interface Super extends BaseNode {
|
|
935
482
|
type: "Super";
|
|
936
483
|
}
|
|
937
484
|
|
|
938
|
-
interface SpreadElement extends BaseNode {
|
|
485
|
+
export interface SpreadElement extends BaseNode {
|
|
939
486
|
type: "SpreadElement";
|
|
940
487
|
argument: Expression;
|
|
941
488
|
}
|
|
942
489
|
|
|
943
|
-
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
490
|
+
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
944
491
|
type: "ArrowFunctionExpression";
|
|
945
492
|
expression: boolean;
|
|
946
493
|
body: BlockStatement | Expression;
|
|
494
|
+
id: null;
|
|
947
495
|
}
|
|
948
496
|
|
|
949
|
-
interface YieldExpression extends BaseExpression {
|
|
497
|
+
export interface YieldExpression extends BaseExpression {
|
|
950
498
|
type: "YieldExpression";
|
|
951
499
|
argument?: Expression | null | undefined;
|
|
952
500
|
delegate: boolean;
|
|
953
501
|
}
|
|
954
502
|
|
|
955
|
-
interface TemplateLiteral extends BaseExpression {
|
|
503
|
+
export interface TemplateLiteral extends BaseExpression {
|
|
956
504
|
type: "TemplateLiteral";
|
|
957
505
|
quasis: TemplateElement[];
|
|
958
506
|
expressions: Expression[];
|
|
959
507
|
}
|
|
960
508
|
|
|
961
|
-
interface TaggedTemplateExpression extends BaseExpression {
|
|
509
|
+
export interface TaggedTemplateExpression extends BaseExpression {
|
|
962
510
|
type: "TaggedTemplateExpression";
|
|
963
511
|
tag: Expression;
|
|
964
512
|
quasi: TemplateLiteral;
|
|
513
|
+
typeArguments?: TSTypeParameterInstantiation;
|
|
965
514
|
}
|
|
966
515
|
|
|
967
|
-
interface TemplateElement extends BaseNode {
|
|
516
|
+
export interface TemplateElement extends BaseNode {
|
|
968
517
|
type: "TemplateElement";
|
|
969
518
|
tail: boolean;
|
|
970
519
|
value: {
|
|
@@ -974,148 +523,1138 @@ interface TemplateElement extends BaseNode {
|
|
|
974
523
|
};
|
|
975
524
|
}
|
|
976
525
|
|
|
977
|
-
interface AssignmentProperty extends Property {
|
|
526
|
+
export interface AssignmentProperty extends Property {
|
|
978
527
|
value: Pattern;
|
|
979
528
|
kind: "init";
|
|
980
529
|
method: boolean;
|
|
981
530
|
}
|
|
982
531
|
|
|
983
|
-
interface ObjectPattern extends BasePattern {
|
|
532
|
+
export interface ObjectPattern extends BasePattern, TSBindingFields {
|
|
984
533
|
type: "ObjectPattern";
|
|
985
534
|
properties: Array<AssignmentProperty | RestElement>;
|
|
986
535
|
}
|
|
987
536
|
|
|
988
|
-
interface ArrayPattern extends BasePattern {
|
|
537
|
+
export interface ArrayPattern extends BasePattern, TSBindingFields {
|
|
989
538
|
type: "ArrayPattern";
|
|
990
539
|
elements: Array<Pattern | null>;
|
|
991
540
|
}
|
|
992
541
|
|
|
993
|
-
interface RestElement extends BasePattern {
|
|
542
|
+
export interface RestElement extends BasePattern, TSBindingFields {
|
|
994
543
|
type: "RestElement";
|
|
995
544
|
argument: Pattern;
|
|
996
545
|
}
|
|
997
546
|
|
|
998
|
-
interface AssignmentPattern extends BasePattern {
|
|
547
|
+
export interface AssignmentPattern extends BasePattern {
|
|
999
548
|
type: "AssignmentPattern";
|
|
1000
549
|
left: Pattern;
|
|
1001
550
|
right: Expression;
|
|
551
|
+
decorators?: Decorator[];
|
|
1002
552
|
}
|
|
1003
553
|
|
|
1004
|
-
type Class = ClassDeclaration | ClassExpression;
|
|
554
|
+
export type Class = ClassDeclaration | ClassExpression;
|
|
1005
555
|
|
|
1006
|
-
interface BaseClass extends BaseNode {
|
|
556
|
+
export interface BaseClass extends BaseNode, TSClassFields {
|
|
1007
557
|
superClass?: Expression | null | undefined;
|
|
1008
558
|
body: ClassBody;
|
|
1009
559
|
}
|
|
1010
560
|
|
|
1011
|
-
interface ClassBody extends BaseNode {
|
|
561
|
+
export interface ClassBody extends BaseNode {
|
|
1012
562
|
type: "ClassBody";
|
|
1013
|
-
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
563
|
+
body: Array<MethodDefinition | PropertyDefinition | StaticBlock | TSIndexSignature>;
|
|
1014
564
|
}
|
|
1015
565
|
|
|
1016
|
-
interface MethodDefinition extends BaseNode {
|
|
566
|
+
export interface MethodDefinition extends BaseNode, TSClassMemberFields {
|
|
1017
567
|
type: "MethodDefinition";
|
|
1018
568
|
key: Expression | PrivateIdentifier;
|
|
1019
|
-
value: FunctionExpression;
|
|
569
|
+
value: FunctionExpression | TSDeclareMethod;
|
|
1020
570
|
kind: "constructor" | "method" | "get" | "set";
|
|
1021
571
|
computed: boolean;
|
|
1022
572
|
static: boolean;
|
|
573
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
1023
574
|
}
|
|
1024
575
|
|
|
1025
|
-
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
576
|
+
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
1026
577
|
type: "ClassDeclaration";
|
|
1027
578
|
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
1028
579
|
id: Identifier | null;
|
|
1029
580
|
}
|
|
1030
581
|
|
|
1031
|
-
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
582
|
+
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
1032
583
|
id: Identifier;
|
|
1033
584
|
}
|
|
1034
585
|
|
|
1035
|
-
interface ClassExpression extends BaseClass, BaseExpression {
|
|
586
|
+
export interface ClassExpression extends BaseClass, BaseExpression {
|
|
1036
587
|
type: "ClassExpression";
|
|
1037
588
|
id?: Identifier | null | undefined;
|
|
1038
589
|
}
|
|
1039
590
|
|
|
1040
|
-
interface MetaProperty extends BaseExpression {
|
|
591
|
+
export interface MetaProperty extends BaseExpression {
|
|
1041
592
|
type: "MetaProperty";
|
|
1042
593
|
meta: Identifier;
|
|
1043
594
|
property: Identifier;
|
|
1044
595
|
}
|
|
1045
596
|
|
|
1046
|
-
type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration;
|
|
597
|
+
export type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | TSModuleDeclarationStatement;
|
|
1047
598
|
|
|
1048
|
-
interface BaseModuleDeclaration extends BaseNode {
|
|
599
|
+
export interface BaseModuleDeclaration extends BaseNode {
|
|
1049
600
|
}
|
|
1050
601
|
|
|
1051
|
-
type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
|
602
|
+
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
|
1052
603
|
|
|
1053
|
-
interface BaseModuleSpecifier extends BaseNode {
|
|
604
|
+
export interface BaseModuleSpecifier extends BaseNode {
|
|
1054
605
|
local: Identifier;
|
|
1055
606
|
}
|
|
1056
607
|
|
|
1057
|
-
interface ImportDeclaration extends BaseModuleDeclaration {
|
|
608
|
+
export interface ImportDeclaration extends BaseModuleDeclaration {
|
|
1058
609
|
type: "ImportDeclaration";
|
|
1059
610
|
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
1060
|
-
|
|
611
|
+
/** Absent with `typescript: true` unless there's a `with` clause, as in acorn-typescript. */
|
|
612
|
+
attributes?: ImportAttribute[] | undefined;
|
|
1061
613
|
source: Literal;
|
|
614
|
+
importKind?: "type" | "value";
|
|
1062
615
|
}
|
|
1063
616
|
|
|
1064
|
-
interface ImportSpecifier extends BaseModuleSpecifier {
|
|
617
|
+
export interface ImportSpecifier extends BaseModuleSpecifier {
|
|
1065
618
|
type: "ImportSpecifier";
|
|
1066
619
|
imported: Identifier | Literal;
|
|
620
|
+
importKind?: "type" | "value";
|
|
1067
621
|
}
|
|
1068
622
|
|
|
1069
|
-
interface ImportAttribute extends BaseNode {
|
|
623
|
+
export interface ImportAttribute extends BaseNode {
|
|
1070
624
|
type: "ImportAttribute";
|
|
1071
625
|
key: Identifier | Literal;
|
|
1072
626
|
value: Literal;
|
|
1073
627
|
}
|
|
1074
628
|
|
|
1075
|
-
interface ImportExpression extends BaseExpression {
|
|
629
|
+
export interface ImportExpression extends BaseExpression {
|
|
1076
630
|
type: "ImportExpression";
|
|
1077
631
|
source: Expression;
|
|
1078
632
|
options?: Expression | null | undefined;
|
|
633
|
+
/** The import attributes, with `typescript: true`; `options` otherwise. */
|
|
634
|
+
arguments?: Expression[];
|
|
1079
635
|
}
|
|
1080
636
|
|
|
1081
|
-
interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
|
637
|
+
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
|
1082
638
|
type: "ImportDefaultSpecifier";
|
|
1083
639
|
}
|
|
1084
640
|
|
|
1085
|
-
interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
641
|
+
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
1086
642
|
type: "ImportNamespaceSpecifier";
|
|
1087
643
|
}
|
|
1088
644
|
|
|
1089
|
-
interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
|
645
|
+
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
|
1090
646
|
type: "ExportNamedDeclaration";
|
|
1091
647
|
declaration?: Declaration | null | undefined;
|
|
1092
648
|
specifiers: ExportSpecifier[];
|
|
1093
|
-
|
|
649
|
+
/** Absent with `typescript: true` unless there's a `with` clause, as in acorn-typescript. */
|
|
650
|
+
attributes?: ImportAttribute[] | undefined;
|
|
1094
651
|
source?: Literal | null | undefined;
|
|
652
|
+
exportKind?: "type" | "value";
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export interface ExportSpecifier extends Omit<BaseModuleSpecifier, "local"> {
|
|
656
|
+
type: "ExportSpecifier";
|
|
657
|
+
local: Identifier | Literal;
|
|
658
|
+
exported: Identifier | Literal;
|
|
659
|
+
exportKind?: "type" | "value";
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
|
663
|
+
type: "ExportDefaultDeclaration";
|
|
664
|
+
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression | TSDeclareFunction | TSInterfaceDeclaration;
|
|
665
|
+
exportKind?: "type" | "value";
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
|
669
|
+
type: "ExportAllDeclaration";
|
|
670
|
+
exported: Identifier | Literal | null;
|
|
671
|
+
/** Absent with `typescript: true` unless there's a `with` clause, as in acorn-typescript. */
|
|
672
|
+
attributes?: ImportAttribute[] | undefined;
|
|
673
|
+
source: Literal;
|
|
674
|
+
exportKind?: "type" | "value";
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface AwaitExpression extends BaseExpression {
|
|
678
|
+
type: "AwaitExpression";
|
|
679
|
+
argument: Expression;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export type TSNode = Decorator | TSTypeAnnotation | TypeNode | TSTypePredicate | TSNamedTupleMember | TSOptionalType | TSRestType | TemplateLiteralType | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSQualifiedName | TypeElement | TSInterfaceBody | TSExpressionWithTypeArguments | TSEnumMember | TSModuleBlock | TSExternalModuleReference | TSParameterProperty | TSDeclareMethod | TSDeclaration | TSModuleDeclarationStatement | TSExpression;
|
|
683
|
+
|
|
684
|
+
/** Declarations; in estree's `Declaration` union. */
|
|
685
|
+
export type TSDeclaration = TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration;
|
|
686
|
+
|
|
687
|
+
/** Module-level statements; in estree's `ModuleDeclaration` union. */
|
|
688
|
+
export type TSModuleDeclarationStatement = TSExportAssignment | TSImportEqualsDeclaration | TSNamespaceExportDeclaration;
|
|
689
|
+
|
|
690
|
+
/** Expressions; in estree's `Expression` union. */
|
|
691
|
+
export type TSExpression = TSAsExpression | TSInstantiationExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion;
|
|
692
|
+
|
|
693
|
+
export type TypeNode = TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSParenthesizedType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypeQuery | TSTypeReference | TSUnionType;
|
|
694
|
+
|
|
695
|
+
export type TypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature;
|
|
696
|
+
|
|
697
|
+
export type EntityName = Identifier | TSQualifiedName;
|
|
698
|
+
|
|
699
|
+
export type Accessibility = "public" | "private" | "protected";
|
|
700
|
+
|
|
701
|
+
/** A parameter of a function type, method signature or declared function. */
|
|
702
|
+
export type SignatureParameter = Identifier | ObjectPattern | ArrayPattern | RestElement;
|
|
703
|
+
|
|
704
|
+
/** Fields the plugin adds to `Identifier`, `ObjectPattern`, `ArrayPattern` and `RestElement`. */
|
|
705
|
+
export interface TSBindingFields {
|
|
706
|
+
typeAnnotation?: TSTypeAnnotation | undefined;
|
|
707
|
+
/** `a?` in a parameter list. */
|
|
708
|
+
optional?: boolean;
|
|
709
|
+
decorators?: Decorator[];
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/** Fields the plugin adds to functions. */
|
|
713
|
+
export interface TSFunctionFields {
|
|
714
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
715
|
+
returnType?: TSTypeAnnotation;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/** Fields the plugin adds to classes. */
|
|
719
|
+
export interface TSClassFields {
|
|
720
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
721
|
+
superTypeParameters?: TSTypeParameterInstantiation;
|
|
722
|
+
implements?: TSExpressionWithTypeArguments[];
|
|
723
|
+
abstract?: boolean;
|
|
724
|
+
declare?: boolean;
|
|
725
|
+
decorators?: Decorator[];
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/** Modifiers the plugin adds to class members. */
|
|
729
|
+
export interface TSClassMemberFields {
|
|
730
|
+
accessibility?: Accessibility;
|
|
731
|
+
abstract?: boolean;
|
|
732
|
+
override?: boolean;
|
|
733
|
+
readonly?: boolean;
|
|
734
|
+
declare?: boolean;
|
|
735
|
+
accessor?: boolean;
|
|
736
|
+
optional?: boolean;
|
|
737
|
+
decorators?: Decorator[];
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export interface Decorator extends BaseNode {
|
|
741
|
+
type: "Decorator";
|
|
742
|
+
expression: Expression;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export interface TSTypeAnnotation extends BaseNode {
|
|
746
|
+
type: "TSTypeAnnotation";
|
|
747
|
+
/** A predicate (`x is T`, `asserts x`) only in a return type. */
|
|
748
|
+
typeAnnotation: TypeNode | TSTypePredicate;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export interface TSTypePredicate extends BaseNode {
|
|
752
|
+
type: "TSTypePredicate";
|
|
753
|
+
parameterName: Identifier | TSThisType;
|
|
754
|
+
asserts: boolean;
|
|
755
|
+
/** `null` for `asserts x` without `is`. */
|
|
756
|
+
typeAnnotation: TSTypeAnnotation | null;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export interface TSAnyKeyword extends BaseNode {
|
|
760
|
+
type: "TSAnyKeyword";
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export interface TSBigIntKeyword extends BaseNode {
|
|
764
|
+
type: "TSBigIntKeyword";
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export interface TSBooleanKeyword extends BaseNode {
|
|
768
|
+
type: "TSBooleanKeyword";
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export interface TSNeverKeyword extends BaseNode {
|
|
772
|
+
type: "TSNeverKeyword";
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export interface TSNullKeyword extends BaseNode {
|
|
776
|
+
type: "TSNullKeyword";
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
export interface TSNumberKeyword extends BaseNode {
|
|
780
|
+
type: "TSNumberKeyword";
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export interface TSObjectKeyword extends BaseNode {
|
|
784
|
+
type: "TSObjectKeyword";
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
export interface TSStringKeyword extends BaseNode {
|
|
788
|
+
type: "TSStringKeyword";
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export interface TSSymbolKeyword extends BaseNode {
|
|
792
|
+
type: "TSSymbolKeyword";
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export interface TSUndefinedKeyword extends BaseNode {
|
|
796
|
+
type: "TSUndefinedKeyword";
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface TSUnknownKeyword extends BaseNode {
|
|
800
|
+
type: "TSUnknownKeyword";
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export interface TSVoidKeyword extends BaseNode {
|
|
804
|
+
type: "TSVoidKeyword";
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export interface TSThisType extends BaseNode {
|
|
808
|
+
type: "TSThisType";
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export interface TSArrayType extends BaseNode {
|
|
812
|
+
type: "TSArrayType";
|
|
813
|
+
elementType: TypeNode;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export interface TSConditionalType extends BaseNode {
|
|
817
|
+
type: "TSConditionalType";
|
|
818
|
+
checkType: TypeNode;
|
|
819
|
+
extendsType: TypeNode;
|
|
820
|
+
trueType: TypeNode;
|
|
821
|
+
falseType: TypeNode;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export interface TSFunctionType extends BaseNode {
|
|
825
|
+
type: "TSFunctionType";
|
|
826
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
827
|
+
parameters: SignatureParameter[];
|
|
828
|
+
typeAnnotation: TSTypeAnnotation;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export interface TSConstructorType extends BaseNode {
|
|
832
|
+
type: "TSConstructorType";
|
|
833
|
+
abstract: boolean;
|
|
834
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
835
|
+
parameters: SignatureParameter[];
|
|
836
|
+
typeAnnotation: TSTypeAnnotation;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export interface TSImportType extends BaseNode {
|
|
840
|
+
type: "TSImportType";
|
|
841
|
+
argument: Literal;
|
|
842
|
+
qualifier?: EntityName;
|
|
843
|
+
typeArguments?: TSTypeParameterInstantiation;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
export interface TSIndexedAccessType extends BaseNode {
|
|
847
|
+
type: "TSIndexedAccessType";
|
|
848
|
+
objectType: TypeNode;
|
|
849
|
+
indexType: TypeNode;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export interface TSInferType extends BaseNode {
|
|
853
|
+
type: "TSInferType";
|
|
854
|
+
typeParameter: TSTypeParameter;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export interface TSIntersectionType extends BaseNode {
|
|
858
|
+
type: "TSIntersectionType";
|
|
859
|
+
types: TypeNode[];
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export interface TSUnionType extends BaseNode {
|
|
863
|
+
type: "TSUnionType";
|
|
864
|
+
types: TypeNode[];
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export interface TSLiteralType extends BaseNode {
|
|
868
|
+
type: "TSLiteralType";
|
|
869
|
+
/** `UnaryExpression` for a negative number, e.g. `-1`. */
|
|
870
|
+
literal: Literal | UnaryExpression | TemplateLiteralType;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** A template literal type, `` `prefix-${T}` ``: a `TemplateLiteral` whose expressions are types. */
|
|
874
|
+
export interface TemplateLiteralType extends BaseNode {
|
|
875
|
+
type: "TemplateLiteral";
|
|
876
|
+
quasis: TemplateElement[];
|
|
877
|
+
expressions: TypeNode[];
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
export interface TSMappedType extends BaseNode {
|
|
881
|
+
type: "TSMappedType";
|
|
882
|
+
readonly?: true | "+" | "-";
|
|
883
|
+
typeParameter: TSTypeParameter;
|
|
884
|
+
/** The `as` clause. */
|
|
885
|
+
nameType: TypeNode | null;
|
|
886
|
+
optional?: true | "+" | "-";
|
|
887
|
+
typeAnnotation?: TypeNode;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
export interface TSParenthesizedType extends BaseNode {
|
|
891
|
+
type: "TSParenthesizedType";
|
|
892
|
+
typeAnnotation: TypeNode;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
export interface TSTupleType extends BaseNode {
|
|
896
|
+
type: "TSTupleType";
|
|
897
|
+
elementTypes: Array<TypeNode | TSNamedTupleMember | TSOptionalType | TSRestType>;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export interface TSNamedTupleMember extends BaseNode {
|
|
901
|
+
type: "TSNamedTupleMember";
|
|
902
|
+
label: Identifier;
|
|
903
|
+
optional: boolean;
|
|
904
|
+
elementType: TypeNode;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export interface TSOptionalType extends BaseNode {
|
|
908
|
+
type: "TSOptionalType";
|
|
909
|
+
typeAnnotation: TypeNode;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
export interface TSRestType extends BaseNode {
|
|
913
|
+
type: "TSRestType";
|
|
914
|
+
typeAnnotation: TypeNode | TSNamedTupleMember;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export interface TSTypeLiteral extends BaseNode {
|
|
918
|
+
type: "TSTypeLiteral";
|
|
919
|
+
members: TypeElement[];
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export interface TSTypeOperator extends BaseNode {
|
|
923
|
+
type: "TSTypeOperator";
|
|
924
|
+
operator: "keyof" | "unique" | "readonly";
|
|
925
|
+
typeAnnotation: TypeNode;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export interface TSTypeQuery extends BaseNode {
|
|
929
|
+
type: "TSTypeQuery";
|
|
930
|
+
exprName: EntityName | TSImportType;
|
|
931
|
+
typeArguments?: TSTypeParameterInstantiation;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export interface TSTypeReference extends BaseNode {
|
|
935
|
+
type: "TSTypeReference";
|
|
936
|
+
typeName: EntityName;
|
|
937
|
+
typeArguments?: TSTypeParameterInstantiation;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
export interface TSQualifiedName extends BaseNode {
|
|
941
|
+
type: "TSQualifiedName";
|
|
942
|
+
left: EntityName;
|
|
943
|
+
right: Identifier;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
export interface TSTypeParameterDeclaration extends BaseNode {
|
|
947
|
+
type: "TSTypeParameterDeclaration";
|
|
948
|
+
params: TSTypeParameter[];
|
|
949
|
+
/** With a trailing comma, its offset. */
|
|
950
|
+
extra?: {
|
|
951
|
+
trailingComma: number;
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
export interface TSTypeParameter extends BaseNode {
|
|
956
|
+
type: "TSTypeParameter";
|
|
957
|
+
name: string;
|
|
958
|
+
constraint?: TypeNode;
|
|
959
|
+
default?: TypeNode;
|
|
960
|
+
const?: true;
|
|
961
|
+
in?: true;
|
|
962
|
+
out?: true;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export interface TSTypeParameterInstantiation extends BaseNode {
|
|
966
|
+
type: "TSTypeParameterInstantiation";
|
|
967
|
+
params: TypeNode[];
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export interface TSPropertySignature extends BaseNode {
|
|
971
|
+
type: "TSPropertySignature";
|
|
972
|
+
key: Expression;
|
|
973
|
+
computed?: boolean;
|
|
974
|
+
optional?: boolean;
|
|
975
|
+
readonly?: boolean;
|
|
976
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
export interface TSMethodSignature extends BaseNode {
|
|
980
|
+
type: "TSMethodSignature";
|
|
981
|
+
key: Expression;
|
|
982
|
+
computed?: boolean;
|
|
983
|
+
optional?: boolean;
|
|
984
|
+
kind: "method" | "get" | "set";
|
|
985
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
986
|
+
parameters: SignatureParameter[];
|
|
987
|
+
/** The return type. */
|
|
988
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/** In an interface, a type literal, or a class body (with the class member modifiers). */
|
|
992
|
+
export interface TSIndexSignature extends BaseNode, TSClassMemberFields {
|
|
993
|
+
type: "TSIndexSignature";
|
|
994
|
+
parameters: Identifier[];
|
|
995
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
996
|
+
static?: boolean;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
export interface TSCallSignatureDeclaration extends BaseNode {
|
|
1000
|
+
type: "TSCallSignatureDeclaration";
|
|
1001
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
1002
|
+
parameters: SignatureParameter[];
|
|
1003
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export interface TSConstructSignatureDeclaration extends BaseNode {
|
|
1007
|
+
type: "TSConstructSignatureDeclaration";
|
|
1008
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
1009
|
+
parameters: SignatureParameter[];
|
|
1010
|
+
typeAnnotation?: TSTypeAnnotation;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
export interface TSInterfaceDeclaration extends BaseNode {
|
|
1014
|
+
type: "TSInterfaceDeclaration";
|
|
1015
|
+
id: Identifier;
|
|
1016
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
1017
|
+
extends?: TSExpressionWithTypeArguments[];
|
|
1018
|
+
body: TSInterfaceBody;
|
|
1019
|
+
declare?: boolean;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export interface TSInterfaceBody extends BaseNode {
|
|
1023
|
+
type: "TSInterfaceBody";
|
|
1024
|
+
body: TypeElement[];
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/** An interface's `extends` or a class's `implements` entry. */
|
|
1028
|
+
export interface TSExpressionWithTypeArguments extends BaseNode {
|
|
1029
|
+
type: "TSExpressionWithTypeArguments";
|
|
1030
|
+
expression: EntityName;
|
|
1031
|
+
/** The type arguments, named `typeParameters` as in acorn-typescript. */
|
|
1032
|
+
typeParameters?: TSTypeParameterInstantiation;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export interface TSTypeAliasDeclaration extends BaseNode {
|
|
1036
|
+
type: "TSTypeAliasDeclaration";
|
|
1037
|
+
id: Identifier;
|
|
1038
|
+
typeParameters?: TSTypeParameterDeclaration;
|
|
1039
|
+
typeAnnotation: TypeNode;
|
|
1040
|
+
declare?: boolean;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
export interface TSEnumDeclaration extends BaseNode {
|
|
1044
|
+
type: "TSEnumDeclaration";
|
|
1045
|
+
id: Identifier;
|
|
1046
|
+
members: TSEnumMember[];
|
|
1047
|
+
const?: boolean;
|
|
1048
|
+
declare?: boolean;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export interface TSEnumMember extends BaseNode {
|
|
1052
|
+
type: "TSEnumMember";
|
|
1053
|
+
id: Identifier | Literal;
|
|
1054
|
+
initializer?: Expression;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/** `namespace A {}`, `module "a" {}`, `declare global {}`; `namespace A.B {}` nests through `body`. */
|
|
1058
|
+
export interface TSModuleDeclaration extends BaseNode {
|
|
1059
|
+
type: "TSModuleDeclaration";
|
|
1060
|
+
id: Identifier | Literal;
|
|
1061
|
+
/** Absent for `declare module "a";`. */
|
|
1062
|
+
body?: TSModuleBlock | TSModuleDeclaration;
|
|
1063
|
+
declare?: boolean;
|
|
1064
|
+
global?: boolean;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
export interface TSModuleBlock extends BaseNode {
|
|
1068
|
+
type: "TSModuleBlock";
|
|
1069
|
+
body: Array<Statement | ModuleDeclaration>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/** A function declaration without a body: an overload or `declare function`. */
|
|
1073
|
+
export interface TSDeclareFunction extends BaseNode, TSFunctionFields {
|
|
1074
|
+
type: "TSDeclareFunction";
|
|
1075
|
+
/** `null` in `export default function (): void;`. */
|
|
1076
|
+
id: Identifier | null;
|
|
1077
|
+
params: Pattern[];
|
|
1078
|
+
expression: boolean;
|
|
1079
|
+
generator: boolean;
|
|
1080
|
+
async: boolean;
|
|
1081
|
+
declare?: boolean;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/** A `MethodDefinition`'s value when the method has no body: an overload or an abstract method. */
|
|
1085
|
+
export interface TSDeclareMethod extends BaseNode, TSFunctionFields {
|
|
1086
|
+
type: "TSDeclareMethod";
|
|
1087
|
+
id: null;
|
|
1088
|
+
params: Array<Pattern | TSParameterProperty>;
|
|
1089
|
+
expression: boolean;
|
|
1090
|
+
generator: boolean;
|
|
1091
|
+
async: boolean;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/** `constructor(private a: T)`: a constructor parameter with a modifier. */
|
|
1095
|
+
export interface TSParameterProperty extends BaseNode {
|
|
1096
|
+
type: "TSParameterProperty";
|
|
1097
|
+
accessibility?: Accessibility;
|
|
1098
|
+
readonly?: boolean;
|
|
1099
|
+
override?: boolean;
|
|
1100
|
+
parameter: Identifier | AssignmentPattern;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** `import a = require("a")`, `import a = B.C`, `export import a = B.C`. */
|
|
1104
|
+
export interface TSImportEqualsDeclaration extends BaseNode {
|
|
1105
|
+
type: "TSImportEqualsDeclaration";
|
|
1106
|
+
importKind: "type" | "value";
|
|
1107
|
+
isExport: boolean;
|
|
1108
|
+
id: Identifier;
|
|
1109
|
+
moduleReference: EntityName | TSExternalModuleReference;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
export interface TSExternalModuleReference extends BaseNode {
|
|
1113
|
+
type: "TSExternalModuleReference";
|
|
1114
|
+
expression: Literal;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/** `export = a`. */
|
|
1118
|
+
export interface TSExportAssignment extends BaseNode {
|
|
1119
|
+
type: "TSExportAssignment";
|
|
1120
|
+
expression: Expression;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/** `export as namespace A`. */
|
|
1124
|
+
export interface TSNamespaceExportDeclaration extends BaseNode {
|
|
1125
|
+
type: "TSNamespaceExportDeclaration";
|
|
1126
|
+
id: Identifier;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
export interface TSAsExpression extends BaseNode {
|
|
1130
|
+
type: "TSAsExpression";
|
|
1131
|
+
expression: Expression;
|
|
1132
|
+
typeAnnotation: TypeNode;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export interface TSSatisfiesExpression extends BaseNode {
|
|
1136
|
+
type: "TSSatisfiesExpression";
|
|
1137
|
+
expression: Expression;
|
|
1138
|
+
typeAnnotation: TypeNode;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/** `<T>a`. */
|
|
1142
|
+
export interface TSTypeAssertion extends BaseNode {
|
|
1143
|
+
type: "TSTypeAssertion";
|
|
1144
|
+
typeAnnotation: TypeNode;
|
|
1145
|
+
expression: Expression;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
export interface TSNonNullExpression extends BaseNode {
|
|
1149
|
+
type: "TSNonNullExpression";
|
|
1150
|
+
expression: Expression;
|
|
1095
1151
|
}
|
|
1096
1152
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1153
|
+
/** `f<T>` without a call. */
|
|
1154
|
+
export interface TSInstantiationExpression extends BaseNode {
|
|
1155
|
+
type: "TSInstantiationExpression";
|
|
1156
|
+
expression: Expression;
|
|
1157
|
+
typeArguments: TSTypeParameterInstantiation;
|
|
1101
1158
|
}
|
|
1102
1159
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1160
|
+
type Namespace = "html" | "svg" | "mathml";
|
|
1161
|
+
|
|
1162
|
+
export declare namespace AST {
|
|
1163
|
+
export interface BaseNode {
|
|
1164
|
+
type: string;
|
|
1165
|
+
start: number;
|
|
1166
|
+
end: number;
|
|
1167
|
+
}
|
|
1168
|
+
export interface Fragment {
|
|
1169
|
+
type: "Fragment";
|
|
1170
|
+
nodes: Array<Text | Tag | ElementLike | Block | Comment>;
|
|
1171
|
+
}
|
|
1172
|
+
export interface Root extends BaseNode {
|
|
1173
|
+
type: "Root";
|
|
1174
|
+
/**
|
|
1175
|
+
* Inline options provided by `<svelte:options>` — these override options passed to `compile(...)`
|
|
1176
|
+
*/
|
|
1177
|
+
options: SvelteOptions | null;
|
|
1178
|
+
fragment: Fragment;
|
|
1179
|
+
/** The parsed `<style>` element, if exists */
|
|
1180
|
+
css: AST.CSS.StyleSheet | null;
|
|
1181
|
+
/** The parsed `<script>` element, if exists */
|
|
1182
|
+
instance?: Script;
|
|
1183
|
+
/** The parsed `<script module>` element, if exists */
|
|
1184
|
+
module?: Script;
|
|
1185
|
+
/** Comments found in <script> and {expressions} */
|
|
1186
|
+
comments: JSComment[];
|
|
1187
|
+
/** Always empty, as in svelte. */
|
|
1188
|
+
js: [];
|
|
1189
|
+
}
|
|
1190
|
+
export interface SvelteOptions {
|
|
1191
|
+
start: number;
|
|
1192
|
+
end: number;
|
|
1193
|
+
runes?: boolean;
|
|
1194
|
+
immutable?: boolean;
|
|
1195
|
+
accessors?: boolean;
|
|
1196
|
+
preserveWhitespace?: boolean;
|
|
1197
|
+
namespace?: Namespace;
|
|
1198
|
+
css?: "injected";
|
|
1199
|
+
customElement?: {
|
|
1200
|
+
tag?: string;
|
|
1201
|
+
shadow?: "open" | "none" | ObjectExpression | undefined;
|
|
1202
|
+
props?: Record<string, {
|
|
1203
|
+
attribute?: string;
|
|
1204
|
+
reflect?: boolean;
|
|
1205
|
+
type?: "Array" | "Boolean" | "Number" | "Object" | "String";
|
|
1206
|
+
}>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Is of type
|
|
1209
|
+
* ```ts
|
|
1210
|
+
* (ceClass: new () => HTMLElement) => new () => HTMLElement
|
|
1211
|
+
* ```
|
|
1212
|
+
*/
|
|
1213
|
+
extend?: ArrowFunctionExpression | Identifier;
|
|
1214
|
+
};
|
|
1215
|
+
attributes: Attribute[];
|
|
1216
|
+
}
|
|
1217
|
+
/** Static text */
|
|
1218
|
+
export interface Text extends BaseNode {
|
|
1219
|
+
type: "Text";
|
|
1220
|
+
/** Text with decoded HTML entities */
|
|
1221
|
+
data: string;
|
|
1222
|
+
/** The original text, with undecoded HTML entities */
|
|
1223
|
+
raw: string;
|
|
1224
|
+
}
|
|
1225
|
+
/** A (possibly reactive) template expression — `{...}` */
|
|
1226
|
+
export interface ExpressionTag extends BaseNode {
|
|
1227
|
+
type: "ExpressionTag";
|
|
1228
|
+
expression: Expression;
|
|
1229
|
+
}
|
|
1230
|
+
/** A (possibly reactive) HTML template expression — `{@html ...}` */
|
|
1231
|
+
export interface HtmlTag extends BaseNode {
|
|
1232
|
+
type: "HtmlTag";
|
|
1233
|
+
expression: Expression;
|
|
1234
|
+
}
|
|
1235
|
+
/** An HTML comment */
|
|
1236
|
+
export interface Comment extends BaseNode {
|
|
1237
|
+
type: "Comment";
|
|
1238
|
+
/** the contents of the comment */
|
|
1239
|
+
data: string;
|
|
1240
|
+
}
|
|
1241
|
+
/** A `{@const ...}` tag */
|
|
1242
|
+
export interface ConstTag extends BaseNode {
|
|
1243
|
+
type: "ConstTag";
|
|
1244
|
+
declaration: VariableDeclaration & {
|
|
1245
|
+
declarations: [VariableDeclarator & {
|
|
1246
|
+
id: Pattern;
|
|
1247
|
+
init: Expression;
|
|
1248
|
+
}];
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
/** A `{let ...}` or `{const ...}` tag */
|
|
1252
|
+
export interface DeclarationTag extends BaseNode {
|
|
1253
|
+
type: "DeclarationTag";
|
|
1254
|
+
declaration: VariableDeclaration;
|
|
1255
|
+
}
|
|
1256
|
+
/** A `{@debug ...}` tag */
|
|
1257
|
+
export interface DebugTag extends BaseNode {
|
|
1258
|
+
type: "DebugTag";
|
|
1259
|
+
identifiers: Identifier[];
|
|
1260
|
+
}
|
|
1261
|
+
/** A `{@render foo(...)} tag */
|
|
1262
|
+
export interface RenderTag extends BaseNode {
|
|
1263
|
+
type: "RenderTag";
|
|
1264
|
+
expression: SimpleCallExpression | (ChainExpression & {
|
|
1265
|
+
expression: SimpleCallExpression;
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
/** A `{@attach foo(...)} tag */
|
|
1269
|
+
export interface AttachTag extends BaseNode {
|
|
1270
|
+
type: "AttachTag";
|
|
1271
|
+
expression: Expression;
|
|
1272
|
+
}
|
|
1273
|
+
/** An `animate:` directive */
|
|
1274
|
+
export interface AnimateDirective extends BaseAttribute {
|
|
1275
|
+
type: "AnimateDirective";
|
|
1276
|
+
/** The 'x' in `animate:x` */
|
|
1277
|
+
name: string;
|
|
1278
|
+
/** The y in `animate:x={y}` */
|
|
1279
|
+
expression: null | Expression;
|
|
1280
|
+
/** Parsed for every directive, e.g. `use:x|y`; svelte's types declare it only on some. */
|
|
1281
|
+
modifiers: string[];
|
|
1282
|
+
}
|
|
1283
|
+
/** A `bind:` directive */
|
|
1284
|
+
export interface BindDirective extends BaseAttribute {
|
|
1285
|
+
type: "BindDirective";
|
|
1286
|
+
/** The 'x' in `bind:x` */
|
|
1287
|
+
name: string;
|
|
1288
|
+
/** The y in `bind:x={y}` */
|
|
1289
|
+
expression: Identifier | MemberExpression | SequenceExpression;
|
|
1290
|
+
/** Parsed for every directive, e.g. `use:x|y`; svelte's types declare it only on some. */
|
|
1291
|
+
modifiers: string[];
|
|
1292
|
+
}
|
|
1293
|
+
/** A `class:` directive */
|
|
1294
|
+
export interface ClassDirective extends BaseAttribute {
|
|
1295
|
+
type: "ClassDirective";
|
|
1296
|
+
/** The 'x' in `class:x` */
|
|
1297
|
+
name: "class";
|
|
1298
|
+
/** The 'y' in `class:x={y}`, or the `x` in `class:x` */
|
|
1299
|
+
expression: Expression;
|
|
1300
|
+
/** Parsed for every directive, e.g. `use:x|y`; svelte's types declare it only on some. */
|
|
1301
|
+
modifiers: string[];
|
|
1302
|
+
}
|
|
1303
|
+
/** A `let:` directive */
|
|
1304
|
+
export interface LetDirective extends BaseAttribute {
|
|
1305
|
+
type: "LetDirective";
|
|
1306
|
+
/** The 'x' in `let:x` */
|
|
1307
|
+
name: string;
|
|
1308
|
+
/** The 'y' in `let:x={y}` */
|
|
1309
|
+
expression: null | Identifier | ArrayExpression | ObjectExpression;
|
|
1310
|
+
/** Parsed for every directive, e.g. `use:x|y`; svelte's types declare it only on some. */
|
|
1311
|
+
modifiers: string[];
|
|
1312
|
+
}
|
|
1313
|
+
/** An `on:` directive */
|
|
1314
|
+
export interface OnDirective extends BaseAttribute {
|
|
1315
|
+
type: "OnDirective";
|
|
1316
|
+
/** The 'x' in `on:x` */
|
|
1317
|
+
name: string;
|
|
1318
|
+
/** The 'y' in `on:x={y}` */
|
|
1319
|
+
expression: null | Expression;
|
|
1320
|
+
modifiers: Array<"capture" | "nonpassive" | "once" | "passive" | "preventDefault" | "self" | "stopImmediatePropagation" | "stopPropagation" | "trusted">;
|
|
1321
|
+
}
|
|
1322
|
+
/** A `style:` directive */
|
|
1323
|
+
export interface StyleDirective extends BaseAttribute {
|
|
1324
|
+
type: "StyleDirective";
|
|
1325
|
+
/** The 'x' in `style:x` */
|
|
1326
|
+
name: string;
|
|
1327
|
+
/** The 'y' in `style:x={y}` */
|
|
1328
|
+
value: true | ExpressionTag | Array<ExpressionTag | Text>;
|
|
1329
|
+
modifiers: Array<"important">;
|
|
1330
|
+
}
|
|
1331
|
+
/** A `transition:`, `in:` or `out:` directive */
|
|
1332
|
+
export interface TransitionDirective extends BaseAttribute {
|
|
1333
|
+
type: "TransitionDirective";
|
|
1334
|
+
/** The 'x' in `transition:x` */
|
|
1335
|
+
name: string;
|
|
1336
|
+
/** The 'y' in `transition:x={y}` */
|
|
1337
|
+
expression: null | Expression;
|
|
1338
|
+
modifiers: Array<"local" | "global">;
|
|
1339
|
+
/** True if this is a `transition:` or `in:` directive */
|
|
1340
|
+
intro: boolean;
|
|
1341
|
+
/** True if this is a `transition:` or `out:` directive */
|
|
1342
|
+
outro: boolean;
|
|
1343
|
+
}
|
|
1344
|
+
/** A `use:` directive */
|
|
1345
|
+
export interface UseDirective extends BaseAttribute {
|
|
1346
|
+
type: "UseDirective";
|
|
1347
|
+
/** The 'x' in `use:x` */
|
|
1348
|
+
name: string;
|
|
1349
|
+
/** The 'y' in `use:x={y}` */
|
|
1350
|
+
expression: null | Expression;
|
|
1351
|
+
/** Parsed for every directive, e.g. `use:x|y`; svelte's types declare it only on some. */
|
|
1352
|
+
modifiers: string[];
|
|
1353
|
+
}
|
|
1354
|
+
export interface BaseElement extends BaseNode {
|
|
1355
|
+
name: string;
|
|
1356
|
+
/** Only with `parse(source, { loc: true })`. */
|
|
1357
|
+
name_loc?: SourceLocation;
|
|
1358
|
+
attributes: Array<Attribute | SpreadAttribute | Directive | AttachTag>;
|
|
1359
|
+
fragment: Fragment;
|
|
1360
|
+
}
|
|
1361
|
+
export interface Component extends BaseElement {
|
|
1362
|
+
type: "Component";
|
|
1363
|
+
}
|
|
1364
|
+
export interface TitleElement extends BaseElement {
|
|
1365
|
+
type: "TitleElement";
|
|
1366
|
+
name: "title";
|
|
1367
|
+
}
|
|
1368
|
+
export interface SlotElement extends BaseElement {
|
|
1369
|
+
type: "SlotElement";
|
|
1370
|
+
name: "slot";
|
|
1371
|
+
}
|
|
1372
|
+
export interface RegularElement extends BaseElement {
|
|
1373
|
+
type: "RegularElement";
|
|
1374
|
+
}
|
|
1375
|
+
export interface SvelteBody extends BaseElement {
|
|
1376
|
+
type: "SvelteBody";
|
|
1377
|
+
name: "svelte:body";
|
|
1378
|
+
}
|
|
1379
|
+
export interface SvelteComponent extends BaseElement {
|
|
1380
|
+
type: "SvelteComponent";
|
|
1381
|
+
name: "svelte:component";
|
|
1382
|
+
expression: Expression;
|
|
1383
|
+
}
|
|
1384
|
+
export interface SvelteDocument extends BaseElement {
|
|
1385
|
+
type: "SvelteDocument";
|
|
1386
|
+
name: "svelte:document";
|
|
1387
|
+
}
|
|
1388
|
+
export interface SvelteElement extends BaseElement {
|
|
1389
|
+
type: "SvelteElement";
|
|
1390
|
+
name: "svelte:element";
|
|
1391
|
+
tag: Expression;
|
|
1392
|
+
}
|
|
1393
|
+
export interface SvelteFragment extends BaseElement {
|
|
1394
|
+
type: "SvelteFragment";
|
|
1395
|
+
name: "svelte:fragment";
|
|
1396
|
+
}
|
|
1397
|
+
export interface SvelteBoundary extends BaseElement {
|
|
1398
|
+
type: "SvelteBoundary";
|
|
1399
|
+
name: "svelte:boundary";
|
|
1400
|
+
}
|
|
1401
|
+
export interface SvelteHead extends BaseElement {
|
|
1402
|
+
type: "SvelteHead";
|
|
1403
|
+
name: "svelte:head";
|
|
1404
|
+
}
|
|
1405
|
+
/** This is only an intermediate representation while parsing, it doesn't exist in the final AST */
|
|
1406
|
+
export interface SvelteOptionsRaw extends BaseElement {
|
|
1407
|
+
type: "SvelteOptions";
|
|
1408
|
+
name: "svelte:options";
|
|
1409
|
+
}
|
|
1410
|
+
export interface SvelteSelf extends BaseElement {
|
|
1411
|
+
type: "SvelteSelf";
|
|
1412
|
+
name: "svelte:self";
|
|
1413
|
+
}
|
|
1414
|
+
export interface SvelteWindow extends BaseElement {
|
|
1415
|
+
type: "SvelteWindow";
|
|
1416
|
+
name: "svelte:window";
|
|
1417
|
+
}
|
|
1418
|
+
/** An `{#each ...}` block */
|
|
1419
|
+
export interface EachBlock extends BaseNode {
|
|
1420
|
+
type: "EachBlock";
|
|
1421
|
+
expression: Expression;
|
|
1422
|
+
/** The `entry` in `{#each item as entry}`. `null` if `as` part is omitted */
|
|
1423
|
+
context: Pattern | null;
|
|
1424
|
+
body: Fragment;
|
|
1425
|
+
fallback?: Fragment;
|
|
1426
|
+
index?: string;
|
|
1427
|
+
key?: Expression;
|
|
1428
|
+
}
|
|
1429
|
+
/** An `{#if ...}` block */
|
|
1430
|
+
export interface IfBlock extends BaseNode {
|
|
1431
|
+
type: "IfBlock";
|
|
1432
|
+
elseif: boolean;
|
|
1433
|
+
test: Expression;
|
|
1434
|
+
consequent: Fragment;
|
|
1435
|
+
alternate: Fragment | null;
|
|
1436
|
+
}
|
|
1437
|
+
/** An `{#await ...}` block */
|
|
1438
|
+
export interface AwaitBlock extends BaseNode {
|
|
1439
|
+
type: "AwaitBlock";
|
|
1440
|
+
expression: Expression;
|
|
1441
|
+
/** The resolved value inside the `then` block */
|
|
1442
|
+
value: Pattern | null;
|
|
1443
|
+
/** The rejection reason inside the `catch` block */
|
|
1444
|
+
error: Pattern | null;
|
|
1445
|
+
pending: Fragment | null;
|
|
1446
|
+
then: Fragment | null;
|
|
1447
|
+
catch: Fragment | null;
|
|
1448
|
+
}
|
|
1449
|
+
export interface KeyBlock extends BaseNode {
|
|
1450
|
+
type: "KeyBlock";
|
|
1451
|
+
expression: Expression;
|
|
1452
|
+
fragment: Fragment;
|
|
1453
|
+
}
|
|
1454
|
+
export interface SnippetBlock extends BaseNode {
|
|
1455
|
+
type: "SnippetBlock";
|
|
1456
|
+
expression: Identifier;
|
|
1457
|
+
parameters: Pattern[];
|
|
1458
|
+
typeParams?: string;
|
|
1459
|
+
body: Fragment;
|
|
1460
|
+
}
|
|
1461
|
+
export interface BaseAttribute extends BaseNode {
|
|
1462
|
+
name: string;
|
|
1463
|
+
/** Only with `parse(source, { loc: true })`. */
|
|
1464
|
+
name_loc?: SourceLocation | null;
|
|
1465
|
+
}
|
|
1466
|
+
export interface Attribute extends BaseAttribute {
|
|
1467
|
+
type: "Attribute";
|
|
1468
|
+
/**
|
|
1469
|
+
* Quoted/string values are represented by an array, even if they contain a single expression like `"{x}"`
|
|
1470
|
+
*/
|
|
1471
|
+
value: true | ExpressionTag | Array<Text | ExpressionTag>;
|
|
1472
|
+
}
|
|
1473
|
+
export interface SpreadAttribute extends BaseNode {
|
|
1474
|
+
type: "SpreadAttribute";
|
|
1475
|
+
expression: Expression;
|
|
1476
|
+
}
|
|
1477
|
+
export interface Script extends BaseNode {
|
|
1478
|
+
type: "Script";
|
|
1479
|
+
context: "default" | "module";
|
|
1480
|
+
content: Program;
|
|
1481
|
+
attributes: Attribute[];
|
|
1482
|
+
}
|
|
1483
|
+
export interface JSComment {
|
|
1484
|
+
type: "Line" | "Block";
|
|
1485
|
+
value: string;
|
|
1486
|
+
start: number;
|
|
1487
|
+
end: number;
|
|
1488
|
+
/** Only with `parse(source, { loc: true })`. */
|
|
1489
|
+
loc?: {
|
|
1490
|
+
start: {
|
|
1491
|
+
line: number;
|
|
1492
|
+
column: number;
|
|
1493
|
+
};
|
|
1494
|
+
end: {
|
|
1495
|
+
line: number;
|
|
1496
|
+
column: number;
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
export type AttributeLike = Attribute | SpreadAttribute | Directive;
|
|
1501
|
+
export type Directive = AST.AnimateDirective | AST.BindDirective | AST.ClassDirective | AST.LetDirective | AST.OnDirective | AST.StyleDirective | AST.TransitionDirective | AST.UseDirective;
|
|
1502
|
+
export type Block = AST.EachBlock | AST.IfBlock | AST.AwaitBlock | AST.KeyBlock | AST.SnippetBlock;
|
|
1503
|
+
export type ElementLike = AST.Component | AST.TitleElement | AST.SlotElement | AST.RegularElement | AST.SvelteBody | AST.SvelteBoundary | AST.SvelteComponent | AST.SvelteDocument | AST.SvelteElement | AST.SvelteFragment | AST.SvelteHead | AST.SvelteOptionsRaw | AST.SvelteSelf | AST.SvelteWindow | AST.SvelteBoundary;
|
|
1504
|
+
export type Tag = AST.AttachTag | AST.ConstTag | AST.DeclarationTag | AST.DebugTag | AST.ExpressionTag | AST.HtmlTag | AST.RenderTag;
|
|
1505
|
+
export type TemplateNode = AST.Root | AST.Text | Tag | ElementLike | AST.Attribute | AST.SpreadAttribute | Directive | AST.AttachTag | AST.Comment | Block;
|
|
1506
|
+
export type SvelteNode = Node | TemplateNode | AST.Fragment | _CSS.Node | Script;
|
|
1507
|
+
export type { _CSS as CSS };
|
|
1106
1508
|
}
|
|
1107
1509
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1510
|
+
declare namespace _CSS {
|
|
1511
|
+
interface BaseNode {
|
|
1512
|
+
start: number;
|
|
1513
|
+
end: number;
|
|
1514
|
+
}
|
|
1515
|
+
interface StyleSheetBase extends BaseNode {
|
|
1516
|
+
children: Array<Atrule | Rule>;
|
|
1517
|
+
/** CSS comments in source order */
|
|
1518
|
+
comments: CSSComment[];
|
|
1519
|
+
}
|
|
1520
|
+
interface CSSComment extends BaseNode {
|
|
1521
|
+
type: "CSSComment";
|
|
1522
|
+
value: string;
|
|
1523
|
+
/** Character offset in a containing declaration value or at-rule prelude */
|
|
1524
|
+
position?: number;
|
|
1525
|
+
}
|
|
1526
|
+
interface StyleSheetFile extends StyleSheetBase {
|
|
1527
|
+
type: "StyleSheetFile";
|
|
1528
|
+
}
|
|
1529
|
+
interface StyleSheet extends StyleSheetBase {
|
|
1530
|
+
type: "StyleSheet";
|
|
1531
|
+
attributes: any[];
|
|
1532
|
+
content: {
|
|
1533
|
+
start: number;
|
|
1534
|
+
end: number;
|
|
1535
|
+
styles: string;
|
|
1536
|
+
/** Possible comment atop the style tag */
|
|
1537
|
+
comment: AST.Comment | null;
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
interface Atrule extends BaseNode {
|
|
1541
|
+
type: "Atrule";
|
|
1542
|
+
name: string;
|
|
1543
|
+
prelude: string;
|
|
1544
|
+
block: Block | null;
|
|
1545
|
+
}
|
|
1546
|
+
interface Rule extends BaseNode {
|
|
1547
|
+
type: "Rule";
|
|
1548
|
+
prelude: SelectorList;
|
|
1549
|
+
block: Block;
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* A list of selectors, e.g. `a, b, c {}`
|
|
1553
|
+
*/
|
|
1554
|
+
interface SelectorList extends BaseNode {
|
|
1555
|
+
type: "SelectorList";
|
|
1556
|
+
/**
|
|
1557
|
+
* The `a`, `b` and `c` in `a, b, c {}`
|
|
1558
|
+
*/
|
|
1559
|
+
children: ComplexSelector[];
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* A complex selector, e.g. `a b c {}`
|
|
1563
|
+
*/
|
|
1564
|
+
interface ComplexSelector extends BaseNode {
|
|
1565
|
+
type: "ComplexSelector";
|
|
1566
|
+
/**
|
|
1567
|
+
* The `a`, `b` and `c` in `a b c {}`
|
|
1568
|
+
*/
|
|
1569
|
+
children: RelativeSelector[];
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* A relative selector, e.g the `a` and `> b` in `a > b {}`
|
|
1573
|
+
*/
|
|
1574
|
+
interface RelativeSelector extends BaseNode {
|
|
1575
|
+
type: "RelativeSelector";
|
|
1576
|
+
/**
|
|
1577
|
+
* In `a > b`, `> b` forms one relative selector, and `>` is the combinator. `null` for the first selector.
|
|
1578
|
+
*/
|
|
1579
|
+
combinator: null | Combinator;
|
|
1580
|
+
/**
|
|
1581
|
+
* The `b:is(...)` in `> b:is(...)`
|
|
1582
|
+
*/
|
|
1583
|
+
selectors: SimpleSelector[];
|
|
1584
|
+
}
|
|
1585
|
+
interface TypeSelector extends BaseNode {
|
|
1586
|
+
type: "TypeSelector";
|
|
1587
|
+
name: string;
|
|
1588
|
+
namespace?: string;
|
|
1589
|
+
}
|
|
1590
|
+
interface IdSelector extends BaseNode {
|
|
1591
|
+
type: "IdSelector";
|
|
1592
|
+
name: string;
|
|
1593
|
+
}
|
|
1594
|
+
interface ClassSelector extends BaseNode {
|
|
1595
|
+
type: "ClassSelector";
|
|
1596
|
+
name: string;
|
|
1597
|
+
}
|
|
1598
|
+
interface AttributeSelector extends BaseNode {
|
|
1599
|
+
type: "AttributeSelector";
|
|
1600
|
+
name: string;
|
|
1601
|
+
matcher: string | null;
|
|
1602
|
+
value: string | null;
|
|
1603
|
+
flags: string | null;
|
|
1604
|
+
}
|
|
1605
|
+
interface PseudoElementSelector extends BaseNode {
|
|
1606
|
+
type: "PseudoElementSelector";
|
|
1607
|
+
name: string;
|
|
1608
|
+
args?: SelectorList;
|
|
1609
|
+
}
|
|
1610
|
+
interface PseudoClassSelector extends BaseNode {
|
|
1611
|
+
type: "PseudoClassSelector";
|
|
1612
|
+
name: string;
|
|
1613
|
+
args: SelectorList | null;
|
|
1614
|
+
}
|
|
1615
|
+
interface Percentage extends BaseNode {
|
|
1616
|
+
type: "Percentage";
|
|
1617
|
+
value: string;
|
|
1618
|
+
}
|
|
1619
|
+
interface NestingSelector extends BaseNode {
|
|
1620
|
+
type: "NestingSelector";
|
|
1621
|
+
name: "&";
|
|
1622
|
+
}
|
|
1623
|
+
interface Nth extends BaseNode {
|
|
1624
|
+
type: "Nth";
|
|
1625
|
+
value: string;
|
|
1626
|
+
}
|
|
1627
|
+
type SimpleSelector = TypeSelector | IdSelector | ClassSelector | AttributeSelector | PseudoElementSelector | PseudoClassSelector | Percentage | Nth | NestingSelector;
|
|
1628
|
+
interface Combinator extends BaseNode {
|
|
1629
|
+
type: "Combinator";
|
|
1630
|
+
name: string;
|
|
1631
|
+
}
|
|
1632
|
+
interface Block extends BaseNode {
|
|
1633
|
+
type: "Block";
|
|
1634
|
+
children: Array<Declaration | Rule | Atrule>;
|
|
1635
|
+
}
|
|
1636
|
+
interface Declaration extends BaseNode {
|
|
1637
|
+
type: "Declaration";
|
|
1638
|
+
property: string;
|
|
1639
|
+
value: string;
|
|
1640
|
+
}
|
|
1641
|
+
type Node = StyleSheet | Rule | Atrule | SelectorList | Block | ComplexSelector | RelativeSelector | Combinator | SimpleSelector | Declaration;
|
|
1113
1642
|
}
|
|
1114
1643
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1644
|
+
/**
|
|
1645
|
+
* Parses a JavaScript or TypeScript module, e.g. a `.ts` file a component
|
|
1646
|
+
* imports, into the same kind of AST as a component's `<script>`:
|
|
1647
|
+
* estree, TypeScript nodes as in `@sveltejs/acorn-typescript`, and
|
|
1648
|
+
* comments attached as `leadingComments`/`trailingComments`.
|
|
1649
|
+
*
|
|
1650
|
+
* Throws a {@link ParseError} (`js_parse_error`) on a syntax error.
|
|
1651
|
+
*/
|
|
1652
|
+
export declare function parseModule(source: string, options?: {
|
|
1653
|
+
/** Parse TypeScript. Default `false`. */
|
|
1654
|
+
typescript?: boolean;
|
|
1655
|
+
/** Add `loc` (line/column) to every node. Default `false`. */
|
|
1656
|
+
loc?: boolean;
|
|
1657
|
+
}): Program;
|
|
1119
1658
|
|
|
1120
1659
|
type NodeLike = number | {
|
|
1121
1660
|
start?: number;
|
|
@@ -1140,17 +1679,8 @@ export declare class ParseError extends Error {
|
|
|
1140
1679
|
constructor(node: NodeLike, code: string, message: string);
|
|
1141
1680
|
}
|
|
1142
1681
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
*
|
|
1149
|
-
* Throws a {@link ParseError} (`js_parse_error`) on a syntax error.
|
|
1150
|
-
*/
|
|
1151
|
-
export declare function parseModule(source: string, options?: {
|
|
1152
|
-
/** Parse TypeScript. Default `false`. */
|
|
1153
|
-
typescript?: boolean;
|
|
1154
|
-
/** Add `loc` (line/column) to every node. Default `false`. */
|
|
1155
|
-
loc?: boolean;
|
|
1156
|
-
}): Program;
|
|
1682
|
+
interface Location {
|
|
1683
|
+
line: number;
|
|
1684
|
+
column: number;
|
|
1685
|
+
character: number;
|
|
1686
|
+
}
|