isomorfeus-asset-manager 0.14.3 → 0.14.7
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/LICENSE +21 -21
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/lib/isomorfeus/asset_manager.rb +6 -7
- 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 +2 -0
- data/node_modules/esbuild-wasm/esm/browser.js +4 -4
- data/node_modules/esbuild-wasm/esm/browser.min.js +2 -2
- data/node_modules/esbuild-wasm/lib/browser.d.ts +2 -0
- data/node_modules/esbuild-wasm/lib/browser.js +4 -4
- data/node_modules/esbuild-wasm/lib/browser.min.js +2 -2
- data/node_modules/esbuild-wasm/lib/main.d.ts +2 -0
- data/node_modules/esbuild-wasm/lib/main.js +60 -7
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85e22a9e188a1be0996db972e25710c16497826e71ddc17712af17c643716567
|
4
|
+
data.tar.gz: 12d2fcbd96cb9df806aae43cb3960c93bee80df0b757aaa1a0f06a40c53ac6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f498c766bae93cf14772b0099d810d7cf6a9b5381fd658726bb10d54819b5163479708b024f660c047b1f19e3cd2c502f7bf39a8cfaa412910fd50963ae20449
|
7
|
+
data.tar.gz: 5cc42ef75eaa113305e9a44a08d1d8eba25b0cfa9f882fae94e7ddf46109b315e39f237685c2d789a5d40add964f4892a0707378f361d90b7b9eb79917b7c2dd
|
data/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2021 Jan Biedermann
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Jan Biedermann
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -172,9 +172,9 @@ module Isomorfeus
|
|
172
172
|
update_json = Oj.dump(update, mode: :strict)
|
173
173
|
Iodine.publish(Isomorfeus.asset_manager_hmr_channel, update_json)
|
174
174
|
rescue Exception => e
|
175
|
-
message = "#{e.message}\n#{e.backtrace.join("\n")}"
|
175
|
+
message = "IsomorfeusAssetManager during hot module update:\n#{e.class}\n#{e.message}\n#{e.backtrace.join("\n")}"
|
176
176
|
STDERR.puts message
|
177
|
-
Iodine.publish(Isomorfeus.asset_manager_hmr_channel, Oj.dump({ error: message }, mode: :
|
177
|
+
Iodine.publish(Isomorfeus.asset_manager_hmr_channel, Oj.dump({ error: message }, mode: :strict))
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
@@ -191,13 +191,14 @@ module Isomorfeus
|
|
191
191
|
resolve_paths << 'node_modules'
|
192
192
|
resolve_paths.uniq!
|
193
193
|
|
194
|
-
result = @context.
|
195
|
-
|
194
|
+
result = @context.await <<~JAVASCRIPT
|
195
|
+
esbuild.build({
|
196
196
|
entryPoints: [path.resolve(global.imports_path, '#{asset_key}')],
|
197
197
|
bundle: true,
|
198
198
|
color: false,
|
199
199
|
format: '#{asset.target == :node ? 'cjs' : 'iife'}',
|
200
200
|
legalComments: 'linked',
|
201
|
+
loader: { '.svg': 'text' },
|
201
202
|
metafile: true,
|
202
203
|
minify: #{Isomorfeus.production? ? 'true' : 'false'},
|
203
204
|
nodePaths: #{resolve_paths},
|
@@ -208,9 +209,7 @@ module Isomorfeus
|
|
208
209
|
splitting: false,
|
209
210
|
target: 'es6',
|
210
211
|
write: true
|
211
|
-
});
|
212
|
-
global.res_meta = res.metafile;
|
213
|
-
return res;
|
212
|
+
}).then((result) => { global.res_meta = result.metafile; return result; });
|
214
213
|
JAVASCRIPT
|
215
214
|
if analyze
|
216
215
|
analysis = @context.await <<~JAVASCRIPT
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.14.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.14.14",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.14.tgz",
|
9
|
+
"integrity": "sha512-qTjK4MWnYtQHCMGg2qDUqeFYXfVvYq5qJkQTIsOV4VZCknoYePVaDTG9ygEB9Ct0kc0DWs7IrS6Ja+GjY62Kzw==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
Binary file
|
@@ -449,7 +449,9 @@ export interface AnalyzeMetafileOptions {
|
|
449
449
|
* Documentation: https://esbuild.github.io/api/#build-api
|
450
450
|
*/
|
451
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 }>;
|
452
453
|
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
454
|
+
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
453
455
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
454
456
|
|
455
457
|
/**
|
@@ -696,8 +696,8 @@ function createChannel(streamIn) {
|
|
696
696
|
if (isFirstPacket) {
|
697
697
|
isFirstPacket = false;
|
698
698
|
let binaryVersion = String.fromCharCode(...bytes);
|
699
|
-
if (binaryVersion !== "0.14.
|
700
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
699
|
+
if (binaryVersion !== "0.14.14") {
|
700
|
+
throw new Error(`Cannot start service: Host version "${"0.14.14"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
701
701
|
}
|
702
702
|
return;
|
703
703
|
}
|
@@ -1625,7 +1625,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1625
1625
|
}
|
1626
1626
|
|
1627
1627
|
// lib/npm/browser.ts
|
1628
|
-
var version = "0.14.
|
1628
|
+
var version = "0.14.14";
|
1629
1629
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1630
1630
|
var serve = () => {
|
1631
1631
|
throw new Error(`The "serve" API only works in node`);
|
@@ -2382,7 +2382,7 @@ onmessage = ({ data: wasm }) => {
|
|
2382
2382
|
callback(null, count);
|
2383
2383
|
};
|
2384
2384
|
let go = new global.Go();
|
2385
|
-
go.argv = ["", \`--service=\${"0.14.
|
2385
|
+
go.argv = ["", \`--service=\${"0.14.14"}\`];
|
2386
2386
|
WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));
|
2387
2387
|
};}`;
|
2388
2388
|
let worker;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
var Le=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var rt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Me=(e,t)=>{for(var r in t||(t={}))rt.call(t,r)&&qe(e,r,t[r]);if(Ue)for(var r of Ue(t))nt.call(t,r)&&qe(e,r,t[r]);return e},Be=(e,t)=>et(e,tt(t));var lt=(e,t)=>{for(var r in t)Le(e,r,{get:t[r],enumerable:!0})};var Ce={};lt(Ce,{analyzeMetafile:()=>vt,analyzeMetafileSync:()=>xt,build:()=>yt,buildSync:()=>Rt,formatMessages:()=>wt,formatMessagesSync:()=>St,initialize:()=>kt,serve:()=>ht,transform:()=>bt,transformSync:()=>Ot,version:()=>mt});function Te(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(fe(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 d of o)t(d)}else{let d=Object.keys(o);r.write8(6),r.write32(d.length);for(let i of d)r.write(fe(i)),t(o[i])}},r=new De;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 We(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return ge(r.read());case 4:return r.read();case 5:{let c=r.read32(),s=[];for(let y=0;y<c;y++)s.push(t());return s}case 6:{let c=r.read32(),s={};for(let y=0;y<c;y++)s[ge(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new De(e),o=r.read32(),d=(o&1)===0;o>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:d,value:i}}var De=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 Ae(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}},fe,ge;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;fe=r=>e.encode(r),ge=r=>t.decode(r)}else if(typeof Buffer!="undefined")fe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ge=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 Ae(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 Ie(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Re=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",st=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",g=e=>typeof e=="string"?null:"a string",ze=e=>e instanceof RegExp?null:"a RegExp object",ye=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ne=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",he=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ot=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ke=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",_e=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",at=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ut=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",ft=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let d=e[r];if(t[r+""]=!0,d===void 0)return;let i=o(d);if(i!==null)throw new Error(`"${r}" must be ${i}`);return d}function Y(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Ve(e){let t=Object.create(null),r=n(e,t,"wasmURL",g),o=n(e,t,"worker",q);return Y(e,t,"in startService() call"),{wasmURL:r,worker:o}}function Oe(e,t,r,o,d){let i=n(t,r,"color",q),c=n(t,r,"logLevel",g),s=n(t,r,"logLimit",ye);i!==void 0?e.push(`--color=${i}`):o&&e.push("--color=true"),e.push(`--log-level=${c||d}`),e.push(`--log-limit=${s||0}`)}function Je(e,t,r){let o=n(t,r,"legalComments",g),d=n(t,r,"sourceRoot",g),i=n(t,r,"sourcesContent",q),c=n(t,r,"target",ut),s=n(t,r,"format",g),y=n(t,r,"globalName",g),R=n(t,r,"minify",q),T=n(t,r,"minifySyntax",q),C=n(t,r,"minifyWhitespace",q),$=n(t,r,"minifyIdentifiers",q),S=n(t,r,"drop",_),ne=n(t,r,"charset",g),re=n(t,r,"treeShaking",q),le=n(t,r,"ignoreAnnotations",q),ie=n(t,r,"jsx",g),se=n(t,r,"jsxFactory",g),ue=n(t,r,"jsxFragment",g),oe=n(t,r,"define",he),de=n(t,r,"pure",_),pe=n(t,r,"keepNames",q);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ie).join(",")}`):e.push(`--target=${Ie(c)}`)),s&&e.push(`--format=${s}`),y&&e.push(`--global-name=${y}`),R&&e.push("--minify"),T&&e.push("--minify-syntax"),C&&e.push("--minify-whitespace"),$&&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(de)for(let ee of de)e.push(`--pure:${ee}`);pe&&e.push("--keep-names")}function ct(e,t,r,o,d){var h;let i=[],c=[],s=Object.create(null),y=null,R=null,T=null;Oe(i,t,s,r,o),Je(i,t,s);let C=n(t,s,"sourcemap",_e),$=n(t,s,"bundle",q),S=n(t,s,"watch",st),ne=n(t,s,"splitting",q),re=n(t,s,"preserveSymlinks",q),le=n(t,s,"metafile",q),ie=n(t,s,"outfile",g),se=n(t,s,"outdir",g),ue=n(t,s,"outbase",g),oe=n(t,s,"platform",g),de=n(t,s,"tsconfig",g),pe=n(t,s,"resolveExtensions",_),ee=n(t,s,"nodePaths",_),Ee=n(t,s,"mainFields",_),$e=n(t,s,"conditions",_),p=n(t,s,"external",_),u=n(t,s,"loader",he),a=n(t,s,"outExtension",he),f=n(t,s,"publicPath",g),j=n(t,s,"entryNames",g),N=n(t,s,"chunkNames",g),P=n(t,s,"assetNames",g),E=n(t,s,"inject",_),D=n(t,s,"banner",he),M=n(t,s,"footer",he),w=n(t,s,"entryPoints",ot),U=n(t,s,"absWorkingDir",g),k=n(t,s,"stdin",he),O=(h=n(t,s,"write",q))!=null?h:d,te=n(t,s,"allowOverwrite",q),X=n(t,s,"incremental",q)===!0;if(s.plugins=!0,Y(t,s,`in ${e}() call`),C&&i.push(`--sourcemap${C===!0?"":`=${C}`}`),$&&i.push("--bundle"),te&&i.push("--allow-overwrite"),S)if(i.push("--watch"),typeof S=="boolean")T={};else{let l=Object.create(null),v=n(S,l,"onRebuild",Ne);Y(S,l,`on "watch" in ${e}() call`),T={onRebuild:v}}if(ne&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),le&&i.push("--metafile"),ie&&i.push(`--outfile=${ie}`),se&&i.push(`--outdir=${se}`),ue&&i.push(`--outbase=${ue}`),oe&&i.push(`--platform=${oe}`),de&&i.push(`--tsconfig=${de}`),pe){let l=[];for(let v of pe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);l.push(v)}i.push(`--resolve-extensions=${l.join(",")}`)}if(f&&i.push(`--public-path=${f}`),j&&i.push(`--entry-names=${j}`),N&&i.push(`--chunk-names=${N}`),P&&i.push(`--asset-names=${P}`),Ee){let l=[];for(let v of Ee){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);l.push(v)}i.push(`--main-fields=${l.join(",")}`)}if($e){let l=[];for(let v of $e){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);l.push(v)}i.push(`--conditions=${l.join(",")}`)}if(p)for(let l of p)i.push(`--external:${l}`);if(D)for(let l in D){if(l.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${l}`);i.push(`--banner:${l}=${D[l]}`)}if(M)for(let l in M){if(l.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${l}`);i.push(`--footer:${l}=${M[l]}`)}if(E)for(let l of E)i.push(`--inject:${l}`);if(u)for(let l in u){if(l.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${l}`);i.push(`--loader:${l}=${u[l]}`)}if(a)for(let l in a){if(l.indexOf("=")>=0)throw new Error(`Invalid out extension: ${l}`);i.push(`--out-extension:${l}=${a[l]}`)}if(w)if(Array.isArray(w))for(let l of w)c.push(["",l+""]);else for(let[l,v]of Object.entries(w))c.push([l+"",v+""]);if(k){let l=Object.create(null),v=n(k,l,"contents",g),W=n(k,l,"resolveDir",g),L=n(k,l,"sourcefile",g),b=n(k,l,"loader",g);Y(k,l,'in "stdin" object'),L&&i.push(`--sourcefile=${L}`),b&&i.push(`--loader=${b}`),W&&(R=W+""),y=v?v+"":""}let x=[];if(ee)for(let l of ee)l+="",x.push(l);return{entries:c,flags:i,write:O,stdinContents:y,stdinResolveDir:R,absWorkingDir:U,incremental:X,nodePaths:x,watch:T}}function dt(e,t,r,o){let d=[],i=Object.create(null);Oe(d,t,i,r,o),Je(d,t,i);let c=n(t,i,"sourcemap",_e),s=n(t,i,"tsconfigRaw",at),y=n(t,i,"sourcefile",g),R=n(t,i,"loader",g),T=n(t,i,"banner",g),C=n(t,i,"footer",g);return Y(t,i,`in ${e}() call`),c&&d.push(`--sourcemap=${c===!0?"external":c}`),s&&d.push(`--tsconfig-raw=${typeof s=="string"?s:JSON.stringify(s)}`),y&&d.push(`--sourcefile=${y}`),R&&d.push(`--loader=${R}`),T&&d.push(`--banner=${T}`),C&&d.push(`--footer=${C}`),d}function Ye(e){let t=new Map,r=new Map,o=new Map,d=new Map,i=!1,c=0,s=0,y=new Uint8Array(16*1024),R=0,T=p=>{let u=R+p.length;if(u>y.length){let f=new Uint8Array(u*2);f.set(y),y=f}y.set(p,R),R+=p.length;let a=0;for(;a+4<=R;){let f=Ae(y,a);if(a+4+f>R)break;a+=4,le(y.subarray(a,a+f)),a+=f}a>0&&(y.copyWithin(0,a,R),R-=a)},C=()=>{i=!0;for(let p of t.values())p("The service was stopped",null);t.clear();for(let p of d.values())p.onWait("The service was stopped");d.clear();for(let p of o.values())try{p(new Error("The service was stopped"),null)}catch(u){console.error(u)}o.clear()},$=(p,u,a)=>{if(i)return a("The service is no longer running",null);let f=c++;t.set(f,(j,N)=>{try{a(j,N)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(Te({id:f,isRequest:!0,value:u}))},S=(p,u)=>{if(i)throw new Error("The service is no longer running");e.writeToStdin(Te({id:p,isRequest:!1,value:u}))},ne=async(p,u)=>{try{switch(u.command){case"ping":{S(p,{});break}case"on-start":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"on-resolve":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"on-load":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"serve-request":{let a=d.get(u.key);a&&a.onRequest&&a.onRequest(u.args),S(p,{});break}case"serve-wait":{let a=d.get(u.key);a&&a.onWait(u.error),S(p,{});break}case"watch-rebuild":{let a=o.get(u.key);try{a&&a(null,u.args)}catch(f){console.error(f)}S(p,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(a){S(p,{errors:[be(a,e,null,void 0,"")]})}},re=!0,le=p=>{if(re){re=!1;let a=String.fromCharCode(...p);if(a!=="0.14.10")throw new Error(`Cannot start service: Host version "0.14.10" does not match binary version ${JSON.stringify(a)}`);return}let u=We(p);if(u.isRequest)ne(u.id,u.value);else{let a=t.get(u.id);t.delete(u.id),u.value.error?a(u.value.error,{}):a(null,u.value)}},ie=async(p,u,a,f,j)=>{let N=[],P=[],E={},D={},M=0,w=0,U=[],k=!1;u=[...u];for(let x of u){let h={};if(typeof x!="object")throw new Error(`Plugin at index ${w} must be an object`);let l=n(x,h,"name",g);if(typeof l!="string"||l==="")throw new Error(`Plugin at index ${w} is missing a name`);try{let v=n(x,h,"setup",Ne);if(typeof v!="function")throw new Error("Plugin is missing a setup function");Y(x,h,`on plugin ${JSON.stringify(l)}`);let W={name:l,onResolve:[],onLoad:[]};w++;let b=v({initialOptions:p,resolve:(m,A={})=>{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 F=Object.create(null),V=n(A,F,"pluginName",g),I=n(A,F,"importer",g),H=n(A,F,"namespace",g),Q=n(A,F,"resolveDir",g),B=n(A,F,"kind",g),J=n(A,F,"pluginData",Re);return Y(A,F,"in resolve() call"),new Promise((K,Z)=>{let G={command:"resolve",path:m,key:a,pluginName:l};V!=null&&(G.pluginName=V),I!=null&&(G.importer=I),H!=null&&(G.namespace=H),Q!=null&&(G.resolveDir=Q),B!=null&&(G.kind=B),J!=null&&(G.pluginData=f.store(J)),$(j,G,(ae,z)=>{ae!==null?Z(new Error(ae)):K({errors:ce(z.errors,f),warnings:ce(z.warnings,f),path:z.path,external:z.external,sideEffects:z.sideEffects,namespace:z.namespace,suffix:z.suffix,pluginData:f.load(z.pluginData)})})})},onStart(m){let A='This error came from the "onStart" callback registered here:',F=Se(new Error(A),e,"onStart");N.push({name:l,callback:m,note:F})},onEnd(m){let A='This error came from the "onEnd" callback registered here:',F=Se(new Error(A),e,"onEnd");P.push({name:l,callback:m,note:F})},onResolve(m,A){let F='This error came from the "onResolve" callback registered here:',V=Se(new Error(F),e,"onResolve"),I={},H=n(m,I,"filter",ze),Q=n(m,I,"namespace",g);if(Y(m,I,`in onResolve() call for plugin ${JSON.stringify(l)}`),H==null)throw new Error("onResolve() call is missing a filter");let B=M++;E[B]={name:l,callback:A,note:V},W.onResolve.push({id:B,filter:H.source,namespace:Q||""})},onLoad(m,A){let F='This error came from the "onLoad" callback registered here:',V=Se(new Error(F),e,"onLoad"),I={},H=n(m,I,"filter",ze),Q=n(m,I,"namespace",g);if(Y(m,I,`in onLoad() call for plugin ${JSON.stringify(l)}`),H==null)throw new Error("onLoad() call is missing a filter");let B=M++;D[B]={name:l,callback:A,note:V},W.onLoad.push({id:B,filter:H.source,namespace:Q||""})},esbuild:e.esbuild});b&&await b,U.push(W)}catch(v){return{ok:!1,error:v,pluginName:l}}}let O=async x=>{switch(x.command){case"on-start":{let h={errors:[],warnings:[]};return await Promise.all(N.map(async({name:l,callback:v,note:W})=>{try{let L=await v();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(l)} to return an object`);let b={},m=n(L,b,"errors",_),A=n(L,b,"warnings",_);Y(L,b,`from onStart() callback in plugin ${JSON.stringify(l)}`),m!=null&&h.errors.push(...me(m,"errors",f,l)),A!=null&&h.warnings.push(...me(A,"warnings",f,l))}}catch(L){h.errors.push(be(L,e,f,W&&W(),l))}})),h}case"on-resolve":{let h={},l="",v,W;for(let L of x.ids)try{({name:l,callback:v,note:W}=E[L]);let b=await v({path:x.path,importer:x.importer,namespace:x.namespace,resolveDir:x.resolveDir,kind:x.kind,pluginData:f.load(x.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(l)} to return an object`);let m={},A=n(b,m,"pluginName",g),F=n(b,m,"path",g),V=n(b,m,"namespace",g),I=n(b,m,"suffix",g),H=n(b,m,"external",q),Q=n(b,m,"sideEffects",q),B=n(b,m,"pluginData",Re),J=n(b,m,"errors",_),K=n(b,m,"warnings",_),Z=n(b,m,"watchFiles",_),G=n(b,m,"watchDirs",_);Y(b,m,`from onResolve() callback in plugin ${JSON.stringify(l)}`),h.id=L,A!=null&&(h.pluginName=A),F!=null&&(h.path=F),V!=null&&(h.namespace=V),I!=null&&(h.suffix=I),H!=null&&(h.external=H),Q!=null&&(h.sideEffects=Q),B!=null&&(h.pluginData=f.store(B)),J!=null&&(h.errors=me(J,"errors",f,l)),K!=null&&(h.warnings=me(K,"warnings",f,l)),Z!=null&&(h.watchFiles=xe(Z,"watchFiles")),G!=null&&(h.watchDirs=xe(G,"watchDirs"));break}}catch(b){return{id:L,errors:[be(b,e,f,W&&W(),l)]}}return h}case"on-load":{let h={},l="",v,W;for(let L of x.ids)try{({name:l,callback:v,note:W}=D[L]);let b=await v({path:x.path,namespace:x.namespace,suffix:x.suffix,pluginData:f.load(x.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(l)} to return an object`);let m={},A=n(b,m,"pluginName",g),F=n(b,m,"contents",ft),V=n(b,m,"resolveDir",g),I=n(b,m,"pluginData",Re),H=n(b,m,"loader",g),Q=n(b,m,"errors",_),B=n(b,m,"warnings",_),J=n(b,m,"watchFiles",_),K=n(b,m,"watchDirs",_);Y(b,m,`from onLoad() callback in plugin ${JSON.stringify(l)}`),h.id=L,A!=null&&(h.pluginName=A),F instanceof Uint8Array?h.contents=F:F!=null&&(h.contents=fe(F)),V!=null&&(h.resolveDir=V),I!=null&&(h.pluginData=f.store(I)),H!=null&&(h.loader=H),Q!=null&&(h.errors=me(Q,"errors",f,l)),B!=null&&(h.warnings=me(B,"warnings",f,l)),J!=null&&(h.watchFiles=xe(J,"watchFiles")),K!=null&&(h.watchDirs=xe(K,"watchDirs"));break}}catch(b){return{id:L,errors:[be(b,e,f,W&&W(),l)]}}return h}default:throw new Error("Invalid command: "+x.command)}},te=(x,h,l)=>l();P.length>0&&(te=(x,h,l)=>{(async()=>{for(let{name:v,callback:W,note:L}of P)try{await W(x)}catch(b){x.errors.push(await new Promise(m=>h(b,v,L&&L(),m)))}})().then(l)}),k=!0;let X=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:te,pluginRefs:{ref(){++X===1&&r.set(a,O)},unref(){--X===0&&r.delete(a)}}}},se=(p,u,a,f)=>{let j={},N=n(u,j,"port",ye),P=n(u,j,"host",g),E=n(u,j,"servedir",g),D=n(u,j,"onRequest",Ne),M,w=new Promise((U,k)=>{M=O=>{d.delete(f),O!==null?k(new Error(O)):U()}});return a.serve={},Y(u,j,"in serve() call"),N!==void 0&&(a.serve.port=N),P!==void 0&&(a.serve.host=P),E!==void 0&&(a.serve.servedir=E),d.set(f,{onRequest:D,onWait:M}),{wait:w,stop(){$(p,{command:"serve-stop",key:f},()=>{})}}},ue="warning",oe="silent",de=p=>{let u=s++,a=He(),f,{refs:j,options:N,isTTY:P,callback:E}=p;if(typeof N=="object"){let w=N.plugins;if(w!==void 0){if(!Array.isArray(w))throw new Error('"plugins" must be an array');f=w}}let D=(w,U,k,O)=>{let te=[];try{Oe(te,N,{},P,ue)}catch(x){}let X=be(w,e,a,k,U);$(j,{command:"error",flags:te,error:X},()=>{X.detail=a.load(X.detail),O(X)})},M=(w,U)=>{D(w,U,void 0,k=>{E(we("Build failed",[k],[]),null)})};if(f&&f.length>0){if(e.isSync)return M(new Error("Cannot use plugins in synchronous API calls"),"");ie(N,f,u,a,j).then(w=>{if(!w.ok)M(w.error,w.pluginName);else try{pe(Be(Me({},p),{key:u,details:a,logPluginError:D,requestPlugins:w.requestPlugins,runOnEndCallbacks:w.runOnEndCallbacks,pluginRefs:w.pluginRefs}))}catch(U){M(U,"")}},w=>M(w,""))}else try{pe(Be(Me({},p),{key:u,details:a,logPluginError:D,requestPlugins:null,runOnEndCallbacks:(w,U,k)=>k(),pluginRefs:null}))}catch(w){M(w,"")}},pe=({callName:p,refs:u,serveOptions:a,options:f,isTTY:j,defaultWD:N,callback:P,key:E,details:D,logPluginError:M,requestPlugins:w,runOnEndCallbacks:U,pluginRefs:k})=>{let O={ref(){k&&k.ref(),u&&u.ref()},unref(){k&&k.unref(),u&&u.unref()}},te=!e.isBrowser,{entries:X,flags:x,write:h,stdinContents:l,stdinResolveDir:v,absWorkingDir:W,incremental:L,nodePaths:b,watch:m}=ct(p,f,j,ue,te),A={command:"build",key:E,entries:X,flags:x,write:h,stdinContents:l,stdinResolveDir:v,absWorkingDir:W||N,incremental:L,nodePaths:b};w&&(A.plugins=w);let F=a&&se(O,a,A,E),V,I,H=(B,J)=>{B.outputFiles&&(J.outputFiles=B.outputFiles.map(pt)),B.metafile&&(J.metafile=JSON.parse(B.metafile)),B.writeToStdout!==void 0&&console.log(ge(B.writeToStdout).replace(/\n$/,""))},Q=(B,J)=>{let K={errors:ce(B.errors,D),warnings:ce(B.warnings,D)};H(B,K),U(K,M,()=>{if(K.errors.length>0)return J(we("Build failed",K.errors,K.warnings),null);if(B.rebuild){if(!V){let Z=!1;V=()=>new Promise((G,ae)=>{if(Z||i)throw new Error("Cannot rebuild");$(O,{command:"rebuild",key:E},(z,Xe)=>{if(z)return J(we("Build failed",[{pluginName:"",text:z,location:null,notes:[],detail:void 0}],[]),null);Q(Xe,(Pe,Ze)=>{Pe?ae(Pe):G(Ze)})})}),O.ref(),V.dispose=()=>{Z||(Z=!0,$(O,{command:"rebuild-dispose",key:E},()=>{}),O.unref())}}K.rebuild=V}if(B.watch){if(!I){let Z=!1;O.ref(),I=()=>{Z||(Z=!0,o.delete(E),$(O,{command:"watch-stop",key:E},()=>{}),O.unref())},m&&o.set(E,(G,ae)=>{if(G){m.onRebuild&&m.onRebuild(G,null);return}let z={errors:ce(ae.errors,D),warnings:ce(ae.warnings,D)};H(ae,z),U(z,M,()=>{if(z.errors.length>0){m.onRebuild&&m.onRebuild(we("Build failed",z.errors,z.warnings),null);return}ae.rebuildID!==void 0&&(z.rebuild=V),z.stop=I,m.onRebuild&&m.onRebuild(null,z)})})}K.stop=I}J(null,K)})};if(h&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(L&&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');$(O,A,(B,J)=>{if(B)return P(new Error(B),null);if(F){let K=J,Z=!1;O.ref();let G={port:K.port,host:K.host,wait:F.wait,stop(){Z||(Z=!0,F.stop(),O.unref())}};return O.ref(),F.wait.then(O.unref,O.unref),P(null,G)}return Q(J,P)})};return{readFromStdout:T,afterClose:C,service:{buildOrServe:de,transform:({callName:p,refs:u,input:a,options:f,isTTY:j,fs:N,callback:P})=>{let E=He(),D=M=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let w=dt(p,f,j,oe);$(u,{command:"transform",flags:w,inputFS:M!==null,input:M!==null?M:a},(k,O)=>{if(k)return P(new Error(k),null);let te=ce(O.errors,E),X=ce(O.warnings,E),x=1,h=()=>--x===0&&P(null,{warnings:X,code:O.code,map:O.map});if(te.length>0)return P(we("Transform failed",te,X),null);O.codeFS&&(x++,N.readFile(O.code,(l,v)=>{l!==null?P(l,null):(O.code=v,h())})),O.mapFS&&(x++,N.readFile(O.map,(l,v)=>{l!==null?P(l,null):(O.map=v,h())})),h()})}catch(w){let U=[];try{Oe(U,f,{},j,oe)}catch(O){}let k=be(w,e,E,void 0,"");$(u,{command:"error",flags:U,error:k},()=>{k.detail=E.load(k.detail),P(we("Transform failed",[k],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let M=D;D=()=>N.writeFile(a,M)}D(null)},formatMessages:({callName:p,refs:u,messages:a,options:f,callback:j})=>{let N=me(a,"messages",null,"");if(!f)throw new Error(`Missing second argument in ${p}() call`);let P={},E=n(f,P,"kind",g),D=n(f,P,"color",q),M=n(f,P,"terminalWidth",ye);if(Y(f,P,`in ${p}() call`),E===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let w={command:"format-msgs",messages:N,isWarning:E==="warning"};D!==void 0&&(w.color=D),M!==void 0&&(w.terminalWidth=M),$(u,w,(U,k)=>{if(U)return j(new Error(U),null);j(null,k.messages)})},analyzeMetafile:({callName:p,refs:u,metafile:a,options:f,callback:j})=>{f===void 0&&(f={});let N={},P=n(f,N,"color",q),E=n(f,N,"verbose",q);Y(f,N,`in ${p}() call`);let D={command:"analyze-metafile",metafile:a};P!==void 0&&(D.color=P),E!==void 0&&(D.verbose=E),$(u,D,(M,w)=>{if(M)return j(new Error(M),null);j(null,w.result)})}}}}function He(){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 Se(e,t,r){let o,d=!1;return()=>{if(d)return o;d=!0;try{let i=(e.stack+"").split(`
|
1
|
+
var Le=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var rt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Me=(e,t)=>{for(var r in t||(t={}))rt.call(t,r)&&qe(e,r,t[r]);if(Ue)for(var r of Ue(t))nt.call(t,r)&&qe(e,r,t[r]);return e},Be=(e,t)=>et(e,tt(t));var lt=(e,t)=>{for(var r in t)Le(e,r,{get:t[r],enumerable:!0})};var Ce={};lt(Ce,{analyzeMetafile:()=>vt,analyzeMetafileSync:()=>xt,build:()=>yt,buildSync:()=>Rt,formatMessages:()=>wt,formatMessagesSync:()=>St,initialize:()=>kt,serve:()=>ht,transform:()=>bt,transformSync:()=>Ot,version:()=>mt});function Te(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(fe(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 d of o)t(d)}else{let d=Object.keys(o);r.write8(6),r.write32(d.length);for(let i of d)r.write(fe(i)),t(o[i])}},r=new De;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 We(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return ge(r.read());case 4:return r.read();case 5:{let c=r.read32(),s=[];for(let y=0;y<c;y++)s.push(t());return s}case 6:{let c=r.read32(),s={};for(let y=0;y<c;y++)s[ge(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new De(e),o=r.read32(),d=(o&1)===0;o>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:d,value:i}}var De=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 Ae(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}},fe,ge;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;fe=r=>e.encode(r),ge=r=>t.decode(r)}else if(typeof Buffer!="undefined")fe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ge=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 Ae(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 Ie(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Re=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",st=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",g=e=>typeof e=="string"?null:"a string",ze=e=>e instanceof RegExp?null:"a RegExp object",ye=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ne=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",he=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ot=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ke=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",_e=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",at=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ut=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",ft=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let d=e[r];if(t[r+""]=!0,d===void 0)return;let i=o(d);if(i!==null)throw new Error(`"${r}" must be ${i}`);return d}function Y(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Ve(e){let t=Object.create(null),r=n(e,t,"wasmURL",g),o=n(e,t,"worker",q);return Y(e,t,"in startService() call"),{wasmURL:r,worker:o}}function Oe(e,t,r,o,d){let i=n(t,r,"color",q),c=n(t,r,"logLevel",g),s=n(t,r,"logLimit",ye);i!==void 0?e.push(`--color=${i}`):o&&e.push("--color=true"),e.push(`--log-level=${c||d}`),e.push(`--log-limit=${s||0}`)}function Je(e,t,r){let o=n(t,r,"legalComments",g),d=n(t,r,"sourceRoot",g),i=n(t,r,"sourcesContent",q),c=n(t,r,"target",ut),s=n(t,r,"format",g),y=n(t,r,"globalName",g),R=n(t,r,"minify",q),T=n(t,r,"minifySyntax",q),C=n(t,r,"minifyWhitespace",q),$=n(t,r,"minifyIdentifiers",q),S=n(t,r,"drop",_),ne=n(t,r,"charset",g),re=n(t,r,"treeShaking",q),le=n(t,r,"ignoreAnnotations",q),ie=n(t,r,"jsx",g),se=n(t,r,"jsxFactory",g),ue=n(t,r,"jsxFragment",g),oe=n(t,r,"define",he),de=n(t,r,"pure",_),pe=n(t,r,"keepNames",q);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ie).join(",")}`):e.push(`--target=${Ie(c)}`)),s&&e.push(`--format=${s}`),y&&e.push(`--global-name=${y}`),R&&e.push("--minify"),T&&e.push("--minify-syntax"),C&&e.push("--minify-whitespace"),$&&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(de)for(let ee of de)e.push(`--pure:${ee}`);pe&&e.push("--keep-names")}function ct(e,t,r,o,d){var h;let i=[],c=[],s=Object.create(null),y=null,R=null,T=null;Oe(i,t,s,r,o),Je(i,t,s);let C=n(t,s,"sourcemap",_e),$=n(t,s,"bundle",q),S=n(t,s,"watch",st),ne=n(t,s,"splitting",q),re=n(t,s,"preserveSymlinks",q),le=n(t,s,"metafile",q),ie=n(t,s,"outfile",g),se=n(t,s,"outdir",g),ue=n(t,s,"outbase",g),oe=n(t,s,"platform",g),de=n(t,s,"tsconfig",g),pe=n(t,s,"resolveExtensions",_),ee=n(t,s,"nodePaths",_),Ee=n(t,s,"mainFields",_),$e=n(t,s,"conditions",_),p=n(t,s,"external",_),u=n(t,s,"loader",he),a=n(t,s,"outExtension",he),f=n(t,s,"publicPath",g),j=n(t,s,"entryNames",g),N=n(t,s,"chunkNames",g),P=n(t,s,"assetNames",g),E=n(t,s,"inject",_),D=n(t,s,"banner",he),M=n(t,s,"footer",he),w=n(t,s,"entryPoints",ot),U=n(t,s,"absWorkingDir",g),k=n(t,s,"stdin",he),O=(h=n(t,s,"write",q))!=null?h:d,te=n(t,s,"allowOverwrite",q),X=n(t,s,"incremental",q)===!0;if(s.plugins=!0,Y(t,s,`in ${e}() call`),C&&i.push(`--sourcemap${C===!0?"":`=${C}`}`),$&&i.push("--bundle"),te&&i.push("--allow-overwrite"),S)if(i.push("--watch"),typeof S=="boolean")T={};else{let l=Object.create(null),v=n(S,l,"onRebuild",Ne);Y(S,l,`on "watch" in ${e}() call`),T={onRebuild:v}}if(ne&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),le&&i.push("--metafile"),ie&&i.push(`--outfile=${ie}`),se&&i.push(`--outdir=${se}`),ue&&i.push(`--outbase=${ue}`),oe&&i.push(`--platform=${oe}`),de&&i.push(`--tsconfig=${de}`),pe){let l=[];for(let v of pe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);l.push(v)}i.push(`--resolve-extensions=${l.join(",")}`)}if(f&&i.push(`--public-path=${f}`),j&&i.push(`--entry-names=${j}`),N&&i.push(`--chunk-names=${N}`),P&&i.push(`--asset-names=${P}`),Ee){let l=[];for(let v of Ee){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);l.push(v)}i.push(`--main-fields=${l.join(",")}`)}if($e){let l=[];for(let v of $e){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);l.push(v)}i.push(`--conditions=${l.join(",")}`)}if(p)for(let l of p)i.push(`--external:${l}`);if(D)for(let l in D){if(l.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${l}`);i.push(`--banner:${l}=${D[l]}`)}if(M)for(let l in M){if(l.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${l}`);i.push(`--footer:${l}=${M[l]}`)}if(E)for(let l of E)i.push(`--inject:${l}`);if(u)for(let l in u){if(l.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${l}`);i.push(`--loader:${l}=${u[l]}`)}if(a)for(let l in a){if(l.indexOf("=")>=0)throw new Error(`Invalid out extension: ${l}`);i.push(`--out-extension:${l}=${a[l]}`)}if(w)if(Array.isArray(w))for(let l of w)c.push(["",l+""]);else for(let[l,v]of Object.entries(w))c.push([l+"",v+""]);if(k){let l=Object.create(null),v=n(k,l,"contents",g),W=n(k,l,"resolveDir",g),L=n(k,l,"sourcefile",g),b=n(k,l,"loader",g);Y(k,l,'in "stdin" object'),L&&i.push(`--sourcefile=${L}`),b&&i.push(`--loader=${b}`),W&&(R=W+""),y=v?v+"":""}let x=[];if(ee)for(let l of ee)l+="",x.push(l);return{entries:c,flags:i,write:O,stdinContents:y,stdinResolveDir:R,absWorkingDir:U,incremental:X,nodePaths:x,watch:T}}function dt(e,t,r,o){let d=[],i=Object.create(null);Oe(d,t,i,r,o),Je(d,t,i);let c=n(t,i,"sourcemap",_e),s=n(t,i,"tsconfigRaw",at),y=n(t,i,"sourcefile",g),R=n(t,i,"loader",g),T=n(t,i,"banner",g),C=n(t,i,"footer",g);return Y(t,i,`in ${e}() call`),c&&d.push(`--sourcemap=${c===!0?"external":c}`),s&&d.push(`--tsconfig-raw=${typeof s=="string"?s:JSON.stringify(s)}`),y&&d.push(`--sourcefile=${y}`),R&&d.push(`--loader=${R}`),T&&d.push(`--banner=${T}`),C&&d.push(`--footer=${C}`),d}function Ye(e){let t=new Map,r=new Map,o=new Map,d=new Map,i=!1,c=0,s=0,y=new Uint8Array(16*1024),R=0,T=p=>{let u=R+p.length;if(u>y.length){let f=new Uint8Array(u*2);f.set(y),y=f}y.set(p,R),R+=p.length;let a=0;for(;a+4<=R;){let f=Ae(y,a);if(a+4+f>R)break;a+=4,le(y.subarray(a,a+f)),a+=f}a>0&&(y.copyWithin(0,a,R),R-=a)},C=()=>{i=!0;for(let p of t.values())p("The service was stopped",null);t.clear();for(let p of d.values())p.onWait("The service was stopped");d.clear();for(let p of o.values())try{p(new Error("The service was stopped"),null)}catch(u){console.error(u)}o.clear()},$=(p,u,a)=>{if(i)return a("The service is no longer running",null);let f=c++;t.set(f,(j,N)=>{try{a(j,N)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(Te({id:f,isRequest:!0,value:u}))},S=(p,u)=>{if(i)throw new Error("The service is no longer running");e.writeToStdin(Te({id:p,isRequest:!1,value:u}))},ne=async(p,u)=>{try{switch(u.command){case"ping":{S(p,{});break}case"on-start":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"on-resolve":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"on-load":{let a=r.get(u.key);a?S(p,await a(u)):S(p,{});break}case"serve-request":{let a=d.get(u.key);a&&a.onRequest&&a.onRequest(u.args),S(p,{});break}case"serve-wait":{let a=d.get(u.key);a&&a.onWait(u.error),S(p,{});break}case"watch-rebuild":{let a=o.get(u.key);try{a&&a(null,u.args)}catch(f){console.error(f)}S(p,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(a){S(p,{errors:[be(a,e,null,void 0,"")]})}},re=!0,le=p=>{if(re){re=!1;let a=String.fromCharCode(...p);if(a!=="0.14.14")throw new Error(`Cannot start service: Host version "0.14.14" does not match binary version ${JSON.stringify(a)}`);return}let u=We(p);if(u.isRequest)ne(u.id,u.value);else{let a=t.get(u.id);t.delete(u.id),u.value.error?a(u.value.error,{}):a(null,u.value)}},ie=async(p,u,a,f,j)=>{let N=[],P=[],E={},D={},M=0,w=0,U=[],k=!1;u=[...u];for(let x of u){let h={};if(typeof x!="object")throw new Error(`Plugin at index ${w} must be an object`);let l=n(x,h,"name",g);if(typeof l!="string"||l==="")throw new Error(`Plugin at index ${w} is missing a name`);try{let v=n(x,h,"setup",Ne);if(typeof v!="function")throw new Error("Plugin is missing a setup function");Y(x,h,`on plugin ${JSON.stringify(l)}`);let W={name:l,onResolve:[],onLoad:[]};w++;let b=v({initialOptions:p,resolve:(m,A={})=>{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 F=Object.create(null),V=n(A,F,"pluginName",g),I=n(A,F,"importer",g),H=n(A,F,"namespace",g),Q=n(A,F,"resolveDir",g),B=n(A,F,"kind",g),J=n(A,F,"pluginData",Re);return Y(A,F,"in resolve() call"),new Promise((K,Z)=>{let G={command:"resolve",path:m,key:a,pluginName:l};V!=null&&(G.pluginName=V),I!=null&&(G.importer=I),H!=null&&(G.namespace=H),Q!=null&&(G.resolveDir=Q),B!=null&&(G.kind=B),J!=null&&(G.pluginData=f.store(J)),$(j,G,(ae,z)=>{ae!==null?Z(new Error(ae)):K({errors:ce(z.errors,f),warnings:ce(z.warnings,f),path:z.path,external:z.external,sideEffects:z.sideEffects,namespace:z.namespace,suffix:z.suffix,pluginData:f.load(z.pluginData)})})})},onStart(m){let A='This error came from the "onStart" callback registered here:',F=Se(new Error(A),e,"onStart");N.push({name:l,callback:m,note:F})},onEnd(m){let A='This error came from the "onEnd" callback registered here:',F=Se(new Error(A),e,"onEnd");P.push({name:l,callback:m,note:F})},onResolve(m,A){let F='This error came from the "onResolve" callback registered here:',V=Se(new Error(F),e,"onResolve"),I={},H=n(m,I,"filter",ze),Q=n(m,I,"namespace",g);if(Y(m,I,`in onResolve() call for plugin ${JSON.stringify(l)}`),H==null)throw new Error("onResolve() call is missing a filter");let B=M++;E[B]={name:l,callback:A,note:V},W.onResolve.push({id:B,filter:H.source,namespace:Q||""})},onLoad(m,A){let F='This error came from the "onLoad" callback registered here:',V=Se(new Error(F),e,"onLoad"),I={},H=n(m,I,"filter",ze),Q=n(m,I,"namespace",g);if(Y(m,I,`in onLoad() call for plugin ${JSON.stringify(l)}`),H==null)throw new Error("onLoad() call is missing a filter");let B=M++;D[B]={name:l,callback:A,note:V},W.onLoad.push({id:B,filter:H.source,namespace:Q||""})},esbuild:e.esbuild});b&&await b,U.push(W)}catch(v){return{ok:!1,error:v,pluginName:l}}}let O=async x=>{switch(x.command){case"on-start":{let h={errors:[],warnings:[]};return await Promise.all(N.map(async({name:l,callback:v,note:W})=>{try{let L=await v();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(l)} to return an object`);let b={},m=n(L,b,"errors",_),A=n(L,b,"warnings",_);Y(L,b,`from onStart() callback in plugin ${JSON.stringify(l)}`),m!=null&&h.errors.push(...me(m,"errors",f,l)),A!=null&&h.warnings.push(...me(A,"warnings",f,l))}}catch(L){h.errors.push(be(L,e,f,W&&W(),l))}})),h}case"on-resolve":{let h={},l="",v,W;for(let L of x.ids)try{({name:l,callback:v,note:W}=E[L]);let b=await v({path:x.path,importer:x.importer,namespace:x.namespace,resolveDir:x.resolveDir,kind:x.kind,pluginData:f.load(x.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(l)} to return an object`);let m={},A=n(b,m,"pluginName",g),F=n(b,m,"path",g),V=n(b,m,"namespace",g),I=n(b,m,"suffix",g),H=n(b,m,"external",q),Q=n(b,m,"sideEffects",q),B=n(b,m,"pluginData",Re),J=n(b,m,"errors",_),K=n(b,m,"warnings",_),Z=n(b,m,"watchFiles",_),G=n(b,m,"watchDirs",_);Y(b,m,`from onResolve() callback in plugin ${JSON.stringify(l)}`),h.id=L,A!=null&&(h.pluginName=A),F!=null&&(h.path=F),V!=null&&(h.namespace=V),I!=null&&(h.suffix=I),H!=null&&(h.external=H),Q!=null&&(h.sideEffects=Q),B!=null&&(h.pluginData=f.store(B)),J!=null&&(h.errors=me(J,"errors",f,l)),K!=null&&(h.warnings=me(K,"warnings",f,l)),Z!=null&&(h.watchFiles=xe(Z,"watchFiles")),G!=null&&(h.watchDirs=xe(G,"watchDirs"));break}}catch(b){return{id:L,errors:[be(b,e,f,W&&W(),l)]}}return h}case"on-load":{let h={},l="",v,W;for(let L of x.ids)try{({name:l,callback:v,note:W}=D[L]);let b=await v({path:x.path,namespace:x.namespace,suffix:x.suffix,pluginData:f.load(x.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(l)} to return an object`);let m={},A=n(b,m,"pluginName",g),F=n(b,m,"contents",ft),V=n(b,m,"resolveDir",g),I=n(b,m,"pluginData",Re),H=n(b,m,"loader",g),Q=n(b,m,"errors",_),B=n(b,m,"warnings",_),J=n(b,m,"watchFiles",_),K=n(b,m,"watchDirs",_);Y(b,m,`from onLoad() callback in plugin ${JSON.stringify(l)}`),h.id=L,A!=null&&(h.pluginName=A),F instanceof Uint8Array?h.contents=F:F!=null&&(h.contents=fe(F)),V!=null&&(h.resolveDir=V),I!=null&&(h.pluginData=f.store(I)),H!=null&&(h.loader=H),Q!=null&&(h.errors=me(Q,"errors",f,l)),B!=null&&(h.warnings=me(B,"warnings",f,l)),J!=null&&(h.watchFiles=xe(J,"watchFiles")),K!=null&&(h.watchDirs=xe(K,"watchDirs"));break}}catch(b){return{id:L,errors:[be(b,e,f,W&&W(),l)]}}return h}default:throw new Error("Invalid command: "+x.command)}},te=(x,h,l)=>l();P.length>0&&(te=(x,h,l)=>{(async()=>{for(let{name:v,callback:W,note:L}of P)try{await W(x)}catch(b){x.errors.push(await new Promise(m=>h(b,v,L&&L(),m)))}})().then(l)}),k=!0;let X=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:te,pluginRefs:{ref(){++X===1&&r.set(a,O)},unref(){--X===0&&r.delete(a)}}}},se=(p,u,a,f)=>{let j={},N=n(u,j,"port",ye),P=n(u,j,"host",g),E=n(u,j,"servedir",g),D=n(u,j,"onRequest",Ne),M,w=new Promise((U,k)=>{M=O=>{d.delete(f),O!==null?k(new Error(O)):U()}});return a.serve={},Y(u,j,"in serve() call"),N!==void 0&&(a.serve.port=N),P!==void 0&&(a.serve.host=P),E!==void 0&&(a.serve.servedir=E),d.set(f,{onRequest:D,onWait:M}),{wait:w,stop(){$(p,{command:"serve-stop",key:f},()=>{})}}},ue="warning",oe="silent",de=p=>{let u=s++,a=He(),f,{refs:j,options:N,isTTY:P,callback:E}=p;if(typeof N=="object"){let w=N.plugins;if(w!==void 0){if(!Array.isArray(w))throw new Error('"plugins" must be an array');f=w}}let D=(w,U,k,O)=>{let te=[];try{Oe(te,N,{},P,ue)}catch(x){}let X=be(w,e,a,k,U);$(j,{command:"error",flags:te,error:X},()=>{X.detail=a.load(X.detail),O(X)})},M=(w,U)=>{D(w,U,void 0,k=>{E(we("Build failed",[k],[]),null)})};if(f&&f.length>0){if(e.isSync)return M(new Error("Cannot use plugins in synchronous API calls"),"");ie(N,f,u,a,j).then(w=>{if(!w.ok)M(w.error,w.pluginName);else try{pe(Be(Me({},p),{key:u,details:a,logPluginError:D,requestPlugins:w.requestPlugins,runOnEndCallbacks:w.runOnEndCallbacks,pluginRefs:w.pluginRefs}))}catch(U){M(U,"")}},w=>M(w,""))}else try{pe(Be(Me({},p),{key:u,details:a,logPluginError:D,requestPlugins:null,runOnEndCallbacks:(w,U,k)=>k(),pluginRefs:null}))}catch(w){M(w,"")}},pe=({callName:p,refs:u,serveOptions:a,options:f,isTTY:j,defaultWD:N,callback:P,key:E,details:D,logPluginError:M,requestPlugins:w,runOnEndCallbacks:U,pluginRefs:k})=>{let O={ref(){k&&k.ref(),u&&u.ref()},unref(){k&&k.unref(),u&&u.unref()}},te=!e.isBrowser,{entries:X,flags:x,write:h,stdinContents:l,stdinResolveDir:v,absWorkingDir:W,incremental:L,nodePaths:b,watch:m}=ct(p,f,j,ue,te),A={command:"build",key:E,entries:X,flags:x,write:h,stdinContents:l,stdinResolveDir:v,absWorkingDir:W||N,incremental:L,nodePaths:b};w&&(A.plugins=w);let F=a&&se(O,a,A,E),V,I,H=(B,J)=>{B.outputFiles&&(J.outputFiles=B.outputFiles.map(pt)),B.metafile&&(J.metafile=JSON.parse(B.metafile)),B.writeToStdout!==void 0&&console.log(ge(B.writeToStdout).replace(/\n$/,""))},Q=(B,J)=>{let K={errors:ce(B.errors,D),warnings:ce(B.warnings,D)};H(B,K),U(K,M,()=>{if(K.errors.length>0)return J(we("Build failed",K.errors,K.warnings),null);if(B.rebuild){if(!V){let Z=!1;V=()=>new Promise((G,ae)=>{if(Z||i)throw new Error("Cannot rebuild");$(O,{command:"rebuild",key:E},(z,Xe)=>{if(z)return J(we("Build failed",[{pluginName:"",text:z,location:null,notes:[],detail:void 0}],[]),null);Q(Xe,(Pe,Ze)=>{Pe?ae(Pe):G(Ze)})})}),O.ref(),V.dispose=()=>{Z||(Z=!0,$(O,{command:"rebuild-dispose",key:E},()=>{}),O.unref())}}K.rebuild=V}if(B.watch){if(!I){let Z=!1;O.ref(),I=()=>{Z||(Z=!0,o.delete(E),$(O,{command:"watch-stop",key:E},()=>{}),O.unref())},m&&o.set(E,(G,ae)=>{if(G){m.onRebuild&&m.onRebuild(G,null);return}let z={errors:ce(ae.errors,D),warnings:ce(ae.warnings,D)};H(ae,z),U(z,M,()=>{if(z.errors.length>0){m.onRebuild&&m.onRebuild(we("Build failed",z.errors,z.warnings),null);return}ae.rebuildID!==void 0&&(z.rebuild=V),z.stop=I,m.onRebuild&&m.onRebuild(null,z)})})}K.stop=I}J(null,K)})};if(h&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(L&&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');$(O,A,(B,J)=>{if(B)return P(new Error(B),null);if(F){let K=J,Z=!1;O.ref();let G={port:K.port,host:K.host,wait:F.wait,stop(){Z||(Z=!0,F.stop(),O.unref())}};return O.ref(),F.wait.then(O.unref,O.unref),P(null,G)}return Q(J,P)})};return{readFromStdout:T,afterClose:C,service:{buildOrServe:de,transform:({callName:p,refs:u,input:a,options:f,isTTY:j,fs:N,callback:P})=>{let E=He(),D=M=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let w=dt(p,f,j,oe);$(u,{command:"transform",flags:w,inputFS:M!==null,input:M!==null?M:a},(k,O)=>{if(k)return P(new Error(k),null);let te=ce(O.errors,E),X=ce(O.warnings,E),x=1,h=()=>--x===0&&P(null,{warnings:X,code:O.code,map:O.map});if(te.length>0)return P(we("Transform failed",te,X),null);O.codeFS&&(x++,N.readFile(O.code,(l,v)=>{l!==null?P(l,null):(O.code=v,h())})),O.mapFS&&(x++,N.readFile(O.map,(l,v)=>{l!==null?P(l,null):(O.map=v,h())})),h()})}catch(w){let U=[];try{Oe(U,f,{},j,oe)}catch(O){}let k=be(w,e,E,void 0,"");$(u,{command:"error",flags:U,error:k},()=>{k.detail=E.load(k.detail),P(we("Transform failed",[k],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let M=D;D=()=>N.writeFile(a,M)}D(null)},formatMessages:({callName:p,refs:u,messages:a,options:f,callback:j})=>{let N=me(a,"messages",null,"");if(!f)throw new Error(`Missing second argument in ${p}() call`);let P={},E=n(f,P,"kind",g),D=n(f,P,"color",q),M=n(f,P,"terminalWidth",ye);if(Y(f,P,`in ${p}() call`),E===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let w={command:"format-msgs",messages:N,isWarning:E==="warning"};D!==void 0&&(w.color=D),M!==void 0&&(w.terminalWidth=M),$(u,w,(U,k)=>{if(U)return j(new Error(U),null);j(null,k.messages)})},analyzeMetafile:({callName:p,refs:u,metafile:a,options:f,callback:j})=>{f===void 0&&(f={});let N={},P=n(f,N,"color",q),E=n(f,N,"verbose",q);Y(f,N,`in ${p}() call`);let D={command:"analyze-metafile",metafile:a};P!==void 0&&(D.color=P),E!==void 0&&(D.verbose=E),$(u,D,(M,w)=>{if(M)return j(new Error(M),null);j(null,w.result)})}}}}function He(){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 Se(e,t,r){let o,d=!1;return()=>{if(d)return o;d=!0;try{let i=(e.stack+"").split(`
|
2
2
|
`);i.splice(1,1);let c=Ge(t,i,r);if(c)return o={text:e.message,location:c},o}catch(i){}}}function be(e,t,r,o,d){let i="Internal error",c=null;try{i=(e&&e.message||e)+""}catch(s){}try{c=Ge(t,(e.stack+"").split(`
|
3
3
|
`),"")}catch(s){}return{pluginName:d,text:i,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function Ge(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let d=1;d<t.length;d++){let i=t[d];if(!!i.startsWith(o))for(i=i.slice(o.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 s;try{s=e.readFileSync(c[1],"utf8")}catch(C){break}let y=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",R=+c[3]-1,T=y.slice(R,R+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:fe(y.slice(0,R)).length,length:fe(y.slice(R,R+T)).length,lineText:y+`
|
4
4
|
`+t.slice(1).join(`
|
5
5
|
`),suggestion:""}}break}}return null}function we(e,t,r){let o=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((c,s)=>{if(s===o)return`
|
6
6
|
...`;if(!c.location)return`
|
7
7
|
error: ${c.text}`;let{file:y,line:R,column:T}=c.location,C=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
|
8
|
-
${y}:${R}:${T}: ERROR: ${C}${c.text}`}).join(""),i=new Error(`${e}${d}`);return i.errors=t,i.warnings=r,i}function ce(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={},o=n(e,r,"file",g),d=n(e,r,"namespace",g),i=n(e,r,"line",ye),c=n(e,r,"column",ye),s=n(e,r,"length",ye),y=n(e,r,"lineText",g),R=n(e,r,"suggestion",g);return Y(e,r,t),{file:o||"",namespace:d||"",line:i||0,column:c||0,length:s||0,lineText:y||"",suggestion:R||""}}function me(e,t,r,o){let d=[],i=0;for(let c of e){let s={},y=n(c,s,"pluginName",g),R=n(c,s,"text",g),T=n(c,s,"location",Ke),C=n(c,s,"notes",_),$=n(c,s,"detail",Re),S=`in element ${i} of "${t}"`;Y(c,s,S);let ne=[];if(C)for(let re of C){let le={},ie=n(re,le,"text",g),se=n(re,le,"location",Ke);Y(re,le,S),ne.push({text:ie||"",location:Qe(se,S)})}d.push({pluginName:y||o,text:R||"",location:Qe(T,S),notes:ne,detail:r?r.store($):-1}),i++}return d}function xe(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 pt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=ge(t)),r}}}var mt="0.14.10",yt=e=>ke().build(e),ht=()=>{throw new Error('The "serve" API only works in node')},bt=(e,t)=>ke().transform(e,t),wt=(e,t)=>ke().formatMessages(e,t),vt=(e,t)=>ke().analyzeMetafile(e,t),Rt=()=>{throw new Error('The "buildSync" API only works in node')},Ot=()=>{throw new Error('The "transformSync" API only works in node')},St=()=>{throw new Error('The "formatMessagesSync" API only works in node')},xt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ve,je,ke=()=>{if(je)return je;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')},kt=e=>{e=Ve(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=Et(t,r),ve.catch(()=>{ve=void 0}),ve},Et=async(e,t)=>{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let o=await 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.\n(()=>{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,d,u){if(i===0&&l===s.length&&d===null){if(n===process.stdout.fd){try{process.stdout.write(s,h=>h?u(h,0,null):u(null,l,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,l,s))}catch(h){u(h,0,null)}return}}r.write(n,s,i,l,d,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+=g.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,d,u){if(i!==0||l!==s.length||d!==null){u(a());return}const h=this.writeSync(n,s);u(null,h)},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,d,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 f=new TextEncoder("utf-8"),g=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 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,o|m,!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)},d=e=>{const t=n(e+0),o=n(e+8),c=new Array(o);for(let m=0;m<o;m++)c[m]=s(t+m*8);return c},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},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),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,(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(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=d(e+32),m=Reflect.apply(o,t,c);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=d(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=d(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=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);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)}}}}async run(r){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=f.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 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(),await 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.10"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',i;if(t){let y=new Blob([d],{type:"text/javascript"});i=new Worker(URL.createObjectURL(y))}else{let R=new Function("postMessage",d+"var onmessage; return m => onmessage(m)")(T=>i.onmessage({data:T}));i={onmessage:null,postMessage:T=>R({data:T}),terminate(){}}}i.postMessage(o),i.onmessage=({data:y})=>c(y);let{readFromStdout:c,service:s}=Ye({writeToStdin(y){i.postMessage(y)},isSync:!1,isBrowser:!0,esbuild:Ce});je={build:y=>new Promise((R,T)=>s.buildOrServe({callName:"build",refs:null,serveOptions:null,options:y,isTTY:!1,defaultWD:"/",callback:(C,$)=>C?T(C):R($)})),transform:(y,R)=>new Promise((T,C)=>s.transform({callName:"transform",refs:null,input:y,options:R||{},isTTY:!1,fs:{readFile($,S){S(new Error("Internal error"),null)},writeFile($,S){S(null)}},callback:($,S)=>$?C($):T(S)})),formatMessages:(y,R)=>new Promise((T,C)=>s.formatMessages({callName:"formatMessages",refs:null,messages:y,options:R,callback:($,S)=>$?C($):T(S)})),analyzeMetafile:(y,R)=>new Promise((T,C)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof y=="string"?y:JSON.stringify(y),options:R,callback:($,S)=>$?C($):T(S)}))}};export{vt as analyzeMetafile,xt as analyzeMetafileSync,yt as build,Rt as buildSync,wt as formatMessages,St as formatMessagesSync,kt as initialize,ht as serve,bt as transform,Ot as transformSync,mt as version};
|
8
|
+
${y}:${R}:${T}: ERROR: ${C}${c.text}`}).join(""),i=new Error(`${e}${d}`);return i.errors=t,i.warnings=r,i}function ce(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={},o=n(e,r,"file",g),d=n(e,r,"namespace",g),i=n(e,r,"line",ye),c=n(e,r,"column",ye),s=n(e,r,"length",ye),y=n(e,r,"lineText",g),R=n(e,r,"suggestion",g);return Y(e,r,t),{file:o||"",namespace:d||"",line:i||0,column:c||0,length:s||0,lineText:y||"",suggestion:R||""}}function me(e,t,r,o){let d=[],i=0;for(let c of e){let s={},y=n(c,s,"pluginName",g),R=n(c,s,"text",g),T=n(c,s,"location",Ke),C=n(c,s,"notes",_),$=n(c,s,"detail",Re),S=`in element ${i} of "${t}"`;Y(c,s,S);let ne=[];if(C)for(let re of C){let le={},ie=n(re,le,"text",g),se=n(re,le,"location",Ke);Y(re,le,S),ne.push({text:ie||"",location:Qe(se,S)})}d.push({pluginName:y||o,text:R||"",location:Qe(T,S),notes:ne,detail:r?r.store($):-1}),i++}return d}function xe(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 pt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=ge(t)),r}}}var mt="0.14.14",yt=e=>ke().build(e),ht=()=>{throw new Error('The "serve" API only works in node')},bt=(e,t)=>ke().transform(e,t),wt=(e,t)=>ke().formatMessages(e,t),vt=(e,t)=>ke().analyzeMetafile(e,t),Rt=()=>{throw new Error('The "buildSync" API only works in node')},Ot=()=>{throw new Error('The "transformSync" API only works in node')},St=()=>{throw new Error('The "formatMessagesSync" API only works in node')},xt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ve,je,ke=()=>{if(je)return je;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')},kt=e=>{e=Ve(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=Et(t,r),ve.catch(()=>{ve=void 0}),ve},Et=async(e,t)=>{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let o=await 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.\n(()=>{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,d,u){if(i===0&&l===s.length&&d===null){if(n===process.stdout.fd){try{process.stdout.write(s,h=>h?u(h,0,null):u(null,l,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,l,s))}catch(h){u(h,0,null)}return}}r.write(n,s,i,l,d,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+=g.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,d,u){if(i!==0||l!==s.length||d!==null){u(a());return}const h=this.writeSync(n,s);u(null,h)},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,d,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 f=new TextEncoder("utf-8"),g=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 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,o|m,!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)},d=e=>{const t=n(e+0),o=n(e+8),c=new Array(o);for(let m=0;m<o;m++)c[m]=s(t+m*8);return c},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},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),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,(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(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=d(e+32),m=Reflect.apply(o,t,c);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=d(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=d(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=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);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)}}}}async run(r){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=f.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 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(),await 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.14"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',i;if(t){let y=new Blob([d],{type:"text/javascript"});i=new Worker(URL.createObjectURL(y))}else{let R=new Function("postMessage",d+"var onmessage; return m => onmessage(m)")(T=>i.onmessage({data:T}));i={onmessage:null,postMessage:T=>R({data:T}),terminate(){}}}i.postMessage(o),i.onmessage=({data:y})=>c(y);let{readFromStdout:c,service:s}=Ye({writeToStdin(y){i.postMessage(y)},isSync:!1,isBrowser:!0,esbuild:Ce});je={build:y=>new Promise((R,T)=>s.buildOrServe({callName:"build",refs:null,serveOptions:null,options:y,isTTY:!1,defaultWD:"/",callback:(C,$)=>C?T(C):R($)})),transform:(y,R)=>new Promise((T,C)=>s.transform({callName:"transform",refs:null,input:y,options:R||{},isTTY:!1,fs:{readFile($,S){S(new Error("Internal error"),null)},writeFile($,S){S(null)}},callback:($,S)=>$?C($):T(S)})),formatMessages:(y,R)=>new Promise((T,C)=>s.formatMessages({callName:"formatMessages",refs:null,messages:y,options:R,callback:($,S)=>$?C($):T(S)})),analyzeMetafile:(y,R)=>new Promise((T,C)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof y=="string"?y:JSON.stringify(y),options:R,callback:($,S)=>$?C($):T(S)}))}};export{vt as analyzeMetafile,xt as analyzeMetafileSync,yt as build,Rt as buildSync,wt as formatMessages,St as formatMessagesSync,kt as initialize,ht as serve,bt as transform,Ot as transformSync,mt as version};
|
@@ -449,7 +449,9 @@ export interface AnalyzeMetafileOptions {
|
|
449
449
|
* Documentation: https://esbuild.github.io/api/#build-api
|
450
450
|
*/
|
451
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 }>;
|
452
453
|
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
454
|
+
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
453
455
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
454
456
|
|
455
457
|
/**
|
@@ -733,8 +733,8 @@ function createChannel(streamIn) {
|
|
733
733
|
if (isFirstPacket) {
|
734
734
|
isFirstPacket = false;
|
735
735
|
let binaryVersion = String.fromCharCode(...bytes);
|
736
|
-
if (binaryVersion !== "0.14.
|
737
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
736
|
+
if (binaryVersion !== "0.14.14") {
|
737
|
+
throw new Error(`Cannot start service: Host version "${"0.14.14"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
738
738
|
}
|
739
739
|
return;
|
740
740
|
}
|
@@ -1662,7 +1662,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1662
1662
|
}
|
1663
1663
|
|
1664
1664
|
// lib/npm/browser.ts
|
1665
|
-
var version = "0.14.
|
1665
|
+
var version = "0.14.14";
|
1666
1666
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1667
1667
|
var serve = () => {
|
1668
1668
|
throw new Error(`The "serve" API only works in node`);
|
@@ -2419,7 +2419,7 @@ onmessage = ({ data: wasm }) => {
|
|
2419
2419
|
callback(null, count);
|
2420
2420
|
};
|
2421
2421
|
let go = new global.Go();
|
2422
|
-
go.argv = ["", \`--service=\${"0.14.
|
2422
|
+
go.argv = ["", \`--service=\${"0.14.14"}\`];
|
2423
2423
|
WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));
|
2424
2424
|
};}`;
|
2425
2425
|
let worker;
|
@@ -1,10 +1,10 @@
|
|
1
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.10")throw new Error(`Cannot start service: Host version "0.14.10" 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(`
|
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.14")throw new Error(`Cannot start service: Host version "0.14.14" 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
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
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
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
7
|
...`;if(!c.location)return`
|
8
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.10",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.10"],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);
|
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.14",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.14"],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
10
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
@@ -449,7 +449,9 @@ export interface AnalyzeMetafileOptions {
|
|
449
449
|
* Documentation: https://esbuild.github.io/api/#build-api
|
450
450
|
*/
|
451
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 }>;
|
452
453
|
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
454
|
+
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
453
455
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
454
456
|
|
455
457
|
/**
|
@@ -717,8 +717,8 @@ function createChannel(streamIn) {
|
|
717
717
|
if (isFirstPacket) {
|
718
718
|
isFirstPacket = false;
|
719
719
|
let binaryVersion = String.fromCharCode(...bytes);
|
720
|
-
if (binaryVersion !== "0.14.
|
721
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
720
|
+
if (binaryVersion !== "0.14.14") {
|
721
|
+
throw new Error(`Cannot start service: Host version "${"0.14.14"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
722
722
|
}
|
723
723
|
return;
|
724
724
|
}
|
@@ -1687,6 +1687,29 @@ function pkgAndSubpathForCurrentPlatform() {
|
|
1687
1687
|
}
|
1688
1688
|
return { pkg, subpath };
|
1689
1689
|
}
|
1690
|
+
function pkgForSomeOtherPlatform() {
|
1691
|
+
const libMainJS = require.resolve("esbuild");
|
1692
|
+
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
1693
|
+
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
1694
|
+
for (const unixKey in knownUnixlikePackages) {
|
1695
|
+
try {
|
1696
|
+
const pkg = knownUnixlikePackages[unixKey];
|
1697
|
+
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
1698
|
+
return pkg;
|
1699
|
+
} catch {
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
for (const windowsKey in knownWindowsPackages) {
|
1703
|
+
try {
|
1704
|
+
const pkg = knownWindowsPackages[windowsKey];
|
1705
|
+
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
1706
|
+
return pkg;
|
1707
|
+
} catch {
|
1708
|
+
}
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
return null;
|
1712
|
+
}
|
1690
1713
|
function downloadedBinPath(pkg, subpath) {
|
1691
1714
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
1692
1715
|
return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
|
@@ -1705,6 +1728,36 @@ function generateBinPath() {
|
|
1705
1728
|
try {
|
1706
1729
|
require.resolve(pkg);
|
1707
1730
|
} catch {
|
1731
|
+
const otherPkg = pkgForSomeOtherPlatform();
|
1732
|
+
if (otherPkg) {
|
1733
|
+
throw new Error(`
|
1734
|
+
You installed esbuild on another platform than the one you're currently using.
|
1735
|
+
This won't work because esbuild is written with native code and needs to
|
1736
|
+
install a platform-specific binary executable.
|
1737
|
+
|
1738
|
+
Specifically the "${otherPkg}" package is present but this platform
|
1739
|
+
needs the "${pkg}" package instead. People often get into this
|
1740
|
+
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
1741
|
+
into a Docker image that runs Linux, or by copying "node_modules" between
|
1742
|
+
Windows and WSL environments.
|
1743
|
+
|
1744
|
+
If you are installing with npm, you can try not copying the "node_modules"
|
1745
|
+
directory when you copy the files over, and running "npm ci" or "npm install"
|
1746
|
+
on the destination platform after the copy. Or you could consider using yarn
|
1747
|
+
instead which has built-in support for installing a package on multiple
|
1748
|
+
platforms simultaneously.
|
1749
|
+
|
1750
|
+
If you are installing with yarn, you can try listing both this platform and the
|
1751
|
+
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
1752
|
+
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
1753
|
+
Keep in mind that this means multiple copies of esbuild will be present.
|
1754
|
+
|
1755
|
+
Another alternative is to use the "esbuild-wasm" package instead, which works
|
1756
|
+
the same way on all platforms. But it comes with a heavy performance cost and
|
1757
|
+
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
1758
|
+
want to do that.
|
1759
|
+
`);
|
1760
|
+
}
|
1708
1761
|
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
1709
1762
|
|
1710
1763
|
If you are installing esbuild with npm, make sure that you don't specify the
|
@@ -1751,7 +1804,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
1751
1804
|
}
|
1752
1805
|
}
|
1753
1806
|
var _a;
|
1754
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.
|
1807
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.14";
|
1755
1808
|
var esbuildCommandAndArgs = () => {
|
1756
1809
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
1757
1810
|
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.
|
@@ -1810,7 +1863,7 @@ var fsAsync = {
|
|
1810
1863
|
}
|
1811
1864
|
}
|
1812
1865
|
};
|
1813
|
-
var version = "0.14.
|
1866
|
+
var version = "0.14.14";
|
1814
1867
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1815
1868
|
var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
|
1816
1869
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
@@ -1919,7 +1972,7 @@ var ensureServiceIsRunning = () => {
|
|
1919
1972
|
if (longLivedService)
|
1920
1973
|
return longLivedService;
|
1921
1974
|
let [command, args] = esbuildCommandAndArgs();
|
1922
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.14.
|
1975
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.14.14"}`, "--ping"), {
|
1923
1976
|
windowsHide: true,
|
1924
1977
|
stdio: ["pipe", "pipe", "inherit"],
|
1925
1978
|
cwd: defaultWD
|
@@ -2028,7 +2081,7 @@ var runServiceSync = (callback) => {
|
|
2028
2081
|
esbuild: node_exports
|
2029
2082
|
});
|
2030
2083
|
callback(service);
|
2031
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.
|
2084
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.14"}`), {
|
2032
2085
|
cwd: defaultWD,
|
2033
2086
|
windowsHide: true,
|
2034
2087
|
input: stdin,
|
@@ -2044,7 +2097,7 @@ var workerThreadService = null;
|
|
2044
2097
|
var startWorkerThreadService = (worker_threads2) => {
|
2045
2098
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
2046
2099
|
let worker = new worker_threads2.Worker(__filename, {
|
2047
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.14.
|
2100
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.14.14" },
|
2048
2101
|
transferList: [workerPort],
|
2049
2102
|
execArgv: []
|
2050
2103
|
});
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-asset-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isomorfeus-iodine
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.7.
|
19
|
+
version: 0.7.46
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.
|
26
|
+
version: 0.7.46
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: isomorfeus-speednode
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.13.
|
61
|
+
version: 3.13.11
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.13.
|
68
|
+
version: 3.13.11
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: opal
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.4.
|
75
|
+
version: 1.4.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.4.
|
82
|
+
version: 1.4.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|