update, text, response
This commit is contained in:
2
node_modules/uglify-js/LICENSE
generated
vendored
2
node_modules/uglify-js/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
UglifyJS is released under the BSD license:
|
||||
|
||||
Copyright 2012-2019 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
||||
Copyright 2012-2024 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
||||
25
node_modules/uglify-js/README.md
generated
vendored
25
node_modules/uglify-js/README.md
generated
vendored
@@ -119,6 +119,8 @@ a double dash to prevent input files being used as option arguments:
|
||||
--keep-fnames Do not mangle/drop function names. Useful for
|
||||
code relying on Function.prototype.name.
|
||||
--module Process input as ES module (implies --toplevel)
|
||||
--no-module Avoid optimizations which may alter runtime behavior
|
||||
under prior versions of JavaScript.
|
||||
--name-cache <file> File to hold mangled name mappings.
|
||||
--self Build UglifyJS as a library (implies --wrap UglifyJS)
|
||||
--source-map [options] Enable source map/specify source map options:
|
||||
@@ -530,9 +532,9 @@ if (result.error) throw result.error;
|
||||
- `mangle.properties` (default: `false`) — a subcategory of the mangle option.
|
||||
Pass an object to specify custom [mangle property options](#mangle-properties-options).
|
||||
|
||||
- `module` (default: `false`) — set to `true` if you wish to process input as
|
||||
ES module, i.e. implicit `"use strict";` and support for top-level `await`,
|
||||
alongside with `toplevel` enabled.
|
||||
- `module` (default: `true`) — process input as ES module, i.e. implicit
|
||||
`"use strict";` and support for top-level `await`. When explicitly specified,
|
||||
also enables `toplevel`.
|
||||
|
||||
- `nameCache` (default: `null`) — pass an empty object `{}` or a previously
|
||||
used `nameCache` object if you wish to cache mangled variable and
|
||||
@@ -750,7 +752,7 @@ to be `false` and all symbol names will be omitted.
|
||||
- `merge_vars` (default: `true`) — combine and reuse variables.
|
||||
|
||||
- `module` (default: `false`) — set to `true` if you wish to process input as
|
||||
ES module, i.e. implicit `"use strict";` alongside with `toplevel` enabled.
|
||||
ES module, i.e. implicit `"use strict";`.
|
||||
|
||||
- `negate_iife` (default: `true`) — negate "Immediately-Called Function Expressions"
|
||||
where the return value is discarded, to avoid the parentheses that the
|
||||
@@ -777,11 +779,11 @@ to be `false` and all symbol names will be omitted.
|
||||
overhead (compression will be slower). Make sure symbols under `pure_funcs`
|
||||
are also under `mangle.reserved` to avoid mangling.
|
||||
|
||||
- `pure_getters` (default: `"strict"`) — If you pass `true` for
|
||||
this, UglifyJS will assume that object property access
|
||||
(e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects.
|
||||
Specify `"strict"` to treat `foo.bar` as side-effect-free only when
|
||||
`foo` is certain to not throw, i.e. not `null` or `undefined`.
|
||||
- `pure_getters` (default: `"strict"`) — Pass `true` for UglifyJS to assume that
|
||||
object property access (e.g. `foo.bar` or `a[42]`) does not throw exception or
|
||||
alter program states via getter function. Pass `"strict"` to allow dropping or
|
||||
reordering `foo.bar` only if `foo` is not `null` or `undefined` and is safe to
|
||||
access as a variable. Pass `false` to retain all property accesses.
|
||||
|
||||
- `reduce_funcs` (default: `true`) — Allows single-use functions to be
|
||||
inlined as function expressions when permissible allowing further
|
||||
@@ -925,9 +927,8 @@ can pass additional arguments that control the code output:
|
||||
regexps (affects directives with non-ascii characters becoming invalid)
|
||||
|
||||
- `beautify` (default: `true`) — whether to actually beautify the output.
|
||||
Passing `-b` will set this to true, but you might need to pass `-b` even
|
||||
when you want to generate minified code, in order to specify additional
|
||||
arguments, so you can use `-b beautify=false` to override it.
|
||||
Passing `-b` will set this to true. Use `-O` if you want to generate minified
|
||||
code and specify additional arguments.
|
||||
|
||||
- `braces` (default: `false`) — always insert braces in `if`, `for`,
|
||||
`do`, `while` or `with` statements, even if their body is a single
|
||||
|
||||
35
node_modules/uglify-js/bin/uglifyjs
generated
vendored
35
node_modules/uglify-js/bin/uglifyjs
generated
vendored
@@ -108,7 +108,8 @@ function process_option(name, no_value) {
|
||||
" --ie Support non-standard Internet Explorer.",
|
||||
" --keep-fargs Do not mangle/drop function arguments.",
|
||||
" --keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name.",
|
||||
" --module Process input as ES module (implies --toplevel)",
|
||||
" --module Process input as ES module (implies --toplevel).",
|
||||
" --no-module Process input with improved JavaScript compatibility.",
|
||||
" --name-cache <file> File to hold mangled name mappings.",
|
||||
" --rename Force symbol expansion.",
|
||||
" --no-rename Disable symbol expansion.",
|
||||
@@ -155,7 +156,6 @@ function process_option(name, no_value) {
|
||||
case "expression":
|
||||
case "ie":
|
||||
case "ie8":
|
||||
case "module":
|
||||
case "timings":
|
||||
case "toplevel":
|
||||
case "v8":
|
||||
@@ -201,6 +201,12 @@ function process_option(name, no_value) {
|
||||
if (typeof options.mangle != "object") options.mangle = {};
|
||||
options.mangle.properties = parse_js(read_value(), options.mangle.properties);
|
||||
break;
|
||||
case "module":
|
||||
options.module = true;
|
||||
break;
|
||||
case "no-module":
|
||||
options.module = false;
|
||||
break;
|
||||
case "name-cache":
|
||||
nameCache = read_value(true);
|
||||
options.nameCache = JSON.parse(read_file(nameCache, "{}"));
|
||||
@@ -295,9 +301,19 @@ if (specified["in-situ"]) {
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.once("data", function() {
|
||||
clearTimeout(timerId);
|
||||
}).on("data", function(chunk) {
|
||||
}).on("data", process.stdin.isTTY ? function(chunk) {
|
||||
// emulate console input termination via Ctrl+D / Ctrl+Z
|
||||
var match = /[\x04\x1a]\r?\n?$/.exec(chunk);
|
||||
if (match) {
|
||||
chunks.push(chunk.slice(0, -match[0].length));
|
||||
process.stdin.pause();
|
||||
process.stdin.emit("end");
|
||||
} else {
|
||||
chunks.push(chunk);
|
||||
}
|
||||
} : function(chunk) {
|
||||
chunks.push(chunk);
|
||||
}).on("end", function() {
|
||||
}).once("end", function() {
|
||||
files = { STDIN: chunks.join("") };
|
||||
run();
|
||||
});
|
||||
@@ -451,11 +467,14 @@ function run() {
|
||||
} else if (output) {
|
||||
var code;
|
||||
if (result.ast) {
|
||||
var opts = {};
|
||||
for (var name in options.output) {
|
||||
if (!/^ast|code$/.test(name)) opts[name] = options.output[name];
|
||||
var output_options = {};
|
||||
for (var name in UglifyJS.default_options("output")) {
|
||||
if (name in options) output_options[name] = options[name];
|
||||
}
|
||||
code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(opts);
|
||||
for (var name in options.output) {
|
||||
if (!/^ast|code$/.test(name)) output_options[name] = options.output[name];
|
||||
}
|
||||
code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(output_options);
|
||||
} else {
|
||||
code = result.code;
|
||||
}
|
||||
|
||||
9
node_modules/uglify-js/lib/ast.js
generated
vendored
9
node_modules/uglify-js/lib/ast.js
generated
vendored
@@ -169,8 +169,6 @@ DEF_BITPROPS(AST_Node, [
|
||||
"private",
|
||||
// AST_Call
|
||||
"pure",
|
||||
// AST_Assign
|
||||
"redundant",
|
||||
// AST_Node
|
||||
"single_use",
|
||||
// AST_ClassProperty
|
||||
@@ -967,9 +965,12 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "key private static value", {
|
||||
if (this.key != null) throw new Error("key must be null");
|
||||
} else if (typeof this.key != "string") {
|
||||
if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node");
|
||||
if (this.private) throw new Error("computed key cannot be private");
|
||||
must_be_expression(this, "key");
|
||||
} else if (this.private) {
|
||||
if (!/^#/.test(this.key)) throw new Error("private key must prefix with #");
|
||||
}
|
||||
if(this.value != null) {
|
||||
if (this.value != null) {
|
||||
if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node");
|
||||
}
|
||||
},
|
||||
@@ -978,7 +979,7 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "key private static value", {
|
||||
var AST_ClassField = DEFNODE("ClassField", null, {
|
||||
$documentation: "A `class` field",
|
||||
_validate: function() {
|
||||
if(this.value != null) must_be_expression(this, "value");
|
||||
if (this.value != null) must_be_expression(this, "value");
|
||||
},
|
||||
}, AST_ClassProperty);
|
||||
|
||||
|
||||
881
node_modules/uglify-js/lib/compress.js
generated
vendored
881
node_modules/uglify-js/lib/compress.js
generated
vendored
File diff suppressed because it is too large
Load Diff
14
node_modules/uglify-js/lib/minify.js
generated
vendored
14
node_modules/uglify-js/lib/minify.js
generated
vendored
@@ -49,8 +49,9 @@ function parse_source_map(content) {
|
||||
function set_shorthand(name, options, keys) {
|
||||
keys.forEach(function(key) {
|
||||
if (options[key]) {
|
||||
if (typeof options[key] != "object") options[key] = {};
|
||||
if (!(name in options[key])) options[key][name] = options[name];
|
||||
var defs = {};
|
||||
defs[name] = options[name];
|
||||
options[key] = defaults(options[key], defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -82,14 +83,14 @@ function minify(files, options) {
|
||||
keep_fargs: false,
|
||||
keep_fnames: false,
|
||||
mangle: {},
|
||||
module: false,
|
||||
module: undefined,
|
||||
nameCache: null,
|
||||
output: {},
|
||||
parse: {},
|
||||
rename: undefined,
|
||||
sourceMap: false,
|
||||
timings: false,
|
||||
toplevel: !!(options && options["module"]),
|
||||
toplevel: options && !options["expression"] && options["module"] ? true : undefined,
|
||||
v8: false,
|
||||
validate: false,
|
||||
warnings: false,
|
||||
@@ -104,8 +105,9 @@ function minify(files, options) {
|
||||
if (options.ie) set_shorthand("ie", options, [ "compress", "mangle", "output", "rename" ]);
|
||||
if (options.keep_fargs) set_shorthand("keep_fargs", options, [ "compress", "mangle", "rename" ]);
|
||||
if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle", "rename" ]);
|
||||
if (options.module) set_shorthand("module", options, [ "compress", "parse" ]);
|
||||
if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle", "rename" ]);
|
||||
if (options.module === undefined && !options.ie) options.module = true;
|
||||
if (options.module) set_shorthand("module", options, [ "compress", "output", "parse" ]);
|
||||
if (options.toplevel !== undefined) set_shorthand("toplevel", options, [ "compress", "mangle", "rename" ]);
|
||||
if (options.v8) set_shorthand("v8", options, [ "mangle", "output", "rename" ]);
|
||||
if (options.webkit) set_shorthand("webkit", options, [ "compress", "mangle", "output", "rename" ]);
|
||||
var quoted_props;
|
||||
|
||||
40
node_modules/uglify-js/lib/mozilla-ast.js
generated
vendored
40
node_modules/uglify-js/lib/mozilla-ast.js
generated
vendored
@@ -125,6 +125,16 @@
|
||||
body: normalize_directives(from_moz(M.body).body),
|
||||
});
|
||||
},
|
||||
CallExpression: function(M) {
|
||||
return new AST_Call({
|
||||
start: my_start_token(M),
|
||||
end: my_end_token(M),
|
||||
expression: from_moz(M.callee),
|
||||
args: M.arguments.map(from_moz),
|
||||
optional: M.optional,
|
||||
pure: M.pure,
|
||||
});
|
||||
},
|
||||
ClassDeclaration: function(M) {
|
||||
return new AST_DefClass({
|
||||
start: my_start_token(M),
|
||||
@@ -458,7 +468,7 @@
|
||||
end: my_end_token(M),
|
||||
};
|
||||
if (M.bigint) {
|
||||
args.value = M.bigint.toLowerCase() + "n";
|
||||
args.value = M.bigint.toLowerCase();
|
||||
return new AST_BigInt(args);
|
||||
}
|
||||
var val = M.value;
|
||||
@@ -631,7 +641,6 @@
|
||||
map("AssignmentPattern", AST_DefaultValue, "left>name, right>value");
|
||||
map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative");
|
||||
map("NewExpression", AST_New, "callee>expression, arguments@args, pure=pure");
|
||||
map("CallExpression", AST_Call, "callee>expression, arguments@args, optional=optional, pure=pure");
|
||||
map("SequenceExpression", AST_Sequence, "expressions@expressions");
|
||||
map("SpreadElement", AST_Spread, "argument>expression");
|
||||
map("ObjectExpression", AST_Object, "properties@properties");
|
||||
@@ -668,6 +677,7 @@
|
||||
type: "ArrowFunctionExpression",
|
||||
async: is_async(M),
|
||||
params: params,
|
||||
expression: !!M.value,
|
||||
body: M.value ? to_moz(M.value) : to_moz_scope("BlockStatement", M),
|
||||
};
|
||||
return {
|
||||
@@ -680,6 +690,21 @@
|
||||
};
|
||||
});
|
||||
|
||||
def_to_moz(AST_Call, function To_Moz_CallExpression(M) {
|
||||
var expr = M.expression;
|
||||
if (M.args.length == 1 && expr instanceof AST_SymbolRef && expr.name == "import") return {
|
||||
type: "ImportExpression",
|
||||
source: to_moz(M.args[0]),
|
||||
};
|
||||
return {
|
||||
type: "CallExpression",
|
||||
callee: to_moz(expr),
|
||||
arguments: M.args.map(to_moz),
|
||||
optional: M.optional,
|
||||
pure: M.pure,
|
||||
};
|
||||
});
|
||||
|
||||
def_to_moz(AST_DefClass, function To_Moz_ClassDeclaration(M) {
|
||||
return {
|
||||
type: "ClassDeclaration",
|
||||
@@ -767,6 +792,7 @@
|
||||
def_to_moz(AST_Directive, function To_Moz_Directive(M) {
|
||||
return {
|
||||
type: "ExpressionStatement",
|
||||
directive: M.value,
|
||||
expression: set_moz_loc(M, {
|
||||
type: "Literal",
|
||||
value: M.value,
|
||||
@@ -787,7 +813,6 @@
|
||||
type: "TryStatement",
|
||||
block: to_moz_block(M),
|
||||
handler: to_moz(M.bcatch),
|
||||
guardedHandlers: [],
|
||||
finalizer: to_moz(M.bfinally),
|
||||
};
|
||||
});
|
||||
@@ -796,7 +821,6 @@
|
||||
return {
|
||||
type: "CatchClause",
|
||||
param: to_moz(M.argname),
|
||||
guard: null,
|
||||
body: to_moz_block(M),
|
||||
};
|
||||
});
|
||||
@@ -805,6 +829,7 @@
|
||||
return {
|
||||
type: "ExportNamedDeclaration",
|
||||
declaration: to_moz(M.body),
|
||||
specifiers: [],
|
||||
};
|
||||
});
|
||||
|
||||
@@ -954,6 +979,8 @@
|
||||
type: "Property",
|
||||
kind: "init",
|
||||
computed: computed,
|
||||
method: false,
|
||||
shorthand: false,
|
||||
key: key,
|
||||
value: to_moz(M.value),
|
||||
};
|
||||
@@ -990,6 +1017,7 @@
|
||||
kind: kind,
|
||||
computed: computed,
|
||||
method: M instanceof AST_ObjectMethod,
|
||||
shorthand: false,
|
||||
key: key,
|
||||
value: to_moz(M.value),
|
||||
};
|
||||
@@ -1043,8 +1071,8 @@
|
||||
var value = M.value;
|
||||
return {
|
||||
type: "Literal",
|
||||
bigint: value.slice(0, -1),
|
||||
raw: value,
|
||||
bigint: value,
|
||||
raw: value + "n",
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
45
node_modules/uglify-js/lib/output.js
generated
vendored
45
node_modules/uglify-js/lib/output.js
generated
vendored
@@ -63,6 +63,7 @@ function OutputStream(options) {
|
||||
inline_script : true,
|
||||
keep_quoted_props: false,
|
||||
max_line_len : false,
|
||||
module : false,
|
||||
preamble : null,
|
||||
preserve_line : false,
|
||||
quote_keys : false,
|
||||
@@ -140,12 +141,22 @@ function OutputStream(options) {
|
||||
|
||||
reset();
|
||||
var to_utf8 = options.ascii_only ? function(str, identifier) {
|
||||
if (identifier) str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
|
||||
if (identifier || options.module) str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
|
||||
return "\\u{" + (ch.charCodeAt(0) - 0xd7c0 << 10 | ch.charCodeAt(1) - 0xdc00).toString(16) + "}";
|
||||
});
|
||||
return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch) {
|
||||
var code = ch.charCodeAt(0).toString(16);
|
||||
return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(s, i) {
|
||||
var code = s.charCodeAt(0).toString(16);
|
||||
if (code.length <= 2 && !identifier) {
|
||||
switch (s) {
|
||||
case "\n": return "\\n";
|
||||
case "\r": return "\\r";
|
||||
case "\t": return "\\t";
|
||||
case "\b": return "\\b";
|
||||
case "\f": return "\\f";
|
||||
case "\x0B": return options.ie ? "\\x0B" : "\\v";
|
||||
case "\0":
|
||||
return /[0-9]/.test(str.charAt(i+1)) ? "\\x00" : "\\0";
|
||||
}
|
||||
while (code.length < 2) code = "0" + code;
|
||||
return "\\x" + code;
|
||||
} else {
|
||||
@@ -259,7 +270,9 @@ function OutputStream(options) {
|
||||
if (line_fixed || flush) flush_mappings();
|
||||
} : noop;
|
||||
|
||||
var require_semicolon = makePredicate("( [ + * / - , .");
|
||||
var stat_end_chars = makePredicate("; }");
|
||||
var asi_skip_chars = makePredicate("( [ + * / - , . `");
|
||||
var asi_skip_words = makePredicate("in instanceof");
|
||||
|
||||
function require_space(prev, ch, str) {
|
||||
return is_identifier_char(prev) && (is_identifier_char(ch) || ch == "\\")
|
||||
@@ -295,8 +308,8 @@ function OutputStream(options) {
|
||||
var prev = last.slice(-1);
|
||||
if (might_need_semicolon) {
|
||||
might_need_semicolon = false;
|
||||
if (prev == ":" && ch == "}" || prev != ";" && (!ch || ";}".indexOf(ch) < 0)) {
|
||||
var need_semicolon = require_semicolon[ch];
|
||||
if (prev != ";" && !stat_end_chars[ch]) {
|
||||
var need_semicolon = asi_skip_chars[ch] || asi_skip_words[str];
|
||||
if (need_semicolon || options.semicolons) {
|
||||
output += ";";
|
||||
current_col++;
|
||||
@@ -941,7 +954,12 @@ function OutputStream(options) {
|
||||
DEFPRINT(AST_LabeledStatement, function(output) {
|
||||
this.label.print(output);
|
||||
output.colon();
|
||||
this.body.print(output);
|
||||
var body = this.body;
|
||||
if (body instanceof AST_EmptyStatement) {
|
||||
output.force_semicolon();
|
||||
} else {
|
||||
body.print(output);
|
||||
}
|
||||
});
|
||||
DEFPRINT(AST_SimpleStatement, function(output) {
|
||||
this.body.print(output);
|
||||
@@ -1244,6 +1262,12 @@ function OutputStream(options) {
|
||||
output.print("=");
|
||||
output.space();
|
||||
self.value.print(output);
|
||||
} else switch (self.key) {
|
||||
case "get":
|
||||
case "set":
|
||||
case "static":
|
||||
output.force_semicolon();
|
||||
return;
|
||||
}
|
||||
output.semicolon();
|
||||
});
|
||||
@@ -1775,14 +1799,17 @@ function OutputStream(options) {
|
||||
if (self.tag) self.tag.print(output);
|
||||
output.print("`");
|
||||
for (var i = 0; i < self.expressions.length; i++) {
|
||||
output.print(self.strings[i]);
|
||||
output.print(output.to_utf8(self.strings[i]));
|
||||
output.print("${");
|
||||
self.expressions[i].print(output);
|
||||
output.print("}");
|
||||
}
|
||||
output.print(self.strings[i]);
|
||||
output.print(output.to_utf8(self.strings[i]));
|
||||
output.print("`");
|
||||
});
|
||||
DEFPRINT(AST_BigInt, function(output) {
|
||||
output.print(this.value + "n");
|
||||
});
|
||||
DEFPRINT(AST_Constant, function(output) {
|
||||
output.print("" + this.value);
|
||||
});
|
||||
|
||||
12
node_modules/uglify-js/lib/parse.js
generated
vendored
12
node_modules/uglify-js/lib/parse.js
generated
vendored
@@ -207,11 +207,14 @@ function JS_Parse_Error(message, filename, line, col, pos) {
|
||||
this.line = line;
|
||||
this.col = col;
|
||||
this.pos = pos;
|
||||
try {
|
||||
throw new SyntaxError(message, filename, line, col);
|
||||
} catch (cause) {
|
||||
configure_error_stack(this, cause);
|
||||
}
|
||||
}
|
||||
JS_Parse_Error.prototype = Object.create(Error.prototype);
|
||||
JS_Parse_Error.prototype = Object.create(SyntaxError.prototype);
|
||||
JS_Parse_Error.prototype.constructor = JS_Parse_Error;
|
||||
JS_Parse_Error.prototype.name = "SyntaxError";
|
||||
configure_error_stack(JS_Parse_Error);
|
||||
|
||||
function js_error(message, filename, line, col, pos) {
|
||||
throw new JS_Parse_Error(message, filename, line, col, pos);
|
||||
@@ -391,7 +394,8 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
||||
var valid = parse_js_number(num);
|
||||
if (isNaN(valid)) parse_error("Invalid syntax: " + num);
|
||||
if (has_dot || has_e || peek() != "n") return token("num", valid);
|
||||
return token("bigint", num.toLowerCase() + next());
|
||||
next();
|
||||
return token("bigint", num.toLowerCase());
|
||||
}
|
||||
|
||||
function read_escaped_char(in_string) {
|
||||
|
||||
67
node_modules/uglify-js/lib/scope.js
generated
vendored
67
node_modules/uglify-js/lib/scope.js
generated
vendored
@@ -68,9 +68,7 @@ SymbolDef.prototype = {
|
||||
var cache = this.global && options.cache && options.cache.props;
|
||||
if (cache && cache.has(this.name)) {
|
||||
this.mangled_name = cache.get(this.name);
|
||||
} else if (this.unmangleable(options)) {
|
||||
names_in_use(this.scope, options).set(this.name, true);
|
||||
} else {
|
||||
} else if (!this.unmangleable(options)) {
|
||||
var def = this.redefined();
|
||||
if (def) {
|
||||
this.mangled_name = def.mangled_name || def.name;
|
||||
@@ -180,6 +178,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Switch) {
|
||||
node.expression.walk(tw);
|
||||
walk_scope(function() {
|
||||
walk_body(node, tw);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_SwitchBranch) {
|
||||
node.init_vars(scope);
|
||||
descend();
|
||||
@@ -439,35 +444,43 @@ AST_Toplevel.DEFMETHOD("def_global", function(node) {
|
||||
}
|
||||
});
|
||||
|
||||
function init_block_vars(scope, parent) {
|
||||
scope.enclosed = []; // variables from this or outer scope(s) that are referenced from this or inner scopes
|
||||
scope.parent_scope = parent; // the parent scope (null if this is the top level)
|
||||
scope.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope)
|
||||
scope.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions)
|
||||
if (parent) scope.make_def = parent.make_def; // top-level tracking of SymbolDef instances
|
||||
function init_block_vars(scope, parent, orig) {
|
||||
// variables from this or outer scope(s) that are referenced from this or inner scopes
|
||||
scope.enclosed = orig ? orig.enclosed.slice() : [];
|
||||
// map name to AST_SymbolDefun (functions defined in this scope)
|
||||
scope.functions = orig ? orig.functions.clone() : new Dictionary();
|
||||
// map name to AST_SymbolVar (variables defined in this scope; includes functions)
|
||||
scope.variables = orig ? orig.variables.clone() : new Dictionary();
|
||||
if (!parent) return;
|
||||
// top-level tracking of SymbolDef instances
|
||||
scope.make_def = parent.make_def;
|
||||
// the parent scope (null if this is the top level)
|
||||
scope.parent_scope = parent;
|
||||
}
|
||||
|
||||
function init_scope_vars(scope, parent) {
|
||||
init_block_vars(scope, parent);
|
||||
scope.uses_eval = false; // will be set to true if this or nested scope uses the global `eval`
|
||||
scope.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement
|
||||
function init_scope_vars(scope, parent, orig) {
|
||||
init_block_vars(scope, parent, orig);
|
||||
// will be set to true if this or nested scope uses the global `eval`
|
||||
scope.uses_eval = false;
|
||||
// will be set to true if this or some nested scope uses the `with` statement
|
||||
scope.uses_with = false;
|
||||
}
|
||||
|
||||
AST_BlockScope.DEFMETHOD("init_vars", function(parent_scope) {
|
||||
init_block_vars(this, parent_scope);
|
||||
AST_BlockScope.DEFMETHOD("init_vars", function(parent, orig) {
|
||||
init_block_vars(this, parent, orig);
|
||||
});
|
||||
AST_Scope.DEFMETHOD("init_vars", function(parent_scope) {
|
||||
init_scope_vars(this, parent_scope);
|
||||
AST_Scope.DEFMETHOD("init_vars", function(parent, orig) {
|
||||
init_scope_vars(this, parent, orig);
|
||||
});
|
||||
AST_Arrow.DEFMETHOD("init_vars", function(parent_scope) {
|
||||
init_scope_vars(this, parent_scope);
|
||||
AST_Arrow.DEFMETHOD("init_vars", function(parent, orig) {
|
||||
init_scope_vars(this, parent, orig);
|
||||
return this;
|
||||
});
|
||||
AST_AsyncArrow.DEFMETHOD("init_vars", function(parent_scope) {
|
||||
init_scope_vars(this, parent_scope);
|
||||
AST_AsyncArrow.DEFMETHOD("init_vars", function(parent, orig) {
|
||||
init_scope_vars(this, parent, orig);
|
||||
});
|
||||
AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) {
|
||||
init_scope_vars(this, parent_scope);
|
||||
AST_Lambda.DEFMETHOD("init_vars", function(parent, orig) {
|
||||
init_scope_vars(this, parent, orig);
|
||||
this.uses_arguments = false;
|
||||
this.def_variable(new AST_SymbolFunarg({
|
||||
name: "arguments",
|
||||
@@ -643,8 +656,12 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
|
||||
}, true);
|
||||
}
|
||||
var to_mangle = node.to_mangle = [];
|
||||
node.variables.each(function(def) {
|
||||
if (!defer_redef(def)) to_mangle.push(def);
|
||||
node.variables.each(function(def, name) {
|
||||
if (def.unmangleable(options)) {
|
||||
names_in_use(node, options).set(name, true);
|
||||
} else if (!defer_redef(def)) {
|
||||
to_mangle.push(def);
|
||||
}
|
||||
});
|
||||
descend();
|
||||
if (options.cache && node instanceof AST_Toplevel) {
|
||||
|
||||
33
node_modules/uglify-js/lib/utils.js
generated
vendored
33
node_modules/uglify-js/lib/utils.js
generated
vendored
@@ -55,28 +55,41 @@ function find_if(func, array) {
|
||||
for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i];
|
||||
}
|
||||
|
||||
function configure_error_stack(fn) {
|
||||
Object.defineProperty(fn.prototype, "stack", {
|
||||
function configure_error_stack(ex, cause) {
|
||||
var stack = ex.name + ": " + ex.message;
|
||||
Object.defineProperty(ex, "stack", {
|
||||
get: function() {
|
||||
var err = new Error(this.message);
|
||||
err.name = this.name;
|
||||
try {
|
||||
throw err;
|
||||
} catch (e) {
|
||||
return e.stack;
|
||||
if (cause) {
|
||||
cause.name = "" + ex.name;
|
||||
stack = "" + cause.stack;
|
||||
var msg = "" + cause.message;
|
||||
cause = null;
|
||||
var index = stack.indexOf(msg);
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
} else {
|
||||
index += msg.length;
|
||||
index = stack.indexOf("\n", index) + 1;
|
||||
}
|
||||
stack = stack.slice(0, index) + stack.slice(stack.indexOf("\n", index) + 1);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function DefaultsError(msg, defs) {
|
||||
this.message = msg;
|
||||
this.defs = defs;
|
||||
try {
|
||||
throw new Error(msg);
|
||||
} catch (cause) {
|
||||
configure_error_stack(this, cause);
|
||||
}
|
||||
}
|
||||
DefaultsError.prototype = Object.create(Error.prototype);
|
||||
DefaultsError.prototype.constructor = DefaultsError;
|
||||
DefaultsError.prototype.name = "DefaultsError";
|
||||
configure_error_stack(DefaultsError);
|
||||
|
||||
function defaults(args, defs, croak) {
|
||||
if (croak) for (var i in args) {
|
||||
|
||||
2
node_modules/uglify-js/package.json
generated
vendored
2
node_modules/uglify-js/package.json
generated
vendored
@@ -3,7 +3,7 @@
|
||||
"description": "JavaScript parser, mangler/compressor and beautifier toolkit",
|
||||
"author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
|
||||
"license": "BSD-2-Clause",
|
||||
"version": "3.17.4",
|
||||
"version": "3.19.3",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
|
||||
2
node_modules/uglify-js/tools/domprops.json
generated
vendored
2
node_modules/uglify-js/tools/domprops.json
generated
vendored
@@ -4323,6 +4323,7 @@
|
||||
"enable",
|
||||
"enableBackground",
|
||||
"enableDelegations",
|
||||
"enableHighAccuracy",
|
||||
"enableStyleSheetsForSet",
|
||||
"enableVertexAttribArray",
|
||||
"enabled",
|
||||
@@ -5553,6 +5554,7 @@
|
||||
"maxWidth",
|
||||
"maxZoom",
|
||||
"maximize",
|
||||
"maximumAge",
|
||||
"maximumFractionDigits",
|
||||
"measure",
|
||||
"measureText",
|
||||
|
||||
9
node_modules/uglify-js/tools/node.js
generated
vendored
9
node_modules/uglify-js/tools/node.js
generated
vendored
@@ -97,10 +97,15 @@ function infer_options(options) {
|
||||
return result.error && result.error.defs;
|
||||
}
|
||||
|
||||
exports.default_options = function() {
|
||||
exports.default_options = function(component) {
|
||||
if (component) {
|
||||
var options = { module: false };
|
||||
options[component] = { 0: 0 };
|
||||
return infer_options(options);
|
||||
}
|
||||
var defs = infer_options({ 0: 0 });
|
||||
Object.keys(defs).forEach(function(component) {
|
||||
var options = {};
|
||||
var options = { module: false };
|
||||
options[component] = { 0: 0 };
|
||||
if (options = infer_options(options)) {
|
||||
defs[component] = options;
|
||||
|
||||
2
node_modules/uglify-js/tools/tty.js
generated
vendored
2
node_modules/uglify-js/tools/tty.js
generated
vendored
@@ -6,7 +6,7 @@ try {
|
||||
} catch (e) {
|
||||
// ensure output buffers are flushed before process termination
|
||||
var exit = process.exit;
|
||||
process.exit = function() {
|
||||
if ("bufferSize" in process.stdout) process.exit = function() {
|
||||
var args = [].slice.call(arguments);
|
||||
process.once("uncaughtException", function() {
|
||||
(function callback() {
|
||||
|
||||
Reference in New Issue
Block a user