This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
> Transforms new.target meta property
See our website [@babel/plugin-transform-new-target](https://babeljs.io/docs/en/next/babel-plugin-transform-new-target.html) for more information.
See our website [@babel/plugin-transform-new-target](https://babeljs.io/docs/en/babel-plugin-transform-new-target) for more information.
## Install
+18 -7
View File
@@ -50,13 +50,9 @@ var _default = (0, _helperPluginUtils.declare)(api => {
node
} = func;
if (!node.id) {
if (func.isMethod()) {
path.replaceWith(scope.buildUndefinedNode());
return;
}
node.id = scope.generateUidIdentifier("target");
if (_core.types.isMethod(node)) {
path.replaceWith(scope.buildUndefinedNode());
return;
}
const constructor = _core.types.memberExpression(_core.types.thisExpression(), _core.types.identifier("constructor"));
@@ -66,6 +62,21 @@ var _default = (0, _helperPluginUtils.declare)(api => {
return;
}
if (!node.id) {
node.id = scope.generateUidIdentifier("target");
} else {
let scope = path.scope;
const name = node.id.name;
while (scope !== func.parentPath.scope) {
if (scope.hasOwnBinding(name) && !scope.bindingIdentifierEquals(name, node.id)) {
scope.rename(name);
}
scope = scope.parent;
}
}
path.replaceWith(_core.types.conditionalExpression(_core.types.binaryExpression("instanceof", _core.types.thisExpression(), _core.types.cloneNode(node.id)), constructor, scope.buildUndefinedNode()));
}
}
+27 -20
View File
@@ -1,53 +1,59 @@
{
"_args": [
[
"@babel/plugin-transform-new-target@7.10.4",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
"@babel/plugin-transform-new-target@7.18.6",
"/home/node/nuxt"
]
],
"_from": "@babel/plugin-transform-new-target@7.10.4",
"_id": "@babel/plugin-transform-new-target@7.10.4",
"_from": "@babel/plugin-transform-new-target@7.18.6",
"_id": "@babel/plugin-transform-new-target@7.18.6",
"_inBundle": false,
"_integrity": "sha512-YXwWUDAH/J6dlfwqlWsztI2Puz1NtUAubXhOPLQ5gjR/qmQ5U96DY4FQO8At33JN4XPBhrjB8I4eMmLROjjLjw==",
"_integrity": "sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw==",
"_location": "/@babel/plugin-transform-new-target",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@babel/plugin-transform-new-target@7.10.4",
"raw": "@babel/plugin-transform-new-target@7.18.6",
"name": "@babel/plugin-transform-new-target",
"escapedName": "@babel%2fplugin-transform-new-target",
"scope": "@babel",
"rawSpec": "7.10.4",
"rawSpec": "7.18.6",
"saveSpec": null,
"fetchSpec": "7.10.4"
"fetchSpec": "7.18.6"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.10.4.tgz",
"_spec": "7.10.4",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz",
"_spec": "7.18.6",
"_where": "/home/node/nuxt",
"author": {
"name": "The Babel Team",
"url": "https://babel.dev/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4"
"@babel/helper-plugin-utils": "^7.18.6"
},
"description": "Transforms new.target meta property",
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/helper-plugin-test-runner": "^7.10.4",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-transform-arrow-functions": "^7.10.4"
"@babel/core": "^7.18.6",
"@babel/helper-plugin-test-runner": "^7.18.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-arrow-functions": "^7.18.6"
},
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
"homepage": "https://github.com/babel/babel#readme",
"engines": {
"node": ">=6.9.0"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-new-target",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"main": "./lib/index.js",
"name": "@babel/plugin-transform-new-target",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
@@ -60,5 +66,6 @@
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-transform-new-target"
},
"version": "7.10.4"
"type": "commonjs",
"version": "7.18.6"
}