summaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:31:11 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:31:11 +0800
commitaa773172311dcada759dfbaac485f4bc6e00bc21 (patch)
treeca6d9a5eff3ab8f689f9acb4f0df791d9486813d /node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
parentc5a5384e846f242e901e859fe600d695d8990a9a (diff)
added babel
Diffstat (limited to 'node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression')
-rw-r--r--node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/LICENSE22
-rw-r--r--node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/README.md19
-rw-r--r--node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js47
-rw-r--r--node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js.map1
-rw-r--r--node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/package.json41
5 files changed, 130 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/LICENSE b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/LICENSE
new file mode 100644
index 00000000..f31575ec
--- /dev/null
+++ b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/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-bugfix-safari-id-destructuring-collision-in-function-expression/README.md b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/README.md
new file mode 100644
index 00000000..5a7986b9
--- /dev/null
+++ b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/README.md
@@ -0,0 +1,19 @@
+# @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
+
+> Rename destructuring parameter to workaround https://bugs.webkit.org/show_bug.cgi?id=220517
+
+See our website [@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression](https://babeljs.io/docs/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression) for more information.
+
+## Install
+
+Using npm:
+
+```sh
+npm install --save-dev @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
+```
+
+or using yarn:
+
+```sh
+yarn add @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression --dev
+```
diff --git a/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js
new file mode 100644
index 00000000..1766a47c
--- /dev/null
+++ b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js
@@ -0,0 +1,47 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var helperPluginUtils = require('@babel/helper-plugin-utils');
+
+function shouldTransform(path) {
+ const {
+ node
+ } = path;
+ const functionId = node.id;
+ if (!functionId) return false;
+ const name = functionId.name;
+ const paramNameBinding = path.scope.getOwnBinding(name);
+ if (paramNameBinding === undefined) {
+ return false;
+ }
+ if (paramNameBinding.kind !== "param") {
+ return false;
+ }
+ if (paramNameBinding.identifier === paramNameBinding.path.node) {
+ return false;
+ }
+ return name;
+}
+
+var index = helperPluginUtils.declare(api => {
+ api.assertVersion("^7.16.0");
+ return {
+ name: "plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
+ visitor: {
+ FunctionExpression(path) {
+ const name = shouldTransform(path);
+ if (name) {
+ const {
+ scope
+ } = path;
+ const newParamName = scope.generateUid(name);
+ scope.rename(name, newParamName);
+ }
+ }
+ }
+ };
+});
+
+exports.default = index;
+//# sourceMappingURL=index.js.map
diff --git a/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js.map b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js.map
new file mode 100644
index 00000000..05e92b9e
--- /dev/null
+++ b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import type { FunctionExpression } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\n/**\n * Check whether a function expression can be affected by\n * https://bugs.webkit.org/show_bug.cgi?id=220517\n * @param path The function expression NodePath\n * @returns the name of function id if it should be transformed, otherwise returns false\n */\nexport function shouldTransform(\n path: NodePath<FunctionExpression>,\n): string | false {\n const { node } = path;\n const functionId = node.id;\n if (!functionId) return false;\n\n const name = functionId.name;\n // On collision, `getOwnBinding` returns the param binding\n // with the id binding be registered as constant violation\n const paramNameBinding = path.scope.getOwnBinding(name);\n if (paramNameBinding === undefined) {\n // Case 1: the function id is injected by babel-helper-name-function, which\n // assigns `NOT_LOCAL_BINDING` to the `functionId` and thus not registering id\n // in scope tracking\n // Case 2: the function id is injected by a third party plugin which does not update the\n // scope info\n return false;\n }\n if (paramNameBinding.kind !== \"param\") {\n // the function id does not reproduce in params\n return false;\n }\n\n if (paramNameBinding.identifier === paramNameBinding.path.node) {\n // the param binding is a simple parameter\n // e.g. (function a(a) {})\n return false;\n }\n\n return name;\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport { shouldTransform } from \"./util.ts\";\n\nexport default declare(api => {\n api.assertVersion(\"^7.16.0\");\n\n return {\n name: \"plugin-bugfix-safari-id-destructuring-collision-in-function-expression\",\n\n visitor: {\n FunctionExpression(path) {\n const name = shouldTransform(path);\n if (name) {\n // Now we have (function a([a]) {})\n const { scope } = path;\n // invariant: path.node.id is always an Identifier here\n const newParamName = scope.generateUid(name);\n scope.rename(name, newParamName);\n }\n },\n },\n };\n});\n"],"names":["shouldTransform","path","node","functionId","id","name","paramNameBinding","scope","getOwnBinding","undefined","kind","identifier","declare","api","assertVersion","visitor","FunctionExpression","newParamName","generateUid","rename"],"mappings":";;;;;;AASO,SAASA,eAAeA,CAC7BC,IAAkC,EAClB;EAChB,MAAM;AAAEC,IAAAA,IAAAA;AAAK,GAAC,GAAGD,IAAI,CAAA;AACrB,EAAA,MAAME,UAAU,GAAGD,IAAI,CAACE,EAAE,CAAA;AAC1B,EAAA,IAAI,CAACD,UAAU,EAAE,OAAO,KAAK,CAAA;AAE7B,EAAA,MAAME,IAAI,GAAGF,UAAU,CAACE,IAAI,CAAA;EAG5B,MAAMC,gBAAgB,GAAGL,IAAI,CAACM,KAAK,CAACC,aAAa,CAACH,IAAI,CAAC,CAAA;EACvD,IAAIC,gBAAgB,KAAKG,SAAS,EAAE;AAMlC,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACA,EAAA,IAAIH,gBAAgB,CAACI,IAAI,KAAK,OAAO,EAAE;AAErC,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;EAEA,IAAIJ,gBAAgB,CAACK,UAAU,KAAKL,gBAAgB,CAACL,IAAI,CAACC,IAAI,EAAE;AAG9D,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,OAAOG,IAAI,CAAA;AACb;;ACrCA,YAAeO,yBAAO,CAACC,GAAG,IAAI;AAC5BA,EAAAA,GAAG,CAACC,aAAa,CAAC,SAAS,CAAC,CAAA;EAE5B,OAAO;AACLT,IAAAA,IAAI,EAAE,wEAAwE;AAE9EU,IAAAA,OAAO,EAAE;MACPC,kBAAkBA,CAACf,IAAI,EAAE;AACvB,QAAA,MAAMI,IAAI,GAAGL,eAAe,CAACC,IAAI,CAAC,CAAA;AAClC,QAAA,IAAII,IAAI,EAAE;UAER,MAAM;AAAEE,YAAAA,KAAAA;AAAM,WAAC,GAAGN,IAAI,CAAA;AAEtB,UAAA,MAAMgB,YAAY,GAAGV,KAAK,CAACW,WAAW,CAACb,IAAI,CAAC,CAAA;AAC5CE,UAAAA,KAAK,CAACY,MAAM,CAACd,IAAI,EAAEY,YAAY,CAAC,CAAA;AAClC,SAAA;AACF,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAC,CAAC;;;;"} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/package.json b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/package.json
new file mode 100644
index 00000000..3ca7ac19
--- /dev/null
+++ b/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
+ "version": "7.22.15",
+ "description": "Rename destructuring parameter to workaround https://bugs.webkit.org/show_bug.cgi?id=220517",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/babel/babel.git",
+ "directory": "packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression"
+ },
+ "homepage": "https://babel.dev/docs/en/next/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
+ "license": "MIT",
+ "publishConfig": {
+ "access": "public"
+ },
+ "main": "./lib/index.js",
+ "exports": {
+ ".": "./lib/index.js",
+ "./package.json": "./package.json"
+ },
+ "keywords": [
+ "babel-plugin",
+ "bugfix"
+ ],
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.22.5"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.22.15",
+ "@babel/helper-function-name": "^7.22.5",
+ "@babel/helper-plugin-test-runner": "^7.22.5",
+ "@babel/traverse": "^7.22.15"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "author": "The Babel Team (https://babel.dev/team)",
+ "type": "commonjs"
+} \ No newline at end of file