From 0f664ba3767edb65940373b4972f7f0e3bf004fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Sat, 31 Aug 2024 23:36:41 +0200 Subject: [PATCH] Refresh the CLI script --- bin/php_minifier.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/php_minifier.js b/bin/php_minifier.js index 58c8b98..a4b0133 100755 --- a/bin/php_minifier.js +++ b/bin/php_minifier.js @@ -2,7 +2,7 @@ (function(at){"use strict";var g=function(){return se.__string_rec(this,"")},C=C||{},u;class He{constructor(e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&et?1:-1}static isEnumValue(e){return e!=null?e.__enum__!=null:!1}static copy(e){if(e==null)return null;let t={},n=0,r=U.fields(e);for(;n8&&n<14?!0:n==32}static ltrim(e){let t=e.length,n=0;for(;n0?R.substr(e,n,t-n):e}static rtrim(e){let t=e.length,n=0;for(;n0?R.substr(e,0,t-n):e}static trim(e){return D.ltrim(D.rtrim(e))}static lpad(e,t,n){if(t.length<=0)return e;let r="";for(n-=e.length;r.lengththis.length||n+r>t.length)throw N.thrown(re.OutsideBounds);n==0&&r==t.b.byteLength?this.b.set(t.b,e):this.b.set(t.b.subarray(n,n+r),e)}sub(e,t){if(e<0||t<0||e+t>this.length)throw N.thrown(re.OutsideBounds);return new L(this.b.buffer.slice(e+this.b.byteOffset,e+this.b.byteOffset+t))}getString(e,t,n){if(e<0||t<0||e+t>this.length)throw N.thrown(re.OutsideBounds);n==null&&(n=ye.UTF8);let r="",s=this.b,i=e,l=e+t;switch(n._hx_index){case 0:for(;i>8}return new L(s.buffer)}let n=[],r=0;for(;r>6),n.push(128|s&63)):s<=65535?(n.push(224|s>>12),n.push(128|s>>6&63),n.push(128|s&63)):(n.push(240|s>>18),n.push(128|s>>12&63),n.push(128|s>>6&63),n.push(128|s&63))}return new L(new Uint8Array(n).buffer)}static ofData(e){let t=e.hxBytes;return t??new L(e)}}L.__name__=!0;var ye=C["haxe.io.Encoding"]={__ename__:!0,__constructs__:null,UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding",toString:g},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding",toString:g}};ye.__constructs__=[ye.UTF8,ye.RawNative];class he{static encode(e,t){t==null&&(t=!0);let n=new _t(he.BYTES).encodeBytes(e).toString();if(t)switch(e.length%3){case 1:n+="==";break;case 2:n+="=";break;default:}return n}}he.__name__=!0;class _t{constructor(e){let t=e.length,n=1;for(;t>1<8||t!=1<>l&c]}return l>0&&(s.b[h++]=n.b[i<i+2){let l=e.left,c=e.right;return(l==null?0:l._height)>=(c==null?0:c._height)?new j(e.left,e.key,e.value,new j(e.right,t,n,r)):new j(new j(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new j(e.right.right,t,n,r))}else if(i>s+2){let l=r.right,c=r.left;return(l==null?0:l._height)>(c==null?0:c._height)?new j(new j(e,t,n,r.left),r.key,r.value,r.right):new j(new j(e,t,n,r.left.left),r.left.key,r.left.value,new j(r.left.right,r.key,r.value,r.right))}else return new j(e,t,n,r,(s>i?s:i)+1)}compare(e,t){return U.compare(e,t)}}ot.__name__=!0;class j{constructor(e,t,n,r,s){if(s==null&&(s=-1),this.left=e,this.key=t,this.value=n,this.right=r,s==-1){let i,l=this.left,c=this.right;if((l==null?0:l._height)>(c==null?0:c._height)){let _=this.left;i=_==null?0:_._height}else{let _=this.right;i=_==null?0:_._height}this._height=i+1}else this._height=s}}j.__name__=!0;class ht extends ot{constructor(){super()}compare(e,t){let n=e._hx_index-t._hx_index;if(n!=0)return n;let r=$e.enumParameters(e),s=$e.enumParameters(t);return r.length==0&&s.length==0?0:this.compareArgs(r,s)}compareArgs(e,t){let n=e.length-t.length;if(n!=0)return n;let r=0,s=e.length;for(;r=200&&F<400?m.success(m.responseBytes):m.onError("Http Error #"+F)})};this.req=n?wt.request(w,b):pt.request(w,b),e&&(this.postData!=null?this.req.write(this.postData):this.postBytes!=null&&(this.req.setHeader("Content-Length",""+this.postBytes.length),this.req.write(ie.from(this.postBytes.b.bufferValue)))),this.req.end()}}mt.__name__=!0;var re=C["haxe.io.Error"]={__ename__:!0,__constructs__:null,Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error",toString:g},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error",toString:g},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error",toString:g},Custom:(u=function(a){return{_hx_index:3,e:a,__enum__:"haxe.io.Error",toString:g}},u._hx_name="Custom",u.__params__=["e"],u)};re.__constructs__=[re.Blocked,re.Overflow,re.OutsideBounds,re.Custom];class T{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),n=e.lastIndexOf("\\");t0&&n[n.length-1]!=".."?n.pop():f==""?(n.length>0||R.cca(e,0)==47)&&n.push(f):f!="."&&n.push(f)}let i="",l=!1,c=!1,_=0,h=n.join(t);for(;_=55296&&x<=56319&&(x=x-55232<<10|f.charCodeAt(d+1)&1023);let w=x;w>=65536&&++_;let m=w;switch(m){case 47:if(!l)c=!0;else{let v=m;l=!1,c&&(i+="/",c=!1),i+=String.fromCodePoint(v)}break;case 58:i+=":",l=!0;break;default:let b=m;l=!1,c&&(i+="/",c=!1),i+=String.fromCodePoint(b)}}return i}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),n=e.lastIndexOf("\\");return t=5)return"<...>";let n=typeof e;switch(n=="function"&&(e.__name__||e.__ename__)&&(n="object"),n){case"function":return"";case"object":if(e.__enum__){let _=C[e.__enum__].__constructs__[e._hx_index],h=_._hx_name;return _.__params__?(t=t+" ",h+"("+function(f){var d;let x=[];{let w=0,m=_.__params__;for(;w0?",":"")+se.__string_rec(e[f],t)}return c+="]",c}let r;try{r=e.toString}catch{return"???"}if(r!=null&&r!=Object.toString&&typeof r=="function"){let c=e.toString();if(c!="[object Object]")return c}let s=`{ `;t+=" ";let i=e.hasOwnProperty!=null,l=null;for(l in e)i&&!e.hasOwnProperty(l)||l=="prototype"||l=="__class__"||l=="__super__"||l=="__interfaces__"||l=="__properties__"||(s.length!=2&&(s+=`, `),s+=t+l+" : "+se.__string_rec(e[l],t));return t=t.substring(1),s+=` -`+t+"}",s;case"string":return e;default:return String(e)}}}se.__name__=!0;var Ke=require("child_process"),Pe=require("fs"),pt=require("http"),wt=require("https"),an=require("net"),un=require("path"),ie=require("buffer").Buffer;class xt{static bytesOfBuffer(e){let t=Object.create(L.prototype);return t.length=e.byteLength,t.b=e,e.bufferValue=e,e.hxBytes=t,e.bytes=e,t}}xt.__name__=!0;var cn=require("url").URL;class St{constructor(e){e==null&&(e="php"),this.process=null,this.port=-1,this.executable=T.normalize(e)}close(){let e=this.process;return e?.kill(),this.process=null,new k(new p(o.Success(null)))}transform(e){let t=this;return E.next(E.next(this.listen(),function(n){return on.all(ee.fetch(q.fromString("http://127.0.0.1:"+t.port+"/index.php?"+new Zt().stringify({file:K.absolutePath(e)})),null))}),function(n){return new k(new p(o.Success(n.body.toString())))})}getPort(){let e=new Fe,t=an.createServer().on("error",function(n){let r=P.withData(500,n.message,n,{fileName:"src/php_minifier/FastTransformer.hx",lineNumber:47,className:"php_minifier.FastTransformer",methodName:"getPort"});return e.trigger(o.Failure(r))});return t.listen(0,"127.0.0.1",function(){let n=t.address().port;t.close(function(){e.trigger(o.Success(n))})}),t.unref(),e}listen(){let e=this;return this.process!=null?new k(new p(o.Success(null))):E.next(this.getPort(),function(t){let n=new Fe;e.port=t;let r=e.executable,s="127.0.0.1:"+e.port,i=T.join([__dirname,"../www"]);return e.process=Ke.spawn(r,["-S",s,"-t",i],{stdio:["ignore","pipe","ignore"]}).on("error",function(l){let c=P.withData(500,l.message,l,{fileName:"src/php_minifier/FastTransformer.hx",lineNumber:64,className:"php_minifier.FastTransformer",methodName:"listen"});return n.trigger(o.Failure(c))}).on("spawn",function(){let l=S.delay(1e3,new p(null)),c=n;return l.handle(function(_){return c.trigger(o.Success(_))})}),n})}}St.__name__=!0;class ve{static get_packageVersion(){return ve.packageVersion==null&&(ve.packageVersion="4.0.0"),ve.packageVersion}}ve.__name__=!0;class Ie{constructor(){this.version=!1,this.help=!1,this.silent=!1,this.mode="safe",this.extension="php",this.binary="php"}run(e){if(this.help||this.version){let l=this.version?ve.get_packageVersion():new Nt().format(Ne.get());return process.stdout.write(B.string(l)),process.stdout.write(` +`+t+"}",s;case"string":return e;default:return String(e)}}}se.__name__=!0;var Ke=require("child_process"),Pe=require("fs"),pt=require("http"),wt=require("https"),an=require("net"),un=require("path"),ie=require("buffer").Buffer;class xt{static bytesOfBuffer(e){let t=Object.create(L.prototype);return t.length=e.byteLength,t.b=e,e.bufferValue=e,e.hxBytes=t,e.bytes=e,t}}xt.__name__=!0;var cn=require("url").URL;class St{constructor(e){e==null&&(e="php"),this.process=null,this.port=-1,this.executable=T.normalize(e)}close(){let e=this.process;return e?.kill(),this.process=null,new k(new p(o.Success(null)))}transform(e){let t=this;return E.next(E.next(this.listen(),function(n){return on.all(ee.fetch(q.fromString("http://127.0.0.1:"+t.port+"/index.php?"+new Zt().stringify({file:K.absolutePath(e)})),null))}),function(n){return new k(new p(o.Success(n.body.toString())))})}getPort(){let e=new Fe,t=an.createServer().on("error",function(n){let r=P.withData(500,n.message,n,{fileName:"src/php_minifier/FastTransformer.hx",lineNumber:47,className:"php_minifier.FastTransformer",methodName:"getPort"});return e.trigger(o.Failure(r))});return t.listen(0,"127.0.0.1",function(){let n=t.address().port;t.close(function(){e.trigger(o.Success(n))})}),t.unref(),e}listen(){let e=this;return this.process!=null?new k(new p(o.Success(null))):E.next(this.getPort(),function(t){let n=new Fe;e.port=t;let r=e.executable,s="127.0.0.1:"+e.port,i=T.join([__dirname,"../www"]);return e.process=Ke.spawn(r,["-S",s,"-t",i],{stdio:["ignore","pipe","ignore"]}).on("error",function(l){let c=P.withData(500,l.message,l,{fileName:"src/php_minifier/FastTransformer.hx",lineNumber:64,className:"php_minifier.FastTransformer",methodName:"listen"});return n.trigger(o.Failure(c))}).on("spawn",function(){let l=S.delay(1e3,new p(null)),c=n;return l.handle(function(_){return c.trigger(o.Success(_))})}),n})}}St.__name__=!0;class ve{static get_packageVersion(){return ve.packageVersion==null&&(ve.packageVersion="4.0.1"),ve.packageVersion}}ve.__name__=!0;class Ie{constructor(){this.version=!1,this.help=!1,this.silent=!1,this.mode="safe",this.extension="php",this.binary="php"}run(e){if(this.help||this.version){let l=this.version?ve.get_packageVersion():new Nt().format(Ne.get());return process.stdout.write(B.string(l)),process.stdout.write(` `),new k(new p(o.Success(null)))}let t=process.env.HAXELIB_RUN=="1";if(e.length<(t?2:1))return new k(new p(o.Failure(new P(400,"You must provide the path to the input directory.",{fileName:"src/php_minifier/Program.hx",lineNumber:60,className:"php_minifier.Program",methodName:"run"}))));let n=t?e.pop():T.addTrailingSlash(process.cwd()),r=this.resolvePath(e.shift(),n),s=e.length>0?this.resolvePath(e.shift(),n):r,i=this;return S.flatMap(K.exists(r),function(l){if(l){let c=T.addTrailingSlash(r).length,_=i,h=r,f=s,d=i.listDirectory(r),x=new Array(d.length),w=0,m=d.length;for(;w0&&l.charAt(0)!="/"&&(l="/"+l),{scheme:n.matched(2),payload:n.matched(3),hosts:s,auth:n.matched(6),path:Ce.ofString(l),query:n.matched(10),hash:n.matched(12)}}}static make(e){let t={payload:"",path:e.path,query:e.query,hosts:e.hosts,auth:e.auth,scheme:e.scheme,hash:e.hash};return q.makePayload(t),t}}class fe extends qe{constructor(e,t,n){super(),this.data=e,this.from=t,this.to=n}flatten(e){e.push(this)}getLength(){return this.to-this.from}getSlice(e,t){return t>this.to-this.from&&(t=this.to-this.from),e<0&&(e=0),t<=e?null:t==this.to-this.from&&e==0?this:new fe(this.data,this.from+e,t+this.from)}slice(e,t){let n=this.getSlice(e,t);return n??I.EMPTY}blitTo(e,t){this.wrapped==null&&(this.wrapped=L.ofData(this.data)),e.blit(t,this.wrapped,this.from,this.to-this.from)}toBytes(){return this.wrapped==null&&(this.wrapped=L.ofData(this.data)),this.wrapped.sub(this.from,this.to-this.from)}toString(){return this.wrapped==null&&(this.wrapped=L.ofData(this.data)),this.wrapped.getString(this.from,this.to-this.from)}static of(e){if(e.length==0)return I.EMPTY;let t=new fe(e.b.bufferValue,0,e.length);return t.wrapped=e,t}}fe.__name__=!0;class Me{constructor(){this.currentByte=-1,this.currentPos=0,this.length=0,this.curLength=0,this.curOffset=0,this.curPartIndex=0}reset(){this.length=0,this.currentPos=0,this.currentByte=-1,this.curOffset=0;let e=0,t=this.parts;for(;e0&&(e[0]=this.curPart.slice(this.curOffset,this.curLength)),I.join(e)}ffwd(){this.currentByte=-1,this.curLength=0,this.curOffset=0,this.curPart=null,this.curPartIndex=this.parts.length}next(){if(this.currentPos==this.length)return!1;if(this.currentPos++,this.currentPos==this.length)return this.ffwd(),!1;if(this.curOffset==this.curLength-1){this.curOffset=0,this.curPart=this.parts[++this.curPartIndex];let e=this.curPart;this.curLength=e.to-e.from;let t=this.curPart;this.currentByte=t.data.bytes[t.from]}else{let e=this.curPart;this.currentByte=e.data.bytes[e.from+ ++this.curOffset]}return!0}static create(e){let t=new Me;return t.parts=e,t.reset(),t}}Me.__name__=!0;class z extends qe{constructor(){super()}getLength(){return this.length}flatten(e){let t=0,n=this.chunks;for(;ti.depth?s.depth:i.depth;return z.create(s.chunks.concat(i.chunks),l)}}}static create(e,t){let n=new z,r=[0],s=0,i=0;for(;i