forked from daren.hsu/line_push
update
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
> Compile ES2015 shorthand properties to ES5
|
||||
|
||||
See our website [@babel/plugin-transform-shorthand-properties](https://babeljs.io/docs/en/next/babel-plugin-transform-shorthand-properties.html) for more information.
|
||||
See our website [@babel/plugin-transform-shorthand-properties](https://babeljs.io/docs/en/babel-plugin-transform-shorthand-properties) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
+24
-5
@@ -23,15 +23,34 @@ var _default = (0, _helperPluginUtils.declare)(api => {
|
||||
const func = _core.types.functionExpression(null, node.params, node.body, node.generator, node.async);
|
||||
|
||||
func.returnType = node.returnType;
|
||||
path.replaceWith(_core.types.objectProperty(node.key, func, node.computed));
|
||||
|
||||
const computedKey = _core.types.toComputedKey(node);
|
||||
|
||||
if (_core.types.isStringLiteral(computedKey, {
|
||||
value: "__proto__"
|
||||
})) {
|
||||
path.replaceWith(_core.types.objectProperty(computedKey, func, true));
|
||||
} else {
|
||||
path.replaceWith(_core.types.objectProperty(node.key, func, node.computed));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
ObjectProperty({
|
||||
node
|
||||
}) {
|
||||
ObjectProperty(path) {
|
||||
const {
|
||||
node
|
||||
} = path;
|
||||
|
||||
if (node.shorthand) {
|
||||
node.shorthand = false;
|
||||
const computedKey = _core.types.toComputedKey(node);
|
||||
|
||||
if (_core.types.isStringLiteral(computedKey, {
|
||||
value: "__proto__"
|
||||
})) {
|
||||
path.replaceWith(_core.types.objectProperty(computedKey, node.value, true));
|
||||
} else {
|
||||
node.shorthand = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-18
@@ -1,51 +1,57 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/plugin-transform-shorthand-properties@7.10.4",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"@babel/plugin-transform-shorthand-properties@7.18.6",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "@babel/plugin-transform-shorthand-properties@7.10.4",
|
||||
"_id": "@babel/plugin-transform-shorthand-properties@7.10.4",
|
||||
"_from": "@babel/plugin-transform-shorthand-properties@7.18.6",
|
||||
"_id": "@babel/plugin-transform-shorthand-properties@7.18.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-AC2K/t7o07KeTIxMoHneyX90v3zkm5cjHJEokrPEAGEy3UCp8sLKfnfOIGdZ194fyN4wfX/zZUWT9trJZ0qc+Q==",
|
||||
"_integrity": "sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw==",
|
||||
"_location": "/@babel/plugin-transform-shorthand-properties",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/plugin-transform-shorthand-properties@7.10.4",
|
||||
"raw": "@babel/plugin-transform-shorthand-properties@7.18.6",
|
||||
"name": "@babel/plugin-transform-shorthand-properties",
|
||||
"escapedName": "@babel%2fplugin-transform-shorthand-properties",
|
||||
"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-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-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": "Compile ES2015 shorthand properties to ES5",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.10.4",
|
||||
"@babel/helper-plugin-test-runner": "^7.10.4"
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/helper-plugin-test-runner": "^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-shorthand-properties",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"main": "./lib/index.js",
|
||||
"name": "@babel/plugin-transform-shorthand-properties",
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
@@ -58,5 +64,6 @@
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-plugin-transform-shorthand-properties"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
"type": "commonjs",
|
||||
"version": "7.18.6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user