@stylexjs/rollup-plugin 0.16.1 → 0.16.3

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.
@@ -1,1002 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * @flow strict
7
- */
8
-
9
- import * as t from '../types';
10
-
11
- export type Node = t.Node;
12
-
13
- declare var traverse: {
14
- <S>(
15
- parent: ?Node | $ReadOnlyArray<Node>,
16
- opts: TraverseOptions<S>,
17
- scope: Scope | void,
18
- state: S,
19
- parentPath?: NodePath<>,
20
- ): void,
21
- (
22
- parent: ?Node | $ReadOnlyArray<Node>,
23
- opts?: TraverseOptions<>,
24
- scope?: Scope,
25
- state?: mixed,
26
- parentPath?: NodePath<>,
27
- ): void,
28
-
29
- visitors: typeof visitors,
30
- verify: typeof visitors.verify,
31
- explode: typeof visitors.explode,
32
- };
33
-
34
- export default traverse;
35
-
36
- declare export var visitors: {
37
- /**
38
- * `explode()` will take a `Visitor` object with all of the various shorthands
39
- * that we support, and validates & normalizes it into a common format, ready
40
- * to be used in traversal.
41
- *
42
- * The various shorthands are:
43
- * - `Identifier() { ... }` -> `Identifier: { enter() { ... } }`
44
- * - `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }`
45
- * - Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }`
46
- *
47
- * Other normalizations are:
48
- * - Visitors of virtual types are wrapped, so that they are only visited when their dynamic check passes
49
- * - `enter` and `exit` functions are wrapped in arrays, to ease merging of visitors
50
- */
51
- +explode: <S: { +[string]: mixed } = { +[string]: mixed }>(
52
- visitor: Visitor<S>,
53
- ) => { [key: $Keys<t._NodeMap>]: ?VisitNodeObject<S, Node> },
54
- +verify: (visitor: Visitor<>) => void,
55
- +merge: <S = {}>(visitors: Array<Visitor<S>>, states?: S[]) => Visitor<mixed>,
56
- };
57
-
58
- // TODO: Change to object type
59
- export type TraverseOptions<S: Node = Node> = $ReadOnly<{
60
- ...Visitor<S>,
61
- scope?: Scope | void,
62
- noScope?: boolean | void,
63
- }>;
64
-
65
- // TODO: Is this possible??
66
- // export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
67
-
68
- declare export class Scope {
69
- constructor(path: NodePath<>, parentScope?: Scope): Scope;
70
- path: NodePath<>;
71
- block: Node;
72
- parentBlock: Node;
73
- parent: Scope;
74
- hub: HubInterface;
75
- bindings: { [name: string]: Binding };
76
-
77
- /** Traverse node with current scope and path. */
78
- traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void;
79
- traverse(node: Node | Node[], opts?: TraverseOptions<>, state?: any): void;
80
-
81
- /** Generate a unique identifier and add it to the current scope. */
82
- generateDeclaredUidIdentifier(name?: string): t.Identifier;
83
-
84
- /** Generate a unique identifier. */
85
- generateUidIdentifier(name?: string): t.Identifier;
86
-
87
- /** Generate a unique `_id1` binding. */
88
- generateUid(name?: string): string;
89
-
90
- /** Generate a unique identifier based on a node. */
91
- generateUidIdentifierBasedOnNode(
92
- parent: Node,
93
- defaultName?: string,
94
- ): t.Identifier;
95
-
96
- /**
97
- * Determine whether evaluating the specific input `node` is a consequenceless reference. ie.
98
- * evaluating it wont result in potentially arbitrary code from being ran. The following are
99
- * whitelisted and determined not to cause side effects:
100
- *
101
- * - `this` expressions
102
- * - `super` expressions
103
- * - Bound identifiers
104
- */
105
- isStatic(node: Node): boolean;
106
-
107
- /** Possibly generate a memoised identifier if it is not static and has consequences. */
108
- maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier;
109
-
110
- checkBlockScopedCollisions(
111
- local: Binding,
112
- kind: BindingKind,
113
- name: string,
114
- id: object,
115
- ): void;
116
-
117
- rename(oldName: string, newName?: string, block?: Node): void;
118
-
119
- dump(): void;
120
-
121
- toArray(node: Node, i?: number): Node;
122
-
123
- registerDeclaration(path: NodePath<>): void;
124
-
125
- buildUndefinedNode(): Node;
126
-
127
- registerConstantViolation(path: NodePath<>): void;
128
-
129
- registerBinding(
130
- kind: string,
131
- path: NodePath<>,
132
- bindingPath?: NodePath<>,
133
- ): void;
134
-
135
- addGlobal(node: Node): void;
136
-
137
- hasUid(name: string): boolean;
138
-
139
- hasGlobal(name: string): boolean;
140
-
141
- hasReference(name: string): boolean;
142
-
143
- isPure(node: Node, constantsOnly?: boolean): boolean;
144
-
145
- setData(key: string, val: any): any;
146
-
147
- getData(key: string): any;
148
-
149
- removeData(key: string): void;
150
-
151
- crawl(): void;
152
-
153
- push(opts: {
154
- id: t.LVal,
155
- init?: t.Expression | void,
156
- unique?: boolean | void,
157
- kind?: 'var' | 'let' | 'const' | void,
158
- }): void;
159
-
160
- getProgramParent(): Scope;
161
-
162
- getFunctionParent(): Scope | null;
163
-
164
- getBlockParent(): Scope;
165
-
166
- /** Walks the scope tree and gathers **all** bindings. */
167
- getAllBindings<T: string>(...kinds: $ReadOnlyArray<T>): {
168
- +[key: T]: Binding,
169
- };
170
-
171
- bindingIdentifierEquals(name: string, node: Node): boolean;
172
-
173
- getBinding(name: string): Binding | void;
174
-
175
- getOwnBinding(name: string): Binding | void;
176
-
177
- getBindingIdentifier(name: string): t.Identifier;
178
-
179
- getOwnBindingIdentifier(name: string): t.Identifier;
180
-
181
- hasOwnBinding(name: string): boolean;
182
-
183
- hasBinding(name: string, noGlobals?: boolean): boolean;
184
-
185
- parentHasBinding(name: string, noGlobals?: boolean): boolean;
186
-
187
- /** Move a binding of `name` to another `scope`. */
188
- moveBindingTo(name: string, scope: Scope): void;
189
-
190
- removeOwnBinding(name: string): void;
191
-
192
- removeBinding(name: string): void;
193
- }
194
-
195
- export type BindingKind =
196
- | 'var'
197
- | 'let'
198
- | 'const'
199
- | 'module'
200
- | 'hoisted'
201
- | 'param'
202
- | 'local'
203
- | 'unknown';
204
-
205
- declare export class Binding {
206
- constructor(opts: {
207
- identifier: t.Identifier,
208
- scope: Scope,
209
- path: NodePath<>,
210
- kind: BindingKind,
211
- }): Binding;
212
- identifier: t.Identifier;
213
- scope: Scope;
214
- path: NodePath<>;
215
- kind: BindingKind;
216
- referenced: boolean;
217
- references: number;
218
- referencePaths: $ReadOnlyArray<NodePath<>>;
219
- constant: boolean;
220
- constantViolations: $ReadOnlyArray<NodePath<>>;
221
- hasDeoptedValue?: boolean;
222
- hasValue: ?boolean;
223
- value?: any;
224
-
225
- deopValue(): void;
226
- setValue(value: any): void;
227
- clearValue(): void;
228
-
229
- reassign(path: NodePath<>): void;
230
- reference(path: NodePath<>): void;
231
- dereference(): void;
232
- }
233
-
234
- // TODO: Change to object type
235
- type _VisitorNodeKeys<S: object> = {
236
- +[K in keyof t._NodeMap]: ?VisitNode<S, t._NodeMap[K]>,
237
- };
238
- type _VisitorAliases<S: object> = {
239
- +[K in keyof t.Aliases]: ?VisitNode<S, t.Aliases[K]>,
240
- };
241
-
242
- export type Visitor<S: object = object> = $ReadOnly<
243
- Partial<{
244
- ...VisitNodeObject<S, Node>,
245
- ..._VisitorNodeKeys<S>,
246
- ..._VisitorAliases<S>,
247
- }>,
248
- >;
249
-
250
- export type VisitNode<S, P: Node> =
251
- | VisitNodeFunction<S, P>
252
- | VisitNodeObject<S, P>;
253
-
254
- export type VisitNodeFunction<S, P: Node> = (
255
- this: S,
256
- path: NodePath<P>,
257
- state: S,
258
- ) => void;
259
-
260
- type NodeType = Node['type'] | $Keys<t.Aliases>;
261
-
262
- // TODO: Change to object type??
263
- export type VisitNodeObject<S, P: Node> = {
264
- enter?: VisitNodeFunction<S, P> | void,
265
- exit?: VisitNodeFunction<S, P> | void,
266
- denylist?: NodeType[] | void,
267
- /**
268
- * @deprecated will be removed in Babel 8
269
- */
270
- // blacklist?: NodeType[] | void,
271
- };
272
-
273
- type _NodeToTuple<T: Node | $ReadOnlyArray<Node>> =
274
- T extends $ReadOnlyArray<Node> ? T : [T];
275
-
276
- export type NodePaths<T: Node | $ReadOnlyArray<Node>> = $TupleMap<
277
- _NodeToTuple<T>,
278
- <TNode: Node>(TNode) => NodePath<TNode>,
279
- >;
280
-
281
- type TParentPath<T: Node> = T extends t.Program ? null : NodePath<>;
282
-
283
- interface object {}
284
-
285
- declare export class NodePath<+T: Node = Node> {
286
- constructor(hub: Hub, parent: Node): NodePath<T>;
287
- parent: Node;
288
- hub: Hub;
289
- contexts: $ReadOnlyArray<TraversalContext>;
290
- data: object;
291
- shouldSkip: boolean;
292
- shouldStop: boolean;
293
- removed: boolean;
294
- state: any;
295
- opts: object;
296
- skipKeys: object;
297
- parentPath: TParentPath<T>;
298
- context: TraversalContext;
299
- container: object | $ReadOnlyArray<object>;
300
- listKey: string;
301
- inList: boolean;
302
- parentKey: string;
303
- key: string | number;
304
- node: T;
305
- scope: Scope;
306
-
307
- type: T extends null | void
308
- ? void
309
- : T extends Node
310
- ? T['type']
311
- : string | void;
312
-
313
- typeAnnotation: { ... };
314
-
315
- getScope(scope: Scope): Scope;
316
-
317
- setData(key: string, val: any): any;
318
-
319
- getData(key: string, def?: any): any;
320
-
321
- hasNode(this: NodePath<>): boolean; // this is NodePath<$NonMaybeType<this['node']>>;
322
-
323
- buildCodeFrameError<TError: Error>(
324
- msg: string,
325
- Error?: Class<TError>,
326
- ): TError;
327
-
328
- traverse<T: object>(visitor: Visitor<T>, state?: T): void;
329
- // traverse(visitor: Visitor<>): void;
330
-
331
- set(key: string, node: Node): void;
332
-
333
- getPathLocation(): string;
334
-
335
- // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83
336
- debug(buildMessage: () => string): void;
337
-
338
- static get<C: Node, K: $Keys<C>>(opts: {
339
- hub: HubInterface,
340
- parentPath: NodePath<> | null,
341
- parent: Node,
342
- container: C,
343
- listKey?: string | void,
344
- key: K,
345
- }): NodePath<C[K]>;
346
-
347
- //#region ------------------------- ancestry -------------------------
348
- /**
349
- * Starting at the parent path of the current `NodePath` and going up the
350
- * tree, return the first `NodePath` that causes the provided `callback`
351
- * to return a truthy value, or `null` if the `callback` never returns a
352
- * truthy value.
353
- */
354
- findParent(callback: (path: NodePath<>) => boolean): NodePath<> | null;
355
-
356
- /**
357
- * Starting at current `NodePath` and going up the tree, return the first
358
- * `NodePath` that causes the provided `callback` to return a truthy value,
359
- * or `null` if the `callback` never returns a truthy value.
360
- */
361
- find(callback: (path: NodePath<>) => boolean): NodePath<> | null;
362
-
363
- /** Get the parent function of the current path. */
364
- getFunctionParent(): NodePath<t.Function> | null;
365
-
366
- /** Walk up the tree until we hit a parent node path in a list. */
367
- getStatementParent(): NodePath<t.Statement> | null;
368
-
369
- /**
370
- * Get the deepest common ancestor and then from it, get the earliest relationship path
371
- * to that ancestor.
372
- *
373
- * Earliest is defined as being "before" all the other nodes in terms of list container
374
- * position and visiting key.
375
- */
376
- getEarliestCommonAncestorFrom(paths: $ReadOnlyArray<NodePath<>>): NodePath<>;
377
-
378
- /** Get the earliest path in the tree where the provided `paths` intersect. */
379
- getDeepestCommonAncestorFrom(
380
- paths: $ReadOnlyArray<NodePath<>>,
381
- filter?: (
382
- deepest: Node,
383
- i: number,
384
- ancestries: $ReadOnlyArray<NodePath<>>,
385
- ) => NodePath<>,
386
- ): NodePath<>;
387
-
388
- /**
389
- * Build an array of node paths containing the entire ancestry of the current node path.
390
- *
391
- * NOTE: The current node path is included in this.
392
- */
393
- getAncestry(): $ReadOnlyArray<NodePath<>>;
394
-
395
- /**
396
- * A helper to find if `this` path is an ancestor of `maybeDescendant`
397
- */
398
- isAncestor(maybeDescendant: NodePath<>): boolean;
399
-
400
- /**
401
- * A helper to find if `this` path is a descendant of `maybeAncestor`
402
- */
403
- isDescendant(maybeAncestor: NodePath<>): boolean;
404
-
405
- inType(...candidateTypes: Array<string>): boolean;
406
- //#endregion
407
-
408
- //#region ------------------------- inference -------------------------
409
- /** Infer the type of the current `NodePath`. */
410
- getTypeAnnotation(): t.FlowType;
411
-
412
- isBaseType(baseName: string, soft?: boolean): boolean;
413
-
414
- couldBeBaseType(name: string): boolean;
415
-
416
- baseTypeStrictlyMatches(right: NodePath<>): boolean;
417
-
418
- isGenericType(genericName: string): boolean;
419
- //#endregion
420
-
421
- //#region ------------------------- replacement -------------------------
422
- /**
423
- * Replace a node with an array of multiple. This method performs the following steps:
424
- *
425
- * - Inherit the comments of first provided node with that of the current node.
426
- * - Insert the provided nodes after the current node.
427
- * - Remove the current node.
428
- */
429
- replaceWithMultiple<Nodes: $ReadOnlyArray<Node>>(
430
- nodes: Nodes,
431
- ): NodePaths<Nodes>;
432
-
433
- /**
434
- * Parse a string as an expression and replace the current node with the result.
435
- *
436
- * NOTE: This is typically not a good idea to use. Building source strings when
437
- * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
438
- * easier to use, your transforms will be extremely brittle.
439
- */
440
- replaceWithSourceString(replacement: any): [NodePath<>];
441
-
442
- /** Replace the current node with another. */
443
- replaceWith<T: Node>(replacement: T | NodePath<T>): [NodePath<T>];
444
-
445
- /**
446
- * This method takes an array of statements nodes and then explodes it
447
- * into expressions. This method retains completion records which is
448
- * extremely important to retain original semantics.
449
- */
450
- replaceExpressionWithStatements<Nodes: $ReadOnlyArray<Node>>(
451
- nodes: Nodes,
452
- ): NodePaths<Nodes>;
453
-
454
- replaceInline<Nodes: Node | $ReadOnlyArray<Node>>(
455
- nodes: Nodes,
456
- ): NodePaths<Nodes>;
457
- //#endregion
458
-
459
- //#region ------------------------- evaluation -------------------------
460
- /**
461
- * Walk the input `node` and statically evaluate if it's truthy.
462
- *
463
- * Returning `true` when we're sure that the expression will evaluate to a
464
- * truthy value, `false` if we're sure that it will evaluate to a falsy
465
- * value and `undefined` if we aren't sure. Because of this please do not
466
- * rely on coercion when using this method and check with === if it's false.
467
- */
468
- evaluateTruthy(): boolean;
469
-
470
- /**
471
- * Walk the input `node` and statically evaluate it.
472
- *
473
- * Returns an object in the form `{ confident, value }`. `confident` indicates
474
- * whether or not we had to drop out of evaluating the expression because of
475
- * hitting an unknown node that we couldn't confidently find the value of.
476
- *
477
- * Example:
478
- *
479
- * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 }
480
- * t.evaluate(parse("!true")) // { confident: true, value: false }
481
- * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined }
482
- */
483
- evaluate(): { confident: boolean, value: any };
484
- //#endregion
485
-
486
- //#region ------------------------- introspection -------------------------
487
- /**
488
- * Match the current node if it matches the provided `pattern`.
489
- *
490
- * For example, given the match `React.createClass` it would match the
491
- * parsed nodes of `React.createClass` and `React["createClass"]`.
492
- */
493
- matchesPattern(pattern: string, allowPartial?: boolean): boolean;
494
-
495
- /**
496
- * Check whether we have the input `key`. If the `key` references an array then we check
497
- * if the array has any items, otherwise we just check if it's falsy.
498
- */
499
- has(key: string): boolean;
500
-
501
- isStatic(): boolean;
502
-
503
- /** Alias of `has`. */
504
- is(key: string): boolean;
505
-
506
- /** Opposite of `has`. */
507
- isnt(key: string): boolean;
508
-
509
- /** Check whether the path node `key` strict equals `value`. */
510
- equals(key: string, value: any): boolean;
511
-
512
- /**
513
- * Check the type against our stored internal type of the node. This is handy when a node has
514
- * been removed yet we still internally know the type and need it to calculate node replacement.
515
- */
516
- isNodeType(type: string): boolean;
517
-
518
- /**
519
- * This checks whether or not we're in one of the following positions:
520
- *
521
- * for (KEY in right);
522
- * for (KEY;;);
523
- *
524
- * This is because these spots allow VariableDeclarations AND normal expressions so we need
525
- * to tell the path replacement that it's ok to replace this with an expression.
526
- */
527
- canHaveVariableDeclarationOrExpression(): boolean;
528
-
529
- /**
530
- * This checks whether we are swapping an arrow function's body between an
531
- * expression and a block statement (or vice versa).
532
- *
533
- * This is because arrow functions may implicitly return an expression, which
534
- * is the same as containing a block statement.
535
- */
536
- canSwapBetweenExpressionAndStatement(replacement: Node): boolean;
537
-
538
- /** Check whether the current path references a completion record */
539
- isCompletionRecord(allowInsideFunction?: boolean): boolean;
540
-
541
- /**
542
- * Check whether or not the current `key` allows either a single statement or block statement
543
- * so we can explode it if necessary.
544
- */
545
- isStatementOrBlock(): boolean;
546
-
547
- /** Check if the currently assigned path references the `importName` of `moduleSource`. */
548
- referencesImport(moduleSource: string, importName: string): boolean;
549
-
550
- /** Get the source code associated with this node. */
551
- getSource(): string;
552
-
553
- /** Check if the current path will maybe execute before another path */
554
- willIMaybeExecuteBefore(path: NodePath<>): boolean;
555
- //#endregion
556
-
557
- //#region ------------------------- context -------------------------
558
- call(key: string): boolean;
559
-
560
- isBlacklisted(): boolean;
561
-
562
- visit(): boolean;
563
-
564
- skip(): void;
565
-
566
- skipKey(key: string): void;
567
-
568
- stop(): void;
569
-
570
- setScope(): void;
571
-
572
- setContext(context?: TraversalContext): this;
573
-
574
- popContext(): void;
575
-
576
- pushContext(context: TraversalContext): void;
577
- //#endregion
578
-
579
- //#region ------------------------- removal -------------------------
580
- remove(): void;
581
- //#endregion
582
-
583
- //#region ------------------------- modification -------------------------
584
- /** Insert the provided nodes before the current one. */
585
- insertBefore<Nodes: Node | $ReadOnlyArray<Node>>(
586
- nodes: Nodes,
587
- ): NodePaths<Nodes>;
588
-
589
- /**
590
- * Insert the provided nodes after the current one. When inserting nodes after an
591
- * expression, ensure that the completion record is correct by pushing the current node.
592
- */
593
- insertAfter<Nodes: Node | $ReadOnlyArray<Node>>(
594
- nodes: Nodes,
595
- ): NodePaths<Nodes>;
596
-
597
- /** Update all sibling node paths after `fromIndex` by `incrementBy`. */
598
- updateSiblingKeys(fromIndex: number, incrementBy: number): void;
599
-
600
- /**
601
- * Insert child nodes at the start of the current node.
602
- * @param listKey - The key at which the child nodes are stored (usually body).
603
- * @param nodes - the nodes to insert.
604
- */
605
- unshiftContainer<Nodes: Node | $ReadOnlyArray<Node>>(
606
- listKey: $Keys<T>,
607
- nodes: Nodes,
608
- ): NodePaths<Nodes>;
609
-
610
- /**
611
- * Insert child nodes at the end of the current node.
612
- * @param listKey - The key at which the child nodes are stored (usually body).
613
- * @param nodes - the nodes to insert.
614
- */
615
- pushContainer<Nodes: Node | $ReadOnlyArray<Node>>(
616
- listKey: $Keys<T>,
617
- nodes: Nodes,
618
- ): NodePaths<Nodes>;
619
-
620
- /** Hoist the current node to the highest scope possible and return a UID referencing it. */
621
- hoist(scope: Scope): void;
622
- //#endregion
623
-
624
- //#region ------------------------- family -------------------------
625
- getOpposite(): NodePath<>;
626
-
627
- getCompletionRecords(): Array<NodePath<>>;
628
-
629
- getSibling(key: string | number): NodePath<>;
630
- getPrevSibling(): NodePath<>;
631
- getNextSibling(): NodePath<>;
632
- getAllPrevSiblings(): Array<NodePath<>>;
633
- getAllNextSiblings(): Array<NodePath<>>;
634
-
635
- get<K: $Keys<T>>(
636
- key: K,
637
- context?: boolean | TraversalContext,
638
- ): NodePathResult<$NonMaybeType<T[K]>> | T[K] extends null | void
639
- ? null
640
- : empty;
641
- // get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[];
642
-
643
- getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
644
- getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
645
- getBindingIdentifiers(
646
- duplicates?: boolean,
647
- ): Record<string, t.Identifier | t.Identifier[]>;
648
-
649
- getOuterBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
650
- getOuterBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
651
- getOuterBindingIdentifiers(
652
- duplicates?: boolean,
653
- ): Record<string, t.Identifier | t.Identifier[]>;
654
-
655
- getBindingIdentifierPaths(
656
- duplicates: true,
657
- outerOnly?: boolean,
658
- ): Record<string, Array<NodePath<t.Identifier>>>;
659
- getBindingIdentifierPaths(
660
- duplicates?: false,
661
- outerOnly?: boolean,
662
- ): Record<string, NodePath<t.Identifier>>;
663
- getBindingIdentifierPaths(
664
- duplicates?: boolean,
665
- outerOnly?: boolean,
666
- ): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>;
667
-
668
- getOuterBindingIdentifierPaths(
669
- duplicates: true,
670
- ): Record<string, Array<NodePath<t.Identifier>>>;
671
- getOuterBindingIdentifierPaths(
672
- duplicates?: false,
673
- ): Record<string, NodePath<t.Identifier>>;
674
- getOuterBindingIdentifierPaths(
675
- duplicates?: boolean,
676
- outerOnly?: boolean,
677
- ): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>;
678
- //#endregion
679
-
680
- //#region ------------------------- comments -------------------------
681
- /** Share comments amongst siblings. */
682
- shareCommentsWithSiblings(): void;
683
-
684
- addComment(type: string, content: string, line?: boolean): void;
685
-
686
- /** Give node `comments` of the specified `type`. */
687
- addComments(type: string, comments: any[]): void;
688
- //#endregion
689
-
690
- //#region ------------------------- isXXX -------------------------
691
- // isAnyTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.AnyTypeAnnotation>;
692
- // isArrayExpression(props?: object | null): boolean; // this is NodePath<t.ArrayExpression>;
693
- // isArrayPattern(props?: object | null): boolean; // this is NodePath<t.ArrayPattern>;
694
- // isArrayTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.ArrayTypeAnnotation>;
695
- // isArrowFunctionExpression(props?: object | null): boolean; // this is NodePath<t.ArrowFunctionExpression>;
696
- // isAssignmentExpression(props?: object | null): boolean; // this is NodePath<t.AssignmentExpression>;
697
- // isAssignmentPattern(props?: object | null): boolean; // this is NodePath<t.AssignmentPattern>;
698
- // isAwaitExpression(props?: object | null): boolean; // this is NodePath<t.AwaitExpression>;
699
- // isBigIntLiteral(props?: object | null): boolean; // this is NodePath<t.BigIntLiteral>;
700
- // isBinary(props?: object | null): boolean; // this is NodePath<t.Binary>;
701
- // isBinaryExpression(props?: object | null): boolean; // this is NodePath<t.BinaryExpression>;
702
- // isBindExpression(props?: object | null): boolean; // this is NodePath<t.BindExpression>;
703
- // isBlock(props?: object | null): boolean; // this is NodePath<t.Block>;
704
- // isBlockParent(props?: object | null): boolean; // this is NodePath<t.BlockParent>;
705
- // isBlockStatement(props?: object | null): boolean; // this is NodePath<t.BlockStatement>;
706
- // isBooleanLiteral(props?: object | null): boolean; // this is NodePath<t.BooleanLiteral>;
707
- // isBooleanLiteralTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.BooleanLiteralTypeAnnotation>;
708
- // isBooleanTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.BooleanTypeAnnotation>;
709
- // isBreakStatement(props?: object | null): boolean; // this is NodePath<t.BreakStatement>;
710
- // isCallExpression(props?: object | null): boolean; // this is NodePath<t.CallExpression>;
711
- // isCatchClause(props?: object | null): boolean; // this is NodePath<t.CatchClause>;
712
- // isClass(props?: object | null): boolean; // this is NodePath<t.Class>;
713
- // isClassBody(props?: object | null): boolean; // this is NodePath<t.ClassBody>;
714
- // isClassDeclaration(props?: object | null): boolean; // this is NodePath<t.ClassDeclaration>;
715
- // isClassExpression(props?: object | null): boolean; // this is NodePath<t.ClassExpression>;
716
- // isClassImplements(props?: object | null): boolean; // this is NodePath<t.ClassImplements>;
717
- // isClassMethod(props?: object | null): boolean; // this is NodePath<t.ClassMethod>;
718
- // isClassPrivateMethod(props?: object | null): boolean; // this is NodePath<t.ClassPrivateMethod>;
719
- // isClassPrivateProperty(props?: object | null): boolean; // this is NodePath<t.ClassPrivateProperty>;
720
- // isClassProperty(props?: object | null): boolean; // this is NodePath<t.ClassProperty>;
721
- // isCompletionStatement(props?: object | null): boolean; // this is NodePath<t.CompletionStatement>;
722
- // isConditional(props?: object | null): boolean; // this is NodePath<t.Conditional>;
723
- // isConditionalExpression(props?: object | null): boolean; // this is NodePath<t.ConditionalExpression>;
724
- // isContinueStatement(props?: object | null): boolean; // this is NodePath<t.ContinueStatement>;
725
- // isDebuggerStatement(props?: object | null): boolean; // this is NodePath<t.DebuggerStatement>;
726
- // isDeclaration(props?: object | null): boolean; // this is NodePath<t.Declaration>;
727
- // isDeclareClass(props?: object | null): boolean; // this is NodePath<t.DeclareClass>;
728
- // isDeclareExportAllDeclaration(props?: object | null): boolean; // this is NodePath<t.DeclareExportAllDeclaration>;
729
- // isDeclareExportDeclaration(props?: object | null): boolean; // this is NodePath<t.DeclareExportDeclaration>;
730
- // isDeclareFunction(props?: object | null): boolean; // this is NodePath<t.DeclareFunction>;
731
- // isDeclareInterface(props?: object | null): boolean; // this is NodePath<t.DeclareInterface>;
732
- // isDeclareModule(props?: object | null): boolean; // this is NodePath<t.DeclareModule>;
733
- // isDeclareModuleExports(props?: object | null): boolean; // this is NodePath<t.DeclareModuleExports>;
734
- // isDeclareOpaqueType(props?: object | null): boolean; // this is NodePath<t.DeclareOpaqueType>;
735
- // isDeclareTypeAlias(props?: object | null): boolean; // this is NodePath<t.DeclareTypeAlias>;
736
- // isDeclareVariable(props?: object | null): boolean; // this is NodePath<t.DeclareVariable>;
737
- // isDeclaredPredicate(props?: object | null): boolean; // this is NodePath<t.DeclaredPredicate>;
738
- // isDecorator(props?: object | null): boolean; // this is NodePath<t.Decorator>;
739
- // isDirective(props?: object | null): boolean; // this is NodePath<t.Directive>;
740
- // isDirectiveLiteral(props?: object | null): boolean; // this is NodePath<t.DirectiveLiteral>;
741
- // isDoExpression(props?: object | null): boolean; // this is NodePath<t.DoExpression>;
742
- // isDoWhileStatement(props?: object | null): boolean; // this is NodePath<t.DoWhileStatement>;
743
- // isEmptyStatement(props?: object | null): boolean; // this is NodePath<t.EmptyStatement>;
744
- // isEmptyTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.EmptyTypeAnnotation>;
745
- // isExistsTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.ExistsTypeAnnotation>;
746
- // isExportAllDeclaration(props?: object | null): boolean; // this is NodePath<t.ExportAllDeclaration>;
747
- // isExportDeclaration(props?: object | null): boolean; // this is NodePath<t.ExportDeclaration>;
748
- // isExportDefaultDeclaration(props?: object | null): boolean; // this is NodePath<t.ExportDefaultDeclaration>;
749
- // isExportDefaultSpecifier(props?: object | null): boolean; // this is NodePath<t.ExportDefaultSpecifier>;
750
- // isExportNamedDeclaration(props?: object | null): boolean; // this is NodePath<t.ExportNamedDeclaration>;
751
- // isExportNamespaceSpecifier(props?: object | null): boolean; // this is NodePath<t.ExportNamespaceSpecifier>;
752
- // isExportSpecifier(props?: object | null): boolean; // this is NodePath<t.ExportSpecifier>;
753
- // isExpression(props?: object | null): boolean; // this is NodePath<t.Expression>;
754
- // isExpressionStatement(props?: object | null): boolean; // this is NodePath<t.ExpressionStatement>;
755
- // isExpressionWrapper(props?: object | null): boolean; // this is NodePath<t.ExpressionWrapper>;
756
- // isFile(props?: object | null): boolean; // this is NodePath<t.File>;
757
- // isFlow(props?: object | null): boolean; // this is NodePath<t.Flow>;
758
- // isFlowBaseAnnotation(props?: object | null): boolean; // this is NodePath<t.FlowBaseAnnotation>;
759
- // isFlowDeclaration(props?: object | null): boolean; // this is NodePath<t.FlowDeclaration>;
760
- // isFlowPredicate(props?: object | null): boolean; // this is NodePath<t.FlowPredicate>;
761
- // isFlowType(props?: object | null): boolean; // this is NodePath<t.FlowType>;
762
- // isFor(props?: object | null): boolean; // this is NodePath<t.For>;
763
- // isForInStatement(props?: object | null): boolean; // this is NodePath<t.ForInStatement>;
764
- // isForOfStatement(props?: object | null): boolean; // this is NodePath<t.ForOfStatement>;
765
- // isForStatement(props?: object | null): boolean; // this is NodePath<t.ForStatement>;
766
- // isForXStatement(props?: object | null): boolean; // this is NodePath<t.ForXStatement>;
767
- // isFunction(props?: object | null): boolean; // this is NodePath<t.Function>;
768
- // isFunctionDeclaration(props?: object | null): boolean; // this is NodePath<t.FunctionDeclaration>;
769
- // isFunctionExpression(props?: object | null): boolean; // this is NodePath<t.FunctionExpression>;
770
- // isFunctionParent(props?: object | null): boolean; // this is NodePath<t.FunctionParent>;
771
- // isFunctionTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.FunctionTypeAnnotation>;
772
- // isFunctionTypeParam(props?: object | null): boolean; // this is NodePath<t.FunctionTypeParam>;
773
- // isGenericTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.GenericTypeAnnotation>;
774
- // isIdentifier(props?: object | null): boolean; // this is NodePath<t.Identifier>;
775
- // isIfStatement(props?: object | null): boolean; // this is NodePath<t.IfStatement>;
776
- // isImmutable(props?: object | null): boolean; // this is NodePath<t.Immutable>;
777
- // isImport(props?: object | null): boolean; // this is NodePath<t.Import>;
778
- // isImportDeclaration(props?: object | null): boolean; // this is NodePath<t.ImportDeclaration>;
779
- // isImportDefaultSpecifier(props?: object | null): boolean; // this is NodePath<t.ImportDefaultSpecifier>;
780
- // isImportNamespaceSpecifier(props?: object | null): boolean; // this is NodePath<t.ImportNamespaceSpecifier>;
781
- // isImportSpecifier(props?: object | null): boolean; // this is NodePath<t.ImportSpecifier>;
782
- // isInferredPredicate(props?: object | null): boolean; // this is NodePath<t.InferredPredicate>;
783
- // isInterfaceDeclaration(props?: object | null): boolean; // this is NodePath<t.InterfaceDeclaration>;
784
- // isInterfaceExtends(props?: object | null): boolean; // this is NodePath<t.InterfaceExtends>;
785
- // isInterfaceTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.InterfaceTypeAnnotation>;
786
- // isInterpreterDirective(props?: object | null): boolean; // this is NodePath<t.InterpreterDirective>;
787
- // isIntersectionTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.IntersectionTypeAnnotation>;
788
- // isJSX(props?: object | null): boolean; // this is NodePath<t.JSX>;
789
- // isJSXAttribute(props?: object | null): boolean; // this is NodePath<t.JSXAttribute>;
790
- // isJSXClosingElement(props?: object | null): boolean; // this is NodePath<t.JSXClosingElement>;
791
- // isJSXClosingFragment(props?: object | null): boolean; // this is NodePath<t.JSXClosingFragment>;
792
- // isJSXElement(props?: object | null): boolean; // this is NodePath<t.JSXElement>;
793
- // isJSXEmptyExpression(props?: object | null): boolean; // this is NodePath<t.JSXEmptyExpression>;
794
- // isJSXExpressionContainer(props?: object | null): boolean; // this is NodePath<t.JSXExpressionContainer>;
795
- // isJSXFragment(props?: object | null): boolean; // this is NodePath<t.JSXFragment>;
796
- // isJSXIdentifier(props?: object | null): boolean; // this is NodePath<t.JSXIdentifier>;
797
- // isJSXMemberExpression(props?: object | null): boolean; // this is NodePath<t.JSXMemberExpression>;
798
- // isJSXNamespacedName(props?: object | null): boolean; // this is NodePath<t.JSXNamespacedName>;
799
- // isJSXOpeningElement(props?: object | null): boolean; // this is NodePath<t.JSXOpeningElement>;
800
- // isJSXOpeningFragment(props?: object | null): boolean; // this is NodePath<t.JSXOpeningFragment>;
801
- // isJSXSpreadAttribute(props?: object | null): boolean; // this is NodePath<t.JSXSpreadAttribute>;
802
- // isJSXSpreadChild(props?: object | null): boolean; // this is NodePath<t.JSXSpreadChild>;
803
- // isJSXText(props?: object | null): boolean; // this is NodePath<t.JSXText>;
804
- // isLVal(props?: object | null): boolean; // this is NodePath<t.LVal>;
805
- // isLabeledStatement(props?: object | null): boolean; // this is NodePath<t.LabeledStatement>;
806
- // isLiteral(props?: object | null): boolean; // this is NodePath<t.Literal>;
807
- // isLogicalExpression(props?: object | null): boolean; // this is NodePath<t.LogicalExpression>;
808
- // isLoop(props?: object | null): boolean; // this is NodePath<t.Loop>;
809
- // isMemberExpression(props?: object | null): boolean; // this is NodePath<t.MemberExpression>;
810
- // isMetaProperty(props?: object | null): boolean; // this is NodePath<t.MetaProperty>;
811
- // isMethod(props?: object | null): boolean; // this is NodePath<t.Method>;
812
- // isMixedTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.MixedTypeAnnotation>;
813
- // isModuleDeclaration(props?: object | null): boolean; // this is NodePath<t.ModuleDeclaration>;
814
- // isModuleSpecifier(props?: object | null): boolean; // this is NodePath<t.ModuleSpecifier>;
815
- // isNewExpression(props?: object | null): boolean; // this is NodePath<t.NewExpression>;
816
- // isNoop(props?: object | null): boolean; // this is NodePath<t.Noop>;
817
- // isNullLiteral(props?: object | null): boolean; // this is NodePath<t.NullLiteral>;
818
- // isNullLiteralTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.NullLiteralTypeAnnotation>;
819
- // isNullableTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.NullableTypeAnnotation>;
820
- // isNumberLiteralTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.NumberLiteralTypeAnnotation>;
821
- // isNumberTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.NumberTypeAnnotation>;
822
- // isNumericLiteral(props?: object | null): boolean; // this is NodePath<t.NumericLiteral>;
823
- // isObjectExpression(props?: object | null): boolean; // this is NodePath<t.ObjectExpression>;
824
- // isObjectMember(props?: object | null): boolean; // this is NodePath<t.ObjectMember>;
825
- // isObjectMethod(props?: object | null): boolean; // this is NodePath<t.ObjectMethod>;
826
- // isObjectPattern(props?: object | null): boolean; // this is NodePath<t.ObjectPattern>;
827
- // isObjectProperty(props?: object | null): boolean; // this is NodePath<t.ObjectProperty>;
828
- // isObjectTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.ObjectTypeAnnotation>;
829
- // isObjectTypeCallProperty(props?: object | null): boolean; // this is NodePath<t.ObjectTypeCallProperty>;
830
- // isObjectTypeIndexer(props?: object | null): boolean; // this is NodePath<t.ObjectTypeIndexer>;
831
- // isObjectTypeInternalSlot(props?: object | null): boolean; // this is NodePath<t.ObjectTypeInternalSlot>;
832
- // isObjectTypeProperty(props?: object | null): boolean; // this is NodePath<t.ObjectTypeProperty>;
833
- // isObjectTypeSpreadProperty(props?: object | null): boolean; // this is NodePath<t.ObjectTypeSpreadProperty>;
834
- // isOpaqueType(props?: object | null): boolean; // this is NodePath<t.OpaqueType>;
835
- // isOptionalCallExpression(props?: object | null): boolean; // this is NodePath<t.OptionalCallExpression>;
836
- // isOptionalMemberExpression(props?: object | null): boolean; // this is NodePath<t.OptionalMemberExpression>;
837
- // isParenthesizedExpression(props?: object | null): boolean; // this is NodePath<t.ParenthesizedExpression>;
838
- // isPattern(props?: object | null): boolean; // this is NodePath<t.Pattern>;
839
- // isPatternLike(props?: object | null): boolean; // this is NodePath<t.PatternLike>;
840
- // isPipelineBareFunction(props?: object | null): boolean; // this is NodePath<t.PipelineBareFunction>;
841
- // isPipelinePrimaryTopicReference(props?: object | null): boolean; // this is NodePath<t.PipelinePrimaryTopicReference>;
842
- // isPipelineTopicExpression(props?: object | null): boolean; // this is NodePath<t.PipelineTopicExpression>;
843
- // isPrivate(props?: object | null): boolean; // this is NodePath<t.Private>;
844
- // isPrivateName(props?: object | null): boolean; // this is NodePath<t.PrivateName>;
845
- // isProgram(props?: object | null): boolean; // this is NodePath<t.Program>;
846
- // isProperty(props?: object | null): boolean; // this is NodePath<t.Property>;
847
- // isPureish(props?: object | null): boolean; // this is NodePath<t.Pureish>;
848
- // isQualifiedTypeIdentifier(props?: object | null): boolean; // this is NodePath<t.QualifiedTypeIdentifier>;
849
- // isRegExpLiteral(props?: object | null): boolean; // this is NodePath<t.RegExpLiteral>;
850
- // isRestElement(props?: object | null): boolean; // this is NodePath<t.RestElement>;
851
- // isReturnStatement(props?: object | null): boolean; // this is NodePath<t.ReturnStatement>;
852
- // isScopable(props?: object | null): boolean; // this is NodePath<t.Scopable>;
853
- // isSequenceExpression(props?: object | null): boolean; // this is NodePath<t.SequenceExpression>;
854
- // isSpreadElement(props?: object | null): boolean; // this is NodePath<t.SpreadElement>;
855
- // isStatement(props?: object | null): boolean; // this is NodePath<t.Statement>;
856
- // isStringLiteral(props?: object | null): boolean; // this is NodePath<t.StringLiteral>;
857
- // isStringLiteralTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.StringLiteralTypeAnnotation>;
858
- // isStringTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.StringTypeAnnotation>;
859
- // isSuper(props?: object | null): boolean; // this is NodePath<t.Super>;
860
- // isSwitchCase(props?: object | null): boolean; // this is NodePath<t.SwitchCase>;
861
- // isSwitchStatement(props?: object | null): boolean; // this is NodePath<t.SwitchStatement>;
862
- // isTSAnyKeyword(props?: object | null): boolean; // this is NodePath<t.TSAnyKeyword>;
863
- // isTSArrayType(props?: object | null): boolean; // this is NodePath<t.TSArrayType>;
864
- // isTSAsExpression(props?: object | null): boolean; // this is NodePath<t.TSAsExpression>;
865
- // isTSBooleanKeyword(props?: object | null): boolean; // this is NodePath<t.TSBooleanKeyword>;
866
- // isTSCallSignatureDeclaration(props?: object | null): boolean; // this is NodePath<t.TSCallSignatureDeclaration>;
867
- // isTSConditionalType(props?: object | null): boolean; // this is NodePath<t.TSConditionalType>;
868
- // isTSConstructSignatureDeclaration(props?: object | null): boolean; // this is NodePath<t.TSConstructSignatureDeclaration>;
869
- // isTSConstructorType(props?: object | null): boolean; // this is NodePath<t.TSConstructorType>;
870
- // isTSDeclareFunction(props?: object | null): boolean; // this is NodePath<t.TSDeclareFunction>;
871
- // isTSDeclareMethod(props?: object | null): boolean; // this is NodePath<t.TSDeclareMethod>;
872
- // isTSEntityName(props?: object | null): boolean; // this is NodePath<t.TSEntityName>;
873
- // isTSEnumDeclaration(props?: object | null): boolean; // this is NodePath<t.TSEnumDeclaration>;
874
- // isTSEnumMember(props?: object | null): boolean; // this is NodePath<t.TSEnumMember>;
875
- // isTSExportAssignment(props?: object | null): boolean; // this is NodePath<t.TSExportAssignment>;
876
- // isTSExpressionWithTypeArguments(props?: object | null): boolean; // this is NodePath<t.TSExpressionWithTypeArguments>;
877
- // isTSExternalModuleReference(props?: object | null): boolean; // this is NodePath<t.TSExternalModuleReference>;
878
- // isTSFunctionType(props?: object | null): boolean; // this is NodePath<t.TSFunctionType>;
879
- // isTSImportEqualsDeclaration(props?: object | null): boolean; // this is NodePath<t.TSImportEqualsDeclaration>;
880
- // isTSImportType(props?: object | null): boolean; // this is NodePath<t.TSImportType>;
881
- // isTSIndexSignature(props?: object | null): boolean; // this is NodePath<t.TSIndexSignature>;
882
- // isTSIndexedAccessType(props?: object | null): boolean; // this is NodePath<t.TSIndexedAccessType>;
883
- // isTSInferType(props?: object | null): boolean; // this is NodePath<t.TSInferType>;
884
- // isTSInterfaceBody(props?: object | null): boolean; // this is NodePath<t.TSInterfaceBody>;
885
- // isTSInterfaceDeclaration(props?: object | null): boolean; // this is NodePath<t.TSInterfaceDeclaration>;
886
- // isTSIntersectionType(props?: object | null): boolean; // this is NodePath<t.TSIntersectionType>;
887
- // isTSLiteralType(props?: object | null): boolean; // this is NodePath<t.TSLiteralType>;
888
- // isTSMappedType(props?: object | null): boolean; // this is NodePath<t.TSMappedType>;
889
- // isTSMethodSignature(props?: object | null): boolean; // this is NodePath<t.TSMethodSignature>;
890
- // isTSModuleBlock(props?: object | null): boolean; // this is NodePath<t.TSModuleBlock>;
891
- // isTSModuleDeclaration(props?: object | null): boolean; // this is NodePath<t.TSModuleDeclaration>;
892
- // isTSNamespaceExportDeclaration(props?: object | null): boolean; // this is NodePath<t.TSNamespaceExportDeclaration>;
893
- // isTSNeverKeyword(props?: object | null): boolean; // this is NodePath<t.TSNeverKeyword>;
894
- // isTSNonNullExpression(props?: object | null): boolean; // this is NodePath<t.TSNonNullExpression>;
895
- // isTSNullKeyword(props?: object | null): boolean; // this is NodePath<t.TSNullKeyword>;
896
- // isTSNumberKeyword(props?: object | null): boolean; // this is NodePath<t.TSNumberKeyword>;
897
- // isTSObjectKeyword(props?: object | null): boolean; // this is NodePath<t.TSObjectKeyword>;
898
- // isTSOptionalType(props?: object | null): boolean; // this is NodePath<t.TSOptionalType>;
899
- // isTSParameterProperty(props?: object | null): boolean; // this is NodePath<t.TSParameterProperty>;
900
- // isTSParenthesizedType(props?: object | null): boolean; // this is NodePath<t.TSParenthesizedType>;
901
- // isTSPropertySignature(props?: object | null): boolean; // this is NodePath<t.TSPropertySignature>;
902
- // isTSQualifiedName(props?: object | null): boolean; // this is NodePath<t.TSQualifiedName>;
903
- // isTSRestType(props?: object | null): boolean; // this is NodePath<t.TSRestType>;
904
- // isTSStringKeyword(props?: object | null): boolean; // this is NodePath<t.TSStringKeyword>;
905
- // isTSSymbolKeyword(props?: object | null): boolean; // this is NodePath<t.TSSymbolKeyword>;
906
- // isTSThisType(props?: object | null): boolean; // this is NodePath<t.TSThisType>;
907
- // isTSTupleType(props?: object | null): boolean; // this is NodePath<t.TSTupleType>;
908
- // isTSType(props?: object | null): boolean; // this is NodePath<t.TSType>;
909
- // isTSTypeAliasDeclaration(props?: object | null): boolean; // this is NodePath<t.TSTypeAliasDeclaration>;
910
- // isTSTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.TSTypeAnnotation>;
911
- // isTSTypeAssertion(props?: object | null): boolean; // this is NodePath<t.TSTypeAssertion>;
912
- // isTSTypeElement(props?: object | null): boolean; // this is NodePath<t.TSTypeElement>;
913
- // isTSTypeLiteral(props?: object | null): boolean; // this is NodePath<t.TSTypeLiteral>;
914
- // isTSTypeOperator(props?: object | null): boolean; // this is NodePath<t.TSTypeOperator>;
915
- // isTSTypeParameter(props?: object | null): boolean; // this is NodePath<t.TSTypeParameter>;
916
- // isTSTypeParameterDeclaration(props?: object | null): boolean; // this is NodePath<t.TSTypeParameterDeclaration>;
917
- // isTSTypeParameterInstantiation(props?: object | null): boolean; // this is NodePath<t.TSTypeParameterInstantiation>;
918
- // isTSTypePredicate(props?: object | null): boolean; // this is NodePath<t.TSTypePredicate>;
919
- // isTSTypeQuery(props?: object | null): boolean; // this is NodePath<t.TSTypeQuery>;
920
- // isTSTypeReference(props?: object | null): boolean; // this is NodePath<t.TSTypeReference>;
921
- // isTSUndefinedKeyword(props?: object | null): boolean; // this is NodePath<t.TSUndefinedKeyword>;
922
- // isTSUnionType(props?: object | null): boolean; // this is NodePath<t.TSUnionType>;
923
- // isTSUnknownKeyword(props?: object | null): boolean; // this is NodePath<t.TSUnknownKeyword>;
924
- // isTSVoidKeyword(props?: object | null): boolean; // this is NodePath<t.TSVoidKeyword>;
925
- // isTaggedTemplateExpression(props?: object | null): boolean; // this is NodePath<t.TaggedTemplateExpression>;
926
- // isTemplateElement(props?: object | null): boolean; // this is NodePath<t.TemplateElement>;
927
- // isTemplateLiteral(props?: object | null): boolean; // this is NodePath<t.TemplateLiteral>;
928
- // isTerminatorless(props?: object | null): boolean; // this is NodePath<t.Terminatorless>;
929
- // isThisExpression(props?: object | null): boolean; // this is NodePath<t.ThisExpression>;
930
- // isThisTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.ThisTypeAnnotation>;
931
- // isThrowStatement(props?: object | null): boolean; // this is NodePath<t.ThrowStatement>;
932
- // isTryStatement(props?: object | null): boolean; // this is NodePath<t.TryStatement>;
933
- // isTupleTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.TupleTypeAnnotation>;
934
- // isTypeAlias(props?: object | null): boolean; // this is NodePath<t.TypeAlias>;
935
- // isTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.TypeAnnotation>;
936
- // isTypeCastExpression(props?: object | null): boolean; // this is NodePath<t.TypeCastExpression>;
937
- // isTypeParameter(props?: object | null): boolean; // this is NodePath<t.TypeParameter>;
938
- // isTypeParameterDeclaration(props?: object | null): boolean; // this is NodePath<t.TypeParameterDeclaration>;
939
- // isTypeParameterInstantiation(props?: object | null): boolean; // this is NodePath<t.TypeParameterInstantiation>;
940
- // isTypeofTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.TypeofTypeAnnotation>;
941
- // isUnaryExpression(props?: object | null): boolean; // this is NodePath<t.UnaryExpression>;
942
- // isUnaryLike(props?: object | null): boolean; // this is NodePath<t.UnaryLike>;
943
- // isUnionTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.UnionTypeAnnotation>;
944
- // isUpdateExpression(props?: object | null): boolean; // this is NodePath<t.UpdateExpression>;
945
- // isUserWhitespacable(props?: object | null): boolean; // this is NodePath<t.UserWhitespacable>;
946
- // isVariableDeclaration(props?: object | null): boolean; // this is NodePath<t.VariableDeclaration>;
947
- // isVariableDeclarator(props?: object | null): boolean; // this is NodePath<t.VariableDeclarator>;
948
- // isVariance(props?: object | null): boolean; // this is NodePath<t.Variance>;
949
- // isVoidTypeAnnotation(props?: object | null): boolean; // this is NodePath<t.VoidTypeAnnotation>;
950
- // isWhile(props?: object | null): boolean; // this is NodePath<t.While>;
951
- // isWhileStatement(props?: object | null): boolean; // this is NodePath<t.WhileStatement>;
952
- // isWithStatement(props?: object | null): boolean; // this is NodePath<t.WithStatement>;
953
- // isYieldExpression(props?: object | null): boolean; // this is NodePath<t.YieldExpression>;
954
- // isBindingIdentifier(props?: object | null): boolean; // this is NodePath<t.Identifier>;
955
- // isBlockScoped(
956
- // props?: object | null,
957
- // ): boolean; // this is NodePath<t.FunctionDeclaration | t.ClassDeclaration | t.VariableDeclaration>;
958
- // isGenerated(props?: object | null): boolean;
959
- // isPure(props?: object | null): boolean;
960
- // isReferenced(props?: object | null): boolean;
961
- // isReferencedIdentifier(props?: object | null): boolean; // this is NodePath<t.Identifier | t.JSXIdentifier>;
962
- // isReferencedMemberExpression(props?: object | null): boolean; // this is NodePath<t.MemberExpression>;
963
- // isScope(props?: object | null): boolean; // this is NodePath<t.Scopable>;
964
- // isUser(props?: object | null): boolean;
965
- // isVar(props?: object | null): boolean; // this is NodePath<t.VariableDeclaration>;
966
- //#endregion
967
-
968
- //#region ------------------------- assertXXX -------------------------
969
- // Purposely skipping all `assert` functions as Flow can't handle them.
970
- //#endregion
971
- }
972
-
973
- export interface HubInterface {
974
- getCode(): string | void;
975
- getScope(): Scope | void;
976
- addHelper(name: string): any;
977
- buildError<E: Error>(node: Node, msg: string, Error: Class<E>): E;
978
- }
979
-
980
- declare export class Hub implements HubInterface {
981
- constructor(): Hub;
982
- getCode(): string | void;
983
- getScope(): Scope | void;
984
- addHelper(name: string): any;
985
- buildError<E: Error>(node: Node, msg: string, Constructor: Class<E>): E;
986
- }
987
-
988
- export interface TraversalContext {
989
- parentPath: NodePath<>;
990
- scope: Scope;
991
- state: any;
992
- opts: any;
993
- }
994
-
995
- export type NodePathResult<T: Node | $ReadOnlyArray<Node>> =
996
- T extends $ReadOnlyArray<infer TNode>
997
- ? $ReadOnlyArray<NodePath<TNode>>
998
- : T extends null | void
999
- ? void
1000
- : T extends Node
1001
- ? NodePath<T>
1002
- : T;