UNPKG

haxeshim

Version:

Haxe shim to deal with cooexisting versions.

1,811 lines (1,810 loc) 130 kB
// Generated by Haxe 3.4.2 (git build development @ e033003) if (typeof process !== "undefined") if (process.version < "v4.0.0") console.warn("Module " + (typeof(module) == "undefined" ? "" : module.filename) + " requires node.js version 4.0.0 or higher"); (function ($global) { "use strict"; var $estr = function() { return js_Boot.__string_rec(this,''); }; function $extend(from, fields) { function Inherit() {} Inherit.prototype = from; var proto = new Inherit(); for (var name in fields) proto[name] = fields[name]; if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; return proto; } var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; EReg.__name__ = ["EReg"]; EReg.prototype = { r: null ,match: function(s) { if(this.r.global) { this.r.lastIndex = 0; } this.r.m = this.r.exec(s); this.r.s = s; return this.r.m != null; } ,matched: function(n) { if(this.r.m != null && n >= 0 && n < this.r.m.length) { return this.r.m[n]; } else { throw new js__$Boot_HaxeError("EReg::matched"); } } ,__class__: EReg }; var HxOverrides = function() { }; HxOverrides.__name__ = ["HxOverrides"]; HxOverrides.strDate = function(s) { var _g = s.length; switch(_g) { case 8: var k = s.split(":"); var d = new Date(); d["setTime"](0); d["setUTCHours"](k[0]); d["setUTCMinutes"](k[1]); d["setUTCSeconds"](k[2]); return d; case 10: var k1 = s.split("-"); return new Date(k1[0],k1[1] - 1,k1[2],0,0,0); case 19: var k2 = s.split(" "); var y = k2[0].split("-"); var t = k2[1].split(":"); return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]); default: throw new js__$Boot_HaxeError("Invalid date format : " + s); } }; HxOverrides.cca = function(s,index) { var x = s.charCodeAt(index); if(x != x) { return undefined; } return x; }; HxOverrides.substr = function(s,pos,len) { if(len == null) { len = s.length; } else if(len < 0) { if(pos == 0) { len = s.length + len; } else { return ""; } } return s.substr(pos,len); }; HxOverrides.remove = function(a,obj) { var i = a.indexOf(obj); if(i == -1) { return false; } a.splice(i,1); return true; }; HxOverrides.iter = function(a) { return { cur : 0, arr : a, hasNext : function() { return this.cur < this.arr.length; }, next : function() { return this.arr[this.cur++]; }}; }; var List = function() { this.length = 0; }; List.__name__ = ["List"]; List.prototype = { h: null ,q: null ,length: null ,add: function(item) { var x = new _$List_ListNode(item,null); if(this.h == null) { this.h = x; } else { this.q.next = x; } this.q = x; this.length++; } ,__class__: List }; var _$List_ListNode = function(item,next) { this.item = item; this.next = next; }; _$List_ListNode.__name__ = ["_List","ListNode"]; _$List_ListNode.prototype = { item: null ,next: null ,__class__: _$List_ListNode }; Math.__name__ = ["Math"]; var Reflect = function() { }; Reflect.__name__ = ["Reflect"]; Reflect.field = function(o,field) { try { return o[field]; } catch( e ) { haxe_CallStack.lastException = e; return null; } }; Reflect.fields = function(o) { var a = []; if(o != null) { var hasOwnProperty = Object.prototype.hasOwnProperty; for( var f in o ) { if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { a.push(f); } } } return a; }; Reflect.isFunction = function(f) { if(typeof(f) == "function") { return !(f.__name__ || f.__ename__); } else { return false; } }; Reflect.copy = function(o) { var o2 = { }; var _g = 0; var _g1 = Reflect.fields(o); while(_g < _g1.length) { var f = _g1[_g]; ++_g; o2[f] = Reflect.field(o,f); } return o2; }; var RunTests = function() { }; RunTests.__name__ = ["RunTests"]; RunTests.main = function() { var runner = new haxe_unit_TestRunner(); runner.add(new TestResolution()); runner.add(new TestEnv()); new haxeshim_CompilerServer(haxeshim_ServerKind.Port(6000),haxeshim_Scope.seek(),[]); js_node_ChildProcess.exec("haxe --connect 6000 -version",function(error,stdout,stderr) { if(error == null) { process.exit(runner.run() ? 0 : 500); } else { haxe_Log.trace(error,{ fileName : "RunTests.hx", lineNumber : 24, className : "RunTests", methodName : "main"}); process.exit(500); } }); }; var haxe_unit_TestCase = function() { }; haxe_unit_TestCase.__name__ = ["haxe","unit","TestCase"]; haxe_unit_TestCase.prototype = { currentTest: null ,setup: function() { } ,tearDown: function() { } ,print: function(v) { haxe_unit_TestRunner.print(v); } ,assertTrue: function(b,c) { this.currentTest.done = true; if(b != true) { this.currentTest.success = false; this.currentTest.error = "expected true but was false"; this.currentTest.posInfos = c; throw new js__$Boot_HaxeError(this.currentTest); } } ,assertFalse: function(b,c) { this.currentTest.done = true; if(b == true) { this.currentTest.success = false; this.currentTest.error = "expected false but was true"; this.currentTest.posInfos = c; throw new js__$Boot_HaxeError(this.currentTest); } } ,assertEquals: function(expected,actual,c) { this.currentTest.done = true; if(actual != expected) { this.currentTest.success = false; this.currentTest.error = "expected '" + Std.string(expected) + "' but was '" + Std.string(actual) + "'"; this.currentTest.posInfos = c; throw new js__$Boot_HaxeError(this.currentTest); } } ,__class__: haxe_unit_TestCase }; var TestEnv = function() { haxe_unit_TestCase.call(this); }; TestEnv.__name__ = ["TestEnv"]; TestEnv.__super__ = haxe_unit_TestCase; TestEnv.prototype = $extend(haxe_unit_TestCase.prototype,{ test: function() { var a = haxeshim__$Env_Env_$Impl_$.ofVars({ "one" : "a", "two" : "a"}); var b = haxeshim__$Env_Env_$Impl_$.ofVars({ "two" : "b", "three" : "b"}); var aIntoB = haxeshim__$Env_Env_$Impl_$.mergeInto(a,b); var bIntoA = haxeshim__$Env_Env_$Impl_$.mergeInto(b,a); this.assertEquals("a",haxeshim__$Env_Env_$Impl_$.get(aIntoB,"one"),{ fileName : "RunTests.hx", lineNumber : 46, className : "TestEnv", methodName : "test"}); this.assertEquals("a",haxeshim__$Env_Env_$Impl_$.get(bIntoA,"one"),{ fileName : "RunTests.hx", lineNumber : 47, className : "TestEnv", methodName : "test"}); this.assertEquals("a",haxeshim__$Env_Env_$Impl_$.get(aIntoB,"two"),{ fileName : "RunTests.hx", lineNumber : 49, className : "TestEnv", methodName : "test"}); this.assertEquals("b",haxeshim__$Env_Env_$Impl_$.get(bIntoA,"two"),{ fileName : "RunTests.hx", lineNumber : 50, className : "TestEnv", methodName : "test"}); this.assertEquals("b",haxeshim__$Env_Env_$Impl_$.get(aIntoB,"three"),{ fileName : "RunTests.hx", lineNumber : 52, className : "TestEnv", methodName : "test"}); this.assertEquals("b",haxeshim__$Env_Env_$Impl_$.get(bIntoA,"three"),{ fileName : "RunTests.hx", lineNumber : 53, className : "TestEnv", methodName : "test"}); if(haxeshim_Os.IS_WINDOWS) { this.assertEquals("a",haxeshim__$Env_Env_$Impl_$.get(aIntoB,"oNe"),{ fileName : "RunTests.hx", lineNumber : 56, className : "TestEnv", methodName : "test"}); } } ,__class__: TestEnv }); var TestResolution = function() { haxe_unit_TestCase.call(this); }; TestResolution.__name__ = ["TestResolution"]; TestResolution.__super__ = haxe_unit_TestCase; TestResolution.prototype = $extend(haxe_unit_TestCase.prototype,{ testNext: function() { var r = new haxeshim_Resolver(process.cwd(),null,"haxelib",function(v) { throw new js__$Boot_HaxeError("assert"); }); this.assertEquals(["--macro","Sys.println('before')","--run","Main1","--next","-lib","tink_core","--run","Main2","-lib","foo"].join("\n"),r.resolve(["tests/build.hxml"],function(libs) { var ret = []; var _g = 0; while(_g < libs.length) { var l = libs[_g]; ++_g; ret.push("-lib"); ret.push(l); } return ret; }).join("\n"),{ fileName : "RunTests.hx", lineNumber : 64, className : "TestResolution", methodName : "testNext"}); } ,__class__: TestResolution }); var Std = function() { }; Std.__name__ = ["Std"]; Std.string = function(s) { return js_Boot.__string_rec(s,""); }; Std.parseInt = function(x) { var v = parseInt(x,10); if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) { v = parseInt(x); } if(isNaN(v)) { return null; } return v; }; var StringBuf = function() { this.b = ""; }; StringBuf.__name__ = ["StringBuf"]; StringBuf.prototype = { b: null ,__class__: StringBuf }; var StringTools = function() { }; StringTools.__name__ = ["StringTools"]; StringTools.htmlEscape = function(s,quotes) { s = s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;"); if(quotes) { return s.split("\"").join("&quot;").split("'").join("&#039;"); } else { return s; } }; StringTools.startsWith = function(s,start) { if(s.length >= start.length) { return HxOverrides.substr(s,0,start.length) == start; } else { return false; } }; StringTools.endsWith = function(s,end) { var elen = end.length; var slen = s.length; if(slen >= elen) { return HxOverrides.substr(s,slen - elen,elen) == end; } else { return false; } }; StringTools.isSpace = function(s,pos) { var c = HxOverrides.cca(s,pos); if(!(c > 8 && c < 14)) { return c == 32; } else { return true; } }; StringTools.ltrim = function(s) { var l = s.length; var r = 0; while(r < l && StringTools.isSpace(s,r)) ++r; if(r > 0) { return HxOverrides.substr(s,r,l - r); } else { return s; } }; StringTools.rtrim = function(s) { var l = s.length; var r = 0; while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; if(r > 0) { return HxOverrides.substr(s,0,l - r); } else { return s; } }; StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; StringTools.replace = function(s,sub,by) { return s.split(sub).join(by); }; StringTools.quoteUnixArg = function(argument) { if(argument == "") { return "''"; } if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { return argument; } return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; }; StringTools.quoteWinArg = function(argument,escapeMetaCharacters) { if(!new EReg("^[^ \t\\\\\"]+$","").match(argument)) { var result_b = ""; var needquote = argument.indexOf(" ") != -1 || argument.indexOf("\t") != -1 || argument == ""; if(needquote) { result_b += "\""; } var bs_buf = new StringBuf(); var _g1 = 0; var _g = argument.length; while(_g1 < _g) { var i = _g1++; var _g2 = HxOverrides.cca(argument,i); if(_g2 == null) { var c = _g2; if(bs_buf.b.length > 0) { result_b += Std.string(bs_buf.b); bs_buf = new StringBuf(); } result_b += String.fromCharCode(c); } else { switch(_g2) { case 34: var bs = bs_buf.b; result_b += bs == null ? "null" : "" + bs; result_b += bs == null ? "null" : "" + bs; bs_buf = new StringBuf(); result_b += "\\\""; break; case 92: bs_buf.b += "\\"; break; default: var c1 = _g2; if(bs_buf.b.length > 0) { result_b += Std.string(bs_buf.b); bs_buf = new StringBuf(); } result_b += String.fromCharCode(c1); } } } result_b += Std.string(bs_buf.b); if(needquote) { result_b += Std.string(bs_buf.b); result_b += "\""; } argument = result_b; } if(escapeMetaCharacters) { var result_b1 = ""; var _g11 = 0; var _g3 = argument.length; while(_g11 < _g3) { var i1 = _g11++; var c2 = HxOverrides.cca(argument,i1); if(StringTools.winMetaCharacters.indexOf(c2) >= 0) { result_b1 += "^"; } result_b1 += String.fromCharCode(c2); } return result_b1; } else { return argument; } }; var Sys = function() { }; Sys.__name__ = ["Sys"]; Sys.systemName = function() { var _g = process.platform; switch(_g) { case "darwin": return "Mac"; case "freebsd": return "BSD"; case "linux": return "Linux"; case "win32": return "Windows"; default: var other = _g; return other; } }; var haxe_io_Output = function() { }; haxe_io_Output.__name__ = ["haxe","io","Output"]; haxe_io_Output.prototype = { writeByte: function(c) { throw new js__$Boot_HaxeError("Not implemented"); } ,writeBytes: function(s,pos,len) { if(pos < 0 || len < 0 || pos + len > s.length) { throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); } var b = s.b; var k = len; while(k > 0) { this.writeByte(b[pos]); ++pos; --k; } return len; } ,writeFullBytes: function(s,pos,len) { while(len > 0) { var k = this.writeBytes(s,pos,len); pos += k; len -= k; } } ,writeString: function(s) { var b = haxe_io_Bytes.ofString(s); this.writeFullBytes(b,0,b.length); } ,__class__: haxe_io_Output }; var _$Sys_FileOutput = function(fd) { this.fd = fd; }; _$Sys_FileOutput.__name__ = ["_Sys","FileOutput"]; _$Sys_FileOutput.__super__ = haxe_io_Output; _$Sys_FileOutput.prototype = $extend(haxe_io_Output.prototype,{ fd: null ,writeByte: function(c) { js_node_Fs.writeSync(this.fd,String.fromCharCode(c)); } ,writeBytes: function(s,pos,len) { var data = s.b; return js_node_Fs.writeSync(this.fd,new js_node_buffer_Buffer(data.buffer,data.byteOffset,data.byteLength),pos,len); } ,writeString: function(s) { js_node_Fs.writeSync(this.fd,s); } ,flush: function() { js_node_Fs.fsyncSync(this.fd); } ,close: function() { js_node_Fs.closeSync(this.fd); } ,__class__: _$Sys_FileOutput }); var haxe_io_Input = function() { }; haxe_io_Input.__name__ = ["haxe","io","Input"]; var _$Sys_FileInput = function(fd) { this.fd = fd; }; _$Sys_FileInput.__name__ = ["_Sys","FileInput"]; _$Sys_FileInput.__super__ = haxe_io_Input; _$Sys_FileInput.prototype = $extend(haxe_io_Input.prototype,{ fd: null ,readByte: function() { var buf = new js_node_buffer_Buffer(1); try { js_node_Fs.readSync(this.fd,buf,0,1,null); } catch( e ) { haxe_CallStack.lastException = e; if (e instanceof js__$Boot_HaxeError) e = e.val; if(e.code == "EOF") { throw new js__$Boot_HaxeError(new haxe_io_Eof()); } else { throw new js__$Boot_HaxeError(haxe_io_Error.Custom(e)); } } return buf[0]; } ,readBytes: function(s,pos,len) { var data = s.b; var buf = new js_node_buffer_Buffer(data.buffer,data.byteOffset,data.byteLength); try { return js_node_Fs.readSync(this.fd,buf,pos,len,null); } catch( e ) { haxe_CallStack.lastException = e; if (e instanceof js__$Boot_HaxeError) e = e.val; if(e.code == "EOF") { throw new js__$Boot_HaxeError(new haxe_io_Eof()); } else { throw new js__$Boot_HaxeError(haxe_io_Error.Custom(e)); } } } ,close: function() { js_node_Fs.closeSync(this.fd); } ,__class__: _$Sys_FileInput }); var Type = function() { }; Type.__name__ = ["Type"]; Type.getClassName = function(c) { var a = c.__name__; if(a == null) { return null; } return a.join("."); }; Type.getInstanceFields = function(c) { var a = []; for(var i in c.prototype) a.push(i); HxOverrides.remove(a,"__class__"); HxOverrides.remove(a,"__properties__"); return a; }; var haxe_StackItem = { __ename__ : true, __constructs__ : ["CFunction","Module","FilePos","Method","LocalFunction"] }; haxe_StackItem.CFunction = ["CFunction",0]; haxe_StackItem.CFunction.toString = $estr; haxe_StackItem.CFunction.__enum__ = haxe_StackItem; haxe_StackItem.Module = function(m) { var $x = ["Module",1,m]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; haxe_StackItem.FilePos = function(s,file,line) { var $x = ["FilePos",2,s,file,line]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; haxe_StackItem.Method = function(classname,method) { var $x = ["Method",3,classname,method]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; haxe_StackItem.LocalFunction = function(v) { var $x = ["LocalFunction",4,v]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; var haxe_CallStack = function() { }; haxe_CallStack.__name__ = ["haxe","CallStack"]; haxe_CallStack.getStack = function(e) { if(e == null) { return []; } var oldValue = Error.prepareStackTrace; Error.prepareStackTrace = function(error,callsites) { var stack = []; var _g = 0; while(_g < callsites.length) { var site = callsites[_g]; ++_g; if(haxe_CallStack.wrapCallSite != null) { site = haxe_CallStack.wrapCallSite(site); } var method = null; var fullName = site.getFunctionName(); if(fullName != null) { var idx = fullName.lastIndexOf("."); if(idx >= 0) { var className = HxOverrides.substr(fullName,0,idx); var methodName = HxOverrides.substr(fullName,idx + 1,null); method = haxe_StackItem.Method(className,methodName); } } stack.push(haxe_StackItem.FilePos(method,site.getFileName(),site.getLineNumber())); } return stack; }; var a = haxe_CallStack.makeStack(e.stack); Error.prepareStackTrace = oldValue; return a; }; haxe_CallStack.exceptionStack = function() { return haxe_CallStack.getStack(haxe_CallStack.lastException); }; haxe_CallStack.toString = function(stack) { var b = new StringBuf(); var _g = 0; while(_g < stack.length) { var s = stack[_g]; ++_g; b.b += "\nCalled from "; haxe_CallStack.itemToString(b,s); } return b.b; }; haxe_CallStack.itemToString = function(b,s) { switch(s[1]) { case 0: b.b += "a C function"; break; case 1: var m = s[2]; b.b += "module "; b.b += m == null ? "null" : "" + m; break; case 2: var line = s[4]; var file = s[3]; var s1 = s[2]; if(s1 != null) { haxe_CallStack.itemToString(b,s1); b.b += " ("; } b.b += file == null ? "null" : "" + file; b.b += " line "; b.b += line == null ? "null" : "" + line; if(s1 != null) { b.b += ")"; } break; case 3: var meth = s[3]; var cname = s[2]; b.b += cname == null ? "null" : "" + cname; b.b += "."; b.b += meth == null ? "null" : "" + meth; break; case 4: var n = s[2]; b.b += "local function #"; b.b += n == null ? "null" : "" + n; break; } }; haxe_CallStack.makeStack = function(s) { if(s == null) { return []; } else if(typeof(s) == "string") { var stack = s.split("\n"); if(stack[0] == "Error") { stack.shift(); } var m = []; var rie10 = new EReg("^ at ([A-Za-z0-9_. ]+) \\(([^)]+):([0-9]+):([0-9]+)\\)$",""); var _g = 0; while(_g < stack.length) { var line = stack[_g]; ++_g; if(rie10.match(line)) { var path = rie10.matched(1).split("."); var meth = path.pop(); var file = rie10.matched(2); var line1 = Std.parseInt(rie10.matched(3)); m.push(haxe_StackItem.FilePos(meth == "Anonymous function" ? haxe_StackItem.LocalFunction() : meth == "Global code" ? null : haxe_StackItem.Method(path.join("."),meth),file,line1)); } else { m.push(haxe_StackItem.Module(StringTools.trim(line))); } } return m; } else { return s; } }; var haxe_IMap = function() { }; haxe_IMap.__name__ = ["haxe","IMap"]; haxe_IMap.prototype = { set: null ,__class__: haxe_IMap }; var haxe_Log = function() { }; haxe_Log.__name__ = ["haxe","Log"]; haxe_Log.trace = function(v,infos) { js_Boot.__trace(v,infos); }; var haxe_Timer = function(time_ms) { var me = this; this.id = setInterval(function() { me.run(); },time_ms); }; haxe_Timer.__name__ = ["haxe","Timer"]; haxe_Timer.delay = function(f,time_ms) { var t = new haxe_Timer(time_ms); t.run = function() { t.stop(); f(); }; return t; }; haxe_Timer.prototype = { id: null ,stop: function() { if(this.id == null) { return; } clearInterval(this.id); this.id = null; } ,run: function() { } ,__class__: haxe_Timer }; var haxe_ds_Either = { __ename__ : true, __constructs__ : ["Left","Right"] }; haxe_ds_Either.Left = function(v) { var $x = ["Left",0,v]; $x.__enum__ = haxe_ds_Either; $x.toString = $estr; return $x; }; haxe_ds_Either.Right = function(v) { var $x = ["Right",1,v]; $x.__enum__ = haxe_ds_Either; $x.toString = $estr; return $x; }; var haxe_ds_ObjectMap = function() { this.h = { __keys__ : { }}; }; haxe_ds_ObjectMap.__name__ = ["haxe","ds","ObjectMap"]; haxe_ds_ObjectMap.__interfaces__ = [haxe_IMap]; haxe_ds_ObjectMap.prototype = { h: null ,set: function(key,value) { var id = key.__id__ || (key.__id__ = ++haxe_ds_ObjectMap.count); this.h[id] = value; this.h.__keys__[id] = key; } ,__class__: haxe_ds_ObjectMap }; var haxe_ds_Option = { __ename__ : true, __constructs__ : ["Some","None"] }; haxe_ds_Option.Some = function(v) { var $x = ["Some",0,v]; $x.__enum__ = haxe_ds_Option; $x.toString = $estr; return $x; }; haxe_ds_Option.None = ["None",1]; haxe_ds_Option.None.toString = $estr; haxe_ds_Option.None.__enum__ = haxe_ds_Option; var haxe_ds_StringMap = function() { this.h = { }; }; haxe_ds_StringMap.__name__ = ["haxe","ds","StringMap"]; haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; haxe_ds_StringMap.prototype = { h: null ,rh: null ,set: function(key,value) { if(__map_reserved[key] != null) { this.setReserved(key,value); } else { this.h[key] = value; } } ,setReserved: function(key,value) { if(this.rh == null) { this.rh = { }; } this.rh["$" + key] = value; } ,getReserved: function(key) { if(this.rh == null) { return null; } else { return this.rh["$" + key]; } } ,keys: function() { return HxOverrides.iter(this.arrayKeys()); } ,arrayKeys: function() { var out = []; for( var key in this.h ) { if(this.h.hasOwnProperty(key)) { out.push(key); } } if(this.rh != null) { for( var key in this.rh ) { if(key.charCodeAt(0) == 36) { out.push(key.substr(1)); } } } return out; } ,__class__: haxe_ds_StringMap }; var haxe_io_Bytes = function(data) { this.length = data.byteLength; this.b = new Uint8Array(data); this.b.bufferValue = data; data.hxBytes = this; data.bytes = this.b; }; haxe_io_Bytes.__name__ = ["haxe","io","Bytes"]; haxe_io_Bytes.ofString = function(s) { var a = []; var i = 0; while(i < s.length) { var c = s.charCodeAt(i++); if(55296 <= c && c <= 56319) { c = c - 55232 << 10 | s.charCodeAt(i++) & 1023; } if(c <= 127) { a.push(c); } else if(c <= 2047) { a.push(192 | c >> 6); a.push(128 | c & 63); } else if(c <= 65535) { a.push(224 | c >> 12); a.push(128 | c >> 6 & 63); a.push(128 | c & 63); } else { a.push(240 | c >> 18); a.push(128 | c >> 12 & 63); a.push(128 | c >> 6 & 63); a.push(128 | c & 63); } } return new haxe_io_Bytes(new Uint8Array(a).buffer); }; haxe_io_Bytes.prototype = { length: null ,b: null ,__class__: haxe_io_Bytes }; var haxe_io_Eof = function() { }; haxe_io_Eof.__name__ = ["haxe","io","Eof"]; haxe_io_Eof.prototype = { toString: function() { return "Eof"; } ,__class__: haxe_io_Eof }; var haxe_io_Error = { __ename__ : true, __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] }; haxe_io_Error.Blocked = ["Blocked",0]; haxe_io_Error.Blocked.toString = $estr; haxe_io_Error.Blocked.__enum__ = haxe_io_Error; haxe_io_Error.Overflow = ["Overflow",1]; haxe_io_Error.Overflow.toString = $estr; haxe_io_Error.Overflow.__enum__ = haxe_io_Error; haxe_io_Error.OutsideBounds = ["OutsideBounds",2]; haxe_io_Error.OutsideBounds.toString = $estr; haxe_io_Error.OutsideBounds.__enum__ = haxe_io_Error; haxe_io_Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe_io_Error; $x.toString = $estr; return $x; }; var haxe_io_Path = function(path) { switch(path) { case ".":case "..": this.dir = path; this.file = ""; return; } var c1 = path.lastIndexOf("/"); var c2 = path.lastIndexOf("\\"); if(c1 < c2) { this.dir = HxOverrides.substr(path,0,c2); path = HxOverrides.substr(path,c2 + 1,null); this.backslash = true; } else if(c2 < c1) { this.dir = HxOverrides.substr(path,0,c1); path = HxOverrides.substr(path,c1 + 1,null); } else { this.dir = null; } var cp = path.lastIndexOf("."); if(cp != -1) { this.ext = HxOverrides.substr(path,cp + 1,null); this.file = HxOverrides.substr(path,0,cp); } else { this.ext = null; this.file = path; } }; haxe_io_Path.__name__ = ["haxe","io","Path"]; haxe_io_Path.directory = function(path) { var s = new haxe_io_Path(path); if(s.dir == null) { return ""; } return s.dir; }; haxe_io_Path.join = function(paths) { var paths1 = paths.filter(function(s) { if(s != null) { return s != ""; } else { return false; } }); if(paths1.length == 0) { return ""; } var path = paths1[0]; var _g1 = 1; var _g = paths1.length; while(_g1 < _g) { var i = _g1++; path = haxe_io_Path.addTrailingSlash(path); path += paths1[i]; } return haxe_io_Path.normalize(path); }; haxe_io_Path.normalize = function(path) { var slash = "/"; path = path.split("\\").join(slash); if(path == slash) { return slash; } var target = []; var _g = 0; var _g1 = path.split(slash); while(_g < _g1.length) { var token = _g1[_g]; ++_g; if(token == ".." && target.length > 0 && target[target.length - 1] != "..") { target.pop(); } else if(token != ".") { target.push(token); } } var tmp = target.join(slash); var regex_r = new RegExp("([^:])/+","g".split("u").join("")); var result = tmp.replace(regex_r,"$1" + slash); var acc_b = ""; var colon = false; var slashes = false; var _g11 = 0; var _g2 = tmp.length; while(_g11 < _g2) { var i = _g11++; var _g21 = tmp.charCodeAt(i); switch(_g21) { case 47: if(!colon) { slashes = true; } else { var i1 = _g21; colon = false; if(slashes) { acc_b += "/"; slashes = false; } acc_b += String.fromCharCode(i1); } break; case 58: acc_b += ":"; colon = true; break; default: var i2 = _g21; colon = false; if(slashes) { acc_b += "/"; slashes = false; } acc_b += String.fromCharCode(i2); } } return acc_b; }; haxe_io_Path.addTrailingSlash = function(path) { if(path.length == 0) { return "/"; } var c1 = path.lastIndexOf("/"); var c2 = path.lastIndexOf("\\"); if(c1 < c2) { if(c2 != path.length - 1) { return path + "\\"; } else { return path; } } else if(c1 != path.length - 1) { return path + "/"; } else { return path; } }; haxe_io_Path.removeTrailingSlashes = function(path) { try { while(true) { var _g = HxOverrides.cca(path,path.length - 1); if(_g == null) { throw "__break__"; } else { switch(_g) { case 47:case 92: path = HxOverrides.substr(path,0,-1); break; default: throw "__break__"; } } } } catch( e ) { if( e != "__break__" ) throw e; } return path; }; haxe_io_Path.isAbsolute = function(path) { if(StringTools.startsWith(path,"/")) { return true; } if(path.charAt(1) == ":") { return true; } if(StringTools.startsWith(path,"\\\\")) { return true; } return false; }; haxe_io_Path.prototype = { dir: null ,file: null ,ext: null ,backslash: null ,__class__: haxe_io_Path }; var haxe_unit_TestResult = function() { this.m_tests = new List(); this.success = true; }; haxe_unit_TestResult.__name__ = ["haxe","unit","TestResult"]; haxe_unit_TestResult.prototype = { m_tests: null ,success: null ,add: function(t) { this.m_tests.add(t); if(!t.success) { this.success = false; } } ,toString: function() { var buf_b = ""; var failures = 0; var _g_head = this.m_tests.h; while(_g_head != null) { var val = _g_head.item; _g_head = _g_head.next; var test = val; if(test.success == false) { buf_b += "* "; buf_b += Std.string(test.classname); buf_b += "::"; buf_b += Std.string(test.method); buf_b += "()"; buf_b += "\n"; buf_b += "ERR: "; if(test.posInfos != null) { buf_b += Std.string(test.posInfos.fileName); buf_b += ":"; buf_b += Std.string(test.posInfos.lineNumber); buf_b += "("; buf_b += Std.string(test.posInfos.className); buf_b += "."; buf_b += Std.string(test.posInfos.methodName); buf_b += ") - "; } buf_b += Std.string(test.error); buf_b += "\n"; if(test.backtrace != null) { buf_b += Std.string(test.backtrace); buf_b += "\n"; } buf_b += "\n"; ++failures; } } buf_b += "\n"; if(failures == 0) { buf_b += "OK "; } else { buf_b += "FAILED "; } buf_b += Std.string(this.m_tests.length); buf_b += " tests, "; buf_b += failures == null ? "null" : "" + failures; buf_b += " failed, "; buf_b += Std.string(this.m_tests.length - failures); buf_b += " success"; buf_b += "\n"; return buf_b; } ,__class__: haxe_unit_TestResult }; var haxe_unit_TestRunner = function() { this.result = new haxe_unit_TestResult(); this.cases = new List(); }; haxe_unit_TestRunner.__name__ = ["haxe","unit","TestRunner"]; haxe_unit_TestRunner.print = function(v) { var msg = js_Boot.__string_rec(v,""); var d; var tmp; if(typeof(document) != "undefined") { d = document.getElementById("haxe:trace"); tmp = d != null; } else { tmp = false; } if(tmp) { msg = StringTools.htmlEscape(msg).split("\n").join("<br/>"); d.innerHTML += msg + "<br/>"; } else if(typeof process != "undefined" && process.stdout != null && process.stdout.write != null) { process.stdout.write(msg); } else if(typeof console != "undefined" && console.log != null) { console.log(msg); } }; haxe_unit_TestRunner.customTrace = function(v,p) { haxe_unit_TestRunner.print(p.fileName + ":" + p.lineNumber + ": " + Std.string(v) + "\n"); }; haxe_unit_TestRunner.prototype = { result: null ,cases: null ,add: function(c) { this.cases.add(c); } ,run: function() { this.result = new haxe_unit_TestResult(); var _g_head = this.cases.h; while(_g_head != null) { var val = _g_head.item; _g_head = _g_head.next; var c = val; this.runCase(c); } haxe_unit_TestRunner.print(this.result.toString()); return this.result.success; } ,runCase: function(t) { var old = haxe_Log.trace; haxe_Log.trace = haxe_unit_TestRunner.customTrace; var cl = t == null ? null : js_Boot.getClass(t); var fields = Type.getInstanceFields(cl); haxe_unit_TestRunner.print("Class: " + Type.getClassName(cl) + " "); var _g = 0; while(_g < fields.length) { var f = fields[_g]; ++_g; var fname = f; var field = Reflect.field(t,f); if(StringTools.startsWith(fname,"test") && Reflect.isFunction(field)) { t.currentTest = new haxe_unit_TestStatus(); t.currentTest.classname = Type.getClassName(cl); t.currentTest.method = fname; t.setup(); try { var args = []; field.apply(t,args); if(t.currentTest.done) { t.currentTest.success = true; haxe_unit_TestRunner.print("."); } else { t.currentTest.success = false; t.currentTest.error = "(warning) no assert"; haxe_unit_TestRunner.print("W"); } } catch( $e0 ) { haxe_CallStack.lastException = $e0; if ($e0 instanceof js__$Boot_HaxeError) $e0 = $e0.val; if( js_Boot.__instanceof($e0,haxe_unit_TestStatus) ) { var e = $e0; haxe_unit_TestRunner.print("F"); var tmp = haxe_CallStack.exceptionStack(); t.currentTest.backtrace = haxe_CallStack.toString(tmp); } else { var e1 = $e0; haxe_unit_TestRunner.print("E"); if(e1.message != null) { t.currentTest.error = "exception thrown : " + Std.string(e1) + " [" + Std.string(e1.message) + "]"; } else { t.currentTest.error = "exception thrown : " + Std.string(e1); } var tmp1 = haxe_CallStack.exceptionStack(); t.currentTest.backtrace = haxe_CallStack.toString(tmp1); } } this.result.add(t.currentTest); t.tearDown(); } } haxe_unit_TestRunner.print("\n"); haxe_Log.trace = old; } ,__class__: haxe_unit_TestRunner }; var haxe_unit_TestStatus = function() { this.done = false; this.success = false; }; haxe_unit_TestStatus.__name__ = ["haxe","unit","TestStatus"]; haxe_unit_TestStatus.prototype = { done: null ,success: null ,error: null ,method: null ,classname: null ,posInfos: null ,backtrace: null ,__class__: haxe_unit_TestStatus }; var haxeshim_ServerKind = { __ename__ : true, __constructs__ : ["Port","Stdio"] }; haxeshim_ServerKind.Port = function(num) { var $x = ["Port",0,num]; $x.__enum__ = haxeshim_ServerKind; $x.toString = $estr; return $x; }; haxeshim_ServerKind.Stdio = ["Stdio",1]; haxeshim_ServerKind.Stdio.toString = $estr; haxeshim_ServerKind.Stdio.__enum__ = haxeshim_ServerKind; var haxeshim_StdioState = { __ename__ : true, __constructs__ : ["AwaitingHeader","AwaitingData"] }; haxeshim_StdioState.AwaitingHeader = function(buf) { var $x = ["AwaitingHeader",0,buf]; $x.__enum__ = haxeshim_StdioState; $x.toString = $estr; return $x; }; haxeshim_StdioState.AwaitingData = function(buf,total) { var $x = ["AwaitingData",1,buf,total]; $x.__enum__ = haxeshim_StdioState; $x.toString = $estr; return $x; }; var haxeshim_CompilerServer = function(kind,scope,args) { this.freePort = tink_core__$Future_Future_$Impl_$.async(function(cb) { var test = js_node_Net.createServer(); test.listen(0,function() { var port = test.address().port; test.close(function() { cb(tink_core_Outcome.Success(port)); }); }); },true); this.args = args; this.scope = scope; switch(kind[1]) { case 0: var port1 = kind[2]; this.waitOnPort(port1); break; case 1: this.stdio(); break; } }; haxeshim_CompilerServer.__name__ = ["haxeshim","CompilerServer"]; haxeshim_CompilerServer.prototype = { scope: null ,waiting: null ,lastVersion: null ,args: null ,freePort: null ,stdio: function() { var _gthis = this; js_node_Fs.watch(this.scope.configFile,{ persistent : false},function(_,_1) { _gthis.scope.reload(); }); var child = null; var quit = function() { if(child != null) { child.kill(); } }; process.on("exit",quit); var cleanExit = function() { process.exit(); }; process.on("SIGINT",cleanExit); process.on("SIGTERM",cleanExit); process.stdin.on("end",quit); process.stdin.on("close",quit); var state = haxeshim_StdioState.AwaitingHeader(new js_node_buffer_Buffer(0)); var frame = function(payload) { var ret = new js_node_buffer_Buffer(4 + payload.length); ret.writeInt32LE(payload.length,0); payload.copy(ret,4); return ret; }; var processData = function(data) { var postfix = new js_node_buffer_Buffer(0); var _g = data.indexOf(1); var ctx; if(_g == -1) { ctx = data; } else { var v = _g; postfix = data.slice(v); ctx = data.slice(0,v); } var ctx1 = _gthis.parseArgs(ctx); if(child == null || ctx1.version != _gthis.lastVersion) { if(child != null) { child.kill(); child.stderr.unpipe(process.stderr); } _gthis.lastVersion = ctx1.version; var hx = _gthis.scope.haxeInstallation; child = js_node_ChildProcess.spawn(hx.compiler,_gthis.args.concat(["--wait","stdio"]),{ cwd : _gthis.scope.cwd, env : haxeshim__$Env_Env_$Impl_$.toVars(haxeshim_Exec.mergeEnv(hx.env())), stdio : "pipe"}); var old = child; child.on("exit",function(code,_2) { if(child == old) { child = null; } }); child.stderr.pipe(process.stderr); } var first = new js_node_buffer_Buffer(haxeshim_HaxeCli.checkClassPaths(_gthis.scope.resolve(ctx1.args)).join("\n")); var child1 = child.stdin; var processData1 = js_node_buffer_Buffer.concat([first,postfix]); child1.write(frame(processData1)); }; var reduce = function() { while(true) { var next; switch(state[1]) { case 0: var buf = state[2]; if(buf.length >= 4) { next = haxeshim_StdioState.AwaitingData(buf.slice(4),buf.readInt32LE(0)); } else { next = state; } break; case 1: var total = state[3]; var buf1 = state[2]; if(buf1.length >= total) { var next1 = buf1.slice(0,total); processData(next1); next = haxeshim_StdioState.AwaitingHeader(buf1.slice(total)); } else { next = state; } break; default: next = state; } if(state == next) { break; } state = next; } }; process.stdin.on("data",function(chunk) { switch(state[1]) { case 0: var buf2 = state[2]; state = haxeshim_StdioState.AwaitingHeader(js_node_buffer_Buffer.concat([buf2,chunk])); break; case 1: var left = state[3]; var buf3 = state[2]; state = haxeshim_StdioState.AwaitingData(js_node_buffer_Buffer.concat([buf3,chunk]),left); break; } reduce(); }); } ,parseArgs: function(raw) { var args = raw.toString().split("\n"); var version; var _g = args.indexOf("--haxe-version"); if(_g == -1) { if(this.lastVersion == null) { version = this.scope.haxeInstallation.version; } else { version = this.lastVersion; } } else { var v = _g; version = args.splice(v,2).pop(); } return { version : version, args : args}; } ,waitOnPort: function(port) { var _gthis = this; var server = js_node_Net.createServer(function(cnx) { var buf = []; cnx.on("data",function(chunk) { var _g = chunk.indexOf(0); if(_g == -1) { buf.push(chunk); } else { var v = _g; var server1 = chunk.slice(0,v); buf.push(server1); var server2 = chunk.slice(v + 1); cnx.unshift(server2); var args = js_node_buffer_Buffer.concat(buf).toString().split("\n"); buf = []; var version; var _g1 = args.indexOf("--haxe-version"); if(_g1 == -1) { if(_gthis.lastVersion == null) { version = _gthis.scope.haxeInstallation.version; } else { version = _gthis.lastVersion; } } else { var v1 = _g1; version = args.splice(v1,2).pop(); } _gthis.connect(version).handle(function(o) { switch(o[1]) { case 0: var compiler = o[2]; compiler.write(args.join("\n") + String.fromCharCode(0)); compiler.pipe(cnx,{ end : true}); break; case 1: var e = o[2]; cnx.end(e.message + "\n" + "\x02" + "\n","utf8"); break; } }); } }); cnx.on("error",function() { }); cnx.on("end",function() { }); }); server.listen(port); } ,disconnect: function() { if(this.waiting == null) { return new tink_core__$Future_FutureBase(null,null,tink_core_Outcome.Success(tink_core_Noise.Noise)); } else { return tink_core__$Promise_Promise_$Impl_$.next(this.waiting,function(w) { var ret = w.kill().map(tink_core_Outcome.Success); return ret.gather(); }); } } ,connect: function(version) { var _gthis = this; if(version != this.lastVersion || this.waiting == null) { this.lastVersion = version; var nu = this.waiting = tink_core__$Promise_Promise_$Impl_$.next(this.disconnect(),function(_) { return tink_core__$Promise_Promise_$Impl_$.next(_gthis.freePort,tink_core__$Promise_Next_$Impl_$.ofSafeSync(function(port) { var installation = _gthis.scope.getInstallation(version); var proc = haxeshim_Exec.async(installation.compiler,_gthis.scope.cwd,_gthis.args.concat(["--wait",port == null ? "null" : "" + port]),installation.env()); return { died : tink_core__$Future_Future_$Impl_$.async(function(cb) { var f = cb; var nu1 = function() { f(tink_core_Noise.Noise); }; proc.on("exit",nu1); var f1 = cb; var nu2 = function() { f1(tink_core_Noise.Noise); }; proc.on("error",nu2); var f2 = cb; var nu3 = function() { f2(tink_core_Noise.Noise); }; proc.on("disconnect",nu3); }), version : version, socket : function() { return tink_core__$Future_Future_$Impl_$.async(function(cb1) { var max = 10; var connect = null; connect = function(attempt) { var cnx = js_node_Net.createConnection(port,"127.0.0.1"); cnx.on("error",function(e) { if(attempt >= max) { var connect1 = tink_core_Outcome.Failure(new tink_core_TypedError(null,"Failed to connect to 127.0.0.1:" + port + " after " + max + " attempts because " + e,{ fileName : "CompilerServer.hx", lineNumber : 257, className : "haxeshim.CompilerServer", methodName : "connect"})); cb1(connect1); } else { var f3 = connect; var a1 = attempt + 1; haxe_Timer.delay(function() { f3(a1); return; },100); } }).on("connect",function() { cb1(tink_core_Outcome.Success(cnx)); }); }; var connect2 = connect; connect2(1); }); }, kill : function() { proc.kill(); return tink_core__$Future_Future_$Impl_$.async(function(cb2) { var f4 = cb2; haxe_Timer.delay(function() { f4(tink_core_Noise.Noise); },500); }); }}; })); }); this.waiting.handle(function(o) { switch(o[1]) { case 0: var w = o[2]; w.died.handle(tink_core__$Callback_Callback_$Impl_$.fromNiladic(function() { if(_gthis.waiting == nu) { _gthis.waiting = null; } })); break; case 1: _gthis.waiting = null; break; } }); } return tink_core__$Promise_Promise_$Impl_$.next(this.waiting,function(w1) { return w1.socket(); }); } ,__class__: haxeshim_CompilerServer }; var haxeshim__$Env_Env_$Impl_$ = {}; haxeshim__$Env_Env_$Impl_$.__name__ = ["haxeshim","_Env","Env_Impl_"]; haxeshim__$Env_Env_$Impl_$.ofVars = function(vars) { var this1 = { }; var ret = this1; var _g = 0; var _g1 = Reflect.fields(vars); while(_g < _g1.length) { var k = _g1[_g]; ++_g; ret[haxeshim_Os.IS_WINDOWS ? k.toUpperCase() : k] = vars[k]; } var this2 = ret; return this2; }; haxeshim__$Env_Env_$Impl_$.keys = function(this1) { if(this1 == null) { return []; } else { return Reflect.fields(this1); } }; haxeshim__$Env_Env_$Impl_$.ofMap = function(map) { var this1 = { }; var ret = this1; var k = map.keys(); while(k.hasNext()) { var k1 = k.next(); ret[haxeshim_Os.IS_WINDOWS ? k1.toUpperCase() : k1] = __map_reserved[k1] != null ? map.getReserved(k1) : map.h[k1]; } var this2 = ret; return this2; }; haxeshim__$Env_Env_$Impl_$.vars = function(this1) { return this1; }; haxeshim__$Env_Env_$Impl_$.toVars = function(this1) { return Reflect.copy(this1); }; haxeshim__$Env_Env_$Impl_$._new = function(vars) { var this1 = vars; return this1; }; haxeshim__$Env_Env_$Impl_$.get = function(this1,s) { return this1[haxeshim_Os.IS_WINDOWS ? s.toUpperCase() : s]; }; haxeshim__$Env_Env_$Impl_$.normalize = function(s) { if(haxeshim_Os.IS_WINDOWS) { return s.toUpperCase(); } else { return s; } }; haxeshim__$Env_Env_$Impl_$.mergeInto = function(this1,that) { var _g = haxeshim__$Env_Env_$Impl_$.vars(that); if(this1 == null) { var v = _g; var this2 = v; return this2; } else if(_g == null) { var v1 = this1; var this3 = v1; return this3; } else { var a = this1; var b = _g; var this4 = { }; var ret = this4; var _g1 = 0; var _g11 = [b,a]; while(_g1 < _g11.length) { var vars = _g11[_g1]; ++_g1; var _g2 = 0; var _g3 = Reflect.fields(vars); while(_g2 < _g3.length) { var k = _g3[_g2]; ++_g2; ret[k] = vars[k]; } } var this5 = ret; return this5; } }; var haxeshim_Exec = function() { }; haxeshim_Exec.__name__ = ["haxeshim","Exec"]; haxeshim_Exec.die = function(code,reason) { new _$Sys_FileOutput(2).writeString("" + reason + "\n"); process.exit(code); throw new js__$Boot_HaxeError("unreachable"); }; haxeshim_Exec.gracefully = function(f) { try { return f(); } catch( $e0 ) { haxe_CallStack.lastException = $e0; if ($e0 instanceof js__$Boot_HaxeError) $e0 = $e0.val; if( js_Boot.__instanceof($e0,tink_core_TypedError) ) { var e = $e0; return haxeshim_Exec.die(e.code,e.message); } else { var e1 = $e0; return haxeshim_Exec.die(500,Std.string(e1)); } } }; haxeshim_Exec.mergeEnv = function(env) { return haxeshim__$Env_Env_$Impl_$.mergeInto(env,haxeshim__$Env_Env_$Impl_$.ofVars(process.env)); }; haxeshim_Exec.async = function(cmd,cwd,args,env) { return js_node_ChildProcess.spawn(cmd,args,{ cwd : cwd, stdio : "inherit", env : haxeshim__$Env_Env_$Impl_$.toVars(haxeshim_Exec.mergeEnv(env))}); }; haxeshim_Exec.shell = function(cmd,cwd,env) { try { return tink_core_Outcome.Success(js_node_ChildProcess.execSync(cmd,{ cwd : cwd, stdio : "inherit", env : haxeshim__$Env_Env_$Impl_$.toVars(haxeshim_Exec.mergeEnv(env))})); } catch( e ) { haxe_CallStack.lastException = e; if (e instanceof js__$Boot_HaxeError) e = e.val; return tink_core_Outcome.Failure(new tink_core_TypedError(e.status,"Failed to invoke `" + cmd + "` because " + Std.string(e),{ fileName : "Exec.hx", lineNumber : 33, className : "haxeshim.Exec", methodName : "shell"})); } }; haxeshim_Exec.sync = function(cmd,cwd,args,env) { var _g = js_node_ChildProcess.spawnSync(cmd,args,{ cwd : cwd, stdio : "inherit", env : haxeshim__$Env_Env_$Impl_$.toVars(haxeshim_Exec.mergeEnv(env))}); var x = _g; if(x.error == null) { return tink_core_Outcome.Success(x.status); } else { var e = _g.error; return tink_core_Outcome.Failure(new tink_core_TypedError(null,"Failed to call " + cmd + " because " + Std.string(e),{ fileName : "Exec.hx", lineNumber : 40, className : "haxeshim.Exec", methodName : "sync"})); } }; haxeshim_Exec["eval"] = function(cmd,cwd,args,env) { var _g = js_node_ChildProcess.spawnSync(cmd,args,{ cwd : cwd, env : haxeshim__$Env_Env_$Impl_$.toVars(haxeshim_Exec.mergeEnv(env))}); var x = _g; if(x.error == null) { return tink_core_Outcome.Success({ status : x.status, stdout : x.stdout.toString(), stderr : x.stderr.toString()}); } else { var e = _g.error; return tink_core_Outcome.Failure(new tink_core_TypedError(null,"Failed to call " + cmd + " because " + Std.string(e),{ fileName : "Exec.hx", lineNumber : 52, className : "haxeshim.Exec", methodName : "eval"})); } }; var haxeshim_Fs = function() { }; haxeshim_Fs.__name__ = ["haxeshim","Fs"]; haxeshim_Fs.get = function(path,pos) { var _e = path; return new tink_core__$Future_FutureBase(null,null,tink_core_TypedError.catchExceptions(function() { return js_node_Fs.readFileSync(_e,{ encoding : "utf8"}); },function(data) { return tink_core_TypedError.withData(null,"failed to get content of " + path,data,pos); },{ fileName : "Fs.hx", lineNumber : 14, className : "haxeshim.Fs", methodName : "get"})); }; haxeshim_Fs.ensureDir = function(dir) { var isDir = StringTools.endsWith(dir,"/") || StringTools.endsWith(dir,"\\"); if(isDir) { dir = haxe_io_Path.removeTrailingSlashes(dir); } var parent = haxe_io_Path.directory(dir); if(haxe_io_Path.removeTrailingSlashes(parent) == dir) { return; } if(!sys_FileSystem.exists(parent)) { haxeshim_Fs.ensureDir(haxe_io_Path.addTrailingSlash(parent)); } if(isDir && !sys_FileSystem.exists(dir)) { sys_FileSystem.createDirectory(dir); } }; haxeshim_Fs.ifNewer = function(files) { return js_node_Fs.statSync(files.src).mtime.getTime() > js_node_Fs.statSync(files.dest).mtime.getTime(); }; haxeshim_Fs.copy = function(src,target,filter,overwrite) { var copy = null; copy = function(src1,target1,ensure) { if(filter == null || filter(src1)) { if(js_node_Fs.statSync(src1).isDirectory()) { haxeshim_Fs.ensureDir(haxe_io_Path.addTrailingSlash(target1)); var _g = 0; var _g1 = js_node_Fs.readdirSync(src1); while(_g < _g1.length) { var entry = _g1[_g]; ++_g; copy("" + src1 + "/" + entry,"" + target1 + "/" + entry,false); } } else { if(ensure) { haxeshim_Fs.ensureDir(target1); } if(!sys_FileSystem.exists(target1) || overwrite == null || overwrite({ src : src1, dest : target1})) { sys_io_File.copy(src1,target1); } } } }; var copy1 = copy; copy1(src,target,true); }; haxeshim_Fs.ls = function(dir,filter) { var _g = []; var _g1 = 0; var _g2 = js_node_Fs.readdirSync(dir); while(_g1 < _g2.length) { var entry = _g2[_g1]; ++_g1; var _g3 = "" + dir + "/" + entry; var included = _g3; var tmp; if(filter == null || filter(included)) { tmp = included; } else { continue; } _g.push(tmp); } return _g; }; haxeshim_Fs["delete"] = function(path) { if(js_node_Fs.statSync(path).isDirectory()) { var _g = 0; var _g1 = haxeshim_Fs.ls(path); while(_g < _g1.length) { var file = _g1[_g]; ++_g; haxeshim_Fs["delete"](file); } js_node_Fs.rmdirSync(path); } else { js_node_Fs.unlinkSync(path); } }; haxeshim_Fs.peel = function(file,depth) { var start = 0; var _g1 = 0; var _g = depth; while(_g1 < _g) { var i = _g1++; var _g2 = file.indexOf("/",start); if(_g2 == -1) { return haxe_ds_Option.None; } else { var v = _g2; start = v + 1; } } return haxe_ds_Option.Some(HxOverrides.substr(file,start,null)); }; haxeshim_Fs.findNearest = function(name,dir) { while(true) if(sys_FileSystem.exists("" + dir + "/" + name)) { return haxe_ds_Option.Some("" + dir + "/" + name); } else { var _g = haxe_io_Path.directory(dir); var same = _g; if(dir == same) { return haxe_ds_Option.None; } else { var parent = _g; dir = parent; } } }; var haxeshim_HaxeCli = function(scope) { this.scope = scope; }; haxeshim_HaxeCli.__name__ = ["haxeshim","HaxeCli"]; haxeshim_HaxeCli.main = function() { haxeshim_Neko.setEnv(); new haxeshim_HaxeCli(haxeshim_Exec.gracefully(function() { return haxeshim_Scope.seek(); })).dispatch(process.argv.slice(2)); }; haxeshim_HaxeCli.checkClassPaths = function(args) { var i = 0; var invalid = []; while(i < args.length) { var _g = args[i++]; if(_g == "-cp") { var cp = args[i++]; try { js_node_Fs.readdirSync(cp); } catch( e ) { haxe_CallStack.lastException = e; invalid.push("classpath " + cp + " is not a directory or cannot be read from"); } } } if(invalid.length != 0) { var v = invalid; haxeshim_Exec.die(404,invalid.join("\n")); } return args; }; haxeshim_HaxeCli.prototype = { scope: null ,installLibs: function(silent) { var i = this.scope.getInstallationInstructions(); var code = 0; var _g = i.missing; if(_g.length != 0) { var v = _g; c