@babel/plugin-transform-proto-to-assign
Advanced tools
Comparing version 7.21.4-esm.2 to 7.21.4-esm.3
@@ -1,7 +0,13 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import { types as t } from "@babel/core"; | ||
export default declare(api => { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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) { | ||
return !t.isSpreadElement(node) && t.isStringLiteral(t.toComputedKey(node, node.key), { | ||
return !_core.types.isSpreadElement(node) && _core.types.isStringLiteral(_core.types.toComputedKey(node, node.key), { | ||
value: "__proto__" | ||
@@ -12,3 +18,3 @@ }); | ||
const left = node; | ||
return t.isMemberExpression(left) && t.isStringLiteral(t.toComputedKey(left, left.property), { | ||
return _core.types.isMemberExpression(left) && _core.types.isStringLiteral(_core.types.toComputedKey(left, left.property), { | ||
value: "__proto__" | ||
@@ -18,3 +24,3 @@ }); | ||
function buildDefaultsCallExpression(expr, ref, file) { | ||
return t.expressionStatement(t.callExpression(file.addHelper("defaults"), [ref, expr.right])); | ||
return _core.types.expressionStatement(_core.types.callExpression(file.addHelper("defaults"), [ref, expr.right])); | ||
} | ||
@@ -32,6 +38,6 @@ return { | ||
if (temp) { | ||
nodes.push(t.expressionStatement(t.assignmentExpression("=", temp, left))); | ||
nodes.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", temp, left))); | ||
} | ||
nodes.push(buildDefaultsCallExpression(path.node, t.cloneNode(temp || left), file)); | ||
if (temp) nodes.push(t.cloneNode(temp)); | ||
nodes.push(buildDefaultsCallExpression(path.node, _core.types.cloneNode(temp || left), file)); | ||
if (temp) nodes.push(_core.types.cloneNode(temp)); | ||
path.replaceWithMultiple(nodes); | ||
@@ -43,3 +49,3 @@ }, | ||
const expr = path.node.expression; | ||
if (!t.isAssignmentExpression(expr, { | ||
if (!_core.types.isAssignmentExpression(expr, { | ||
operator: "=" | ||
@@ -70,5 +76,5 @@ })) return; | ||
if (proto) { | ||
const args = [t.objectExpression([]), proto]; | ||
const args = [_core.types.objectExpression([]), proto]; | ||
if (node.properties.length) args.push(node); | ||
path.replaceWith(t.callExpression(file.addHelper("extends"), args)); | ||
path.replaceWith(_core.types.callExpression(file.addHelper("extends"), args)); | ||
} | ||
@@ -79,3 +85,4 @@ } | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-transform-proto-to-assign", | ||
"version": "7.21.4-esm.2", | ||
"version": "7.21.4-esm.3", | ||
"description": "Babel plugin for turning __proto__ into a shallow property clone", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.21.4-esm.2" | ||
"@babel/helper-plugin-utils": "7.21.4-esm.3" | ||
}, | ||
@@ -27,4 +27,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.21.4-esm.2", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.2" | ||
"@babel/core": "7.21.4-esm.3", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.3" | ||
}, | ||
@@ -31,0 +31,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
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
11847
80
+ Added@babel/helper-plugin-utils@7.21.4-esm.3(transitive)
- Removed@babel/helper-plugin-utils@7.21.4-esm.2(transitive)