isomorfeus-asset-manager 0.14.21 → 0.14.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,17 @@
1
1
  (module=>{
2
- var ke=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ae=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Ne=(e,t)=>lt(e,st(t)),ut=e=>ke(e,"__esModule",{value:!0});var ft=(e,t)=>{for(var r in t)ke(e,r,{get:t[r],enumerable:!0})},ct=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ot(t))!Ke.call(e,u)&&(r||u!=="default")&&ke(e,u,{get:()=>t[u],enumerable:!(i=it(t,u))||i.enumerable});return e};var dt=(e=>(t,r)=>e&&e.get(t)||(r=ct(ut({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var de=(e,t,r)=>new Promise((i,u)=>{var l=d=>{try{s(r.next(d))}catch(O){u(O)}},c=d=>{try{s(r.throw(d))}catch(O){u(O)}},s=d=>d.done?i(d.value):Promise.resolve(d.value).then(l,c);s((r=r.apply(e,t)).next())});var Be={};ft(Be,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Bt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>Tt,initialize:()=>Dt,serve:()=>kt,transform:()=>Et,transformSync:()=>Pt,version:()=>St});function je(e){let t=i=>{if(i===null)r.write8(0);else if(typeof i=="boolean")r.write8(1),r.write8(+i);else if(typeof i=="number")r.write8(2),r.write32(i|0);else if(typeof i=="string")r.write8(3),r.write(pe(i));else if(i instanceof Uint8Array)r.write8(4),r.write(i);else if(i instanceof Array){r.write8(5),r.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);r.write8(6),r.write32(u.length);for(let l of u)r.write(pe(l)),t(i[l])}},r=new Le;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return he(r.read());case 4:return r.read();case 5:{let c=r.read32(),s=[];for(let d=0;d<c;d++)s.push(t());return s}case 6:{let c=r.read32(),s={};for(let d=0;d<c;d++)s[he(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new Le(e),i=r.read32(),u=(i&1)===0;i>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:u,value:l}}var Le=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);Fe(this.buf,t,r)}write(t){let r=this._write(4+t.length);Fe(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Ue(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),i=this._read(r.length);return r.set(this.buf.subarray(i,i+t)),r}},pe,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;pe=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")pe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=e=>{let{buffer:t,byteOffset:r,byteLength:i}=e;return Buffer.from(t,r,i).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Fe(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",gt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",Ce=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",qe=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ge=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,i){let u=e[r];if(t[r+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`"${r}" must be ${l}`);return u}function J(e,t,r){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${r}: "${i}"`)}function Qe(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),i=n(e,t,"worker",I);return J(e,t,"in startService() call"),{wasmURL:r,worker:i}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let i=e[r];if(typeof i=="string"||i===!1)t[r]=i;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Pe(e,t,r,i,u){let l=n(t,r,"color",I),c=n(t,r,"logLevel",y),s=n(t,r,"logLimit",Oe);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${s||0}`)}function Ze(e,t,r){let i=n(t,r,"legalComments",y),u=n(t,r,"sourceRoot",y),l=n(t,r,"sourcesContent",I),c=n(t,r,"target",ht),s=n(t,r,"format",y),d=n(t,r,"globalName",y),O=n(t,r,"mangleProps",Ce),T=n(t,r,"reserveProps",Ce),L=n(t,r,"minify",I),x=n(t,r,"minifySyntax",I),S=n(t,r,"minifyWhitespace",I),ae=n(t,r,"minifyIdentifiers",I),re=n(t,r,"drop",_),le=n(t,r,"charset",y),ie=n(t,r,"treeShaking",I),ue=n(t,r,"ignoreAnnotations",I),fe=n(t,r,"jsx",y),ce=n(t,r,"jsxFactory",y),ye=n(t,r,"jsxFragment",y),se=n(t,r,"define",me),we=n(t,r,"pure",_),xe=n(t,r,"keepNames",I);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),s&&e.push(`--format=${s}`),d&&e.push(`--global-name=${d}`),L&&e.push("--minify"),x&&e.push("--minify-syntax"),S&&e.push("--minify-whitespace"),ae&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),ue&&e.push("--ignore-annotations"),re)for(let te of re)e.push(`--drop:${te}`);if(O&&e.push(`--mangle-props=${O.source}`),T&&e.push(`--reserve-props=${T.source}`),fe&&e.push(`--jsx=${fe}`),ce&&e.push(`--jsx-factory=${ce}`),ye&&e.push(`--jsx-fragment=${ye}`),se)for(let te in se){if(te.indexOf("=")>=0)throw new Error(`Invalid define: ${te}`);e.push(`--define:${te}=${se[te]}`)}if(we)for(let te of we)e.push(`--pure:${te}`);xe&&e.push("--keep-names")}function wt(e,t,r,i,u){var w;let l=[],c=[],s=Object.create(null),d=null,O=null,T=null;Pe(l,t,s,r,i),Ze(l,t,s);let L=n(t,s,"sourcemap",Ge),x=n(t,s,"bundle",I),S=n(t,s,"watch",gt),ae=n(t,s,"splitting",I),re=n(t,s,"preserveSymlinks",I),le=n(t,s,"metafile",I),ie=n(t,s,"outfile",y),ue=n(t,s,"outdir",y),fe=n(t,s,"outbase",y),ce=n(t,s,"platform",y),ye=n(t,s,"tsconfig",y),se=n(t,s,"resolveExtensions",_),we=n(t,s,"nodePaths",_),xe=n(t,s,"mainFields",_),te=n(t,s,"conditions",_),m=n(t,s,"external",_),f=n(t,s,"loader",me),a=n(t,s,"outExtension",me),p=n(t,s,"publicPath",y),F=n(t,s,"entryNames",y),D=n(t,s,"chunkNames",y),C=n(t,s,"assetNames",y),E=n(t,s,"inject",_),B=n(t,s,"banner",me),P=n(t,s,"footer",me),R=n(t,s,"entryPoints",mt),U=n(t,s,"absWorkingDir",y),k=n(t,s,"stdin",me),A=(w=n(t,s,"write",I))!=null?w:u,q=n(t,s,"allowOverwrite",I),ee=n(t,s,"incremental",I)===!0,$=n(t,s,"mangleCache",me);if(s.plugins=!0,J(t,s,`in ${e}() call`),L&&l.push(`--sourcemap${L===!0?"":`=${L}`}`),x&&l.push("--bundle"),q&&l.push("--allow-overwrite"),S)if(l.push("--watch"),typeof S=="boolean")T={};else{let o=Object.create(null),v=n(S,o,"onRebuild",qe);J(S,o,`on "watch" in ${e}() call`),T={onRebuild:v}}if(ae&&l.push("--splitting"),re&&l.push("--preserve-symlinks"),le&&l.push("--metafile"),ie&&l.push(`--outfile=${ie}`),ue&&l.push(`--outdir=${ue}`),fe&&l.push(`--outbase=${fe}`),ce&&l.push(`--platform=${ce}`),ye&&l.push(`--tsconfig=${ye}`),se){let o=[];for(let v of se){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);o.push(v)}l.push(`--resolve-extensions=${o.join(",")}`)}if(p&&l.push(`--public-path=${p}`),F&&l.push(`--entry-names=${F}`),D&&l.push(`--chunk-names=${D}`),C&&l.push(`--asset-names=${C}`),xe){let o=[];for(let v of xe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);o.push(v)}l.push(`--main-fields=${o.join(",")}`)}if(te){let o=[];for(let v of te){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);o.push(v)}l.push(`--conditions=${o.join(",")}`)}if(m)for(let o of m)l.push(`--external:${o}`);if(B)for(let o in B){if(o.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${o}`);l.push(`--banner:${o}=${B[o]}`)}if(P)for(let o in P){if(o.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${o}`);l.push(`--footer:${o}=${P[o]}`)}if(E)for(let o of E)l.push(`--inject:${o}`);if(f)for(let o in f){if(o.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${o}`);l.push(`--loader:${o}=${f[o]}`)}if(a)for(let o in a){if(o.indexOf("=")>=0)throw new Error(`Invalid out extension: ${o}`);l.push(`--out-extension:${o}=${a[o]}`)}if(R)if(Array.isArray(R))for(let o of R)c.push(["",o+""]);else for(let[o,v]of Object.entries(R))c.push([o+"",v+""]);if(k){let o=Object.create(null),v=n(k,o,"contents",y),Y=n(k,o,"resolveDir",y),h=n(k,o,"sourcefile",y),g=n(k,o,"loader",y);J(k,o,'in "stdin" object'),h&&l.push(`--sourcefile=${h}`),g&&l.push(`--loader=${g}`),Y&&(O=Y+""),d=v?v+"":""}let b=[];if(we)for(let o of we)o+="",b.push(o);return{entries:c,flags:l,write:A,stdinContents:d,stdinResolveDir:O,absWorkingDir:U,incremental:ee,nodePaths:b,watch:T,mangleCache:Xe($)}}function vt(e,t,r,i){let u=[],l=Object.create(null);Pe(u,t,l,r,i),Ze(u,t,l);let c=n(t,l,"sourcemap",Ge),s=n(t,l,"tsconfigRaw",yt),d=n(t,l,"sourcefile",y),O=n(t,l,"loader",y),T=n(t,l,"banner",y),L=n(t,l,"footer",y),x=n(t,l,"mangleCache",me);return J(t,l,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),s&&u.push(`--tsconfig-raw=${typeof s=="string"?s:JSON.stringify(s)}`),d&&u.push(`--sourcefile=${d}`),O&&u.push(`--loader=${O}`),T&&u.push(`--banner=${T}`),L&&u.push(`--footer=${L}`),{flags:u,mangleCache:Xe(x)}}function et(e){let t=new Map,r=new Map,i=new Map,u=new Map,l=!1,c=0,s=0,d=new Uint8Array(16*1024),O=0,T=m=>{let f=O+m.length;if(f>d.length){let p=new Uint8Array(f*2);p.set(d),d=p}d.set(m,O),O+=m.length;let a=0;for(;a+4<=O;){let p=Ue(d,a);if(a+4+p>O)break;a+=4,le(d.subarray(a,a+p)),a+=p}a>0&&(d.copyWithin(0,a,O),O-=a)},L=()=>{l=!0;for(let m of t.values())m("The service was stopped",null);t.clear();for(let m of u.values())m.onWait("The service was stopped");u.clear();for(let m of i.values())try{m(new Error("The service was stopped"),null)}catch(f){console.error(f)}i.clear()},x=(m,f,a)=>{if(l)return a("The service is no longer running",null);let p=c++;t.set(p,(F,D)=>{try{a(F,D)}finally{m&&m.unref()}}),m&&m.ref(),e.writeToStdin(je({id:p,isRequest:!0,value:f}))},S=(m,f)=>{if(l)throw new Error("The service is no longer running");e.writeToStdin(je({id:m,isRequest:!1,value:f}))},ae=(m,f)=>de(this,null,function*(){try{switch(f.command){case"ping":{S(m,{});break}case"on-start":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"on-resolve":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"on-load":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"serve-request":{let a=u.get(f.key);a&&a.onRequest&&a.onRequest(f.args),S(m,{});break}case"serve-wait":{let a=u.get(f.key);a&&a.onWait(f.error),S(m,{});break}case"watch-rebuild":{let a=i.get(f.key);try{a&&a(null,f.args)}catch(p){console.error(p)}S(m,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(a){S(m,{errors:[ve(a,e,null,void 0,"")]})}}),re=!0,le=m=>{if(re){re=!1;let a=String.fromCharCode(...m);if(a!=="0.14.23")throw new Error(`Cannot start service: Host version "0.14.23" does not match binary version ${JSON.stringify(a)}`);return}let f=_e(m);if(f.isRequest)ae(f.id,f.value);else{let a=t.get(f.id);t.delete(f.id),f.value.error?a(f.value.error,{}):a(null,f.value)}},ie=(m,f,a,p,F)=>de(this,null,function*(){let D=[],C=[],E={},B={},P=0,R=0,U=[],k=!1;f=[...f];for(let $ of f){let b={};if(typeof $!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n($,b,"name",y);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let o=n($,b,"setup",qe);if(typeof o!="function")throw new Error("Plugin is missing a setup function");J($,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=o({initialOptions:m,resolve:(g,N={})=>{if(!k)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof g!="string")throw new Error("The path to resolve must be a string");let M=Object.create(null),H=n(N,M,"pluginName",y),W=n(N,M,"importer",y),K=n(N,M,"namespace",y),X=n(N,M,"resolveDir",y),G=n(N,M,"kind",y),j=n(N,M,"pluginData",Me);return J(N,M,"in resolve() call"),new Promise((V,Q)=>{let z={command:"resolve",path:g,key:a,pluginName:w};H!=null&&(z.pluginName=H),W!=null&&(z.importer=W),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),G!=null&&(z.kind=G),j!=null&&(z.pluginData=p.store(j)),x(F,z,(oe,Z)=>{oe!==null?Q(new Error(oe)):V({errors:ge(Z.errors,p),warnings:ge(Z.warnings,p),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:p.load(Z.pluginData)})})})},onStart(g){let N='This error came from the "onStart" callback registered here:',M=Ee(new Error(N),e,"onStart");D.push({name:w,callback:g,note:M})},onEnd(g){let N='This error came from the "onEnd" callback registered here:',M=Ee(new Error(N),e,"onEnd");C.push({name:w,callback:g,note:M})},onResolve(g,N){let M='This error came from the "onResolve" callback registered here:',H=Ee(new Error(M),e,"onResolve"),W={},K=n(g,W,"filter",Ce),X=n(g,W,"namespace",y);if(J(g,W,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let G=P++;E[G]={name:w,callback:N,note:H},v.onResolve.push({id:G,filter:K.source,namespace:X||""})},onLoad(g,N){let M='This error came from the "onLoad" callback registered here:',H=Ee(new Error(M),e,"onLoad"),W={},K=n(g,W,"filter",Ce),X=n(g,W,"namespace",y);if(J(g,W,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let G=P++;B[G]={name:w,callback:N,note:H},v.onLoad.push({id:G,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),U.push(v)}catch(o){return{ok:!1,error:o,pluginName:w}}}let A=$=>de(this,null,function*(){switch($.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(D.map(Y=>de(this,[Y],function*({name:w,callback:o,note:v}){try{let h=yield o();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"errors",_),M=n(h,g,"warnings",_);J(h,g,`from onStart() callback in plugin ${JSON.stringify(w)}`),N!=null&&b.errors.push(...be(N,"errors",p,w)),M!=null&&b.warnings.push(...be(M,"warnings",p,w))}}catch(h){b.errors.push(ve(h,e,p,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",o,v;for(let Y of $.ids)try{({name:w,callback:o,note:v}=E[Y]);let h=yield o({path:$.path,importer:$.importer,namespace:$.namespace,resolveDir:$.resolveDir,kind:$.kind,pluginData:p.load($.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"pluginName",y),M=n(h,g,"path",y),H=n(h,g,"namespace",y),W=n(h,g,"suffix",y),K=n(h,g,"external",I),X=n(h,g,"sideEffects",I),G=n(h,g,"pluginData",Me),j=n(h,g,"errors",_),V=n(h,g,"warnings",_),Q=n(h,g,"watchFiles",_),z=n(h,g,"watchDirs",_);J(h,g,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,N!=null&&(b.pluginName=N),M!=null&&(b.path=M),H!=null&&(b.namespace=H),W!=null&&(b.suffix=W),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),G!=null&&(b.pluginData=p.store(G)),j!=null&&(b.errors=be(j,"errors",p,w)),V!=null&&(b.warnings=be(V,"warnings",p,w)),Q!=null&&(b.watchFiles=$e(Q,"watchFiles")),z!=null&&(b.watchDirs=$e(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}case"on-load":{let b={},w="",o,v;for(let Y of $.ids)try{({name:w,callback:o,note:v}=B[Y]);let h=yield o({path:$.path,namespace:$.namespace,suffix:$.suffix,pluginData:p.load($.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"pluginName",y),M=n(h,g,"contents",bt),H=n(h,g,"resolveDir",y),W=n(h,g,"pluginData",Me),K=n(h,g,"loader",y),X=n(h,g,"errors",_),G=n(h,g,"warnings",_),j=n(h,g,"watchFiles",_),V=n(h,g,"watchDirs",_);J(h,g,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,N!=null&&(b.pluginName=N),M instanceof Uint8Array?b.contents=M:M!=null&&(b.contents=pe(M)),H!=null&&(b.resolveDir=H),W!=null&&(b.pluginData=p.store(W)),K!=null&&(b.loader=K),X!=null&&(b.errors=be(X,"errors",p,w)),G!=null&&(b.warnings=be(G,"warnings",p,w)),j!=null&&(b.watchFiles=$e(j,"watchFiles")),V!=null&&(b.watchDirs=$e(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+$.command)}}),q=($,b,w)=>w();C.length>0&&(q=($,b,w)=>{(()=>de(this,null,function*(){for(let{name:o,callback:v,note:Y}of C)try{yield v($)}catch(h){$.errors.push(yield new Promise(g=>b(h,o,Y&&Y(),g)))}}))().then(w)}),k=!0;let ee=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:q,pluginRefs:{ref(){++ee===1&&r.set(a,A)},unref(){--ee===0&&r.delete(a)}}}}),ue=(m,f,a,p)=>{let F={},D=n(f,F,"port",Oe),C=n(f,F,"host",y),E=n(f,F,"servedir",y),B=n(f,F,"onRequest",qe),P,R=new Promise((U,k)=>{P=A=>{u.delete(p),A!==null?k(new Error(A)):U()}});return a.serve={},J(f,F,"in serve() call"),D!==void 0&&(a.serve.port=D),C!==void 0&&(a.serve.host=C),E!==void 0&&(a.serve.servedir=E),u.set(p,{onRequest:B,onWait:P}),{wait:R,stop(){x(m,{command:"serve-stop",key:p},()=>{})}}},fe="warning",ce="silent",ye=m=>{let f=s++,a=Ye(),p,{refs:F,options:D,isTTY:C,callback:E}=m;if(typeof D=="object"){let R=D.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');p=R}}let B=(R,U,k,A)=>{let q=[];try{Pe(q,D,{},C,fe)}catch($){}let ee=ve(R,e,a,k,U);x(F,{command:"error",flags:q,error:ee},()=>{ee.detail=a.load(ee.detail),A(ee)})},P=(R,U)=>{B(R,U,void 0,k=>{E(Re("Build failed",[k],[]),null)})};if(p&&p.length>0){if(e.isSync)return P(new Error("Cannot use plugins in synchronous API calls"),"");ie(D,p,f,a,F).then(R=>{if(!R.ok)P(R.error,R.pluginName);else try{se(Ne(Ae({},m),{key:f,details:a,logPluginError:B,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(U){P(U,"")}},R=>P(R,""))}else try{se(Ne(Ae({},m),{key:f,details:a,logPluginError:B,requestPlugins:null,runOnEndCallbacks:(R,U,k)=>k(),pluginRefs:null}))}catch(R){P(R,"")}},se=({callName:m,refs:f,serveOptions:a,options:p,isTTY:F,defaultWD:D,callback:C,key:E,details:B,logPluginError:P,requestPlugins:R,runOnEndCallbacks:U,pluginRefs:k})=>{let A={ref(){k&&k.ref(),f&&f.ref()},unref(){k&&k.unref(),f&&f.unref()}},q=!e.isBrowser,{entries:ee,flags:$,write:b,stdinContents:w,stdinResolveDir:o,absWorkingDir:v,incremental:Y,nodePaths:h,watch:g,mangleCache:N}=wt(m,p,F,fe,q),M={command:"build",key:E,entries:ee,flags:$,write:b,stdinContents:w,stdinResolveDir:o,absWorkingDir:v||D,incremental:Y,nodePaths:h};R&&(M.plugins=R),N&&(M.mangleCache=N);let H=a&&ue(A,a,M,E),W,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(he(j.writeToStdout).replace(/\n$/,""))},G=(j,V)=>{let Q={errors:ge(j.errors,B),warnings:ge(j.warnings,B)};X(j,Q),U(Q,P,()=>{if(Q.errors.length>0)return V(Re("Build failed",Q.errors,Q.warnings),null);if(j.rebuild){if(!W){let z=!1;W=()=>new Promise((oe,Z)=>{if(z||l)throw new Error("Cannot rebuild");x(A,{command:"rebuild",key:E},(ne,rt)=>{if(ne)return V(Re("Build failed",[{pluginName:"",text:ne,location:null,notes:[],detail:void 0}],[]),null);G(rt,(De,nt)=>{De?Z(De):oe(nt)})})}),A.ref(),W.dispose=()=>{z||(z=!0,x(A,{command:"rebuild-dispose",key:E},()=>{}),A.unref())}}Q.rebuild=W}if(j.watch){if(!K){let z=!1;A.ref(),K=()=>{z||(z=!0,i.delete(E),x(A,{command:"watch-stop",key:E},()=>{}),A.unref())},g&&i.set(E,(oe,Z)=>{if(oe){g.onRebuild&&g.onRebuild(oe,null);return}let ne={errors:ge(Z.errors,B),warnings:ge(Z.warnings,B)};X(Z,ne),U(ne,P,()=>{if(ne.errors.length>0){g.onRebuild&&g.onRebuild(Re("Build failed",ne.errors,ne.warnings),null);return}Z.rebuildID!==void 0&&(ne.rebuild=W),ne.stop=K,g.onRebuild&&g.onRebuild(null,ne)})})}Q.stop=K}V(null,Q)})};if(b&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(g&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');x(A,M,(j,V)=>{if(j)return C(new Error(j),null);if(H){let Q=V,z=!1;A.ref();let oe={port:Q.port,host:Q.host,wait:H.wait,stop(){z||(z=!0,H.stop(),A.unref())}};return A.ref(),H.wait.then(A.unref,A.unref),C(null,oe)}return G(V,C)})};return{readFromStdout:T,afterClose:L,service:{buildOrServe:ye,transform:({callName:m,refs:f,input:a,options:p,isTTY:F,fs:D,callback:C})=>{let E=Ye(),B=P=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:U}=vt(m,p,F,ce),k={command:"transform",flags:R,inputFS:P!==null,input:P!==null?P:a};U&&(k.mangleCache=U),x(f,k,(A,q)=>{if(A)return C(new Error(A),null);let ee=ge(q.errors,E),$=ge(q.warnings,E),b=1,w=()=>{if(--b===0){let o={warnings:$,code:q.code,map:q.map};q.mangleCache&&(o.mangleCache=q==null?void 0:q.mangleCache),C(null,o)}};if(ee.length>0)return C(Re("Transform failed",ee,$),null);q.codeFS&&(b++,D.readFile(q.code,(o,v)=>{o!==null?C(o,null):(q.code=v,w())})),q.mapFS&&(b++,D.readFile(q.map,(o,v)=>{o!==null?C(o,null):(q.map=v,w())})),w()})}catch(R){let U=[];try{Pe(U,p,{},F,ce)}catch(A){}let k=ve(R,e,E,void 0,"");x(f,{command:"error",flags:U,error:k},()=>{k.detail=E.load(k.detail),C(Re("Transform failed",[k],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let P=B;B=()=>D.writeFile(a,P)}B(null)},formatMessages:({callName:m,refs:f,messages:a,options:p,callback:F})=>{let D=be(a,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${m}() call`);let C={},E=n(p,C,"kind",y),B=n(p,C,"color",I),P=n(p,C,"terminalWidth",Oe);if(J(p,C,`in ${m}() call`),E===void 0)throw new Error(`Missing "kind" in ${m}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${m}() call`);let R={command:"format-msgs",messages:D,isWarning:E==="warning"};B!==void 0&&(R.color=B),P!==void 0&&(R.terminalWidth=P),x(f,R,(U,k)=>{if(U)return F(new Error(U),null);F(null,k.messages)})},analyzeMetafile:({callName:m,refs:f,metafile:a,options:p,callback:F})=>{p===void 0&&(p={});let D={},C=n(p,D,"color",I),E=n(p,D,"verbose",I);J(p,D,`in ${m}() call`);let B={command:"analyze-metafile",metafile:a};C!==void 0&&(B.color=C),E!==void 0&&(B.verbose=E),x(f,B,(P,R)=>{if(P)return F(new Error(P),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let i=t++;return e.set(i,r),i}}}function Ee(e,t,r){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
3
- `);l.splice(1,1);let c=tt(t,l,r);if(c)return i={text:e.message,location:c},i}catch(l){}}}function ve(e,t,r,i,u){let l="Internal error",c=null;try{l=(e&&e.message||e)+""}catch(s){}try{c=tt(t,(e.stack+"").split(`
4
- `),"")}catch(s){}return{pluginName:u,text:l,location:c,notes:i?[i]:[],detail:r?r.store(e):-1}}function tt(e,t,r){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(!!l.startsWith(i))for(l=l.slice(i.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(c){l=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),c){l=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(l),c){let s;try{s=e.readFileSync(c[1],"utf8")}catch(L){break}let d=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,T=d.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:pe(d.slice(0,O)).length,length:pe(d.slice(O,O+T)).length,lineText:d+`
2
+ var Ee=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ne=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Fe=(e,t)=>lt(e,st(t));var ut=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of ot(t))!Ke.call(e,f)&&f!==r&&Ee(e,f,{get:()=>t[f],enumerable:!(s=it(t,f))||s.enumerable});return e};var ct=e=>ft(Ee({},"__esModule",{value:!0}),e);var ce=(e,t,r)=>new Promise((s,f)=>{var i=g=>{try{l(r.next(g))}catch(O){f(O)}},c=g=>{try{l(r.throw(g))}catch(O){f(O)}},l=g=>g.done?s(g.value):Promise.resolve(g.value).then(i,c);l((r=r.apply(e,t)).next())});var Te={};ut(Te,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Bt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>At,initialize:()=>Tt,serve:()=>Et,transform:()=>kt,transformSync:()=>Pt,version:()=>St});module.exports=ct(Te);function Le(e){let t=s=>{if(s===null)r.write8(0);else if(typeof s=="boolean")r.write8(1),r.write8(+s);else if(typeof s=="number")r.write8(2),r.write32(s|0);else if(typeof s=="string")r.write8(3),r.write(de(s));else if(s instanceof Uint8Array)r.write8(4),r.write(s);else if(s instanceof Array){r.write8(5),r.write32(s.length);for(let f of s)t(f)}else{let f=Object.keys(s);r.write8(6),r.write32(f.length);for(let i of f)r.write(de(i)),t(s[i])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),je(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return be(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let g=0;g<c;g++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let g=0;g<c;g++)l[be(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new ke(e),s=r.read32(),f=(s&1)===0;s>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:f,value:i}}var ke=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);je(this.buf,t,r)}write(t){let r=this._write(4+t.length);je(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Ue(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),s=this._read(r.length);return r.set(this.buf.subarray(s,s+t)),r}},de,be;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;de=r=>e.encode(r),be=r=>t.decode(r)}else if(typeof Buffer!="undefined")de=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},be=e=>{let{buffer:t,byteOffset:r,byteLength:s}=e;return Buffer.from(t,r,s).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function je(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ce=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",pt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",Pe=e=>e instanceof RegExp?null:"a RegExp object",Se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",oe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",gt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let f=e[r];if(t[r+""]=!0,f===void 0)return;let i=s(f);if(i!==null)throw new Error(`"${r}" must be ${i}`);return f}function J(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Ge(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),s=n(e,t,"wasmModule",gt),f=n(e,t,"worker",q);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:f}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let s=e[r];if(typeof s=="string"||s===!1)t[r]=s;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ae(e,t,r,s,f){let i=n(t,r,"color",q),c=n(t,r,"logLevel",y),l=n(t,r,"logLimit",Se);i!==void 0?e.push(`--color=${i}`):s&&e.push("--color=true"),e.push(`--log-level=${c||f}`),e.push(`--log-limit=${l||0}`)}function Ze(e,t,r){let s=n(t,r,"legalComments",y),f=n(t,r,"sourceRoot",y),i=n(t,r,"sourcesContent",q),c=n(t,r,"target",ht),l=n(t,r,"format",y),g=n(t,r,"globalName",y),O=n(t,r,"mangleProps",Pe),N=n(t,r,"reserveProps",Pe),$=n(t,r,"mangleQuoted",q),P=n(t,r,"minify",q),W=n(t,r,"minifySyntax",q),ae=n(t,r,"minifyWhitespace",q),re=n(t,r,"minifyIdentifiers",q),ne=n(t,r,"drop",_),le=n(t,r,"charset",y),ie=n(t,r,"treeShaking",q),ge=n(t,r,"ignoreAnnotations",q),ue=n(t,r,"jsx",y),me=n(t,r,"jsxFactory",y),fe=n(t,r,"jsxFragment",y),ye=n(t,r,"define",oe),he=n(t,r,"logOverride",oe),ve=n(t,r,"pure",_),m=n(t,r,"keepNames",q);if(s&&e.push(`--legal-comments=${s}`),f!==void 0&&e.push(`--source-root=${f}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),l&&e.push(`--format=${l}`),g&&e.push(`--global-name=${g}`),P&&e.push("--minify"),W&&e.push("--minify-syntax"),ae&&e.push("--minify-whitespace"),re&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),ge&&e.push("--ignore-annotations"),ne)for(let o of ne)e.push(`--drop:${o}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),$!==void 0&&e.push(`--mangle-quoted=${$}`),ue&&e.push(`--jsx=${ue}`),me&&e.push(`--jsx-factory=${me}`),fe&&e.push(`--jsx-fragment=${fe}`),ye)for(let o in ye){if(o.indexOf("=")>=0)throw new Error(`Invalid define: ${o}`);e.push(`--define:${o}=${ye[o]}`)}if(he)for(let o in he){if(o.indexOf("=")>=0)throw new Error(`Invalid log override: ${o}`);e.push(`--log-override:${o}=${he[o]}`)}if(ve)for(let o of ve)e.push(`--pure:${o}`);m&&e.push("--keep-names")}function wt(e,t,r,s,f){var w;let i=[],c=[],l=Object.create(null),g=null,O=null,N=null;Ae(i,t,l,r,s),Ze(i,t,l);let $=n(t,l,"sourcemap",He),P=n(t,l,"bundle",q),W=n(t,l,"watch",pt),ae=n(t,l,"splitting",q),re=n(t,l,"preserveSymlinks",q),ne=n(t,l,"metafile",q),le=n(t,l,"outfile",y),ie=n(t,l,"outdir",y),ge=n(t,l,"outbase",y),ue=n(t,l,"platform",y),me=n(t,l,"tsconfig",y),fe=n(t,l,"resolveExtensions",_),ye=n(t,l,"nodePaths",_),he=n(t,l,"mainFields",_),ve=n(t,l,"conditions",_),m=n(t,l,"external",_),o=n(t,l,"loader",oe),a=n(t,l,"outExtension",oe),d=n(t,l,"publicPath",y),F=n(t,l,"entryNames",y),B=n(t,l,"chunkNames",y),M=n(t,l,"assetNames",y),x=n(t,l,"inject",_),A=n(t,l,"banner",oe),C=n(t,l,"footer",oe),R=n(t,l,"entryPoints",mt),L=n(t,l,"absWorkingDir",y),S=n(t,l,"stdin",oe),T=(w=n(t,l,"write",q))!=null?w:f,U=n(t,l,"allowOverwrite",q),ee=n(t,l,"incremental",q)===!0,E=n(t,l,"mangleCache",oe);if(l.plugins=!0,J(t,l,`in ${e}() call`),$&&i.push(`--sourcemap${$===!0?"":`=${$}`}`),P&&i.push("--bundle"),U&&i.push("--allow-overwrite"),W)if(i.push("--watch"),typeof W=="boolean")N={};else{let u=Object.create(null),v=n(W,u,"onRebuild",We);J(W,u,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ae&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),ne&&i.push("--metafile"),le&&i.push(`--outfile=${le}`),ie&&i.push(`--outdir=${ie}`),ge&&i.push(`--outbase=${ge}`),ue&&i.push(`--platform=${ue}`),me&&i.push(`--tsconfig=${me}`),fe){let u=[];for(let v of fe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);u.push(v)}i.push(`--resolve-extensions=${u.join(",")}`)}if(d&&i.push(`--public-path=${d}`),F&&i.push(`--entry-names=${F}`),B&&i.push(`--chunk-names=${B}`),M&&i.push(`--asset-names=${M}`),he){let u=[];for(let v of he){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);u.push(v)}i.push(`--main-fields=${u.join(",")}`)}if(ve){let u=[];for(let v of ve){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);u.push(v)}i.push(`--conditions=${u.join(",")}`)}if(m)for(let u of m)i.push(`--external:${u}`);if(A)for(let u in A){if(u.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${u}`);i.push(`--banner:${u}=${A[u]}`)}if(C)for(let u in C){if(u.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${u}`);i.push(`--footer:${u}=${C[u]}`)}if(x)for(let u of x)i.push(`--inject:${u}`);if(o)for(let u in o){if(u.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${u}`);i.push(`--loader:${u}=${o[u]}`)}if(a)for(let u in a){if(u.indexOf("=")>=0)throw new Error(`Invalid out extension: ${u}`);i.push(`--out-extension:${u}=${a[u]}`)}if(R)if(Array.isArray(R))for(let u of R)c.push(["",u+""]);else for(let[u,v]of Object.entries(R))c.push([u+"",v+""]);if(S){let u=Object.create(null),v=n(S,u,"contents",y),Y=n(S,u,"resolveDir",y),h=n(S,u,"sourcefile",y),p=n(S,u,"loader",y);J(S,u,'in "stdin" object'),h&&i.push(`--sourcefile=${h}`),p&&i.push(`--loader=${p}`),Y&&(O=Y+""),g=v?v+"":""}let b=[];if(ye)for(let u of ye)u+="",b.push(u);return{entries:c,flags:i,write:T,stdinContents:g,stdinResolveDir:O,absWorkingDir:L,incremental:ee,nodePaths:b,watch:N,mangleCache:Xe(E)}}function vt(e,t,r,s){let f=[],i=Object.create(null);Ae(f,t,i,r,s),Ze(f,t,i);let c=n(t,i,"sourcemap",He),l=n(t,i,"tsconfigRaw",yt),g=n(t,i,"sourcefile",y),O=n(t,i,"loader",y),N=n(t,i,"banner",y),$=n(t,i,"footer",y),P=n(t,i,"mangleCache",oe);return J(t,i,`in ${e}() call`),c&&f.push(`--sourcemap=${c===!0?"external":c}`),l&&f.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),g&&f.push(`--sourcefile=${g}`),O&&f.push(`--loader=${O}`),N&&f.push(`--banner=${N}`),$&&f.push(`--footer=${$}`),{flags:f,mangleCache:Xe(P)}}function et(e){let t=new Map,r=new Map,s=new Map,f=new Map,i=null,c=0,l=0,g=new Uint8Array(16*1024),O=0,N=m=>{let o=O+m.length;if(o>g.length){let d=new Uint8Array(o*2);d.set(g),g=d}g.set(m,O),O+=m.length;let a=0;for(;a+4<=O;){let d=Ue(g,a);if(a+4+d>O)break;a+=4,ne(g.subarray(a,a+d)),a+=d}a>0&&(g.copyWithin(0,a,O),O-=a)},$=m=>{i={reason:m?": "+(m.message||m):""};let o="The service was stopped"+i.reason;for(let a of t.values())a(o,null);t.clear();for(let a of f.values())a.onWait(o);f.clear();for(let a of s.values())try{a(new Error(o),null)}catch(d){console.error(d)}s.clear()},P=(m,o,a)=>{if(i)return a("The service is no longer running"+i.reason,null);let d=c++;t.set(d,(F,B)=>{try{a(F,B)}finally{m&&m.unref()}}),m&&m.ref(),e.writeToStdin(Le({id:d,isRequest:!0,value:o}))},W=(m,o)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(Le({id:m,isRequest:!1,value:o}))},ae=(m,o)=>ce(this,null,function*(){try{switch(o.command){case"ping":{W(m,{});break}case"on-start":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"on-resolve":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"on-load":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"serve-request":{let a=f.get(o.key);a&&a.onRequest&&a.onRequest(o.args),W(m,{});break}case"serve-wait":{let a=f.get(o.key);a&&a.onWait(o.error),W(m,{});break}case"watch-rebuild":{let a=s.get(o.key);try{a&&a(null,o.args)}catch(d){console.error(d)}W(m,{});break}default:throw new Error("Invalid command: "+o.command)}}catch(a){W(m,{errors:[Re(a,e,null,void 0,"")]})}}),re=!0,ne=m=>{if(re){re=!1;let a=String.fromCharCode(...m);if(a!=="0.14.42")throw new Error(`Cannot start service: Host version "0.14.42" does not match binary version ${JSON.stringify(a)}`);return}let o=_e(m);if(o.isRequest)ae(o.id,o.value);else{let a=t.get(o.id);t.delete(o.id),o.value.error?a(o.value.error,{}):a(null,o.value)}},le=(m,o,a,d,F)=>ce(this,null,function*(){let B=[],M=[],x={},A={},C=0,R=0,L=[],S=!1;o=[...o];for(let E of o){let b={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n(E,b,"name",y);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let u=n(E,b,"setup",We);if(typeof u!="function")throw new Error("Plugin is missing a setup function");J(E,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=u({initialOptions:m,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(D,k,"pluginName",y),I=n(D,k,"importer",y),K=n(D,k,"namespace",y),X=n(D,k,"resolveDir",y),H=n(D,k,"kind",y),j=n(D,k,"pluginData",Ce);return J(D,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:p,key:a,pluginName:w};Q!=null&&(z.pluginName=Q),I!=null&&(z.importer=I),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),j!=null&&(z.pluginData=d.store(j)),P(F,z,(se,Z)=>{se!==null?G(new Error(se)):V({errors:pe(Z.errors,d),warnings:pe(Z.warnings,d),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:d.load(Z.pluginData)})})})},onStart(p){let D='This error came from the "onStart" callback registered here:',k=$e(new Error(D),e,"onStart");B.push({name:w,callback:p,note:k})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',k=$e(new Error(D),e,"onEnd");M.push({name:w,callback:p,note:k})},onResolve(p,D){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),I={},K=n(p,I,"filter",Pe),X=n(p,I,"namespace",y);if(J(p,I,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=C++;x[H]={name:w,callback:D,note:Q},v.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(p,D){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),I={},K=n(p,I,"filter",Pe),X=n(p,I,"namespace",y);if(J(p,I,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=C++;A[H]={name:w,callback:D,note:Q},v.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),L.push(v)}catch(u){return{ok:!1,error:u,pluginName:w}}}let T=E=>ce(this,null,function*(){switch(E.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(B.map(Y=>ce(this,[Y],function*({name:w,callback:u,note:v}){try{let h=yield u();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"errors",_),k=n(h,p,"warnings",_);J(h,p,`from onStart() callback in plugin ${JSON.stringify(w)}`),D!=null&&b.errors.push(...we(D,"errors",d,w)),k!=null&&b.warnings.push(...we(k,"warnings",d,w))}}catch(h){b.errors.push(Re(h,e,d,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",u,v;for(let Y of E.ids)try{({name:w,callback:u,note:v}=x[Y]);let h=yield u({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",y),k=n(h,p,"path",y),Q=n(h,p,"namespace",y),I=n(h,p,"suffix",y),K=n(h,p,"external",q),X=n(h,p,"sideEffects",q),H=n(h,p,"pluginData",Ce),j=n(h,p,"errors",_),V=n(h,p,"warnings",_),G=n(h,p,"watchFiles",_),z=n(h,p,"watchDirs",_);J(h,p,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k!=null&&(b.path=k),Q!=null&&(b.namespace=Q),I!=null&&(b.suffix=I),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),H!=null&&(b.pluginData=d.store(H)),j!=null&&(b.errors=we(j,"errors",d,w)),V!=null&&(b.warnings=we(V,"warnings",d,w)),G!=null&&(b.watchFiles=Me(G,"watchFiles")),z!=null&&(b.watchDirs=Me(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}case"on-load":{let b={},w="",u,v;for(let Y of E.ids)try{({name:w,callback:u,note:v}=A[Y]);let h=yield u({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",y),k=n(h,p,"contents",bt),Q=n(h,p,"resolveDir",y),I=n(h,p,"pluginData",Ce),K=n(h,p,"loader",y),X=n(h,p,"errors",_),H=n(h,p,"warnings",_),j=n(h,p,"watchFiles",_),V=n(h,p,"watchDirs",_);J(h,p,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k instanceof Uint8Array?b.contents=k:k!=null&&(b.contents=de(k)),Q!=null&&(b.resolveDir=Q),I!=null&&(b.pluginData=d.store(I)),K!=null&&(b.loader=K),X!=null&&(b.errors=we(X,"errors",d,w)),H!=null&&(b.warnings=we(H,"warnings",d,w)),j!=null&&(b.watchFiles=Me(j,"watchFiles")),V!=null&&(b.watchDirs=Me(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+E.command)}}),U=(E,b,w)=>w();M.length>0&&(U=(E,b,w)=>{(()=>ce(this,null,function*(){for(let{name:u,callback:v,note:Y}of M)try{yield v(E)}catch(h){E.errors.push(yield new Promise(p=>b(h,u,Y&&Y(),p)))}}))().then(w)}),S=!0;let ee=0;return{ok:!0,requestPlugins:L,runOnEndCallbacks:U,pluginRefs:{ref(){++ee===1&&r.set(a,T)},unref(){--ee===0&&r.delete(a)}}}}),ie=(m,o,a,d)=>{let F={},B=n(o,F,"port",Se),M=n(o,F,"host",y),x=n(o,F,"servedir",y),A=n(o,F,"onRequest",We),C,R=new Promise((L,S)=>{C=T=>{f.delete(d),T!==null?S(new Error(T)):L()}});return a.serve={},J(o,F,"in serve() call"),B!==void 0&&(a.serve.port=B),M!==void 0&&(a.serve.host=M),x!==void 0&&(a.serve.servedir=x),f.set(d,{onRequest:A,onWait:C}),{wait:R,stop(){P(m,{command:"serve-stop",key:d},()=>{})}}},ge="warning",ue="silent",me=m=>{let o=l++,a=Ye(),d,{refs:F,options:B,isTTY:M,callback:x}=m;if(typeof B=="object"){let R=B.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');d=R}}let A=(R,L,S,T)=>{let U=[];try{Ae(U,B,{},M,ge)}catch(E){}let ee=Re(R,e,a,S,L);P(F,{command:"error",flags:U,error:ee},()=>{ee.detail=a.load(ee.detail),T(ee)})},C=(R,L)=>{A(R,L,void 0,S=>{x(Oe("Build failed",[S],[]),null)})};if(d&&d.length>0){if(e.isSync)return C(new Error("Cannot use plugins in synchronous API calls"),"");le(B,d,o,a,F).then(R=>{if(!R.ok)C(R.error,R.pluginName);else try{fe(Fe(Ne({},m),{key:o,details:a,logPluginError:A,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(L){C(L,"")}},R=>C(R,""))}else try{fe(Fe(Ne({},m),{key:o,details:a,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(R,L,S)=>S(),pluginRefs:null}))}catch(R){C(R,"")}},fe=({callName:m,refs:o,serveOptions:a,options:d,isTTY:F,defaultWD:B,callback:M,key:x,details:A,logPluginError:C,requestPlugins:R,runOnEndCallbacks:L,pluginRefs:S})=>{let T={ref(){S&&S.ref(),o&&o.ref()},unref(){S&&S.unref(),o&&o.unref()}},U=!e.isBrowser,{entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:u,absWorkingDir:v,incremental:Y,nodePaths:h,watch:p,mangleCache:D}=wt(m,d,F,ge,U),k={command:"build",key:x,entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:u,absWorkingDir:v||B,incremental:Y,nodePaths:h};R&&(k.plugins=R),D&&(k.mangleCache=D);let Q=a&&ie(T,a,k,x),I,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(be(j.writeToStdout).replace(/\n$/,""))},H=(j,V)=>{let G={errors:pe(j.errors,A),warnings:pe(j.warnings,A)};X(j,G),L(G,C,()=>{if(G.errors.length>0)return V(Oe("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!I){let z=!1;I=()=>new Promise((se,Z)=>{if(z||i)throw new Error("Cannot rebuild");P(T,{command:"rebuild",key:x},(te,rt)=>{if(te)return V(Oe("Build failed",[{pluginName:"",text:te,location:null,notes:[],detail:void 0}],[]),null);H(rt,(De,nt)=>{De?Z(De):se(nt)})})}),T.ref(),I.dispose=()=>{z||(z=!0,P(T,{command:"rebuild-dispose",key:x},()=>{}),T.unref())}}G.rebuild=I}if(j.watch){if(!K){let z=!1;T.ref(),K=()=>{z||(z=!0,s.delete(x),P(T,{command:"watch-stop",key:x},()=>{}),T.unref())},p&&s.set(x,(se,Z)=>{if(se){p.onRebuild&&p.onRebuild(se,null);return}let te={errors:pe(Z.errors,A),warnings:pe(Z.warnings,A)};X(Z,te),L(te,C,()=>{if(te.errors.length>0){p.onRebuild&&p.onRebuild(Oe("Build failed",te.errors,te.warnings),null);return}Z.rebuildID!==void 0&&(te.rebuild=I),te.stop=K,p.onRebuild&&p.onRebuild(null,te)})})}G.stop=K}V(null,G)})};if(b&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');P(T,k,(j,V)=>{if(j)return M(new Error(j),null);if(Q){let G=V,z=!1;T.ref();let se={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),T.unref())}};return T.ref(),Q.wait.then(T.unref,T.unref),M(null,se)}return H(V,M)})};return{readFromStdout:N,afterClose:$,service:{buildOrServe:me,transform:({callName:m,refs:o,input:a,options:d,isTTY:F,fs:B,callback:M})=>{let x=Ye(),A=C=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:L}=vt(m,d,F,ue),S={command:"transform",flags:R,inputFS:C!==null,input:C!==null?C:a};L&&(S.mangleCache=L),P(o,S,(T,U)=>{if(T)return M(new Error(T),null);let ee=pe(U.errors,x),E=pe(U.warnings,x),b=1,w=()=>{if(--b===0){let u={warnings:E,code:U.code,map:U.map};U.mangleCache&&(u.mangleCache=U==null?void 0:U.mangleCache),M(null,u)}};if(ee.length>0)return M(Oe("Transform failed",ee,E),null);U.codeFS&&(b++,B.readFile(U.code,(u,v)=>{u!==null?M(u,null):(U.code=v,w())})),U.mapFS&&(b++,B.readFile(U.map,(u,v)=>{u!==null?M(u,null):(U.map=v,w())})),w()})}catch(R){let L=[];try{Ae(L,d,{},F,ue)}catch(T){}let S=Re(R,e,x,void 0,"");P(o,{command:"error",flags:L,error:S},()=>{S.detail=x.load(S.detail),M(Oe("Transform failed",[S],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let C=A;A=()=>B.writeFile(a,C)}A(null)},formatMessages:({callName:m,refs:o,messages:a,options:d,callback:F})=>{let B=we(a,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${m}() call`);let M={},x=n(d,M,"kind",y),A=n(d,M,"color",q),C=n(d,M,"terminalWidth",Se);if(J(d,M,`in ${m}() call`),x===void 0)throw new Error(`Missing "kind" in ${m}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${m}() call`);let R={command:"format-msgs",messages:B,isWarning:x==="warning"};A!==void 0&&(R.color=A),C!==void 0&&(R.terminalWidth=C),P(o,R,(L,S)=>{if(L)return F(new Error(L),null);F(null,S.messages)})},analyzeMetafile:({callName:m,refs:o,metafile:a,options:d,callback:F})=>{d===void 0&&(d={});let B={},M=n(d,B,"color",q),x=n(d,B,"verbose",q);J(d,B,`in ${m}() call`);let A={command:"analyze-metafile",metafile:a};M!==void 0&&(A.color=M),x!==void 0&&(A.verbose=x),P(o,A,(C,R)=>{if(C)return F(new Error(C),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let s=t++;return e.set(s,r),s}}}function $e(e,t,r){let s,f=!1;return()=>{if(f)return s;f=!0;try{let i=(e.stack+"").split(`
3
+ `);i.splice(1,1);let c=tt(t,i,r);if(c)return s={text:e.message,location:c},s}catch(i){}}}function Re(e,t,r,s,f){let i="Internal error",c=null;try{i=(e&&e.message||e)+""}catch(l){}try{c=tt(t,(e.stack+"").split(`
4
+ `),"")}catch(l){}return{pluginName:f,text:i,location:c,notes:s?[s]:[],detail:r?r.store(e):-1}}function tt(e,t,r){let s=" at ";if(e.readFileSync&&!t[0].startsWith(s)&&t[1].startsWith(s))for(let f=1;f<t.length;f++){let i=t[f];if(!!i.startsWith(s))for(i=i.slice(s.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(c){i=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),c){i=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(i),c){let l;try{l=e.readFileSync(c[1],"utf8")}catch($){break}let g=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=g.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:de(g.slice(0,O)).length,length:de(g.slice(O,O+N)).length,lineText:g+`
5
5
  `+t.slice(1).join(`
6
- `),suggestion:""}}break}}return null}function Re(e,t,r){let i=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((c,s)=>{if(s===i)return`
6
+ `),suggestion:""}}break}}return null}function Oe(e,t,r){let s=5,f=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,s+1).map((c,l)=>{if(l===s)return`
7
7
  ...`;if(!c.location)return`
8
- error: ${c.text}`;let{file:d,line:O,column:T}=c.location,L=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
9
- ${d}:${O}:${T}: ERROR: ${L}${c.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=r,l}function ge(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function He(e,t){if(e==null)return null;let r={},i=n(e,r,"file",y),u=n(e,r,"namespace",y),l=n(e,r,"line",Oe),c=n(e,r,"column",Oe),s=n(e,r,"length",Oe),d=n(e,r,"lineText",y),O=n(e,r,"suggestion",y);return J(e,r,t),{file:i||"",namespace:u||"",line:l||0,column:c||0,length:s||0,lineText:d||"",suggestion:O||""}}function be(e,t,r,i){let u=[],l=0;for(let c of e){let s={},d=n(c,s,"pluginName",y),O=n(c,s,"text",y),T=n(c,s,"location",Je),L=n(c,s,"notes",_),x=n(c,s,"detail",Me),S=`in element ${l} of "${t}"`;J(c,s,S);let ae=[];if(L)for(let re of L){let le={},ie=n(re,le,"text",y),ue=n(re,le,"location",Je);J(re,le,S),ae.push({text:ie||"",location:He(ue,S)})}u.push({pluginName:d||i,text:O||"",location:He(T,S),notes:ae,detail:r?r.store(x):-1}),l++}return u}function $e(e,t){let r=[];for(let i of e){if(typeof i!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(i)}return r}function Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=he(t)),r}}}var St="0.14.23",xt=e=>Te().build(e),kt=()=>{throw new Error('The "serve" API only works in node')},Et=(e,t)=>Te().transform(e,t),$t=(e,t)=>Te().formatMessages(e,t),Mt=(e,t)=>Te().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},Tt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Se,We,Te=()=>{if(We)return We;throw Se?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Dt=e=>{e=Qe(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",Se)throw new Error('Cannot call "initialize" more than once');return Se=At(t,r),Se.catch(()=>{Se=void 0}),Se},At=(e,t)=>de(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let i=yield r.arrayBuffer(),u='{let global={};for(let o=self;o;o=Object.getPrototypeOf(o))for(let k of Object.getOwnPropertyNames(o))if(!(k in global))Object.defineProperty(global,k,{get:()=>self[k]});\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar w=(a,g,f)=>new Promise((y,r)=>{var n=o=>{try{i(f.next(o))}catch(m){r(m)}},s=o=>{try{i(f.throw(o))}catch(m){r(m)}},i=o=>o.done?y(o.value):Promise.resolve(o.value).then(n,s);i((f=f.apply(a,g)).next())});(()=>{if(typeof global=="undefined")if(typeof window!="undefined")window.global=window;else if(typeof self!="undefined")self.global=self;else throw new Error("cannot export Go (neither global, window nor self is defined)");if(!global.require&&typeof require!="undefined"&&(global.require=require),!global.fs&&global.require){const r=require("fs");typeof r=="object"&&r!==null&&Object.keys(r).length!==0&&(global.fs=Object.assign({},r,{write(n,s,i,o,m,u){if(i===0&&o===s.length&&m===null){if(n===process.stdout.fd){try{process.stdout.write(s,h=>h?u(h,0,null):u(null,o,s))}catch(h){u(h,0,null)}return}if(n===process.stderr.fd){try{process.stderr.write(s,h=>h?u(h,0,null):u(null,o,s))}catch(h){u(h,0,null)}return}}r.write(n,s,i,o,m,u)}}))}const a=()=>{const r=new Error("not implemented");return r.code="ENOSYS",r};if(!global.fs){let r="";global.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){r+=y.decode(s);const i=r.lastIndexOf(`\n`);return i!=-1&&(console.log(r.substr(0,i)),r=r.substr(i+1)),s.length},write(n,s,i,o,m,u){if(i!==0||o!==s.length||m!==null){u(a());return}const h=this.writeSync(n,s);u(null,h)},chmod(n,s,i){i(a())},chown(n,s,i,o){o(a())},close(n,s){s(a())},fchmod(n,s,i){i(a())},fchown(n,s,i,o){o(a())},fstat(n,s){s(a())},fsync(n,s){s(null)},ftruncate(n,s,i){i(a())},lchown(n,s,i,o){o(a())},link(n,s,i){i(a())},lstat(n,s){s(a())},mkdir(n,s,i){i(a())},open(n,s,i,o){o(a())},read(n,s,i,o,m,u){u(a())},readdir(n,s){s(a())},readlink(n,s){s(a())},rename(n,s,i){i(a())},rmdir(n,s){s(a())},stat(n,s){s(a())},symlink(n,s,i){i(a())},truncate(n,s,i){i(a())},unlink(n,s){s(a())},utimes(n,s,i,o){o(a())}}}if(global.process||(global.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw a()},pid:-1,ppid:-1,umask(){throw a()},cwd(){throw a()},chdir(){throw a()}}),!global.crypto&&global.require){const r=require("crypto");global.crypto={getRandomValues(n){r.randomFillSync(n)}}}if(!global.crypto)throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");if(global.performance||(global.performance={now(){const[r,n]=process.hrtime();return r*1e3+n/1e6}}),!global.TextEncoder&&global.require&&(global.TextEncoder=require("util").TextEncoder),!global.TextEncoder)throw new Error("global.TextEncoder is not available, polyfill required");if(!global.TextDecoder&&global.require&&(global.TextDecoder=require("util").TextDecoder),!global.TextDecoder)throw new Error("global.TextDecoder is not available, polyfill required");const{fs:g}=global,f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");if(global.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const r=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let c=this._ids.get(t);c===void 0&&(c=this._idPool.pop(),c===void 0&&(c=this._values.length),this._values[c]=t,this._goRefCounts[c]=0,this._ids.set(t,c)),this._goRefCounts[c]++;let d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,c,!0)},o=e=>{const t=n(e+0),l=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=n(e+0),l=n(e+8),c=new Array(l);for(let d=0;d<l;d++)c[d]=s(t+d*8);return c},u=e=>{const t=n(e+0),l=n(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},h=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),l=n(e+16),c=this.mem.getInt32(e+24,!0);g.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,c))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,r(e+8,(h+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();r(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(o(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),l=Reflect.get(t,u(e+16)),c=m(e+32),d=Reflect.apply(l,t,c);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),l=m(e+16),c=Reflect.apply(t,void 0,l);e=this._inst.exports.getsp()>>>0,i(e+40,c),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),l=m(e+16),c=Reflect.construct(t,l);e=this._inst.exports.getsp()>>>0,i(e+40,c),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,r(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),r(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);o(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=o(e+8),l=s(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=l.subarray(0,t.length);t.set(c),r(e+40,c.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),l=o(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=l.subarray(0,t.length);t.set(c),r(e+40,c.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(r){return w(this,null,function*(){if(!(r instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=r,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,global,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[global,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,l=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,l.length).set(l),n+=l.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,o=[];this.argv.forEach(e=>{o.push(s(e))}),o.push(0),Object.keys(this.env).sort().forEach(e=>{o.push(s(`${e}=${this.env[e]}`))}),o.push(0);const u=n;o.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const h=4096+8192;if(n>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(r){const n=this;return function(){const s={id:r,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}},typeof module!="undefined"&&global.require&&global.require.main===module&&global.process&&global.process.versions&&!global.process.versions.electron){process.argv.length<3&&(console.error("usage: go_js_wasm_exec [wasm binary] [arguments]"),process.exit(1));const r=new Go;r.argv=process.argv.slice(2),r.env=Object.assign({TMPDIR:require("os").tmpdir()},process.env),r.exit=process.exit,WebAssembly.instantiate(g.readFileSync(process.argv[2]),r.importObject).then(n=>(process.on("exit",s=>{s===0&&!r.exited&&(r._pendingEvent={id:0},r._resume())}),r.run(n.instance))).catch(n=>{console.error(n),process.exit(1)})}})();\nonmessage=({data:c})=>{let y=new TextDecoder,s=global.fs,a="";s.writeSync=(e,t)=>{if(e===1)postMessage(t);else if(e===2){a+=y.decode(t);let n=a.split(`\n`);n.length>1&&console.log(n.slice(0,-1).join(`\n`)),a=n[n.length-1]}else throw new Error("Bad write");return t.length};let l=[],i,r=0;onmessage=({data:e})=>{e.length>0&&(l.push(e),i&&i())},s.read=(e,t,n,d,h,m)=>{if(e!==0||n!==0||d!==t.length||h!==null)throw new Error("Bad read");if(l.length===0){i=()=>s.read(e,t,n,d,h,m);return}let g=l[0],u=Math.max(0,Math.min(d,g.length-r));t.set(g.subarray(r,r+u),n),r+=u,r===g.length&&(l.shift(),r=0),m(null,u)};let o=new global.Go;o.argv=["","--service=0.14.23"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',l;if(t){let d=new Blob([u],{type:"text/javascript"});l=new Worker(URL.createObjectURL(d))}else{let O=new Function("postMessage",u+"var onmessage; return m => onmessage(m)")(T=>l.onmessage({data:T}));l={onmessage:null,postMessage:T=>O({data:T}),terminate(){}}}l.postMessage(i),l.onmessage=({data:d})=>c(d);let{readFromStdout:c,service:s}=et({writeToStdin(d){l.postMessage(d)},isSync:!1,isBrowser:!0,esbuild:Be});We={build:d=>new Promise((O,T)=>s.buildOrServe({callName:"build",refs:null,serveOptions:null,options:d,isTTY:!1,defaultWD:"/",callback:(L,x)=>L?T(L):O(x)})),transform:(d,O)=>new Promise((T,L)=>s.transform({callName:"transform",refs:null,input:d,options:O||{},isTTY:!1,fs:{readFile(x,S){S(new Error("Internal error"),null)},writeFile(x,S){S(null)}},callback:(x,S)=>x?L(x):T(S)})),formatMessages:(d,O)=>new Promise((T,L)=>s.formatMessages({callName:"formatMessages",refs:null,messages:d,options:O,callback:(x,S)=>x?L(x):T(S)})),analyzeMetafile:(d,O)=>new Promise((T,L)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof d=="string"?d:JSON.stringify(d),options:O,callback:(x,S)=>x?L(x):T(S)}))}}),Nt=Be;module.exports=dt(Be);
8
+ error: ${c.text}`;let{file:g,line:O,column:N}=c.location,$=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
9
+ ${g}:${O}:${N}: ERROR: ${$}${c.text}`}).join(""),i=new Error(`${e}${f}`);return i.errors=t,i.warnings=r,i}function pe(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",y),f=n(e,r,"namespace",y),i=n(e,r,"line",Se),c=n(e,r,"column",Se),l=n(e,r,"length",Se),g=n(e,r,"lineText",y),O=n(e,r,"suggestion",y);return J(e,r,t),{file:s||"",namespace:f||"",line:i||0,column:c||0,length:l||0,lineText:g||"",suggestion:O||""}}function we(e,t,r,s){let f=[],i=0;for(let c of e){let l={},g=n(c,l,"pluginName",y),O=n(c,l,"text",y),N=n(c,l,"location",Je),$=n(c,l,"notes",_),P=n(c,l,"detail",Ce),W=`in element ${i} of "${t}"`;J(c,l,W);let ae=[];if($)for(let re of $){let ne={},le=n(re,ne,"text",y),ie=n(re,ne,"location",Je);J(re,ne,W),ae.push({text:le||"",location:Qe(ie,W)})}f.push({pluginName:g||s,text:O||"",location:Qe(N,W),notes:ae,detail:r?r.store(P):-1}),i++}return f}function Me(e,t){let r=[];for(let s of e){if(typeof s!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(s)}return r}function Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=be(t)),r}}}var St="0.14.42",xt=e=>Be().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Be().transform(e,t),$t=(e,t)=>Be().formatMessages(e,t),Mt=(e,t)=>Be().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},At=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},xe,qe,Be=()=>{if(qe)return qe;throw xe?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Tt=e=>{e=Ge(e||{});let t=e.wasmURL,r=e.wasmModule,s=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(xe)throw new Error('Cannot call "initialize" more than once');return xe=Dt(t||"",r,s),xe.catch(()=>{xe=void 0}),xe},Dt=(e,t,r)=>ce(void 0,null,function*(){let s;if(t)s=t;else{let l=yield fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);s=yield l.arrayBuffer()}let f;if(r){let l=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const g=new TextEncoder("utf-8"),f=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=c(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=g.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.42"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});f=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
10
+ // Copyright 2018 The Go Authors. All rights reserved.
11
+ // Use of this source code is governed by a BSD-style
12
+ // license that can be found in the LICENSE file.
13
+ var y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`
14
+ `);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const g=new TextEncoder("utf-8"),f=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=c(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=g.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`
15
+ `);d.length>1&&console.log(d.slice(0,-1).join(`
16
+ `)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.42"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(g=>f.onmessage({data:g}));f={onmessage:null,postMessage:g=>setTimeout(()=>l({data:g})),terminate(){}}}f.postMessage(s),f.onmessage=({data:l})=>i(l);let{readFromStdout:i,service:c}=et({writeToStdin(l){f.postMessage(l)},isSync:!1,isBrowser:!0,esbuild:Te});qe={build:l=>new Promise((g,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(N,$)=>N?O(N):g($)})),transform:(l,g)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:l,options:g||{},isTTY:!1,fs:{readFile($,P){P(new Error("Internal error"),null)},writeFile($,P){P(null)}},callback:($,P)=>$?N($):O(P)})),formatMessages:(l,g)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:l,options:g,callback:($,P)=>$?N($):O(P)})),analyzeMetafile:(l,g)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:g,callback:($,P)=>$?N($):O(P)}))}}),Nt=Te;
10
17
  })(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
@@ -7,7 +7,7 @@ export type Drop = 'console' | 'debugger';
7
7
 
8
8
  interface CommonOptions {
9
9
  /** Documentation: https://esbuild.github.io/api/#sourcemap */
10
- sourcemap?: boolean | 'inline' | 'external' | 'both';
10
+ sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
11
11
  /** Documentation: https://esbuild.github.io/api/#legal-comments */
12
12
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
13
13
  /** Documentation: https://esbuild.github.io/api/#source-root */
@@ -27,6 +27,8 @@ interface CommonOptions {
27
27
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
28
28
  reserveProps?: RegExp;
29
29
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
+ mangleQuoted?: boolean;
31
+ /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
32
  mangleCache?: Record<string, string | false>;
31
33
  /** Documentation: https://esbuild.github.io/api/#drop */
32
34
  drop?: Drop[];
@@ -65,6 +67,8 @@ interface CommonOptions {
65
67
  logLevel?: LogLevel;
66
68
  /** Documentation: https://esbuild.github.io/api/#log-limit */
67
69
  logLimit?: number;
70
+ /** Documentation: https://esbuild.github.io/api/#log-override */
71
+ logOverride?: Record<string, LogLevel>;
68
72
  }
69
73
 
70
74
  export interface BuildOptions extends CommonOptions {
@@ -569,6 +573,16 @@ export interface InitializeOptions {
569
573
  */
570
574
  wasmURL?: string
571
575
 
576
+ /**
577
+ * The result of calling "new WebAssembly.Module(buffer)" where "buffer"
578
+ * is a typed array or ArrayBuffer containing the binary code of the
579
+ * "esbuild.wasm" file.
580
+ *
581
+ * You can use this as an alternative to "wasmURL" for environments where it's
582
+ * not possible to download the WebAssembly module.
583
+ */
584
+ wasmModule?: WebAssembly.Module
585
+
572
586
  /**
573
587
  * By default esbuild runs the WebAssembly-based browser API in a web worker
574
588
  * to avoid blocking the UI thread. This can be disabled by setting "worker"
@@ -21,27 +21,20 @@ var __spreadValues = (a, b) => {
21
21
  return a;
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
24
  var __export = (target, all) => {
26
25
  for (var name in all)
27
26
  __defProp(target, name, { get: all[name], enumerable: true });
28
27
  };
29
- var __reExport = (target, module2, copyDefault, desc) => {
30
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
31
- for (let key of __getOwnPropNames(module2))
32
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
33
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
33
  }
35
- return target;
36
- };
37
- var __toESM = (module2, isNodeMode) => {
38
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
34
+ return to;
39
35
  };
40
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
41
- return (module2, temp) => {
42
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
43
- };
44
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
38
 
46
39
  // lib/npm/node.ts
47
40
  var node_exports = {};
@@ -59,6 +52,7 @@ __export(node_exports, {
59
52
  transformSync: () => transformSync,
60
53
  version: () => version
61
54
  });
55
+ module.exports = __toCommonJS(node_exports);
62
56
 
63
57
  // lib/shared/stdio_protocol.ts
64
58
  function encodePacket(packet) {
@@ -240,6 +234,7 @@ var mustBeInteger = (value) => typeof value === "number" && value === (value | 0
240
234
  var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
241
235
  var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
242
236
  var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
237
+ var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
243
238
  var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
244
239
  var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
245
240
  var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
@@ -266,10 +261,12 @@ function checkForInvalidFlags(object, keys, where) {
266
261
  function validateInitializeOptions(options) {
267
262
  let keys = /* @__PURE__ */ Object.create(null);
268
263
  let wasmURL = getFlag(options, keys, "wasmURL", mustBeString);
264
+ let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule);
269
265
  let worker = getFlag(options, keys, "worker", mustBeBoolean);
270
- checkForInvalidFlags(options, keys, "in startService() call");
266
+ checkForInvalidFlags(options, keys, "in initialize() call");
271
267
  return {
272
268
  wasmURL,
269
+ wasmModule,
273
270
  worker
274
271
  };
275
272
  }
@@ -308,6 +305,7 @@ function pushCommonFlags(flags, options, keys) {
308
305
  let globalName = getFlag(options, keys, "globalName", mustBeString);
309
306
  let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
310
307
  let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
308
+ let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
311
309
  let minify = getFlag(options, keys, "minify", mustBeBoolean);
312
310
  let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
313
311
  let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
@@ -320,6 +318,7 @@ function pushCommonFlags(flags, options, keys) {
320
318
  let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
321
319
  let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
322
320
  let define = getFlag(options, keys, "define", mustBeObject);
321
+ let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
323
322
  let pure = getFlag(options, keys, "pure", mustBeArray);
324
323
  let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
325
324
  if (legalComments)
@@ -359,6 +358,8 @@ function pushCommonFlags(flags, options, keys) {
359
358
  flags.push(`--mangle-props=${mangleProps.source}`);
360
359
  if (reserveProps)
361
360
  flags.push(`--reserve-props=${reserveProps.source}`);
361
+ if (mangleQuoted !== void 0)
362
+ flags.push(`--mangle-quoted=${mangleQuoted}`);
362
363
  if (jsx)
363
364
  flags.push(`--jsx=${jsx}`);
364
365
  if (jsxFactory)
@@ -372,6 +373,13 @@ function pushCommonFlags(flags, options, keys) {
372
373
  flags.push(`--define:${key}=${define[key]}`);
373
374
  }
374
375
  }
376
+ if (logOverride) {
377
+ for (let key in logOverride) {
378
+ if (key.indexOf("=") >= 0)
379
+ throw new Error(`Invalid log override: ${key}`);
380
+ flags.push(`--log-override:${key}=${logOverride[key]}`);
381
+ }
382
+ }
375
383
  if (pure)
376
384
  for (let fn of pure)
377
385
  flags.push(`--pure:${fn}`);
@@ -608,7 +616,7 @@ function createChannel(streamIn) {
608
616
  let pluginCallbacks = /* @__PURE__ */ new Map();
609
617
  let watchCallbacks = /* @__PURE__ */ new Map();
610
618
  let serveCallbacks = /* @__PURE__ */ new Map();
611
- let isClosed = false;
619
+ let closeData = null;
612
620
  let nextRequestID = 0;
613
621
  let nextBuildKey = 0;
614
622
  let stdout = new Uint8Array(16 * 1024);
@@ -637,19 +645,20 @@ function createChannel(streamIn) {
637
645
  stdoutUsed -= offset;
638
646
  }
639
647
  };
640
- let afterClose = () => {
641
- isClosed = true;
648
+ let afterClose = (error) => {
649
+ closeData = { reason: error ? ": " + (error.message || error) : "" };
650
+ const text = "The service was stopped" + closeData.reason;
642
651
  for (let callback of responseCallbacks.values()) {
643
- callback("The service was stopped", null);
652
+ callback(text, null);
644
653
  }
645
654
  responseCallbacks.clear();
646
655
  for (let callbacks of serveCallbacks.values()) {
647
- callbacks.onWait("The service was stopped");
656
+ callbacks.onWait(text);
648
657
  }
649
658
  serveCallbacks.clear();
650
659
  for (let callback of watchCallbacks.values()) {
651
660
  try {
652
- callback(new Error("The service was stopped"), null);
661
+ callback(new Error(text), null);
653
662
  } catch (e) {
654
663
  console.error(e);
655
664
  }
@@ -657,8 +666,8 @@ function createChannel(streamIn) {
657
666
  watchCallbacks.clear();
658
667
  };
659
668
  let sendRequest = (refs, value, callback) => {
660
- if (isClosed)
661
- return callback("The service is no longer running", null);
669
+ if (closeData)
670
+ return callback("The service is no longer running" + closeData.reason, null);
662
671
  let id = nextRequestID++;
663
672
  responseCallbacks.set(id, (error, response) => {
664
673
  try {
@@ -673,8 +682,8 @@ function createChannel(streamIn) {
673
682
  streamIn.writeToStdin(encodePacket({ id, isRequest: true, value }));
674
683
  };
675
684
  let sendResponse = (id, value) => {
676
- if (isClosed)
677
- throw new Error("The service is no longer running");
685
+ if (closeData)
686
+ throw new Error("The service is no longer running" + closeData.reason);
678
687
  streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
679
688
  };
680
689
  let handleRequest = async (id, request) => {
@@ -745,8 +754,8 @@ function createChannel(streamIn) {
745
754
  if (isFirstPacket) {
746
755
  isFirstPacket = false;
747
756
  let binaryVersion = String.fromCharCode(...bytes);
748
- if (binaryVersion !== "0.14.23") {
749
- throw new Error(`Cannot start service: Host version "${"0.14.23"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
757
+ if (binaryVersion !== "0.14.42") {
758
+ throw new Error(`Cannot start service: Host version "${"0.14.42"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
750
759
  }
751
760
  return;
752
761
  }
@@ -1251,7 +1260,7 @@ function createChannel(streamIn) {
1251
1260
  if (!rebuild) {
1252
1261
  let isDisposed = false;
1253
1262
  rebuild = () => new Promise((resolve, reject) => {
1254
- if (isDisposed || isClosed)
1263
+ if (isDisposed || closeData)
1255
1264
  throw new Error("Cannot rebuild");
1256
1265
  sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
1257
1266
  if (error2) {
@@ -1718,9 +1727,13 @@ var knownUnixlikePackages = {
1718
1727
  "openbsd x64 LE": "esbuild-openbsd-64",
1719
1728
  "sunos x64 LE": "esbuild-sunos-64"
1720
1729
  };
1730
+ var knownWebAssemblyFallbackPackages = {
1731
+ "android x64 LE": "esbuild-android-64"
1732
+ };
1721
1733
  function pkgAndSubpathForCurrentPlatform() {
1722
1734
  let pkg;
1723
1735
  let subpath;
1736
+ let isWASM = false;
1724
1737
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
1725
1738
  if (platformKey in knownWindowsPackages) {
1726
1739
  pkg = knownWindowsPackages[platformKey];
@@ -1728,10 +1741,14 @@ function pkgAndSubpathForCurrentPlatform() {
1728
1741
  } else if (platformKey in knownUnixlikePackages) {
1729
1742
  pkg = knownUnixlikePackages[platformKey];
1730
1743
  subpath = "bin/esbuild";
1744
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
1745
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
1746
+ subpath = "bin/esbuild";
1747
+ isWASM = true;
1731
1748
  } else {
1732
1749
  throw new Error(`Unsupported platform: ${platformKey}`);
1733
1750
  }
1734
- return { pkg, subpath };
1751
+ return { pkg, subpath, isWASM };
1735
1752
  }
1736
1753
  function pkgForSomeOtherPlatform() {
1737
1754
  const libMainJS = require.resolve("esbuild");
@@ -1762,9 +1779,9 @@ function downloadedBinPath(pkg, subpath) {
1762
1779
  }
1763
1780
  function generateBinPath() {
1764
1781
  if (ESBUILD_BINARY_PATH) {
1765
- return ESBUILD_BINARY_PATH;
1782
+ return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
1766
1783
  }
1767
- const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
1784
+ const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
1768
1785
  let binPath;
1769
1786
  try {
1770
1787
  binPath = require.resolve(`${pkg}/${subpath}`);
@@ -1826,9 +1843,9 @@ by esbuild to install the correct binary executable for your current platform.`)
1826
1843
  fs.copyFileSync(binPath, binTargetPath);
1827
1844
  fs.chmodSync(binTargetPath, 493);
1828
1845
  }
1829
- return binTargetPath;
1846
+ return { binPath: binTargetPath, isWASM };
1830
1847
  }
1831
- return binPath;
1848
+ return { binPath, isWASM };
1832
1849
  }
1833
1850
 
1834
1851
  // lib/npm/node.ts
@@ -1850,7 +1867,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1850
1867
  }
1851
1868
  }
1852
1869
  var _a;
1853
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.23";
1870
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.42";
1854
1871
  var esbuildCommandAndArgs = () => {
1855
1872
  if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1856
1873
  throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
@@ -1860,7 +1877,12 @@ More information: The file containing the code for esbuild's JavaScript API (${_
1860
1877
  if (true) {
1861
1878
  return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]];
1862
1879
  }
1863
- return [generateBinPath(), []];
1880
+ const { binPath, isWASM } = generateBinPath();
1881
+ if (isWASM) {
1882
+ return ["node", [binPath]];
1883
+ } else {
1884
+ return [binPath, []];
1885
+ }
1864
1886
  };
1865
1887
  var isTTY = () => tty.isatty(2);
1866
1888
  var fsSync = {
@@ -1909,7 +1931,7 @@ var fsAsync = {
1909
1931
  }
1910
1932
  }
1911
1933
  };
1912
- var version = "0.14.23";
1934
+ var version = "0.14.42";
1913
1935
  var build = (options) => ensureServiceIsRunning().build(options);
1914
1936
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1915
1937
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2018,7 +2040,7 @@ var ensureServiceIsRunning = () => {
2018
2040
  if (longLivedService)
2019
2041
  return longLivedService;
2020
2042
  let [command, args] = esbuildCommandAndArgs();
2021
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.23"}`, "--ping"), {
2043
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.42"}`, "--ping"), {
2022
2044
  windowsHide: true,
2023
2045
  stdio: ["pipe", "pipe", "inherit"],
2024
2046
  cwd: defaultWD
@@ -2027,7 +2049,7 @@ var ensureServiceIsRunning = () => {
2027
2049
  writeToStdin(bytes) {
2028
2050
  child.stdin.write(bytes, (err) => {
2029
2051
  if (err)
2030
- afterClose();
2052
+ afterClose(err);
2031
2053
  });
2032
2054
  },
2033
2055
  readFileSync: fs2.readFileSync,
@@ -2036,6 +2058,7 @@ var ensureServiceIsRunning = () => {
2036
2058
  esbuild: node_exports
2037
2059
  });
2038
2060
  child.stdin.on("error", afterClose);
2061
+ child.on("error", afterClose);
2039
2062
  const stdin = child.stdin;
2040
2063
  const stdout = child.stdout;
2041
2064
  stdout.on("data", readFromStdout);
@@ -2131,14 +2154,14 @@ var runServiceSync = (callback) => {
2131
2154
  esbuild: node_exports
2132
2155
  });
2133
2156
  callback(service);
2134
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.23"}`), {
2157
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.42"}`), {
2135
2158
  cwd: defaultWD,
2136
2159
  windowsHide: true,
2137
2160
  input: stdin,
2138
2161
  maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
2139
2162
  });
2140
2163
  readFromStdout(stdout);
2141
- afterClose();
2164
+ afterClose(null);
2142
2165
  };
2143
2166
  var randomFileName = () => {
2144
2167
  return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`);
@@ -2147,7 +2170,7 @@ var workerThreadService = null;
2147
2170
  var startWorkerThreadService = (worker_threads2) => {
2148
2171
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2149
2172
  let worker = new worker_threads2.Worker(__filename, {
2150
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.23" },
2173
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.42" },
2151
2174
  transferList: [workerPort],
2152
2175
  execArgv: []
2153
2176
  });
@@ -2263,7 +2286,6 @@ if (isInternalWorkerThread) {
2263
2286
  startSyncServiceWorker();
2264
2287
  }
2265
2288
  var node_default = node_exports;
2266
- module.exports = __toCommonJS(node_exports);
2267
2289
  // Annotate the CommonJS export names for ESM import in node:
2268
2290
  0 && (module.exports = {
2269
2291
  analyzeMetafile,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild-wasm",
3
- "version": "0.14.23",
3
+ "version": "0.14.42",
4
4
  "description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "license": "MIT",