@babel/traverse 7.26.3 → 7.26.5

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.
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports._call = _call;
7
- exports._forceSetScope = _forceSetScope;
8
7
  exports._getQueueContexts = _getQueueContexts;
9
8
  exports._resyncKey = _resyncKey;
10
9
  exports._resyncList = _resyncList;
@@ -109,20 +108,6 @@ function skipKey(key) {
109
108
  function stop() {
110
109
  this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP;
111
110
  }
112
- function _forceSetScope(current) {
113
- var _current$scope;
114
- let path = current.parentPath;
115
- if ((current.key === "key" || current.listKey === "decorators") && path.isMethod() || current.key === "discriminant" && path.isSwitchStatement()) {
116
- path = path.parentPath;
117
- }
118
- let target;
119
- while (path && !target) {
120
- target = path.scope;
121
- path = path.parentPath;
122
- }
123
- current.scope = current.getScope(target);
124
- (_current$scope = current.scope) == null || _current$scope.init();
125
- }
126
111
  function setScope() {
127
112
  var _this$opts2, _this$scope;
128
113
  if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return;
@@ -1 +1 @@
1
- {"version":3,"names":["_traverseNode","require","_index","_removal","t","call","key","opts","debug","node","_call","_opts$this$node$type","type","fns","fn","ret","state","then","Error","_traverseFlags","isDenylisted","_this$opts$denylist","denylist","blacklist","includes","exports","isBlacklisted","restoreContext","path","context","visit","_this$opts$shouldSkip","_this$opts","shouldSkip","currentContext","shouldStop","traverseNode","scope","skipKeys","skip","skipKey","stop","SHOULD_SKIP","SHOULD_STOP","_forceSetScope","current","_current$scope","parentPath","listKey","isMethod","isSwitchStatement","target","getScope","init","setScope","_this$opts2","_this$scope","noScope","_path$opts","setContext","resync","removed","_resyncParent","_resyncList","_resyncKey","parent","container","Array","isArray","i","length","setKey","Object","keys","inList","newContainer","_resyncRemoved","_markRemoved","popContext","contexts","pop","undefined","pushContext","push","setup","_this$node","requeue","pathToQueue","maybeQueue","requeueComputedKeyAndDecorators","isPrivate","computed","get","decorators","decorator","_getQueueContexts"],"sources":["../../src/path/context.ts"],"sourcesContent":["// This file contains methods responsible for maintaining a TraversalContext.\n\nimport { traverseNode } from \"../traverse-node.ts\";\nimport { SHOULD_SKIP, SHOULD_STOP } from \"./index.ts\";\nimport { _markRemoved } from \"./removal.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { VisitPhase } from \"../types.ts\";\nimport type NodePath from \"./index.ts\";\nimport * as t from \"@babel/types\";\n\nexport function call(this: NodePath, key: VisitPhase): boolean {\n const opts = this.opts;\n\n this.debug(key);\n\n if (this.node) {\n if (_call.call(this, opts[key])) return true;\n }\n\n if (this.node) {\n return _call.call(this, opts[this.node.type]?.[key]);\n }\n\n return false;\n}\n\nexport function _call(this: NodePath, fns?: Array<Function>): boolean {\n if (!fns) return false;\n\n for (const fn of fns) {\n if (!fn) continue;\n\n const node = this.node;\n if (!node) return true;\n\n const ret = fn.call(this.state, this, this.state);\n if (ret && typeof ret === \"object\" && typeof ret.then === \"function\") {\n throw new Error(\n `You appear to be using a plugin with an async traversal visitor, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n if (ret) {\n throw new Error(`Unexpected return value from visitor method ${fn}`);\n }\n\n // node has been replaced, it will have been requeued\n if (this.node !== node) return true;\n\n // this.shouldSkip || this.shouldStop || this.removed\n if (this._traverseFlags > 0) return true;\n }\n\n return false;\n}\n\nexport function isDenylisted(this: NodePath): boolean {\n // @ts-expect-error TODO(Babel 8): Remove blacklist\n const denylist = this.opts.denylist ?? this.opts.blacklist;\n return denylist?.includes(this.node.type);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n // eslint-disable-next-line no-restricted-globals\n exports.isBlacklisted = isDenylisted;\n}\n\nfunction restoreContext(path: NodePath, context: TraversalContext) {\n if (path.context !== context) {\n path.context = context;\n path.state = context.state;\n path.opts = context.opts;\n }\n}\n\nexport function visit(this: NodePath): boolean {\n if (!this.node) {\n return false;\n }\n\n if (this.isDenylisted()) {\n return false;\n }\n\n if (this.opts.shouldSkip?.(this)) {\n return false;\n }\n\n const currentContext = this.context;\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 (this.shouldSkip || call.call(this, \"enter\")) {\n this.debug(\"Skip...\");\n return this.shouldStop;\n }\n restoreContext(this, currentContext);\n\n this.debug(\"Recursing into...\");\n this.shouldStop = traverseNode(\n this.node,\n this.opts,\n this.scope,\n this.state,\n this,\n this.skipKeys,\n );\n\n restoreContext(this, currentContext);\n\n call.call(this, \"exit\");\n\n return this.shouldStop;\n}\n\nexport function skip(this: NodePath) {\n this.shouldSkip = true;\n}\n\nexport function skipKey(this: NodePath, key: string) {\n if (this.skipKeys == null) {\n this.skipKeys = {};\n }\n this.skipKeys[key] = true;\n}\n\nexport function stop(this: NodePath) {\n // this.shouldSkip = true; this.shouldStop = true;\n this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP;\n}\n\nexport function _forceSetScope(current: NodePath) {\n let path = current.parentPath;\n\n if (\n // Skip method scope if is computed method key or decorator expression\n ((current.key === \"key\" || current.listKey === \"decorators\") &&\n path.isMethod()) ||\n // Skip switch scope if for discriminant (`x` in `switch (x) {}`).\n (current.key === \"discriminant\" && path.isSwitchStatement())\n ) {\n path = path.parentPath;\n }\n\n let target;\n while (path && !target) {\n target = path.scope;\n path = path.parentPath;\n }\n\n current.scope = current.getScope(target);\n current.scope?.init();\n}\n\nexport function setScope(this: NodePath) {\n if (this.opts?.noScope) return;\n\n let path = this.parentPath;\n\n if (\n // Skip method scope if is computed method key or decorator expression\n ((this.key === \"key\" || this.listKey === \"decorators\") &&\n path.isMethod()) ||\n // Skip switch scope if for discriminant (`x` in `switch (x) {}`).\n (this.key === \"discriminant\" && path.isSwitchStatement())\n ) {\n path = path.parentPath;\n }\n\n let target;\n while (path && !target) {\n if (path.opts?.noScope) return;\n\n target = path.scope;\n path = path.parentPath;\n }\n\n this.scope = this.getScope(target);\n this.scope?.init();\n}\n\nexport function setContext<S = unknown>(\n this: NodePath,\n context?: TraversalContext<S>,\n) {\n if (this.skipKeys != null) {\n this.skipKeys = {};\n }\n // this.shouldSkip = false; this.shouldStop = false; this.removed = false;\n this._traverseFlags = 0;\n\n if (context) {\n this.context = context;\n this.state = context.state;\n // Discard the S type parameter from context.opts\n this.opts = context.opts as typeof this.opts;\n }\n\n setScope.call(this);\n\n return this;\n}\n\n/**\n * Here we resync the node paths `key` and `container`. If they've changed according\n * to what we have stored internally then we attempt to resync by crawling and looking\n * for the new values.\n */\n\nexport function resync(this: NodePath) {\n if (this.removed) return;\n\n _resyncParent.call(this);\n _resyncList.call(this);\n _resyncKey.call(this);\n //this._resyncRemoved();\n}\n\nexport function _resyncParent(this: NodePath) {\n if (this.parentPath) {\n this.parent = this.parentPath.node;\n }\n}\n\nexport function _resyncKey(this: NodePath) {\n if (!this.container) return;\n\n if (\n this.node ===\n // @ts-expect-error this.key should present in this.container\n this.container[this.key]\n ) {\n return;\n }\n\n // grrr, path key is out of sync. this is likely due to a modification to the AST\n // not done through our path APIs\n\n if (Array.isArray(this.container)) {\n for (let i = 0; i < this.container.length; i++) {\n if (this.container[i] === this.node) {\n setKey.call(this, i);\n return;\n }\n }\n } else {\n for (const key of Object.keys(this.container)) {\n // @ts-expect-error this.key should present in this.container\n if (this.container[key] === this.node) {\n setKey.call(this, key);\n return;\n }\n }\n }\n\n // ¯\\_(ツ)_/¯ who knows where it's gone lol\n this.key = null;\n}\n\nexport function _resyncList(this: NodePath) {\n if (!this.parent || !this.inList) return;\n\n const newContainer =\n // @ts-expect-error this.listKey should present in this.parent\n this.parent[this.listKey];\n if (this.container === newContainer) return;\n\n // container is out of sync. this is likely the result of it being reassigned\n this.container = newContainer || null;\n}\n\nexport function _resyncRemoved(this: NodePath) {\n if (\n this.key == null ||\n !this.container ||\n // @ts-expect-error this.key should present in this.container\n this.container[this.key] !== this.node\n ) {\n _markRemoved.call(this);\n }\n}\n\nexport function popContext(this: NodePath) {\n this.contexts.pop();\n if (this.contexts.length > 0) {\n this.setContext(this.contexts[this.contexts.length - 1]);\n } else {\n this.setContext(undefined);\n }\n}\n\nexport function pushContext(this: NodePath, context: TraversalContext) {\n this.contexts.push(context);\n this.setContext(context);\n}\n\nexport function setup(\n this: NodePath,\n parentPath: NodePath | undefined,\n container: t.Node | t.Node[],\n listKey: string,\n key: string | number,\n) {\n this.listKey = listKey;\n this.container = container;\n\n this.parentPath = parentPath || this.parentPath;\n setKey.call(this, key);\n}\n\nexport function setKey(this: NodePath, key: string | number) {\n this.key = key;\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key];\n this.type = this.node?.type;\n}\n\nexport function requeue(this: NodePath, pathToQueue = this) {\n if (pathToQueue.removed) return;\n\n // If a path is skipped, and then replaced with a\n // new one, the new one shouldn't probably be skipped.\n if (process.env.BABEL_8_BREAKING) {\n pathToQueue.shouldSkip = false;\n }\n\n // TODO(loganfsmyth): This should be switched back to queue in parent contexts\n // automatically once #2892 and #4135 have been resolved. See #4140.\n // let contexts = this._getQueueContexts();\n const contexts = this.contexts;\n\n for (const context of contexts) {\n context.maybeQueue(pathToQueue);\n }\n}\n\nexport function requeueComputedKeyAndDecorators(\n this: NodePath<t.Method | t.Property>,\n) {\n const { context, node } = this;\n if (!t.isPrivate(node) && node.computed) {\n context.maybeQueue(this.get(\"key\"));\n }\n if (node.decorators) {\n for (const decorator of this.get(\"decorators\")) {\n context.maybeQueue(decorator);\n }\n }\n}\n\nexport function _getQueueContexts(this: NodePath) {\n let path = this;\n let contexts = this.contexts;\n while (!contexts.length) {\n path = path.parentPath;\n if (!path) break;\n contexts = path.contexts;\n }\n return contexts;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAE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CAACI,GAAG,CAAC,KAAK,CAAC,CAAC;EACrC;EACA,IAAInF,IAAI,CAACoF,UAAU,EAAE;IACnB,KAAK,MAAMC,SAAS,IAAI,IAAI,CAACF,GAAG,CAAC,YAAY,CAAC,EAAE;MAC9C/D,OAAO,CAAC2D,UAAU,CAACM,SAAS,CAAC;IAC/B;EACF;AACF;AAEO,SAASC,iBAAiBA,CAAA,EAAiB;EAChD,IAAInE,IAAI,GAAG,IAAI;EACf,IAAImD,QAAQ,GAAG,IAAI,CAACA,QAAQ;EAC5B,OAAO,CAACA,QAAQ,CAACT,MAAM,EAAE;IACvB1C,IAAI,GAAGA,IAAI,CAACmB,UAAU;IACtB,IAAI,CAACnB,IAAI,EAAE;IACXmD,QAAQ,GAAGnD,IAAI,CAACmD,QAAQ;EAC1B;EACA,OAAOA,QAAQ;AACjB","ignoreList":[]}
1
+ {"version":3,"names":["_traverseNode","require","_index","_removal","t","call","key","opts","debug","node","_call","_opts$this$node$type","type","fns","fn","ret","state","then","Error","_traverseFlags","isDenylisted","_this$opts$denylist","denylist","blacklist","includes","exports","isBlacklisted","restoreContext","path","context","visit","_this$opts$shouldSkip","_this$opts","shouldSkip","currentContext","shouldStop","traverseNode","scope","skipKeys","skip","skipKey","stop","SHOULD_SKIP","SHOULD_STOP","setScope","_this$opts2","_this$scope","noScope","parentPath","listKey","isMethod","isSwitchStatement","target","_path$opts","getScope","init","setContext","resync","removed","_resyncParent","_resyncList","_resyncKey","parent","container","Array","isArray","i","length","setKey","Object","keys","inList","newContainer","_resyncRemoved","_markRemoved","popContext","contexts","pop","undefined","pushContext","push","setup","_this$node","requeue","pathToQueue","maybeQueue","requeueComputedKeyAndDecorators","isPrivate","computed","get","decorators","decorator","_getQueueContexts"],"sources":["../../src/path/context.ts"],"sourcesContent":["// This file contains methods responsible for maintaining a TraversalContext.\n\nimport { traverseNode } from \"../traverse-node.ts\";\nimport { SHOULD_SKIP, SHOULD_STOP } from \"./index.ts\";\nimport { _markRemoved } from \"./removal.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { VisitPhase } from \"../types.ts\";\nimport type NodePath from \"./index.ts\";\nimport * as t from \"@babel/types\";\n\nexport function call(this: NodePath, key: VisitPhase): boolean {\n const opts = this.opts;\n\n this.debug(key);\n\n if (this.node) {\n if (_call.call(this, opts[key])) return true;\n }\n\n if (this.node) {\n return _call.call(this, opts[this.node.type]?.[key]);\n }\n\n return false;\n}\n\nexport function _call(this: NodePath, fns?: Array<Function>): boolean {\n if (!fns) return false;\n\n for (const fn of fns) {\n if (!fn) continue;\n\n const node = this.node;\n if (!node) return true;\n\n const ret = fn.call(this.state, this, this.state);\n if (ret && typeof ret === \"object\" && typeof ret.then === \"function\") {\n throw new Error(\n `You appear to be using a plugin with an async traversal visitor, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n if (ret) {\n throw new Error(`Unexpected return value from visitor method ${fn}`);\n }\n\n // node has been replaced, it will have been requeued\n if (this.node !== node) return true;\n\n // this.shouldSkip || this.shouldStop || this.removed\n if (this._traverseFlags > 0) return true;\n }\n\n return false;\n}\n\nexport function isDenylisted(this: NodePath): boolean {\n // @ts-expect-error TODO(Babel 8): Remove blacklist\n const denylist = this.opts.denylist ?? this.opts.blacklist;\n return denylist?.includes(this.node.type);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n // eslint-disable-next-line no-restricted-globals\n exports.isBlacklisted = isDenylisted;\n}\n\nfunction restoreContext(path: NodePath, context: TraversalContext) {\n if (path.context !== context) {\n path.context = context;\n path.state = context.state;\n path.opts = context.opts;\n }\n}\n\nexport function visit(this: NodePath): boolean {\n if (!this.node) {\n return false;\n }\n\n if (this.isDenylisted()) {\n return false;\n }\n\n if (this.opts.shouldSkip?.(this)) {\n return false;\n }\n\n const currentContext = this.context;\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 (this.shouldSkip || call.call(this, \"enter\")) {\n this.debug(\"Skip...\");\n return this.shouldStop;\n }\n restoreContext(this, currentContext);\n\n this.debug(\"Recursing into...\");\n this.shouldStop = traverseNode(\n this.node,\n this.opts,\n this.scope,\n this.state,\n this,\n this.skipKeys,\n );\n\n restoreContext(this, currentContext);\n\n call.call(this, \"exit\");\n\n return this.shouldStop;\n}\n\nexport function skip(this: NodePath) {\n this.shouldSkip = true;\n}\n\nexport function skipKey(this: NodePath, key: string) {\n if (this.skipKeys == null) {\n this.skipKeys = {};\n }\n this.skipKeys[key] = true;\n}\n\nexport function stop(this: NodePath) {\n // this.shouldSkip = true; this.shouldStop = true;\n this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP;\n}\n\nexport function setScope(this: NodePath) {\n if (this.opts?.noScope) return;\n\n let path = this.parentPath;\n\n if (\n // Skip method scope if is computed method key or decorator expression\n ((this.key === \"key\" || this.listKey === \"decorators\") &&\n path.isMethod()) ||\n // Skip switch scope if for discriminant (`x` in `switch (x) {}`).\n (this.key === \"discriminant\" && path.isSwitchStatement())\n ) {\n path = path.parentPath;\n }\n\n let target;\n while (path && !target) {\n if (path.opts?.noScope) return;\n\n target = path.scope;\n path = path.parentPath;\n }\n\n this.scope = this.getScope(target);\n this.scope?.init();\n}\n\nexport function setContext<S = unknown>(\n this: NodePath,\n context?: TraversalContext<S>,\n) {\n if (this.skipKeys != null) {\n this.skipKeys = {};\n }\n // this.shouldSkip = false; this.shouldStop = false; this.removed = false;\n this._traverseFlags = 0;\n\n if (context) {\n this.context = context;\n this.state = context.state;\n // Discard the S type parameter from context.opts\n this.opts = context.opts as typeof this.opts;\n }\n\n setScope.call(this);\n\n return this;\n}\n\n/**\n * Here we resync the node paths `key` and `container`. If they've changed according\n * to what we have stored internally then we attempt to resync by crawling and looking\n * for the new values.\n */\n\nexport function resync(this: NodePath) {\n if (this.removed) return;\n\n _resyncParent.call(this);\n _resyncList.call(this);\n _resyncKey.call(this);\n //this._resyncRemoved();\n}\n\nexport function _resyncParent(this: NodePath) {\n if (this.parentPath) {\n this.parent = this.parentPath.node;\n }\n}\n\nexport function _resyncKey(this: NodePath) {\n if (!this.container) return;\n\n if (\n this.node ===\n // @ts-expect-error this.key should present in this.container\n this.container[this.key]\n ) {\n return;\n }\n\n // grrr, path key is out of sync. this is likely due to a modification to the AST\n // not done through our path APIs\n\n if (Array.isArray(this.container)) {\n for (let i = 0; i < this.container.length; i++) {\n if (this.container[i] === this.node) {\n setKey.call(this, i);\n return;\n }\n }\n } else {\n for (const key of Object.keys(this.container)) {\n // @ts-expect-error this.key should present in this.container\n if (this.container[key] === this.node) {\n setKey.call(this, key);\n return;\n }\n }\n }\n\n // ¯\\_(ツ)_/¯ who knows where it's gone lol\n this.key = null;\n}\n\nexport function _resyncList(this: NodePath) {\n if (!this.parent || !this.inList) return;\n\n const newContainer =\n // @ts-expect-error this.listKey should present in this.parent\n this.parent[this.listKey];\n if (this.container === newContainer) return;\n\n // container is out of sync. this is likely the result of it being reassigned\n this.container = newContainer || null;\n}\n\nexport function _resyncRemoved(this: NodePath) {\n if (\n this.key == null ||\n !this.container ||\n // @ts-expect-error this.key should present in this.container\n this.container[this.key] !== this.node\n ) {\n _markRemoved.call(this);\n }\n}\n\nexport function popContext(this: NodePath) {\n this.contexts.pop();\n if (this.contexts.length > 0) {\n this.setContext(this.contexts[this.contexts.length - 1]);\n } else {\n this.setContext(undefined);\n }\n}\n\nexport function pushContext(this: NodePath, context: TraversalContext) {\n this.contexts.push(context);\n this.setContext(context);\n}\n\nexport function setup(\n this: NodePath,\n parentPath: NodePath | undefined,\n container: t.Node | t.Node[],\n listKey: string,\n key: string | number,\n) {\n this.listKey = listKey;\n this.container = container;\n\n this.parentPath = parentPath || this.parentPath;\n setKey.call(this, key);\n}\n\nexport function setKey(this: NodePath, key: string | number) {\n this.key = key;\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key];\n this.type = this.node?.type;\n}\n\nexport function requeue(this: NodePath, pathToQueue = this) {\n if (pathToQueue.removed) return;\n\n // If a path is skipped, and then replaced with a\n // new one, the new one shouldn't probably be skipped.\n if (process.env.BABEL_8_BREAKING) {\n pathToQueue.shouldSkip = false;\n }\n\n // TODO(loganfsmyth): This should be switched back to queue in parent contexts\n // automatically once #2892 and #4135 have been resolved. See #4140.\n // let contexts = this._getQueueContexts();\n const contexts = this.contexts;\n\n for (const context of contexts) {\n context.maybeQueue(pathToQueue);\n }\n}\n\nexport function requeueComputedKeyAndDecorators(\n this: NodePath<t.Method | t.Property>,\n) {\n const { context, node } = this;\n if (!t.isPrivate(node) && node.computed) {\n context.maybeQueue(this.get(\"key\"));\n }\n if (node.decorators) {\n for (const decorator of this.get(\"decorators\")) {\n context.maybeQueue(decorator);\n }\n }\n}\n\nexport function _getQueueContexts(this: NodePath) {\n let path = this;\n let contexts = this.contexts;\n while (!contexts.length) {\n path = path.parentPath;\n if (!path) break;\n contexts = path.contexts;\n }\n return contexts;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,CAAA,GAAAH,OAAA;AAEO,SAASI,IAAIA,CAAiBC,GAAe,EAAW;EAC7D,MAAMC,IAAI,GAAG,IAAI,CAACA,IAAI;EAEtB,IAAI,CAACC,KAAK,CAACF,GAAG,CAAC;EAEf,IAAI,IAAI,CAACG,IAAI,EAAE;IACb,IAAIC,KAAK,CAACL,IAAI,CAAC,IAAI,EAAEE,IAAI,CAACD,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI;EAC9C;EAEA,IAAI,IAAI,CAACG,IAAI,EAAE;IAAA,IAAAE,oBAAA;IACb,OAAOD,KAAK,CAACL,IAAI,CAAC,IAAI,GAAAM,oBAAA,GAAEJ,IAAI,CAAC,IAAI,CAACE,IAAI,CA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AG,CAAC,KAAK,CAAC,CAAC;EACrC;EACA,IAAIhF,IAAI,CAACiF,UAAU,EAAE;IACnB,KAAK,MAAMC,SAAS,IAAI,IAAI,CAACF,GAAG,CAAC,YAAY,CAAC,EAAE;MAC9C5D,OAAO,CAACwD,UAAU,CAACM,SAAS,CAAC;IAC/B;EACF;AACF;AAEO,SAASC,iBAAiBA,CAAA,EAAiB;EAChD,IAAIhE,IAAI,GAAG,IAAI;EACf,IAAIgD,QAAQ,GAAG,IAAI,CAACA,QAAQ;EAC5B,OAAO,CAACA,QAAQ,CAACT,MAAM,EAAE;IACvBvC,IAAI,GAAGA,IAAI,CAACoB,UAAU;IACtB,IAAI,CAACpB,IAAI,EAAE;IACXgD,QAAQ,GAAGhD,IAAI,CAACgD,QAAQ;EAC1B;EACA,OAAOA,QAAQ;AACjB","ignoreList":[]}
@@ -11,7 +11,7 @@ const Statement = exports.Statement = ["Statement"];
11
11
  const Expression = exports.Expression = ["Expression"];
12
12
  const Scope = exports.Scope = ["Scopable", "Pattern"];
13
13
  const Referenced = exports.Referenced = null;
14
- const BlockScoped = exports.BlockScoped = ["FunctionDeclaration", "ClassDeclaration", "VariableDeclaration"];
14
+ const BlockScoped = exports.BlockScoped = null;
15
15
  const Var = exports.Var = ["VariableDeclaration"];
16
16
  const User = exports.User = null;
17
17
  const Generated = exports.Generated = null;
@@ -1 +1 @@
1
- {"version":3,"names":["ReferencedIdentifier","exports","ReferencedMemberExpression","BindingIdentifier","Statement","Expression","Scope","Referenced","BlockScoped","Var","User","Generated","Pure","Flow","RestProperty","SpreadProperty","ExistentialTypeParam","NumericLiteralTypeAnnotation","ForAwaitStatement"],"sources":["../../../src/path/lib/virtual-types.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\n\nexport interface VirtualTypeAliases {\n BindingIdentifier: t.Identifier;\n BlockScoped:\n | t.FunctionDeclaration\n | t.ClassDeclaration\n | t.VariableDeclaration;\n ExistentialTypeParam: t.ExistsTypeAnnotation;\n Expression: t.Expression;\n Flow: t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier;\n ForAwaitStatement: t.ForOfStatement;\n Generated: t.Node;\n NumericLiteralTypeAnnotation: t.NumberLiteralTypeAnnotation;\n Pure: t.Node;\n Referenced: t.Node;\n ReferencedIdentifier: t.Identifier | t.JSXIdentifier;\n ReferencedMemberExpression: t.MemberExpression;\n RestProperty: t.RestElement;\n Scope: t.Scopable | t.Pattern;\n SpreadProperty: t.RestElement;\n Statement: t.Statement;\n User: t.Node;\n Var: t.VariableDeclaration;\n}\n\ntype VirtualTypeMapping = readonly (t.Node[\"type\"] | keyof t.Aliases)[] | null;\n\nexport const ReferencedIdentifier: VirtualTypeMapping = [\n \"Identifier\",\n \"JSXIdentifier\",\n] as const;\n\nexport const ReferencedMemberExpression: VirtualTypeMapping = [\n \"MemberExpression\",\n] as const;\n\nexport const BindingIdentifier: VirtualTypeMapping = [\"Identifier\"] as const;\n\nexport const Statement: VirtualTypeMapping = [\"Statement\"] as const;\n\nexport const Expression: VirtualTypeMapping = [\"Expression\"] as const;\n\nexport const Scope: VirtualTypeMapping = [\"Scopable\", \"Pattern\"] as const;\n\nexport const Referenced: VirtualTypeMapping = null;\n\nexport const BlockScoped: VirtualTypeMapping = [\n \"FunctionDeclaration\",\n \"ClassDeclaration\",\n \"VariableDeclaration\",\n] as const;\n\nexport const Var: VirtualTypeMapping = [\"VariableDeclaration\"];\n\nexport const User: VirtualTypeMapping = null;\n\nexport const Generated: VirtualTypeMapping = null;\n\nexport const Pure: VirtualTypeMapping = null;\n\nexport const Flow: VirtualTypeMapping = [\n \"Flow\",\n \"ImportDeclaration\",\n \"ExportDeclaration\",\n \"ImportSpecifier\",\n] as const;\n\n// TODO: 7.0 Backwards Compat\nexport const RestProperty: VirtualTypeMapping = [\"RestElement\"] as const;\n\nexport const SpreadProperty: VirtualTypeMapping = [\"RestElement\"] as const;\n\nexport const ExistentialTypeParam: VirtualTypeMapping = [\n \"ExistsTypeAnnotation\",\n] as const;\n\nexport const NumericLiteralTypeAnnotation: VirtualTypeMapping = [\n \"NumberLiteralTypeAnnotation\",\n] as const;\n\nexport const ForAwaitStatement: VirtualTypeMapping = [\n \"ForOfStatement\",\n] as const;\n"],"mappings":";;;;;;AA4BO,MAAMA,oBAAwC,GAAAC,OAAA,CAAAD,oBAAA,GAAG,CACtD,YAAY,EACZ,eAAe,CACP;AAEH,MAAME,0BAA8C,GAAAD,OAAA,CAAAC,0BAAA,GAAG,CAC5D,kBAAkB,CACV;AAEH,MAAMC,iBAAqC,GAAAF,OAAA,CAAAE,iBAAA,GAAG,CAAC,YAAY,CAAU;AAErE,MAAMC,SAA6B,GAAAH,OAAA,CAAAG,SAAA,GAAG,CAAC,WAAW,CAAU;AAE5D,MAAMC,UAA8B,GAAAJ,OAAA,CAAAI,UAAA,GAAG,CAAC,YAAY,CAAU;AAE9D,MAAMC,KAAyB,GAAAL,OAAA,CAAAK,KAAA,GAAG,CAAC,UAAU,EAAE,SAAS,CAAU;AAElE,MAAMC,UAA8B,GAAAN,OAAA,CAAAM,UAAA,GAAG,IAAI;AAE3C,MAAMC,WAA+B,GAAAP,OAAA,CAAAO,WAAA,GAAG,CAC7C,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,CACb;AAEH,MAAMC,GAAuB,GAAAR,OAAA,CAAAQ,GAAA,GAAG,CAAC,qBAAqB,CAAC;AAEvD,MAAMC,IAAwB,GAAAT,OAAA,CAAAS,IAAA,GAAG,IAAI;AAErC,MAAMC,SAA6B,GAAAV,OAAA,CAAAU,SAAA,GAAG,IAAI;AAE1C,MAAMC,IAAwB,GAAAX,OAAA,CAAAW,IAAA,GAAG,IAAI;AAErC,MAAMC,IAAwB,GAAAZ,OAAA,CAAAY,IAAA,GAAG,CACtC,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,CACT;AAGH,MAAMC,YAAgC,GAAAb,OAAA,CAAAa,YAAA,GAAG,CAAC,aAAa,CAAU;AAEjE,MAAMC,cAAkC,GAAAd,OAAA,CAAAc,cAAA,GAAG,CAAC,aAAa,CAAU;AAEnE,MAAMC,oBAAwC,GAAAf,OAAA,CAAAe,oBAAA,GAAG,CACtD,sBAAsB,CACd;AAEH,MAAMC,4BAAgD,GAAAhB,OAAA,CAAAgB,4BAAA,GAAG,CAC9D,6BAA6B,CACrB;AAEH,MAAMC,iBAAqC,GAAAjB,OAAA,CAAAiB,iBAAA,GAAG,CACnD,gBAAgB,CACR","ignoreList":[]}
1
+ {"version":3,"names":["ReferencedIdentifier","exports","ReferencedMemberExpression","BindingIdentifier","Statement","Expression","Scope","Referenced","BlockScoped","Var","User","Generated","Pure","Flow","RestProperty","SpreadProperty","ExistentialTypeParam","NumericLiteralTypeAnnotation","ForAwaitStatement"],"sources":["../../../src/path/lib/virtual-types.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\n\nexport interface VirtualTypeAliases {\n BindingIdentifier: t.Identifier;\n BlockScoped: t.Node;\n ExistentialTypeParam: t.ExistsTypeAnnotation;\n Expression: t.Expression;\n Flow: t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier;\n ForAwaitStatement: t.ForOfStatement;\n Generated: t.Node;\n NumericLiteralTypeAnnotation: t.NumberLiteralTypeAnnotation;\n Pure: t.Node;\n Referenced: t.Node;\n ReferencedIdentifier: t.Identifier | t.JSXIdentifier;\n ReferencedMemberExpression: t.MemberExpression;\n RestProperty: t.RestElement;\n Scope: t.Scopable | t.Pattern;\n SpreadProperty: t.RestElement;\n Statement: t.Statement;\n User: t.Node;\n Var: t.VariableDeclaration;\n}\n\ntype VirtualTypeMapping = readonly (t.Node[\"type\"] | keyof t.Aliases)[] | null;\n\nexport const ReferencedIdentifier: VirtualTypeMapping = [\n \"Identifier\",\n \"JSXIdentifier\",\n] as const;\n\nexport const ReferencedMemberExpression: VirtualTypeMapping = [\n \"MemberExpression\",\n] as const;\n\nexport const BindingIdentifier: VirtualTypeMapping = [\"Identifier\"] as const;\n\nexport const Statement: VirtualTypeMapping = [\"Statement\"] as const;\n\nexport const Expression: VirtualTypeMapping = [\"Expression\"] as const;\n\nexport const Scope: VirtualTypeMapping = [\"Scopable\", \"Pattern\"] as const;\n\nexport const Referenced: VirtualTypeMapping = null;\n\nexport const BlockScoped: VirtualTypeMapping = null;\n\nexport const Var: VirtualTypeMapping = [\"VariableDeclaration\"];\n\nexport const User: VirtualTypeMapping = null;\n\nexport const Generated: VirtualTypeMapping = null;\n\nexport const Pure: VirtualTypeMapping = null;\n\nexport const Flow: VirtualTypeMapping = [\n \"Flow\",\n \"ImportDeclaration\",\n \"ExportDeclaration\",\n \"ImportSpecifier\",\n] as const;\n\n// TODO: 7.0 Backwards Compat\nexport const RestProperty: VirtualTypeMapping = [\"RestElement\"] as const;\n\nexport const SpreadProperty: VirtualTypeMapping = [\"RestElement\"] as const;\n\nexport const ExistentialTypeParam: VirtualTypeMapping = [\n \"ExistsTypeAnnotation\",\n] as const;\n\nexport const NumericLiteralTypeAnnotation: VirtualTypeMapping = [\n \"NumberLiteralTypeAnnotation\",\n] as const;\n\nexport const ForAwaitStatement: VirtualTypeMapping = [\n \"ForOfStatement\",\n] as const;\n"],"mappings":";;;;;;AAyBO,MAAMA,oBAAwC,GAAAC,OAAA,CAAAD,oBAAA,GAAG,CACtD,YAAY,EACZ,eAAe,CACP;AAEH,MAAME,0BAA8C,GAAAD,OAAA,CAAAC,0BAAA,GAAG,CAC5D,kBAAkB,CACV;AAEH,MAAMC,iBAAqC,GAAAF,OAAA,CAAAE,iBAAA,GAAG,CAAC,YAAY,CAAU;AAErE,MAAMC,SAA6B,GAAAH,OAAA,CAAAG,SAAA,GAAG,CAAC,WAAW,CAAU;AAE5D,MAAMC,UAA8B,GAAAJ,OAAA,CAAAI,UAAA,GAAG,CAAC,YAAY,CAAU;AAE9D,MAAMC,KAAyB,GAAAL,OAAA,CAAAK,KAAA,GAAG,CAAC,UAAU,EAAE,SAAS,CAAU;AAElE,MAAMC,UAA8B,GAAAN,OAAA,CAAAM,UAAA,GAAG,IAAI;AAE3C,MAAMC,WAA+B,GAAAP,OAAA,CAAAO,WAAA,GAAG,IAAI;AAE5C,MAAMC,GAAuB,GAAAR,OAAA,CAAAQ,GAAA,GAAG,CAAC,qBAAqB,CAAC;AAEvD,MAAMC,IAAwB,GAAAT,OAAA,CAAAS,IAAA,GAAG,IAAI;AAErC,MAAMC,SAA6B,GAAAV,OAAA,CAAAU,SAAA,GAAG,IAAI;AAE1C,MAAMC,IAAwB,GAAAX,OAAA,CAAAW,IAAA,GAAG,IAAI;AAErC,MAAMC,IAAwB,GAAAZ,OAAA,CAAAY,IAAA,GAAG,CACtC,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,CACT;AAGH,MAAMC,YAAgC,GAAAb,OAAA,CAAAa,YAAA,GAAG,CAAC,aAAa,CAAU;AAEjE,MAAMC,cAAkC,GAAAd,OAAA,CAAAc,cAAA,GAAG,CAAC,aAAa,CAAU;AAEnE,MAAMC,oBAAwC,GAAAf,OAAA,CAAAe,oBAAA,GAAG,CACtD,sBAAsB,CACd;AAEH,MAAMC,4BAAgD,GAAAhB,OAAA,CAAAgB,4BAAA,GAAG,CAC9D,6BAA6B,CACrB;AAEH,MAAMC,iBAAqC,GAAAjB,OAAA,CAAAiB,iBAAA,GAAG,CACnD,gBAAgB,CACR","ignoreList":[]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _renamer = require("./lib/renamer.js");
8
8
  var _index = require("../index.js");
9
- var _traverseForScope = require("./traverseForScope.js");
10
9
  var _binding = require("./binding.js");
11
10
  var _globals = require("globals");
12
11
  var _t = require("@babel/types");
@@ -648,6 +647,9 @@ class Scope {
648
647
  };
649
648
  this.crawling = true;
650
649
  if (path.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor)) {
650
+ for (const visit of collectorVisitor.enter) {
651
+ visit.call(state, path, state);
652
+ }
651
653
  const typeVisitors = collectorVisitor[path.type];
652
654
  if (typeVisitors) {
653
655
  for (const visit of typeVisitors.enter) {
@@ -655,7 +657,7 @@ class Scope {
655
657
  }
656
658
  }
657
659
  }
658
- (0, _traverseForScope.default)(path, collectorVisitor, state);
660
+ path.traverse(collectorVisitor, state);
659
661
  this.crawling = false;
660
662
  for (const path of state.assignments) {
661
663
  const ids = path.getAssignmentIdentifiers();
@@ -1 +1 @@
1
- {"version":3,"names":["_renamer","require","_index","_traverseForScope","_binding","_globals","_t","t","_cache","_visitors","NOT_LOCAL_BINDING","assignmentExpression","callExpression","cloneNode","getBindingIdentifiers","identifier","isArrayExpression","isBinary","isCallExpression","isClass","isClassBody","isClassDeclaration","isExportAllDeclaration","isExportDefaultDeclaration","isExportNamedDeclaration","isFunctionDeclaration","isIdentifier","isImportDeclaration","isLiteral","isMemberExpression","isMethod","isModuleSpecifier","isNullLiteral","isObjectExpression","isProperty","isPureish","isRegExpLiteral","isSuper","isTaggedTemplateExpression","isTemplateLiteral","isThisExpression","isUnaryExpression","isVariableDeclaration","expressionStatement","matchesPattern","memberExpression","numericLiteral","toIdentifier","variableDeclaration","variableDeclarator","isRecordExpression","isTupleExpression","isObjectProperty","isTopicReference","isMetaProperty","isPrivateName","isExportDeclaration","buildUndefinedNode","sequenceExpression","gatherNodeParts","node","parts","type","_node$specifiers","source","specifiers","length","e","declaration","local","push","value","object","property","name","callee","properties","argument","key","left","id","expression","meta","openingElement","openingFragment","namespace","collectorVisitor","ForStatement","path","declar","get","isVar","scope","parentScope","getFunctionParent","getProgramParent","registerBinding","Declaration","isBlockScoped","parent","registerDeclaration","ImportDeclaration","getBlockParent","ReferencedIdentifier","state","references","ForXStatement","isPattern","constantViolations","ExportDeclaration","exit","binding","getBinding","reference","decl","declarations","Object","keys","LabeledStatement","AssignmentExpression","assignments","UpdateExpression","UnaryExpression","operator","BlockScoped","bindings","CatchClause","Function","params","param","isFunctionExpression","ClassExpression","TSTypeAnnotation","skip","uid","Scope","constructor","block","inited","labels","globals","uids","data","crawling","cached","scopeCache","set","Map","_parent","_path","shouldSkip","listKey","parentPath","isScope","generateDeclaredUidIdentifier","generateUidIdentifier","generateUid","replace","i","hasLabel","hasBinding","hasGlobal","hasReference","program","generateUidBasedOnNode","defaultName","join","slice","generateUidIdentifierBasedOnNode","isStatic","constant","maybeGenerateMemoised","dontPush","checkBlockScopedCollisions","kind","duplicate","hub","buildError","TypeError","rename","oldName","newName","renamer","Renamer","arguments","dump","sep","repeat","console","log","violations","getLabel","registerLabel","label","isLabeledStatement","declare","isTypeDeclaration","importKind","specifier","isTypeSpecifier","isImportSpecifier","registerConstantViolation","ids","getAssignmentIdentifiers","_this$getBinding","reassign","bindingPath","ReferenceError","declarators","getOuterBindingIdentifiers","getOwnBinding","Binding","addGlobal","hasUid","isPure","constantsOnly","_node$decorators","superClass","decorators","body","method","right","elem","elements","prop","_node$decorators2","computed","_node$decorators3","static","expressions","tag","noGlobals","quasi","isStringLiteral","setData","val","getData","removeData","init","crawl","create","isProgram","programParent","isExplodedVisitor","typeVisitors","visit","enter","call","traverseForScope","ref","opts","getPatternParent","isBlockStatement","isSwitchStatement","unique","isFunction","pushContainer","isLoop","isCatchClause","ensureBlock","blockHoist","_blockHoist","dataKey","declarPath","unshiftContainer","declarator","len","Error","isFunctionParent","isBlockParent","getAllBindings","bindingIdentifierEquals","getBindingIdentifier","previousPath","_previousPath","isArrowFunctionExpression","_this$getBinding2","getOwnBindingIdentifier","hasOwnBinding","noUids","includes","contextVariables","parentHasBinding","_this$parent","moveBindingTo","info","removeOwnBinding","removeBinding","_this$getBinding3","hoistVariables","emit","seen","Set","isVariableDeclarator","has","add","firstId","_firstId","isFor","replaceWith","remove","expr","isForStatement","exports","default","builtin","prototype","_renameFromMap","map","traverse","_generateUid","toArray","arrayLikeIsIterable","isGenericType","helperName","args","unshift","addHelper","getAllBindingsOfKind","kinds","defineProperties","parentBlock","configurable","enumerable"],"sources":["../../src/scope/index.ts"],"sourcesContent":["import Renamer from \"./lib/renamer.ts\";\nimport type NodePath from \"../path/index.ts\";\nimport traverse from \"../index.ts\";\nimport traverseForScope from \"./traverseForScope.ts\";\nimport Binding from \"./binding.ts\";\nimport type { BindingKind } from \"./binding.ts\";\nimport globals from \"globals\";\nimport {\n NOT_LOCAL_BINDING,\n assignmentExpression,\n callExpression,\n cloneNode,\n getBindingIdentifiers,\n identifier,\n isArrayExpression,\n isBinary,\n isCallExpression,\n isClass,\n isClassBody,\n isClassDeclaration,\n isExportAllDeclaration,\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n isFunctionDeclaration,\n isIdentifier,\n isImportDeclaration,\n isLiteral,\n isMemberExpression,\n isMethod,\n isModuleSpecifier,\n isNullLiteral,\n isObjectExpression,\n isProperty,\n isPureish,\n isRegExpLiteral,\n isSuper,\n isTaggedTemplateExpression,\n isTemplateLiteral,\n isThisExpression,\n isUnaryExpression,\n isVariableDeclaration,\n expressionStatement,\n matchesPattern,\n memberExpression,\n numericLiteral,\n toIdentifier,\n variableDeclaration,\n variableDeclarator,\n isRecordExpression,\n isTupleExpression,\n isObjectProperty,\n isTopicReference,\n isMetaProperty,\n isPrivateName,\n isExportDeclaration,\n buildUndefinedNode,\n sequenceExpression,\n} from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport { scope as scopeCache } from \"../cache.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport { isExplodedVisitor } from \"../visitors.ts\";\n\ntype NodePart = string | number | boolean;\n// Recursively gathers the identifying names of a node.\nfunction gatherNodeParts(node: t.Node, parts: NodePart[]) {\n switch (node?.type) {\n default:\n if (isImportDeclaration(node) || isExportDeclaration(node)) {\n if (\n (isExportAllDeclaration(node) ||\n isExportNamedDeclaration(node) ||\n isImportDeclaration(node)) &&\n node.source\n ) {\n gatherNodeParts(node.source, parts);\n } else if (\n (isExportNamedDeclaration(node) || isImportDeclaration(node)) &&\n node.specifiers?.length\n ) {\n for (const e of node.specifiers) gatherNodeParts(e, parts);\n } else if (\n (isExportDefaultDeclaration(node) ||\n isExportNamedDeclaration(node)) &&\n node.declaration\n ) {\n gatherNodeParts(node.declaration, parts);\n }\n } else if (isModuleSpecifier(node)) {\n // todo(flow->ts): should condition instead be:\n // ```\n // t.isExportSpecifier(node) ||\n // t.isImportDefaultSpecifier(node) ||\n // t.isImportNamespaceSpecifier(node) ||\n // t.isImportSpecifier(node)\n // ```\n // allowing only nodes with `.local`?\n // @ts-expect-error todo(flow->ts)\n gatherNodeParts(node.local, parts);\n } else if (\n isLiteral(node) &&\n !isNullLiteral(node) &&\n !isRegExpLiteral(node) &&\n !isTemplateLiteral(node)\n ) {\n parts.push(node.value);\n }\n break;\n\n case \"MemberExpression\":\n case \"OptionalMemberExpression\":\n case \"JSXMemberExpression\":\n gatherNodeParts(node.object, parts);\n gatherNodeParts(node.property, parts);\n break;\n\n case \"Identifier\":\n case \"JSXIdentifier\":\n parts.push(node.name);\n break;\n\n case \"CallExpression\":\n case \"OptionalCallExpression\":\n case \"NewExpression\":\n gatherNodeParts(node.callee, parts);\n break;\n\n case \"ObjectExpression\":\n case \"ObjectPattern\":\n for (const e of node.properties) {\n gatherNodeParts(e, parts);\n }\n break;\n\n case \"SpreadElement\":\n case \"RestElement\":\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"ObjectProperty\":\n case \"ObjectMethod\":\n case \"ClassProperty\":\n case \"ClassMethod\":\n case \"ClassPrivateProperty\":\n case \"ClassPrivateMethod\":\n gatherNodeParts(node.key, parts);\n break;\n\n case \"ThisExpression\":\n parts.push(\"this\");\n break;\n\n case \"Super\":\n parts.push(\"super\");\n break;\n\n case \"Import\":\n parts.push(\"import\");\n break;\n\n case \"DoExpression\":\n parts.push(\"do\");\n break;\n\n case \"YieldExpression\":\n parts.push(\"yield\");\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"AwaitExpression\":\n parts.push(\"await\");\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"AssignmentExpression\":\n gatherNodeParts(node.left, parts);\n break;\n\n case \"VariableDeclarator\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"FunctionExpression\":\n case \"FunctionDeclaration\":\n case \"ClassExpression\":\n case \"ClassDeclaration\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"PrivateName\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"ParenthesizedExpression\":\n gatherNodeParts(node.expression, parts);\n break;\n\n case \"UnaryExpression\":\n case \"UpdateExpression\":\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"MetaProperty\":\n gatherNodeParts(node.meta, parts);\n gatherNodeParts(node.property, parts);\n break;\n\n case \"JSXElement\":\n gatherNodeParts(node.openingElement, parts);\n break;\n\n case \"JSXOpeningElement\":\n gatherNodeParts(node.name, parts);\n break;\n\n case \"JSXFragment\":\n gatherNodeParts(node.openingFragment, parts);\n break;\n\n case \"JSXOpeningFragment\":\n parts.push(\"Fragment\");\n break;\n\n case \"JSXNamespacedName\":\n gatherNodeParts(node.namespace, parts);\n gatherNodeParts(node.name, parts);\n break;\n }\n}\n\n//\ninterface CollectVisitorState {\n assignments: NodePath<t.AssignmentExpression>[];\n references: NodePath<t.Identifier | t.JSXIdentifier>[];\n constantViolations: NodePath[];\n}\n\nconst collectorVisitor: Visitor<CollectVisitorState> = {\n ForStatement(path) {\n const declar = path.get(\"init\");\n // delegate block scope handling to the `BlockScoped` method\n if (declar.isVar()) {\n const { scope } = path;\n const parentScope = scope.getFunctionParent() || scope.getProgramParent();\n parentScope.registerBinding(\"var\", declar);\n }\n },\n\n Declaration(path) {\n // delegate block scope handling to the `BlockScoped` method\n if (path.isBlockScoped()) return;\n\n // delegate import handing to the `ImportDeclaration` method\n if (path.isImportDeclaration()) return;\n\n // this will be hit again once we traverse into it after this iteration\n if (path.isExportDeclaration()) return;\n\n // we've ran into a declaration!\n const parent =\n path.scope.getFunctionParent() || path.scope.getProgramParent();\n parent.registerDeclaration(path);\n },\n\n ImportDeclaration(path) {\n // import may only appear in the top level or inside a module/namespace (for TS/flow)\n const parent = path.scope.getBlockParent();\n\n parent.registerDeclaration(path);\n },\n\n ReferencedIdentifier(path, state) {\n state.references.push(path);\n },\n\n ForXStatement(path, state) {\n const left = path.get(\"left\");\n if (left.isPattern() || left.isIdentifier()) {\n state.constantViolations.push(path);\n }\n // delegate block scope handling to the `BlockScoped` method\n else if (left.isVar()) {\n const { scope } = path;\n const parentScope = scope.getFunctionParent() || scope.getProgramParent();\n parentScope.registerBinding(\"var\", left);\n }\n },\n\n ExportDeclaration: {\n exit(path) {\n const { node, scope } = path;\n // ExportAllDeclaration does not have `declaration`\n if (isExportAllDeclaration(node)) return;\n const declar = node.declaration;\n if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {\n const id = declar.id;\n if (!id) return;\n\n const binding = scope.getBinding(id.name);\n binding?.reference(path);\n } else if (isVariableDeclaration(declar)) {\n for (const decl of declar.declarations) {\n for (const name of Object.keys(getBindingIdentifiers(decl))) {\n const binding = scope.getBinding(name);\n binding?.reference(path);\n }\n }\n }\n },\n },\n\n LabeledStatement(path) {\n path.scope.getBlockParent().registerDeclaration(path);\n },\n\n AssignmentExpression(path, state) {\n state.assignments.push(path);\n },\n\n UpdateExpression(path, state) {\n state.constantViolations.push(path);\n },\n\n UnaryExpression(path, state) {\n if (path.node.operator === \"delete\") {\n state.constantViolations.push(path);\n }\n },\n\n BlockScoped(path) {\n let scope = path.scope;\n if (scope.path === path) scope = scope.parent;\n\n const parent = scope.getBlockParent();\n parent.registerDeclaration(path);\n\n // Register class identifier in class' scope if this is a class declaration.\n if (path.isClassDeclaration() && path.node.id) {\n const id = path.node.id;\n const name = id.name;\n\n path.scope.bindings[name] = path.scope.parent.getBinding(name);\n }\n },\n\n CatchClause(path) {\n path.scope.registerBinding(\"let\", path);\n },\n\n Function(path) {\n const params: Array<NodePath> = path.get(\"params\");\n for (const param of params) {\n path.scope.registerBinding(\"param\", param);\n }\n\n // Register function expression id after params. When the id\n // collides with a function param, the id effectively can't be\n // referenced: here we registered it as a constantViolation\n if (\n path.isFunctionExpression() &&\n path.node.id &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING]\n ) {\n path.scope.registerBinding(\"local\", path.get(\"id\"), path);\n }\n },\n\n ClassExpression(path) {\n if (\n path.node.id &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING]\n ) {\n path.scope.registerBinding(\"local\", path.get(\"id\"), path);\n }\n },\n TSTypeAnnotation(path) {\n path.skip();\n },\n};\n\nlet uid = 0;\n\nexport type { Binding };\n\nexport { Scope as default };\nclass Scope {\n uid;\n\n path: NodePath;\n block: t.Pattern | t.Scopable;\n\n inited;\n\n labels: Map<string, NodePath<t.LabeledStatement>>;\n bindings: { [name: string]: Binding };\n references: { [name: string]: true };\n globals: { [name: string]: t.Identifier | t.JSXIdentifier };\n uids: { [name: string]: boolean };\n data: { [key: string | symbol]: unknown };\n crawling: boolean;\n\n /**\n * This searches the current \"scope\" and collects all references/bindings\n * within.\n */\n constructor(path: NodePath<t.Pattern | t.Scopable>) {\n const { node } = path;\n const cached = scopeCache.get(node);\n // Sometimes, a scopable path is placed higher in the AST tree.\n // In these cases, have to create a new Scope.\n if (cached?.path === path) {\n return cached;\n }\n scopeCache.set(node, this);\n\n this.uid = uid++;\n\n this.block = node;\n this.path = path;\n\n this.labels = new Map();\n this.inited = false;\n }\n\n /**\n * Globals.\n */\n\n static globals = Object.keys(globals.builtin);\n\n /**\n * Variables available in current context.\n */\n\n static contextVariables = [\"arguments\", \"undefined\", \"Infinity\", \"NaN\"];\n\n get parent() {\n let parent,\n path = this.path;\n do {\n // Skip method scope if coming from inside computed key or decorator expression\n const shouldSkip = path.key === \"key\" || path.listKey === \"decorators\";\n path = path.parentPath;\n if (shouldSkip && path.isMethod()) path = path.parentPath;\n if (path?.isScope()) parent = path;\n } while (path && !parent);\n\n return parent?.scope;\n }\n\n /**\n * Generate a unique identifier and add it to the current scope.\n */\n\n generateDeclaredUidIdentifier(name?: string) {\n const id = this.generateUidIdentifier(name);\n this.push({ id });\n return cloneNode(id);\n }\n\n /**\n * Generate a unique identifier.\n */\n\n generateUidIdentifier(name?: string) {\n return identifier(this.generateUid(name));\n }\n\n /**\n * Generate a unique `_id1` binding.\n */\n\n generateUid(name: string = \"temp\"): string {\n name = toIdentifier(name).replace(/^_+/, \"\").replace(/\\d+$/g, \"\");\n\n let uid;\n let i = 1;\n do {\n uid = `_${name}`;\n if (i > 1) uid += i;\n i++;\n } while (\n this.hasLabel(uid) ||\n this.hasBinding(uid) ||\n this.hasGlobal(uid) ||\n this.hasReference(uid)\n );\n\n const program = this.getProgramParent();\n program.references[uid] = true;\n program.uids[uid] = true;\n\n return uid;\n }\n\n generateUidBasedOnNode(node: t.Node, defaultName?: string) {\n const parts: NodePart[] = [];\n gatherNodeParts(node, parts);\n\n let id = parts.join(\"$\");\n id = id.replace(/^_/, \"\") || defaultName || \"ref\";\n\n return this.generateUid(id.slice(0, 20));\n }\n\n /**\n * Generate a unique identifier based on a node.\n */\n\n generateUidIdentifierBasedOnNode(node: t.Node, defaultName?: string) {\n return identifier(this.generateUidBasedOnNode(node, defaultName));\n }\n\n /**\n * Determine whether evaluating the specific input `node` is a consequenceless reference. ie.\n * evaluating it won't result in potentially arbitrary code from being ran. The following are\n * allowed and determined not to cause side effects:\n *\n * - `this` expressions\n * - `super` expressions\n * - Bound identifiers\n */\n\n isStatic(node: t.Node): boolean {\n if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {\n return true;\n }\n\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (binding) {\n return binding.constant;\n } else {\n return this.hasBinding(node.name);\n }\n }\n\n return false;\n }\n\n /**\n * Possibly generate a memoised identifier if it is not static and has consequences.\n */\n\n maybeGenerateMemoised(node: t.Node, dontPush?: boolean) {\n if (this.isStatic(node)) {\n return null;\n } else {\n const id = this.generateUidIdentifierBasedOnNode(node);\n if (!dontPush) {\n this.push({ id });\n return cloneNode(id);\n }\n return id;\n }\n }\n\n checkBlockScopedCollisions(\n local: Binding,\n kind: BindingKind,\n name: string,\n id: any,\n ) {\n // ignore parameters\n if (kind === \"param\") return;\n\n // Ignore existing binding if it's the name of the current function or\n // class expression\n if (local.kind === \"local\") return;\n\n const duplicate =\n // don't allow duplicate bindings to exist alongside\n kind === \"let\" ||\n local.kind === \"let\" ||\n local.kind === \"const\" ||\n local.kind === \"module\" ||\n // don't allow a local of param with a kind of let\n (local.kind === \"param\" && kind === \"const\");\n\n if (duplicate) {\n throw this.path.hub.buildError(\n id,\n `Duplicate declaration \"${name}\"`,\n TypeError,\n );\n }\n }\n\n rename(\n oldName: string,\n newName?: string,\n // prettier-ignore\n /* Babel 7 - block?: t.Pattern | t.Scopable */\n ) {\n const binding = this.getBinding(oldName);\n if (binding) {\n newName ||= this.generateUidIdentifier(oldName).name;\n const renamer = new Renamer(binding, oldName, newName);\n if (process.env.BABEL_8_BREAKING) {\n renamer.rename();\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) TODO: Delete this\n renamer.rename(arguments[2]);\n }\n }\n }\n\n dump() {\n const sep = \"-\".repeat(60);\n console.log(sep);\n let scope: Scope = this;\n do {\n console.log(\"#\", scope.block.type);\n for (const name of Object.keys(scope.bindings)) {\n const binding = scope.bindings[name];\n console.log(\" -\", name, {\n constant: binding.constant,\n references: binding.references,\n violations: binding.constantViolations.length,\n kind: binding.kind,\n });\n }\n } while ((scope = scope.parent));\n console.log(sep);\n }\n\n hasLabel(name: string) {\n return !!this.getLabel(name);\n }\n\n getLabel(name: string) {\n return this.labels.get(name);\n }\n\n registerLabel(path: NodePath<t.LabeledStatement>) {\n this.labels.set(path.node.label.name, path);\n }\n\n registerDeclaration(path: NodePath) {\n if (path.isLabeledStatement()) {\n this.registerLabel(path);\n } else if (path.isFunctionDeclaration()) {\n this.registerBinding(\"hoisted\", path.get(\"id\"), path);\n } else if (path.isVariableDeclaration()) {\n const declarations = path.get(\"declarations\");\n const { kind } = path.node;\n for (const declar of declarations) {\n this.registerBinding(\n kind === \"using\" || kind === \"await using\" ? \"const\" : kind,\n declar,\n );\n }\n } else if (path.isClassDeclaration()) {\n if (path.node.declare) return;\n this.registerBinding(\"let\", path);\n } else if (path.isImportDeclaration()) {\n const isTypeDeclaration =\n path.node.importKind === \"type\" || path.node.importKind === \"typeof\";\n const specifiers = path.get(\"specifiers\");\n for (const specifier of specifiers) {\n const isTypeSpecifier =\n isTypeDeclaration ||\n (specifier.isImportSpecifier() &&\n (specifier.node.importKind === \"type\" ||\n specifier.node.importKind === \"typeof\"));\n\n this.registerBinding(isTypeSpecifier ? \"unknown\" : \"module\", specifier);\n }\n } else if (path.isExportDeclaration()) {\n // todo: improve babel-types\n const declar = path.get(\"declaration\") as NodePath;\n if (\n declar.isClassDeclaration() ||\n declar.isFunctionDeclaration() ||\n declar.isVariableDeclaration()\n ) {\n this.registerDeclaration(declar);\n }\n } else {\n this.registerBinding(\"unknown\", path);\n }\n }\n\n buildUndefinedNode() {\n return buildUndefinedNode();\n }\n\n registerConstantViolation(path: NodePath) {\n const ids = path.getAssignmentIdentifiers();\n for (const name of Object.keys(ids)) {\n this.getBinding(name)?.reassign(path);\n }\n }\n\n registerBinding(\n kind: Binding[\"kind\"],\n path: NodePath,\n bindingPath: NodePath = path,\n ) {\n if (!kind) throw new ReferenceError(\"no `kind`\");\n\n if (path.isVariableDeclaration()) {\n const declarators: Array<NodePath> = path.get(\"declarations\");\n for (const declar of declarators) {\n this.registerBinding(kind, declar);\n }\n return;\n }\n\n const parent = this.getProgramParent();\n const ids = path.getOuterBindingIdentifiers(true);\n\n for (const name of Object.keys(ids)) {\n parent.references[name] = true;\n\n for (const id of ids[name]) {\n const local = this.getOwnBinding(name);\n\n if (local) {\n // same identifier so continue safely as we're likely trying to register it\n // multiple times\n if (local.identifier === id) continue;\n\n this.checkBlockScopedCollisions(local, kind, name, id);\n }\n\n // A redeclaration of an existing variable is a modification\n if (local) {\n local.reassign(bindingPath);\n } else {\n this.bindings[name] = new Binding({\n identifier: id,\n scope: this,\n path: bindingPath,\n kind: kind,\n });\n }\n }\n }\n }\n\n addGlobal(node: t.Identifier | t.JSXIdentifier) {\n this.globals[node.name] = node;\n }\n\n hasUid(name: string): boolean {\n let scope: Scope = this;\n\n do {\n if (scope.uids[name]) return true;\n } while ((scope = scope.parent));\n\n return false;\n }\n\n hasGlobal(name: string): boolean {\n let scope: Scope = this;\n\n do {\n if (scope.globals[name]) return true;\n } while ((scope = scope.parent));\n\n return false;\n }\n\n hasReference(name: string): boolean {\n return !!this.getProgramParent().references[name];\n }\n\n isPure(node: t.Node, constantsOnly?: boolean): boolean {\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (!binding) return false;\n if (constantsOnly) return binding.constant;\n return true;\n } else if (\n isThisExpression(node) ||\n isMetaProperty(node) ||\n isTopicReference(node) ||\n isPrivateName(node)\n ) {\n return true;\n } else if (isClass(node)) {\n if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {\n return false;\n }\n if (node.decorators?.length > 0) {\n return false;\n }\n return this.isPure(node.body, constantsOnly);\n } else if (isClassBody(node)) {\n for (const method of node.body) {\n if (!this.isPure(method, constantsOnly)) return false;\n }\n return true;\n } else if (isBinary(node)) {\n return (\n this.isPure(node.left, constantsOnly) &&\n this.isPure(node.right, constantsOnly)\n );\n } else if (isArrayExpression(node) || isTupleExpression(node)) {\n for (const elem of node.elements) {\n if (elem !== null && !this.isPure(elem, constantsOnly)) return false;\n }\n return true;\n } else if (isObjectExpression(node) || isRecordExpression(node)) {\n for (const prop of node.properties) {\n if (!this.isPure(prop, constantsOnly)) return false;\n }\n return true;\n } else if (isMethod(node)) {\n if (node.computed && !this.isPure(node.key, constantsOnly)) return false;\n if (node.decorators?.length > 0) {\n return false;\n }\n return true;\n } else if (isProperty(node)) {\n // @ts-expect-error todo(flow->ts): computed in not present on private properties\n if (node.computed && !this.isPure(node.key, constantsOnly)) return false;\n if (node.decorators?.length > 0) {\n return false;\n }\n if (isObjectProperty(node) || node.static) {\n if (node.value !== null && !this.isPure(node.value, constantsOnly)) {\n return false;\n }\n }\n return true;\n } else if (isUnaryExpression(node)) {\n return this.isPure(node.argument, constantsOnly);\n } else if (isTemplateLiteral(node)) {\n for (const expression of node.expressions) {\n if (!this.isPure(expression, constantsOnly)) return false;\n }\n return true;\n } else if (isTaggedTemplateExpression(node)) {\n return (\n matchesPattern(node.tag, \"String.raw\") &&\n !this.hasBinding(\"String\", { noGlobals: true }) &&\n this.isPure(node.quasi, constantsOnly)\n );\n } else if (isMemberExpression(node)) {\n return (\n !node.computed &&\n isIdentifier(node.object) &&\n node.object.name === \"Symbol\" &&\n isIdentifier(node.property) &&\n node.property.name !== \"for\" &&\n !this.hasBinding(\"Symbol\", { noGlobals: true })\n );\n } else if (isCallExpression(node)) {\n return (\n matchesPattern(node.callee, \"Symbol.for\") &&\n !this.hasBinding(\"Symbol\", { noGlobals: true }) &&\n node.arguments.length === 1 &&\n t.isStringLiteral(node.arguments[0])\n );\n } else {\n return isPureish(node);\n }\n }\n\n /**\n * Set some arbitrary data on the current scope.\n */\n\n setData(key: string | symbol, val: any) {\n return (this.data[key] = val);\n }\n\n /**\n * Recursively walk up scope tree looking for the data `key`.\n */\n\n getData(key: string | symbol): any {\n let scope: Scope = this;\n do {\n const data = scope.data[key];\n if (data != null) return data;\n } while ((scope = scope.parent));\n }\n\n /**\n * Recursively walk up scope tree looking for the data `key` and if it exists,\n * remove it.\n */\n\n removeData(key: string) {\n let scope: Scope = this;\n do {\n const data = scope.data[key];\n if (data != null) scope.data[key] = null;\n } while ((scope = scope.parent));\n }\n\n init() {\n if (!this.inited) {\n this.inited = true;\n this.crawl();\n }\n }\n\n crawl() {\n const path = this.path;\n\n this.references = Object.create(null);\n this.bindings = Object.create(null);\n this.globals = Object.create(null);\n this.uids = Object.create(null);\n this.data = Object.create(null);\n\n let scope: Scope = this;\n do {\n if (scope.crawling) return;\n if (scope.path.isProgram()) {\n break;\n }\n } while ((scope = scope.parent));\n\n const programParent = scope;\n\n const state: CollectVisitorState = {\n references: [],\n constantViolations: [],\n assignments: [],\n };\n\n this.crawling = true;\n // traverse does not visit the root node, here we explicitly collect\n // root node binding info when the root is not a Program.\n if (path.type !== \"Program\" && isExplodedVisitor(collectorVisitor)) {\n const typeVisitors = collectorVisitor[path.type];\n if (typeVisitors) {\n for (const visit of typeVisitors.enter) {\n visit.call(state, path, state);\n }\n }\n }\n traverseForScope(path, collectorVisitor, state);\n this.crawling = false;\n\n // register assignments\n for (const path of state.assignments) {\n // register undeclared bindings as globals\n const ids = path.getAssignmentIdentifiers();\n for (const name of Object.keys(ids)) {\n if (path.scope.getBinding(name)) continue;\n programParent.addGlobal(ids[name]);\n }\n\n // register as constant violation\n path.scope.registerConstantViolation(path);\n }\n\n // register references\n for (const ref of state.references) {\n const binding = ref.scope.getBinding(ref.node.name);\n if (binding) {\n binding.reference(ref);\n } else {\n programParent.addGlobal(ref.node);\n }\n }\n\n // register constant violations\n for (const path of state.constantViolations) {\n path.scope.registerConstantViolation(path);\n }\n }\n\n push(opts: {\n id: t.ArrayPattern | t.Identifier | t.ObjectPattern;\n init?: t.Expression;\n unique?: boolean;\n _blockHoist?: number | undefined;\n kind?: \"var\" | \"let\" | \"const\";\n }) {\n let path = this.path;\n\n if (path.isPattern()) {\n path = this.getPatternParent().path;\n } else if (!path.isBlockStatement() && !path.isProgram()) {\n path = this.getBlockParent().path;\n }\n\n if (path.isSwitchStatement()) {\n path = (this.getFunctionParent() || this.getProgramParent()).path;\n }\n\n const { init, unique, kind = \"var\", id } = opts;\n\n // When injecting a non-const non-initialized binding inside\n // an IIFE, if the number of call arguments is less than or\n // equal to the number of function parameters, we can safely\n // inject the binding into the parameter list.\n if (\n !init &&\n !unique &&\n (kind === \"var\" || kind === \"let\") &&\n path.isFunction() &&\n // @ts-expect-error ArrowFunctionExpression never has a name\n !path.node.name &&\n isCallExpression(path.parent, { callee: path.node }) &&\n path.parent.arguments.length <= path.node.params.length &&\n isIdentifier(id)\n ) {\n path.pushContainer(\"params\", id);\n path.scope.registerBinding(\n \"param\",\n path.get(\"params\")[path.node.params.length - 1],\n );\n return;\n }\n\n if (path.isLoop() || path.isCatchClause() || path.isFunction()) {\n path.ensureBlock();\n path = path.get(\"body\");\n }\n\n const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;\n\n const dataKey = `declaration:${kind}:${blockHoist}`;\n let declarPath = !unique && path.getData(dataKey);\n\n if (!declarPath) {\n const declar = variableDeclaration(kind, []);\n // @ts-expect-error todo(flow->ts): avoid modifying nodes\n declar._blockHoist = blockHoist;\n\n [declarPath] = (path as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n [declar],\n );\n if (!unique) path.setData(dataKey, declarPath);\n }\n\n const declarator = variableDeclarator(id, init);\n const len = declarPath.node.declarations.push(declarator);\n path.scope.registerBinding(kind, declarPath.get(\"declarations\")[len - 1]);\n }\n\n /**\n * Walk up to the top of the scope tree and get the `Program`.\n */\n\n getProgramParent() {\n let scope: Scope = this;\n do {\n if (scope.path.isProgram()) {\n return scope;\n }\n } while ((scope = scope.parent));\n throw new Error(\"Couldn't find a Program\");\n }\n\n /**\n * Walk up the scope tree until we hit either a Function or return null.\n */\n\n getFunctionParent(): Scope | null {\n let scope: Scope = this;\n do {\n if (scope.path.isFunctionParent()) {\n return scope;\n }\n } while ((scope = scope.parent));\n return null;\n }\n\n /**\n * Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the\n * very top and hit Program.\n */\n\n getBlockParent() {\n let scope: Scope = this;\n do {\n if (scope.path.isBlockParent()) {\n return scope;\n }\n } while ((scope = scope.parent));\n throw new Error(\n \"We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...\",\n );\n }\n\n /**\n * Walk up from a pattern scope (function param initializer) until we hit a non-pattern scope,\n * then returns its block parent\n * @returns An ancestry scope whose path is a block parent\n */\n getPatternParent() {\n let scope: Scope = this;\n do {\n if (!scope.path.isPattern()) {\n return scope.getBlockParent();\n }\n } while ((scope = scope.parent.parent));\n throw new Error(\n \"We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...\",\n );\n }\n\n /**\n * Walks the scope tree and gathers **all** bindings.\n */\n\n getAllBindings(): Record<string, Binding> {\n const ids = Object.create(null);\n\n let scope: Scope = this;\n do {\n for (const key of Object.keys(scope.bindings)) {\n if (key in ids === false) {\n ids[key] = scope.bindings[key];\n }\n }\n scope = scope.parent;\n } while (scope);\n\n return ids;\n }\n\n bindingIdentifierEquals(name: string, node: t.Node): boolean {\n return this.getBindingIdentifier(name) === node;\n }\n\n getBinding(name: string): Binding | undefined {\n let scope: Scope = this;\n let previousPath;\n\n do {\n const binding = scope.getOwnBinding(name);\n if (binding) {\n // Check if a pattern is a part of parameter expressions.\n // Note: for performance reason we skip checking previousPath.parentPath.isFunction()\n // because `scope.path` is validated as scope in packages/babel-types/src/validators/isScope.js\n // That is, if a scope path is pattern, its parent must be Function/CatchClause\n\n // Spec 9.2.10.28: The closure created by this expression should not have visibility of\n // declarations in the function body. If the binding is not a `param`-kind (as function parameters)\n // or `local`-kind (as id in function expression),\n // then it must be defined inside the function body, thus it should be skipped\n if (\n previousPath?.isPattern() &&\n binding.kind !== \"param\" &&\n binding.kind !== \"local\"\n ) {\n // do nothing\n } else {\n return binding;\n }\n } else if (\n !binding &&\n name === \"arguments\" &&\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n previousPath = scope.path;\n } while ((scope = scope.parent));\n }\n\n getOwnBinding(name: string): Binding | undefined {\n return this.bindings[name];\n }\n\n // todo: return probably can be undefined…\n getBindingIdentifier(name: string): t.Identifier {\n return this.getBinding(name)?.identifier;\n }\n\n // todo: flow->ts return probably can be undefined\n getOwnBindingIdentifier(name: string): t.Identifier {\n const binding = this.bindings[name];\n return binding?.identifier;\n }\n\n hasOwnBinding(name: string) {\n return !!this.getOwnBinding(name);\n }\n\n // By default, we consider generated UIDs as bindings.\n // This is because they are almost always used to declare variables,\n // and since the scope isn't always up-to-date it's better to assume that\n // there is a variable with that name. The `noUids` option can be used to\n // turn off this behavior, for example if you know that the generate UID\n // was used to declare a variable in a different scope.\n hasBinding(\n name: string,\n opts?: boolean | { noGlobals?: boolean; noUids?: boolean },\n ) {\n if (!name) return false;\n let scope: Scope = this;\n do {\n if (scope.hasOwnBinding(name)) {\n return true;\n }\n } while ((scope = scope.parent));\n\n // TODO: Only accept the object form.\n let noGlobals;\n let noUids;\n if (typeof opts === \"object\") {\n noGlobals = opts.noGlobals;\n noUids = opts.noUids;\n } else if (typeof opts === \"boolean\") {\n noGlobals = opts;\n }\n\n if (!noUids && this.hasUid(name)) return true;\n if (!noGlobals && Scope.globals.includes(name)) return true;\n if (!noGlobals && Scope.contextVariables.includes(name)) return true;\n return false;\n }\n\n parentHasBinding(\n name: string,\n opts?: { noGlobals?: boolean; noUids?: boolean },\n ) {\n return this.parent?.hasBinding(name, opts);\n }\n\n /**\n * Move a binding of `name` to another `scope`.\n */\n\n moveBindingTo(name: string, scope: Scope) {\n const info = this.getBinding(name);\n if (info) {\n info.scope.removeOwnBinding(name);\n info.scope = scope;\n scope.bindings[name] = info;\n }\n }\n\n removeOwnBinding(name: string) {\n delete this.bindings[name];\n }\n\n removeBinding(name: string) {\n // clear literal binding\n this.getBinding(name)?.scope.removeOwnBinding(name);\n\n // clear uids with this name - https://github.com/babel/babel/issues/2101\n let scope: Scope = this;\n do {\n if (scope.uids[name]) {\n scope.uids[name] = false;\n }\n } while ((scope = scope.parent));\n }\n\n /**\n * Hoist all the `var` variable to the beginning of the function/program\n * scope where their binding will be actually defined. For exmaple,\n * { var x = 2 }\n * will be transformed to\n * var x; { x = 2 }\n *\n * @param emit A custom function to emit `var` declarations, for example to\n * emit them in a different scope.\n */\n hoistVariables(\n emit: (id: t.Identifier, hasInit: boolean) => void = id =>\n this.push({ id }),\n ) {\n this.crawl();\n\n const seen = new Set();\n for (const name of Object.keys(this.bindings)) {\n const binding = this.bindings[name];\n if (!binding) continue;\n const { path } = binding;\n if (!path.isVariableDeclarator()) continue;\n const { parent, parentPath } = path;\n\n if (parent.kind !== \"var\" || seen.has(parent)) continue;\n seen.add(path.parent);\n\n let firstId;\n const init = [];\n for (const decl of parent.declarations) {\n firstId ??= decl.id;\n if (decl.init) {\n init.push(assignmentExpression(\"=\", decl.id, decl.init));\n }\n\n const ids = Object.keys(getBindingIdentifiers(decl, false, true, true));\n for (const name of ids) {\n emit(identifier(name), decl.init != null);\n }\n }\n\n // for (var i in test)\n if (parentPath.parentPath.isFor({ left: parent })) {\n parentPath.replaceWith(firstId);\n } else if (init.length === 0) {\n parentPath.remove();\n } else {\n const expr = init.length === 1 ? init[0] : sequenceExpression(init);\n if (parentPath.parentPath.isForStatement({ init: parent })) {\n parentPath.replaceWith(expr);\n } else {\n parentPath.replaceWith(expressionStatement(expr));\n }\n }\n }\n }\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /** @deprecated Not used in our codebase */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype._renameFromMap = function _renameFromMap(\n map: Record<string | symbol, unknown>,\n oldName: string | symbol,\n newName: string | symbol,\n value: unknown,\n ) {\n if (map[oldName]) {\n map[newName] = value;\n map[oldName] = null;\n }\n };\n\n /**\n * Traverse node with current scope and path.\n *\n * !!! WARNING !!!\n * This method assumes that `this.path` is the NodePath representing `node`.\n * After running the traversal, the `.parentPath` of the NodePaths\n * corresponding to `node`'s children will be set to `this.path`.\n *\n * There is no good reason to use this method, since the only safe way to use\n * it is equivalent to `scope.path.traverse(opts, state)`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.traverse = function <S>(\n this: Scope,\n node: any,\n opts: any,\n state?: S,\n ) {\n traverse(node, opts, this, state, this.path);\n };\n\n /**\n * Generate an `_id1`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype._generateUid = function _generateUid(\n name: string,\n i: number,\n ) {\n let id = name;\n if (i > 1) id += i;\n return `_${id}`;\n };\n\n // TODO: (Babel 8) Split i in two parameters, and use an object of flags\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.toArray = function toArray(\n this: Scope,\n node: t.Node,\n i?: number | boolean,\n arrayLikeIsIterable?: boolean | void,\n ) {\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (binding?.constant && binding.path.isGenericType(\"Array\")) {\n return node;\n }\n }\n\n if (isArrayExpression(node)) {\n return node;\n }\n\n if (isIdentifier(node, { name: \"arguments\" })) {\n return callExpression(\n memberExpression(\n memberExpression(\n memberExpression(identifier(\"Array\"), identifier(\"prototype\")),\n identifier(\"slice\"),\n ),\n identifier(\"call\"),\n ),\n [node],\n );\n }\n\n let helperName;\n const args = [node];\n if (i === true) {\n // Used in array-spread to create an array.\n helperName = \"toConsumableArray\";\n } else if (typeof i === \"number\") {\n args.push(numericLiteral(i));\n\n // Used in array-rest to create an array from a subset of an iterable.\n helperName = \"slicedToArray\";\n // TODO if (this.hub.isLoose(\"es6.forOf\")) helperName += \"-loose\";\n } else {\n // Used in array-rest to create an array\n helperName = \"toArray\";\n }\n\n if (arrayLikeIsIterable) {\n args.unshift(this.path.hub.addHelper(helperName));\n helperName = \"maybeArrayLike\";\n }\n\n // @ts-expect-error todo(flow->ts): t.Node is not valid to use in args, function argument typeneeds to be clarified\n return callExpression(this.path.hub.addHelper(helperName), args);\n };\n\n /**\n * Walks the scope tree and gathers all declarations of `kind`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(\n ...kinds: string[]\n ): Record<string, Binding> {\n const ids = Object.create(null);\n\n for (const kind of kinds) {\n let scope: Scope = this;\n do {\n for (const name of Object.keys(scope.bindings)) {\n const binding = scope.bindings[name];\n if (binding.kind === kind) ids[name] = binding;\n }\n scope = scope.parent;\n } while (scope);\n }\n\n return ids;\n };\n\n Object.defineProperties(Scope.prototype, {\n parentBlock: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.parent;\n },\n },\n hub: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.hub;\n },\n },\n });\n}\n\ntype _Binding = Binding;\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Scope {\n export type Binding = _Binding;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,EAAA,GAAAL,OAAA;AAkDsB,IAAAM,CAAA,GAAAD,EAAA;AAEtB,IAAAE,MAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AAAmD;EArDjDS,iBAAiB;EACjBC,oBAAoB;EACpBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,UAAU;EACVC,iBAAiB;EACjBC,QAAQ;EACRC,gBAAgB;EAChBC,OAAO;EACPC,WAAW;EACXC,kBAAkB;EAClBC,sBAAsB;EACtBC,0BAA0B;EAC1BC,wBAAwB;EACxBC,qBAAqB;EACrBC,YAAY;EACZC,mBAAmB;EACnBC,SAAS;EACTC,kBAAkB;EAClBC,QAAQ;EACRC,iBAAiB;EACjBC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,SAAS;EACTC,eAAe;EACfC,OAAO;EACPC,0BAA0B;EAC1BC,iBAAiB;EACjBC,gBAAgB;EAChBC,iBAAiB;EACjBC,qBAAqB;EACrBC,mBAAmB;EACnBC,cAAc;EACdC,gBAAgB;EAChBC,cAAc;EACdC,YAAY;EACZC,mBAAmB;EACnBC,kBAAkB;EAClBC,kBAAkB;EAClBC,iBAAiB;EACjBC,gBAAgB;EAChBC,gBAAgB;EAChBC,cAAc;EACdC,aAAa;EACbC,mBAAmB;EACnBC,kBAAkB;EAClBC;AAAkB,IAAApD,EAAA;AASpB,SAASqD,eAAeA,CAACC,IAAY,EAAEC,KAAiB,EAAE;EACxD,QAAQD,IAAI,oBAAJA,IAAI,CAAEE,IAAI;IAChB;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AAE;IACvCe,WAAW,EAAE;MACXC,YAAY,EAAE,IAAI;MAClBC,UAAU,EAAE,IAAI;MAChBzO,GAAGA,CAAA,EAAc;QACf,OAAO,IAAI,CAACF,IAAI,CAACW,MAAM;MACzB;IACF,CAAC;IACD6E,GAAG,EAAE;MACHkJ,YAAY,EAAE,IAAI;MAClBC,UAAU,EAAE,IAAI;MAChBzO,GAAGA,CAAA,EAAc;QACf,OAAO,IAAI,CAACF,IAAI,CAACwF,GAAG;MACtB;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_renamer","require","_index","_binding","_globals","_t","t","_cache","_visitors","NOT_LOCAL_BINDING","assignmentExpression","callExpression","cloneNode","getBindingIdentifiers","identifier","isArrayExpression","isBinary","isCallExpression","isClass","isClassBody","isClassDeclaration","isExportAllDeclaration","isExportDefaultDeclaration","isExportNamedDeclaration","isFunctionDeclaration","isIdentifier","isImportDeclaration","isLiteral","isMemberExpression","isMethod","isModuleSpecifier","isNullLiteral","isObjectExpression","isProperty","isPureish","isRegExpLiteral","isSuper","isTaggedTemplateExpression","isTemplateLiteral","isThisExpression","isUnaryExpression","isVariableDeclaration","expressionStatement","matchesPattern","memberExpression","numericLiteral","toIdentifier","variableDeclaration","variableDeclarator","isRecordExpression","isTupleExpression","isObjectProperty","isTopicReference","isMetaProperty","isPrivateName","isExportDeclaration","buildUndefinedNode","sequenceExpression","gatherNodeParts","node","parts","type","_node$specifiers","source","specifiers","length","e","declaration","local","push","value","object","property","name","callee","properties","argument","key","left","id","expression","meta","openingElement","openingFragment","namespace","collectorVisitor","ForStatement","path","declar","get","isVar","scope","parentScope","getFunctionParent","getProgramParent","registerBinding","Declaration","isBlockScoped","parent","registerDeclaration","ImportDeclaration","getBlockParent","ReferencedIdentifier","state","references","ForXStatement","isPattern","constantViolations","ExportDeclaration","exit","binding","getBinding","reference","decl","declarations","Object","keys","LabeledStatement","AssignmentExpression","assignments","UpdateExpression","UnaryExpression","operator","BlockScoped","bindings","CatchClause","Function","params","param","isFunctionExpression","ClassExpression","TSTypeAnnotation","skip","uid","Scope","constructor","block","inited","labels","globals","uids","data","crawling","cached","scopeCache","set","Map","_parent","_path","shouldSkip","listKey","parentPath","isScope","generateDeclaredUidIdentifier","generateUidIdentifier","generateUid","replace","i","hasLabel","hasBinding","hasGlobal","hasReference","program","generateUidBasedOnNode","defaultName","join","slice","generateUidIdentifierBasedOnNode","isStatic","constant","maybeGenerateMemoised","dontPush","checkBlockScopedCollisions","kind","duplicate","hub","buildError","TypeError","rename","oldName","newName","renamer","Renamer","arguments","dump","sep","repeat","console","log","violations","getLabel","registerLabel","label","isLabeledStatement","declare","isTypeDeclaration","importKind","specifier","isTypeSpecifier","isImportSpecifier","registerConstantViolation","ids","getAssignmentIdentifiers","_this$getBinding","reassign","bindingPath","ReferenceError","declarators","getOuterBindingIdentifiers","getOwnBinding","Binding","addGlobal","hasUid","isPure","constantsOnly","_node$decorators","superClass","decorators","body","method","right","elem","elements","prop","_node$decorators2","computed","_node$decorators3","static","expressions","tag","noGlobals","quasi","isStringLiteral","setData","val","getData","removeData","init","crawl","create","isProgram","programParent","isExplodedVisitor","visit","enter","call","typeVisitors","traverse","ref","opts","getPatternParent","isBlockStatement","isSwitchStatement","unique","isFunction","pushContainer","isLoop","isCatchClause","ensureBlock","blockHoist","_blockHoist","dataKey","declarPath","unshiftContainer","declarator","len","Error","isFunctionParent","isBlockParent","getAllBindings","bindingIdentifierEquals","getBindingIdentifier","previousPath","_previousPath","isArrowFunctionExpression","_this$getBinding2","getOwnBindingIdentifier","hasOwnBinding","noUids","includes","contextVariables","parentHasBinding","_this$parent","moveBindingTo","info","removeOwnBinding","removeBinding","_this$getBinding3","hoistVariables","emit","seen","Set","isVariableDeclarator","has","add","firstId","_firstId","isFor","replaceWith","remove","expr","isForStatement","exports","default","builtin","prototype","_renameFromMap","map","_generateUid","toArray","arrayLikeIsIterable","isGenericType","helperName","args","unshift","addHelper","getAllBindingsOfKind","kinds","defineProperties","parentBlock","configurable","enumerable"],"sources":["../../src/scope/index.ts"],"sourcesContent":["import Renamer from \"./lib/renamer.ts\";\nimport type NodePath from \"../path/index.ts\";\nimport traverse from \"../index.ts\";\nimport Binding from \"./binding.ts\";\nimport type { BindingKind } from \"./binding.ts\";\nimport globals from \"globals\";\nimport {\n NOT_LOCAL_BINDING,\n assignmentExpression,\n callExpression,\n cloneNode,\n getBindingIdentifiers,\n identifier,\n isArrayExpression,\n isBinary,\n isCallExpression,\n isClass,\n isClassBody,\n isClassDeclaration,\n isExportAllDeclaration,\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n isFunctionDeclaration,\n isIdentifier,\n isImportDeclaration,\n isLiteral,\n isMemberExpression,\n isMethod,\n isModuleSpecifier,\n isNullLiteral,\n isObjectExpression,\n isProperty,\n isPureish,\n isRegExpLiteral,\n isSuper,\n isTaggedTemplateExpression,\n isTemplateLiteral,\n isThisExpression,\n isUnaryExpression,\n isVariableDeclaration,\n expressionStatement,\n matchesPattern,\n memberExpression,\n numericLiteral,\n toIdentifier,\n variableDeclaration,\n variableDeclarator,\n isRecordExpression,\n isTupleExpression,\n isObjectProperty,\n isTopicReference,\n isMetaProperty,\n isPrivateName,\n isExportDeclaration,\n buildUndefinedNode,\n sequenceExpression,\n} from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport { scope as scopeCache } from \"../cache.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport { isExplodedVisitor } from \"../visitors.ts\";\n\ntype NodePart = string | number | boolean;\n// Recursively gathers the identifying names of a node.\nfunction gatherNodeParts(node: t.Node, parts: NodePart[]) {\n switch (node?.type) {\n default:\n if (isImportDeclaration(node) || isExportDeclaration(node)) {\n if (\n (isExportAllDeclaration(node) ||\n isExportNamedDeclaration(node) ||\n isImportDeclaration(node)) &&\n node.source\n ) {\n gatherNodeParts(node.source, parts);\n } else if (\n (isExportNamedDeclaration(node) || isImportDeclaration(node)) &&\n node.specifiers?.length\n ) {\n for (const e of node.specifiers) gatherNodeParts(e, parts);\n } else if (\n (isExportDefaultDeclaration(node) ||\n isExportNamedDeclaration(node)) &&\n node.declaration\n ) {\n gatherNodeParts(node.declaration, parts);\n }\n } else if (isModuleSpecifier(node)) {\n // todo(flow->ts): should condition instead be:\n // ```\n // t.isExportSpecifier(node) ||\n // t.isImportDefaultSpecifier(node) ||\n // t.isImportNamespaceSpecifier(node) ||\n // t.isImportSpecifier(node)\n // ```\n // allowing only nodes with `.local`?\n // @ts-expect-error todo(flow->ts)\n gatherNodeParts(node.local, parts);\n } else if (\n isLiteral(node) &&\n !isNullLiteral(node) &&\n !isRegExpLiteral(node) &&\n !isTemplateLiteral(node)\n ) {\n parts.push(node.value);\n }\n break;\n\n case \"MemberExpression\":\n case \"OptionalMemberExpression\":\n case \"JSXMemberExpression\":\n gatherNodeParts(node.object, parts);\n gatherNodeParts(node.property, parts);\n break;\n\n case \"Identifier\":\n case \"JSXIdentifier\":\n parts.push(node.name);\n break;\n\n case \"CallExpression\":\n case \"OptionalCallExpression\":\n case \"NewExpression\":\n gatherNodeParts(node.callee, parts);\n break;\n\n case \"ObjectExpression\":\n case \"ObjectPattern\":\n for (const e of node.properties) {\n gatherNodeParts(e, parts);\n }\n break;\n\n case \"SpreadElement\":\n case \"RestElement\":\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"ObjectProperty\":\n case \"ObjectMethod\":\n case \"ClassProperty\":\n case \"ClassMethod\":\n case \"ClassPrivateProperty\":\n case \"ClassPrivateMethod\":\n gatherNodeParts(node.key, parts);\n break;\n\n case \"ThisExpression\":\n parts.push(\"this\");\n break;\n\n case \"Super\":\n parts.push(\"super\");\n break;\n\n case \"Import\":\n parts.push(\"import\");\n break;\n\n case \"DoExpression\":\n parts.push(\"do\");\n break;\n\n case \"YieldExpression\":\n parts.push(\"yield\");\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"AwaitExpression\":\n parts.push(\"await\");\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"AssignmentExpression\":\n gatherNodeParts(node.left, parts);\n break;\n\n case \"VariableDeclarator\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"FunctionExpression\":\n case \"FunctionDeclaration\":\n case \"ClassExpression\":\n case \"ClassDeclaration\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"PrivateName\":\n gatherNodeParts(node.id, parts);\n break;\n\n case \"ParenthesizedExpression\":\n gatherNodeParts(node.expression, parts);\n break;\n\n case \"UnaryExpression\":\n case \"UpdateExpression\":\n gatherNodeParts(node.argument, parts);\n break;\n\n case \"MetaProperty\":\n gatherNodeParts(node.meta, parts);\n gatherNodeParts(node.property, parts);\n break;\n\n case \"JSXElement\":\n gatherNodeParts(node.openingElement, parts);\n break;\n\n case \"JSXOpeningElement\":\n gatherNodeParts(node.name, parts);\n break;\n\n case \"JSXFragment\":\n gatherNodeParts(node.openingFragment, parts);\n break;\n\n case \"JSXOpeningFragment\":\n parts.push(\"Fragment\");\n break;\n\n case \"JSXNamespacedName\":\n gatherNodeParts(node.namespace, parts);\n gatherNodeParts(node.name, parts);\n break;\n }\n}\n\n//\ninterface CollectVisitorState {\n assignments: NodePath<t.AssignmentExpression>[];\n references: NodePath<t.Identifier | t.JSXIdentifier>[];\n constantViolations: NodePath[];\n}\n\nconst collectorVisitor: Visitor<CollectVisitorState> = {\n ForStatement(path) {\n const declar = path.get(\"init\");\n // delegate block scope handling to the `BlockScoped` method\n if (declar.isVar()) {\n const { scope } = path;\n const parentScope = scope.getFunctionParent() || scope.getProgramParent();\n parentScope.registerBinding(\"var\", declar);\n }\n },\n\n Declaration(path) {\n // delegate block scope handling to the `BlockScoped` method\n if (path.isBlockScoped()) return;\n\n // delegate import handing to the `ImportDeclaration` method\n if (path.isImportDeclaration()) return;\n\n // this will be hit again once we traverse into it after this iteration\n if (path.isExportDeclaration()) return;\n\n // we've ran into a declaration!\n const parent =\n path.scope.getFunctionParent() || path.scope.getProgramParent();\n parent.registerDeclaration(path);\n },\n\n ImportDeclaration(path) {\n // import may only appear in the top level or inside a module/namespace (for TS/flow)\n const parent = path.scope.getBlockParent();\n\n parent.registerDeclaration(path);\n },\n\n ReferencedIdentifier(path, state) {\n state.references.push(path);\n },\n\n ForXStatement(path, state) {\n const left = path.get(\"left\");\n if (left.isPattern() || left.isIdentifier()) {\n state.constantViolations.push(path);\n }\n // delegate block scope handling to the `BlockScoped` method\n else if (left.isVar()) {\n const { scope } = path;\n const parentScope = scope.getFunctionParent() || scope.getProgramParent();\n parentScope.registerBinding(\"var\", left);\n }\n },\n\n ExportDeclaration: {\n exit(path) {\n const { node, scope } = path;\n // ExportAllDeclaration does not have `declaration`\n if (isExportAllDeclaration(node)) return;\n const declar = node.declaration;\n if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {\n const id = declar.id;\n if (!id) return;\n\n const binding = scope.getBinding(id.name);\n binding?.reference(path);\n } else if (isVariableDeclaration(declar)) {\n for (const decl of declar.declarations) {\n for (const name of Object.keys(getBindingIdentifiers(decl))) {\n const binding = scope.getBinding(name);\n binding?.reference(path);\n }\n }\n }\n },\n },\n\n LabeledStatement(path) {\n path.scope.getBlockParent().registerDeclaration(path);\n },\n\n AssignmentExpression(path, state) {\n state.assignments.push(path);\n },\n\n UpdateExpression(path, state) {\n state.constantViolations.push(path);\n },\n\n UnaryExpression(path, state) {\n if (path.node.operator === \"delete\") {\n state.constantViolations.push(path);\n }\n },\n\n BlockScoped(path) {\n let scope = path.scope;\n if (scope.path === path) scope = scope.parent;\n\n const parent = scope.getBlockParent();\n parent.registerDeclaration(path);\n\n // Register class identifier in class' scope if this is a class declaration.\n if (path.isClassDeclaration() && path.node.id) {\n const id = path.node.id;\n const name = id.name;\n\n path.scope.bindings[name] = path.scope.parent.getBinding(name);\n }\n },\n\n CatchClause(path) {\n path.scope.registerBinding(\"let\", path);\n },\n\n Function(path) {\n const params: Array<NodePath> = path.get(\"params\");\n for (const param of params) {\n path.scope.registerBinding(\"param\", param);\n }\n\n // Register function expression id after params. When the id\n // collides with a function param, the id effectively can't be\n // referenced: here we registered it as a constantViolation\n if (\n path.isFunctionExpression() &&\n path.node.id &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING]\n ) {\n path.scope.registerBinding(\"local\", path.get(\"id\"), path);\n }\n },\n\n ClassExpression(path) {\n if (\n path.node.id &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING]\n ) {\n path.scope.registerBinding(\"local\", path.get(\"id\"), path);\n }\n },\n TSTypeAnnotation(path) {\n path.skip();\n },\n};\n\nlet uid = 0;\n\nexport type { Binding };\n\nexport { Scope as default };\nclass Scope {\n uid;\n\n path: NodePath;\n block: t.Pattern | t.Scopable;\n\n inited;\n\n labels: Map<string, NodePath<t.LabeledStatement>>;\n bindings: { [name: string]: Binding };\n references: { [name: string]: true };\n globals: { [name: string]: t.Identifier | t.JSXIdentifier };\n uids: { [name: string]: boolean };\n data: { [key: string | symbol]: unknown };\n crawling: boolean;\n\n /**\n * This searches the current \"scope\" and collects all references/bindings\n * within.\n */\n constructor(path: NodePath<t.Pattern | t.Scopable>) {\n const { node } = path;\n const cached = scopeCache.get(node);\n // Sometimes, a scopable path is placed higher in the AST tree.\n // In these cases, have to create a new Scope.\n if (cached?.path === path) {\n return cached;\n }\n scopeCache.set(node, this);\n\n this.uid = uid++;\n\n this.block = node;\n this.path = path;\n\n this.labels = new Map();\n this.inited = false;\n }\n\n /**\n * Globals.\n */\n\n static globals = Object.keys(globals.builtin);\n\n /**\n * Variables available in current context.\n */\n\n static contextVariables = [\"arguments\", \"undefined\", \"Infinity\", \"NaN\"];\n\n get parent() {\n let parent,\n path = this.path;\n do {\n // Skip method scope if coming from inside computed key or decorator expression\n const shouldSkip = path.key === \"key\" || path.listKey === \"decorators\";\n path = path.parentPath;\n if (shouldSkip && path.isMethod()) path = path.parentPath;\n if (path?.isScope()) parent = path;\n } while (path && !parent);\n\n return parent?.scope;\n }\n\n /**\n * Generate a unique identifier and add it to the current scope.\n */\n\n generateDeclaredUidIdentifier(name?: string) {\n const id = this.generateUidIdentifier(name);\n this.push({ id });\n return cloneNode(id);\n }\n\n /**\n * Generate a unique identifier.\n */\n\n generateUidIdentifier(name?: string) {\n return identifier(this.generateUid(name));\n }\n\n /**\n * Generate a unique `_id1` binding.\n */\n\n generateUid(name: string = \"temp\"): string {\n name = toIdentifier(name).replace(/^_+/, \"\").replace(/\\d+$/g, \"\");\n\n let uid;\n let i = 1;\n do {\n uid = `_${name}`;\n if (i > 1) uid += i;\n i++;\n } while (\n this.hasLabel(uid) ||\n this.hasBinding(uid) ||\n this.hasGlobal(uid) ||\n this.hasReference(uid)\n );\n\n const program = this.getProgramParent();\n program.references[uid] = true;\n program.uids[uid] = true;\n\n return uid;\n }\n\n generateUidBasedOnNode(node: t.Node, defaultName?: string) {\n const parts: NodePart[] = [];\n gatherNodeParts(node, parts);\n\n let id = parts.join(\"$\");\n id = id.replace(/^_/, \"\") || defaultName || \"ref\";\n\n return this.generateUid(id.slice(0, 20));\n }\n\n /**\n * Generate a unique identifier based on a node.\n */\n\n generateUidIdentifierBasedOnNode(node: t.Node, defaultName?: string) {\n return identifier(this.generateUidBasedOnNode(node, defaultName));\n }\n\n /**\n * Determine whether evaluating the specific input `node` is a consequenceless reference. ie.\n * evaluating it won't result in potentially arbitrary code from being ran. The following are\n * allowed and determined not to cause side effects:\n *\n * - `this` expressions\n * - `super` expressions\n * - Bound identifiers\n */\n\n isStatic(node: t.Node): boolean {\n if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {\n return true;\n }\n\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (binding) {\n return binding.constant;\n } else {\n return this.hasBinding(node.name);\n }\n }\n\n return false;\n }\n\n /**\n * Possibly generate a memoised identifier if it is not static and has consequences.\n */\n\n maybeGenerateMemoised(node: t.Node, dontPush?: boolean) {\n if (this.isStatic(node)) {\n return null;\n } else {\n const id = this.generateUidIdentifierBasedOnNode(node);\n if (!dontPush) {\n this.push({ id });\n return cloneNode(id);\n }\n return id;\n }\n }\n\n checkBlockScopedCollisions(\n local: Binding,\n kind: BindingKind,\n name: string,\n id: any,\n ) {\n // ignore parameters\n if (kind === \"param\") return;\n\n // Ignore existing binding if it's the name of the current function or\n // class expression\n if (local.kind === \"local\") return;\n\n const duplicate =\n // don't allow duplicate bindings to exist alongside\n kind === \"let\" ||\n local.kind === \"let\" ||\n local.kind === \"const\" ||\n local.kind === \"module\" ||\n // don't allow a local of param with a kind of let\n (local.kind === \"param\" && kind === \"const\");\n\n if (duplicate) {\n throw this.path.hub.buildError(\n id,\n `Duplicate declaration \"${name}\"`,\n TypeError,\n );\n }\n }\n\n rename(\n oldName: string,\n newName?: string,\n // prettier-ignore\n /* Babel 7 - block?: t.Pattern | t.Scopable */\n ) {\n const binding = this.getBinding(oldName);\n if (binding) {\n newName ||= this.generateUidIdentifier(oldName).name;\n const renamer = new Renamer(binding, oldName, newName);\n if (process.env.BABEL_8_BREAKING) {\n renamer.rename();\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) TODO: Delete this\n renamer.rename(arguments[2]);\n }\n }\n }\n\n dump() {\n const sep = \"-\".repeat(60);\n console.log(sep);\n let scope: Scope = this;\n do {\n console.log(\"#\", scope.block.type);\n for (const name of Object.keys(scope.bindings)) {\n const binding = scope.bindings[name];\n console.log(\" -\", name, {\n constant: binding.constant,\n references: binding.references,\n violations: binding.constantViolations.length,\n kind: binding.kind,\n });\n }\n } while ((scope = scope.parent));\n console.log(sep);\n }\n\n hasLabel(name: string) {\n return !!this.getLabel(name);\n }\n\n getLabel(name: string) {\n return this.labels.get(name);\n }\n\n registerLabel(path: NodePath<t.LabeledStatement>) {\n this.labels.set(path.node.label.name, path);\n }\n\n registerDeclaration(path: NodePath) {\n if (path.isLabeledStatement()) {\n this.registerLabel(path);\n } else if (path.isFunctionDeclaration()) {\n this.registerBinding(\"hoisted\", path.get(\"id\"), path);\n } else if (path.isVariableDeclaration()) {\n const declarations = path.get(\"declarations\");\n const { kind } = path.node;\n for (const declar of declarations) {\n this.registerBinding(\n kind === \"using\" || kind === \"await using\" ? \"const\" : kind,\n declar,\n );\n }\n } else if (path.isClassDeclaration()) {\n if (path.node.declare) return;\n this.registerBinding(\"let\", path);\n } else if (path.isImportDeclaration()) {\n const isTypeDeclaration =\n path.node.importKind === \"type\" || path.node.importKind === \"typeof\";\n const specifiers = path.get(\"specifiers\");\n for (const specifier of specifiers) {\n const isTypeSpecifier =\n isTypeDeclaration ||\n (specifier.isImportSpecifier() &&\n (specifier.node.importKind === \"type\" ||\n specifier.node.importKind === \"typeof\"));\n\n this.registerBinding(isTypeSpecifier ? \"unknown\" : \"module\", specifier);\n }\n } else if (path.isExportDeclaration()) {\n // todo: improve babel-types\n const declar = path.get(\"declaration\") as NodePath;\n if (\n declar.isClassDeclaration() ||\n declar.isFunctionDeclaration() ||\n declar.isVariableDeclaration()\n ) {\n this.registerDeclaration(declar);\n }\n } else {\n this.registerBinding(\"unknown\", path);\n }\n }\n\n buildUndefinedNode() {\n return buildUndefinedNode();\n }\n\n registerConstantViolation(path: NodePath) {\n const ids = path.getAssignmentIdentifiers();\n for (const name of Object.keys(ids)) {\n this.getBinding(name)?.reassign(path);\n }\n }\n\n registerBinding(\n kind: Binding[\"kind\"],\n path: NodePath,\n bindingPath: NodePath = path,\n ) {\n if (!kind) throw new ReferenceError(\"no `kind`\");\n\n if (path.isVariableDeclaration()) {\n const declarators: Array<NodePath> = path.get(\"declarations\");\n for (const declar of declarators) {\n this.registerBinding(kind, declar);\n }\n return;\n }\n\n const parent = this.getProgramParent();\n const ids = path.getOuterBindingIdentifiers(true);\n\n for (const name of Object.keys(ids)) {\n parent.references[name] = true;\n\n for (const id of ids[name]) {\n const local = this.getOwnBinding(name);\n\n if (local) {\n // same identifier so continue safely as we're likely trying to register it\n // multiple times\n if (local.identifier === id) continue;\n\n this.checkBlockScopedCollisions(local, kind, name, id);\n }\n\n // A redeclaration of an existing variable is a modification\n if (local) {\n local.reassign(bindingPath);\n } else {\n this.bindings[name] = new Binding({\n identifier: id,\n scope: this,\n path: bindingPath,\n kind: kind,\n });\n }\n }\n }\n }\n\n addGlobal(node: t.Identifier | t.JSXIdentifier) {\n this.globals[node.name] = node;\n }\n\n hasUid(name: string): boolean {\n let scope: Scope = this;\n\n do {\n if (scope.uids[name]) return true;\n } while ((scope = scope.parent));\n\n return false;\n }\n\n hasGlobal(name: string): boolean {\n let scope: Scope = this;\n\n do {\n if (scope.globals[name]) return true;\n } while ((scope = scope.parent));\n\n return false;\n }\n\n hasReference(name: string): boolean {\n return !!this.getProgramParent().references[name];\n }\n\n isPure(node: t.Node, constantsOnly?: boolean): boolean {\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (!binding) return false;\n if (constantsOnly) return binding.constant;\n return true;\n } else if (\n isThisExpression(node) ||\n isMetaProperty(node) ||\n isTopicReference(node) ||\n isPrivateName(node)\n ) {\n return true;\n } else if (isClass(node)) {\n if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {\n return false;\n }\n if (node.decorators?.length > 0) {\n return false;\n }\n return this.isPure(node.body, constantsOnly);\n } else if (isClassBody(node)) {\n for (const method of node.body) {\n if (!this.isPure(method, constantsOnly)) return false;\n }\n return true;\n } else if (isBinary(node)) {\n return (\n this.isPure(node.left, constantsOnly) &&\n this.isPure(node.right, constantsOnly)\n );\n } else if (isArrayExpression(node) || isTupleExpression(node)) {\n for (const elem of node.elements) {\n if (elem !== null && !this.isPure(elem, constantsOnly)) return false;\n }\n return true;\n } else if (isObjectExpression(node) || isRecordExpression(node)) {\n for (const prop of node.properties) {\n if (!this.isPure(prop, constantsOnly)) return false;\n }\n return true;\n } else if (isMethod(node)) {\n if (node.computed && !this.isPure(node.key, constantsOnly)) return false;\n if (node.decorators?.length > 0) {\n return false;\n }\n return true;\n } else if (isProperty(node)) {\n // @ts-expect-error todo(flow->ts): computed in not present on private properties\n if (node.computed && !this.isPure(node.key, constantsOnly)) return false;\n if (node.decorators?.length > 0) {\n return false;\n }\n if (isObjectProperty(node) || node.static) {\n if (node.value !== null && !this.isPure(node.value, constantsOnly)) {\n return false;\n }\n }\n return true;\n } else if (isUnaryExpression(node)) {\n return this.isPure(node.argument, constantsOnly);\n } else if (isTemplateLiteral(node)) {\n for (const expression of node.expressions) {\n if (!this.isPure(expression, constantsOnly)) return false;\n }\n return true;\n } else if (isTaggedTemplateExpression(node)) {\n return (\n matchesPattern(node.tag, \"String.raw\") &&\n !this.hasBinding(\"String\", { noGlobals: true }) &&\n this.isPure(node.quasi, constantsOnly)\n );\n } else if (isMemberExpression(node)) {\n return (\n !node.computed &&\n isIdentifier(node.object) &&\n node.object.name === \"Symbol\" &&\n isIdentifier(node.property) &&\n node.property.name !== \"for\" &&\n !this.hasBinding(\"Symbol\", { noGlobals: true })\n );\n } else if (isCallExpression(node)) {\n return (\n matchesPattern(node.callee, \"Symbol.for\") &&\n !this.hasBinding(\"Symbol\", { noGlobals: true }) &&\n node.arguments.length === 1 &&\n t.isStringLiteral(node.arguments[0])\n );\n } else {\n return isPureish(node);\n }\n }\n\n /**\n * Set some arbitrary data on the current scope.\n */\n\n setData(key: string | symbol, val: any) {\n return (this.data[key] = val);\n }\n\n /**\n * Recursively walk up scope tree looking for the data `key`.\n */\n\n getData(key: string | symbol): any {\n let scope: Scope = this;\n do {\n const data = scope.data[key];\n if (data != null) return data;\n } while ((scope = scope.parent));\n }\n\n /**\n * Recursively walk up scope tree looking for the data `key` and if it exists,\n * remove it.\n */\n\n removeData(key: string) {\n let scope: Scope = this;\n do {\n const data = scope.data[key];\n if (data != null) scope.data[key] = null;\n } while ((scope = scope.parent));\n }\n\n init() {\n if (!this.inited) {\n this.inited = true;\n this.crawl();\n }\n }\n\n crawl() {\n const path = this.path;\n\n this.references = Object.create(null);\n this.bindings = Object.create(null);\n this.globals = Object.create(null);\n this.uids = Object.create(null);\n this.data = Object.create(null);\n\n let scope: Scope = this;\n do {\n if (scope.crawling) return;\n if (scope.path.isProgram()) {\n break;\n }\n } while ((scope = scope.parent));\n\n const programParent = scope;\n\n const state: CollectVisitorState = {\n references: [],\n constantViolations: [],\n assignments: [],\n };\n\n this.crawling = true;\n // traverse does not visit the root node, here we explicitly collect\n // root node binding info when the root is not a Program.\n if (path.type !== \"Program\" && isExplodedVisitor(collectorVisitor)) {\n for (const visit of collectorVisitor.enter) {\n visit.call(state, path, state);\n }\n const typeVisitors = collectorVisitor[path.type];\n if (typeVisitors) {\n for (const visit of typeVisitors.enter) {\n visit.call(state, path, state);\n }\n }\n }\n path.traverse(collectorVisitor, state);\n this.crawling = false;\n\n // register assignments\n for (const path of state.assignments) {\n // register undeclared bindings as globals\n const ids = path.getAssignmentIdentifiers();\n for (const name of Object.keys(ids)) {\n if (path.scope.getBinding(name)) continue;\n programParent.addGlobal(ids[name]);\n }\n\n // register as constant violation\n path.scope.registerConstantViolation(path);\n }\n\n // register references\n for (const ref of state.references) {\n const binding = ref.scope.getBinding(ref.node.name);\n if (binding) {\n binding.reference(ref);\n } else {\n programParent.addGlobal(ref.node);\n }\n }\n\n // register constant violations\n for (const path of state.constantViolations) {\n path.scope.registerConstantViolation(path);\n }\n }\n\n push(opts: {\n id: t.ArrayPattern | t.Identifier | t.ObjectPattern;\n init?: t.Expression;\n unique?: boolean;\n _blockHoist?: number | undefined;\n kind?: \"var\" | \"let\" | \"const\";\n }) {\n let path = this.path;\n\n if (path.isPattern()) {\n path = this.getPatternParent().path;\n } else if (!path.isBlockStatement() && !path.isProgram()) {\n path = this.getBlockParent().path;\n }\n\n if (path.isSwitchStatement()) {\n path = (this.getFunctionParent() || this.getProgramParent()).path;\n }\n\n const { init, unique, kind = \"var\", id } = opts;\n\n // When injecting a non-const non-initialized binding inside\n // an IIFE, if the number of call arguments is less than or\n // equal to the number of function parameters, we can safely\n // inject the binding into the parameter list.\n if (\n !init &&\n !unique &&\n (kind === \"var\" || kind === \"let\") &&\n path.isFunction() &&\n // @ts-expect-error ArrowFunctionExpression never has a name\n !path.node.name &&\n isCallExpression(path.parent, { callee: path.node }) &&\n path.parent.arguments.length <= path.node.params.length &&\n isIdentifier(id)\n ) {\n path.pushContainer(\"params\", id);\n path.scope.registerBinding(\n \"param\",\n path.get(\"params\")[path.node.params.length - 1],\n );\n return;\n }\n\n if (path.isLoop() || path.isCatchClause() || path.isFunction()) {\n path.ensureBlock();\n path = path.get(\"body\");\n }\n\n const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;\n\n const dataKey = `declaration:${kind}:${blockHoist}`;\n let declarPath = !unique && path.getData(dataKey);\n\n if (!declarPath) {\n const declar = variableDeclaration(kind, []);\n // @ts-expect-error todo(flow->ts): avoid modifying nodes\n declar._blockHoist = blockHoist;\n\n [declarPath] = (path as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n [declar],\n );\n if (!unique) path.setData(dataKey, declarPath);\n }\n\n const declarator = variableDeclarator(id, init);\n const len = declarPath.node.declarations.push(declarator);\n path.scope.registerBinding(kind, declarPath.get(\"declarations\")[len - 1]);\n }\n\n /**\n * Walk up to the top of the scope tree and get the `Program`.\n */\n\n getProgramParent() {\n let scope: Scope = this;\n do {\n if (scope.path.isProgram()) {\n return scope;\n }\n } while ((scope = scope.parent));\n throw new Error(\"Couldn't find a Program\");\n }\n\n /**\n * Walk up the scope tree until we hit either a Function or return null.\n */\n\n getFunctionParent(): Scope | null {\n let scope: Scope = this;\n do {\n if (scope.path.isFunctionParent()) {\n return scope;\n }\n } while ((scope = scope.parent));\n return null;\n }\n\n /**\n * Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the\n * very top and hit Program.\n */\n\n getBlockParent() {\n let scope: Scope = this;\n do {\n if (scope.path.isBlockParent()) {\n return scope;\n }\n } while ((scope = scope.parent));\n throw new Error(\n \"We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...\",\n );\n }\n\n /**\n * Walk up from a pattern scope (function param initializer) until we hit a non-pattern scope,\n * then returns its block parent\n * @returns An ancestry scope whose path is a block parent\n */\n getPatternParent() {\n let scope: Scope = this;\n do {\n if (!scope.path.isPattern()) {\n return scope.getBlockParent();\n }\n } while ((scope = scope.parent.parent));\n throw new Error(\n \"We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...\",\n );\n }\n\n /**\n * Walks the scope tree and gathers **all** bindings.\n */\n\n getAllBindings(): Record<string, Binding> {\n const ids = Object.create(null);\n\n let scope: Scope = this;\n do {\n for (const key of Object.keys(scope.bindings)) {\n if (key in ids === false) {\n ids[key] = scope.bindings[key];\n }\n }\n scope = scope.parent;\n } while (scope);\n\n return ids;\n }\n\n bindingIdentifierEquals(name: string, node: t.Node): boolean {\n return this.getBindingIdentifier(name) === node;\n }\n\n getBinding(name: string): Binding | undefined {\n let scope: Scope = this;\n let previousPath;\n\n do {\n const binding = scope.getOwnBinding(name);\n if (binding) {\n // Check if a pattern is a part of parameter expressions.\n // Note: for performance reason we skip checking previousPath.parentPath.isFunction()\n // because `scope.path` is validated as scope in packages/babel-types/src/validators/isScope.js\n // That is, if a scope path is pattern, its parent must be Function/CatchClause\n\n // Spec 9.2.10.28: The closure created by this expression should not have visibility of\n // declarations in the function body. If the binding is not a `param`-kind (as function parameters)\n // or `local`-kind (as id in function expression),\n // then it must be defined inside the function body, thus it should be skipped\n if (\n previousPath?.isPattern() &&\n binding.kind !== \"param\" &&\n binding.kind !== \"local\"\n ) {\n // do nothing\n } else {\n return binding;\n }\n } else if (\n !binding &&\n name === \"arguments\" &&\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n previousPath = scope.path;\n } while ((scope = scope.parent));\n }\n\n getOwnBinding(name: string): Binding | undefined {\n return this.bindings[name];\n }\n\n // todo: return probably can be undefined…\n getBindingIdentifier(name: string): t.Identifier {\n return this.getBinding(name)?.identifier;\n }\n\n // todo: flow->ts return probably can be undefined\n getOwnBindingIdentifier(name: string): t.Identifier {\n const binding = this.bindings[name];\n return binding?.identifier;\n }\n\n hasOwnBinding(name: string) {\n return !!this.getOwnBinding(name);\n }\n\n // By default, we consider generated UIDs as bindings.\n // This is because they are almost always used to declare variables,\n // and since the scope isn't always up-to-date it's better to assume that\n // there is a variable with that name. The `noUids` option can be used to\n // turn off this behavior, for example if you know that the generate UID\n // was used to declare a variable in a different scope.\n hasBinding(\n name: string,\n opts?: boolean | { noGlobals?: boolean; noUids?: boolean },\n ) {\n if (!name) return false;\n let scope: Scope = this;\n do {\n if (scope.hasOwnBinding(name)) {\n return true;\n }\n } while ((scope = scope.parent));\n\n // TODO: Only accept the object form.\n let noGlobals;\n let noUids;\n if (typeof opts === \"object\") {\n noGlobals = opts.noGlobals;\n noUids = opts.noUids;\n } else if (typeof opts === \"boolean\") {\n noGlobals = opts;\n }\n\n if (!noUids && this.hasUid(name)) return true;\n if (!noGlobals && Scope.globals.includes(name)) return true;\n if (!noGlobals && Scope.contextVariables.includes(name)) return true;\n return false;\n }\n\n parentHasBinding(\n name: string,\n opts?: { noGlobals?: boolean; noUids?: boolean },\n ) {\n return this.parent?.hasBinding(name, opts);\n }\n\n /**\n * Move a binding of `name` to another `scope`.\n */\n\n moveBindingTo(name: string, scope: Scope) {\n const info = this.getBinding(name);\n if (info) {\n info.scope.removeOwnBinding(name);\n info.scope = scope;\n scope.bindings[name] = info;\n }\n }\n\n removeOwnBinding(name: string) {\n delete this.bindings[name];\n }\n\n removeBinding(name: string) {\n // clear literal binding\n this.getBinding(name)?.scope.removeOwnBinding(name);\n\n // clear uids with this name - https://github.com/babel/babel/issues/2101\n let scope: Scope = this;\n do {\n if (scope.uids[name]) {\n scope.uids[name] = false;\n }\n } while ((scope = scope.parent));\n }\n\n /**\n * Hoist all the `var` variable to the beginning of the function/program\n * scope where their binding will be actually defined. For exmaple,\n * { var x = 2 }\n * will be transformed to\n * var x; { x = 2 }\n *\n * @param emit A custom function to emit `var` declarations, for example to\n * emit them in a different scope.\n */\n hoistVariables(\n emit: (id: t.Identifier, hasInit: boolean) => void = id =>\n this.push({ id }),\n ) {\n this.crawl();\n\n const seen = new Set();\n for (const name of Object.keys(this.bindings)) {\n const binding = this.bindings[name];\n if (!binding) continue;\n const { path } = binding;\n if (!path.isVariableDeclarator()) continue;\n const { parent, parentPath } = path;\n\n if (parent.kind !== \"var\" || seen.has(parent)) continue;\n seen.add(path.parent);\n\n let firstId;\n const init = [];\n for (const decl of parent.declarations) {\n firstId ??= decl.id;\n if (decl.init) {\n init.push(assignmentExpression(\"=\", decl.id, decl.init));\n }\n\n const ids = Object.keys(getBindingIdentifiers(decl, false, true, true));\n for (const name of ids) {\n emit(identifier(name), decl.init != null);\n }\n }\n\n // for (var i in test)\n if (parentPath.parentPath.isFor({ left: parent })) {\n parentPath.replaceWith(firstId);\n } else if (init.length === 0) {\n parentPath.remove();\n } else {\n const expr = init.length === 1 ? init[0] : sequenceExpression(init);\n if (parentPath.parentPath.isForStatement({ init: parent })) {\n parentPath.replaceWith(expr);\n } else {\n parentPath.replaceWith(expressionStatement(expr));\n }\n }\n }\n }\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /** @deprecated Not used in our codebase */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype._renameFromMap = function _renameFromMap(\n map: Record<string | symbol, unknown>,\n oldName: string | symbol,\n newName: string | symbol,\n value: unknown,\n ) {\n if (map[oldName]) {\n map[newName] = value;\n map[oldName] = null;\n }\n };\n\n /**\n * Traverse node with current scope and path.\n *\n * !!! WARNING !!!\n * This method assumes that `this.path` is the NodePath representing `node`.\n * After running the traversal, the `.parentPath` of the NodePaths\n * corresponding to `node`'s children will be set to `this.path`.\n *\n * There is no good reason to use this method, since the only safe way to use\n * it is equivalent to `scope.path.traverse(opts, state)`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.traverse = function <S>(\n this: Scope,\n node: any,\n opts: any,\n state?: S,\n ) {\n traverse(node, opts, this, state, this.path);\n };\n\n /**\n * Generate an `_id1`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype._generateUid = function _generateUid(\n name: string,\n i: number,\n ) {\n let id = name;\n if (i > 1) id += i;\n return `_${id}`;\n };\n\n // TODO: (Babel 8) Split i in two parameters, and use an object of flags\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.toArray = function toArray(\n this: Scope,\n node: t.Node,\n i?: number | boolean,\n arrayLikeIsIterable?: boolean | void,\n ) {\n if (isIdentifier(node)) {\n const binding = this.getBinding(node.name);\n if (binding?.constant && binding.path.isGenericType(\"Array\")) {\n return node;\n }\n }\n\n if (isArrayExpression(node)) {\n return node;\n }\n\n if (isIdentifier(node, { name: \"arguments\" })) {\n return callExpression(\n memberExpression(\n memberExpression(\n memberExpression(identifier(\"Array\"), identifier(\"prototype\")),\n identifier(\"slice\"),\n ),\n identifier(\"call\"),\n ),\n [node],\n );\n }\n\n let helperName;\n const args = [node];\n if (i === true) {\n // Used in array-spread to create an array.\n helperName = \"toConsumableArray\";\n } else if (typeof i === \"number\") {\n args.push(numericLiteral(i));\n\n // Used in array-rest to create an array from a subset of an iterable.\n helperName = \"slicedToArray\";\n // TODO if (this.hub.isLoose(\"es6.forOf\")) helperName += \"-loose\";\n } else {\n // Used in array-rest to create an array\n helperName = \"toArray\";\n }\n\n if (arrayLikeIsIterable) {\n args.unshift(this.path.hub.addHelper(helperName));\n helperName = \"maybeArrayLike\";\n }\n\n // @ts-expect-error todo(flow->ts): t.Node is not valid to use in args, function argument typeneeds to be clarified\n return callExpression(this.path.hub.addHelper(helperName), args);\n };\n\n /**\n * Walks the scope tree and gathers all declarations of `kind`.\n */\n // @ts-expect-error Babel 7 compatibility\n Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(\n ...kinds: string[]\n ): Record<string, Binding> {\n const ids = Object.create(null);\n\n for (const kind of kinds) {\n let scope: Scope = this;\n do {\n for (const name of Object.keys(scope.bindings)) {\n const binding = scope.bindings[name];\n if (binding.kind === kind) ids[name] = binding;\n }\n scope = scope.parent;\n } while (scope);\n }\n\n return ids;\n };\n\n Object.defineProperties(Scope.prototype, {\n parentBlock: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.parent;\n },\n },\n hub: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.hub;\n },\n },\n });\n}\n\ntype _Binding = Binding;\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Scope {\n export type Binding = _Binding;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AAkDsB,IAAAK,CAAA,GAAAD,EAAA;AAEtB,IAAAE,MAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AAAmD;EArDjDQ,iBAAiB;EACjBC,oBAAoB;EACpBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,UAAU;EACVC,iBAAiB;EACjBC,QAAQ;EACRC,gBAAgB;EAChBC,OAAO;EACPC,WAAW;EACXC,kBAAkB;EAClBC,sBAAsB;EACtBC,0BAA0B;EAC1BC,wBAAwB;EACxBC,qBAAqB;EACrBC,YAAY;EACZC,mBAAmB;EACnBC,SAAS;EACTC,kBAAkB;EAClBC,QAAQ;EACRC,iBAAiB;EACjBC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,SAAS;EACTC,eAAe;EACfC,OAAO;EACPC,0BAA0B;EAC1BC,iBAAiB;EACjBC,gBAAgB;EAChBC,iBAAiB;EACjBC,qBAAqB;EACrBC,mBAAmB;EACnBC,cAAc;EACdC,gBAAgB;EAChBC,cAAc;EACdC,YAAY;EACZC,mBAAmB;EACnBC,kBAAkB;EAClBC,kBAAkB;EAClBC,iBAAiB;EACjBC,gBAAgB;EAChBC,gBAAgB;EAChBC,cAAc;EACdC,aAAa;EACbC,mBAAmB;EACnBC,kBAAkB;EAClBC;AAAkB,IAAApD,EAAA;AASpB,SAASqD,eAAeA,CAACC,IAAY,EAAEC,KAAiB,E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CAAChI,IAAI,CAAC,GAAGqC,OAAO;QAChD;QACAnB,KAAK,GAAGA,KAAK,CAACO,MAAM;MACtB,CAAC,QAAQP,KAAK;IAChB;IAEA,OAAO8G,GAAG;EACZ,CAAC;EAEDtF,MAAM,CAAC2M,gBAAgB,CAACxL,KAAK,CAAC2K,SAAS,EAAE;IACvCc,WAAW,EAAE;MACXC,YAAY,EAAE,IAAI;MAClBC,UAAU,EAAE,IAAI;MAChBxO,GAAGA,CAAA,EAAc;QACf,OAAO,IAAI,CAACF,IAAI,CAACW,MAAM;MACzB;IACF,CAAC;IACD6E,GAAG,EAAE;MACHiJ,YAAY,EAAE,IAAI;MAClBC,UAAU,EAAE,IAAI;MAChBxO,GAAGA,CAAA,EAAc;QACf,OAAO,IAAI,CAACF,IAAI,CAACwF,GAAG;MACtB;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
package/lib/visitors.js CHANGED
@@ -53,9 +53,11 @@ function explode$1(visitor) {
53
53
  const types = virtualTypes[nodeType];
54
54
  if (types !== null) {
55
55
  for (const type of types) {
56
- var _visitor$type;
57
- (_visitor$type = visitor[type]) != null ? _visitor$type : visitor[type] = {};
58
- mergePair(visitor[type], fns);
56
+ if (visitor[type]) {
57
+ mergePair(visitor[type], fns);
58
+ } else {
59
+ visitor[type] = fns;
60
+ }
59
61
  }
60
62
  } else {
61
63
  mergePair(visitor, fns);
@@ -102,7 +104,7 @@ function verify$1(visitor) {
102
104
  }
103
105
  if (shouldIgnoreKey(nodeType)) continue;
104
106
  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.26.3"}`);
107
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.26.5"}`);
106
108
  }
107
109
  const visitors = visitor[nodeType];
108
110
  if (typeof visitors === "object") {
@@ -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) {\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,iBAAiB,CAACC,OAAO,CAAC,EAAE,OAAOA,OAAO;EAE9CA,OAAO,CAACC,SAAS,GAAG,IAAI;EAGxB,KAAK,MAAME,QAAQ,IAAIC,MAAM,CAACC,IAAI,CAACL,OAAO,CAAC,EAAuB;IAChE,IAAIM,eAAe,CAACH,QAAQ,CAAC,EAAE;IAE/B,MAAMI,KAAoB,GAAGJ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AACzB,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","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 // merge the visitor if necessary or just put it back in\n if (visitor[type]) {\n mergePair(visitor[type], fns);\n } else {\n // @ts-expect-error Expression produces too complex union\n visitor[type] = fns;\n }\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) {\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,O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B,IAAI,CAAC;MAC5C,CAAC,MAAM;QACLA,IAAI,CAACyC,+BAA+B,CAAC,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,CAAI3E,OAAmB,EAAc;EACrE,OAAOoC,KAAK,CAAC,CAAC+B,mBAAmB,EAAEnE,OAAO,CAAC,CAAC;AAC9C","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.26.3",
3
+ "version": "7.26.5",
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",
@@ -17,10 +17,10 @@
17
17
  "main": "./lib/index.js",
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.26.2",
20
- "@babel/generator": "^7.26.3",
21
- "@babel/parser": "^7.26.3",
20
+ "@babel/generator": "^7.26.5",
21
+ "@babel/parser": "^7.26.5",
22
22
  "@babel/template": "^7.25.9",
23
- "@babel/types": "^7.26.3",
23
+ "@babel/types": "^7.26.5",
24
24
  "debug": "^4.3.1",
25
25
  "globals": "^11.1.0"
26
26
  },
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = traverseForScope;
7
- var _t = require("@babel/types");
8
- var _index = require("../index.js");
9
- var _visitors = require("../visitors.js");
10
- var _context = require("../path/context.js");
11
- const {
12
- VISITOR_KEYS
13
- } = _t;
14
- function traverseForScope(path, visitors, state) {
15
- const exploded = (0, _visitors.explode)(visitors);
16
- if (exploded.enter || exploded.exit) {
17
- throw new Error("Should not be used with enter/exit visitors.");
18
- }
19
- _traverse(path.parentPath, path.parent, path.node, path.container, path.key, path.listKey, path.hub);
20
- function _traverse(parentPath, parent, node, container, key, listKey, hub) {
21
- if (!node) {
22
- return;
23
- }
24
- const path = _index.NodePath.get({
25
- hub,
26
- parentPath,
27
- parent,
28
- container,
29
- listKey,
30
- key
31
- });
32
- (0, _context._forceSetScope)(path);
33
- const visitor = exploded[node.type];
34
- if (visitor) {
35
- if (visitor.enter) {
36
- for (const visit of visitor.enter) {
37
- visit.call(state, path, state);
38
- }
39
- }
40
- if (visitor.exit) {
41
- for (const visit of visitor.exit) {
42
- visit.call(state, path, state);
43
- }
44
- }
45
- }
46
- if (path.shouldSkip) {
47
- return;
48
- }
49
- const keys = VISITOR_KEYS[node.type];
50
- if (!(keys != null && keys.length)) {
51
- return;
52
- }
53
- for (const key of keys) {
54
- const prop = node[key];
55
- if (!prop) continue;
56
- if (Array.isArray(prop)) {
57
- for (let i = 0; i < prop.length; i++) {
58
- const value = prop[i];
59
- _traverse(path, node, value, prop, i, key);
60
- }
61
- } else {
62
- _traverse(path, node, prop, node, key, null);
63
- }
64
- }
65
- }
66
- }
67
-
68
- //# sourceMappingURL=traverseForScope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","NodePath","get","_forceSetScope","visitor","type","visit","call","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { _forceSetScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container,\n path.key,\n path.listKey,\n path.hub,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string,\n hub?: HubInterface,\n ) {\n if (!node) {\n return;\n }\n\n const path = NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n _forceSetScope(path);\n\n const visitor = exploded[node.type];\n if (visitor) {\n if (visitor.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n if (visitor.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAoD;EAL3CI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,QAAiB,EACjBC,KAAU,EACV;EACA,MAAMC,QAAQ,GAAG,IAAAC,iBAAO,EAACH,QAAQ,CAAC;EAElC,IAAIE,QAAQ,CAACE,KAAK,IAAIF,QAAQ,CAACG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