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
+24 -5
View File
@@ -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;
}
}
}