implement --module (#5462)
This commit is contained in:
@@ -80,6 +80,7 @@ function Compressor(options, false_by_default) {
|
||||
keep_infinity : false,
|
||||
loops : !false_by_default,
|
||||
merge_vars : !false_by_default,
|
||||
module : false,
|
||||
negate_iife : !false_by_default,
|
||||
objects : !false_by_default,
|
||||
optional_chains : !false_by_default,
|
||||
@@ -97,7 +98,7 @@ function Compressor(options, false_by_default) {
|
||||
switches : !false_by_default,
|
||||
templates : !false_by_default,
|
||||
top_retain : null,
|
||||
toplevel : !!(options && options["top_retain"]),
|
||||
toplevel : !!(options && (options["module"] || options["top_retain"])),
|
||||
typeofs : !false_by_default,
|
||||
unsafe : false,
|
||||
unsafe_comps : false,
|
||||
@@ -130,6 +131,7 @@ function Compressor(options, false_by_default) {
|
||||
var escaped = def.escaped;
|
||||
return escaped && escaped.depth != 1;
|
||||
};
|
||||
if (this.options["module"]) this.directives["use strict"] = true;
|
||||
var pure_funcs = this.options["pure_funcs"];
|
||||
if (typeof pure_funcs == "function") {
|
||||
this.pure_funcs = pure_funcs;
|
||||
@@ -7360,6 +7362,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
});
|
||||
tt.push(compressor.parent());
|
||||
tt.directives = Object.create(compressor.directives);
|
||||
self.transform(tt);
|
||||
if (self instanceof AST_Lambda
|
||||
&& self.body.length == 1
|
||||
|
||||
Reference in New Issue
Block a user