uglify-js
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -192,3 +192,3 @@ /*********************************************************************** | ||
var WHITESPACE_CHARS = array_to_hash(characters(" \n\r\t\u200b")); | ||
var WHITESPACE_CHARS = array_to_hash(characters(" \u00a0\n\r\t\f\v\u200b")); | ||
@@ -755,10 +755,13 @@ var PUNC_BEFORE_EXPRESSION = array_to_hash(characters("[{}(,.;:")); | ||
var statement = embed_tokens ? function() { | ||
var start = S.token; | ||
var ast = $statement.apply(this, arguments); | ||
ast[0] = add_tokens(ast[0], start, prev()); | ||
return ast; | ||
} : $statement; | ||
function maybe_embed_tokens(parser) { | ||
if (embed_tokens) return function() { | ||
var start = S.token; | ||
var ast = parser.apply(this, arguments); | ||
ast[0] = add_tokens(ast[0], start, prev()); | ||
return ast; | ||
}; | ||
else return parser; | ||
}; | ||
function $statement() { | ||
var statement = maybe_embed_tokens(function() { | ||
if (is("operator", "/")) { | ||
@@ -857,3 +860,3 @@ S.peeked = null; | ||
} | ||
}; | ||
}); | ||
@@ -916,10 +919,3 @@ function labeled_statement(label) { | ||
var function_ = embed_tokens ? function() { | ||
var start = prev(); | ||
var ast = $function_.apply(this, arguments); | ||
ast[0] = add_tokens(ast[0], start, prev()); | ||
return ast; | ||
} : $function_; | ||
function $function_(in_statement) { | ||
var function_ = maybe_embed_tokens(function(in_statement) { | ||
var name = is("name") ? prog1(S.token.value, next) : null; | ||
@@ -952,3 +948,3 @@ if (in_statement && !name) | ||
})()); | ||
}; | ||
}); | ||
@@ -1061,3 +1057,3 @@ function if_() { | ||
function expr_atom(allow_calls) { | ||
var expr_atom = maybe_embed_tokens(function(allow_calls) { | ||
if (is("operator", "new")) { | ||
@@ -1097,3 +1093,3 @@ next(); | ||
unexpected(); | ||
}; | ||
}); | ||
@@ -1238,3 +1234,3 @@ function expr_list(closing, allow_trailing_comma, allow_empty) { | ||
function expression(commas, no_in) { | ||
var expression = maybe_embed_tokens(function(commas, no_in) { | ||
if (arguments.length == 0) | ||
@@ -1248,3 +1244,3 @@ commas = true; | ||
return expr; | ||
}; | ||
}); | ||
@@ -1251,0 +1247,0 @@ function in_loop(cont) { |
@@ -10,3 +10,3 @@ { | ||
"version" : "1.0.1", | ||
"version" : "1.0.2", | ||
@@ -13,0 +13,0 @@ "main" : "./uglify-js.js", |
@@ -1,2 +0,17 @@ | ||
exports.parser = require("./lib/parse-js"); | ||
exports.uglify = require("./lib/process"); | ||
//convienence function(src, [options]); | ||
function uglify(orig_code, options){ | ||
options || (options = {}); | ||
var jsp = uglify.parser; | ||
var pro = uglify.uglify; | ||
var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST | ||
ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names | ||
ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations | ||
var final_code = pro.gen_code(ast, options.gen_options); // compressed code here | ||
return final_code; | ||
}; | ||
uglify.parser = require("./lib/parse-js"); | ||
uglify.uglify = require("./lib/process"); | ||
module.exports = uglify |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
218490
85
3591