Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-new-target

Package Overview
Dependencies
Maintainers
6
Versions
75
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.0.0-beta.42 to 7.0.0-beta.43

49

lib/index.js
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var _core = require("@babel/core");
_helperPluginUtils = function () {
return data;
};
var _default = (0, _helperPluginUtils.declare)(function (api) {
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);

@@ -15,6 +33,8 @@ return {

visitor: {
MetaProperty: function MetaProperty(path) {
var meta = path.get("meta");
var property = path.get("property");
var scope = path.scope;
MetaProperty(path) {
const meta = path.get("meta");
const property = path.get("property");
const {
scope
} = path;

@@ -26,3 +46,3 @@ if (meta.isIdentifier({

})) {
var func = path.findParent(function (path) {
const func = path.findParent(path => {
if (path.isClass()) return true;

@@ -47,3 +67,5 @@

var node = func.node;
const {
node
} = func;

@@ -59,12 +81,13 @@ if (!node.id) {

var _constructor = _core.types.memberExpression(_core.types.thisExpression(), _core.types.identifier("constructor"));
const constructor = _core().types.memberExpression(_core().types.thisExpression(), _core().types.identifier("constructor"));
if (func.isClass()) {
path.replaceWith(_constructor);
path.replaceWith(constructor);
return;
}
path.replaceWith(_core.types.conditionalExpression(_core.types.binaryExpression("instanceof", _core.types.thisExpression(), _core.types.cloneNode(node.id)), _constructor, scope.buildUndefinedNode()));
path.replaceWith(_core().types.conditionalExpression(_core().types.binaryExpression("instanceof", _core().types.thisExpression(), _core().types.cloneNode(node.id)), constructor, scope.buildUndefinedNode()));
}
}
}

@@ -71,0 +94,0 @@ };

{
"name": "@babel/plugin-transform-new-target",
"version": "7.0.0-beta.42",
"version": "7.0.0-beta.43",
"description": "Transforms new.target meta property",

@@ -12,13 +12,13 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target",

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.42"
"@babel/helper-plugin-utils": "7.0.0-beta.43"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.42"
"@babel/core": "7.0.0-beta.43"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.42",
"@babel/helper-plugin-test-runner": "7.0.0-beta.42",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.42",
"@babel/plugin-transform-arrow-functions": "7.0.0-beta.42"
"@babel/core": "7.0.0-beta.43",
"@babel/helper-plugin-test-runner": "7.0.0-beta.43",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.43",
"@babel/plugin-transform-arrow-functions": "7.0.0-beta.43"
}
}
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