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.43 to 7.0.0-beta.44

33

lib/index.js

@@ -9,5 +9,5 @@ "use strict";

function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
_helperPluginUtils = function _helperPluginUtils() {
return data;

@@ -20,5 +20,5 @@ };

function _core() {
const data = require("@babel/core");
var data = require("@babel/core");
_core = function () {
_core = function _core() {
return data;

@@ -30,3 +30,3 @@ };

var _default = (0, _helperPluginUtils().declare)(api => {
var _default = (0, _helperPluginUtils().declare)(function (api) {
api.assertVersion(7);

@@ -36,8 +36,6 @@ return {

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

@@ -49,3 +47,3 @@ if (meta.isIdentifier({

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

@@ -70,5 +68,3 @@

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

@@ -84,13 +80,12 @@ if (!node.id) {

const constructor = _core().types.memberExpression(_core().types.thisExpression(), _core().types.identifier("constructor"));
var _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()));
}
}
}

@@ -97,0 +92,0 @@ };

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