@babel/traverse 8.0.0-alpha.9 → 8.0.0-beta.1
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/lib/index.d.ts +108 -156
- package/lib/index.js +1156 -1034
- package/lib/index.js.map +1 -1
- package/package.json +11 -14
package/lib/index.d.ts
CHANGED
@@ -53,20 +53,18 @@ declare class Scope {
|
|
53
53
|
uid: number;
|
54
54
|
path: NodePath_Final;
|
55
55
|
block: t.Pattern | t.Scopable;
|
56
|
-
labels: Map<any, any>;
|
57
56
|
inited: boolean;
|
57
|
+
labels: Map<string, NodePath_Final<t.LabeledStatement>>;
|
58
58
|
bindings: {
|
59
59
|
[name: string]: Binding;
|
60
60
|
};
|
61
|
-
|
62
|
-
|
63
|
-
};
|
61
|
+
/** Only defined in the program scope */
|
62
|
+
referencesSet?: Set<string>;
|
64
63
|
globals: {
|
65
64
|
[name: string]: t.Identifier | t.JSXIdentifier;
|
66
65
|
};
|
67
|
-
|
68
|
-
|
69
|
-
};
|
66
|
+
/** Only defined in the program scope */
|
67
|
+
uidsSet?: Set<string>;
|
70
68
|
data: {
|
71
69
|
[key: string | symbol]: unknown;
|
72
70
|
};
|
@@ -85,10 +83,8 @@ declare class Scope {
|
|
85
83
|
*/
|
86
84
|
static contextVariables: string[];
|
87
85
|
get parent(): Scope;
|
88
|
-
get
|
89
|
-
get
|
90
|
-
traverse<S>(node: t.Node | t.Node[], opts: TraverseOptions<S>, state: S): void;
|
91
|
-
traverse(node: t.Node | t.Node[], opts?: TraverseOptions, state?: any): void;
|
86
|
+
get references(): void;
|
87
|
+
get uids(): void;
|
92
88
|
/**
|
93
89
|
* Generate a unique identifier and add it to the current scope.
|
94
90
|
*/
|
@@ -101,10 +97,6 @@ declare class Scope {
|
|
101
97
|
* Generate a unique `_id1` binding.
|
102
98
|
*/
|
103
99
|
generateUid(name?: string): string;
|
104
|
-
/**
|
105
|
-
* Generate an `_id1`.
|
106
|
-
*/
|
107
|
-
_generateUid(name: string, i: number): string;
|
108
100
|
generateUidBasedOnNode(node: t.Node, defaultName?: string): string;
|
109
101
|
/**
|
110
102
|
* Generate a unique identifier based on a node.
|
@@ -126,12 +118,9 @@ declare class Scope {
|
|
126
118
|
maybeGenerateMemoised(node: t.Node, dontPush?: boolean): t.Identifier;
|
127
119
|
checkBlockScopedCollisions(local: Binding, kind: BindingKind, name: string, id: any): void;
|
128
120
|
rename(oldName: string, newName?: string): void;
|
129
|
-
/** @deprecated Not used in our codebase */
|
130
|
-
_renameFromMap(map: Record<string | symbol, unknown>, oldName: string | symbol, newName: string | symbol, value: unknown): void;
|
131
121
|
dump(): void;
|
132
|
-
toArray(node: t.Node, i?: number | boolean, arrayLikeIsIterable?: boolean | void): t.ArrayExpression | t.CallExpression | t.Identifier;
|
133
122
|
hasLabel(name: string): boolean;
|
134
|
-
getLabel(name: string):
|
123
|
+
getLabel(name: string): NodePath<t.LabeledStatement>;
|
135
124
|
registerLabel(path: NodePath_Final<t.LabeledStatement>): void;
|
136
125
|
registerDeclaration(path: NodePath_Final): void;
|
137
126
|
buildUndefinedNode(): t.UnaryExpression;
|
@@ -158,7 +147,7 @@ declare class Scope {
|
|
158
147
|
init(): void;
|
159
148
|
crawl(): void;
|
160
149
|
push(opts: {
|
161
|
-
id: t.
|
150
|
+
id: t.ArrayPattern | t.Identifier | t.ObjectPattern;
|
162
151
|
init?: t.Expression;
|
163
152
|
unique?: boolean;
|
164
153
|
_blockHoist?: number | undefined;
|
@@ -167,7 +156,10 @@ declare class Scope {
|
|
167
156
|
/**
|
168
157
|
* Walk up to the top of the scope tree and get the `Program`.
|
169
158
|
*/
|
170
|
-
getProgramParent(): Scope
|
159
|
+
getProgramParent(): Scope & {
|
160
|
+
referencesSet: Set<string>;
|
161
|
+
uidsSet: Set<string>;
|
162
|
+
};
|
171
163
|
/**
|
172
164
|
* Walk up the scope tree until we hit either a Function or return null.
|
173
165
|
*/
|
@@ -187,10 +179,6 @@ declare class Scope {
|
|
187
179
|
* Walks the scope tree and gathers **all** bindings.
|
188
180
|
*/
|
189
181
|
getAllBindings(): Record<string, Binding>;
|
190
|
-
/**
|
191
|
-
* Walks the scope tree and gathers all declarations of `kind`.
|
192
|
-
*/
|
193
|
-
getAllBindingsOfKind(...kinds: string[]): Record<string, Binding>;
|
194
182
|
bindingIdentifierEquals(name: string, node: t.Node): boolean;
|
195
183
|
getBinding(name: string): Binding | undefined;
|
196
184
|
getOwnBinding(name: string): Binding | undefined;
|
@@ -200,6 +188,7 @@ declare class Scope {
|
|
200
188
|
hasBinding(name: string, opts?: boolean | {
|
201
189
|
noGlobals?: boolean;
|
202
190
|
noUids?: boolean;
|
191
|
+
upToScope?: Scope;
|
203
192
|
}): boolean;
|
204
193
|
parentHasBinding(name: string, opts?: {
|
205
194
|
noGlobals?: boolean;
|
@@ -211,6 +200,17 @@ declare class Scope {
|
|
211
200
|
moveBindingTo(name: string, scope: Scope): void;
|
212
201
|
removeOwnBinding(name: string): void;
|
213
202
|
removeBinding(name: string): void;
|
203
|
+
/**
|
204
|
+
* Hoist all the `var` variable to the beginning of the function/program
|
205
|
+
* scope where their binding will be actually defined. For exmaple,
|
206
|
+
* { var x = 2 }
|
207
|
+
* will be transformed to
|
208
|
+
* var x; { x = 2 }
|
209
|
+
*
|
210
|
+
* @param emit A custom function to emit `var` declarations, for example to
|
211
|
+
* emit them in a different scope.
|
212
|
+
*/
|
213
|
+
hoistVariables(emit?: (id: t.Identifier, hasInit: boolean) => void): void;
|
214
214
|
}
|
215
215
|
declare namespace Scope {
|
216
216
|
type Binding = _Binding;
|
@@ -313,7 +313,6 @@ interface ExplVisitorBase<S> {
|
|
313
313
|
ConditionalExpression?: ExplVisitNode<S, t.ConditionalExpression>;
|
314
314
|
ContinueStatement?: ExplVisitNode<S, t.ContinueStatement>;
|
315
315
|
DebuggerStatement?: ExplVisitNode<S, t.DebuggerStatement>;
|
316
|
-
DecimalLiteral?: ExplVisitNode<S, t.DecimalLiteral>;
|
317
316
|
DeclareClass?: ExplVisitNode<S, t.DeclareClass>;
|
318
317
|
DeclareExportAllDeclaration?: ExplVisitNode<S, t.DeclareExportAllDeclaration>;
|
319
318
|
DeclareExportDeclaration?: ExplVisitNode<S, t.DeclareExportDeclaration>;
|
@@ -451,6 +450,7 @@ interface ExplVisitorBase<S> {
|
|
451
450
|
TSBigIntKeyword?: ExplVisitNode<S, t.TSBigIntKeyword>;
|
452
451
|
TSBooleanKeyword?: ExplVisitNode<S, t.TSBooleanKeyword>;
|
453
452
|
TSCallSignatureDeclaration?: ExplVisitNode<S, t.TSCallSignatureDeclaration>;
|
453
|
+
TSClassImplements?: ExplVisitNode<S, t.TSClassImplements>;
|
454
454
|
TSConditionalType?: ExplVisitNode<S, t.TSConditionalType>;
|
455
455
|
TSConstructSignatureDeclaration?: ExplVisitNode<
|
456
456
|
S,
|
@@ -459,13 +459,10 @@ interface ExplVisitorBase<S> {
|
|
459
459
|
TSConstructorType?: ExplVisitNode<S, t.TSConstructorType>;
|
460
460
|
TSDeclareFunction?: ExplVisitNode<S, t.TSDeclareFunction>;
|
461
461
|
TSDeclareMethod?: ExplVisitNode<S, t.TSDeclareMethod>;
|
462
|
+
TSEnumBody?: ExplVisitNode<S, t.TSEnumBody>;
|
462
463
|
TSEnumDeclaration?: ExplVisitNode<S, t.TSEnumDeclaration>;
|
463
464
|
TSEnumMember?: ExplVisitNode<S, t.TSEnumMember>;
|
464
465
|
TSExportAssignment?: ExplVisitNode<S, t.TSExportAssignment>;
|
465
|
-
TSExpressionWithTypeArguments?: ExplVisitNode<
|
466
|
-
S,
|
467
|
-
t.TSExpressionWithTypeArguments
|
468
|
-
>;
|
469
466
|
TSExternalModuleReference?: ExplVisitNode<S, t.TSExternalModuleReference>;
|
470
467
|
TSFunctionType?: ExplVisitNode<S, t.TSFunctionType>;
|
471
468
|
TSImportEqualsDeclaration?: ExplVisitNode<S, t.TSImportEqualsDeclaration>;
|
@@ -476,6 +473,7 @@ interface ExplVisitorBase<S> {
|
|
476
473
|
TSInstantiationExpression?: ExplVisitNode<S, t.TSInstantiationExpression>;
|
477
474
|
TSInterfaceBody?: ExplVisitNode<S, t.TSInterfaceBody>;
|
478
475
|
TSInterfaceDeclaration?: ExplVisitNode<S, t.TSInterfaceDeclaration>;
|
476
|
+
TSInterfaceHeritage?: ExplVisitNode<S, t.TSInterfaceHeritage>;
|
479
477
|
TSIntersectionType?: ExplVisitNode<S, t.TSIntersectionType>;
|
480
478
|
TSIntrinsicKeyword?: ExplVisitNode<S, t.TSIntrinsicKeyword>;
|
481
479
|
TSLiteralType?: ExplVisitNode<S, t.TSLiteralType>;
|
@@ -502,6 +500,7 @@ interface ExplVisitorBase<S> {
|
|
502
500
|
TSSatisfiesExpression?: ExplVisitNode<S, t.TSSatisfiesExpression>;
|
503
501
|
TSStringKeyword?: ExplVisitNode<S, t.TSStringKeyword>;
|
504
502
|
TSSymbolKeyword?: ExplVisitNode<S, t.TSSymbolKeyword>;
|
503
|
+
TSTemplateLiteralType?: ExplVisitNode<S, t.TSTemplateLiteralType>;
|
505
504
|
TSThisType?: ExplVisitNode<S, t.TSThisType>;
|
506
505
|
TSTupleType?: ExplVisitNode<S, t.TSTupleType>;
|
507
506
|
TSTypeAliasDeclaration?: ExplVisitNode<S, t.TSTypeAliasDeclaration>;
|
@@ -546,6 +545,7 @@ interface ExplVisitorBase<S> {
|
|
546
545
|
VariableDeclaration?: ExplVisitNode<S, t.VariableDeclaration>;
|
547
546
|
VariableDeclarator?: ExplVisitNode<S, t.VariableDeclarator>;
|
548
547
|
Variance?: ExplVisitNode<S, t.Variance>;
|
548
|
+
VoidPattern?: ExplVisitNode<S, t.VoidPattern>;
|
549
549
|
VoidTypeAnnotation?: ExplVisitNode<S, t.VoidTypeAnnotation>;
|
550
550
|
WhileStatement?: ExplVisitNode<S, t.WhileStatement>;
|
551
551
|
WithStatement?: ExplVisitNode<S, t.WithStatement>;
|
@@ -584,7 +584,6 @@ interface VisitorBaseNodes<S> {
|
|
584
584
|
ConditionalExpression?: VisitNode<S, t.ConditionalExpression>;
|
585
585
|
ContinueStatement?: VisitNode<S, t.ContinueStatement>;
|
586
586
|
DebuggerStatement?: VisitNode<S, t.DebuggerStatement>;
|
587
|
-
DecimalLiteral?: VisitNode<S, t.DecimalLiteral>;
|
588
587
|
DeclareClass?: VisitNode<S, t.DeclareClass>;
|
589
588
|
DeclareExportAllDeclaration?: VisitNode<S, t.DeclareExportAllDeclaration>;
|
590
589
|
DeclareExportDeclaration?: VisitNode<S, t.DeclareExportDeclaration>;
|
@@ -719,6 +718,7 @@ interface VisitorBaseNodes<S> {
|
|
719
718
|
TSBigIntKeyword?: VisitNode<S, t.TSBigIntKeyword>;
|
720
719
|
TSBooleanKeyword?: VisitNode<S, t.TSBooleanKeyword>;
|
721
720
|
TSCallSignatureDeclaration?: VisitNode<S, t.TSCallSignatureDeclaration>;
|
721
|
+
TSClassImplements?: VisitNode<S, t.TSClassImplements>;
|
722
722
|
TSConditionalType?: VisitNode<S, t.TSConditionalType>;
|
723
723
|
TSConstructSignatureDeclaration?: VisitNode<
|
724
724
|
S,
|
@@ -727,10 +727,10 @@ interface VisitorBaseNodes<S> {
|
|
727
727
|
TSConstructorType?: VisitNode<S, t.TSConstructorType>;
|
728
728
|
TSDeclareFunction?: VisitNode<S, t.TSDeclareFunction>;
|
729
729
|
TSDeclareMethod?: VisitNode<S, t.TSDeclareMethod>;
|
730
|
+
TSEnumBody?: VisitNode<S, t.TSEnumBody>;
|
730
731
|
TSEnumDeclaration?: VisitNode<S, t.TSEnumDeclaration>;
|
731
732
|
TSEnumMember?: VisitNode<S, t.TSEnumMember>;
|
732
733
|
TSExportAssignment?: VisitNode<S, t.TSExportAssignment>;
|
733
|
-
TSExpressionWithTypeArguments?: VisitNode<S, t.TSExpressionWithTypeArguments>;
|
734
734
|
TSExternalModuleReference?: VisitNode<S, t.TSExternalModuleReference>;
|
735
735
|
TSFunctionType?: VisitNode<S, t.TSFunctionType>;
|
736
736
|
TSImportEqualsDeclaration?: VisitNode<S, t.TSImportEqualsDeclaration>;
|
@@ -741,6 +741,7 @@ interface VisitorBaseNodes<S> {
|
|
741
741
|
TSInstantiationExpression?: VisitNode<S, t.TSInstantiationExpression>;
|
742
742
|
TSInterfaceBody?: VisitNode<S, t.TSInterfaceBody>;
|
743
743
|
TSInterfaceDeclaration?: VisitNode<S, t.TSInterfaceDeclaration>;
|
744
|
+
TSInterfaceHeritage?: VisitNode<S, t.TSInterfaceHeritage>;
|
744
745
|
TSIntersectionType?: VisitNode<S, t.TSIntersectionType>;
|
745
746
|
TSIntrinsicKeyword?: VisitNode<S, t.TSIntrinsicKeyword>;
|
746
747
|
TSLiteralType?: VisitNode<S, t.TSLiteralType>;
|
@@ -764,6 +765,7 @@ interface VisitorBaseNodes<S> {
|
|
764
765
|
TSSatisfiesExpression?: VisitNode<S, t.TSSatisfiesExpression>;
|
765
766
|
TSStringKeyword?: VisitNode<S, t.TSStringKeyword>;
|
766
767
|
TSSymbolKeyword?: VisitNode<S, t.TSSymbolKeyword>;
|
768
|
+
TSTemplateLiteralType?: VisitNode<S, t.TSTemplateLiteralType>;
|
767
769
|
TSThisType?: VisitNode<S, t.TSThisType>;
|
768
770
|
TSTupleType?: VisitNode<S, t.TSTupleType>;
|
769
771
|
TSTypeAliasDeclaration?: VisitNode<S, t.TSTypeAliasDeclaration>;
|
@@ -805,6 +807,7 @@ interface VisitorBaseNodes<S> {
|
|
805
807
|
VariableDeclaration?: VisitNode<S, t.VariableDeclaration>;
|
806
808
|
VariableDeclarator?: VisitNode<S, t.VariableDeclarator>;
|
807
809
|
Variance?: VisitNode<S, t.Variance>;
|
810
|
+
VoidPattern?: VisitNode<S, t.VoidPattern>;
|
808
811
|
VoidTypeAnnotation?: VisitNode<S, t.VoidTypeAnnotation>;
|
809
812
|
WhileStatement?: VisitNode<S, t.WhileStatement>;
|
810
813
|
WithStatement?: VisitNode<S, t.WithStatement>;
|
@@ -833,6 +836,7 @@ interface VisitorBaseAliases<S> {
|
|
833
836
|
For?: VisitNode<S, t.For>;
|
834
837
|
ForXStatement?: VisitNode<S, t.ForXStatement>;
|
835
838
|
Function?: VisitNode<S, t.Function>;
|
839
|
+
FunctionParameter?: VisitNode<S, t.FunctionParameter>;
|
836
840
|
FunctionParent?: VisitNode<S, t.FunctionParent>;
|
837
841
|
Immutable?: VisitNode<S, t.Immutable>;
|
838
842
|
ImportOrExportDeclaration?: VisitNode<S, t.ImportOrExportDeclaration>;
|
@@ -956,10 +960,6 @@ declare function inType(this: NodePath_Final, ...candidateTypes: string[]): bool
|
|
956
960
|
* Infer the type of the current `NodePath`.
|
957
961
|
*/
|
958
962
|
declare function getTypeAnnotation(this: NodePath_Final): t.FlowType | t.TSType;
|
959
|
-
/**
|
960
|
-
* todo: split up this method
|
961
|
-
*/
|
962
|
-
declare function _getTypeAnnotation(this: NodePath_Final): any;
|
963
963
|
declare function isBaseType(this: NodePath_Final, baseName: string, soft?: boolean): boolean;
|
964
964
|
declare function couldBeBaseType(this: NodePath_Final, name: string): boolean;
|
965
965
|
declare function baseTypeStrictlyMatches(this: NodePath_Final, rightArg: NodePath_Final): boolean;
|
@@ -980,22 +980,18 @@ declare function replaceWithMultiple(this: NodePath_Final, nodes: t.Node | t.Nod
|
|
980
980
|
* transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
|
981
981
|
* easier to use, your transforms will be extremely brittle.
|
982
982
|
*/
|
983
|
-
declare function replaceWithSourceString(this: NodePath_Final, replacement: string): [NodePath<t.ArrayExpression> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BooleanLiteral> | NodePath<t.CallExpression> | NodePath<t.ClassExpression> | NodePath<t.ConditionalExpression> | NodePath<t.
|
983
|
+
declare function replaceWithSourceString(this: NodePath_Final, replacement: string): [NodePath<t.Identifier> | NodePath<t.ArrayExpression> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BooleanLiteral> | NodePath<t.CallExpression> | NodePath<t.ClassExpression> | NodePath<t.ConditionalExpression> | NodePath<t.DoExpression> | NodePath<t.FunctionExpression> | NodePath<t.Import> | NodePath<t.ImportExpression> | NodePath<t.JSXElement> | NodePath<t.JSXFragment> | NodePath<t.LogicalExpression> | NodePath<t.MemberExpression> | NodePath<t.MetaProperty> | NodePath<t.ModuleExpression> | NodePath<t.NewExpression> | NodePath<t.NullLiteral> | NodePath<t.NumericLiteral> | NodePath<t.ObjectExpression> | NodePath<t.OptionalCallExpression> | NodePath<t.OptionalMemberExpression> | NodePath<t.ParenthesizedExpression> | NodePath<t.PipelineBareFunction> | NodePath<t.PipelinePrimaryTopicReference> | NodePath<t.PipelineTopicExpression> | NodePath<t.RecordExpression> | NodePath<t.RegExpLiteral> | NodePath<t.SequenceExpression> | NodePath<t.StringLiteral> | NodePath<t.TSAsExpression> | NodePath<t.TSInstantiationExpression> | NodePath<t.TSNonNullExpression> | NodePath<t.TSSatisfiesExpression> | NodePath<t.TSTypeAssertion> | NodePath<t.TaggedTemplateExpression> | NodePath<t.TemplateLiteral> | NodePath<t.ThisExpression> | NodePath<t.TopicReference> | NodePath<t.TupleExpression> | NodePath<t.TypeCastExpression> | NodePath<t.UnaryExpression> | NodePath<t.UpdateExpression> | NodePath<t.YieldExpression>];
|
984
984
|
/**
|
985
985
|
* Replace the current node with another.
|
986
986
|
*/
|
987
987
|
declare function replaceWith<R extends t.Node>(this: NodePath_Final, replacementPath: R): [NodePath_Final<R>];
|
988
988
|
declare function replaceWith<R extends NodePath_Final>(this: NodePath_Final, replacementPath: R): [R];
|
989
|
-
/**
|
990
|
-
* Description
|
991
|
-
*/
|
992
|
-
declare function _replaceWith(this: NodePath_Final, node: t.Node): void;
|
993
989
|
/**
|
994
990
|
* This method takes an array of statements nodes and then explodes it
|
995
991
|
* into expressions. This method retains completion records which is
|
996
992
|
* extremely important to retain original semantics.
|
997
993
|
*/
|
998
|
-
declare function replaceExpressionWithStatements(this: NodePath_Final, nodes: Array<t.Statement>): (NodePath<t.
|
994
|
+
declare function replaceExpressionWithStatements(this: NodePath_Final, nodes: Array<t.Statement>): (NodePath<t.BlockStatement> | NodePath<t.BreakStatement> | NodePath<t.ClassDeclaration> | NodePath<t.ContinueStatement> | NodePath<t.DebuggerStatement> | NodePath<t.DeclareClass> | NodePath<t.DeclareExportAllDeclaration> | NodePath<t.DeclareExportDeclaration> | NodePath<t.DeclareFunction> | NodePath<t.DeclareInterface> | NodePath<t.DeclareModule> | NodePath<t.DeclareModuleExports> | NodePath<t.DeclareOpaqueType> | NodePath<t.DeclareTypeAlias> | NodePath<t.DeclareVariable> | NodePath<t.DoWhileStatement> | NodePath<t.EmptyStatement> | NodePath<t.EnumDeclaration> | NodePath<t.ExportAllDeclaration> | NodePath<t.ExportDefaultDeclaration> | NodePath<t.ExportNamedDeclaration> | NodePath<t.ExpressionStatement> | NodePath<t.ForInStatement> | NodePath<t.ForOfStatement> | NodePath<t.ForStatement> | NodePath<t.FunctionDeclaration> | NodePath<t.IfStatement> | NodePath<t.ImportDeclaration> | NodePath<t.InterfaceDeclaration> | NodePath<t.LabeledStatement> | NodePath<t.OpaqueType> | NodePath<t.ReturnStatement> | NodePath<t.SwitchStatement> | NodePath<t.TSDeclareFunction> | NodePath<t.TSEnumDeclaration> | NodePath<t.TSExportAssignment> | NodePath<t.TSImportEqualsDeclaration> | NodePath<t.TSInterfaceDeclaration> | NodePath<t.TSModuleDeclaration> | NodePath<t.TSNamespaceExportDeclaration> | NodePath<t.TSTypeAliasDeclaration> | NodePath<t.ThrowStatement> | NodePath<t.TryStatement> | NodePath<t.TypeAlias> | NodePath<t.VariableDeclaration> | NodePath<t.WhileStatement> | NodePath<t.WithStatement>)[] | (NodePath<t.Identifier> | NodePath<t.ArrayExpression> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BooleanLiteral> | NodePath<t.CallExpression> | NodePath<t.ClassExpression> | NodePath<t.ConditionalExpression> | NodePath<t.DoExpression> | NodePath<t.FunctionExpression> | NodePath<t.Import> | NodePath<t.ImportExpression> | NodePath<t.JSXElement> | NodePath<t.JSXFragment> | NodePath<t.LogicalExpression> | NodePath<t.MemberExpression> | NodePath<t.MetaProperty> | NodePath<t.ModuleExpression> | NodePath<t.NewExpression> | NodePath<t.NullLiteral> | NodePath<t.NumericLiteral> | NodePath<t.ObjectExpression> | NodePath<t.OptionalCallExpression> | NodePath<t.OptionalMemberExpression> | NodePath<t.ParenthesizedExpression> | NodePath<t.PipelineBareFunction> | NodePath<t.PipelinePrimaryTopicReference> | NodePath<t.PipelineTopicExpression> | NodePath<t.RecordExpression> | NodePath<t.RegExpLiteral> | NodePath<t.SequenceExpression> | NodePath<t.StringLiteral> | NodePath<t.TSAnyKeyword> | NodePath<t.TSArrayType> | NodePath<t.TSAsExpression> | NodePath<t.TSBigIntKeyword> | NodePath<t.TSBooleanKeyword> | NodePath<t.TSClassImplements> | NodePath<t.TSConditionalType> | NodePath<t.TSConstructorType> | NodePath<t.TSFunctionType> | NodePath<t.TSImportType> | NodePath<t.TSIndexedAccessType> | NodePath<t.TSInferType> | NodePath<t.TSInstantiationExpression> | NodePath<t.TSInterfaceHeritage> | NodePath<t.TSIntersectionType> | NodePath<t.TSIntrinsicKeyword> | NodePath<t.TSLiteralType> | NodePath<t.TSMappedType> | NodePath<t.TSNeverKeyword> | NodePath<t.TSNonNullExpression> | NodePath<t.TSNullKeyword> | NodePath<t.TSNumberKeyword> | NodePath<t.TSObjectKeyword> | NodePath<t.TSOptionalType> | NodePath<t.TSParenthesizedType> | NodePath<t.TSRestType> | NodePath<t.TSSatisfiesExpression> | NodePath<t.TSStringKeyword> | NodePath<t.TSSymbolKeyword> | NodePath<t.TSTemplateLiteralType> | NodePath<t.TSThisType> | NodePath<t.TSTupleType> | NodePath<t.TSTypeAssertion> | NodePath<t.TSTypeLiteral> | NodePath<t.TSTypeOperator> | NodePath<t.TSTypePredicate> | NodePath<t.TSTypeQuery> | NodePath<t.TSTypeReference> | NodePath<t.TSUndefinedKeyword> | NodePath<t.TSUnionType> | NodePath<t.TSUnknownKeyword> | NodePath<t.TSVoidKeyword> | NodePath<t.TaggedTemplateExpression> | NodePath<t.TemplateLiteral> | NodePath<t.ThisExpression> | NodePath<t.TopicReference> | NodePath<t.TupleExpression> | NodePath<t.TypeCastExpression> | NodePath<t.UnaryExpression> | NodePath<t.UpdateExpression> | NodePath<t.YieldExpression>)[];
|
999
995
|
declare function replaceInline(this: NodePath_Final, nodes: t.Node | Array<t.Node>): NodePath_Final[];
|
1000
996
|
|
1001
997
|
/**
|
@@ -1054,6 +1050,8 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1054
1050
|
allowInsertArrowWithRest?: boolean | void;
|
1055
1051
|
noNewArrows?: boolean;
|
1056
1052
|
}): NodePath_Final<Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression>;
|
1053
|
+
declare function splitExportDeclaration(this: NodePath_Final<t.ExportDefaultDeclaration | t.ExportNamedDeclaration>): NodePath_Final<t.Declaration>;
|
1054
|
+
declare function ensureFunctionName<N extends t.FunctionExpression | t.ClassExpression>(this: NodePath_Final<N>, supportUnicodeId: boolean): null | NodePath_Final<N>;
|
1057
1055
|
|
1058
1056
|
/**
|
1059
1057
|
* Match the current node if it matches the provided `pattern`.
|
@@ -1062,23 +1060,7 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1062
1060
|
* parsed nodes of `React.createClass` and `React["createClass"]`.
|
1063
1061
|
*/
|
1064
1062
|
declare function matchesPattern(this: NodePath_Final, pattern: string, allowPartial?: boolean): boolean;
|
1065
|
-
/**
|
1066
|
-
* Check whether we have the input `key`. If the `key` references an array then we check
|
1067
|
-
* if the array has any items, otherwise we just check if it's falsy.
|
1068
|
-
*/
|
1069
|
-
declare function has<N extends t.Node>(this: NodePath_Final<N>, key: keyof N): boolean;
|
1070
|
-
/**
|
1071
|
-
* Description
|
1072
|
-
*/
|
1073
1063
|
declare function isStatic(this: NodePath_Final): boolean;
|
1074
|
-
/**
|
1075
|
-
* Opposite of `has`.
|
1076
|
-
*/
|
1077
|
-
declare function isnt<N extends t.Node>(this: NodePath_Final<N>, key: keyof N): boolean;
|
1078
|
-
/**
|
1079
|
-
* Check whether the path node `key` strict equals `value`.
|
1080
|
-
*/
|
1081
|
-
declare function equals<N extends t.Node>(this: NodePath_Final<N>, key: keyof N, value: any): boolean;
|
1082
1064
|
/**
|
1083
1065
|
* Check the type against our stored internal type of the node. This is handy when a node has
|
1084
1066
|
* been removed yet we still internally know the type and need it to calculate node replacement.
|
@@ -1129,71 +1111,41 @@ type RelativeExecutionStatus = "before" | "after" | "unknown";
|
|
1129
1111
|
*/
|
1130
1112
|
declare function _guessExecutionStatusRelativeTo(this: NodePath_Final, target: NodePath_Final): RelativeExecutionStatus;
|
1131
1113
|
/**
|
1132
|
-
* Resolve
|
1114
|
+
* Resolve the value pointed to by a NodePath
|
1115
|
+
* e.g.
|
1116
|
+
* ```
|
1117
|
+
* var a = 1;
|
1118
|
+
* var b = a;
|
1119
|
+
* b;
|
1120
|
+
* ```
|
1121
|
+
* `b.resolve()` will return `1`
|
1133
1122
|
*/
|
1134
1123
|
declare function resolve(this: NodePath_Final, dangerous?: boolean, resolved?: NodePath_Final[]): NodePath_Final;
|
1135
|
-
declare function _resolve(this: NodePath_Final, dangerous?: boolean, resolved?: NodePath_Final[]): NodePath_Final | undefined | null;
|
1136
1124
|
declare function isConstantExpression(this: NodePath_Final): boolean;
|
1137
1125
|
declare function isInStrictMode(this: NodePath_Final): boolean;
|
1138
1126
|
|
1139
|
-
declare function call(this: NodePath_Final, key: VisitPhase): boolean;
|
1140
|
-
declare function _call(this: NodePath_Final, fns?: Array<Function>): boolean;
|
1141
1127
|
declare function isDenylisted(this: NodePath_Final): boolean;
|
1142
|
-
|
1143
1128
|
declare function visit(this: NodePath_Final): boolean;
|
1144
1129
|
declare function skip(this: NodePath_Final): void;
|
1145
1130
|
declare function skipKey(this: NodePath_Final, key: string): void;
|
1146
1131
|
declare function stop(this: NodePath_Final): void;
|
1147
|
-
declare function setScope(this: NodePath_Final): void;
|
1148
1132
|
declare function setContext<S = unknown>(this: NodePath_Final, context?: TraversalContext<S>): NodePath_Final;
|
1149
|
-
/**
|
1150
|
-
* Here we resync the node paths `key` and `container`. If they've changed according
|
1151
|
-
* to what we have stored internally then we attempt to resync by crawling and looking
|
1152
|
-
* for the new values.
|
1153
|
-
*/
|
1154
|
-
declare function resync(this: NodePath_Final): void;
|
1155
|
-
declare function _resyncParent(this: NodePath_Final): void;
|
1156
|
-
declare function _resyncKey(this: NodePath_Final): void;
|
1157
|
-
declare function _resyncList(this: NodePath_Final): void;
|
1158
|
-
declare function _resyncRemoved(this: NodePath_Final): void;
|
1159
|
-
declare function popContext(this: NodePath_Final): void;
|
1160
|
-
declare function pushContext(this: NodePath_Final, context: TraversalContext): void;
|
1161
|
-
declare function setup(this: NodePath_Final, parentPath: NodePath_Final | undefined, container: t.Node | t.Node[], listKey: string, key: string | number): void;
|
1162
|
-
declare function setKey(this: NodePath_Final, key: string | number): void;
|
1163
1133
|
declare function requeue(this: NodePath_Final, pathToQueue?: NodePath_Final): void;
|
1164
|
-
declare function
|
1134
|
+
declare function requeueComputedKeyAndDecorators(this: NodePath_Final<t.Method | t.Property>): void;
|
1165
1135
|
|
1166
1136
|
declare function remove(this: NodePath_Final): void;
|
1167
|
-
declare function _removeFromScope(this: NodePath_Final): void;
|
1168
|
-
declare function _callRemovalHooks(this: NodePath_Final): boolean;
|
1169
|
-
declare function _remove(this: NodePath_Final): void;
|
1170
|
-
declare function _markRemoved(this: NodePath_Final): void;
|
1171
|
-
declare function _assertUnremoved(this: NodePath_Final): void;
|
1172
1137
|
|
1173
1138
|
/**
|
1174
1139
|
* Insert the provided nodes before the current one.
|
1175
1140
|
*/
|
1176
1141
|
declare function insertBefore(this: NodePath_Final, nodes_: t.Node | t.Node[]): NodePath_Final[];
|
1177
|
-
declare function _containerInsert<N extends t.Node>(this: NodePath_Final, from: number, nodes: N[]): NodePath_Final<N>[];
|
1178
|
-
declare function _containerInsertBefore<N extends t.Node>(this: NodePath_Final, nodes: N[]): NodePath_Final<N>[];
|
1179
|
-
declare function _containerInsertAfter<N extends t.Node>(this: NodePath_Final, nodes: N[]): NodePath_Final<N>[];
|
1180
1142
|
/**
|
1181
1143
|
* Insert the provided nodes after the current one. When inserting nodes after an
|
1182
1144
|
* expression, ensure that the completion record is correct by pushing the current node.
|
1183
1145
|
*/
|
1184
1146
|
declare function insertAfter(this: NodePath_Final, nodes_: t.Node | t.Node[]): NodePath_Final[];
|
1185
|
-
|
1186
|
-
* Update all sibling node paths after `fromIndex` by `incrementBy`.
|
1187
|
-
*/
|
1188
|
-
declare function updateSiblingKeys(this: NodePath_Final, fromIndex: number, incrementBy: number): void;
|
1189
|
-
declare function _verifyNodeList<N extends t.Node>(this: NodePath_Final, nodes: N | N[]): N[];
|
1190
|
-
declare function unshiftContainer<N extends t.Node, K extends keyof N & string>(this: NodePath_Final<N>, listKey: K, nodes: N[K] extends (infer E)[] ? E | E[] : never): (NodePath<t.AnyTypeAnnotation> | NodePath<t.ArgumentPlaceholder> | NodePath<t.ArrayExpression> | NodePath<t.ArrayPattern> | NodePath<t.ArrayTypeAnnotation> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AssignmentPattern> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BlockStatement> | NodePath<t.BooleanLiteral> | NodePath<t.BooleanLiteralTypeAnnotation> | NodePath<t.BooleanTypeAnnotation> | NodePath<t.BreakStatement> | NodePath<t.CallExpression> | NodePath<t.CatchClause> | NodePath<t.ClassAccessorProperty> | NodePath<t.ClassBody> | NodePath<t.ClassDeclaration> | NodePath<t.ClassExpression> | NodePath<t.ClassImplements> | NodePath<t.ClassMethod> | NodePath<t.ClassPrivateMethod> | NodePath<t.ClassPrivateProperty> | NodePath<t.ClassProperty> | NodePath<t.ConditionalExpression> | NodePath<t.ContinueStatement> | NodePath<t.DebuggerStatement> | NodePath<t.DecimalLiteral> | NodePath<t.DeclareClass> | NodePath<t.DeclareExportAllDeclaration> | NodePath<t.DeclareExportDeclaration> | NodePath<t.DeclareFunction> | NodePath<t.DeclareInterface> | NodePath<t.DeclareModule> | NodePath<t.DeclareModuleExports> | NodePath<t.DeclareOpaqueType> | NodePath<t.DeclareTypeAlias> | NodePath<t.DeclareVariable> | NodePath<t.DeclaredPredicate> | NodePath<t.Decorator> | NodePath<t.Directive> | NodePath<t.DirectiveLiteral> | NodePath<t.DoExpression> | NodePath<t.DoWhileStatement> | NodePath<t.EmptyStatement> | NodePath<t.EmptyTypeAnnotation> | NodePath<t.EnumBooleanBody> | NodePath<t.EnumBooleanMember> | NodePath<t.EnumDeclaration> | NodePath<t.EnumDefaultedMember> | NodePath<t.EnumNumberBody> | NodePath<t.EnumNumberMember> | NodePath<t.EnumStringBody> | NodePath<t.EnumStringMember> | NodePath<t.EnumSymbolBody> | NodePath<t.ExistsTypeAnnotation> | NodePath<t.ExportAllDeclaration> | NodePath<t.ExportDefaultDeclaration> | NodePath<t.ExportDefaultSpecifier> | NodePath<t.ExportNamedDeclaration> | NodePath<t.ExportNamespaceSpecifier> | NodePath<t.ExportSpecifier> | NodePath<t.ExpressionStatement> | NodePath<t.File> | NodePath<t.ForInStatement> | NodePath<t.ForOfStatement> | NodePath<t.ForStatement> | NodePath<t.FunctionDeclaration> | NodePath<t.FunctionExpression> | NodePath<t.FunctionTypeAnnotation> | NodePath<t.FunctionTypeParam> | NodePath<t.GenericTypeAnnotation> | NodePath<t.Identifier> | NodePath<t.IfStatement> | NodePath<t.Import> | NodePath<t.ImportAttribute> | NodePath<t.ImportDeclaration> | NodePath<t.ImportDefaultSpecifier> | NodePath<t.ImportExpression> | NodePath<t.ImportNamespaceSpecifier> | NodePath<t.ImportSpecifier> | NodePath<t.IndexedAccessType> | NodePath<t.InferredPredicate> | NodePath<t.InterfaceDeclaration> | NodePath<t.InterfaceExtends> | NodePath<t.InterfaceTypeAnnotation> | NodePath<t.InterpreterDirective> | NodePath<t.IntersectionTypeAnnotation> | NodePath<t.JSXAttribute> | NodePath<t.JSXClosingElement> | NodePath<t.JSXClosingFragment> | NodePath<t.JSXElement> | NodePath<t.JSXEmptyExpression> | NodePath<t.JSXExpressionContainer> | NodePath<t.JSXFragment> | NodePath<t.JSXIdentifier> | NodePath<t.JSXMemberExpression> | NodePath<t.JSXNamespacedName> | NodePath<t.JSXOpeningElement> | NodePath<t.JSXOpeningFragment> | NodePath<t.JSXSpreadAttribute> | NodePath<t.JSXSpreadChild> | NodePath<t.JSXText> | NodePath<t.LabeledStatement> | NodePath<t.LogicalExpression> | NodePath<t.MemberExpression> | NodePath<t.MetaProperty> | NodePath<t.MixedTypeAnnotation> | NodePath<t.ModuleExpression> | NodePath<t.NewExpression> | NodePath<t.NullLiteral> | NodePath<t.NullLiteralTypeAnnotation> | NodePath<t.NullableTypeAnnotation> | NodePath<t.NumberLiteral> | NodePath<t.NumberLiteralTypeAnnotation> | NodePath<t.NumberTypeAnnotation> | NodePath<t.NumericLiteral> | NodePath<t.ObjectExpression> | NodePath<t.ObjectMethod> | NodePath<t.ObjectPattern> | NodePath<t.ObjectProperty> | NodePath<t.ObjectTypeAnnotation> | NodePath<t.ObjectTypeCallProperty> | NodePath<t.ObjectTypeIndexer> | NodePath<t.ObjectTypeInternalSlot> | NodePath<t.ObjectTypeProperty> | NodePath<t.ObjectTypeSpreadProperty> | NodePath<t.OpaqueType> | NodePath<t.OptionalCallExpression> | NodePath<t.OptionalIndexedAccessType> | NodePath<t.OptionalMemberExpression> | NodePath<t.ParenthesizedExpression> | NodePath<t.PipelineBareFunction> | NodePath<t.PipelinePrimaryTopicReference> | NodePath<t.PipelineTopicExpression> | NodePath<t.Placeholder> | NodePath<t.PrivateName> | NodePath<t.Program> | NodePath<t.QualifiedTypeIdentifier> | NodePath<t.RecordExpression> | NodePath<t.RegExpLiteral> | NodePath<t.RegexLiteral> | NodePath<t.RestElement> | NodePath<t.RestProperty> | NodePath<t.ReturnStatement> | NodePath<t.SequenceExpression> | NodePath<t.SpreadElement> | NodePath<t.SpreadProperty> | NodePath<t.StaticBlock> | NodePath<t.StringLiteral> | NodePath<t.StringLiteralTypeAnnotation> | NodePath<t.StringTypeAnnotation> | NodePath<t.Super> | NodePath<t.SwitchCase> | NodePath<t.SwitchStatement> | NodePath<t.SymbolTypeAnnotation> | NodePath<t.TSAnyKeyword> | NodePath<t.TSArrayType> | NodePath<t.TSAsExpression> | NodePath<t.TSBigIntKeyword> | NodePath<t.TSBooleanKeyword> | NodePath<t.TSCallSignatureDeclaration> | NodePath<t.TSConditionalType> | NodePath<t.TSConstructSignatureDeclaration> | NodePath<t.TSConstructorType> | NodePath<t.TSDeclareFunction> | NodePath<t.TSDeclareMethod> | NodePath<t.TSEnumDeclaration> | NodePath<t.TSEnumMember> | NodePath<t.TSExportAssignment> | NodePath<t.TSExpressionWithTypeArguments> | NodePath<t.TSExternalModuleReference> | NodePath<t.TSFunctionType> | NodePath<t.TSImportEqualsDeclaration> | NodePath<t.TSImportType> | NodePath<t.TSIndexSignature> | NodePath<t.TSIndexedAccessType> | NodePath<t.TSInferType> | NodePath<t.TSInstantiationExpression> | NodePath<t.TSInterfaceBody> | NodePath<t.TSInterfaceDeclaration> | NodePath<t.TSIntersectionType> | NodePath<t.TSIntrinsicKeyword> | NodePath<t.TSLiteralType> | NodePath<t.TSMappedType> | NodePath<t.TSMethodSignature> | NodePath<t.TSModuleBlock> | NodePath<t.TSModuleDeclaration> | NodePath<t.TSNamedTupleMember> | NodePath<t.TSNamespaceExportDeclaration> | NodePath<t.TSNeverKeyword> | NodePath<t.TSNonNullExpression> | NodePath<t.TSNullKeyword> | NodePath<t.TSNumberKeyword> | NodePath<t.TSObjectKeyword> | NodePath<t.TSOptionalType> | NodePath<t.TSParameterProperty> | NodePath<t.TSParenthesizedType> | NodePath<t.TSPropertySignature> | NodePath<t.TSQualifiedName> | NodePath<t.TSRestType> | NodePath<t.TSSatisfiesExpression> | NodePath<t.TSStringKeyword> | NodePath<t.TSSymbolKeyword> | NodePath<t.TSThisType> | NodePath<t.TSTupleType> | NodePath<t.TSTypeAliasDeclaration> | NodePath<t.TSTypeAnnotation> | NodePath<t.TSTypeAssertion> | NodePath<t.TSTypeLiteral> | NodePath<t.TSTypeOperator> | NodePath<t.TSTypeParameter> | NodePath<t.TSTypeParameterDeclaration> | NodePath<t.TSTypeParameterInstantiation> | NodePath<t.TSTypePredicate> | NodePath<t.TSTypeQuery> | NodePath<t.TSTypeReference> | NodePath<t.TSUndefinedKeyword> | NodePath<t.TSUnionType> | NodePath<t.TSUnknownKeyword> | NodePath<t.TSVoidKeyword> | NodePath<t.TaggedTemplateExpression> | NodePath<t.TemplateElement> | NodePath<t.TemplateLiteral> | NodePath<t.ThisExpression> | NodePath<t.ThisTypeAnnotation> | NodePath<t.ThrowStatement> | NodePath<t.TopicReference> | NodePath<t.TryStatement> | NodePath<t.TupleExpression> | NodePath<t.TupleTypeAnnotation> | NodePath<t.TypeAlias> | NodePath<t.TypeAnnotation> | NodePath<t.TypeCastExpression> | NodePath<t.TypeParameter> | NodePath<t.TypeParameterDeclaration> | NodePath<t.TypeParameterInstantiation> | NodePath<t.TypeofTypeAnnotation> | NodePath<t.UnaryExpression> | NodePath<t.UnionTypeAnnotation> | NodePath<t.UpdateExpression> | NodePath<t.V8IntrinsicIdentifier> | NodePath<t.VariableDeclaration> | NodePath<t.VariableDeclarator> | NodePath<t.Variance> | NodePath<t.VoidTypeAnnotation> | NodePath<t.WhileStatement> | NodePath<t.WithStatement> | NodePath<t.YieldExpression>)[];
|
1147
|
+
declare function unshiftContainer<N extends t.Node, K extends keyof N & string>(this: NodePath_Final<N>, listKey: K, nodes: N[K] extends (infer E)[] ? E | E[] : never): (NodePath<t.Identifier> | NodePath<t.AnyTypeAnnotation> | NodePath<t.ArgumentPlaceholder> | NodePath<t.ArrayExpression> | NodePath<t.ArrayPattern> | NodePath<t.ArrayTypeAnnotation> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AssignmentPattern> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BlockStatement> | NodePath<t.BooleanLiteral> | NodePath<t.BooleanLiteralTypeAnnotation> | NodePath<t.BooleanTypeAnnotation> | NodePath<t.BreakStatement> | NodePath<t.CallExpression> | NodePath<t.CatchClause> | NodePath<t.ClassAccessorProperty> | NodePath<t.ClassBody> | NodePath<t.ClassDeclaration> | NodePath<t.ClassExpression> | NodePath<t.ClassImplements> | NodePath<t.ClassMethod> | NodePath<t.ClassPrivateMethod> | NodePath<t.ClassPrivateProperty> | NodePath<t.ClassProperty> | NodePath<t.ConditionalExpression> | NodePath<t.ContinueStatement> | NodePath<t.DebuggerStatement> | NodePath<t.DeclareClass> | NodePath<t.DeclareExportAllDeclaration> | NodePath<t.DeclareExportDeclaration> | NodePath<t.DeclareFunction> | NodePath<t.DeclareInterface> | NodePath<t.DeclareModule> | NodePath<t.DeclareModuleExports> | NodePath<t.DeclareOpaqueType> | NodePath<t.DeclareTypeAlias> | NodePath<t.DeclareVariable> | NodePath<t.DeclaredPredicate> | NodePath<t.Decorator> | NodePath<t.Directive> | NodePath<t.DirectiveLiteral> | NodePath<t.DoExpression> | NodePath<t.DoWhileStatement> | NodePath<t.EmptyStatement> | NodePath<t.EmptyTypeAnnotation> | NodePath<t.EnumBooleanBody> | NodePath<t.EnumBooleanMember> | NodePath<t.EnumDeclaration> | NodePath<t.EnumDefaultedMember> | NodePath<t.EnumNumberBody> | NodePath<t.EnumNumberMember> | NodePath<t.EnumStringBody> | NodePath<t.EnumStringMember> | NodePath<t.EnumSymbolBody> | NodePath<t.ExistsTypeAnnotation> | NodePath<t.ExportAllDeclaration> | NodePath<t.ExportDefaultDeclaration> | NodePath<t.ExportDefaultSpecifier> | NodePath<t.ExportNamedDeclaration> | NodePath<t.ExportNamespaceSpecifier> | NodePath<t.ExportSpecifier> | NodePath<t.ExpressionStatement> | NodePath<t.File> | NodePath<t.ForInStatement> | NodePath<t.ForOfStatement> | NodePath<t.ForStatement> | NodePath<t.FunctionDeclaration> | NodePath<t.FunctionExpression> | NodePath<t.FunctionTypeAnnotation> | NodePath<t.FunctionTypeParam> | NodePath<t.GenericTypeAnnotation> | NodePath<t.IfStatement> | NodePath<t.Import> | NodePath<t.ImportAttribute> | NodePath<t.ImportDeclaration> | NodePath<t.ImportDefaultSpecifier> | NodePath<t.ImportExpression> | NodePath<t.ImportNamespaceSpecifier> | NodePath<t.ImportSpecifier> | NodePath<t.IndexedAccessType> | NodePath<t.InferredPredicate> | NodePath<t.InterfaceDeclaration> | NodePath<t.InterfaceExtends> | NodePath<t.InterfaceTypeAnnotation> | NodePath<t.InterpreterDirective> | NodePath<t.IntersectionTypeAnnotation> | NodePath<t.JSXAttribute> | NodePath<t.JSXClosingElement> | NodePath<t.JSXClosingFragment> | NodePath<t.JSXElement> | NodePath<t.JSXEmptyExpression> | NodePath<t.JSXExpressionContainer> | NodePath<t.JSXFragment> | NodePath<t.JSXIdentifier> | NodePath<t.JSXMemberExpression> | NodePath<t.JSXNamespacedName> | NodePath<t.JSXOpeningElement> | NodePath<t.JSXOpeningFragment> | NodePath<t.JSXSpreadAttribute> | NodePath<t.JSXSpreadChild> | NodePath<t.JSXText> | NodePath<t.LabeledStatement> | NodePath<t.LogicalExpression> | NodePath<t.MemberExpression> | NodePath<t.MetaProperty> | NodePath<t.MixedTypeAnnotation> | NodePath<t.ModuleExpression> | NodePath<t.NewExpression> | NodePath<t.NullLiteral> | NodePath<t.NullLiteralTypeAnnotation> | NodePath<t.NullableTypeAnnotation> | NodePath<t.NumberLiteral> | NodePath<t.NumberLiteralTypeAnnotation> | NodePath<t.NumberTypeAnnotation> | NodePath<t.NumericLiteral> | NodePath<t.ObjectExpression> | NodePath<t.ObjectMethod> | NodePath<t.ObjectPattern> | NodePath<t.ObjectProperty> | NodePath<t.ObjectTypeAnnotation> | NodePath<t.ObjectTypeCallProperty> | NodePath<t.ObjectTypeIndexer> | NodePath<t.ObjectTypeInternalSlot> | NodePath<t.ObjectTypeProperty> | NodePath<t.ObjectTypeSpreadProperty> | NodePath<t.OpaqueType> | NodePath<t.OptionalCallExpression> | NodePath<t.OptionalIndexedAccessType> | NodePath<t.OptionalMemberExpression> | NodePath<t.ParenthesizedExpression> | NodePath<t.PipelineBareFunction> | NodePath<t.PipelinePrimaryTopicReference> | NodePath<t.PipelineTopicExpression> | NodePath<t.Placeholder> | NodePath<t.PrivateName> | NodePath<t.Program> | NodePath<t.QualifiedTypeIdentifier> | NodePath<t.RecordExpression> | NodePath<t.RegExpLiteral> | NodePath<t.RegexLiteral> | NodePath<t.RestElement> | NodePath<t.RestProperty> | NodePath<t.ReturnStatement> | NodePath<t.SequenceExpression> | NodePath<t.SpreadElement> | NodePath<t.SpreadProperty> | NodePath<t.StaticBlock> | NodePath<t.StringLiteral> | NodePath<t.StringLiteralTypeAnnotation> | NodePath<t.StringTypeAnnotation> | NodePath<t.Super> | NodePath<t.SwitchCase> | NodePath<t.SwitchStatement> | NodePath<t.SymbolTypeAnnotation> | NodePath<t.TSAnyKeyword> | NodePath<t.TSArrayType> | NodePath<t.TSAsExpression> | NodePath<t.TSBigIntKeyword> | NodePath<t.TSBooleanKeyword> | NodePath<t.TSCallSignatureDeclaration> | NodePath<t.TSClassImplements> | NodePath<t.TSConditionalType> | NodePath<t.TSConstructSignatureDeclaration> | NodePath<t.TSConstructorType> | NodePath<t.TSDeclareFunction> | NodePath<t.TSDeclareMethod> | NodePath<t.TSEnumBody> | NodePath<t.TSEnumDeclaration> | NodePath<t.TSEnumMember> | NodePath<t.TSExportAssignment> | NodePath<t.TSExternalModuleReference> | NodePath<t.TSFunctionType> | NodePath<t.TSImportEqualsDeclaration> | NodePath<t.TSImportType> | NodePath<t.TSIndexSignature> | NodePath<t.TSIndexedAccessType> | NodePath<t.TSInferType> | NodePath<t.TSInstantiationExpression> | NodePath<t.TSInterfaceBody> | NodePath<t.TSInterfaceDeclaration> | NodePath<t.TSInterfaceHeritage> | NodePath<t.TSIntersectionType> | NodePath<t.TSIntrinsicKeyword> | NodePath<t.TSLiteralType> | NodePath<t.TSMappedType> | NodePath<t.TSMethodSignature> | NodePath<t.TSModuleBlock> | NodePath<t.TSModuleDeclaration> | NodePath<t.TSNamedTupleMember> | NodePath<t.TSNamespaceExportDeclaration> | NodePath<t.TSNeverKeyword> | NodePath<t.TSNonNullExpression> | NodePath<t.TSNullKeyword> | NodePath<t.TSNumberKeyword> | NodePath<t.TSObjectKeyword> | NodePath<t.TSOptionalType> | NodePath<t.TSParameterProperty> | NodePath<t.TSParenthesizedType> | NodePath<t.TSPropertySignature> | NodePath<t.TSQualifiedName> | NodePath<t.TSRestType> | NodePath<t.TSSatisfiesExpression> | NodePath<t.TSStringKeyword> | NodePath<t.TSSymbolKeyword> | NodePath<t.TSTemplateLiteralType> | NodePath<t.TSThisType> | NodePath<t.TSTupleType> | NodePath<t.TSTypeAliasDeclaration> | NodePath<t.TSTypeAnnotation> | NodePath<t.TSTypeAssertion> | NodePath<t.TSTypeLiteral> | NodePath<t.TSTypeOperator> | NodePath<t.TSTypeParameter> | NodePath<t.TSTypeParameterDeclaration> | NodePath<t.TSTypeParameterInstantiation> | NodePath<t.TSTypePredicate> | NodePath<t.TSTypeQuery> | NodePath<t.TSTypeReference> | NodePath<t.TSUndefinedKeyword> | NodePath<t.TSUnionType> | NodePath<t.TSUnknownKeyword> | NodePath<t.TSVoidKeyword> | NodePath<t.TaggedTemplateExpression> | NodePath<t.TemplateElement> | NodePath<t.TemplateLiteral> | NodePath<t.ThisExpression> | NodePath<t.ThisTypeAnnotation> | NodePath<t.ThrowStatement> | NodePath<t.TopicReference> | NodePath<t.TryStatement> | NodePath<t.TupleExpression> | NodePath<t.TupleTypeAnnotation> | NodePath<t.TypeAlias> | NodePath<t.TypeAnnotation> | NodePath<t.TypeCastExpression> | NodePath<t.TypeParameter> | NodePath<t.TypeParameterDeclaration> | NodePath<t.TypeParameterInstantiation> | NodePath<t.TypeofTypeAnnotation> | NodePath<t.UnaryExpression> | NodePath<t.UnionTypeAnnotation> | NodePath<t.UpdateExpression> | NodePath<t.V8IntrinsicIdentifier> | NodePath<t.VariableDeclaration> | NodePath<t.VariableDeclarator> | NodePath<t.Variance> | NodePath<t.VoidPattern> | NodePath<t.VoidTypeAnnotation> | NodePath<t.WhileStatement> | NodePath<t.WithStatement> | NodePath<t.YieldExpression>)[];
|
1191
1148
|
declare function pushContainer<P extends NodePath_Final, K extends string & keyof P["node"]>(this: P, listKey: K, nodes: P["node"][K] extends (infer E)[] ? E | E[] : never): NodePath_Final[];
|
1192
|
-
/**
|
1193
|
-
* Hoist the current node to the highest scope possible and return a UID
|
1194
|
-
* referencing it.
|
1195
|
-
*/
|
1196
|
-
declare function hoist<T extends t.Node>(this: NodePath_Final<T>, scope?: Scope): NodePath_Final<t.Expression>;
|
1197
1149
|
|
1198
1150
|
declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
1199
1151
|
/**
|
@@ -1204,9 +1156,10 @@ declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
|
1204
1156
|
*
|
1205
1157
|
* @export
|
1206
1158
|
* @param {NodePath} this
|
1159
|
+
* @param {boolean} [shouldPreserveBreak=false] Whether the `break` statement should be preserved.
|
1207
1160
|
* @returns {NodePath[]} Completion records
|
1208
1161
|
*/
|
1209
|
-
declare function getCompletionRecords(this: NodePath_Final): NodePath_Final[];
|
1162
|
+
declare function getCompletionRecords(this: NodePath_Final, shouldPreserveBreak?: boolean): NodePath_Final[];
|
1210
1163
|
declare function getSibling(this: NodePath_Final, key: string | number): NodePath_Final;
|
1211
1164
|
declare function getPrevSibling(this: NodePath_Final): NodePath_Final;
|
1212
1165
|
declare function getNextSibling(this: NodePath_Final): NodePath_Final;
|
@@ -1221,8 +1174,7 @@ declare function get<T extends NodePath_Final, K extends keyof T["node"]>(this:
|
|
1221
1174
|
declare function get<T extends NodePath_Final, K extends string>(this: T, key: K, context?: boolean | TraversalContext): T extends any ? ToNodePath<Trav<T["node"], Split<K>>> : never;
|
1222
1175
|
declare function get(this: NodePath_Final, key: string, context?: true | TraversalContext): NodePath_Final | NodePath_Final[];
|
1223
1176
|
|
1224
|
-
declare function
|
1225
|
-
declare function _getPattern(this: NodePath_Final, parts: string[], context?: TraversalContext): NodePath_Final | NodePath_Final[];
|
1177
|
+
declare function getAssignmentIdentifiers(this: NodePath_Final): Record<string, t.Identifier>;
|
1226
1178
|
declare function getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
|
1227
1179
|
declare function getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
|
1228
1180
|
declare function getBindingIdentifiers(duplicates: boolean): Record<string, t.Identifier[] | t.Identifier>;
|
@@ -1370,9 +1322,6 @@ interface NodePathAssertions {
|
|
1370
1322
|
assertDebuggerStatement(
|
1371
1323
|
opts?: Opts$2<t.DebuggerStatement>,
|
1372
1324
|
): asserts this is NodePath_Final<t.DebuggerStatement>;
|
1373
|
-
assertDecimalLiteral(
|
1374
|
-
opts?: Opts$2<t.DecimalLiteral>,
|
1375
|
-
): asserts this is NodePath_Final<t.DecimalLiteral>;
|
1376
1325
|
assertDeclaration(
|
1377
1326
|
opts?: Opts$2<t.Declaration>,
|
1378
1327
|
): asserts this is NodePath_Final<t.Declaration>;
|
@@ -1526,6 +1475,9 @@ interface NodePathAssertions {
|
|
1526
1475
|
assertFunctionExpression(
|
1527
1476
|
opts?: Opts$2<t.FunctionExpression>,
|
1528
1477
|
): asserts this is NodePath_Final<t.FunctionExpression>;
|
1478
|
+
assertFunctionParameter(
|
1479
|
+
opts?: Opts$2<t.FunctionParameter>,
|
1480
|
+
): asserts this is NodePath_Final<t.FunctionParameter>;
|
1529
1481
|
assertFunctionParent(
|
1530
1482
|
opts?: Opts$2<t.FunctionParent>,
|
1531
1483
|
): asserts this is NodePath_Final<t.FunctionParent>;
|
@@ -1840,6 +1792,9 @@ interface NodePathAssertions {
|
|
1840
1792
|
assertTSCallSignatureDeclaration(
|
1841
1793
|
opts?: Opts$2<t.TSCallSignatureDeclaration>,
|
1842
1794
|
): asserts this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
1795
|
+
assertTSClassImplements(
|
1796
|
+
opts?: Opts$2<t.TSClassImplements>,
|
1797
|
+
): asserts this is NodePath_Final<t.TSClassImplements>;
|
1843
1798
|
assertTSConditionalType(
|
1844
1799
|
opts?: Opts$2<t.TSConditionalType>,
|
1845
1800
|
): asserts this is NodePath_Final<t.TSConditionalType>;
|
@@ -1858,6 +1813,9 @@ interface NodePathAssertions {
|
|
1858
1813
|
assertTSEntityName(
|
1859
1814
|
opts?: Opts$2<t.TSEntityName>,
|
1860
1815
|
): asserts this is NodePath_Final<t.TSEntityName>;
|
1816
|
+
assertTSEnumBody(
|
1817
|
+
opts?: Opts$2<t.TSEnumBody>,
|
1818
|
+
): asserts this is NodePath_Final<t.TSEnumBody>;
|
1861
1819
|
assertTSEnumDeclaration(
|
1862
1820
|
opts?: Opts$2<t.TSEnumDeclaration>,
|
1863
1821
|
): asserts this is NodePath_Final<t.TSEnumDeclaration>;
|
@@ -1867,9 +1825,6 @@ interface NodePathAssertions {
|
|
1867
1825
|
assertTSExportAssignment(
|
1868
1826
|
opts?: Opts$2<t.TSExportAssignment>,
|
1869
1827
|
): asserts this is NodePath_Final<t.TSExportAssignment>;
|
1870
|
-
assertTSExpressionWithTypeArguments(
|
1871
|
-
opts?: Opts$2<t.TSExpressionWithTypeArguments>,
|
1872
|
-
): asserts this is NodePath_Final<t.TSExpressionWithTypeArguments>;
|
1873
1828
|
assertTSExternalModuleReference(
|
1874
1829
|
opts?: Opts$2<t.TSExternalModuleReference>,
|
1875
1830
|
): asserts this is NodePath_Final<t.TSExternalModuleReference>;
|
@@ -1900,6 +1855,9 @@ interface NodePathAssertions {
|
|
1900
1855
|
assertTSInterfaceDeclaration(
|
1901
1856
|
opts?: Opts$2<t.TSInterfaceDeclaration>,
|
1902
1857
|
): asserts this is NodePath_Final<t.TSInterfaceDeclaration>;
|
1858
|
+
assertTSInterfaceHeritage(
|
1859
|
+
opts?: Opts$2<t.TSInterfaceHeritage>,
|
1860
|
+
): asserts this is NodePath_Final<t.TSInterfaceHeritage>;
|
1903
1861
|
assertTSIntersectionType(
|
1904
1862
|
opts?: Opts$2<t.TSIntersectionType>,
|
1905
1863
|
): asserts this is NodePath_Final<t.TSIntersectionType>;
|
@@ -1969,6 +1927,9 @@ interface NodePathAssertions {
|
|
1969
1927
|
assertTSSymbolKeyword(
|
1970
1928
|
opts?: Opts$2<t.TSSymbolKeyword>,
|
1971
1929
|
): asserts this is NodePath_Final<t.TSSymbolKeyword>;
|
1930
|
+
assertTSTemplateLiteralType(
|
1931
|
+
opts?: Opts$2<t.TSTemplateLiteralType>,
|
1932
|
+
): asserts this is NodePath_Final<t.TSTemplateLiteralType>;
|
1972
1933
|
assertTSThisType(
|
1973
1934
|
opts?: Opts$2<t.TSThisType>,
|
1974
1935
|
): asserts this is NodePath_Final<t.TSThisType>;
|
@@ -2106,6 +2067,9 @@ interface NodePathAssertions {
|
|
2106
2067
|
opts?: Opts$2<t.VariableDeclarator>,
|
2107
2068
|
): asserts this is NodePath_Final<t.VariableDeclarator>;
|
2108
2069
|
assertVariance(opts?: Opts$2<t.Variance>): asserts this is NodePath_Final<t.Variance>;
|
2070
|
+
assertVoidPattern(
|
2071
|
+
opts?: Opts$2<t.VoidPattern>,
|
2072
|
+
): asserts this is NodePath_Final<t.VoidPattern>;
|
2109
2073
|
assertVoidTypeAnnotation(
|
2110
2074
|
opts?: Opts$2<t.VoidTypeAnnotation>,
|
2111
2075
|
): asserts this is NodePath_Final<t.VoidTypeAnnotation>;
|
@@ -2309,10 +2273,6 @@ interface BaseNodePathValidators {
|
|
2309
2273
|
this: NodePath_Final,
|
2310
2274
|
opts?: Opts<t.DebuggerStatement>,
|
2311
2275
|
): this is NodePath_Final<t.DebuggerStatement>;
|
2312
|
-
isDecimalLiteral(
|
2313
|
-
this: NodePath_Final,
|
2314
|
-
opts?: Opts<t.DecimalLiteral>,
|
2315
|
-
): this is NodePath_Final<t.DecimalLiteral>;
|
2316
2276
|
isDeclaration(
|
2317
2277
|
this: NodePath_Final,
|
2318
2278
|
opts?: Opts<t.Declaration>,
|
@@ -2524,6 +2484,10 @@ interface BaseNodePathValidators {
|
|
2524
2484
|
this: NodePath_Final,
|
2525
2485
|
opts?: Opts<t.FunctionExpression>,
|
2526
2486
|
): this is NodePath_Final<t.FunctionExpression>;
|
2487
|
+
isFunctionParameter(
|
2488
|
+
this: NodePath_Final,
|
2489
|
+
opts?: Opts<t.FunctionParameter>,
|
2490
|
+
): this is NodePath_Final<t.FunctionParameter>;
|
2527
2491
|
isFunctionParent(
|
2528
2492
|
this: NodePath_Final,
|
2529
2493
|
opts?: Opts<t.FunctionParent>,
|
@@ -2962,6 +2926,10 @@ interface BaseNodePathValidators {
|
|
2962
2926
|
this: NodePath_Final,
|
2963
2927
|
opts?: Opts<t.TSCallSignatureDeclaration>,
|
2964
2928
|
): this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
2929
|
+
isTSClassImplements(
|
2930
|
+
this: NodePath_Final,
|
2931
|
+
opts?: Opts<t.TSClassImplements>,
|
2932
|
+
): this is NodePath_Final<t.TSClassImplements>;
|
2965
2933
|
isTSConditionalType(
|
2966
2934
|
this: NodePath_Final,
|
2967
2935
|
opts?: Opts<t.TSConditionalType>,
|
@@ -2986,6 +2954,10 @@ interface BaseNodePathValidators {
|
|
2986
2954
|
this: NodePath_Final,
|
2987
2955
|
opts?: Opts<t.TSEntityName>,
|
2988
2956
|
): this is NodePath_Final<t.TSEntityName>;
|
2957
|
+
isTSEnumBody(
|
2958
|
+
this: NodePath_Final,
|
2959
|
+
opts?: Opts<t.TSEnumBody>,
|
2960
|
+
): this is NodePath_Final<t.TSEnumBody>;
|
2989
2961
|
isTSEnumDeclaration(
|
2990
2962
|
this: NodePath_Final,
|
2991
2963
|
opts?: Opts<t.TSEnumDeclaration>,
|
@@ -2998,10 +2970,6 @@ interface BaseNodePathValidators {
|
|
2998
2970
|
this: NodePath_Final,
|
2999
2971
|
opts?: Opts<t.TSExportAssignment>,
|
3000
2972
|
): this is NodePath_Final<t.TSExportAssignment>;
|
3001
|
-
isTSExpressionWithTypeArguments(
|
3002
|
-
this: NodePath_Final,
|
3003
|
-
opts?: Opts<t.TSExpressionWithTypeArguments>,
|
3004
|
-
): this is NodePath_Final<t.TSExpressionWithTypeArguments>;
|
3005
2973
|
isTSExternalModuleReference(
|
3006
2974
|
this: NodePath_Final,
|
3007
2975
|
opts?: Opts<t.TSExternalModuleReference>,
|
@@ -3042,6 +3010,10 @@ interface BaseNodePathValidators {
|
|
3042
3010
|
this: NodePath_Final,
|
3043
3011
|
opts?: Opts<t.TSInterfaceDeclaration>,
|
3044
3012
|
): this is NodePath_Final<t.TSInterfaceDeclaration>;
|
3013
|
+
isTSInterfaceHeritage(
|
3014
|
+
this: NodePath_Final,
|
3015
|
+
opts?: Opts<t.TSInterfaceHeritage>,
|
3016
|
+
): this is NodePath_Final<t.TSInterfaceHeritage>;
|
3045
3017
|
isTSIntersectionType(
|
3046
3018
|
this: NodePath_Final,
|
3047
3019
|
opts?: Opts<t.TSIntersectionType>,
|
@@ -3134,6 +3106,10 @@ interface BaseNodePathValidators {
|
|
3134
3106
|
this: NodePath_Final,
|
3135
3107
|
opts?: Opts<t.TSSymbolKeyword>,
|
3136
3108
|
): this is NodePath_Final<t.TSSymbolKeyword>;
|
3109
|
+
isTSTemplateLiteralType(
|
3110
|
+
this: NodePath_Final,
|
3111
|
+
opts?: Opts<t.TSTemplateLiteralType>,
|
3112
|
+
): this is NodePath_Final<t.TSTemplateLiteralType>;
|
3137
3113
|
isTSThisType(
|
3138
3114
|
this: NodePath_Final,
|
3139
3115
|
opts?: Opts<t.TSThisType>,
|
@@ -3319,6 +3295,10 @@ interface BaseNodePathValidators {
|
|
3319
3295
|
this: NodePath_Final,
|
3320
3296
|
opts?: Opts<t.Variance>,
|
3321
3297
|
): this is NodePath_Final<t.Variance>;
|
3298
|
+
isVoidPattern(
|
3299
|
+
this: NodePath_Final,
|
3300
|
+
opts?: Opts<t.VoidPattern>,
|
3301
|
+
): this is NodePath_Final<t.VoidPattern>;
|
3322
3302
|
isVoidTypeAnnotation(
|
3323
3303
|
this: NodePath_Final,
|
3324
3304
|
opts?: Opts<t.VoidTypeAnnotation>,
|
@@ -3354,7 +3334,6 @@ declare const methods: {
|
|
3354
3334
|
isDescendant: typeof isDescendant;
|
3355
3335
|
inType: typeof inType;
|
3356
3336
|
getTypeAnnotation: typeof getTypeAnnotation;
|
3357
|
-
_getTypeAnnotation: typeof _getTypeAnnotation;
|
3358
3337
|
isBaseType: typeof isBaseType;
|
3359
3338
|
couldBeBaseType: typeof couldBeBaseType;
|
3360
3339
|
baseTypeStrictlyMatches: typeof baseTypeStrictlyMatches;
|
@@ -3362,7 +3341,6 @@ declare const methods: {
|
|
3362
3341
|
replaceWithMultiple: typeof replaceWithMultiple;
|
3363
3342
|
replaceWithSourceString: typeof replaceWithSourceString;
|
3364
3343
|
replaceWith: typeof replaceWith;
|
3365
|
-
_replaceWith: typeof _replaceWith;
|
3366
3344
|
replaceExpressionWithStatements: typeof replaceExpressionWithStatements;
|
3367
3345
|
replaceInline: typeof replaceInline;
|
3368
3346
|
evaluateTruthy: typeof evaluateTruthy;
|
@@ -3371,12 +3349,10 @@ declare const methods: {
|
|
3371
3349
|
ensureBlock: typeof ensureBlock;
|
3372
3350
|
unwrapFunctionEnvironment: typeof unwrapFunctionEnvironment;
|
3373
3351
|
arrowFunctionToExpression: typeof arrowFunctionToExpression;
|
3352
|
+
splitExportDeclaration: typeof splitExportDeclaration;
|
3353
|
+
ensureFunctionName: typeof ensureFunctionName;
|
3374
3354
|
matchesPattern: typeof matchesPattern;
|
3375
|
-
has: typeof has;
|
3376
3355
|
isStatic: typeof isStatic;
|
3377
|
-
is: typeof has;
|
3378
|
-
isnt: typeof isnt;
|
3379
|
-
equals: typeof equals;
|
3380
3356
|
isNodeType: typeof isNodeType;
|
3381
3357
|
canHaveVariableDeclarationOrExpression: typeof canHaveVariableDeclarationOrExpression;
|
3382
3358
|
canSwapBetweenExpressionAndStatement: typeof canSwapBetweenExpressionAndStatement;
|
@@ -3387,46 +3363,21 @@ declare const methods: {
|
|
3387
3363
|
willIMaybeExecuteBefore: typeof willIMaybeExecuteBefore;
|
3388
3364
|
_guessExecutionStatusRelativeTo: typeof _guessExecutionStatusRelativeTo;
|
3389
3365
|
resolve: typeof resolve;
|
3390
|
-
_resolve: typeof _resolve;
|
3391
3366
|
isConstantExpression: typeof isConstantExpression;
|
3392
3367
|
isInStrictMode: typeof isInStrictMode;
|
3393
|
-
call: typeof call;
|
3394
|
-
_call: typeof _call;
|
3395
3368
|
isDenylisted: typeof isDenylisted;
|
3396
|
-
isBlacklisted: typeof isDenylisted;
|
3397
3369
|
visit: typeof visit;
|
3398
3370
|
skip: typeof skip;
|
3399
3371
|
skipKey: typeof skipKey;
|
3400
3372
|
stop: typeof stop;
|
3401
|
-
setScope: typeof setScope;
|
3402
3373
|
setContext: typeof setContext;
|
3403
|
-
resync: typeof resync;
|
3404
|
-
_resyncParent: typeof _resyncParent;
|
3405
|
-
_resyncKey: typeof _resyncKey;
|
3406
|
-
_resyncList: typeof _resyncList;
|
3407
|
-
_resyncRemoved: typeof _resyncRemoved;
|
3408
|
-
popContext: typeof popContext;
|
3409
|
-
pushContext: typeof pushContext;
|
3410
|
-
setup: typeof setup;
|
3411
|
-
setKey: typeof setKey;
|
3412
3374
|
requeue: typeof requeue;
|
3413
|
-
|
3375
|
+
requeueComputedKeyAndDecorators: typeof requeueComputedKeyAndDecorators;
|
3414
3376
|
remove: typeof remove;
|
3415
|
-
_removeFromScope: typeof _removeFromScope;
|
3416
|
-
_callRemovalHooks: typeof _callRemovalHooks;
|
3417
|
-
_remove: typeof _remove;
|
3418
|
-
_markRemoved: typeof _markRemoved;
|
3419
|
-
_assertUnremoved: typeof _assertUnremoved;
|
3420
3377
|
insertBefore: typeof insertBefore;
|
3421
|
-
_containerInsert: typeof _containerInsert;
|
3422
|
-
_containerInsertBefore: typeof _containerInsertBefore;
|
3423
|
-
_containerInsertAfter: typeof _containerInsertAfter;
|
3424
3378
|
insertAfter: typeof insertAfter;
|
3425
|
-
updateSiblingKeys: typeof updateSiblingKeys;
|
3426
|
-
_verifyNodeList: typeof _verifyNodeList;
|
3427
3379
|
unshiftContainer: typeof unshiftContainer;
|
3428
3380
|
pushContainer: typeof pushContainer;
|
3429
|
-
hoist: typeof hoist;
|
3430
3381
|
getOpposite: typeof getOpposite;
|
3431
3382
|
getCompletionRecords: typeof getCompletionRecords;
|
3432
3383
|
getSibling: typeof getSibling;
|
@@ -3435,8 +3386,7 @@ declare const methods: {
|
|
3435
3386
|
getAllNextSiblings: typeof getAllNextSiblings;
|
3436
3387
|
getAllPrevSiblings: typeof getAllPrevSiblings;
|
3437
3388
|
get: typeof get;
|
3438
|
-
|
3439
|
-
_getPattern: typeof _getPattern;
|
3389
|
+
getAssignmentIdentifiers: typeof getAssignmentIdentifiers;
|
3440
3390
|
getBindingIdentifiers: typeof getBindingIdentifiers;
|
3441
3391
|
getOuterBindingIdentifiers: typeof getOuterBindingIdentifiers;
|
3442
3392
|
getBindingIdentifierPaths: typeof getBindingIdentifierPaths;
|
@@ -3488,6 +3438,7 @@ declare const NodePath_Final: {
|
|
3488
3438
|
key: string | number | null;
|
3489
3439
|
node: t.Node | null;
|
3490
3440
|
type: t.Node["type"] | null;
|
3441
|
+
_store: Map<t.Node, NodePath_Final> | null;
|
3491
3442
|
getScope(this: NodePath_Final, scope: Scope): Scope;
|
3492
3443
|
setData(key: string | symbol, val: any): any;
|
3493
3444
|
getData(key: string | symbol, def?: any): any;
|
@@ -3513,15 +3464,14 @@ declare const NodePath_Final: {
|
|
3513
3464
|
};
|
3514
3465
|
type NodePath_Final<T extends t.Node = t.Node> = T extends any ? NodePath<T> : never;
|
3515
3466
|
|
3516
|
-
declare let pathsCache: WeakMap<
|
3467
|
+
declare let pathsCache: WeakMap<Node, Map<Node, NodePath_Final>>;
|
3517
3468
|
|
3518
3469
|
declare let scope: WeakMap<Node, Scope>;
|
3519
3470
|
declare function clear(): void;
|
3520
3471
|
declare function clearPath(): void;
|
3521
3472
|
declare function clearScope(): void;
|
3522
|
-
declare
|
3523
|
-
declare function
|
3524
|
-
declare function getOrCreateCachedPaths(hub: HubInterface | null, parent: Node): Map<Node, NodePath_Final>;
|
3473
|
+
declare function getCachedPaths(path: NodePath_Final): Map<Node, NodePath<t.Identifier> | NodePath<t.AnyTypeAnnotation> | NodePath<t.ArgumentPlaceholder> | NodePath<t.ArrayExpression> | NodePath<t.ArrayPattern> | NodePath<t.ArrayTypeAnnotation> | NodePath<t.ArrowFunctionExpression> | NodePath<t.AssignmentExpression> | NodePath<t.AssignmentPattern> | NodePath<t.AwaitExpression> | NodePath<t.BigIntLiteral> | NodePath<t.BinaryExpression> | NodePath<t.BindExpression> | NodePath<t.BlockStatement> | NodePath<t.BooleanLiteral> | NodePath<t.BooleanLiteralTypeAnnotation> | NodePath<t.BooleanTypeAnnotation> | NodePath<t.BreakStatement> | NodePath<t.CallExpression> | NodePath<t.CatchClause> | NodePath<t.ClassAccessorProperty> | NodePath<t.ClassBody> | NodePath<t.ClassDeclaration> | NodePath<t.ClassExpression> | NodePath<t.ClassImplements> | NodePath<t.ClassMethod> | NodePath<t.ClassPrivateMethod> | NodePath<t.ClassPrivateProperty> | NodePath<t.ClassProperty> | NodePath<t.ConditionalExpression> | NodePath<t.ContinueStatement> | NodePath<t.DebuggerStatement> | NodePath<t.DeclareClass> | NodePath<t.DeclareExportAllDeclaration> | NodePath<t.DeclareExportDeclaration> | NodePath<t.DeclareFunction> | NodePath<t.DeclareInterface> | NodePath<t.DeclareModule> | NodePath<t.DeclareModuleExports> | NodePath<t.DeclareOpaqueType> | NodePath<t.DeclareTypeAlias> | NodePath<t.DeclareVariable> | NodePath<t.DeclaredPredicate> | NodePath<t.Decorator> | NodePath<t.Directive> | NodePath<t.DirectiveLiteral> | NodePath<t.DoExpression> | NodePath<t.DoWhileStatement> | NodePath<t.EmptyStatement> | NodePath<t.EmptyTypeAnnotation> | NodePath<t.EnumBooleanBody> | NodePath<t.EnumBooleanMember> | NodePath<t.EnumDeclaration> | NodePath<t.EnumDefaultedMember> | NodePath<t.EnumNumberBody> | NodePath<t.EnumNumberMember> | NodePath<t.EnumStringBody> | NodePath<t.EnumStringMember> | NodePath<t.EnumSymbolBody> | NodePath<t.ExistsTypeAnnotation> | NodePath<t.ExportAllDeclaration> | NodePath<t.ExportDefaultDeclaration> | NodePath<t.ExportDefaultSpecifier> | NodePath<t.ExportNamedDeclaration> | NodePath<t.ExportNamespaceSpecifier> | NodePath<t.ExportSpecifier> | NodePath<t.ExpressionStatement> | NodePath<t.File> | NodePath<t.ForInStatement> | NodePath<t.ForOfStatement> | NodePath<t.ForStatement> | NodePath<t.FunctionDeclaration> | NodePath<t.FunctionExpression> | NodePath<t.FunctionTypeAnnotation> | NodePath<t.FunctionTypeParam> | NodePath<t.GenericTypeAnnotation> | NodePath<t.IfStatement> | NodePath<t.Import> | NodePath<t.ImportAttribute> | NodePath<t.ImportDeclaration> | NodePath<t.ImportDefaultSpecifier> | NodePath<t.ImportExpression> | NodePath<t.ImportNamespaceSpecifier> | NodePath<t.ImportSpecifier> | NodePath<t.IndexedAccessType> | NodePath<t.InferredPredicate> | NodePath<t.InterfaceDeclaration> | NodePath<t.InterfaceExtends> | NodePath<t.InterfaceTypeAnnotation> | NodePath<t.InterpreterDirective> | NodePath<t.IntersectionTypeAnnotation> | NodePath<t.JSXAttribute> | NodePath<t.JSXClosingElement> | NodePath<t.JSXClosingFragment> | NodePath<t.JSXElement> | NodePath<t.JSXEmptyExpression> | NodePath<t.JSXExpressionContainer> | NodePath<t.JSXFragment> | NodePath<t.JSXIdentifier> | NodePath<t.JSXMemberExpression> | NodePath<t.JSXNamespacedName> | NodePath<t.JSXOpeningElement> | NodePath<t.JSXOpeningFragment> | NodePath<t.JSXSpreadAttribute> | NodePath<t.JSXSpreadChild> | NodePath<t.JSXText> | NodePath<t.LabeledStatement> | NodePath<t.LogicalExpression> | NodePath<t.MemberExpression> | NodePath<t.MetaProperty> | NodePath<t.MixedTypeAnnotation> | NodePath<t.ModuleExpression> | NodePath<t.NewExpression> | NodePath<t.NullLiteral> | NodePath<t.NullLiteralTypeAnnotation> | NodePath<t.NullableTypeAnnotation> | NodePath<t.NumberLiteral> | NodePath<t.NumberLiteralTypeAnnotation> | NodePath<t.NumberTypeAnnotation> | NodePath<t.NumericLiteral> | NodePath<t.ObjectExpression> | NodePath<t.ObjectMethod> | NodePath<t.ObjectPattern> | NodePath<t.ObjectProperty> | NodePath<t.ObjectTypeAnnotation> | NodePath<t.ObjectTypeCallProperty> | NodePath<t.ObjectTypeIndexer> | NodePath<t.ObjectTypeInternalSlot> | NodePath<t.ObjectTypeProperty> | NodePath<t.ObjectTypeSpreadProperty> | NodePath<t.OpaqueType> | NodePath<t.OptionalCallExpression> | NodePath<t.OptionalIndexedAccessType> | NodePath<t.OptionalMemberExpression> | NodePath<t.ParenthesizedExpression> | NodePath<t.PipelineBareFunction> | NodePath<t.PipelinePrimaryTopicReference> | NodePath<t.PipelineTopicExpression> | NodePath<t.Placeholder> | NodePath<t.PrivateName> | NodePath<t.Program> | NodePath<t.QualifiedTypeIdentifier> | NodePath<t.RecordExpression> | NodePath<t.RegExpLiteral> | NodePath<t.RegexLiteral> | NodePath<t.RestElement> | NodePath<t.RestProperty> | NodePath<t.ReturnStatement> | NodePath<t.SequenceExpression> | NodePath<t.SpreadElement> | NodePath<t.SpreadProperty> | NodePath<t.StaticBlock> | NodePath<t.StringLiteral> | NodePath<t.StringLiteralTypeAnnotation> | NodePath<t.StringTypeAnnotation> | NodePath<t.Super> | NodePath<t.SwitchCase> | NodePath<t.SwitchStatement> | NodePath<t.SymbolTypeAnnotation> | NodePath<t.TSAnyKeyword> | NodePath<t.TSArrayType> | NodePath<t.TSAsExpression> | NodePath<t.TSBigIntKeyword> | NodePath<t.TSBooleanKeyword> | NodePath<t.TSCallSignatureDeclaration> | NodePath<t.TSClassImplements> | NodePath<t.TSConditionalType> | NodePath<t.TSConstructSignatureDeclaration> | NodePath<t.TSConstructorType> | NodePath<t.TSDeclareFunction> | NodePath<t.TSDeclareMethod> | NodePath<t.TSEnumBody> | NodePath<t.TSEnumDeclaration> | NodePath<t.TSEnumMember> | NodePath<t.TSExportAssignment> | NodePath<t.TSExternalModuleReference> | NodePath<t.TSFunctionType> | NodePath<t.TSImportEqualsDeclaration> | NodePath<t.TSImportType> | NodePath<t.TSIndexSignature> | NodePath<t.TSIndexedAccessType> | NodePath<t.TSInferType> | NodePath<t.TSInstantiationExpression> | NodePath<t.TSInterfaceBody> | NodePath<t.TSInterfaceDeclaration> | NodePath<t.TSInterfaceHeritage> | NodePath<t.TSIntersectionType> | NodePath<t.TSIntrinsicKeyword> | NodePath<t.TSLiteralType> | NodePath<t.TSMappedType> | NodePath<t.TSMethodSignature> | NodePath<t.TSModuleBlock> | NodePath<t.TSModuleDeclaration> | NodePath<t.TSNamedTupleMember> | NodePath<t.TSNamespaceExportDeclaration> | NodePath<t.TSNeverKeyword> | NodePath<t.TSNonNullExpression> | NodePath<t.TSNullKeyword> | NodePath<t.TSNumberKeyword> | NodePath<t.TSObjectKeyword> | NodePath<t.TSOptionalType> | NodePath<t.TSParameterProperty> | NodePath<t.TSParenthesizedType> | NodePath<t.TSPropertySignature> | NodePath<t.TSQualifiedName> | NodePath<t.TSRestType> | NodePath<t.TSSatisfiesExpression> | NodePath<t.TSStringKeyword> | NodePath<t.TSSymbolKeyword> | NodePath<t.TSTemplateLiteralType> | NodePath<t.TSThisType> | NodePath<t.TSTupleType> | NodePath<t.TSTypeAliasDeclaration> | NodePath<t.TSTypeAnnotation> | NodePath<t.TSTypeAssertion> | NodePath<t.TSTypeLiteral> | NodePath<t.TSTypeOperator> | NodePath<t.TSTypeParameter> | NodePath<t.TSTypeParameterDeclaration> | NodePath<t.TSTypeParameterInstantiation> | NodePath<t.TSTypePredicate> | NodePath<t.TSTypeQuery> | NodePath<t.TSTypeReference> | NodePath<t.TSUndefinedKeyword> | NodePath<t.TSUnionType> | NodePath<t.TSUnknownKeyword> | NodePath<t.TSVoidKeyword> | NodePath<t.TaggedTemplateExpression> | NodePath<t.TemplateElement> | NodePath<t.TemplateLiteral> | NodePath<t.ThisExpression> | NodePath<t.ThisTypeAnnotation> | NodePath<t.ThrowStatement> | NodePath<t.TopicReference> | NodePath<t.TryStatement> | NodePath<t.TupleExpression> | NodePath<t.TupleTypeAnnotation> | NodePath<t.TypeAlias> | NodePath<t.TypeAnnotation> | NodePath<t.TypeCastExpression> | NodePath<t.TypeParameter> | NodePath<t.TypeParameterDeclaration> | NodePath<t.TypeParameterInstantiation> | NodePath<t.TypeofTypeAnnotation> | NodePath<t.UnaryExpression> | NodePath<t.UnionTypeAnnotation> | NodePath<t.UpdateExpression> | NodePath<t.V8IntrinsicIdentifier> | NodePath<t.VariableDeclaration> | NodePath<t.VariableDeclarator> | NodePath<t.Variance> | NodePath<t.VoidPattern> | NodePath<t.VoidTypeAnnotation> | NodePath<t.WhileStatement> | NodePath<t.WithStatement> | NodePath<t.YieldExpression>>;
|
3474
|
+
declare function getOrCreateCachedPaths(node: Node, parentPath?: NodePath_Final): Map<any, any>;
|
3525
3475
|
|
3526
3476
|
declare const __cache_ts_clear: typeof clear;
|
3527
3477
|
declare const __cache_ts_clearPath: typeof clearPath;
|
@@ -3556,12 +3506,14 @@ declare function explode$1<S>(visitor: Visitor<S>): ExplodedVisitor<S>;
|
|
3556
3506
|
declare function verify$1(visitor: Visitor): void;
|
3557
3507
|
declare function merge<State>(visitors: Visitor<State>[]): ExplodedVisitor<State>;
|
3558
3508
|
declare function merge(visitors: Visitor<unknown>[], states?: any[], wrapper?: Function | null): ExplodedVisitor<unknown>;
|
3509
|
+
declare function environmentVisitor<S>(visitor: Visitor<S>): Visitor<S>;
|
3559
3510
|
|
3560
3511
|
type __visitors_ts_VisitWrapper<S = any> = VisitWrapper<S>;
|
3512
|
+
declare const __visitors_ts_environmentVisitor: typeof environmentVisitor;
|
3561
3513
|
declare const __visitors_ts_isExplodedVisitor: typeof isExplodedVisitor;
|
3562
3514
|
declare const __visitors_ts_merge: typeof merge;
|
3563
3515
|
declare namespace __visitors_ts {
|
3564
|
-
export { type __visitors_ts_VisitWrapper as VisitWrapper, explode$1 as explode, __visitors_ts_isExplodedVisitor as isExplodedVisitor, __visitors_ts_merge as merge, verify$1 as verify };
|
3516
|
+
export { type __visitors_ts_VisitWrapper as VisitWrapper, __visitors_ts_environmentVisitor as environmentVisitor, explode$1 as explode, __visitors_ts_isExplodedVisitor as isExplodedVisitor, __visitors_ts_merge as merge, verify$1 as verify };
|
3565
3517
|
}
|
3566
3518
|
|
3567
3519
|
type TraverseOptions<S = t.Node> = {
|
@@ -3578,10 +3530,10 @@ declare namespace traverse {
|
|
3578
3530
|
var verify: typeof verify$1;
|
3579
3531
|
var explode: typeof explode$1;
|
3580
3532
|
var cheap: (node: t.Node, enter: (node: t.Node) => void) => void;
|
3581
|
-
var node: (node: t.Node, opts: ExplodedTraverseOptions
|
3533
|
+
var node: (node: t.Node, opts: ExplodedTraverseOptions, scope?: Scope, state?: any, path?: NodePath_Final, skipKeys?: Record<string, boolean>) => void;
|
3582
3534
|
var clearNode: (node: t.Node, opts?: RemovePropertiesOptions) => void;
|
3583
3535
|
var removeProperties: (tree: t.Node, opts?: RemovePropertiesOptions) => t.Node;
|
3584
|
-
var hasType: (tree: t.Node, type: "
|
3536
|
+
var hasType: (tree: t.Node, type: t.Node["type"], denylistTypes?: Array<string>) => boolean;
|
3585
3537
|
var cache: typeof __cache_ts;
|
3586
3538
|
}
|
3587
3539
|
|