function(r, i, s){function f(){var f=i.call(s,r[a],a);f instanceof t?(f=f.v,f instanceof n?u. push.apply(u,f.v):u.push(f)):f!=e&&(f instanceof n?o.push.apply(o,f.v):o.push(f) )}var o=[],u=[],a;if(r instanceof Array)for(a=0;a<r.length;++a)f();else for(a in r)HOP(r,a)&&f();return u.concat(o)}
n/a
function array_to_hash(e){var t={};for(var n=0 ;n<e.length;++n)t[e[n]]=!0;return t}
...
s){case"string":o=["string",s];break;case"number":o=["num",s];break;case"boolean"
;
:o=["name",String(s)];break;default:if(s===null){o=["atom","null"];break}throw new
Error("Can't handle constant of type: "+typeof s)}return r.call(n,o,s)}catch(u){
if(u===e){if(n[0]!="binary"||n[1]!="==="&&n[1]!="!=="||!(is_string(n[2])&&is_string
(n[3])||boolean_expr(n[2])&&boolean_expr(n[3]))){if(i&&n[0]=="binary"&&(n[1]=="||"||
n[1]=="&&"))try{var a=t(n[2]);n=n[1]=="&&"&&(a?n[3]:a)||n[1]=="||"&&
;(a?a:n[3])||
n}catch(f){}}else n[1]=n[1].substr(0,2);return i?i.call(n,n):null}throw u}}}(),DOT_CALL_NO_PARENS=
jsp.array_to_hash(["name","array","object","string
","dot","sub","call","regexp","defun"
]),SPLICE_NEEDS_BRACKETS=jsp.array_to_hash(["if","while","do","for","for-in",&
quot;with"
]),MAP;(function(){function t(e){this.v=e}function n(e){this.v=e}MAP=function(r,
i,s){function f(){var f=i.call(s,r[a],a);f instanceof t?(f=f.v,f instanceof n?u.
push.apply(u,f.v):u.push(f)):f!=e&&(f instanceof n?o.push.apply(o,f.v):o.push(f)
)}var o=[],u=[],a;if(r instanceof Array)for(a=0;a<r.length;++a)f();else for(a in
r)HOP(r,a)&&f();return u.concat(o)},MAP.at_top=function(e){return new t(e)},MAP.
splice=function(e){return new n(e)};var e=MAP.skip={}})(),exports.ast_walker=ast_walker
...
function ast_add_scope(e){function s(e){t=new Scope(t),t.labels=new Scope;var n= t.body=e();return n.scope=t,t=t.parent,n}function o(e,n){return t.define(e,n)}function u (e){t.refs[e]=!0}function a(e,t,n){var i=this[0]=="defun";return[this[0],i?o(e,"defun" ):e,t,s(function(){return i||o(e,"lambda"),MAP(t,function(e){o(e,"arg")}),MAP(n, r)})]}function f(e){return function(t){MAP(t,function(t){o(t[0],e),t[1]&&u(t[0]) })}}function l(e){e&&(t.labels.refs[e]=!0)}var t=null,n=ast_walker(),r=n.walk,i= [];return s(function(){function c(e,t){for(t=e.children.length;--t>=0;)c(e.children [t]);for(t in e.refs)if(HOP(e.refs,t))for(var n=e.has(t),r=e;r;r=r.parent){r.refs [t]=n;if(r===n)break}}var s=n.with_walkers({"function":a,defun:a,label:function( e,n){t.labels.define(e)},"break":l,"continue":l,"with":function(e,n){for(var r=t ;r;r=r.parent)r.uses_with=!0},"var":f("var"),"const":f("const"),"try":function(e ,t,n){if(t!=null)return[this[0],MAP(e,r),[o(t[0],"catch"),MAP(t[1],r)],n!=null?MAP (n,r):null]},name:function(e){e=="eval"&&i.push(t),u(e)}},function(){return r(e) });return MAP(i,function(e){if(!e.has("eval"))while(e)e.uses_eval=!0,e=e.parent} ),c(t),s})}
n/a
function ast_lift_variables(e){function i(e,t){var i=r;r=t,e=MAP(e,n);var s= {},o=MAP(t.names,function(e,n){return e!="var"?MAP.skip:t.references(n)?(s[n]=!0 ,[n]):MAP.skip});return o.length>0&&(for_side_effects(["block",e],function(e,t,n ,r){if(e[0]=="assign"&&e[1]===!0&&e[2][0]=="name"&&HOP(s,e[2][1])){for(var i=o.length ;--i>=0;)if(o[i][0]==e[2][1]){o[i][1]&&n(),o[i][1]=e[3],o.push(o.splice(i,1)[0]) ;break}var u=t.parent();if(u[0]=="seq"){var a=u[2];a.unshift(0,u.length),u.splice .apply(u,a)}else u[0]=="stat"?u.splice(0,u.length,"block"):n();r()}n()}),e.unshift (["var",o])),r=i,e}function s(e){var n=null;for(var r=e.length;--r>=0;){var i=e[ r];if(!i[1])continue;i=["assign",!0,["name",i[0]],i[1]],n==null?n=i:n=["seq",i,n ]}return n==null&&t.parent()[0]!="for"?t.parent()[0]=="for-in"?["name",e[0][0]]: MAP.skip:["stat",n]}function o(e){return[this[0],i(e,this.scope)]}var t=ast_walker (),n=t.walk,r;return t.with_walkers({"function":function(e,t,n){for(var r=t.length ;--r>=0&&!n.scope.references(t[r]);)t.pop();return n.scope.references(e)||(e=null ),[this[0],e,t,i(n,n.scope)]},defun:function(e,t,n){if(!r.references(e))return MAP .skip;for(var s=t.length;--s>=0&&!n.scope.references(t[s]);)t.pop();return[this[0 ],e,t,i(n,n.scope)]},"var":s,toplevel:o},function(){return n(ast_add_scope(e))}) }
n/a
function ast_mangle(e, t){function s(e,n){return t.mangle?!t.toplevel&&! i.parent?e:t.except&&member(e,t.except)?e:t.no_functions&&HOP(i.names,e)&&(i.names [e]=="defun"||i.names[e]=="lambda")?e:i.get_mangled(e,n):e}function o(e){if(t.defines )return!i.has(e)&&HOP(t.defines,e)?t.defines[e]:null}function u(e,n,o){if(!t.no_functions&& t.mangle){var u=this[0]=="defun",f;e&&(u?e=s(e):o.scope.references(e)?(f={},!i.uses_eval&&! i.uses_with?e=f[e]=i.next_mangled():f[e]=e):e=null)}return o=a(o.scope,function( ){return n=MAP(n,function(e){return s(e)}),MAP(o,r)},f),[this[0],e,n,o]}function a (e,t,n){var r=i;i=e;if(n)for(var o in n)HOP(n,o)&&e.set_mangle(o,n[o]);for(var o in e.names)HOP(e.names,o)&&s(o,!0);var u=t();return u.scope=e,i=r,u}function f(e){return[ this[0],MAP(e,function(e){return[s(e[0]),r(e[1])]})]}function l(e){if(e)return[this [0],i.labels.get_mangled(e)]}var n=ast_walker(),r=n.walk,i;return t=defaults(t,{ mangle:!0,toplevel:!1,defines:null,except:null,no_functions:!1}),n.with_walkers( {"function":u,defun:function(){var e=u.apply(this,arguments);switch(n.parent()[0 ]){case"toplevel":case"function":case"defun":return MAP.at_top(e)}return e},label :function(e,t){return i.labels.refs[e]?[this[0],i.labels.get_mangled(e,!0),r(t)] :r(t)},"break":l,"continue":l,"var":f,"const":f,name:function(e){return o(e)||[this [0],s(e)]},"try":function(e,t,n){return[this[0],MAP(e,r),t!=null?[s(t[0]),MAP(t[1 ],r)]:null,n!=null?MAP(n,r):null]},toplevel:function(e){var t=this;return a(t.scope ,function(){return[t[0],MAP(e,r)]})},directive:function(){return MAP.at_top(this )}},function(){return r(ast_add_scope(e))})}
...
}
// parse code and get the initial AST
tmp = local.parse(code
.trim()
// comment shebang
.replace((/^#!\//), '// '));
// get a new AST with mangled names
tmp = local.ast_mangle(tmp);
// get an AST with compression optimizations
tmp = local.ast_squeeze(tmp);
// compressed code here
tmp = local.split_lines(local.gen_code(tmp, { ascii_only: true }), 79);
// escape \r and \t
tmp = tmp.replace((/\r/g), '\\r').replace((/\t/g), '\\t');
return tmp;
...
function ast_squeeze(e, t){return e=squeeze_1(e,t),e=squeeze_2(e,t),e}
...
tmp = local.parse(code
.trim()
// comment shebang
.replace((/^#!\//), '// '));
// get a new AST with mangled names
tmp = local.ast_mangle(tmp);
// get an AST with compression optimizations
tmp = local.ast_squeeze(tmp);
// compressed code here
tmp = local.split_lines(local.gen_code(tmp, { ascii_only: true }), 79);
// escape \r and \t
tmp = tmp.replace((/\r/g), '\\r').replace((/\t/g), '\\t');
return tmp;
};
}());
...
function ast_walker(){function e(e){return[this[0],MAP(e,function(e){var t=[e[0] ];return e.length>1&&(t[1]=s(e[1])),t})]}function t(e){var t=[this[0]];return e!= null&&t.push(MAP(e,s)),t}function s(e){if(e==null)return null;try{i.push(e);var t= e[0],s=r[t];if(s){var o=s.apply(e,e.slice(1));if(o!=null)return o}return s=n[t], s.apply(e,e.slice(1))}finally{i.pop()}}function o(e){if(e==null)return null;try{ return i.push(e),n[e[0]].apply(e,e.slice(1))}finally{i.pop()}}function u(e,t){var n= {},i;for(i in e)HOP(e,i)&&(n[i]=r[i],r[i]=e[i]);var s=t();for(i in n)HOP(n,i)&&( n[i]?r[i]=n[i]:delete r[i]);return s}var n={string:function(e){return[this[0],e] },num:function(e){return[this[0],e]},name:function(e){return[this[0],e]},toplevel :function(e){return[this[0],MAP(e,s)]},block:t,splice:t,"var":e,"const":e,"try": function(e,t,n){return[this[0],MAP(e,s),t!=null?[t[0],MAP(t[1],s)]:null,n!=null? MAP(n,s):null]},"throw":function(e){return[this[0],s(e)]},"new":function(e,t){return[ this[0],s(e),MAP(t,s)]},"switch":function(e,t){return[this[0],s(e),MAP(t,function( e){return[e[0]?s(e[0]):null,MAP(e[1],s)]})]},"break":function(e){return[this[0], e]},"continue":function(e){return[this[0],e]},conditional:function(e,t,n){return[ this[0],s(e),s(t),s(n)]},assign:function(e,t,n){return[this[0],e,s(t),s(n)]},dot :function(e){return[this[0],s(e)].concat(slice(arguments,1))},call:function(e,t) {return[this[0],s(e),MAP(t,s)]},"function":function(e,t,n){return[this[0],e,t.slice (),MAP(n,s)]},"debugger":function(){return[this[0]]},defun:function(e,t,n){return[ this[0],e,t.slice(),MAP(n,s)]},"if":function(e,t,n){return[this[0],s(e),s(t),s(n )]},"for":function(e,t,n,r){return[this[0],s(e),s(t),s(n),s(r)]},"for-in":function( e,t,n,r){return[this[0],s(e),s(t),s(n),s(r)]},"while":function(e,t){return[this[0 ],s(e),s(t)]},"do":function(e,t){return[this[0],s(e),s(t)]},"return":function(e) {return[this[0],s(e)]},binary:function(e,t,n){return[this[0],e,s(t),s(n)]},"unary-prefix" :function(e,t){return[this[0],e,s(t)]},"unary-postfix":function(e,t){return[this [0],e,s(t)]},sub:function(e,t){return[this[0],s(e),s(t)]},object:function(e){return[ this[0],MAP(e,function(e){return e.length==2?[e[0],s(e[1])]:[e[0],s(e[1]),e[2]]} )]},regexp:function(e,t){return[this[0],e,t]},array:function(e){return[this[0],MAP (e,s)]},stat:function(e){return[this[0],s(e)]},seq:function(){return[this[0]].concat (MAP(slice(arguments),s))},label:function(e,t){return[this[0],e,s(t)]},"with":function( e,t){return[this[0],s(e),s(t)]},atom:function(e){return[this[0],e]},directive:function( e){return[this[0],e]}},r={},i=[];return{walk:s,dive:o,with_walkers:u,parent:function( ){return i[i.length-2]},stack:function(){return i}}}
n/a
cliRun = function (fnc) {
/*
* this function will run the cli
*/
var nop;
nop = function () {
/*
* this function will do nothing
*/
return;
};
local.cliDict._eval = local.cliDict._eval || function () {
/*
* <code>
* # eval code
*/
local.global.local = local;
require('vm').runInThisContext(process.argv[3]);
};
local.cliDict['--eval'] = local.cliDict['--eval'] || local.cliDict._eval;
local.cliDict['-e'] = local.cliDict['-e'] || local.cliDict._eval;
local.cliDict._help = local.cliDict._help || function (options) {
/*
*
* # print help
*/
var commandList, file, packageJson, text, textDict;
commandList = [{
arg: '<arg2> ...',
description: 'usage:',
command: ['<arg1>']
}];
file = __filename.replace((/.*\//), '');
packageJson = require('./package.json');
textDict = {};
Object.keys(local.cliDict).sort().forEach(function (key, ii) {
if (key[0] === '_' && key !== '_default') {
return;
}
text = String(local.cliDict[key]);
if (key === '_default') {
key = '<>';
}
ii = textDict[text] = textDict[text] || (ii + 1);
if (commandList[ii]) {
commandList[ii].command.push(key);
} else {
commandList[ii] = (/\n +?\*(.*?)\n +?\*(.*?)\n/).exec(text);
// coverage-hack - ignore else-statement
nop(local.global.__coverage__ && (function () {
commandList[ii] = commandList[ii] || ['', '', ''];
}()));
commandList[ii] = {
arg: commandList[ii][1].trim(),
command: [key],
description: commandList[ii][2].trim()
};
}
});
(options && options.modeError
? console.error
: console.log)((options && options.modeError
? '\u001b[31merror: missing <arg1>\u001b[39m\n\n'
: '') + packageJson.name + ' (' + packageJson.version + ')\n\n' + commandList
.filter(function (element) {
return element;
}).map(function (element) {
return (element.description + '\n' +
file + ' ' +
element.command.sort().join('|') + ' ' +
element.arg.replace((/ +/g), ' '))
.replace((/<>\||\|<>|<> {2}/), '')
.trim();
})
.join('\n\n') + '\n\nexample:\n' + file +
' --eval \'console.log("hello world")\'');
};
local.cliDict['--help'] = local.cliDict['--help'] || local.cliDict._help;
local.cliDict['-h'] = local.cliDict['-h'] || local.cliDict._help;
local.cliDict._default = local.cliDict._default || local.cliDict._help;
local.cliDict.help = local.cliDict.help || local.cliDict._help;
local.cliDict._interactive = local.cliDict._interactive || function () {
/*
*
* # start interactive-mode
*/
local.global.local = local;
local.replStart();
};
if (local.replStart) {
local.cliDict['--interactive'] = local.cliDict['--interactive'] ||
local.cliDict._interactive;
local.cliDict['-i'] = local.cliDict['-i'] || local.cliDict._interactive;
}
local.cliDict._version = local.cliDict._version || function () {
/*
*...
...
}
// uglify file
console.log(local.uglify(local.fs.readFileSync(
local.path.resolve(process.cwd(), process.argv[2]),
'utf8'
), process.argv[2]));
};
local.cliRun();
}());
}());
...
function curry(e){var t= slice(arguments,1);return function(){return e.apply(this,t.concat(slice(arguments )))}}
n/a
function gen_code(e, t){function o( e){var n=make_string(e,t.ascii_only);return t.inline_script&&(n=n.replace(/<\x2fscript([>\/\t\n\f\r ])/gi ,"<\\/script$1")),n}function u(e){return e=e.toString(),t.ascii_only&&(e=to_ascii (e)),e}function a(e){return e==null&&(e=""),n&&(e=repeat_string(" ",t.indent_start+ r*t.indent_level)+e),e}function f(e,t){t==null&&(t=1),r+=t;try{return e.apply(null ,slice(arguments,1))}finally{r-=t}}function l(e){return e=e.toString(),e.charAt( e.length-1)}function c(e){return e.toString().charAt(0)}function h(e){if(n)return e .join(" ");var t=[];for(var r=0;r<e.length;++r){var i=e[r+1];t.push(e[r]),i&&(is_identifier_char (l(e[r]))&&(is_identifier_char(c(i))||c(i)=="\\")||/[\+\-]$/.test(e[r].toString( ))&&/^[\+\-]/.test(i.toString())||l(e[r])=="/"&&c(i)=="/")&&t.push(" ")}return t .join("")}function p(e){return e.join(","+s)}function d(e){var t=b(e);for(var n=1 ;n<arguments.length;++n){var r=arguments[n];if(r instanceof Function&&r(e)||e[0]== r)return"("+t+")"}return t}function v(e){if(e.length==1)return e[0];if(e.length==2 ){var t=e[1];return e=e[0],e.length<=t.length?e:t}return v([e[0],v(e.slice(1))]) }function m(e){if(e[0]=="function"||e[0]=="object"){var t=slice(y.stack()),n=t.pop (),r=t.pop();while(r){if(r[0]=="stat")return!0;if((r[0]!="seq"&&r[0]!="call"&&r[0 ]!="dot"&&r[0]!="sub"&&r[0]!="conditional"||r[1]!==n)&&(r[0]!="binary"&&r[0]!="assign"&& r[0]!="unary-postfix"||r[2]!==n))return!1;n=r,r=t.pop()}}return!HOP(DOT_CALL_NO_PARENS ,e[0])}function g(e){var t=e.toString(10),n=[t.replace(/^0\./,".").replace("e+","e" )],r;return Math.floor(e)===e?(e>=0?n.push("0x"+e.toString(16).toLowerCase(),"0"+ e.toString(8)):n.push("-0x"+(-e).toString(16).toLowerCase(),"-0"+(-e).toString(8 )),(r=/^(.*?)(0+)$/.exec(e))&&n.push(r[1]+"e"+r[2].length)):(r=/^0?\.(0+)(.*)$/. exec(e))&&n.push(r[2]+"e-"+(r[1].length+r[2].length),t.substr(t.indexOf("."))),v (n)}function w(e){if(e==null)return";";if(e[0]=="do")return N([e]);var t=e;for(; ;){var n=t[0];if(n=="if"){if(!t[3])return b(["block",[e]]);t=t[3]}else if(n=="while"|| n=="do")t=t[2];else{if(n!="for"&&n!="for-in")break;t=t[4]}}return b(e)}function E (e,t,n,r,i){var s=r||"function";return e&&(s+=" "+u(e)),s+="("+p(MAP(t,u))+")",s= h([s,N(n)]),!i&&m(this)?"("+s+")":s}function S(e){switch(e[0]){case"with":case"while" :return empty(e[2])||S(e[2]);case"for":case"for-in":return empty(e[4])||S(e[4]); case"if":if(empty(e[2])&&!e[3])return!0;if(e[3])return empty(e[3])?!0:S(e[3]);return S (e[2]);case"directive":return!0}}function x(e,t){for(var r=[],i=e.length-1,s=0;s<= i;++s){var o=e[s],u=b(o);u!=";"&&(!n&&s==i&&!S(o)&&(u=u.replace(/;+\s*$/,"")),r. push(u))}return t?r:MAP(r,a)}function T(e){var t=e.length;return t==0?"{}":"{"+i+ MAP(e,function(e,r){var s=e[1].length>0,o=f(function(){return a(e[0]?h(["case",b (e[0])+":"]):"default:")},.5)+(s?i+f(function(){return x(e[1]).join(i)}):"");return! n&&s&&r<t-1&&(o+=";"),o}).join(i)+i+a("}")}function N(e){return e?e.length==0?"{}" :"{"+i+f(function(){return x(e).join(i)})+i+a("}"):";"}function C(e){var t=e[0], n=e[1];return n!=null&&(t=h([u(t),"=",d(n,"seq")])),t}t=defau...
...
// comment shebang
.replace((/^#!\//), '// '));
// get a new AST with mangled names
tmp = local.ast_mangle(tmp);
// get an AST with compression optimizations
tmp = local.ast_squeeze(tmp);
// compressed code here
tmp = local.split_lines(local.gen_code(tmp, { ascii_only: true }), 79);
// escape \r and \t
tmp = tmp.replace((/\r/g), '\\r').replace((/\t/g), '\\t');
return tmp;
};
}());
...
function is_alphanumeric_char(e){return is_digit(e)||is_letter(e)}
n/a
function is_identifier_char(e){return is_identifier_start (e)||is_unicode_combining_mark(e)||is_unicode_digit(e)||is_unicode_connector_punctuation (e)||e=="\u200c"||e=="\u200d"}
n/a
function is_identifier_start(e) {return e=="$"||e=="_"||is_letter(e)}
n/a
function make_string(e, t){var n=0,r=0;return e= e.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0]/g,function(e){switch(e){case"\\" :return"\\\\";case"\b":return"\\b";case"\f":return"\\f";case"\n":return"\\n";case"\r" :return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";case'"':return++ n,'"';case"'":return++r,"'";case"\0":return"\\0"}return e}),t&&(e=to_ascii(e)),n> r?"'"+e.replace(/\x27/g,"\\'")+"'":'"'+e.replace(/\x22/g,'\\"')+'"'}
n/a
function member(e, t){for( var n=t.length;--n>=0;)if(t[n]==e)return!0;return!1}
n/a
nop = function () {
/*
* this function will do nothing
*/
return;
}
n/a
function parse (e, t, n){function i(e,t){return is_token(r.token,e,t)}function s(){return r.peeked|| (r.peeked=r.input())}function o(){return r.prev=r.token,r.peeked?(r.token=r.peeked ,r.peeked=null):r.token=r.input(),r.in_directives=r.in_directives&&(r.token.type=="string"|| i("punc",";")),r.token}function u(){return r.prev}function a(e,t,n,i){var s=r.input .context();js_error(e,t!=null?t:s.tokline,n!=null?n:s.tokcol,i!=null?i:s.tokpos) }function f(e,t){a(t,e.line,e.col)}function l(e){e==null&&(e=r.token),f(e,"Unexpected token: "+ e.type+" ("+e.value+")")}function c(e,t){if(i(e,t))return o();f(r.token,"Unexpected token "+ r.token.type+", expected "+e)}function h(e){return c("punc",e)}function p(){return! t&&(r.token.nlb||i("eof")||i("punc","}"))}function d(){i("punc",";")?o():p()||l( )}function v(){return slice(arguments)}function m(){h("(");var e=K();return h(")" ),e}function g(e,t,n){return e instanceof NodeWithToken?e:new NodeWithToken(e,t, n)}function y(e){return n?function(){var t=r.token,n=e.apply(this,arguments);return n [0]=g(n[0],t,u()),n}:e}function w(e){r.labels.push(e);var n=r.token,i=b();return t&&! HOP(STATEMENTS_WITH_LABELS,i[0])&&l(n),r.labels.pop(),v("label",e,i)}function E( ){return v("stat",prog1(K,d))}function S(e){var t;return p()||(t=i("name")?r.token .value:null),t!=null?(o(),member(t,r.labels)||a("Label "+t+" without matching loop or statement" )):r.in_loop==0&&a(e+" not inside a loop or switch"),d(),v(e,t)}function x(){h("(" );var e=null;if(!i("punc",";")){e=i("keyword","var")?(o(),_(!0)):K(!0,!0);if(i("operator" ,"in"))return e[0]=="var"&&e[1].length>1&&a("Only one variable declaration allowed in for..in loop" ),N(e)}return T(e)}function T(e){h(";");var t=i("punc",";")?null:K();h(";");var n= i("punc",")")?null:K();return h(")"),v("for",e,t,n,Q(b))}function N(e){var t=e[0 ]=="var"?v("name",e[1][0]):e;o();var n=K();return h(")"),v("for-in",e,t,n,Q(b))} function k(){var e=m(),t=b(),n;return i("keyword","else")&&(o(),n=b()),v("if",e, t,n)}function L(){h("{");var e=[];while(!i("punc","}"))i("eof")&&l(),e.push(b()) ;return o(),e}function O(){var e=L(),t,n;if(i("keyword","catch")){o(),h("("),i("name" )||a("Name expected");var s=r.token.value;o(),h(")"),t=[s,L()]}return i("keyword" ,"finally")&&(o(),n=L()),!t&&!n&&a("Missing catch/finally blocks"),v("try",e,t,n )}function M(e){var t=[];for(;;){i("name")||l();var n=r.token.value;o(),i("operator" ,"=")?(o(),t.push([n,K(!1,e)])):t.push([n]);if(!i("punc",","))break;o()}return t }function _(e){return v("var",M(e))}function D(){return v("const",M())}function P (){var e=H(!1),t;return i("punc","(")?(o(),t=B(")")):t=[],R(v("new",e,t),!0)}function B (e,t,n){var r=!0,s=[];while(!i("punc",e)){r?r=!1:h(",");if(t&&i("punc",e))break; i("punc",",")&&n?s.push(["atom","undefined"]):s.push(K(!1))}return o(),s}function j (){return v("array",B("]",!t,!0))}function F(){var e=!0,n=[];while(!i("punc","}" )){e?e=!1:h(",");if(!t&&i("punc","}"))break;var s=r.token.type,u=I();s!="name"|| u!="get"&&u!="set"||!!i("punc",":")?(h(":"),n.push([u,K(!1)]...
...
n){return t.ascii_only&&(e=to_ascii(e)),"/"+e+"/"+n},array:function(e){return e.
length==0?"[]":h(["[",p(MAP(e,function(t,r){return!n&&t[0]=="atom"&&t[1]=="undefined
"?
r===e.length-1?",":"":d(t,"seq")})),"]"])},stat:function(e){return e!=null?b(e).
replace(/;*\s*$/,";"):";"},seq:function(){return p(MAP(slice(arguments),b))},label
:function(e,t){return h([u(e),":",b(t)])},"with":function(e,t){return h(["with","("+
b(e)+")",b(t)])},atom:function(e){return u(e)},directive:function(e){return make_string
(e)+";"}},function(){return b(e)})}function split_lines(e,t){var n=[0];return jsp
.parse(function(){function o(e){return e.pos-i}function u(e){i=e.pos,n.push(i)}function
a
(){var e=r.apply(this,arguments);e:{if(s&&s.type=="keyword")break e;if(o(e)>t)switch(
e.type){case"keyword":case"atom":case"name":case"punc":u(e);break e}}return s=e,
e}var r=jsp.tokenizer(e),i=0,s;return a.context=function(){return r.context.apply
(this,arguments)},a}()),n.map(function(t,r){return e.substring(t,n[r+1]||e.length
)}).join("\n")}function repeat_string(e,t){if(t<=0)return"";if(t==1)return e;var n=
repeat_string(e,t>>1);return n+=n,t&1&&(n+=e),n}function defaults(e,t){var n={};
e===!0&&(e={});for(var r in t)HOP(t,r)&&(n[r]=e&&HOP(e,r)?e[r]:t[r]);return n}function is_identifier
...
function(e){warn=e}
n/a
function slice(e, t){return Array.prototype.slice .call(e,t||0)}
...
.test(n)&&(warn("WARNING: at line "+t.line),warn('*** Found "conditional comment": '+
n),warn("*** UglifyJS DISCARDS ALL COMMENTS. This means your code might no longer work properly in Internet Explorer."
;
)),u("comment2",n,!0)})}function g(){var e=!1,t="",i,s=!1,o;while((i=n())!=null)
if(!e)if(i=="\\")s=e=!0,r();else{if(!is_identifier_char(i))break;t+=r()}else i!="u"&&
l("Expecting UnicodeEscapeSequence -- uXXXX"),i=h(),is_identifier_char(i)||l("Unicode char: "+
i.charCodeAt(0)+" is not valid in identifier"),t+=i,e=!1;return HOP(KEYWORDS,t)&&
s&&(o=t.charCodeAt(0).toString(16).toUpperCase(),t="\\u"+"0000".substr(o.length)+
o+t.slice(1)),t}function y(e){return x("Unterminated regular expression",function
(
){var t=!1,n,i=!1;while(n=r(!0))if(t)e+="\\"+n,t=!1;else if(n=="[")i=!0,e+=n;else if(
n=="]"&&i)i=!1,e+=n;else{if(n=="/"&&!i)break;n=="\\"?t=!0:e+=n}var s=g();return u
("regexp",[e,s])})}function b(e){function t(e){if(!n())return e;var i=e+n();return HOP
(OPERATORS,i)?(r(),t(i)):e}return u("operator",t(e||r()))}function w(){r();var e=
t.regex_allowed;switch(n()){case"/":return t.comments_before.push(v()),t.regex_allowed=
e,T();case"*":return t.comments_before.push(m()),t.regex_allowed=e,T()}return t.
regex_allowed?y(""):b("/")}function E(){return r(),is_digit(n())?c("."):u("punc"
...
function split_lines(e, t){var n=[0];return jsp .parse(function(){function o(e){return e.pos-i}function u(e){i=e.pos,n.push(i)}function a (){var e=r.apply(this,arguments);e:{if(s&&s.type=="keyword")break e;if(o(e)>t)switch( e.type){case"keyword":case"atom":case"name":case"punc":u(e);break e}}return s=e, e}var r=jsp.tokenizer(e),i=0,s;return a.context=function(){return r.context.apply (this,arguments)},a}()),n.map(function(t,r){return e.substring(t,n[r+1]||e.length )}).join("\n")}
...
// comment shebang
.replace((/^#!\//), '// '));
// get a new AST with mangled names
tmp = local.ast_mangle(tmp);
// get an AST with compression optimizations
tmp = local.ast_squeeze(tmp);
// compressed code here
tmp = local.split_lines(local.gen_code(tmp, { ascii_only: true }), 79);
// escape \r and \t
tmp = tmp.replace((/\r/g), '\\r').replace((/\t/g), '\\t');
return tmp;
};
}());
...
function tokenizer(e){function n (){return t.text.charAt(t.pos)}function r(e,n){var r=t.text.charAt(t.pos++);if(e&&! r)throw EX_EOF;return r=="\n"?(t.newline_before=t.newline_before||!n,++t.line,t. col=0):++t.col,r}function i(){return!t.peek()}function s(e,n){var r=t.text.indexOf (e,t.pos);if(n&&r==-1)throw EX_EOF;return r}function o(){t.tokline=t.line,t.tokcol= t.col,t.tokpos=t.pos}function u(e,n,r){t.regex_allowed=e=="operator"&&!HOP(UNARY_POSTFIX ,n)||e=="keyword"&&HOP(KEYWORDS_BEFORE_EXPRESSION,n)||e=="punc"&&HOP(PUNC_BEFORE_EXPRESSION ,n);var i={type:e,value:n,line:t.tokline,col:t.tokcol,pos:t.tokpos,endpos:t.pos, nlb:t.newline_before};if(!r){i.comments_before=t.comments_before,t.comments_before= [];for(var s=0,o=i.comments_before.length;s<o;s++)i.nlb=i.nlb||i.comments_before [s].nlb}return t.newline_before=!1,i}function a(){while(HOP(WHITESPACE_CHARS,n() ))r()}function f(e){var t="",i=n(),s=0;while(i&&e(i,s++))t+=r(),i=n();return t}function l (e){js_error(e,t.tokline,t.tokcol,t.tokpos)}function c(e){var t=!1,n=!1,r=!1,i=e=="." ,s=f(function(s,o){return s=="x"||s=="X"?r?!1:r=!0:!!r||s!="E"&&s!="e"?s=="-"?n|| o==0&&!e?!0:!1:s=="+"?n:(n=!1,s=="."?!i&&!r&&!t?i=!0:!1:is_alphanumeric_char(s)) :t?!1:t=n=!0});e&&(s=e+s);var o=parse_js_number(s);if(!isNaN(o))return u("num",o );l("Invalid syntax: "+s)}function h(e){var t=r(!0,e);switch(t){case"n":return"\n" ;case"r":return"\r";case"t":return"\t";case"b":return"\b";case"v":return"";case"f" :return"\f";case"0":return"\0";case"x":return String.fromCharCode(p(2));case"u": return String.fromCharCode(p(4));case"\n":return"";default:return t}}function p( e){var t=0;for(;e>0;--e){var n=parseInt(r(!0),16);isNaN(n)&&l("Invalid hex-character pattern in string" ),t=t<<4|n}return t}function d(){return x("Unterminated string constant",function( ){var e=r(),t="";for(;;){var n=r(!0);if(n=="\\"){var i=0,s=null;n=f(function(e){ if(e>="0"&&e<="7"){if(!s)return s=e,++i;if(s<="3"&&i<=2)return++i;if(s>="4"&&i<=1 )return++i}return!1}),i>0?n=String.fromCharCode(parseInt(n,8)):n=h(!0)}else{if(n== e)break;if(n=="\n")throw EX_EOF}t+=n}return u("string",t)})}function v(){r();var e= s("\n"),n;return e==-1?(n=t.text.substr(t.pos),t.pos=t.text.length):(n=t.text.substring (t.pos,e),t.pos=e),u("comment1",n,!0)}function m(){return r(),x("Unterminated multiline comment" ,function(){var e=s("*/",!0),n=t.text.substring(t.pos,e);return t.pos=e+2,t.line+= n.split("\n").length-1,t.newline_before=t.newline_before||n.indexOf("\n")>=0,/^@cc_on/i .test(n)&&(warn("WARNING: at line "+t.line),warn('*** Found "conditional comment": '+ n),warn("*** UglifyJS DISCARDS ALL COMMENTS. This means your code might no longer work properly in Internet Explorer." )),u("comment2",n,!0)})}function g(){var e=!1,t="",i,s=!1,o;while((i=n())!=null) if(!e)if(i=="\\")s=e=!0,r();else{if(!is_identifier_char(i))break;t+=r()}else i!="u"&& l("Expecting UnicodeEscapeSequence -- uXXXX"),i=h(),is_identifier_char(i)||l("Unicode char: "+ i.charCodeAt(0)+" is not valid in identifier"),t+=i,e=!1;return HOP(KEYWORDS,t)&& s&&(o=t.charCodeAt(0).toString(16).toUpperCase(),t="\\u"+"0000".substr(o.length)+ o+t.slice(1)),t}function y(e){return x("Unterminated regular expression",function( ){var t=!1,n,i=!1;while(n=r(!0))if(t)e+="\\"+n,t=!1;els...
...
replace(/;*\s*$/,";"):";"},seq:function(){return p(MAP(slice(arguments),b))},label
:function(e,t){return h([u(e),":",b(t)])},"with":function(e,t){return h(["with","("+
b(e)+")",b(t)])},atom:function(e){return u(e)},directive:function(e){return make_string
(e)+";"}},function(){return b(e)})}function split_lines(e,t){var n=[0];return jsp
.parse(function(){function o(e){return e.pos-i}function u(e){i=e.pos,n.push(i)}function a
(){var e=r.apply(this,arguments);e:{if(s&&s.type=="keyword")break e;if(o(e)>t)switch(
e.type){case"keyword":case"atom":case"name":case"punc":u(e);break e}}return s=e,
e}var r=jsp.tokenizer(e),i=0,s;return a.context=function(){return r.context.apply
(this,arguments)},a}()),n.map(function(t,r){return e.substring(t,n[r+1]||e.length
)}).join("\n")}function repeat_string(e,t){if(t<=0)return"";if(t==1)return e;var n=
repeat_string(e,t>>1);return n+=n,t&1&&(n+=e),n}function defaults(e,t){var n={};
e===!0&&(e={});for(var r in t)HOP(t,r)&&(n[r]=e&&HOP(e,r)?e[r]:t[r]);return n}function is_identifier
(e){return/^[a-z_$][a-z0-9_$]*$/i.test(e)&&e!="this"&&!HOP(jsp.KEYWORDS_ATOM,e)&&!
HOP(jsp.RESERVED_WORDS,e)&&!HOP(jsp.KEYWORDS,e)}function HOP(e,t){return Object.
prototype.hasOwnProperty.call(e,t)}var jsp=require("./parse-js"),curry=jsp.curry
...
uglify = function (code, file) {
/*
* this function will uglify the js-code
*/
var tmp;
// uglify css
if ((file || '').slice(-4) === '.css') {
return code
// remove comment /**/
.replace((/\/\*[\S\s]*?\*\//g), '')
// remove comment //
.replace((/\/\/.*/g), '')
// remove whitespace
.replace((/\t/g), ' ')
.replace((/ {2,}/g), ' ')
.replace((/ *?([\n,:;{}]) */g), '$1')
.replace((/\n\n+/g), '\n')
.trim();
}
// parse code and get the initial AST
tmp = local.parse(code
.trim()
// comment shebang
.replace((/^#!\//), '// '));
// get a new AST with mangled names
tmp = local.ast_mangle(tmp);
// get an AST with compression optimizations
tmp = local.ast_squeeze(tmp);
// compressed code here
tmp = local.split_lines(local.gen_code(tmp, { ascii_only: true }), 79);
// escape \r and \t
tmp = tmp.replace((/\r/g), '\\r').replace((/\t/g), '\\t');
return tmp;
}
...
), function (response) {
local.chunkList = [];
response
.on('data', function (chunk) {
local.chunkList.push(chunk);
})
.on('end', function () {
console.log(local.uglify(
Buffer.concat(local.chunkList).toString(),
local.url.parse(process.argv[2]).pathname
));
});
})
.end();
return;
...
function(r, i, s){function f(){var f=i.call(s,r[a],a);f instanceof t?(f=f.v,f instanceof n?u. push.apply(u,f.v):u.push(f)):f!=e&&(f instanceof n?o.push.apply(o,f.v):o.push(f) )}var o=[],u=[],a;if(r instanceof Array)for(a=0;a<r.length;++a)f();else for(a in r)HOP(r,a)&&f();return u.concat(o)}
n/a
function(e){return new t(e)}
...
){return n=MAP(n,function(e){return s(e)}),MAP(o,r)},f),[this[0],e,n,o]}function a
(e,t,n){var r=i;i=e;if(n)for(var o in n)HOP(n,o)&&e.set_mangle(o,n[o]);for(var o in
e.names)HOP(e.names,o)&&s(o,!0);var u=t();return u.scope=e,i=r,u}function f(e){return[
this[0],MAP(e,function(e){return[s(e[0]),r(e[1])]})]}function l(e){if(e)return[this
[0],i.labels.get_mangled(e)]}var n=ast_walker(),r=n.walk,i;return t=defaults(t,{
mangle:!0,toplevel:!1,defines:null,except:null,no_functions:!1}),n.with_walkers(
{"function":u,defun:function(){var e=u.apply(this,arguments);switch(n.parent()[0
]){case"toplevel":case"function":case"defun":return MAP.at_top
(e)}return e},label
:function(e,t){return i.labels.refs[e]?[this[0],i.labels.get_mangled(e,!0),r(t)]
:r(t)},"break":l,"continue":l,"var":f,"const":f,name:function(e){return o(e)||[this
[0],s(e)]},"try":function(e,t,n){return[this[0],MAP(e,r),t!=null?[s(t[0]),MAP(t[1
],r)]:null,n!=null?MAP(n,r):null]},toplevel:function(e){var t=this;return a(t.scope
,function(){return[t[0],MAP(e,r)]})},directive:function(){return MAP.at_top(this
)}},function(){return r(ast_add_scope(e))})}function best_of(e,t){return gen_code
(e).length>gen_code(t[0]=="stat"?t[1]:t).length?t:e}function last_stat(e){return e
...
function(e){return new n(e)}
...
a,"break":a,"continue":a,assign:a,call:a,"if":a,"for":a,"for-in":a,"while
":a,"do"
:a,"return":a,"unary-prefix":f,"unary-postfix":f,conditional:a,binary:l,defun:a}
,function(){for(;;)try{r(e);break}catch(t){if(t===i)break;if(t===s)continue;throw t
}})}function ast_lift_variables(e){function i(e,t){var i=r;r=t,e=MAP(e,n);var s=
{},o=MAP(t.names,function(e,n){return e!="var"?MAP.skip:t.references(n)?(s[n]=!0
,[n]):MAP.skip});return o.length>0&&(for_side_effects(["block",e],function(e,t,n
,r){if(e[0]=="assign"&&e[1]===!0&&e[2][0]=="name"&&HOP(s,e[2][1])){for(var i=o.length
;--i>=0;)if(o[i][0]==e[2][1]){o[i][1]&&n(),o[i][1]=e[3],o.push(o.splice(i,
1)[0])
;break}var u=t.parent();if(u[0]=="seq"){var a=u[2];a.unshift(0,u.length),u.splice
.apply(u,a)}else u[0]=="stat"?u.splice(0,u.length,"block"):n();r()}n()}),e.unshift
(["var",o])),r=i,e}function s(e){var n=null;for(var r=e.length;--r>=0;){var i=e[
r];if(!i[1])continue;i=["assign",!0,["name",i[0]],i[1]],n==null?n=i:n=["seq",i,n
]}return n==null&&t.parent()[0]!="for"?t.parent()[0]=="for-in"?["name",e[0][0]]:
MAP.skip:["stat",n]}function o(e){return[this[0],i(e,this.scope)]}var t=ast_walker
(),n=t.walk,r;return t.with_walkers({"function":function(e,t,n){for(var r=t.length
...