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
5
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.5.0-alpha.7ba5821f to 0.5.0-alpha.830ce3f1

37

lib/index.js

@@ -335,16 +335,8 @@ "use strict";

mangler.visitedScopes.add(scope); // Helpers to generate names
mangler.visitedScopes.add(scope);
const bindings = scopeTracker.bindings.get(scope);
const names = [...bindings.keys()]; // A counter to generate names and reset
// so we can reuse removed names
let i = 0;
function getNext() {
return mangler.charset.getIdentifier(i++);
}
function resetNext() {
i = 0;
}
const bindings = scopeTracker.bindings.get(scope);
const names = [...bindings.keys()];
let counter = 0;
/**

@@ -360,4 +352,4 @@ * 1. Iterate through the list of BindingIdentifiers

for (let i = 0; i < names.length; i++) {
const oldName = names[i];
for (var _i = 0; _i < names.length; _i++) {
const oldName = names[_i];
const binding = bindings.get(oldName);

@@ -369,9 +361,20 @@

do {
next = getNext();
next = mangler.charset.getIdentifier(counter++);
} while (!mangler.isValidName(next, binding, scope)); // Reset so variables which are removed can be reused
//
// the following is an assumtion (for perf)
// the length 3 is an assumption that if the oldName isn't
// 1 or 2 characters, then probably we are not going to find
// a name - because for almost all usecases we have 1 or 2
// character new names only. And for the edge cases where
// one scope has lots and lots of variables, it's okay to
// name something with 3 characters instead of 1
resetNext(); // Once we detected a valid `next` Identifier which could be used,
if (oldName.length < 3) {
counter = 0;
} // Once we detected a valid `next` Identifier which could be used,
// call the renamer
mangler.rename(scope, binding, oldName, next);

@@ -378,0 +381,0 @@ }

{
"name": "babel-plugin-minify-mangle-names",
"version": "0.5.0-alpha.7ba5821f",
"version": "0.5.0-alpha.830ce3f1",
"description": "",

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

"dependencies": {
"babel-helper-mark-eval-scopes": "^0.5.0-alpha.7ba5821f"
"babel-helper-mark-eval-scopes": "^0.5.0-alpha.830ce3f1"
}
}
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