Socket
Socket
Sign inDemoInstall

babel-plugin-minify-dead-code-elimination

Package Overview
Dependencies
Maintainers
5
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-dead-code-elimination - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0-alpha.da60c6b8

41

lib/index.js

@@ -472,2 +472,3 @@ "use strict";

};
var isReplacementObj = isObj(replacement) || some(replacement, isObj);

@@ -479,2 +480,31 @@

// check if it's safe to replace
// To solve https://github.com/babel/minify/issues/691
// Here we bail for property checks using the "in" operator
// This is because - `in` is a side-effect-free operation but the property
// could be deleted between the replacementPath and referencePath
// It is expensive to compute the delete operation and we bail for
// all the binary "in" operations
var inExpression = replacementPath.isBinaryExpression({
operator: "in"
});
if (!inExpression) {
replacementPath.traverse({
Function(path) {
path.skip();
},
BinaryExpression(path) {
if (path.node.operator === "in") {
inExpression = true;
path.stop();
}
}
});
}
if (inExpression) {
return "continue";
}
var replaced = replace(binding.referencePaths[0], {

@@ -1011,3 +1041,7 @@ binding,

declarators.push(t.variableDeclarator(decl.id));
var bindingIds = Object.keys(t.getBindingIdentifiers(decl.id));
declarators.push.apply(declarators, _toConsumableArray(bindingIds.map(function (name) {
return t.variableDeclarator(t.identifier(name));
})));
}

@@ -1042,3 +1076,6 @@ } catch (err) {

declarators.push(t.variableDeclarator(_decl.id));
var _bindingIds = Object.keys(t.getBindingIdentifiers(_decl.id));
declarators.push.apply(declarators, _toConsumableArray(_bindingIds.map(function (name) {
return t.variableDeclarator(t.identifier(name));
})));
}

@@ -1045,0 +1082,0 @@ } catch (err) {

8

package.json
{
"name": "babel-plugin-minify-dead-code-elimination",
"version": "0.2.0",
"version": "0.3.0-alpha.da60c6b8",
"description": "",

@@ -15,7 +15,7 @@ "keywords": [

"dependencies": {
"babel-helper-evaluate-path": "^0.2.0",
"babel-helper-mark-eval-scopes": "^0.2.0",
"babel-helper-remove-or-void": "^0.2.0",
"babel-helper-evaluate-path": "^0.3.0-alpha.da60c6b8",
"babel-helper-mark-eval-scopes": "^0.3.0-alpha.da60c6b8",
"babel-helper-remove-or-void": "^0.3.0-alpha.da60c6b8",
"lodash.some": "^4.6.0"
}
}
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