Changeset 0c6b92a for imaps-frontend/node_modules/@babel/traverse
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/@babel/traverse
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/traverse/lib/context.js
rd565449 r0c6b92a 7 7 var _index = require("./path/index.js"); 8 8 var _t = require("@babel/types"); 9 var _context = require("./path/context.js"); 9 10 const { 10 11 VISITOR_KEYS … … 77 78 const path = queue[visitIndex]; 78 79 visitIndex++; 79 path.resync();80 _context.resync.call(path); 80 81 if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { 81 path.pushContext(this);82 _context.pushContext.call(path, this); 82 83 } 83 84 if (path.key === null) continue; … … 99 100 } 100 101 for (let i = 0; i < visitIndex; i++) { 101 queue[i].popContext();102 _context.popContext.call(queue[i]); 102 103 } 103 104 this.queue = null; -
imaps-frontend/node_modules/@babel/traverse/lib/context.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_index","require","_t"," VISITOR_KEYS","TraversalContext","constructor","scope","opts","state","parentPath","queue","priorityQueue","shouldVisit","node","enter","exit","type","keys","length","key","create","container","listKey","NodePath","get","parent","maybeQueue","path","notPriority","push","visitMultiple","visitQueue","visitSingle","visited","WeakSet","stop","visitIndex","resync","contexts","pushContext","has","add","visit","i","popContext","nodes","Array","isArray","exports","default"],"sources":["../src/context.ts"],"sourcesContent":["import NodePath from \"./path/index.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type Scope from \"./scope/index.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Visitor } from \"./types.ts\";\n\nexport default class TraversalContext<S = unknown> {\n constructor(\n scope: Scope,\n opts: ExplodedTraverseOptions<S>,\n state: S,\n parentPath: NodePath,\n ) {\n this.parentPath = parentPath;\n this.scope = scope;\n this.state = state;\n this.opts = opts;\n }\n\n declare parentPath: NodePath;\n declare scope: Scope;\n declare state: S;\n declare opts: ExplodedTraverseOptions<S>;\n queue: Array<NodePath> | null = null;\n priorityQueue: Array<NodePath> | null = null;\n\n /**\n * This method does a simple check to determine whether or not we really need to attempt\n * visit a node. This will prevent us from constructing a NodePath.\n */\n\n shouldVisit(node: t.Node): boolean {\n const opts = this.opts as Visitor;\n if (opts.enter || opts.exit) return true;\n\n // check if we have a visitor for this node\n if (opts[node.type]) return true;\n\n // check if we're going to traverse into this node\n const keys: Array<string> | undefined = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n // we need to traverse into this node so ensure that it has children to traverse into!\n for (const key of keys) {\n if (\n // @ts-expect-error key is from visitor keys\n node[key]\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n create(\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey?: string,\n ): NodePath {\n // We don't need to `.setContext()` here, since `.visitQueue()` already\n // calls `.pushContext`.\n return NodePath.get({\n parentPath: this.parentPath,\n parent: node,\n container,\n key: key,\n listKey,\n });\n }\n\n maybeQueue(path: NodePath, notPriority?: boolean) {\n if (this.queue) {\n if (notPriority) {\n this.queue.push(path);\n } else {\n this.priorityQueue.push(path);\n }\n }\n }\n\n visitMultiple(container: t.Node[], parent: t.Node, listKey: string) {\n // nothing to traverse!\n if (container.length === 0) return false;\n\n const queue = [];\n\n // build up initial queue\n for (let key = 0; key < container.length; key++) {\n const node = container[key];\n if (node && this.shouldVisit(node)) {\n queue.push(this.create(parent, container, key, listKey));\n }\n }\n\n return this.visitQueue(queue);\n }\n\n visitSingle(node: t.Node, key: string): boolean {\n if (\n this.shouldVisit(\n // @ts-expect-error key may not index node\n node[key],\n )\n ) {\n return this.visitQueue([this.create(node, node, key)]);\n } else {\n return false;\n }\n }\n\n visitQueue(queue: Array<NodePath>): boolean {\n // set queue\n this.queue = queue;\n this.priorityQueue = [];\n\n const visited = new WeakSet();\n let stop = false;\n let visitIndex = 0;\n\n // visit the queue\n for (; visitIndex < queue.length; ) {\n const path = queue[visitIndex];\n visitIndex++;\n path.resync();\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== this\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n path.pushContext(this);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (path.visit()) {\n stop = true;\n break;\n }\n\n if (this.priorityQueue.length) {\n stop = this.visitQueue(this.priorityQueue);\n this.priorityQueue = [];\n this.queue = queue;\n if (stop) break;\n }\n }\n\n // pop contexts\n for (let i = 0; i < visitIndex; i++) {\n queue[i].popContext();\n }\n\n // clear queue\n this.queue = null;\n\n return stop;\n }\n\n visit(node: t.Node, key: string) {\n // @ts-expect-error key may not index node\n const nodes = node[key] as t.Node | t.Node[] | null;\n if (!nodes) return false;\n\n if (Array.isArray(nodes)) {\n return this.visitMultiple(nodes, node, key);\n } else {\n return this.visitSingle(node, key);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAA4C;EAAnCE;AAAY,IAAAD,EAAA;AAMN,MAAME,gBAAgB,CAAc;EACjDC,WAAWA,CACTC,KAAY,EACZC,IAAgC,EAChCC,KAAQ,EACRC,UAAoB,EACpB;IAAA,KAWFC,KAAK,GAA2B,IAAI;IAAA,KACpCC,aAAa,GAA2B,IAAI;IAX1C,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACH,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAcAK,WAAWA,CAACC,IAAY,EAAW;IACjC,MAAMN,IAAI,GAAG,IAAI,CAACA,IAAe;IACjC,IAAIA,IAAI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AAG,CAAC3B,IAAI,CAAC,EAAE;MACvB,IAAIA,IAAI,EAAEoB,OAAO,CAACQ,GAAG,CAAC5B,IAAI,CAAC;MAE3B,IAAIc,IAAI,CAACe,KAAK,CAAC,CAAC,EAAE;QAChBP,IAAI,GAAG,IAAI;QACX;MACF;MAEA,IAAI,IAAI,CAACxB,aAAa,CAACO,MAAM,EAAE;QAC7BiB,IAAI,GAAG,IAAI,CAACJ,UAAU,CAAC,IAAI,CAACpB,aAAa,CAAC;QAC1C,IAAI,CAACA,aAAa,GAAG,EAAE;QACvB,IAAI,CAACD,KAAK,GAAGA,KAAK;QAClB,IAAIyB,IAAI,EAAE;MACZ;IACF;IAGA,KAAK,IAAIQ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,UAAU,EAAEO,CAAC,EAAE,EAAE;MACnCjC,KAAK,CAACiC,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;IACvB;IAGA,IAAI,CAAClC,KAAK,GAAG,IAAI;IAEjB,OAAOyB,IAAI;EACb;EAEAO,KAAKA,CAAC7B,IAAY,EAAEM,GAAW,EAAE;IAE/B,MAAM0B,KAAK,GAAGhC,IAAI,CAACM,GAAG,CAA6B;IACnD,IAAI,CAAC0B,KAAK,EAAE,OAAO,KAAK;IAExB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI,CAACf,aAAa,CAACe,KAAK,EAAEhC,IAAI,EAAEM,GAAG,CAAC;IAC7C,CAAC,MAAM;MACL,OAAO,IAAI,CAACa,WAAW,CAACnB,IAAI,EAAEM,GAAG,CAAC;IACpC;EACF;AACF;AAAC6B,OAAA,CAAAC,OAAA,GAAA7C,gBAAA","ignoreList":[]}1 {"version":3,"names":["_index","require","_t","_context","VISITOR_KEYS","TraversalContext","constructor","scope","opts","state","parentPath","queue","priorityQueue","shouldVisit","node","enter","exit","type","keys","length","key","create","container","listKey","NodePath","get","parent","maybeQueue","path","notPriority","push","visitMultiple","visitQueue","visitSingle","visited","WeakSet","stop","visitIndex","resync","call","contexts","pushContext","has","add","visit","i","popContext","nodes","Array","isArray","exports","default"],"sources":["../src/context.ts"],"sourcesContent":["import NodePath from \"./path/index.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type Scope from \"./scope/index.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Visitor } from \"./types.ts\";\nimport { popContext, pushContext, resync } from \"./path/context.ts\";\n\nexport default class TraversalContext<S = unknown> {\n constructor(\n scope: Scope,\n opts: ExplodedTraverseOptions<S>,\n state: S,\n parentPath: NodePath,\n ) {\n this.parentPath = parentPath;\n this.scope = scope;\n this.state = state;\n this.opts = opts;\n }\n\n declare parentPath: NodePath;\n declare scope: Scope;\n declare state: S;\n declare opts: ExplodedTraverseOptions<S>;\n queue: Array<NodePath> | null = null;\n priorityQueue: Array<NodePath> | null = null;\n\n /**\n * This method does a simple check to determine whether or not we really need to attempt\n * visit a node. This will prevent us from constructing a NodePath.\n */\n\n shouldVisit(node: t.Node): boolean {\n const opts = this.opts as Visitor;\n if (opts.enter || opts.exit) return true;\n\n // check if we have a visitor for this node\n if (opts[node.type]) return true;\n\n // check if we're going to traverse into this node\n const keys: Array<string> | undefined = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n // we need to traverse into this node so ensure that it has children to traverse into!\n for (const key of keys) {\n if (\n // @ts-expect-error key is from visitor keys\n node[key]\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n create(\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey?: string,\n ): NodePath {\n // We don't need to `.setContext()` here, since `.visitQueue()` already\n // calls `.pushContext`.\n return NodePath.get({\n parentPath: this.parentPath,\n parent: node,\n container,\n key: key,\n listKey,\n });\n }\n\n maybeQueue(path: NodePath, notPriority?: boolean) {\n if (this.queue) {\n if (notPriority) {\n this.queue.push(path);\n } else {\n this.priorityQueue.push(path);\n }\n }\n }\n\n visitMultiple(container: t.Node[], parent: t.Node, listKey: string) {\n // nothing to traverse!\n if (container.length === 0) return false;\n\n const queue = [];\n\n // build up initial queue\n for (let key = 0; key < container.length; key++) {\n const node = container[key];\n if (node && this.shouldVisit(node)) {\n queue.push(this.create(parent, container, key, listKey));\n }\n }\n\n return this.visitQueue(queue);\n }\n\n visitSingle(node: t.Node, key: string): boolean {\n if (\n this.shouldVisit(\n // @ts-expect-error key may not index node\n node[key],\n )\n ) {\n return this.visitQueue([this.create(node, node, key)]);\n } else {\n return false;\n }\n }\n\n visitQueue(queue: Array<NodePath>): boolean {\n // set queue\n this.queue = queue;\n this.priorityQueue = [];\n\n const visited = new WeakSet();\n let stop = false;\n let visitIndex = 0;\n\n // visit the queue\n for (; visitIndex < queue.length; ) {\n const path = queue[visitIndex];\n visitIndex++;\n resync.call(path);\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== this\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n pushContext.call(path, this);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (path.visit()) {\n stop = true;\n break;\n }\n\n if (this.priorityQueue.length) {\n stop = this.visitQueue(this.priorityQueue);\n this.priorityQueue = [];\n this.queue = queue;\n if (stop) break;\n }\n }\n\n // pop contexts\n for (let i = 0; i < visitIndex; i++) {\n popContext.call(queue[i]);\n }\n\n // clear queue\n this.queue = null;\n\n return stop;\n }\n\n visit(node: t.Node, key: string) {\n // @ts-expect-error key may not index node\n const nodes = node[key] as t.Node | t.Node[] | null;\n if (!nodes) return false;\n\n if (Array.isArray(nodes)) {\n return this.visitMultiple(nodes, node, key);\n } else {\n return this.visitSingle(node, key);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC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AM2B,KAAK,GAAGjC,IAAI,CAACM,GAAG,CAA6B;IACnD,IAAI,CAAC2B,KAAK,EAAE,OAAO,KAAK;IAExB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI,CAAChB,aAAa,CAACgB,KAAK,EAAEjC,IAAI,EAAEM,GAAG,CAAC;IAC7C,CAAC,MAAM;MACL,OAAO,IAAI,CAACa,WAAW,CAACnB,IAAI,EAAEM,GAAG,CAAC;IACpC;EACF;AACF;AAAC8B,OAAA,CAAAC,OAAA,GAAA9C,gBAAA","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/context.js
rd565449 r0c6b92a 11 11 exports._resyncRemoved = _resyncRemoved; 12 12 exports.call = call; 13 exports.is Blacklisted = exports.isDenylisted = isDenylisted;13 exports.isDenylisted = isDenylisted; 14 14 exports.popContext = popContext; 15 15 exports.pushContext = pushContext; … … 62 62 var _this$opts$denylist; 63 63 const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist; 64 return denylist && denylist.indexOf(this.node.type) > -1; 64 return denylist == null ? void 0 : denylist.includes(this.node.type); 65 } 66 { 67 exports.isBlacklisted = isDenylisted; 65 68 } 66 69 function restoreContext(path, context) { … … 83 86 } 84 87 const currentContext = this.context; 85 if (this.shouldSkip || this.call("enter")) {88 if (this.shouldSkip || call.call(this, "enter")) { 86 89 this.debug("Skip..."); 87 90 return this.shouldStop; … … 91 94 this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys); 92 95 restoreContext(this, currentContext); 93 this.call("exit");96 call.call(this, "exit"); 94 97 return this.shouldStop; 95 98 } … … 133 136 this.opts = context.opts; 134 137 } 135 this.setScope();138 setScope.call(this); 136 139 return this; 137 140 } … … 155 158 for (let i = 0; i < this.container.length; i++) { 156 159 if (this.container[i] === this.node) { 157 this.setKey(i);160 setKey.call(this, i); 158 161 return; 159 162 } … … 162 165 for (const key of Object.keys(this.container)) { 163 166 if (this.container[key] === this.node) { 164 this.setKey(key);167 setKey.call(this, key); 165 168 return; 166 169 } … … 196 199 this.container = container; 197 200 this.parentPath = parentPath || this.parentPath; 198 this.setKey(key);201 setKey.call(this, key); 199 202 } 200 203 function setKey(key) { -
imaps-frontend/node_modules/@babel/traverse/lib/path/context.js.map
rd565449 r0c6b92a 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","in dexOf","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 && denylist.indexOf(this.node.type) > -1;\n}\n\n// TODO: Remove in Babel 8\nexport { isDenylisted as isBlacklisted };\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 || this.call(\"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 this.call(\"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 this.setScope();\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 this.setKey(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 this.setKey(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 this.setKey(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,CAACG,IAAI,CAAC,qBAApBD,oBAAA,CAAuBL,GAAG,CAAC,CAAC;EACtD;EAEA,OAAO,KAAK;AACd;AAEO,SAASI,KAAKA,CAAiBG,GAAqB,EAAW;EACpE,IAAI,CAACA,GAAG,EAAE,OAAO,KAAK;EAEtB,KAAK,MAAMC,EAAE,IAAID,GAAG,EAAE;IACpB,IAAI,CAACC,EAAE,EAAE;IAET,MAAML,IAAI,GAAG,IAAI,CAACA,IAAI;IACtB,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;IAEtB,MAAMM,GAAG,GAAGD,EAA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;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,CAACG,IAAI,CAAC,qBAApBD,oBAAA,CAAuBL,GAAG,CAAC,CAAC;EACtD;EAEA,OAAO,KAAK;AACd;AAEO,SAASI,KAAKA,CAAiBG,GAAqB,EAAW;EACpE,IAAI,CAACA,GAAG,EAAE,OAAO,KAAK;EAEtB,KAAK,MAAMC,EAAE,IAAID,GAAG,EAAE;IACpB,IAAI,CAACC,EAAE,EAAE;IAET,MAAML,IAAI,GAAG,IAAI,CAACA,IAAI;IACtB,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;IAEtB,MAAMM,GAAG,GAAGD,EAAE,CAACT,IAAI,CAAC,IAAI,CAACW,KAAK,EAAE,IAAI,EAAE,IAAI,CAACA,KAAK,CAAC;IACjD,IAAID,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,OA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OA,QAAQ;AACjB","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/conversion.js
rd565449 r0c6b92a 13 13 var _template = require("@babel/template"); 14 14 var _visitors = require("../visitors.js"); 15 var _context = require("./context.js"); 15 16 const { 16 17 arrowFunctionExpression, … … 97 98 this.node.body = blockStatement(statements); 98 99 const parentPath = this.get(stringPath); 99 body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);100 _context.setup.call(body, parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key); 100 101 return this.node; 101 102 } -
imaps-frontend/node_modules/@babel/traverse/lib/path/conversion.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_t","require","_template","_visitors"," arrowFunctionExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","conditionalExpression","expressionStatement","identifier","isIdentifier","jsxIdentifier","logicalExpression","LOGICAL_OPERATORS","memberExpression","metaProperty","numericLiteral","objectExpression","restElement","returnStatement","sequenceExpression","spreadElement","stringLiteral","super","_super","thisExpression","toExpression","unaryExpression","toBindingIdentifierName","isFunction","isAssignmentPattern","isRestElement","getFunctionName","cloneNode","variableDeclaration","variableDeclarator","exportNamedDeclaration","exportSpecifier","inherits","toComputedKey","key","isMemberExpression","node","property","isProperty","isMethod","ReferenceError","computed","name","ensureBlock","body","get","bodyNode","Array","isArray","Error","isBlockStatement","statements","stringPath","listKey","isStatement","push","parentPath","setup","exports","arrowFunctionToShadowed","isArrowFunctionExpression","arrowFunctionToExpression","unwrapFunctionEnvironment","isFunctionExpression","isFunctionDeclaration","buildCodeFrameError","hoistFunctionEnvironment","setType","path","type","allowInsertArrow","allowInsertArrowWithRest","noNewArrows","_arguments$","arguments","specCompliant","self","_self$ensureFunctionN","ensureFunctionName","thisBinding","fnPath","fn","checkBinding","scope","generateUidIdentifier","id","init","unshiftContainer","hub","addHelper","replaceWith","getSuperCallsVisitor","environmentVisitor","CallExpression","child","allSuperCalls","isSuper","arrowParent","thisEnvFn","findParent","p","_arrowParent","isProgram","isClassProperty","static","isClassPrivateProperty","inConstructor","isClassMethod","kind","thisPaths","argumentsPaths","newTargetPaths","superProps","superCalls","getScopeInformation","length","traverse","superBinding","getSuperBinding","forEach","superCall","callee","loc","argumentsBinding","getBinding","args","buildUndefinedNode","argumentsChild","argsRef","newTargetBinding","targetChild","targetRef","flatSuperProps","reduce","acc","superProp","concat","standardizeSuperProperty","superParentPath","isAssignment","isAssignmentExpression","left","isCall","isCallExpression","isTaggedTemplate","isTaggedTemplateExpression","tag","getSuperPropBinding","value","right","call","getThisBinding","hasSuperClass","thisChild","thisRef","isJSX","isLogicalOp","op","includes","operator","assignmentPath","slice","isLogicalAssignment","tmp","generateDeclaredUidIdentifier","object","rightExpression","isUpdateExpression","updateExpr","computedKey","parts","prefix","superClass","assignSuperThisVisitor","supers","has","add","replaceWithMultiple","WeakSet","argsBinding","propName","argsList","fnBody","method","unshift","valueIdent","cacheKey","data","getData","setData","getScopeInformationVisitor","ThisExpression","JSXIdentifier","isJSXMemberExpression","isJSXOpeningElement","MemberExpression","Identifier","isReferencedIdentifier","curr","hasOwnBinding","rename","parent","MetaProperty","splitExportDeclaration","isExportDeclaration","isExportAllDeclaration","isExportNamedDeclaration","declaration","isExportDefaultDeclaration","standaloneDeclaration","isClassDeclaration","exportExpr","isClassExpression","isScope","needBindingRegistration","hasBinding","updatedDeclaration","updatedExportDeclaration","insertAfter","registerDeclaration","bindingIdentifiers","getOuterBindingIdentifiers","specifiers","Object","keys","map","aliasDeclar","refersOuterBindingVisitor","ReferencedIdentifier|BindingIdentifier","state","needsRename","stop","Scope","skip","supportUnicodeId","res","test","startsWith","replace","originalNode","binding","getOwnBinding","hasGlobal","getProgramParent","references","params","i","len","getFunctionArity","template","expression","ast","count","findIndex","param"],"sources":["../../src/path/conversion.ts"],"sourcesContent":["// This file contains methods that convert the path node into another node or some other type of data.\n\nimport {\n arrowFunctionExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n conditionalExpression,\n expressionStatement,\n identifier,\n isIdentifier,\n jsxIdentifier,\n logicalExpression,\n LOGICAL_OPERATORS,\n memberExpression,\n metaProperty,\n numericLiteral,\n objectExpression,\n restElement,\n returnStatement,\n sequenceExpression,\n spreadElement,\n stringLiteral,\n super as _super,\n thisExpression,\n toExpression,\n unaryExpression,\n toBindingIdentifierName,\n isFunction,\n isAssignmentPattern,\n isRestElement,\n getFunctionName,\n cloneNode,\n variableDeclaration,\n variableDeclarator,\n exportNamedDeclaration,\n exportSpecifier,\n inherits,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport template from \"@babel/template\";\nimport { environmentVisitor } from \"../visitors.ts\";\nimport type NodePath from \"./index.ts\";\nimport type { Visitor } from \"../types.ts\";\n\nexport function toComputedKey(this: NodePath) {\n let key;\n if (this.isMemberExpression()) {\n key = this.node.property;\n } else if (this.isProperty() || this.isMethod()) {\n key = this.node.key;\n } else {\n throw new ReferenceError(\"todo\");\n }\n\n // @ts-expect-error todo(flow->ts) computed does not exist in ClassPrivateProperty\n if (!this.node.computed) {\n if (isIdentifier(key)) key = stringLiteral(key.name);\n }\n\n return key;\n}\n\nexport function ensureBlock(\n this: NodePath<\n t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause\n >,\n): void {\n const body = this.get(\"body\");\n const bodyNode = body.node;\n\n if (Array.isArray(body)) {\n throw new Error(\"Can't convert array path to a block statement\");\n }\n if (!bodyNode) {\n throw new Error(\"Can't convert node without a body\");\n }\n\n if (body.isBlockStatement()) {\n // @ts-expect-error TS throws because ensureBlock returns the body node path\n // however, we don't use the return value and treat it as a transform and\n // assertion utilities. For better type inference we annotate it as an\n // assertion method\n // TODO: Unify the implementation with the type definition\n return bodyNode;\n }\n\n const statements: Array<t.Statement> = [];\n\n let stringPath = \"body\";\n let key;\n let listKey;\n if (body.isStatement()) {\n listKey = \"body\";\n key = 0;\n statements.push(body.node);\n } else {\n stringPath += \".body.0\";\n if (this.isFunction()) {\n key = \"argument\";\n statements.push(returnStatement(body.node as t.Expression));\n } else {\n key = \"expression\";\n statements.push(expressionStatement(body.node as t.Expression));\n }\n }\n\n this.node.body = blockStatement(statements);\n const parentPath = this.get(stringPath) as NodePath;\n body.setup(\n parentPath,\n listKey\n ? // @ts-expect-error listKey must present in parent path\n parentPath.node[listKey]\n : parentPath.node,\n listKey,\n key,\n );\n\n // @ts-expect-error TS throws because ensureBlock returns the body node path\n // however, we don't use the return value and treat it as a transform and\n // assertion utilities. For better type inference we annotate it as an\n // assertion method\n // TODO: Unify the implementation with the type definition\n return this.node;\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Keeping this for backward-compatibility. You should use arrowFunctionToExpression() for >=7.x.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.arrowFunctionToShadowed = function (this: NodePath) {\n if (!this.isArrowFunctionExpression()) return;\n\n this.arrowFunctionToExpression();\n };\n}\n\n/**\n * Given an arbitrary function, process its content as if it were an arrow function, moving references\n * to \"this\", \"arguments\", \"super\", and such into the function's parent scope. This method is useful if\n * you have wrapped some set of items in an IIFE or other function, but want \"this\", \"arguments\", and super\"\n * to continue behaving as expected.\n */\nexport function unwrapFunctionEnvironment(this: NodePath) {\n if (\n !this.isArrowFunctionExpression() &&\n !this.isFunctionExpression() &&\n !this.isFunctionDeclaration()\n ) {\n throw this.buildCodeFrameError(\n \"Can only unwrap the environment of a function.\",\n );\n }\n\n hoistFunctionEnvironment(this);\n}\n\nfunction setType<N extends t.Node, T extends N[\"type\"]>(\n path: NodePath<N>,\n type: T,\n): asserts path is NodePath<Extract<N, { type: T }>> {\n path.node.type = type;\n}\n\n/**\n * Convert a given arrow function into a normal ES5 function expression.\n */\nexport function arrowFunctionToExpression(\n this: NodePath<t.ArrowFunctionExpression>,\n {\n allowInsertArrow = true,\n allowInsertArrowWithRest = allowInsertArrow,\n noNewArrows = process.env.BABEL_8_BREAKING\n ? // TODO(Babel 8): Consider defaulting to `false` for spec compliance\n true\n : !arguments[0]?.specCompliant,\n }: {\n allowInsertArrow?: boolean | void;\n allowInsertArrowWithRest?: boolean | void;\n noNewArrows?: boolean;\n } = {},\n): NodePath<\n Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression\n> {\n if (!this.isArrowFunctionExpression()) {\n throw (this as NodePath).buildCodeFrameError(\n \"Cannot convert non-arrow function to a function expression.\",\n );\n }\n\n let self = this;\n if (!noNewArrows) {\n // @ts-expect-error This is technicallynot valid on arrow functions\n // because it adds an .id property, but we are going to convert it\n // to a function expression anyway\n self = self.ensureFunctionName(false) ?? self;\n }\n\n const { thisBinding, fnPath: fn } = hoistFunctionEnvironment(\n self,\n noNewArrows,\n allowInsertArrow,\n allowInsertArrowWithRest,\n );\n\n fn.ensureBlock();\n setType(fn, \"FunctionExpression\");\n\n if (!noNewArrows) {\n const checkBinding = thisBinding\n ? null\n : fn.scope.generateUidIdentifier(\"arrowCheckId\");\n if (checkBinding) {\n fn.parentPath.scope.push({\n id: checkBinding,\n init: objectExpression([]),\n });\n }\n\n fn.get(\"body\").unshiftContainer(\n \"body\",\n expressionStatement(\n callExpression(this.hub.addHelper(\"newArrowCheck\"), [\n thisExpression(),\n checkBinding\n ? identifier(checkBinding.name)\n : identifier(thisBinding),\n ]),\n ),\n );\n\n fn.replaceWith(\n callExpression(memberExpression(fn.node, identifier(\"bind\")), [\n checkBinding ? identifier(checkBinding.name) : thisExpression(),\n ]),\n );\n\n return fn.get(\"callee.object\");\n }\n\n return fn;\n}\n\nconst getSuperCallsVisitor = environmentVisitor<{\n allSuperCalls: NodePath<t.CallExpression>[];\n}>({\n CallExpression(child, { allSuperCalls }) {\n if (!child.get(\"callee\").isSuper()) return;\n allSuperCalls.push(child);\n },\n});\n\n/**\n * Given a function, traverse its contents, and if there are references to \"this\", \"arguments\", \"super\",\n * or \"new.target\", ensure that these references reference the parent environment around this function.\n *\n * @returns `thisBinding`: the name of the injected reference to `this`; for example \"_this\"\n * @returns `fnPath`: the new path to the function node. This is different from the fnPath\n * parameter when the function node is wrapped in another node.\n */\nfunction hoistFunctionEnvironment(\n fnPath: NodePath<t.Function>,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliance\n noNewArrows: boolean | void = true,\n allowInsertArrow: boolean | void = true,\n allowInsertArrowWithRest: boolean | void = true,\n): { thisBinding: string; fnPath: NodePath<t.Function> } {\n let arrowParent;\n let thisEnvFn: NodePath<t.Function> = fnPath.findParent(p => {\n if (p.isArrowFunctionExpression()) {\n arrowParent ??= p;\n return false;\n }\n return (\n p.isFunction() ||\n p.isProgram() ||\n p.isClassProperty({ static: false }) ||\n p.isClassPrivateProperty({ static: false })\n );\n }) as NodePath<t.Function>;\n const inConstructor = thisEnvFn.isClassMethod({ kind: \"constructor\" });\n\n if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {\n if (arrowParent) {\n thisEnvFn = arrowParent;\n } else if (allowInsertArrow) {\n // It's safe to wrap this function in another and not hoist to the\n // top level because the 'this' binding is constant in class\n // properties (since 'super()' has already been called), so we don't\n // need to capture/reassign it at the top level.\n fnPath.replaceWith(\n callExpression(\n arrowFunctionExpression([], toExpression(fnPath.node)),\n [],\n ),\n );\n thisEnvFn = fnPath.get(\"callee\") as NodePath<t.ArrowFunctionExpression>;\n fnPath = thisEnvFn.get(\"body\") as NodePath<t.FunctionExpression>;\n } else {\n throw fnPath.buildCodeFrameError(\n \"Unable to transform arrow inside class property\",\n );\n }\n }\n\n const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } =\n getScopeInformation(fnPath);\n\n // Convert all super() calls in the constructor, if super is used in an arrow.\n if (inConstructor && superCalls.length > 0) {\n if (!allowInsertArrow) {\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super()` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n if (!allowInsertArrowWithRest) {\n // preset-env with target `since 2017` enables `transform-parameters` without `transform-classes`.\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-parameters', \" +\n \"it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n const allSuperCalls: NodePath<t.CallExpression>[] = [];\n thisEnvFn.traverse(getSuperCallsVisitor, { allSuperCalls });\n const superBinding = getSuperBinding(thisEnvFn);\n allSuperCalls.forEach(superCall => {\n const callee = identifier(superBinding);\n callee.loc = superCall.node.callee.loc;\n\n superCall.get(\"callee\").replaceWith(callee);\n });\n }\n\n // Convert all \"arguments\" references in the arrow to point at the alias.\n if (argumentsPaths.length > 0) {\n const argumentsBinding = getBinding(thisEnvFn, \"arguments\", () => {\n const args = () => identifier(\"arguments\");\n if (thisEnvFn.scope.path.isProgram()) {\n return conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", args()),\n stringLiteral(\"undefined\"),\n ),\n thisEnvFn.scope.buildUndefinedNode(),\n args(),\n );\n } else {\n return args();\n }\n });\n\n argumentsPaths.forEach(argumentsChild => {\n const argsRef = identifier(argumentsBinding);\n argsRef.loc = argumentsChild.node.loc;\n\n argumentsChild.replaceWith(argsRef);\n });\n }\n\n // Convert all \"new.target\" references in the arrow to point at the alias.\n if (newTargetPaths.length > 0) {\n const newTargetBinding = getBinding(thisEnvFn, \"newtarget\", () =>\n metaProperty(identifier(\"new\"), identifier(\"target\")),\n );\n\n newTargetPaths.forEach(targetChild => {\n const targetRef = identifier(newTargetBinding);\n targetRef.loc = targetChild.node.loc;\n\n targetChild.replaceWith(targetRef);\n });\n }\n\n // Convert all \"super.prop\" references to point at aliases.\n if (superProps.length > 0) {\n if (!allowInsertArrow) {\n throw superProps[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super.prop` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n\n const flatSuperProps: NodePath<t.MemberExpression>[] = superProps.reduce(\n (acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),\n [],\n );\n\n flatSuperProps.forEach(superProp => {\n const key = superProp.node.computed\n ? \"\"\n : // @ts-expect-error super property must not contain private name\n superProp.get(\"property\").node.name;\n\n const superParentPath = superProp.parentPath;\n\n const isAssignment = superParentPath.isAssignmentExpression({\n left: superProp.node,\n });\n const isCall = superParentPath.isCallExpression({\n callee: superProp.node,\n });\n const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({\n tag: superProp.node,\n });\n const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);\n\n const args: t.Expression[] = [];\n if (superProp.node.computed) {\n // SuperProperty must not be a private name\n args.push(superProp.get(\"property\").node as t.Expression);\n }\n\n if (isAssignment) {\n const value = superParentPath.node.right;\n args.push(value);\n }\n\n const call = callExpression(identifier(superBinding), args);\n\n if (isCall) {\n superParentPath.unshiftContainer(\"arguments\", thisExpression());\n superProp.replaceWith(memberExpression(call, identifier(\"call\")));\n\n thisPaths.push(\n superParentPath.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else if (isAssignment) {\n // Replace not only the super.prop, but the whole assignment\n superParentPath.replaceWith(call);\n } else if (isTaggedTemplate) {\n superProp.replaceWith(\n callExpression(memberExpression(call, identifier(\"bind\"), false), [\n thisExpression(),\n ]),\n );\n\n thisPaths.push(\n superProp.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else {\n superProp.replaceWith(call);\n }\n });\n }\n\n // Convert all \"this\" references in the arrow to point at the alias.\n let thisBinding: string | null;\n if (thisPaths.length > 0 || !noNewArrows) {\n thisBinding = getThisBinding(thisEnvFn, inConstructor);\n\n if (\n noNewArrows ||\n // In subclass constructors, still need to rewrite because \"this\" can't be bound in spec mode\n // because it might not have been initialized yet.\n (inConstructor && hasSuperClass(thisEnvFn))\n ) {\n thisPaths.forEach(thisChild => {\n const thisRef = thisChild.isJSX()\n ? jsxIdentifier(thisBinding)\n : identifier(thisBinding);\n\n thisRef.loc = thisChild.node.loc;\n thisChild.replaceWith(thisRef);\n });\n\n if (!noNewArrows) thisBinding = null;\n }\n }\n\n return { thisBinding, fnPath };\n}\n\ntype LogicalOp = Parameters<typeof logicalExpression>[0];\ntype BinaryOp = Parameters<typeof binaryExpression>[0];\n\nfunction isLogicalOp(op: string): op is LogicalOp {\n return LOGICAL_OPERATORS.includes(op);\n}\n\nfunction standardizeSuperProperty(\n superProp: NodePath<t.MemberExpression>,\n):\n | [NodePath<t.MemberExpression>]\n | [NodePath<t.MemberExpression>, NodePath<t.MemberExpression>] {\n if (\n superProp.parentPath.isAssignmentExpression() &&\n superProp.parentPath.node.operator !== \"=\"\n ) {\n const assignmentPath = superProp.parentPath;\n\n const op = assignmentPath.node.operator.slice(0, -1) as\n | LogicalOp\n | BinaryOp;\n\n const value = assignmentPath.node.right;\n\n const isLogicalAssignment = isLogicalOp(op);\n\n if (superProp.node.computed) {\n // from: super[foo] **= 4;\n // to: super[tmp = foo] = super[tmp] ** 4;\n\n // from: super[foo] ??= 4;\n // to: super[tmp = foo] ?? super[tmp] = 4;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Expression;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(\n memberExpression(\n object,\n assignmentExpression(\"=\", tmp, property),\n true /* computed */,\n ),\n );\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(tmp.name), true /* computed */),\n value,\n ),\n );\n } else {\n // from: super.foo **= 4;\n // to: super.foo = super.foo ** 4;\n\n // from: super.foo ??= 4;\n // to: super.foo ?? super.foo = 4;\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Identifier;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(memberExpression(object, property));\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(property.name)),\n value,\n ),\n );\n }\n\n if (isLogicalAssignment) {\n assignmentPath.replaceWith(\n logicalExpression(\n op,\n assignmentPath.node.left as t.MemberExpression,\n assignmentPath.node.right,\n ),\n );\n } else {\n assignmentPath.node.operator = \"=\";\n }\n\n return [\n assignmentPath.get(\"left\") as NodePath<t.MemberExpression>,\n assignmentPath.get(\"right\").get(\"left\") as NodePath<t.MemberExpression>,\n ];\n } else if (superProp.parentPath.isUpdateExpression()) {\n const updateExpr = superProp.parentPath;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n const computedKey = superProp.node.computed\n ? superProp.scope.generateDeclaredUidIdentifier(\"prop\")\n : null;\n\n const parts: t.Expression[] = [\n assignmentExpression(\n \"=\",\n tmp,\n memberExpression(\n superProp.node.object,\n computedKey\n ? assignmentExpression(\n \"=\",\n computedKey,\n superProp.node.property as t.Expression,\n )\n : superProp.node.property,\n superProp.node.computed,\n ),\n ),\n assignmentExpression(\n \"=\",\n memberExpression(\n superProp.node.object,\n computedKey ? identifier(computedKey.name) : superProp.node.property,\n superProp.node.computed,\n ),\n binaryExpression(\n // map `++` to `+`, and `--` to `-`\n superProp.parentPath.node.operator[0] as \"+\" | \"-\",\n identifier(tmp.name),\n numericLiteral(1),\n ),\n ),\n ];\n\n if (!superProp.parentPath.node.prefix) {\n parts.push(identifier(tmp.name));\n }\n\n updateExpr.replaceWith(sequenceExpression(parts));\n\n const left = updateExpr.get(\n \"expressions.0.right\",\n ) as NodePath<t.MemberExpression>;\n const right = updateExpr.get(\n \"expressions.1.left\",\n ) as NodePath<t.MemberExpression>;\n return [left, right];\n }\n\n return [superProp];\n\n function rightExpression(\n op: BinaryOp | \"=\",\n left: t.MemberExpression,\n right: t.Expression,\n ) {\n if (op === \"=\") {\n return assignmentExpression(\"=\", left, right);\n } else {\n return binaryExpression(op, left, right);\n }\n }\n}\n\nfunction hasSuperClass(thisEnvFn: NodePath<t.Function>) {\n return (\n thisEnvFn.isClassMethod() &&\n !!(thisEnvFn.parentPath.parentPath.node as t.Class).superClass\n );\n}\n\nconst assignSuperThisVisitor = environmentVisitor<{\n supers: WeakSet<t.CallExpression>;\n thisBinding: string;\n}>({\n CallExpression(child, { supers, thisBinding }) {\n if (!child.get(\"callee\").isSuper()) return;\n if (supers.has(child.node)) return;\n supers.add(child.node);\n\n child.replaceWithMultiple([\n child.node,\n assignmentExpression(\"=\", identifier(thisBinding), identifier(\"this\")),\n ]);\n },\n});\n\n// Create a binding that evaluates to the \"this\" of the given function.\nfunction getThisBinding(\n thisEnvFn: NodePath<t.Function>,\n inConstructor: boolean,\n) {\n return getBinding(thisEnvFn, \"this\", thisBinding => {\n if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();\n\n thisEnvFn.traverse(assignSuperThisVisitor, {\n supers: new WeakSet(),\n thisBinding,\n });\n });\n}\n\n// Create a binding for a function that will call \"super()\" with arguments passed through.\nfunction getSuperBinding(thisEnvFn: NodePath<t.Function>) {\n return getBinding(thisEnvFn, \"supercall\", () => {\n const argsBinding = thisEnvFn.scope.generateUidIdentifier(\"args\");\n return arrowFunctionExpression(\n [restElement(argsBinding)],\n callExpression(_super(), [spreadElement(identifier(argsBinding.name))]),\n );\n });\n}\n\n// Create a binding for a function that will call \"super.foo\" or \"super[foo]\".\nfunction getSuperPropBinding(\n thisEnvFn: NodePath<t.Function>,\n isAssignment: boolean,\n propName: string,\n) {\n const op = isAssignment ? \"set\" : \"get\";\n\n return getBinding(thisEnvFn, `superprop_${op}:${propName || \"\"}`, () => {\n const argsList = [];\n\n let fnBody;\n if (propName) {\n // () => super.foo\n fnBody = memberExpression(_super(), identifier(propName));\n } else {\n const method = thisEnvFn.scope.generateUidIdentifier(\"prop\");\n // (method) => super[method]\n argsList.unshift(method);\n fnBody = memberExpression(\n _super(),\n identifier(method.name),\n true /* computed */,\n );\n }\n\n if (isAssignment) {\n const valueIdent = thisEnvFn.scope.generateUidIdentifier(\"value\");\n argsList.push(valueIdent);\n\n fnBody = assignmentExpression(\"=\", fnBody, identifier(valueIdent.name));\n }\n\n return arrowFunctionExpression(argsList, fnBody);\n });\n}\n\nfunction getBinding(\n thisEnvFn: NodePath,\n key: string,\n init: (name: string) => t.Expression,\n) {\n const cacheKey = \"binding:\" + key;\n let data: string | undefined = thisEnvFn.getData(cacheKey);\n if (!data) {\n const id = thisEnvFn.scope.generateUidIdentifier(key);\n data = id.name;\n thisEnvFn.setData(cacheKey, data);\n\n thisEnvFn.scope.push({\n id: id,\n init: init(data),\n });\n }\n\n return data;\n}\n\ntype ScopeInfo = {\n thisPaths: NodePath<t.ThisExpression | t.JSXIdentifier>[];\n superCalls: NodePath<t.CallExpression>[];\n superProps: NodePath<t.MemberExpression>[];\n argumentsPaths: NodePath<t.Identifier | t.JSXIdentifier>[];\n newTargetPaths: NodePath<t.MetaProperty>[];\n};\n\nconst getScopeInformationVisitor = environmentVisitor<ScopeInfo>({\n ThisExpression(child, { thisPaths }) {\n thisPaths.push(child);\n },\n JSXIdentifier(child, { thisPaths }) {\n if (child.node.name !== \"this\") return;\n if (\n !child.parentPath.isJSXMemberExpression({ object: child.node }) &&\n !child.parentPath.isJSXOpeningElement({ name: child.node })\n ) {\n return;\n }\n\n thisPaths.push(child);\n },\n CallExpression(child, { superCalls }) {\n if (child.get(\"callee\").isSuper()) superCalls.push(child);\n },\n MemberExpression(child, { superProps }) {\n if (child.get(\"object\").isSuper()) superProps.push(child);\n },\n Identifier(child, { argumentsPaths }) {\n if (!child.isReferencedIdentifier({ name: \"arguments\" })) return;\n\n let curr = child.scope;\n do {\n if (curr.hasOwnBinding(\"arguments\")) {\n curr.rename(\"arguments\");\n return;\n }\n if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {\n break;\n }\n } while ((curr = curr.parent));\n\n argumentsPaths.push(child);\n },\n MetaProperty(child, { newTargetPaths }) {\n if (!child.get(\"meta\").isIdentifier({ name: \"new\" })) return;\n if (!child.get(\"property\").isIdentifier({ name: \"target\" })) return;\n\n newTargetPaths.push(child);\n },\n});\n\nfunction getScopeInformation(fnPath: NodePath) {\n const thisPaths: ScopeInfo[\"thisPaths\"] = [];\n const argumentsPaths: ScopeInfo[\"argumentsPaths\"] = [];\n const newTargetPaths: ScopeInfo[\"newTargetPaths\"] = [];\n const superProps: ScopeInfo[\"superProps\"] = [];\n const superCalls: ScopeInfo[\"superCalls\"] = [];\n\n fnPath.traverse(getScopeInformationVisitor, {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n });\n\n return {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n };\n}\n\nexport function splitExportDeclaration(\n this: NodePath<t.ExportDefaultDeclaration | t.ExportNamedDeclaration>,\n): NodePath<t.Declaration> {\n if (!this.isExportDeclaration() || this.isExportAllDeclaration()) {\n throw new Error(\"Only default and named export declarations can be split.\");\n }\n if (this.isExportNamedDeclaration() && this.get(\"specifiers\").length > 0) {\n throw new Error(\"It doesn't make sense to split exported specifiers.\");\n }\n\n const declaration = this.get(\"declaration\");\n\n if (this.isExportDefaultDeclaration()) {\n const standaloneDeclaration =\n declaration.isFunctionDeclaration() || declaration.isClassDeclaration();\n const exportExpr =\n declaration.isFunctionExpression() || declaration.isClassExpression();\n\n const scope = declaration.isScope()\n ? declaration.scope.parent\n : declaration.scope;\n\n // @ts-expect-error id is not defined in expressions other than function/class\n let id = declaration.node.id;\n let needBindingRegistration = false;\n\n if (!id) {\n needBindingRegistration = true;\n\n id = scope.generateUidIdentifier(\"default\");\n\n if (standaloneDeclaration || exportExpr) {\n declaration.node.id = cloneNode(id);\n }\n } else if (exportExpr && scope.hasBinding(id.name)) {\n needBindingRegistration = true;\n\n id = scope.generateUidIdentifier(id.name);\n }\n\n const updatedDeclaration = standaloneDeclaration\n ? declaration.node\n : variableDeclaration(\"var\", [\n variableDeclarator(\n cloneNode(id),\n // @ts-expect-error When `standaloneDeclaration` is false, declaration must not be a Function/ClassDeclaration\n declaration.node,\n ),\n ]);\n\n const updatedExportDeclaration = exportNamedDeclaration(null, [\n exportSpecifier(cloneNode(id), identifier(\"default\")),\n ]);\n\n this.insertAfter(updatedExportDeclaration);\n this.replaceWith(updatedDeclaration);\n\n if (needBindingRegistration) {\n scope.registerDeclaration(this);\n }\n\n return this;\n } else if (this.get(\"specifiers\").length > 0) {\n throw new Error(\"It doesn't make sense to split exported specifiers.\");\n }\n\n const bindingIdentifiers = declaration.getOuterBindingIdentifiers();\n\n const specifiers = Object.keys(bindingIdentifiers).map(name => {\n return exportSpecifier(identifier(name), identifier(name));\n });\n\n const aliasDeclar = exportNamedDeclaration(null, specifiers);\n\n this.insertAfter(aliasDeclar);\n this.replaceWith(declaration.node);\n return this;\n}\n\nconst refersOuterBindingVisitor: Visitor<{\n needsRename: boolean;\n name: string;\n}> = {\n \"ReferencedIdentifier|BindingIdentifier\"(\n path: NodePath<t.Identifier>,\n state,\n ) {\n // check if this node matches our function id\n if (path.node.name !== state.name) return;\n state.needsRename = true;\n path.stop();\n },\n Scope(path, state) {\n if (path.scope.hasOwnBinding(state.name)) {\n path.skip();\n }\n },\n};\n\nexport function ensureFunctionName<\n N extends t.FunctionExpression | t.ClassExpression,\n>(this: NodePath<N>, supportUnicodeId: boolean): null | NodePath<N> {\n if (this.node.id) return this;\n\n const res = getFunctionName(this.node, this.parent);\n if (res == null) return this;\n let { name } = res;\n\n if (!supportUnicodeId && /[\\uD800-\\uDFFF]/.test(name)) {\n return null;\n }\n\n if (name.startsWith(\"get \") || name.startsWith(\"set \")) {\n // TODO: Remove this to support naming getters and setters\n return null;\n }\n\n name = toBindingIdentifierName(name.replace(/[/ ]/g, \"_\"));\n const id = identifier(name);\n inherits(id, res.originalNode);\n\n const state = { needsRename: false, name };\n\n // check to see if we have a local binding of the id we're setting inside of\n // the function, this is important as there are caveats associated\n\n const { scope } = this;\n const binding = scope.getOwnBinding(name);\n if (binding) {\n if (binding.kind === \"param\") {\n // safari will blow up in strict mode with code like:\n //\n // let t = function t(t) {};\n //\n // with the error:\n //\n // Cannot declare a parameter named 't' as it shadows the name of a\n // strict mode function.\n //\n // this isn't to the spec and they've invented this behaviour which is\n // **extremely** annoying so we avoid setting the name if it has a param\n // with the same id\n state.needsRename = true;\n } else {\n // otherwise it's defined somewhere in scope like:\n //\n // let t = function () {\n // let t = 2;\n // };\n //\n // so we can safely just set the id and move along as it shadows the\n // bound function id\n }\n } else if (scope.parent.hasBinding(name) || scope.hasGlobal(name)) {\n this.traverse(refersOuterBindingVisitor, state);\n }\n\n if (!state.needsRename) {\n this.node.id = id;\n scope.getProgramParent().references[id.name] = true;\n return this;\n }\n\n if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {\n // we can just munge the local binding\n scope.rename(id.name);\n this.node.id = id;\n scope.getProgramParent().references[id.name] = true;\n return this;\n }\n\n // TODO: we don't currently support wrapping class expressions\n if (!isFunction(this.node)) return null;\n\n // need to add a wrapper since we can't change the references\n\n const key = scope.generateUidIdentifier(id.name);\n // shim in dummy params to retain function arity, if you try to read the\n // source then you'll get the original since it's proxied so it's all good\n const params = [];\n for (let i = 0, len = getFunctionArity(this.node); i < len; i++) {\n params.push(scope.generateUidIdentifier(\"x\"));\n }\n const call = template.expression.ast`\n (function (${key}) {\n function ${id}(${params}) {\n return ${cloneNode(key)}.apply(this, arguments);\n }\n\n ${cloneNode(id)}.toString = function () {\n return ${cloneNode(key)}.toString();\n }\n\n return ${cloneNode(id)};\n })(${toExpression(this.node)})\n ` as t.CallExpression;\n\n return this.replaceWith(call)[0].get(\"arguments.0\") as NodePath<N>;\n}\n\nfunction getFunctionArity(node: t.Function): number {\n const count = node.params.findIndex(\n param => isAssignmentPattern(param) || isRestElement(param),\n );\n return count === -1 ? node.params.length : count;\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAuCA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAoD;EAvClDG,uBAAuB;EACv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iBmD,EAAE,IAAIgK,MAAM;AAC7B,iBAAiB1N,SAAS,CAACO,GAAG,CAAC;AAC/B;AACA;AACA,QAAQP,SAAS,CAAC0D,EAAE,CAAC;AACrB,iBAAiB1D,SAAS,CAACO,GAAG,CAAC;AAC/B;AACA;AACA,eAAeP,SAAS,CAAC0D,EAAE,CAAC;AAC5B,SAASjE,YAAY,CAAC,IAAI,CAACgB,IAAI,CAAC;AAChC,GAAuB;EAErB,OAAO,IAAI,CAACsD,WAAW,CAAC4D,IAAI,CAAC,CAAC,CAAC,CAAC,CAACzG,GAAG,CAAC,aAAa,CAAC;AACrD;AAEA,SAAS2M,gBAAgBA,CAACpN,IAAgB,EAAU;EAClD,MAAMwN,KAAK,GAAGxN,IAAI,CAACiN,MAAM,CAACQ,SAAS,CACjCC,KAAK,IAAItO,mBAAmB,CAACsO,KAAK,CAAC,IAAIrO,aAAa,CAACqO,KAAK,CAC5D,CAAC;EACD,OAAOF,KAAK,KAAK,CAAC,CAAC,GAAGxN,IAAI,CAACiN,MAAM,CAAClI,MAAM,GAAGyI,KAAK;AAClD","ignoreList":[]}1 {"version":3,"names":["_t","require","_template","_visitors","_context","arrowFunctionExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","conditionalExpression","expressionStatement","identifier","isIdentifier","jsxIdentifier","logicalExpression","LOGICAL_OPERATORS","memberExpression","metaProperty","numericLiteral","objectExpression","restElement","returnStatement","sequenceExpression","spreadElement","stringLiteral","super","_super","thisExpression","toExpression","unaryExpression","toBindingIdentifierName","isFunction","isAssignmentPattern","isRestElement","getFunctionName","cloneNode","variableDeclaration","variableDeclarator","exportNamedDeclaration","exportSpecifier","inherits","toComputedKey","key","isMemberExpression","node","property","isProperty","isMethod","ReferenceError","computed","name","ensureBlock","body","get","bodyNode","Array","isArray","Error","isBlockStatement","statements","stringPath","listKey","isStatement","push","parentPath","setup","call","exports","arrowFunctionToShadowed","isArrowFunctionExpression","arrowFunctionToExpression","unwrapFunctionEnvironment","isFunctionExpression","isFunctionDeclaration","buildCodeFrameError","hoistFunctionEnvironment","setType","path","type","allowInsertArrow","allowInsertArrowWithRest","noNewArrows","_arguments$","arguments","specCompliant","self","_self$ensureFunctionN","ensureFunctionName","thisBinding","fnPath","fn","checkBinding","scope","generateUidIdentifier","id","init","unshiftContainer","hub","addHelper","replaceWith","getSuperCallsVisitor","environmentVisitor","CallExpression","child","allSuperCalls","isSuper","arrowParent","thisEnvFn","findParent","p","_arrowParent","isProgram","isClassProperty","static","isClassPrivateProperty","inConstructor","isClassMethod","kind","thisPaths","argumentsPaths","newTargetPaths","superProps","superCalls","getScopeInformation","length","traverse","superBinding","getSuperBinding","forEach","superCall","callee","loc","argumentsBinding","getBinding","args","buildUndefinedNode","argumentsChild","argsRef","newTargetBinding","targetChild","targetRef","flatSuperProps","reduce","acc","superProp","concat","standardizeSuperProperty","superParentPath","isAssignment","isAssignmentExpression","left","isCall","isCallExpression","isTaggedTemplate","isTaggedTemplateExpression","tag","getSuperPropBinding","value","right","getThisBinding","hasSuperClass","thisChild","thisRef","isJSX","isLogicalOp","op","includes","operator","assignmentPath","slice","isLogicalAssignment","tmp","generateDeclaredUidIdentifier","object","rightExpression","isUpdateExpression","updateExpr","computedKey","parts","prefix","superClass","assignSuperThisVisitor","supers","has","add","replaceWithMultiple","WeakSet","argsBinding","propName","argsList","fnBody","method","unshift","valueIdent","cacheKey","data","getData","setData","getScopeInformationVisitor","ThisExpression","JSXIdentifier","isJSXMemberExpression","isJSXOpeningElement","MemberExpression","Identifier","isReferencedIdentifier","curr","hasOwnBinding","rename","parent","MetaProperty","splitExportDeclaration","isExportDeclaration","isExportAllDeclaration","isExportNamedDeclaration","declaration","isExportDefaultDeclaration","standaloneDeclaration","isClassDeclaration","exportExpr","isClassExpression","isScope","needBindingRegistration","hasBinding","updatedDeclaration","updatedExportDeclaration","insertAfter","registerDeclaration","bindingIdentifiers","getOuterBindingIdentifiers","specifiers","Object","keys","map","aliasDeclar","refersOuterBindingVisitor","ReferencedIdentifier|BindingIdentifier","state","needsRename","stop","Scope","skip","supportUnicodeId","res","test","startsWith","replace","originalNode","binding","getOwnBinding","hasGlobal","getProgramParent","references","params","i","len","getFunctionArity","template","expression","ast","count","findIndex","param"],"sources":["../../src/path/conversion.ts"],"sourcesContent":["// This file contains methods that convert the path node into another node or some other type of data.\n\nimport {\n arrowFunctionExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n conditionalExpression,\n expressionStatement,\n identifier,\n isIdentifier,\n jsxIdentifier,\n logicalExpression,\n LOGICAL_OPERATORS,\n memberExpression,\n metaProperty,\n numericLiteral,\n objectExpression,\n restElement,\n returnStatement,\n sequenceExpression,\n spreadElement,\n stringLiteral,\n super as _super,\n thisExpression,\n toExpression,\n unaryExpression,\n toBindingIdentifierName,\n isFunction,\n isAssignmentPattern,\n isRestElement,\n getFunctionName,\n cloneNode,\n variableDeclaration,\n variableDeclarator,\n exportNamedDeclaration,\n exportSpecifier,\n inherits,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport template from \"@babel/template\";\nimport { environmentVisitor } from \"../visitors.ts\";\nimport type NodePath from \"./index.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport { setup } from \"./context.ts\";\n\nexport function toComputedKey(this: NodePath) {\n let key;\n if (this.isMemberExpression()) {\n key = this.node.property;\n } else if (this.isProperty() || this.isMethod()) {\n key = this.node.key;\n } else {\n throw new ReferenceError(\"todo\");\n }\n\n // @ts-expect-error todo(flow->ts) computed does not exist in ClassPrivateProperty\n if (!this.node.computed) {\n if (isIdentifier(key)) key = stringLiteral(key.name);\n }\n\n return key;\n}\n\nexport function ensureBlock(\n this: NodePath<\n t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause\n >,\n): void {\n const body = this.get(\"body\");\n const bodyNode = body.node;\n\n if (Array.isArray(body)) {\n throw new Error(\"Can't convert array path to a block statement\");\n }\n if (!bodyNode) {\n throw new Error(\"Can't convert node without a body\");\n }\n\n if (body.isBlockStatement()) {\n // @ts-expect-error TS throws because ensureBlock returns the body node path\n // however, we don't use the return value and treat it as a transform and\n // assertion utilities. For better type inference we annotate it as an\n // assertion method\n // TODO: Unify the implementation with the type definition\n return bodyNode;\n }\n\n const statements: Array<t.Statement> = [];\n\n let stringPath = \"body\";\n let key;\n let listKey;\n if (body.isStatement()) {\n listKey = \"body\";\n key = 0;\n statements.push(body.node);\n } else {\n stringPath += \".body.0\";\n if (this.isFunction()) {\n key = \"argument\";\n statements.push(returnStatement(body.node as t.Expression));\n } else {\n key = \"expression\";\n statements.push(expressionStatement(body.node as t.Expression));\n }\n }\n\n this.node.body = blockStatement(statements);\n const parentPath = this.get(stringPath) as NodePath;\n setup.call(\n body,\n parentPath,\n listKey\n ? // @ts-expect-error listKey must present in parent path\n parentPath.node[listKey]\n : parentPath.node,\n listKey,\n key,\n );\n\n // @ts-expect-error TS throws because ensureBlock returns the body node path\n // however, we don't use the return value and treat it as a transform and\n // assertion utilities. For better type inference we annotate it as an\n // assertion method\n // TODO: Unify the implementation with the type definition\n return this.node;\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Keeping this for backward-compatibility. You should use arrowFunctionToExpression() for >=7.x.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.arrowFunctionToShadowed = function (this: NodePath) {\n if (!this.isArrowFunctionExpression()) return;\n\n this.arrowFunctionToExpression();\n };\n}\n\n/**\n * Given an arbitrary function, process its content as if it were an arrow function, moving references\n * to \"this\", \"arguments\", \"super\", and such into the function's parent scope. This method is useful if\n * you have wrapped some set of items in an IIFE or other function, but want \"this\", \"arguments\", and super\"\n * to continue behaving as expected.\n */\nexport function unwrapFunctionEnvironment(this: NodePath) {\n if (\n !this.isArrowFunctionExpression() &&\n !this.isFunctionExpression() &&\n !this.isFunctionDeclaration()\n ) {\n throw this.buildCodeFrameError(\n \"Can only unwrap the environment of a function.\",\n );\n }\n\n hoistFunctionEnvironment(this);\n}\n\nfunction setType<N extends t.Node, T extends N[\"type\"]>(\n path: NodePath<N>,\n type: T,\n): asserts path is NodePath<Extract<N, { type: T }>> {\n path.node.type = type;\n}\n\n/**\n * Convert a given arrow function into a normal ES5 function expression.\n */\nexport function arrowFunctionToExpression(\n this: NodePath<t.ArrowFunctionExpression>,\n {\n allowInsertArrow = true,\n allowInsertArrowWithRest = allowInsertArrow,\n noNewArrows = process.env.BABEL_8_BREAKING\n ? // TODO(Babel 8): Consider defaulting to `false` for spec compliance\n true\n : !arguments[0]?.specCompliant,\n }: {\n allowInsertArrow?: boolean | void;\n allowInsertArrowWithRest?: boolean | void;\n noNewArrows?: boolean;\n } = {},\n): NodePath<\n Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression\n> {\n if (!this.isArrowFunctionExpression()) {\n throw (this as NodePath).buildCodeFrameError(\n \"Cannot convert non-arrow function to a function expression.\",\n );\n }\n\n let self = this;\n if (!noNewArrows) {\n // @ts-expect-error This is technicallynot valid on arrow functions\n // because it adds an .id property, but we are going to convert it\n // to a function expression anyway\n self = self.ensureFunctionName(false) ?? self;\n }\n\n const { thisBinding, fnPath: fn } = hoistFunctionEnvironment(\n self,\n noNewArrows,\n allowInsertArrow,\n allowInsertArrowWithRest,\n );\n\n fn.ensureBlock();\n setType(fn, \"FunctionExpression\");\n\n if (!noNewArrows) {\n const checkBinding = thisBinding\n ? null\n : fn.scope.generateUidIdentifier(\"arrowCheckId\");\n if (checkBinding) {\n fn.parentPath.scope.push({\n id: checkBinding,\n init: objectExpression([]),\n });\n }\n\n fn.get(\"body\").unshiftContainer(\n \"body\",\n expressionStatement(\n callExpression(this.hub.addHelper(\"newArrowCheck\"), [\n thisExpression(),\n checkBinding\n ? identifier(checkBinding.name)\n : identifier(thisBinding),\n ]),\n ),\n );\n\n fn.replaceWith(\n callExpression(memberExpression(fn.node, identifier(\"bind\")), [\n checkBinding ? identifier(checkBinding.name) : thisExpression(),\n ]),\n );\n\n return fn.get(\"callee.object\");\n }\n\n return fn;\n}\n\nconst getSuperCallsVisitor = environmentVisitor<{\n allSuperCalls: NodePath<t.CallExpression>[];\n}>({\n CallExpression(child, { allSuperCalls }) {\n if (!child.get(\"callee\").isSuper()) return;\n allSuperCalls.push(child);\n },\n});\n\n/**\n * Given a function, traverse its contents, and if there are references to \"this\", \"arguments\", \"super\",\n * or \"new.target\", ensure that these references reference the parent environment around this function.\n *\n * @returns `thisBinding`: the name of the injected reference to `this`; for example \"_this\"\n * @returns `fnPath`: the new path to the function node. This is different from the fnPath\n * parameter when the function node is wrapped in another node.\n */\nfunction hoistFunctionEnvironment(\n fnPath: NodePath<t.Function>,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliance\n noNewArrows: boolean | void = true,\n allowInsertArrow: boolean | void = true,\n allowInsertArrowWithRest: boolean | void = true,\n): { thisBinding: string; fnPath: NodePath<t.Function> } {\n let arrowParent;\n let thisEnvFn: NodePath<t.Function> = fnPath.findParent(p => {\n if (p.isArrowFunctionExpression()) {\n arrowParent ??= p;\n return false;\n }\n return (\n p.isFunction() ||\n p.isProgram() ||\n p.isClassProperty({ static: false }) ||\n p.isClassPrivateProperty({ static: false })\n );\n }) as NodePath<t.Function>;\n const inConstructor = thisEnvFn.isClassMethod({ kind: \"constructor\" });\n\n if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {\n if (arrowParent) {\n thisEnvFn = arrowParent;\n } else if (allowInsertArrow) {\n // It's safe to wrap this function in another and not hoist to the\n // top level because the 'this' binding is constant in class\n // properties (since 'super()' has already been called), so we don't\n // need to capture/reassign it at the top level.\n fnPath.replaceWith(\n callExpression(\n arrowFunctionExpression([], toExpression(fnPath.node)),\n [],\n ),\n );\n thisEnvFn = fnPath.get(\"callee\") as NodePath<t.ArrowFunctionExpression>;\n fnPath = thisEnvFn.get(\"body\") as NodePath<t.FunctionExpression>;\n } else {\n throw fnPath.buildCodeFrameError(\n \"Unable to transform arrow inside class property\",\n );\n }\n }\n\n const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } =\n getScopeInformation(fnPath);\n\n // Convert all super() calls in the constructor, if super is used in an arrow.\n if (inConstructor && superCalls.length > 0) {\n if (!allowInsertArrow) {\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super()` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n if (!allowInsertArrowWithRest) {\n // preset-env with target `since 2017` enables `transform-parameters` without `transform-classes`.\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-parameters', \" +\n \"it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n const allSuperCalls: NodePath<t.CallExpression>[] = [];\n thisEnvFn.traverse(getSuperCallsVisitor, { allSuperCalls });\n const superBinding = getSuperBinding(thisEnvFn);\n allSuperCalls.forEach(superCall => {\n const callee = identifier(superBinding);\n callee.loc = superCall.node.callee.loc;\n\n superCall.get(\"callee\").replaceWith(callee);\n });\n }\n\n // Convert all \"arguments\" references in the arrow to point at the alias.\n if (argumentsPaths.length > 0) {\n const argumentsBinding = getBinding(thisEnvFn, \"arguments\", () => {\n const args = () => identifier(\"arguments\");\n if (thisEnvFn.scope.path.isProgram()) {\n return conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", args()),\n stringLiteral(\"undefined\"),\n ),\n thisEnvFn.scope.buildUndefinedNode(),\n args(),\n );\n } else {\n return args();\n }\n });\n\n argumentsPaths.forEach(argumentsChild => {\n const argsRef = identifier(argumentsBinding);\n argsRef.loc = argumentsChild.node.loc;\n\n argumentsChild.replaceWith(argsRef);\n });\n }\n\n // Convert all \"new.target\" references in the arrow to point at the alias.\n if (newTargetPaths.length > 0) {\n const newTargetBinding = getBinding(thisEnvFn, \"newtarget\", () =>\n metaProperty(identifier(\"new\"), identifier(\"target\")),\n );\n\n newTargetPaths.forEach(targetChild => {\n const targetRef = identifier(newTargetBinding);\n targetRef.loc = targetChild.node.loc;\n\n targetChild.replaceWith(targetRef);\n });\n }\n\n // Convert all \"super.prop\" references to point at aliases.\n if (superProps.length > 0) {\n if (!allowInsertArrow) {\n throw superProps[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super.prop` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n\n const flatSuperProps: NodePath<t.MemberExpression>[] = superProps.reduce(\n (acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),\n [],\n );\n\n flatSuperProps.forEach(superProp => {\n const key = superProp.node.computed\n ? \"\"\n : // @ts-expect-error super property must not contain private name\n superProp.get(\"property\").node.name;\n\n const superParentPath = superProp.parentPath;\n\n const isAssignment = superParentPath.isAssignmentExpression({\n left: superProp.node,\n });\n const isCall = superParentPath.isCallExpression({\n callee: superProp.node,\n });\n const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({\n tag: superProp.node,\n });\n const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);\n\n const args: t.Expression[] = [];\n if (superProp.node.computed) {\n // SuperProperty must not be a private name\n args.push(superProp.get(\"property\").node as t.Expression);\n }\n\n if (isAssignment) {\n const value = superParentPath.node.right;\n args.push(value);\n }\n\n const call = callExpression(identifier(superBinding), args);\n\n if (isCall) {\n superParentPath.unshiftContainer(\"arguments\", thisExpression());\n superProp.replaceWith(memberExpression(call, identifier(\"call\")));\n\n thisPaths.push(\n superParentPath.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else if (isAssignment) {\n // Replace not only the super.prop, but the whole assignment\n superParentPath.replaceWith(call);\n } else if (isTaggedTemplate) {\n superProp.replaceWith(\n callExpression(memberExpression(call, identifier(\"bind\"), false), [\n thisExpression(),\n ]),\n );\n\n thisPaths.push(\n superProp.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else {\n superProp.replaceWith(call);\n }\n });\n }\n\n // Convert all \"this\" references in the arrow to point at the alias.\n let thisBinding: string | null;\n if (thisPaths.length > 0 || !noNewArrows) {\n thisBinding = getThisBinding(thisEnvFn, inConstructor);\n\n if (\n noNewArrows ||\n // In subclass constructors, still need to rewrite because \"this\" can't be bound in spec mode\n // because it might not have been initialized yet.\n (inConstructor && hasSuperClass(thisEnvFn))\n ) {\n thisPaths.forEach(thisChild => {\n const thisRef = thisChild.isJSX()\n ? jsxIdentifier(thisBinding)\n : identifier(thisBinding);\n\n thisRef.loc = thisChild.node.loc;\n thisChild.replaceWith(thisRef);\n });\n\n if (!noNewArrows) thisBinding = null;\n }\n }\n\n return { thisBinding, fnPath };\n}\n\ntype LogicalOp = Parameters<typeof logicalExpression>[0];\ntype BinaryOp = Parameters<typeof binaryExpression>[0];\n\nfunction isLogicalOp(op: string): op is LogicalOp {\n return LOGICAL_OPERATORS.includes(op);\n}\n\nfunction standardizeSuperProperty(\n superProp: NodePath<t.MemberExpression>,\n):\n | [NodePath<t.MemberExpression>]\n | [NodePath<t.MemberExpression>, NodePath<t.MemberExpression>] {\n if (\n superProp.parentPath.isAssignmentExpression() &&\n superProp.parentPath.node.operator !== \"=\"\n ) {\n const assignmentPath = superProp.parentPath;\n\n const op = assignmentPath.node.operator.slice(0, -1) as\n | LogicalOp\n | BinaryOp;\n\n const value = assignmentPath.node.right;\n\n const isLogicalAssignment = isLogicalOp(op);\n\n if (superProp.node.computed) {\n // from: super[foo] **= 4;\n // to: super[tmp = foo] = super[tmp] ** 4;\n\n // from: super[foo] ??= 4;\n // to: super[tmp = foo] ?? super[tmp] = 4;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Expression;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(\n memberExpression(\n object,\n assignmentExpression(\"=\", tmp, property),\n true /* computed */,\n ),\n );\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(tmp.name), true /* computed */),\n value,\n ),\n );\n } else {\n // from: super.foo **= 4;\n // to: super.foo = super.foo ** 4;\n\n // from: super.foo ??= 4;\n // to: super.foo ?? super.foo = 4;\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Identifier;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(memberExpression(object, property));\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(property.name)),\n value,\n ),\n );\n }\n\n if (isLogicalAssignment) {\n assignmentPath.replaceWith(\n logicalExpression(\n op,\n assignmentPath.node.left as t.MemberExpression,\n assignmentPath.node.right,\n ),\n );\n } else {\n assignmentPath.node.operator = \"=\";\n }\n\n return [\n assignmentPath.get(\"left\") as NodePath<t.MemberExpression>,\n assignmentPath.get(\"right\").get(\"left\") as NodePath<t.MemberExpression>,\n ];\n } else if (superProp.parentPath.isUpdateExpression()) {\n const updateExpr = superProp.parentPath;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n const computedKey = superProp.node.computed\n ? superProp.scope.generateDeclaredUidIdentifier(\"prop\")\n : null;\n\n const parts: t.Expression[] = [\n assignmentExpression(\n \"=\",\n tmp,\n memberExpression(\n superProp.node.object,\n computedKey\n ? assignmentExpression(\n \"=\",\n computedKey,\n superProp.node.property as t.Expression,\n )\n : superProp.node.property,\n superProp.node.computed,\n ),\n ),\n assignmentExpression(\n \"=\",\n memberExpression(\n superProp.node.object,\n computedKey ? identifier(computedKey.name) : superProp.node.property,\n superProp.node.computed,\n ),\n binaryExpression(\n // map `++` to `+`, and `--` to `-`\n superProp.parentPath.node.operator[0] as \"+\" | \"-\",\n identifier(tmp.name),\n numericLiteral(1),\n ),\n ),\n ];\n\n if (!superProp.parentPath.node.prefix) {\n parts.push(identifier(tmp.name));\n }\n\n updateExpr.replaceWith(sequenceExpression(parts));\n\n const left = updateExpr.get(\n \"expressions.0.right\",\n ) as NodePath<t.MemberExpression>;\n const right = updateExpr.get(\n \"expressions.1.left\",\n ) as NodePath<t.MemberExpression>;\n return [left, right];\n }\n\n return [superProp];\n\n function rightExpression(\n op: BinaryOp | \"=\",\n left: t.MemberExpression,\n right: t.Expression,\n ) {\n if (op === \"=\") {\n return assignmentExpression(\"=\", left, right);\n } else {\n return binaryExpression(op, left, right);\n }\n }\n}\n\nfunction hasSuperClass(thisEnvFn: NodePath<t.Function>) {\n return (\n thisEnvFn.isClassMethod() &&\n !!(thisEnvFn.parentPath.parentPath.node as t.Class).superClass\n );\n}\n\nconst assignSuperThisVisitor = environmentVisitor<{\n supers: WeakSet<t.CallExpression>;\n thisBinding: string;\n}>({\n CallExpression(child, { supers, thisBinding }) {\n if (!child.get(\"callee\").isSuper()) return;\n if (supers.has(child.node)) return;\n supers.add(child.node);\n\n child.replaceWithMultiple([\n child.node,\n assignmentExpression(\"=\", identifier(thisBinding), identifier(\"this\")),\n ]);\n },\n});\n\n// Create a binding that evaluates to the \"this\" of the given function.\nfunction getThisBinding(\n thisEnvFn: NodePath<t.Function>,\n inConstructor: boolean,\n) {\n return getBinding(thisEnvFn, \"this\", thisBinding => {\n if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();\n\n thisEnvFn.traverse(assignSuperThisVisitor, {\n supers: new WeakSet(),\n thisBinding,\n });\n });\n}\n\n// Create a binding for a function that will call \"super()\" with arguments passed through.\nfunction getSuperBinding(thisEnvFn: NodePath<t.Function>) {\n return getBinding(thisEnvFn, \"supercall\", () => {\n const argsBinding = thisEnvFn.scope.generateUidIdentifier(\"args\");\n return arrowFunctionExpression(\n [restElement(argsBinding)],\n callExpression(_super(), [spreadElement(identifier(argsBinding.name))]),\n );\n });\n}\n\n// Create a binding for a function that will call \"super.foo\" or \"super[foo]\".\nfunction getSuperPropBinding(\n thisEnvFn: NodePath<t.Function>,\n isAssignment: boolean,\n propName: string,\n) {\n const op = isAssignment ? \"set\" : \"get\";\n\n return getBinding(thisEnvFn, `superprop_${op}:${propName || \"\"}`, () => {\n const argsList = [];\n\n let fnBody;\n if (propName) {\n // () => super.foo\n fnBody = memberExpression(_super(), identifier(propName));\n } else {\n const method = thisEnvFn.scope.generateUidIdentifier(\"prop\");\n // (method) => super[method]\n argsList.unshift(method);\n fnBody = memberExpression(\n _super(),\n identifier(method.name),\n true /* computed */,\n );\n }\n\n if (isAssignment) {\n const valueIdent = thisEnvFn.scope.generateUidIdentifier(\"value\");\n argsList.push(valueIdent);\n\n fnBody = assignmentExpression(\"=\", fnBody, identifier(valueIdent.name));\n }\n\n return arrowFunctionExpression(argsList, fnBody);\n });\n}\n\nfunction getBinding(\n thisEnvFn: NodePath,\n key: string,\n init: (name: string) => t.Expression,\n) {\n const cacheKey = \"binding:\" + key;\n let data: string | undefined = thisEnvFn.getData(cacheKey);\n if (!data) {\n const id = thisEnvFn.scope.generateUidIdentifier(key);\n data = id.name;\n thisEnvFn.setData(cacheKey, data);\n\n thisEnvFn.scope.push({\n id: id,\n init: init(data),\n });\n }\n\n return data;\n}\n\ntype ScopeInfo = {\n thisPaths: NodePath<t.ThisExpression | t.JSXIdentifier>[];\n superCalls: NodePath<t.CallExpression>[];\n superProps: NodePath<t.MemberExpression>[];\n argumentsPaths: NodePath<t.Identifier | t.JSXIdentifier>[];\n newTargetPaths: NodePath<t.MetaProperty>[];\n};\n\nconst getScopeInformationVisitor = environmentVisitor<ScopeInfo>({\n ThisExpression(child, { thisPaths }) {\n thisPaths.push(child);\n },\n JSXIdentifier(child, { thisPaths }) {\n if (child.node.name !== \"this\") return;\n if (\n !child.parentPath.isJSXMemberExpression({ object: child.node }) &&\n !child.parentPath.isJSXOpeningElement({ name: child.node })\n ) {\n return;\n }\n\n thisPaths.push(child);\n },\n CallExpression(child, { superCalls }) {\n if (child.get(\"callee\").isSuper()) superCalls.push(child);\n },\n MemberExpression(child, { superProps }) {\n if (child.get(\"object\").isSuper()) superProps.push(child);\n },\n Identifier(child, { argumentsPaths }) {\n if (!child.isReferencedIdentifier({ name: \"arguments\" })) return;\n\n let curr = child.scope;\n do {\n if (curr.hasOwnBinding(\"arguments\")) {\n curr.rename(\"arguments\");\n return;\n }\n if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {\n break;\n }\n } while ((curr = curr.parent));\n\n argumentsPaths.push(child);\n },\n MetaProperty(child, { newTargetPaths }) {\n if (!child.get(\"meta\").isIdentifier({ name: \"new\" })) return;\n if (!child.get(\"property\").isIdentifier({ name: \"target\" })) return;\n\n newTargetPaths.push(child);\n },\n});\n\nfunction getScopeInformation(fnPath: NodePath) {\n const thisPaths: ScopeInfo[\"thisPaths\"] = [];\n const argumentsPaths: ScopeInfo[\"argumentsPaths\"] = [];\n const newTargetPaths: ScopeInfo[\"newTargetPaths\"] = [];\n const superProps: ScopeInfo[\"superProps\"] = [];\n const superCalls: ScopeInfo[\"superCalls\"] = [];\n\n fnPath.traverse(getScopeInformationVisitor, {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n });\n\n return {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n };\n}\n\nexport function splitExportDeclaration(\n this: NodePath<t.ExportDefaultDeclaration | t.ExportNamedDeclaration>,\n): NodePath<t.Declaration> {\n if (!this.isExportDeclaration() || this.isExportAllDeclaration()) {\n throw new Error(\"Only default and named export declarations can be split.\");\n }\n if (this.isExportNamedDeclaration() && this.get(\"specifiers\").length > 0) {\n throw new Error(\"It doesn't make sense to split exported specifiers.\");\n }\n\n const declaration = this.get(\"declaration\");\n\n if (this.isExportDefaultDeclaration()) {\n const standaloneDeclaration =\n declaration.isFunctionDeclaration() || declaration.isClassDeclaration();\n const exportExpr =\n declaration.isFunctionExpression() || declaration.isClassExpression();\n\n const scope = declaration.isScope()\n ? declaration.scope.parent\n : declaration.scope;\n\n // @ts-expect-error id is not defined in expressions other than function/class\n let id = declaration.node.id;\n let needBindingRegistration = false;\n\n if (!id) {\n needBindingRegistration = true;\n\n id = scope.generateUidIdentifier(\"default\");\n\n if (standaloneDeclaration || exportExpr) {\n declaration.node.id = cloneNode(id);\n }\n } else if (exportExpr && scope.hasBinding(id.name)) {\n needBindingRegistration = true;\n\n id = scope.generateUidIdentifier(id.name);\n }\n\n const updatedDeclaration = standaloneDeclaration\n ? declaration.node\n : variableDeclaration(\"var\", [\n variableDeclarator(\n cloneNode(id),\n // @ts-expect-error When `standaloneDeclaration` is false, declaration must not be a Function/ClassDeclaration\n declaration.node,\n ),\n ]);\n\n const updatedExportDeclaration = exportNamedDeclaration(null, [\n exportSpecifier(cloneNode(id), identifier(\"default\")),\n ]);\n\n this.insertAfter(updatedExportDeclaration);\n this.replaceWith(updatedDeclaration);\n\n if (needBindingRegistration) {\n scope.registerDeclaration(this);\n }\n\n return this;\n } else if (this.get(\"specifiers\").length > 0) {\n throw new Error(\"It doesn't make sense to split exported specifiers.\");\n }\n\n const bindingIdentifiers = declaration.getOuterBindingIdentifiers();\n\n const specifiers = Object.keys(bindingIdentifiers).map(name => {\n return exportSpecifier(identifier(name), identifier(name));\n });\n\n const aliasDeclar = exportNamedDeclaration(null, specifiers);\n\n this.insertAfter(aliasDeclar);\n this.replaceWith(declaration.node);\n return this;\n}\n\nconst refersOuterBindingVisitor: Visitor<{\n needsRename: boolean;\n name: string;\n}> = {\n \"ReferencedIdentifier|BindingIdentifier\"(\n path: NodePath<t.Identifier>,\n state,\n ) {\n // check if this node matches our function id\n if (path.node.name !== state.name) return;\n state.needsRename = true;\n path.stop();\n },\n Scope(path, state) {\n if (path.scope.hasOwnBinding(state.name)) {\n path.skip();\n }\n },\n};\n\nexport function ensureFunctionName<\n N extends t.FunctionExpression | t.ClassExpression,\n>(this: NodePath<N>, supportUnicodeId: boolean): null | NodePath<N> {\n if (this.node.id) return this;\n\n const res = getFunctionName(this.node, this.parent);\n if (res == null) return this;\n let { name } = res;\n\n if (!supportUnicodeId && /[\\uD800-\\uDFFF]/.test(name)) {\n return null;\n }\n\n if (name.startsWith(\"get \") || name.startsWith(\"set \")) {\n // TODO: Remove this to support naming getters and setters\n return null;\n }\n\n name = toBindingIdentifierName(name.replace(/[/ ]/g, \"_\"));\n const id = identifier(name);\n inherits(id, res.originalNode);\n\n const state = { needsRename: false, name };\n\n // check to see if we have a local binding of the id we're setting inside of\n // the function, this is important as there are caveats associated\n\n const { scope } = this;\n const binding = scope.getOwnBinding(name);\n if (binding) {\n if (binding.kind === \"param\") {\n // safari will blow up in strict mode with code like:\n //\n // let t = function t(t) {};\n //\n // with the error:\n //\n // Cannot declare a parameter named 't' as it shadows the name of a\n // strict mode function.\n //\n // this isn't to the spec and they've invented this behaviour which is\n // **extremely** annoying so we avoid setting the name if it has a param\n // with the same id\n state.needsRename = true;\n } else {\n // otherwise it's defined somewhere in scope like:\n //\n // let t = function () {\n // let t = 2;\n // };\n //\n // so we can safely just set the id and move along as it shadows the\n // bound function id\n }\n } else if (scope.parent.hasBinding(name) || scope.hasGlobal(name)) {\n this.traverse(refersOuterBindingVisitor, state);\n }\n\n if (!state.needsRename) {\n this.node.id = id;\n scope.getProgramParent().references[id.name] = true;\n return this;\n }\n\n if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {\n // we can just munge the local binding\n scope.rename(id.name);\n this.node.id = id;\n scope.getProgramParent().references[id.name] = true;\n return this;\n }\n\n // TODO: we don't currently support wrapping class expressions\n if (!isFunction(this.node)) return null;\n\n // need to add a wrapper since we can't change the references\n\n const key = scope.generateUidIdentifier(id.name);\n // shim in dummy params to retain function arity, if you try to read the\n // source then you'll get the original since it's proxied so it's all good\n const params = [];\n for (let i = 0, len = getFunctionArity(this.node); i < len; i++) {\n params.push(scope.generateUidIdentifier(\"x\"));\n }\n const call = template.expression.ast`\n (function (${key}) {\n function ${id}(${params}) {\n return ${cloneNode(key)}.apply(this, arguments);\n }\n\n ${cloneNode(id)}.toString = function () {\n return ${cloneNode(key)}.toString();\n }\n\n return ${cloneNode(id)};\n })(${toExpression(this.node)})\n ` as t.CallExpression;\n\n return this.replaceWith(call)[0].get(\"arguments.0\") as NodePath<N>;\n}\n\nfunction getFunctionArity(node: t.Function): number {\n const count = node.params.findIndex(\n param => isAssignmentPattern(param) || isRestElement(param),\n );\n return count === -1 ? node.params.length : count;\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAuCA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,QAAA,GAAAH,OAAA;AAAqC;EA1CnCI,uBAAuB;EACvBC,oBAAoB;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,qBAAqB;EACrBC,mBAAmB;EACnBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,iBAAiB;EACjBC,iBAAiB;EACjBC,gBAAgB;EAChBC,YAAY;EACZC,cAAc;EACdC,gBAAgB;EAChBC,WAAW;EACXC,eAAe;EACfC,kBAAkB;EAClBC,aAAa;EACbC,aAAa;EACbC,KAAK,EAAIC,MAAM;EACfC,cAAc;EACdC,YAAY;EACZC,eAAe;EACfC,uBAAuB;EACvBC,UAAU;EACVC,mBAAmB;EACnBC,aAAa;EACbC,eAAe;EACfC,SAAS;EACTC,mBAAmB;EACnBC,kBAAkB;EAClBC,sBAAsB;EACtBC,eAAe;EACfC;AAAQ,IAAAzC,EAAA;AASH,SAAS0C,aAAaA,CAAA,EAAiB;EAC5C,IAAIC,GAAG;EACP,IAAI,IAAI,CAACC,kBAAkB,CAAC,CAAC,EAAE;IAC7BD,GAAG,GAAG,IAAI,CAACE,IAAI,CAACC,QAAQ;EAC1B,CAAC,MAAM,IAAI,IAAI,CAACC,UAAU,CAAC,CAAC,IAAI,IAAI,CAACC,QAAQ,CAAC,CAAC,EAAE;IAC/CL,GAAG,GAAG,IAAI,CAACE,IAAI,CAACF,GAAG;EACrB,CAAC,MAAM;IACL,MAAM,IAAIM,cAAc,CAAC,MAAM,CAAC;EAClC;EAGA,IAAI,CAAC,IAAI,CAAC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AE;EACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGC,gBAAgB,CAAC,IAAI,CAACpN,IAAI,CAAC,EAAEkN,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;IAC/DD,MAAM,CAAC9L,IAAI,CAAC6B,KAAK,CAACC,qBAAqB,CAAC,GAAG,CAAC,CAAC;EAC/C;EACA,MAAM3B,IAAI,GAAG+L,iBAAQ,CAACC,UAAU,CAACC,GAAG;AACtC,iBAAiBzN,GAAG;AACpB,iBAAiBoD,EAAE,IAAI+J,MAAM;AAC7B,iBAAiB1N,SAAS,CAACO,GAAG,CAAC;AAC/B;AACA;AACA,QAAQP,SAAS,CAAC2D,EAAE,CAAC;AACrB,iBAAiB3D,SAAS,CAACO,GAAG,CAAC;AAC/B;AACA;AACA,eAAeP,SAAS,CAAC2D,EAAE,CAAC;AAC5B,SAASlE,YAAY,CAAC,IAAI,CAACgB,IAAI,CAAC;AAChC,GAAuB;EAErB,OAAO,IAAI,CAACuD,WAAW,CAACjC,IAAI,CAAC,CAAC,CAAC,CAAC,CAACb,GAAG,CAAC,aAAa,CAAC;AACrD;AAEA,SAAS2M,gBAAgBA,CAACpN,IAAgB,EAAU;EAClD,MAAMwN,KAAK,GAAGxN,IAAI,CAACiN,MAAM,CAACQ,SAAS,CACjCC,KAAK,IAAItO,mBAAmB,CAACsO,KAAK,CAAC,IAAIrO,aAAa,CAACqO,KAAK,CAC5D,CAAC;EACD,OAAOF,KAAK,KAAK,CAAC,CAAC,GAAGxN,IAAI,CAACiN,MAAM,CAACjI,MAAM,GAAGwI,KAAK;AAClD","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/index.js
rd565449 r0c6b92a 19 19 var NodePath_conversion = require("./conversion.js"); 20 20 var NodePath_introspection = require("./introspection.js"); 21 var NodePath_context = require("./context.js"); 21 var _context = require("./context.js"); 22 var NodePath_context = _context; 22 23 var NodePath_removal = require("./removal.js"); 23 24 var NodePath_modification = require("./modification.js"); … … 90 91 if (targetNode) paths.set(targetNode, path); 91 92 } 92 path.setup(parentPath, container, listKey, key);93 _context.setup.call(path, parentPath, container, listKey, key); 93 94 return path; 94 95 } … … 182 183 ensureFunctionName: NodePath_conversion.ensureFunctionName, 183 184 matchesPattern: NodePath_introspection.matchesPattern, 184 has: NodePath_introspection.has,185 185 isStatic: NodePath_introspection.isStatic, 186 is: NodePath_introspection.is,187 isnt: NodePath_introspection.isnt,188 equals: NodePath_introspection.equals,189 186 isNodeType: NodePath_introspection.isNodeType, 190 187 canHaveVariableDeclarationOrExpression: NodePath_introspection.canHaveVariableDeclarationOrExpression, … … 199 196 isConstantExpression: NodePath_introspection.isConstantExpression, 200 197 isInStrictMode: NodePath_introspection.isInStrictMode, 201 call: NodePath_context.call,202 198 isDenylisted: NodePath_context.isDenylisted, 203 isBlacklisted: NodePath_context.isBlacklisted,204 199 visit: NodePath_context.visit, 205 200 skip: NodePath_context.skip, 206 201 skipKey: NodePath_context.skipKey, 207 202 stop: NodePath_context.stop, 208 setScope: NodePath_context.setScope,209 203 setContext: NodePath_context.setContext, 210 resync: NodePath_context.resync,211 popContext: NodePath_context.popContext,212 pushContext: NodePath_context.pushContext,213 setup: NodePath_context.setup,214 setKey: NodePath_context.setKey,215 204 requeue: NodePath_context.requeue, 216 205 requeueComputedKeyAndDecorators: NodePath_context.requeueComputedKeyAndDecorators, … … 218 207 insertBefore: NodePath_modification.insertBefore, 219 208 insertAfter: NodePath_modification.insertAfter, 220 updateSiblingKeys: NodePath_modification.updateSiblingKeys,221 209 unshiftContainer: NodePath_modification.unshiftContainer, 222 210 pushContainer: NodePath_modification.pushContainer, 223 hoist: NodePath_modification.hoist,224 211 getOpposite: NodePath_family.getOpposite, 225 212 getCompletionRecords: NodePath_family.getCompletionRecords, … … 242 229 { 243 230 NodePath_Final.prototype.arrowFunctionToShadowed = NodePath_conversion[String("arrowFunctionToShadowed")]; 231 Object.assign(NodePath_Final.prototype, { 232 has: NodePath_introspection[String("has")], 233 is: NodePath_introspection[String("is")], 234 isnt: NodePath_introspection[String("isnt")], 235 equals: NodePath_introspection[String("equals")], 236 hoist: NodePath_modification[String("hoist")], 237 updateSiblingKeys: NodePath_modification.updateSiblingKeys, 238 call: NodePath_context.call, 239 isBlacklisted: NodePath_context[String("isBlacklisted")], 240 setScope: NodePath_context.setScope, 241 resync: NodePath_context.resync, 242 popContext: NodePath_context.popContext, 243 pushContext: NodePath_context.pushContext, 244 setup: NodePath_context.setup, 245 setKey: NodePath_context.setKey 246 }); 244 247 } 245 248 { 246 249 NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; 247 }248 {249 250 NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; 250 251 Object.assign(NodePath_Final.prototype, { -
imaps-frontend/node_modules/@babel/traverse/lib/path/index.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["virtualTypes","require","_debug","_index","_index2","_t","t","cache","_generator","NodePath_ancestry","NodePath_inference","NodePath_replacement","NodePath_evaluation","NodePath_conversion","NodePath_introspection"," NodePath_context","NodePath_removal","NodePath_modification","NodePath_family","NodePath_comments","NodePath_virtual_types_validator","validate","debug","buildDebug","REMOVED","exports","SHOULD_STOP","SHOULD_SKIP","NodePath_Final","default","NodePath","constructor","hub","parent","contexts","state","opts","_traverseFlags","skipKeys","parentPath","container","listKey","key","node","type","data","context","scope","removed","v","shouldStop","shouldSkip","get","Error","targetNode","paths","getOrCreateCachedPaths","path","set","setup","getScope","isScope","Scope","setData","val","Object","create","getData","def","undefined","hasNode","buildCodeFrameError","msg","SyntaxError","buildError","traverse","visitor","getPathLocation","parts","inList","unshift","join","message","enabled","toString","generator","code","parentKey","methods","findParent","find","getFunctionParent","getStatementParent","getEarliestCommonAncestorFrom","getDeepestCommonAncestorFrom","getAncestry","isAncestor","isDescendant","inType","getTypeAnnotation","isBaseType","couldBeBaseType","baseTypeStrictlyMatches","isGenericType","replaceWithMultiple","replaceWithSourceString","replaceWith","replaceExpressionWithStatements","replaceInline","evaluateTruthy","evaluate","toComputedKey","ensureBlock","unwrapFunctionEnvironment","arrowFunctionToExpression","splitExportDeclaration","ensureFunctionName","matchesPattern","has","isStatic","is","isnt","equals","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","isCompletionRecord","isStatementOrBlock","referencesImport","getSource","willIMaybeExecuteBefore","_guessExecutionStatusRelativeTo","resolve","isConstantExpression","isInStrictMode","call","isDenylisted","isBlacklisted","visit","skip","skipKey","stop","setScope","setContext","resync","popContext","pushContext","setKey","requeue","requeueComputedKeyAndDecorators","remove","insertBefore","insertAfter","updateSiblingKeys","unshiftContainer","pushContainer","hoist","getOpposite","getCompletionRecords","getSibling","getPrevSibling","getNextSibling","getAllNextSiblings","getAllPrevSiblings","getAssignmentIdentifiers","getBindingIdentifiers","getOuterBindingIdentifiers","getBindingIdentifierPaths","getOuterBindingIdentifierPaths","shareCommentsWithSiblings","addComment","addComments","assign","prototype","arrowFunctionToShadowed","String","_guessExecutionStatusRelativeToDifferentFunctions","_getTypeAnnotation","_replaceWith","_resolve","_call","_resyncParent","_resyncKey","_resyncList","_resyncRemoved","_getQueueContexts","_removeFromScope","_callRemovalHooks","_remove","_markRemoved","_assertUnremoved","_containerInsert","_containerInsertBefore","_containerInsertAfter","_verifyNodeList","_getKey","_getPattern","TYPES","typeKey","fn","TypeError","keys","includes","push"],"sources":["../../src/path/index.ts"],"sourcesContent":["import type { HubInterface } from \"../hub.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { ExplodedTraverseOptions } from \"../index.ts\";\nimport * as virtualTypes from \"./lib/virtual-types.ts\";\nimport buildDebug from \"debug\";\nimport traverse from \"../index.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport Scope from \"../scope/index.ts\";\nimport { validate } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport * as cache from \"../cache.ts\";\nimport generator from \"@babel/generator\";\n\n// NodePath is split across many files.\nimport * as NodePath_ancestry from \"./ancestry.ts\";\nimport * as NodePath_inference from \"./inference/index.ts\";\nimport * as NodePath_replacement from \"./replacement.ts\";\nimport * as NodePath_evaluation from \"./evaluation.ts\";\nimport * as NodePath_conversion from \"./conversion.ts\";\nimport * as NodePath_introspection from \"./introspection.ts\";\nimport * as NodePath_context from \"./context.ts\";\nimport * as NodePath_removal from \"./removal.ts\";\nimport * as NodePath_modification from \"./modification.ts\";\nimport * as NodePath_family from \"./family.ts\";\nimport * as NodePath_comments from \"./comments.ts\";\nimport * as NodePath_virtual_types_validator from \"./lib/virtual-types-validator.ts\";\nimport type { NodePathAssertions } from \"./generated/asserts.ts\";\nimport type { NodePathValidators } from \"./generated/validators.ts\";\n\nconst debug = buildDebug(\"babel\");\n\nexport const REMOVED = 1 << 0;\nexport const SHOULD_STOP = 1 << 1;\nexport const SHOULD_SKIP = 1 << 2;\n\ndeclare const bit: import(\"../../../../scripts/babel-plugin-bit-decorator/types.d.ts\").BitDecorator<any>;\n\nconst NodePath_Final = class NodePath {\n constructor(hub: HubInterface, parent: t.Node | null) {\n this.parent = parent;\n this.hub = hub;\n this.data = null;\n\n this.context = null;\n this.scope = null;\n }\n\n declare parent: t.Node;\n declare hub: HubInterface;\n declare data: Record<string | symbol, unknown>;\n // TraversalContext is configured by setContext\n declare context: TraversalContext;\n declare scope: Scope;\n\n contexts: Array<TraversalContext> = [];\n state: any = null;\n opts: ExplodedTraverseOptions | null = null;\n\n @bit.storage _traverseFlags: number;\n @bit(REMOVED) accessor removed = false;\n @bit(SHOULD_STOP) accessor shouldStop = false;\n @bit(SHOULD_SKIP) accessor shouldSkip = false;\n\n skipKeys: Record<string, boolean> | null = null;\n parentPath: NodePath_Final | null = null;\n container: t.Node | Array<t.Node> | null = null;\n listKey: string | null = null;\n key: string | number | null = null;\n node: t.Node | null = null;\n type: t.Node[\"type\"] | null = null;\n\n static get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n }: {\n hub?: HubInterface;\n parentPath: NodePath_Final | null;\n parent: t.Node;\n container: t.Node | t.Node[];\n listKey?: string;\n key: string | number;\n }): NodePath_Final {\n if (!hub && parentPath) {\n hub = parentPath.hub;\n }\n\n if (!parent) {\n throw new Error(\"To get a node path the parent needs to exist\");\n }\n\n const targetNode =\n // @ts-expect-error key must present in container\n container[key];\n\n const paths = cache.getOrCreateCachedPaths(hub, parent);\n\n let path = paths.get(targetNode);\n if (!path) {\n path = new NodePath(hub, parent) as NodePath_Final;\n if (targetNode) paths.set(targetNode, path);\n }\n\n path.setup(parentPath, container, listKey, key);\n\n return path;\n }\n\n getScope(this: NodePath_Final, scope: Scope): Scope {\n return this.isScope() ? new Scope(this) : scope;\n }\n\n setData(key: string | symbol, val: any): any {\n if (this.data == null) {\n this.data = Object.create(null);\n }\n return (this.data[key] = val);\n }\n\n getData(key: string | symbol, def?: any): any {\n if (this.data == null) {\n this.data = Object.create(null);\n }\n let val = this.data[key];\n if (val === undefined && def !== undefined) val = this.data[key] = def;\n return val;\n }\n\n hasNode(): boolean {\n return this.node != null;\n }\n\n buildCodeFrameError(\n msg: string,\n Error: new () => Error = SyntaxError,\n ): Error {\n return this.hub.buildError(this.node, msg, Error);\n }\n\n traverse<T>(this: NodePath_Final, visitor: Visitor<T>, state: T): void;\n traverse(this: NodePath_Final, visitor: Visitor): void;\n traverse(this: NodePath_Final, visitor: any, state?: any) {\n traverse(this.node, visitor, this.scope, state, this);\n }\n\n set(key: string, node: any) {\n validate(this.node, key, node);\n // @ts-expect-error key must present in this.node\n this.node[key] = node;\n }\n\n getPathLocation(this: NodePath_Final): string {\n const parts = [];\n let path: NodePath_Final = this;\n do {\n let key = path.key;\n if (path.inList) key = `${path.listKey}[${key}]`;\n parts.unshift(key);\n } while ((path = path.parentPath));\n return parts.join(\".\");\n }\n\n debug(this: NodePath_Final, message: string) {\n if (!debug.enabled) return;\n debug(`${this.getPathLocation()} ${this.type}: ${message}`);\n }\n\n toString() {\n return generator(this.node).code;\n }\n\n get inList() {\n return !!this.listKey;\n }\n\n set inList(inList) {\n if (!inList) {\n this.listKey = null;\n }\n // ignore inList = true as it should depend on `listKey`\n }\n\n get parentKey(): string {\n return (this.listKey || this.key) as string;\n }\n};\n\nconst methods = {\n // NodePath_ancestry\n findParent: NodePath_ancestry.findParent,\n find: NodePath_ancestry.find,\n getFunctionParent: NodePath_ancestry.getFunctionParent,\n getStatementParent: NodePath_ancestry.getStatementParent,\n getEarliestCommonAncestorFrom:\n NodePath_ancestry.getEarliestCommonAncestorFrom,\n getDeepestCommonAncestorFrom: NodePath_ancestry.getDeepestCommonAncestorFrom,\n getAncestry: NodePath_ancestry.getAncestry,\n isAncestor: NodePath_ancestry.isAncestor,\n isDescendant: NodePath_ancestry.isDescendant,\n inType: NodePath_ancestry.inType,\n\n // NodePath_inference\n getTypeAnnotation: NodePath_inference.getTypeAnnotation,\n isBaseType: NodePath_inference.isBaseType,\n couldBeBaseType: NodePath_inference.couldBeBaseType,\n baseTypeStrictlyMatches: NodePath_inference.baseTypeStrictlyMatches,\n isGenericType: NodePath_inference.isGenericType,\n\n // NodePath_replacement\n replaceWithMultiple: NodePath_replacement.replaceWithMultiple,\n replaceWithSourceString: NodePath_replacement.replaceWithSourceString,\n replaceWith: NodePath_replacement.replaceWith,\n replaceExpressionWithStatements:\n NodePath_replacement.replaceExpressionWithStatements,\n replaceInline: NodePath_replacement.replaceInline,\n\n // NodePath_evaluation\n evaluateTruthy: NodePath_evaluation.evaluateTruthy,\n evaluate: NodePath_evaluation.evaluate,\n\n // NodePath_conversion\n toComputedKey: NodePath_conversion.toComputedKey,\n ensureBlock: NodePath_conversion.ensureBlock,\n unwrapFunctionEnvironment: NodePath_conversion.unwrapFunctionEnvironment,\n arrowFunctionToExpression: NodePath_conversion.arrowFunctionToExpression,\n splitExportDeclaration: NodePath_conversion.splitExportDeclaration,\n ensureFunctionName: NodePath_conversion.ensureFunctionName,\n\n // NodePath_introspection\n matchesPattern: NodePath_introspection.matchesPattern,\n has: NodePath_introspection.has,\n isStatic: NodePath_introspection.isStatic,\n is: NodePath_introspection.is,\n isnt: NodePath_introspection.isnt,\n equals: NodePath_introspection.equals,\n isNodeType: NodePath_introspection.isNodeType,\n canHaveVariableDeclarationOrExpression:\n NodePath_introspection.canHaveVariableDeclarationOrExpression,\n canSwapBetweenExpressionAndStatement:\n NodePath_introspection.canSwapBetweenExpressionAndStatement,\n isCompletionRecord: NodePath_introspection.isCompletionRecord,\n isStatementOrBlock: NodePath_introspection.isStatementOrBlock,\n referencesImport: NodePath_introspection.referencesImport,\n getSource: NodePath_introspection.getSource,\n willIMaybeExecuteBefore: NodePath_introspection.willIMaybeExecuteBefore,\n _guessExecutionStatusRelativeTo:\n NodePath_introspection._guessExecutionStatusRelativeTo,\n resolve: NodePath_introspection.resolve,\n isConstantExpression: NodePath_introspection.isConstantExpression,\n isInStrictMode: NodePath_introspection.isInStrictMode,\n\n // NodePath_context\n call: NodePath_context.call,\n isDenylisted: NodePath_context.isDenylisted,\n isBlacklisted: NodePath_context.isBlacklisted,\n visit: NodePath_context.visit,\n skip: NodePath_context.skip,\n skipKey: NodePath_context.skipKey,\n stop: NodePath_context.stop,\n setScope: NodePath_context.setScope,\n setContext: NodePath_context.setContext,\n resync: NodePath_context.resync,\n popContext: NodePath_context.popContext,\n pushContext: NodePath_context.pushContext,\n setup: NodePath_context.setup,\n setKey: NodePath_context.setKey,\n requeue: NodePath_context.requeue,\n requeueComputedKeyAndDecorators:\n NodePath_context.requeueComputedKeyAndDecorators,\n\n // NodePath_removal\n remove: NodePath_removal.remove,\n\n // NodePath_modification\n insertBefore: NodePath_modification.insertBefore,\n insertAfter: NodePath_modification.insertAfter,\n updateSiblingKeys: NodePath_modification.updateSiblingKeys,\n unshiftContainer: NodePath_modification.unshiftContainer,\n pushContainer: NodePath_modification.pushContainer,\n hoist: NodePath_modification.hoist,\n\n // NodePath_family\n getOpposite: NodePath_family.getOpposite,\n getCompletionRecords: NodePath_family.getCompletionRecords,\n getSibling: NodePath_family.getSibling,\n getPrevSibling: NodePath_family.getPrevSibling,\n getNextSibling: NodePath_family.getNextSibling,\n getAllNextSiblings: NodePath_family.getAllNextSiblings,\n getAllPrevSiblings: NodePath_family.getAllPrevSiblings,\n get: NodePath_family.get,\n getAssignmentIdentifiers: NodePath_family.getAssignmentIdentifiers,\n getBindingIdentifiers: NodePath_family.getBindingIdentifiers,\n getOuterBindingIdentifiers: NodePath_family.getOuterBindingIdentifiers,\n getBindingIdentifierPaths: NodePath_family.getBindingIdentifierPaths,\n getOuterBindingIdentifierPaths:\n NodePath_family.getOuterBindingIdentifierPaths,\n\n // NodePath_comments\n shareCommentsWithSiblings: NodePath_comments.shareCommentsWithSiblings,\n addComment: NodePath_comments.addComment,\n addComments: NodePath_comments.addComments,\n};\n\nObject.assign(NodePath_Final.prototype, methods);\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n // @ts-expect-error babel 7 only\n NodePath_Final.prototype.arrowFunctionToShadowed =\n // workaround for rollup\n // @ts-expect-error babel 7 only\n NodePath_conversion[String(\"arrowFunctionToShadowed\")];\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // @ts-expect-error The original _guessExecutionStatusRelativeToDifferentFunctions only worked for paths in\n // different functions, but _guessExecutionStatusRelativeTo works as a replacement in those cases.\n NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions =\n NodePath_introspection._guessExecutionStatusRelativeTo;\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // @ts-expect-error The original _guessExecutionStatusRelativeToDifferentFunctions only worked for paths in\n // different functions, but _guessExecutionStatusRelativeTo works as a replacement in those cases.\n NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions =\n NodePath_introspection._guessExecutionStatusRelativeTo;\n\n Object.assign(NodePath_Final.prototype, {\n // NodePath_inference\n _getTypeAnnotation: NodePath_inference._getTypeAnnotation,\n\n // NodePath_replacement\n _replaceWith: NodePath_replacement._replaceWith,\n\n // NodePath_introspection\n _resolve: NodePath_introspection._resolve,\n\n // NodePath_context\n _call: NodePath_context._call,\n _resyncParent: NodePath_context._resyncParent,\n _resyncKey: NodePath_context._resyncKey,\n _resyncList: NodePath_context._resyncList,\n _resyncRemoved: NodePath_context._resyncRemoved,\n _getQueueContexts: NodePath_context._getQueueContexts,\n\n // NodePath_removal\n _removeFromScope: NodePath_removal._removeFromScope,\n _callRemovalHooks: NodePath_removal._callRemovalHooks,\n _remove: NodePath_removal._remove,\n _markRemoved: NodePath_removal._markRemoved,\n _assertUnremoved: NodePath_removal._assertUnremoved,\n\n // NodePath_modification\n _containerInsert: NodePath_modification._containerInsert,\n _containerInsertBefore: NodePath_modification._containerInsertBefore,\n _containerInsertAfter: NodePath_modification._containerInsertAfter,\n _verifyNodeList: NodePath_modification._verifyNodeList,\n\n // NodePath_family\n _getKey: NodePath_family._getKey,\n _getPattern: NodePath_family._getPattern,\n });\n}\n\n// we can not use `import { TYPES } from \"@babel/types\"` here\n// because the transformNamedBabelTypesImportToDestructuring plugin in babel.config.js\n// does not offer live bindings for `TYPES`\n// we can change to `import { TYPES }` when we are publishing ES modules only\nfor (const type of t.TYPES) {\n const typeKey = `is${type}`;\n // @ts-expect-error typeKey must present in t\n const fn = t[typeKey];\n // @ts-expect-error augmenting NodePath prototype\n NodePath_Final.prototype[typeKey] = function (opts: any) {\n return fn(this.node, opts);\n };\n\n // @ts-expect-error augmenting NodePath prototype\n NodePath_Final.prototype[`assert${type}`] = function (opts: any) {\n if (!fn(this.node, opts)) {\n throw new TypeError(`Expected node path of type ${type}`);\n }\n };\n}\n\n// Register virtual types validators after base types validators\nObject.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);\n\nfor (const type of Object.keys(virtualTypes) as (keyof typeof virtualTypes)[]) {\n if (type[0] === \"_\") continue;\n if (!t.TYPES.includes(type)) t.TYPES.push(type);\n}\n\ninterface NodePathOverwrites {\n // We need to re-define these predicate and assertion\n // methods here, because we cannot refine `this` in\n // a function declaration.\n // See https://github.com/microsoft/TypeScript/issues/38150\n\n /**\n * NOTE: This assertion doesn't narrow the type on unions of\n * NodePaths, due to https://github.com/microsoft/TypeScript/issues/44212\n *\n * @see ./conversion.ts for implementation.\n */\n ensureBlock(\n this: NodePath_Final,\n ): asserts this is NodePath_Final<\n (\n | t.Loop\n | t.WithStatement\n | t.Function\n | t.LabeledStatement\n | t.CatchClause\n ) & { body: t.BlockStatement }\n >;\n /**\n * @see ./introspection.ts for implementation.\n */\n isStatementOrBlock(\n this: NodePath_Final,\n ): this is NodePath_Final<t.Statement | t.Block>;\n}\n\ntype NodePathMixins = Omit<typeof methods, keyof NodePathOverwrites>;\n\ninterface NodePath<T extends t.Node>\n extends InstanceType<typeof NodePath_Final>,\n NodePathAssertions,\n NodePathValidators,\n NodePathMixins,\n NodePathOverwrites {\n type: T[\"type\"] | null;\n node: T;\n parent: t.ParentMaps[T[\"type\"]];\n parentPath: t.ParentMaps[T[\"type\"]] extends null\n ? null\n : NodePath_Final<t.ParentMaps[T[\"type\"]]> | null;\n}\n\n// This trick is necessary so that\n// NodePath_Final<A | B> is the same as NodePath_Final<A> | NodePath_Final<B>\ntype NodePath_Final<T extends t.Node = t.Node> = T extends any\n ? NodePath<T>\n : never;\n\nexport { NodePath_Final as default, type NodePath as NodePath_Internal };\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AAAwC,IAAAK,CAAA,GAAAD,EAAA;AAExC,IAAAE,KAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAGA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAA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Types","require","_debug","_index","_index2","_t","t","cache","_generator","NodePath_ancestry","NodePath_inference","NodePath_replacement","NodePath_evaluation","NodePath_conversion","NodePath_introspection","_context","NodePath_context","NodePath_removal","NodePath_modification","NodePath_family","NodePath_comments","NodePath_virtual_types_validator","validate","debug","buildDebug","REMOVED","exports","SHOULD_STOP","SHOULD_SKIP","NodePath_Final","default","NodePath","constructor","hub","parent","contexts","state","opts","_traverseFlags","skipKeys","parentPath","container","listKey","key","node","type","data","context","scope","removed","v","shouldStop","shouldSkip","get","Error","targetNode","paths","getOrCreateCachedPaths","path","set","setup","call","getScope","isScope","Scope","setData","val","Object","create","getData","def","undefined","hasNode","buildCodeFrameError","msg","SyntaxError","buildError","traverse","visitor","getPathLocation","parts","inList","unshift","join","message","enabled","toString","generator","code","parentKey","methods","findParent","find","getFunctionParent","getStatementParent","getEarliestCommonAncestorFrom","getDeepestCommonAncestorFrom","getAncestry","isAncestor","isDescendant","inType","getTypeAnnotation","isBaseType","couldBeBaseType","baseTypeStrictlyMatches","isGenericType","replaceWithMultiple","replaceWithSourceString","replaceWith","replaceExpressionWithStatements","replaceInline","evaluateTruthy","evaluate","toComputedKey","ensureBlock","unwrapFunctionEnvironment","arrowFunctionToExpression","splitExportDeclaration","ensureFunctionName","matchesPattern","isStatic","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","isCompletionRecord","isStatementOrBlock","referencesImport","getSource","willIMaybeExecuteBefore","_guessExecutionStatusRelativeTo","resolve","isConstantExpression","isInStrictMode","isDenylisted","visit","skip","skipKey","stop","setContext","requeue","requeueComputedKeyAndDecorators","remove","insertBefore","insertAfter","unshiftContainer","pushContainer","getOpposite","getCompletionRecords","getSibling","getPrevSibling","getNextSibling","getAllNextSiblings","getAllPrevSiblings","getAssignmentIdentifiers","getBindingIdentifiers","getOuterBindingIdentifiers","getBindingIdentifierPaths","getOuterBindingIdentifierPaths","shareCommentsWithSiblings","addComment","addComments","assign","prototype","arrowFunctionToShadowed","String","has","is","isnt","equals","hoist","updateSiblingKeys","isBlacklisted","setScope","resync","popContext","pushContext","setKey","_guessExecutionStatusRelativeToDifferentFunctions","_getTypeAnnotation","_replaceWith","_resolve","_call","_resyncParent","_resyncKey","_resyncList","_resyncRemoved","_getQueueContexts","_removeFromScope","_callRemovalHooks","_remove","_markRemoved","_assertUnremoved","_containerInsert","_containerInsertBefore","_containerInsertAfter","_verifyNodeList","_getKey","_getPattern","TYPES","typeKey","fn","TypeError","keys","includes","push"],"sources":["../../src/path/index.ts"],"sourcesContent":["import type { HubInterface } from \"../hub.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { ExplodedTraverseOptions } from \"../index.ts\";\nimport * as virtualTypes from \"./lib/virtual-types.ts\";\nimport buildDebug from \"debug\";\nimport traverse from \"../index.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport Scope from \"../scope/index.ts\";\nimport { validate } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport * as cache from \"../cache.ts\";\nimport generator from \"@babel/generator\";\n\n// NodePath is split across many files.\nimport * as NodePath_ancestry from \"./ancestry.ts\";\nimport * as NodePath_inference from \"./inference/index.ts\";\nimport * as NodePath_replacement from \"./replacement.ts\";\nimport * as NodePath_evaluation from \"./evaluation.ts\";\nimport * as NodePath_conversion from \"./conversion.ts\";\nimport * as NodePath_introspection from \"./introspection.ts\";\nimport * as NodePath_context from \"./context.ts\";\nimport * as NodePath_removal from \"./removal.ts\";\nimport * as NodePath_modification from \"./modification.ts\";\nimport * as NodePath_family from \"./family.ts\";\nimport * as NodePath_comments from \"./comments.ts\";\nimport * as NodePath_virtual_types_validator from \"./lib/virtual-types-validator.ts\";\nimport type { NodePathAssertions } from \"./generated/asserts.ts\";\nimport type { NodePathValidators } from \"./generated/validators.ts\";\nimport { setup } from \"./context.ts\";\n\nconst debug = buildDebug(\"babel\");\n\nexport const REMOVED = 1 << 0;\nexport const SHOULD_STOP = 1 << 1;\nexport const SHOULD_SKIP = 1 << 2;\n\ndeclare const bit: import(\"../../../../scripts/babel-plugin-bit-decorator/types.d.ts\").BitDecorator<any>;\n\nconst NodePath_Final = class NodePath {\n constructor(hub: HubInterface, parent: t.Node | null) {\n this.parent = parent;\n this.hub = hub;\n this.data = null;\n\n this.context = null;\n this.scope = null;\n }\n\n declare parent: t.Node;\n declare hub: HubInterface;\n declare data: Record<string | symbol, unknown>;\n // TraversalContext is configured by setContext\n declare context: TraversalContext;\n declare scope: Scope;\n\n contexts: Array<TraversalContext> = [];\n state: any = null;\n opts: ExplodedTraverseOptions | null = null;\n\n @bit.storage _traverseFlags: number;\n @bit(REMOVED) accessor removed = false;\n @bit(SHOULD_STOP) accessor shouldStop = false;\n @bit(SHOULD_SKIP) accessor shouldSkip = false;\n\n skipKeys: Record<string, boolean> | null = null;\n parentPath: NodePath_Final | null = null;\n container: t.Node | Array<t.Node> | null = null;\n listKey: string | null = null;\n key: string | number | null = null;\n node: t.Node | null = null;\n type: t.Node[\"type\"] | null = null;\n\n static get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n }: {\n hub?: HubInterface;\n parentPath: NodePath_Final | null;\n parent: t.Node;\n container: t.Node | t.Node[];\n listKey?: string;\n key: string | number;\n }): NodePath_Final {\n if (!hub && parentPath) {\n hub = parentPath.hub;\n }\n\n if (!parent) {\n throw new Error(\"To get a node path the parent needs to exist\");\n }\n\n const targetNode =\n // @ts-expect-error key must present in container\n container[key];\n\n const paths = cache.getOrCreateCachedPaths(hub, parent);\n\n let path = paths.get(targetNode);\n if (!path) {\n path = new NodePath(hub, parent) as NodePath_Final;\n if (targetNode) paths.set(targetNode, path);\n }\n\n setup.call(path, parentPath, container, listKey, key);\n\n return path;\n }\n\n getScope(this: NodePath_Final, scope: Scope): Scope {\n return this.isScope() ? new Scope(this) : scope;\n }\n\n setData(key: string | symbol, val: any): any {\n if (this.data == null) {\n this.data = Object.create(null);\n }\n return (this.data[key] = val);\n }\n\n getData(key: string | symbol, def?: any): any {\n if (this.data == null) {\n this.data = Object.create(null);\n }\n let val = this.data[key];\n if (val === undefined && def !== undefined) val = this.data[key] = def;\n return val;\n }\n\n hasNode(): boolean {\n return this.node != null;\n }\n\n buildCodeFrameError(\n msg: string,\n Error: new () => Error = SyntaxError,\n ): Error {\n return this.hub.buildError(this.node, msg, Error);\n }\n\n traverse<T>(this: NodePath_Final, visitor: Visitor<T>, state: T): void;\n traverse(this: NodePath_Final, visitor: Visitor): void;\n traverse(this: NodePath_Final, visitor: any, state?: any) {\n traverse(this.node, visitor, this.scope, state, this);\n }\n\n set(key: string, node: any) {\n validate(this.node, key, node);\n // @ts-expect-error key must present in this.node\n this.node[key] = node;\n }\n\n getPathLocation(this: NodePath_Final): string {\n const parts = [];\n let path: NodePath_Final = this;\n do {\n let key = path.key;\n if (path.inList) key = `${path.listKey}[${key}]`;\n parts.unshift(key);\n } while ((path = path.parentPath));\n return parts.join(\".\");\n }\n\n debug(this: NodePath_Final, message: string) {\n if (!debug.enabled) return;\n debug(`${this.getPathLocation()} ${this.type}: ${message}`);\n }\n\n toString() {\n return generator(this.node).code;\n }\n\n get inList() {\n return !!this.listKey;\n }\n\n set inList(inList) {\n if (!inList) {\n this.listKey = null;\n }\n // ignore inList = true as it should depend on `listKey`\n }\n\n get parentKey(): string {\n return (this.listKey || this.key) as string;\n }\n};\n\nconst methods = {\n // NodePath_ancestry\n findParent: NodePath_ancestry.findParent,\n find: NodePath_ancestry.find,\n getFunctionParent: NodePath_ancestry.getFunctionParent,\n getStatementParent: NodePath_ancestry.getStatementParent,\n getEarliestCommonAncestorFrom:\n NodePath_ancestry.getEarliestCommonAncestorFrom,\n getDeepestCommonAncestorFrom: NodePath_ancestry.getDeepestCommonAncestorFrom,\n getAncestry: NodePath_ancestry.getAncestry,\n isAncestor: NodePath_ancestry.isAncestor,\n isDescendant: NodePath_ancestry.isDescendant,\n inType: NodePath_ancestry.inType,\n\n // NodePath_inference\n getTypeAnnotation: NodePath_inference.getTypeAnnotation,\n isBaseType: NodePath_inference.isBaseType,\n couldBeBaseType: NodePath_inference.couldBeBaseType,\n baseTypeStrictlyMatches: NodePath_inference.baseTypeStrictlyMatches,\n isGenericType: NodePath_inference.isGenericType,\n\n // NodePath_replacement\n replaceWithMultiple: NodePath_replacement.replaceWithMultiple,\n replaceWithSourceString: NodePath_replacement.replaceWithSourceString,\n replaceWith: NodePath_replacement.replaceWith,\n replaceExpressionWithStatements:\n NodePath_replacement.replaceExpressionWithStatements,\n replaceInline: NodePath_replacement.replaceInline,\n\n // NodePath_evaluation\n evaluateTruthy: NodePath_evaluation.evaluateTruthy,\n evaluate: NodePath_evaluation.evaluate,\n\n // NodePath_conversion\n toComputedKey: NodePath_conversion.toComputedKey,\n ensureBlock: NodePath_conversion.ensureBlock,\n unwrapFunctionEnvironment: NodePath_conversion.unwrapFunctionEnvironment,\n arrowFunctionToExpression: NodePath_conversion.arrowFunctionToExpression,\n splitExportDeclaration: NodePath_conversion.splitExportDeclaration,\n ensureFunctionName: NodePath_conversion.ensureFunctionName,\n\n // NodePath_introspection\n matchesPattern: NodePath_introspection.matchesPattern,\n isStatic: NodePath_introspection.isStatic,\n isNodeType: NodePath_introspection.isNodeType,\n canHaveVariableDeclarationOrExpression:\n NodePath_introspection.canHaveVariableDeclarationOrExpression,\n canSwapBetweenExpressionAndStatement:\n NodePath_introspection.canSwapBetweenExpressionAndStatement,\n isCompletionRecord: NodePath_introspection.isCompletionRecord,\n isStatementOrBlock: NodePath_introspection.isStatementOrBlock,\n referencesImport: NodePath_introspection.referencesImport,\n getSource: NodePath_introspection.getSource,\n willIMaybeExecuteBefore: NodePath_introspection.willIMaybeExecuteBefore,\n _guessExecutionStatusRelativeTo:\n NodePath_introspection._guessExecutionStatusRelativeTo,\n resolve: NodePath_introspection.resolve,\n isConstantExpression: NodePath_introspection.isConstantExpression,\n isInStrictMode: NodePath_introspection.isInStrictMode,\n\n // NodePath_context\n isDenylisted: NodePath_context.isDenylisted,\n visit: NodePath_context.visit,\n skip: NodePath_context.skip,\n skipKey: NodePath_context.skipKey,\n stop: NodePath_context.stop,\n setContext: NodePath_context.setContext,\n requeue: NodePath_context.requeue,\n requeueComputedKeyAndDecorators:\n NodePath_context.requeueComputedKeyAndDecorators,\n\n // NodePath_removal\n remove: NodePath_removal.remove,\n\n // NodePath_modification\n insertBefore: NodePath_modification.insertBefore,\n insertAfter: NodePath_modification.insertAfter,\n unshiftContainer: NodePath_modification.unshiftContainer,\n pushContainer: NodePath_modification.pushContainer,\n\n // NodePath_family\n getOpposite: NodePath_family.getOpposite,\n getCompletionRecords: NodePath_family.getCompletionRecords,\n getSibling: NodePath_family.getSibling,\n getPrevSibling: NodePath_family.getPrevSibling,\n getNextSibling: NodePath_family.getNextSibling,\n getAllNextSiblings: NodePath_family.getAllNextSiblings,\n getAllPrevSiblings: NodePath_family.getAllPrevSiblings,\n get: NodePath_family.get,\n getAssignmentIdentifiers: NodePath_family.getAssignmentIdentifiers,\n getBindingIdentifiers: NodePath_family.getBindingIdentifiers,\n getOuterBindingIdentifiers: NodePath_family.getOuterBindingIdentifiers,\n getBindingIdentifierPaths: NodePath_family.getBindingIdentifierPaths,\n getOuterBindingIdentifierPaths:\n NodePath_family.getOuterBindingIdentifierPaths,\n\n // NodePath_comments\n shareCommentsWithSiblings: NodePath_comments.shareCommentsWithSiblings,\n addComment: NodePath_comments.addComment,\n addComments: NodePath_comments.addComments,\n};\n\nObject.assign(NodePath_Final.prototype, methods);\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n // String(x) is workaround for rollup\n\n // @ts-expect-error babel 7 only\n NodePath_Final.prototype.arrowFunctionToShadowed =\n // @ts-expect-error babel 7 only\n NodePath_conversion[String(\"arrowFunctionToShadowed\")];\n\n Object.assign(NodePath_Final.prototype, {\n // @ts-expect-error Babel 7 only\n has: NodePath_introspection[String(\"has\")],\n // @ts-expect-error Babel 7 only\n is: NodePath_introspection[String(\"is\")],\n // @ts-expect-error Babel 7 only\n isnt: NodePath_introspection[String(\"isnt\")],\n // @ts-expect-error Babel 7 only\n equals: NodePath_introspection[String(\"equals\")],\n // @ts-expect-error Babel 7 only\n hoist: NodePath_modification[String(\"hoist\")],\n updateSiblingKeys: NodePath_modification.updateSiblingKeys,\n call: NodePath_context.call,\n // @ts-expect-error Babel 7 only\n isBlacklisted: NodePath_context[String(\"isBlacklisted\")],\n setScope: NodePath_context.setScope,\n resync: NodePath_context.resync,\n popContext: NodePath_context.popContext,\n pushContext: NodePath_context.pushContext,\n setup: NodePath_context.setup,\n setKey: NodePath_context.setKey,\n });\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // @ts-expect-error The original _guessExecutionStatusRelativeToDifferentFunctions only worked for paths in\n // different functions, but _guessExecutionStatusRelativeTo works as a replacement in those cases.\n NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions =\n NodePath_introspection._guessExecutionStatusRelativeTo;\n\n // @ts-expect-error The original _guessExecutionStatusRelativeToDifferentFunctions only worked for paths in\n // different functions, but _guessExecutionStatusRelativeTo works as a replacement in those cases.\n NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions =\n NodePath_introspection._guessExecutionStatusRelativeTo;\n\n Object.assign(NodePath_Final.prototype, {\n // NodePath_inference\n _getTypeAnnotation: NodePath_inference._getTypeAnnotation,\n\n // NodePath_replacement\n _replaceWith: NodePath_replacement._replaceWith,\n\n // NodePath_introspection\n _resolve: NodePath_introspection._resolve,\n\n // NodePath_context\n _call: NodePath_context._call,\n _resyncParent: NodePath_context._resyncParent,\n _resyncKey: NodePath_context._resyncKey,\n _resyncList: NodePath_context._resyncList,\n _resyncRemoved: NodePath_context._resyncRemoved,\n _getQueueContexts: NodePath_context._getQueueContexts,\n\n // NodePath_removal\n _removeFromScope: NodePath_removal._removeFromScope,\n _callRemovalHooks: NodePath_removal._callRemovalHooks,\n _remove: NodePath_removal._remove,\n _markRemoved: NodePath_removal._markRemoved,\n _assertUnremoved: NodePath_removal._assertUnremoved,\n\n // NodePath_modification\n _containerInsert: NodePath_modification._containerInsert,\n _containerInsertBefore: NodePath_modification._containerInsertBefore,\n _containerInsertAfter: NodePath_modification._containerInsertAfter,\n _verifyNodeList: NodePath_modification._verifyNodeList,\n\n // NodePath_family\n _getKey: NodePath_family._getKey,\n _getPattern: NodePath_family._getPattern,\n });\n}\n\n// we can not use `import { TYPES } from \"@babel/types\"` here\n// because the transformNamedBabelTypesImportToDestructuring plugin in babel.config.js\n// does not offer live bindings for `TYPES`\n// we can change to `import { TYPES }` when we are publishing ES modules only\nfor (const type of t.TYPES) {\n const typeKey = `is${type}`;\n // @ts-expect-error typeKey must present in t\n const fn = t[typeKey];\n // @ts-expect-error augmenting NodePath prototype\n NodePath_Final.prototype[typeKey] = function (opts: any) {\n return fn(this.node, opts);\n };\n\n // @ts-expect-error augmenting NodePath prototype\n NodePath_Final.prototype[`assert${type}`] = function (opts: any) {\n if (!fn(this.node, opts)) {\n throw new TypeError(`Expected node path of type ${type}`);\n }\n };\n}\n\n// Register virtual types validators after base types validators\nObject.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);\n\nfor (const type of Object.keys(virtualTypes) as (keyof typeof virtualTypes)[]) {\n if (type[0] === \"_\") continue;\n if (!t.TYPES.includes(type)) t.TYPES.push(type);\n}\n\ninterface NodePathOverwrites {\n // We need to re-define these predicate and assertion\n // methods here, because we cannot refine `this` in\n // a function declaration.\n // See https://github.com/microsoft/TypeScript/issues/38150\n\n /**\n * NOTE: This assertion doesn't narrow the type on unions of\n * NodePaths, due to https://github.com/microsoft/TypeScript/issues/44212\n *\n * @see ./conversion.ts for implementation.\n */\n ensureBlock(\n this: NodePath_Final,\n ): asserts this is NodePath_Final<\n (\n | t.Loop\n | t.WithStatement\n | t.Function\n | t.LabeledStatement\n | t.CatchClause\n ) & { body: t.BlockStatement }\n >;\n /**\n * @see ./introspection.ts for implementation.\n */\n isStatementOrBlock(\n this: NodePath_Final,\n ): this is NodePath_Final<t.Statement | t.Block>;\n}\n\ntype NodePathMixins = Omit<typeof methods, keyof NodePathOverwrites>;\n\ninterface NodePath<T extends t.Node>\n extends InstanceType<typeof NodePath_Final>,\n NodePathAssertions,\n NodePathValidators,\n NodePathMixins,\n NodePathOverwrites {\n type: T[\"type\"] | null;\n node: T;\n parent: t.ParentMaps[T[\"type\"]];\n parentPath: t.ParentMaps[T[\"type\"]] extends null\n ? null\n : NodePath_Final<t.ParentMaps[T[\"type\"]]> | null;\n}\n\n// This trick is necessary so that\n// NodePath_Final<A | B> is the same as NodePath_Final<A> | NodePath_Final<B>\ntype NodePath_Final<T extends t.Node = t.Node> = T extends any\n ? NodePath<T>\n : never;\n\nexport { NodePath_Final as default, type NodePath as NodePath_Internal };\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AAAwC,IAAAK,CAAA,GAAAD,EAAA;AAExC,IAAAE,KAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAGA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,sBAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AAAiD,IAAAe,gBAAA,GAAAD,QAAA;AACjD,IAAAE,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,qBAAA,GAAAjB,OAAA;AACA,IAAAkB,eAAA,GAAAlB,OAAA;AACA,IAAAmB,iBAAA,GAAAnB,OAAA;AACA,IAAAoB,gCAAA,GAAApB,OAAA;AAAqF;EAjB5EqB;AAAQ,IAAAjB,EAAA;AAsBjB,MAAMkB,KAAK,GAAGC,MAAU,CAAC,OAAO,CAAC;AAE1B,MAAMC,OAAO,GAAAC,OA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jL,qBAAqB,CAACiL,eAAe;IAGtDC,OAAO,EAAEjL,eAAe,CAACiL,OAAO;IAChCC,WAAW,EAAElL,eAAe,CAACkL;EAC/B,CAAC,CAAC;AACJ;AAMA,KAAK,MAAMxJ,IAAI,IAAIvC,CAAC,CAACgM,KAAK,EAAE;EAC1B,MAAMC,OAAO,GAAG,KAAK1J,IAAI,EAAE;EAE3B,MAAM2J,EAAE,GAAGlM,CAAC,CAACiM,OAAO,CAAC;EAErB1K,cAAc,CAACqI,SAAS,CAACqC,OAAO,CAAC,GAAG,UAAUlK,IAAS,EAAE;IACvD,OAAOmK,EAAE,CAAC,IAAI,CAAC5J,IAAI,EAAEP,IAAI,CAAC;EAC5B,CAAC;EAGDR,cAAc,CAACqI,SAAS,CAAC,SAASrH,IAAI,EAAE,CAAC,GAAG,UAAUR,IAAS,EAAE;IAC/D,IAAI,CAACmK,EAAE,CAAC,IAAI,CAAC5J,IAAI,EAAEP,IAAI,CAAC,EAAE;MACxB,MAAM,IAAIoK,SAAS,CAAC,8BAA8B5J,IAAI,EAAE,CAAC;IAC3D;EACF,CAAC;AACH;AAGAsB,MAAM,CAAC8F,MAAM,CAACpI,cAAc,CAACqI,SAAS,EAAE7I,gCAAgC,CAAC;AAEzE,KAAK,MAAMwB,IAAI,IAAIsB,MAAM,CAACuI,IAAI,CAAC1M,YAAY,CAAC,EAAmC;EAC7E,IAAI6C,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;EACrB,IAAI,CAACvC,CAAC,CAACgM,KAAK,CAACK,QAAQ,CAAC9J,IAAI,CAAC,EAAEvC,CAAC,CAACgM,KAAK,CAACM,IAAI,CAAC/J,IAAI,CAAC;AACjD","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/introspection.js
rd565449 r0c6b92a 8 8 exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression; 9 9 exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement; 10 exports.equals = equals;11 10 exports.getSource = getSource; 12 exports.has = has;13 exports.is = void 0;14 11 exports.isCompletionRecord = isCompletionRecord; 15 12 exports.isConstantExpression = isConstantExpression; … … 18 15 exports.isStatementOrBlock = isStatementOrBlock; 19 16 exports.isStatic = isStatic; 20 exports.isnt = isnt;21 17 exports.matchesPattern = matchesPattern; 22 18 exports.referencesImport = referencesImport; … … 38 34 return _matchesPattern(this.node, pattern, allowPartial); 39 35 } 40 function has(key) { 41 var _this$node; 42 const val = (_this$node = this.node) == null ? void 0 : _this$node[key]; 43 if (val && Array.isArray(val)) { 44 return !!val.length; 45 } else { 46 return !!val; 47 } 36 { 37 exports.has = function has(key) { 38 var _this$node; 39 const val = (_this$node = this.node) == null ? void 0 : _this$node[key]; 40 if (val && Array.isArray(val)) { 41 return !!val.length; 42 } else { 43 return !!val; 44 } 45 }; 48 46 } 49 47 function isStatic() { 50 48 return this.scope.isStatic(this.node); 51 49 } 52 const is = exports.is = has; 53 function isnt(key) { 54 return !this.has(key); 55 } 56 function equals(key, value) { 57 return this.node[key] === value; 50 { 51 exports.is = exports.has; 52 exports.isnt = function isnt(key) { 53 return !this.has(key); 54 }; 55 exports.equals = function equals(key, value) { 56 return this.node[key] === value; 57 }; 58 58 } 59 59 function isNodeType(type) { -
imaps-frontend/node_modules/@babel/traverse/lib/path/introspection.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_t","require","STATEMENT_OR_BLOCK_KEYS","VISITOR_KEYS","isBlockStatement","isExpression","isIdentifier","isLiteral","isStringLiteral","isType","matchesPattern","_matchesPattern","pattern","allowPartial","node"," has","key","_this$node","val","Array","isArray","length","isStatic","scope","is","exports","isnt","equals","value","isNodeType","type","canHaveVariableDeclarationOrExpression","parentPath","isFor","canSwapBetweenExpressionAndStatement","replacement","isArrowFunctionExpression","isCompletionRecord","allowInsideFunction","path","first","container","isFunction","isProgram","isDoExpression","isStatementOrBlock","isLabeledStatement","includes","referencesImport","moduleSource","importName","isReferencedIdentifier","isJSXMemberExpression","property","name","isMemberExpression","isOptionalMemberExpression","computed","object","get","binding","getBinding","kind","parent","isImportDeclaration","source","isImportDefaultSpecifier","isImportNamespaceSpecifier","isImportSpecifier","imported","getSource","end","code","hub","getCode","slice","start","willIMaybeExecuteBefore","target","_guessExecutionStatusRelativeTo","getOuterFunction","getFunctionParent","getProgramParent","isExecutionUncertain","isExecutionUncertainInList","paths","maxIndex","i","parentKey","SYMBOL_CHECKING","Symbol","_guessExecutionStatusRelativeToCached","Map","base","cache","funcParent","this","_guessExecutionStatusRelativeToDifferentFunctionsCached","getAncestry","commonPath","commonIndex","indexOf","Error","divergence","listKey","keys","keyPosition","_guessExecutionStatusRelativeToDifferentFunctionsInternal","isFunctionDeclaration","isExportDeclaration","id","references","referencePaths","allStatus","childOfFunction","find","isCallExpression","status","nodeMap","cached","set","result","resolve","dangerous","resolved","_resolve","call","_resolved","push","isVariableDeclarator","constant","ret","isTypeCastExpression","targetKey","toComputedKey","targetName","isObjectExpression","props","prop","isProperty","match","isArrayExpression","isNaN","elems","elem","isConstantExpression","isRegExpLiteral","isTemplateLiteral","every","expression","isUnaryExpression","operator","isBinaryExpression","hasBinding","noGlobals","arguments","isInStrictMode","strictParent","sourceType","isClass","body","directive","directives"],"sources":["../../src/path/introspection.ts"],"sourcesContent":["// This file contains methods responsible for introspecting the current path for certain values.\n\nimport type NodePath from \"./index.ts\";\nimport {\n STATEMENT_OR_BLOCK_KEYS,\n VISITOR_KEYS,\n isBlockStatement,\n isExpression,\n isIdentifier,\n isLiteral,\n isStringLiteral,\n isType,\n matchesPattern as _matchesPattern,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Match the current node if it matches the provided `pattern`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\n\nexport function matchesPattern(\n this: NodePath,\n pattern: string,\n allowPartial?: boolean,\n): boolean {\n return _matchesPattern(this.node, pattern, allowPartial);\n}\n\n/**\n * Check whether we have the input `key`. If the `key` references an array then we check\n * if the array has any items, otherwise we just check if it's falsy.\n */\n\nexport function has<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n): boolean {\n const val = (this.node as N)?.[key];\n if (val && Array.isArray(val)) {\n return !!val.length;\n } else {\n return !!val;\n }\n}\n\n/**\n * Description\n */\n\nexport function isStatic(this: NodePath): boolean {\n return this.scope.isStatic(this.node);\n}\n\n/**\n * Alias of `has`.\n */\n\nexport const is = has;\n\n/**\n * Opposite of `has`.\n */\n\nexport function isnt<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n): boolean {\n return !this.has(key);\n}\n\n/**\n * Check whether the path node `key` strict equals `value`.\n */\n\nexport function equals<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n value: any,\n): boolean {\n return (this.node as N)[key] === value;\n}\n\n/**\n * Check the type against our stored internal type of the node. This is handy when a node has\n * been removed yet we still internally know the type and need it to calculate node replacement.\n */\n\nexport function isNodeType(this: NodePath, type: string): boolean {\n return isType(this.type, type);\n}\n\n/**\n * This checks whether or not we're in one of the following positions:\n *\n * for (KEY in right);\n * for (KEY;;);\n *\n * This is because these spots allow VariableDeclarations AND normal expressions so we need\n * to tell the path replacement that it's ok to replace this with an expression.\n */\n\nexport function canHaveVariableDeclarationOrExpression(this: NodePath) {\n return (\n (this.key === \"init\" || this.key === \"left\") && this.parentPath.isFor()\n );\n}\n\n/**\n * This checks whether we are swapping an arrow function's body between an\n * expression and a block statement (or vice versa).\n *\n * This is because arrow functions may implicitly return an expression, which\n * is the same as containing a block statement.\n */\n\nexport function canSwapBetweenExpressionAndStatement(\n this: NodePath,\n replacement: t.Node,\n): boolean {\n if (this.key !== \"body\" || !this.parentPath.isArrowFunctionExpression()) {\n return false;\n }\n\n if (this.isExpression()) {\n return isBlockStatement(replacement);\n } else if (this.isBlockStatement()) {\n return isExpression(replacement);\n }\n\n return false;\n}\n\n/**\n * Check whether the current path references a completion record\n */\n\nexport function isCompletionRecord(\n this: NodePath,\n allowInsideFunction?: boolean,\n): boolean {\n let path = this;\n let first = true;\n\n do {\n const { type, container } = path;\n\n // we're in a function so can't be a completion record\n if (!first && (path.isFunction() || type === \"StaticBlock\")) {\n return !!allowInsideFunction;\n }\n\n first = false;\n\n // check to see if we're the last item in the container and if we are\n // we're a completion record!\n if (Array.isArray(container) && path.key !== container.length - 1) {\n return false;\n }\n } while (\n (path = path.parentPath) &&\n !path.isProgram() &&\n !path.isDoExpression()\n );\n\n return true;\n}\n\n/**\n * Check whether or not the current `key` allows either a single statement or block statement\n * so we can explode it if necessary.\n */\n\nexport function isStatementOrBlock(this: NodePath): boolean {\n if (\n this.parentPath.isLabeledStatement() ||\n isBlockStatement(this.container as t.Node)\n ) {\n return false;\n } else {\n return STATEMENT_OR_BLOCK_KEYS.includes(this.key as string);\n }\n}\n\n/**\n * Check if the currently assigned path references the `importName` of `moduleSource`.\n */\n\nexport function referencesImport(\n this: NodePath,\n moduleSource: string,\n importName: string,\n): boolean {\n if (!this.isReferencedIdentifier()) {\n if (\n (this.isJSXMemberExpression() &&\n this.node.property.name === importName) ||\n ((this.isMemberExpression() || this.isOptionalMemberExpression()) &&\n (this.node.computed\n ? isStringLiteral(this.node.property, { value: importName })\n : (this.node.property as t.Identifier).name === importName))\n ) {\n const object = (\n this as NodePath<t.MemberExpression | t.OptionalMemberExpression>\n ).get(\"object\");\n return (\n object.isReferencedIdentifier() &&\n object.referencesImport(moduleSource, \"*\")\n );\n }\n\n return false;\n }\n\n const binding = this.scope.getBinding((this.node as t.Identifier).name);\n if (!binding || binding.kind !== \"module\") return false;\n\n const path = binding.path;\n const parent = path.parentPath;\n if (!parent.isImportDeclaration()) return false;\n\n // check moduleSource\n if (parent.node.source.value === moduleSource) {\n if (!importName) return true;\n } else {\n return false;\n }\n\n if (path.isImportDefaultSpecifier() && importName === \"default\") {\n return true;\n }\n\n if (path.isImportNamespaceSpecifier() && importName === \"*\") {\n return true;\n }\n\n if (\n path.isImportSpecifier() &&\n isIdentifier(path.node.imported, { name: importName })\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get the source code associated with this node.\n */\n\nexport function getSource(this: NodePath): string {\n const node = this.node;\n if (node.end) {\n const code = this.hub.getCode();\n if (code) return code.slice(node.start, node.end);\n }\n return \"\";\n}\n\nexport function willIMaybeExecuteBefore(\n this: NodePath,\n target: NodePath,\n): boolean {\n return this._guessExecutionStatusRelativeTo(target) !== \"after\";\n}\n\nfunction getOuterFunction(path: NodePath) {\n return path.isProgram()\n ? path\n : (\n path.parentPath.scope.getFunctionParent() ||\n path.parentPath.scope.getProgramParent()\n ).path;\n}\n\nfunction isExecutionUncertain(type: t.Node[\"type\"], key: string) {\n switch (type) {\n // a && FOO\n // a || FOO\n case \"LogicalExpression\":\n return key === \"right\";\n\n // a ? FOO : FOO\n // if (a) FOO; else FOO;\n case \"ConditionalExpression\":\n case \"IfStatement\":\n return key === \"consequent\" || key === \"alternate\";\n\n // while (a) FOO;\n case \"WhileStatement\":\n case \"DoWhileStatement\":\n case \"ForInStatement\":\n case \"ForOfStatement\":\n return key === \"body\";\n\n // for (a; b; FOO) FOO;\n case \"ForStatement\":\n return key === \"body\" || key === \"update\";\n\n // switch (a) { FOO }\n case \"SwitchStatement\":\n return key === \"cases\";\n\n // try { a } catch FOO finally { b }\n case \"TryStatement\":\n return key === \"handler\";\n\n // var [ x = FOO ]\n case \"AssignmentPattern\":\n return key === \"right\";\n\n // a?.[FOO]\n case \"OptionalMemberExpression\":\n return key === \"property\";\n\n // a?.(FOO)\n case \"OptionalCallExpression\":\n return key === \"arguments\";\n\n default:\n return false;\n }\n}\n\nfunction isExecutionUncertainInList(paths: NodePath[], maxIndex: number) {\n for (let i = 0; i < maxIndex; i++) {\n const path = paths[i];\n if (isExecutionUncertain(path.parent.type, path.parentKey)) {\n return true;\n }\n }\n return false;\n}\n\n// TODO(Babel 8)\n// This can be { before: boolean, after: boolean, unknown: boolean }.\n// This allows transforms like the tdz one to treat cases when the status\n// is both before and unknown/after like if it were before.\ntype RelativeExecutionStatus = \"before\" | \"after\" | \"unknown\";\n\n// Used to avoid infinite recursion in cases like\n// function f() { if (false) f(); }\n// f();\n// It also works with indirect recursion.\nconst SYMBOL_CHECKING = Symbol();\n\ntype ExecutionStatusCache = Map<\n t.Node,\n Map<t.Node, RelativeExecutionStatus | typeof SYMBOL_CHECKING>\n>;\n\n/**\n * Given a `target` check the execution status of it relative to the current path.\n *\n * \"Execution status\" simply refers to where or not we **think** this will execute\n * before or after the input `target` element.\n */\n\nexport function _guessExecutionStatusRelativeTo(\n this: NodePath,\n target: NodePath,\n): RelativeExecutionStatus {\n return _guessExecutionStatusRelativeToCached(this, target, new Map());\n}\n\nfunction _guessExecutionStatusRelativeToCached(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n // check if the two paths are in different functions, we can't track execution of these\n const funcParent = {\n this: getOuterFunction(base),\n target: getOuterFunction(target),\n };\n\n // here we check the `node` equality as sometimes we may have different paths for the\n // same node due to path thrashing\n if (funcParent.target.node !== funcParent.this.node) {\n return _guessExecutionStatusRelativeToDifferentFunctionsCached(\n base,\n funcParent.target,\n cache,\n );\n }\n\n const paths = {\n target: target.getAncestry(),\n this: base.getAncestry(),\n };\n\n // If this is an ancestor of the target path,\n // e.g. f(g); where this is f and target is g.\n if (paths.target.includes(base)) return \"after\";\n if (paths.this.includes(target)) return \"before\";\n\n // get ancestor where the branches intersect\n let commonPath;\n const commonIndex = { target: 0, this: 0 };\n\n while (!commonPath && commonIndex.this < paths.this.length) {\n const path = paths.this[commonIndex.this];\n commonIndex.target = paths.target.indexOf(path);\n if (commonIndex.target >= 0) {\n commonPath = path;\n } else {\n commonIndex.this++;\n }\n }\n\n if (!commonPath) {\n throw new Error(\n \"Internal Babel error - The two compared nodes\" +\n \" don't appear to belong to the same program.\",\n );\n }\n\n if (\n isExecutionUncertainInList(paths.this, commonIndex.this - 1) ||\n isExecutionUncertainInList(paths.target, commonIndex.target - 1)\n ) {\n return \"unknown\";\n }\n\n const divergence = {\n this: paths.this[commonIndex.this - 1],\n target: paths.target[commonIndex.target - 1],\n };\n\n // container list so let's see which one is after the other\n // e.g. [ THIS, TARGET ]\n if (\n divergence.target.listKey &&\n divergence.this.listKey &&\n divergence.target.container === divergence.this.container\n ) {\n return divergence.target.key > divergence.this.key ? \"before\" : \"after\";\n }\n\n // otherwise we're associated by a parent node, check which key comes before the other\n const keys = VISITOR_KEYS[commonPath.type];\n const keyPosition = {\n this: keys.indexOf(divergence.this.parentKey),\n target: keys.indexOf(divergence.target.parentKey),\n };\n return keyPosition.target > keyPosition.this ? \"before\" : \"after\";\n}\n\nfunction _guessExecutionStatusRelativeToDifferentFunctionsInternal(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n if (!target.isFunctionDeclaration()) {\n if (\n _guessExecutionStatusRelativeToCached(base, target, cache) === \"before\"\n ) {\n return \"before\";\n }\n return \"unknown\";\n } else if (target.parentPath.isExportDeclaration()) {\n return \"unknown\";\n }\n\n // so we're in a completely different function, if this is a function declaration\n // then we can be a bit smarter and handle cases where the function is either\n // a. not called at all (part of an export)\n // b. called directly\n const binding = target.scope.getBinding(target.node.id.name);\n\n // no references!\n if (!binding.references) return \"before\";\n\n const referencePaths: Array<NodePath> = binding.referencePaths;\n\n let allStatus;\n\n // verify that all the calls have the same execution status\n for (const path of referencePaths) {\n // if a reference is a child of the function we're checking against then we can\n // safely ignore it\n const childOfFunction = !!path.find(path => path.node === target.node);\n if (childOfFunction) continue;\n\n if (path.key !== \"callee\" || !path.parentPath.isCallExpression()) {\n // This function is passed as a reference, so we don't\n // know when it will be called.\n return \"unknown\";\n }\n\n const status = _guessExecutionStatusRelativeToCached(base, path, cache);\n\n if (allStatus && allStatus !== status) {\n return \"unknown\";\n } else {\n allStatus = status;\n }\n }\n\n return allStatus;\n}\n\nfunction _guessExecutionStatusRelativeToDifferentFunctionsCached(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n let nodeMap = cache.get(base.node);\n let cached;\n\n if (!nodeMap) {\n cache.set(base.node, (nodeMap = new Map()));\n } else if ((cached = nodeMap.get(target.node))) {\n if (cached === SYMBOL_CHECKING) {\n return \"unknown\";\n }\n return cached;\n }\n\n nodeMap.set(target.node, SYMBOL_CHECKING);\n\n const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(\n base,\n target,\n cache,\n );\n\n nodeMap.set(target.node, result);\n return result;\n}\n\n/**\n * Resolve a \"pointer\" `NodePath` to it's absolute path.\n */\nexport function resolve(\n this: NodePath,\n dangerous?: boolean,\n resolved?: NodePath[],\n) {\n return _resolve.call(this, dangerous, resolved) || this;\n}\n\nexport function _resolve(\n this: NodePath,\n dangerous?: boolean,\n resolved?: NodePath[],\n): NodePath | undefined | null {\n // detect infinite recursion\n // todo: possibly have a max length on this just to be safe\n if (resolved?.includes(this)) return;\n\n // we store all the paths we've \"resolved\" in this array to prevent infinite recursion\n resolved = resolved || [];\n resolved.push(this);\n\n if (this.isVariableDeclarator()) {\n if (this.get(\"id\").isIdentifier()) {\n return this.get(\"init\").resolve(dangerous, resolved);\n } else {\n // otherwise it's a request for a pattern and that's a bit more tricky\n }\n } else if (this.isReferencedIdentifier()) {\n const binding = this.scope.getBinding(this.node.name);\n if (!binding) return;\n\n // reassigned so we can't really resolve it\n if (!binding.constant) return;\n\n // todo - lookup module in dependency graph\n if (binding.kind === \"module\") return;\n\n if (binding.path !== this) {\n const ret = binding.path.resolve(dangerous, resolved);\n // If the identifier resolves to parent node then we can't really resolve it.\n if (this.find(parent => parent.node === ret.node)) return;\n return ret;\n }\n } else if (this.isTypeCastExpression()) {\n // @ ts-ignore todo: babel-types\n return this.get(\"expression\").resolve(dangerous, resolved);\n } else if (dangerous && this.isMemberExpression()) {\n // this is dangerous, as non-direct target assignments will mutate it's state\n // making this resolution inaccurate\n\n const targetKey = this.toComputedKey();\n if (!isLiteral(targetKey)) return;\n\n // @ts-expect-error todo(flow->ts): NullLiteral\n const targetName = targetKey.value;\n\n const target = this.get(\"object\").resolve(dangerous, resolved);\n\n if (target.isObjectExpression()) {\n const props = target.get(\"properties\");\n for (const prop of props as any[]) {\n if (!prop.isProperty()) continue;\n\n const key = prop.get(\"key\");\n\n // { foo: obj }\n let match =\n prop.isnt(\"computed\") && key.isIdentifier({ name: targetName });\n\n // { \"foo\": \"obj\" } or { [\"foo\"]: \"obj\" }\n match = match || key.isLiteral({ value: targetName });\n\n if (match) return prop.get(\"value\").resolve(dangerous, resolved);\n }\n } else if (target.isArrayExpression() && !isNaN(+targetName)) {\n const elems = target.get(\"elements\");\n const elem = elems[targetName];\n if (elem) return elem.resolve(dangerous, resolved);\n }\n }\n}\n\nexport function isConstantExpression(this: NodePath): boolean {\n if (this.isIdentifier()) {\n const binding = this.scope.getBinding(this.node.name);\n if (!binding) return false;\n return binding.constant;\n }\n\n if (this.isLiteral()) {\n if (this.isRegExpLiteral()) {\n return false;\n }\n\n if (this.isTemplateLiteral()) {\n return this.get(\"expressions\").every(expression =>\n expression.isConstantExpression(),\n );\n }\n\n return true;\n }\n\n if (this.isUnaryExpression()) {\n if (this.node.operator !== \"void\") {\n return false;\n }\n\n return this.get(\"argument\").isConstantExpression();\n }\n\n if (this.isBinaryExpression()) {\n const { operator } = this.node;\n return (\n operator !== \"in\" &&\n operator !== \"instanceof\" &&\n this.get(\"left\").isConstantExpression() &&\n this.get(\"right\").isConstantExpression()\n );\n }\n\n if (this.isMemberExpression()) {\n return (\n !this.node.computed &&\n this.get(\"object\").isIdentifier({ name: \"Symbol\" }) &&\n !this.scope.hasBinding(\"Symbol\", { noGlobals: true })\n );\n }\n\n if (this.isCallExpression()) {\n return (\n this.node.arguments.length === 1 &&\n this.get(\"callee\").matchesPattern(\"Symbol.for\") &&\n !this.scope.hasBinding(\"Symbol\", { noGlobals: true }) &&\n this.get(\"arguments\")[0].isStringLiteral()\n );\n }\n\n return false;\n}\n\nexport function isInStrictMode(this: NodePath) {\n const start = this.isProgram() ? this : this.parentPath;\n\n const strictParent = start.find(path => {\n if (path.isProgram({ sourceType: \"module\" })) return true;\n\n if (path.isClass()) return true;\n\n if (\n path.isArrowFunctionExpression() &&\n !path.get(\"body\").isBlockStatement()\n ) {\n return false;\n }\n\n let body: t.BlockStatement | t.Program;\n if (path.isFunction()) {\n body = path.node.body as t.BlockStatement;\n } else if (path.isProgram()) {\n // @ts-expect-error TODO: TS thinks that `path` here cannot be\n // Program due to the `isProgram()` check at the beginning of\n // the function\n body = path.node;\n } else {\n return false;\n }\n\n for (const directive of body.directives) {\n if (directive.value.value === \"use strict\") {\n return true;\n }\n }\n });\n\n return !!strictParent;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,EAAA,GAAAC,OAAA;AAUsB;EATpBC,uBAAuB;EACvBC,YAAY;EACZC,gBAAgB;EAChBC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,eAAe;EACfC,MAAM;EACNC,cAAc,EAAIC;AAAe,IAAAX,EAAA;AAW5B,SAASU,cAAcA,CAE5BE,OAAe,EACfC,YAAsB,EACb;EACT,OAAOF,eAAe,CAAC,IAAI,CAACG,IAAI,EAAEF,OAAO,EAAEC,YAAY,CAAC;AAC1D;AAOO,SAASE,GAAGA,CAEjBC,GAAY,EACH;EAAA,IAAAC,UAAA;EACT,MAAMC,GAAG,IAAAD,UAAA,GAAI,IAAI,CAACH,IAAI,qBAAVG,UAAA,CAAmBD,GAAG,CAAC;EACnC,IAAIE,GAAG,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;IAC7B,OAAO,CAAC,CAACA,GAAG,CAACG,MAAM;EACrB,CAAC,MAAM;IACL,OAAO,CAAC,CAACH,GAAG;EACd;AACF;AAMO,SAASI,QAAQA,CAAA,EAA0B;EAChD,OAAO,IAAI,CAACC,KAAK,CAACD,QAAQ,CAAC,IAAI,CAACR,IAAI,CAAC;AACvC;AAMO,MAAMU,EAAE,GAAAC,OAAA,CAAAD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AAO,KAAK;IACd;IAEA,IAAI4J,IAAkC;IACtC,IAAIzH,IAAI,CAACG,UAAU,CAAC,CAAC,EAAE;MACrBsH,IAAI,GAAGzH,IAAI,CAACzB,IAAI,CAACkJ,IAAwB;IAC3C,CAAC,MAAM,IAAIzH,IAAI,CAACI,SAAS,CAAC,CAAC,EAAE;MAI3BqH,IAAI,GAAGzH,IAAI,CAACzB,IAAI;IAClB,CAAC,MAAM;MACL,OAAO,KAAK;IACd;IAEA,KAAK,MAAMmJ,SAAS,IAAID,IAAI,CAACE,UAAU,EAAE;MACvC,IAAID,SAAS,CAACrI,KAAK,CAACA,KAAK,KAAK,YAAY,EAAE;QAC1C,OAAO,IAAI;MACb;IACF;EACF,CAAC,CAAC;EAEF,OAAO,CAAC,CAACiI,YAAY;AACvB","ignoreList":[]}1 {"version":3,"names":["_t","require","STATEMENT_OR_BLOCK_KEYS","VISITOR_KEYS","isBlockStatement","isExpression","isIdentifier","isLiteral","isStringLiteral","isType","matchesPattern","_matchesPattern","pattern","allowPartial","node","exports","has","key","_this$node","val","Array","isArray","length","isStatic","scope","is","isnt","equals","value","isNodeType","type","canHaveVariableDeclarationOrExpression","parentPath","isFor","canSwapBetweenExpressionAndStatement","replacement","isArrowFunctionExpression","isCompletionRecord","allowInsideFunction","path","first","container","isFunction","isProgram","isDoExpression","isStatementOrBlock","isLabeledStatement","includes","referencesImport","moduleSource","importName","isReferencedIdentifier","isJSXMemberExpression","property","name","isMemberExpression","isOptionalMemberExpression","computed","object","get","binding","getBinding","kind","parent","isImportDeclaration","source","isImportDefaultSpecifier","isImportNamespaceSpecifier","isImportSpecifier","imported","getSource","end","code","hub","getCode","slice","start","willIMaybeExecuteBefore","target","_guessExecutionStatusRelativeTo","getOuterFunction","getFunctionParent","getProgramParent","isExecutionUncertain","isExecutionUncertainInList","paths","maxIndex","i","parentKey","SYMBOL_CHECKING","Symbol","_guessExecutionStatusRelativeToCached","Map","base","cache","funcParent","this","_guessExecutionStatusRelativeToDifferentFunctionsCached","getAncestry","commonPath","commonIndex","indexOf","Error","divergence","listKey","keys","keyPosition","_guessExecutionStatusRelativeToDifferentFunctionsInternal","isFunctionDeclaration","isExportDeclaration","id","references","referencePaths","allStatus","childOfFunction","find","isCallExpression","status","nodeMap","cached","set","result","resolve","dangerous","resolved","_resolve","call","_resolved","push","isVariableDeclarator","constant","ret","isTypeCastExpression","targetKey","toComputedKey","targetName","isObjectExpression","props","prop","isProperty","match","isArrayExpression","isNaN","elems","elem","isConstantExpression","isRegExpLiteral","isTemplateLiteral","every","expression","isUnaryExpression","operator","isBinaryExpression","hasBinding","noGlobals","arguments","isInStrictMode","strictParent","sourceType","isClass","body","directive","directives"],"sources":["../../src/path/introspection.ts"],"sourcesContent":["// This file contains methods responsible for introspecting the current path for certain values.\n\nimport type NodePath from \"./index.ts\";\nimport {\n STATEMENT_OR_BLOCK_KEYS,\n VISITOR_KEYS,\n isBlockStatement,\n isExpression,\n isIdentifier,\n isLiteral,\n isStringLiteral,\n isType,\n matchesPattern as _matchesPattern,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Match the current node if it matches the provided `pattern`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\n\nexport function matchesPattern(\n this: NodePath,\n pattern: string,\n allowPartial?: boolean,\n): boolean {\n return _matchesPattern(this.node, pattern, allowPartial);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Check whether we have the input `key`. If the `key` references an array then we check\n * if the array has any items, otherwise we just check if it's falsy.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.has = function has<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n ): boolean {\n const val = (this.node as N)?.[key];\n if (val && Array.isArray(val)) {\n return !!val.length;\n } else {\n return !!val;\n }\n };\n}\n\nexport function isStatic(this: NodePath): boolean {\n return this.scope.isStatic(this.node);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Alias of `has`.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.is = exports.has;\n\n /**\n * Opposite of `has`.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.isnt = function isnt<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n ): boolean {\n // @ts-expect-error Babel 7\n return !this.has(key);\n };\n\n /**\n * Check whether the path node `key` strict equals `value`.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.equals = function equals<N extends t.Node>(\n this: NodePath<N>,\n key: keyof N,\n value: any,\n ): boolean {\n return (this.node as N)[key] === value;\n };\n}\n\n/**\n * Check the type against our stored internal type of the node. This is handy when a node has\n * been removed yet we still internally know the type and need it to calculate node replacement.\n */\n\nexport function isNodeType(this: NodePath, type: string): boolean {\n return isType(this.type, type);\n}\n\n/**\n * This checks whether or not we're in one of the following positions:\n *\n * for (KEY in right);\n * for (KEY;;);\n *\n * This is because these spots allow VariableDeclarations AND normal expressions so we need\n * to tell the path replacement that it's ok to replace this with an expression.\n */\n\nexport function canHaveVariableDeclarationOrExpression(this: NodePath) {\n return (\n (this.key === \"init\" || this.key === \"left\") && this.parentPath.isFor()\n );\n}\n\n/**\n * This checks whether we are swapping an arrow function's body between an\n * expression and a block statement (or vice versa).\n *\n * This is because arrow functions may implicitly return an expression, which\n * is the same as containing a block statement.\n */\n\nexport function canSwapBetweenExpressionAndStatement(\n this: NodePath,\n replacement: t.Node,\n): boolean {\n if (this.key !== \"body\" || !this.parentPath.isArrowFunctionExpression()) {\n return false;\n }\n\n if (this.isExpression()) {\n return isBlockStatement(replacement);\n } else if (this.isBlockStatement()) {\n return isExpression(replacement);\n }\n\n return false;\n}\n\n/**\n * Check whether the current path references a completion record\n */\n\nexport function isCompletionRecord(\n this: NodePath,\n allowInsideFunction?: boolean,\n): boolean {\n let path = this;\n let first = true;\n\n do {\n const { type, container } = path;\n\n // we're in a function so can't be a completion record\n if (!first && (path.isFunction() || type === \"StaticBlock\")) {\n return !!allowInsideFunction;\n }\n\n first = false;\n\n // check to see if we're the last item in the container and if we are\n // we're a completion record!\n if (Array.isArray(container) && path.key !== container.length - 1) {\n return false;\n }\n } while (\n (path = path.parentPath) &&\n !path.isProgram() &&\n !path.isDoExpression()\n );\n\n return true;\n}\n\n/**\n * Check whether or not the current `key` allows either a single statement or block statement\n * so we can explode it if necessary.\n */\n\nexport function isStatementOrBlock(this: NodePath): boolean {\n if (\n this.parentPath.isLabeledStatement() ||\n isBlockStatement(this.container as t.Node)\n ) {\n return false;\n } else {\n return STATEMENT_OR_BLOCK_KEYS.includes(this.key as string);\n }\n}\n\n/**\n * Check if the currently assigned path references the `importName` of `moduleSource`.\n */\n\nexport function referencesImport(\n this: NodePath,\n moduleSource: string,\n importName: string,\n): boolean {\n if (!this.isReferencedIdentifier()) {\n if (\n (this.isJSXMemberExpression() &&\n this.node.property.name === importName) ||\n ((this.isMemberExpression() || this.isOptionalMemberExpression()) &&\n (this.node.computed\n ? isStringLiteral(this.node.property, { value: importName })\n : (this.node.property as t.Identifier).name === importName))\n ) {\n const object = (\n this as NodePath<t.MemberExpression | t.OptionalMemberExpression>\n ).get(\"object\");\n return (\n object.isReferencedIdentifier() &&\n object.referencesImport(moduleSource, \"*\")\n );\n }\n\n return false;\n }\n\n const binding = this.scope.getBinding((this.node as t.Identifier).name);\n if (!binding || binding.kind !== \"module\") return false;\n\n const path = binding.path;\n const parent = path.parentPath;\n if (!parent.isImportDeclaration()) return false;\n\n // check moduleSource\n if (parent.node.source.value === moduleSource) {\n if (!importName) return true;\n } else {\n return false;\n }\n\n if (path.isImportDefaultSpecifier() && importName === \"default\") {\n return true;\n }\n\n if (path.isImportNamespaceSpecifier() && importName === \"*\") {\n return true;\n }\n\n if (\n path.isImportSpecifier() &&\n isIdentifier(path.node.imported, { name: importName })\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get the source code associated with this node.\n */\n\nexport function getSource(this: NodePath): string {\n const node = this.node;\n if (node.end) {\n const code = this.hub.getCode();\n if (code) return code.slice(node.start, node.end);\n }\n return \"\";\n}\n\nexport function willIMaybeExecuteBefore(\n this: NodePath,\n target: NodePath,\n): boolean {\n return this._guessExecutionStatusRelativeTo(target) !== \"after\";\n}\n\nfunction getOuterFunction(path: NodePath) {\n return path.isProgram()\n ? path\n : (\n path.parentPath.scope.getFunctionParent() ||\n path.parentPath.scope.getProgramParent()\n ).path;\n}\n\nfunction isExecutionUncertain(type: t.Node[\"type\"], key: string) {\n switch (type) {\n // a && FOO\n // a || FOO\n case \"LogicalExpression\":\n return key === \"right\";\n\n // a ? FOO : FOO\n // if (a) FOO; else FOO;\n case \"ConditionalExpression\":\n case \"IfStatement\":\n return key === \"consequent\" || key === \"alternate\";\n\n // while (a) FOO;\n case \"WhileStatement\":\n case \"DoWhileStatement\":\n case \"ForInStatement\":\n case \"ForOfStatement\":\n return key === \"body\";\n\n // for (a; b; FOO) FOO;\n case \"ForStatement\":\n return key === \"body\" || key === \"update\";\n\n // switch (a) { FOO }\n case \"SwitchStatement\":\n return key === \"cases\";\n\n // try { a } catch FOO finally { b }\n case \"TryStatement\":\n return key === \"handler\";\n\n // var [ x = FOO ]\n case \"AssignmentPattern\":\n return key === \"right\";\n\n // a?.[FOO]\n case \"OptionalMemberExpression\":\n return key === \"property\";\n\n // a?.(FOO)\n case \"OptionalCallExpression\":\n return key === \"arguments\";\n\n default:\n return false;\n }\n}\n\nfunction isExecutionUncertainInList(paths: NodePath[], maxIndex: number) {\n for (let i = 0; i < maxIndex; i++) {\n const path = paths[i];\n if (isExecutionUncertain(path.parent.type, path.parentKey)) {\n return true;\n }\n }\n return false;\n}\n\n// TODO(Babel 8)\n// This can be { before: boolean, after: boolean, unknown: boolean }.\n// This allows transforms like the tdz one to treat cases when the status\n// is both before and unknown/after like if it were before.\ntype RelativeExecutionStatus = \"before\" | \"after\" | \"unknown\";\n\n// Used to avoid infinite recursion in cases like\n// function f() { if (false) f(); }\n// f();\n// It also works with indirect recursion.\nconst SYMBOL_CHECKING = Symbol();\n\ntype ExecutionStatusCache = Map<\n t.Node,\n Map<t.Node, RelativeExecutionStatus | typeof SYMBOL_CHECKING>\n>;\n\n/**\n * Given a `target` check the execution status of it relative to the current path.\n *\n * \"Execution status\" simply refers to where or not we **think** this will execute\n * before or after the input `target` element.\n */\n\nexport function _guessExecutionStatusRelativeTo(\n this: NodePath,\n target: NodePath,\n): RelativeExecutionStatus {\n return _guessExecutionStatusRelativeToCached(this, target, new Map());\n}\n\nfunction _guessExecutionStatusRelativeToCached(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n // check if the two paths are in different functions, we can't track execution of these\n const funcParent = {\n this: getOuterFunction(base),\n target: getOuterFunction(target),\n };\n\n // here we check the `node` equality as sometimes we may have different paths for the\n // same node due to path thrashing\n if (funcParent.target.node !== funcParent.this.node) {\n return _guessExecutionStatusRelativeToDifferentFunctionsCached(\n base,\n funcParent.target,\n cache,\n );\n }\n\n const paths = {\n target: target.getAncestry(),\n this: base.getAncestry(),\n };\n\n // If this is an ancestor of the target path,\n // e.g. f(g); where this is f and target is g.\n if (paths.target.includes(base)) return \"after\";\n if (paths.this.includes(target)) return \"before\";\n\n // get ancestor where the branches intersect\n let commonPath;\n const commonIndex = { target: 0, this: 0 };\n\n while (!commonPath && commonIndex.this < paths.this.length) {\n const path = paths.this[commonIndex.this];\n commonIndex.target = paths.target.indexOf(path);\n if (commonIndex.target >= 0) {\n commonPath = path;\n } else {\n commonIndex.this++;\n }\n }\n\n if (!commonPath) {\n throw new Error(\n \"Internal Babel error - The two compared nodes\" +\n \" don't appear to belong to the same program.\",\n );\n }\n\n if (\n isExecutionUncertainInList(paths.this, commonIndex.this - 1) ||\n isExecutionUncertainInList(paths.target, commonIndex.target - 1)\n ) {\n return \"unknown\";\n }\n\n const divergence = {\n this: paths.this[commonIndex.this - 1],\n target: paths.target[commonIndex.target - 1],\n };\n\n // container list so let's see which one is after the other\n // e.g. [ THIS, TARGET ]\n if (\n divergence.target.listKey &&\n divergence.this.listKey &&\n divergence.target.container === divergence.this.container\n ) {\n return divergence.target.key > divergence.this.key ? \"before\" : \"after\";\n }\n\n // otherwise we're associated by a parent node, check which key comes before the other\n const keys = VISITOR_KEYS[commonPath.type];\n const keyPosition = {\n this: keys.indexOf(divergence.this.parentKey),\n target: keys.indexOf(divergence.target.parentKey),\n };\n return keyPosition.target > keyPosition.this ? \"before\" : \"after\";\n}\n\nfunction _guessExecutionStatusRelativeToDifferentFunctionsInternal(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n if (!target.isFunctionDeclaration()) {\n if (\n _guessExecutionStatusRelativeToCached(base, target, cache) === \"before\"\n ) {\n return \"before\";\n }\n return \"unknown\";\n } else if (target.parentPath.isExportDeclaration()) {\n return \"unknown\";\n }\n\n // so we're in a completely different function, if this is a function declaration\n // then we can be a bit smarter and handle cases where the function is either\n // a. not called at all (part of an export)\n // b. called directly\n const binding = target.scope.getBinding(target.node.id.name);\n\n // no references!\n if (!binding.references) return \"before\";\n\n const referencePaths: Array<NodePath> = binding.referencePaths;\n\n let allStatus;\n\n // verify that all the calls have the same execution status\n for (const path of referencePaths) {\n // if a reference is a child of the function we're checking against then we can\n // safely ignore it\n const childOfFunction = !!path.find(path => path.node === target.node);\n if (childOfFunction) continue;\n\n if (path.key !== \"callee\" || !path.parentPath.isCallExpression()) {\n // This function is passed as a reference, so we don't\n // know when it will be called.\n return \"unknown\";\n }\n\n const status = _guessExecutionStatusRelativeToCached(base, path, cache);\n\n if (allStatus && allStatus !== status) {\n return \"unknown\";\n } else {\n allStatus = status;\n }\n }\n\n return allStatus;\n}\n\nfunction _guessExecutionStatusRelativeToDifferentFunctionsCached(\n base: NodePath,\n target: NodePath,\n cache: ExecutionStatusCache,\n): RelativeExecutionStatus {\n let nodeMap = cache.get(base.node);\n let cached;\n\n if (!nodeMap) {\n cache.set(base.node, (nodeMap = new Map()));\n } else if ((cached = nodeMap.get(target.node))) {\n if (cached === SYMBOL_CHECKING) {\n return \"unknown\";\n }\n return cached;\n }\n\n nodeMap.set(target.node, SYMBOL_CHECKING);\n\n const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(\n base,\n target,\n cache,\n );\n\n nodeMap.set(target.node, result);\n return result;\n}\n\n/**\n * Resolve a \"pointer\" `NodePath` to it's absolute path.\n */\nexport function resolve(\n this: NodePath,\n dangerous?: boolean,\n resolved?: NodePath[],\n) {\n return _resolve.call(this, dangerous, resolved) || this;\n}\n\nexport function _resolve(\n this: NodePath,\n dangerous?: boolean,\n resolved?: NodePath[],\n): NodePath | undefined | null {\n // detect infinite recursion\n // todo: possibly have a max length on this just to be safe\n if (resolved?.includes(this)) return;\n\n // we store all the paths we've \"resolved\" in this array to prevent infinite recursion\n resolved = resolved || [];\n resolved.push(this);\n\n if (this.isVariableDeclarator()) {\n if (this.get(\"id\").isIdentifier()) {\n return this.get(\"init\").resolve(dangerous, resolved);\n } else {\n // otherwise it's a request for a pattern and that's a bit more tricky\n }\n } else if (this.isReferencedIdentifier()) {\n const binding = this.scope.getBinding(this.node.name);\n if (!binding) return;\n\n // reassigned so we can't really resolve it\n if (!binding.constant) return;\n\n // todo - lookup module in dependency graph\n if (binding.kind === \"module\") return;\n\n if (binding.path !== this) {\n const ret = binding.path.resolve(dangerous, resolved);\n // If the identifier resolves to parent node then we can't really resolve it.\n if (this.find(parent => parent.node === ret.node)) return;\n return ret;\n }\n } else if (this.isTypeCastExpression()) {\n // @ ts-ignore todo: babel-types\n return this.get(\"expression\").resolve(dangerous, resolved);\n } else if (dangerous && this.isMemberExpression()) {\n // this is dangerous, as non-direct target assignments will mutate it's state\n // making this resolution inaccurate\n\n const targetKey = this.toComputedKey();\n if (!isLiteral(targetKey)) return;\n\n // @ts-expect-error todo(flow->ts): NullLiteral\n const targetName = targetKey.value;\n\n const target = this.get(\"object\").resolve(dangerous, resolved);\n\n if (target.isObjectExpression()) {\n const props = target.get(\"properties\");\n for (const prop of props as any[]) {\n if (!prop.isProperty()) continue;\n\n const key = prop.get(\"key\");\n\n // { foo: obj }\n let match =\n prop.isnt(\"computed\") && key.isIdentifier({ name: targetName });\n\n // { \"foo\": \"obj\" } or { [\"foo\"]: \"obj\" }\n match = match || key.isLiteral({ value: targetName });\n\n if (match) return prop.get(\"value\").resolve(dangerous, resolved);\n }\n } else if (target.isArrayExpression() && !isNaN(+targetName)) {\n const elems = target.get(\"elements\");\n const elem = elems[targetName];\n if (elem) return elem.resolve(dangerous, resolved);\n }\n }\n}\n\nexport function isConstantExpression(this: NodePath): boolean {\n if (this.isIdentifier()) {\n const binding = this.scope.getBinding(this.node.name);\n if (!binding) return false;\n return binding.constant;\n }\n\n if (this.isLiteral()) {\n if (this.isRegExpLiteral()) {\n return false;\n }\n\n if (this.isTemplateLiteral()) {\n return this.get(\"expressions\").every(expression =>\n expression.isConstantExpression(),\n );\n }\n\n return true;\n }\n\n if (this.isUnaryExpression()) {\n if (this.node.operator !== \"void\") {\n return false;\n }\n\n return this.get(\"argument\").isConstantExpression();\n }\n\n if (this.isBinaryExpression()) {\n const { operator } = this.node;\n return (\n operator !== \"in\" &&\n operator !== \"instanceof\" &&\n this.get(\"left\").isConstantExpression() &&\n this.get(\"right\").isConstantExpression()\n );\n }\n\n if (this.isMemberExpression()) {\n return (\n !this.node.computed &&\n this.get(\"object\").isIdentifier({ name: \"Symbol\" }) &&\n !this.scope.hasBinding(\"Symbol\", { noGlobals: true })\n );\n }\n\n if (this.isCallExpression()) {\n return (\n this.node.arguments.length === 1 &&\n this.get(\"callee\").matchesPattern(\"Symbol.for\") &&\n !this.scope.hasBinding(\"Symbol\", { noGlobals: true }) &&\n this.get(\"arguments\")[0].isStringLiteral()\n );\n }\n\n return false;\n}\n\nexport function isInStrictMode(this: NodePath) {\n const start = this.isProgram() ? this : this.parentPath;\n\n const strictParent = start.find(path => {\n if (path.isProgram({ sourceType: \"module\" })) return true;\n\n if (path.isClass()) return true;\n\n if (\n path.isArrowFunctionExpression() &&\n !path.get(\"body\").isBlockStatement()\n ) {\n return false;\n }\n\n let body: t.BlockStatement | t.Program;\n if (path.isFunction()) {\n body = path.node.body as t.BlockStatement;\n } else if (path.isProgram()) {\n // @ts-expect-error TODO: TS thinks that `path` here cannot be\n // Program due to the `isProgram()` check at the beginning of\n // the function\n body = path.node;\n } else {\n return false;\n }\n\n for (const directive of body.directives) {\n if (directive.value.value === \"use strict\") {\n return true;\n }\n }\n });\n\n return !!strictParent;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,EAAA,GAAAC,OAAA;AAUsB;EATpBC,uBAAuB;EACvBC,YAAY;EACZC,gBAAgB;EAChBC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,eAAe;EACfC,MAAM;EACNC,cAAc,EAAIC;AAAe,IAAAX,EAAA;AAW5B,SAASU,cAAcA,CAE5BE,OAAe,EACfC,YAAsB,EACb;EACT,OAAOF,eAAe,CAAC,IAAI,CAACG,IAAI,EAAEF,OAAO,EAAEC,YAAY,CAAC;AAC1D;AAE+C;EAM7CE,OAAO,CAACC,GAAG,GAAG,SAASA,GAAGA,CAExBC,GAAY,EACH;IAAA,IAAAC,UAAA;IACT,MAAMC,GAAG,IAAAD,UAAA,GAAI,IAAI,CAACJ,IAAI,qBAAVI,UAAA,CAAmBD,GAAG,CAAC;IACnC,IAAIE,GAAG,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;MAC7B,OAAO,CAAC,CAACA,GAAG,CAACG,MAAM;IACrB,CAAC,MAAM;MACL,OAAO,CAAC,CAACH,GAAG;IACd;EACF,CAAC;AACH;AAEO,SAASI,QAAQA,CAAA,EAA0B;EAChD,OAAO,IAAI,CAACC,KAAK,CAACD,QAAQ,CAAC,IAAI,CAACT,IAAI,CAAC;AACvC;AAE+C;EAK7CC,OAAO,CAACU,EAAE,GAAGV,OAAO,CAACC,GAAG;EAMxBD,OAAO,CAACW,IAAI,GAAG,SAASA,IAAIA,CAE1BT,GAAY,EACH;IAET,OAAO,C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,IAAkC;IACtC,IAAIzH,IAAI,CAACG,UAAU,CAAC,CAAC,EAAE;MACrBsH,IAAI,GAAGzH,IAAI,CAACzB,IAAI,CAACkJ,IAAwB;IAC3C,CAAC,MAAM,IAAIzH,IAAI,CAACI,SAAS,CAAC,CAAC,EAAE;MAI3BqH,IAAI,GAAGzH,IAAI,CAACzB,IAAI;IAClB,CAAC,MAAM;MACL,OAAO,KAAK;IACd;IAEA,KAAK,MAAMmJ,SAAS,IAAID,IAAI,CAACE,UAAU,EAAE;MACvC,IAAID,SAAS,CAACrI,KAAK,CAACA,KAAK,KAAK,YAAY,EAAE;QAC1C,OAAO,IAAI;MACb;IACF;EACF,CAAC,CAAC;EAEF,OAAO,CAAC,CAACiI,YAAY;AACvB","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/lib/hoister.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_t","require","_t2","react","cloneNode","jsxExpressionContainer","variableDeclaration","variableDeclarator","referenceVisitor","ReferencedIdentifier","path","state","isJSXIdentifier","isCompatTag","node","name","parentPath","isJSXMemberExpression","scope","isFunction","isArrowFunctionExpression","parent","breakOnScopePaths","push","binding","getBinding","violation","constantViolations","mutableBinding","stop","bindings","PathHoister","constructor","scopes","attachAfter","isCompatibleScope","key","Object","keys","bindingIdentifierEquals","identifier","getCompatibleScopes","includes","getAttachmentPath","_getAttachmentPath","targetScope","isProgram","hasOwnBinding","kind","parentKey","bindingParentPath","getAttachmentParentForPath","violationPath","pop","hasOwnParamBindings","bodies","get","i","length","_blockHoist","getNextScopeAttachmentParent","Array","isArray","container","isStatement","constant","run","traverse","attachTo","getFunctionParent","uid","generateUidIdentifier","declarator","insertFn","attached","isVariableDeclarator","isJSXElement","children","replaceWith","exports","default"],"sources":["../../../src/path/lib/hoister.ts"],"sourcesContent":[" import { react } from \"@babel/types\";\nimport {\n cloneNode,\n jsxExpressionContainer,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../../scope/index.ts\";\nimport type NodePath from \"../index.ts\";\nimport type Binding from \"../../scope/binding.ts\";\nimport type { Visitor } from \"../../types.ts\";\n\nconst referenceVisitor: Visitor<PathHoister> = {\n // This visitor looks for bindings to establish a topmost scope for hoisting.\n ReferencedIdentifier(path, state) {\n // Don't hoist regular JSX identifiers ('div', 'span', etc).\n // We do have to consider member expressions for hoisting (e.g. `this.component`)\n if (\n path.isJSXIdentifier() &&\n react.isCompatTag(path.node.name) &&\n !path.parentPath.isJSXMemberExpression()\n ) {\n return;\n }\n\n // If the identifier refers to `this`, we need to break on the closest non-arrow scope.\n if (path.node.name === \"this\") {\n let scope = path.scope;\n do {\n if (\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n } while ((scope = scope.parent));\n if (scope) state.breakOnScopePaths.push(scope.path);\n }\n\n // direct references that we need to track to hoist this to the highest scope we can\n const binding = path.scope.getBinding(path.node.name);\n if (!binding) return;\n\n // we can handle reassignments only if they happen in the same scope as the declaration\n for (const violation of binding.constantViolations) {\n if (violation.scope !== binding.path.scope) {\n state.mutableBinding = true;\n path.stop();\n return;\n }\n }\n\n // this binding isn't accessible from the parent scope so we can safely ignore it\n // eg. it's in a closure etc\n if (binding !== state.scope.getBinding(path.node.name)) return;\n\n state.bindings[path.node.name] = binding;\n },\n};\n\nexport default class PathHoister<T extends t.Node = t.Node> {\n breakOnScopePaths: NodePath[];\n bindings: { [k: string]: Binding };\n mutableBinding: boolean;\n private scopes: Scope[];\n scope: Scope;\n private path: NodePath<T>;\n private attachAfter: boolean;\n\n constructor(path: NodePath<T>, scope: Scope) {\n // Storage for scopes we can't hoist above.\n this.breakOnScopePaths = [];\n // Storage for bindings that may affect what path we can hoist to.\n this.bindings = {};\n // \"true\" if the current path contains a reference to a binding whose\n // value can change and thus can't be safely hoisted.\n this.mutableBinding = false;\n // Storage for eligible scopes.\n this.scopes = [];\n // Our original scope and path.\n this.scope = scope;\n this.path = path;\n // By default, we attach as far up as we can; but if we're trying\n // to avoid referencing a binding, we may have to go after.\n this.attachAfter = false;\n }\n\n // A scope is compatible if all required bindings are reachable.\n isCompatibleScope(scope: Scope) {\n for (const key of Object.keys(this.bindings)) {\n const binding = this.bindings[key];\n if (!scope.bindingIdentifierEquals(key, binding.identifier)) {\n return false;\n }\n }\n\n return true;\n }\n\n // Look through all scopes and push compatible ones.\n getCompatibleScopes() {\n let scope = this.path.scope;\n do {\n if (this.isCompatibleScope(scope)) {\n this.scopes.push(scope);\n } else {\n break;\n }\n\n // deopt: These scopes are set in the visitor on const violations\n if (this.breakOnScopePaths.includes(scope.path)) {\n break;\n }\n } while ((scope = scope.parent));\n }\n\n getAttachmentPath() {\n let path = this._getAttachmentPath();\n if (!path) return;\n\n let targetScope = path.scope;\n\n // don't allow paths that have their own lexical environments to pollute\n if (targetScope.path === path) {\n targetScope = path.scope.parent;\n }\n\n // avoid hoisting to a scope that contains bindings that are executed after our attachment path\n if (targetScope.path.isProgram() || targetScope.path.isFunction()) {\n for (const name of Object.keys(this.bindings)) {\n // check binding is a direct child of this paths scope\n if (!targetScope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n\n // allow parameter references and expressions in params (like destructuring rest)\n if (binding.kind === \"param\" || binding.path.parentKey === \"params\") {\n continue;\n }\n\n // For each binding, get its attachment parent. This gives us an idea of where we might\n // introduce conflicts.\n const bindingParentPath = this.getAttachmentParentForPath(binding.path);\n\n // If the binding's attachment appears at or after our attachment point, then we move after it.\n if (bindingParentPath.key >= path.key) {\n this.attachAfter = true;\n path = binding.path;\n\n // We also move past any constant violations.\n for (const violationPath of binding.constantViolations) {\n if (this.getAttachmentParentForPath(violationPath).key > path.key) {\n path = violationPath;\n }\n }\n }\n }\n }\n\n return path;\n }\n\n _getAttachmentPath() {\n const scopes = this.scopes;\n\n const scope = scopes.pop();\n // deopt: no compatible scopes\n if (!scope) return;\n\n if (scope.path.isFunction()) {\n if (this.hasOwnParamBindings(scope)) {\n // deopt: should ignore this scope since it's ourselves\n if (this.scope === scope) return;\n\n // needs to be attached to the body\n const bodies = scope.path.get(\"body\").get(\"body\") as NodePath[];\n for (let i = 0; i < bodies.length; i++) {\n // Don't attach to something that's going to get hoisted,\n // like a default parameter\n // @ts-expect-error todo(flow->ts): avoid mutating the node, introducing new fields\n if (bodies[i].node._blockHoist) continue;\n return bodies[i];\n }\n // deopt: If here, no attachment path found\n } else {\n // doesn't need to be be attached to this scope\n return this.getNextScopeAttachmentParent();\n }\n } else if (scope.path.isProgram()) {\n return this.getNextScopeAttachmentParent();\n }\n }\n\n getNextScopeAttachmentParent() {\n const scope = this.scopes.pop();\n if (scope) return this.getAttachmentParentForPath(scope.path);\n }\n\n // Find an attachment for this path.\n getAttachmentParentForPath(path: NodePath) {\n do {\n if (\n // Beginning of the scope\n !path.parentPath ||\n // Has siblings and is a statement\n (Array.isArray(path.container) && path.isStatement())\n ) {\n return path;\n }\n } while ((path = path.parentPath));\n }\n\n // Returns true if a scope has param bindings.\n hasOwnParamBindings(scope: Scope) {\n for (const name of Object.keys(this.bindings)) {\n if (!scope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n // Ensure constant; without it we could place behind a reassignment\n if (binding.kind === \"param\" && binding.constant) return true;\n }\n return false;\n }\n\n run(): NodePath<t.Expression> | undefined {\n this.path.traverse(referenceVisitor, this);\n\n if (this.mutableBinding) return;\n\n this.getCompatibleScopes();\n\n const attachTo = this.getAttachmentPath();\n if (!attachTo) return;\n\n // don't bother hoisting to the same function as this will cause multiple branches to be\n // evaluated more than once leading to a bad optimisation\n if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;\n\n // generate declaration and insert it to our point\n let uid: t.Identifier | t.JSXExpressionContainer =\n attachTo.scope.generateUidIdentifier(\"ref\");\n\n // @ts-expect-error todo(flow->ts): more specific type for this.path\n const declarator = variableDeclarator(uid, this.path.node);\n\n const insertFn = this.attachAfter ? \"insertAfter\" : \"insertBefore\";\n const [attached] = attachTo[insertFn]([\n attachTo.isVariableDeclarator()\n ? declarator\n : variableDeclaration(\"var\", [declarator]),\n ]);\n\n const parent = this.path.parentPath;\n if (parent.isJSXElement() && this.path.container === parent.node.children) {\n // turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with\n // an expression container\n uid = jsxExpressionContainer(uid);\n }\n\n this.path.replaceWith(cloneNode(uid));\n\n // @ts-expect-error TS cannot refine the type of `attached`\n // TODO: Should we use `attached.isVariableDeclaration()`?\n return attachTo.isVariableDeclarator()\n ? attached.get(\"init\")\n : attached.get(\"declarations.0.init\");\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAAqC,IAAAC,GAAA,GAAAF,EAAA;AAAA;EAA5BG;AAAK,IAAAH,EAAA;AAAA;EAEZI,SAAS;EACTC,sBAAsB;EACtBC,mBAAmB;EACnBC;AAAkB,IAAAL,GAAA;AAQpB,MAAMM,gBAAsC,GAAG;EAE7CC,oBAAoBA,CAACC,IAAI,EAAEC,KAAK,EAAE;IAGhC,IACED,IAAI,CAACE,eAAe,CAAC,CAAC,IACtBT,KAAK,CAACU,WAAW,CAACH,IAAI,CAACI,IAAI,CAACC,IAAI,CAAC,IACjC,CAACL,IAAI,CAACM,UAAU,CAACC,qBAAqB,CAAC,CAAC,EACxC;MACA;IACF;IAGA,IAAIP,IAAI,CAACI,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;MAC7B,IAAIG,KAAK,GAAGR,IAAI,CAACQ,KAAK;MACtB,GAAG;QACD,IACEA,KAAK,CAACR,IAAI,CAACS,UAAU,CAAC,CAAC,IACvB,CAACD,KAAK,CAACR,IAAI,CAACU,yBAAyB,CAAC,CAAC,EACvC;UACA;QACF;MACF,CAAC,QAASF,KAAK,GAAGA,KAAK,CAACG,MAAM;MAC9B,IAAIH,KAAK,EAAEP,KAAK,CAACW,iBAAiB,CAACC,IAAI,CAACL,KAAK,CAACR,IAAI,CAAC;IACrD;IAGA,MAAMc,OAAO,GAAGd,IA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Q,EAAE;IAIf,IAAIA,QAAQ,CAACC,iBAAiB,CAAC,CAAC,KAAK,IAAI,CAAC3D,IAAI,CAAC2D,iBAAiB,CAAC,CAAC,EAAE;IAGpE,IAAIC,GAA4C,GAC9CF,QAAQ,CAAClD,KAAK,CAACqD,qBAAqB,CAAC,KAAK,CAAC;IAG7C,MAAMC,UAAU,GAAGjE,kBAAkB,CAAC+D,GAAG,EAAE,IAAI,CAAC5D,IAAI,CAACI,IAAI,CAAC;IAE1D,MAAM2D,QAAQ,GAAG,IAAI,CAACvC,WAAW,GAAG,aAAa,GAAG,cAAc;IAClE,MAAM,CAACwC,QAAQ,CAAC,GAAGN,QAAQ,CAACK,QAAQ,CAAC,CAAC,CACpCL,QAAQ,CAACO,oBAAoB,CAAC,CAAC,GAC3BH,UAAU,GACVlE,mBAAmB,CAAC,KAAK,EAAE,CAACkE,UAAU,CAAC,CAAC,CAC7C,CAAC;IAEF,MAAMnD,MAAM,GAAG,IAAI,CAACX,IAAI,CAACM,UAAU;IACnC,IAAIK,MAAM,CAACuD,YAAY,CAAC,CAAC,IAAI,IAAI,CAAClE,IAAI,CAACqD,SAAS,KAAK1C,MAAM,CAACP,IAAI,CAAC+D,QAAQ,EAAE;MAGzEP,GAAG,GAAGjE,sBAAsB,CAACiE,GAAG,CAAC;IACnC;IAEA,IAAI,CAAC5D,IAAI,CAACoE,WAAW,CAAC1E,SAAS,CAACkE,GAAG,CAAC,CAAC;IAIrC,OAAOF,QAAQ,CAACO,oBAAoB,CAAC,CAAC,GAClCD,QAAQ,CAAClB,GAAG,CAAC,MAAM,CAAC,GACpBkB,QAAQ,CAAClB,GAAG,CAAC,qBAAqB,CAAC;EACzC;AACF;AAACuB,OAAA,CAAAC,OAAA,GAAAjD,WAAA","ignoreList":[]}1 {"version":3,"names":["_t","require","_t2","react","cloneNode","jsxExpressionContainer","variableDeclaration","variableDeclarator","referenceVisitor","ReferencedIdentifier","path","state","isJSXIdentifier","isCompatTag","node","name","parentPath","isJSXMemberExpression","scope","isFunction","isArrowFunctionExpression","parent","breakOnScopePaths","push","binding","getBinding","violation","constantViolations","mutableBinding","stop","bindings","PathHoister","constructor","scopes","attachAfter","isCompatibleScope","key","Object","keys","bindingIdentifierEquals","identifier","getCompatibleScopes","includes","getAttachmentPath","_getAttachmentPath","targetScope","isProgram","hasOwnBinding","kind","parentKey","bindingParentPath","getAttachmentParentForPath","violationPath","pop","hasOwnParamBindings","bodies","get","i","length","_blockHoist","getNextScopeAttachmentParent","Array","isArray","container","isStatement","constant","run","traverse","attachTo","getFunctionParent","uid","generateUidIdentifier","declarator","insertFn","attached","isVariableDeclarator","isJSXElement","children","replaceWith","exports","default"],"sources":["../../../src/path/lib/hoister.ts"],"sourcesContent":["// Remove this file in Babel 8\n\nimport { react } from \"@babel/types\";\nimport {\n cloneNode,\n jsxExpressionContainer,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../../scope/index.ts\";\nimport type NodePath from \"../index.ts\";\nimport type Binding from \"../../scope/binding.ts\";\nimport type { Visitor } from \"../../types.ts\";\n\nconst referenceVisitor: Visitor<PathHoister> = {\n // This visitor looks for bindings to establish a topmost scope for hoisting.\n ReferencedIdentifier(path, state) {\n // Don't hoist regular JSX identifiers ('div', 'span', etc).\n // We do have to consider member expressions for hoisting (e.g. `this.component`)\n if (\n path.isJSXIdentifier() &&\n react.isCompatTag(path.node.name) &&\n !path.parentPath.isJSXMemberExpression()\n ) {\n return;\n }\n\n // If the identifier refers to `this`, we need to break on the closest non-arrow scope.\n if (path.node.name === \"this\") {\n let scope = path.scope;\n do {\n if (\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n } while ((scope = scope.parent));\n if (scope) state.breakOnScopePaths.push(scope.path);\n }\n\n // direct references that we need to track to hoist this to the highest scope we can\n const binding = path.scope.getBinding(path.node.name);\n if (!binding) return;\n\n // we can handle reassignments only if they happen in the same scope as the declaration\n for (const violation of binding.constantViolations) {\n if (violation.scope !== binding.path.scope) {\n state.mutableBinding = true;\n path.stop();\n return;\n }\n }\n\n // this binding isn't accessible from the parent scope so we can safely ignore it\n // eg. it's in a closure etc\n if (binding !== state.scope.getBinding(path.node.name)) return;\n\n state.bindings[path.node.name] = binding;\n },\n};\n\nexport default class PathHoister<T extends t.Node = t.Node> {\n breakOnScopePaths: NodePath[];\n bindings: { [k: string]: Binding };\n mutableBinding: boolean;\n private scopes: Scope[];\n scope: Scope;\n private path: NodePath<T>;\n private attachAfter: boolean;\n\n constructor(path: NodePath<T>, scope: Scope) {\n // Storage for scopes we can't hoist above.\n this.breakOnScopePaths = [];\n // Storage for bindings that may affect what path we can hoist to.\n this.bindings = {};\n // \"true\" if the current path contains a reference to a binding whose\n // value can change and thus can't be safely hoisted.\n this.mutableBinding = false;\n // Storage for eligible scopes.\n this.scopes = [];\n // Our original scope and path.\n this.scope = scope;\n this.path = path;\n // By default, we attach as far up as we can; but if we're trying\n // to avoid referencing a binding, we may have to go after.\n this.attachAfter = false;\n }\n\n // A scope is compatible if all required bindings are reachable.\n isCompatibleScope(scope: Scope) {\n for (const key of Object.keys(this.bindings)) {\n const binding = this.bindings[key];\n if (!scope.bindingIdentifierEquals(key, binding.identifier)) {\n return false;\n }\n }\n\n return true;\n }\n\n // Look through all scopes and push compatible ones.\n getCompatibleScopes() {\n let scope = this.path.scope;\n do {\n if (this.isCompatibleScope(scope)) {\n this.scopes.push(scope);\n } else {\n break;\n }\n\n // deopt: These scopes are set in the visitor on const violations\n if (this.breakOnScopePaths.includes(scope.path)) {\n break;\n }\n } while ((scope = scope.parent));\n }\n\n getAttachmentPath() {\n let path = this._getAttachmentPath();\n if (!path) return;\n\n let targetScope = path.scope;\n\n // don't allow paths that have their own lexical environments to pollute\n if (targetScope.path === path) {\n targetScope = path.scope.parent;\n }\n\n // avoid hoisting to a scope that contains bindings that are executed after our attachment path\n if (targetScope.path.isProgram() || targetScope.path.isFunction()) {\n for (const name of Object.keys(this.bindings)) {\n // check binding is a direct child of this paths scope\n if (!targetScope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n\n // allow parameter references and expressions in params (like destructuring rest)\n if (binding.kind === \"param\" || binding.path.parentKey === \"params\") {\n continue;\n }\n\n // For each binding, get its attachment parent. This gives us an idea of where we might\n // introduce conflicts.\n const bindingParentPath = this.getAttachmentParentForPath(binding.path);\n\n // If the binding's attachment appears at or after our attachment point, then we move after it.\n if (bindingParentPath.key >= path.key) {\n this.attachAfter = true;\n path = binding.path;\n\n // We also move past any constant violations.\n for (const violationPath of binding.constantViolations) {\n if (this.getAttachmentParentForPath(violationPath).key > path.key) {\n path = violationPath;\n }\n }\n }\n }\n }\n\n return path;\n }\n\n _getAttachmentPath() {\n const scopes = this.scopes;\n\n const scope = scopes.pop();\n // deopt: no compatible scopes\n if (!scope) return;\n\n if (scope.path.isFunction()) {\n if (this.hasOwnParamBindings(scope)) {\n // deopt: should ignore this scope since it's ourselves\n if (this.scope === scope) return;\n\n // needs to be attached to the body\n const bodies = scope.path.get(\"body\").get(\"body\") as NodePath[];\n for (let i = 0; i < bodies.length; i++) {\n // Don't attach to something that's going to get hoisted,\n // like a default parameter\n // @ts-expect-error todo(flow->ts): avoid mutating the node, introducing new fields\n if (bodies[i].node._blockHoist) continue;\n return bodies[i];\n }\n // deopt: If here, no attachment path found\n } else {\n // doesn't need to be be attached to this scope\n return this.getNextScopeAttachmentParent();\n }\n } else if (scope.path.isProgram()) {\n return this.getNextScopeAttachmentParent();\n }\n }\n\n getNextScopeAttachmentParent() {\n const scope = this.scopes.pop();\n if (scope) return this.getAttachmentParentForPath(scope.path);\n }\n\n // Find an attachment for this path.\n getAttachmentParentForPath(path: NodePath) {\n do {\n if (\n // Beginning of the scope\n !path.parentPath ||\n // Has siblings and is a statement\n (Array.isArray(path.container) && path.isStatement())\n ) {\n return path;\n }\n } while ((path = path.parentPath));\n }\n\n // Returns true if a scope has param bindings.\n hasOwnParamBindings(scope: Scope) {\n for (const name of Object.keys(this.bindings)) {\n if (!scope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n // Ensure constant; without it we could place behind a reassignment\n if (binding.kind === \"param\" && binding.constant) return true;\n }\n return false;\n }\n\n run(): NodePath<t.Expression> | undefined {\n this.path.traverse(referenceVisitor, this);\n\n if (this.mutableBinding) return;\n\n this.getCompatibleScopes();\n\n const attachTo = this.getAttachmentPath();\n if (!attachTo) return;\n\n // don't bother hoisting to the same function as this will cause multiple branches to be\n // evaluated more than once leading to a bad optimisation\n if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;\n\n // generate declaration and insert it to our point\n let uid: t.Identifier | t.JSXExpressionContainer =\n attachTo.scope.generateUidIdentifier(\"ref\");\n\n // @ts-expect-error todo(flow->ts): more specific type for this.path\n const declarator = variableDeclarator(uid, this.path.node);\n\n const insertFn = this.attachAfter ? \"insertAfter\" : \"insertBefore\";\n const [attached] = attachTo[insertFn]([\n attachTo.isVariableDeclarator()\n ? declarator\n : variableDeclaration(\"var\", [declarator]),\n ]);\n\n const parent = this.path.parentPath;\n if (parent.isJSXElement() && this.path.container === parent.node.children) {\n // turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with\n // an expression container\n uid = jsxExpressionContainer(uid);\n }\n\n this.path.replaceWith(cloneNode(uid));\n\n // @ts-expect-error TS cannot refine the type of `attached`\n // TODO: Should we use `attached.isVariableDeclaration()`?\n return attachTo.isVariableDeclarator()\n ? attached.get(\"init\")\n : attached.get(\"declarations.0.init\");\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAAqC,IAAAC,GAAA,GAAAF,EAAA;AAAA;EAA5BG;AAAK,IAAAH,EAAA;AAAA;EAEZI,SAAS;EACTC,sBAAsB;EACtBC,mBAAmB;EACnBC;AAAkB,IAAAL,GAAA;AAQpB,MAAMM,gBAAsC,GAAG;EAE7CC,oBAAoBA,CAACC,IAAI,EAAEC,KAAK,EAAE;IAGhC,IACED,IAAI,CA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,YAAY,CAAC,CAAC,IAAI,IAAI,CAAClE,IAAI,CAACqD,SAAS,KAAK1C,MAAM,CAACP,IAAI,CAAC+D,QAAQ,EAAE;MAGzEP,GAAG,GAAGjE,sBAAsB,CAACiE,GAAG,CAAC;IACnC;IAEA,IAAI,CAAC5D,IAAI,CAACoE,WAAW,CAAC1E,SAAS,CAACkE,GAAG,CAAC,CAAC;IAIrC,OAAOF,QAAQ,CAACO,oBAAoB,CAAC,CAAC,GAClCD,QAAQ,CAAClB,GAAG,CAAC,MAAM,CAAC,GACpBkB,QAAQ,CAAClB,GAAG,CAAC,qBAAqB,CAAC;EACzC;AACF;AAACuB,OAAA,CAAAC,OAAA,GAAAjD,WAAA","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/modification.js
rd565449 r0c6b92a 8 8 exports._containerInsertBefore = _containerInsertBefore; 9 9 exports._verifyNodeList = _verifyNodeList; 10 exports.hoist = hoist;11 10 exports.insertAfter = insertAfter; 12 11 exports.insertBefore = insertBefore; … … 61 60 } 62 61 function _containerInsert(from, nodes) { 63 this.updateSiblingKeys(from, nodes.length);62 updateSiblingKeys.call(this, from, nodes.length); 64 63 const paths = []; 65 64 this.container.splice(from, 0, ...nodes); … … 70 69 paths.push(path); 71 70 if ((_this$context = this.context) != null && _this$context.queue) { 72 path.pushContext(this.context);71 _context.pushContext.call(path, this.context); 73 72 } 74 73 } 75 74 const contexts = _context._getQueueContexts.call(this); 76 75 for (const path of paths) { 77 path.setScope();76 _context.setScope.call(path); 78 77 path.debug("Inserted."); 79 78 for (const context of contexts) { … … 165 164 const paths = (0, _cache.getCachedPaths)(this.hub, this.parent) || []; 166 165 for (const [, path] of paths) { 167 if (typeof path.key === "number" && path. key >= fromIndex) {166 if (typeof path.key === "number" && path.container === this.container && path.key >= fromIndex) { 168 167 path.key += incrementBy; 169 168 } … … 221 220 return path.replaceWithMultiple(verifiedNodes); 222 221 } 223 function hoist(scope = this.scope) { 224 const hoister = new _hoister.default(this, scope); 225 return hoister.run(); 222 { 223 exports.hoist = function hoist(scope = this.scope) { 224 const hoister = new _hoister.default(this, scope); 225 return hoister.run(); 226 }; 226 227 } 227 228 -
imaps-frontend/node_modules/@babel/traverse/lib/path/modification.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_cache","require","_hoister","_index","_context","_removal","_t","arrowFunctionExpression","assertExpression","assignmentExpression","blockStatement","callExpression","cloneNode","expressionStatement","isAssignmentExpression","isCallExpression","isExportNamedDeclaration","isExpression","isIdentifier","isSequenceExpression","isSuper","thisExpression","insertBefore","nodes_","_assertUnremoved","call","nodes","_verifyNodeList","parentPath","parent","isExpressionStatement","isLabeledStatement","isExportDefaultDeclaration","isDeclaration","isNodeType","isJSXElement","isForStatement","key","node","push","replaceExpressionWithStatements","Array","isArray","container","_containerInsertBefore","isStatementOrBlock","shouldInsertCurrentNode","expression","replaceWith","unshiftContainer","Error","_containerInsert","from","updateSiblingKeys","length","paths","splice","i","_this$context","to","path","getSibling","context","queue","pushContext","contexts","_getQueueContexts","setScope","debug","maybeQueue","_containerInsertAfter","last","arr","isHiddenInSequenceExpression","expressions","isAlmostConstantAssignment","scope","left","blockScope","getBlockParent","hasOwnBinding","name","getOwnBinding","constantViolations","insertAfter","get","map","self","isPattern","unshift","callee","isPure","isMethod","computed","temp","generateDeclaredUidIdentifier","pushContainer","fromIndex","incrementBy","getCachedPaths","hub","msg","type","NodePath","listKey","setContext","verifiedNodes","replaceWithMultiple"," hoist","hoister","PathHoister","run"],"sources":["../../src/path/modification.ts"],"sourcesContent":["// This file contains methods that modify the path/node in some ways.\n\nimport { getCachedPaths } from \"../cache.ts\";\nimport PathHoister from \"./lib/hoister.ts\";\nimport NodePath from \"./index.ts\";\nimport { _getQueueContexts } from \"./context.ts\";\nimport { _assertUnremoved } from \"./removal.ts\";\nimport {\n arrowFunctionExpression,\n assertExpression,\n assignmentExpression,\n blockStatement,\n callExpression,\n cloneNode,\n expressionStatement,\n isAssignmentExpression,\n isCallExpression,\n isExportNamedDeclaration,\n isExpression,\n isIdentifier,\n isSequenceExpression,\n isSuper,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../scope/index.ts\";\n\n/**\n * Insert the provided nodes before the current one.\n */\n\nexport function insertBefore(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // https://github.com/babel/babel/issues/15293\n // When Babel transforms `export class String { field }`, the class properties plugin will inject the defineProperty\n // helper, which depends on the builtins e.g. String, Number, Symbol, etc. To prevent them from being shadowed by local\n // exports, the helper injector replaces the named export into `class _String { field }; export { _String as String }`,\n // with `parentPath` here changed to the moved ClassDeclaration, causing rare inconsistency between `parent` and `parentPath`.\n // Here we retrieve the parent type from the `parent` property. This is a temporary fix and we should revisit when\n // helpers should get injected.\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertBefore(nodes);\n } else if (\n (this.isNodeType(\"Expression\") && !this.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n if (this.node) nodes.push(this.node);\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertBefore.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n return (this as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n nodes,\n );\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\nexport function _containerInsert<N extends t.Node>(\n this: NodePath,\n from: number,\n nodes: N[],\n): NodePath<N>[] {\n this.updateSiblingKeys(from, nodes.length);\n\n const paths: NodePath<N>[] = [];\n\n // @ts-expect-error todo(flow->ts): this.container could be a NodePath\n this.container.splice(from, 0, ...nodes);\n for (let i = 0; i < nodes.length; i++) {\n const to = from + i;\n const path = this.getSibling(to) as NodePath<N>;\n paths.push(path);\n\n if (this.context?.queue) {\n path.pushContext(this.context);\n }\n }\n\n const contexts = _getQueueContexts.call(this);\n\n for (const path of paths) {\n path.setScope();\n path.debug(\"Inserted.\");\n\n for (const context of contexts) {\n context.maybeQueue(path, true);\n }\n }\n\n return paths;\n}\n\nexport function _containerInsertBefore<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, this.key as number, nodes);\n}\n\nexport function _containerInsertAfter<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, (this.key as number) + 1, nodes);\n}\n\nconst last = <T>(arr: T[]) => arr[arr.length - 1];\n\nfunction isHiddenInSequenceExpression(path: NodePath): boolean {\n return (\n isSequenceExpression(path.parent) &&\n (last(path.parent.expressions) !== path.node ||\n isHiddenInSequenceExpression(path.parentPath))\n );\n}\n\nfunction isAlmostConstantAssignment(\n node: t.Node,\n scope: Scope,\n): node is t.AssignmentExpression & { left: t.Identifier } {\n if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {\n return false;\n }\n\n // Not every scope can contain variables. For example, we might be in\n // a ClassScope either in the ClassHeritage or in a computed key.\n const blockScope = scope.getBlockParent();\n\n // If the variable is defined in the current scope and only assigned here,\n // we can be sure that its value won't change.\n return (\n blockScope.hasOwnBinding(node.left.name) &&\n blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1\n );\n}\n\n/**\n * Insert the provided nodes after the current one. When inserting nodes after an\n * expression, ensure that the completion record is correct by pushing the current node.\n */\n\nexport function insertAfter(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n if (this.isSequenceExpression()) {\n return last(this.get(\"expressions\")).insertAfter(nodes_);\n }\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // see insertBefore\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertAfter(\n nodes.map(node => {\n // Usually after an expression we can safely insert another expression:\n // A.insertAfter(B)\n // foo = A; -> foo = (A, B);\n // If A is an expression statement, it isn't safe anymore so we need to\n // convert B to an expression statement\n // A; -> A; B // No semicolon! It could break if followed by [!\n return isExpression(node) ? expressionStatement(node) : node;\n }),\n );\n } else if (\n (this.isNodeType(\"Expression\") &&\n !this.isJSXElement() &&\n !parentPath.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n const self = this as NodePath<t.Expression | t.VariableDeclaration>;\n if (self.node) {\n const node = self.node;\n let { scope } = this;\n\n if (scope.path.isPattern()) {\n assertExpression(node);\n\n self.replaceWith(callExpression(arrowFunctionExpression([], node), []));\n (self.get(\"callee.body\") as NodePath<t.Expression>).insertAfter(nodes);\n return [self];\n }\n\n if (isHiddenInSequenceExpression(self)) {\n nodes.unshift(node);\n }\n // We need to preserve the value of this expression.\n else if (isCallExpression(node) && isSuper(node.callee)) {\n nodes.unshift(node);\n // `super(...)` always evaluates to `this`.\n nodes.push(thisExpression());\n } else if (isAlmostConstantAssignment(node, scope)) {\n nodes.unshift(node);\n nodes.push(cloneNode(node.left));\n } else if (scope.isPure(node, true)) {\n // Insert the nodes before rather than after; it's not observable.\n nodes.push(node);\n } else {\n // Inserting after the computed key of a method should insert the\n // temporary binding in the method's parent's scope.\n if (parentPath.isMethod({ computed: true, key: node })) {\n scope = scope.parent;\n }\n const temp = scope.generateDeclaredUidIdentifier();\n nodes.unshift(\n expressionStatement(\n // @ts-expect-error todo(flow->ts): This can be a variable\n // declaration in the \"init\" of a for statement, but that's\n // invalid here.\n assignmentExpression(\"=\", cloneNode(temp), node),\n ),\n );\n nodes.push(expressionStatement(cloneNode(temp)));\n }\n }\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertAfter.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n return this.pushContainer(\"body\", nodes);\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\n/**\n * Update all sibling node paths after `fromIndex` by `incrementBy`.\n */\n\nexport function updateSiblingKeys(\n this: NodePath,\n fromIndex: number,\n incrementBy: number,\n) {\n if (!this.parent) return;\n\n const paths = getCachedPaths(this.hub, this.parent) || ([] as never[]);\n\n for (const [, path] of paths) {\n if (typeof path.key === \"number\" && path.key >= fromIndex) {\n path.key += incrementBy;\n }\n }\n}\n\nexport function _verifyNodeList<N extends t.Node>(\n this: NodePath,\n nodes: N | N[],\n): N[] {\n if (!nodes) {\n return [];\n }\n\n if (!Array.isArray(nodes)) {\n nodes = [nodes];\n }\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n let msg;\n\n if (!node) {\n msg = \"has falsy node\";\n } else if (typeof node !== \"object\") {\n msg = \"contains a non-object node\";\n } else if (!node.type) {\n msg = \"without a type\";\n } else if (node instanceof NodePath) {\n msg = \"has a NodePath when it expected a raw object\";\n }\n\n if (msg) {\n const type = Array.isArray(node) ? \"array\" : typeof node;\n throw new Error(\n `Node list ${msg} with the index of ${i} and type of ${type}`,\n );\n }\n }\n\n return nodes;\n}\n\nexport function unshiftContainer<N extends t.Node, K extends keyof N & string>(\n this: NodePath<N>,\n listKey: K,\n nodes: N[K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n // todo: NodePaths<Nodes>\n _assertUnremoved.call(this);\n\n // @ts-expect-error fixme\n nodes = _verifyNodeList.call(this, nodes);\n\n // get the first path and insert our nodes before it, if it doesn't exist then it\n // doesn't matter, our nodes will be inserted anyway\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: (this.node as N)[listKey] as unknown as t.Node | t.Node[],\n listKey,\n key: 0,\n }).setContext(this.context);\n\n return _containerInsertBefore.call(\n path,\n // @ts-expect-error typings needed to narrow down nodes as t.Node[]\n nodes,\n );\n}\n\nexport function pushContainer<\n P extends NodePath,\n K extends string & keyof P[\"node\"],\n>(\n this: P,\n listKey: K,\n nodes: P[\"node\"][K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(\n this,\n // @ts-expect-error refine typings\n nodes,\n );\n\n // get an invisible path that represents the last node + 1 and replace it with our\n // nodes, effectively inlining it\n\n const container = (this.node as P[\"node\"])[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: container as unknown as t.Node | t.Node[],\n listKey,\n key: container.length,\n }).setContext(this.context);\n\n return path.replaceWithMultiple(verifiedNodes);\n}\n\n/**\n * Hoist the current node to the highest scope possible and return a UID\n * referencing it.\n */\nexport function hoist<T extends t.Node>(\n this: NodePath<T>,\n scope: Scope = this.scope,\n) {\n const hoister = new PathHoister<T>(this, scope);\n return hoister.run();\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAA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index","_context","_removal","_t","arrowFunctionExpression","assertExpression","assignmentExpression","blockStatement","callExpression","cloneNode","expressionStatement","isAssignmentExpression","isCallExpression","isExportNamedDeclaration","isExpression","isIdentifier","isSequenceExpression","isSuper","thisExpression","insertBefore","nodes_","_assertUnremoved","call","nodes","_verifyNodeList","parentPath","parent","isExpressionStatement","isLabeledStatement","isExportDefaultDeclaration","isDeclaration","isNodeType","isJSXElement","isForStatement","key","node","push","replaceExpressionWithStatements","Array","isArray","container","_containerInsertBefore","isStatementOrBlock","shouldInsertCurrentNode","expression","replaceWith","unshiftContainer","Error","_containerInsert","from","updateSiblingKeys","length","paths","splice","i","_this$context","to","path","getSibling","context","queue","pushContext","contexts","_getQueueContexts","setScope","debug","maybeQueue","_containerInsertAfter","last","arr","isHiddenInSequenceExpression","expressions","isAlmostConstantAssignment","scope","left","blockScope","getBlockParent","hasOwnBinding","name","getOwnBinding","constantViolations","insertAfter","get","map","self","isPattern","unshift","callee","isPure","isMethod","computed","temp","generateDeclaredUidIdentifier","pushContainer","fromIndex","incrementBy","getCachedPaths","hub","msg","type","NodePath","listKey","setContext","verifiedNodes","replaceWithMultiple","exports","hoist","hoister","PathHoister","run"],"sources":["../../src/path/modification.ts"],"sourcesContent":["// This file contains methods that modify the path/node in some ways.\n\nimport { getCachedPaths } from \"../cache.ts\";\nimport PathHoister from \"./lib/hoister.ts\";\nimport NodePath from \"./index.ts\";\nimport { _getQueueContexts, pushContext, setScope } from \"./context.ts\";\nimport { _assertUnremoved } from \"./removal.ts\";\nimport {\n arrowFunctionExpression,\n assertExpression,\n assignmentExpression,\n blockStatement,\n callExpression,\n cloneNode,\n expressionStatement,\n isAssignmentExpression,\n isCallExpression,\n isExportNamedDeclaration,\n isExpression,\n isIdentifier,\n isSequenceExpression,\n isSuper,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../scope/index.ts\";\n\n/**\n * Insert the provided nodes before the current one.\n */\n\nexport function insertBefore(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // https://github.com/babel/babel/issues/15293\n // When Babel transforms `export class String { field }`, the class properties plugin will inject the defineProperty\n // helper, which depends on the builtins e.g. String, Number, Symbol, etc. To prevent them from being shadowed by local\n // exports, the helper injector replaces the named export into `class _String { field }; export { _String as String }`,\n // with `parentPath` here changed to the moved ClassDeclaration, causing rare inconsistency between `parent` and `parentPath`.\n // Here we retrieve the parent type from the `parent` property. This is a temporary fix and we should revisit when\n // helpers should get injected.\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertBefore(nodes);\n } else if (\n (this.isNodeType(\"Expression\") && !this.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n if (this.node) nodes.push(this.node);\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertBefore.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n return (this as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n nodes,\n );\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\nexport function _containerInsert<N extends t.Node>(\n this: NodePath,\n from: number,\n nodes: N[],\n): NodePath<N>[] {\n updateSiblingKeys.call(this, from, nodes.length);\n\n const paths: NodePath<N>[] = [];\n\n // @ts-expect-error todo(flow->ts): this.container could be a NodePath\n this.container.splice(from, 0, ...nodes);\n for (let i = 0; i < nodes.length; i++) {\n const to = from + i;\n const path = this.getSibling(to) as NodePath<N>;\n paths.push(path);\n\n if (this.context?.queue) {\n pushContext.call(path, this.context);\n }\n }\n\n const contexts = _getQueueContexts.call(this);\n\n for (const path of paths) {\n setScope.call(path);\n path.debug(\"Inserted.\");\n\n for (const context of contexts) {\n context.maybeQueue(path, true);\n }\n }\n\n return paths;\n}\n\nexport function _containerInsertBefore<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, this.key as number, nodes);\n}\n\nexport function _containerInsertAfter<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, (this.key as number) + 1, nodes);\n}\n\nconst last = <T>(arr: T[]) => arr[arr.length - 1];\n\nfunction isHiddenInSequenceExpression(path: NodePath): boolean {\n return (\n isSequenceExpression(path.parent) &&\n (last(path.parent.expressions) !== path.node ||\n isHiddenInSequenceExpression(path.parentPath))\n );\n}\n\nfunction isAlmostConstantAssignment(\n node: t.Node,\n scope: Scope,\n): node is t.AssignmentExpression & { left: t.Identifier } {\n if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {\n return false;\n }\n\n // Not every scope can contain variables. For example, we might be in\n // a ClassScope either in the ClassHeritage or in a computed key.\n const blockScope = scope.getBlockParent();\n\n // If the variable is defined in the current scope and only assigned here,\n // we can be sure that its value won't change.\n return (\n blockScope.hasOwnBinding(node.left.name) &&\n blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1\n );\n}\n\n/**\n * Insert the provided nodes after the current one. When inserting nodes after an\n * expression, ensure that the completion record is correct by pushing the current node.\n */\n\nexport function insertAfter(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n if (this.isSequenceExpression()) {\n return last(this.get(\"expressions\")).insertAfter(nodes_);\n }\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // see insertBefore\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertAfter(\n nodes.map(node => {\n // Usually after an expression we can safely insert another expression:\n // A.insertAfter(B)\n // foo = A; -> foo = (A, B);\n // If A is an expression statement, it isn't safe anymore so we need to\n // convert B to an expression statement\n // A; -> A; B // No semicolon! It could break if followed by [!\n return isExpression(node) ? expressionStatement(node) : node;\n }),\n );\n } else if (\n (this.isNodeType(\"Expression\") &&\n !this.isJSXElement() &&\n !parentPath.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n const self = this as NodePath<t.Expression | t.VariableDeclaration>;\n if (self.node) {\n const node = self.node;\n let { scope } = this;\n\n if (scope.path.isPattern()) {\n assertExpression(node);\n\n self.replaceWith(callExpression(arrowFunctionExpression([], node), []));\n (self.get(\"callee.body\") as NodePath<t.Expression>).insertAfter(nodes);\n return [self];\n }\n\n if (isHiddenInSequenceExpression(self)) {\n nodes.unshift(node);\n }\n // We need to preserve the value of this expression.\n else if (isCallExpression(node) && isSuper(node.callee)) {\n nodes.unshift(node);\n // `super(...)` always evaluates to `this`.\n nodes.push(thisExpression());\n } else if (isAlmostConstantAssignment(node, scope)) {\n nodes.unshift(node);\n nodes.push(cloneNode(node.left));\n } else if (scope.isPure(node, true)) {\n // Insert the nodes before rather than after; it's not observable.\n nodes.push(node);\n } else {\n // Inserting after the computed key of a method should insert the\n // temporary binding in the method's parent's scope.\n if (parentPath.isMethod({ computed: true, key: node })) {\n scope = scope.parent;\n }\n const temp = scope.generateDeclaredUidIdentifier();\n nodes.unshift(\n expressionStatement(\n // @ts-expect-error todo(flow->ts): This can be a variable\n // declaration in the \"init\" of a for statement, but that's\n // invalid here.\n assignmentExpression(\"=\", cloneNode(temp), node),\n ),\n );\n nodes.push(expressionStatement(cloneNode(temp)));\n }\n }\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertAfter.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n return this.pushContainer(\"body\", nodes);\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\n/**\n * Update all sibling node paths after `fromIndex` by `incrementBy`.\n */\n\nexport function updateSiblingKeys(\n this: NodePath,\n fromIndex: number,\n incrementBy: number,\n) {\n if (!this.parent) return;\n\n const paths = getCachedPaths(this.hub, this.parent) || ([] as never[]);\n\n for (const [, path] of paths) {\n if (\n typeof path.key === \"number\" &&\n path.container === this.container &&\n path.key >= fromIndex\n ) {\n path.key += incrementBy;\n }\n }\n}\n\nexport function _verifyNodeList<N extends t.Node>(\n this: NodePath,\n nodes: N | N[],\n): N[] {\n if (!nodes) {\n return [];\n }\n\n if (!Array.isArray(nodes)) {\n nodes = [nodes];\n }\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n let msg;\n\n if (!node) {\n msg = \"has falsy node\";\n } else if (typeof node !== \"object\") {\n msg = \"contains a non-object node\";\n } else if (!node.type) {\n msg = \"without a type\";\n } else if (node instanceof NodePath) {\n msg = \"has a NodePath when it expected a raw object\";\n }\n\n if (msg) {\n const type = Array.isArray(node) ? \"array\" : typeof node;\n throw new Error(\n `Node list ${msg} with the index of ${i} and type of ${type}`,\n );\n }\n }\n\n return nodes;\n}\n\nexport function unshiftContainer<N extends t.Node, K extends keyof N & string>(\n this: NodePath<N>,\n listKey: K,\n nodes: N[K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n // todo: NodePaths<Nodes>\n _assertUnremoved.call(this);\n\n // @ts-expect-error fixme\n nodes = _verifyNodeList.call(this, nodes);\n\n // get the first path and insert our nodes before it, if it doesn't exist then it\n // doesn't matter, our nodes will be inserted anyway\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: (this.node as N)[listKey] as unknown as t.Node | t.Node[],\n listKey,\n key: 0,\n }).setContext(this.context);\n\n return _containerInsertBefore.call(\n path,\n // @ts-expect-error typings needed to narrow down nodes as t.Node[]\n nodes,\n );\n}\n\nexport function pushContainer<\n P extends NodePath,\n K extends string & keyof P[\"node\"],\n>(\n this: P,\n listKey: K,\n nodes: P[\"node\"][K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(\n this,\n // @ts-expect-error refine typings\n nodes,\n );\n\n // get an invisible path that represents the last node + 1 and replace it with our\n // nodes, effectively inlining it\n\n const container = (this.node as P[\"node\"])[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: container as unknown as t.Node | t.Node[],\n listKey,\n key: container.length,\n }).setContext(this.context);\n\n return path.replaceWithMultiple(verifiedNodes);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Hoist the current node to the highest scope possible and return a UID\n * referencing it.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.hoist = function hoist<T extends t.Node>(\n this: NodePath<T>,\n scope: Scope = this.scope,\n ) {\n const hoister = new PathHoister<T>(this, scope);\n return hoister.run();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAA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C,CAAC;EACtB,CAAC;AACH","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/removal.js
rd565449 r0c6b92a 15 15 var _index = require("./index.js"); 16 16 var _t = require("@babel/types"); 17 var _modification = require("./modification.js"); 18 var _context = require("./context.js"); 17 19 const { 18 20 getBindingIdentifiers … … 21 23 var _this$opts; 22 24 _assertUnremoved.call(this); 23 this.resync();25 _context.resync.call(this); 24 26 if (_callRemovalHooks.call(this)) { 25 27 _markRemoved.call(this); … … 47 49 if (Array.isArray(this.container)) { 48 50 this.container.splice(this.key, 1); 49 this.updateSiblingKeys(this.key, -1);51 _modification.updateSiblingKeys.call(this, this.key, -1); 50 52 } else { 51 53 _replacement._replaceWith.call(this, null); -
imaps-frontend/node_modules/@babel/traverse/lib/path/removal.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_removalHooks","require","_cache","_replacement","_index","_t"," getBindingIdentifiers","remove","_this$opts","_assertUnremoved","call","resync","_callRemovalHooks","_markRemoved","opts","noScope","_removeFromScope","shareCommentsWithSiblings","_remove","bindings","node","Object","keys","forEach","name","scope","removeBinding","parentPath","fn","hooks","Array","isArray","container","splice","key","updateSiblingKeys","_replaceWith","_traverseFlags","SHOULD_SKIP","REMOVED","parent","getCachedPaths","hub","delete","removed","buildCodeFrameError"],"sources":["../../src/path/removal.ts"],"sourcesContent":["// This file contains methods responsible for removing a node.\n\nimport { hooks } from \"./lib/removal-hooks.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _replaceWith } from \"./replacement.ts\";\nimport type NodePath from \"./index.ts\";\nimport { REMOVED, SHOULD_SKIP } from \"./index.ts\";\nimport { getBindingIdentifiers } from \"@babel/types\";\n\nexport function remove(this: NodePath) {\n _assertUnremoved.call(this);\n\n this.resync();\n\n if (_callRemovalHooks.call(this)) {\n _markRemoved.call(this);\n return;\n }\n\n if (!this.opts?.noScope) {\n _removeFromScope.call(this);\n }\n\n this.shareCommentsWithSiblings();\n _remove.call(this);\n _markRemoved.call(this);\n}\n\nexport function _removeFromScope(this: NodePath) {\n const bindings = getBindingIdentifiers(this.node, false, false, true);\n Object.keys(bindings).forEach(name => this.scope.removeBinding(name));\n}\n\nexport function _callRemovalHooks(this: NodePath) {\n if (this.parentPath) {\n for (const fn of hooks) {\n if (fn(this, this.parentPath)) return true;\n }\n }\n}\n\nexport function _remove(this: NodePath) {\n if (Array.isArray(this.container)) {\n this.container.splice(this.key as number, 1);\n this.updateSiblingKeys(this.key as number, -1);\n } else {\n _replaceWith.call(this, null);\n }\n}\n\nexport function _markRemoved(this: NodePath) {\n // this.shouldSkip = true; this.removed = true;\n this._traverseFlags |= SHOULD_SKIP | REMOVED;\n if (this.parent) {\n getCachedPaths(this.hub, this.parent).delete(this.node);\n }\n this.node = null;\n}\n\nexport function _assertUnremoved(this: NodePath) {\n if (this.removed) {\n throw this.buildCodeFrameError(\n \"NodePath has been removed so is read-only.\",\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AAAqD;EAA5CK;AAAqB,IAAAD,EAAA;AAEvB,SAASE,MAAMA,CAAA,EAAiB;EAAA,IAAAC,UAAA;EACrCC,gBAAgB,CAACC,IAAI,CAAC,IAAI,CAAC;EAE3B,IAAI,CAACC,MAAM,CAAC,CAAC;EAEb,IAAIC,iBAAiB,CAACF,IAAI,CAAC,IAAI,CAAC,EAAE;IAChCG,YAAY,CAACH,IAAI,CAAC,IAAI,CAAC;IACvB;EACF;EAEA,IAAI,GAAAF,UAAA,GAAC,IAAI,CAACM,IAAI,aAATN,UAAA,CAAWO,OAAO,GAAE;IACvBC,gBAAgB,CAACN,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,IAAI,CAACO,yBAAyB,CAAC,CAAC;EAChCC,OAAO,CAACR,I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AI,IAAI,CAACmC,OAAO,EAAE;IAChB,MAAM,IAAI,CAACC,mBAAmB,CAC5B,4CACF,CAAC;EACH;AACF","ignoreList":[]}1 {"version":3,"names":["_removalHooks","require","_cache","_replacement","_index","_t","_modification","_context","getBindingIdentifiers","remove","_this$opts","_assertUnremoved","call","resync","_callRemovalHooks","_markRemoved","opts","noScope","_removeFromScope","shareCommentsWithSiblings","_remove","bindings","node","Object","keys","forEach","name","scope","removeBinding","parentPath","fn","hooks","Array","isArray","container","splice","key","updateSiblingKeys","_replaceWith","_traverseFlags","SHOULD_SKIP","REMOVED","parent","getCachedPaths","hub","delete","removed","buildCodeFrameError"],"sources":["../../src/path/removal.ts"],"sourcesContent":["// This file contains methods responsible for removing a node.\n\nimport { hooks } from \"./lib/removal-hooks.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _replaceWith } from \"./replacement.ts\";\nimport type NodePath from \"./index.ts\";\nimport { REMOVED, SHOULD_SKIP } from \"./index.ts\";\nimport { getBindingIdentifiers } from \"@babel/types\";\nimport { updateSiblingKeys } from \"./modification.ts\";\nimport { resync } from \"./context.ts\";\n\nexport function remove(this: NodePath) {\n _assertUnremoved.call(this);\n\n resync.call(this);\n\n if (_callRemovalHooks.call(this)) {\n _markRemoved.call(this);\n return;\n }\n\n if (!this.opts?.noScope) {\n _removeFromScope.call(this);\n }\n\n this.shareCommentsWithSiblings();\n _remove.call(this);\n _markRemoved.call(this);\n}\n\nexport function _removeFromScope(this: NodePath) {\n const bindings = getBindingIdentifiers(this.node, false, false, true);\n Object.keys(bindings).forEach(name => this.scope.removeBinding(name));\n}\n\nexport function _callRemovalHooks(this: NodePath) {\n if (this.parentPath) {\n for (const fn of hooks) {\n if (fn(this, this.parentPath)) return true;\n }\n }\n}\n\nexport function _remove(this: NodePath) {\n if (Array.isArray(this.container)) {\n this.container.splice(this.key as number, 1);\n updateSiblingKeys.call(this, this.key as number, -1);\n } else {\n _replaceWith.call(this, null);\n }\n}\n\nexport function _markRemoved(this: NodePath) {\n // this.shouldSkip = true; this.removed = true;\n this._traverseFlags |= SHOULD_SKIP | REMOVED;\n if (this.parent) {\n getCachedPaths(this.hub, this.parent).delete(this.node);\n }\n this.node = null;\n}\n\nexport function _assertUnremoved(this: NodePath) {\n if (this.removed) {\n throw this.buildCodeFrameError(\n \"NodePath has been removed so is read-only.\",\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAsC;EAF7BO;AAAqB,IAAAH,EAAA;AAIvB,SAASI,MAAMA,CAAA,EAAiB;EAAA,IAAAC,UAAA;EACrCC,gBAAgB,CAACC,IAAI,CAAC,IAAI,CAAC;EAE3BC,eAAM,CAACD,IAAI,CAAC,IAAI,CAAC;EAEjB,IAAIE,iBAAiB,CAACF,IAAI,CAAC,IAAI,CAAC,EAAE;IAChCG,YAAY,CAACH,IAAI,CAAC,IAAI,CAAC;IACvB;EACF;EAEA,IAAI,GAAAF,UAAA,GAAC,IAAI,CAACM,IAAI,aAATN,UAAA,CAAWO,OAAO,GAAE;IACvBC,gBAAgB,CAACN,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,IAAI,CAACO,yBAAyB,CAAC,CAAC;EAChCC,OAAO,CAACR,IAAI,CAAC,IAAI,CAAC;EAClBG,YAAY,CAACH,IAAI,CAAC,IAAI,CAAC;AACzB;AAEO,SAASM,gBAAgBA,CAAA,EAAiB;EAC/C,MAAMG,QAAQ,GAAGb,qBAAqB,CAAC,IAAI,CAACc,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;EACrEC,MAAM,CAACC,IAAI,CAACH,QAAQ,CAAC,CAACI,OAAO,CAACC,IAAI,IAAI,IAAI,CAACC,KAAK,CAACC,aAAa,CAACF,IAAI,CAAC,CAAC;AACvE;AAEO,SAASZ,iBAAiBA,CAAA,EAAiB;EAChD,IAAI,IAAI,CAACe,UAAU,EAAE;IACnB,KAAK,MAAMC,EAAE,IAAIC,mBAAK,EAAE;MACtB,IAAID,EAAE,CAAC,IAAI,EAAE,IAAI,CAACD,UAAU,CAAC,EAAE,OAAO,IAAI;IAC5C;EACF;AACF;AAEO,SAAST,OAAOA,CAAA,EAAiB;EACtC,IAAIY,KAAK,CAACC,OAAO,CAAC,IAAI,CAACC,SAAS,CAAC,EAAE;IACjC,IAAI,CAACA,SAAS,CAACC,MAAM,CAAC,IAAI,CAACC,GAAG,EAAY,CAAC,CAAC;IAC5CC,+BAAiB,CAACzB,IAAI,CAAC,IAAI,EAAE,IAAI,CAACwB,GAAG,EAAY,CAAC,CAAC,CAAC;EACtD,CAAC,MAAM;IACLE,yBAAY,CAAC1B,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;EAC/B;AACF;AAEO,SAASG,YAAYA,CAAA,EAAiB;EAE3C,IAAI,CAACwB,cAAc,IAAIC,kBAAW,GAAGC,cAAO;EAC5C,IAAI,IAAI,CAACC,MAAM,EAAE;IACf,IAAAC,qBAAc,EAAC,IAAI,CAACC,GAAG,EAAE,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,CAAC,IAAI,CAACvB,IAAI,CAAC;EACzD;EACA,IAAI,CAACA,IAAI,GAAG,IAAI;AAClB;AAEO,SAASX,gBAAgBA,CAAA,EAAiB;EAC/C,IAAI,IAAI,CAACmC,OAAO,EAAE;IAChB,MAAM,IAAI,CAACC,mBAAmB,CAC5B,4CACF,CAAC;EACH;AACF","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/path/replacement.js
rd565449 r0c6b92a 17 17 var _parser = require("@babel/parser"); 18 18 var _t = require("@babel/types"); 19 var _context = require("./context.js"); 19 20 const { 20 21 FUNCTION_TYPES, … … 49 50 function replaceWithMultiple(nodes) { 50 51 var _getCachedPaths; 51 this.resync();52 _context.resync.call(this); 52 53 nodes = _modification._verifyNodeList.call(this, nodes); 53 54 inheritLeadingComments(nodes[0], this.node); … … 64 65 } 65 66 function replaceWithSourceString(replacement) { 66 this.resync();67 _context.resync.call(this); 67 68 let ast; 68 69 try { … … 87 88 } 88 89 function replaceWith(replacementPath) { 89 this.resync();90 _context.resync.call(this); 90 91 if (this.removed) { 91 92 throw new Error("You can't replace this node, we've already removed it"); … … 126 127 _replaceWith.call(this, replacement); 127 128 this.type = replacement.type; 128 this.setScope();129 _context.setScope.call(this); 129 130 this.requeue(); 130 131 return [nodePath ? this.get(nodePath) : this]; … … 145 146 } 146 147 function replaceExpressionWithStatements(nodes) { 147 this.resync();148 _context.resync.call(this); 148 149 const declars = []; 149 150 const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars); … … 155 156 } 156 157 const functionParent = this.getFunctionParent(); 157 const isParentAsync = functionParent == null ? void 0 : functionParent. is("async");158 const isParentGenerator = functionParent == null ? void 0 : functionParent. is("generator");158 const isParentAsync = functionParent == null ? void 0 : functionParent.node.async; 159 const isParentGenerator = functionParent == null ? void 0 : functionParent.node.generator; 159 160 const container = arrowFunctionExpression([], blockStatement(nodes)); 160 161 this.replaceWith(callExpression(container, [])); … … 245 246 } 246 247 function replaceInline(nodes) { 247 this.resync();248 _context.resync.call(this); 248 249 if (Array.isArray(nodes)) { 249 250 if (Array.isArray(this.container)) { -
imaps-frontend/node_modules/@babel/traverse/lib/path/replacement.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["_codeFrame","require","_index","_index2","_cache","_modification","_parser","_t"," FUNCTION_TYPES","arrowFunctionExpression","assignmentExpression","awaitExpression","blockStatement","buildUndefinedNode","callExpression","cloneNode","conditionalExpression","expressionStatement","getBindingIdentifiers","identifier","inheritLeadingComments","inheritTrailingComments","inheritsComments","isBlockStatement","isEmptyStatement","isExpression","isExpressionStatement","isIfStatement","isProgram","isStatement","isVariableDeclaration","removeComments","returnStatement","sequenceExpression","validate","yieldExpression","replaceWithMultiple","nodes","_getCachedPaths","resync","_verifyNodeList","call","node","length","getCachedPaths","hub","parent","delete","container","key","paths","insertAfter","requeue","remove","replaceWithSourceString","replacement","ast","parse","err","loc","message","codeFrameColumns","start","line","column","code","expressionAST","program","body","expression","traverse","removeProperties","replaceWith","replacementPath","removed","Error","NodePath","Array","isArray","nodePath","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","parentPath","isExportDefaultDeclaration","replaceExpressionWithStatements","oldNode","_replaceWith","type","setScope","get","_getCachedPaths2","ReferenceError","inList","debug","set","declars","nodesAsSingleExpression","gatherSequenceExpressions","id","scope","push","functionParent","getFunctionParent","isParentAsync","is","isParentGenerator","callee","hoistVariables","completionRecords","getCompletionRecords","path","loop","findParent","isLoop","uid","getData","generateDeclaredUidIdentifier","pushContainer","setData","name","arrowFunctionToExpression","newCallee","needToAwaitFunction","hasType","needToYieldFunction","exprs","ensureLastUndefined","kind","declar","declarations","bindings","Object","keys","init","consequent","alternate","test","indexOf","replaceInline","_containerInsertAfter"],"sources":["../../src/path/replacement.ts"],"sourcesContent":["// This file contains methods responsible for replacing a node with another.\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"../index.ts\";\nimport NodePath from \"./index.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _verifyNodeList, _containerInsertAfter } from \"./modification.ts\";\nimport { parse } from \"@babel/parser\";\nimport {\n FUNCTION_TYPES,\n arrowFunctionExpression,\n assignmentExpression,\n awaitExpression,\n blockStatement,\n buildUndefinedNode,\n callExpression,\n cloneNode,\n conditionalExpression,\n expressionStatement,\n getBindingIdentifiers,\n identifier,\n inheritLeadingComments,\n inheritTrailingComments,\n inheritsComments,\n isBlockStatement,\n isEmptyStatement,\n isExpression,\n isExpressionStatement,\n isIfStatement,\n isProgram,\n isStatement,\n isVariableDeclaration,\n removeComments,\n returnStatement,\n sequenceExpression,\n validate,\n yieldExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Replace a node with an array of multiple. This method performs the following steps:\n *\n * - Inherit the comments of first provided node with that of the current node.\n * - Insert the provided nodes after the current node.\n * - Remove the current node.\n */\n\nexport function replaceWithMultiple(\n this: NodePath,\n nodes: t.Node | t.Node[],\n): NodePath[] {\n this.resync();\n\n nodes = _verifyNodeList.call(this, nodes);\n inheritLeadingComments(nodes[0], this.node);\n inheritTrailingComments(nodes[nodes.length - 1], this.node);\n getCachedPaths(this.hub, this.parent)?.delete(this.node);\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = null;\n const paths = this.insertAfter(nodes);\n\n if (this.node) {\n this.requeue();\n } else {\n this.remove();\n }\n return paths;\n}\n\n/**\n * Parse a string as an expression and replace the current node with the result.\n *\n * NOTE: This is typically not a good idea to use. Building source strings when\n * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's\n * easier to use, your transforms will be extremely brittle.\n */\n\nexport function replaceWithSourceString(this: NodePath, replacement: string) {\n this.resync();\n let ast: t.File;\n\n try {\n replacement = `(${replacement})`;\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = parse(replacement);\n } catch (err) {\n const loc = err.loc;\n if (loc) {\n err.message +=\n \" - make sure this is an expression.\\n\" +\n codeFrameColumns(replacement, {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n });\n err.code = \"BABEL_REPLACE_SOURCE_ERROR\";\n }\n throw err;\n }\n\n const expressionAST = (ast.program.body[0] as t.ExpressionStatement)\n .expression;\n traverse.removeProperties(expressionAST);\n return this.replaceWith(expressionAST);\n}\n\n/**\n * Replace the current node with another.\n */\nexport function replaceWith<R extends t.Node>(\n this: NodePath,\n replacementPath: R,\n): [NodePath<R>];\nexport function replaceWith<R extends NodePath>(\n this: NodePath,\n replacementPath: R,\n): [R];\nexport function replaceWith(\n this: NodePath,\n replacementPath: t.Node | NodePath,\n): [NodePath] {\n this.resync();\n\n if (this.removed) {\n throw new Error(\"You can't replace this node, we've already removed it\");\n }\n\n let replacement: t.Node =\n replacementPath instanceof NodePath\n ? replacementPath.node\n : replacementPath;\n\n if (!replacement) {\n throw new Error(\n \"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\",\n );\n }\n\n if (this.node === replacement) {\n return [this];\n }\n\n if (this.isProgram() && !isProgram(replacement)) {\n throw new Error(\n \"You can only replace a Program root node with another Program node\",\n );\n }\n\n if (Array.isArray(replacement)) {\n throw new Error(\n \"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\",\n );\n }\n\n if (typeof replacement === \"string\") {\n throw new Error(\n \"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\",\n );\n }\n\n let nodePath = \"\";\n\n if (this.isNodeType(\"Statement\") && isExpression(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement) &&\n !this.parentPath.isExportDefaultDeclaration()\n ) {\n // replacing a statement with an expression so wrap it in an expression statement\n replacement = expressionStatement(replacement);\n nodePath = \"expression\";\n }\n }\n\n if (this.isNodeType(\"Expression\") && isStatement(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement)\n ) {\n // replacing an expression with a statement so let's explode it\n return this.replaceExpressionWithStatements([replacement]) as [NodePath];\n }\n }\n\n const oldNode = this.node;\n if (oldNode) {\n inheritsComments(replacement, oldNode);\n removeComments(oldNode);\n }\n\n // replace the node\n _replaceWith.call(this, replacement);\n this.type = replacement.type;\n\n // potentially create new scope\n this.setScope();\n\n // requeue for visiting\n this.requeue();\n\n return [nodePath ? this.get(nodePath) : this];\n}\n\nexport function _replaceWith(this: NodePath, node: t.Node) {\n if (!this.container) {\n throw new ReferenceError(\"Container is falsy\");\n }\n\n if (this.inList) {\n // @ts-expect-error todo(flow->ts): check if validate accepts a numeric key\n validate(this.parent, this.key, [node]);\n } else {\n validate(this.parent, this.key as string, node);\n }\n\n this.debug(`Replace with ${node?.type}`);\n getCachedPaths(this.hub, this.parent)?.set(node, this).delete(this.node);\n\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = node;\n}\n\n/**\n * This method takes an array of statements nodes and then explodes it\n * into expressions. This method retains completion records which is\n * extremely important to retain original semantics.\n */\n\nexport function replaceExpressionWithStatements(\n this: NodePath,\n nodes: Array<t.Statement>,\n) {\n this.resync();\n\n const declars: t.Identifier[] = [];\n const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars);\n if (nodesAsSingleExpression) {\n for (const id of declars) this.scope.push({ id });\n return this.replaceWith(nodesAsSingleExpression)[0].get(\"expressions\");\n }\n\n const functionParent = this.getFunctionParent();\n const isParentAsync = functionParent?.is(\"async\");\n const isParentGenerator = functionParent?.is(\"generator\");\n\n const container = arrowFunctionExpression([], blockStatement(nodes));\n\n this.replaceWith(callExpression(container, []));\n // replaceWith changes the type of \"this\", but it isn't trackable by TS\n type ThisType = NodePath<\n t.CallExpression & {\n callee: t.ArrowFunctionExpression & { body: t.BlockStatement };\n }\n >;\n\n // hoist variable declaration in do block\n // `(do { var x = 1; x;})` -> `var x; (() => { x = 1; return x; })()`\n const callee = (this as ThisType).get(\"callee\");\n callee.get(\"body\").scope.hoistVariables(id => this.scope.push({ id }));\n\n // add implicit returns to all ending expression statements\n const completionRecords: Array<NodePath> = callee.getCompletionRecords();\n for (const path of completionRecords) {\n if (!path.isExpressionStatement()) continue;\n\n const loop = path.findParent(path => path.isLoop());\n if (loop) {\n let uid = loop.getData(\"expressionReplacementReturnUid\");\n\n if (!uid) {\n uid = callee.scope.generateDeclaredUidIdentifier(\"ret\");\n callee\n .get(\"body\")\n .pushContainer(\"body\", returnStatement(cloneNode(uid)));\n loop.setData(\"expressionReplacementReturnUid\", uid);\n } else {\n uid = identifier(uid.name);\n }\n\n path\n .get(\"expression\")\n .replaceWith(\n assignmentExpression(\"=\", cloneNode(uid), path.node.expression),\n );\n } else {\n path.replaceWith(returnStatement(path.node.expression));\n }\n }\n\n // This is an IIFE, so we don't need to worry about the noNewArrows assumption\n callee.arrowFunctionToExpression();\n // Fixme: we can not `assert this is NodePath<t.FunctionExpression>` in `arrowFunctionToExpression`\n // because it is not a class method known at compile time.\n const newCallee = callee as unknown as NodePath<t.FunctionExpression>;\n\n // (() => await xxx)() -> await (async () => await xxx)();\n const needToAwaitFunction =\n isParentAsync &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"AwaitExpression\",\n FUNCTION_TYPES,\n );\n const needToYieldFunction =\n isParentGenerator &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"YieldExpression\",\n FUNCTION_TYPES,\n );\n if (needToAwaitFunction) {\n newCallee.set(\"async\", true);\n // yield* will await the generator return result\n if (!needToYieldFunction) {\n this.replaceWith(awaitExpression((this as ThisType).node));\n }\n }\n if (needToYieldFunction) {\n newCallee.set(\"generator\", true);\n this.replaceWith(yieldExpression((this as ThisType).node, true));\n }\n\n return newCallee.get(\"body.body\");\n}\n\nfunction gatherSequenceExpressions(\n nodes: ReadonlyArray<t.Node>,\n declars: Array<t.Identifier>,\n) {\n const exprs: t.Expression[] = [];\n let ensureLastUndefined = true;\n\n for (const node of nodes) {\n // if we encounter emptyStatement before a non-emptyStatement\n // we want to disregard that\n if (!isEmptyStatement(node)) {\n ensureLastUndefined = false;\n }\n\n if (isExpression(node)) {\n exprs.push(node);\n } else if (isExpressionStatement(node)) {\n exprs.push(node.expression);\n } else if (isVariableDeclaration(node)) {\n if (node.kind !== \"var\") return; // bailed\n\n for (const declar of node.declarations) {\n const bindings = getBindingIdentifiers(declar);\n for (const key of Object.keys(bindings)) {\n declars.push(cloneNode(bindings[key]));\n }\n\n if (declar.init) {\n exprs.push(assignmentExpression(\"=\", declar.id, declar.init));\n }\n }\n\n ensureLastUndefined = true;\n } else if (isIfStatement(node)) {\n const consequent = node.consequent\n ? gatherSequenceExpressions([node.consequent], declars)\n : buildUndefinedNode();\n const alternate = node.alternate\n ? gatherSequenceExpressions([node.alternate], declars)\n : buildUndefinedNode();\n if (!consequent || !alternate) return; // bailed\n\n exprs.push(conditionalExpression(node.test, consequent, alternate));\n } else if (isBlockStatement(node)) {\n const body = gatherSequenceExpressions(node.body, declars);\n if (!body) return; // bailed\n\n exprs.push(body);\n } else if (isEmptyStatement(node)) {\n // empty statement so ensure the last item is undefined if we're last\n // checks if emptyStatement is first\n if (nodes.indexOf(node) === 0) {\n ensureLastUndefined = true;\n }\n } else {\n // bailed, we can't turn this statement into an expression\n return;\n }\n }\n\n if (ensureLastUndefined) exprs.push(buildUndefinedNode());\n\n if (exprs.length === 1) {\n return exprs[0];\n } else {\n return sequenceExpression(exprs);\n }\n}\n\nexport function replaceInline(this: NodePath, nodes: t.Node | Array<t.Node>) {\n this.resync();\n\n if (Array.isArray(nodes)) {\n if (Array.isArray(this.container)) {\n nodes = _verifyNodeList.call(this, nodes);\n const paths = _containerInsertAfter.call(this, nodes);\n this.remove();\n return paths;\n } else {\n return this.replaceWithMultiple(nodes);\n }\n } else {\n return this.replaceWith(nodes);\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,EAAA,GAAAN,OAAA;AA6BsB;EA5BpBO,cAAc;EACdC,uBAAuB;EACvBC,oBAAoB;EACpBC,eAAe;EACfC,cAAc;EACdC,kBAAkB;EAClBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,mBAAmB;EACnBC,qBAAqB;EACrBC,UAAU;EACVC,sBAAsB;EACtBC,uBAAuB;EACvBC,gBAAgB;EAChBC,gBAAgB;EAChBC,gBAAgB;EAChBC,YAAY;EACZ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,GAAG0F,mCAAqB,CAACnG,IAAI,CAAC,IAAI,EAAEJ,KAAK,CAAC;MACrD,IAAI,CAACgB,MAAM,CAAC,CAAC;MACb,OAAOH,KAAK;IACd,CAAC,MAAM;MACL,OAAO,IAAI,CAACd,mBAAmB,CAACC,KAAK,CAAC;IACxC;EACF,CAAC,MAAM;IACL,OAAO,IAAI,CAACmC,WAAW,CAACnC,KAAK,CAAC;EAChC;AACF","ignoreList":[]}1 {"version":3,"names":["_codeFrame","require","_index","_index2","_cache","_modification","_parser","_t","_context","FUNCTION_TYPES","arrowFunctionExpression","assignmentExpression","awaitExpression","blockStatement","buildUndefinedNode","callExpression","cloneNode","conditionalExpression","expressionStatement","getBindingIdentifiers","identifier","inheritLeadingComments","inheritTrailingComments","inheritsComments","isBlockStatement","isEmptyStatement","isExpression","isExpressionStatement","isIfStatement","isProgram","isStatement","isVariableDeclaration","removeComments","returnStatement","sequenceExpression","validate","yieldExpression","replaceWithMultiple","nodes","_getCachedPaths","resync","call","_verifyNodeList","node","length","getCachedPaths","hub","parent","delete","container","key","paths","insertAfter","requeue","remove","replaceWithSourceString","replacement","ast","parse","err","loc","message","codeFrameColumns","start","line","column","code","expressionAST","program","body","expression","traverse","removeProperties","replaceWith","replacementPath","removed","Error","NodePath","Array","isArray","nodePath","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","parentPath","isExportDefaultDeclaration","replaceExpressionWithStatements","oldNode","_replaceWith","type","setScope","get","_getCachedPaths2","ReferenceError","inList","debug","set","declars","nodesAsSingleExpression","gatherSequenceExpressions","id","scope","push","functionParent","getFunctionParent","isParentAsync","async","isParentGenerator","generator","callee","hoistVariables","completionRecords","getCompletionRecords","path","loop","findParent","isLoop","uid","getData","generateDeclaredUidIdentifier","pushContainer","setData","name","arrowFunctionToExpression","newCallee","needToAwaitFunction","hasType","needToYieldFunction","exprs","ensureLastUndefined","kind","declar","declarations","bindings","Object","keys","init","consequent","alternate","test","indexOf","replaceInline","_containerInsertAfter"],"sources":["../../src/path/replacement.ts"],"sourcesContent":["// This file contains methods responsible for replacing a node with another.\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"../index.ts\";\nimport NodePath from \"./index.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _verifyNodeList, _containerInsertAfter } from \"./modification.ts\";\nimport { parse } from \"@babel/parser\";\nimport {\n FUNCTION_TYPES,\n arrowFunctionExpression,\n assignmentExpression,\n awaitExpression,\n blockStatement,\n buildUndefinedNode,\n callExpression,\n cloneNode,\n conditionalExpression,\n expressionStatement,\n getBindingIdentifiers,\n identifier,\n inheritLeadingComments,\n inheritTrailingComments,\n inheritsComments,\n isBlockStatement,\n isEmptyStatement,\n isExpression,\n isExpressionStatement,\n isIfStatement,\n isProgram,\n isStatement,\n isVariableDeclaration,\n removeComments,\n returnStatement,\n sequenceExpression,\n validate,\n yieldExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { resync, setScope } from \"./context.ts\";\n\n/**\n * Replace a node with an array of multiple. This method performs the following steps:\n *\n * - Inherit the comments of first provided node with that of the current node.\n * - Insert the provided nodes after the current node.\n * - Remove the current node.\n */\n\nexport function replaceWithMultiple(\n this: NodePath,\n nodes: t.Node | t.Node[],\n): NodePath[] {\n resync.call(this);\n\n nodes = _verifyNodeList.call(this, nodes);\n inheritLeadingComments(nodes[0], this.node);\n inheritTrailingComments(nodes[nodes.length - 1], this.node);\n getCachedPaths(this.hub, this.parent)?.delete(this.node);\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = null;\n const paths = this.insertAfter(nodes);\n\n if (this.node) {\n this.requeue();\n } else {\n this.remove();\n }\n return paths;\n}\n\n/**\n * Parse a string as an expression and replace the current node with the result.\n *\n * NOTE: This is typically not a good idea to use. Building source strings when\n * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's\n * easier to use, your transforms will be extremely brittle.\n */\n\nexport function replaceWithSourceString(this: NodePath, replacement: string) {\n resync.call(this);\n let ast: t.File;\n\n try {\n replacement = `(${replacement})`;\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = parse(replacement);\n } catch (err) {\n const loc = err.loc;\n if (loc) {\n err.message +=\n \" - make sure this is an expression.\\n\" +\n codeFrameColumns(replacement, {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n });\n err.code = \"BABEL_REPLACE_SOURCE_ERROR\";\n }\n throw err;\n }\n\n const expressionAST = (ast.program.body[0] as t.ExpressionStatement)\n .expression;\n traverse.removeProperties(expressionAST);\n return this.replaceWith(expressionAST);\n}\n\n/**\n * Replace the current node with another.\n */\nexport function replaceWith<R extends t.Node>(\n this: NodePath,\n replacementPath: R,\n): [NodePath<R>];\nexport function replaceWith<R extends NodePath>(\n this: NodePath,\n replacementPath: R,\n): [R];\nexport function replaceWith(\n this: NodePath,\n replacementPath: t.Node | NodePath,\n): [NodePath] {\n resync.call(this);\n\n if (this.removed) {\n throw new Error(\"You can't replace this node, we've already removed it\");\n }\n\n let replacement: t.Node =\n replacementPath instanceof NodePath\n ? replacementPath.node\n : replacementPath;\n\n if (!replacement) {\n throw new Error(\n \"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\",\n );\n }\n\n if (this.node === replacement) {\n return [this];\n }\n\n if (this.isProgram() && !isProgram(replacement)) {\n throw new Error(\n \"You can only replace a Program root node with another Program node\",\n );\n }\n\n if (Array.isArray(replacement)) {\n throw new Error(\n \"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\",\n );\n }\n\n if (typeof replacement === \"string\") {\n throw new Error(\n \"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\",\n );\n }\n\n let nodePath = \"\";\n\n if (this.isNodeType(\"Statement\") && isExpression(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement) &&\n !this.parentPath.isExportDefaultDeclaration()\n ) {\n // replacing a statement with an expression so wrap it in an expression statement\n replacement = expressionStatement(replacement);\n nodePath = \"expression\";\n }\n }\n\n if (this.isNodeType(\"Expression\") && isStatement(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement)\n ) {\n // replacing an expression with a statement so let's explode it\n return this.replaceExpressionWithStatements([replacement]) as [NodePath];\n }\n }\n\n const oldNode = this.node;\n if (oldNode) {\n inheritsComments(replacement, oldNode);\n removeComments(oldNode);\n }\n\n // replace the node\n _replaceWith.call(this, replacement);\n this.type = replacement.type;\n\n // potentially create new scope\n setScope.call(this);\n\n // requeue for visiting\n this.requeue();\n\n return [nodePath ? this.get(nodePath) : this];\n}\n\nexport function _replaceWith(this: NodePath, node: t.Node) {\n if (!this.container) {\n throw new ReferenceError(\"Container is falsy\");\n }\n\n if (this.inList) {\n // @ts-expect-error todo(flow->ts): check if validate accepts a numeric key\n validate(this.parent, this.key, [node]);\n } else {\n validate(this.parent, this.key as string, node);\n }\n\n this.debug(`Replace with ${node?.type}`);\n getCachedPaths(this.hub, this.parent)?.set(node, this).delete(this.node);\n\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = node;\n}\n\n/**\n * This method takes an array of statements nodes and then explodes it\n * into expressions. This method retains completion records which is\n * extremely important to retain original semantics.\n */\n\nexport function replaceExpressionWithStatements(\n this: NodePath,\n nodes: Array<t.Statement>,\n) {\n resync.call(this);\n\n const declars: t.Identifier[] = [];\n const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars);\n if (nodesAsSingleExpression) {\n for (const id of declars) this.scope.push({ id });\n return this.replaceWith(nodesAsSingleExpression)[0].get(\"expressions\");\n }\n\n const functionParent = this.getFunctionParent();\n const isParentAsync = functionParent?.node.async;\n const isParentGenerator = functionParent?.node.generator;\n\n const container = arrowFunctionExpression([], blockStatement(nodes));\n\n this.replaceWith(callExpression(container, []));\n // replaceWith changes the type of \"this\", but it isn't trackable by TS\n type ThisType = NodePath<\n t.CallExpression & {\n callee: t.ArrowFunctionExpression & { body: t.BlockStatement };\n }\n >;\n\n // hoist variable declaration in do block\n // `(do { var x = 1; x;})` -> `var x; (() => { x = 1; return x; })()`\n const callee = (this as ThisType).get(\"callee\");\n callee.get(\"body\").scope.hoistVariables(id => this.scope.push({ id }));\n\n // add implicit returns to all ending expression statements\n const completionRecords: Array<NodePath> = callee.getCompletionRecords();\n for (const path of completionRecords) {\n if (!path.isExpressionStatement()) continue;\n\n const loop = path.findParent(path => path.isLoop());\n if (loop) {\n let uid = loop.getData(\"expressionReplacementReturnUid\");\n\n if (!uid) {\n uid = callee.scope.generateDeclaredUidIdentifier(\"ret\");\n callee\n .get(\"body\")\n .pushContainer(\"body\", returnStatement(cloneNode(uid)));\n loop.setData(\"expressionReplacementReturnUid\", uid);\n } else {\n uid = identifier(uid.name);\n }\n\n path\n .get(\"expression\")\n .replaceWith(\n assignmentExpression(\"=\", cloneNode(uid), path.node.expression),\n );\n } else {\n path.replaceWith(returnStatement(path.node.expression));\n }\n }\n\n // This is an IIFE, so we don't need to worry about the noNewArrows assumption\n callee.arrowFunctionToExpression();\n // Fixme: we can not `assert this is NodePath<t.FunctionExpression>` in `arrowFunctionToExpression`\n // because it is not a class method known at compile time.\n const newCallee = callee as unknown as NodePath<t.FunctionExpression>;\n\n // (() => await xxx)() -> await (async () => await xxx)();\n const needToAwaitFunction =\n isParentAsync &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"AwaitExpression\",\n FUNCTION_TYPES,\n );\n const needToYieldFunction =\n isParentGenerator &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"YieldExpression\",\n FUNCTION_TYPES,\n );\n if (needToAwaitFunction) {\n newCallee.set(\"async\", true);\n // yield* will await the generator return result\n if (!needToYieldFunction) {\n this.replaceWith(awaitExpression((this as ThisType).node));\n }\n }\n if (needToYieldFunction) {\n newCallee.set(\"generator\", true);\n this.replaceWith(yieldExpression((this as ThisType).node, true));\n }\n\n return newCallee.get(\"body.body\");\n}\n\nfunction gatherSequenceExpressions(\n nodes: ReadonlyArray<t.Node>,\n declars: Array<t.Identifier>,\n) {\n const exprs: t.Expression[] = [];\n let ensureLastUndefined = true;\n\n for (const node of nodes) {\n // if we encounter emptyStatement before a non-emptyStatement\n // we want to disregard that\n if (!isEmptyStatement(node)) {\n ensureLastUndefined = false;\n }\n\n if (isExpression(node)) {\n exprs.push(node);\n } else if (isExpressionStatement(node)) {\n exprs.push(node.expression);\n } else if (isVariableDeclaration(node)) {\n if (node.kind !== \"var\") return; // bailed\n\n for (const declar of node.declarations) {\n const bindings = getBindingIdentifiers(declar);\n for (const key of Object.keys(bindings)) {\n declars.push(cloneNode(bindings[key]));\n }\n\n if (declar.init) {\n exprs.push(assignmentExpression(\"=\", declar.id, declar.init));\n }\n }\n\n ensureLastUndefined = true;\n } else if (isIfStatement(node)) {\n const consequent = node.consequent\n ? gatherSequenceExpressions([node.consequent], declars)\n : buildUndefinedNode();\n const alternate = node.alternate\n ? gatherSequenceExpressions([node.alternate], declars)\n : buildUndefinedNode();\n if (!consequent || !alternate) return; // bailed\n\n exprs.push(conditionalExpression(node.test, consequent, alternate));\n } else if (isBlockStatement(node)) {\n const body = gatherSequenceExpressions(node.body, declars);\n if (!body) return; // bailed\n\n exprs.push(body);\n } else if (isEmptyStatement(node)) {\n // empty statement so ensure the last item is undefined if we're last\n // checks if emptyStatement is first\n if (nodes.indexOf(node) === 0) {\n ensureLastUndefined = true;\n }\n } else {\n // bailed, we can't turn this statement into an expression\n return;\n }\n }\n\n if (ensureLastUndefined) exprs.push(buildUndefinedNode());\n\n if (exprs.length === 1) {\n return exprs[0];\n } else {\n return sequenceExpression(exprs);\n }\n}\n\nexport function replaceInline(this: NodePath, nodes: t.Node | Array<t.Node>) {\n resync.call(this);\n\n if (Array.isArray(nodes)) {\n if (Array.isArray(this.container)) {\n nodes = _verifyNodeList.call(this, nodes);\n const paths = _containerInsertAfter.call(this, nodes);\n this.remove();\n return paths;\n } else {\n return this.replaceWithMultiple(nodes);\n }\n } else {\n return this.replaceWith(nodes);\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,EAAA,GAAAN,OAAA;AA+BA,IAAAO,QAAA,GAAAP,OAAA;AAAgD;EA9B9CQ,cAAc;EACdC,uBAAuB;EACvBC,oBAAoB;EACpBC,eAAe;EACfC,cAAc;EACdC,kBAAkB;EAClBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,mBAAmB;EACnBC,qBAAqB;EACrBC,UAAU;EACVC,sBAAsB;EACtBC,uBAAuB;EACvBC,gBAAgB;EAChBC,gBAAgB;EAChBC,gBAAgB;EAChBC,YAAY;EACZC,qBAAqB;EACrBC,aAAa;EACbC,SAAS;EACTC,WAAW;EACXC,qBAAqB;EACrBC,cAAc;EACdC,eAAe;EACfC,kBAAkB;EAClBC,QAAQ;EACRC;AAAe,IAAA7B,EAAA;AAaV,SAAS8B,mBAAmBA,CAEjCC,KAAwB,EACZ;EAAA,IAAAC,eAAA;EACZC,eAAM,CAACC,IAAI,CAAC,IAAI,CAAC;EAEjBH,KAAK,GAAGI,6BAAe,CAACD,IAAI,CAAC,IAAI,EAAEH,KAAK,CAAC;EACzCjB,sBAAsB,CAACiB,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAACK,IAAI,CAAC;EAC3CrB,uBAAuB,CAACgB,KAAK,CAACA,KAAK,CAACM,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,CAACD,IAAI,CAAC;EAC3D,CAAAJ,eAAA,OAAAM,qBAAc,EAAC,IAAI,CAACC,GAAG,EAAE,IAAI,CAACC,MAAM,CAAC,aAArCR,eAAA,CAAuCS,MA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O,CAACjG,IAAI,CAAC,KAAK,CAAC,EAAE;QAC7BsF,mBAAmB,GAAG,IAAI;MAC5B;IACF,CAAC,MAAM;MAEL;IACF;EACF;EAEA,IAAIA,mBAAmB,EAAED,KAAK,CAAC1B,IAAI,CAACxF,kBAAkB,CAAC,CAAC,CAAC;EAEzD,IAAIkH,KAAK,CAACpF,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOoF,KAAK,CAAC,CAAC,CAAC;EACjB,CAAC,MAAM;IACL,OAAO9F,kBAAkB,CAAC8F,KAAK,CAAC;EAClC;AACF;AAEO,SAASa,aAAaA,CAAiBvG,KAA6B,EAAE;EAC3EE,eAAM,CAACC,IAAI,CAAC,IAAI,CAAC;EAEjB,IAAIqC,KAAK,CAACC,OAAO,CAACzC,KAAK,CAAC,EAAE;IACxB,IAAIwC,KAAK,CAACC,OAAO,CAAC,IAAI,CAAC9B,SAAS,CAAC,EAAE;MACjCX,KAAK,GAAGI,6BAAe,CAACD,IAAI,CAAC,IAAI,EAAEH,KAAK,CAAC;MACzC,MAAMa,KAAK,GAAG2F,mCAAqB,CAACrG,IAAI,CAAC,IAAI,EAAEH,KAAK,CAAC;MACrD,IAAI,CAACgB,MAAM,CAAC,CAAC;MACb,OAAOH,KAAK;IACd,CAAC,MAAM;MACL,OAAO,IAAI,CAACd,mBAAmB,CAACC,KAAK,CAAC;IACxC;EACF,CAAC,MAAM;IACL,OAAO,IAAI,CAACmC,WAAW,CAACnC,KAAK,CAAC;EAChC;AACF","ignoreList":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/scope/index.js
rd565449 r0c6b92a 272 272 path.scope.registerBinding("param", param); 273 273 } 274 if (path.isFunctionExpression() && path. has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {274 if (path.isFunctionExpression() && path.node.id && !path.node.id[NOT_LOCAL_BINDING]) { 275 275 path.scope.registerBinding("local", path.get("id"), path); 276 276 } 277 277 }, 278 278 ClassExpression(path) { 279 if (path. has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {279 if (path.node.id && !path.node.id[NOT_LOCAL_BINDING]) { 280 280 path.scope.registerBinding("local", path.get("id"), path); 281 281 } … … 291 291 this.path = void 0; 292 292 this.block = void 0; 293 this.inited = void 0; 293 294 this.labels = void 0; 294 this.inited = void 0;295 295 this.bindings = void 0; 296 296 this.references = void 0; … … 326 326 return (_parent = parent) == null ? void 0 : _parent.scope; 327 327 } 328 get parentBlock() {329 return this.path.parent;330 }331 get hub() {332 return this.path.hub;333 }334 traverse(node, opts, state) {335 (0, _index.default)(node, opts, this, state, this.path);336 }337 328 generateDeclaredUidIdentifier(name) { 338 329 const id = this.generateUidIdentifier(name); … … 350 341 let i = 1; 351 342 do { 352 uid = this._generateUid(name, i); 343 uid = `_${name}`; 344 if (i > 1) uid += i; 353 345 i++; 354 346 } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); … … 357 349 program.uids[uid] = true; 358 350 return uid; 359 }360 _generateUid(name, i) {361 let id = name;362 if (i > 1) id += i;363 return `_${id}`;364 351 } 365 352 generateUidBasedOnNode(node, defaultName) { … … 406 393 const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const"; 407 394 if (duplicate) { 408 throw this. hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);395 throw this.path.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError); 409 396 } 410 397 } … … 417 404 renamer.rename(arguments[2]); 418 405 } 419 }420 }421 _renameFromMap(map, oldName, newName, value) {422 if (map[oldName]) {423 map[newName] = value;424 map[oldName] = null;425 406 } 426 407 } … … 442 423 } while (scope = scope.parent); 443 424 console.log(sep); 444 }445 toArray(node, i, arrayLikeIsIterable) {446 if (isIdentifier(node)) {447 const binding = this.getBinding(node.name);448 if (binding != null && binding.constant && binding.path.isGenericType("Array")) {449 return node;450 }451 }452 if (isArrayExpression(node)) {453 return node;454 }455 if (isIdentifier(node, {456 name: "arguments"457 })) {458 return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);459 }460 let helperName;461 const args = [node];462 if (i === true) {463 helperName = "toConsumableArray";464 } else if (typeof i === "number") {465 args.push(numericLiteral(i));466 helperName = "slicedToArray";467 } else {468 helperName = "toArray";469 }470 if (arrayLikeIsIterable) {471 args.unshift(this.hub.addHelper(helperName));472 helperName = "maybeArrayLike";473 }474 return callExpression(this.hub.addHelper(helperName), args);475 425 } 476 426 hasLabel(name) { … … 811 761 scope = scope.parent; 812 762 } while (scope); 813 return ids;814 }815 getAllBindingsOfKind(...kinds) {816 const ids = Object.create(null);817 for (const kind of kinds) {818 let scope = this;819 do {820 for (const name of Object.keys(scope.bindings)) {821 const binding = scope.bindings[name];822 if (binding.kind === kind) ids[name] = binding;823 }824 scope = scope.parent;825 } while (scope);826 }827 763 return ids; 828 764 } … … 959 895 Scope.globals = Object.keys(_globals.builtin); 960 896 Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; 897 { 898 Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { 899 if (map[oldName]) { 900 map[newName] = value; 901 map[oldName] = null; 902 } 903 }; 904 Scope.prototype.traverse = function (node, opts, state) { 905 (0, _index.default)(node, opts, this, state, this.path); 906 }; 907 Scope.prototype._generateUid = function _generateUid(name, i) { 908 let id = name; 909 if (i > 1) id += i; 910 return `_${id}`; 911 }; 912 Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) { 913 if (isIdentifier(node)) { 914 const binding = this.getBinding(node.name); 915 if (binding != null && binding.constant && binding.path.isGenericType("Array")) { 916 return node; 917 } 918 } 919 if (isArrayExpression(node)) { 920 return node; 921 } 922 if (isIdentifier(node, { 923 name: "arguments" 924 })) { 925 return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]); 926 } 927 let helperName; 928 const args = [node]; 929 if (i === true) { 930 helperName = "toConsumableArray"; 931 } else if (typeof i === "number") { 932 args.push(numericLiteral(i)); 933 helperName = "slicedToArray"; 934 } else { 935 helperName = "toArray"; 936 } 937 if (arrayLikeIsIterable) { 938 args.unshift(this.path.hub.addHelper(helperName)); 939 helperName = "maybeArrayLike"; 940 } 941 return callExpression(this.path.hub.addHelper(helperName), args); 942 }; 943 Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) { 944 const ids = Object.create(null); 945 for (const kind of kinds) { 946 let scope = this; 947 do { 948 for (const name of Object.keys(scope.bindings)) { 949 const binding = scope.bindings[name]; 950 if (binding.kind === kind) ids[name] = binding; 951 } 952 scope = scope.parent; 953 } while (scope); 954 } 955 return ids; 956 }; 957 Object.defineProperties(Scope.prototype, { 958 parentBlock: { 959 configurable: true, 960 enumerable: true, 961 get() { 962 return this.path.parent; 963 } 964 }, 965 hub: { 966 configurable: true, 967 enumerable: true, 968 get() { 969 return this.path.hub; 970 } 971 } 972 }); 973 } 961 974 962 975 //# sourceMappingURL=index.js.map -
imaps-frontend/node_modules/@babel/traverse/lib/scope/index.js.map
rd565449 r0c6b92a 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"," has","ClassExpression","TSTypeAnnotation","skip","uid","Scope","constructor","block","labels","inited","globals","uids","data","crawling","cached","scopeCache","set","Map","_parent","_path","shouldSkip","listKey","parentPath","isScope","parentBlock","hub","traverse","opts","generateDeclaredUidIdentifier","generateUidIdentifier","generateUid","replace","i","_generateUid","hasLabel","hasBinding","hasGlobal","hasReference","program","generateUidBasedOnNode","defaultName","join","slice","generateUidIdentifierBasedOnNode","isStatic","constant","maybeGenerateMemoised","dontPush","checkBlockScopedCollisions","kind","duplicate","buildError","TypeError","rename","oldName","newName","renamer","Renamer","arguments","_renameFromMap","map","dump","sep","repeat","console","log","violations","toArray","arrayLikeIsIterable","isGenericType","helperName","args","unshift","addHelper","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","programParent","isExplodedVisitor","visit","enter","call","typeVisitors","ref","getPatternParent","isBlockStatement","isProgram","isSwitchStatement","unique","isFunction","pushContainer","isLoop","isCatchClause","ensureBlock","blockHoist","_blockHoist","dataKey","declarPath","unshiftContainer","declarator","len","Error","isFunctionParent","isBlockParent","getAllBindings","getAllBindingsOfKind","kinds","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","add","firstId","_firstId","isFor","replaceWith","remove","expr","isForStatement","exports","default","builtin"],"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 type { TraverseOptions } 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.has(\"id\") &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.get(\"id\").node[NOT_LOCAL_BINDING]\n ) {\n path.scope.registerBinding(\"local\", path.get(\"id\"), path);\n }\n },\n\n ClassExpression(path) {\n if (\n path.has(\"id\") &&\n // @ts-expect-error Fixme: document symbol ast properties\n !path.get(\"id\").node[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 labels;\n inited;\n\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 get parentBlock() {\n return this.path.parent;\n }\n\n get hub() {\n return this.path.hub;\n }\n\n traverse<S>(\n node: t.Node | t.Node[],\n opts: TraverseOptions<S>,\n state: S,\n ): void;\n traverse(node: t.Node | t.Node[], opts?: TraverseOptions, state?: any): void;\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 traverse<S>(node: any, opts: any, state?: S) {\n traverse(node, opts, this, state, this.path);\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 = this._generateUid(name, 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 /**\n * Generate an `_id1`.\n */\n\n _generateUid(name: string, i: number) {\n let id = name;\n if (i > 1) id += i;\n return `_${id}`;\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.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 /** @deprecated Not used in our codebase */\n _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 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 // TODO: (Babel 8) Split i in two parameters, and use an object of flags\n toArray(\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.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.hub.addHelper(helperName), args);\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 const programParent = this.getProgramParent();\n if (programParent.crawling) return;\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.LVal;\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 /**\n * Walks the scope tree and gathers all declarations of `kind`.\n */\n\n getAllBindingsOfKind(...kinds: string[]): 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 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\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;AAEA,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,EAAE;EACxD,QAAQD,IAAI,oBAAJA,IAAI,CAAEE,IAAI;IAChB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,CAAC,CAAC;QACvE,KAAK,MAAMxC,IAAI,IAAI8I,GAAG,EAAE;UACtBwF,IAAI,CAACjS,UAAU,CAAC2D,IAAI,CAAC,EAAEwC,IAAI,CAAC0I,IAAI,IAAI,IAAI,CAAC;QAC3C;MACF;MAGA,IAAInG,UAAU,CAACA,UAAU,CAAC8J,KAAK,CAAC;QAAExO,IAAI,EAAEoB;MAAO,CAAC,CAAC,EAAE;QACjDsD,UAAU,CAAC+J,WAAW,CAACH,OAAO,CAAC;MACjC,CAAC,MAAM,IAAIzD,IAAI,CAAC1L,MAAM,KAAK,CAAC,EAAE;QAC5BuF,UAAU,CAACgK,MAAM,CAAC,CAAC;MACrB,CAAC,MAAM;QACL,MAAMC,IAAI,GAAG9D,IAAI,CAAC1L,MAAM,KAAK,CAAC,GAAG0L,IAAI,CAAC,CAAC,CAAC,GAAGlM,kBAAkB,CAACkM,IAAI,CAAC;QACnE,IAAInG,UAAU,CAACA,UAAU,CAACkK,cAAc,CAAC;UAAE/D,IAAI,EAAEzJ;QAAO,CAAC,CAAC,EAAE;UAC1DsD,UAAU,CAAC+J,WAAW,CAACE,IAAI,CAAC;QAC9B,CAAC,MAAM;UACLjK,UAAU,CAAC+J,WAAW,CAAC7Q,mBAAmB,CAAC+Q,IAAI,CAAC,CAAC;QACnD;MACF;IACF;EACF;AACF;AAACE,OAAA,CAAAC,OAAA,GAAArL,KAAA;AAxhCKA,KAAK,CA2CFK,OAAO,GAAGzB,MAAM,CAACC,IAAI,CAACwB,QAAO,CAACiL,OAAO,CAAC;AA3CzCtL,KAAK,CAiDF+J,gBAAgB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC","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","programParent","isExplodedVisitor","visit","enter","call","typeVisitors","traverse","ref","opts","getPatternParent","isBlockStatement","isProgram","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 const programParent = this.getProgramParent();\n if (programParent.crawling) return;\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,QA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AC,EAAEC,IAAI,CAAC;EAClE,CAAC;EAMDnL,KAAK,CAAC2K,SAAS,CAACW,oBAAoB,GAAG,SAASA,oBAAoBA,CAClE,GAAGC,KAAe,EACO;IACzB,MAAMpH,GAAG,GAAGtF,MAAM,CAAC4H,MAAM,CAAC,IAAI,CAAC;IAE/B,KAAK,MAAMlE,IAAI,IAAIgJ,KAAK,EAAE;MACxB,IAAIlO,KAAY,GAAG,IAAI;MACvB,GAAG;QACD,KAAK,MAAMlB,IAAI,IAAI0C,MAAM,CAACC,IAAI,CAACzB,KAAK,CAACiC,QAAQ,CAAC,EAAE;UAC9C,MAAMd,OAAO,GAAGnB,KAAK,CAACiC,QAAQ,CAACnD,IAAI,CAAC;UACpC,IAAIqC,OAAO,CAAC+D,IAAI,KAAKA,IAAI,EAAE4B,GAAG,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":[]} -
imaps-frontend/node_modules/@babel/traverse/lib/scope/lib/renamer.js
rd565449 r0c6b92a 6 6 exports.default = void 0; 7 7 var t = require("@babel/types"); 8 var _t = t; 8 9 var _traverseNode = require("../../traverse-node.js"); 9 10 var _visitors = require("../../visitors.js"); 10 11 var _context = require("../../path/context.js"); 12 const { 13 getAssignmentIdentifiers 14 } = _t; 11 15 const renameVisitor = { 12 16 ReferencedIdentifier({ … … 46 50 "AssignmentExpression|Declaration|VariableDeclarator"(path, state) { 47 51 if (path.isVariableDeclaration()) return; 48 const ids = path.isAssignmentExpression() ? path.getAssignmentIdentifiers() : path.getOuterBindingIdentifiers();52 const ids = path.isAssignmentExpression() ? getAssignmentIdentifiers(path.node) : path.getOuterBindingIdentifiers(); 49 53 for (const name in ids) { 50 54 if (name === state.oldName) ids[name].name = state.newName; … … 100 104 } 101 105 const blockToTraverse = arguments[0] || scope.block; 102 (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path,{106 const skipKeys = { 103 107 discriminant: true 104 }); 108 }; 109 if (t.isMethod(blockToTraverse)) { 110 if (blockToTraverse.computed) { 111 skipKeys.key = true; 112 } 113 if (!t.isObjectMethod(blockToTraverse)) { 114 skipKeys.decorators = true; 115 } 116 } 117 (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, skipKeys); 105 118 if (!arguments[0]) { 106 119 scope.removeOwnBinding(oldName); -
imaps-frontend/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map
rd565449 r0c6b92a 1 {"version":3,"names":["t","require","_t raverseNode","_visitors","_context","renameVisitor","ReferencedIdentifier","node","state","name","oldName","newName","Scope","path","scope","bindingIdentifierEquals","binding","identifier","skip","isMethod","requeueComputedKeyAndDecorators","call","ObjectProperty","key","shorthand","getBindingIdentifier","_node$extra","extra","AssignmentExpression|Declaration|VariableDeclarator","isVariableDeclaration","ids","isAssignmentExpression","getAssignmentIdentifiers","getOuterBindingIdentifiers","Renamer","constructor","maybeConvertFromExportDeclaration","parentDeclar","maybeExportDeclar","parentPath","isExportDeclaration","isExportDefaultDeclaration","declaration","isDeclaration","id","isExportAllDeclaration","splitExportDeclaration","maybeConvertFromClassFunctionDeclaration","maybeConvertFromClassFunctionExpression","rename","find","isFunctionExpression","isClassExpression","bindingIds","blockToTraverse","arguments","block","traverseNode","explode","discriminant","removeOwnBinding","bindings","exports","default"],"sources":["../../../src/scope/lib/renamer.ts"],"sourcesContent":["import type Binding from \"../binding.ts\";\nimport * as t from \"@babel/types\";\nimport type { NodePath, Visitor } from \"../../index.ts\";\nimport { traverseNode } from \"../../traverse-node.ts\";\nimport { explode } from \"../../visitors.ts\";\nimport type { Identifier } from \"@babel/types\";\nimport { requeueComputedKeyAndDecorators } from \"../../path/context.ts\";\n\nconst renameVisitor: Visitor<Renamer> = {\n ReferencedIdentifier({ node }, state) {\n if (node.name === state.oldName) {\n node.name = state.newName;\n }\n },\n\n Scope(path, state) {\n if (\n !path.scope.bindingIdentifierEquals(\n state.oldName,\n state.binding.identifier,\n )\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 },\n\n ObjectProperty({ node, scope }, state) {\n const { name } = node.key as Identifier;\n if (\n node.shorthand &&\n // In destructuring the identifier is already renamed by the\n // AssignmentExpression|Declaration|VariableDeclarator visitor,\n // while in object literals it's renamed later by the\n // ReferencedIdentifier visitor.\n (name === state.oldName || name === state.newName) &&\n // Ignore shadowed bindings\n scope.getBindingIdentifier(name) === state.binding.identifier\n ) {\n node.shorthand = false;\n if (!process.env.BABEL_8_BREAKING) {\n if (node.extra?.shorthand) node.extra.shorthand = false;\n }\n }\n },\n\n \"AssignmentExpression|Declaration|VariableDeclarator\"(\n path: NodePath<\n t.AssignmentExpression | t.Declaration | t.VariableDeclarator\n >,\n state,\n ) {\n if (path.isVariableDeclaration()) return;\n const ids = path.isAssignmentExpression()\n ? path.getAssignmentIdentifiers()\n : path.getOuterBindingIdentifiers();\n\n for (const name in ids) {\n if (name === state.oldName) ids[name].name = state.newName;\n }\n },\n};\n\nexport default class Renamer {\n constructor(binding: Binding, oldName: string, newName: string) {\n this.newName = newName;\n this.oldName = oldName;\n this.binding = binding;\n }\n\n declare oldName: string;\n declare newName: string;\n declare binding: Binding;\n\n maybeConvertFromExportDeclaration(parentDeclar: NodePath) {\n const maybeExportDeclar = parentDeclar.parentPath;\n\n if (!maybeExportDeclar.isExportDeclaration()) {\n return;\n }\n\n if (maybeExportDeclar.isExportDefaultDeclaration()) {\n const { declaration } = maybeExportDeclar.node;\n if (t.isDeclaration(declaration) && !declaration.id) {\n return;\n }\n }\n\n if (maybeExportDeclar.isExportAllDeclaration()) {\n return;\n }\n\n maybeExportDeclar.splitExportDeclaration();\n }\n\n maybeConvertFromClassFunctionDeclaration(path: NodePath) {\n return path; // TODO\n\n // // retain the `name` of a class/function declaration\n\n // if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;\n // if (this.binding.kind !== \"hoisted\") return;\n\n // path.node.id = identifier(this.oldName);\n // path.node._blockHoist = 3;\n\n // path.replaceWith(\n // variableDeclaration(\"let\", [\n // variableDeclarator(identifier(this.newName), toExpression(path.node)),\n // ]),\n // );\n }\n\n maybeConvertFromClassFunctionExpression(path: NodePath) {\n return path; // TODO\n\n // // retain the `name` of a class/function expression\n\n // if (!path.isFunctionExpression() && !path.isClassExpression()) return;\n // if (this.binding.kind !== \"local\") return;\n\n // path.node.id = identifier(this.oldName);\n\n // this.binding.scope.parent.push({\n // id: identifier(this.newName),\n // });\n\n // path.replaceWith(\n // assignmentExpression(\"=\", identifier(this.newName), path.node),\n // );\n }\n\n rename(/* Babel 7 - block?: t.Pattern | t.Scopable */) {\n const { binding, oldName, newName } = this;\n const { scope, path } = binding;\n\n const parentDeclar = path.find(\n path =>\n path.isDeclaration() ||\n path.isFunctionExpression() ||\n path.isClassExpression(),\n );\n if (parentDeclar) {\n const bindingIds = parentDeclar.getOuterBindingIdentifiers();\n if (bindingIds[oldName] === binding.identifier) {\n // When we are renaming an exported identifier, we need to ensure that\n // the exported binding keeps the old name.\n this.maybeConvertFromExportDeclaration(parentDeclar);\n }\n }\n\n const blockToTraverse = process.env.BABEL_8_BREAKING\n ? scope.block\n : (arguments[0] as t.Pattern | t.Scopable) || scope.block;\n traverseNode(\n blockToTraverse,\n explode(renameVisitor),\n scope,\n this,\n scope.path,\n // When blockToTraverse is a SwitchStatement, the discriminant\n // is not part of the current scope and thus should be skipped.\n { discriminant: true },\n );\n\n if (process.env.BABEL_8_BREAKING) {\n scope.removeOwnBinding(oldName);\n scope.bindings[newName] = binding;\n this.binding.identifier.name = newName;\n } else if (!arguments[0]) {\n scope.removeOwnBinding(oldName);\n scope.bindings[newName] = binding;\n this.binding.identifier.name = newName;\n }\n\n if (parentDeclar) {\n this.maybeConvertFromClassFunctionDeclaration(path);\n this.maybeConvertFromClassFunctionExpression(path);\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAEA,MAAMI,aAA+B,GAAG;EACtCC,oBAAoBA,CAAC;IAAEC;EAAK,CAAC,EAAEC,KAAK,EAAE;IACpC,IAAID,IAAI,CAACE,IAAI,KAAKD,KAAK,CAACE,OAAO,EAAE;MAC/BH,IAAI,CAACE,IAAI,GAAGD,KAAK,CAACG,OAAO;IAC3B;EACF,CAAC;EAEDC,KAAKA,CAACC,IAAI,EAAEL,KAAK,EAAE;IACjB,IACE,CAACK,IAAI,CAACC,KAAK,CAACC,uBAAuB,CACjCP,KAAK,CAACE,OAAO,EACbF,KAAK,CAACQ,OAAO,CAACC,UAChB,CAAC,EACD;MACAJ,IAAI,CAACK,IAAI,CAAC,CAAC;MACX,IAAIL,IAAI,CAACM,QAAQ,CAAC,CAAC,EAAE;QACnB,IAEE,CAACN,IAAI,CAACO,+BAA+B,EACrC;UAEAA,wCAA+B,CAACC,IAAI,CAACR,IAAI,CAAC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,MAAMiB,eAAe,GAEhBC,SAAS,CAAC,CAAC,CAAC,IAA+BzC,KAAK,CAAC0C,KAAK;IAC3D,IAAAC,0BAAY,EACVH,eAAe,EACf,IAAAI,iBAAO,EAACrD,aAAa,CAAC,EACtBS,KAAK,EACL,IAAI,EACJA,KAAK,CAACD,IAAI,EAGV;MAAE8C,YAAY,EAAE;IAAK,CACvB,CAAC;IAMM,IAAI,CAACJ,SAAS,CAAC,CAAC,CAAC,EAAE;MACxBzC,KAAK,CAAC8C,gBAAgB,CAAClD,OAAO,CAAC;MAC/BI,KAAK,CAAC+C,QAAQ,CAAClD,OAAO,CAAC,GAAGK,OAAO;MACjC,IAAI,CAACA,OAAO,CAACC,UAAU,CAACR,IAAI,GAAGE,OAAO;IACxC;IAEA,IAAI0B,YAAY,EAAE;MAChB,IAAI,CAACU,wCAAwC,CAAClC,IAAI,CAAC;MACnD,IAAI,CAACmC,uCAAuC,CAACnC,IAAI,CAAC;IACpD;EACF;AACF;AAACiD,OAAA,CAAAC,OAAA,GAAA7B,OAAA","ignoreList":[]}1 {"version":3,"names":["t","require","_t","_traverseNode","_visitors","_context","getAssignmentIdentifiers","renameVisitor","ReferencedIdentifier","node","state","name","oldName","newName","Scope","path","scope","bindingIdentifierEquals","binding","identifier","skip","isMethod","requeueComputedKeyAndDecorators","call","ObjectProperty","key","shorthand","getBindingIdentifier","_node$extra","extra","AssignmentExpression|Declaration|VariableDeclarator","isVariableDeclaration","ids","isAssignmentExpression","getOuterBindingIdentifiers","Renamer","constructor","maybeConvertFromExportDeclaration","parentDeclar","maybeExportDeclar","parentPath","isExportDeclaration","isExportDefaultDeclaration","declaration","isDeclaration","id","isExportAllDeclaration","splitExportDeclaration","maybeConvertFromClassFunctionDeclaration","maybeConvertFromClassFunctionExpression","rename","find","isFunctionExpression","isClassExpression","bindingIds","blockToTraverse","arguments","block","skipKeys","discriminant","computed","isObjectMethod","decorators","traverseNode","explode","removeOwnBinding","bindings","exports","default"],"sources":["../../../src/scope/lib/renamer.ts"],"sourcesContent":["import type Binding from \"../binding.ts\";\nimport * as t from \"@babel/types\";\nimport type { NodePath, Visitor } from \"../../index.ts\";\nimport { traverseNode } from \"../../traverse-node.ts\";\nimport { explode } from \"../../visitors.ts\";\nimport { getAssignmentIdentifiers, type Identifier } from \"@babel/types\";\nimport { requeueComputedKeyAndDecorators } from \"../../path/context.ts\";\n\nconst renameVisitor: Visitor<Renamer> = {\n ReferencedIdentifier({ node }, state) {\n if (node.name === state.oldName) {\n node.name = state.newName;\n }\n },\n\n Scope(path, state) {\n if (\n !path.scope.bindingIdentifierEquals(\n state.oldName,\n state.binding.identifier,\n )\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 },\n\n ObjectProperty({ node, scope }, state) {\n const { name } = node.key as Identifier;\n if (\n node.shorthand &&\n // In destructuring the identifier is already renamed by the\n // AssignmentExpression|Declaration|VariableDeclarator visitor,\n // while in object literals it's renamed later by the\n // ReferencedIdentifier visitor.\n (name === state.oldName || name === state.newName) &&\n // Ignore shadowed bindings\n scope.getBindingIdentifier(name) === state.binding.identifier\n ) {\n node.shorthand = false;\n if (!process.env.BABEL_8_BREAKING) {\n if (node.extra?.shorthand) node.extra.shorthand = false;\n }\n }\n },\n\n \"AssignmentExpression|Declaration|VariableDeclarator\"(\n path: NodePath<\n t.AssignmentExpression | t.Declaration | t.VariableDeclarator\n >,\n state,\n ) {\n if (path.isVariableDeclaration()) return;\n const ids = path.isAssignmentExpression()\n ? // See https://github.com/babel/babel/issues/16694\n getAssignmentIdentifiers(path.node)\n : path.getOuterBindingIdentifiers();\n\n for (const name in ids) {\n if (name === state.oldName) ids[name].name = state.newName;\n }\n },\n};\n\nexport default class Renamer {\n constructor(binding: Binding, oldName: string, newName: string) {\n this.newName = newName;\n this.oldName = oldName;\n this.binding = binding;\n }\n\n declare oldName: string;\n declare newName: string;\n declare binding: Binding;\n\n maybeConvertFromExportDeclaration(parentDeclar: NodePath) {\n const maybeExportDeclar = parentDeclar.parentPath;\n\n if (!maybeExportDeclar.isExportDeclaration()) {\n return;\n }\n\n if (maybeExportDeclar.isExportDefaultDeclaration()) {\n const { declaration } = maybeExportDeclar.node;\n if (t.isDeclaration(declaration) && !declaration.id) {\n return;\n }\n }\n\n if (maybeExportDeclar.isExportAllDeclaration()) {\n return;\n }\n\n maybeExportDeclar.splitExportDeclaration();\n }\n\n maybeConvertFromClassFunctionDeclaration(path: NodePath) {\n return path; // TODO\n\n // // retain the `name` of a class/function declaration\n\n // if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;\n // if (this.binding.kind !== \"hoisted\") return;\n\n // path.node.id = identifier(this.oldName);\n // path.node._blockHoist = 3;\n\n // path.replaceWith(\n // variableDeclaration(\"let\", [\n // variableDeclarator(identifier(this.newName), toExpression(path.node)),\n // ]),\n // );\n }\n\n maybeConvertFromClassFunctionExpression(path: NodePath) {\n return path; // TODO\n\n // // retain the `name` of a class/function expression\n\n // if (!path.isFunctionExpression() && !path.isClassExpression()) return;\n // if (this.binding.kind !== \"local\") return;\n\n // path.node.id = identifier(this.oldName);\n\n // this.binding.scope.parent.push({\n // id: identifier(this.newName),\n // });\n\n // path.replaceWith(\n // assignmentExpression(\"=\", identifier(this.newName), path.node),\n // );\n }\n\n rename(/* Babel 7 - block?: t.Pattern | t.Scopable */) {\n const { binding, oldName, newName } = this;\n const { scope, path } = binding;\n\n const parentDeclar = path.find(\n path =>\n path.isDeclaration() ||\n path.isFunctionExpression() ||\n path.isClassExpression(),\n );\n if (parentDeclar) {\n const bindingIds = parentDeclar.getOuterBindingIdentifiers();\n if (bindingIds[oldName] === binding.identifier) {\n // When we are renaming an exported identifier, we need to ensure that\n // the exported binding keeps the old name.\n this.maybeConvertFromExportDeclaration(parentDeclar);\n }\n }\n\n const blockToTraverse = process.env.BABEL_8_BREAKING\n ? scope.block\n : (arguments[0] as t.Pattern | t.Scopable) || scope.block;\n\n // When blockToTraverse is a SwitchStatement, the discriminant\n // is not part of the current scope and thus should be skipped.\n\n // const foo = {\n // get [x]() {\n // return x;\n // },\n // };\n const skipKeys: Record<string, true> = { discriminant: true };\n if (t.isMethod(blockToTraverse)) {\n if (blockToTraverse.computed) {\n skipKeys.key = true;\n }\n if (!t.isObjectMethod(blockToTraverse)) {\n skipKeys.decorators = true;\n }\n }\n\n traverseNode(\n blockToTraverse,\n explode(renameVisitor),\n scope,\n this,\n scope.path,\n skipKeys,\n );\n\n if (process.env.BABEL_8_BREAKING) {\n scope.removeOwnBinding(oldName);\n scope.bindings[newName] = binding;\n this.binding.identifier.name = newName;\n } else if (!arguments[0]) {\n scope.removeOwnBinding(oldName);\n scope.bindings[newName] = binding;\n this.binding.identifier.name = newName;\n }\n\n if (parentDeclar) {\n this.maybeConvertFromClassFunctionDeclaration(path);\n this.maybeConvertFromClassFunctionExpression(path);\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,OAAA;AAAkC,IAAAC,EAAA,GAAAF,CAAA;AAElC,IAAAG,aAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAAwE;EAD/DK;AAAwB,IAAAJ,EAAA;AAGjC,MAAMK,aAA+B,GAAG;EACtCC,oBAAoBA,CAAC;IAAEC;EAAK,CAAC,EAAEC,KAAK,EAAE;IACpC,IAAID,IAAI,CAACE,IAAI,KAAKD,KAAK,CAACE,OAAO,EAAE;MAC/BH,IAAI,CAACE,IAAI,GAAGD,KAAK,CAACG,OAAO;IAC3B;EACF,CAAC;EAEDC,KAAKA,CAACC,IAAI,EAAEL,KAAK,EAAE;IACjB,IACE,CAACK,IAAI,CAACC,KAAK,CAACC,uBAAuB,CACjCP,KAAK,CAACE,OAAO,EACbF,KAAK,CAACQ,OAA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) continue; 106 106 if (!TYPES.includes(nodeType)) { 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.25. 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.25.9"}`); 108 108 } 109 109 const visitors = visitor[nodeType]; -
imaps-frontend/node_modules/@babel/traverse/package.json
rd565449 r0c6b92a 1 1 { 2 2 "name": "@babel/traverse", 3 "version": "7.25. 3",3 "version": "7.25.9", 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)", … … 17 17 "main": "./lib/index.js", 18 18 "dependencies": { 19 "@babel/code-frame": "^7.2 4.7",20 "@babel/generator": "^7.25. 0",21 "@babel/parser": "^7.25. 3",22 "@babel/template": "^7.25. 0",23 "@babel/types": "^7.25. 2",19 "@babel/code-frame": "^7.25.9", 20 "@babel/generator": "^7.25.9", 21 "@babel/parser": "^7.25.9", 22 "@babel/template": "^7.25.9", 23 "@babel/types": "^7.25.9", 24 24 "debug": "^4.3.1", 25 25 "globals": "^11.1.0" 26 26 }, 27 27 "devDependencies": { 28 "@babel/core": "^7.25. 2",29 "@babel/helper-plugin-test-runner": "^7.2 4.7"28 "@babel/core": "^7.25.9", 29 "@babel/helper-plugin-test-runner": "^7.25.9" 30 30 }, 31 31 "engines": {
Note:
See TracChangeset
for help on using the changeset viewer.