isomorfeus-asset-manager 0.14.1 → 0.14.5
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.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/lib/isomorfeus/asset_manager.rb +1 -1
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +27 -0
- data/node_modules/esbuild-wasm/esm/browser.js +90 -38
- data/node_modules/esbuild-wasm/esm/browser.min.js +7 -7
- data/node_modules/esbuild-wasm/lib/browser.d.ts +27 -0
- data/node_modules/esbuild-wasm/lib/browser.js +111 -41
- data/node_modules/esbuild-wasm/lib/browser.min.js +9 -9
- data/node_modules/esbuild-wasm/lib/main.d.ts +27 -0
- data/node_modules/esbuild-wasm/lib/main.js +108 -47
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +11 -11
@@ -1,10 +1,10 @@
|
|
1
|
-
(
|
2
|
-
var Me=Object.defineProperty,tt=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var nt=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Be=(e,t)=>{for(var r in t||(t={}))nt.call(t,r)&&qe(e,r,t[r]);if(Ue)for(var r of Ue(t))lt.call(t,r)&&qe(e,r,t[r]);return e},Te=(e,t)=>tt(e,rt(t)),it=e=>Me(e,"__esModule",{value:!0});var st=(e,t)=>{it(e);for(var r in t)Me(e,r,{get:t[r],enumerable:!0})};var ae=(e,t,r)=>new Promise((s,d)=>{var l=m=>{try{i(r.next(m))}catch(R){d(R)}},u=m=>{try{i(r.throw(m))}catch(R){d(R)}},i=m=>m.done?s(m.value):Promise.resolve(m.value).then(l,u);i((r=r.apply(e,t)).next())});st(exports,{analyzeMetafile:()=>Ot,analyzeMetafileSync:()=>Et,build:()=>bt,buildSync:()=>St,formatMessages:()=>Rt,formatMessagesSync:()=>kt,initialize:()=>$t,serve:()=>wt,transform:()=>vt,transformSync:()=>xt,version:()=>ht});function Ae(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(ue(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 d of s)t(d)}else{let d=Object.keys(s);r.write8(6),r.write32(d.length);for(let l of d)r.write(ue(l)),t(s[l])}},r=new Fe;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 We(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return ce(r.read());case 4:return r.read();case 5:{let u=r.read32(),i=[];for(let m=0;m<u;m++)i.push(t());return i}case 6:{let u=r.read32(),i={};for(let m=0;m<u;m++)i[ce(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new Fe(e),s=r.read32(),d=(s&1)==0;s>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:d,value:l}}var Fe=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 Ne(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}},ue,ce;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ue=r=>e.encode(r),ce=r=>t.decode(r)}else if(typeof Buffer!="undefined")ue=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ce=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 Ne(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 ze(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ce=()=>null,L=e=>typeof e=="boolean"?null:"a boolean",at=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",Ke=e=>e instanceof RegExp?null:"a RegExp object",me=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ie=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ut=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ve=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ft=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ct=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",dt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let d=e[r];if(t[r+""]=!0,d===void 0)return;let l=s(d);if(l!==null)throw new Error(`"${r}" must be ${l}`);return d}function _(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Je(e){let t=Object.create(null),r=n(e,t,"wasmURL",h),s=n(e,t,"worker",L);return _(e,t,"in startService() call"),{wasmURL:r,worker:s}}function Oe(e,t,r,s,d){let l=n(t,r,"color",L),u=n(t,r,"logLevel",h),i=n(t,r,"logLimit",me);l!==void 0?e.push(`--color=${l}`):s&&e.push("--color=true"),e.push(`--log-level=${u||d}`),e.push(`--log-limit=${i||0}`)}function Ye(e,t,r){let s=n(t,r,"legalComments",h),d=n(t,r,"sourceRoot",h),l=n(t,r,"sourcesContent",L),u=n(t,r,"target",ct),i=n(t,r,"format",h),m=n(t,r,"globalName",h),R=n(t,r,"minify",L),x=n(t,r,"minifySyntax",L),F=n(t,r,"minifyWhitespace",L),U=n(t,r,"minifyIdentifiers",L),k=n(t,r,"charset",h),q=n(t,r,"treeShaking",L),ee=n(t,r,"ignoreAnnotations",L),Q=n(t,r,"jsx",h),te=n(t,r,"jsxFactory",h),re=n(t,r,"jsxFragment",h),le=n(t,r,"define",ye),ie=n(t,r,"pure",z),fe=n(t,r,"keepNames",L);if(s&&e.push(`--legal-comments=${s}`),d!==void 0&&e.push(`--source-root=${d}`),l!==void 0&&e.push(`--sources-content=${l}`),u&&(Array.isArray(u)?e.push(`--target=${Array.from(u).map(ze).join(",")}`):e.push(`--target=${ze(u)}`)),i&&e.push(`--format=${i}`),m&&e.push(`--global-name=${m}`),R&&e.push("--minify"),x&&e.push("--minify-syntax"),F&&e.push("--minify-whitespace"),U&&e.push("--minify-identifiers"),k&&e.push(`--charset=${k}`),q!==void 0&&e.push(`--tree-shaking=${q}`),ee&&e.push("--ignore-annotations"),Q&&e.push(`--jsx=${Q}`),te&&e.push(`--jsx-factory=${te}`),re&&e.push(`--jsx-fragment=${re}`),le)for(let X in le){if(X.indexOf("=")>=0)throw new Error(`Invalid define: ${X}`);e.push(`--define:${X}=${le[X]}`)}if(ie)for(let X of ie)e.push(`--pure:${X}`);fe&&e.push("--keep-names")}function pt(e,t,r,s,d){var w;let l=[],u=[],i=Object.create(null),m=null,R=null,x=null;Oe(l,t,i,r,s),Ye(l,t,i);let F=n(t,i,"sourcemap",Ve),U=n(t,i,"bundle",L),k=n(t,i,"watch",at),q=n(t,i,"splitting",L),ee=n(t,i,"preserveSymlinks",L),Q=n(t,i,"metafile",L),te=n(t,i,"outfile",h),re=n(t,i,"outdir",h),le=n(t,i,"outbase",h),ie=n(t,i,"platform",h),fe=n(t,i,"tsconfig",h),X=n(t,i,"resolveExtensions",z),Re=n(t,i,"nodePaths",z),Ee=n(t,i,"mainFields",z),$e=n(t,i,"conditions",z),De=n(t,i,"external",z),g=n(t,i,"loader",ye),f=n(t,i,"outExtension",ye),o=n(t,i,"publicPath",h),p=n(t,i,"entryNames",h),j=n(t,i,"chunkNames",h),M=n(t,i,"assetNames",h),P=n(t,i,"inject",z),N=n(t,i,"banner",ye),D=n(t,i,"footer",ye),$=n(t,i,"entryPoints",ut),O=n(t,i,"absWorkingDir",h),B=n(t,i,"stdin",ye),T=(w=n(t,i,"write",L))!=null?w:d,S=n(t,i,"allowOverwrite",L),E=n(t,i,"incremental",L)===!0;if(i.plugins=!0,_(t,i,`in ${e}() call`),F&&l.push(`--sourcemap${F===!0?"":`=${F}`}`),U&&l.push("--bundle"),S&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")x={};else{let a=Object.create(null),b=n(k,a,"onRebuild",Ie);_(k,a,`on "watch" in ${e}() call`),x={onRebuild:b}}if(q&&l.push("--splitting"),ee&&l.push("--preserve-symlinks"),Q&&l.push("--metafile"),te&&l.push(`--outfile=${te}`),re&&l.push(`--outdir=${re}`),le&&l.push(`--outbase=${le}`),ie&&l.push(`--platform=${ie}`),fe&&l.push(`--tsconfig=${fe}`),X){let a=[];for(let b of X){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${b}`);a.push(b)}l.push(`--resolve-extensions=${a.join(",")}`)}if(o&&l.push(`--public-path=${o}`),p&&l.push(`--entry-names=${p}`),j&&l.push(`--chunk-names=${j}`),M&&l.push(`--asset-names=${M}`),Ee){let a=[];for(let b of Ee){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid main field: ${b}`);a.push(b)}l.push(`--main-fields=${a.join(",")}`)}if($e){let a=[];for(let b of $e){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid condition: ${b}`);a.push(b)}l.push(`--conditions=${a.join(",")}`)}if(De)for(let a of De)l.push(`--external:${a}`);if(N)for(let a in N){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);l.push(`--banner:${a}=${N[a]}`)}if(D)for(let a in D){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);l.push(`--footer:${a}=${D[a]}`)}if(P)for(let a of P)l.push(`--inject:${a}`);if(g)for(let a in g){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);l.push(`--loader:${a}=${g[a]}`)}if(f)for(let a in f){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);l.push(`--out-extension:${a}=${f[a]}`)}if($)if(Array.isArray($))for(let a of $)u.push(["",a+""]);else for(let[a,b]of Object.entries($))u.push([a+"",b+""]);if(B){let a=Object.create(null),b=n(B,a,"contents",h),I=n(B,a,"resolveDir",h),c=n(B,a,"sourcefile",h),v=n(B,a,"loader",h);_(B,a,'in "stdin" object'),c&&l.push(`--sourcefile=${c}`),v&&l.push(`--loader=${v}`),I&&(R=I+""),m=b?b+"":""}let y=[];if(Re)for(let a of Re)a+="",y.push(a);return{entries:u,flags:l,write:T,stdinContents:m,stdinResolveDir:R,absWorkingDir:O,incremental:E,nodePaths:y,watch:x}}function gt(e,t,r,s){let d=[],l=Object.create(null);Oe(d,t,l,r,s),Ye(d,t,l);let u=n(t,l,"sourcemap",Ve),i=n(t,l,"tsconfigRaw",ft),m=n(t,l,"sourcefile",h),R=n(t,l,"loader",h),x=n(t,l,"banner",h),F=n(t,l,"footer",h);return _(t,l,`in ${e}() call`),u&&d.push(`--sourcemap=${u===!0?"external":u}`),i&&d.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),m&&d.push(`--sourcefile=${m}`),R&&d.push(`--loader=${R}`),x&&d.push(`--banner=${x}`),F&&d.push(`--footer=${F}`),d}function He(e){let t=new Map,r=new Map,s=new Map,d=new Map,l=0,u=!1,i=0,m=0,R=new Uint8Array(16*1024),x=0,F=g=>{let f=x+g.length;if(f>R.length){let p=new Uint8Array(f*2);p.set(R),R=p}R.set(g,x),x+=g.length;let o=0;for(;o+4<=x;){let p=Ne(R,o);if(o+4+p>x)break;o+=4,te(R.subarray(o,o+p)),o+=p}o>0&&(R.copyWithin(0,o,x),x-=o)},U=()=>{u=!0;for(let g of t.values())g("The service was stopped",null);t.clear();for(let g of d.values())g.onWait("The service was stopped");d.clear();for(let g of s.values())try{g(new Error("The service was stopped"),null)}catch(f){console.error(f)}s.clear()},k=(g,f,o)=>{if(u)return o("The service is no longer running",null);let p=i++;t.set(p,(j,M)=>{try{o(j,M)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ae({id:p,isRequest:!0,value:f}))},q=(g,f)=>{if(u)throw new Error("The service is no longer running");e.writeToStdin(Ae({id:g,isRequest:!1,value:f}))},ee=(g,f)=>ae(this,null,function*(){try{switch(f.command){case"ping":{q(g,{});break}case"start":{let o=r.get(f.key);o?q(g,yield o(f)):q(g,{});break}case"resolve":{let o=r.get(f.key);o?q(g,yield o(f)):q(g,{});break}case"load":{let o=r.get(f.key);o?q(g,yield o(f)):q(g,{});break}case"serve-request":{let o=d.get(f.serveID);o&&o.onRequest&&o.onRequest(f.args),q(g,{});break}case"serve-wait":{let o=d.get(f.serveID);o&&o.onWait(f.error),q(g,{});break}case"watch-rebuild":{let o=s.get(f.watchID);try{o&&o(null,f.args)}catch(p){console.error(p)}q(g,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(o){q(g,{errors:[he(o,e,null,void 0,"")]})}}),Q=!0,te=g=>{if(Q){Q=!1;let o=String.fromCharCode(...g);if(o!=="0.14.3")throw new Error(`Cannot start service: Host version "0.14.3" does not match binary version ${JSON.stringify(o)}`);return}let f=We(g);if(f.isRequest)ee(f.id,f.value);else{let o=t.get(f.id);t.delete(f.id),f.value.error?o(f.value.error,{}):o(null,f.value)}},re=(g,f,o,p)=>ae(this,null,function*(){let j=[],M=[],P={},N={},D=0,$=0,O=[];f=[...f];for(let E of f){let y={};if(typeof E!="object")throw new Error(`Plugin at index ${$} must be an object`);let w=n(E,y,"name",h);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${$} is missing a name`);try{let a=n(E,y,"setup",Ie);if(typeof a!="function")throw new Error("Plugin is missing a setup function");_(E,y,`on plugin ${JSON.stringify(w)}`);let b={name:w,onResolve:[],onLoad:[]};$++;let I=a({initialOptions:g,onStart(c){let v='This error came from the "onStart" callback registered here:',W=Se(new Error(v),e,"onStart");j.push({name:w,callback:c,note:W})},onEnd(c){let v='This error came from the "onEnd" callback registered here:',W=Se(new Error(v),e,"onEnd");M.push({name:w,callback:c,note:W})},onResolve(c,v){let W='This error came from the "onResolve" callback registered here:',C=Se(new Error(W),e,"onResolve"),K={},V=n(c,K,"filter",Ke),Y=n(c,K,"namespace",h);if(_(c,K,`in onResolve() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onResolve() call is missing a filter");let J=D++;P[J]={name:w,callback:v,note:C},b.onResolve.push({id:J,filter:V.source,namespace:Y||""})},onLoad(c,v){let W='This error came from the "onLoad" callback registered here:',C=Se(new Error(W),e,"onLoad"),K={},V=n(c,K,"filter",Ke),Y=n(c,K,"namespace",h);if(_(c,K,`in onLoad() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onLoad() call is missing a filter");let J=D++;N[J]={name:w,callback:v,note:C},b.onLoad.push({id:J,filter:V.source,namespace:Y||""})},esbuild:e.esbuild});I&&(yield I),O.push(b)}catch(a){return{ok:!1,error:a,pluginName:w}}}let B=E=>ae(this,null,function*(){switch(E.command){case"start":{let y={errors:[],warnings:[]};return yield Promise.all(j.map(I=>ae(this,[I],function*({name:w,callback:a,note:b}){try{let c=yield a();if(c!=null){if(typeof c!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(c,v,"errors",z),C=n(c,v,"warnings",z);_(c,v,`from onStart() callback in plugin ${JSON.stringify(w)}`),W!=null&&y.errors.push(...de(W,"errors",p,w)),C!=null&&y.warnings.push(...de(C,"warnings",p,w))}}catch(c){y.errors.push(he(c,e,p,b&&b(),w))}}))),y}case"resolve":{let y={},w="",a,b;for(let I of E.ids)try{({name:w,callback:a,note:b}=P[I]);let c=yield a({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:p.load(E.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(c,v,"pluginName",h),C=n(c,v,"path",h),K=n(c,v,"namespace",h),V=n(c,v,"suffix",h),Y=n(c,v,"external",L),J=n(c,v,"sideEffects",L),se=n(c,v,"pluginData",Ce),oe=n(c,v,"errors",z),A=n(c,v,"warnings",z),G=n(c,v,"watchFiles",z),H=n(c,v,"watchDirs",z);_(c,v,`from onResolve() callback in plugin ${JSON.stringify(w)}`),y.id=I,W!=null&&(y.pluginName=W),C!=null&&(y.path=C),K!=null&&(y.namespace=K),V!=null&&(y.suffix=V),Y!=null&&(y.external=Y),J!=null&&(y.sideEffects=J),se!=null&&(y.pluginData=p.store(se)),oe!=null&&(y.errors=de(oe,"errors",p,w)),A!=null&&(y.warnings=de(A,"warnings",p,w)),G!=null&&(y.watchFiles=xe(G,"watchFiles")),H!=null&&(y.watchDirs=xe(H,"watchDirs"));break}}catch(c){return{id:I,errors:[he(c,e,p,b&&b(),w)]}}return y}case"load":{let y={},w="",a,b;for(let I of E.ids)try{({name:w,callback:a,note:b}=N[I]);let c=yield a({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:p.load(E.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(c,v,"pluginName",h),C=n(c,v,"contents",dt),K=n(c,v,"resolveDir",h),V=n(c,v,"pluginData",Ce),Y=n(c,v,"loader",h),J=n(c,v,"errors",z),se=n(c,v,"warnings",z),oe=n(c,v,"watchFiles",z),A=n(c,v,"watchDirs",z);_(c,v,`from onLoad() callback in plugin ${JSON.stringify(w)}`),y.id=I,W!=null&&(y.pluginName=W),C instanceof Uint8Array?y.contents=C:C!=null&&(y.contents=ue(C)),K!=null&&(y.resolveDir=K),V!=null&&(y.pluginData=p.store(V)),Y!=null&&(y.loader=Y),J!=null&&(y.errors=de(J,"errors",p,w)),se!=null&&(y.warnings=de(se,"warnings",p,w)),oe!=null&&(y.watchFiles=xe(oe,"watchFiles")),A!=null&&(y.watchDirs=xe(A,"watchDirs"));break}}catch(c){return{id:I,errors:[he(c,e,p,b&&b(),w)]}}return y}default:throw new Error("Invalid command: "+E.command)}}),T=(E,y,w)=>w();M.length>0&&(T=(E,y,w)=>{(()=>ae(this,null,function*(){for(let{name:a,callback:b,note:I}of M)try{yield b(E)}catch(c){E.errors.push(yield new Promise(v=>y(c,a,I&&I(),v)))}}))().then(w)});let S=0;return{ok:!0,requestPlugins:O,runOnEndCallbacks:T,pluginRefs:{ref(){++S==1&&r.set(o,B)},unref(){--S==0&&r.delete(o)}}}}),le=(g,f,o)=>{let p={},j=n(f,p,"port",me),M=n(f,p,"host",h),P=n(f,p,"servedir",h),N=n(f,p,"onRequest",Ie),D=l++,$,O=new Promise((B,T)=>{$=S=>{d.delete(D),S!==null?T(new Error(S)):B()}});return o.serve={serveID:D},_(f,p,"in serve() call"),j!==void 0&&(o.serve.port=j),M!==void 0&&(o.serve.host=M),P!==void 0&&(o.serve.servedir=P),d.set(D,{onRequest:N,onWait:$}),{wait:O,stop(){k(g,{command:"serve-stop",serveID:D},()=>{})}}},ie="warning",fe="silent",X=g=>{let f=m++,o=Ge(),p,{refs:j,options:M,isTTY:P,callback:N}=g;if(typeof M=="object"){let O=M.plugins;if(O!==void 0){if(!Array.isArray(O))throw new Error('"plugins" must be an array');p=O}}let D=(O,B,T,S)=>{let E=[];try{Oe(E,M,{},P,ie)}catch(w){}let y=he(O,e,o,T,B);k(j,{command:"error",flags:E,error:y},()=>{y.detail=o.load(y.detail),S(y)})},$=(O,B)=>{D(O,B,void 0,T=>{N(be("Build failed",[T],[]),null)})};if(p&&p.length>0){if(e.isSync)return $(new Error("Cannot use plugins in synchronous API calls"),"");re(M,p,f,o).then(O=>{if(!O.ok)$(O.error,O.pluginName);else try{Re(Te(Be({},g),{key:f,details:o,logPluginError:D,requestPlugins:O.requestPlugins,runOnEndCallbacks:O.runOnEndCallbacks,pluginRefs:O.pluginRefs}))}catch(B){$(B,"")}},O=>$(O,""))}else try{Re(Te(Be({},g),{key:f,details:o,logPluginError:D,requestPlugins:null,runOnEndCallbacks:(O,B,T)=>T(),pluginRefs:null}))}catch(O){$(O,"")}},Re=({callName:g,refs:f,serveOptions:o,options:p,isTTY:j,defaultWD:M,callback:P,key:N,details:D,logPluginError:$,requestPlugins:O,runOnEndCallbacks:B,pluginRefs:T})=>{let S={ref(){T&&T.ref(),f&&f.ref()},unref(){T&&T.unref(),f&&f.unref()}},E=!e.isBrowser,{entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:I,absWorkingDir:c,incremental:v,nodePaths:W,watch:C}=pt(g,p,j,ie,E),K={command:"build",key:N,entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:I,absWorkingDir:c||M,incremental:v,nodePaths:W};O&&(K.plugins=O);let V=o&&le(S,o,K),Y,J,se=(A,G)=>{A.outputFiles&&(G.outputFiles=A.outputFiles.map(mt)),A.metafile&&(G.metafile=JSON.parse(A.metafile)),A.writeToStdout!==void 0&&console.log(ce(A.writeToStdout).replace(/\n$/,""))},oe=(A,G)=>{let H={errors:we(A.errors,D),warnings:we(A.warnings,D)};se(A,H),B(H,$,()=>{if(H.errors.length>0)return G(be("Build failed",H.errors,H.warnings),null);if(A.rebuildID!==void 0){if(!Y){let ne=!1;Y=()=>new Promise((pe,ge)=>{if(ne||u)throw new Error("Cannot rebuild");k(S,{command:"rebuild",rebuildID:A.rebuildID},(Z,Ze)=>{if(Z)return G(be("Build failed",[{pluginName:"",text:Z,location:null,notes:[],detail:void 0}],[]),null);oe(Ze,(Pe,et)=>{Pe?ge(Pe):pe(et)})})}),S.ref(),Y.dispose=()=>{ne||(ne=!0,k(S,{command:"rebuild-dispose",rebuildID:A.rebuildID},()=>{}),S.unref())}}H.rebuild=Y}if(A.watchID!==void 0){if(!J){let ne=!1;S.ref(),J=()=>{ne||(ne=!0,s.delete(A.watchID),k(S,{command:"watch-stop",watchID:A.watchID},()=>{}),S.unref())},C&&s.set(A.watchID,(pe,ge)=>{if(pe){C.onRebuild&&C.onRebuild(pe,null);return}let Z={errors:we(ge.errors,D),warnings:we(ge.warnings,D)};se(ge,Z),B(Z,$,()=>{if(Z.errors.length>0){C.onRebuild&&C.onRebuild(be("Build failed",Z.errors,Z.warnings),null);return}ge.rebuildID!==void 0&&(Z.rebuild=Y),Z.stop=J,C.onRebuild&&C.onRebuild(null,Z)})})}H.stop=J}G(null,H)})};if(a&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(v&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(C&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(S,K,(A,G)=>{if(A)return P(new Error(A),null);if(V){let H=G,ne=!1;S.ref();let pe={port:H.port,host:H.host,wait:V.wait,stop(){ne||(ne=!0,V.stop(),S.unref())}};return S.ref(),V.wait.then(S.unref,S.unref),P(null,pe)}return oe(G,P)})};return{readFromStdout:F,afterClose:U,service:{buildOrServe:X,transform:({callName:g,refs:f,input:o,options:p,isTTY:j,fs:M,callback:P})=>{let N=Ge(),D=$=>{try{if(typeof o!="string")throw new Error('The input to "transform" must be a string');let O=gt(g,p,j,fe);k(f,{command:"transform",flags:O,inputFS:$!==null,input:$!==null?$:o},(T,S)=>{if(T)return P(new Error(T),null);let E=we(S.errors,N),y=we(S.warnings,N),w=1,a=()=>--w==0&&P(null,{warnings:y,code:S.code,map:S.map});if(E.length>0)return P(be("Transform failed",E,y),null);S.codeFS&&(w++,M.readFile(S.code,(b,I)=>{b!==null?P(b,null):(S.code=I,a())})),S.mapFS&&(w++,M.readFile(S.map,(b,I)=>{b!==null?P(b,null):(S.map=I,a())})),a()})}catch(O){let B=[];try{Oe(B,p,{},j,fe)}catch(S){}let T=he(O,e,N,void 0,"");k(f,{command:"error",flags:B,error:T},()=>{T.detail=N.load(T.detail),P(be("Transform failed",[T],[]),null)})}};if(typeof o=="string"&&o.length>1024*1024){let $=D;D=()=>M.writeFile(o,$)}D(null)},formatMessages:({callName:g,refs:f,messages:o,options:p,callback:j})=>{let M=de(o,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${g}() call`);let P={},N=n(p,P,"kind",h),D=n(p,P,"color",L),$=n(p,P,"terminalWidth",me);if(_(p,P,`in ${g}() call`),N===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(N!=="error"&&N!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let O={command:"format-msgs",messages:M,isWarning:N==="warning"};D!==void 0&&(O.color=D),$!==void 0&&(O.terminalWidth=$),k(f,O,(B,T)=>{if(B)return j(new Error(B),null);j(null,T.messages)})},analyzeMetafile:({callName:g,refs:f,metafile:o,options:p,callback:j})=>{p===void 0&&(p={});let M={},P=n(p,M,"color",L),N=n(p,M,"verbose",L);_(p,M,`in ${g}() call`);let D={command:"analyze-metafile",metafile:o};P!==void 0&&(D.color=P),N!==void 0&&(D.verbose=N),k(f,D,($,O)=>{if($)return j(new Error($),null);j(null,O.result)})}}}}function Ge(){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 Se(e,t,r){let s,d=!1;return()=>{if(d)return s;d=!0;try{let l=(e.stack+"").split(`
|
3
|
-
`);l.splice(1,1);let
|
4
|
-
`),"")}catch(
|
1
|
+
(module=>{
|
2
|
+
var Oe=Object.defineProperty,rt=Object.defineProperties,nt=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertyNames,qe=Object.getOwnPropertySymbols;var We=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable;var Ie=(e,t,r)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Te=(e,t)=>{for(var r in t||(t={}))We.call(t,r)&&Ie(e,r,t[r]);if(qe)for(var r of qe(t))st.call(t,r)&&Ie(e,r,t[r]);return e},De=(e,t)=>rt(e,lt(t)),ot=e=>Oe(e,"__esModule",{value:!0});var at=(e,t)=>{for(var r in t)Oe(e,r,{get:t[r],enumerable:!0})},ut=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of it(t))!We.call(e,u)&&(r||u!=="default")&&Oe(e,u,{get:()=>t[u],enumerable:!(o=nt(t,u))||o.enumerable});return e};var ft=(e=>(t,r)=>e&&e.get(t)||(r=ut(ot({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var fe=(e,t,r)=>new Promise((o,u)=>{var l=d=>{try{s(r.next(d))}catch(R){u(R)}},c=d=>{try{s(r.throw(d))}catch(R){u(R)}},s=d=>d.done?o(d.value):Promise.resolve(d.value).then(l,c);s((r=r.apply(e,t)).next())});var Ue={};at(Ue,{analyzeMetafile:()=>Et,analyzeMetafileSync:()=>Bt,build:()=>Ot,buildSync:()=>$t,formatMessages:()=>kt,formatMessagesSync:()=>Mt,initialize:()=>Tt,serve:()=>St,transform:()=>xt,transformSync:()=>Pt,version:()=>Rt});function Ae(e){let t=o=>{if(o===null)r.write8(0);else if(typeof o=="boolean")r.write8(1),r.write8(+o);else if(typeof o=="number")r.write8(2),r.write32(o|0);else if(typeof o=="string")r.write8(3),r.write(ce(o));else if(o instanceof Uint8Array)r.write8(4),r.write(o);else if(o instanceof Array){r.write8(5),r.write32(o.length);for(let u of o)t(u)}else{let u=Object.keys(o);r.write8(6),r.write32(u.length);for(let l of u)r.write(ce(l)),t(o[l])}},r=new Fe;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 ze(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return me(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[me(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new Fe(e),o=r.read32(),u=(o&1)===0;o>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:u,value:l}}var Fe=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 Ne(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),o=this._read(r.length);return r.set(this.buf.subarray(o,o+t)),r}},ce,me;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ce=r=>e.encode(r),me=r=>t.decode(r)}else if(typeof Buffer!="undefined")ce=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},me=e=>{let{buffer:t,byteOffset:r,byteLength:o}=e;return Buffer.from(t,r,o).toString()};else throw new Error("No UTF-8 codec found");function Ne(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 Ke(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Se=()=>null,U=e=>typeof e=="boolean"?null:"a boolean",dt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",_e=e=>e instanceof RegExp?null:"a RegExp object",he=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ce=e=>typeof e=="function"?null:"a function",K=e=>Array.isArray(e)?null:"an array",be=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",pt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ve=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Je=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",gt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",mt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",yt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let u=e[r];if(t[r+""]=!0,u===void 0)return;let l=o(u);if(l!==null)throw new Error(`"${r}" must be ${l}`);return u}function J(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Ye(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),o=n(e,t,"worker",U);return J(e,t,"in startService() call"),{wasmURL:r,worker:o}}function xe(e,t,r,o,u){let l=n(t,r,"color",U),c=n(t,r,"logLevel",y),s=n(t,r,"logLimit",he);l!==void 0?e.push(`--color=${l}`):o&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${s||0}`)}function He(e,t,r){let o=n(t,r,"legalComments",y),u=n(t,r,"sourceRoot",y),l=n(t,r,"sourcesContent",U),c=n(t,r,"target",mt),s=n(t,r,"format",y),d=n(t,r,"globalName",y),R=n(t,r,"minify",U),D=n(t,r,"minifySyntax",U),C=n(t,r,"minifyWhitespace",U),P=n(t,r,"minifyIdentifiers",U),S=n(t,r,"drop",K),ne=n(t,r,"charset",y),re=n(t,r,"treeShaking",U),le=n(t,r,"ignoreAnnotations",U),ie=n(t,r,"jsx",y),se=n(t,r,"jsxFactory",y),ue=n(t,r,"jsxFragment",y),oe=n(t,r,"define",be),pe=n(t,r,"pure",K),ge=n(t,r,"keepNames",U);if(o&&e.push(`--legal-comments=${o}`),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(Ke).join(",")}`):e.push(`--target=${Ke(c)}`)),s&&e.push(`--format=${s}`),d&&e.push(`--global-name=${d}`),R&&e.push("--minify"),D&&e.push("--minify-syntax"),C&&e.push("--minify-whitespace"),P&&e.push("--minify-identifiers"),ne&&e.push(`--charset=${ne}`),re!==void 0&&e.push(`--tree-shaking=${re}`),le&&e.push("--ignore-annotations"),S)for(let ee of S)e.push(`--drop:${ee}`);if(ie&&e.push(`--jsx=${ie}`),se&&e.push(`--jsx-factory=${se}`),ue&&e.push(`--jsx-fragment=${ue}`),oe)for(let ee in oe){if(ee.indexOf("=")>=0)throw new Error(`Invalid define: ${ee}`);e.push(`--define:${ee}=${oe[ee]}`)}if(pe)for(let ee of pe)e.push(`--pure:${ee}`);ge&&e.push("--keep-names")}function ht(e,t,r,o,u){var b;let l=[],c=[],s=Object.create(null),d=null,R=null,D=null;xe(l,t,s,r,o),He(l,t,s);let C=n(t,s,"sourcemap",Je),P=n(t,s,"bundle",U),S=n(t,s,"watch",dt),ne=n(t,s,"splitting",U),re=n(t,s,"preserveSymlinks",U),le=n(t,s,"metafile",U),ie=n(t,s,"outfile",y),se=n(t,s,"outdir",y),ue=n(t,s,"outbase",y),oe=n(t,s,"platform",y),pe=n(t,s,"tsconfig",y),ge=n(t,s,"resolveExtensions",K),ee=n(t,s,"nodePaths",K),Pe=n(t,s,"mainFields",K),Me=n(t,s,"conditions",K),g=n(t,s,"external",K),f=n(t,s,"loader",be),a=n(t,s,"outExtension",be),p=n(t,s,"publicPath",y),j=n(t,s,"entryNames",y),N=n(t,s,"chunkNames",y),M=n(t,s,"assetNames",y),E=n(t,s,"inject",K),A=n(t,s,"banner",be),B=n(t,s,"footer",be),w=n(t,s,"entryPoints",pt),L=n(t,s,"absWorkingDir",y),k=n(t,s,"stdin",be),O=(b=n(t,s,"write",U))!=null?b:u,te=n(t,s,"allowOverwrite",U),X=n(t,s,"incremental",U)===!0;if(s.plugins=!0,J(t,s,`in ${e}() call`),C&&l.push(`--sourcemap${C===!0?"":`=${C}`}`),P&&l.push("--bundle"),te&&l.push("--allow-overwrite"),S)if(l.push("--watch"),typeof S=="boolean")D={};else{let i=Object.create(null),v=n(S,i,"onRebuild",Ce);J(S,i,`on "watch" in ${e}() call`),D={onRebuild:v}}if(ne&&l.push("--splitting"),re&&l.push("--preserve-symlinks"),le&&l.push("--metafile"),ie&&l.push(`--outfile=${ie}`),se&&l.push(`--outdir=${se}`),ue&&l.push(`--outbase=${ue}`),oe&&l.push(`--platform=${oe}`),pe&&l.push(`--tsconfig=${pe}`),ge){let i=[];for(let v of ge){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);i.push(v)}l.push(`--resolve-extensions=${i.join(",")}`)}if(p&&l.push(`--public-path=${p}`),j&&l.push(`--entry-names=${j}`),N&&l.push(`--chunk-names=${N}`),M&&l.push(`--asset-names=${M}`),Pe){let i=[];for(let v of Pe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);i.push(v)}l.push(`--main-fields=${i.join(",")}`)}if(Me){let i=[];for(let v of Me){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);i.push(v)}l.push(`--conditions=${i.join(",")}`)}if(g)for(let i of g)l.push(`--external:${i}`);if(A)for(let i in A){if(i.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${i}`);l.push(`--banner:${i}=${A[i]}`)}if(B)for(let i in B){if(i.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${i}`);l.push(`--footer:${i}=${B[i]}`)}if(E)for(let i of E)l.push(`--inject:${i}`);if(f)for(let i in f){if(i.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${i}`);l.push(`--loader:${i}=${f[i]}`)}if(a)for(let i in a){if(i.indexOf("=")>=0)throw new Error(`Invalid out extension: ${i}`);l.push(`--out-extension:${i}=${a[i]}`)}if(w)if(Array.isArray(w))for(let i of w)c.push(["",i+""]);else for(let[i,v]of Object.entries(w))c.push([i+"",v+""]);if(k){let i=Object.create(null),v=n(k,i,"contents",y),q=n(k,i,"resolveDir",y),Y=n(k,i,"sourcefile",y),h=n(k,i,"loader",y);J(k,i,'in "stdin" object'),Y&&l.push(`--sourcefile=${Y}`),h&&l.push(`--loader=${h}`),q&&(R=q+""),d=v?v+"":""}let x=[];if(ee)for(let i of ee)i+="",x.push(i);return{entries:c,flags:l,write:O,stdinContents:d,stdinResolveDir:R,absWorkingDir:L,incremental:X,nodePaths:x,watch:D}}function bt(e,t,r,o){let u=[],l=Object.create(null);xe(u,t,l,r,o),He(u,t,l);let c=n(t,l,"sourcemap",Je),s=n(t,l,"tsconfigRaw",gt),d=n(t,l,"sourcefile",y),R=n(t,l,"loader",y),D=n(t,l,"banner",y),C=n(t,l,"footer",y);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}`),R&&u.push(`--loader=${R}`),D&&u.push(`--banner=${D}`),C&&u.push(`--footer=${C}`),u}function Ge(e){let t=new Map,r=new Map,o=new Map,u=new Map,l=!1,c=0,s=0,d=new Uint8Array(16*1024),R=0,D=g=>{let f=R+g.length;if(f>d.length){let p=new Uint8Array(f*2);p.set(d),d=p}d.set(g,R),R+=g.length;let a=0;for(;a+4<=R;){let p=Ne(d,a);if(a+4+p>R)break;a+=4,le(d.subarray(a,a+p)),a+=p}a>0&&(d.copyWithin(0,a,R),R-=a)},C=()=>{l=!0;for(let g of t.values())g("The service was stopped",null);t.clear();for(let g of u.values())g.onWait("The service was stopped");u.clear();for(let g of o.values())try{g(new Error("The service was stopped"),null)}catch(f){console.error(f)}o.clear()},P=(g,f,a)=>{if(l)return a("The service is no longer running",null);let p=c++;t.set(p,(j,N)=>{try{a(j,N)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ae({id:p,isRequest:!0,value:f}))},S=(g,f)=>{if(l)throw new Error("The service is no longer running");e.writeToStdin(Ae({id:g,isRequest:!1,value:f}))},ne=(g,f)=>fe(this,null,function*(){try{switch(f.command){case"ping":{S(g,{});break}case"on-start":{let a=r.get(f.key);a?S(g,yield a(f)):S(g,{});break}case"on-resolve":{let a=r.get(f.key);a?S(g,yield a(f)):S(g,{});break}case"on-load":{let a=r.get(f.key);a?S(g,yield a(f)):S(g,{});break}case"serve-request":{let a=u.get(f.key);a&&a.onRequest&&a.onRequest(f.args),S(g,{});break}case"serve-wait":{let a=u.get(f.key);a&&a.onWait(f.error),S(g,{});break}case"watch-rebuild":{let a=o.get(f.key);try{a&&a(null,f.args)}catch(p){console.error(p)}S(g,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(a){S(g,{errors:[we(a,e,null,void 0,"")]})}}),re=!0,le=g=>{if(re){re=!1;let a=String.fromCharCode(...g);if(a!=="0.14.11")throw new Error(`Cannot start service: Host version "0.14.11" does not match binary version ${JSON.stringify(a)}`);return}let f=ze(g);if(f.isRequest)ne(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=(g,f,a,p,j)=>fe(this,null,function*(){let N=[],M=[],E={},A={},B=0,w=0,L=[],k=!1;f=[...f];for(let x of f){let b={};if(typeof x!="object")throw new Error(`Plugin at index ${w} must be an object`);let i=n(x,b,"name",y);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${w} is missing a name`);try{let v=n(x,b,"setup",Ce);if(typeof v!="function")throw new Error("Plugin is missing a setup function");J(x,b,`on plugin ${JSON.stringify(i)}`);let q={name:i,onResolve:[],onLoad:[]};w++;let h=v({initialOptions:g,resolve:(m,F={})=>{if(!k)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof m!="string")throw new Error("The path to resolve must be a string");let $=Object.create(null),_=n(F,$,"pluginName",y),W=n(F,$,"importer",y),H=n(F,$,"namespace",y),Q=n(F,$,"resolveDir",y),T=n(F,$,"kind",y),V=n(F,$,"pluginData",Se);return J(F,$,"in resolve() call"),new Promise((z,Z)=>{let G={command:"resolve",path:m,key:a,pluginName:i};_!=null&&(G.pluginName=_),W!=null&&(G.importer=W),H!=null&&(G.namespace=H),Q!=null&&(G.resolveDir=Q),T!=null&&(G.kind=T),V!=null&&(G.pluginData=p.store(V)),P(j,G,(ae,I)=>{ae!==null?Z(new Error(ae)):z({errors:de(I.errors,p),warnings:de(I.warnings,p),path:I.path,external:I.external,sideEffects:I.sideEffects,namespace:I.namespace,suffix:I.suffix,pluginData:p.load(I.pluginData)})})})},onStart(m){let F='This error came from the "onStart" callback registered here:',$=ke(new Error(F),e,"onStart");N.push({name:i,callback:m,note:$})},onEnd(m){let F='This error came from the "onEnd" callback registered here:',$=ke(new Error(F),e,"onEnd");M.push({name:i,callback:m,note:$})},onResolve(m,F){let $='This error came from the "onResolve" callback registered here:',_=ke(new Error($),e,"onResolve"),W={},H=n(m,W,"filter",_e),Q=n(m,W,"namespace",y);if(J(m,W,`in onResolve() call for plugin ${JSON.stringify(i)}`),H==null)throw new Error("onResolve() call is missing a filter");let T=B++;E[T]={name:i,callback:F,note:_},q.onResolve.push({id:T,filter:H.source,namespace:Q||""})},onLoad(m,F){let $='This error came from the "onLoad" callback registered here:',_=ke(new Error($),e,"onLoad"),W={},H=n(m,W,"filter",_e),Q=n(m,W,"namespace",y);if(J(m,W,`in onLoad() call for plugin ${JSON.stringify(i)}`),H==null)throw new Error("onLoad() call is missing a filter");let T=B++;A[T]={name:i,callback:F,note:_},q.onLoad.push({id:T,filter:H.source,namespace:Q||""})},esbuild:e.esbuild});h&&(yield h),L.push(q)}catch(v){return{ok:!1,error:v,pluginName:i}}}let O=x=>fe(this,null,function*(){switch(x.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(N.map(Y=>fe(this,[Y],function*({name:i,callback:v,note:q}){try{let h=yield v();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(h,m,"errors",K),$=n(h,m,"warnings",K);J(h,m,`from onStart() callback in plugin ${JSON.stringify(i)}`),F!=null&&b.errors.push(...ye(F,"errors",p,i)),$!=null&&b.warnings.push(...ye($,"warnings",p,i))}}catch(h){b.errors.push(we(h,e,p,q&&q(),i))}}))),b}case"on-resolve":{let b={},i="",v,q;for(let Y of x.ids)try{({name:i,callback:v,note:q}=E[Y]);let h=yield v({path:x.path,importer:x.importer,namespace:x.namespace,resolveDir:x.resolveDir,kind:x.kind,pluginData:p.load(x.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(h,m,"pluginName",y),$=n(h,m,"path",y),_=n(h,m,"namespace",y),W=n(h,m,"suffix",y),H=n(h,m,"external",U),Q=n(h,m,"sideEffects",U),T=n(h,m,"pluginData",Se),V=n(h,m,"errors",K),z=n(h,m,"warnings",K),Z=n(h,m,"watchFiles",K),G=n(h,m,"watchDirs",K);J(h,m,`from onResolve() callback in plugin ${JSON.stringify(i)}`),b.id=Y,F!=null&&(b.pluginName=F),$!=null&&(b.path=$),_!=null&&(b.namespace=_),W!=null&&(b.suffix=W),H!=null&&(b.external=H),Q!=null&&(b.sideEffects=Q),T!=null&&(b.pluginData=p.store(T)),V!=null&&(b.errors=ye(V,"errors",p,i)),z!=null&&(b.warnings=ye(z,"warnings",p,i)),Z!=null&&(b.watchFiles=Ee(Z,"watchFiles")),G!=null&&(b.watchDirs=Ee(G,"watchDirs"));break}}catch(h){return{id:Y,errors:[we(h,e,p,q&&q(),i)]}}return b}case"on-load":{let b={},i="",v,q;for(let Y of x.ids)try{({name:i,callback:v,note:q}=A[Y]);let h=yield v({path:x.path,namespace:x.namespace,suffix:x.suffix,pluginData:p.load(x.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(h,m,"pluginName",y),$=n(h,m,"contents",yt),_=n(h,m,"resolveDir",y),W=n(h,m,"pluginData",Se),H=n(h,m,"loader",y),Q=n(h,m,"errors",K),T=n(h,m,"warnings",K),V=n(h,m,"watchFiles",K),z=n(h,m,"watchDirs",K);J(h,m,`from onLoad() callback in plugin ${JSON.stringify(i)}`),b.id=Y,F!=null&&(b.pluginName=F),$ instanceof Uint8Array?b.contents=$:$!=null&&(b.contents=ce($)),_!=null&&(b.resolveDir=_),W!=null&&(b.pluginData=p.store(W)),H!=null&&(b.loader=H),Q!=null&&(b.errors=ye(Q,"errors",p,i)),T!=null&&(b.warnings=ye(T,"warnings",p,i)),V!=null&&(b.watchFiles=Ee(V,"watchFiles")),z!=null&&(b.watchDirs=Ee(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[we(h,e,p,q&&q(),i)]}}return b}default:throw new Error("Invalid command: "+x.command)}}),te=(x,b,i)=>i();M.length>0&&(te=(x,b,i)=>{(()=>fe(this,null,function*(){for(let{name:v,callback:q,note:Y}of M)try{yield q(x)}catch(h){x.errors.push(yield new Promise(m=>b(h,v,Y&&Y(),m)))}}))().then(i)}),k=!0;let X=0;return{ok:!0,requestPlugins:L,runOnEndCallbacks:te,pluginRefs:{ref(){++X===1&&r.set(a,O)},unref(){--X===0&&r.delete(a)}}}}),se=(g,f,a,p)=>{let j={},N=n(f,j,"port",he),M=n(f,j,"host",y),E=n(f,j,"servedir",y),A=n(f,j,"onRequest",Ce),B,w=new Promise((L,k)=>{B=O=>{u.delete(p),O!==null?k(new Error(O)):L()}});return a.serve={},J(f,j,"in serve() call"),N!==void 0&&(a.serve.port=N),M!==void 0&&(a.serve.host=M),E!==void 0&&(a.serve.servedir=E),u.set(p,{onRequest:A,onWait:B}),{wait:w,stop(){P(g,{command:"serve-stop",key:p},()=>{})}}},ue="warning",oe="silent",pe=g=>{let f=s++,a=Qe(),p,{refs:j,options:N,isTTY:M,callback:E}=g;if(typeof N=="object"){let w=N.plugins;if(w!==void 0){if(!Array.isArray(w))throw new Error('"plugins" must be an array');p=w}}let A=(w,L,k,O)=>{let te=[];try{xe(te,N,{},M,ue)}catch(x){}let X=we(w,e,a,k,L);P(j,{command:"error",flags:te,error:X},()=>{X.detail=a.load(X.detail),O(X)})},B=(w,L)=>{A(w,L,void 0,k=>{E(ve("Build failed",[k],[]),null)})};if(p&&p.length>0){if(e.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");ie(N,p,f,a,j).then(w=>{if(!w.ok)B(w.error,w.pluginName);else try{ge(De(Te({},g),{key:f,details:a,logPluginError:A,requestPlugins:w.requestPlugins,runOnEndCallbacks:w.runOnEndCallbacks,pluginRefs:w.pluginRefs}))}catch(L){B(L,"")}},w=>B(w,""))}else try{ge(De(Te({},g),{key:f,details:a,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(w,L,k)=>k(),pluginRefs:null}))}catch(w){B(w,"")}},ge=({callName:g,refs:f,serveOptions:a,options:p,isTTY:j,defaultWD:N,callback:M,key:E,details:A,logPluginError:B,requestPlugins:w,runOnEndCallbacks:L,pluginRefs:k})=>{let O={ref(){k&&k.ref(),f&&f.ref()},unref(){k&&k.unref(),f&&f.unref()}},te=!e.isBrowser,{entries:X,flags:x,write:b,stdinContents:i,stdinResolveDir:v,absWorkingDir:q,incremental:Y,nodePaths:h,watch:m}=ht(g,p,j,ue,te),F={command:"build",key:E,entries:X,flags:x,write:b,stdinContents:i,stdinResolveDir:v,absWorkingDir:q||N,incremental:Y,nodePaths:h};w&&(F.plugins=w);let $=a&&se(O,a,F,E),_,W,H=(T,V)=>{T.outputFiles&&(V.outputFiles=T.outputFiles.map(wt)),T.metafile&&(V.metafile=JSON.parse(T.metafile)),T.writeToStdout!==void 0&&console.log(me(T.writeToStdout).replace(/\n$/,""))},Q=(T,V)=>{let z={errors:de(T.errors,A),warnings:de(T.warnings,A)};H(T,z),L(z,B,()=>{if(z.errors.length>0)return V(ve("Build failed",z.errors,z.warnings),null);if(T.rebuild){if(!_){let Z=!1;_=()=>new Promise((G,ae)=>{if(Z||l)throw new Error("Cannot rebuild");P(O,{command:"rebuild",key:E},(I,et)=>{if(I)return V(ve("Build failed",[{pluginName:"",text:I,location:null,notes:[],detail:void 0}],[]),null);Q(et,(Be,tt)=>{Be?ae(Be):G(tt)})})}),O.ref(),_.dispose=()=>{Z||(Z=!0,P(O,{command:"rebuild-dispose",key:E},()=>{}),O.unref())}}z.rebuild=_}if(T.watch){if(!W){let Z=!1;O.ref(),W=()=>{Z||(Z=!0,o.delete(E),P(O,{command:"watch-stop",key:E},()=>{}),O.unref())},m&&o.set(E,(G,ae)=>{if(G){m.onRebuild&&m.onRebuild(G,null);return}let I={errors:de(ae.errors,A),warnings:de(ae.warnings,A)};H(ae,I),L(I,B,()=>{if(I.errors.length>0){m.onRebuild&&m.onRebuild(ve("Build failed",I.errors,I.warnings),null);return}ae.rebuildID!==void 0&&(I.rebuild=_),I.stop=W,m.onRebuild&&m.onRebuild(null,I)})})}z.stop=W}V(null,z)})};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(m&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');P(O,F,(T,V)=>{if(T)return M(new Error(T),null);if($){let z=V,Z=!1;O.ref();let G={port:z.port,host:z.host,wait:$.wait,stop(){Z||(Z=!0,$.stop(),O.unref())}};return O.ref(),$.wait.then(O.unref,O.unref),M(null,G)}return Q(V,M)})};return{readFromStdout:D,afterClose:C,service:{buildOrServe:pe,transform:({callName:g,refs:f,input:a,options:p,isTTY:j,fs:N,callback:M})=>{let E=Qe(),A=B=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let w=bt(g,p,j,oe);P(f,{command:"transform",flags:w,inputFS:B!==null,input:B!==null?B:a},(k,O)=>{if(k)return M(new Error(k),null);let te=de(O.errors,E),X=de(O.warnings,E),x=1,b=()=>--x===0&&M(null,{warnings:X,code:O.code,map:O.map});if(te.length>0)return M(ve("Transform failed",te,X),null);O.codeFS&&(x++,N.readFile(O.code,(i,v)=>{i!==null?M(i,null):(O.code=v,b())})),O.mapFS&&(x++,N.readFile(O.map,(i,v)=>{i!==null?M(i,null):(O.map=v,b())})),b()})}catch(w){let L=[];try{xe(L,p,{},j,oe)}catch(O){}let k=we(w,e,E,void 0,"");P(f,{command:"error",flags:L,error:k},()=>{k.detail=E.load(k.detail),M(ve("Transform failed",[k],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let B=A;A=()=>N.writeFile(a,B)}A(null)},formatMessages:({callName:g,refs:f,messages:a,options:p,callback:j})=>{let N=ye(a,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${g}() call`);let M={},E=n(p,M,"kind",y),A=n(p,M,"color",U),B=n(p,M,"terminalWidth",he);if(J(p,M,`in ${g}() call`),E===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let w={command:"format-msgs",messages:N,isWarning:E==="warning"};A!==void 0&&(w.color=A),B!==void 0&&(w.terminalWidth=B),P(f,w,(L,k)=>{if(L)return j(new Error(L),null);j(null,k.messages)})},analyzeMetafile:({callName:g,refs:f,metafile:a,options:p,callback:j})=>{p===void 0&&(p={});let N={},M=n(p,N,"color",U),E=n(p,N,"verbose",U);J(p,N,`in ${g}() call`);let A={command:"analyze-metafile",metafile:a};M!==void 0&&(A.color=M),E!==void 0&&(A.verbose=E),P(f,A,(B,w)=>{if(B)return j(new Error(B),null);j(null,w.result)})}}}}function Qe(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let o=t++;return e.set(o,r),o}}}function ke(e,t,r){let o,u=!1;return()=>{if(u)return o;u=!0;try{let l=(e.stack+"").split(`
|
3
|
+
`);l.splice(1,1);let c=Xe(t,l,r);if(c)return o={text:e.message,location:c},o}catch(l){}}}function we(e,t,r,o,u){let l="Internal error",c=null;try{l=(e&&e.message||e)+""}catch(s){}try{c=Xe(t,(e.stack+"").split(`
|
4
|
+
`),"")}catch(s){}return{pluginName:u,text:l,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function Xe(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let u=1;u<t.length;u++){let l=t[u];if(!!l.startsWith(o))for(l=l.slice(o.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(C){break}let d=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",R=+c[3]-1,D=d.slice(R,R+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:ce(d.slice(0,R)).length,length:ce(d.slice(R,R+D)).length,lineText:d+`
|
5
5
|
`+t.slice(1).join(`
|
6
|
-
`),suggestion:""}}break}}return null}function
|
7
|
-
...`;if(!
|
8
|
-
error: ${
|
9
|
-
${m}:${R}:${x}: ERROR: ${F}${u.text}`}).join(""),l=new Error(`${e}${d}`);return l.errors=t,l.warnings=r,l}function we(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Xe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",h),d=n(e,r,"namespace",h),l=n(e,r,"line",me),u=n(e,r,"column",me),i=n(e,r,"length",me),m=n(e,r,"lineText",h),R=n(e,r,"suggestion",h);return _(e,r,t),{file:s||"",namespace:d||"",line:l||0,column:u||0,length:i||0,lineText:m||"",suggestion:R||""}}function de(e,t,r,s){let d=[],l=0;for(let u of e){let i={},m=n(u,i,"pluginName",h),R=n(u,i,"text",h),x=n(u,i,"location",_e),F=n(u,i,"notes",z),U=n(u,i,"detail",Ce),k=`in element ${l} of "${t}"`;_(u,i,k);let q=[];if(F)for(let ee of F){let Q={},te=n(ee,Q,"text",h),re=n(ee,Q,"location",_e);_(ee,Q,k),q.push({text:te||"",location:Xe(re,k)})}d.push({pluginName:m||s,text:R||"",location:Xe(x,k),notes:q,detail:r?r.store(U):-1}),l++}return d}function xe(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 mt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=ce(t)),r}}}var ht="0.14.3",bt=e=>ke().build(e),wt=()=>{throw new Error('The "serve" API only works in node')},vt=(e,t)=>ke().transform(e,t),Rt=(e,t)=>ke().formatMessages(e,t),Ot=(e,t)=>ke().analyzeMetafile(e,t),St=()=>{throw new Error('The "buildSync" API only works in node')},xt=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Et=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ve,Le,ke=()=>{if(Le)return Le;throw ve?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')},$t=e=>{e=Je(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",ve)throw new Error('Cannot call "initialize" more than once');return ve=Dt(t,r),ve.catch(()=>{ve=void 0}),ve},Dt=(e,t)=>ae(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let s=yield r.arrayBuffer(),d='{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 y=(a,g,f)=>new Promise((r,n)=>{var s=h=>{try{l(f.next(h))}catch(u){n(u)}},i=h=>{try{l(f.throw(h))}catch(u){n(u)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(s,i);l((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,l,h,u){if(i===0&&l===s.length&&h===null){if(n===process.stdout.fd){try{process.stdout.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}if(n===process.stderr.fd){try{process.stderr.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}}r.write(n,s,i,l,h,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+=f.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,l,h,u){if(i!==0||l!==s.length||h!==null){u(a());return}const m=this.writeSync(n,s);u(null,m)},chmod(n,s,i){i(a())},chown(n,s,i,l){l(a())},close(n,s){s(a())},fchmod(n,s,i){i(a())},fchown(n,s,i,l){l(a())},fstat(n,s){s(a())},fsync(n,s){s(null)},ftruncate(n,s,i){i(a())},lchown(n,s,i,l){l(a())},link(n,s,i){i(a())},lstat(n,s){s(a())},mkdir(n,s,i){i(a())},open(n,s,i,l){l(a())},read(n,s,i,l,h,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,l){l(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 g=new TextEncoder("utf-8"),f=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),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)=>{const o=2146959360;if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,o,!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,o|d,!0),this.mem.setUint32(e,c,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),c=new Array(o);for(let d=0;d<o;d++)c[d]=s(t+d*8);return c},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},m=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),c=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,c))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,r(e+8,(m+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(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)),c=h(e+32),d=Reflect.apply(o,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),o=h(e+16),c=Reflect.apply(t,void 0,o);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),o=h(e+16),c=Reflect.construct(t,o);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=g.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);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 c=o.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),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=o.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 y(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,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 m=4096+8192;if(n>=m)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(fs.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.3"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',l;if(t){let m=new Blob([d],{type:"text/javascript"});l=new Worker(URL.createObjectURL(m))}else{let R=new Function("postMessage",d+"var onmessage; return m => onmessage(m)")(x=>l.onmessage({data:x}));l={onmessage:null,postMessage:x=>R({data:x}),terminate(){}}}l.postMessage(s),l.onmessage=({data:m})=>u(m);let{readFromStdout:u,service:i}=He({writeToStdin(m){l.postMessage(m)},isSync:!1,isBrowser:!0,esbuild:exports});Le={build:m=>new Promise((R,x)=>i.buildOrServe({callName:"build",refs:null,serveOptions:null,options:m,isTTY:!1,defaultWD:"/",callback:(F,U)=>F?x(F):R(U)})),transform:(m,R)=>new Promise((x,F)=>i.transform({callName:"transform",refs:null,input:m,options:R||{},isTTY:!1,fs:{readFile(U,k){k(new Error("Internal error"),null)},writeFile(U,k){k(null)}},callback:(U,k)=>U?F(U):x(k)})),formatMessages:(m,R)=>new Promise((x,F)=>i.formatMessages({callName:"formatMessages",refs:null,messages:m,options:R,callback:(U,k)=>U?F(U):x(k)})),analyzeMetafile:(m,R)=>new Promise((x,F)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof m=="string"?m:JSON.stringify(m),options:R,callback:(U,k)=>U?F(U):x(k)}))}});
|
10
|
-
})(typeof
|
6
|
+
`),suggestion:""}}break}}return null}function ve(e,t,r){let o=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((c,s)=>{if(s===o)return`
|
7
|
+
...`;if(!c.location)return`
|
8
|
+
error: ${c.text}`;let{file:d,line:R,column:D}=c.location,C=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
|
9
|
+
${d}:${R}:${D}: ERROR: ${C}${c.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=r,l}function de(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Ze(e,t){if(e==null)return null;let r={},o=n(e,r,"file",y),u=n(e,r,"namespace",y),l=n(e,r,"line",he),c=n(e,r,"column",he),s=n(e,r,"length",he),d=n(e,r,"lineText",y),R=n(e,r,"suggestion",y);return J(e,r,t),{file:o||"",namespace:u||"",line:l||0,column:c||0,length:s||0,lineText:d||"",suggestion:R||""}}function ye(e,t,r,o){let u=[],l=0;for(let c of e){let s={},d=n(c,s,"pluginName",y),R=n(c,s,"text",y),D=n(c,s,"location",Ve),C=n(c,s,"notes",K),P=n(c,s,"detail",Se),S=`in element ${l} of "${t}"`;J(c,s,S);let ne=[];if(C)for(let re of C){let le={},ie=n(re,le,"text",y),se=n(re,le,"location",Ve);J(re,le,S),ne.push({text:ie||"",location:Ze(se,S)})}u.push({pluginName:d||o,text:R||"",location:Ze(D,S),notes:ne,detail:r?r.store(P):-1}),l++}return u}function Ee(e,t){let r=[];for(let o of e){if(typeof o!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(o)}return r}function wt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=me(t)),r}}}var Rt="0.14.11",Ot=e=>$e().build(e),St=()=>{throw new Error('The "serve" API only works in node')},xt=(e,t)=>$e().transform(e,t),kt=(e,t)=>$e().formatMessages(e,t),Et=(e,t)=>$e().analyzeMetafile(e,t),$t=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},Mt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Re,Le,$e=()=>{if(Le)return Le;throw Re?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=Ye(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",Re)throw new Error('Cannot call "initialize" more than once');return Re=Dt(t,r),Re.catch(()=>{Re=void 0}),Re},Dt=(e,t)=>fe(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let o=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 y=(a,g,f)=>new Promise((r,n)=>{var s=h=>{try{l(f.next(h))}catch(u){n(u)}},i=h=>{try{l(f.throw(h))}catch(u){n(u)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(s,i);l((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,l,h,u){if(i===0&&l===s.length&&h===null){if(n===process.stdout.fd){try{process.stdout.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}if(n===process.stderr.fd){try{process.stderr.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}}r.write(n,s,i,l,h,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+=f.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,l,h,u){if(i!==0||l!==s.length||h!==null){u(a());return}const m=this.writeSync(n,s);u(null,m)},chmod(n,s,i){i(a())},chown(n,s,i,l){l(a())},close(n,s){s(a())},fchmod(n,s,i){i(a())},fchown(n,s,i,l){l(a())},fstat(n,s){s(a())},fsync(n,s){s(null)},ftruncate(n,s,i){i(a())},lchown(n,s,i,l){l(a())},link(n,s,i){i(a())},lstat(n,s){s(a())},mkdir(n,s,i){i(a())},open(n,s,i,l){l(a())},read(n,s,i,l,h,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,l){l(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 g=new TextEncoder("utf-8"),f=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),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)=>{const o=2146959360;if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,o,!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,o|d,!0),this.mem.setUint32(e,c,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),c=new Array(o);for(let d=0;d<o;d++)c[d]=s(t+d*8);return c},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},m=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),c=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,c))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,r(e+8,(m+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(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)),c=h(e+32),d=Reflect.apply(o,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),o=h(e+16),c=Reflect.apply(t,void 0,o);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),o=h(e+16),c=Reflect.construct(t,o);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=g.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);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 c=o.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),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=o.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 y(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,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 m=4096+8192;if(n>=m)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(fs.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.11"],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 R=new Function("postMessage",u+"var onmessage; return m => onmessage(m)")(D=>l.onmessage({data:D}));l={onmessage:null,postMessage:D=>R({data:D}),terminate(){}}}l.postMessage(o),l.onmessage=({data:d})=>c(d);let{readFromStdout:c,service:s}=Ge({writeToStdin(d){l.postMessage(d)},isSync:!1,isBrowser:!0,esbuild:Ue});Le={build:d=>new Promise((R,D)=>s.buildOrServe({callName:"build",refs:null,serveOptions:null,options:d,isTTY:!1,defaultWD:"/",callback:(C,P)=>C?D(C):R(P)})),transform:(d,R)=>new Promise((D,C)=>s.transform({callName:"transform",refs:null,input:d,options:R||{},isTTY:!1,fs:{readFile(P,S){S(new Error("Internal error"),null)},writeFile(P,S){S(null)}},callback:(P,S)=>P?C(P):D(S)})),formatMessages:(d,R)=>new Promise((D,C)=>s.formatMessages({callName:"formatMessages",refs:null,messages:d,options:R,callback:(P,S)=>P?C(P):D(S)})),analyzeMetafile:(d,R)=>new Promise((D,C)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof d=="string"?d:JSON.stringify(d),options:R,callback:(P,S)=>P?C(P):D(S)}))}});module.exports=ft(Ue);
|
10
|
+
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
@@ -3,6 +3,7 @@ export type Format = 'iife' | 'cjs' | 'esm';
|
|
3
3
|
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
5
5
|
export type Charset = 'ascii' | 'utf8';
|
6
|
+
export type Drop = 'console' | 'debugger';
|
6
7
|
|
7
8
|
interface CommonOptions {
|
8
9
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
@@ -21,6 +22,7 @@ interface CommonOptions {
|
|
21
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
22
23
|
target?: string | string[];
|
23
24
|
|
25
|
+
drop?: Drop[];
|
24
26
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
25
27
|
minify?: boolean;
|
26
28
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
@@ -260,6 +262,8 @@ export interface Plugin {
|
|
260
262
|
|
261
263
|
export interface PluginBuild {
|
262
264
|
initialOptions: BuildOptions;
|
265
|
+
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>;
|
266
|
+
|
263
267
|
onStart(callback: () =>
|
264
268
|
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
|
265
269
|
onEnd(callback: (result: BuildResult) =>
|
@@ -285,6 +289,27 @@ export interface PluginBuild {
|
|
285
289
|
};
|
286
290
|
}
|
287
291
|
|
292
|
+
export interface ResolveOptions {
|
293
|
+
pluginName?: string;
|
294
|
+
importer?: string;
|
295
|
+
namespace?: string;
|
296
|
+
resolveDir?: string;
|
297
|
+
kind?: ImportKind;
|
298
|
+
pluginData?: any;
|
299
|
+
}
|
300
|
+
|
301
|
+
export interface ResolveResult {
|
302
|
+
errors: Message[];
|
303
|
+
warnings: Message[];
|
304
|
+
|
305
|
+
path: string;
|
306
|
+
external: boolean;
|
307
|
+
sideEffects: boolean;
|
308
|
+
namespace: string;
|
309
|
+
suffix: string;
|
310
|
+
pluginData: any;
|
311
|
+
}
|
312
|
+
|
288
313
|
export interface OnStartResult {
|
289
314
|
errors?: PartialMessage[];
|
290
315
|
warnings?: PartialMessage[];
|
@@ -424,7 +449,9 @@ export interface AnalyzeMetafileOptions {
|
|
424
449
|
* Documentation: https://esbuild.github.io/api/#build-api
|
425
450
|
*/
|
426
451
|
export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
|
452
|
+
export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise<BuildIncremental & { metafile: Metafile }>;
|
427
453
|
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
454
|
+
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
428
455
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
429
456
|
|
430
457
|
/**
|