@babel/traverse 8.0.0-alpha.15 → 8.0.0-alpha.16
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 +11 -2
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
package/lib/index.d.ts
CHANGED
@@ -496,6 +496,7 @@ interface ExplVisitorBase<S> {
|
|
496
496
|
TSSatisfiesExpression?: ExplVisitNode<S, t.TSSatisfiesExpression>;
|
497
497
|
TSStringKeyword?: ExplVisitNode<S, t.TSStringKeyword>;
|
498
498
|
TSSymbolKeyword?: ExplVisitNode<S, t.TSSymbolKeyword>;
|
499
|
+
TSTemplateLiteralType?: ExplVisitNode<S, t.TSTemplateLiteralType>;
|
499
500
|
TSThisType?: ExplVisitNode<S, t.TSThisType>;
|
500
501
|
TSTupleType?: ExplVisitNode<S, t.TSTupleType>;
|
501
502
|
TSTypeAliasDeclaration?: ExplVisitNode<S, t.TSTypeAliasDeclaration>;
|
@@ -759,6 +760,7 @@ interface VisitorBaseNodes<S> {
|
|
759
760
|
TSSatisfiesExpression?: VisitNode<S, t.TSSatisfiesExpression>;
|
760
761
|
TSStringKeyword?: VisitNode<S, t.TSStringKeyword>;
|
761
762
|
TSSymbolKeyword?: VisitNode<S, t.TSSymbolKeyword>;
|
763
|
+
TSTemplateLiteralType?: VisitNode<S, t.TSTemplateLiteralType>;
|
762
764
|
TSThisType?: VisitNode<S, t.TSThisType>;
|
763
765
|
TSTupleType?: VisitNode<S, t.TSTupleType>;
|
764
766
|
TSTypeAliasDeclaration?: VisitNode<S, t.TSTypeAliasDeclaration>;
|
@@ -982,7 +984,7 @@ declare function replaceWith<R extends NodePath_Final>(this: NodePath_Final, rep
|
|
982
984
|
* into expressions. This method retains completion records which is
|
983
985
|
* extremely important to retain original semantics.
|
984
986
|
*/
|
985
|
-
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>)[];
|
987
|
+
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>)[];
|
986
988
|
declare function replaceInline(this: NodePath_Final, nodes: t.Node | Array<t.Node>): NodePath_Final[];
|
987
989
|
|
988
990
|
/**
|
@@ -1128,7 +1130,7 @@ declare function insertBefore(this: NodePath_Final, nodes_: t.Node | t.Node[]):
|
|
1128
1130
|
* expression, ensure that the completion record is correct by pushing the current node.
|
1129
1131
|
*/
|
1130
1132
|
declare function insertAfter(this: NodePath_Final, nodes_: t.Node | t.Node[]): NodePath_Final[];
|
1131
|
-
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.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>)[];
|
1133
|
+
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>)[];
|
1132
1134
|
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[];
|
1133
1135
|
|
1134
1136
|
declare function getOpposite(this: NodePath_Final): NodePath_Final | null;
|
@@ -1907,6 +1909,9 @@ interface NodePathAssertions {
|
|
1907
1909
|
assertTSSymbolKeyword(
|
1908
1910
|
opts?: Opts$2<t.TSSymbolKeyword>,
|
1909
1911
|
): asserts this is NodePath_Final<t.TSSymbolKeyword>;
|
1912
|
+
assertTSTemplateLiteralType(
|
1913
|
+
opts?: Opts$2<t.TSTemplateLiteralType>,
|
1914
|
+
): asserts this is NodePath_Final<t.TSTemplateLiteralType>;
|
1910
1915
|
assertTSThisType(
|
1911
1916
|
opts?: Opts$2<t.TSThisType>,
|
1912
1917
|
): asserts this is NodePath_Final<t.TSThisType>;
|
@@ -3076,6 +3081,10 @@ interface BaseNodePathValidators {
|
|
3076
3081
|
this: NodePath_Final,
|
3077
3082
|
opts?: Opts<t.TSSymbolKeyword>,
|
3078
3083
|
): this is NodePath_Final<t.TSSymbolKeyword>;
|
3084
|
+
isTSTemplateLiteralType(
|
3085
|
+
this: NodePath_Final,
|
3086
|
+
opts?: Opts<t.TSTemplateLiteralType>,
|
3087
|
+
): this is NodePath_Final<t.TSTemplateLiteralType>;
|
3079
3088
|
isTSThisType(
|
3080
3089
|
this: NodePath_Final,
|
3081
3090
|
opts?: Opts<t.TSThisType>,
|
package/lib/index.js
CHANGED
@@ -289,7 +289,7 @@ function verify$1(visitor) {
|
|
289
289
|
}
|
290
290
|
if (shouldIgnoreKey(nodeType)) continue;
|
291
291
|
if (!TYPES.includes(nodeType)) {
|
292
|
-
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.
|
292
|
+
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.16"}`);
|
293
293
|
}
|
294
294
|
const visitors = visitor[nodeType];
|
295
295
|
if (typeof visitors === "object") {
|
@@ -841,7 +841,15 @@ const collectorVisitor = {
|
|
841
841
|
const parent = path.scope.getBlockParent();
|
842
842
|
parent.registerDeclaration(path);
|
843
843
|
},
|
844
|
+
TSImportEqualsDeclaration(path) {
|
845
|
+
const parent = path.scope.getBlockParent();
|
846
|
+
parent.registerDeclaration(path);
|
847
|
+
},
|
844
848
|
ReferencedIdentifier(path, state) {
|
849
|
+
if (_t.isTSQualifiedName(path.parent) && path.parent.right === path.node) {
|
850
|
+
return;
|
851
|
+
}
|
852
|
+
if (path.parentPath.isTSImportEqualsDeclaration()) return;
|
845
853
|
state.references.push(path);
|
846
854
|
},
|
847
855
|
ForXStatement(path, state) {
|