1
1
/**
2
- * @license r.js 2.0.2+ Mon, 18 Jun 2012 20:53:28 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 2.0.2+ Tue, 26 Jun 2012 23:04:40 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3
3
* Available via the MIT or new BSD license.
4
4
* see: http://github.com/jrburke/requirejs for details
5
5
*/
@@ -20,7 +20,7 @@ var requirejs, require, define;
20
20
21
21
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
22
22
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode,
23
- version = '2.0.2+ Mon, 18 Jun 2012 20:53:28 GMT',
23
+ version = '2.0.2+ Tue, 26 Jun 2012 23:04:40 GMT',
24
24
jsSuffixRegExp = /\.js$/,
25
25
commandOption = '',
26
26
useLibLoaded = {},
@@ -8031,7 +8031,8 @@ exports['ast_consolidate'] = function(oAbstractSyntaxTree) {
8031
8031
/* End: */
8032
8032
/* vim: set ft=javascript fenc=utf-8 et ts=2 sts=2 sw=2: */
8033
8033
/* :mode=javascript:noTabs=true:tabSize=2:indentSize=2:deepIndent=true: */
8034
- });define('uglifyjs/parse-js', ["exports"], function(exports) {
8034
+ });
8035
+ define('uglifyjs/parse-js', ["exports"], function(exports) {
8035
8036
/***********************************************************************
8036
8037
8037
8038
A JavaScript tokenizer / parser / beautifier / compressor.
@@ -9391,12 +9392,14 @@ exports.KEYWORDS = KEYWORDS;
9391
9392
exports.ATOMIC_START_TOKEN = ATOMIC_START_TOKEN;
9392
9393
exports.OPERATORS = OPERATORS;
9393
9394
exports.is_alphanumeric_char = is_alphanumeric_char;
9395
+ exports.is_identifier_start = is_identifier_start;
9396
+ exports.is_identifier_char = is_identifier_char;
9394
9397
exports.set_logger = function(logger) {
9395
9398
warn = logger;
9396
9399
};
9397
- });define('uglifyjs/squeeze-more', ["require", "exports", "module", "./parse-js", "./process"], function(require, exports, module) {
9398
-
9399
- var jsp = require("./parse-js"),
9400
+ });
9401
+ define('uglifyjs/squeeze-more', ["require", "exports", "module", "./parse-js", "./process"], function(require, exports, module) {
9402
+ var jsp = require("./parse-js"),
9400
9403
pro = require("./process"),
9401
9404
slice = jsp.slice,
9402
9405
member = jsp.member,
@@ -9470,7 +9473,9 @@ function ast_squeeze_more(ast) {
9470
9473
};
9471
9474
9472
9475
exports.ast_squeeze_more = ast_squeeze_more;
9473
- });define('uglifyjs/process', ["require", "exports", "module", "./parse-js", "./squeeze-more"], function(require, exports, module) {
9476
+ });
9477
+ define('uglifyjs/process', ["require", "exports", "module", "./parse-js", "./squeeze-more"], function(require, exports, module) {
9478
+
9474
9479
/***********************************************************************
9475
9480
9476
9481
A JavaScript tokenizer / parser / beautifier / compressor.
@@ -9534,6 +9539,7 @@ exports.ast_squeeze_more = ast_squeeze_more;
9534
9539
var jsp = require("./parse-js"),
9535
9540
slice = jsp.slice,
9536
9541
member = jsp.member,
9542
+ is_identifier_char = jsp.is_identifier_char,
9537
9543
PRECEDENCE = jsp.PRECEDENCE,
9538
9544
OPERATORS = jsp.OPERATORS;
9539
9545
@@ -9982,7 +9988,13 @@ function ast_add_scope(ast) {
9982
9988
9983
9989
function ast_mangle(ast, options) {
9984
9990
var w = ast_walker(), walk = w.walk, scope;
9985
- options = options || {};
9991
+ options = defaults(options, {
9992
+ mangle : true,
9993
+ toplevel : false,
9994
+ defines : null,
9995
+ except : null,
9996
+ no_functions : false
9997
+ });
9986
9998
9987
9999
function get_mangled(name, newMangle) {
9988
10000
if (!options.mangle) return name;
@@ -10009,7 +10021,7 @@ function ast_mangle(ast, options) {
10009
10021
};
10010
10022
10011
10023
function _lambda(name, args, body) {
10012
- if (!options.no_functions) {
10024
+ if (!options.no_functions && options.mangle ) {
10013
10025
var is_defun = this[0] == "defun", extra;
10014
10026
if (name) {
10015
10027
if (is_defun) name = get_mangled(name);
@@ -10709,6 +10721,9 @@ function ast_squeeze(ast, options) {
10709
10721
t = walk(t);
10710
10722
e = walk(e);
10711
10723
10724
+ if (empty(e) && empty(t))
10725
+ return [ "stat", c ];
10726
+
10712
10727
if (empty(t)) {
10713
10728
c = negate(c);
10714
10729
t = e;
@@ -10729,8 +10744,6 @@ function ast_squeeze(ast, options) {
10729
10744
}
10730
10745
})();
10731
10746
}
10732
- if (empty(e) && empty(t))
10733
- return [ "stat", c ];
10734
10747
var ret = [ "if", c, t, e ];
10735
10748
if (t[0] == "if" && empty(t[3]) && empty(e)) {
10736
10749
ret = best_of(ret, walk([ "if", [ "binary", "&&", c, t[1] ], t[2] ]));
@@ -10874,6 +10887,15 @@ function ast_squeeze(ast, options) {
10874
10887
return expr[1];
10875
10888
}
10876
10889
return [ this[0], expr, MAP(args, walk) ];
10890
+ },
10891
+ "num": function (num) {
10892
+ if (!isFinite(num))
10893
+ return [ "binary", "/", num === 1 / 0
10894
+ ? [ "num", 1 ] : num === -1 / 0
10895
+ ? [ "unary-prefix", "-", [ "num", 1 ] ]
10896
+ : [ "num", 0 ], [ "num", 0 ] ];
10897
+
10898
+ return [ this[0], num ];
10877
10899
}
10878
10900
}, function() {
10879
10901
for (var i = 0; i < 2; ++i) {
@@ -10974,6 +10996,15 @@ function gen_code(ast, options) {
10974
10996
finally { indentation -= incr; }
10975
10997
};
10976
10998
10999
+ function last_char(str) {
11000
+ str = str.toString();
11001
+ return str.charAt(str.length - 1);
11002
+ };
11003
+
11004
+ function first_char(str) {
11005
+ return str.toString().charAt(0);
11006
+ };
11007
+
10977
11008
function add_spaces(a) {
10978
11009
if (beautify)
10979
11010
return a.join(" ");
@@ -10982,7 +11013,8 @@ function gen_code(ast, options) {
10982
11013
var next = a[i + 1];
10983
11014
b.push(a[i]);
10984
11015
if (next &&
10985
- ((/[a-z0-9_\x24]$/i.test(a[i].toString()) && /^[a-z0-9_\x24]/i.test(next.toString())) ||
11016
+ ((is_identifier_char(last_char(a[i])) && (is_identifier_char(first_char(next))
11017
+ || first_char(next) == "\\")) ||
10986
11018
(/[\+\-]$/.test(a[i].toString()) && /^[\+\-]/.test(next.toString())))) {
10987
11019
b.push(" ");
10988
11020
}
@@ -11042,7 +11074,7 @@ function gen_code(ast, options) {
11042
11074
};
11043
11075
11044
11076
function make_num(num) {
11045
- var str = num.toString(10), a = [ str.replace(/^0\./, ".") ], m;
11077
+ var str = num.toString(10), a = [ str.replace(/^0\./, ".").replace('e+', 'e') ], m;
11046
11078
if (Math.floor(num) === num) {
11047
11079
if (num >= 0) {
11048
11080
a.push("0x" + num.toString(16).toLowerCase(), // probably pointless
@@ -11535,7 +11567,8 @@ exports.MAP = MAP;
11535
11567
11536
11568
// keep this last!
11537
11569
exports.ast_squeeze_more = require("./squeeze-more").ast_squeeze_more;
11538
- });define('uglifyjs/index', ["require", "exports", "module", "./parse-js", "./process", "./consolidator"], function(require, exports, module) {
11570
+ });
11571
+ define('uglifyjs/index', ["require", "exports", "module", "./parse-js", "./process", "./consolidator"], function(require, exports, module) {
11539
11572
//convienence function(src, [options]);
11540
11573
function uglify(orig_code, options){
11541
11574
options || (options = {});
0 commit comments