Visitor.d.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import { Accessibility, Argument, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BindingIdentifier, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExprOrSpread, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, Import, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttrValue, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleExportName, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingCall, OptionalChainingExpression, Param, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SuperPropExpression, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstAssertion, TsConstructSignatureDeclaration, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsGetterSignature, TsImportEqualsDeclaration, TsIndexSignature, TsInstantiation, TsInterfaceBody, TsInterfaceDeclaration, TsMethodSignature, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsPropertySignature, TsQualifiedName, TsSatisfiesExpression, TsSetterSignature, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression } from "@swc/types";
  2. /**
  3. * @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
  4. */
  5. export declare class Visitor {
  6. visitProgram(n: Program): Program;
  7. visitModule(m: Module): Module;
  8. visitScript(m: Script): Script;
  9. visitModuleItems(items: ModuleItem[]): ModuleItem[];
  10. visitModuleItem(n: ModuleItem): ModuleItem;
  11. visitModuleDeclaration(n: ModuleDeclaration): ModuleDeclaration;
  12. visitTsNamespaceExportDeclaration(n: TsNamespaceExportDeclaration): ModuleDeclaration;
  13. visitTsExportAssignment(n: TsExportAssignment): TsExportAssignment;
  14. visitTsImportEqualsDeclaration(n: TsImportEqualsDeclaration): ModuleDeclaration;
  15. visitTsModuleReference(n: TsModuleReference): TsModuleReference;
  16. visitTsExternalModuleReference(n: TsExternalModuleReference): TsExternalModuleReference;
  17. visitExportAllDeclaration(n: ExportAllDeclaration): ModuleDeclaration;
  18. visitExportDefaultExpression(n: ExportDefaultExpression): ModuleDeclaration;
  19. visitExportNamedDeclaration(n: ExportNamedDeclaration): ModuleDeclaration;
  20. visitExportSpecifiers(nodes: ExportSpecifier[]): ExportSpecifier[];
  21. visitExportSpecifier(n: ExportSpecifier): ExportSpecifier;
  22. visitNamedExportSpecifier(n: NamedExportSpecifier): ExportSpecifier;
  23. visitModuleExportName(n: ModuleExportName): ModuleExportName;
  24. visitExportNamespaceSpecifier(n: ExportNamespaceSpecifier): ExportSpecifier;
  25. visitExportDefaultSpecifier(n: ExportDefaultSpecifier): ExportSpecifier;
  26. visitOptionalStringLiteral(n: StringLiteral | undefined): StringLiteral | undefined;
  27. visitExportDefaultDeclaration(n: ExportDefaultDeclaration): ModuleDeclaration;
  28. visitDefaultDeclaration(n: DefaultDecl): DefaultDecl;
  29. visitFunctionExpression(n: FunctionExpression): FunctionExpression;
  30. visitClassExpression(n: ClassExpression): ClassExpression;
  31. visitExportDeclaration(n: ExportDeclaration): ModuleDeclaration;
  32. visitArrayExpression(e: ArrayExpression): Expression;
  33. visitArrayElement(e: ExprOrSpread | undefined): ExprOrSpread | undefined;
  34. visitExprOrSpread(e: ExprOrSpread): ExprOrSpread;
  35. visitExprOrSpreads(nodes: ExprOrSpread[]): ExprOrSpread[];
  36. visitSpreadElement(e: SpreadElement): SpreadElement;
  37. visitOptionalExpression(e: Expression | undefined): Expression | undefined;
  38. visitArrowFunctionExpression(e: ArrowFunctionExpression): Expression;
  39. visitArrowBody(body: BlockStatement | Expression): BlockStatement | Expression;
  40. visitBlockStatement(block: BlockStatement): BlockStatement;
  41. visitStatements(stmts: Statement[]): Statement[];
  42. visitStatement(stmt: Statement): Statement;
  43. visitSwitchStatement(stmt: SwitchStatement): Statement;
  44. visitSwitchCases(cases: SwitchCase[]): SwitchCase[];
  45. visitSwitchCase(c: SwitchCase): SwitchCase;
  46. visitIfStatement(stmt: IfStatement): Statement;
  47. visitOptionalStatement(stmt: Statement | undefined): Statement | undefined;
  48. visitBreakStatement(stmt: BreakStatement): Statement;
  49. visitWhileStatement(stmt: WhileStatement): Statement;
  50. visitTryStatement(stmt: TryStatement): Statement;
  51. visitCatchClause(handler: CatchClause | undefined): CatchClause | undefined;
  52. visitThrowStatement(stmt: ThrowStatement): Statement;
  53. visitReturnStatement(stmt: ReturnStatement): Statement;
  54. visitLabeledStatement(stmt: LabeledStatement): Statement;
  55. visitForStatement(stmt: ForStatement): Statement;
  56. visitForOfStatement(stmt: ForOfStatement): Statement;
  57. visitForInStatement(stmt: ForInStatement): Statement;
  58. visitEmptyStatement(stmt: EmptyStatement): EmptyStatement;
  59. visitDoWhileStatement(stmt: DoWhileStatement): Statement;
  60. visitDebuggerStatement(stmt: DebuggerStatement): Statement;
  61. visitWithStatement(stmt: WithStatement): Statement;
  62. visitDeclaration(decl: Declaration): Declaration;
  63. visitVariableDeclaration(n: VariableDeclaration): VariableDeclaration;
  64. visitVariableDeclarators(nodes: VariableDeclarator[]): VariableDeclarator[];
  65. visitVariableDeclarator(n: VariableDeclarator): VariableDeclarator;
  66. visitTsTypeAliasDeclaration(n: TsTypeAliasDeclaration): Declaration;
  67. visitTsModuleDeclaration(n: TsModuleDeclaration): Declaration;
  68. visitTsModuleName(n: TsModuleName): TsModuleName;
  69. visitTsNamespaceBody(n: TsNamespaceBody): TsNamespaceBody | undefined;
  70. visitTsNamespaceDeclaration(n: TsNamespaceDeclaration): TsModuleBlock | TsNamespaceDeclaration;
  71. visitTsModuleBlock(n: TsModuleBlock): TsModuleBlock | TsNamespaceDeclaration;
  72. visitTsInterfaceDeclaration(n: TsInterfaceDeclaration): TsInterfaceDeclaration;
  73. visitTsInterfaceBody(n: TsInterfaceBody): TsInterfaceBody;
  74. visitTsTypeElements(nodes: TsTypeElement[]): TsTypeElement[];
  75. visitTsTypeElement(n: TsTypeElement): TsTypeElement;
  76. visitTsCallSignatureDeclaration(n: TsCallSignatureDeclaration): TsCallSignatureDeclaration;
  77. visitTsConstructSignatureDeclaration(n: TsConstructSignatureDeclaration): TsConstructSignatureDeclaration;
  78. visitTsPropertySignature(n: TsPropertySignature): TsPropertySignature;
  79. visitTsGetterSignature(n: TsGetterSignature): TsGetterSignature;
  80. visitTsSetterSignature(n: TsSetterSignature): TsSetterSignature;
  81. visitTsMethodSignature(n: TsMethodSignature): TsMethodSignature;
  82. visitTsEnumDeclaration(n: TsEnumDeclaration): Declaration;
  83. visitTsEnumMembers(nodes: TsEnumMember[]): TsEnumMember[];
  84. visitTsEnumMember(n: TsEnumMember): TsEnumMember;
  85. visitTsEnumMemberId(n: TsEnumMemberId): TsEnumMemberId;
  86. visitFunctionDeclaration(decl: FunctionDeclaration): Declaration;
  87. visitClassDeclaration(decl: ClassDeclaration): Declaration;
  88. visitClassBody(members: ClassMember[]): ClassMember[];
  89. visitClassMember(member: ClassMember): ClassMember;
  90. visitTsIndexSignature(n: TsIndexSignature): TsIndexSignature;
  91. visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[];
  92. visitTsFnParameter(n: TsFnParameter): TsFnParameter;
  93. visitPrivateProperty(n: PrivateProperty): ClassMember;
  94. visitPrivateMethod(n: PrivateMethod): ClassMember;
  95. visitPrivateName(n: PrivateName): PrivateName;
  96. visitConstructor(n: Constructor): ClassMember;
  97. visitConstructorParameters(nodes: (Param | TsParameterProperty)[]): (Param | TsParameterProperty)[];
  98. visitConstructorParameter(n: Param | TsParameterProperty): Param | TsParameterProperty;
  99. visitStaticBlock(n: StaticBlock): StaticBlock;
  100. visitTsParameterProperty(n: TsParameterProperty): TsParameterProperty | Param;
  101. visitTsParameterPropertyParameter(n: TsParameterPropertyParameter): TsParameterPropertyParameter;
  102. visitPropertyName(key: PropertyName): PropertyName;
  103. visitAccessibility(n: Accessibility | undefined): Accessibility | undefined;
  104. visitClassProperty(n: ClassProperty): ClassMember;
  105. visitClassMethod(n: ClassMethod): ClassMember;
  106. visitComputedPropertyKey(n: ComputedPropName): ComputedPropName;
  107. visitClass<T extends Class>(n: T): T;
  108. visitFunction<T extends Fn>(n: T): T;
  109. visitTsExpressionsWithTypeArguments(nodes: TsExpressionWithTypeArguments[]): TsExpressionWithTypeArguments[];
  110. visitTsExpressionWithTypeArguments(n: TsExpressionWithTypeArguments): TsExpressionWithTypeArguments;
  111. visitTsTypeParameterInstantiation(n: TsTypeParameterInstantiation | undefined): TsTypeParameterInstantiation | undefined;
  112. visitTsTypes(nodes: TsType[]): TsType[];
  113. visitTsEntityName(n: TsEntityName): TsEntityName;
  114. visitTsQualifiedName(n: TsQualifiedName): TsQualifiedName;
  115. visitDecorators(nodes: Decorator[] | undefined): Decorator[] | undefined;
  116. visitDecorator(n: Decorator): Decorator;
  117. visitExpressionStatement(stmt: ExpressionStatement): Statement;
  118. visitContinueStatement(stmt: ContinueStatement): Statement;
  119. visitExpression(n: Expression): Expression;
  120. visitOptionalChainingExpression(n: OptionalChainingExpression): Expression;
  121. visitMemberExpressionOrOptionalChainingCall(n: MemberExpression | OptionalChainingCall): MemberExpression | OptionalChainingCall;
  122. visitOptionalChainingCall(n: OptionalChainingCall): OptionalChainingCall;
  123. visitAssignmentExpression(n: AssignmentExpression): Expression;
  124. visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression;
  125. visitYieldExpression(n: YieldExpression): Expression;
  126. visitUpdateExpression(n: UpdateExpression): Expression;
  127. visitUnaryExpression(n: UnaryExpression): Expression;
  128. visitTsTypeAssertion(n: TsTypeAssertion): Expression;
  129. visitTsConstAssertion(n: TsConstAssertion): Expression;
  130. visitTsInstantiation(n: TsInstantiation): TsInstantiation;
  131. visitTsNonNullExpression(n: TsNonNullExpression): Expression;
  132. visitTsAsExpression(n: TsAsExpression): Expression;
  133. visitTsSatisfiesExpression(n: TsSatisfiesExpression): Expression;
  134. visitThisExpression(n: ThisExpression): Expression;
  135. visitTemplateLiteral(n: TemplateLiteral): Expression;
  136. visitParameters(n: Param[]): Param[];
  137. visitParameter(n: Param): Param;
  138. visitTaggedTemplateExpression(n: TaggedTemplateExpression): Expression;
  139. visitSequenceExpression(n: SequenceExpression): Expression;
  140. visitRegExpLiteral(n: RegExpLiteral): Expression;
  141. visitParenthesisExpression(n: ParenthesisExpression): Expression;
  142. visitObjectExpression(n: ObjectExpression): Expression;
  143. visitObjectProperties(nodes: (Property | SpreadElement)[]): (Property | SpreadElement)[];
  144. visitObjectProperty(n: Property | SpreadElement): Property | SpreadElement;
  145. visitProperty(n: Property): Property | SpreadElement;
  146. visitSetterProperty(n: SetterProperty): Property | SpreadElement;
  147. visitMethodProperty(n: MethodProperty): Property | SpreadElement;
  148. visitKeyValueProperty(n: KeyValueProperty): Property | SpreadElement;
  149. visitGetterProperty(n: GetterProperty): Property | SpreadElement;
  150. visitAssignmentProperty(n: AssignmentProperty): Property | SpreadElement;
  151. visitNullLiteral(n: NullLiteral): NullLiteral;
  152. visitNewExpression(n: NewExpression): Expression;
  153. visitTsTypeArguments(n: TsTypeParameterInstantiation | undefined): TsTypeParameterInstantiation | undefined;
  154. visitArguments(nodes: Argument[]): Argument[];
  155. visitArgument(n: Argument): Argument;
  156. visitMetaProperty(n: MetaProperty): Expression;
  157. visitMemberExpression(n: MemberExpression): MemberExpression;
  158. visitSuperPropExpression(n: SuperPropExpression): Expression;
  159. visitCallee(n: Expression | Super | Import): Expression | Super | Import;
  160. visitJSXText(n: JSXText): JSXText;
  161. visitJSXNamespacedName(n: JSXNamespacedName): JSXNamespacedName;
  162. visitJSXMemberExpression(n: JSXMemberExpression): JSXMemberExpression;
  163. visitJSXObject(n: JSXObject): JSXObject;
  164. visitJSXFragment(n: JSXFragment): JSXFragment;
  165. visitJSXClosingFragment(n: JSXClosingFragment): JSXClosingFragment;
  166. visitJSXElementChildren(nodes: JSXElementChild[]): JSXElementChild[];
  167. visitJSXElementChild(n: JSXElementChild): JSXElementChild;
  168. visitJSXExpressionContainer(n: JSXExpressionContainer): JSXExpressionContainer;
  169. visitJSXSpreadChild(n: JSXSpreadChild): JSXElementChild;
  170. visitJSXOpeningFragment(n: JSXOpeningFragment): JSXOpeningFragment;
  171. visitJSXEmptyExpression(n: JSXEmptyExpression): Expression;
  172. visitJSXElement(n: JSXElement): JSXElement;
  173. visitJSXClosingElement(n: JSXClosingElement | undefined): JSXClosingElement | undefined;
  174. visitJSXElementName(n: JSXElementName): JSXElementName;
  175. visitJSXOpeningElement(n: JSXOpeningElement): JSXOpeningElement;
  176. visitJSXAttributes(attrs: JSXAttributeOrSpread[] | undefined): JSXAttributeOrSpread[] | undefined;
  177. visitJSXAttributeOrSpread(n: JSXAttributeOrSpread): JSXAttributeOrSpread;
  178. visitJSXAttributeOrSpreads(nodes: JSXAttributeOrSpread[]): JSXAttributeOrSpread[];
  179. visitJSXAttribute(n: JSXAttribute): JSXAttributeOrSpread;
  180. visitJSXAttributeValue(n: JSXAttrValue | undefined): JSXAttrValue | undefined;
  181. visitJSXAttributeName(n: JSXAttributeName): JSXAttributeName;
  182. visitConditionalExpression(n: ConditionalExpression): Expression;
  183. visitCallExpression(n: CallExpression): Expression;
  184. visitBooleanLiteral(n: BooleanLiteral): BooleanLiteral;
  185. visitBinaryExpression(n: BinaryExpression): Expression;
  186. visitAwaitExpression(n: AwaitExpression): Expression;
  187. visitTsTypeParameterDeclaration(n: TsTypeParameterDeclaration | undefined): TsTypeParameterDeclaration | undefined;
  188. visitTsTypeParameters(nodes: TsTypeParameter[]): TsTypeParameter[];
  189. visitTsTypeParameter(n: TsTypeParameter): TsTypeParameter;
  190. visitTsTypeAnnotation(a: TsTypeAnnotation | undefined): TsTypeAnnotation | undefined;
  191. visitTsType(n: TsType): TsType;
  192. visitPatterns(nodes: Pattern[]): Pattern[];
  193. visitImportDeclaration(n: ImportDeclaration): ImportDeclaration;
  194. visitImportSpecifiers(nodes: ImportSpecifier[]): ImportSpecifier[];
  195. visitImportSpecifier(node: ImportSpecifier): ImportSpecifier;
  196. visitNamedImportSpecifier(node: NamedImportSpecifier): NamedImportSpecifier;
  197. visitImportNamespaceSpecifier(node: ImportNamespaceSpecifier): ImportNamespaceSpecifier;
  198. visitImportDefaultSpecifier(node: ImportDefaultSpecifier): ImportSpecifier;
  199. visitBindingIdentifier(i: BindingIdentifier): BindingIdentifier;
  200. visitIdentifierReference(i: Identifier): Identifier;
  201. visitLabelIdentifier(label: Identifier): Identifier;
  202. visitIdentifier(n: Identifier): Identifier;
  203. visitStringLiteral(n: StringLiteral): StringLiteral;
  204. visitNumericLiteral(n: NumericLiteral): NumericLiteral;
  205. visitBigIntLiteral(n: BigIntLiteral): BigIntLiteral;
  206. visitPattern(n: Pattern): Pattern;
  207. visitRestElement(n: RestElement): RestElement;
  208. visitAssignmentPattern(n: AssignmentPattern): Pattern;
  209. visitObjectPattern(n: ObjectPattern): Pattern;
  210. visitObjectPatternProperties(nodes: ObjectPatternProperty[]): ObjectPatternProperty[];
  211. visitObjectPatternProperty(n: ObjectPatternProperty): ObjectPatternProperty;
  212. visitKeyValuePatternProperty(n: KeyValuePatternProperty): ObjectPatternProperty;
  213. visitAssignmentPatternProperty(n: AssignmentPatternProperty): ObjectPatternProperty;
  214. visitArrayPattern(n: ArrayPattern): Pattern;
  215. visitArrayPatternElements(nodes: (Pattern | undefined)[]): (Pattern | undefined)[];
  216. visitArrayPatternElement(n: Pattern | undefined): Pattern | undefined;
  217. }
  218. export default Visitor;