uglify-js.js 720 B

12345678910111213141516171819
  1. //convienence function(src, [options]);
  2. function uglify(orig_code, options){
  3. options || (options = {});
  4. var jsp = uglify.parser;
  5. var pro = uglify.uglify;
  6. var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST
  7. ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names
  8. ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations
  9. var final_code = pro.gen_code(ast, options.gen_options); // compressed code here
  10. return final_code;
  11. };
  12. uglify.parser = require("./lib/parse-js");
  13. uglify.uglify = require("./lib/process");
  14. uglify.consolidator = require("./lib/consolidator");
  15. module.exports = uglify