diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:31:11 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:31:11 +0800 |
| commit | aa773172311dcada759dfbaac485f4bc6e00bc21 (patch) | |
| tree | ca6d9a5eff3ab8f689f9acb4f0df791d9486813d /node_modules/@babel/plugin-transform-logical-assignment-operators | |
| parent | c5a5384e846f242e901e859fe600d695d8990a9a (diff) | |
added babel
Diffstat (limited to 'node_modules/@babel/plugin-transform-logical-assignment-operators')
5 files changed, 134 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-transform-logical-assignment-operators/LICENSE b/node_modules/@babel/plugin-transform-logical-assignment-operators/LICENSE new file mode 100644 index 00000000..f31575ec --- /dev/null +++ b/node_modules/@babel/plugin-transform-logical-assignment-operators/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-logical-assignment-operators/README.md b/node_modules/@babel/plugin-transform-logical-assignment-operators/README.md new file mode 100644 index 00000000..bf3795d7 --- /dev/null +++ b/node_modules/@babel/plugin-transform-logical-assignment-operators/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-transform-logical-assignment-operators + +> Transforms logical assignment operators into short-circuited assignments + +See our website [@babel/plugin-transform-logical-assignment-operators](https://babeljs.io/docs/babel-plugin-transform-logical-assignment-operators) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-transform-logical-assignment-operators +``` + +or using yarn: + +```sh +yarn add @babel/plugin-transform-logical-assignment-operators --dev +``` diff --git a/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js b/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js new file mode 100644 index 00000000..984841d7 --- /dev/null +++ b/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js @@ -0,0 +1,56 @@ +"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 _default = (0, _helperPluginUtils.declare)(api => { + api.assertVersion(7); + return { + name: "transform-logical-assignment-operators", + inherits: require("@babel/plugin-syntax-logical-assignment-operators").default, + visitor: { + AssignmentExpression(path) { + const { + node, + scope + } = path; + const { + operator, + left, + right + } = node; + const operatorTrunc = operator.slice(0, -1); + if (!_core.types.LOGICAL_OPERATORS.includes(operatorTrunc)) { + return; + } + const lhs = _core.types.cloneNode(left); + if (_core.types.isMemberExpression(left)) { + const { + object, + property, + computed + } = left; + const memo = scope.maybeGenerateMemoised(object); + if (memo) { + left.object = memo; + lhs.object = _core.types.assignmentExpression("=", _core.types.cloneNode(memo), object); + } + if (computed) { + const memo = scope.maybeGenerateMemoised(property); + if (memo) { + left.property = memo; + lhs.property = _core.types.assignmentExpression("=", _core.types.cloneNode(memo), property); + } + } + } + path.replaceWith(_core.types.logicalExpression(operatorTrunc, lhs, _core.types.assignmentExpression("=", left, right))); + } + } + }; +}); +exports.default = _default; + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js.map b/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js.map new file mode 100644 index 00000000..009ce9ac --- /dev/null +++ b/node_modules/@babel/plugin-transform-logical-assignment-operators/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_helperPluginUtils","require","_core","_default","declare","api","assertVersion","name","inherits","default","visitor","AssignmentExpression","path","node","scope","operator","left","right","operatorTrunc","slice","t","LOGICAL_OPERATORS","includes","lhs","cloneNode","isMemberExpression","object","property","computed","memo","maybeGenerateMemoised","assignmentExpression","replaceWith","logicalExpression","exports"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { types as t } from \"@babel/core\";\n\nexport default declare(api => {\n api.assertVersion(7);\n\n return {\n name: \"transform-logical-assignment-operators\",\n inherits: USE_ESM\n ? undefined\n : IS_STANDALONE\n ? undefined\n : // eslint-disable-next-line no-restricted-globals\n require(\"@babel/plugin-syntax-logical-assignment-operators\").default,\n\n visitor: {\n AssignmentExpression(path) {\n const { node, scope } = path;\n const { operator, left, right } = node;\n const operatorTrunc = operator.slice(0, -1);\n if (!t.LOGICAL_OPERATORS.includes(operatorTrunc)) {\n return;\n }\n\n const lhs = t.cloneNode(left) as t.Identifier | t.MemberExpression;\n if (t.isMemberExpression(left)) {\n const { object, property, computed } = left;\n const memo = scope.maybeGenerateMemoised(object);\n if (memo) {\n left.object = memo;\n (lhs as t.MemberExpression).object = t.assignmentExpression(\n \"=\",\n t.cloneNode(memo),\n // object must not be Super when `memo` is an identifier\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n object as t.Expression,\n );\n }\n\n if (computed) {\n const memo = scope.maybeGenerateMemoised(property);\n if (memo) {\n left.property = memo;\n (lhs as t.MemberExpression).property = t.assignmentExpression(\n \"=\",\n t.cloneNode(memo),\n // @ts-expect-error todo(flow->ts): property can be t.PrivateName\n property,\n );\n }\n }\n }\n\n path.replaceWith(\n t.logicalExpression(\n // @ts-expect-error operatorTrunc has been tested by t.LOGICAL_OPERATORS\n operatorTrunc,\n lhs,\n t.assignmentExpression(\"=\", left, right),\n ),\n );\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAyC,IAAAE,QAAA,GAE1B,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAC,CAAC,CAAC;EAEpB,OAAO;IACLC,IAAI,EAAE,wCAAwC;IAC9CC,QAAQ,EAKJP,OAAO,CAAC,mDAAmD,CAAC,CAACQ,OAAO;IAExEC,OAAO,EAAE;MACPC,oBAAoBA,CAACC,IAAI,EAAE;QACzB,MAAM;UAAEC,IAAI;UAAEC;QAAM,CAAC,GAAGF,IAAI;QAC5B,MAAM;UAAEG,QAAQ;UAAEC,IAAI;UAAEC;QAAM,CAAC,GAAGJ,IAAI;QACtC,MAAMK,aAAa,GAAGH,QAAQ,CAACI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,IAAI,CAACC,WAAC,CAACC,iBAAiB,CAACC,QAAQ,CAACJ,aAAa,CAAC,EAAE;UAChD;QACF;QAEA,MAAMK,GAAG,GAAGH,WAAC,CAACI,SAAS,CAACR,IAAI,CAAsC;QAClE,IAAII,WAAC,CAACK,kBAAkB,CAACT,IAAI,CAAC,EAAE;UAC9B,MAAM;YAAEU,MAAM;YAAEC,QAAQ;YAAEC;UAAS,CAAC,GAAGZ,IAAI;UAC3C,MAAMa,IAAI,GAAGf,KAAK,CAACgB,qBAAqB,CAACJ,MAAM,CAAC;UAChD,IAAIG,IAAI,EAAE;YACRb,IAAI,CAACU,MAAM,GAAGG,IAAI;YACjBN,GAAG,CAAwBG,MAAM,GAAGN,WAAC,CAACW,oBAAoB,CACzD,GAAG,EACHX,WAAC,CAACI,SAAS,CAACK,IAAI,CAAC,EAGjBH,MACF,CAAC;UACH;UAEA,IAAIE,QAAQ,EAAE;YACZ,MAAMC,IAAI,GAAGf,KAAK,CAACgB,qBAAqB,CAACH,QAAQ,CAAC;YAClD,IAAIE,IAAI,EAAE;cACRb,IAAI,CAACW,QAAQ,GAAGE,IAAI;cACnBN,GAAG,CAAwBI,QAAQ,GAAGP,WAAC,CAACW,oBAAoB,CAC3D,GAAG,EACHX,WAAC,CAACI,SAAS,CAACK,IAAI,CAAC,EAEjBF,QACF,CAAC;YACH;UACF;QACF;QAEAf,IAAI,CAACoB,WAAW,CACdZ,WAAC,CAACa,iBAAiB,CAEjBf,aAAa,EACbK,GAAG,EACHH,WAAC,CAACW,oBAAoB,CAAC,GAAG,EAAEf,IAAI,EAAEC,KAAK,CACzC,CACF,CAAC;MACH;IACF;EACF,CAAC;AACH,CAAC,CAAC;AAAAiB,OAAA,CAAAzB,OAAA,GAAAN,QAAA"}
\ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-logical-assignment-operators/package.json b/node_modules/@babel/plugin-transform-logical-assignment-operators/package.json new file mode 100644 index 00000000..963c52aa --- /dev/null +++ b/node_modules/@babel/plugin-transform-logical-assignment-operators/package.json @@ -0,0 +1,36 @@ +{ + "name": "@babel/plugin-transform-logical-assignment-operators", + "version": "7.22.11", + "description": "Transforms logical assignment operators into short-circuited assignments", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-transform-logical-assignment-operators" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "./lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.22.11", + "@babel/helper-plugin-test-runner": "^7.22.5", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.22.11" + }, + "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-logical-assignment-operators", + "engines": { + "node": ">=6.9.0" + }, + "author": "The Babel Team (https://babel.dev/team)", + "type": "commonjs" +}
\ No newline at end of file |
