@babel/traverse 8.0.0-alpha.9 → 8.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +91 -156
- package/lib/index.js +1152 -1033
- package/lib/index.js.map +1 -1
- package/package.json +10 -13
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>;
|
@@ -584,7 +583,6 @@ interface VisitorBaseNodes<S> {
|
|
584
583
|
ConditionalExpression?: VisitNode<S, t.ConditionalExpression>;
|
585
584
|
ContinueStatement?: VisitNode<S, t.ContinueStatement>;
|
586
585
|
DebuggerStatement?: VisitNode<S, t.DebuggerStatement>;
|
587
|
-
DecimalLiteral?: VisitNode<S, t.DecimalLiteral>;
|
588
586
|
DeclareClass?: VisitNode<S, t.DeclareClass>;
|
589
587
|
DeclareExportAllDeclaration?: VisitNode<S, t.DeclareExportAllDeclaration>;
|
590
588
|
DeclareExportDeclaration?: VisitNode<S, t.DeclareExportDeclaration>;
|
@@ -719,6 +717,7 @@ interface VisitorBaseNodes<S> {
|
|
719
717
|
TSBigIntKeyword?: VisitNode<S, t.TSBigIntKeyword>;
|
720
718
|
TSBooleanKeyword?: VisitNode<S, t.TSBooleanKeyword>;
|
721
719
|
TSCallSignatureDeclaration?: VisitNode<S, t.TSCallSignatureDeclaration>;
|
720
|
+
TSClassImplements?: VisitNode<S, t.TSClassImplements>;
|
722
721
|
TSConditionalType?: VisitNode<S, t.TSConditionalType>;
|
723
722
|
TSConstructSignatureDeclaration?: VisitNode<
|
724
723
|
S,
|
@@ -727,10 +726,10 @@ interface VisitorBaseNodes<S> {
|
|
727
726
|
TSConstructorType?: VisitNode<S, t.TSConstructorType>;
|
728
727
|
TSDeclareFunction?: VisitNode<S, t.TSDeclareFunction>;
|
729
728
|
TSDeclareMethod?: VisitNode<S, t.TSDeclareMethod>;
|
729
|
+
TSEnumBody?: VisitNode<S, t.TSEnumBody>;
|
730
730
|
TSEnumDeclaration?: VisitNode<S, t.TSEnumDeclaration>;
|
731
731
|
TSEnumMember?: VisitNode<S, t.TSEnumMember>;
|
732
732
|
TSExportAssignment?: VisitNode<S, t.TSExportAssignment>;
|
733
|
-
TSExpressionWithTypeArguments?: VisitNode<S, t.TSExpressionWithTypeArguments>;
|
734
733
|
TSExternalModuleReference?: VisitNode<S, t.TSExternalModuleReference>;
|
735
734
|
TSFunctionType?: VisitNode<S, t.TSFunctionType>;
|
736
735
|
TSImportEqualsDeclaration?: VisitNode<S, t.TSImportEqualsDeclaration>;
|
@@ -741,6 +740,7 @@ interface VisitorBaseNodes<S> {
|
|
741
740
|
TSInstantiationExpression?: VisitNode<S, t.TSInstantiationExpression>;
|
742
741
|
TSInterfaceBody?: VisitNode<S, t.TSInterfaceBody>;
|
743
742
|
TSInterfaceDeclaration?: VisitNode<S, t.TSInterfaceDeclaration>;
|
743
|
+
TSInterfaceHeritage?: VisitNode<S, t.TSInterfaceHeritage>;
|
744
744
|
TSIntersectionType?: VisitNode<S, t.TSIntersectionType>;
|
745
745
|
TSIntrinsicKeyword?: VisitNode<S, t.TSIntrinsicKeyword>;
|
746
746
|
TSLiteralType?: VisitNode<S, t.TSLiteralType>;
|
@@ -764,6 +764,7 @@ interface VisitorBaseNodes<S> {
|
|
764
764
|
TSSatisfiesExpression?: VisitNode<S, t.TSSatisfiesExpression>;
|
765
765
|
TSStringKeyword?: VisitNode<S, t.TSStringKeyword>;
|
766
766
|
TSSymbolKeyword?: VisitNode<S, t.TSSymbolKeyword>;
|
767
|
+
TSTemplateLiteralType?: VisitNode<S, t.TSTemplateLiteralType>;
|
767
768
|
TSThisType?: VisitNode<S, t.TSThisType>;
|
768
769
|
TSTupleType?: VisitNode<S, t.TSTupleType>;
|
769
770
|
TSTypeAliasDeclaration?: VisitNode<S, t.TSTypeAliasDeclaration>;
|
@@ -956,10 +957,6 @@ declare function inType(this: NodePath_Final, ...candidateTypes: string[]): bool
|
|
956
957
|
* Infer the type of the current `NodePath`.
|
957
958
|
*/
|
958
959
|
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
960
|
declare function isBaseType(this: NodePath_Final, baseName: string, soft?: boolean): boolean;
|
964
961
|
declare function couldBeBaseType(this: NodePath_Final, name: string): boolean;
|
965
962
|
declare function baseTypeStrictlyMatches(this: NodePath_Final, rightArg: NodePath_Final): boolean;
|
@@ -980,22 +977,18 @@ declare function replaceWithMultiple(this: NodePath_Final, nodes: t.Node | t.Nod
|
|
980
977
|
* transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
|
981
978
|
* easier to use, your transforms will be extremely brittle.
|
982
979
|
*/
|
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.
|
980
|
+
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
981
|
/**
|
985
982
|
* Replace the current node with another.
|
986
983
|
*/
|
987
984
|
declare function replaceWith<R extends t.Node>(this: NodePath_Final, replacementPath: R): [NodePath_Final<R>];
|
988
985
|
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
986
|
/**
|
994
987
|
* This method takes an array of statements nodes and then explodes it
|
995
988
|
* into expressions. This method retains completion records which is
|
996
989
|
* extremely important to retain original semantics.
|
997
990
|
*/
|
998
|
-
declare function replaceExpressionWithStatements(this: NodePath_Final, nodes: Array<t.Statement>): (NodePath<t.
|
991
|
+
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
992
|
declare function replaceInline(this: NodePath_Final, nodes: t.Node | Array<t.Node>): NodePath_Final[];
|
1000
993
|
|
1001
994
|
/**
|
@@ -1054,6 +1047,8 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1054
1047
|
allowInsertArrowWithRest?: boolean | void;
|
1055
1048
|
noNewArrows?: boolean;
|
1056
1049
|
}): NodePath_Final<Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression>;
|
1050
|
+
declare function splitExportDeclaration(this: NodePath_Final<t.ExportDefaultDeclaration | t.ExportNamedDeclaration>): NodePath_Final<t.Declaration>;
|
1051
|
+
declare function ensureFunctionName<N extends t.FunctionExpression | t.ClassExpression>(this: NodePath_Final<N>, supportUnicodeId: boolean): null | NodePath_Final<N>;
|
1057
1052
|
|
1058
1053
|
/**
|
1059
1054
|
* Match the current node if it matches the provided `pattern`.
|
@@ -1062,23 +1057,7 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1062
1057
|
* parsed nodes of `React.createClass` and `React["createClass"]`.
|
1063
1058
|
*/
|
1064
1059
|
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
1060
|
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
1061
|
/**
|
1083
1062
|
* Check the type against our stored internal type of the node. This is handy when a node has
|
1084
1063
|
* been removed yet we still internally know the type and need it to calculate node replacement.
|
@@ -1129,71 +1108,41 @@ type RelativeExecutionStatus = "before" | "after" | "unknown";
|
|
1129
1108
|
*/
|
1130
1109
|
declare function _guessExecutionStatusRelativeTo(this: NodePath_Final, target: NodePath_Final): RelativeExecutionStatus;
|
1131
1110
|
/**
|
1132
|
-
* Resolve
|
1111
|
+
* Resolve the value pointed to by a NodePath
|
1112
|
+
* e.g.
|
1113
|
+
* ```
|
1114
|
+
* var a = 1;
|
1115
|
+
* var b = a;
|
1116
|
+
* b;
|
1117
|
+
* ```
|
1118
|
+
* `b.resolve()` will return `1`
|
1133
1119
|
*/
|
1134
1120
|
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
1121
|
declare function isConstantExpression(this: NodePath_Final): boolean;
|
1137
1122
|
declare function isInStrictMode(this: NodePath_Final): boolean;
|
1138
1123
|
|
1139
|
-
declare function call(this: NodePath_Final, key: VisitPhase): boolean;
|
1140
|
-
declare function _call(this: NodePath_Final, fns?: Array<Function>): boolean;
|
1141
1124
|
declare function isDenylisted(this: NodePath_Final): boolean;
|
1142
|
-
|
1143
1125
|
declare function visit(this: NodePath_Final): boolean;
|
1144
1126
|
declare function skip(this: NodePath_Final): void;
|
1145
1127
|
declare function skipKey(this: NodePath_Final, key: string): void;
|
1146
1128
|
declare function stop(this: NodePath_Final): void;
|
1147
|
-
declare function setScope(this: NodePath_Final): void;
|
1148
1129
|
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
1130
|
declare function requeue(this: NodePath_Final, pathToQueue?: NodePath_Final): void;
|
1164
|
-
declare function
|
1131
|
+
declare function requeueComputedKeyAndDecorators(this: NodePath_Final<t.Method | t.Property>): void;
|
1165
1132
|
|
1166
1133
|
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
1134
|
|
1173
1135
|
/**
|
1174
1136
|
* Insert the provided nodes before the current one.
|
1175
1137
|
*/
|
1176
1138
|
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
1139
|
/**
|
1181
1140
|
* Insert the provided nodes after the current one. When inserting nodes after an
|
1182
1141
|
* expression, ensure that the completion record is correct by pushing the current node.
|
1183
1142
|
*/
|
1184
1143
|
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>)[];
|
1144
|
+
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.VoidTypeAnnotation> | NodePath<t.WhileStatement> | NodePath<t.WithStatement> | NodePath<t.YieldExpression>)[];
|
1191
1145
|
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
1146
|
|
1198
1147
|
declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
1199
1148
|
/**
|
@@ -1204,9 +1153,10 @@ declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
|
1204
1153
|
*
|
1205
1154
|
* @export
|
1206
1155
|
* @param {NodePath} this
|
1156
|
+
* @param {boolean} [shouldPreserveBreak=false] Whether the `break` statement should be preserved.
|
1207
1157
|
* @returns {NodePath[]} Completion records
|
1208
1158
|
*/
|
1209
|
-
declare function getCompletionRecords(this: NodePath_Final): NodePath_Final[];
|
1159
|
+
declare function getCompletionRecords(this: NodePath_Final, shouldPreserveBreak?: boolean): NodePath_Final[];
|
1210
1160
|
declare function getSibling(this: NodePath_Final, key: string | number): NodePath_Final;
|
1211
1161
|
declare function getPrevSibling(this: NodePath_Final): NodePath_Final;
|
1212
1162
|
declare function getNextSibling(this: NodePath_Final): NodePath_Final;
|
@@ -1221,8 +1171,7 @@ declare function get<T extends NodePath_Final, K extends keyof T["node"]>(this:
|
|
1221
1171
|
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
1172
|
declare function get(this: NodePath_Final, key: string, context?: true | TraversalContext): NodePath_Final | NodePath_Final[];
|
1223
1173
|
|
1224
|
-
declare function
|
1225
|
-
declare function _getPattern(this: NodePath_Final, parts: string[], context?: TraversalContext): NodePath_Final | NodePath_Final[];
|
1174
|
+
declare function getAssignmentIdentifiers(this: NodePath_Final): Record<string, t.Identifier>;
|
1226
1175
|
declare function getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
|
1227
1176
|
declare function getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
|
1228
1177
|
declare function getBindingIdentifiers(duplicates: boolean): Record<string, t.Identifier[] | t.Identifier>;
|
@@ -1370,9 +1319,6 @@ interface NodePathAssertions {
|
|
1370
1319
|
assertDebuggerStatement(
|
1371
1320
|
opts?: Opts$2<t.DebuggerStatement>,
|
1372
1321
|
): asserts this is NodePath_Final<t.DebuggerStatement>;
|
1373
|
-
assertDecimalLiteral(
|
1374
|
-
opts?: Opts$2<t.DecimalLiteral>,
|
1375
|
-
): asserts this is NodePath_Final<t.DecimalLiteral>;
|
1376
1322
|
assertDeclaration(
|
1377
1323
|
opts?: Opts$2<t.Declaration>,
|
1378
1324
|
): asserts this is NodePath_Final<t.Declaration>;
|
@@ -1840,6 +1786,9 @@ interface NodePathAssertions {
|
|
1840
1786
|
assertTSCallSignatureDeclaration(
|
1841
1787
|
opts?: Opts$2<t.TSCallSignatureDeclaration>,
|
1842
1788
|
): asserts this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
1789
|
+
assertTSClassImplements(
|
1790
|
+
opts?: Opts$2<t.TSClassImplements>,
|
1791
|
+
): asserts this is NodePath_Final<t.TSClassImplements>;
|
1843
1792
|
assertTSConditionalType(
|
1844
1793
|
opts?: Opts$2<t.TSConditionalType>,
|
1845
1794
|
): asserts this is NodePath_Final<t.TSConditionalType>;
|
@@ -1858,6 +1807,9 @@ interface NodePathAssertions {
|
|
1858
1807
|
assertTSEntityName(
|
1859
1808
|
opts?: Opts$2<t.TSEntityName>,
|
1860
1809
|
): asserts this is NodePath_Final<t.TSEntityName>;
|
1810
|
+
assertTSEnumBody(
|
1811
|
+
opts?: Opts$2<t.TSEnumBody>,
|
1812
|
+
): asserts this is NodePath_Final<t.TSEnumBody>;
|
1861
1813
|
assertTSEnumDeclaration(
|
1862
1814
|
opts?: Opts$2<t.TSEnumDeclaration>,
|
1863
1815
|
): asserts this is NodePath_Final<t.TSEnumDeclaration>;
|
@@ -1867,9 +1819,6 @@ interface NodePathAssertions {
|
|
1867
1819
|
assertTSExportAssignment(
|
1868
1820
|
opts?: Opts$2<t.TSExportAssignment>,
|
1869
1821
|
): asserts this is NodePath_Final<t.TSExportAssignment>;
|
1870
|
-
assertTSExpressionWithTypeArguments(
|
1871
|
-
opts?: Opts$2<t.TSExpressionWithTypeArguments>,
|
1872
|
-
): asserts this is NodePath_Final<t.TSExpressionWithTypeArguments>;
|
1873
1822
|
assertTSExternalModuleReference(
|
1874
1823
|
opts?: Opts$2<t.TSExternalModuleReference>,
|
1875
1824
|
): asserts this is NodePath_Final<t.TSExternalModuleReference>;
|
@@ -1900,6 +1849,9 @@ interface NodePathAssertions {
|
|
1900
1849
|
assertTSInterfaceDeclaration(
|
1901
1850
|
opts?: Opts$2<t.TSInterfaceDeclaration>,
|
1902
1851
|
): asserts this is NodePath_Final<t.TSInterfaceDeclaration>;
|
1852
|
+
assertTSInterfaceHeritage(
|
1853
|
+
opts?: Opts$2<t.TSInterfaceHeritage>,
|
1854
|
+
): asserts this is NodePath_Final<t.TSInterfaceHeritage>;
|
1903
1855
|
assertTSIntersectionType(
|
1904
1856
|
opts?: Opts$2<t.TSIntersectionType>,
|
1905
1857
|
): asserts this is NodePath_Final<t.TSIntersectionType>;
|
@@ -1969,6 +1921,9 @@ interface NodePathAssertions {
|
|
1969
1921
|
assertTSSymbolKeyword(
|
1970
1922
|
opts?: Opts$2<t.TSSymbolKeyword>,
|
1971
1923
|
): asserts this is NodePath_Final<t.TSSymbolKeyword>;
|
1924
|
+
assertTSTemplateLiteralType(
|
1925
|
+
opts?: Opts$2<t.TSTemplateLiteralType>,
|
1926
|
+
): asserts this is NodePath_Final<t.TSTemplateLiteralType>;
|
1972
1927
|
assertTSThisType(
|
1973
1928
|
opts?: Opts$2<t.TSThisType>,
|
1974
1929
|
): asserts this is NodePath_Final<t.TSThisType>;
|
@@ -2309,10 +2264,6 @@ interface BaseNodePathValidators {
|
|
2309
2264
|
this: NodePath_Final,
|
2310
2265
|
opts?: Opts<t.DebuggerStatement>,
|
2311
2266
|
): 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
2267
|
isDeclaration(
|
2317
2268
|
this: NodePath_Final,
|
2318
2269
|
opts?: Opts<t.Declaration>,
|
@@ -2962,6 +2913,10 @@ interface BaseNodePathValidators {
|
|
2962
2913
|
this: NodePath_Final,
|
2963
2914
|
opts?: Opts<t.TSCallSignatureDeclaration>,
|
2964
2915
|
): this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
2916
|
+
isTSClassImplements(
|
2917
|
+
this: NodePath_Final,
|
2918
|
+
opts?: Opts<t.TSClassImplements>,
|
2919
|
+
): this is NodePath_Final<t.TSClassImplements>;
|
2965
2920
|
isTSConditionalType(
|
2966
2921
|
this: NodePath_Final,
|
2967
2922
|
opts?: Opts<t.TSConditionalType>,
|
@@ -2986,6 +2941,10 @@ interface BaseNodePathValidators {
|
|
2986
2941
|
this: NodePath_Final,
|
2987
2942
|
opts?: Opts<t.TSEntityName>,
|
2988
2943
|
): this is NodePath_Final<t.TSEntityName>;
|
2944
|
+
isTSEnumBody(
|
2945
|
+
this: NodePath_Final,
|
2946
|
+
opts?: Opts<t.TSEnumBody>,
|
2947
|
+
): this is NodePath_Final<t.TSEnumBody>;
|
2989
2948
|
isTSEnumDeclaration(
|
2990
2949
|
this: NodePath_Final,
|
2991
2950
|
opts?: Opts<t.TSEnumDeclaration>,
|
@@ -2998,10 +2957,6 @@ interface BaseNodePathValidators {
|
|
2998
2957
|
this: NodePath_Final,
|
2999
2958
|
opts?: Opts<t.TSExportAssignment>,
|
3000
2959
|
): 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
2960
|
isTSExternalModuleReference(
|
3006
2961
|
this: NodePath_Final,
|
3007
2962
|
opts?: Opts<t.TSExternalModuleReference>,
|
@@ -3042,6 +2997,10 @@ interface BaseNodePathValidators {
|
|
3042
2997
|
this: NodePath_Final,
|
3043
2998
|
opts?: Opts<t.TSInterfaceDeclaration>,
|
3044
2999
|
): this is NodePath_Final<t.TSInterfaceDeclaration>;
|
3000
|
+
isTSInterfaceHeritage(
|
3001
|
+
this: NodePath_Final,
|
3002
|
+
opts?: Opts<t.TSInterfaceHeritage>,
|
3003
|
+
): this is NodePath_Final<t.TSInterfaceHeritage>;
|
3045
3004
|
isTSIntersectionType(
|
3046
3005
|
this: NodePath_Final,
|
3047
3006
|
opts?: Opts<t.TSIntersectionType>,
|
@@ -3134,6 +3093,10 @@ interface BaseNodePathValidators {
|
|
3134
3093
|
this: NodePath_Final,
|
3135
3094
|
opts?: Opts<t.TSSymbolKeyword>,
|
3136
3095
|
): this is NodePath_Final<t.TSSymbolKeyword>;
|
3096
|
+
isTSTemplateLiteralType(
|
3097
|
+
this: NodePath_Final,
|
3098
|
+
opts?: Opts<t.TSTemplateLiteralType>,
|
3099
|
+
): this is NodePath_Final<t.TSTemplateLiteralType>;
|
3137
3100
|
isTSThisType(
|
3138
3101
|
this: NodePath_Final,
|
3139
3102
|
opts?: Opts<t.TSThisType>,
|
@@ -3354,7 +3317,6 @@ declare const methods: {
|
|
3354
3317
|
isDescendant: typeof isDescendant;
|
3355
3318
|
inType: typeof inType;
|
3356
3319
|
getTypeAnnotation: typeof getTypeAnnotation;
|
3357
|
-
_getTypeAnnotation: typeof _getTypeAnnotation;
|
3358
3320
|
isBaseType: typeof isBaseType;
|
3359
3321
|
couldBeBaseType: typeof couldBeBaseType;
|
3360
3322
|
baseTypeStrictlyMatches: typeof baseTypeStrictlyMatches;
|
@@ -3362,7 +3324,6 @@ declare const methods: {
|
|
3362
3324
|
replaceWithMultiple: typeof replaceWithMultiple;
|
3363
3325
|
replaceWithSourceString: typeof replaceWithSourceString;
|
3364
3326
|
replaceWith: typeof replaceWith;
|
3365
|
-
_replaceWith: typeof _replaceWith;
|
3366
3327
|
replaceExpressionWithStatements: typeof replaceExpressionWithStatements;
|
3367
3328
|
replaceInline: typeof replaceInline;
|
3368
3329
|
evaluateTruthy: typeof evaluateTruthy;
|
@@ -3371,12 +3332,10 @@ declare const methods: {
|
|
3371
3332
|
ensureBlock: typeof ensureBlock;
|
3372
3333
|
unwrapFunctionEnvironment: typeof unwrapFunctionEnvironment;
|
3373
3334
|
arrowFunctionToExpression: typeof arrowFunctionToExpression;
|
3335
|
+
splitExportDeclaration: typeof splitExportDeclaration;
|
3336
|
+
ensureFunctionName: typeof ensureFunctionName;
|
3374
3337
|
matchesPattern: typeof matchesPattern;
|
3375
|
-
has: typeof has;
|
3376
3338
|
isStatic: typeof isStatic;
|
3377
|
-
is: typeof has;
|
3378
|
-
isnt: typeof isnt;
|
3379
|
-
equals: typeof equals;
|
3380
3339
|
isNodeType: typeof isNodeType;
|
3381
3340
|
canHaveVariableDeclarationOrExpression: typeof canHaveVariableDeclarationOrExpression;
|
3382
3341
|
canSwapBetweenExpressionAndStatement: typeof canSwapBetweenExpressionAndStatement;
|
@@ -3387,46 +3346,21 @@ declare const methods: {
|
|
3387
3346
|
willIMaybeExecuteBefore: typeof willIMaybeExecuteBefore;
|
3388
3347
|
_guessExecutionStatusRelativeTo: typeof _guessExecutionStatusRelativeTo;
|
3389
3348
|
resolve: typeof resolve;
|
3390
|
-
_resolve: typeof _resolve;
|
3391
3349
|
isConstantExpression: typeof isConstantExpression;
|
3392
3350
|
isInStrictMode: typeof isInStrictMode;
|
3393
|
-
call: typeof call;
|
3394
|
-
_call: typeof _call;
|
3395
3351
|
isDenylisted: typeof isDenylisted;
|
3396
|
-
isBlacklisted: typeof isDenylisted;
|
3397
3352
|
visit: typeof visit;
|
3398
3353
|
skip: typeof skip;
|
3399
3354
|
skipKey: typeof skipKey;
|
3400
3355
|
stop: typeof stop;
|
3401
|
-
setScope: typeof setScope;
|
3402
3356
|
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
3357
|
requeue: typeof requeue;
|
3413
|
-
|
3358
|
+
requeueComputedKeyAndDecorators: typeof requeueComputedKeyAndDecorators;
|
3414
3359
|
remove: typeof remove;
|
3415
|
-
_removeFromScope: typeof _removeFromScope;
|
3416
|
-
_callRemovalHooks: typeof _callRemovalHooks;
|
3417
|
-
_remove: typeof _remove;
|
3418
|
-
_markRemoved: typeof _markRemoved;
|
3419
|
-
_assertUnremoved: typeof _assertUnremoved;
|
3420
3360
|
insertBefore: typeof insertBefore;
|
3421
|
-
_containerInsert: typeof _containerInsert;
|
3422
|
-
_containerInsertBefore: typeof _containerInsertBefore;
|
3423
|
-
_containerInsertAfter: typeof _containerInsertAfter;
|
3424
3361
|
insertAfter: typeof insertAfter;
|
3425
|
-
updateSiblingKeys: typeof updateSiblingKeys;
|
3426
|
-
_verifyNodeList: typeof _verifyNodeList;
|
3427
3362
|
unshiftContainer: typeof unshiftContainer;
|
3428
3363
|
pushContainer: typeof pushContainer;
|
3429
|
-
hoist: typeof hoist;
|
3430
3364
|
getOpposite: typeof getOpposite;
|
3431
3365
|
getCompletionRecords: typeof getCompletionRecords;
|
3432
3366
|
getSibling: typeof getSibling;
|
@@ -3435,8 +3369,7 @@ declare const methods: {
|
|
3435
3369
|
getAllNextSiblings: typeof getAllNextSiblings;
|
3436
3370
|
getAllPrevSiblings: typeof getAllPrevSiblings;
|
3437
3371
|
get: typeof get;
|
3438
|
-
|
3439
|
-
_getPattern: typeof _getPattern;
|
3372
|
+
getAssignmentIdentifiers: typeof getAssignmentIdentifiers;
|
3440
3373
|
getBindingIdentifiers: typeof getBindingIdentifiers;
|
3441
3374
|
getOuterBindingIdentifiers: typeof getOuterBindingIdentifiers;
|
3442
3375
|
getBindingIdentifierPaths: typeof getBindingIdentifierPaths;
|
@@ -3488,6 +3421,7 @@ declare const NodePath_Final: {
|
|
3488
3421
|
key: string | number | null;
|
3489
3422
|
node: t.Node | null;
|
3490
3423
|
type: t.Node["type"] | null;
|
3424
|
+
_store: Map<t.Node, NodePath_Final> | null;
|
3491
3425
|
getScope(this: NodePath_Final, scope: Scope): Scope;
|
3492
3426
|
setData(key: string | symbol, val: any): any;
|
3493
3427
|
getData(key: string | symbol, def?: any): any;
|
@@ -3513,15 +3447,14 @@ declare const NodePath_Final: {
|
|
3513
3447
|
};
|
3514
3448
|
type NodePath_Final<T extends t.Node = t.Node> = T extends any ? NodePath<T> : never;
|
3515
3449
|
|
3516
|
-
declare let pathsCache: WeakMap<
|
3450
|
+
declare let pathsCache: WeakMap<Node, Map<Node, NodePath_Final>>;
|
3517
3451
|
|
3518
3452
|
declare let scope: WeakMap<Node, Scope>;
|
3519
3453
|
declare function clear(): void;
|
3520
3454
|
declare function clearPath(): void;
|
3521
3455
|
declare function clearScope(): void;
|
3522
|
-
declare
|
3523
|
-
declare function
|
3524
|
-
declare function getOrCreateCachedPaths(hub: HubInterface | null, parent: Node): Map<Node, NodePath_Final>;
|
3456
|
+
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.VoidTypeAnnotation> | NodePath<t.WhileStatement> | NodePath<t.WithStatement> | NodePath<t.YieldExpression>>;
|
3457
|
+
declare function getOrCreateCachedPaths(node: Node, parentPath?: NodePath_Final): Map<any, any>;
|
3525
3458
|
|
3526
3459
|
declare const __cache_ts_clear: typeof clear;
|
3527
3460
|
declare const __cache_ts_clearPath: typeof clearPath;
|
@@ -3556,12 +3489,14 @@ declare function explode$1<S>(visitor: Visitor<S>): ExplodedVisitor<S>;
|
|
3556
3489
|
declare function verify$1(visitor: Visitor): void;
|
3557
3490
|
declare function merge<State>(visitors: Visitor<State>[]): ExplodedVisitor<State>;
|
3558
3491
|
declare function merge(visitors: Visitor<unknown>[], states?: any[], wrapper?: Function | null): ExplodedVisitor<unknown>;
|
3492
|
+
declare function environmentVisitor<S>(visitor: Visitor<S>): Visitor<S>;
|
3559
3493
|
|
3560
3494
|
type __visitors_ts_VisitWrapper<S = any> = VisitWrapper<S>;
|
3495
|
+
declare const __visitors_ts_environmentVisitor: typeof environmentVisitor;
|
3561
3496
|
declare const __visitors_ts_isExplodedVisitor: typeof isExplodedVisitor;
|
3562
3497
|
declare const __visitors_ts_merge: typeof merge;
|
3563
3498
|
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 };
|
3499
|
+
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
3500
|
}
|
3566
3501
|
|
3567
3502
|
type TraverseOptions<S = t.Node> = {
|
@@ -3578,10 +3513,10 @@ declare namespace traverse {
|
|
3578
3513
|
var verify: typeof verify$1;
|
3579
3514
|
var explode: typeof explode$1;
|
3580
3515
|
var cheap: (node: t.Node, enter: (node: t.Node) => void) => void;
|
3581
|
-
var node: (node: t.Node, opts: ExplodedTraverseOptions
|
3516
|
+
var node: (node: t.Node, opts: ExplodedTraverseOptions, scope?: Scope, state?: any, path?: NodePath_Final, skipKeys?: Record<string, boolean>) => void;
|
3582
3517
|
var clearNode: (node: t.Node, opts?: RemovePropertiesOptions) => void;
|
3583
3518
|
var removeProperties: (tree: t.Node, opts?: RemovePropertiesOptions) => t.Node;
|
3584
|
-
var hasType: (tree: t.Node, type: "
|
3519
|
+
var hasType: (tree: t.Node, type: t.Node["type"], denylistTypes?: Array<string>) => boolean;
|
3585
3520
|
var cache: typeof __cache_ts;
|
3586
3521
|
}
|
3587
3522
|
|