@babel/traverse 8.0.0-alpha.11 → 8.0.0-alpha.13
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 +48 -143
- package/lib/index.js +956 -992
- package/lib/index.js.map +1 -1
- package/package.json +10 -13
package/lib/index.d.ts
CHANGED
@@ -53,8 +53,8 @@ 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
|
};
|
@@ -85,10 +85,6 @@ declare class Scope {
|
|
85
85
|
*/
|
86
86
|
static contextVariables: string[];
|
87
87
|
get parent(): Scope;
|
88
|
-
get parentBlock(): t.Node;
|
89
|
-
get hub(): HubInterface;
|
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;
|
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;
|
@@ -187,10 +176,6 @@ declare class Scope {
|
|
187
176
|
* Walks the scope tree and gathers **all** bindings.
|
188
177
|
*/
|
189
178
|
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
179
|
bindingIdentifierEquals(name: string, node: t.Node): boolean;
|
195
180
|
getBinding(name: string): Binding | undefined;
|
196
181
|
getOwnBinding(name: string): Binding | undefined;
|
@@ -211,6 +196,17 @@ declare class Scope {
|
|
211
196
|
moveBindingTo(name: string, scope: Scope): void;
|
212
197
|
removeOwnBinding(name: string): void;
|
213
198
|
removeBinding(name: string): void;
|
199
|
+
/**
|
200
|
+
* Hoist all the `var` variable to the beginning of the function/program
|
201
|
+
* scope where their binding will be actually defined. For exmaple,
|
202
|
+
* { var x = 2 }
|
203
|
+
* will be transformed to
|
204
|
+
* var x; { x = 2 }
|
205
|
+
*
|
206
|
+
* @param emit A custom function to emit `var` declarations, for example to
|
207
|
+
* emit them in a different scope.
|
208
|
+
*/
|
209
|
+
hoistVariables(emit?: (id: t.Identifier, hasInit: boolean) => void): void;
|
214
210
|
}
|
215
211
|
declare namespace Scope {
|
216
212
|
type Binding = _Binding;
|
@@ -313,7 +309,6 @@ interface ExplVisitorBase<S> {
|
|
313
309
|
ConditionalExpression?: ExplVisitNode<S, t.ConditionalExpression>;
|
314
310
|
ContinueStatement?: ExplVisitNode<S, t.ContinueStatement>;
|
315
311
|
DebuggerStatement?: ExplVisitNode<S, t.DebuggerStatement>;
|
316
|
-
DecimalLiteral?: ExplVisitNode<S, t.DecimalLiteral>;
|
317
312
|
DeclareClass?: ExplVisitNode<S, t.DeclareClass>;
|
318
313
|
DeclareExportAllDeclaration?: ExplVisitNode<S, t.DeclareExportAllDeclaration>;
|
319
314
|
DeclareExportDeclaration?: ExplVisitNode<S, t.DeclareExportDeclaration>;
|
@@ -451,6 +446,7 @@ interface ExplVisitorBase<S> {
|
|
451
446
|
TSBigIntKeyword?: ExplVisitNode<S, t.TSBigIntKeyword>;
|
452
447
|
TSBooleanKeyword?: ExplVisitNode<S, t.TSBooleanKeyword>;
|
453
448
|
TSCallSignatureDeclaration?: ExplVisitNode<S, t.TSCallSignatureDeclaration>;
|
449
|
+
TSClassImplements?: ExplVisitNode<S, t.TSClassImplements>;
|
454
450
|
TSConditionalType?: ExplVisitNode<S, t.TSConditionalType>;
|
455
451
|
TSConstructSignatureDeclaration?: ExplVisitNode<
|
456
452
|
S,
|
@@ -462,10 +458,6 @@ interface ExplVisitorBase<S> {
|
|
462
458
|
TSEnumDeclaration?: ExplVisitNode<S, t.TSEnumDeclaration>;
|
463
459
|
TSEnumMember?: ExplVisitNode<S, t.TSEnumMember>;
|
464
460
|
TSExportAssignment?: ExplVisitNode<S, t.TSExportAssignment>;
|
465
|
-
TSExpressionWithTypeArguments?: ExplVisitNode<
|
466
|
-
S,
|
467
|
-
t.TSExpressionWithTypeArguments
|
468
|
-
>;
|
469
461
|
TSExternalModuleReference?: ExplVisitNode<S, t.TSExternalModuleReference>;
|
470
462
|
TSFunctionType?: ExplVisitNode<S, t.TSFunctionType>;
|
471
463
|
TSImportEqualsDeclaration?: ExplVisitNode<S, t.TSImportEqualsDeclaration>;
|
@@ -476,6 +468,7 @@ interface ExplVisitorBase<S> {
|
|
476
468
|
TSInstantiationExpression?: ExplVisitNode<S, t.TSInstantiationExpression>;
|
477
469
|
TSInterfaceBody?: ExplVisitNode<S, t.TSInterfaceBody>;
|
478
470
|
TSInterfaceDeclaration?: ExplVisitNode<S, t.TSInterfaceDeclaration>;
|
471
|
+
TSInterfaceHeritage?: ExplVisitNode<S, t.TSInterfaceHeritage>;
|
479
472
|
TSIntersectionType?: ExplVisitNode<S, t.TSIntersectionType>;
|
480
473
|
TSIntrinsicKeyword?: ExplVisitNode<S, t.TSIntrinsicKeyword>;
|
481
474
|
TSLiteralType?: ExplVisitNode<S, t.TSLiteralType>;
|
@@ -584,7 +577,6 @@ interface VisitorBaseNodes<S> {
|
|
584
577
|
ConditionalExpression?: VisitNode<S, t.ConditionalExpression>;
|
585
578
|
ContinueStatement?: VisitNode<S, t.ContinueStatement>;
|
586
579
|
DebuggerStatement?: VisitNode<S, t.DebuggerStatement>;
|
587
|
-
DecimalLiteral?: VisitNode<S, t.DecimalLiteral>;
|
588
580
|
DeclareClass?: VisitNode<S, t.DeclareClass>;
|
589
581
|
DeclareExportAllDeclaration?: VisitNode<S, t.DeclareExportAllDeclaration>;
|
590
582
|
DeclareExportDeclaration?: VisitNode<S, t.DeclareExportDeclaration>;
|
@@ -719,6 +711,7 @@ interface VisitorBaseNodes<S> {
|
|
719
711
|
TSBigIntKeyword?: VisitNode<S, t.TSBigIntKeyword>;
|
720
712
|
TSBooleanKeyword?: VisitNode<S, t.TSBooleanKeyword>;
|
721
713
|
TSCallSignatureDeclaration?: VisitNode<S, t.TSCallSignatureDeclaration>;
|
714
|
+
TSClassImplements?: VisitNode<S, t.TSClassImplements>;
|
722
715
|
TSConditionalType?: VisitNode<S, t.TSConditionalType>;
|
723
716
|
TSConstructSignatureDeclaration?: VisitNode<
|
724
717
|
S,
|
@@ -730,7 +723,6 @@ interface VisitorBaseNodes<S> {
|
|
730
723
|
TSEnumDeclaration?: VisitNode<S, t.TSEnumDeclaration>;
|
731
724
|
TSEnumMember?: VisitNode<S, t.TSEnumMember>;
|
732
725
|
TSExportAssignment?: VisitNode<S, t.TSExportAssignment>;
|
733
|
-
TSExpressionWithTypeArguments?: VisitNode<S, t.TSExpressionWithTypeArguments>;
|
734
726
|
TSExternalModuleReference?: VisitNode<S, t.TSExternalModuleReference>;
|
735
727
|
TSFunctionType?: VisitNode<S, t.TSFunctionType>;
|
736
728
|
TSImportEqualsDeclaration?: VisitNode<S, t.TSImportEqualsDeclaration>;
|
@@ -741,6 +733,7 @@ interface VisitorBaseNodes<S> {
|
|
741
733
|
TSInstantiationExpression?: VisitNode<S, t.TSInstantiationExpression>;
|
742
734
|
TSInterfaceBody?: VisitNode<S, t.TSInterfaceBody>;
|
743
735
|
TSInterfaceDeclaration?: VisitNode<S, t.TSInterfaceDeclaration>;
|
736
|
+
TSInterfaceHeritage?: VisitNode<S, t.TSInterfaceHeritage>;
|
744
737
|
TSIntersectionType?: VisitNode<S, t.TSIntersectionType>;
|
745
738
|
TSIntrinsicKeyword?: VisitNode<S, t.TSIntrinsicKeyword>;
|
746
739
|
TSLiteralType?: VisitNode<S, t.TSLiteralType>;
|
@@ -956,10 +949,6 @@ declare function inType(this: NodePath_Final, ...candidateTypes: string[]): bool
|
|
956
949
|
* Infer the type of the current `NodePath`.
|
957
950
|
*/
|
958
951
|
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
952
|
declare function isBaseType(this: NodePath_Final, baseName: string, soft?: boolean): boolean;
|
964
953
|
declare function couldBeBaseType(this: NodePath_Final, name: string): boolean;
|
965
954
|
declare function baseTypeStrictlyMatches(this: NodePath_Final, rightArg: NodePath_Final): boolean;
|
@@ -980,22 +969,18 @@ declare function replaceWithMultiple(this: NodePath_Final, nodes: t.Node | t.Nod
|
|
980
969
|
* transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
|
981
970
|
* easier to use, your transforms will be extremely brittle.
|
982
971
|
*/
|
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.
|
972
|
+
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
973
|
/**
|
985
974
|
* Replace the current node with another.
|
986
975
|
*/
|
987
976
|
declare function replaceWith<R extends t.Node>(this: NodePath_Final, replacementPath: R): [NodePath_Final<R>];
|
988
977
|
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
978
|
/**
|
994
979
|
* This method takes an array of statements nodes and then explodes it
|
995
980
|
* into expressions. This method retains completion records which is
|
996
981
|
* extremely important to retain original semantics.
|
997
982
|
*/
|
998
|
-
declare function replaceExpressionWithStatements(this: NodePath_Final, nodes: Array<t.Statement>): (NodePath<t.
|
983
|
+
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.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
984
|
declare function replaceInline(this: NodePath_Final, nodes: t.Node | Array<t.Node>): NodePath_Final[];
|
1000
985
|
|
1001
986
|
/**
|
@@ -1054,6 +1039,8 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1054
1039
|
allowInsertArrowWithRest?: boolean | void;
|
1055
1040
|
noNewArrows?: boolean;
|
1056
1041
|
}): NodePath_Final<Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression>;
|
1042
|
+
declare function splitExportDeclaration(this: NodePath_Final<t.ExportDefaultDeclaration | t.ExportNamedDeclaration>): NodePath_Final<t.Declaration>;
|
1043
|
+
declare function ensureFunctionName<N extends t.FunctionExpression | t.ClassExpression>(this: NodePath_Final<N>, supportUnicodeId: boolean): null | NodePath_Final<N>;
|
1057
1044
|
|
1058
1045
|
/**
|
1059
1046
|
* Match the current node if it matches the provided `pattern`.
|
@@ -1062,23 +1049,7 @@ declare function arrowFunctionToExpression(this: NodePath_Final<t.ArrowFunctionE
|
|
1062
1049
|
* parsed nodes of `React.createClass` and `React["createClass"]`.
|
1063
1050
|
*/
|
1064
1051
|
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
1052
|
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
1053
|
/**
|
1083
1054
|
* Check the type against our stored internal type of the node. This is handy when a node has
|
1084
1055
|
* been removed yet we still internally know the type and need it to calculate node replacement.
|
@@ -1132,68 +1103,31 @@ declare function _guessExecutionStatusRelativeTo(this: NodePath_Final, target: N
|
|
1132
1103
|
* Resolve a "pointer" `NodePath` to it's absolute path.
|
1133
1104
|
*/
|
1134
1105
|
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
1106
|
declare function isConstantExpression(this: NodePath_Final): boolean;
|
1137
1107
|
declare function isInStrictMode(this: NodePath_Final): boolean;
|
1138
1108
|
|
1139
|
-
declare function call(this: NodePath_Final, key: VisitPhase): boolean;
|
1140
|
-
declare function _call(this: NodePath_Final, fns?: Array<Function>): boolean;
|
1141
1109
|
declare function isDenylisted(this: NodePath_Final): boolean;
|
1142
|
-
|
1143
1110
|
declare function visit(this: NodePath_Final): boolean;
|
1144
1111
|
declare function skip(this: NodePath_Final): void;
|
1145
1112
|
declare function skipKey(this: NodePath_Final, key: string): void;
|
1146
1113
|
declare function stop(this: NodePath_Final): void;
|
1147
|
-
declare function setScope(this: NodePath_Final): void;
|
1148
1114
|
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
1115
|
declare function requeue(this: NodePath_Final, pathToQueue?: NodePath_Final): void;
|
1164
|
-
declare function
|
1116
|
+
declare function requeueComputedKeyAndDecorators(this: NodePath_Final<t.Method | t.Property>): void;
|
1165
1117
|
|
1166
1118
|
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
1119
|
|
1173
1120
|
/**
|
1174
1121
|
* Insert the provided nodes before the current one.
|
1175
1122
|
*/
|
1176
1123
|
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
1124
|
/**
|
1181
1125
|
* Insert the provided nodes after the current one. When inserting nodes after an
|
1182
1126
|
* expression, ensure that the completion record is correct by pushing the current node.
|
1183
1127
|
*/
|
1184
1128
|
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>)[];
|
1129
|
+
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.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.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
1130
|
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
1131
|
|
1198
1132
|
declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
1199
1133
|
/**
|
@@ -1221,8 +1155,7 @@ declare function get<T extends NodePath_Final, K extends keyof T["node"]>(this:
|
|
1221
1155
|
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
1156
|
declare function get(this: NodePath_Final, key: string, context?: true | TraversalContext): NodePath_Final | NodePath_Final[];
|
1223
1157
|
|
1224
|
-
declare function
|
1225
|
-
declare function _getPattern(this: NodePath_Final, parts: string[], context?: TraversalContext): NodePath_Final | NodePath_Final[];
|
1158
|
+
declare function getAssignmentIdentifiers(this: NodePath_Final): Record<string, t.Identifier>;
|
1226
1159
|
declare function getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
|
1227
1160
|
declare function getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
|
1228
1161
|
declare function getBindingIdentifiers(duplicates: boolean): Record<string, t.Identifier[] | t.Identifier>;
|
@@ -1370,9 +1303,6 @@ interface NodePathAssertions {
|
|
1370
1303
|
assertDebuggerStatement(
|
1371
1304
|
opts?: Opts$2<t.DebuggerStatement>,
|
1372
1305
|
): asserts this is NodePath_Final<t.DebuggerStatement>;
|
1373
|
-
assertDecimalLiteral(
|
1374
|
-
opts?: Opts$2<t.DecimalLiteral>,
|
1375
|
-
): asserts this is NodePath_Final<t.DecimalLiteral>;
|
1376
1306
|
assertDeclaration(
|
1377
1307
|
opts?: Opts$2<t.Declaration>,
|
1378
1308
|
): asserts this is NodePath_Final<t.Declaration>;
|
@@ -1840,6 +1770,9 @@ interface NodePathAssertions {
|
|
1840
1770
|
assertTSCallSignatureDeclaration(
|
1841
1771
|
opts?: Opts$2<t.TSCallSignatureDeclaration>,
|
1842
1772
|
): asserts this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
1773
|
+
assertTSClassImplements(
|
1774
|
+
opts?: Opts$2<t.TSClassImplements>,
|
1775
|
+
): asserts this is NodePath_Final<t.TSClassImplements>;
|
1843
1776
|
assertTSConditionalType(
|
1844
1777
|
opts?: Opts$2<t.TSConditionalType>,
|
1845
1778
|
): asserts this is NodePath_Final<t.TSConditionalType>;
|
@@ -1867,9 +1800,6 @@ interface NodePathAssertions {
|
|
1867
1800
|
assertTSExportAssignment(
|
1868
1801
|
opts?: Opts$2<t.TSExportAssignment>,
|
1869
1802
|
): asserts this is NodePath_Final<t.TSExportAssignment>;
|
1870
|
-
assertTSExpressionWithTypeArguments(
|
1871
|
-
opts?: Opts$2<t.TSExpressionWithTypeArguments>,
|
1872
|
-
): asserts this is NodePath_Final<t.TSExpressionWithTypeArguments>;
|
1873
1803
|
assertTSExternalModuleReference(
|
1874
1804
|
opts?: Opts$2<t.TSExternalModuleReference>,
|
1875
1805
|
): asserts this is NodePath_Final<t.TSExternalModuleReference>;
|
@@ -1900,6 +1830,9 @@ interface NodePathAssertions {
|
|
1900
1830
|
assertTSInterfaceDeclaration(
|
1901
1831
|
opts?: Opts$2<t.TSInterfaceDeclaration>,
|
1902
1832
|
): asserts this is NodePath_Final<t.TSInterfaceDeclaration>;
|
1833
|
+
assertTSInterfaceHeritage(
|
1834
|
+
opts?: Opts$2<t.TSInterfaceHeritage>,
|
1835
|
+
): asserts this is NodePath_Final<t.TSInterfaceHeritage>;
|
1903
1836
|
assertTSIntersectionType(
|
1904
1837
|
opts?: Opts$2<t.TSIntersectionType>,
|
1905
1838
|
): asserts this is NodePath_Final<t.TSIntersectionType>;
|
@@ -2309,10 +2242,6 @@ interface BaseNodePathValidators {
|
|
2309
2242
|
this: NodePath_Final,
|
2310
2243
|
opts?: Opts<t.DebuggerStatement>,
|
2311
2244
|
): 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
2245
|
isDeclaration(
|
2317
2246
|
this: NodePath_Final,
|
2318
2247
|
opts?: Opts<t.Declaration>,
|
@@ -2962,6 +2891,10 @@ interface BaseNodePathValidators {
|
|
2962
2891
|
this: NodePath_Final,
|
2963
2892
|
opts?: Opts<t.TSCallSignatureDeclaration>,
|
2964
2893
|
): this is NodePath_Final<t.TSCallSignatureDeclaration>;
|
2894
|
+
isTSClassImplements(
|
2895
|
+
this: NodePath_Final,
|
2896
|
+
opts?: Opts<t.TSClassImplements>,
|
2897
|
+
): this is NodePath_Final<t.TSClassImplements>;
|
2965
2898
|
isTSConditionalType(
|
2966
2899
|
this: NodePath_Final,
|
2967
2900
|
opts?: Opts<t.TSConditionalType>,
|
@@ -2998,10 +2931,6 @@ interface BaseNodePathValidators {
|
|
2998
2931
|
this: NodePath_Final,
|
2999
2932
|
opts?: Opts<t.TSExportAssignment>,
|
3000
2933
|
): 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
2934
|
isTSExternalModuleReference(
|
3006
2935
|
this: NodePath_Final,
|
3007
2936
|
opts?: Opts<t.TSExternalModuleReference>,
|
@@ -3042,6 +2971,10 @@ interface BaseNodePathValidators {
|
|
3042
2971
|
this: NodePath_Final,
|
3043
2972
|
opts?: Opts<t.TSInterfaceDeclaration>,
|
3044
2973
|
): this is NodePath_Final<t.TSInterfaceDeclaration>;
|
2974
|
+
isTSInterfaceHeritage(
|
2975
|
+
this: NodePath_Final,
|
2976
|
+
opts?: Opts<t.TSInterfaceHeritage>,
|
2977
|
+
): this is NodePath_Final<t.TSInterfaceHeritage>;
|
3045
2978
|
isTSIntersectionType(
|
3046
2979
|
this: NodePath_Final,
|
3047
2980
|
opts?: Opts<t.TSIntersectionType>,
|
@@ -3354,7 +3287,6 @@ declare const methods: {
|
|
3354
3287
|
isDescendant: typeof isDescendant;
|
3355
3288
|
inType: typeof inType;
|
3356
3289
|
getTypeAnnotation: typeof getTypeAnnotation;
|
3357
|
-
_getTypeAnnotation: typeof _getTypeAnnotation;
|
3358
3290
|
isBaseType: typeof isBaseType;
|
3359
3291
|
couldBeBaseType: typeof couldBeBaseType;
|
3360
3292
|
baseTypeStrictlyMatches: typeof baseTypeStrictlyMatches;
|
@@ -3362,7 +3294,6 @@ declare const methods: {
|
|
3362
3294
|
replaceWithMultiple: typeof replaceWithMultiple;
|
3363
3295
|
replaceWithSourceString: typeof replaceWithSourceString;
|
3364
3296
|
replaceWith: typeof replaceWith;
|
3365
|
-
_replaceWith: typeof _replaceWith;
|
3366
3297
|
replaceExpressionWithStatements: typeof replaceExpressionWithStatements;
|
3367
3298
|
replaceInline: typeof replaceInline;
|
3368
3299
|
evaluateTruthy: typeof evaluateTruthy;
|
@@ -3371,12 +3302,10 @@ declare const methods: {
|
|
3371
3302
|
ensureBlock: typeof ensureBlock;
|
3372
3303
|
unwrapFunctionEnvironment: typeof unwrapFunctionEnvironment;
|
3373
3304
|
arrowFunctionToExpression: typeof arrowFunctionToExpression;
|
3305
|
+
splitExportDeclaration: typeof splitExportDeclaration;
|
3306
|
+
ensureFunctionName: typeof ensureFunctionName;
|
3374
3307
|
matchesPattern: typeof matchesPattern;
|
3375
|
-
has: typeof has;
|
3376
3308
|
isStatic: typeof isStatic;
|
3377
|
-
is: typeof has;
|
3378
|
-
isnt: typeof isnt;
|
3379
|
-
equals: typeof equals;
|
3380
3309
|
isNodeType: typeof isNodeType;
|
3381
3310
|
canHaveVariableDeclarationOrExpression: typeof canHaveVariableDeclarationOrExpression;
|
3382
3311
|
canSwapBetweenExpressionAndStatement: typeof canSwapBetweenExpressionAndStatement;
|
@@ -3387,46 +3316,21 @@ declare const methods: {
|
|
3387
3316
|
willIMaybeExecuteBefore: typeof willIMaybeExecuteBefore;
|
3388
3317
|
_guessExecutionStatusRelativeTo: typeof _guessExecutionStatusRelativeTo;
|
3389
3318
|
resolve: typeof resolve;
|
3390
|
-
_resolve: typeof _resolve;
|
3391
3319
|
isConstantExpression: typeof isConstantExpression;
|
3392
3320
|
isInStrictMode: typeof isInStrictMode;
|
3393
|
-
call: typeof call;
|
3394
|
-
_call: typeof _call;
|
3395
3321
|
isDenylisted: typeof isDenylisted;
|
3396
|
-
isBlacklisted: typeof isDenylisted;
|
3397
3322
|
visit: typeof visit;
|
3398
3323
|
skip: typeof skip;
|
3399
3324
|
skipKey: typeof skipKey;
|
3400
3325
|
stop: typeof stop;
|
3401
|
-
setScope: typeof setScope;
|
3402
3326
|
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
3327
|
requeue: typeof requeue;
|
3413
|
-
|
3328
|
+
requeueComputedKeyAndDecorators: typeof requeueComputedKeyAndDecorators;
|
3414
3329
|
remove: typeof remove;
|
3415
|
-
_removeFromScope: typeof _removeFromScope;
|
3416
|
-
_callRemovalHooks: typeof _callRemovalHooks;
|
3417
|
-
_remove: typeof _remove;
|
3418
|
-
_markRemoved: typeof _markRemoved;
|
3419
|
-
_assertUnremoved: typeof _assertUnremoved;
|
3420
3330
|
insertBefore: typeof insertBefore;
|
3421
|
-
_containerInsert: typeof _containerInsert;
|
3422
|
-
_containerInsertBefore: typeof _containerInsertBefore;
|
3423
|
-
_containerInsertAfter: typeof _containerInsertAfter;
|
3424
3331
|
insertAfter: typeof insertAfter;
|
3425
|
-
updateSiblingKeys: typeof updateSiblingKeys;
|
3426
|
-
_verifyNodeList: typeof _verifyNodeList;
|
3427
3332
|
unshiftContainer: typeof unshiftContainer;
|
3428
3333
|
pushContainer: typeof pushContainer;
|
3429
|
-
hoist: typeof hoist;
|
3430
3334
|
getOpposite: typeof getOpposite;
|
3431
3335
|
getCompletionRecords: typeof getCompletionRecords;
|
3432
3336
|
getSibling: typeof getSibling;
|
@@ -3435,8 +3339,7 @@ declare const methods: {
|
|
3435
3339
|
getAllNextSiblings: typeof getAllNextSiblings;
|
3436
3340
|
getAllPrevSiblings: typeof getAllPrevSiblings;
|
3437
3341
|
get: typeof get;
|
3438
|
-
|
3439
|
-
_getPattern: typeof _getPattern;
|
3342
|
+
getAssignmentIdentifiers: typeof getAssignmentIdentifiers;
|
3440
3343
|
getBindingIdentifiers: typeof getBindingIdentifiers;
|
3441
3344
|
getOuterBindingIdentifiers: typeof getOuterBindingIdentifiers;
|
3442
3345
|
getBindingIdentifierPaths: typeof getBindingIdentifierPaths;
|
@@ -3556,12 +3459,14 @@ declare function explode$1<S>(visitor: Visitor<S>): ExplodedVisitor<S>;
|
|
3556
3459
|
declare function verify$1(visitor: Visitor): void;
|
3557
3460
|
declare function merge<State>(visitors: Visitor<State>[]): ExplodedVisitor<State>;
|
3558
3461
|
declare function merge(visitors: Visitor<unknown>[], states?: any[], wrapper?: Function | null): ExplodedVisitor<unknown>;
|
3462
|
+
declare function environmentVisitor<S>(visitor: Visitor<S>): Visitor<S>;
|
3559
3463
|
|
3560
3464
|
type __visitors_ts_VisitWrapper<S = any> = VisitWrapper<S>;
|
3465
|
+
declare const __visitors_ts_environmentVisitor: typeof environmentVisitor;
|
3561
3466
|
declare const __visitors_ts_isExplodedVisitor: typeof isExplodedVisitor;
|
3562
3467
|
declare const __visitors_ts_merge: typeof merge;
|
3563
3468
|
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 };
|
3469
|
+
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
3470
|
}
|
3566
3471
|
|
3567
3472
|
type TraverseOptions<S = t.Node> = {
|
@@ -3578,10 +3483,10 @@ declare namespace traverse {
|
|
3578
3483
|
var verify: typeof verify$1;
|
3579
3484
|
var explode: typeof explode$1;
|
3580
3485
|
var cheap: (node: t.Node, enter: (node: t.Node) => void) => void;
|
3581
|
-
var node: (node: t.Node, opts: ExplodedTraverseOptions
|
3486
|
+
var node: (node: t.Node, opts: ExplodedTraverseOptions, scope?: Scope, state?: any, path?: NodePath_Final, skipKeys?: Record<string, boolean>) => void;
|
3582
3487
|
var clearNode: (node: t.Node, opts?: RemovePropertiesOptions) => void;
|
3583
3488
|
var removeProperties: (tree: t.Node, opts?: RemovePropertiesOptions) => t.Node;
|
3584
|
-
var hasType: (tree: t.Node, type: "
|
3489
|
+
var hasType: (tree: t.Node, type: t.Node["type"], denylistTypes?: Array<string>) => boolean;
|
3585
3490
|
var cache: typeof __cache_ts;
|
3586
3491
|
}
|
3587
3492
|
|