Update dependencies

This commit is contained in:
Jay Trees 2022-02-07 15:48:46 +01:00
parent 4098eacf03
commit 5d8b1b788a
879 changed files with 3792 additions and 2525 deletions

21
node_modules/uglify-js/lib/ast.js generated vendored
View file

@ -142,6 +142,7 @@ DEF_BITPROPS(AST_Node, [
"_squeezed",
// AST_Call
"call_only",
// AST_Lambda
"collapse_scanning",
// AST_SymbolRef
"defined",
@ -1537,6 +1538,12 @@ var AST_Assign = DEFNODE("Assign", null, {
throw new Error("left must be assignable: " + node.TYPE);
}
});
} else if (!(this.left instanceof AST_Infinity
|| this.left instanceof AST_NaN
|| this.left instanceof AST_PropAccess && !this.left.optional
|| this.left instanceof AST_SymbolRef
|| this.left instanceof AST_Undefined)) {
throw new Error("left must be assignable");
}
},
}, AST_Binary);
@ -1971,27 +1978,27 @@ var AST_Atom = DEFNODE("Atom", null, {
var AST_Null = DEFNODE("Null", null, {
$documentation: "The `null` atom",
value: null
value: null,
}, AST_Atom);
var AST_NaN = DEFNODE("NaN", null, {
$documentation: "The impossible value",
value: 0/0
value: 0/0,
}, AST_Atom);
var AST_Undefined = DEFNODE("Undefined", null, {
$documentation: "The `undefined` value",
value: function(){}()
value: function(){}(),
}, AST_Atom);
var AST_Hole = DEFNODE("Hole", null, {
$documentation: "A hole in an array",
value: function(){}()
value: function(){}(),
}, AST_Atom);
var AST_Infinity = DEFNODE("Infinity", null, {
$documentation: "The `Infinity` value",
value: 1/0
value: 1/0,
}, AST_Atom);
var AST_Boolean = DEFNODE("Boolean", null, {
@ -2003,12 +2010,12 @@ var AST_Boolean = DEFNODE("Boolean", null, {
var AST_False = DEFNODE("False", null, {
$documentation: "The `false` atom",
value: false
value: false,
}, AST_Boolean);
var AST_True = DEFNODE("True", null, {
$documentation: "The `true` atom",
value: true
value: true,
}, AST_Boolean);
/* -----[ TreeWalker ]----- */

2259
node_modules/uglify-js/lib/compress.js generated vendored

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@ function read_source_map(name, toplevel) {
var match = /^# ([^\s=]+)=(\S+)\s*$/.exec(comment.value);
if (!match) break;
if (match[1] == "sourceMappingURL") {
match = /^data:application\/json(;.*?)?;base64,(\S+)$/.exec(match[2]);
match = /^data:application\/json(;.*?)?;base64,([^,]+)$/.exec(match[2]);
if (!match) break;
return to_ascii(match[2]);
}
@ -78,6 +78,7 @@ function minify(files, options) {
enclose: false,
ie: false,
ie8: false,
keep_fargs: false,
keep_fnames: false,
mangle: {},
nameCache: null,
@ -99,6 +100,7 @@ function minify(files, options) {
if (options.annotations !== undefined) set_shorthand("annotations", options, [ "compress", "output" ]);
if (options.ie8) options.ie = options.ie || options.ie8;
if (options.ie) set_shorthand("ie", options, [ "compress", "mangle", "output" ]);
if (options.keep_fargs) set_shorthand("keep_fargs", options, [ "compress", "mangle" ]);
if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle" ]);
if (options.v8) set_shorthand("v8", options, [ "mangle", "output" ]);
@ -109,6 +111,7 @@ function minify(files, options) {
cache: options.nameCache && (options.nameCache.vars || {}),
eval: false,
ie: false,
keep_fargs: false,
keep_fnames: false,
properties: false,
reserved: [],

View file

@ -1005,7 +1005,7 @@
});
def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) {
var flags = M.value.toString().match(/[gimuy]*$/)[0];
var flags = M.value.toString().match(/\/([gimuy]*)$/)[1];
var value = "/" + M.value.raw_source + "/" + flags;
return {
type: "Literal",
@ -1013,8 +1013,8 @@
raw: value,
regex: {
pattern: M.value.raw_source,
flags: flags
}
flags: flags,
},
};
});

138
node_modules/uglify-js/lib/output.js generated vendored
View file

@ -101,10 +101,18 @@ function OutputStream(options) {
}
}
function make_indent(value) {
if (typeof value == "number") return new Array(value + 1).join(" ");
if (!value) return "";
if (!/^\s*$/.test(value)) throw new Error("unsupported indentation: " + JSON.stringify("" + value));
return value;
}
var current_col = 0;
var current_line = 1;
var current_pos = 0;
var indentation = options.indent_start;
var current_indent = make_indent(options.indent_start);
var full_indent = make_indent(options.indent_level);
var half_indent = full_indent.length + 1 >> 1;
var last;
var line_end = 0;
var line_fixed = true;
@ -115,17 +123,17 @@ function OutputStream(options) {
var might_need_semicolon;
var need_newline_indented = false;
var need_space = false;
var newline_insert = -1;
var output;
var stack;
var OUTPUT;
var stored = "";
function reset() {
last = "";
might_need_space = false;
might_need_semicolon = false;
stack = [];
var str = OUTPUT;
OUTPUT = "";
var str = output;
output = "";
return str;
}
@ -227,32 +235,30 @@ function OutputStream(options) {
} : noop;
function insert_newlines(count) {
var index = OUTPUT.lastIndexOf("\n");
if (line_end < index) line_end = index;
var left = OUTPUT.slice(0, line_end);
var right = OUTPUT.slice(line_end);
adjust_mappings(count, right.length - current_col);
stored += output.slice(0, line_end);
output = output.slice(line_end);
var new_col = output.length;
adjust_mappings(count, new_col - current_col);
current_line += count;
current_pos += count;
current_col = right.length;
OUTPUT = left;
while (count--) OUTPUT += "\n";
OUTPUT += right;
current_col = new_col;
while (count--) stored += "\n";
}
var fix_line = options.max_line_len ? function() {
var fix_line = options.max_line_len ? function(flush) {
if (line_fixed) {
if (current_col > options.max_line_len) {
AST_Node.warn("Output exceeds {max_line_len} characters", options);
}
return;
}
if (current_col > options.max_line_len) insert_newlines(1);
line_fixed = true;
flush_mappings();
if (current_col > options.max_line_len) {
insert_newlines(1);
line_fixed = true;
}
if (line_fixed || flush) flush_mappings();
} : noop;
var requireSemicolonChars = makePredicate("( [ + * / - , .");
var require_semicolon = makePredicate("( [ + * / - , .");
var print = options.beautify
|| options.comments
@ -276,32 +282,32 @@ function OutputStream(options) {
space();
}
}
newline_insert = -1;
var prev = last.slice(-1);
if (might_need_semicolon) {
might_need_semicolon = false;
if (prev == ":" && ch == "}" || (!ch || ";}".indexOf(ch) < 0) && prev != ";") {
if (options.semicolons || requireSemicolonChars[ch]) {
OUTPUT += ";";
if (prev == ":" && ch == "}" || prev != ";" && (!ch || ";}".indexOf(ch) < 0)) {
var need_semicolon = require_semicolon[ch];
if (need_semicolon || options.semicolons) {
output += ";";
current_col++;
current_pos++;
if (!line_fixed) {
fix_line();
if (line_fixed && !need_semicolon && output == ";") {
output = "";
current_col = 0;
}
}
if (line_end == output.length - 1) line_end++;
} else {
fix_line();
OUTPUT += "\n";
current_pos++;
output += "\n";
current_line++;
current_col = 0;
if (/^\s+$/.test(str)) {
// reset the semicolon flag, since we didn't print one
// now and might still have to later
might_need_semicolon = true;
}
// reset the semicolon flag, since we didn't print one
// now and might still have to later
if (/^\s+$/.test(str)) might_need_semicolon = true;
}
if (!options.beautify)
might_need_space = false;
if (!options.beautify) might_need_space = false;
}
}
@ -312,9 +318,8 @@ function OutputStream(options) {
|| str == "--" && last == "!"
|| str == "in" && prev == "/"
|| last == "--" && ch == ">") {
OUTPUT += " ";
output += " ";
current_col++;
current_pos++;
}
if (prev != "<" || str != "!") might_need_space = false;
}
@ -324,14 +329,13 @@ function OutputStream(options) {
token: mapping_token,
name: mapping_name,
line: current_line,
col: current_col
col: current_col,
});
mapping_token = false;
if (line_fixed) flush_mappings();
}
OUTPUT += str;
current_pos += str.length;
output += str;
var a = str.split(/\r?\n/), n = a.length - 1;
current_line += n;
current_col += a[0].length;
@ -346,7 +350,7 @@ function OutputStream(options) {
if (might_need_semicolon) {
might_need_semicolon = false;
if (prev == ":" && ch == "}" || (!ch || ";}".indexOf(ch) < 0) && prev != ";") {
OUTPUT += ";";
output += ";";
might_need_space = false;
}
}
@ -357,11 +361,11 @@ function OutputStream(options) {
|| str == "--" && last == "!"
|| str == "in" && prev == "/"
|| last == "--" && ch == ">") {
OUTPUT += " ";
output += " ";
}
if (prev != "<" || str != "!") might_need_space = false;
}
OUTPUT += str;
output += str;
last = str;
};
@ -373,30 +377,25 @@ function OutputStream(options) {
var indent = options.beautify ? function(half) {
if (need_newline_indented) print("\n");
print(repeat_string(" ", half ? indentation - (options.indent_level >> 1) : indentation));
print(half ? current_indent.slice(0, -half_indent) : current_indent);
} : noop;
var with_indent = options.beautify ? function(cont) {
var save_indentation = indentation;
indentation += options.indent_level;
var save_indentation = current_indent;
current_indent += full_indent;
cont();
indentation = save_indentation;
current_indent = save_indentation;
} : function(cont) { cont() };
var may_add_newline = options.max_line_len || options.preserve_line ? function() {
fix_line();
line_end = OUTPUT.length;
line_end = output.length;
line_fixed = false;
} : noop;
var newline = options.beautify ? function() {
if (newline_insert < 0) return print("\n");
if (OUTPUT[newline_insert] != "\n") {
OUTPUT = OUTPUT.slice(0, newline_insert) + "\n" + OUTPUT.slice(newline_insert);
current_pos++;
current_line++;
}
newline_insert++;
print("\n");
line_end = output.length;
} : may_add_newline;
var semicolon = options.beautify ? function() {
@ -452,13 +451,12 @@ function OutputStream(options) {
} : noop;
function get() {
if (!line_fixed) fix_line();
return OUTPUT;
if (!line_fixed) fix_line(true);
return stored + output;
}
function has_nlb() {
var index = OUTPUT.lastIndexOf("\n");
return /^ *$/.test(OUTPUT.slice(index + 1));
return /(^|\n) *$/.test(output);
}
function pad_comment(token, force) {
@ -515,15 +513,13 @@ function OutputStream(options) {
scan.walk(tw);
}
if (current_pos == 0) {
if (current_line == 1 && current_col == 0) {
if (comments.length > 0 && options.shebang && comments[0].type == "comment5") {
print("#!" + comments.shift().value + "\n");
indent();
}
var preamble = options.preamble;
if (preamble) {
print(preamble.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g, "\n"));
}
if (preamble) print(preamble.replace(/\r\n?|\u2028|\u2029|(^|\S)\s*$/g, "$1\n"));
}
comments = comments.filter(comment_filter, node);
@ -561,20 +557,18 @@ function OutputStream(options) {
return !/comment[134]/.test(c.type);
}))) return;
comments._dumped = self;
var insert = OUTPUT.length;
comments.filter(comment_filter, node).forEach(function(comment, index) {
pad_comment(comment, index || !tail);
print_comment(comment);
});
if (OUTPUT.length > insert) newline_insert = insert;
}
return {
get : get,
reset : reset,
indent : indent,
should_break : options.width ? function() {
return current_col - indentation >= options.width;
should_break : options.beautify && options.width ? function() {
return current_col >= options.width;
} : return_false,
has_parens : function() { return last.slice(-1) == "(" },
newline : newline,
@ -1870,8 +1864,8 @@ function OutputStream(options) {
len = match[0].length;
digits = str.slice(len);
candidates.push(digits + "e-" + (digits.length + len - 1));
} else if (match = /0+$/.exec(str)) {
len = match[0].length;
} else if (match = /[^0]0+$/.exec(str)) {
len = match[0].length - 1;
candidates.push(str.slice(0, -len) + "e" + len);
} else if (match = /^(\d)\.(\d+)e(-?\d+)$/.exec(str)) {
candidates.push(match[1] + match[2] + "e" + (match[3] - match[2].length));

98
node_modules/uglify-js/lib/scope.js generated vendored
View file

@ -92,15 +92,19 @@ SymbolDef.prototype = {
if (def && def !== self) return def.redefined() || def;
},
unmangleable: function(options) {
return this.global && !options.toplevel
|| this.exported
|| this.undeclared
|| !options.eval && this.scope.pinned()
|| options.keep_fnames
&& (this.orig[0] instanceof AST_SymbolClass
|| this.orig[0] instanceof AST_SymbolDefClass
|| this.orig[0] instanceof AST_SymbolDefun
|| this.orig[0] instanceof AST_SymbolLambda);
if (this.exported) return true;
if (this.undeclared) return true;
if (!options.eval && this.scope.pinned()) return true;
if (options.keep_fargs && is_funarg(this)) return true;
if (options.keep_fnames) {
var sym = this.orig[0];
if (sym instanceof AST_SymbolClass) return true;
if (sym instanceof AST_SymbolDefClass) return true;
if (sym instanceof AST_SymbolDefun) return true;
if (sym instanceof AST_SymbolLambda) return true;
}
if (!options.toplevel && this.global) return true;
return false;
},
};
@ -113,6 +117,10 @@ DEF_BITPROPS(SymbolDef, [
"undeclared",
]);
function is_funarg(def) {
return def.orig[0] instanceof AST_SymbolFunarg || def.orig[1] instanceof AST_SymbolFunarg;
}
var unary_side_effects = makePredicate("delete ++ --");
function is_lhs(node, parent) {
@ -214,10 +222,8 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
} else if (node instanceof AST_SymbolDefun) {
var def = defun.def_function(node, tw.parent());
if (exported) def.exported = true;
entangle(defun, scope);
} else if (node instanceof AST_SymbolFunarg) {
defun.def_variable(node);
entangle(defun, scope);
} else if (node instanceof AST_SymbolLambda) {
var def = defun.def_function(node, node.name == "arguments" ? undefined : defun);
if (options.ie) def.defun = defun.parent_scope.resolve();
@ -227,7 +233,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
} else if (node instanceof AST_SymbolVar) {
var def = defun.def_variable(node, node instanceof AST_SymbolImport ? undefined : null);
if (exported) def.exported = true;
entangle(defun, scope);
}
function walk_scope(descend) {
@ -240,16 +245,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
scope = save_scope;
defun = save_defun;
}
function entangle(defun, scope) {
if (defun === scope) return;
node.mark_enclosed(options);
var def = scope.find_variable(node.name);
if (node.thedef === def) return;
node.thedef = def;
def.orig.push(node);
node.mark_enclosed(options);
}
});
self.make_def = function(orig, init) {
return new SymbolDef(++next_def_id, this, orig, init);
@ -270,6 +265,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
}
if (node instanceof AST_Lambda) {
in_arg.push(node);
if (node.name) node.name.walk(tw);
node.argnames.forEach(function(argname) {
argname.walk(tw);
});
@ -296,6 +292,16 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
// ensure compression works if `const` reuses a scope variable
var redef = def.redefined();
if (redef) redef.const_redefs = true;
} else if (def.scope !== node.scope && (node instanceof AST_SymbolDefun
|| node instanceof AST_SymbolFunarg
|| node instanceof AST_SymbolVar)) {
node.mark_enclosed(options);
var redef = node.scope.find_variable(node.name);
if (node.thedef !== redef) {
node.thedef = redef;
redef.orig.push(node);
node.mark_enclosed(options);
}
}
if (node.name != "arguments") return true;
var parent = node instanceof AST_SymbolVar && tw.parent();
@ -475,8 +481,11 @@ AST_Symbol.DEFMETHOD("mark_enclosed", function(options) {
push_uniq(s.enclosed, def);
if (!options) {
s._var_names = undefined;
} else if (options.keep_fnames) {
s.functions.each(function(d) {
} else {
if (options.keep_fargs && s instanceof AST_Lambda) s.each_argname(function(arg) {
push_uniq(def.scope.enclosed, arg.definition());
});
if (options.keep_fnames) s.functions.each(function(d) {
push_uniq(def.scope.enclosed, d);
});
}
@ -581,6 +590,7 @@ function _default_mangler_options(options) {
options = defaults(options, {
eval : false,
ie : false,
keep_fargs : false,
keep_fnames : false,
reserved : [],
toplevel : false,
@ -588,32 +598,30 @@ function _default_mangler_options(options) {
webkit : false,
});
if (!Array.isArray(options.reserved)) options.reserved = [];
// Never mangle arguments
// Never mangle `arguments`
push_uniq(options.reserved, "arguments");
options.reserved.has = makePredicate(options.reserved);
return options;
}
// We only need to mangle declaration nodes. Special logic wired into the code
// generator will display the mangled name if it is present (and for
// `AST_SymbolRef`s it will use the mangled name of the `AST_SymbolDeclaration`
// that it points to).
AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
options = _default_mangler_options(options);
// We only need to mangle declaration nodes. Special logic wired
// into the code generator will display the mangled name if it's
// present (and for AST_SymbolRef-s it'll use the mangled name of
// the AST_SymbolDeclaration that it points to).
var lname = -1;
if (options.cache && options.cache.props) {
var mangled_names = names_in_use(this, options);
options.cache.props.each(function(mangled_name) {
mangled_names.set(mangled_name, true);
});
}
var cutoff = 10;
var lname = -1;
var redefined = [];
var tw = new TreeWalker(function(node, descend) {
if (node instanceof AST_LabeledStatement) {
// lname is incremented when we get to the AST_Label
// `lname` is incremented when we get to the `AST_Label`
var save_nesting = lname;
descend();
if (!options.v8 || !in_label(tw)) lname = save_nesting;
@ -635,9 +643,9 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
});
}, true);
}
node.to_mangle = [];
var to_mangle = node.to_mangle = [];
node.variables.each(function(def) {
if (!defer_redef(def)) node.to_mangle.push(def);
if (!defer_redef(def)) to_mangle.push(def);
});
descend();
if (options.cache && node instanceof AST_Toplevel) {
@ -648,7 +656,23 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
sym.scope = node;
sym.reference(options);
}
node.to_mangle.forEach(mangle);
if (to_mangle.length > cutoff) {
var indices = to_mangle.map(function(def, index) {
return index;
}).sort(function(i, j) {
return to_mangle[j].references.length - to_mangle[i].references.length || i - j;
});
to_mangle = indices.slice(0, cutoff).sort(function(i, j) {
return i - j;
}).map(function(index) {
return to_mangle[index];
}).concat(indices.slice(cutoff).sort(function(i, j) {
return i - j;
}).map(function(index) {
return to_mangle[index];
}));
}
to_mangle.forEach(mangle);
return true;
}
if (node instanceof AST_Label) {

View file

@ -55,14 +55,6 @@ function find_if(func, array) {
for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i];
}
function repeat_string(str, i) {
if (i <= 0) return "";
if (i == 1) return str;
var d = repeat_string(str, i >> 1);
d += d;
return i & 1 ? d + str : d;
}
function configure_error_stack(fn) {
Object.defineProperty(fn.prototype, "stack", {
get: function() {