babel-plugin-minify-dead-code-elimination
Advanced tools
Comparing version 0.5.0-alpha.8b905991 to 0.5.0-alpha.91ed3622
@@ -13,2 +13,7 @@ "use strict"; | ||
function evaluateTruthy(path) { | ||
const res = evaluate(path); | ||
if (res.confident) return !!res.value; | ||
} | ||
function prevSiblings(path) { | ||
@@ -593,3 +598,3 @@ const parentPath = path.parentPath; | ||
const node = path.node; | ||
const evaluateTest = path.get("test").evaluateTruthy(); | ||
const evaluateTest = evaluateTruthy(path.get("test")); | ||
@@ -736,3 +741,9 @@ if (evaluateTest === true) { | ||
} else { | ||
path.remove(); | ||
const init = path.get("init"); | ||
if (init.node && !init.isPure()) { | ||
path.replaceWith(init); | ||
} else { | ||
path.remove(); | ||
} | ||
} | ||
@@ -739,0 +750,0 @@ } |
{ | ||
"name": "babel-plugin-minify-dead-code-elimination", | ||
"version": "0.5.0-alpha.8b905991", | ||
"version": "0.5.0-alpha.91ed3622", | ||
"description": "", | ||
@@ -15,7 +15,7 @@ "keywords": [ | ||
"dependencies": { | ||
"babel-helper-evaluate-path": "^0.5.0-alpha.8b905991", | ||
"babel-helper-mark-eval-scopes": "^0.5.0-alpha.8b905991", | ||
"babel-helper-remove-or-void": "^0.5.0-alpha.8b905991", | ||
"babel-helper-evaluate-path": "^0.5.0-alpha.91ed3622", | ||
"babel-helper-mark-eval-scopes": "^0.5.0-alpha.91ed3622", | ||
"babel-helper-remove-or-void": "^0.5.0-alpha.91ed3622", | ||
"lodash.some": "^4.6.0" | ||
} | ||
} |
@@ -34,3 +34,3 @@ # babel-plugin-minify-dead-code-elimination | ||
```sh | ||
npm install babel-plugin-minify-dead-code-elimination | ||
npm install babel-plugin-minify-dead-code-elimination --save-dev | ||
``` | ||
@@ -37,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45646
1173