summaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-transform-block-scoping
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/plugin-transform-block-scoping')
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/LICENSE22
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/README.md19
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js101
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js.map1
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/index.js185
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/index.js.map1
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/loop.js294
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map1
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/validation.js133
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/lib/validation.js.map1
-rw-r--r--node_modules/@babel/plugin-transform-block-scoping/package.json35
11 files changed, 793 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-transform-block-scoping/LICENSE b/node_modules/@babel/plugin-transform-block-scoping/LICENSE
new file mode 100644
index 00000000..f31575ec
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2014-present Sebastian McKenzie and other contributors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@babel/plugin-transform-block-scoping/README.md b/node_modules/@babel/plugin-transform-block-scoping/README.md
new file mode 100644
index 00000000..5750b906
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/README.md
@@ -0,0 +1,19 @@
+# @babel/plugin-transform-block-scoping
+
+> Compile ES2015 block scoping (const and let) to ES5
+
+See our website [@babel/plugin-transform-block-scoping](https://babeljs.io/docs/babel-plugin-transform-block-scoping) for more information.
+
+## Install
+
+Using npm:
+
+```sh
+npm install --save-dev @babel/plugin-transform-block-scoping
+```
+
+or using yarn:
+
+```sh
+yarn add @babel/plugin-transform-block-scoping --dev
+```
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js b/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js
new file mode 100644
index 00000000..5464912f
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js
@@ -0,0 +1,101 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.annexB33FunctionsVisitor = void 0;
+exports.isVarScope = isVarScope;
+var _core = require("@babel/core");
+const annexB33FunctionsVisitor = {
+ VariableDeclaration(path) {
+ if (isStrict(path)) return;
+ if (path.node.kind !== "var") return;
+ const varScope = path.scope.getFunctionParent() || path.scope.getProgramParent();
+ varScope.path.traverse(functionsToVarVisitor, {
+ names: Object.keys(path.getBindingIdentifiers())
+ });
+ },
+ BlockStatement(path) {
+ if (isStrict(path)) return;
+ if (_core.types.isFunction(path.parent, {
+ body: path.node
+ })) return;
+ transformStatementList(path.get("body"));
+ },
+ SwitchCase(path) {
+ if (isStrict(path)) return;
+ transformStatementList(path.get("consequent"));
+ }
+};
+exports.annexB33FunctionsVisitor = annexB33FunctionsVisitor;
+function transformStatementList(paths) {
+ outer: for (const path of paths) {
+ if (!path.isFunctionDeclaration()) continue;
+ if (path.node.async || path.node.generator) return;
+ const {
+ scope
+ } = path.parentPath;
+ if (isVarScope(scope)) return;
+ const {
+ name
+ } = path.node.id;
+ let currScope = scope;
+ do {
+ if (currScope.parent.hasOwnBinding(name)) continue outer;
+ currScope = currScope.parent;
+ } while (!isVarScope(currScope));
+ maybeTransformBlockScopedFunction(path);
+ }
+}
+function maybeTransformBlockScopedFunction(path) {
+ const {
+ node,
+ parentPath: {
+ scope
+ }
+ } = path;
+ const {
+ id
+ } = node;
+ scope.removeOwnBinding(id.name);
+ node.id = null;
+ const varNode = _core.types.variableDeclaration("var", [_core.types.variableDeclarator(id, _core.types.toExpression(node))]);
+ varNode._blockHoist = 2;
+ const [varPath] = path.replaceWith(varNode);
+ scope.registerDeclaration(varPath);
+}
+const functionsToVarVisitor = {
+ Scope(path, {
+ names
+ }) {
+ for (const name of names) {
+ const binding = path.scope.getOwnBinding(name);
+ if (binding && binding.kind === "hoisted") {
+ maybeTransformBlockScopedFunction(binding.path);
+ }
+ }
+ },
+ "Expression|Declaration"(path) {
+ path.skip();
+ }
+};
+function isVarScope(scope) {
+ return scope.path.isFunctionParent() || scope.path.isProgram();
+}
+function isStrict(path) {
+ return !!path.find(({
+ node
+ }) => {
+ var _node$directives;
+ if (_core.types.isProgram(node)) {
+ if (node.sourceType === "module") return true;
+ } else if (_core.types.isClass(node)) {
+ return true;
+ } else if (!_core.types.isBlockStatement(node)) {
+ return false;
+ }
+ return (_node$directives = node.directives) == null ? void 0 : _node$directives.some(directive => directive.value.value === "use strict");
+ });
+}
+
+//# sourceMappingURL=annex-B_3_3.js.map
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js.map b/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js.map
new file mode 100644
index 00000000..b69793b3
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/annex-B_3_3.js.map
@@ -0,0 +1 @@
+{"version":3,"names":["_core","require","annexB33FunctionsVisitor","VariableDeclaration","path","isStrict","node","kind","varScope","scope","getFunctionParent","getProgramParent","traverse","functionsToVarVisitor","names","Object","keys","getBindingIdentifiers","BlockStatement","t","isFunction","parent","body","transformStatementList","get","SwitchCase","exports","paths","outer","isFunctionDeclaration","async","generator","parentPath","isVarScope","name","id","currScope","hasOwnBinding","maybeTransformBlockScopedFunction","removeOwnBinding","varNode","variableDeclaration","variableDeclarator","toExpression","_blockHoist","varPath","replaceWith","registerDeclaration","Scope","binding","getOwnBinding","Expression|Declaration","skip","isFunctionParent","isProgram","find","_node$directives","sourceType","isClass","isBlockStatement","directives","some","directive","value"],"sources":["../src/annex-B_3_3.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { NodePath, Visitor, Scope } from \"@babel/traverse\";\n\n// Whenever a function declaration in a nested block scope\n// doesn't conflict with a block-scoped binding from an outer\n// scope, we transform it to a variable declaration.\n//\n// This implements the Annex B.3.3 behavior.\n//\n// TODO(Babel 8): Figure out how this should interact with\n// the transform-block-scoped functions plugin (it feels\n// wrong to handle this transform here), and what we want\n// to do with Annex B behavior in general.\n\n// To avoid confusing block-scoped variables transformed to\n// var with original vars, this transformation happens in two\n// different places:\n// 1. For functions that \"conflict\" with var-variables, in\n// the VariableDeclaration visitor.\n// 2. For functions that don't conflict with any variable,\n// in the FunctionDeclaration visitor.\n\nexport const annexB33FunctionsVisitor: Visitor = {\n VariableDeclaration(path) {\n if (isStrict(path)) return;\n if (path.node.kind !== \"var\") return;\n\n const varScope =\n path.scope.getFunctionParent() || path.scope.getProgramParent();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n varScope.path.traverse(functionsToVarVisitor, {\n names: Object.keys(path.getBindingIdentifiers()),\n });\n },\n\n // NOTE: These two visitors target the same nodes as the\n // block-scoped-functions plugin\n\n BlockStatement(path) {\n if (isStrict(path)) return;\n if (t.isFunction(path.parent, { body: path.node })) return;\n transformStatementList(path.get(\"body\"));\n },\n\n SwitchCase(path) {\n if (isStrict(path)) return;\n transformStatementList(path.get(\"consequent\"));\n },\n};\n\nfunction transformStatementList(paths: NodePath<t.Statement>[]) {\n outer: for (const path of paths) {\n if (!path.isFunctionDeclaration()) continue;\n // Annex B.3.3 only applies to plain functions.\n if (path.node.async || path.node.generator) return;\n\n const { scope } = path.parentPath;\n if (isVarScope(scope)) return;\n\n const { name } = path.node.id;\n let currScope = scope;\n do {\n if (currScope.parent.hasOwnBinding(name)) continue outer;\n currScope = currScope.parent;\n } while (!isVarScope(currScope));\n\n maybeTransformBlockScopedFunction(path);\n }\n}\n\nfunction maybeTransformBlockScopedFunction(\n path: NodePath<t.FunctionDeclaration>,\n) {\n const {\n node,\n parentPath: { scope },\n } = path;\n\n const { id } = node;\n scope.removeOwnBinding(id.name);\n node.id = null;\n\n const varNode = t.variableDeclaration(\"var\", [\n t.variableDeclarator(id, t.toExpression(node)),\n ]);\n // @ts-expect-error undocumented property\n varNode._blockHoist = 2;\n\n const [varPath] = path.replaceWith(varNode);\n scope.registerDeclaration(varPath);\n}\n\nconst functionsToVarVisitor: Visitor<{ names: string[] }> = {\n Scope(path, { names }) {\n for (const name of names) {\n const binding = path.scope.getOwnBinding(name);\n if (binding && binding.kind === \"hoisted\") {\n maybeTransformBlockScopedFunction(\n binding.path as NodePath<t.FunctionDeclaration>,\n );\n }\n }\n },\n \"Expression|Declaration\"(path) {\n path.skip();\n },\n};\n\nexport function isVarScope(scope: Scope) {\n return scope.path.isFunctionParent() || scope.path.isProgram();\n}\n\nfunction isStrict(path: NodePath) {\n return !!path.find(({ node }) => {\n if (t.isProgram(node)) {\n if (node.sourceType === \"module\") return true;\n } else if (t.isClass(node)) {\n return true;\n } else if (!t.isBlockStatement(node)) {\n return false;\n }\n\n return node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rB,KAAK,MAAMoB,IAAI,IAAIpB,KAAK,EAAE;MACxB,MAAMmC,OAAO,GAAG7C,IAAI,CAACK,KAAK,CAACyC,aAAa,CAAChB,IAAI,CAAC;MAC9C,IAAIe,OAAO,IAAIA,OAAO,CAAC1C,IAAI,KAAK,SAAS,EAAE;QACzC+B,iCAAiC,CAC/BW,OAAO,CAAC7C,IACV,CAAC;MACH;IACF;EACF,CAAC;EACD,wBAAwB+C,CAAC/C,IAAI,EAAE;IAC7BA,IAAI,CAACgD,IAAI,CAAC,CAAC;EACb;AACF,CAAC;AAEM,SAASnB,UAAUA,CAACxB,KAAY,EAAE;EACvC,OAAOA,KAAK,CAACL,IAAI,CAACiD,gBAAgB,CAAC,CAAC,IAAI5C,KAAK,CAACL,IAAI,CAACkD,SAAS,CAAC,CAAC;AAChE;AAEA,SAASjD,QAAQA,CAACD,IAAc,EAAE;EAChC,OAAO,CAAC,CAACA,IAAI,CAACmD,IAAI,CAAC,CAAC;IAAEjD;EAAK,CAAC,KAAK;IAAA,IAAAkD,gBAAA;IAC/B,IAAIrC,WAAC,CAACmC,SAAS,CAAChD,IAAI,CAAC,EAAE;MACrB,IAAIA,IAAI,CAACmD,UAAU,KAAK,QAAQ,EAAE,OAAO,IAAI;IAC/C,CAAC,MAAM,IAAItC,WAAC,CAACuC,OAAO,CAACpD,IAAI,CAAC,EAAE;MAC1B,OAAO,IAAI;IACb,CAAC,MAAM,IAAI,CAACa,WAAC,CAACwC,gBAAgB,CAACrD,IAAI,CAAC,EAAE;MACpC,OAAO,KAAK;IACd;IAEA,QAAAkD,gBAAA,GAAOlD,IAAI,CAACsD,UAAU,qBAAfJ,gBAAA,CAAiBK,IAAI,CAC1BC,SAAS,IAAIA,SAAS,CAACC,KAAK,CAACA,KAAK,KAAK,YACzC,CAAC;EACH,CAAC,CAAC;AACJ"} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/index.js b/node_modules/@babel/plugin-transform-block-scoping/lib/index.js
new file mode 100644
index 00000000..6014ff65
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/index.js
@@ -0,0 +1,185 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+var _helperPluginUtils = require("@babel/helper-plugin-utils");
+var _core = require("@babel/core");
+var _loop = require("./loop.js");
+var _validation = require("./validation.js");
+var _annexB_3_ = require("./annex-B_3_3.js");
+var _default = (0, _helperPluginUtils.declare)((api, opts) => {
+ api.assertVersion(7);
+ const {
+ throwIfClosureRequired = false,
+ tdz: tdzEnabled = false
+ } = opts;
+ if (typeof throwIfClosureRequired !== "boolean") {
+ throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`);
+ }
+ if (typeof tdzEnabled !== "boolean") {
+ throw new Error(`.tdz must be a boolean, or undefined`);
+ }
+ return {
+ name: "transform-block-scoping",
+ visitor: _core.traverse.visitors.merge([_annexB_3_.annexB33FunctionsVisitor, {
+ Loop(path, state) {
+ const isForStatement = path.isForStatement();
+ const headPath = isForStatement ? path.get("init") : path.isForXStatement() ? path.get("left") : null;
+ let needsBodyWrap = false;
+ const markNeedsBodyWrap = () => {
+ if (throwIfClosureRequired) {
+ throw path.buildCodeFrameError("Compiling let/const in this block would add a closure " + "(throwIfClosureRequired).");
+ }
+ needsBodyWrap = true;
+ };
+ const body = path.get("body");
+ let bodyScope;
+ if (body.isBlockStatement()) {
+ bodyScope = body.scope;
+ const bindings = (0, _loop.getLoopBodyBindings)(path);
+ for (const binding of bindings) {
+ const {
+ capturedInClosure
+ } = (0, _loop.getUsageInBody)(binding, path);
+ if (capturedInClosure) markNeedsBodyWrap();
+ }
+ }
+ const captured = [];
+ const updatedBindingsUsages = new Map();
+ if (headPath && isBlockScoped(headPath.node)) {
+ const names = Object.keys(headPath.getBindingIdentifiers());
+ const headScope = headPath.scope;
+ for (let name of names) {
+ var _bodyScope;
+ if ((_bodyScope = bodyScope) != null && _bodyScope.hasOwnBinding(name)) continue;
+ let binding = headScope.getOwnBinding(name);
+ if (!binding) {
+ headScope.crawl();
+ binding = headScope.getOwnBinding(name);
+ }
+ const {
+ usages,
+ capturedInClosure,
+ hasConstantViolations
+ } = (0, _loop.getUsageInBody)(binding, path);
+ if (headScope.parent.hasBinding(name) || headScope.parent.hasGlobal(name)) {
+ const newName = headScope.generateUid(name);
+ headScope.rename(name, newName);
+ name = newName;
+ }
+ if (capturedInClosure) {
+ markNeedsBodyWrap();
+ captured.push(name);
+ }
+ if (isForStatement && hasConstantViolations) {
+ updatedBindingsUsages.set(name, usages);
+ }
+ }
+ }
+ if (needsBodyWrap) {
+ const varPath = (0, _loop.wrapLoopBody)(path, captured, updatedBindingsUsages);
+ if (headPath != null && headPath.isVariableDeclaration()) {
+ transformBlockScopedVariable(headPath, state, tdzEnabled);
+ }
+ varPath.get("declarations.0.init").unwrapFunctionEnvironment();
+ }
+ },
+ VariableDeclaration(path, state) {
+ transformBlockScopedVariable(path, state, tdzEnabled);
+ },
+ ClassDeclaration(path) {
+ const {
+ id
+ } = path.node;
+ if (!id) return;
+ const {
+ scope
+ } = path.parentPath;
+ if (!(0, _annexB_3_.isVarScope)(scope) && scope.parent.hasBinding(id.name, {
+ noUids: true
+ })) {
+ path.scope.rename(id.name);
+ }
+ }
+ }])
+ };
+});
+exports.default = _default;
+const conflictingFunctionsVisitor = {
+ Scope(path, {
+ names
+ }) {
+ for (const name of names) {
+ const binding = path.scope.getOwnBinding(name);
+ if (binding && binding.kind === "hoisted") {
+ path.scope.rename(name);
+ }
+ }
+ },
+ "Expression|Declaration"(path) {
+ path.skip();
+ }
+};
+function transformBlockScopedVariable(path, state, tdzEnabled) {
+ if (!isBlockScoped(path.node)) return;
+ const dynamicTDZNames = (0, _validation.validateUsage)(path, state, tdzEnabled);
+ path.node.kind = "var";
+ const bindingNames = Object.keys(path.getBindingIdentifiers());
+ for (const name of bindingNames) {
+ const binding = path.scope.getOwnBinding(name);
+ if (!binding) continue;
+ binding.kind = "var";
+ }
+ if (isInLoop(path) && !(0, _loop.isVarInLoopHead)(path) || dynamicTDZNames.length > 0) {
+ for (const decl of path.node.declarations) {
+ var _decl$init;
+ (_decl$init = decl.init) != null ? _decl$init : decl.init = path.scope.buildUndefinedNode();
+ }
+ }
+ const blockScope = path.scope;
+ const varScope = blockScope.getFunctionParent() || blockScope.getProgramParent();
+ if (varScope !== blockScope) {
+ for (const name of bindingNames) {
+ let newName = name;
+ if (blockScope.parent.hasBinding(name, {
+ noUids: true
+ }) || blockScope.parent.hasGlobal(name)) {
+ newName = blockScope.generateUid(name);
+ blockScope.rename(name, newName);
+ }
+ blockScope.moveBindingTo(newName, varScope);
+ }
+ }
+ blockScope.path.traverse(conflictingFunctionsVisitor, {
+ names: bindingNames
+ });
+ for (const name of dynamicTDZNames) {
+ path.scope.push({
+ id: _core.types.identifier(name),
+ init: state.addHelper("temporalUndefined")
+ });
+ }
+}
+function isLetOrConst(kind) {
+ return kind === "let" || kind === "const";
+}
+function isInLoop(path) {
+ if (!path.parentPath) return false;
+ if (path.parentPath.isLoop()) return true;
+ if (path.parentPath.isFunctionParent()) return false;
+ return isInLoop(path.parentPath);
+}
+function isBlockScoped(node) {
+ if (!_core.types.isVariableDeclaration(node)) return false;
+ if (node[_core.types.BLOCK_SCOPED_SYMBOL]) {
+ return true;
+ }
+ if (!isLetOrConst(node.kind) && node.kind !== "using") {
+ return false;
+ }
+ return true;
+}
+
+//# sourceMappingURL=index.js.map
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/index.js.map b/node_modules/@babel/plugin-transform-block-scoping/lib/index.js.map
new file mode 100644
index 00000000..9495087e
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/index.js.map
@@ -0,0 +1 @@
+{"version":3,"names":["_helperPluginUtils","require","_core","_loop","_validation","_annexB_3_","_default","declare","api","opts","assertVersion","throwIfClosureRequired","tdz","tdzEnabled","Error","name","visitor","traverse","visitors","merge","annexB33FunctionsVisitor","Loop","path","state","isForStatement","headPath","get","isForXStatement","needsBodyWrap","markNeedsBodyWrap","buildCodeFrameError","body","bodyScope","isBlockStatement","scope","bindings","getLoopBodyBindings","binding","capturedInClosure","getUsageInBody","captured","updatedBindingsUsages","Map","isBlockScoped","node","names","Object","keys","getBindingIdentifiers","headScope","_bodyScope","hasOwnBinding","getOwnBinding","crawl","usages","hasConstantViolations","parent","hasBinding","hasGlobal","newName","generateUid","rename","push","set","varPath","wrapLoopBody","isVariableDeclaration","transformBlockScopedVariable","unwrapFunctionEnvironment","VariableDeclaration","ClassDeclaration","id","parentPath","isVarScope","noUids","exports","default","conflictingFunctionsVisitor","Scope","kind","Expression|Declaration","skip","dynamicTDZNames","validateUsage","bindingNames","isInLoop","isVarInLoopHead","length","decl","declarations","_decl$init","init","buildUndefinedNode","blockScope","varScope","getFunctionParent","getProgramParent","moveBindingTo","t","identifier","addHelper","isLetOrConst","isLoop","isFunctionParent","BLOCK_SCOPED_SYMBOL"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport type { NodePath, Scope, Visitor } from \"@babel/traverse\";\nimport { type PluginPass, types as t, traverse } from \"@babel/core\";\n\nimport {\n getLoopBodyBindings,\n getUsageInBody,\n isVarInLoopHead,\n wrapLoopBody,\n} from \"./loop.ts\";\nimport { validateUsage } from \"./validation.ts\";\nimport { annexB33FunctionsVisitor, isVarScope } from \"./annex-B_3_3.ts\";\n\nexport interface Options {\n tdz?: boolean;\n throwIfClosureRequired?: boolean;\n}\n\nexport default declare((api, opts: Options) => {\n api.assertVersion(7);\n\n const { throwIfClosureRequired = false, tdz: tdzEnabled = false } = opts;\n if (typeof throwIfClosureRequired !== \"boolean\") {\n throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`);\n }\n if (typeof tdzEnabled !== \"boolean\") {\n throw new Error(`.tdz must be a boolean, or undefined`);\n }\n\n return {\n name: \"transform-block-scoping\",\n\n visitor: traverse.visitors.merge<PluginPass>([\n // TODO: Consider adding an option to control Annex B behavior.\n annexB33FunctionsVisitor,\n {\n Loop(path: NodePath<t.Loop>, state) {\n const isForStatement = path.isForStatement();\n const headPath = isForStatement\n ? path.get(\"init\")\n : path.isForXStatement()\n ? path.get(\"left\")\n : null;\n\n let needsBodyWrap = false;\n const markNeedsBodyWrap = () => {\n if (throwIfClosureRequired) {\n throw path.buildCodeFrameError(\n \"Compiling let/const in this block would add a closure \" +\n \"(throwIfClosureRequired).\",\n );\n }\n needsBodyWrap = true;\n };\n\n const body = path.get(\"body\");\n let bodyScope: Scope | null;\n if (body.isBlockStatement()) {\n bodyScope = body.scope;\n\n const bindings = getLoopBodyBindings(path);\n for (const binding of bindings) {\n const { capturedInClosure } = getUsageInBody(binding, path);\n if (capturedInClosure) markNeedsBodyWrap();\n }\n }\n\n const captured: string[] = [];\n const updatedBindingsUsages: Map<string, NodePath<t.Identifier>[]> =\n new Map();\n\n if (headPath && isBlockScoped(headPath.node)) {\n const names = Object.keys(headPath.getBindingIdentifiers());\n const headScope = headPath.scope;\n\n for (let name of names) {\n if (bodyScope?.hasOwnBinding(name)) continue; // shadowed\n\n let binding = headScope.getOwnBinding(name);\n if (!binding) {\n headScope.crawl();\n binding = headScope.getOwnBinding(name);\n }\n const { usages, capturedInClosure, hasConstantViolations } =\n getUsageInBody(binding, path);\n\n if (\n headScope.parent.hasBinding(name) ||\n headScope.parent.hasGlobal(name)\n ) {\n // If the binding is not captured, there is no need\n // of adding it to the closure param. However, rename\n // it if it shadows an outer binding, because the\n // closure will be moved to an outer level.\n const newName = headScope.generateUid(name);\n headScope.rename(name, newName);\n name = newName;\n }\n\n if (capturedInClosure) {\n markNeedsBodyWrap();\n captured.push(name);\n }\n\n if (isForStatement && hasConstantViolations) {\n updatedBindingsUsages.set(name, usages);\n }\n }\n }\n\n if (needsBodyWrap) {\n const varPath = wrapLoopBody(path, captured, updatedBindingsUsages);\n\n if (headPath?.isVariableDeclaration<t.Node>()) {\n // If we wrap the loop body, we transform the var\n // declaration in the loop head now, to avoid\n // invalid references that break other plugins:\n //\n // for (let head of x) {\n // let i = head;\n // setTimeout(() => i);\n // }\n //\n // would become\n //\n // function _loop() {\n // let i = head;\n // setTimeout(() => i);\n // }\n // for (let head of x) _loop();\n //\n // which references `head` in a scope where it's not visible.\n transformBlockScopedVariable(headPath, state, tdzEnabled);\n }\n\n varPath.get(\"declarations.0.init\").unwrapFunctionEnvironment();\n }\n },\n\n VariableDeclaration(path, state) {\n transformBlockScopedVariable(path, state, tdzEnabled);\n },\n\n // Class declarations are block-scoped: if there is\n // a class declaration in a nested block that conflicts\n // with an outer block-scoped binding, rename it.\n // TODO: Should this be moved to the classes plugin?\n ClassDeclaration(path) {\n const { id } = path.node;\n if (!id) return;\n\n const { scope } = path.parentPath;\n if (\n !isVarScope(scope) &&\n scope.parent.hasBinding(id.name, { noUids: true })\n ) {\n path.scope.rename(id.name);\n }\n },\n },\n ]),\n };\n});\n\nconst conflictingFunctionsVisitor: Visitor<{ names: string[] }> = {\n Scope(path, { names }) {\n for (const name of names) {\n const binding = path.scope.getOwnBinding(name);\n if (binding && binding.kind === \"hoisted\") {\n path.scope.rename(name);\n }\n }\n },\n \"Expression|Declaration\"(path) {\n path.skip();\n },\n};\n\nfunction transformBlockScopedVariable(\n path: NodePath<t.VariableDeclaration>,\n state: PluginPass,\n tdzEnabled: boolean,\n) {\n if (!isBlockScoped(path.node)) return;\n\n const dynamicTDZNames = validateUsage(path, state, tdzEnabled);\n\n path.node.kind = \"var\";\n\n const bindingNames = Object.keys(path.getBindingIdentifiers());\n for (const name of bindingNames) {\n const binding = path.scope.getOwnBinding(name);\n if (!binding) continue;\n binding.kind = \"var\";\n }\n\n if (\n (isInLoop(path) && !isVarInLoopHead(path)) ||\n dynamicTDZNames.length > 0\n ) {\n for (const decl of path.node.declarations) {\n // We explicitly add `void 0` to cases like\n // for (;;) { let a; }\n // to make sure that `a` doesn't keep the value from\n // the previous iteration.\n decl.init ??= path.scope.buildUndefinedNode();\n }\n }\n\n const blockScope = path.scope;\n const varScope =\n blockScope.getFunctionParent() || blockScope.getProgramParent();\n\n if (varScope !== blockScope) {\n for (const name of bindingNames) {\n let newName = name;\n if (\n // We pass `noUids` true because, if `name` was a generated\n // UID, it has been used to declare the current variable in\n // a nested scope and thus we don't need to assume that it\n // may be declared (but not registered yet) in an upper one.\n blockScope.parent.hasBinding(name, { noUids: true }) ||\n blockScope.parent.hasGlobal(name)\n ) {\n newName = blockScope.generateUid(name);\n blockScope.rename(name, newName);\n }\n\n blockScope.moveBindingTo(newName, varScope);\n }\n }\n\n blockScope.path.traverse(conflictingFunctionsVisitor, {\n names: bindingNames,\n });\n\n for (const name of dynamicTDZNames) {\n path.scope.push({\n id: t.identifier(name),\n init: state.addHelper(\"temporalUndefined\"),\n });\n }\n}\n\nfunction isLetOrConst(kind: string): kind is \"let\" | \"const\" {\n return kind === \"let\" || kind === \"const\";\n}\n\nfunction isInLoop(path: NodePath<t.Node>): boolean {\n if (!path.parentPath) return false;\n if (path.parentPath.isLoop()) return true;\n if (path.parentPath.isFunctionParent()) return false;\n return isInLoop(path.parentPath);\n}\n\nfunction isBlockScoped(node: t.Node): node is t.VariableDeclaration {\n if (!t.isVariableDeclaration(node)) return false;\n if (\n // @ts-expect-error Fixme: document symbol properties\n node[t.BLOCK_SCOPED_SYMBOL]\n ) {\n return true;\n }\n\n if (!isLetOrConst(node.kind) && node.kind !== \"using\") {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAAwE,IAAAK,QAAA,GAOzD,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,IAAa,KAAK;EAC7CD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC;EAEpB,MAAM;IAAEC,sBAAsB,GAAG,KAAK;IAAEC,GAAG,EAAEC,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OAAO,KAAK;EAClC,IAAIlD,IAAI,CAACkD,UAAU,CAAC8B,MAAM,CAAC,CAAC,EAAE,OAAO,IAAI;EACzC,IAAIhF,IAAI,CAACkD,UAAU,CAAC+B,gBAAgB,CAAC,CAAC,EAAE,OAAO,KAAK;EACpD,OAAOlB,QAAQ,CAAC/D,IAAI,CAACkD,UAAU,CAAC;AAClC;AAEA,SAAS7B,aAAaA,CAACC,IAAY,EAAiC;EAClE,IAAI,CAACsD,WAAC,CAAChC,qBAAqB,CAACtB,IAAI,CAAC,EAAE,OAAO,KAAK;EAChD,IAEEA,IAAI,CAACsD,WAAC,CAACM,mBAAmB,CAAC,EAC3B;IACA,OAAO,IAAI;EACb;EAEA,IAAI,CAACH,YAAY,CAACzD,IAAI,CAACmC,IAAI,CAAC,IAAInC,IAAI,CAACmC,IAAI,KAAK,OAAO,EAAE;IACrD,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb"} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js b/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js
new file mode 100644
index 00000000..0c0a17f8
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js
@@ -0,0 +1,294 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getLoopBodyBindings = getLoopBodyBindings;
+exports.getUsageInBody = getUsageInBody;
+exports.isVarInLoopHead = isVarInLoopHead;
+exports.wrapLoopBody = wrapLoopBody;
+var _core = require("@babel/core");
+const collectLoopBodyBindingsVisitor = {
+ "Expression|Declaration|Loop"(path) {
+ path.skip();
+ },
+ Scope(path, state) {
+ if (path.isFunctionParent()) path.skip();
+ const {
+ bindings
+ } = path.scope;
+ for (const name of Object.keys(bindings)) {
+ const binding = bindings[name];
+ if (binding.kind === "let" || binding.kind === "const" || binding.kind === "hoisted") {
+ state.blockScoped.push(binding);
+ }
+ }
+ }
+};
+function getLoopBodyBindings(loopPath) {
+ const state = {
+ blockScoped: []
+ };
+ loopPath.traverse(collectLoopBodyBindingsVisitor, state);
+ return state.blockScoped;
+}
+function getUsageInBody(binding, loopPath) {
+ const seen = new WeakSet();
+ let capturedInClosure = false;
+ const constantViolations = filterMap(binding.constantViolations, path => {
+ const {
+ inBody,
+ inClosure
+ } = relativeLoopLocation(path, loopPath);
+ if (!inBody) return null;
+ capturedInClosure || (capturedInClosure = inClosure);
+ const id = path.isUpdateExpression() ? path.get("argument") : path.isAssignmentExpression() ? path.get("left") : null;
+ if (id) seen.add(id.node);
+ return id;
+ });
+ const references = filterMap(binding.referencePaths, path => {
+ if (seen.has(path.node)) return null;
+ const {
+ inBody,
+ inClosure
+ } = relativeLoopLocation(path, loopPath);
+ if (!inBody) return null;
+ capturedInClosure || (capturedInClosure = inClosure);
+ return path;
+ });
+ return {
+ capturedInClosure,
+ hasConstantViolations: constantViolations.length > 0,
+ usages: references.concat(constantViolations)
+ };
+}
+function relativeLoopLocation(path, loopPath) {
+ const bodyPath = loopPath.get("body");
+ let inClosure = false;
+ for (let currPath = path; currPath; currPath = currPath.parentPath) {
+ if (currPath.isFunction() || currPath.isClass() || currPath.isMethod()) {
+ inClosure = true;
+ }
+ if (currPath === bodyPath) {
+ return {
+ inBody: true,
+ inClosure
+ };
+ } else if (currPath === loopPath) {
+ return {
+ inBody: false,
+ inClosure
+ };
+ }
+ }
+ throw new Error("Internal Babel error: path is not in loop. Please report this as a bug.");
+}
+const collectCompletionsAndVarsVisitor = {
+ Function(path) {
+ path.skip();
+ },
+ LabeledStatement: {
+ enter({
+ node
+ }, state) {
+ state.labelsStack.push(node.label.name);
+ },
+ exit({
+ node
+ }, state) {
+ const popped = state.labelsStack.pop();
+ if (popped !== node.label.name) {
+ throw new Error("Assertion failure. Please report this bug to Babel.");
+ }
+ }
+ },
+ Loop: {
+ enter(_, state) {
+ state.labellessContinueTargets++;
+ state.labellessBreakTargets++;
+ },
+ exit(_, state) {
+ state.labellessContinueTargets--;
+ state.labellessBreakTargets--;
+ }
+ },
+ SwitchStatement: {
+ enter(_, state) {
+ state.labellessBreakTargets++;
+ },
+ exit(_, state) {
+ state.labellessBreakTargets--;
+ }
+ },
+ "BreakStatement|ContinueStatement"(path, state) {
+ const {
+ label
+ } = path.node;
+ if (label) {
+ if (state.labelsStack.includes(label.name)) return;
+ } else if (path.isBreakStatement() ? state.labellessBreakTargets > 0 : state.labellessContinueTargets > 0) {
+ return;
+ }
+ state.breaksContinues.push(path);
+ },
+ ReturnStatement(path, state) {
+ state.returns.push(path);
+ },
+ VariableDeclaration(path, state) {
+ if (path.parent === state.loopNode && isVarInLoopHead(path)) return;
+ if (path.node.kind === "var") state.vars.push(path);
+ }
+};
+function wrapLoopBody(loopPath, captured, updatedBindingsUsages) {
+ const loopNode = loopPath.node;
+ const state = {
+ breaksContinues: [],
+ returns: [],
+ labelsStack: [],
+ labellessBreakTargets: 0,
+ labellessContinueTargets: 0,
+ vars: [],
+ loopNode
+ };
+ loopPath.traverse(collectCompletionsAndVarsVisitor, state);
+ const callArgs = [];
+ const closureParams = [];
+ const updater = [];
+ for (const [name, updatedUsage] of updatedBindingsUsages) {
+ callArgs.push(_core.types.identifier(name));
+ const innerName = loopPath.scope.generateUid(name);
+ closureParams.push(_core.types.identifier(innerName));
+ updater.push(_core.types.assignmentExpression("=", _core.types.identifier(name), _core.types.identifier(innerName)));
+ for (const path of updatedUsage) path.replaceWith(_core.types.identifier(innerName));
+ }
+ for (const name of captured) {
+ if (updatedBindingsUsages.has(name)) continue;
+ callArgs.push(_core.types.identifier(name));
+ closureParams.push(_core.types.identifier(name));
+ }
+ const id = loopPath.scope.generateUid("loop");
+ const fn = _core.types.functionExpression(null, closureParams, _core.types.toBlock(loopNode.body));
+ let call = _core.types.callExpression(_core.types.identifier(id), callArgs);
+ const fnParent = loopPath.findParent(p => p.isFunction());
+ if (fnParent) {
+ const {
+ async,
+ generator
+ } = fnParent.node;
+ fn.async = async;
+ fn.generator = generator;
+ if (generator) call = _core.types.yieldExpression(call, true);else if (async) call = _core.types.awaitExpression(call);
+ }
+ const updaterNode = updater.length > 0 ? _core.types.expressionStatement(_core.types.sequenceExpression(updater)) : null;
+ if (updaterNode) fn.body.body.push(updaterNode);
+ const [varPath] = loopPath.insertBefore(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(id), fn)]));
+ const bodyStmts = [];
+ const varNames = [];
+ for (const varPath of state.vars) {
+ const assign = [];
+ for (const decl of varPath.node.declarations) {
+ varNames.push(...Object.keys(_core.types.getBindingIdentifiers(decl.id)));
+ if (decl.init) {
+ assign.push(_core.types.assignmentExpression("=", decl.id, decl.init));
+ }
+ }
+ if (assign.length > 0) {
+ let replacement = assign.length === 1 ? assign[0] : _core.types.sequenceExpression(assign);
+ if (!_core.types.isForStatement(varPath.parent, {
+ init: varPath.node
+ }) && !_core.types.isForXStatement(varPath.parent, {
+ left: varPath.node
+ })) {
+ replacement = _core.types.expressionStatement(replacement);
+ }
+ varPath.replaceWith(replacement);
+ } else {
+ varPath.remove();
+ }
+ }
+ if (varNames.length) {
+ varPath.pushContainer("declarations", varNames.map(name => _core.types.variableDeclarator(_core.types.identifier(name))));
+ }
+ const labelNum = state.breaksContinues.length;
+ const returnNum = state.returns.length;
+ if (labelNum + returnNum === 0) {
+ bodyStmts.push(_core.types.expressionStatement(call));
+ } else if (labelNum === 1 && returnNum === 0) {
+ for (const path of state.breaksContinues) {
+ const {
+ node
+ } = path;
+ const {
+ type,
+ label
+ } = node;
+ let name = type === "BreakStatement" ? "break" : "continue";
+ if (label) name += " " + label.name;
+ path.replaceWith(_core.types.addComment(_core.types.returnStatement(_core.types.numericLiteral(1)), "trailing", " " + name, true));
+ if (updaterNode) path.insertBefore(_core.types.cloneNode(updaterNode));
+ bodyStmts.push(_core.template.statement.ast`
+ if (${call}) ${node}
+ `);
+ }
+ } else {
+ const completionId = loopPath.scope.generateUid("ret");
+ if (varPath.isVariableDeclaration()) {
+ varPath.pushContainer("declarations", [_core.types.variableDeclarator(_core.types.identifier(completionId))]);
+ bodyStmts.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.identifier(completionId), call)));
+ } else {
+ bodyStmts.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(completionId), call)]));
+ }
+ const injected = [];
+ for (const path of state.breaksContinues) {
+ const {
+ node
+ } = path;
+ const {
+ type,
+ label
+ } = node;
+ let name = type === "BreakStatement" ? "break" : "continue";
+ if (label) name += " " + label.name;
+ let i = injected.indexOf(name);
+ const hasInjected = i !== -1;
+ if (!hasInjected) {
+ injected.push(name);
+ i = injected.length - 1;
+ }
+ path.replaceWith(_core.types.addComment(_core.types.returnStatement(_core.types.numericLiteral(i)), "trailing", " " + name, true));
+ if (updaterNode) path.insertBefore(_core.types.cloneNode(updaterNode));
+ if (hasInjected) continue;
+ bodyStmts.push(_core.template.statement.ast`
+ if (${_core.types.identifier(completionId)} === ${_core.types.numericLiteral(i)}) ${node}
+ `);
+ }
+ if (returnNum) {
+ for (const path of state.returns) {
+ const arg = path.node.argument || path.scope.buildUndefinedNode();
+ path.replaceWith(_core.template.statement.ast`
+ return { v: ${arg} };
+ `);
+ }
+ bodyStmts.push(_core.template.statement.ast`
+ if (${_core.types.identifier(completionId)}) return ${_core.types.identifier(completionId)}.v;
+ `);
+ }
+ }
+ loopNode.body = _core.types.blockStatement(bodyStmts);
+ return varPath;
+}
+function isVarInLoopHead(path) {
+ if (_core.types.isForStatement(path.parent)) return path.key === "init";
+ if (_core.types.isForXStatement(path.parent)) return path.key === "left";
+ return false;
+}
+function filterMap(list, fn) {
+ const result = [];
+ for (const item of list) {
+ const mapped = fn(item);
+ if (mapped) result.push(mapped);
+ }
+ return result;
+}
+
+//# sourceMappingURL=loop.js.map
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map b/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map
new file mode 100644
index 00000000..8a147389
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map
@@ -0,0 +1 @@
+{"version":3,"names":["_core","require","collectLoopBodyBindingsVisitor","Expression|Declaration|Loop","path","skip","Scope","state","isFunctionParent","bindings","scope","name","Object","keys","binding","kind","blockScoped","push","getLoopBodyBindings","loopPath","traverse","getUsageInBody","seen","WeakSet","capturedInClosure","constantViolations","filterMap","inBody","inClosure","relativeLoopLocation","id","isUpdateExpression","get","isAssignmentExpression","add","node","references","referencePaths","has","hasConstantViolations","length","usages","concat","bodyPath","currPath","parentPath","isFunction","isClass","isMethod","Error","collectCompletionsAndVarsVisitor","Function","LabeledStatement","enter","labelsStack","label","exit","popped","pop","Loop","_","labellessContinueTargets","labellessBreakTargets","SwitchStatement","BreakStatement|ContinueStatement","includes","isBreakStatement","breaksContinues","ReturnStatement","returns","VariableDeclaration","parent","loopNode","isVarInLoopHead","vars","wrapLoopBody","captured","updatedBindingsUsages","callArgs","closureParams","updater","updatedUsage","t","identifier","innerName","generateUid","assignmentExpression","replaceWith","fn","functionExpression","toBlock","body","call","callExpression","fnParent","findParent","p","async","generator","yieldExpression","awaitExpression","updaterNode","expressionStatement","sequenceExpression","varPath","insertBefore","variableDeclaration","variableDeclarator","bodyStmts","varNames","assign","decl","declarations","getBindingIdentifiers","init","replacement","isForStatement","isForXStatement","left","remove","pushContainer","map","labelNum","returnNum","type","addComment","returnStatement","numericLiteral","cloneNode","template","statement","ast","completionId","isVariableDeclaration","injected","i","indexOf","hasInjected","arg","argument","buildUndefinedNode","blockStatement","key","list","result","item","mapped"],"sources":["../src/loop.ts"],"sourcesContent":["import { template, types as t } from \"@babel/core\";\nimport type { NodePath, Visitor, Binding } from \"@babel/traverse\";\n\ninterface LoopBodyBindingsState {\n blockScoped: Binding[];\n}\n\nconst collectLoopBodyBindingsVisitor: Visitor<LoopBodyBindingsState> = {\n \"Expression|Declaration|Loop\"(path) {\n path.skip();\n },\n Scope(path, state) {\n if (path.isFunctionParent()) path.skip();\n\n const { bindings } = path.scope;\n for (const name of Object.keys(bindings)) {\n const binding = bindings[name];\n if (\n binding.kind === \"let\" ||\n binding.kind === \"const\" ||\n binding.kind === \"hoisted\"\n ) {\n state.blockScoped.push(binding);\n }\n }\n },\n};\n\nexport function getLoopBodyBindings(loopPath: NodePath<t.Loop>) {\n const state: LoopBodyBindingsState = { blockScoped: [] };\n loopPath.traverse(collectLoopBodyBindingsVisitor, state);\n return state.blockScoped;\n}\n\nexport function getUsageInBody(binding: Binding, loopPath: NodePath<t.Loop>) {\n // UpdateExpressions are counted both as a reference and a mutation,\n // so we need to de-duplicate them.\n const seen = new WeakSet<t.Node>();\n\n let capturedInClosure = false;\n\n const constantViolations = filterMap(binding.constantViolations, path => {\n const { inBody, inClosure } = relativeLoopLocation(path, loopPath);\n if (!inBody) return null;\n capturedInClosure ||= inClosure;\n\n const id = path.isUpdateExpression()\n ? path.get(\"argument\")\n : path.isAssignmentExpression()\n ? path.get(\"left\")\n : null;\n if (id) seen.add(id.node);\n return id as NodePath<t.Identifier> | null;\n });\n\n const references = filterMap(binding.referencePaths, path => {\n if (seen.has(path.node)) return null;\n\n const { inBody, inClosure } = relativeLoopLocation(path, loopPath);\n if (!inBody) return null;\n capturedInClosure ||= inClosure;\n\n return path as NodePath<t.Identifier>;\n });\n\n return {\n capturedInClosure,\n hasConstantViolations: constantViolations.length > 0,\n usages: references.concat(constantViolations),\n };\n}\n\nfunction relativeLoopLocation(path: NodePath, loopPath: NodePath<t.Loop>) {\n const bodyPath = loopPath.get(\"body\");\n let inClosure = false;\n\n for (let currPath = path; currPath; currPath = currPath.parentPath) {\n if (currPath.isFunction() || currPath.isClass() || currPath.isMethod()) {\n inClosure = true;\n }\n if (currPath === bodyPath) {\n return { inBody: true, inClosure };\n } else if (currPath === loopPath) {\n return { inBody: false, inClosure };\n }\n }\n\n throw new Error(\n \"Internal Babel error: path is not in loop. Please report this as a bug.\",\n );\n}\n\ninterface CompletionsAndVarsState {\n breaksContinues: NodePath<t.BreakStatement | t.ContinueStatement>[];\n returns: NodePath<t.ReturnStatement>[];\n labelsStack: string[];\n labellessContinueTargets: number;\n labellessBreakTargets: number;\n\n vars: NodePath<t.VariableDeclaration>[];\n loopNode: t.Loop;\n}\n\nconst collectCompletionsAndVarsVisitor: Visitor<CompletionsAndVarsState> = {\n Function(path) {\n path.skip();\n },\n LabeledStatement: {\n enter({ node }, state) {\n state.labelsStack.push(node.label.name);\n },\n exit({ node }, state) {\n const popped = state.labelsStack.pop();\n if (popped !== node.label.name) {\n throw new Error(\"Assertion failure. Please report this bug to Babel.\");\n }\n },\n },\n Loop: {\n enter(_, state) {\n state.labellessContinueTargets++;\n state.labellessBreakTargets++;\n },\n exit(_, state) {\n state.labellessContinueTargets--;\n state.labellessBreakTargets--;\n },\n },\n SwitchStatement: {\n enter(_, state) {\n state.labellessBreakTargets++;\n },\n exit(_, state) {\n state.labellessBreakTargets--;\n },\n },\n \"BreakStatement|ContinueStatement\"(\n path: NodePath<t.BreakStatement | t.ContinueStatement>,\n state,\n ) {\n const { label } = path.node;\n if (label) {\n if (state.labelsStack.includes(label.name)) return;\n } else if (\n path.isBreakStatement()\n ? state.labellessBreakTargets > 0\n : state.labellessContinueTargets > 0\n ) {\n return;\n }\n state.breaksContinues.push(path);\n },\n ReturnStatement(path, state) {\n state.returns.push(path);\n },\n VariableDeclaration(path, state) {\n if (path.parent === state.loopNode && isVarInLoopHead(path)) return;\n if (path.node.kind === \"var\") state.vars.push(path);\n },\n};\n\nexport function wrapLoopBody(\n loopPath: NodePath<t.Loop>,\n captured: string[],\n updatedBindingsUsages: Map<string, NodePath<t.Identifier>[]>,\n) {\n const loopNode = loopPath.node;\n const state: CompletionsAndVarsState = {\n breaksContinues: [],\n returns: [],\n labelsStack: [],\n labellessBreakTargets: 0,\n labellessContinueTargets: 0,\n vars: [],\n loopNode,\n };\n loopPath.traverse(collectCompletionsAndVarsVisitor, state);\n\n const callArgs = [];\n const closureParams = [];\n const updater = [];\n for (const [name, updatedUsage] of updatedBindingsUsages) {\n callArgs.push(t.identifier(name));\n\n const innerName = loopPath.scope.generateUid(name);\n closureParams.push(t.identifier(innerName));\n updater.push(\n t.assignmentExpression(\"=\", t.identifier(name), t.identifier(innerName)),\n );\n for (const path of updatedUsage) path.replaceWith(t.identifier(innerName));\n }\n for (const name of captured) {\n if (updatedBindingsUsages.has(name)) continue; // already injected\n callArgs.push(t.identifier(name));\n closureParams.push(t.identifier(name));\n }\n\n const id = loopPath.scope.generateUid(\"loop\");\n const fn = t.functionExpression(\n null,\n closureParams,\n t.toBlock(loopNode.body),\n );\n let call: t.Expression = t.callExpression(t.identifier(id), callArgs);\n\n const fnParent = loopPath.findParent(p => p.isFunction());\n if (fnParent) {\n const { async, generator } = fnParent.node as t.Function;\n fn.async = async;\n fn.generator = generator;\n if (generator) call = t.yieldExpression(call, true);\n else if (async) call = t.awaitExpression(call);\n }\n\n const updaterNode =\n updater.length > 0\n ? t.expressionStatement(t.sequenceExpression(updater))\n : null;\n if (updaterNode) fn.body.body.push(updaterNode);\n\n // NOTE: Calling .insertBefore on the loop path might cause the\n // loop to be moved in the AST. For example, in\n // if (true) for (let x of y) ...\n // .insertBefore will replace the loop with a block:\n // if (true) { var _loop = ...; for (let x of y) ... }\n // All subsequent operations in this function on the loop node\n // must not assume that loopPath still represents the loop.\n // TODO: Consider using a function declaration\n const [varPath] = loopPath.insertBefore(\n t.variableDeclaration(\"var\", [t.variableDeclarator(t.identifier(id), fn)]),\n ) as [NodePath<t.VariableDeclaration>];\n\n const bodyStmts: t.Statement[] = [];\n\n const varNames: string[] = [];\n for (const varPath of state.vars) {\n const assign = [];\n for (const decl of varPath.node.declarations) {\n varNames.push(...Object.keys(t.getBindingIdentifiers(decl.id)));\n if (decl.init) {\n assign.push(t.assignmentExpression(\"=\", decl.id, decl.init));\n }\n }\n if (assign.length > 0) {\n let replacement: t.Node =\n assign.length === 1 ? assign[0] : t.sequenceExpression(assign);\n if (\n !t.isForStatement(varPath.parent, { init: varPath.node }) &&\n !t.isForXStatement(varPath.parent, { left: varPath.node })\n ) {\n replacement = t.expressionStatement(replacement);\n }\n varPath.replaceWith(replacement);\n } else {\n varPath.remove();\n }\n }\n if (varNames.length) {\n varPath.pushContainer(\n \"declarations\",\n varNames.map(name => t.variableDeclarator(t.identifier(name))),\n );\n }\n\n const labelNum = state.breaksContinues.length;\n const returnNum = state.returns.length;\n if (labelNum + returnNum === 0) {\n bodyStmts.push(t.expressionStatement(call));\n } else if (labelNum === 1 && returnNum === 0) {\n for (const path of state.breaksContinues) {\n const { node } = path;\n const { type, label } = node;\n let name = type === \"BreakStatement\" ? \"break\" : \"continue\";\n if (label) name += \" \" + label.name;\n path.replaceWith(\n t.addComment(\n t.returnStatement(t.numericLiteral(1)),\n \"trailing\",\n \" \" + name,\n true,\n ),\n );\n if (updaterNode) path.insertBefore(t.cloneNode(updaterNode));\n\n bodyStmts.push(\n template.statement.ast`\n if (${call}) ${node}\n `,\n );\n }\n } else {\n const completionId = loopPath.scope.generateUid(\"ret\");\n\n if (varPath.isVariableDeclaration()) {\n varPath.pushContainer(\"declarations\", [\n t.variableDeclarator(t.identifier(completionId)),\n ]);\n bodyStmts.push(\n t.expressionStatement(\n t.assignmentExpression(\"=\", t.identifier(completionId), call),\n ),\n );\n } else {\n bodyStmts.push(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.identifier(completionId), call),\n ]),\n );\n }\n\n const injected: string[] = [];\n for (const path of state.breaksContinues) {\n const { node } = path;\n const { type, label } = node;\n let name = type === \"BreakStatement\" ? \"break\" : \"continue\";\n if (label) name += \" \" + label.name;\n\n let i = injected.indexOf(name);\n const hasInjected = i !== -1;\n if (!hasInjected) {\n injected.push(name);\n i = injected.length - 1;\n }\n\n path.replaceWith(\n t.addComment(\n t.returnStatement(t.numericLiteral(i)),\n \"trailing\",\n \" \" + name,\n true,\n ),\n );\n if (updaterNode) path.insertBefore(t.cloneNode(updaterNode));\n\n if (hasInjected) continue;\n\n bodyStmts.push(\n template.statement.ast`\n if (${t.identifier(completionId)} === ${t.numericLiteral(i)}) ${node}\n `,\n );\n }\n\n if (returnNum) {\n for (const path of state.returns) {\n const arg = path.node.argument || path.scope.buildUndefinedNode();\n path.replaceWith(\n template.statement.ast`\n return { v: ${arg} };\n `,\n );\n }\n\n bodyStmts.push(\n template.statement.ast`\n if (${t.identifier(completionId)}) return ${t.identifier(\n completionId,\n )}.v;\n `,\n );\n }\n }\n\n loopNode.body = t.blockStatement(bodyStmts);\n\n return varPath;\n}\n\nexport function isVarInLoopHead(path: NodePath<t.VariableDeclaration>) {\n if (t.isForStatement(path.parent)) return path.key === \"init\";\n if (t.isForXStatement(path.parent)) return path.key === \"left\";\n return false;\n}\n\nfunction filterMap<T, U extends object>(list: T[], fn: (item: T) => U | null) {\n const result: U[] = [];\n for (const item of list) {\n const mapped = fn(item);\n if (mapped) result.push(mapped);\n }\n return result;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,MAAMC,8BAA8D,GAAG;EACrE,6BAA6BC,CAACC,IAAI,EAAE;IAClCA,IAAI,CAACC,IAAI,CAAC,CAAC;EACb,CAAC;EACDC,KAAKA,CAACF,IAAI,EAAEG,KAAK,EAAE;IACjB,IAAIH,IAAI,CAACI,gBAAgB,CAAC,CAAC,EAAEJ,IAAI,CAACC,IAAI,CAAC,CAAC;IAExC,MAAM;MAAEI;IAAS,CAAC,GAAGL,IAAI,CAACM,KAAK;IAC/B,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,EAAE;MACxC,MAAMK,OAAO,GAAGL,QAAQ,CAACE,IAAI,CAAC;MAC9B,IACEG,OAAO,CAACC,IAAI,KAAK,KAAK,IACtBD,OAAO,CAACC,IAAI,KAAK,OAAO,IACxBD,OAAO,CAACC,IAAI,KAAK,SAAS,EAC1B;QACAR,KAAK,CAACS,WAAW,CAACC,IAAI,CAACH,OAAO,CAAC;MACjC;IACF;EACF;AACF,CAAC;AAEM,SAASI,mBAAmBA,CAACC,QAA0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,CAACwG,QAAQ,IAAIvI,IAAI,CAACM,KAAK,CAACkI,kBAAkB,CAAC,CAAC;QACjExI,IAAI,CAACmF,WAAW,CACd0C,cAAQ,CAACC,SAAS,CAACC,GAAI;AACjC,wBAAwBO,GAAI;AAC5B,SACQ,CAAC;MACH;MAEA9B,SAAS,CAAC3F,IAAI,CACZgH,cAAQ,CAACC,SAAS,CAACC,GAAI;AAC/B,gBAAgBjD,WAAC,CAACC,UAAU,CAACiD,YAAY,CAAE,YAAWlD,WAAC,CAACC,UAAU,CACtDiD,YACF,CAAE;AACZ,SACM,CAAC;IACH;EACF;EAEA5D,QAAQ,CAACmB,IAAI,GAAGT,WAAC,CAAC2D,cAAc,CAACjC,SAAS,CAAC;EAE3C,OAAOJ,OAAO;AAChB;AAEO,SAAS/B,eAAeA,CAACrE,IAAqC,EAAE;EACrE,IAAI8E,WAAC,CAACkC,cAAc,CAAChH,IAAI,CAACmE,MAAM,CAAC,EAAE,OAAOnE,IAAI,CAAC0I,GAAG,KAAK,MAAM;EAC7D,IAAI5D,WAAC,CAACmC,eAAe,CAACjH,IAAI,CAACmE,MAAM,CAAC,EAAE,OAAOnE,IAAI,CAAC0I,GAAG,KAAK,MAAM;EAC9D,OAAO,KAAK;AACd;AAEA,SAASpH,SAASA,CAAsBqH,IAAS,EAAEvD,EAAyB,EAAE;EAC5E,MAAMwD,MAAW,GAAG,EAAE;EACtB,KAAK,MAAMC,IAAI,IAAIF,IAAI,EAAE;IACvB,MAAMG,MAAM,GAAG1D,EAAE,CAACyD,IAAI,CAAC;IACvB,IAAIC,MAAM,EAAEF,MAAM,CAAC/H,IAAI,CAACiI,MAAM,CAAC;EACjC;EACA,OAAOF,MAAM;AACf"} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js b/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js
new file mode 100644
index 00000000..3985a42b
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js
@@ -0,0 +1,133 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.validateUsage = validateUsage;
+var _core = require("@babel/core");
+function validateUsage(path, state, tdzEnabled) {
+ const dynamicTDZNames = [];
+ for (const name of Object.keys(path.getBindingIdentifiers())) {
+ const binding = path.scope.getBinding(name);
+ if (!binding) continue;
+ if (tdzEnabled) {
+ if (injectTDZChecks(binding, state)) dynamicTDZNames.push(name);
+ }
+ if (path.node.kind === "const") {
+ disallowConstantViolations(name, binding, state);
+ }
+ }
+ return dynamicTDZNames;
+}
+function disallowConstantViolations(name, binding, state) {
+ for (const violation of binding.constantViolations) {
+ const readOnlyError = state.addHelper("readOnlyError");
+ const throwNode = _core.types.callExpression(readOnlyError, [_core.types.stringLiteral(name)]);
+ if (violation.isAssignmentExpression()) {
+ const {
+ operator,
+ left,
+ right
+ } = violation.node;
+ if (operator === "=") {
+ const exprs = [right];
+ exprs.push(throwNode);
+ violation.replaceWith(_core.types.sequenceExpression(exprs));
+ } else if (["&&=", "||=", "??="].includes(operator)) {
+ violation.replaceWith(_core.types.logicalExpression(operator.slice(0, -1), left, _core.types.sequenceExpression([right, throwNode])));
+ } else {
+ violation.replaceWith(_core.types.sequenceExpression([_core.types.binaryExpression(operator.slice(0, -1), left, right), throwNode]));
+ }
+ } else if (violation.isUpdateExpression()) {
+ violation.replaceWith(_core.types.sequenceExpression([_core.types.unaryExpression("+", violation.get("argument").node), throwNode]));
+ } else if (violation.isForXStatement()) {
+ violation.ensureBlock();
+ violation.get("left").replaceWith(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(violation.scope.generateUidIdentifier(name))]));
+ violation.node.body.body.unshift(_core.types.expressionStatement(throwNode));
+ }
+ }
+}
+function getTDZStatus(refPath, bindingPath) {
+ const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath);
+ if (executionStatus === "before") {
+ return "outside";
+ } else if (executionStatus === "after") {
+ return "inside";
+ } else {
+ return "maybe";
+ }
+}
+const skipTDZChecks = new WeakSet();
+function buildTDZAssert(status, node, state) {
+ if (status === "maybe") {
+ const clone = _core.types.cloneNode(node);
+ skipTDZChecks.add(clone);
+ return _core.types.callExpression(state.addHelper("temporalRef"), [clone, _core.types.stringLiteral(node.name)]);
+ } else {
+ return _core.types.callExpression(state.addHelper("tdz"), [_core.types.stringLiteral(node.name)]);
+ }
+}
+function getTDZReplacement(path, state, id = path.node) {
+ var _path$scope$getBindin;
+ if (skipTDZChecks.has(id)) return;
+ skipTDZChecks.add(id);
+ const bindingPath = (_path$scope$getBindin = path.scope.getBinding(id.name)) == null ? void 0 : _path$scope$getBindin.path;
+ if (!bindingPath || bindingPath.isFunctionDeclaration()) return;
+ const status = getTDZStatus(path, bindingPath);
+ if (status === "outside") return;
+ if (status === "maybe") {
+ bindingPath.parent._tdzThis = true;
+ }
+ return {
+ status,
+ node: buildTDZAssert(status, id, state)
+ };
+}
+function injectTDZChecks(binding, state) {
+ const allUsages = new Set(binding.referencePaths);
+ binding.constantViolations.forEach(allUsages.add, allUsages);
+ let dynamicTdz = false;
+ for (const path of binding.constantViolations) {
+ const {
+ node
+ } = path;
+ if (skipTDZChecks.has(node)) continue;
+ skipTDZChecks.add(node);
+ if (path.isUpdateExpression()) {
+ const arg = path.get("argument");
+ const replacement = getTDZReplacement(path, state, arg.node);
+ if (!replacement) continue;
+ if (replacement.status === "maybe") {
+ dynamicTdz = true;
+ path.insertBefore(replacement.node);
+ } else {
+ path.replaceWith(replacement.node);
+ }
+ } else if (path.isAssignmentExpression()) {
+ const nodes = [];
+ const ids = path.getBindingIdentifiers();
+ for (const name of Object.keys(ids)) {
+ const replacement = getTDZReplacement(path, state, ids[name]);
+ if (replacement) {
+ nodes.push(_core.types.expressionStatement(replacement.node));
+ if (replacement.status === "inside") break;
+ if (replacement.status === "maybe") dynamicTdz = true;
+ }
+ }
+ if (nodes.length > 0) path.insertBefore(nodes);
+ }
+ }
+ for (const path of binding.referencePaths) {
+ if (path.parentPath.isUpdateExpression()) continue;
+ if (path.parentPath.isFor({
+ left: path.node
+ })) continue;
+ const replacement = getTDZReplacement(path, state);
+ if (!replacement) continue;
+ if (replacement.status === "maybe") dynamicTdz = true;
+ path.replaceWith(replacement.node);
+ }
+ return dynamicTdz;
+}
+
+//# sourceMappingURL=validation.js.map
diff --git a/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js.map b/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js.map
new file mode 100644
index 00000000..886b6076
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/lib/validation.js.map
@@ -0,0 +1 @@
+{"version":3,"names":["_core","require","validateUsage","path","state","tdzEnabled","dynamicTDZNames","name","Object","keys","getBindingIdentifiers","binding","scope","getBinding","injectTDZChecks","push","node","kind","disallowConstantViolations","violation","constantViolations","readOnlyError","addHelper","throwNode","t","callExpression","stringLiteral","isAssignmentExpression","operator","left","right","exprs","replaceWith","sequenceExpression","includes","logicalExpression","slice","binaryExpression","isUpdateExpression","unaryExpression","get","isForXStatement","ensureBlock","variableDeclaration","variableDeclarator","generateUidIdentifier","body","unshift","expressionStatement","getTDZStatus","refPath","bindingPath","executionStatus","_guessExecutionStatusRelativeTo","skipTDZChecks","WeakSet","buildTDZAssert","status","clone","cloneNode","add","getTDZReplacement","id","_path$scope$getBindin","has","isFunctionDeclaration","parent","_tdzThis","allUsages","Set","referencePaths","forEach","dynamicTdz","arg","replacement","insertBefore","nodes","ids","length","parentPath","isFor"],"sources":["../src/validation.ts"],"sourcesContent":["import { types as t, type PluginPass } from \"@babel/core\";\nimport type { Binding, NodePath } from \"@babel/traverse\";\n\nexport function validateUsage(\n path: NodePath<t.VariableDeclaration>,\n state: PluginPass,\n tdzEnabled: boolean,\n) {\n const dynamicTDZNames = [];\n\n for (const name of Object.keys(path.getBindingIdentifiers())) {\n const binding = path.scope.getBinding(name);\n // binding may be null. ref: https://github.com/babel/babel/issues/15300\n if (!binding) continue;\n if (tdzEnabled) {\n if (injectTDZChecks(binding, state)) dynamicTDZNames.push(name);\n }\n if (path.node.kind === \"const\") {\n disallowConstantViolations(name, binding, state);\n }\n }\n\n return dynamicTDZNames;\n}\n\nfunction disallowConstantViolations(\n name: string,\n binding: Binding,\n state: PluginPass,\n) {\n for (const violation of binding.constantViolations) {\n const readOnlyError = state.addHelper(\"readOnlyError\");\n const throwNode = t.callExpression(readOnlyError, [t.stringLiteral(name)]);\n\n if (violation.isAssignmentExpression()) {\n const { operator, left, right } = violation.node;\n if (operator === \"=\") {\n const exprs = [right];\n exprs.push(throwNode);\n violation.replaceWith(t.sequenceExpression(exprs));\n } else if ([\"&&=\", \"||=\", \"??=\"].includes(operator)) {\n violation.replaceWith(\n t.logicalExpression(\n // @ts-expect-error todo: give a better type to operator\n operator.slice(0, -1),\n left,\n t.sequenceExpression([right, throwNode]),\n ),\n );\n } else {\n violation.replaceWith(\n t.sequenceExpression([\n t.binaryExpression(\n // @ts-expect-error todo: give a better type to operator\n operator.slice(0, -1),\n left,\n right,\n ),\n throwNode,\n ]),\n );\n }\n } else if (violation.isUpdateExpression()) {\n violation.replaceWith(\n t.sequenceExpression([\n t.unaryExpression(\"+\", violation.get(\"argument\").node),\n throwNode,\n ]),\n );\n } else if (violation.isForXStatement()) {\n violation.ensureBlock();\n violation\n .get(\"left\")\n .replaceWith(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(violation.scope.generateUidIdentifier(name)),\n ]),\n );\n violation.node.body.body.unshift(t.expressionStatement(throwNode));\n }\n }\n}\n\nfunction getTDZStatus(refPath: NodePath, bindingPath: NodePath) {\n const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath);\n\n if (executionStatus === \"before\") {\n return \"outside\";\n } else if (executionStatus === \"after\") {\n return \"inside\";\n } else {\n return \"maybe\";\n }\n}\n\nconst skipTDZChecks = new WeakSet();\n\nfunction buildTDZAssert(\n status: \"maybe\" | \"inside\",\n node: t.Identifier | t.JSXIdentifier,\n state: PluginPass,\n) {\n if (status === \"maybe\") {\n const clone = t.cloneNode(node);\n skipTDZChecks.add(clone);\n return t.callExpression(state.addHelper(\"temporalRef\"), [\n // @ts-expect-error Fixme: we may need to handle JSXIdentifier\n clone,\n t.stringLiteral(node.name),\n ]);\n } else {\n return t.callExpression(state.addHelper(\"tdz\"), [\n t.stringLiteral(node.name),\n ]);\n }\n}\n\ntype TDZReplacement = { status: \"maybe\" | \"inside\"; node: t.Expression };\nfunction getTDZReplacement(\n path: NodePath<t.Identifier | t.JSXIdentifier>,\n state: PluginPass,\n): TDZReplacement | undefined;\nfunction getTDZReplacement(\n path: NodePath,\n state: PluginPass,\n id: t.Identifier | t.JSXIdentifier,\n): TDZReplacement | undefined;\nfunction getTDZReplacement(\n path: NodePath,\n state: PluginPass,\n id: t.Identifier | t.JSXIdentifier = path.node as any,\n): TDZReplacement | undefined {\n if (skipTDZChecks.has(id)) return;\n skipTDZChecks.add(id);\n\n const bindingPath = path.scope.getBinding(id.name)?.path;\n\n if (!bindingPath || bindingPath.isFunctionDeclaration()) return;\n\n const status = getTDZStatus(path, bindingPath);\n if (status === \"outside\") return;\n\n if (status === \"maybe\") {\n // add tdzThis to parent variable declarator so it's exploded\n // @ts-expect-error todo(flow->ts): avoid mutations\n bindingPath.parent._tdzThis = true;\n }\n\n return { status, node: buildTDZAssert(status, id, state) };\n}\n\nfunction injectTDZChecks(binding: Binding, state: PluginPass) {\n const allUsages = new Set(binding.referencePaths);\n binding.constantViolations.forEach(allUsages.add, allUsages);\n\n let dynamicTdz = false;\n\n for (const path of binding.constantViolations) {\n const { node } = path;\n if (skipTDZChecks.has(node)) continue;\n skipTDZChecks.add(node);\n\n if (path.isUpdateExpression()) {\n // arg is an identifier referencing the current binding\n const arg = path.get(\"argument\") as NodePath<t.Identifier>;\n\n const replacement = getTDZReplacement(path, state, arg.node);\n if (!replacement) continue;\n\n if (replacement.status === \"maybe\") {\n dynamicTdz = true;\n path.insertBefore(replacement.node);\n } else {\n path.replaceWith(replacement.node);\n }\n } else if (path.isAssignmentExpression()) {\n const nodes = [];\n const ids = path.getBindingIdentifiers();\n\n for (const name of Object.keys(ids)) {\n const replacement = getTDZReplacement(path, state, ids[name]);\n if (replacement) {\n nodes.push(t.expressionStatement(replacement.node));\n if (replacement.status === \"inside\") break;\n if (replacement.status === \"maybe\") dynamicTdz = true;\n }\n }\n\n if (nodes.length > 0) path.insertBefore(nodes);\n }\n }\n\n for (const path of binding.referencePaths as NodePath<t.Identifier>[]) {\n if (path.parentPath.isUpdateExpression()) continue;\n // It will be handled after transforming the loop\n if (path.parentPath.isFor({ left: path.node })) continue;\n\n const replacement = getTDZReplacement(path, state);\n if (!replacement) continue;\n if (replacement.status === \"maybe\") dynamicTdz = true;\n\n path.replaceWith(replacement.node);\n }\n\n return dynamicTdz;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGO,SAASC,aAAaA,CAC3BC,IAAqC,EACrCC,KAAiB,EACjBC,UAAmB,EACnB;EACA,MAAMC,eAAe,GAAG,EAAE;EAE1B,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACN,IAAI,CAACO,qBAAqB,CAAC,CAAC,CAAC,EAAE;IAC5D,MAAMC,OAAO,GAAGR,IAAI,CAACS,KAAK,CAACC,UAAU,CAACN,IAAI,CAAC;IAE3C,IAAI,CAACI,OAAO,EAAE;IACd,IAAIN,UAAU,EAAE;MACd,IAAIS,eAAe,CAACH,OAAO,EAAEP,KAAK,CAAC,EAAEE,eAAe,CAACS,IAAI,CAACR,IAAI,CAAC;IACjE;IACA,IAAIJ,IAAI,CAACa,IAAI,CAACC,IAAI,KAAK,OAAO,EAAE;MAC9BC,0BAA0B,CAACX,IAAI,EAAEI,OAAO,EAAEP,KAAK,CAAC;IAClD;EACF;EAEA,OAAOE,eAAe;AACxB;AAEA,SAASY,0BAA0BA,CACjCX,IAAY,EACZI,OAAgB,EAChBP,KAAiB,EACjB;EACA,KAAK,MAAMe,SAAS,IAAIR,OAAO,CAACS,kBAAkB,EAAE;IAClD,MAAMC,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e,UAAU,GAAG,IAAI;QACvD;MACF;MAEA,IAAII,KAAK,CAACE,MAAM,GAAG,CAAC,EAAE3E,IAAI,CAACwE,YAAY,CAACC,KAAK,CAAC;IAChD;EACF;EAEA,KAAK,MAAMzE,IAAI,IAAIQ,OAAO,CAAC2D,cAAc,EAA8B;IACrE,IAAInE,IAAI,CAAC4E,UAAU,CAACzC,kBAAkB,CAAC,CAAC,EAAE;IAE1C,IAAInC,IAAI,CAAC4E,UAAU,CAACC,KAAK,CAAC;MAAEnD,IAAI,EAAE1B,IAAI,CAACa;IAAK,CAAC,CAAC,EAAE;IAEhD,MAAM0D,WAAW,GAAGb,iBAAiB,CAAC1D,IAAI,EAAEC,KAAK,CAAC;IAClD,IAAI,CAACsE,WAAW,EAAE;IAClB,IAAIA,WAAW,CAACjB,MAAM,KAAK,OAAO,EAAEe,UAAU,GAAG,IAAI;IAErDrE,IAAI,CAAC6B,WAAW,CAAC0C,WAAW,CAAC1D,IAAI,CAAC;EACpC;EAEA,OAAOwD,UAAU;AACnB"} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-block-scoping/package.json b/node_modules/@babel/plugin-transform-block-scoping/package.json
new file mode 100644
index 00000000..6b9eaad9
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-block-scoping/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@babel/plugin-transform-block-scoping",
+ "version": "7.23.0",
+ "description": "Compile ES2015 block scoping (const and let) to ES5",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/babel/babel.git",
+ "directory": "packages/babel-plugin-transform-block-scoping"
+ },
+ "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-block-scoping",
+ "license": "MIT",
+ "publishConfig": {
+ "access": "public"
+ },
+ "main": "./lib/index.js",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.22.5"
+ },
+ "keywords": [
+ "babel-plugin"
+ ],
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.23.0",
+ "@babel/helper-plugin-test-runner": "^7.22.5",
+ "@babel/traverse": "^7.23.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "author": "The Babel Team (https://babel.dev/team)",
+ "type": "commonjs"
+} \ No newline at end of file