You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

path-visitor.d.ts 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Fork, Omit } from "../types";
  2. import { ASTNode } from "./types";
  3. import { NodePath } from "./node-path";
  4. export interface PathVisitor {
  5. _reusableContextStack: any;
  6. _methodNameTable: any;
  7. _shouldVisitComments: any;
  8. Context: any;
  9. _visiting: any;
  10. _changeReported: any;
  11. _abortRequested: boolean;
  12. visit(...args: any[]): any;
  13. reset(...args: any[]): any;
  14. visitWithoutReset(path: any): any;
  15. AbortRequest: any;
  16. abort(): void;
  17. visitor: any;
  18. acquireContext(path: any): any;
  19. releaseContext(context: any): void;
  20. reportChanged(): void;
  21. wasChangeReported(): any;
  22. }
  23. export interface PathVisitorStatics {
  24. fromMethodsObject(methods?: any): Visitor;
  25. visit<M = {}>(node: ASTNode, methods?: import("../gen/visitor").Visitor<M>): any;
  26. }
  27. export interface PathVisitorConstructor extends PathVisitorStatics {
  28. new (): PathVisitor;
  29. }
  30. export interface Visitor extends PathVisitor {
  31. }
  32. export interface VisitorConstructor extends PathVisitorStatics {
  33. new (): Visitor;
  34. }
  35. export interface VisitorMethods {
  36. [visitorMethod: string]: (path: NodePath) => any;
  37. }
  38. export interface SharedContextMethods {
  39. currentPath: any;
  40. needToCallTraverse: boolean;
  41. Context: any;
  42. visitor: any;
  43. reset(path: any, ...args: any[]): any;
  44. invokeVisitorMethod(methodName: string): any;
  45. traverse(path: any, newVisitor?: VisitorMethods): any;
  46. visit(path: any, newVisitor?: VisitorMethods): any;
  47. reportChanged(): void;
  48. abort(): void;
  49. }
  50. export interface Context extends Omit<PathVisitor, "visit" | "reset">, SharedContextMethods {
  51. }
  52. export default function pathVisitorPlugin(fork: Fork): PathVisitorConstructor;