{"version":3,"names":[],"sources":["../src/types.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\nimport type { NodePath } from \"./index.ts\";\nimport type { VirtualTypeAliases } from \"./path/lib/virtual-types.ts\";\nimport type {\n ExplVisitorBase,\n VisitorBaseNodes,\n VisitorBaseAliases,\n} from \"./generated/visitor-types.d.ts\";\n\nexport type VisitPhase = \"enter\" | \"exit\";\n\ninterface VisitNodeObject {\n enter?: VisitNodeFunction;\n exit?: VisitNodeFunction;\n}\n\nexport interface ExplVisitNode {\n enter?: VisitNodeFunction[];\n exit?: VisitNodeFunction[];\n}\n\nexport interface ExplodedVisitor\n extends ExplVisitorBase,\n ExplVisitNode {\n _exploded: true;\n _verified: true;\n}\n\n// TODO: Assert that the keys of this are the keys of VirtualTypeAliases without\n// the keys of VisitorBaseNodes and VisitorBaseAliases\n// prettier-ignore\ninterface VisitorVirtualAliases {\n BindingIdentifier?: VisitNode;\n BlockScoped?: VisitNode;\n ExistentialTypeParam?: VisitNode;\n Expression?: VisitNode;\n //Flow?: VisitNode;\n ForAwaitStatement?: VisitNode;\n Generated?: VisitNode;\n NumericLiteralTypeAnnotation?: VisitNode;\n Pure?: VisitNode;\n Referenced?: VisitNode;\n ReferencedIdentifier?: VisitNode;\n ReferencedMemberExpression?: VisitNode;\n //RestProperty?: VisitNode;\n Scope?: VisitNode;\n //SpreadProperty?: VisitNode;\n Statement?: VisitNode;\n User?: VisitNode;\n Var?: VisitNode;\n}\n\n// TODO: Do not export this? Or give it a better name?\nexport interface VisitorBase\n extends VisitNodeObject,\n VisitorBaseNodes,\n VisitorBaseAliases,\n VisitorVirtualAliases {\n // Babel supports `NodeTypesWithoutComment | NodeTypesWithoutComment | ... ` but it is\n // too complex for TS. So we type it as a general visitor only if the key contains `|`\n // this is good enough for non-visitor traverse options e.g. `noScope`\n [k: `${string}|${string}`]: VisitNode;\n}\n\nexport type Visitor = VisitorBase | ExplodedVisitor;\n\nexport type VisitNode =\n | VisitNodeFunction\n | VisitNodeObject;\n\nexport type VisitNodeFunction = (\n this: S,\n path: NodePath
,\n state: S,\n) => void;\n"],"mappings":"","ignoreList":[]}