implement --help options (#2017)

This commit is contained in:
Alex Lam S.L
2017-05-28 18:21:44 +08:00
committed by GitHub
parent fec14379f6
commit c6c9f4f5a8
4 changed files with 36 additions and 24 deletions

View File

@@ -63,3 +63,20 @@ function describe_ast() {
doitem(AST_Node);
return out + "\n";
}
function infer_options(options) {
var result = UglifyJS.minify("", options);
return result.error && result.error.defs;
}
UglifyJS.default_options = function() {
var defs = {};
Object.keys(infer_options({ 0: 0 })).forEach(function(component) {
var options = {};
options[component] = { 0: 0 };
if (options = infer_options(options)) {
defs[component] = options;
}
});
return defs;
};