babel-plugin-minify-mangle-names
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -19,2 +19,4 @@ "use strict"; | ||
keepFnName = _ref2$keepFnName === undefined ? false : _ref2$keepFnName, | ||
_ref2$keepClassName = _ref2.keepClassName, | ||
keepClassName = _ref2$keepClassName === undefined ? false : _ref2$keepClassName, | ||
_ref2$eval = _ref2.eval, | ||
@@ -29,2 +31,3 @@ _eval = _ref2$eval === undefined ? false : _ref2$eval; | ||
this.keepFnName = keepFnName; | ||
this.keepClassName = keepClassName; | ||
this.eval = _eval; | ||
@@ -150,3 +153,5 @@ | ||
// function names | ||
|| (mangler.keepFnName ? isFunction(binding.path) : false)) { | ||
|| (mangler.keepFnName ? isFunction(binding.path) : false) | ||
// class names | ||
|| (mangler.keepClassName ? isClass(binding.path) : false)) { | ||
continue; | ||
@@ -327,5 +332,10 @@ } | ||
function isFunction(path) { | ||
return path.isFunctionExpression() || path.isFunctionDeclaration() || path.isClassExpression() || path.isClassDeclaration(); | ||
return path.isFunctionExpression() || path.isFunctionDeclaration(); | ||
} | ||
// for keepClassName | ||
function isClass(path) { | ||
return path.isClassExpression() || path.isClassDeclaration(); | ||
} | ||
function isLabelIdentifier(path) { | ||
@@ -332,0 +342,0 @@ var node = path.node; |
{ | ||
"name": "babel-plugin-minify-mangle-names", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/babel/babili#readme", |
@@ -34,3 +34,3 @@ # babel-plugin-minify-mangle-names | ||
```sh | ||
$ npm install babel-plugin-minify-mangle-names | ||
npm install babel-plugin-minify-mangle-names | ||
``` | ||
@@ -49,3 +49,5 @@ | ||
} | ||
``` | ||
```json | ||
// with options | ||
@@ -60,3 +62,3 @@ { | ||
```sh | ||
$ babel --plugins minify-mangle-names script.js | ||
babel --plugins minify-mangle-names script.js | ||
``` | ||
@@ -77,1 +79,2 @@ | ||
+ `keepFnName` - prevent mangler from altering function names. Useful for code depending on `fn.name` | ||
+ `keepClassName` - prevent mangler from altering class names. |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21872
511
77
0