From aa773172311dcada759dfbaac485f4bc6e00bc21 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 14 Oct 2023 15:31:11 +0800 Subject: added babel --- .../@babel/plugin-transform-for-of/LICENSE | 22 +++ .../@babel/plugin-transform-for-of/README.md | 19 ++ .../@babel/plugin-transform-for-of/lib/index.js | 191 +++++++++++++++++++++ .../plugin-transform-for-of/lib/index.js.map | 1 + .../lib/no-helper-implementation.js | 153 +++++++++++++++++ .../lib/no-helper-implementation.js.map | 1 + .../@babel/plugin-transform-for-of/package.json | 34 ++++ 7 files changed, 421 insertions(+) create mode 100644 node_modules/@babel/plugin-transform-for-of/LICENSE create mode 100644 node_modules/@babel/plugin-transform-for-of/README.md create mode 100644 node_modules/@babel/plugin-transform-for-of/lib/index.js create mode 100644 node_modules/@babel/plugin-transform-for-of/lib/index.js.map create mode 100644 node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js create mode 100644 node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js.map create mode 100644 node_modules/@babel/plugin-transform-for-of/package.json (limited to 'node_modules/@babel/plugin-transform-for-of') diff --git a/node_modules/@babel/plugin-transform-for-of/LICENSE b/node_modules/@babel/plugin-transform-for-of/LICENSE new file mode 100644 index 00000000..f31575ec --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/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-for-of/README.md b/node_modules/@babel/plugin-transform-for-of/README.md new file mode 100644 index 00000000..ae389e10 --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-transform-for-of + +> Compile ES2015 for...of to ES5 + +See our website [@babel/plugin-transform-for-of](https://babeljs.io/docs/babel-plugin-transform-for-of) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-transform-for-of +``` + +or using yarn: + +```sh +yarn add @babel/plugin-transform-for-of --dev +``` diff --git a/node_modules/@babel/plugin-transform-for-of/lib/index.js b/node_modules/@babel/plugin-transform-for-of/lib/index.js new file mode 100644 index 00000000..3d4daace --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/lib/index.js @@ -0,0 +1,191 @@ +"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 _noHelperImplementation = require("./no-helper-implementation.js"); +function buildLoopBody(path, declar, newBody) { + let block; + const bodyPath = path.get("body"); + const body = newBody != null ? newBody : bodyPath.node; + if (_core.types.isBlockStatement(body) && Object.keys(path.getBindingIdentifiers()).some(id => bodyPath.scope.hasOwnBinding(id))) { + block = _core.types.blockStatement([declar, body]); + } else { + block = _core.types.toBlock(body); + block.body.unshift(declar); + } + return block; +} +var _default = (0, _helperPluginUtils.declare)((api, options) => { + var _options$assumeArray, _options$allowArrayLi, _api$assumption; + api.assertVersion(7); + { + const { + assumeArray, + allowArrayLike, + loose + } = options; + if (loose === true && assumeArray === true) { + throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`); + } + if (assumeArray === true && allowArrayLike === true) { + throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`); + } + { + if (allowArrayLike && /^7\.\d\./.test(api.version)) { + throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`); + } + } + } + const iterableIsArray = (_options$assumeArray = options.assumeArray) != null ? _options$assumeArray : !options.loose && api.assumption("iterableIsArray"); + const arrayLikeIsIterable = (_options$allowArrayLi = options.allowArrayLike) != null ? _options$allowArrayLi : api.assumption("arrayLikeIsIterable"); + const skipIteratorClosing = (_api$assumption = api.assumption("skipForOfIteratorClosing")) != null ? _api$assumption : options.loose; + if (iterableIsArray && arrayLikeIsIterable) { + throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`); + } + if (iterableIsArray) { + return { + name: "transform-for-of", + visitor: { + ForOfStatement(path) { + const { + scope + } = path; + const { + left, + right, + await: isAwait + } = path.node; + if (isAwait) { + return; + } + const i = scope.generateUidIdentifier("i"); + let array = scope.maybeGenerateMemoised(right, true); + const inits = [_core.types.variableDeclarator(i, _core.types.numericLiteral(0))]; + if (array) { + inits.push(_core.types.variableDeclarator(array, right)); + } else { + array = right; + } + const item = _core.types.memberExpression(_core.types.cloneNode(array), _core.types.cloneNode(i), true); + let assignment; + if (_core.types.isVariableDeclaration(left)) { + assignment = left; + assignment.declarations[0].init = item; + } else { + assignment = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, item)); + } + path.replaceWith(_core.types.forStatement(_core.types.variableDeclaration("let", inits), _core.types.binaryExpression("<", _core.types.cloneNode(i), _core.types.memberExpression(_core.types.cloneNode(array), _core.types.identifier("length"))), _core.types.updateExpression("++", _core.types.cloneNode(i)), buildLoopBody(path, assignment))); + } + } + }; + } + const buildForOfArray = (0, _core.template)` + for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY; + `; + const buildForOfNoIteratorClosing = _core.template.statements` + for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; + !(STEP_KEY = ITERATOR_HELPER()).done;) BODY; + `; + const buildForOf = _core.template.statements` + var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; + try { + for (ITERATOR_HELPER.s(); !(STEP_KEY = ITERATOR_HELPER.n()).done;) BODY; + } catch (err) { + ITERATOR_HELPER.e(err); + } finally { + ITERATOR_HELPER.f(); + } + `; + const builder = skipIteratorClosing ? { + build: buildForOfNoIteratorClosing, + helper: "createForOfIteratorHelperLoose", + getContainer: nodes => nodes + } : { + build: buildForOf, + helper: "createForOfIteratorHelper", + getContainer: nodes => nodes[1].block.body + }; + function _ForOfStatementArray(path) { + const { + node, + scope + } = path; + const right = scope.generateUidIdentifierBasedOnNode(node.right, "arr"); + const iterationKey = scope.generateUidIdentifier("i"); + const loop = buildForOfArray({ + BODY: node.body, + KEY: iterationKey, + NAME: right, + ARR: node.right + }); + _core.types.inherits(loop, node); + const iterationValue = _core.types.memberExpression(_core.types.cloneNode(right), _core.types.cloneNode(iterationKey), true); + let declar; + const left = node.left; + if (_core.types.isVariableDeclaration(left)) { + left.declarations[0].init = iterationValue; + declar = left; + } else { + declar = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, iterationValue)); + } + loop.body = buildLoopBody(path, declar, loop.body); + return loop; + } + return { + name: "transform-for-of", + visitor: { + ForOfStatement(path, state) { + const right = path.get("right"); + if (right.isArrayExpression() || right.isGenericType("Array") || _core.types.isArrayTypeAnnotation(right.getTypeAnnotation())) { + path.replaceWith(_ForOfStatementArray(path)); + return; + } + { + if (!state.availableHelper(builder.helper)) { + (0, _noHelperImplementation.default)(skipIteratorClosing, path, state); + return; + } + } + const { + node, + parent, + scope + } = path; + const left = node.left; + let declar; + const stepKey = scope.generateUid("step"); + const stepValue = _core.types.memberExpression(_core.types.identifier(stepKey), _core.types.identifier("value")); + if (_core.types.isVariableDeclaration(left)) { + declar = _core.types.variableDeclaration(left.kind, [_core.types.variableDeclarator(left.declarations[0].id, stepValue)]); + } else { + declar = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, stepValue)); + } + const nodes = builder.build({ + CREATE_ITERATOR_HELPER: state.addHelper(builder.helper), + ITERATOR_HELPER: scope.generateUidIdentifier("iterator"), + ARRAY_LIKE_IS_ITERABLE: arrayLikeIsIterable ? _core.types.booleanLiteral(true) : null, + STEP_KEY: _core.types.identifier(stepKey), + OBJECT: node.right, + BODY: buildLoopBody(path, declar) + }); + const container = builder.getContainer(nodes); + _core.types.inherits(container[0], node); + _core.types.inherits(container[0].body, node.body); + if (_core.types.isLabeledStatement(parent)) { + container[0] = _core.types.labeledStatement(parent.label, container[0]); + path.parentPath.replaceWithMultiple(nodes); + path.skip(); + } else { + path.replaceWithMultiple(nodes); + } + } + } + }; +}); +exports.default = _default; + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/plugin-transform-for-of/lib/index.js.map b/node_modules/@babel/plugin-transform-for-of/lib/index.js.map new file mode 100644 index 00000000..11016d6c --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_helperPluginUtils","require","_core","_noHelperImplementation","buildLoopBody","path","declar","newBody","block","bodyPath","get","body","node","t","isBlockStatement","Object","keys","getBindingIdentifiers","some","id","scope","hasOwnBinding","blockStatement","toBlock","unshift","_default","declare","api","options","_options$assumeArray","_options$allowArrayLi","_api$assumption","assertVersion","assumeArray","allowArrayLike","loose","Error","test","version","iterableIsArray","assumption","arrayLikeIsIterable","skipIteratorClosing","name","visitor","ForOfStatement","left","right","await","isAwait","i","generateUidIdentifier","array","maybeGenerateMemoised","inits","variableDeclarator","numericLiteral","push","item","memberExpression","cloneNode","assignment","isVariableDeclaration","declarations","init","expressionStatement","assignmentExpression","replaceWith","forStatement","variableDeclaration","binaryExpression","identifier","updateExpression","buildForOfArray","template","buildForOfNoIteratorClosing","statements","buildForOf","builder","build","helper","getContainer","nodes","_ForOfStatementArray","generateUidIdentifierBasedOnNode","iterationKey","loop","BODY","KEY","NAME","ARR","inherits","iterationValue","state","isArrayExpression","isGenericType","isArrayTypeAnnotation","getTypeAnnotation","availableHelper","transformWithoutHelper","parent","stepKey","generateUid","stepValue","kind","CREATE_ITERATOR_HELPER","addHelper","ITERATOR_HELPER","ARRAY_LIKE_IS_ITERABLE","booleanLiteral","STEP_KEY","OBJECT","container","isLabeledStatement","labeledStatement","label","parentPath","replaceWithMultiple","skip","exports","default"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { template, types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport transformWithoutHelper from \"./no-helper-implementation.ts\";\n\nexport interface Options {\n allowArrayLike?: boolean;\n assumeArray?: boolean;\n loose?: boolean;\n}\n\nfunction buildLoopBody(\n path: NodePath,\n declar: t.Statement,\n newBody?: t.Statement | t.Expression,\n) {\n let block;\n const bodyPath = path.get(\"body\");\n const body = newBody ?? bodyPath.node;\n if (\n t.isBlockStatement(body) &&\n Object.keys(path.getBindingIdentifiers()).some(id =>\n bodyPath.scope.hasOwnBinding(id),\n )\n ) {\n block = t.blockStatement([declar, body]);\n } else {\n block = t.toBlock(body);\n block.body.unshift(declar);\n }\n return block;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n {\n const { assumeArray, allowArrayLike, loose } = options;\n\n if (loose === true && assumeArray === true) {\n throw new Error(\n `The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`,\n );\n }\n\n if (assumeArray === true && allowArrayLike === true) {\n throw new Error(\n `The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`,\n );\n }\n\n if (!process.env.BABEL_8_BREAKING) {\n // TODO: Remove in Babel 8\n if (allowArrayLike && /^7\\.\\d\\./.test(api.version)) {\n throw new Error(\n `The allowArrayLike is only supported when using @babel/core@^7.10.0`,\n );\n }\n }\n }\n\n const iterableIsArray =\n options.assumeArray ??\n // Loose mode is not compatible with 'assumeArray', so we shouldn't read\n // 'iterableIsArray' if 'loose' is true.\n (!options.loose && api.assumption(\"iterableIsArray\"));\n\n const arrayLikeIsIterable =\n options.allowArrayLike ?? api.assumption(\"arrayLikeIsIterable\");\n\n const skipIteratorClosing =\n api.assumption(\"skipForOfIteratorClosing\") ?? options.loose;\n\n if (iterableIsArray && arrayLikeIsIterable) {\n throw new Error(\n `The \"iterableIsArray\" and \"arrayLikeIsIterable\" assumptions are not compatible.`,\n );\n }\n\n if (iterableIsArray) {\n return {\n name: \"transform-for-of\",\n\n visitor: {\n ForOfStatement(path) {\n const { scope } = path;\n const { left, right, await: isAwait } = path.node;\n if (isAwait) {\n return;\n }\n const i = scope.generateUidIdentifier(\"i\");\n let array: t.Identifier | t.ThisExpression =\n scope.maybeGenerateMemoised(right, true);\n\n const inits = [t.variableDeclarator(i, t.numericLiteral(0))];\n if (array) {\n inits.push(t.variableDeclarator(array, right));\n } else {\n array = right as t.Identifier | t.ThisExpression;\n }\n\n const item = t.memberExpression(\n t.cloneNode(array),\n t.cloneNode(i),\n true,\n );\n let assignment;\n if (t.isVariableDeclaration(left)) {\n assignment = left;\n assignment.declarations[0].init = item;\n } else {\n assignment = t.expressionStatement(\n t.assignmentExpression(\"=\", left, item),\n );\n }\n\n path.replaceWith(\n t.forStatement(\n t.variableDeclaration(\"let\", inits),\n t.binaryExpression(\n \"<\",\n t.cloneNode(i),\n t.memberExpression(t.cloneNode(array), t.identifier(\"length\")),\n ),\n t.updateExpression(\"++\", t.cloneNode(i)),\n buildLoopBody(path, assignment),\n ),\n );\n },\n },\n };\n }\n\n const buildForOfArray = template`\n for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY;\n `;\n\n const buildForOfNoIteratorClosing = template.statements`\n for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY;\n !(STEP_KEY = ITERATOR_HELPER()).done;) BODY;\n `;\n\n const buildForOf = template.statements`\n var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY;\n try {\n for (ITERATOR_HELPER.s(); !(STEP_KEY = ITERATOR_HELPER.n()).done;) BODY;\n } catch (err) {\n ITERATOR_HELPER.e(err);\n } finally {\n ITERATOR_HELPER.f();\n }\n `;\n\n const builder = skipIteratorClosing\n ? {\n build: buildForOfNoIteratorClosing,\n helper: \"createForOfIteratorHelperLoose\",\n getContainer: (nodes: t.Statement[]): [t.ForStatement] =>\n nodes as [t.ForStatement],\n }\n : {\n build: buildForOf,\n helper: \"createForOfIteratorHelper\",\n getContainer: (nodes: t.Statement[]): [t.ForStatement] =>\n (nodes[1] as t.TryStatement).block.body as [t.ForStatement],\n };\n\n function _ForOfStatementArray(path: NodePath) {\n const { node, scope } = path;\n\n const right = scope.generateUidIdentifierBasedOnNode(node.right, \"arr\");\n const iterationKey = scope.generateUidIdentifier(\"i\");\n\n const loop = buildForOfArray({\n BODY: node.body,\n KEY: iterationKey,\n NAME: right,\n ARR: node.right,\n }) as t.For;\n\n t.inherits(loop, node);\n\n const iterationValue = t.memberExpression(\n t.cloneNode(right),\n t.cloneNode(iterationKey),\n true,\n );\n\n let declar;\n const left = node.left;\n if (t.isVariableDeclaration(left)) {\n left.declarations[0].init = iterationValue;\n declar = left;\n } else {\n declar = t.expressionStatement(\n t.assignmentExpression(\"=\", left, iterationValue),\n );\n }\n\n loop.body = buildLoopBody(path, declar, loop.body);\n\n return loop;\n }\n\n return {\n name: \"transform-for-of\",\n visitor: {\n ForOfStatement(path, state) {\n const right = path.get(\"right\");\n if (\n right.isArrayExpression() ||\n (process.env.BABEL_8_BREAKING\n ? right.isGenericType(\"Array\")\n : right.isGenericType(\"Array\") ||\n t.isArrayTypeAnnotation(right.getTypeAnnotation()))\n ) {\n path.replaceWith(_ForOfStatementArray(path));\n return;\n }\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(builder.helper)) {\n // Babel <7.9.0 doesn't support this helper\n transformWithoutHelper(skipIteratorClosing, path, state);\n return;\n }\n }\n\n const { node, parent, scope } = path;\n const left = node.left;\n let declar;\n\n const stepKey = scope.generateUid(\"step\");\n const stepValue = t.memberExpression(\n t.identifier(stepKey),\n t.identifier(\"value\"),\n );\n\n if (t.isVariableDeclaration(left)) {\n // for (let i of test)\n declar = t.variableDeclaration(left.kind, [\n t.variableDeclarator(left.declarations[0].id, stepValue),\n ]);\n } else {\n // for (i of test), for ({ i } of test)\n declar = t.expressionStatement(\n t.assignmentExpression(\"=\", left, stepValue),\n );\n }\n\n const nodes = builder.build({\n CREATE_ITERATOR_HELPER: state.addHelper(builder.helper),\n ITERATOR_HELPER: scope.generateUidIdentifier(\"iterator\"),\n ARRAY_LIKE_IS_ITERABLE: arrayLikeIsIterable\n ? t.booleanLiteral(true)\n : null,\n STEP_KEY: t.identifier(stepKey),\n OBJECT: node.right,\n BODY: buildLoopBody(path, declar),\n });\n const container = builder.getContainer(nodes);\n\n t.inherits(container[0], node);\n t.inherits(container[0].body, node.body);\n\n if (t.isLabeledStatement(parent)) {\n // @ts-expect-error replacing node types\n container[0] = t.labeledStatement(parent.label, container[0]);\n\n path.parentPath.replaceWithMultiple(nodes);\n\n // The parent has been replaced, prevent Babel from traversing a detached path\n path.skip();\n } else {\n path.replaceWithMultiple(nodes);\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGA,IAAAE,uBAAA,GAAAF,OAAA;AAQA,SAASG,aAAaA,CACpBC,IAA+B,EAC/BC,MAAmB,EACnBC,OAAoC,EACpC;EACA,IAAIC,KAAK;EACT,MAAMC,QAAQ,GAAGJ,IAAI,CAACK,GAAG,CAAC,MAAM,CAAC;EACjC,MAA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BAAmB,CAACnC,KAAK,CAAC;UAG1C7E,IAAI,CAACiH,IAAI,CAAC,CAAC;QACb,CAAC,MAAM;UACLjH,IAAI,CAACgH,mBAAmB,CAACnC,KAAK,CAAC;QACjC;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC;AAAAqC,OAAA,CAAAC,OAAA,GAAA/F,QAAA"} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js b/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js new file mode 100644 index 00000000..ca667085 --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js @@ -0,0 +1,153 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = transformWithoutHelper; +var _core = require("@babel/core"); +function transformWithoutHelper(loose, path, state) { + const pushComputedProps = loose ? pushComputedPropsLoose : pushComputedPropsSpec; + const { + node + } = path; + const build = pushComputedProps(path, state); + const declar = build.declar; + const loop = build.loop; + const block = loop.body; + path.ensureBlock(); + if (declar) { + block.body.push(declar); + } + block.body.push(...node.body.body); + _core.types.inherits(loop, node); + _core.types.inherits(loop.body, node.body); + if (build.replaceParent) { + path.parentPath.replaceWithMultiple(build.node); + path.remove(); + } else { + path.replaceWithMultiple(build.node); + } +} +const buildForOfLoose = _core.template.statement(` + for (var LOOP_OBJECT = OBJECT, + IS_ARRAY = Array.isArray(LOOP_OBJECT), + INDEX = 0, + LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) { + INTERMEDIATE; + if (IS_ARRAY) { + if (INDEX >= LOOP_OBJECT.length) break; + ID = LOOP_OBJECT[INDEX++]; + } else { + INDEX = LOOP_OBJECT.next(); + if (INDEX.done) break; + ID = INDEX.value; + } + } +`); +const buildForOf = _core.template.statements(` + var ITERATOR_COMPLETION = true; + var ITERATOR_HAD_ERROR_KEY = false; + var ITERATOR_ERROR_KEY = undefined; + try { + for ( + var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; + !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); + ITERATOR_COMPLETION = true + ) {} + } catch (err) { + ITERATOR_HAD_ERROR_KEY = true; + ITERATOR_ERROR_KEY = err; + } finally { + try { + if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) { + ITERATOR_KEY.return(); + } + } finally { + if (ITERATOR_HAD_ERROR_KEY) { + throw ITERATOR_ERROR_KEY; + } + } + } +`); +function pushComputedPropsLoose(path, state) { + const { + node, + scope, + parent + } = path; + const { + left + } = node; + let declar, id, intermediate; + if (_core.types.isIdentifier(left) || _core.types.isPattern(left) || _core.types.isMemberExpression(left)) { + id = left; + intermediate = null; + } else if (_core.types.isVariableDeclaration(left)) { + id = scope.generateUidIdentifier("ref"); + declar = _core.types.variableDeclaration(left.kind, [_core.types.variableDeclarator(left.declarations[0].id, _core.types.identifier(id.name))]); + intermediate = _core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(id.name))]); + } else { + throw state.buildCodeFrameError(left, `Unknown node type ${left.type} in ForStatement`); + } + const iteratorKey = scope.generateUidIdentifier("iterator"); + const isArrayKey = scope.generateUidIdentifier("isArray"); + const loop = buildForOfLoose({ + LOOP_OBJECT: iteratorKey, + IS_ARRAY: isArrayKey, + OBJECT: node.right, + INDEX: scope.generateUidIdentifier("i"), + ID: id, + INTERMEDIATE: intermediate + }); + const isLabeledParent = _core.types.isLabeledStatement(parent); + let labeled; + if (isLabeledParent) { + labeled = _core.types.labeledStatement(parent.label, loop); + } + return { + replaceParent: isLabeledParent, + declar: declar, + node: labeled || loop, + loop: loop + }; +} +function pushComputedPropsSpec(path, state) { + const { + node, + scope, + parent + } = path; + const left = node.left; + let declar; + const stepKey = scope.generateUid("step"); + const stepValue = _core.types.memberExpression(_core.types.identifier(stepKey), _core.types.identifier("value")); + if (_core.types.isIdentifier(left) || _core.types.isPattern(left) || _core.types.isMemberExpression(left)) { + declar = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, stepValue)); + } else if (_core.types.isVariableDeclaration(left)) { + declar = _core.types.variableDeclaration(left.kind, [_core.types.variableDeclarator(left.declarations[0].id, stepValue)]); + } else { + throw state.buildCodeFrameError(left, `Unknown node type ${left.type} in ForStatement`); + } + const template = buildForOf({ + ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), + ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), + ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), + ITERATOR_KEY: scope.generateUidIdentifier("iterator"), + STEP_KEY: _core.types.identifier(stepKey), + OBJECT: node.right + }); + const isLabeledParent = _core.types.isLabeledStatement(parent); + const tryBody = template[3].block.body; + const loop = tryBody[0]; + if (isLabeledParent) { + tryBody[0] = _core.types.labeledStatement(parent.label, loop); + } + return { + replaceParent: isLabeledParent, + declar: declar, + loop: loop, + node: template + }; +} + +//# sourceMappingURL=no-helper-implementation.js.map diff --git a/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js.map b/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js.map new file mode 100644 index 00000000..6f082203 --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/lib/no-helper-implementation.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_core","require","transformWithoutHelper","loose","path","state","pushComputedProps","pushComputedPropsLoose","pushComputedPropsSpec","node","build","declar","loop","block","body","ensureBlock","push","t","inherits","replaceParent","parentPath","replaceWithMultiple","remove","buildForOfLoose","template","statement","buildForOf","statements","scope","parent","left","id","intermediate","isIdentifier","isPattern","isMemberExpression","isVariableDeclaration","generateUidIdentifier","variableDeclaration","kind","variableDeclarator","declarations","identifier","name","buildCodeFrameError","type","iteratorKey","isArrayKey","LOOP_OBJECT","IS_ARRAY","OBJECT","right","INDEX","ID","INTERMEDIATE","isLabeledParent","isLabeledStatement","labeled","labeledStatement","label","stepKey","generateUid","stepValue","memberExpression","expressionStatement","assignmentExpression","ITERATOR_HAD_ERROR_KEY","ITERATOR_COMPLETION","ITERATOR_ERROR_KEY","ITERATOR_KEY","STEP_KEY","tryBody"],"sources":["../src/no-helper-implementation.ts"],"sourcesContent":["import { type PluginPass, template, types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\n\n// This is the legacy implementation, which inlines all the code.\n// It must be kept for compatibility reasons.\n// TODO(Babel 8): Remove this file.\n\nexport default function transformWithoutHelper(\n loose: boolean | void,\n path: NodePath,\n state: PluginPass,\n) {\n const pushComputedProps = loose\n ? pushComputedPropsLoose\n : pushComputedPropsSpec;\n\n const { node } = path;\n const build = pushComputedProps(path, state);\n const declar = build.declar;\n const loop = build.loop;\n const block = loop.body as t.BlockStatement;\n\n // ensure that it's a block so we can take all its statements\n path.ensureBlock();\n\n // add the value declaration to the new loop body\n if (declar) {\n block.body.push(declar);\n }\n\n // push the rest of the original loop body onto our new body\n block.body.push(...(node.body as t.BlockStatement).body);\n\n t.inherits(loop, node);\n t.inherits(loop.body, node.body);\n\n if (build.replaceParent) {\n path.parentPath.replaceWithMultiple(build.node);\n path.remove();\n } else {\n path.replaceWithMultiple(build.node);\n }\n}\n\nconst buildForOfLoose = template.statement(`\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n INTERMEDIATE;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n`);\n\nconst buildForOf = template.statements(`\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY;\n !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done);\n ITERATOR_COMPLETION = true\n ) {}\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n`);\n\nfunction pushComputedPropsLoose(\n path: NodePath,\n state: PluginPass,\n) {\n const { node, scope, parent } = path;\n const { left } = node;\n let declar, id, intermediate;\n\n if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {\n // for (i of test), for ({ i } of test)\n id = left;\n intermediate = null;\n } else if (t.isVariableDeclaration(left)) {\n // for (let i of test)\n id = scope.generateUidIdentifier(\"ref\");\n declar = t.variableDeclaration(left.kind, [\n t.variableDeclarator(left.declarations[0].id, t.identifier(id.name)),\n ]);\n intermediate = t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.identifier(id.name)),\n ]);\n } else {\n throw state.buildCodeFrameError(\n left,\n `Unknown node type ${left.type} in ForStatement`,\n );\n }\n\n const iteratorKey = scope.generateUidIdentifier(\"iterator\");\n const isArrayKey = scope.generateUidIdentifier(\"isArray\");\n\n const loop = buildForOfLoose({\n LOOP_OBJECT: iteratorKey,\n IS_ARRAY: isArrayKey,\n OBJECT: node.right,\n INDEX: scope.generateUidIdentifier(\"i\"),\n ID: id,\n INTERMEDIATE: intermediate,\n }) as t.ForStatement;\n\n //\n const isLabeledParent = t.isLabeledStatement(parent);\n let labeled;\n\n if (isLabeledParent) {\n labeled = t.labeledStatement(parent.label, loop);\n }\n\n return {\n replaceParent: isLabeledParent,\n declar: declar,\n node: labeled || loop,\n loop: loop,\n };\n}\n\nfunction pushComputedPropsSpec(\n path: NodePath,\n state: PluginPass,\n) {\n const { node, scope, parent } = path;\n const left = node.left;\n let declar;\n\n const stepKey = scope.generateUid(\"step\");\n const stepValue = t.memberExpression(\n t.identifier(stepKey),\n t.identifier(\"value\"),\n );\n\n if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {\n // for (i of test), for ({ i } of test)\n declar = t.expressionStatement(\n t.assignmentExpression(\"=\", left, stepValue),\n );\n } else if (t.isVariableDeclaration(left)) {\n // for (let i of test)\n declar = t.variableDeclaration(left.kind, [\n t.variableDeclarator(left.declarations[0].id, stepValue),\n ]);\n } else {\n throw state.buildCodeFrameError(\n left,\n `Unknown node type ${left.type} in ForStatement`,\n );\n }\n\n const template = buildForOf({\n ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier(\"didIteratorError\"),\n ITERATOR_COMPLETION: scope.generateUidIdentifier(\n \"iteratorNormalCompletion\",\n ),\n ITERATOR_ERROR_KEY: scope.generateUidIdentifier(\"iteratorError\"),\n ITERATOR_KEY: scope.generateUidIdentifier(\"iterator\"),\n STEP_KEY: t.identifier(stepKey),\n OBJECT: node.right,\n });\n\n const isLabeledParent = t.isLabeledStatement(parent);\n\n const tryBody = (template[3] as t.TryStatement).block.body;\n const loop = tryBody[0] as t.ForStatement;\n\n if (isLabeledParent) {\n tryBody[0] = t.labeledStatement(parent.label, loop);\n }\n\n //\n\n return {\n replaceParent: isLabeledParent,\n declar: declar,\n loop: loop,\n node: template,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOe,SAASC,sBAAsBA,CAC5CC,KAAqB,EACrBC,IAAgC,EAChCC,KAAiB,EACjB;EACA,MAAMC,iBAAiB,GAAGH,KAAK,GAC3BI,sBAAsB,GACtBC,qBAAqB;EAEzB,MAAM;IAAEC;EAAK,CAAC,GAAGL,IAAI;EACrB,MAAMM,KAAK,GAAGJ,iBAAiB,CAACF,IAAI,EAAEC,KAAK,CAAC;EAC5C,MAAMM,MAAM,GAAGD,KAAK,CAACC,MAAM;EAC3B,MAAMC,IAAI,GAAGF,KAAK,CAACE,IAAI;EACvB,MAAMC,K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V,EAAE,EAAE+B,SAAS,CAAC,CACzD,CAAC;EACJ,CAAC,MAAM;IACL,MAAMzD,KAAK,CAACuC,mBAAmB,CAC7Bd,IAAI,EACH,qBAAoBA,IAAI,CAACe,IAAK,kBACjC,CAAC;EACH;EAEA,MAAMrB,QAAQ,GAAGE,UAAU,CAAC;IAC1BwC,sBAAsB,EAAEtC,KAAK,CAACS,qBAAqB,CAAC,kBAAkB,CAAC;IACvE8B,mBAAmB,EAAEvC,KAAK,CAACS,qBAAqB,CAC9C,0BACF,CAAC;IACD+B,kBAAkB,EAAExC,KAAK,CAACS,qBAAqB,CAAC,eAAe,CAAC;IAChEgC,YAAY,EAAEzC,KAAK,CAACS,qBAAqB,CAAC,UAAU,CAAC;IACrDiC,QAAQ,EAAErD,WAAC,CAACyB,UAAU,CAACkB,OAAO,CAAC;IAC/BV,MAAM,EAAEzC,IAAI,CAAC0C;EACf,CAAC,CAAC;EAEF,MAAMI,eAAe,GAAGtC,WAAC,CAACuC,kBAAkB,CAAC3B,MAAM,CAAC;EAEpD,MAAM0C,OAAO,GAAI/C,QAAQ,CAAC,CAAC,CAAC,CAAoBX,KAAK,CAACC,IAAI;EAC1D,MAAMF,IAAI,GAAG2D,OAAO,CAAC,CAAC,CAAmB;EAEzC,IAAIhB,eAAe,EAAE;IACnBgB,OAAO,CAAC,CAAC,CAAC,GAAGtD,WAAC,CAACyC,gBAAgB,CAAC7B,MAAM,CAAC8B,KAAK,EAAE/C,IAAI,CAAC;EACrD;EAIA,OAAO;IACLO,aAAa,EAAEoC,eAAe;IAC9B5C,MAAM,EAAEA,MAAM;IACdC,IAAI,EAAEA,IAAI;IACVH,IAAI,EAAEe;EACR,CAAC;AACH"} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-for-of/package.json b/node_modules/@babel/plugin-transform-for-of/package.json new file mode 100644 index 00000000..56fccae8 --- /dev/null +++ b/node_modules/@babel/plugin-transform-for-of/package.json @@ -0,0 +1,34 @@ +{ + "name": "@babel/plugin-transform-for-of", + "version": "7.22.15", + "description": "Compile ES2015 for...of to ES5", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-transform-for-of" + }, + "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-for-of", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "./lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.22.15", + "@babel/helper-plugin-test-runner": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "author": "The Babel Team (https://babel.dev/team)", + "type": "commonjs" +} \ No newline at end of file -- cgit v1.2.3