You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
592 B

4 years ago
  1. var fs = require("fs");
  2. var bundle_path = __dirname + "/../dist/bundle.js";
  3. var UglifyJS = require(bundle_path);
  4. module.exports = UglifyJS;
  5. function infer_options(options) {
  6. var result = UglifyJS.minify("", options);
  7. return result.error && result.error.defs;
  8. }
  9. UglifyJS.default_options = function() {
  10. var defs = {};
  11. Object.keys(infer_options({ 0: 0 })).forEach(function(component) {
  12. var options = {};
  13. options[component] = { 0: 0 };
  14. if (options = infer_options(options)) {
  15. defs[component] = options;
  16. }
  17. });
  18. return defs;
  19. };