babel-plugin-minify-mangle-names
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -146,2 +146,23 @@ "use strict"; | ||
/** | ||
* This is required because after function name transformation | ||
* plugin (part of es2015), the function name is NOT added to the | ||
* scope's bindings. So to fix this issue, we simply add a hack to | ||
* handle that case - fix it to the scope tree. | ||
* | ||
* Related: | ||
* - https://github.com/babel/minify/issues/829 | ||
*/ | ||
BindingIdentifier(path) { | ||
if ( // the parent has this id as the name | ||
(path.parentPath.isFunctionExpression({ | ||
id: path.node | ||
}) || path.parentPath.isClassExpression({ | ||
id: path.node | ||
})) && // and the id isn't yet added to the scope | ||
!hop.call(path.parentPath.scope.bindings, path.node.name)) { | ||
path.parentPath.scope.registerBinding("local", path.parentPath); | ||
} | ||
}, | ||
/** | ||
* This is necessary because, in Babel, the scope.references | ||
@@ -148,0 +169,0 @@ * does NOT contain the references in that scope. Only the program |
{ | ||
"name": "babel-plugin-minify-mangle-names", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "", | ||
@@ -15,4 +15,4 @@ "keywords": [ | ||
"dependencies": { | ||
"babel-helper-mark-eval-scopes": "^0.4.1" | ||
"babel-helper-mark-eval-scopes": "^0.4.2" | ||
} | ||
} |
@@ -34,3 +34,3 @@ # babel-plugin-minify-mangle-names | ||
```sh | ||
npm install babel-plugin-minify-mangle-names | ||
npm install babel-plugin-minify-mangle-names --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
33233
884