detect toplevel option properly (#3735)

fixes #3730
This commit is contained in:
Alex Lam S.L
2020-02-29 17:33:48 +00:00
committed by GitHub
parent 6092bf23de
commit c8d60d6983
6 changed files with 69 additions and 22 deletions

View File

@@ -87,3 +87,8 @@ exports.same_stdout = semver.satisfies(process.version, "0.12") ? function(expec
} : function(expected, actual) {
return typeof expected == typeof actual && strip_func_ids(expected) == strip_func_ids(actual);
};
exports.has_toplevel = function(options) {
return options.toplevel
|| options.mangle && options.mangle.toplevel
|| options.compress && options.compress.toplevel;
};