Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-new-target

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-new-target - npm Package Compare versions

Comparing version 7.18.6 to 7.21.4-esm

lib/index.js.map

20

lib/index.js

@@ -7,7 +7,4 @@ "use strict";

exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _core = require("@babel/core");
var _default = (0, _helperPluginUtils.declare)(api => {

@@ -24,3 +21,2 @@ api.assertVersion(7);

} = path;
if (meta.isIdentifier({

@@ -33,3 +29,2 @@ name: "new"

if (path.isClass()) return true;
if (path.isFunction() && !path.isArrowFunctionExpression()) {

@@ -41,17 +36,12 @@ if (path.isClassMethod({

}
return true;
}
return false;
});
if (!func) {
throw path.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.");
}
const {
node
} = func;
if (_core.types.isMethod(node)) {

@@ -61,5 +51,3 @@ path.replaceWith(scope.buildUndefinedNode());

}
const constructor = _core.types.memberExpression(_core.types.thisExpression(), _core.types.identifier("constructor"));
if (func.isClass()) {

@@ -69,3 +57,2 @@ path.replaceWith(constructor);

}
if (!node.id) {

@@ -76,3 +63,2 @@ node.id = scope.generateUidIdentifier("target");

const name = node.id.name;
while (scope !== func.parentPath.scope) {

@@ -82,15 +68,13 @@ if (scope.hasOwnBinding(name) && !scope.bindingIdentifierEquals(name, node.id)) {

}
scope = scope.parent;
}
}
path.replaceWith(_core.types.conditionalExpression(_core.types.binaryExpression("instanceof", _core.types.thisExpression(), _core.types.cloneNode(node.id)), constructor, scope.buildUndefinedNode()));
}
}
}
};
});
exports.default = _default;
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-transform-new-target",
"version": "7.18.6",
"version": "7.21.4-esm",
"description": "Transforms new.target meta property",

@@ -20,12 +20,12 @@ "repository": {

"dependencies": {
"@babel/helper-plugin-utils": "^7.18.6"
"@babel/helper-plugin-utils": "^7.21.4-esm"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
"@babel/core": "^7.0.0-0 || 7.21.4-esm"
},
"devDependencies": {
"@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"
"@babel/core": "^7.21.4-esm",
"@babel/helper-plugin-test-runner": "^7.21.4-esm",
"@babel/plugin-proposal-class-properties": "^7.21.4-esm",
"@babel/plugin-transform-arrow-functions": "^7.21.4-esm"
},

@@ -32,0 +32,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc