@babel/traverse 7.28.5 → 7.29.0
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/cache.js +0 -1
- package/lib/cache.js.map +1 -1
- package/lib/context.js +8 -4
- package/lib/context.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/path/ancestry.js.map +1 -1
- package/lib/path/context.js +18 -6
- package/lib/path/context.js.map +1 -1
- package/lib/path/conversion.js +6 -12
- package/lib/path/conversion.js.map +1 -1
- package/lib/path/evaluation.js +9 -4
- package/lib/path/evaluation.js.map +1 -1
- package/lib/path/family.js.map +1 -1
- package/lib/path/index.js +42 -46
- package/lib/path/index.js.map +1 -1
- package/lib/path/inference/index.js.map +1 -1
- package/lib/path/inference/util.js +8 -10
- package/lib/path/inference/util.js.map +1 -1
- package/lib/path/introspection.js +17 -21
- package/lib/path/introspection.js.map +1 -1
- package/lib/path/lib/hoister.js.map +1 -1
- package/lib/path/lib/virtual-types-validator.js +6 -8
- package/lib/path/lib/virtual-types-validator.js.map +1 -1
- package/lib/path/modification.js +4 -6
- package/lib/path/modification.js.map +1 -1
- package/lib/path/replacement.js +2 -2
- package/lib/path/replacement.js.map +1 -1
- package/lib/scope/binding.js.map +1 -1
- package/lib/scope/index.js +107 -132
- package/lib/scope/index.js.map +1 -1
- package/lib/scope/lib/renamer.js +5 -4
- package/lib/scope/lib/renamer.js.map +1 -1
- package/lib/scope/traverseForScope.js +9 -11
- package/lib/scope/traverseForScope.js.map +1 -1
- package/lib/traverse-node.js +0 -1
- package/lib/traverse-node.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/visitors.js +10 -14
- package/lib/visitors.js.map +1 -1
- package/package.json +7 -7
package/lib/traverse-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_context","require","_index","_t","_context2","VISITOR_KEYS","_visitPaths","ctx","paths","queue","priorityQueue","visited","Set","stop","visitIndex","length","path","resync","call","contexts","pushContext","key","node","has","add","_visit","i","popContext","_opts$denylist","opts","denylist","blacklist","includes","type","shouldSkip","shouldStop","_call","enter","_opts$node$type","_traverse","scope","state","skipKeys","exit","_opts$node$type2","visitSelf","keys","TraversalContext","parentKey","prop","Array","isArray","childPath","NodePath","get","parentPath","parent","container","listKey","push","traverseNode","context","visitQueue","visit"],"sources":["../src/traverse-node.ts"],"sourcesContent":["import TraversalContext from \"./context.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport NodePath from \"./path/index.ts\";\nimport type Scope from \"./scope/index.ts\";\nimport type * as t from \"@babel/types\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport { _call, popContext, pushContext, resync } from \"./path/context.ts\";\n\nfunction _visitPaths(ctx: TraversalContext, paths: NodePath[]): boolean {\n // set queue\n ctx.queue = paths;\n ctx.priorityQueue = [];\n\n const visited = new Set();\n let stop = false;\n let visitIndex = 0;\n\n for (; visitIndex < paths.length; ) {\n const path = paths[visitIndex];\n visitIndex++;\n\n resync.call(path);\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== ctx\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n pushContext.call(path, ctx);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (_visit(ctx, path)) {\n stop = true;\n break;\n }\n\n if (ctx.priorityQueue.length) {\n stop = _visitPaths(ctx, ctx.priorityQueue);\n ctx.priorityQueue = [];\n ctx.queue = paths;\n if (stop) break;\n }\n }\n\n // pop contexts\n for (let i = 0; i < visitIndex; i++) {\n popContext.call(paths[i]);\n }\n\n // clear queue\n ctx.queue = null;\n\n return stop;\n}\n\nfunction _visit(ctx: TraversalContext, path: NodePath) {\n const node = path.node;\n if (!node) {\n return false;\n }\n const opts = ctx.opts;\n\n // @ts-expect-error TODO(Babel 8): Remove blacklist\n const denylist = opts.denylist ?? opts.blacklist;\n if (denylist?.includes(node.type)) {\n return false;\n }\n\n if (opts.shouldSkip?.(path)) {\n return false;\n }\n\n // Note: We need to check \"this.shouldSkip\" first because\n // another visitor can set it to true. Usually .shouldSkip is false\n // before calling the enter visitor, but it can be true in case of\n // a requeued node (e.g. by .replaceWith()) that is then marked\n // with .skip().\n if (path.shouldSkip) return path.shouldStop;\n\n if (_call.call(path, opts.enter)) return path.shouldStop;\n if (path.node) {\n if (_call.call(path, opts[node.type]?.enter)) return path.shouldStop;\n }\n\n path.shouldStop = _traverse(\n path.node,\n opts,\n path.scope,\n ctx.state,\n path,\n path.skipKeys,\n );\n\n if (path.node) {\n if (_call.call(path, opts.exit)) return true;\n }\n if (path.node) {\n _call.call(path, opts[node.type]?.exit);\n }\n\n return path.shouldStop;\n}\n\nfunction _traverse<S>(\n node: t.Node,\n opts: ExplodedTraverseOptions<S>,\n scope?: Scope | null,\n state?: S,\n path?: NodePath,\n skipKeys?: Record<string, boolean> | null,\n visitSelf?: boolean,\n) {\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n const ctx = new TraversalContext(scope, opts, state, path);\n if (visitSelf) {\n if (skipKeys?.[path!.parentKey]) return false;\n return _visitPaths(ctx, [path!]);\n }\n\n for (const key of keys) {\n if (skipKeys?.[key]) continue;\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n\n if (Array.isArray(prop)) {\n if (!prop.length) continue;\n const paths = [];\n for (let i = 0; i < prop.length; i++) {\n const childPath = NodePath.get({\n parentPath: path,\n parent: node,\n container: prop,\n key: i,\n listKey: key,\n });\n paths.push(childPath);\n }\n if (_visitPaths(ctx, paths)) return true;\n } else {\n if (\n _visitPaths(ctx, [\n NodePath.get({\n parentPath: path,\n parent: node,\n container: node,\n key,\n listKey: null,\n }),\n ])\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Traverse the children of given node\n * @param {Node} node\n * @param {TraverseOptions} opts The traverse options used to create a new traversal context\n * @param {scope} scope A traversal scope used to create a new traversal context. When opts.noScope is true, scope should not be provided\n * @param {any} state A user data storage provided as the second callback argument for traversal visitors\n * @param {NodePath} path A NodePath of given node\n * @param {Record<string, boolean>} skipKeys A map from key names to whether that should be skipped during traversal. The skipKeys are applied to every descendants\n * @returns {boolean} Whether the traversal stops early\n\n * @note This function does not visit the given `node`.\n */\nexport function traverseNode<S = unknown>(\n node: t.Node,\n opts: ExplodedTraverseOptions<S>,\n scope?: Scope | null,\n state?: S,\n path?: NodePath,\n skipKeys?: Record<string, boolean> | null,\n visitSelf?: boolean,\n): boolean {\n if (process.env.BABEL_8_BREAKING) {\n return _traverse(node, opts, scope, state, path, skipKeys, visitSelf);\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return false;\n\n const context = new TraversalContext<S>(scope, opts, state as S, path);\n if (visitSelf) {\n if (skipKeys?.[path!.parentKey]) return false;\n return context.visitQueue([path!]);\n }\n\n for (const key of keys) {\n if (skipKeys?.[key]) continue;\n if (context.visit(node, key)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,EAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAA2E;EADlEI;AAAY,IAAAF,EAAA;AAGrB,SAASG,WAAWA,CAACC,GAAqB,EAAEC,KAAiB,EAAW;EAEtED,GAAG,CAACE,KAAK,GAAGD,KAAK;EACjBD,GAAG,CAACG,aAAa,GAAG,EAAE;EAEtB,MAAMC,OAAO,GAAG,IAAIC,GAAG,CAAC,CAAC;EACzB,IAAIC,IAAI,GAAG,KAAK;EAChB,IAAIC,UAAU,GAAG,CAAC;EAElB,OAAOA,UAAU,GAAGN,KAAK,CAACO,MAAM,GAAI;IAClC,MAAMC,IAAI,GAAGR,KAAK,CAACM,UAA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ErC;QACX,CAAC,CAAC;QACFb,KAAK,CAACmD,IAAI,CAACP,SAAS,CAAC;MACvB;MACA,IAAI9C,WAAW,CAACC,GAAG,EAAEC,KAAK,CAAC,EAAE,OAAO,IAAI;IAC1C,CAAC,MAAM;MACL,IACEF,WAAW,CAACC,GAAG,EAAE,CACf8C,cAAQ,CAACC,GAAG,CAAC;QACXC,UAAU,EAAEvC,IAAI;QAChBwC,MAAM,EAAElC,IAAI;QACZmC,SAAS,EAAEnC,IAAI;QACfD,GAAG;QACHqC,OAAO,EAAE;MACX,CAAC,CAAC,CACH,CAAC,EACF;QACA,OAAO,IAAI;MACb;IACF;EACF;EAEA,OAAO,KAAK;AACd;AAcO,SAASE,YAAYA,CAC1BtC,IAAY,EACZO,IAAgC,EAChCW,KAAoB,EACpBC,KAAS,EACTzB,IAAe,EACf0B,QAAyC,EACzCG,SAAmB,EACV;EAAA;EAKT,MAAMC,IAAI,GAAGzC,YAAY,CAACiB,IAAI,CAACW,IAAI,CAAC;EACpC,IAAI,CAACa,IAAI,EAAE,OAAO,KAAK;EAEvB,MAAMe,OAAO,GAAG,IAAId,gBAAgB,CAAIP,KAAK,EAAEX,IAAI,EAAEY,KAAK,EAAOzB,IAAI,CAAC;EACtE,IAAI6B,SAAS,EAAE;IACb,IAAIH,QAAQ,YAARA,QAAQ,CAAG1B,IAAI,CAAEgC,SAAS,CAAC,EAAE,OAAO,KAAK;IAC7C,OAAOa,OAAO,CAACC,UAAU,CAAC,CAAC9C,IAAI,CAAE,CAAC;EACpC;EAEA,KAAK,MAAMK,GAAG,IAAIyB,IAAI,EAAE;IACtB,IAAIJ,QAAQ,YAARA,QAAQ,CAAGrB,GAAG,CAAC,EAAE;IACrB,IAAIwC,OAAO,CAACE,KAAK,CAACzC,IAAI,EAAED,GAAG,CAAC,EAAE;MAC5B,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_context","require","_index","_t","_context2","VISITOR_KEYS","_visitPaths","ctx","paths","queue","priorityQueue","visited","Set","stop","visitIndex","length","path","resync","call","contexts","pushContext","key","node","has","add","_visit","i","popContext","_opts$denylist","opts","denylist","blacklist","includes","type","shouldSkip","shouldStop","_call","enter","_opts$node$type","_traverse","scope","state","skipKeys","exit","_opts$node$type2","visitSelf","keys","TraversalContext","parentKey","prop","Array","isArray","childPath","NodePath","get","parentPath","parent","container","listKey","push","traverseNode","context","visitQueue","visit"],"sources":["../src/traverse-node.ts"],"sourcesContent":["import TraversalContext from \"./context.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport NodePath from \"./path/index.ts\";\nimport type Scope from \"./scope/index.ts\";\nimport type * as t from \"@babel/types\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport { _call, popContext, pushContext, resync } from \"./path/context.ts\";\n\nfunction _visitPaths(ctx: TraversalContext, paths: NodePath[]): boolean {\n // set queue\n ctx.queue = paths;\n ctx.priorityQueue = [];\n\n const visited = new Set();\n let stop = false;\n let visitIndex = 0;\n\n for (; visitIndex < paths.length; ) {\n const path = paths[visitIndex];\n visitIndex++;\n\n resync.call(path);\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== ctx\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n pushContext.call(path, ctx);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (_visit(ctx, path)) {\n stop = true;\n break;\n }\n\n if (ctx.priorityQueue.length) {\n stop = _visitPaths(ctx, ctx.priorityQueue);\n ctx.priorityQueue = [];\n ctx.queue = paths;\n if (stop) break;\n }\n }\n\n // pop contexts\n for (let i = 0; i < visitIndex; i++) {\n popContext.call(paths[i]);\n }\n\n // clear queue\n ctx.queue = null;\n\n return stop;\n}\n\nfunction _visit(ctx: TraversalContext, path: NodePath) {\n const node = path.node;\n if (!node) {\n return false;\n }\n const opts = ctx.opts;\n\n // @ts-expect-error TODO(Babel 8): Remove blacklist\n const denylist = opts.denylist ?? opts.blacklist;\n if (denylist?.includes(node.type)) {\n return false;\n }\n\n if (opts.shouldSkip?.(path)) {\n return false;\n }\n\n // Note: We need to check \"this.shouldSkip\" first because\n // another visitor can set it to true. Usually .shouldSkip is false\n // before calling the enter visitor, but it can be true in case of\n // a requeued node (e.g. by .replaceWith()) that is then marked\n // with .skip().\n if (path.shouldSkip) return path.shouldStop;\n\n if (_call.call(path, opts.enter)) return path.shouldStop;\n if (path.node) {\n if (_call.call(path, opts[node.type]?.enter)) return path.shouldStop;\n }\n\n path.shouldStop = _traverse(\n path.node,\n opts,\n path.scope,\n ctx.state,\n path,\n path.skipKeys,\n );\n\n if (path.node) {\n if (_call.call(path, opts.exit)) return true;\n }\n if (path.node) {\n _call.call(path, opts[node.type]?.exit);\n }\n\n return path.shouldStop;\n}\n\nfunction _traverse<S>(\n node: t.Node,\n opts: ExplodedTraverseOptions<S>,\n scope?: Scope | null,\n state?: S,\n path?: NodePath,\n skipKeys?: Record<string, boolean> | null,\n visitSelf?: boolean,\n) {\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n const ctx = new TraversalContext(scope, opts, state, path);\n if (visitSelf) {\n if (skipKeys?.[path!.parentKey]) return false;\n return _visitPaths(ctx, [path!]);\n }\n\n for (const key of keys) {\n if (skipKeys?.[key]) continue;\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n\n if (Array.isArray(prop)) {\n if (!prop.length) continue;\n const paths = [];\n for (let i = 0; i < prop.length; i++) {\n const childPath = NodePath.get({\n parentPath: path,\n parent: node,\n container: prop,\n key: i,\n listKey: key,\n });\n paths.push(childPath);\n }\n if (_visitPaths(ctx, paths)) return true;\n } else {\n if (\n _visitPaths(ctx, [\n NodePath.get({\n parentPath: path,\n parent: node,\n container: node,\n key,\n listKey: null,\n }),\n ])\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Traverse the children of given node\n * @param {Node} node\n * @param {TraverseOptions} opts The traverse options used to create a new traversal context\n * @param {scope} scope A traversal scope used to create a new traversal context. When opts.noScope is true, scope should not be provided\n * @param {any} state A user data storage provided as the second callback argument for traversal visitors\n * @param {NodePath} path A NodePath of given node\n * @param {Record<string, boolean>} skipKeys A map from key names to whether that should be skipped during traversal. The skipKeys are applied to every descendants\n * @returns {boolean} Whether the traversal stops early\n\n * @note This function does not visit the given `node`.\n */\nexport function traverseNode<S = unknown>(\n node: t.Node,\n opts: ExplodedTraverseOptions<S>,\n scope?: Scope | null,\n state?: S,\n path?: NodePath,\n skipKeys?: Record<string, boolean> | null,\n visitSelf?: boolean,\n): boolean {\n if (process.env.BABEL_8_BREAKING) {\n return _traverse(node, opts, scope, state, path, skipKeys, visitSelf);\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return false;\n\n const context = new TraversalContext<S>(scope, opts, state as S, path);\n if (visitSelf) {\n if (skipKeys?.[path!.parentKey]) return false;\n return context.visitQueue([path!]);\n }\n\n for (const key of keys) {\n if (skipKeys?.[key]) continue;\n if (context.visit(node, key)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,EAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAA2E;EADlEI;AAAY,IAAAF,EAAA;AAGrB,SAASG,WAAWA,CAACC,GAAqB,EAAEC,KAAiB,EAAW;EAEtED,GAAG,CAACE,KAAK,GAAGD,KAAK;EACjBD,GAAG,CAACG,aAAa,GAAG,EAAE;EAEtB,MAAMC,OAAO,GAAG,IAAIC,GAAG,CAAC,CAAC;EACzB,IAAIC,IAAI,GAAG,KAAK;EAChB,IAAIC,UAAU,GAAG,CAAC;EAElB,OAAOA,UAAU,GAAG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ACd","ignoreList":[]}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>;\n exit?: VisitNodeFunction<S, P>;\n}\n\nexport interface ExplVisitNode<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>[];\n exit?: VisitNodeFunction<S, P>[];\n}\n\nexport interface ExplodedVisitor<S = unknown>\n extends ExplVisitorBase<S>,\n ExplVisitNode<S, t.Node> {\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<S> {\n BindingIdentifier?: VisitNode<S, VirtualTypeAliases[\"BindingIdentifier\"]>;\n BlockScoped?: VisitNode<S, VirtualTypeAliases[\"BlockScoped\"]>;\n ExistentialTypeParam?: VisitNode<S, VirtualTypeAliases[\"ExistentialTypeParam\"]>;\n Expression?: VisitNode<S, VirtualTypeAliases[\"Expression\"]>;\n //Flow?: VisitNode<S, VirtualTypeAliases[\"Flow\"]>;\n ForAwaitStatement?: VisitNode<S, VirtualTypeAliases[\"ForAwaitStatement\"]>;\n Generated?: VisitNode<S, VirtualTypeAliases[\"Generated\"]>;\n NumericLiteralTypeAnnotation?: VisitNode<S, VirtualTypeAliases[\"NumericLiteralTypeAnnotation\"]>;\n Pure?: VisitNode<S, VirtualTypeAliases[\"Pure\"]>;\n Referenced?: VisitNode<S, VirtualTypeAliases[\"Referenced\"]>;\n ReferencedIdentifier?: VisitNode<S, VirtualTypeAliases[\"ReferencedIdentifier\"]>;\n ReferencedMemberExpression?: VisitNode<S, VirtualTypeAliases[\"ReferencedMemberExpression\"]>;\n //RestProperty?: VisitNode<S, VirtualTypeAliases[\"RestProperty\"]>;\n Scope?: VisitNode<S, VirtualTypeAliases[\"Scope\"]>;\n //SpreadProperty?: VisitNode<S, VirtualTypeAliases[\"SpreadProperty\"]>;\n Statement?: VisitNode<S, VirtualTypeAliases[\"Statement\"]>;\n User?: VisitNode<S, VirtualTypeAliases[\"User\"]>;\n Var?: VisitNode<S, VirtualTypeAliases[\"Var\"]>;\n}\n\n// TODO: Do not export this? Or give it a better name?\nexport interface VisitorBase<S>\n extends VisitNodeObject<S, t.Node>,\n VisitorBaseNodes<S>,\n VisitorBaseAliases<S>,\n VisitorVirtualAliases<S
|
|
1
|
+
{"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<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>;\n exit?: VisitNodeFunction<S, P>;\n}\n\nexport interface ExplVisitNode<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>[];\n exit?: VisitNodeFunction<S, P>[];\n}\n\nexport interface ExplodedVisitor<S = unknown>\n extends ExplVisitorBase<S>,\n ExplVisitNode<S, t.Node> {\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<S> {\n BindingIdentifier?: VisitNode<S, VirtualTypeAliases[\"BindingIdentifier\"]>;\n BlockScoped?: VisitNode<S, VirtualTypeAliases[\"BlockScoped\"]>;\n ExistentialTypeParam?: VisitNode<S, VirtualTypeAliases[\"ExistentialTypeParam\"]>;\n Expression?: VisitNode<S, VirtualTypeAliases[\"Expression\"]>;\n //Flow?: VisitNode<S, VirtualTypeAliases[\"Flow\"]>;\n ForAwaitStatement?: VisitNode<S, VirtualTypeAliases[\"ForAwaitStatement\"]>;\n Generated?: VisitNode<S, VirtualTypeAliases[\"Generated\"]>;\n NumericLiteralTypeAnnotation?: VisitNode<S, VirtualTypeAliases[\"NumericLiteralTypeAnnotation\"]>;\n Pure?: VisitNode<S, VirtualTypeAliases[\"Pure\"]>;\n Referenced?: VisitNode<S, VirtualTypeAliases[\"Referenced\"]>;\n ReferencedIdentifier?: VisitNode<S, VirtualTypeAliases[\"ReferencedIdentifier\"]>;\n ReferencedMemberExpression?: VisitNode<S, VirtualTypeAliases[\"ReferencedMemberExpression\"]>;\n //RestProperty?: VisitNode<S, VirtualTypeAliases[\"RestProperty\"]>;\n Scope?: VisitNode<S, VirtualTypeAliases[\"Scope\"]>;\n //SpreadProperty?: VisitNode<S, VirtualTypeAliases[\"SpreadProperty\"]>;\n Statement?: VisitNode<S, VirtualTypeAliases[\"Statement\"]>;\n User?: VisitNode<S, VirtualTypeAliases[\"User\"]>;\n Var?: VisitNode<S, VirtualTypeAliases[\"Var\"]>;\n}\n\n// TODO: Do not export this? Or give it a better name?\nexport interface VisitorBase<S>\n extends VisitNodeObject<S, t.Node>,\n VisitorBaseNodes<S>,\n VisitorBaseAliases<S>,\n VisitorVirtualAliases<S>,\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 Record<`${string}|${string}`, VisitNode<S, t.Node>> {}\n\nexport type Visitor<S = unknown> = VisitorBase<S> | ExplodedVisitor<S>;\n\nexport type VisitNode<S, P extends t.Node> =\n | VisitNodeFunction<S, P>\n | VisitNodeObject<S, P>;\n\nexport type VisitNodeFunction<S, P extends t.Node> = (\n this: S,\n path: NodePath<P>,\n state: S,\n) => void;\n"],"mappings":"","ignoreList":[]}
|
package/lib/visitors.js
CHANGED
|
@@ -102,7 +102,7 @@ function verify$1(visitor) {
|
|
|
102
102
|
}
|
|
103
103
|
if (shouldIgnoreKey(nodeType)) continue;
|
|
104
104
|
if (!TYPES.includes(nodeType)) {
|
|
105
|
-
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.
|
|
105
|
+
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.29.0"}`);
|
|
106
106
|
}
|
|
107
107
|
const visitors = visitor[nodeType];
|
|
108
108
|
if (typeof visitors === "object") {
|
|
@@ -130,14 +130,12 @@ function merge(visitors, states = [], wrapper) {
|
|
|
130
130
|
_verified: true,
|
|
131
131
|
_exploded: true
|
|
132
132
|
};
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
}
|
|
133
|
+
Object.defineProperty(mergedVisitor, "_exploded", {
|
|
134
|
+
enumerable: false
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(mergedVisitor, "_verified", {
|
|
137
|
+
enumerable: false
|
|
138
|
+
});
|
|
141
139
|
for (let i = 0; i < visitors.length; i++) {
|
|
142
140
|
const visitor = explode$1(visitors[i]);
|
|
143
141
|
const state = states[i];
|
|
@@ -209,15 +207,13 @@ function wrapCheck(nodeType, fn) {
|
|
|
209
207
|
return newFn;
|
|
210
208
|
}
|
|
211
209
|
function shouldIgnoreKey(key) {
|
|
212
|
-
if (key
|
|
210
|
+
if (key.startsWith("_")) return true;
|
|
213
211
|
if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
|
|
214
212
|
if (key === "denylist" || key === "noScope" || key === "skipKeys") {
|
|
215
213
|
return true;
|
|
216
214
|
}
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
215
|
+
if (key === "blacklist") {
|
|
216
|
+
return true;
|
|
221
217
|
}
|
|
222
218
|
return false;
|
|
223
219
|
}
|
package/lib/visitors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["virtualTypes","require","virtualTypesValidators","_t","_context","DEPRECATED_KEYS","DEPRECATED_ALIASES","FLIPPED_ALIAS_KEYS","TYPES","__internal__deprecationWarning","deprecationWarning","isVirtualType","type","isExplodedVisitor","visitor","_exploded","explode$1","nodeType","Object","keys","shouldIgnoreKey","parts","split","length","fns","part","verify$1","__esModule","ensureEntranceObjects","ensureCallbackArrays","wrapCheck","types","_visitor$type","mergePair","aliases","deprecatedKey","deprecatedAlias","alias","existing","assign","_verified","Error","validateVisitorMethods","includes","visitors","visitorKey","path","val","concat","fn","TypeError","merge","states","wrapper","mergedVisitor","defineProperty","enumerable","i","state","topVisitor","wrapWithStateOrWrapper","key","typeVisitor","nodeVisitor","oldVisitor","newVisitor","phase","Array","isArray","map","newFn","call","toString","obj","enter","exit","fnKey","validator","apply","arguments","dest","src","_environmentVisitor","FunctionParent","isArrowFunctionExpression","skip","isMethod","requeueComputedKeyAndDecorators","Property","isObjectProperty","environmentVisitor"],"sources":["../src/visitors.ts"],"sourcesContent":["import * as virtualTypes from \"./path/lib/virtual-types.ts\";\nimport * as virtualTypesValidators from \"./path/lib/virtual-types-validator.ts\";\nimport type { Node } from \"@babel/types\";\nimport {\n DEPRECATED_KEYS,\n DEPRECATED_ALIASES,\n FLIPPED_ALIAS_KEYS,\n TYPES,\n __internal__deprecationWarning as deprecationWarning,\n} from \"@babel/types\";\nimport type { ExplodedVisitor, NodePath, Visitor } from \"./index.ts\";\nimport type { ExplVisitNode, VisitNodeFunction, VisitPhase } from \"./types.ts\";\nimport { requeueComputedKeyAndDecorators } from \"./path/context.ts\";\n\ntype VIRTUAL_TYPES = keyof typeof virtualTypes;\nfunction isVirtualType(type: string): type is VIRTUAL_TYPES {\n return type in virtualTypes;\n}\nexport type VisitWrapper<S = any> = (\n stateName: string | undefined,\n visitorType: VisitPhase,\n callback: VisitNodeFunction<S, Node>,\n) => VisitNodeFunction<S, Node>;\n\nexport function isExplodedVisitor(\n visitor: Visitor,\n): visitor is ExplodedVisitor {\n // @ts-expect-error _exploded is not defined on non-exploded Visitor\n return visitor?._exploded;\n}\n\n// We need to name this function `explode$1` because otherwise rollup-plugin-dts\n// will generate a `namespace traverse { var explode: typeof explode; }` when\n// bundling @babel/traverse's index.d.ts.\n// TODO: Just call it `explode` once https://github.com/Swatinem/rollup-plugin-dts/issues/307\n// is fixed.\nexport { explode$1 as explode };\n/**\n * explode() will take a visitor object with all of the various shorthands\n * that we support, and validates & normalizes it into a common format, ready\n * to be used in traversal\n *\n * The various shorthands are:\n * * `Identifier() { ... }` -> `Identifier: { enter() { ... } }`\n * * `\"Identifier|NumericLiteral\": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }`\n * * Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }`\n * Other normalizations are:\n * * Visitors of virtual types are wrapped, so that they are only visited when\n * their dynamic check passes\n * * `enter` and `exit` functions are wrapped in arrays, to ease merging of\n * visitors\n */\nfunction explode$1<S>(visitor: Visitor<S>): ExplodedVisitor<S> {\n if (isExplodedVisitor(visitor)) return visitor;\n // @ts-expect-error `visitor` will be cast to ExplodedVisitor by this function\n visitor._exploded = true;\n\n // normalise pipes\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n const parts: Array<string> = nodeType.split(\"|\");\n if (parts.length === 1) continue;\n\n const fns = visitor[nodeType];\n delete visitor[nodeType];\n\n for (const part of parts) {\n // @ts-expect-error part will be verified by `verify` later\n visitor[part] = fns;\n }\n }\n\n // verify data structure\n verify$1(visitor);\n\n // make sure there's no __esModule type since this is because we're using loose mode\n // and it sets __esModule to be enumerable on all modules :(\n // @ts-expect-error ESModule interop\n delete visitor.__esModule;\n\n // ensure visitors are objects\n ensureEntranceObjects(visitor);\n\n // ensure enter/exit callbacks are arrays\n ensureCallbackArrays(visitor);\n\n // add type wrappers\n for (const nodeType of Object.keys(visitor)) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n if (!isVirtualType(nodeType)) continue;\n\n // wrap all the functions\n const fns = visitor[nodeType]!;\n for (const type of Object.keys(fns)) {\n // @ts-expect-error normalised as VisitNodeObject\n fns[type] = wrapCheck(nodeType, fns[type]);\n }\n\n // clear it from the visitor\n delete visitor[nodeType];\n\n const types = virtualTypes[nodeType];\n if (types !== null) {\n for (const type of types) {\n // @ts-expect-error Expression produces too complex union\n visitor[type] ??= {};\n mergePair(visitor[type], fns);\n }\n } else {\n mergePair(visitor, fns);\n }\n }\n\n // add aliases\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n let aliases = FLIPPED_ALIAS_KEYS[nodeType];\n\n if (nodeType in DEPRECATED_KEYS) {\n const deprecatedKey = DEPRECATED_KEYS[nodeType];\n deprecationWarning(nodeType, deprecatedKey, \"Visitor \");\n aliases = [deprecatedKey];\n } else if (nodeType in DEPRECATED_ALIASES) {\n const deprecatedAlias =\n DEPRECATED_ALIASES[nodeType as keyof typeof DEPRECATED_ALIASES];\n deprecationWarning(nodeType, deprecatedAlias, \"Visitor \");\n aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias];\n }\n\n if (!aliases) continue;\n\n const fns = visitor[nodeType];\n // clear it from the visitor\n delete visitor[nodeType];\n\n for (const alias of aliases) {\n const existing = visitor[alias];\n if (existing) {\n mergePair(existing, fns);\n } else {\n visitor[alias] = { ...fns };\n }\n }\n }\n\n for (const nodeType of Object.keys(visitor)) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n ensureCallbackArrays(\n // @ts-expect-error nodeType must present in visitor after previous validations\n visitor[nodeType],\n );\n }\n\n // @ts-expect-error explosion has been performed\n return visitor as ExplodedVisitor;\n}\n\n// We need to name this function `verify$1` because otherwise rollup-plugin-dts\n// will generate a `namespace traverse { var verify: typeof verify; }` when\n// bundling @babel/traverse's index.d.ts.\n// TODO: Just call it `verify` once https://github.com/Swatinem/rollup-plugin-dts/issues/307\n// is fixed.\nexport { verify$1 as verify };\nfunction verify$1(visitor: Visitor) {\n // @ts-expect-error _verified is not defined on non-verified Visitor.\n // TODO: unify _verified and _exploded.\n if (visitor._verified) return;\n\n if (typeof visitor === \"function\") {\n throw new Error(\n \"You passed `traverse()` a function when it expected a visitor object, \" +\n \"are you sure you didn't mean `{ enter: Function }`?\",\n );\n }\n\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (nodeType === \"enter\" || nodeType === \"exit\") {\n validateVisitorMethods(nodeType, visitor[nodeType]);\n }\n\n if (shouldIgnoreKey(nodeType)) continue;\n\n if (!TYPES.includes(nodeType)) {\n throw new Error(\n `You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${PACKAGE_JSON.version}`,\n );\n }\n\n const visitors = visitor[nodeType];\n if (typeof visitors === \"object\") {\n for (const visitorKey of Object.keys(visitors)) {\n if (visitorKey === \"enter\" || visitorKey === \"exit\") {\n // verify that it just contains functions\n validateVisitorMethods(\n `${nodeType}.${visitorKey}`,\n visitors[visitorKey],\n );\n } else {\n throw new Error(\n \"You passed `traverse()` a visitor object with the property \" +\n `${nodeType} that has the invalid property ${visitorKey}`,\n );\n }\n }\n }\n }\n\n // @ts-expect-error _verified is not defined on non-verified Visitor.\n // TODO: unify _verified and _exploded.\n visitor._verified = true;\n}\n\nfunction validateVisitorMethods(\n path: string,\n val: any,\n): asserts val is Function | Function[] {\n const fns = [].concat(val);\n for (const fn of fns) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\n `Non-function found defined in ${path} with type ${typeof fn}`,\n );\n }\n }\n}\n\nexport function merge<State>(\n visitors: Visitor<State>[],\n): ExplodedVisitor<State>;\nexport function merge(\n visitors: Visitor<unknown>[],\n states?: any[],\n wrapper?: Function | null,\n): ExplodedVisitor<unknown>;\nexport function merge(\n visitors: any[],\n states: any[] = [],\n wrapper?: VisitWrapper | null,\n): ExplodedVisitor {\n const mergedVisitor: ExplodedVisitor = { _verified: true, _exploded: true };\n if (!process.env.BABEL_8_BREAKING) {\n // For compatibility with old Babel versions, we must hide _verified and _exploded.\n // Otherwise, old versions of the validator will throw sayng that `true` is not\n // a function, because it tries to validate it as a visitor.\n Object.defineProperty(mergedVisitor, \"_exploded\", { enumerable: false });\n Object.defineProperty(mergedVisitor, \"_verified\", { enumerable: false });\n }\n\n for (let i = 0; i < visitors.length; i++) {\n const visitor = explode$1(visitors[i]);\n const state = states[i];\n\n let topVisitor: ExplVisitNode<unknown, Node> = visitor;\n if (state || wrapper) {\n topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper);\n }\n mergePair(mergedVisitor, topVisitor);\n\n for (const key of Object.keys(visitor) as (keyof ExplodedVisitor)[]) {\n if (shouldIgnoreKey(key)) continue;\n\n let typeVisitor = visitor[key]!;\n\n // if we have state or wrapper then overload the callbacks to take it\n if (state || wrapper) {\n typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper);\n }\n\n const nodeVisitor = (mergedVisitor[key] ||= {});\n mergePair(nodeVisitor, typeVisitor);\n }\n }\n\n return mergedVisitor;\n}\n\nfunction wrapWithStateOrWrapper<State>(\n oldVisitor: ExplVisitNode<State, Node>,\n state: State | null,\n wrapper?: VisitWrapper<State> | null,\n): ExplVisitNode<State, Node> {\n const newVisitor: ExplVisitNode<State, Node> = {};\n\n for (const phase of [\"enter\", \"exit\"] as VisitPhase[]) {\n let fns = oldVisitor[phase];\n\n // not an enter/exit array of callbacks\n if (!Array.isArray(fns)) continue;\n\n fns = fns.map(function (fn) {\n let newFn = fn;\n\n if (state) {\n newFn = function (path: NodePath<Node>) {\n fn.call(state, path, state);\n };\n }\n\n if (wrapper) {\n // @ts-expect-error Fixme: actually PluginPass.key (aka pluginAlias)?\n newFn = wrapper(state?.key, phase, newFn);\n }\n\n // Override toString in case this function is printed, we want to print the wrapped function, same as we do in `wrapCheck`\n if (newFn !== fn) {\n newFn.toString = () => fn.toString();\n }\n\n return newFn;\n });\n\n newVisitor[phase] = fns;\n }\n\n return newVisitor;\n}\n\nfunction ensureEntranceObjects(obj: Visitor) {\n for (const key of Object.keys(obj) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(key)) continue;\n\n const fns = obj[key];\n if (typeof fns === \"function\") {\n // @ts-expect-error: Expression produces a union type that is too complex to represent.\n obj[key] = { enter: fns };\n }\n }\n}\n\nfunction ensureCallbackArrays(obj: Visitor) {\n if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];\n if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];\n}\n\nfunction wrapCheck(nodeType: VIRTUAL_TYPES, fn: Function) {\n const fnKey = `is${nodeType}`;\n // @ts-expect-error we know virtualTypesValidators will contain `fnKey`, but TS doesn't\n const validator = virtualTypesValidators[fnKey];\n const newFn = function (this: unknown, path: NodePath) {\n if (validator.call(path)) {\n return fn.apply(this, arguments);\n }\n };\n newFn.toString = () => fn.toString();\n return newFn;\n}\n\nfunction shouldIgnoreKey(key: string): key is\n | `_${string}` // ` // Comment to fix syntax highlighting in vscode\n | \"enter\"\n | \"exit\"\n | \"shouldSkip\"\n | \"denylist\"\n | \"noScope\"\n | \"skipKeys\"\n | \"blacklist\" {\n // internal/hidden key\n if (key[0] === \"_\") return true;\n\n // ignore function keys\n if (key === \"enter\" || key === \"exit\" || key === \"shouldSkip\") return true;\n\n // ignore other options\n if (key === \"denylist\" || key === \"noScope\" || key === \"skipKeys\") {\n return true;\n }\n\n if (!process.env.BABEL_8_BREAKING) {\n if (key === \"blacklist\") {\n return true;\n }\n }\n\n return false;\n}\n\n/*\nfunction mergePair(\n dest: ExplVisitNode<unknown, Node>,\n src: ExplVisitNode<unknown, Node>,\n);\n*/\nfunction mergePair(dest: any, src: any) {\n for (const phase of [\"enter\", \"exit\"] as VisitPhase[]) {\n if (!src[phase]) continue;\n dest[phase] = [].concat(dest[phase] || [], src[phase]);\n }\n}\n\n// environmentVisitor should be used when traversing the whole class and not for specific class elements/methods.\n// For perf reasons, the environmentVisitor might be traversed with `{ noScope: true }`, which means `path.scope` is undefined.\n// Avoid using `path.scope` here\nconst _environmentVisitor: Visitor = {\n FunctionParent(path) {\n // arrows are not skipped because they inherit the context.\n if (path.isArrowFunctionExpression()) return;\n\n path.skip();\n if (path.isMethod()) {\n if (\n !process.env.BABEL_8_BREAKING &&\n !path.requeueComputedKeyAndDecorators\n ) {\n // See https://github.com/babel/babel/issues/16694\n requeueComputedKeyAndDecorators.call(path);\n } else {\n path.requeueComputedKeyAndDecorators();\n }\n }\n },\n Property(path) {\n if (path.isObjectProperty()) return;\n path.skip();\n if (\n !process.env.BABEL_8_BREAKING &&\n !path.requeueComputedKeyAndDecorators\n ) {\n // See https://github.com/babel/babel/issues/16694\n requeueComputedKeyAndDecorators.call(path);\n } else {\n path.requeueComputedKeyAndDecorators();\n }\n },\n};\n\nexport function environmentVisitor<S>(visitor: Visitor<S>): Visitor<S> {\n return merge([_environmentVisitor, visitor]);\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,EAAA,GAAAF,OAAA;AASA,IAAAG,QAAA,GAAAH,OAAA;AAAoE;EARlEI,eAAe;EACfC,kBAAkB;EAClBC,kBAAkB;EAClBC,KAAK;EACLC,8BAA8B,EAAIC;AAAkB,IAAAP,EAAA;AAOtD,SAASQ,aAAaA,CAACC,IAAY,EAAyB;EAC1D,OAAOA,IAAI,IAAIZ,YAAY;AAC7B;AAOO,SAASa,iBAAiBA,CAC/BC,OAAgB,EACY;EAE5B,OAAOA,OAAO,oBAAPA,OAAO,CAAEC,SAAS;AAC3B;AAuBA,SAASC,SAASA,CAAIF,OAAmB,EAAsB;EAC7D,IAAID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AAC,CAAC;MACxC;IACF;EACF,CAAC;EACDC,QAAQA,CAAC1C,IAAI,EAAE;IACb,IAAIA,IAAI,CAAC2C,gBAAgB,CAAC,CAAC,EAAE;IAC7B3C,IAAI,CAACuC,IAAI,CAAC,CAAC;IACX,IAEE,CAACvC,IAAI,CAACyC,+BAA+B,EACrC;MAEAA,wCAA+B,CAAChB,IAAI,CAACzB,IAAI,CAAC;IAC5C,CAAC,MAAM;MACLA,IAAI,CAACyC,+BAA+B,CAAC,CAAC;IACxC;EACF;AACF,CAAC;AAEM,SAASG,kBAAkBA,CAAI5E,OAAmB,EAAc;EACrE,OAAOqC,KAAK,CAAC,CAAC+B,mBAAmB,EAAEpE,OAAO,CAAC,CAAC;AAC9C","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["virtualTypes","require","virtualTypesValidators","_t","_context","DEPRECATED_KEYS","DEPRECATED_ALIASES","FLIPPED_ALIAS_KEYS","TYPES","__internal__deprecationWarning","deprecationWarning","isVirtualType","type","isExplodedVisitor","visitor","_exploded","explode$1","nodeType","Object","keys","shouldIgnoreKey","parts","split","length","fns","part","verify$1","__esModule","ensureEntranceObjects","ensureCallbackArrays","wrapCheck","types","_visitor$type","mergePair","aliases","deprecatedKey","deprecatedAlias","alias","existing","assign","_verified","Error","validateVisitorMethods","includes","visitors","visitorKey","path","val","concat","fn","TypeError","merge","states","wrapper","mergedVisitor","defineProperty","enumerable","i","state","topVisitor","wrapWithStateOrWrapper","key","typeVisitor","nodeVisitor","oldVisitor","newVisitor","phase","Array","isArray","map","newFn","call","toString","obj","enter","exit","fnKey","validator","apply","arguments","startsWith","dest","src","_environmentVisitor","FunctionParent","isArrowFunctionExpression","skip","isMethod","requeueComputedKeyAndDecorators","Property","isObjectProperty","environmentVisitor"],"sources":["../src/visitors.ts"],"sourcesContent":["import * as virtualTypes from \"./path/lib/virtual-types.ts\";\nimport * as virtualTypesValidators from \"./path/lib/virtual-types-validator.ts\";\nimport type { Node } from \"@babel/types\";\nimport {\n DEPRECATED_KEYS,\n DEPRECATED_ALIASES,\n FLIPPED_ALIAS_KEYS,\n TYPES,\n __internal__deprecationWarning as deprecationWarning,\n} from \"@babel/types\";\nimport type { ExplodedVisitor, NodePath, Visitor } from \"./index.ts\";\nimport type { ExplVisitNode, VisitNodeFunction, VisitPhase } from \"./types.ts\";\nimport { requeueComputedKeyAndDecorators } from \"./path/context.ts\";\n\ntype VIRTUAL_TYPES = keyof typeof virtualTypes;\nfunction isVirtualType(type: string): type is VIRTUAL_TYPES {\n return type in virtualTypes;\n}\nexport type VisitWrapper<S = any> = (\n stateName: string | undefined,\n visitorType: VisitPhase,\n callback: VisitNodeFunction<S, Node>,\n) => VisitNodeFunction<S, Node>;\n\nexport function isExplodedVisitor(\n visitor: Visitor,\n): visitor is ExplodedVisitor {\n // @ts-expect-error _exploded is not defined on non-exploded Visitor\n return visitor?._exploded;\n}\n\n// We need to name this function `explode$1` because otherwise rollup-plugin-dts\n// will generate a `namespace traverse { var explode: typeof explode; }` when\n// bundling @babel/traverse's index.d.ts.\n// TODO: Just call it `explode` once https://github.com/Swatinem/rollup-plugin-dts/issues/307\n// is fixed.\nexport { explode$1 as explode };\n/**\n * explode() will take a visitor object with all of the various shorthands\n * that we support, and validates & normalizes it into a common format, ready\n * to be used in traversal\n *\n * The various shorthands are:\n * * `Identifier() { ... }` -> `Identifier: { enter() { ... } }`\n * * `\"Identifier|NumericLiteral\": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }`\n * * Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }`\n * Other normalizations are:\n * * Visitors of virtual types are wrapped, so that they are only visited when\n * their dynamic check passes\n * * `enter` and `exit` functions are wrapped in arrays, to ease merging of\n * visitors\n */\nfunction explode$1<S>(visitor: Visitor<S>): ExplodedVisitor<S> {\n if (isExplodedVisitor(visitor)) return visitor;\n // @ts-expect-error `visitor` will be cast to ExplodedVisitor by this function\n visitor._exploded = true;\n\n // normalise pipes\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n const parts: string[] = nodeType.split(\"|\");\n if (parts.length === 1) continue;\n\n const fns = visitor[nodeType];\n delete visitor[nodeType];\n\n for (const part of parts) {\n // @ts-expect-error part will be verified by `verify` later\n visitor[part] = fns;\n }\n }\n\n // verify data structure\n verify$1(visitor);\n\n // make sure there's no __esModule type since this is because we're using loose mode\n // and it sets __esModule to be enumerable on all modules :(\n // @ts-expect-error ESModule interop\n delete visitor.__esModule;\n\n // ensure visitors are objects\n ensureEntranceObjects(visitor);\n\n // ensure enter/exit callbacks are arrays\n ensureCallbackArrays(visitor);\n\n // add type wrappers\n for (const nodeType of Object.keys(visitor)) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n if (!isVirtualType(nodeType)) continue;\n\n // wrap all the functions\n const fns = visitor[nodeType]!;\n for (const type of Object.keys(fns)) {\n // @ts-expect-error normalised as VisitNodeObject\n fns[type] = wrapCheck(nodeType, fns[type]);\n }\n\n // clear it from the visitor\n delete visitor[nodeType];\n\n const types = virtualTypes[nodeType];\n if (types !== null) {\n for (const type of types) {\n // @ts-expect-error Expression produces too complex union\n visitor[type] ??= {};\n mergePair(visitor[type], fns);\n }\n } else {\n mergePair(visitor, fns);\n }\n }\n\n // add aliases\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n let aliases = FLIPPED_ALIAS_KEYS[nodeType];\n\n if (nodeType in DEPRECATED_KEYS) {\n const deprecatedKey = DEPRECATED_KEYS[nodeType];\n deprecationWarning(nodeType, deprecatedKey, \"Visitor \");\n aliases = [deprecatedKey];\n } else if (nodeType in DEPRECATED_ALIASES) {\n const deprecatedAlias =\n DEPRECATED_ALIASES[nodeType as keyof typeof DEPRECATED_ALIASES];\n deprecationWarning(nodeType, deprecatedAlias, \"Visitor \");\n aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias];\n }\n\n if (!aliases) continue;\n\n const fns = visitor[nodeType];\n // clear it from the visitor\n delete visitor[nodeType];\n\n for (const alias of aliases) {\n const existing = visitor[alias];\n if (existing) {\n mergePair(existing, fns);\n } else {\n visitor[alias] = { ...fns };\n }\n }\n }\n\n for (const nodeType of Object.keys(visitor)) {\n if (shouldIgnoreKey(nodeType)) continue;\n\n ensureCallbackArrays(\n // @ts-expect-error nodeType must present in visitor after previous validations\n visitor[nodeType],\n );\n }\n\n // @ts-expect-error explosion has been performed\n return visitor as ExplodedVisitor;\n}\n\n// We need to name this function `verify$1` because otherwise rollup-plugin-dts\n// will generate a `namespace traverse { var verify: typeof verify; }` when\n// bundling @babel/traverse's index.d.ts.\n// TODO: Just call it `verify` once https://github.com/Swatinem/rollup-plugin-dts/issues/307\n// is fixed.\nexport { verify$1 as verify };\nfunction verify$1(visitor: Visitor) {\n // @ts-expect-error _verified is not defined on non-verified Visitor.\n // TODO: unify _verified and _exploded.\n if (visitor._verified) return;\n\n if (typeof visitor === \"function\") {\n throw new Error(\n \"You passed `traverse()` a function when it expected a visitor object, \" +\n \"are you sure you didn't mean `{ enter: Function }`?\",\n );\n }\n\n for (const nodeType of Object.keys(visitor) as (keyof Visitor)[]) {\n if (nodeType === \"enter\" || nodeType === \"exit\") {\n validateVisitorMethods(nodeType, visitor[nodeType]);\n }\n\n if (shouldIgnoreKey(nodeType)) continue;\n\n if (!TYPES.includes(nodeType)) {\n throw new Error(\n `You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${PACKAGE_JSON.version}`,\n );\n }\n\n const visitors = visitor[nodeType];\n if (typeof visitors === \"object\") {\n for (const visitorKey of Object.keys(visitors)) {\n if (visitorKey === \"enter\" || visitorKey === \"exit\") {\n // verify that it just contains functions\n validateVisitorMethods(\n `${nodeType}.${visitorKey}`,\n visitors[visitorKey],\n );\n } else {\n throw new Error(\n \"You passed `traverse()` a visitor object with the property \" +\n `${nodeType} that has the invalid property ${visitorKey}`,\n );\n }\n }\n }\n }\n\n // @ts-expect-error _verified is not defined on non-verified Visitor.\n // TODO: unify _verified and _exploded.\n visitor._verified = true;\n}\n\nfunction validateVisitorMethods(\n path: string,\n val: any,\n): asserts val is Function | Function[] {\n const fns = [].concat(val);\n for (const fn of fns) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\n `Non-function found defined in ${path} with type ${typeof fn}`,\n );\n }\n }\n}\n\nexport function merge<State>(\n visitors: Visitor<State>[],\n): ExplodedVisitor<State>;\nexport function merge(\n visitors: Visitor<unknown>[],\n states?: any[],\n wrapper?: Function | null,\n): ExplodedVisitor<unknown>;\nexport function merge(\n visitors: any[],\n states: any[] = [],\n wrapper?: VisitWrapper | null,\n): ExplodedVisitor {\n const mergedVisitor: ExplodedVisitor = { _verified: true, _exploded: true };\n if (!process.env.BABEL_8_BREAKING) {\n // For compatibility with old Babel versions, we must hide _verified and _exploded.\n // Otherwise, old versions of the validator will throw sayng that `true` is not\n // a function, because it tries to validate it as a visitor.\n Object.defineProperty(mergedVisitor, \"_exploded\", { enumerable: false });\n Object.defineProperty(mergedVisitor, \"_verified\", { enumerable: false });\n }\n\n for (let i = 0; i < visitors.length; i++) {\n const visitor = explode$1(visitors[i]);\n const state = states[i];\n\n let topVisitor: ExplVisitNode<unknown, Node> = visitor;\n if (state || wrapper) {\n topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper);\n }\n mergePair(mergedVisitor, topVisitor);\n\n for (const key of Object.keys(visitor) as (keyof ExplodedVisitor)[]) {\n if (shouldIgnoreKey(key)) continue;\n\n let typeVisitor = visitor[key]!;\n\n // if we have state or wrapper then overload the callbacks to take it\n if (state || wrapper) {\n typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper);\n }\n\n const nodeVisitor = (mergedVisitor[key] ||= {});\n mergePair(nodeVisitor, typeVisitor);\n }\n }\n\n return mergedVisitor;\n}\n\nfunction wrapWithStateOrWrapper<State>(\n oldVisitor: ExplVisitNode<State, Node>,\n state: State | null,\n wrapper?: VisitWrapper<State> | null,\n): ExplVisitNode<State, Node> {\n const newVisitor: ExplVisitNode<State, Node> = {};\n\n for (const phase of [\"enter\", \"exit\"] as VisitPhase[]) {\n let fns = oldVisitor[phase];\n\n // not an enter/exit array of callbacks\n if (!Array.isArray(fns)) continue;\n\n fns = fns.map(function (fn) {\n let newFn = fn;\n\n if (state) {\n newFn = function (path: NodePath<Node>) {\n fn.call(state, path, state);\n };\n }\n\n if (wrapper) {\n // @ts-expect-error Fixme: actually PluginPass.key (aka pluginAlias)?\n newFn = wrapper(state?.key, phase, newFn);\n }\n\n // Override toString in case this function is printed, we want to print the wrapped function, same as we do in `wrapCheck`\n if (newFn !== fn) {\n newFn.toString = () => fn.toString();\n }\n\n return newFn;\n });\n\n newVisitor[phase] = fns;\n }\n\n return newVisitor;\n}\n\nfunction ensureEntranceObjects(obj: Visitor) {\n for (const key of Object.keys(obj) as (keyof Visitor)[]) {\n if (shouldIgnoreKey(key)) continue;\n\n const fns = obj[key];\n if (typeof fns === \"function\") {\n // @ts-expect-error: Expression produces a union type that is too complex to represent.\n obj[key] = { enter: fns };\n }\n }\n}\n\nfunction ensureCallbackArrays(obj: Visitor) {\n if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];\n if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];\n}\n\nfunction wrapCheck(nodeType: VIRTUAL_TYPES, fn: Function) {\n const fnKey = `is${nodeType}`;\n // @ts-expect-error we know virtualTypesValidators will contain `fnKey`, but TS doesn't\n const validator = virtualTypesValidators[fnKey];\n const newFn = function (this: unknown, path: NodePath) {\n if (validator.call(path)) {\n return fn.apply(this, arguments);\n }\n };\n newFn.toString = () => fn.toString();\n return newFn;\n}\n\nfunction shouldIgnoreKey(key: string): key is\n | `_${string}` // ` // Comment to fix syntax highlighting in vscode\n | \"enter\"\n | \"exit\"\n | \"shouldSkip\"\n | \"denylist\"\n | \"noScope\"\n | \"skipKeys\"\n | \"blacklist\" {\n // internal/hidden key\n if (key.startsWith(\"_\")) return true;\n\n // ignore function keys\n if (key === \"enter\" || key === \"exit\" || key === \"shouldSkip\") return true;\n\n // ignore other options\n if (key === \"denylist\" || key === \"noScope\" || key === \"skipKeys\") {\n return true;\n }\n\n if (!process.env.BABEL_8_BREAKING) {\n if (key === \"blacklist\") {\n return true;\n }\n }\n\n return false;\n}\n\n/*\nfunction mergePair(\n dest: ExplVisitNode<unknown, Node>,\n src: ExplVisitNode<unknown, Node>,\n);\n*/\nfunction mergePair(dest: any, src: any) {\n for (const phase of [\"enter\", \"exit\"] as VisitPhase[]) {\n if (!src[phase]) continue;\n dest[phase] = [].concat(dest[phase] || [], src[phase]);\n }\n}\n\n// environmentVisitor should be used when traversing the whole class and not for specific class elements/methods.\n// For perf reasons, the environmentVisitor might be traversed with `{ noScope: true }`, which means `path.scope` is undefined.\n// Avoid using `path.scope` here\nconst _environmentVisitor: Visitor = {\n FunctionParent(path) {\n // arrows are not skipped because they inherit the context.\n if (path.isArrowFunctionExpression()) return;\n\n path.skip();\n if (path.isMethod()) {\n if (\n !process.env.BABEL_8_BREAKING &&\n !path.requeueComputedKeyAndDecorators\n ) {\n // See https://github.com/babel/babel/issues/16694\n requeueComputedKeyAndDecorators.call(path);\n } else {\n path.requeueComputedKeyAndDecorators();\n }\n }\n },\n Property(path) {\n if (path.isObjectProperty()) return;\n path.skip();\n if (\n !process.env.BABEL_8_BREAKING &&\n !path.requeueComputedKeyAndDecorators\n ) {\n // See https://github.com/babel/babel/issues/16694\n requeueComputedKeyAndDecorators.call(path);\n } else {\n path.requeueComputedKeyAndDecorators();\n }\n },\n};\n\nexport function environmentVisitor<S>(visitor: Visitor<S>): Visitor<S> {\n return merge([_environmentVisitor, visitor]);\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,EAAA,GAAAF,OAAA;AASA,IAAAG,QAAA,GAAAH,OAAA;AAAoE;EARlEI,eAAe;EACf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,EAAE;IAEnB,IAAIA,IAAI,CAACuC,yBAAyB,CAAC,CAAC,EAAE;IAEtCvC,IAAI,CAACwC,IAAI,CAAC,CAAC;IACX,IAAIxC,IAAI,CAACyC,QAAQ,CAAC,CAAC,EAAE;MACnB,IAEE,CAACzC,IAAI,CAAC0C,+BAA+B,EACrC;QAEAA,wCAA+B,CAACjB,IAAI,CAACzB,IAAI,CAAC;MAC5C,CAAC,MAAM;QACLA,IAAI,CAAC0C,+BAA+B,CAAC,CAAC;MACxC;IACF;EACF,CAAC;EACDC,QAAQA,CAAC3C,IAAI,EAAE;IACb,IAAIA,IAAI,CAAC4C,gBAAgB,CAAC,CAAC,EAAE;IAC7B5C,IAAI,CAACwC,IAAI,CAAC,CAAC;IACX,IAEE,CAACxC,IAAI,CAAC0C,+BAA+B,EACrC;MAEAA,wCAA+B,CAACjB,IAAI,CAACzB,IAAI,CAAC;IAC5C,CAAC,MAAM;MACLA,IAAI,CAAC0C,+BAA+B,CAAC,CAAC;IACxC;EACF;AACF,CAAC;AAEM,SAASG,kBAAkBA,CAAI7E,OAAmB,EAAc;EACrE,OAAOqC,KAAK,CAAC,CAACgC,mBAAmB,EAAErE,OAAO,CAAC,CAAC;AAC9C","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babel/traverse",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.29.0",
|
|
4
4
|
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
|
5
5
|
"author": "The Babel Team (https://babel.dev/team)",
|
|
6
6
|
"homepage": "https://babel.dev/docs/en/next/babel-traverse",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
},
|
|
17
17
|
"main": "./lib/index.js",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@babel/code-frame": "^7.
|
|
20
|
-
"@babel/generator": "^7.
|
|
19
|
+
"@babel/code-frame": "^7.29.0",
|
|
20
|
+
"@babel/generator": "^7.29.0",
|
|
21
21
|
"@babel/helper-globals": "^7.28.0",
|
|
22
|
-
"@babel/parser": "^7.
|
|
23
|
-
"@babel/template": "^7.
|
|
24
|
-
"@babel/types": "^7.
|
|
22
|
+
"@babel/parser": "^7.29.0",
|
|
23
|
+
"@babel/template": "^7.28.6",
|
|
24
|
+
"@babel/types": "^7.29.0",
|
|
25
25
|
"debug": "^4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/core": "^7.
|
|
28
|
+
"@babel/core": "^7.29.0",
|
|
29
29
|
"@babel/helper-plugin-test-runner": "^7.27.1"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|