@babel/plugin-transform-proto-to-assign
Advanced tools
Comparing version 7.18.9 to 7.20.7
@@ -7,10 +7,6 @@ "use strict"; | ||
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); | ||
function isProtoKey(node) { | ||
@@ -21,3 +17,2 @@ return !_core.types.isSpreadElement(node) && _core.types.isStringLiteral(_core.types.toComputedKey(node, node.key), { | ||
} | ||
function isProtoAssignmentExpression(node) { | ||
@@ -29,7 +24,6 @@ const left = node; | ||
} | ||
function buildDefaultsCallExpression(expr, ref, file) { | ||
return _core.types.expressionStatement(_core.types.callExpression(file.addHelper("defaults"), [ref, expr.right])); | ||
return _core.types.expressionStatement(_core.types.callExpression(file.addHelper("defaults"), [ | ||
ref, expr.right])); | ||
} | ||
return { | ||
@@ -45,7 +39,6 @@ name: "transform-proto-to-assign", | ||
const temp = path.scope.maybeGenerateMemoised(left); | ||
if (temp) { | ||
nodes.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", temp, left))); | ||
nodes.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", temp, | ||
left))); | ||
} | ||
nodes.push(buildDefaultsCallExpression(path.node, _core.types.cloneNode(temp || left), file)); | ||
@@ -55,3 +48,2 @@ if (temp) nodes.push(_core.types.cloneNode(temp)); | ||
}, | ||
ExpressionStatement(path, { | ||
@@ -64,3 +56,2 @@ file | ||
})) return; | ||
if (isProtoAssignmentExpression(expr.left)) { | ||
@@ -70,3 +61,2 @@ path.replaceWith(buildDefaultsCallExpression(expr, expr.left.object, file)); | ||
}, | ||
ObjectExpression(path, { | ||
@@ -82,6 +72,4 @@ file | ||
} = node; | ||
for (let i = 0; i < properties.length; i++) { | ||
const prop = properties[i]; | ||
if (isProtoKey(prop)) { | ||
@@ -93,3 +81,2 @@ proto = prop.value; | ||
} | ||
if (proto) { | ||
@@ -101,7 +88,7 @@ const args = [_core.types.objectExpression([]), proto]; | ||
} | ||
} | ||
}; | ||
}); | ||
exports.default = _default; | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-transform-proto-to-assign", | ||
"version": "7.18.9", | ||
"version": "7.20.7", | ||
"description": "Babel plugin for turning __proto__ into a shallow property clone", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.18.9" | ||
"@babel/helper-plugin-utils": "^7.20.2" | ||
}, | ||
@@ -27,3 +27,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.18.9", | ||
"@babel/core": "^7.20.7", | ||
"@babel/helper-plugin-test-runner": "^7.18.6" | ||
@@ -30,0 +30,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11665
5
82
+ Addedelectron-to-chromium@1.5.73(transitive)
- Removedelectron-to-chromium@1.5.74(transitive)