Socket
Socket
Sign inDemoInstall

uglify-es

Package Overview
Dependencies
2
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.4 to 3.3.5

tools/exit.js

2

lib/minify.js

@@ -32,3 +32,2 @@ "use strict";

if (!cache) return;
if (!("cname" in cache)) cache.cname = -1;
if (!("props" in cache)) {

@@ -43,3 +42,2 @@ cache.props = new Dictionary();

return {
cname: cache.cname,
props: cache.props.toObject()

@@ -46,0 +44,0 @@ };

@@ -133,8 +133,11 @@ /***********************************************************************

var cache = options.cache;
if (cache == null) {
cache = {
cname: -1,
props: new Dictionary()
};
var cname = -1;
var cache;
if (options.cache) {
cache = options.cache.props;
cache.each(function(mangled_name) {
push_uniq(reserved, mangled_name);
});
} else {
cache = new Dictionary();
}

@@ -196,3 +199,3 @@

if (options.only_cache) {
return cache.props.has(name);
return cache.has(name);
}

@@ -206,3 +209,3 @@ if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false;

if (reserved.indexOf(name) >= 0) return false;
return cache.props.has(name)
return cache.has(name)
|| names_to_mangle.indexOf(name) >= 0;

@@ -225,3 +228,3 @@ }

var mangled = cache.props.get(name);
var mangled = cache.get(name);
if (!mangled) {

@@ -240,7 +243,7 @@ if (debug) {

do {
mangled = base54(++cache.cname);
mangled = base54(++cname);
} while (!can_mangle(mangled));
}
cache.props.set(name, mangled);
cache.set(name, mangled);
}

@@ -247,0 +250,0 @@ return mangled;

@@ -46,5 +46,6 @@ /***********************************************************************

function SymbolDef(scope, orig) {
function SymbolDef(scope, orig, init) {
this.name = orig.name;
this.orig = [ orig ];
this.init = init;
this.eliminated = 0;

@@ -179,3 +180,3 @@ this.scope = scope;

if (node instanceof AST_SymbolLambda) {
defun.def_function(node);
defun.def_function(node, node.name == "arguments" ? undefined : defun);
}

@@ -188,6 +189,6 @@ else if (node instanceof AST_SymbolDefun) {

// later.
mark_export((node.scope = defun.parent_scope.get_defun_scope()).def_function(node), 1);
mark_export((node.scope = defun.parent_scope.get_defun_scope()).def_function(node, defun), 1);
}
else if (node instanceof AST_SymbolClass) {
mark_export(defun.def_variable(node), 1);
mark_export(defun.def_variable(node, defun), 1);
}

@@ -200,3 +201,3 @@ else if (node instanceof AST_SymbolImport) {

// inside the class.
mark_export((node.scope = defun.parent_scope).def_function(node), 1);
mark_export((node.scope = defun.parent_scope).def_function(node, defun), 1);
}

@@ -206,3 +207,8 @@ else if (node instanceof AST_SymbolVar

|| node instanceof AST_SymbolConst) {
var def = ((node instanceof AST_SymbolBlockDeclaration) ? scope : defun).def_variable(node);
var def;
if (node instanceof AST_SymbolBlockDeclaration) {
def = scope.def_variable(node);
} else {
def = defun.def_variable(node, node.TYPE == "SymbolVar" ? null : undefined);
}
if (!all(def.orig, function(sym) {

@@ -292,2 +298,6 @@ if (sym === node) return true;

node.reference(options);
if (node.scope.is_block_scope()
&& !(sym.orig[0] instanceof AST_SymbolBlockDeclaration)) {
node.scope = node.scope.get_defun_scope();
}
return true;

@@ -339,6 +349,2 @@ }

}
if (options.cache) {
this.cname = options.cache.cname;
}
});

@@ -413,4 +419,5 @@

AST_Scope.DEFMETHOD("def_function", function(symbol){
var def = this.def_variable(symbol);
AST_Scope.DEFMETHOD("def_function", function(symbol, init){
var def = this.def_variable(symbol, init);
if (!def.init) def.init = init;
this.functions.set(symbol.name, def);

@@ -420,11 +427,13 @@ return def;

AST_Scope.DEFMETHOD("def_variable", function(symbol){
var def;
if (!this.variables.has(symbol.name)) {
def = new SymbolDef(this, symbol);
AST_Scope.DEFMETHOD("def_variable", function(symbol, init){
var def = this.variables.get(symbol.name);
if (def) {
def.orig.push(symbol);
if (def.init && (def.scope !== symbol.scope || def.init instanceof AST_Function)) {
def.init = init;
}
} else {
def = new SymbolDef(this, symbol, init);
this.variables.set(symbol.name, def);
def.global = !this.parent_scope;
} else {
def = this.variables.get(symbol.name);
def.orig.push(symbol);
}

@@ -434,6 +443,6 @@ return symbol.thedef = def;

AST_Scope.DEFMETHOD("next_mangled", function(options){
var ext = this.enclosed;
function next_mangled(scope, options) {
var ext = scope.enclosed;
out: while (true) {
var m = base54(++this.cname);
var m = base54(++scope.cname);
if (!is_identifier(m)) continue; // skip over "do"

@@ -455,4 +464,16 @@

}
}
AST_Scope.DEFMETHOD("next_mangled", function(options){
return next_mangled(this, options);
});
AST_Toplevel.DEFMETHOD("next_mangled", function(options){
var name;
do {
name = next_mangled(this, options);
} while (member(name, this.mangled_names));
return name;
});
AST_Function.DEFMETHOD("next_mangled", function(options, def){

@@ -469,3 +490,3 @@ // #179, #326

while (true) {
var name = AST_Lambda.prototype.next_mangled.call(this, options, def);
var name = next_mangled(this, options);
if (!tricky_name || tricky_name != name)

@@ -522,4 +543,10 @@ return name;

var mangled_names = this.mangled_names = [];
if (options.cache) {
this.globals.each(collect);
if (options.cache.props) {
options.cache.props.each(function(mangled_name) {
push_uniq(mangled_names, mangled_name);
});
}
}

@@ -558,6 +585,2 @@

if (options.cache) {
options.cache.cname = this.cname;
}
function collect(symbol) {

@@ -564,0 +587,0 @@ if (!member(symbol.name, options.reserved)) {

@@ -7,3 +7,3 @@ {

"license": "BSD-2-Clause",
"version": "3.3.4",
"version": "3.3.5",
"engines": {

@@ -10,0 +10,0 @@ "node": ">=0.8.0"

@@ -678,3 +678,9 @@ uglify-es

- `inline` (default: `true`) -- embed simple functions
- `inline` (default: `true`) -- inline calls to function with simple/`return` statement:
- `false` -- same as `0`
- `0` -- disabled inlining
- `1` -- inline simple functions
- `2` -- inline functions with arguments
- `3` -- inline functions with arguments and variables
- `true` -- same as `3`

@@ -681,0 +687,0 @@ - `join_vars` (default: `true`) -- join consecutive `var` statements

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc