Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-minify-mangle-names

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-mangle-names - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

63

lib/index.js

@@ -63,3 +63,3 @@ "use strict";

this.program.traverse({
var collectVisitor = {
// capture direct evals

@@ -72,7 +72,8 @@ CallExpression: function CallExpression(path) {

}
},
}
};
if (this.charset.shouldConsider) {
// charset considerations
Identifier: function Identifier(path) {
collectVisitor.Identifier = function Identifier(path) {
var node = path.node;

@@ -84,12 +85,13 @@

}
},
};
// charset considerations
Literal: function Literal(_ref3) {
collectVisitor.Literal = function Literal(_ref3) {
var node = _ref3.node;
mangler.charset.consider(String(node.value));
}
});
};
}
this.program.traverse(collectVisitor);
}

@@ -103,4 +105,2 @@ }, {

Scopable: function Scopable(path) {
if (path.isProgram()) return;
var scope = path.scope;

@@ -133,16 +133,37 @@

Object.keys(scope.getAllBindings()).filter(function (b) {
var binding = scope.getBinding(b);
var bindings = scope.getAllBindings();
var names = Object.keys(bindings);
return scope.hasOwnBinding(b) && !binding.path.isLabeledStatement() && !mangler.isBlacklist(b, mangler.blacklist) && (mangler.keepFnames ? !isFunction(binding.path) : true);
}).map(function (b) {
for (var _i = 0; _i < names.length; _i++) {
var oldName = names[_i];
var binding = bindings[oldName];
if (
// already renamed bindings
binding.renamed
// globals
|| mangler.program.scope.bindings[oldName] === binding
// other scope bindings
|| !scope.hasOwnBinding(oldName)
// labels
|| binding.path.isLabeledStatement()
// blacklisted
|| mangler.isBlacklist(oldName)
// function names
|| (mangler.keepFnames ? isFunction(binding.path) : false)) {
continue;
}
var next = void 0;
do {
next = getNext();
} while (!t.isValidIdentifier(next) || scope.hasBinding(next) || scope.hasGlobal(next) || scope.hasReference(next));
} while (!t.isValidIdentifier(next) || hop.call(bindings, next) || scope.hasGlobal(next) || scope.hasReference(next));
// TODO:
// re-enable this
// re-enable this - check above
// resetNext();
mangler.rename(scope, b, next);
});
mangler.rename(scope, oldName, next);
// mark the binding as renamed
binding.renamed = true;
}
}

@@ -189,4 +210,4 @@ });

var refs = binding.referencePaths;
for (var _i = 0; _i < refs.length; _i++) {
var path = refs[_i];
for (var _i2 = 0; _i2 < refs.length; _i2++) {
var path = refs[_i2];
var node = path.node;

@@ -193,0 +214,0 @@

{
"name": "babel-plugin-minify-mangle-names",
"version": "0.0.2",
"version": "0.0.3",
"description": "",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/babel/babili#readme",

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