Socket
Socket
Sign inDemoInstall

terser

Package Overview
Dependencies
4
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.7.6 to 3.7.7

dist/.gitkeep

93

lib/ast.js

@@ -88,3 +88,3 @@ /***********************************************************************

return ctor;
};
}

@@ -152,3 +152,3 @@ var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos nlb comments_before comments_after file raw", {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.body._walk(visitor);

@@ -167,3 +167,3 @@ });

}
};
}

@@ -187,3 +187,3 @@ function clone_block_scope(deep) {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
walk_body(this, visitor);

@@ -216,3 +216,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.label._walk(visitor);

@@ -257,3 +257,3 @@ this.body._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.body._walk(visitor);

@@ -268,3 +268,3 @@ this.condition._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.condition._walk(visitor);

@@ -284,3 +284,3 @@ this.body._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
if (this.init) this.init._walk(visitor);

@@ -301,3 +301,3 @@ if (this.condition) this.condition._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.init._walk(visitor);

@@ -310,3 +310,3 @@ this.object._walk(visitor);

var AST_ForOf = DEFNODE("ForOf", null, {
var AST_ForOf = DEFNODE("ForOf", "await", {
$documentation: "A `for ... of` statement",

@@ -321,3 +321,3 @@ }, AST_ForIn);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -370,3 +370,3 @@ this.body._walk(visitor);

wrapped_tl = parse(wrapped_tl);
wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){
wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node) {
if (node instanceof AST_Directive && node.value == "$ORIG") {

@@ -404,3 +404,3 @@ return MAP.splice(body);

var self = this;
return visitor._visit(this, function(){
return visitor._visit(this, function() {
self.expression.walk(visitor);

@@ -432,3 +432,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
if (this.name) this.name._walk(visitor);

@@ -468,4 +468,4 @@ var argnames = this.argnames;

_walk: function(visitor) {
return visitor._visit(this, function(){
this.names.forEach(function(name){
return visitor._visit(this, function() {
this.names.forEach(function(name) {
name._walk(visitor);

@@ -507,4 +507,4 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
this.segments.forEach(function(seg){
return visitor._visit(this, function() {
this.segments.forEach(function(seg) {
seg._walk(visitor);

@@ -536,3 +536,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, this.value && function(){
return visitor._visit(this, this.value && function() {
this.value._walk(visitor);

@@ -557,3 +557,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, this.label && function(){
return visitor._visit(this, this.label && function() {
this.label._walk(visitor);

@@ -581,3 +581,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.condition._walk(visitor);

@@ -598,3 +598,3 @@ this.body._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -620,3 +620,3 @@ walk_body(this, visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -637,3 +637,3 @@ walk_body(this, visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
walk_body(this, visitor);

@@ -652,3 +652,3 @@ if (this.bcatch) this.bcatch._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.argname._walk(visitor);

@@ -672,3 +672,3 @@ walk_body(this, visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
var definitions = this.definitions;

@@ -766,3 +766,3 @@ for (var i = 0, len = definitions.length; i < len; i++) {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.name._walk(visitor);

@@ -783,3 +783,3 @@ if (this.value) this.value._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
var args = this.args;

@@ -804,3 +804,3 @@ for (var i = 0, len = args.length; i < len; i++) {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expressions.forEach(function(node) {

@@ -824,3 +824,3 @@ node._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -834,3 +834,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -849,3 +849,3 @@ this.property._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -872,3 +872,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.left._walk(visitor);

@@ -888,3 +888,3 @@ this.right._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.condition._walk(visitor);

@@ -913,3 +913,3 @@ this.consequent._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
var elements = this.elements;

@@ -929,3 +929,3 @@ for (var i = 0, len = elements.length; i < len; i++) {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
var properties = this.properties;

@@ -946,3 +946,3 @@ for (var i = 0, len = properties.length; i < len; i++) {

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
if (this.key instanceof AST_Node)

@@ -996,3 +996,3 @@ this.key._walk(visitor);

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
if (this.name) {

@@ -1004,3 +1004,3 @@ this.name._walk(visitor);

}
this.properties.forEach(function(prop){
this.properties.forEach(function(prop) {
prop._walk(visitor);

@@ -1147,7 +1147,6 @@ });

var AST_RegExp = DEFNODE("RegExp", "value raw", {
var AST_RegExp = DEFNODE("RegExp", "value", {
$documentation: "A regexp literal",
$propdoc: {
value: "[RegExp] the actual regexp",
raw: "[string] the raw regexp source"
}

@@ -1172,3 +1171,3 @@ }, AST_Constant);

$documentation: "The `undefined` value",
value: (function(){}())
value: (function() {}())
}, AST_Atom);

@@ -1178,3 +1177,3 @@

$documentation: "A hole in an array",
value: (function(){}())
value: (function() {}())
}, AST_Atom);

@@ -1207,3 +1206,3 @@

_walk: function(visitor) {
return visitor._visit(this, function(){
return visitor._visit(this, function() {
this.expression._walk(visitor);

@@ -1221,3 +1220,3 @@ });

_walk: function(visitor) {
return visitor._visit(this, this.expression && function(){
return visitor._visit(this, this.expression && function() {
this.expression._walk(visitor);

@@ -1234,7 +1233,7 @@ });

this.directives = Object.create(null);
};
}
TreeWalker.prototype = {
_visit: function(node, descend) {
this.push(node);
var ret = this.visit(node, descend ? function(){
var ret = this.visit(node, descend ? function() {
descend.call(node);

@@ -1241,0 +1240,0 @@ } : noop);

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

total: 1e-3 * (timings.end - timings.start)
}
};
}

@@ -252,0 +252,0 @@ if (warnings.length) {

@@ -46,3 +46,3 @@ /***********************************************************************

(function(){
(function() {

@@ -264,3 +264,3 @@ var normalize_directives = function(body) {

end : my_end_token(M),
elements : M.elements.map(function(elem){
elements : M.elements.map(function(elem) {
return elem === null ? new AST_Hole() : from_moz(elem);

@@ -274,3 +274,3 @@ })

end : my_end_token(M),
properties : M.properties.map(function(prop){
properties : M.properties.map(function(prop) {
if (prop.type === "SpreadElement") {

@@ -280,3 +280,3 @@ return from_moz(prop);

prop.type = "Property";
return from_moz(prop)
return from_moz(prop);
})

@@ -347,3 +347,3 @@ });

module_name : from_moz(M.source)
})
});
},

@@ -372,3 +372,3 @@ ExportAllDeclaration: function(M) {

name: from_moz(specifier.local)
})
});
}) : null,

@@ -485,3 +485,3 @@ module_name: from_moz(M.source)

map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body");
map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body, await=await");
map("AwaitExpression", AST_Await, "argument>expression");

@@ -553,3 +553,3 @@ map("YieldExpression", AST_Yield, "argument>expression, delegate=is_star");

body: to_moz_scope("BlockStatement", M)
}
};
});

@@ -559,3 +559,3 @@

var is_generator = parent.is_generator !== undefined ?
parent.is_generator : M.is_generator
parent.is_generator : M.is_generator;
return {

@@ -568,3 +568,3 @@ type: "FunctionExpression",

body: to_moz_scope("BlockStatement", M)
}
};
});

@@ -582,3 +582,3 @@

body: body
}
};
});

@@ -591,3 +591,3 @@

elements: M.names.map(to_moz)
}
};
}

@@ -689,3 +689,3 @@ return {

}
if (M.imported_names && M.imported_names[0].foreign_name.name === '*') {
if (M.imported_names && M.imported_names[0].foreign_name.name === "*") {
specifiers.push({

@@ -708,3 +708,3 @@ type: "ImportNamespaceSpecifier",

source: to_moz(M.module_name)
}
};
});

@@ -849,3 +849,3 @@

}
}
};
});

@@ -897,3 +897,3 @@

var value = M.value;
if (typeof value === 'number' && (value < 0 || (value === 0 && 1 / value < 0))) {
if (typeof value === "number" && (value < 0 || (value === 0 && 1 / value < 0))) {
return {

@@ -926,3 +926,3 @@ type: "UnaryExpression",

AST_Null.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null });
AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null; });

@@ -953,3 +953,3 @@ AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast);

});
};
}

@@ -969,3 +969,3 @@ function my_end_token(moznode) {

});
};
}

@@ -982,3 +982,3 @@ function map(moztype, mytype, propmap) {

if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop){
if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop) {
var m = /([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(prop);

@@ -1026,3 +1026,3 @@ if (!m) throw new Error("Can't understand property map: " + prop);

def_to_moz(mytype, me_to_moz);
};
}

@@ -1036,5 +1036,5 @@ var FROM_MOZ_STACK = null;

return ret;
};
}
AST_Node.from_mozilla_ast = function(node){
AST_Node.from_mozilla_ast = function(node) {
var save_stack = FROM_MOZ_STACK;

@@ -1063,3 +1063,3 @@ FROM_MOZ_STACK = [];

return moznode;
};
}

@@ -1070,3 +1070,3 @@ function def_to_moz(mytype, handler) {

});
};
}

@@ -1081,4 +1081,4 @@ var TO_MOZ_STACK = null;

if (TO_MOZ_STACK.length === 0) { TO_MOZ_STACK = null; }
return ast
};
return ast;
}

@@ -1093,3 +1093,3 @@ function to_moz_in_destructuring() {

return false;
};
}

@@ -1101,3 +1101,3 @@ function to_moz_block(node) {

};
};
}

@@ -1113,3 +1113,3 @@ function to_moz_scope(type, node) {

};
};
}
})();

@@ -77,3 +77,3 @@ /***********************************************************************

objects.WeakMap, objects.WeakSet
].forEach(function(ctor){
].forEach(function(ctor) {
Object.getOwnPropertyNames(ctor).map(add);

@@ -160,3 +160,3 @@ if (ctor.prototype) {

// step 1: find candidates to mangle
ast.walk(new TreeWalker(function(node){
ast.walk(new TreeWalker(function(node) {
if (node instanceof AST_ObjectKeyVal) {

@@ -182,3 +182,3 @@ add(node.key);

// step 2: transform the tree, renaming properties
return ast.transform(new TreeTransformer(function(node){
return ast.transform(new TreeTransformer(function(node) {
if (node instanceof AST_ObjectKeyVal) {

@@ -260,3 +260,3 @@ node.key = mangle(node.key);

function mangleStrings(node) {
return node.transform(new TreeTransformer(function(node){
return node.transform(new TreeTransformer(function(node) {
if (node instanceof AST_Sequence) {

@@ -263,0 +263,0 @@ var last = node.expressions.length - 1;

@@ -59,3 +59,3 @@ /***********************************************************************

this.id = SymbolDef.next_id++;
};
}

@@ -105,3 +105,3 @@ SymbolDef.next_id = 1;

AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
options = defaults(options, {

@@ -120,3 +120,3 @@ cache: null,

var for_scopes = [];
var tw = new TreeWalker(function(node, descend){
var tw = new TreeWalker(function(node, descend) {
if (node.is_block_scope()) {

@@ -275,3 +275,3 @@ var save_scope = scope;

self.globals = new Dictionary();
var tw = new TreeWalker(function(node, descend){
var tw = new TreeWalker(function(node, descend) {
if (node instanceof AST_LoopControl && node.label) {

@@ -349,3 +349,3 @@ node.label.thedef.references.push(node);

AST_Toplevel.DEFMETHOD("def_global", function(node){
AST_Toplevel.DEFMETHOD("def_global", function(node) {
var globals = this.globals, name = node.name;

@@ -363,3 +363,3 @@ if (globals.has(name)) {

AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope){
AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope) {
this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions)

@@ -382,3 +382,3 @@ this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope)

AST_Lambda.DEFMETHOD("init_scope_vars", function(){
AST_Lambda.DEFMETHOD("init_scope_vars", function() {
AST_Scope.prototype.init_scope_vars.apply(this, arguments);

@@ -393,3 +393,3 @@ this.uses_arguments = false;

AST_Arrow.DEFMETHOD("init_scope_vars", function(){
AST_Arrow.DEFMETHOD("init_scope_vars", function() {
AST_Scope.prototype.init_scope_vars.apply(this, arguments);

@@ -419,3 +419,3 @@ this.uses_arguments = false;

AST_Scope.DEFMETHOD("find_variable", function(name){
AST_Scope.DEFMETHOD("find_variable", function(name) {
if (name instanceof AST_Symbol) name = name.name;

@@ -426,3 +426,3 @@ return this.variables.get(name)

AST_Scope.DEFMETHOD("def_function", function(symbol, init){
AST_Scope.DEFMETHOD("def_function", function(symbol, init) {
var def = this.def_variable(symbol, init);

@@ -434,3 +434,3 @@ if (!def.init || def.init instanceof AST_Defun) def.init = init;

AST_Scope.DEFMETHOD("def_variable", function(symbol, init){
AST_Scope.DEFMETHOD("def_variable", function(symbol, init) {
var def = this.variables.get(symbol.name);

@@ -472,7 +472,7 @@ if (def) {

AST_Scope.DEFMETHOD("next_mangled", function(options){
AST_Scope.DEFMETHOD("next_mangled", function(options) {
return next_mangled(this, options);
});
AST_Toplevel.DEFMETHOD("next_mangled", function(options){
AST_Toplevel.DEFMETHOD("next_mangled", function(options) {
var name;

@@ -485,3 +485,3 @@ do {

AST_Function.DEFMETHOD("next_mangled", function(options, def){
AST_Function.DEFMETHOD("next_mangled", function(options, def) {
// #179, #326

@@ -542,3 +542,3 @@ // in Safari strict mode, something like (function x(x){...}) is a syntax error;

AST_Toplevel.DEFMETHOD("mangle_names", function(options){
AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
options = this._default_mangler_options(options);

@@ -563,3 +563,3 @@

var tw = new TreeWalker(function(node, descend){
var tw = new TreeWalker(function(node, descend) {
if (node instanceof AST_LabeledStatement) {

@@ -592,3 +592,3 @@ // lname is incremented when we get to the AST_Label

this.walk(tw);
to_mangle.forEach(function(def){ def.mangle(options) });
to_mangle.forEach(function(def) { def.mangle(options); });

@@ -665,3 +665,3 @@ function collect(symbol) {

AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options){
AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) {
options = this._default_mangler_options(options);

@@ -735,4 +735,4 @@ try {

return ret;
};
}
return base54;
})();

@@ -91,8 +91,8 @@ /***********************************************************************

});
};
}
return {
add : add,
get : function() { return generator },
get : function() { return generator; },
toString : function() { return JSON.stringify(generator.toJSON()); }
};
};
}

@@ -55,6 +55,6 @@ /***********************************************************************

(function(undefined){
(function(undefined) {
function _(node, descend) {
node.DEFMETHOD("transform", function(tw, in_list){
node.DEFMETHOD("transform", function(tw, in_list) {
var x, y;

@@ -74,13 +74,13 @@ tw.push(this);

});
};
}
function do_list(list, tw) {
return MAP(list, function(node){
return MAP(list, function(node) {
return node.transform(tw, true);
});
};
}
_(AST_Node, noop);
_(AST_LabeledStatement, function(self, tw){
_(AST_LabeledStatement, function(self, tw) {
self.label = self.label.transform(tw);

@@ -90,11 +90,11 @@ self.body = self.body.transform(tw);

_(AST_SimpleStatement, function(self, tw){
_(AST_SimpleStatement, function(self, tw) {
self.body = self.body.transform(tw);
});
_(AST_Block, function(self, tw){
_(AST_Block, function(self, tw) {
self.body = do_list(self.body, tw);
});
_(AST_Do, function(self, tw){
_(AST_Do, function(self, tw) {
self.body = self.body.transform(tw);

@@ -104,3 +104,3 @@ self.condition = self.condition.transform(tw);

_(AST_While, function(self, tw){
_(AST_While, function(self, tw) {
self.condition = self.condition.transform(tw);

@@ -110,3 +110,3 @@ self.body = self.body.transform(tw);

_(AST_For, function(self, tw){
_(AST_For, function(self, tw) {
if (self.init) self.init = self.init.transform(tw);

@@ -118,3 +118,3 @@ if (self.condition) self.condition = self.condition.transform(tw);

_(AST_ForIn, function(self, tw){
_(AST_ForIn, function(self, tw) {
self.init = self.init.transform(tw);

@@ -125,3 +125,3 @@ self.object = self.object.transform(tw);

_(AST_With, function(self, tw){
_(AST_With, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -131,11 +131,11 @@ self.body = self.body.transform(tw);

_(AST_Exit, function(self, tw){
_(AST_Exit, function(self, tw) {
if (self.value) self.value = self.value.transform(tw);
});
_(AST_LoopControl, function(self, tw){
_(AST_LoopControl, function(self, tw) {
if (self.label) self.label = self.label.transform(tw);
});
_(AST_If, function(self, tw){
_(AST_If, function(self, tw) {
self.condition = self.condition.transform(tw);

@@ -146,3 +146,3 @@ self.body = self.body.transform(tw);

_(AST_Switch, function(self, tw){
_(AST_Switch, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -152,3 +152,3 @@ self.body = do_list(self.body, tw);

_(AST_Case, function(self, tw){
_(AST_Case, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -158,3 +158,3 @@ self.body = do_list(self.body, tw);

_(AST_Try, function(self, tw){
_(AST_Try, function(self, tw) {
self.body = do_list(self.body, tw);

@@ -165,3 +165,3 @@ if (self.bcatch) self.bcatch = self.bcatch.transform(tw);

_(AST_Catch, function(self, tw){
_(AST_Catch, function(self, tw) {
self.argname = self.argname.transform(tw);

@@ -171,7 +171,7 @@ self.body = do_list(self.body, tw);

_(AST_Definitions, function(self, tw){
_(AST_Definitions, function(self, tw) {
self.definitions = do_list(self.definitions, tw);
});
_(AST_VarDef, function(self, tw){
_(AST_VarDef, function(self, tw) {
self.name = self.name.transform(tw);

@@ -185,3 +185,3 @@ if (self.value) self.value = self.value.transform(tw);

_(AST_Lambda, function(self, tw){
_(AST_Lambda, function(self, tw) {
if (self.name) self.name = self.name.transform(tw);

@@ -196,3 +196,3 @@ self.argnames = do_list(self.argnames, tw);

_(AST_Call, function(self, tw){
_(AST_Call, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -202,11 +202,11 @@ self.args = do_list(self.args, tw);

_(AST_Sequence, function(self, tw){
_(AST_Sequence, function(self, tw) {
self.expressions = do_list(self.expressions, tw);
});
_(AST_Dot, function(self, tw){
_(AST_Dot, function(self, tw) {
self.expression = self.expression.transform(tw);
});
_(AST_Sub, function(self, tw){
_(AST_Sub, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -216,15 +216,15 @@ self.property = self.property.transform(tw);

_(AST_Yield, function(self, tw){
_(AST_Yield, function(self, tw) {
if (self.expression) self.expression = self.expression.transform(tw);
});
_(AST_Await, function(self, tw){
_(AST_Await, function(self, tw) {
self.expression = self.expression.transform(tw);
});
_(AST_Unary, function(self, tw){
_(AST_Unary, function(self, tw) {
self.expression = self.expression.transform(tw);
});
_(AST_Binary, function(self, tw){
_(AST_Binary, function(self, tw) {
self.left = self.left.transform(tw);

@@ -234,3 +234,3 @@ self.right = self.right.transform(tw);

_(AST_Conditional, function(self, tw){
_(AST_Conditional, function(self, tw) {
self.condition = self.condition.transform(tw);

@@ -241,11 +241,11 @@ self.consequent = self.consequent.transform(tw);

_(AST_Array, function(self, tw){
_(AST_Array, function(self, tw) {
self.elements = do_list(self.elements, tw);
});
_(AST_Object, function(self, tw){
_(AST_Object, function(self, tw) {
self.properties = do_list(self.properties, tw);
});
_(AST_ObjectProperty, function(self, tw){
_(AST_ObjectProperty, function(self, tw) {
if (self.key instanceof AST_Node) {

@@ -257,3 +257,3 @@ self.key = self.key.transform(tw);

_(AST_Class, function(self, tw){
_(AST_Class, function(self, tw) {
if (self.name) self.name = self.name.transform(tw);

@@ -264,3 +264,3 @@ if (self.extends) self.extends = self.extends.transform(tw);

_(AST_Expansion, function(self, tw){
_(AST_Expansion, function(self, tw) {
self.expression = self.expression.transform(tw);

@@ -267,0 +267,0 @@ });

@@ -48,7 +48,7 @@ /***********************************************************************

return str.split("");
};
}
function member(name, array) {
return array.indexOf(name) >= 0;
};
}

@@ -60,3 +60,3 @@ function find_if(func, array) {

}
};
}

@@ -70,3 +70,3 @@ function repeat_string(str, i) {

return d;
};
}

@@ -90,3 +90,3 @@ function configure_error_stack(fn) {

this.defs = defs;
};
}
DefaultsError.prototype = Object.create(Error.prototype);

@@ -111,3 +111,3 @@ DefaultsError.prototype.constructor = DefaultsError;

return ret;
};
}

@@ -121,3 +121,3 @@ function merge(obj, ext) {

return count;
};
}

@@ -130,3 +130,3 @@ function noop() {}

var MAP = (function(){
var MAP = (function() {
function MAP(a, f, backwards) {

@@ -154,3 +154,3 @@ var ret = [], top = [], i;

return is_last;
};
}
if (a instanceof Array) {

@@ -169,10 +169,10 @@ if (backwards) {

return top.concat(ret);
};
MAP.at_top = function(val) { return new AtTop(val) };
MAP.splice = function(val) { return new Splice(val) };
MAP.last = function(val) { return new Last(val) };
}
MAP.at_top = function(val) { return new AtTop(val); };
MAP.splice = function(val) { return new Splice(val); };
MAP.last = function(val) { return new Last(val); };
var skip = MAP.skip = {};
function AtTop(val) { this.v = val };
function Splice(val) { this.v = val };
function Last(val) { this.v = val };
function AtTop(val) { this.v = val; }
function Splice(val) { this.v = val; }
function Last(val) { this.v = val; }
return MAP;

@@ -184,9 +184,9 @@ })();

array.push(el);
};
}
function string_template(text, props) {
return text.replace(/\{(.+?)\}/g, function(str, p){
return text.replace(/\{(.+?)\}/g, function(str, p) {
return props && props[p];
});
};
}

@@ -197,3 +197,3 @@ function remove(array, el) {

}
};
}

@@ -212,3 +212,3 @@ function mergeSort(array, cmp) {

return r;
};
}
function _ms(a) {

@@ -221,5 +221,5 @@ if (a.length <= 1)

return merge(left, right);
};
}
return _ms(array);
};
}

@@ -270,3 +270,3 @@ // this function is taken from Acorn [1], written by Marijn Haverbeke

return new Function("str", f);
};
}

@@ -278,3 +278,3 @@ function all(array, predicate) {

return true;
};
}

@@ -284,3 +284,3 @@ function Dictionary() {

this._size = 0;
};
}
Dictionary.prototype = {

@@ -300,3 +300,3 @@ set: function(key, val) {

},
get: function(key) { return this._values["$" + key] },
get: function(key) { return this._values["$" + key]; },
del: function(key) {

@@ -309,3 +309,3 @@ if (this.has(key)) {

},
has: function(key) { return ("$" + key) in this._values },
has: function(key) { return ("$" + key) in this._values; },
each: function(f) {

@@ -331,3 +331,3 @@ for (var i in this._values)

},
toObject: function() { return this._values }
toObject: function() { return this._values; }
};

@@ -334,0 +334,0 @@ Dictionary.fromObject = function(obj) {

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

"license": "BSD-2-Clause",
"version": "3.7.6",
"version": "3.7.7",
"engines": {

@@ -19,2 +19,3 @@ "node": ">=0.8.0"

"main": "tools/node.js",
"browser": "dist/browser.bundle.js",
"bin": {

@@ -26,2 +27,3 @@ "terser": "bin/uglifyjs"

"lib",
"dist",
"tools",

@@ -32,3 +34,4 @@ "LICENSE"

"commander": "~2.14.1",
"source-map": "~0.6.1"
"source-map": "~0.6.1",
"source-map-support": "~0.5.6"
},

@@ -38,7 +41,12 @@ "devDependencies": {

"escodegen": "^1.9.1",
"eslint": "^4.19.1",
"mocha": "~3.5.1",
"pre-commit": "^1.2.2",
"semver": "~5.5.0"
},
"scripts": {
"test": "node test/run-tests.js"
"test": "node test/run-tests.js",
"lint": "eslint lib",
"lint-fix": "eslint --fix lib",
"prepublish": "node bin/uglifyjs lib/utils.js lib/ast.js lib/parse.js lib/transform.js lib/scope.js lib/output.js lib/compress.js lib/sourcemap.js lib/mozilla-ast.js lib/propmangle.js lib/minify.js tools/exports.js -c defaults=false -d \"MOZ_SourceMap=require('source-map')\" --source-map \"includeSources=true,url='browser.bundle.js.map'\" -e \"exports:(typeof module != 'undefined' ? module.exports : Terser = {})\" -b ascii_only --comments /license/ -o dist/browser.bundle.js"
},

@@ -63,3 +71,24 @@ "keywords": [

"await"
]
],
"eslintConfig": {
"rules": {
"quotes": [
"error",
"double",
"avoid-escape"
],
"no-debugger": "error",
"semi": [
"error",
"always"
],
"no-extra-semi": "error",
"no-irregular-whitespace": "error",
"space-before-blocks": [
"error",
"always"
]
}
},
"pre-commit": "lint"
}

@@ -6,5 +6,11 @@ terser

#### Note:
- **`terser` is API/CLI compatible with `uglify-es` and `uglify-js@3`.**
Why choose terser?
------------------
`uglify-es` is no longer maintained and `uglify-js` does not support ES6+.
**`terser`** is a fork of `uglify-es` that retains API and CLI compatibility
with `uglify-es` and `uglify-js@3`.
Install

@@ -23,3 +29,3 @@ -------

npm install terser
# Command line usage

@@ -640,3 +646,3 @@

- `arguments` (default: `true`) -- replace `arguments[index]` with function
- `arguments` (default: `false`) -- replace `arguments[index]` with function
parameter name whenever possible.

@@ -791,3 +797,4 @@

- `unsafe` (default: `false`) -- apply "unsafe" transformations (discussion below)
- `unsafe` (default: `false`) -- apply "unsafe" transformations
([details](#the-unsafe-compress-option)).

@@ -982,3 +989,3 @@ - `unsafe_arrows` (default: `false`) -- Convert ES5 style anonymous function

function expressions. See
[#640](https://github.com/mishoo/Terser2/issues/640) for more details.
[#640](https://github.com/mishoo/UglifyJS2/issues/640) for more details.

@@ -1018,5 +1025,6 @@ # Miscellaneous

It enables some transformations that *might* break code logic in certain
contrived cases, but should be fine for most code. You might want to try it
on your own code, it should reduce the minified size. Here's what happens
when this flag is on:
contrived cases, but should be fine for most code. It assumes that standard
built-in ECMAScript functions and classes have not been altered or replaced.
You might want to try it on your own code; it should reduce the minified size.
Some examples of the optimizations made when this option is enabled:

@@ -1027,2 +1035,3 @@ - `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]`

- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`
- `"foo bar".substr(4)` → `"bar"`

@@ -1143,6 +1152,11 @@ ### Conditional compilation

Transversal and transformation of the native AST can be performed through
[`TreeWalker`](http://lisperator.net/terser/walk) and
[`TreeTransformer`](http://lisperator.net/terser/transform) respectively.
Traversal and transformation of the native AST can be performed through
[`TreeWalker`](https://github.com/fabiosantoscode/terser/blob/master/lib/ast.js) and
[`TreeTransformer`](https://github.com/fabiosantoscode/terser/blob/master/lib/transform.js)
respectively.
Largely compatible native AST examples can be found in the original UglifyJS
documention. See: [tree walker](http://lisperator.net/uglifyjs/walk) and
[tree transform](http://lisperator.net/uglifyjs/transform).
### ESTree / SpiderMonkey AST

@@ -1228,1 +1242,28 @@

`Object.preventExtensions()` or `Object.seal()`).
### Build Tools and Adaptors using Terser
https://www.npmjs.com/browse/depended/terser
### Replacing `uglify-es` with `terser` in a project using `yarn`
A number of JS bundlers and uglify wrappers are still using buggy versions
of `uglify-es` and have not yet upgraded to `terser`. If you are using `yarn`
you can add the following alias to your project's `package.json` file:
```js
"resolutions": {
"uglify-es": "npm:terser"
}
```
to use `terser` instead of `uglify-es` in all deeply nested dependencies
without changing any code.
Note: for this change to take effect you must run the following commands
to remove the existing `yarn` lock file and reinstall all packages:
```
$ rm -rf node_modules yarn.lock
$ yarn
```
"use strict"
var Console = require("console").Console;
var semver = require("semver");
if (process.version.slice(0, 3) === "v10") {
if (semver.satisfies(process.version, ">=10")) {
var Console = require("console").Console;
global.console = new Console({

@@ -7,0 +8,0 @@ stdout: process.stdout,

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