From 580e798e16346eb894eb899edac82d2efdf40adc Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sat, 18 Apr 2026 22:32:53 -0500 Subject: initial commit --- node_modules/@babel/traverse/lib/scope/binding.js | 84 ++ .../@babel/traverse/lib/scope/binding.js.map | 1 + node_modules/@babel/traverse/lib/scope/index.js | 1018 ++++++++++++++++++++ .../@babel/traverse/lib/scope/index.js.map | 1 + .../@babel/traverse/lib/scope/lib/renamer.js | 132 +++ .../@babel/traverse/lib/scope/lib/renamer.js.map | 1 + .../@babel/traverse/lib/scope/traverseForScope.js | 66 ++ .../traverse/lib/scope/traverseForScope.js.map | 1 + 8 files changed, 1304 insertions(+) create mode 100644 node_modules/@babel/traverse/lib/scope/binding.js create mode 100644 node_modules/@babel/traverse/lib/scope/binding.js.map create mode 100644 node_modules/@babel/traverse/lib/scope/index.js create mode 100644 node_modules/@babel/traverse/lib/scope/index.js.map create mode 100644 node_modules/@babel/traverse/lib/scope/lib/renamer.js create mode 100644 node_modules/@babel/traverse/lib/scope/lib/renamer.js.map create mode 100644 node_modules/@babel/traverse/lib/scope/traverseForScope.js create mode 100644 node_modules/@babel/traverse/lib/scope/traverseForScope.js.map (limited to 'node_modules/@babel/traverse/lib/scope') diff --git a/node_modules/@babel/traverse/lib/scope/binding.js b/node_modules/@babel/traverse/lib/scope/binding.js new file mode 100644 index 0000000..487f6c6 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/binding.js @@ -0,0 +1,84 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +class Binding { + constructor({ + identifier, + scope, + path, + kind + }) { + this.identifier = void 0; + this.scope = void 0; + this.path = void 0; + this.kind = void 0; + this.constantViolations = []; + this.constant = true; + this.referencePaths = []; + this.referenced = false; + this.references = 0; + this.identifier = identifier; + this.scope = scope; + this.path = path; + this.kind = kind; + if ((kind === "var" || kind === "hoisted") && isInitInLoop(path)) { + this.reassign(path); + } + this.clearValue(); + } + deoptValue() { + this.clearValue(); + this.hasDeoptedValue = true; + } + setValue(value) { + if (this.hasDeoptedValue) return; + this.hasValue = true; + this.value = value; + } + clearValue() { + this.hasDeoptedValue = false; + this.hasValue = false; + this.value = null; + } + reassign(path) { + this.constant = false; + if (this.constantViolations.includes(path)) { + return; + } + this.constantViolations.push(path); + } + reference(path) { + if (this.referencePaths.includes(path)) { + return; + } + this.referenced = true; + this.references++; + this.referencePaths.push(path); + } + dereference() { + this.references--; + this.referenced = !!this.references; + } +} +exports.default = Binding; +function isInitInLoop(path) { + const isFunctionDeclarationOrHasInit = !path.isVariableDeclarator() || path.node.init; + for (let { + parentPath, + key + } = path; parentPath; { + parentPath, + key + } = parentPath) { + if (parentPath.isFunctionParent()) return false; + if (key === "left" && parentPath.isForXStatement() || isFunctionDeclarationOrHasInit && key === "body" && parentPath.isLoop()) { + return true; + } + } + return false; +} + +//# sourceMappingURL=binding.js.map diff --git a/node_modules/@babel/traverse/lib/scope/binding.js.map b/node_modules/@babel/traverse/lib/scope/binding.js.map new file mode 100644 index 0000000..1f8733a --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/binding.js.map @@ -0,0 +1 @@ +{"version":3,"names":["Binding","constructor","identifier","scope","path","kind","constantViolations","constant","referencePaths","referenced","references","isInitInLoop","reassign","clearValue","deoptValue","hasDeoptedValue","setValue","value","hasValue","includes","push","reference","dereference","exports","default","isFunctionDeclarationOrHasInit","isVariableDeclarator","node","init","parentPath","key","isFunctionParent","isForXStatement","isLoop"],"sources":["../../src/scope/binding.ts"],"sourcesContent":["import type NodePath from \"../path/index.ts\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"./index.ts\";\n\nexport type BindingKind =\n | \"var\" /* var declarator */\n | \"let\" /* let declarator, class declaration id, catch clause parameters */\n | \"const\" /* const/using/await using declarator */\n | \"module\" /* import specifiers */\n | \"hoisted\" /* function declaration id */\n | \"param\" /* function declaration parameters */\n | \"local\" /* function expression id, class expression id */\n | \"unknown\"; /* export specifiers */\n/**\n * This class is responsible for a binding inside of a scope.\n *\n * It tracks the following:\n *\n * * Node path.\n * * Amount of times referenced by other nodes.\n * * Paths to nodes that reassign or modify this binding.\n * * The kind of binding. (Is it a parameter, declaration etc)\n */\n\nexport default class Binding {\n identifier: t.Identifier;\n scope: Scope;\n path: NodePath;\n kind: BindingKind;\n\n constructor({\n identifier,\n scope,\n path,\n kind,\n }: {\n identifier: t.Identifier;\n scope: Scope;\n path: NodePath;\n kind: BindingKind;\n }) {\n this.identifier = identifier;\n this.scope = scope;\n this.path = path;\n this.kind = kind;\n\n if ((kind === \"var\" || kind === \"hoisted\") && isInitInLoop(path)) {\n this.reassign(path);\n }\n\n this.clearValue();\n }\n\n constantViolations: NodePath[] = [];\n constant: boolean = true;\n\n referencePaths: NodePath[] = [];\n referenced: boolean = false;\n references: number = 0;\n\n declare hasDeoptedValue: boolean;\n declare hasValue: boolean;\n declare value: any;\n\n deoptValue() {\n this.clearValue();\n this.hasDeoptedValue = true;\n }\n\n setValue(value: any) {\n if (this.hasDeoptedValue) return;\n this.hasValue = true;\n this.value = value;\n }\n\n clearValue() {\n this.hasDeoptedValue = false;\n this.hasValue = false;\n this.value = null;\n }\n\n /**\n * Register a constant violation with the provided `path`.\n */\n\n reassign(path: NodePath) {\n this.constant = false;\n if (this.constantViolations.includes(path)) {\n return;\n }\n this.constantViolations.push(path);\n }\n\n /**\n * Increment the amount of references to this binding.\n */\n\n reference(path: NodePath) {\n if (this.referencePaths.includes(path)) {\n return;\n }\n this.referenced = true;\n this.references++;\n this.referencePaths.push(path);\n }\n\n /**\n * Decrement the amount of references to this binding.\n */\n\n dereference() {\n this.references--;\n this.referenced = !!this.references;\n }\n}\n\nfunction isInitInLoop(path: NodePath) {\n const isFunctionDeclarationOrHasInit =\n !path.isVariableDeclarator() || path.node.init;\n for (\n let { parentPath, key } = path;\n parentPath;\n { parentPath, key } = parentPath\n ) {\n if (parentPath.isFunctionParent()) return false;\n if (\n (key === \"left\" && parentPath.isForXStatement()) ||\n (isFunctionDeclarationOrHasInit && key === \"body\" && parentPath.isLoop())\n ) {\n return true;\n }\n }\n return false;\n}\n"],"mappings":";;;;;;AAwBe,MAAMA,OAAO,CAAC;EAM3BC,WAAWA,CAAC;IACVC,UAAU;IACVC,KAAK;IACLC,IAAI;IACJC;EAMF,CAAC,EAAE;IAAA,KAfHH,UAAU;IAAA,KACVC,KAAK;IAAA,KACLC,IAAI;IAAA,KACJC,IAAI;IAAA,KAyBJC,kBAAkB,GAAe,EAAE;IAAA,KACnCC,QAAQ,GAAY,IAAI;IAAA,KAExBC,cAAc,GAAe,EAAE;IAAA,KAC/BC,UAAU,GAAY,KAAK;IAAA,KAC3BC,UAAU,GAAW,CAAC;IAjBpB,IAAI,CAACR,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAEhB,IAAI,CAACA,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,SAAS,KAAKM,YAAY,CAACP,IAAI,CAAC,EAAE;MAChE,IAAI,CAACQ,QAAQ,CAACR,IAAI,CAAC;IACrB;IAEA,IAAI,CAACS,UAAU,CAAC,CAAC;EACnB;EAaAC,UAAUA,CAAA,EAAG;IACX,IAAI,CAACD,UAAU,CAAC,CAAC;IACjB,IAAI,CAACE,eAAe,GAAG,IAAI;EAC7B;EAEAC,QAAQA,CAACC,KAAU,EAAE;IACnB,IAAI,IAAI,CAACF,eAAe,EAAE;IAC1B,IAAI,CAACG,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACD,KAAK,GAAGA,KAAK;EACpB;EAEAJ,UAAUA,CAAA,EAAG;IACX,IAAI,CAACE,eAAe,GAAG,KAAK;IAC5B,IAAI,CAACG,QAAQ,GAAG,KAAK;IACrB,IAAI,CAACD,KAAK,GAAG,IAAI;EACnB;EAMAL,QAAQA,CAACR,IAAc,EAAE;IACvB,IAAI,CAACG,QAAQ,GAAG,KAAK;IACrB,IAAI,IAAI,CAACD,kBAAkB,CAACa,QAAQ,CAACf,IAAI,CAAC,EAAE;MAC1C;IACF;IACA,IAAI,CAACE,kBAAkB,CAACc,IAAI,CAAChB,IAAI,CAAC;EACpC;EAMAiB,SAASA,CAACjB,IAAc,EAAE;IACxB,IAAI,IAAI,CAACI,cAAc,CAACW,QAAQ,CAACf,IAAI,CAAC,EAAE;MACtC;IACF;IACA,IAAI,CAACK,UAAU,GAAG,IAAI;IACtB,IAAI,CAACC,UAAU,EAAE;IACjB,IAAI,CAACF,cAAc,CAACY,IAAI,CAAChB,IAAI,CAAC;EAChC;EAMAkB,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACZ,UAAU,EAAE;IACjB,IAAI,CAACD,UAAU,GAAG,CAAC,CAAC,IAAI,CAACC,UAAU;EACrC;AACF;AAACa,OAAA,CAAAC,OAAA,GAAAxB,OAAA;AAED,SAASW,YAAYA,CAACP,IAAc,EAAE;EACpC,MAAMqB,8BAA8B,GAClC,CAACrB,IAAI,CAACsB,oBAAoB,CAAC,CAAC,IAAItB,IAAI,CAACuB,IAAI,CAACC,IAAI;EAChD,KACE,IAAI;IAAEC,UAAU;IAAEC;EAAI,CAAC,GAAG1B,IAAI,EAC9ByB,UAAU,EACV;IAAEA,UAAU;IAAEC;EAAI,CAAC,GAAGD,UAAU,EAChC;IACA,IAAIA,UAAU,CAACE,gBAAgB,CAAC,CAAC,EAAE,OAAO,KAAK;IAC/C,IACGD,GAAG,KAAK,MAAM,IAAID,UAAU,CAACG,eAAe,CAAC,CAAC,IAC9CP,8BAA8B,IAAIK,GAAG,KAAK,MAAM,IAAID,UAAU,CAACI,MAAM,CAAC,CAAE,EACzE;MACA,OAAO,IAAI;IACb;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]} \ No newline at end of file diff --git a/node_modules/@babel/traverse/lib/scope/index.js b/node_modules/@babel/traverse/lib/scope/index.js new file mode 100644 index 0000000..a607471 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/index.js @@ -0,0 +1,1018 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _renamer = require("./lib/renamer.js"); +var _index = require("../index.js"); +var _traverseForScope = require("./traverseForScope.js"); +var _binding = require("./binding.js"); +var _t = require("@babel/types"); +var t = _t; +var _cache = require("../cache.js"); +const globalsBuiltinLower = require("@babel/helper-globals/data/builtin-lower.json"), + globalsBuiltinUpper = require("@babel/helper-globals/data/builtin-upper.json"); +const { + 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, + isObjectProperty, + isTopicReference, + isMetaProperty, + isPrivateName, + isExportDeclaration, + buildUndefinedNode, + sequenceExpression +} = _t; +function gatherNodeParts(node, parts) { + switch (node == null ? void 0 : node.type) { + default: + if (isImportDeclaration(node) || isExportDeclaration(node)) { + var _node$specifiers; + if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) { + gatherNodeParts(node.source, parts); + } else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length) { + for (const e of node.specifiers) gatherNodeParts(e, parts); + } else if ((isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration) { + gatherNodeParts(node.declaration, parts); + } + } else if (isModuleSpecifier(node)) { + gatherNodeParts(node.local, parts); + } else if (isLiteral(node) && !isNullLiteral(node) && !isRegExpLiteral(node) && !isTemplateLiteral(node)) { + parts.push(node.value); + } + break; + case "MemberExpression": + case "OptionalMemberExpression": + case "JSXMemberExpression": + gatherNodeParts(node.object, parts); + gatherNodeParts(node.property, parts); + break; + case "Identifier": + case "JSXIdentifier": + parts.push(node.name); + break; + case "CallExpression": + case "OptionalCallExpression": + case "NewExpression": + gatherNodeParts(node.callee, parts); + break; + case "ObjectExpression": + case "ObjectPattern": + for (const e of node.properties) { + gatherNodeParts(e, parts); + } + break; + case "SpreadElement": + case "RestElement": + gatherNodeParts(node.argument, parts); + break; + case "ObjectProperty": + case "ObjectMethod": + case "ClassProperty": + case "ClassMethod": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + gatherNodeParts(node.key, parts); + break; + case "ThisExpression": + parts.push("this"); + break; + case "Super": + parts.push("super"); + break; + case "Import": + case "ImportExpression": + parts.push("import"); + break; + case "DoExpression": + parts.push("do"); + break; + case "YieldExpression": + parts.push("yield"); + gatherNodeParts(node.argument, parts); + break; + case "AwaitExpression": + parts.push("await"); + gatherNodeParts(node.argument, parts); + break; + case "AssignmentExpression": + gatherNodeParts(node.left, parts); + break; + case "VariableDeclarator": + gatherNodeParts(node.id, parts); + break; + case "FunctionExpression": + case "FunctionDeclaration": + case "ClassExpression": + case "ClassDeclaration": + gatherNodeParts(node.id, parts); + break; + case "PrivateName": + gatherNodeParts(node.id, parts); + break; + case "ParenthesizedExpression": + gatherNodeParts(node.expression, parts); + break; + case "UnaryExpression": + case "UpdateExpression": + gatherNodeParts(node.argument, parts); + break; + case "MetaProperty": + gatherNodeParts(node.meta, parts); + gatherNodeParts(node.property, parts); + break; + case "JSXElement": + gatherNodeParts(node.openingElement, parts); + break; + case "JSXOpeningElement": + gatherNodeParts(node.name, parts); + break; + case "JSXFragment": + gatherNodeParts(node.openingFragment, parts); + break; + case "JSXOpeningFragment": + parts.push("Fragment"); + break; + case "JSXNamespacedName": + gatherNodeParts(node.namespace, parts); + gatherNodeParts(node.name, parts); + break; + } +} +function resetScope(scope) { + scope.references = Object.create(null); + scope.uids = Object.create(null); + scope.bindings = Object.create(null); + scope.globals = Object.create(null); +} +function isAnonymousFunctionExpression(path) { + return path.isFunctionExpression() && !path.node.id || path.isArrowFunctionExpression(); +} +var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); +const collectorVisitor = { + ForStatement(path) { + const declar = path.get("init"); + if (declar.isVar()) { + const { + scope + } = path; + const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", declar); + } + }, + Declaration(path) { + if (path.isBlockScoped()) return; + if (path.isImportDeclaration()) return; + if (path.isExportDeclaration()) return; + const parent = path.scope.getFunctionParent() || path.scope.getProgramParent(); + parent.registerDeclaration(path); + }, + ImportDeclaration(path) { + const parent = path.scope.getBlockParent(); + parent.registerDeclaration(path); + }, + TSImportEqualsDeclaration(path) { + const parent = path.scope.getBlockParent(); + parent.registerDeclaration(path); + }, + ReferencedIdentifier(path, state) { + if (t.isTSQualifiedName(path.parent) && path.parent.right === path.node) { + return; + } + if (path.parentPath.isTSImportEqualsDeclaration()) return; + state.references.push(path); + }, + ForXStatement(path, state) { + const left = path.get("left"); + if (left.isPattern() || left.isIdentifier()) { + state.constantViolations.push(path); + } else if (left.isVar()) { + const { + scope + } = path; + const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", left); + } + }, + ExportDeclaration: { + exit(path) { + const { + node, + scope + } = path; + if (isExportAllDeclaration(node)) return; + const declar = node.declaration; + if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) { + const id = declar.id; + if (!id) return; + const binding = scope.getBinding(id.name); + binding == null || binding.reference(path); + } else if (isVariableDeclaration(declar)) { + for (const decl of declar.declarations) { + for (const name of Object.keys(getBindingIdentifiers(decl))) { + const binding = scope.getBinding(name); + binding == null || binding.reference(path); + } + } + } + } + }, + LabeledStatement(path) { + path.scope.getBlockParent().registerDeclaration(path); + }, + AssignmentExpression(path, state) { + state.assignments.push(path); + }, + UpdateExpression(path, state) { + state.constantViolations.push(path); + }, + UnaryExpression(path, state) { + if (path.node.operator === "delete") { + state.constantViolations.push(path); + } + }, + BlockScoped(path) { + let scope = path.scope; + if (scope.path === path) scope = scope.parent; + const parent = scope.getBlockParent(); + parent.registerDeclaration(path); + if (path.isClassDeclaration() && path.node.id) { + const id = path.node.id; + const name = id.name; + path.scope.bindings[name] = path.scope.parent.getBinding(name); + } + }, + CatchClause(path) { + path.scope.registerBinding("let", path); + }, + Function(path) { + const params = path.get("params"); + for (const param of params) { + path.scope.registerBinding("param", param); + } + if (path.isFunctionExpression() && path.node.id && !path.node.id[NOT_LOCAL_BINDING]) { + path.scope.registerBinding("local", path.get("id"), path); + } + }, + ClassExpression(path) { + if (path.node.id && !path.node.id[NOT_LOCAL_BINDING]) { + path.scope.registerBinding("local", path.get("id"), path); + } + }, + TSTypeAnnotation(path) { + path.skip(); + } +}; +let scopeVisitor; +let uid = 0; +class Scope { + constructor(path) { + this.uid = void 0; + this.path = void 0; + this.block = void 0; + this.inited = void 0; + this.labels = void 0; + this.bindings = void 0; + this.referencesSet = void 0; + this.globals = void 0; + this.uidsSet = void 0; + this.data = void 0; + this.crawling = void 0; + const { + node + } = path; + const cached = _cache.scope.get(node); + if ((cached == null ? void 0 : cached.path) === path) { + return cached; + } + _cache.scope.set(node, this); + this.uid = uid++; + this.block = node; + this.path = path; + this.labels = new Map(); + this.inited = false; + Object.defineProperties(this, { + references: { + enumerable: true, + configurable: true, + writable: true, + value: Object.create(null) + }, + uids: { + enumerable: true, + configurable: true, + writable: true, + value: Object.create(null) + } + }); + } + get parent() { + var _parent; + let parent, + path = this.path; + do { + var _path; + const shouldSkip = path.key === "key" || path.listKey === "decorators"; + path = path.parentPath; + if (shouldSkip && path.isMethod()) path = path.parentPath; + if ((_path = path) != null && _path.isScope()) parent = path; + } while (path && !parent); + return (_parent = parent) == null ? void 0 : _parent.scope; + } + get references() { + throw new Error("Scope#references is not available in Babel 8. Use Scope#referencesSet instead."); + } + get uids() { + throw new Error("Scope#uids is not available in Babel 8. Use Scope#uidsSet instead."); + } + generateDeclaredUidIdentifier(name) { + const id = this.generateUidIdentifier(name); + this.push({ + id + }); + return cloneNode(id); + } + generateUidIdentifier(name) { + return identifier(this.generateUid(name)); + } + generateUid(name = "temp") { + name = toIdentifier(name).replace(/^_+/, "").replace(/\d+$/g, ""); + let uid; + let i = 0; + do { + uid = `_${name}`; + if (i >= 11) uid += i - 1;else if (i >= 9) uid += i - 9;else if (i >= 1) uid += i + 1; + i++; + } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); + const program = this.getProgramParent(); + program.references[uid] = true; + program.uids[uid] = true; + return uid; + } + generateUidBasedOnNode(node, defaultName) { + const parts = []; + gatherNodeParts(node, parts); + let id = parts.join("$"); + id = id.replace(/^_/, "") || defaultName || "ref"; + return this.generateUid(id.slice(0, 20)); + } + generateUidIdentifierBasedOnNode(node, defaultName) { + return identifier(this.generateUidBasedOnNode(node, defaultName)); + } + isStatic(node) { + if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) { + return true; + } + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (binding) { + return binding.constant; + } else { + return this.hasBinding(node.name); + } + } + return false; + } + maybeGenerateMemoised(node, dontPush) { + if (this.isStatic(node)) { + return null; + } else { + const id = this.generateUidIdentifierBasedOnNode(node); + if (!dontPush) { + this.push({ + id + }); + return cloneNode(id); + } + return id; + } + } + checkBlockScopedCollisions(local, kind, name, id) { + if (kind === "param") return; + if (local.kind === "local") return; + const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const"; + if (duplicate) { + throw this.path.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError); + } + } + rename(oldName, newName) { + const binding = this.getBinding(oldName); + if (binding) { + newName || (newName = this.generateUidIdentifier(oldName).name); + const renamer = new _renamer.default(binding, oldName, newName); + renamer.rename(arguments[2]); + } + } + dump() { + const sep = "-".repeat(60); + console.log(sep); + let scope = this; + do { + console.log("#", scope.block.type); + for (const name of Object.keys(scope.bindings)) { + const binding = scope.bindings[name]; + console.log(" -", name, { + constant: binding.constant, + references: binding.references, + violations: binding.constantViolations.length, + kind: binding.kind + }); + } + } while (scope = scope.parent); + console.log(sep); + } + hasLabel(name) { + return !!this.getLabel(name); + } + getLabel(name) { + return this.labels.get(name); + } + registerLabel(path) { + this.labels.set(path.node.label.name, path); + } + registerDeclaration(path) { + if (path.isLabeledStatement()) { + this.registerLabel(path); + } else if (path.isFunctionDeclaration()) { + this.registerBinding("hoisted", path.get("id"), path); + } else if (path.isVariableDeclaration()) { + const declarations = path.get("declarations"); + const { + kind + } = path.node; + for (const declar of declarations) { + this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar); + } + } else if (path.isClassDeclaration()) { + if (path.node.declare) return; + this.registerBinding("let", path); + } else if (path.isImportDeclaration()) { + const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof"; + const specifiers = path.get("specifiers"); + for (const specifier of specifiers) { + const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof"); + this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier); + } + } else if (path.isExportDeclaration()) { + const declar = path.get("declaration"); + if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) { + this.registerDeclaration(declar); + } + } else { + this.registerBinding("unknown", path); + } + } + buildUndefinedNode() { + return buildUndefinedNode(); + } + registerConstantViolation(path) { + const ids = path.getAssignmentIdentifiers(); + for (const name of Object.keys(ids)) { + var _this$getBinding; + (_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(path); + } + } + registerBinding(kind, path, bindingPath = path) { + if (!kind) throw new ReferenceError("no `kind`"); + if (path.isVariableDeclaration()) { + const declarators = path.get("declarations"); + for (const declar of declarators) { + this.registerBinding(kind, declar); + } + return; + } + const parent = this.getProgramParent(); + const ids = path.getOuterBindingIdentifiers(true); + for (const name of Object.keys(ids)) { + parent.references[name] = true; + for (const id of ids[name]) { + const local = this.getOwnBinding(name); + if (local) { + if (local.identifier === id) continue; + this.checkBlockScopedCollisions(local, kind, name, id); + } + if (local) { + local.reassign(bindingPath); + } else { + this.bindings[name] = new _binding.default({ + identifier: id, + scope: this, + path: bindingPath, + kind: kind + }); + } + } + } + } + addGlobal(node) { + this.globals[node.name] = node; + } + hasUid(name) { + let scope = this; + do { + if (scope.uids[name]) return true; + } while (scope = scope.parent); + return false; + } + hasGlobal(name) { + let scope = this; + do { + if (scope.globals[name]) return true; + } while (scope = scope.parent); + return false; + } + hasReference(name) { + return !!this.getProgramParent().references[name]; + } + isPure(node, constantsOnly) { + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (!binding) return false; + if (constantsOnly) return binding.constant; + return true; + } else if (isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node)) { + return true; + } else if (isClass(node)) { + var _node$decorators; + if (node.superClass && !this.isPure(node.superClass, constantsOnly)) { + return false; + } + if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) { + return false; + } + return this.isPure(node.body, constantsOnly); + } else if (isClassBody(node)) { + for (const method of node.body) { + if (!this.isPure(method, constantsOnly)) return false; + } + return true; + } else if (isBinary(node)) { + return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); + } else if (isArrayExpression(node) || (node == null ? void 0 : node.type) === "TupleExpression") { + for (const elem of node.elements) { + if (elem !== null && !this.isPure(elem, constantsOnly)) return false; + } + return true; + } else if (isObjectExpression(node) || (node == null ? void 0 : node.type) === "RecordExpression") { + for (const prop of node.properties) { + if (!this.isPure(prop, constantsOnly)) return false; + } + return true; + } else if (isMethod(node)) { + var _node$decorators2; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) { + return false; + } + return true; + } else if (isProperty(node)) { + var _node$decorators3; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) { + return false; + } + if (isObjectProperty(node) || node.static) { + if (node.value !== null && !this.isPure(node.value, constantsOnly)) { + return false; + } + } + return true; + } else if (isUnaryExpression(node)) { + return this.isPure(node.argument, constantsOnly); + } else if (isTemplateLiteral(node)) { + for (const expression of node.expressions) { + if (!this.isPure(expression, constantsOnly)) return false; + } + return true; + } else if (isTaggedTemplateExpression(node)) { + return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", { + noGlobals: true + }) && this.isPure(node.quasi, constantsOnly); + } else if (isMemberExpression(node)) { + return !node.computed && isIdentifier(node.object) && node.object.name === "Symbol" && isIdentifier(node.property) && node.property.name !== "for" && !this.hasBinding("Symbol", { + noGlobals: true + }); + } else if (isCallExpression(node)) { + return matchesPattern(node.callee, "Symbol.for") && !this.hasBinding("Symbol", { + noGlobals: true + }) && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]); + } else { + return isPureish(node); + } + } + setData(key, val) { + return this.data[key] = val; + } + getData(key) { + let scope = this; + do { + const data = scope.data[key]; + if (data != null) return data; + } while (scope = scope.parent); + } + removeData(key) { + let scope = this; + do { + const data = scope.data[key]; + if (data != null) scope.data[key] = null; + } while (scope = scope.parent); + } + init() { + if (!this.inited) { + this.inited = true; + this.crawl(); + } + } + crawl() { + const path = this.path; + resetScope(this); + this.data = Object.create(null); + let scope = this; + do { + if (scope.crawling) return; + if (scope.path.isProgram()) { + break; + } + } while (scope = scope.parent); + const programParent = scope; + const state = { + references: [], + constantViolations: [], + assignments: [] + }; + this.crawling = true; + scopeVisitor || (scopeVisitor = _index.default.visitors.merge([{ + Scope(path) { + resetScope(path.scope); + } + }, collectorVisitor])); + if (path.type !== "Program") { + const typeVisitors = scopeVisitor[path.type]; + if (typeVisitors) { + for (const visit of typeVisitors.enter) { + visit.call(state, path, state); + } + } + } + path.traverse(scopeVisitor, state); + this.crawling = false; + for (const path of state.assignments) { + const ids = path.getAssignmentIdentifiers(); + for (const name of Object.keys(ids)) { + if (path.scope.getBinding(name)) continue; + programParent.addGlobal(ids[name]); + } + path.scope.registerConstantViolation(path); + } + for (const ref of state.references) { + const binding = ref.scope.getBinding(ref.node.name); + if (binding) { + binding.reference(ref); + } else { + programParent.addGlobal(ref.node); + } + } + for (const path of state.constantViolations) { + path.scope.registerConstantViolation(path); + } + } + push(opts) { + let path = this.path; + if (path.isPattern()) { + path = this.getPatternParent().path; + } else if (!path.isBlockStatement() && !path.isProgram()) { + path = this.getBlockParent().path; + } + if (path.isSwitchStatement()) { + path = (this.getFunctionParent() || this.getProgramParent()).path; + } + const { + init, + unique, + kind = "var", + id + } = opts; + if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path) && isCallExpression(path.parent, { + callee: path.node + }) && path.parent.arguments.length <= path.node.params.length && isIdentifier(id)) { + path.pushContainer("params", id); + path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]); + return; + } + if (path.isLoop() || path.isCatchClause() || path.isFunction()) { + path.ensureBlock(); + path = path.get("body"); + } + const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; + const dataKey = `declaration:${kind}:${blockHoist}`; + let declarPath = !unique && path.getData(dataKey); + if (!declarPath) { + const declar = variableDeclaration(kind, []); + declar._blockHoist = blockHoist; + [declarPath] = path.unshiftContainer("body", [declar]); + if (!unique) path.setData(dataKey, declarPath); + } + const declarator = variableDeclarator(id, init); + const len = declarPath.node.declarations.push(declarator); + path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]); + } + getProgramParent() { + let scope = this; + do { + if (scope.path.isProgram()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("Couldn't find a Program"); + } + getFunctionParent() { + let scope = this; + do { + if (scope.path.isFunctionParent()) { + return scope; + } + } while (scope = scope.parent); + return null; + } + getBlockParent() { + let scope = this; + do { + if (scope.path.isBlockParent()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + } + getPatternParent() { + let scope = this; + do { + if (!scope.path.isPattern()) { + return scope.getBlockParent(); + } + } while (scope = scope.parent.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + } + getAllBindings() { + const ids = Object.create(null); + let scope = this; + do { + for (const key of Object.keys(scope.bindings)) { + if (key in ids === false) { + ids[key] = scope.bindings[key]; + } + } + scope = scope.parent; + } while (scope); + return ids; + } + bindingIdentifierEquals(name, node) { + return this.getBindingIdentifier(name) === node; + } + getBinding(name) { + let scope = this; + let previousPath; + do { + const binding = scope.getOwnBinding(name); + if (binding) { + var _previousPath; + if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else { + return binding; + } + } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) { + break; + } + previousPath = scope.path; + } while (scope = scope.parent); + } + getOwnBinding(name) { + return this.bindings[name]; + } + getBindingIdentifier(name) { + var _this$getBinding2; + return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier; + } + getOwnBindingIdentifier(name) { + const binding = this.bindings[name]; + return binding == null ? void 0 : binding.identifier; + } + hasOwnBinding(name) { + return !!this.getOwnBinding(name); + } + hasBinding(name, opts) { + if (!name) return false; + let noGlobals; + let noUids; + let upToScope; + if (typeof opts === "object") { + noGlobals = opts.noGlobals; + noUids = opts.noUids; + upToScope = opts.upToScope; + } else if (typeof opts === "boolean") { + noGlobals = opts; + } + let scope = this; + do { + if (upToScope === scope) { + break; + } + if (scope.hasOwnBinding(name)) { + return true; + } + } while (scope = scope.parent); + if (!noUids && this.hasUid(name)) return true; + if (!noGlobals && Scope.globals.includes(name)) return true; + if (!noGlobals && Scope.contextVariables.includes(name)) return true; + return false; + } + parentHasBinding(name, opts) { + var _this$parent; + return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts); + } + moveBindingTo(name, scope) { + const info = this.getBinding(name); + if (info) { + info.scope.removeOwnBinding(name); + info.scope = scope; + scope.bindings[name] = info; + } + } + removeOwnBinding(name) { + delete this.bindings[name]; + } + removeBinding(name) { + var _this$getBinding3; + (_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name); + let scope = this; + do { + if (scope.uids[name]) { + scope.uids[name] = false; + } + } while (scope = scope.parent); + } + hoistVariables(emit = id => this.push({ + id + })) { + this.crawl(); + const seen = new Set(); + for (const name of Object.keys(this.bindings)) { + const binding = this.bindings[name]; + if (!binding) continue; + const { + path + } = binding; + if (!path.isVariableDeclarator()) continue; + const { + parent, + parentPath + } = path; + if (parent.kind !== "var" || seen.has(parent)) continue; + seen.add(path.parent); + let firstId; + const init = []; + for (const decl of parent.declarations) { + firstId != null ? firstId : firstId = decl.id; + if (decl.init) { + init.push(assignmentExpression("=", decl.id, decl.init)); + } + const ids = Object.keys(getBindingIdentifiers(decl, false, true, true)); + for (const name of ids) { + emit(identifier(name), decl.init != null); + } + } + if (parentPath.parentPath.isForXStatement({ + left: parent + })) { + parentPath.replaceWith(firstId); + } else if (init.length === 0) { + parentPath.remove(); + } else { + const expr = init.length === 1 ? init[0] : sequenceExpression(init); + if (parentPath.parentPath.isForStatement({ + init: parent + })) { + parentPath.replaceWith(expr); + } else { + parentPath.replaceWith(expressionStatement(expr)); + } + } + } + } +} +exports.default = Scope; +Scope.globals = [...globalsBuiltinLower, ...globalsBuiltinUpper]; +Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; +Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { + if (map[oldName]) { + map[newName] = value; + map[oldName] = null; + } +}; +Scope.prototype.traverse = function (node, opts, state) { + (0, _index.default)(node, opts, this, state, this.path); +}; +Scope.prototype._generateUid = function _generateUid(name, i) { + let id = name; + if (i > 1) id += i; + return `_${id}`; +}; +Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) { + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (binding != null && binding.constant && binding.path.isGenericType("Array")) { + return node; + } + } + if (isArrayExpression(node)) { + return node; + } + if (isIdentifier(node, { + name: "arguments" + })) { + return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]); + } + let helperName; + const args = [node]; + if (i === true) { + helperName = "toConsumableArray"; + } else if (typeof i === "number") { + args.push(numericLiteral(i)); + helperName = "slicedToArray"; + } else { + helperName = "toArray"; + } + if (arrayLikeIsIterable) { + args.unshift(this.path.hub.addHelper(helperName)); + helperName = "maybeArrayLike"; + } + return callExpression(this.path.hub.addHelper(helperName), args); +}; +Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) { + const ids = Object.create(null); + for (const kind of kinds) { + let scope = this; + do { + for (const name of Object.keys(scope.bindings)) { + const binding = scope.bindings[name]; + if (binding.kind === kind) ids[name] = binding; + } + scope = scope.parent; + } while (scope); + } + return ids; +}; +Object.defineProperties(Scope.prototype, { + parentBlock: { + configurable: true, + enumerable: true, + get() { + return this.path.parent; + } + }, + hub: { + configurable: true, + enumerable: true, + get() { + return this.path.hub; + } + } +}); + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/traverse/lib/scope/index.js.map b/node_modules/@babel/traverse/lib/scope/index.js.map new file mode 100644 index 0000000..8123c6a --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_renamer","require","_index","_traverseForScope","_binding","_t","t","_cache","globalsBuiltinLower","globalsBuiltinUpper","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","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","resetScope","scope","references","Object","create","uids","bindings","globals","isAnonymousFunctionExpression","path","isFunctionExpression","isArrowFunctionExpression","NOT_LOCAL_BINDING","Symbol","for","collectorVisitor","ForStatement","declar","get","isVar","parentScope","getFunctionParent","getProgramParent","registerBinding","Declaration","isBlockScoped","parent","registerDeclaration","ImportDeclaration","getBlockParent","TSImportEqualsDeclaration","ReferencedIdentifier","state","isTSQualifiedName","right","parentPath","isTSImportEqualsDeclaration","ForXStatement","isPattern","constantViolations","ExportDeclaration","exit","binding","getBinding","reference","decl","declarations","keys","LabeledStatement","AssignmentExpression","assignments","UpdateExpression","UnaryExpression","operator","BlockScoped","CatchClause","Function","params","param","ClassExpression","TSTypeAnnotation","skip","scopeVisitor","uid","Scope","constructor","block","inited","labels","referencesSet","uidsSet","data","crawling","cached","scopeCache","set","Map","defineProperties","enumerable","configurable","writable","_parent","_path","shouldSkip","listKey","isScope","Error","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","elem","elements","prop","_node$decorators2","computed","_node$decorators3","static","expressions","tag","noGlobals","quasi","isStringLiteral","setData","val","getData","removeData","init","crawl","isProgram","programParent","traverse","visitors","merge","typeVisitors","visit","enter","call","ref","opts","getPatternParent","isBlockStatement","isSwitchStatement","unique","pushContainer","isLoop","isCatchClause","isFunction","ensureBlock","blockHoist","_blockHoist","dataKey","declarPath","unshiftContainer","declarator","len","isFunctionParent","isBlockParent","getAllBindings","bindingIdentifierEquals","getBindingIdentifier","previousPath","_previousPath","_this$getBinding2","getOwnBindingIdentifier","hasOwnBinding","noUids","upToScope","includes","contextVariables","parentHasBinding","_this$parent","moveBindingTo","info","removeOwnBinding","removeBinding","_this$getBinding3","hoistVariables","emit","seen","Set","isVariableDeclarator","has","add","firstId","isForXStatement","replaceWith","remove","expr","isForStatement","exports","default","prototype","_renameFromMap","map","_generateUid","toArray","arrayLikeIsIterable","isGenericType","helperName","args","unshift","addHelper","getAllBindingsOfKind","kinds","parentBlock"],"sources":["../../src/scope/index.ts"],"sourcesContent":["import Renamer from \"./lib/renamer.ts\";\nimport type NodePath from \"../path/index.ts\";\nimport traverse from \"../index.ts\";\nimport traverseForScope from \"./traverseForScope.ts\";\nimport Binding from \"./binding.ts\";\nimport type { BindingKind } from \"./binding.ts\";\nimport globalsBuiltinLower from \"@babel/helper-globals/data/builtin-lower.json\" with { type: \"json\" };\nimport globalsBuiltinUpper from \"@babel/helper-globals/data/builtin-upper.json\" with { type: \"json\" };\nimport {\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 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 { ExplodedVisitor, Visitor } from \"../types.ts\";\n\nexport type { BindingKind };\n\ntype NodePart = string | number | bigint | boolean;\n// Recursively gathers the identifying names of a node.\nfunction gatherNodeParts(node: t.Node | null | undefined, 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 case \"ImportExpression\":\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\nfunction resetScope(scope: Scope) {\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-expect-error(Babel 7 vs Babel 8)\n scope.references = Object.create(null);\n // @ts-expect-error(Babel 7 vs Babel 8)\n scope.uids = Object.create(null);\n } else if (scope.path.type === \"Program\") {\n scope.referencesSet = new Set();\n scope.uidsSet = new Set();\n }\n\n scope.bindings = Object.create(null);\n scope.globals = Object.create(null);\n}\n\nfunction isAnonymousFunctionExpression(\n path: NodePath,\n): path is NodePath {\n return (\n (path.isFunctionExpression() && !path.node.id) ||\n path.isArrowFunctionExpression()\n );\n}\n\ninterface CollectVisitorState {\n assignments: NodePath[];\n references: NodePath[];\n constantViolations: NodePath[];\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var NOT_LOCAL_BINDING = Symbol.for(\n \"should not be considered a local binding\",\n );\n}\n\nconst collectorVisitor: Visitor = {\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 TSImportEqualsDeclaration(path) {\n const parent = path.scope.getBlockParent();\n\n parent.registerDeclaration(path);\n },\n\n ReferencedIdentifier(path, state) {\n if (t.isTSQualifiedName(path.parent) && path.parent.right === path.node) {\n return;\n }\n if (path.parentPath.isTSImportEqualsDeclaration()) return;\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: 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 = 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 (process.env.BABEL_8_BREAKING ||\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING])\n ) {\n path.scope.registerBinding(\n \"local\",\n path.get(\"id\") as NodePath,\n path,\n );\n }\n },\n\n ClassExpression(path) {\n if (\n path.node.id &&\n (process.env.BABEL_8_BREAKING ||\n // @ts-expect-error Fixme: document symbol ast properties\n !path.node.id[NOT_LOCAL_BINDING])\n ) {\n path.scope.registerBinding(\n \"local\",\n path.get(\"id\") as NodePath,\n path,\n );\n }\n },\n\n TSTypeAnnotation(path) {\n path.skip();\n },\n};\n\nlet scopeVisitor: ExplodedVisitor;\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!: boolean;\n\n labels!: Map>;\n bindings!: Record;\n /** Only defined in the program scope */\n referencesSet?: Set;\n globals!: Record;\n /** Only defined in the program scope */\n uidsSet?: Set;\n data!: Record;\n crawling!: boolean;\n\n /**\n * This searches the current \"scope\" and collects all references/bindings\n * within.\n */\n constructor(path: NodePath) {\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 if (!process.env.BABEL_8_BREAKING) {\n // Shadow the Babel 8 removal getters\n Object.defineProperties(this, {\n references: {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object.create(null),\n },\n uids: {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object.create(null),\n },\n });\n }\n }\n\n /**\n * Globals.\n */\n\n static globals = [...globalsBuiltinLower, ...globalsBuiltinUpper];\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 references() {\n throw new Error(\n \"Scope#references is not available in Babel 8. Use Scope#referencesSet instead.\",\n );\n }\n\n get uids() {\n throw new Error(\n \"Scope#uids is not available in Babel 8. Use Scope#uidsSet instead.\",\n );\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 = 0;\n do {\n uid = `_${name}`;\n\n // Ideally we would just use (i - 1) as the suffix, but that generates\n // unnecessary changes in every single file generated by Babel :)\n //\n // i: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...\n // suffix: (empty) 2 3 4 5 6 7 8 9 0 1 10 11 12 13 ...\n if (i >= 11) uid += i - 1;\n else if (i >= 9) uid += i - 9;\n else if (i >= 1) uid += i + 1;\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 if (process.env.BABEL_8_BREAKING) {\n program.referencesSet.add(uid);\n program.uidsSet.add(uid);\n } else {\n // @ts-expect-error Babel 7\n program.references[uid] = true;\n // @ts-expect-error Babel 7\n program.uids[uid] = true;\n }\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 | undefined = 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) {\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(\n \"hoisted\",\n path.get(\"id\") as NodePath,\n path,\n );\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 = 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 if (process.env.BABEL_8_BREAKING) {\n parent.referencesSet.add(name);\n } else {\n // @ts-expect-error Babel 7\n parent.references[name] = true;\n }\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 if (process.env.BABEL_8_BREAKING) {\n return this.getProgramParent().uidsSet.has(name);\n } else {\n let scope: Scope | undefined = this;\n\n do {\n // @ts-expect-error Babel 7\n if (scope.uids[name]) return true;\n } while ((scope = scope.parent));\n\n return false;\n }\n }\n\n hasGlobal(name: string): boolean {\n let scope: Scope | undefined = 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 if (process.env.BABEL_8_BREAKING) {\n return this.getProgramParent().referencesSet.has(name);\n } else {\n // @ts-expect-error Babel 7\n return !!this.getProgramParent().references[name];\n }\n }\n\n isPure(node: t.Node | null | undefined, 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 // @ts-expect-error comparing undefined and number\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 (\n isArrayExpression(node) ||\n (!process.env.BABEL_8_BREAKING &&\n // @ts-ignore(Babel 7 vs Babel 8) - Removed in Babel 8\n node?.type === \"TupleExpression\")\n ) {\n // @ts-ignore(Babel 7 vs Babel 8) - TS detects this as t.Node instead of t.ArrayExpression\n for (const elem of node.elements) {\n if (elem !== null && !this.isPure(elem, constantsOnly)) return false;\n }\n return true;\n } else if (\n isObjectExpression(node) ||\n (!process.env.BABEL_8_BREAKING &&\n // @ts-ignore(Babel 7 vs Babel 8) - Removed in Babel 8\n node?.type === \"RecordExpression\")\n ) {\n // @ts-ignore(Babel 7 vs Babel 8) - TS detects this as t.Node instead of t.ObjectExpression\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 // @ts-expect-error comparing undefined and number\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 // @ts-expect-error comparing undefined and number\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 | undefined = 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 | undefined = 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 resetScope(this);\n this.data = Object.create(null);\n\n let scope: Scope | undefined = this;\n do {\n if (scope.crawling) return;\n if (scope.path.isProgram()) {\n break;\n }\n } while ((scope = scope.parent));\n\n const programParent = scope!;\n\n const state: CollectVisitorState = {\n references: [],\n constantViolations: [],\n assignments: [],\n };\n\n this.crawling = true;\n scopeVisitor ||= traverse.visitors.merge([\n {\n Scope(path) {\n resetScope(path.scope);\n },\n },\n collectorVisitor,\n ]);\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\") {\n const typeVisitors = scopeVisitor[path.type];\n if (typeVisitors) {\n for (const visit of typeVisitors.enter!) {\n visit.call(state, path, state);\n }\n }\n }\n if (process.env.BABEL_8_BREAKING) {\n traverseForScope(path, scopeVisitor, state);\n } else {\n path.traverse(scopeVisitor, state);\n }\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 isAnonymousFunctionExpression(path) &&\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).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(): Scope & {\n referencesSet: Set;\n uidsSet: Set;\n } {\n let scope: Scope | undefined = this;\n do {\n if (scope.path.isProgram()) {\n return scope as Scope & {\n referencesSet: Set;\n uidsSet: Set;\n };\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 | undefined = 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 | undefined = 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 | undefined = 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 {\n const ids = Object.create(null);\n\n let scope: Scope | undefined = 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 | undefined = 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 getBindingIdentifier(name: string): t.Identifier | undefined {\n return this.getBinding(name)?.identifier;\n }\n\n getOwnBindingIdentifier(name: string): t.Identifier | undefined {\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?:\n | boolean\n | { noGlobals?: boolean; noUids?: boolean; upToScope?: Scope },\n ) {\n if (!name) return false;\n // TODO: Only accept the object form.\n let noGlobals;\n let noUids;\n let upToScope;\n if (typeof opts === \"object\") {\n noGlobals = opts.noGlobals;\n noUids = opts.noUids;\n upToScope = opts.upToScope;\n } else if (typeof opts === \"boolean\") {\n noGlobals = opts;\n }\n let scope: Scope | undefined = this;\n do {\n if (upToScope === scope) {\n break;\n }\n if (scope.hasOwnBinding(name)) {\n return true;\n }\n } while ((scope = scope.parent));\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 if (process.env.BABEL_8_BREAKING) {\n this.getProgramParent().uidsSet.delete(name);\n } else {\n let scope: Scope | undefined = this;\n do {\n // @ts-expect-error Babel 7\n if (scope.uids[name]) {\n // @ts-expect-error Babel 7\n scope.uids[name] = false;\n }\n } while ((scope = scope.parent));\n }\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(\n assignmentExpression(\n \"=\",\n // var declarator must not be a void pattern\n decl.id as Exclude,\n decl.init,\n ),\n );\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.isForXStatement({ left: parent })) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\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,\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 (\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 {\n const ids = Object.create(null);\n\n for (const kind of kinds) {\n let scope: Scope | undefined = this;\n do {\n for (const name of Object.keys(scope.bindings)) {\n const binding = scope.bindings[name];\n if (binding.kind === kind) ids[name] = binding;\n }\n scope = scope.parent;\n } while (scope);\n }\n\n return ids;\n };\n\n Object.defineProperties(Scope.prototype, {\n parentBlock: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.parent;\n },\n },\n hub: {\n configurable: true,\n enumerable: true,\n get(this: Scope) {\n return this.path.hub;\n },\n },\n });\n}\n\ntype _Binding = Binding;\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Scope {\n export type Binding = _Binding;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,EAAA,GAAAJ,OAAA;AA+CsB,IAAAK,CAAA,GAAAD,EAAA;AAEtB,IAAAE,MAAA,GAAAN,OAAA;AAAkD,MAnD3CO,mBAAmB,GAAAP,OAAA,CAAM,+CAA+C;EACxEQ,mBAAmB,GAAAR,OAAA,CAAM,+CAA+C;AAAA;EAE7ES,oBAAoB;EACpBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,UAAU;EACVC,iBAAiB;EACjBC,QAAQ;EACRC,gBAAgB;EAChBC,OAAO;EACPC,WAAW;EACXC,kBAAkB;EAClBC,sBAAsB;EACtBC,0BAA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ACf,OAAO,IAAI,CAACT,IAAI,CAACiB,MAAM;IACzB;EACF,CAAC;EACDmF,GAAG,EAAE;IACH9B,YAAY,EAAE,IAAI;IAClBD,UAAU,EAAE,IAAI;IAChB5D,GAAGA,CAAA,EAAc;MACf,OAAO,IAAI,CAACT,IAAI,CAACoG,GAAG;IACtB;EACF;AACF,CAAC,CAAC","ignoreList":[]} \ No newline at end of file diff --git a/node_modules/@babel/traverse/lib/scope/lib/renamer.js b/node_modules/@babel/traverse/lib/scope/lib/renamer.js new file mode 100644 index 0000000..39c5ce1 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/lib/renamer.js @@ -0,0 +1,132 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var t = require("@babel/types"); +var _t = t; +var _traverseNode = require("../../traverse-node.js"); +var _visitors = require("../../visitors.js"); +var _context = require("../../path/context.js"); +const { + getAssignmentIdentifiers +} = _t; +const renameVisitor = { + ReferencedIdentifier({ + node + }, state) { + if (node.name === state.oldName) { + node.name = state.newName; + } + }, + Scope(path, state) { + if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) { + path.skip(); + if (path.isMethod()) { + if (!path.requeueComputedKeyAndDecorators) { + _context.requeueComputedKeyAndDecorators.call(path); + } else { + path.requeueComputedKeyAndDecorators(); + } + } + if (path.isSwitchStatement()) { + path.context.maybeQueue(path.get("discriminant")); + } + } + }, + ObjectProperty({ + node, + scope + }, state) { + const { + name + } = node.key; + if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) { + var _node$extra; + node.shorthand = false; + if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; + } + }, + "AssignmentExpression|Declaration|VariableDeclarator"(path, state) { + if (path.isVariableDeclaration()) return; + const ids = path.isAssignmentExpression() ? getAssignmentIdentifiers(path.node) : path.getOuterBindingIdentifiers(); + for (const name in ids) { + if (name === state.oldName) ids[name].name = state.newName; + } + } +}; +class Renamer { + constructor(binding, oldName, newName) { + this.newName = newName; + this.oldName = oldName; + this.binding = binding; + } + maybeConvertFromExportDeclaration(parentDeclar) { + const maybeExportDeclar = parentDeclar.parentPath; + if (!maybeExportDeclar.isExportDeclaration()) { + return; + } + if (maybeExportDeclar.isExportDefaultDeclaration()) { + const { + declaration + } = maybeExportDeclar.node; + if (t.isDeclaration(declaration) && !declaration.id) { + return; + } + } + if (maybeExportDeclar.isExportAllDeclaration()) { + return; + } + maybeExportDeclar.splitExportDeclaration(); + } + maybeConvertFromClassFunctionDeclaration(path) { + return path; + } + maybeConvertFromClassFunctionExpression(path) { + return path; + } + rename() { + const { + binding, + oldName, + newName + } = this; + const { + scope, + path + } = binding; + const parentDeclar = path.find(path => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression()); + if (parentDeclar) { + const bindingIds = parentDeclar.getOuterBindingIdentifiers(); + if (bindingIds[oldName] === binding.identifier) { + this.maybeConvertFromExportDeclaration(parentDeclar); + } + } + const blockToTraverse = arguments[0] || scope.block; + const skipKeys = { + discriminant: true + }; + if (t.isMethod(blockToTraverse)) { + if (blockToTraverse.computed) { + skipKeys.key = true; + } + if (!t.isObjectMethod(blockToTraverse)) { + skipKeys.decorators = true; + } + } + (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, skipKeys); + if (!arguments[0]) { + scope.removeOwnBinding(oldName); + scope.bindings[newName] = binding; + this.binding.identifier.name = newName; + } + if (parentDeclar) { + this.maybeConvertFromClassFunctionDeclaration(path); + this.maybeConvertFromClassFunctionExpression(path); + } + } +} +exports.default = Renamer; + +//# sourceMappingURL=renamer.js.map diff --git a/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map b/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map new file mode 100644 index 0000000..6b600e3 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map @@ -0,0 +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","isSwitchStatement","context","maybeQueue","get","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 = {\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 if (path.isSwitchStatement()) {\n path.context.maybeQueue(path.get(\"discriminant\"));\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 = { 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.maybeConvert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ACrB;MACA,IAAI,CAAC7B,CAAC,CAACiE,cAAc,CAACN,eAAe,CAAC,EAAE;QACtCG,QAAQ,CAACI,UAAU,GAAG,IAAI;MAC5B;IACF;IAEA,IAAAC,0BAAY,EACVR,eAAe,EACf,IAAAS,iBAAO,EAAC7D,aAAa,CAAC,EACtBS,KAAK,EACL,IAAI,EACJA,KAAK,CAACD,IAAI,EACV+C,QACF,CAAC;IAMM,IAAI,CAACF,SAAS,CAAC,CAAC,CAAC,EAAE;MACxB5C,KAAK,CAACqD,gBAAgB,CAACzD,OAAO,CAAC;MAC/BI,KAAK,CAACsD,QAAQ,CAACzD,OAAO,CAAC,GAAGK,OAAO;MACjC,IAAI,CAACA,OAAO,CAACC,UAAU,CAACR,IAAI,GAAGE,OAAO;IACxC;IAEA,IAAI6B,YAAY,EAAE;MAChB,IAAI,CAACU,wCAAwC,CAACrC,IAAI,CAAC;MACnD,IAAI,CAACsC,uCAAuC,CAACtC,IAAI,CAAC;IACpD;EACF;AACF;AAACwD,OAAA,CAAAC,OAAA,GAAAjC,OAAA","ignoreList":[]} \ No newline at end of file diff --git a/node_modules/@babel/traverse/lib/scope/traverseForScope.js b/node_modules/@babel/traverse/lib/scope/traverseForScope.js new file mode 100644 index 0000000..9caac02 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/traverseForScope.js @@ -0,0 +1,66 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = traverseForScope; +var _t = require("@babel/types"); +var _index = require("../index.js"); +var _visitors = require("../visitors.js"); +var _context = require("../path/context.js"); +const { + VISITOR_KEYS +} = _t; +function traverseForScope(path, visitors, state) { + const exploded = (0, _visitors.explode)(visitors); + if (exploded.enter || exploded.exit) { + throw new Error("Should not be used with enter/exit visitors."); + } + _traverse(path.parentPath, path.parent, path.node, path.container, path.key, path.listKey, path.hub, path); + function _traverse(parentPath, parent, node, container, key, listKey, hub, inPath) { + if (!node) { + return; + } + const path = inPath || _index.NodePath.get({ + hub, + parentPath, + parent, + container, + listKey, + key + }); + _context._forceSetScope.call(path); + const visitor = exploded[node.type]; + if (visitor != null && visitor.enter) { + for (const visit of visitor.enter) { + visit.call(state, path, state); + } + } + if (path.shouldSkip) { + return; + } + const keys = VISITOR_KEYS[node.type]; + if (!(keys != null && keys.length)) { + return; + } + for (const key of keys) { + const prop = node[key]; + if (!prop) continue; + if (Array.isArray(prop)) { + for (let i = 0; i < prop.length; i++) { + const value = prop[i]; + _traverse(path, node, value, prop, i, key); + } + } else { + _traverse(path, node, prop, node, key, null); + } + } + if (visitor != null && visitor.exit) { + for (const visit of visitor.exit) { + visit.call(state, path, state); + } + } + } +} + +//# sourceMappingURL=traverseForScope.js.map diff --git a/node_modules/@babel/traverse/lib/scope/traverseForScope.js.map b/node_modules/@babel/traverse/lib/scope/traverseForScope.js.map new file mode 100644 index 0000000..c3817a6 --- /dev/null +++ b/node_modules/@babel/traverse/lib/scope/traverseForScope.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","inPath","NodePath","get","_forceSetScope","call","visitor","type","visit","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { _forceSetScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container!,\n path.key!,\n path.listKey,\n path.hub,\n path,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string | null | undefined,\n hub?: HubInterface,\n inPath?: NodePath,\n ) {\n if (!node) {\n return;\n }\n\n const path =\n inPath ||\n NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n _forceSetScope.call(path);\n\n const visitor = exploded[node.type];\n if (visitor?.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n\n if (visitor?.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAoD;EAL3CI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,QAAiB,EACjBC,KAAU,EACV;EACA,MAAMC,QAAQ,GAAG,IAAAC,iBAAO,EAACH,QAAQ,CAAC;EAElC,IAAIE,QAAQ,CAACE,KAAK,IAAIF,QAAQ,CAACG,IAAI,EAAE;IACnC,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEAC,SAAS,CACPR,IAAI,CAACS,UAAU,EACfT,IAAI,CAACU,MAAM,EACXV,IAAI,CAACW,IAAI,EACTX,IAAI,CAACY,SAAS,EACdZ,IAAI,CAACa,GAAG,EACRb,IAAI,CAACc,OAAO,EACZd,IAAI,CAACe,GAAG,EACRf,IACF,CAAC;EAED,SAAS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