Added node modules

This commit is contained in:
John Crepezzi 2012-02-06 14:09:01 -05:00
parent ca9d4c18f7
commit d1e0644a4e
575 changed files with 77900 additions and 6 deletions

13
node_modules/uglify-js/tmp/269.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var test_code = "var JSON;JSON||(JSON={});";
var ast = jsp.parse(test_code, false, false);
var nonembed_token_code = pro.gen_code(ast);
ast = jsp.parse(test_code, false, true);
var embed_token_code = pro.gen_code(ast);
console.log("original: " + test_code);
console.log("no token: " + nonembed_token_code);
console.log(" token: " + embed_token_code);

22315
node_modules/uglify-js/tmp/app.js generated vendored Normal file

File diff suppressed because one or more lines are too long

15
node_modules/uglify-js/tmp/embed-tokens.js generated vendored Executable file
View file

@ -0,0 +1,15 @@
#! /usr/bin/env node
global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
var fs = require("fs");
var uglify = require("uglify-js"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js
jsp = uglify.parser,
pro = uglify.uglify;
var code = fs.readFileSync("embed-tokens.js", "utf8").replace(/^#.*$/mg, "");
var ast = jsp.parse(code, null, true);
// trololo
function fooBar() {}
console.log(sys.inspect(ast, null, null));

26
node_modules/uglify-js/tmp/goto.js generated vendored Normal file
View file

@ -0,0 +1,26 @@
function unique(arqw) {
var a = [], i, j
outer: for (i = 0; i < arqw.length; i++) {
for (j = 0; j < a.length; j++) {
if (a[j] == arqw[i]) {
continue outer
}
}
a[a.length] = arqw[i]
}
return a
}
function unique(arqw) {
var crap = [], i, j
outer: for (i = 0; i < arqw.length; i++) {
for (j = 0; j < crap.length; j++) {
if (crap[j] == arqw[i]) {
continue outer
}
}
crap[crap.length] = arqw[i]
}
return crap
}

8
node_modules/uglify-js/tmp/goto2.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
function q(qooo) {
var a;
foo: for(;;) {
a++;
if (something) break foo;
return qooo;
}
}

33
node_modules/uglify-js/tmp/hoist.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
function foo(arg1, arg2, arg3, arg4, arg5, arg6) {
var a = 5;
{
var d = 10, mak = 20, buz = 30;
var q = buz * 2;
}
if (moo) {
var a, b, c;
}
for (var arg1 = 0, d = 20; arg1 < 10; ++arg1)
console.log(arg3);
for (var i in mak) {}
for (j in d) {}
var d;
function test() {
};
//test();
(function moo(first, second){
console.log(first);
})(1);
(function moo(first, second){
console.log(moo());
})(1);
}
var foo;
var bar;

97
node_modules/uglify-js/tmp/instrument.js generated vendored Normal file
View file

@ -0,0 +1,97 @@
// sample on how to use the parser and walker API to instrument some code
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
function instrument(code) {
var ast = jsp.parse(code, false, true); // true for the third arg specifies that we want
// to have start/end tokens embedded in the
// statements
var w = pro.ast_walker();
// we're gonna need this to push elements that we're currently looking at, to avoid
// endless recursion.
var analyzing = [];
function do_stat() {
var ret;
if (this[0].start && analyzing.indexOf(this) < 0) {
// without the `analyzing' hack, w.walk(this) would re-enter here leading
// to infinite recursion
analyzing.push(this);
ret = [ "splice", // XXX: "block" is safer
[ [ "stat",
[ "call", [ "name", "trace" ],
[ [ "string", this[0].toString() ],
[ "num", this[0].start.line ],
[ "num", this[0].start.col ],
[ "num", this[0].end.line ],
[ "num", this[0].end.col ]]]],
w.walk(this) ]];
analyzing.pop(this);
}
return ret;
};
var new_ast = w.with_walkers({
"stat" : do_stat,
"label" : do_stat,
"break" : do_stat,
"continue" : do_stat,
"debugger" : do_stat,
"var" : do_stat,
"const" : do_stat,
"return" : do_stat,
"throw" : do_stat,
"try" : do_stat,
"defun" : do_stat,
"if" : do_stat,
"while" : do_stat,
"do" : do_stat,
"for" : do_stat,
"for-in" : do_stat,
"switch" : do_stat,
"with" : do_stat
}, function(){
return w.walk(ast);
});
return pro.gen_code(new_ast, { beautify: true });
}
////// test code follows.
var code = instrument(test.toString());
console.log(code);
function test() {
// simple stats
a = 5;
c += a + b;
"foo";
// var
var foo = 5;
const bar = 6, baz = 7;
// switch block. note we can't track case lines the same way.
switch ("foo") {
case "foo":
return 1;
case "bar":
return 2;
}
// for/for in
for (var i = 0; i < 5; ++i) {
console.log("Hello " + i);
}
for (var i in [ 1, 2, 3]) {
console.log(i);
}
// note however that the following is broken. I guess we
// should add the block brackets in this case...
for (var i = 0; i < 5; ++i)
console.log("foo");
}

138
node_modules/uglify-js/tmp/instrument2.js generated vendored Normal file
View file

@ -0,0 +1,138 @@
// sample on how to use the parser and walker API to instrument some code
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
function instrument(code) {
var ast = jsp.parse(code, false, true); // true for the third arg specifies that we want
// to have start/end tokens embedded in the
// statements
var w = pro.ast_walker();
function trace (line, comment) {
var code = pro.gen_code(line, { beautify: true });
var data = line[0]
var args = []
if (!comment) comment = ""
if (typeof data === "object") {
code = code.split(/\n/).shift()
args = [ [ "string", data.toString() ],
[ "string", code ],
[ "num", data.start.line ],
[ "num", data.start.col ],
[ "num", data.end.line ],
[ "num", data.end.col ]]
} else {
args = [ [ "string", data ],
[ "string", code ]]
}
return [ "call", [ "name", "trace" ], args ];
}
// we're gonna need this to push elements that we're currently looking at, to avoid
// endless recursion.
var analyzing = [];
function do_stat() {
var ret;
if (this[0].start && analyzing.indexOf(this) < 0) {
// without the `analyzing' hack, w.walk(this) would re-enter here leading
// to infinite recursion
analyzing.push(this);
ret = [ "splice",
[ [ "stat", trace(this) ],
w.walk(this) ]];
analyzing.pop(this);
}
return ret;
}
function do_cond(c, t, f) {
return [ this[0], w.walk(c),
["seq", trace(t), w.walk(t) ],
["seq", trace(f), w.walk(f) ]];
}
function do_binary(c, l, r) {
if (c !== "&&" && c !== "||") {
return [this[0], c, w.walk(l), w.walk(r)];
}
return [ this[0], c,
["seq", trace(l), w.walk(l) ],
["seq", trace(r), w.walk(r) ]];
}
var new_ast = w.with_walkers({
"stat" : do_stat,
"label" : do_stat,
"break" : do_stat,
"continue" : do_stat,
"debugger" : do_stat,
"var" : do_stat,
"const" : do_stat,
"return" : do_stat,
"throw" : do_stat,
"try" : do_stat,
"defun" : do_stat,
"if" : do_stat,
"while" : do_stat,
"do" : do_stat,
"for" : do_stat,
"for-in" : do_stat,
"switch" : do_stat,
"with" : do_stat,
"conditional" : do_cond,
"binary" : do_binary
}, function(){
return w.walk(ast);
});
return pro.gen_code(new_ast, { beautify: true });
}
////// test code follows.
var code = instrument(test.toString());
console.log(code);
function test() {
// simple stats
a = 5;
c += a + b;
"foo";
// var
var foo = 5;
const bar = 6, baz = 7;
// switch block. note we can't track case lines the same way.
switch ("foo") {
case "foo":
return 1;
case "bar":
return 2;
}
// for/for in
for (var i = 0; i < 5; ++i) {
console.log("Hello " + i);
}
for (var i in [ 1, 2, 3]) {
console.log(i);
}
for (var i = 0; i < 5; ++i)
console.log("foo");
for (var i = 0; i < 5; ++i) {
console.log("foo");
}
var k = plurp() ? 1 : 0;
var x = a ? doX(y) && goZoo("zoo")
: b ? blerg({ x: y })
: null;
var x = X || Y;
}

8
node_modules/uglify-js/tmp/liftvars.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
var UNUSED_VAR1 = 19;
function main() {
var unused_var2 = 20;
alert(100);
}
main();

30
node_modules/uglify-js/tmp/test.js generated vendored Executable file
View file

@ -0,0 +1,30 @@
#! /usr/bin/env node
global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
var fs = require("fs");
var uglify = require("uglify-js"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js
jsp = uglify.parser,
pro = uglify.uglify;
var code = fs.readFileSync("hoist.js", "utf8");
var ast = jsp.parse(code);
ast = pro.ast_lift_variables(ast);
var w = pro.ast_walker();
ast = w.with_walkers({
"function": function() {
var node = w.dive(this); // walk depth first
console.log(pro.gen_code(node, { beautify: true }));
return node;
},
"name": function(name) {
return [ this[0], "X" ];
}
}, function(){
return w.walk(ast);
});
console.log(pro.gen_code(ast, {
beautify: true
}));

3930
node_modules/uglify-js/tmp/uglify-hangs.js generated vendored Normal file

File diff suppressed because it is too large Load diff

166
node_modules/uglify-js/tmp/uglify-hangs2.js generated vendored Normal file
View file

@ -0,0 +1,166 @@
jsworld.Locale = function(properties) {
// LC_NUMERIC
this.frac_digits = properties.frac_digits;
// may be empty string/null for currencies with no fractional part
if (properties.mon_decimal_point === null || properties.mon_decimal_point == "") {
if (this.frac_digits > 0)
throw "Error: Undefined mon_decimal_point property";
else
properties.mon_decimal_point = "";
}
if (typeof properties.mon_decimal_point != "string")
throw "Error: Invalid/missing mon_decimal_point property";
this.mon_decimal_point = properties.mon_decimal_point;
if (typeof properties.mon_thousands_sep != "string")
throw "Error: Invalid/missing mon_thousands_sep property";
this.mon_thousands_sep = properties.mon_thousands_sep;
if (typeof properties.mon_grouping != "string")
throw "Error: Invalid/missing mon_grouping property";
this.mon_grouping = properties.mon_grouping;
if (typeof properties.positive_sign != "string")
throw "Error: Invalid/missing positive_sign property";
this.positive_sign = properties.positive_sign;
if (typeof properties.negative_sign != "string")
throw "Error: Invalid/missing negative_sign property";
this.negative_sign = properties.negative_sign;
if (properties.p_cs_precedes !== 0 && properties.p_cs_precedes !== 1)
throw "Error: Invalid/missing p_cs_precedes property, must be 0 or 1";
this.p_cs_precedes = properties.p_cs_precedes;
if (properties.n_cs_precedes !== 0 && properties.n_cs_precedes !== 1)
throw "Error: Invalid/missing n_cs_precedes, must be 0 or 1";
this.n_cs_precedes = properties.n_cs_precedes;
if (properties.p_sep_by_space !== 0 &&
properties.p_sep_by_space !== 1 &&
properties.p_sep_by_space !== 2)
throw "Error: Invalid/missing p_sep_by_space property, must be 0, 1 or 2";
this.p_sep_by_space = properties.p_sep_by_space;
if (properties.n_sep_by_space !== 0 &&
properties.n_sep_by_space !== 1 &&
properties.n_sep_by_space !== 2)
throw "Error: Invalid/missing n_sep_by_space property, must be 0, 1, or 2";
this.n_sep_by_space = properties.n_sep_by_space;
if (properties.p_sign_posn !== 0 &&
properties.p_sign_posn !== 1 &&
properties.p_sign_posn !== 2 &&
properties.p_sign_posn !== 3 &&
properties.p_sign_posn !== 4)
throw "Error: Invalid/missing p_sign_posn property, must be 0, 1, 2, 3 or 4";
this.p_sign_posn = properties.p_sign_posn;
if (properties.n_sign_posn !== 0 &&
properties.n_sign_posn !== 1 &&
properties.n_sign_posn !== 2 &&
properties.n_sign_posn !== 3 &&
properties.n_sign_posn !== 4)
throw "Error: Invalid/missing n_sign_posn property, must be 0, 1, 2, 3 or 4";
this.n_sign_posn = properties.n_sign_posn;
if (typeof properties.int_frac_digits != "number" && properties.int_frac_digits < 0)
throw "Error: Invalid/missing int_frac_digits property";
this.int_frac_digits = properties.int_frac_digits;
if (properties.int_p_cs_precedes !== 0 && properties.int_p_cs_precedes !== 1)
throw "Error: Invalid/missing int_p_cs_precedes property, must be 0 or 1";
this.int_p_cs_precedes = properties.int_p_cs_precedes;
if (properties.int_n_cs_precedes !== 0 && properties.int_n_cs_precedes !== 1)
throw "Error: Invalid/missing int_n_cs_precedes property, must be 0 or 1";
this.int_n_cs_precedes = properties.int_n_cs_precedes;
if (properties.int_p_sep_by_space !== 0 &&
properties.int_p_sep_by_space !== 1 &&
properties.int_p_sep_by_space !== 2)
throw "Error: Invalid/missing int_p_sep_by_spacev, must be 0, 1 or 2";
this.int_p_sep_by_space = properties.int_p_sep_by_space;
if (properties.int_n_sep_by_space !== 0 &&
properties.int_n_sep_by_space !== 1 &&
properties.int_n_sep_by_space !== 2)
throw "Error: Invalid/missing int_n_sep_by_space property, must be 0, 1, or 2";
this.int_n_sep_by_space = properties.int_n_sep_by_space;
if (properties.int_p_sign_posn !== 0 &&
properties.int_p_sign_posn !== 1 &&
properties.int_p_sign_posn !== 2 &&
properties.int_p_sign_posn !== 3 &&
properties.int_p_sign_posn !== 4)
throw "Error: Invalid/missing int_p_sign_posn property, must be 0, 1, 2, 3 or 4";
this.int_p_sign_posn = properties.int_p_sign_posn;
if (properties.int_n_sign_posn !== 0 &&
properties.int_n_sign_posn !== 1 &&
properties.int_n_sign_posn !== 2 &&
properties.int_n_sign_posn !== 3 &&
properties.int_n_sign_posn !== 4)
throw "Error: Invalid/missing int_n_sign_posn property, must be 0, 1, 2, 3 or 4";
this.int_n_sign_posn = properties.int_n_sign_posn;
// LC_TIME
if (properties == null || typeof properties != "object")
throw "Error: Invalid/missing time locale properties";
// parse the supported POSIX LC_TIME properties
// abday
try {
this.abday = this._parseList(properties.abday, 7);
}
catch (error) {
throw "Error: Invalid abday property: " + error;
}
}