You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@babel/helper-define-polyfill-provider

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-define-polyfill-provider - npm Package Compare versions

Comparing version

to
0.6.4

77

lib/utils.js

@@ -26,4 +26,16 @@ "use strict";

}
function getType(target) {
return Object.prototype.toString.call(target).slice(8, -1);
function resolve(path, resolved = new Set()) {
if (resolved.has(path)) return;
resolved.add(path);
if (path.isVariableDeclarator()) {
if (path.get("id").isIdentifier()) {
return resolve(path.get("init"), resolved);
}
} else if (path.isReferencedIdentifier()) {
const binding = path.scope.getBinding(path.node.name);
if (!binding) return path;
if (!binding.constant) return;
return resolve(binding.path, resolved);
}
return path;
}

@@ -34,9 +46,5 @@ function resolveId(path) {

}
if (path.isPure()) {
const {
deopt
} = path.evaluate();
if (deopt && deopt.isIdentifier()) {
return deopt.node.name;
}
const resolved = resolve(path);
if (resolved != null && resolved.isIdentifier()) {
return resolved.node.name;
}

@@ -89,22 +97,39 @@ }

}
if (obj.isRegExpLiteral()) {
return {
id: "RegExp",
placement: "prototype"
};
} else if (obj.isFunction()) {
return {
id: "Function",
placement: "prototype"
};
} else if (obj.isPure()) {
const {
value
} = obj.evaluate();
if (value !== undefined) {
const path = resolve(obj);
switch (path == null ? void 0 : path.type) {
case "RegExpLiteral":
return {
id: getType(value),
id: "RegExp",
placement: "prototype"
};
}
case "FunctionExpression":
return {
id: "Function",
placement: "prototype"
};
case "StringLiteral":
return {
id: "String",
placement: "prototype"
};
case "NumberLiteral":
return {
id: "Number",
placement: "prototype"
};
case "BooleanLiteral":
return {
id: "Boolean",
placement: "prototype"
};
case "ObjectExpression":
return {
id: "Object",
placement: "prototype"
};
case "ArrayExpression":
return {
id: "Array",
placement: "prototype"
};
}

@@ -111,0 +136,0 @@ return {

{
"name": "@babel/helper-define-polyfill-provider",
"version": "0.6.3",
"version": "0.6.4",
"description": "Babel helper to create your own polyfill provider",

@@ -58,3 +58,3 @@ "repository": {

},
"gitHead": "66340fb145086a826c496f008f67488367846c09"
"gitHead": "d87c29c909148920ad18690b63d450c561842298"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet