isomorfeus-asset-manager 0.14.24 → 0.14.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/esbuild-wasm/LICENSE.md +21 -0
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +7 -3
- data/node_modules/esbuild-wasm/esm/browser.js +21 -11
- data/node_modules/esbuild-wasm/esm/browser.min.js +7 -7
- data/node_modules/esbuild-wasm/lib/browser.d.ts +7 -3
- data/node_modules/esbuild-wasm/lib/browser.js +22 -11
- data/node_modules/esbuild-wasm/lib/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/main.d.ts +7 -3
- data/node_modules/esbuild-wasm/lib/main.js +34 -36
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +3 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
export type Platform = 'browser' | 'node' | 'neutral';
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm';
|
3
|
-
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
3
|
+
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
5
5
|
export type Charset = 'ascii' | 'utf8';
|
6
6
|
export type Drop = 'console' | 'debugger';
|
@@ -17,10 +17,12 @@ interface CommonOptions {
|
|
17
17
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
19
19
|
format?: Format;
|
20
|
-
/** Documentation: https://esbuild.github.io/api/#
|
20
|
+
/** Documentation: https://esbuild.github.io/api/#global-name */
|
21
21
|
globalName?: string;
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
23
23
|
target?: string | string[];
|
24
|
+
/** Documentation: https://esbuild.github.io/api/#supported */
|
25
|
+
supported?: Record<string, boolean>;
|
24
26
|
|
25
27
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
26
28
|
mangleProps?: RegExp;
|
@@ -94,7 +96,7 @@ export interface BuildOptions extends CommonOptions {
|
|
94
96
|
loader?: { [ext: string]: Loader };
|
95
97
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
96
98
|
resolveExtensions?: string[];
|
97
|
-
/** Documentation: https://esbuild.github.io/api/#
|
99
|
+
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
98
100
|
mainFields?: string[];
|
99
101
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
100
102
|
conditions?: string[];
|
@@ -148,6 +150,7 @@ export interface StdinOptions {
|
|
148
150
|
}
|
149
151
|
|
150
152
|
export interface Message {
|
153
|
+
id: string;
|
151
154
|
pluginName: string;
|
152
155
|
text: string;
|
153
156
|
location: Location | null;
|
@@ -402,6 +405,7 @@ export interface OnLoadResult {
|
|
402
405
|
}
|
403
406
|
|
404
407
|
export interface PartialMessage {
|
408
|
+
id?: string;
|
405
409
|
pluginName?: string;
|
406
410
|
text?: string;
|
407
411
|
location?: Partial<Location> | null;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
(module=>{
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __defProps = Object.defineProperties;
|
@@ -337,6 +338,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
337
338
|
let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
|
338
339
|
let define = getFlag(options, keys, "define", mustBeObject);
|
339
340
|
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
341
|
+
let supported = getFlag(options, keys, "supported", mustBeObject);
|
340
342
|
let pure = getFlag(options, keys, "pure", mustBeArray);
|
341
343
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
342
344
|
if (legalComments)
|
@@ -398,6 +400,13 @@ function pushCommonFlags(flags, options, keys) {
|
|
398
400
|
flags.push(`--log-override:${key}=${logOverride[key]}`);
|
399
401
|
}
|
400
402
|
}
|
403
|
+
if (supported) {
|
404
|
+
for (let key in supported) {
|
405
|
+
if (key.indexOf("=") >= 0)
|
406
|
+
throw new Error(`Invalid supported: ${key}`);
|
407
|
+
flags.push(`--supported:${key}=${supported[key]}`);
|
408
|
+
}
|
409
|
+
}
|
401
410
|
if (pure)
|
402
411
|
for (let fn of pure)
|
403
412
|
flags.push(`--pure:${fn}`);
|
@@ -772,8 +781,8 @@ function createChannel(streamIn) {
|
|
772
781
|
if (isFirstPacket) {
|
773
782
|
isFirstPacket = false;
|
774
783
|
let binaryVersion = String.fromCharCode(...bytes);
|
775
|
-
if (binaryVersion !== "0.14.
|
776
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
784
|
+
if (binaryVersion !== "0.14.49") {
|
785
|
+
throw new Error(`Cannot start service: Host version "${"0.14.49"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
777
786
|
}
|
778
787
|
return;
|
779
788
|
}
|
@@ -1222,7 +1231,7 @@ function createChannel(streamIn) {
|
|
1222
1231
|
callerRefs.unref();
|
1223
1232
|
}
|
1224
1233
|
};
|
1225
|
-
let writeDefault = !streamIn.
|
1234
|
+
let writeDefault = !streamIn.isWriteUnavailable;
|
1226
1235
|
let {
|
1227
1236
|
entries,
|
1228
1237
|
flags,
|
@@ -1282,7 +1291,7 @@ function createChannel(streamIn) {
|
|
1282
1291
|
throw new Error("Cannot rebuild");
|
1283
1292
|
sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
|
1284
1293
|
if (error2) {
|
1285
|
-
const message = { pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1294
|
+
const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1286
1295
|
return callback2(failureErrorWithLog("Build failed", [message], []), null);
|
1287
1296
|
}
|
1288
1297
|
buildResponseToResult(response2, (error3, result3) => {
|
@@ -1350,8 +1359,8 @@ function createChannel(streamIn) {
|
|
1350
1359
|
callback2(null, result);
|
1351
1360
|
});
|
1352
1361
|
};
|
1353
|
-
if (write && streamIn.
|
1354
|
-
throw new Error(`
|
1362
|
+
if (write && streamIn.isWriteUnavailable)
|
1363
|
+
throw new Error(`The "write" option is unavailable in this environment`);
|
1355
1364
|
if (incremental && streamIn.isSync)
|
1356
1365
|
throw new Error(`Cannot use "incremental" with a synchronous build`);
|
1357
1366
|
if (watch && streamIn.isSync)
|
@@ -1565,7 +1574,7 @@ function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
|
|
1565
1574
|
location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
|
1566
1575
|
} catch (e2) {
|
1567
1576
|
}
|
1568
|
-
return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1577
|
+
return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1569
1578
|
}
|
1570
1579
|
function parseStackLinesV8(streamIn, lines, ident) {
|
1571
1580
|
let at = " at ";
|
@@ -1664,6 +1673,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1664
1673
|
let index = 0;
|
1665
1674
|
for (const message of messages) {
|
1666
1675
|
let keys = {};
|
1676
|
+
let id = getFlag(message, keys, "id", mustBeString);
|
1667
1677
|
let pluginName = getFlag(message, keys, "pluginName", mustBeString);
|
1668
1678
|
let text = getFlag(message, keys, "text", mustBeString);
|
1669
1679
|
let location = getFlag(message, keys, "location", mustBeObjectOrNull);
|
@@ -1685,6 +1695,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1685
1695
|
}
|
1686
1696
|
}
|
1687
1697
|
messagesClone.push({
|
1698
|
+
id: id || "",
|
1688
1699
|
pluginName: pluginName || fallbackPluginName,
|
1689
1700
|
text: text || "",
|
1690
1701
|
location: sanitizeLocation(location, where),
|
@@ -1718,7 +1729,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1718
1729
|
}
|
1719
1730
|
|
1720
1731
|
// lib/npm/browser.ts
|
1721
|
-
var version = "0.14.
|
1732
|
+
var version = "0.14.49";
|
1722
1733
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1723
1734
|
var serve = () => {
|
1724
1735
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1774,7 +1785,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
1774
1785
|
}
|
1775
1786
|
let worker;
|
1776
1787
|
if (useWorker) {
|
1777
|
-
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(() => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.42"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1788
|
+
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(() => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.49"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1778
1789
|
worker = new Worker(URL.createObjectURL(blob));
|
1779
1790
|
} else {
|
1780
1791
|
let onmessage = ((postMessage) => {
|
@@ -2375,7 +2386,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2375
2386
|
callback(null, count);
|
2376
2387
|
};
|
2377
2388
|
let go = new globalThis.Go();
|
2378
|
-
go.argv = ["", `--service=${"0.14.
|
2389
|
+
go.argv = ["", `--service=${"0.14.49"}`];
|
2379
2390
|
if (wasm instanceof WebAssembly.Module) {
|
2380
2391
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2381
2392
|
} else {
|
@@ -2398,7 +2409,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2398
2409
|
worker.postMessage(bytes);
|
2399
2410
|
},
|
2400
2411
|
isSync: false,
|
2401
|
-
|
2412
|
+
isWriteUnavailable: true,
|
2402
2413
|
esbuild: browser_exports
|
2403
2414
|
});
|
2404
2415
|
longLivedService = {
|
@@ -1,17 +1,17 @@
|
|
1
|
-
(module=>{
|
2
|
-
var Ee=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ne=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Fe=(e,t)=>lt(e,st(t));var ut=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of ot(t))!Ke.call(e,f)&&f!==r&&Ee(e,f,{get:()=>t[f],enumerable:!(s=it(t,f))||s.enumerable});return e};var ct=e=>ft(Ee({},"__esModule",{value:!0}),e);var ce=(e,t,r)=>new Promise((s,f)=>{var i=g=>{try{l(r.next(g))}catch(O){f(O)}},c=g=>{try{l(r.throw(g))}catch(O){f(O)}},l=g=>g.done?s(g.value):Promise.resolve(g.value).then(i,c);l((r=r.apply(e,t)).next())});var Te={};ut(Te,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Bt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>At,initialize:()=>Tt,serve:()=>Et,transform:()=>kt,transformSync:()=>Pt,version:()=>St});module.exports=ct(Te);function Le(e){let t=s=>{if(s===null)r.write8(0);else if(typeof s=="boolean")r.write8(1),r.write8(+s);else if(typeof s=="number")r.write8(2),r.write32(s|0);else if(typeof s=="string")r.write8(3),r.write(de(s));else if(s instanceof Uint8Array)r.write8(4),r.write(s);else if(s instanceof Array){r.write8(5),r.write32(s.length);for(let f of s)t(f)}else{let f=Object.keys(s);r.write8(6),r.write32(f.length);for(let i of f)r.write(de(i)),t(s[i])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),je(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return be(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let g=0;g<c;g++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let g=0;g<c;g++)l[be(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new ke(e),s=r.read32(),f=(s&1)===0;s>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:f,value:i}}var ke=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);je(this.buf,t,r)}write(t){let r=this._write(4+t.length);je(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Ue(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),s=this._read(r.length);return r.set(this.buf.subarray(s,s+t)),r}},de,be;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;de=r=>e.encode(r),be=r=>t.decode(r)}else if(typeof Buffer!="undefined")de=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},be=e=>{let{buffer:t,byteOffset:r,byteLength:s}=e;return Buffer.from(t,r,s).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function je(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ce=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",pt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",Pe=e=>e instanceof RegExp?null:"a RegExp object",Se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",oe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",gt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let f=e[r];if(t[r+""]=!0,f===void 0)return;let i=s(f);if(i!==null)throw new Error(`"${r}" must be ${i}`);return f}function J(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Ge(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),s=n(e,t,"wasmModule",gt),f=n(e,t,"worker",q);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:f}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let s=e[r];if(typeof s=="string"||s===!1)t[r]=s;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ae(e,t,r,s,f){let i=n(t,r,"color",q),c=n(t,r,"logLevel",y),l=n(t,r,"logLimit",Se);i!==void 0?e.push(`--color=${i}`):s&&e.push("--color=true"),e.push(`--log-level=${c||f}`),e.push(`--log-limit=${l||0}`)}function Ze(e,t,r){let s=n(t,r,"legalComments",y),f=n(t,r,"sourceRoot",y),i=n(t,r,"sourcesContent",q),c=n(t,r,"target",ht),l=n(t,r,"format",y),g=n(t,r,"globalName",y),O=n(t,r,"mangleProps",Pe),N=n(t,r,"reserveProps",Pe),$=n(t,r,"mangleQuoted",q),P=n(t,r,"minify",q),W=n(t,r,"minifySyntax",q),ae=n(t,r,"minifyWhitespace",q),re=n(t,r,"minifyIdentifiers",q),ne=n(t,r,"drop",_),le=n(t,r,"charset",y),ie=n(t,r,"treeShaking",q),ge=n(t,r,"ignoreAnnotations",q),ue=n(t,r,"jsx",y),me=n(t,r,"jsxFactory",y),fe=n(t,r,"jsxFragment",y),ye=n(t,r,"define",oe),he=n(t,r,"logOverride",oe),ve=n(t,r,"pure",_),m=n(t,r,"keepNames",q);if(s&&e.push(`--legal-comments=${s}`),f!==void 0&&e.push(`--source-root=${f}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),l&&e.push(`--format=${l}`),g&&e.push(`--global-name=${g}`),P&&e.push("--minify"),W&&e.push("--minify-syntax"),ae&&e.push("--minify-whitespace"),re&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),ge&&e.push("--ignore-annotations"),ne)for(let o of ne)e.push(`--drop:${o}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),$!==void 0&&e.push(`--mangle-quoted=${$}`),ue&&e.push(`--jsx=${ue}`),me&&e.push(`--jsx-factory=${me}`),fe&&e.push(`--jsx-fragment=${fe}`),ye)for(let o in ye){if(o.indexOf("=")>=0)throw new Error(`Invalid define: ${o}`);e.push(`--define:${o}=${ye[o]}`)}if(he)for(let o in he){if(o.indexOf("=")>=0)throw new Error(`Invalid log override: ${o}`);e.push(`--log-override:${o}=${he[o]}`)}if(ve)for(let o of ve)e.push(`--pure:${o}`);m&&e.push("--keep-names")}function wt(e,t,r,s,f){var w;let i=[],c=[],l=Object.create(null),g=null,O=null,N=null;Ae(i,t,l,r,s),Ze(i,t,l);let $=n(t,l,"sourcemap",He),P=n(t,l,"bundle",q),W=n(t,l,"watch",pt),ae=n(t,l,"splitting",q),re=n(t,l,"preserveSymlinks",q),ne=n(t,l,"metafile",q),le=n(t,l,"outfile",y),ie=n(t,l,"outdir",y),ge=n(t,l,"outbase",y),ue=n(t,l,"platform",y),me=n(t,l,"tsconfig",y),fe=n(t,l,"resolveExtensions",_),ye=n(t,l,"nodePaths",_),he=n(t,l,"mainFields",_),ve=n(t,l,"conditions",_),m=n(t,l,"external",_),o=n(t,l,"loader",oe),a=n(t,l,"outExtension",oe),d=n(t,l,"publicPath",y),F=n(t,l,"entryNames",y),B=n(t,l,"chunkNames",y),M=n(t,l,"assetNames",y),x=n(t,l,"inject",_),A=n(t,l,"banner",oe),C=n(t,l,"footer",oe),R=n(t,l,"entryPoints",mt),L=n(t,l,"absWorkingDir",y),S=n(t,l,"stdin",oe),T=(w=n(t,l,"write",q))!=null?w:f,U=n(t,l,"allowOverwrite",q),ee=n(t,l,"incremental",q)===!0,E=n(t,l,"mangleCache",oe);if(l.plugins=!0,J(t,l,`in ${e}() call`),$&&i.push(`--sourcemap${$===!0?"":`=${$}`}`),P&&i.push("--bundle"),U&&i.push("--allow-overwrite"),W)if(i.push("--watch"),typeof W=="boolean")N={};else{let u=Object.create(null),v=n(W,u,"onRebuild",We);J(W,u,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ae&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),ne&&i.push("--metafile"),le&&i.push(`--outfile=${le}`),ie&&i.push(`--outdir=${ie}`),ge&&i.push(`--outbase=${ge}`),ue&&i.push(`--platform=${ue}`),me&&i.push(`--tsconfig=${me}`),fe){let u=[];for(let v of fe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);u.push(v)}i.push(`--resolve-extensions=${u.join(",")}`)}if(d&&i.push(`--public-path=${d}`),F&&i.push(`--entry-names=${F}`),B&&i.push(`--chunk-names=${B}`),M&&i.push(`--asset-names=${M}`),he){let u=[];for(let v of he){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);u.push(v)}i.push(`--main-fields=${u.join(",")}`)}if(ve){let u=[];for(let v of ve){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);u.push(v)}i.push(`--conditions=${u.join(",")}`)}if(m)for(let u of m)i.push(`--external:${u}`);if(A)for(let u in A){if(u.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${u}`);i.push(`--banner:${u}=${A[u]}`)}if(C)for(let u in C){if(u.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${u}`);i.push(`--footer:${u}=${C[u]}`)}if(x)for(let u of x)i.push(`--inject:${u}`);if(o)for(let u in o){if(u.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${u}`);i.push(`--loader:${u}=${o[u]}`)}if(a)for(let u in a){if(u.indexOf("=")>=0)throw new Error(`Invalid out extension: ${u}`);i.push(`--out-extension:${u}=${a[u]}`)}if(R)if(Array.isArray(R))for(let u of R)c.push(["",u+""]);else for(let[u,v]of Object.entries(R))c.push([u+"",v+""]);if(S){let u=Object.create(null),v=n(S,u,"contents",y),Y=n(S,u,"resolveDir",y),h=n(S,u,"sourcefile",y),p=n(S,u,"loader",y);J(S,u,'in "stdin" object'),h&&i.push(`--sourcefile=${h}`),p&&i.push(`--loader=${p}`),Y&&(O=Y+""),g=v?v+"":""}let b=[];if(ye)for(let u of ye)u+="",b.push(u);return{entries:c,flags:i,write:T,stdinContents:g,stdinResolveDir:O,absWorkingDir:L,incremental:ee,nodePaths:b,watch:N,mangleCache:Xe(E)}}function vt(e,t,r,s){let f=[],i=Object.create(null);Ae(f,t,i,r,s),Ze(f,t,i);let c=n(t,i,"sourcemap",He),l=n(t,i,"tsconfigRaw",yt),g=n(t,i,"sourcefile",y),O=n(t,i,"loader",y),N=n(t,i,"banner",y),$=n(t,i,"footer",y),P=n(t,i,"mangleCache",oe);return J(t,i,`in ${e}() call`),c&&f.push(`--sourcemap=${c===!0?"external":c}`),l&&f.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),g&&f.push(`--sourcefile=${g}`),O&&f.push(`--loader=${O}`),N&&f.push(`--banner=${N}`),$&&f.push(`--footer=${$}`),{flags:f,mangleCache:Xe(P)}}function et(e){let t=new Map,r=new Map,s=new Map,f=new Map,i=null,c=0,l=0,g=new Uint8Array(16*1024),O=0,N=m=>{let o=O+m.length;if(o>g.length){let d=new Uint8Array(o*2);d.set(g),g=d}g.set(m,O),O+=m.length;let a=0;for(;a+4<=O;){let d=Ue(g,a);if(a+4+d>O)break;a+=4,ne(g.subarray(a,a+d)),a+=d}a>0&&(g.copyWithin(0,a,O),O-=a)},$=m=>{i={reason:m?": "+(m.message||m):""};let o="The service was stopped"+i.reason;for(let a of t.values())a(o,null);t.clear();for(let a of f.values())a.onWait(o);f.clear();for(let a of s.values())try{a(new Error(o),null)}catch(d){console.error(d)}s.clear()},P=(m,o,a)=>{if(i)return a("The service is no longer running"+i.reason,null);let d=c++;t.set(d,(F,B)=>{try{a(F,B)}finally{m&&m.unref()}}),m&&m.ref(),e.writeToStdin(Le({id:d,isRequest:!0,value:o}))},W=(m,o)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(Le({id:m,isRequest:!1,value:o}))},ae=(m,o)=>ce(this,null,function*(){try{switch(o.command){case"ping":{W(m,{});break}case"on-start":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"on-resolve":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"on-load":{let a=r.get(o.key);a?W(m,yield a(o)):W(m,{});break}case"serve-request":{let a=f.get(o.key);a&&a.onRequest&&a.onRequest(o.args),W(m,{});break}case"serve-wait":{let a=f.get(o.key);a&&a.onWait(o.error),W(m,{});break}case"watch-rebuild":{let a=s.get(o.key);try{a&&a(null,o.args)}catch(d){console.error(d)}W(m,{});break}default:throw new Error("Invalid command: "+o.command)}}catch(a){W(m,{errors:[Re(a,e,null,void 0,"")]})}}),re=!0,ne=m=>{if(re){re=!1;let a=String.fromCharCode(...m);if(a!=="0.14.42")throw new Error(`Cannot start service: Host version "0.14.42" does not match binary version ${JSON.stringify(a)}`);return}let o=_e(m);if(o.isRequest)ae(o.id,o.value);else{let a=t.get(o.id);t.delete(o.id),o.value.error?a(o.value.error,{}):a(null,o.value)}},le=(m,o,a,d,F)=>ce(this,null,function*(){let B=[],M=[],x={},A={},C=0,R=0,L=[],S=!1;o=[...o];for(let E of o){let b={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n(E,b,"name",y);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let u=n(E,b,"setup",We);if(typeof u!="function")throw new Error("Plugin is missing a setup function");J(E,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=u({initialOptions:m,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(D,k,"pluginName",y),I=n(D,k,"importer",y),K=n(D,k,"namespace",y),X=n(D,k,"resolveDir",y),H=n(D,k,"kind",y),j=n(D,k,"pluginData",Ce);return J(D,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:p,key:a,pluginName:w};Q!=null&&(z.pluginName=Q),I!=null&&(z.importer=I),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),j!=null&&(z.pluginData=d.store(j)),P(F,z,(se,Z)=>{se!==null?G(new Error(se)):V({errors:pe(Z.errors,d),warnings:pe(Z.warnings,d),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:d.load(Z.pluginData)})})})},onStart(p){let D='This error came from the "onStart" callback registered here:',k=$e(new Error(D),e,"onStart");B.push({name:w,callback:p,note:k})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',k=$e(new Error(D),e,"onEnd");M.push({name:w,callback:p,note:k})},onResolve(p,D){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),I={},K=n(p,I,"filter",Pe),X=n(p,I,"namespace",y);if(J(p,I,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=C++;x[H]={name:w,callback:D,note:Q},v.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(p,D){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),I={},K=n(p,I,"filter",Pe),X=n(p,I,"namespace",y);if(J(p,I,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=C++;A[H]={name:w,callback:D,note:Q},v.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),L.push(v)}catch(u){return{ok:!1,error:u,pluginName:w}}}let T=E=>ce(this,null,function*(){switch(E.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(B.map(Y=>ce(this,[Y],function*({name:w,callback:u,note:v}){try{let h=yield u();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"errors",_),k=n(h,p,"warnings",_);J(h,p,`from onStart() callback in plugin ${JSON.stringify(w)}`),D!=null&&b.errors.push(...we(D,"errors",d,w)),k!=null&&b.warnings.push(...we(k,"warnings",d,w))}}catch(h){b.errors.push(Re(h,e,d,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",u,v;for(let Y of E.ids)try{({name:w,callback:u,note:v}=x[Y]);let h=yield u({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",y),k=n(h,p,"path",y),Q=n(h,p,"namespace",y),I=n(h,p,"suffix",y),K=n(h,p,"external",q),X=n(h,p,"sideEffects",q),H=n(h,p,"pluginData",Ce),j=n(h,p,"errors",_),V=n(h,p,"warnings",_),G=n(h,p,"watchFiles",_),z=n(h,p,"watchDirs",_);J(h,p,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k!=null&&(b.path=k),Q!=null&&(b.namespace=Q),I!=null&&(b.suffix=I),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),H!=null&&(b.pluginData=d.store(H)),j!=null&&(b.errors=we(j,"errors",d,w)),V!=null&&(b.warnings=we(V,"warnings",d,w)),G!=null&&(b.watchFiles=Me(G,"watchFiles")),z!=null&&(b.watchDirs=Me(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}case"on-load":{let b={},w="",u,v;for(let Y of E.ids)try{({name:w,callback:u,note:v}=A[Y]);let h=yield u({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",y),k=n(h,p,"contents",bt),Q=n(h,p,"resolveDir",y),I=n(h,p,"pluginData",Ce),K=n(h,p,"loader",y),X=n(h,p,"errors",_),H=n(h,p,"warnings",_),j=n(h,p,"watchFiles",_),V=n(h,p,"watchDirs",_);J(h,p,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k instanceof Uint8Array?b.contents=k:k!=null&&(b.contents=de(k)),Q!=null&&(b.resolveDir=Q),I!=null&&(b.pluginData=d.store(I)),K!=null&&(b.loader=K),X!=null&&(b.errors=we(X,"errors",d,w)),H!=null&&(b.warnings=we(H,"warnings",d,w)),j!=null&&(b.watchFiles=Me(j,"watchFiles")),V!=null&&(b.watchDirs=Me(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+E.command)}}),U=(E,b,w)=>w();M.length>0&&(U=(E,b,w)=>{(()=>ce(this,null,function*(){for(let{name:u,callback:v,note:Y}of M)try{yield v(E)}catch(h){E.errors.push(yield new Promise(p=>b(h,u,Y&&Y(),p)))}}))().then(w)}),S=!0;let ee=0;return{ok:!0,requestPlugins:L,runOnEndCallbacks:U,pluginRefs:{ref(){++ee===1&&r.set(a,T)},unref(){--ee===0&&r.delete(a)}}}}),ie=(m,o,a,d)=>{let F={},B=n(o,F,"port",Se),M=n(o,F,"host",y),x=n(o,F,"servedir",y),A=n(o,F,"onRequest",We),C,R=new Promise((L,S)=>{C=T=>{f.delete(d),T!==null?S(new Error(T)):L()}});return a.serve={},J(o,F,"in serve() call"),B!==void 0&&(a.serve.port=B),M!==void 0&&(a.serve.host=M),x!==void 0&&(a.serve.servedir=x),f.set(d,{onRequest:A,onWait:C}),{wait:R,stop(){P(m,{command:"serve-stop",key:d},()=>{})}}},ge="warning",ue="silent",me=m=>{let o=l++,a=Ye(),d,{refs:F,options:B,isTTY:M,callback:x}=m;if(typeof B=="object"){let R=B.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');d=R}}let A=(R,L,S,T)=>{let U=[];try{Ae(U,B,{},M,ge)}catch(E){}let ee=Re(R,e,a,S,L);P(F,{command:"error",flags:U,error:ee},()=>{ee.detail=a.load(ee.detail),T(ee)})},C=(R,L)=>{A(R,L,void 0,S=>{x(Oe("Build failed",[S],[]),null)})};if(d&&d.length>0){if(e.isSync)return C(new Error("Cannot use plugins in synchronous API calls"),"");le(B,d,o,a,F).then(R=>{if(!R.ok)C(R.error,R.pluginName);else try{fe(Fe(Ne({},m),{key:o,details:a,logPluginError:A,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(L){C(L,"")}},R=>C(R,""))}else try{fe(Fe(Ne({},m),{key:o,details:a,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(R,L,S)=>S(),pluginRefs:null}))}catch(R){C(R,"")}},fe=({callName:m,refs:o,serveOptions:a,options:d,isTTY:F,defaultWD:B,callback:M,key:x,details:A,logPluginError:C,requestPlugins:R,runOnEndCallbacks:L,pluginRefs:S})=>{let T={ref(){S&&S.ref(),o&&o.ref()},unref(){S&&S.unref(),o&&o.unref()}},U=!e.isBrowser,{entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:u,absWorkingDir:v,incremental:Y,nodePaths:h,watch:p,mangleCache:D}=wt(m,d,F,ge,U),k={command:"build",key:x,entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:u,absWorkingDir:v||B,incremental:Y,nodePaths:h};R&&(k.plugins=R),D&&(k.mangleCache=D);let Q=a&&ie(T,a,k,x),I,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(be(j.writeToStdout).replace(/\n$/,""))},H=(j,V)=>{let G={errors:pe(j.errors,A),warnings:pe(j.warnings,A)};X(j,G),L(G,C,()=>{if(G.errors.length>0)return V(Oe("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!I){let z=!1;I=()=>new Promise((se,Z)=>{if(z||i)throw new Error("Cannot rebuild");P(T,{command:"rebuild",key:x},(te,rt)=>{if(te)return V(Oe("Build failed",[{pluginName:"",text:te,location:null,notes:[],detail:void 0}],[]),null);H(rt,(De,nt)=>{De?Z(De):se(nt)})})}),T.ref(),I.dispose=()=>{z||(z=!0,P(T,{command:"rebuild-dispose",key:x},()=>{}),T.unref())}}G.rebuild=I}if(j.watch){if(!K){let z=!1;T.ref(),K=()=>{z||(z=!0,s.delete(x),P(T,{command:"watch-stop",key:x},()=>{}),T.unref())},p&&s.set(x,(se,Z)=>{if(se){p.onRebuild&&p.onRebuild(se,null);return}let te={errors:pe(Z.errors,A),warnings:pe(Z.warnings,A)};X(Z,te),L(te,C,()=>{if(te.errors.length>0){p.onRebuild&&p.onRebuild(Oe("Build failed",te.errors,te.warnings),null);return}Z.rebuildID!==void 0&&(te.rebuild=I),te.stop=K,p.onRebuild&&p.onRebuild(null,te)})})}G.stop=K}V(null,G)})};if(b&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');P(T,k,(j,V)=>{if(j)return M(new Error(j),null);if(Q){let G=V,z=!1;T.ref();let se={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),T.unref())}};return T.ref(),Q.wait.then(T.unref,T.unref),M(null,se)}return H(V,M)})};return{readFromStdout:N,afterClose:$,service:{buildOrServe:me,transform:({callName:m,refs:o,input:a,options:d,isTTY:F,fs:B,callback:M})=>{let x=Ye(),A=C=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:L}=vt(m,d,F,ue),S={command:"transform",flags:R,inputFS:C!==null,input:C!==null?C:a};L&&(S.mangleCache=L),P(o,S,(T,U)=>{if(T)return M(new Error(T),null);let ee=pe(U.errors,x),E=pe(U.warnings,x),b=1,w=()=>{if(--b===0){let u={warnings:E,code:U.code,map:U.map};U.mangleCache&&(u.mangleCache=U==null?void 0:U.mangleCache),M(null,u)}};if(ee.length>0)return M(Oe("Transform failed",ee,E),null);U.codeFS&&(b++,B.readFile(U.code,(u,v)=>{u!==null?M(u,null):(U.code=v,w())})),U.mapFS&&(b++,B.readFile(U.map,(u,v)=>{u!==null?M(u,null):(U.map=v,w())})),w()})}catch(R){let L=[];try{Ae(L,d,{},F,ue)}catch(T){}let S=Re(R,e,x,void 0,"");P(o,{command:"error",flags:L,error:S},()=>{S.detail=x.load(S.detail),M(Oe("Transform failed",[S],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let C=A;A=()=>B.writeFile(a,C)}A(null)},formatMessages:({callName:m,refs:o,messages:a,options:d,callback:F})=>{let B=we(a,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${m}() call`);let M={},x=n(d,M,"kind",y),A=n(d,M,"color",q),C=n(d,M,"terminalWidth",Se);if(J(d,M,`in ${m}() call`),x===void 0)throw new Error(`Missing "kind" in ${m}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${m}() call`);let R={command:"format-msgs",messages:B,isWarning:x==="warning"};A!==void 0&&(R.color=A),C!==void 0&&(R.terminalWidth=C),P(o,R,(L,S)=>{if(L)return F(new Error(L),null);F(null,S.messages)})},analyzeMetafile:({callName:m,refs:o,metafile:a,options:d,callback:F})=>{d===void 0&&(d={});let B={},M=n(d,B,"color",q),x=n(d,B,"verbose",q);J(d,B,`in ${m}() call`);let A={command:"analyze-metafile",metafile:a};M!==void 0&&(A.color=M),x!==void 0&&(A.verbose=x),P(o,A,(C,R)=>{if(C)return F(new Error(C),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let s=t++;return e.set(s,r),s}}}function $e(e,t,r){let s,f=!1;return()=>{if(f)return s;f=!0;try{let i=(e.stack+"").split(`
|
3
|
-
`);
|
4
|
-
`),"")}catch(
|
1
|
+
"use strict";(module=>{
|
2
|
+
var Ee=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ne=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Fe=(e,t)=>lt(e,st(t));var ut=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ot(t))!Ke.call(e,u)&&u!==r&&Ee(e,u,{get:()=>t[u],enumerable:!(o=it(t,u))||o.enumerable});return e};var ct=e=>ft(Ee({},"__esModule",{value:!0}),e);var de=(e,t,r)=>new Promise((o,u)=>{var s=y=>{try{i(r.next(y))}catch(O){u(O)}},c=y=>{try{i(r.throw(y))}catch(O){u(O)}},i=y=>y.done?o(y.value):Promise.resolve(y.value).then(s,c);i((r=r.apply(e,t)).next())});var Be={};ut(Be,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Tt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>At,initialize:()=>Bt,serve:()=>Et,transform:()=>kt,transformSync:()=>Pt,version:()=>St});module.exports=ct(Be);function Ue(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(pe(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 s of u)r.write(pe(s)),t(o[s])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),je(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return we(r.read());case 4:return r.read();case 5:{let c=r.read32(),i=[];for(let y=0;y<c;y++)i.push(t());return i}case 6:{let c=r.read32(),i={};for(let y=0;y<c;y++)i[we(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new ke(e),o=r.read32(),u=(o&1)===0;o>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:u,value:s}}var ke=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);je(this.buf,t,r)}write(t){let r=this._write(4+t.length);je(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Le(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}},pe,we;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;pe=r=>e.encode(r),we=r=>t.decode(r)}else if(typeof Buffer!="undefined")pe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},we=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 Le(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function je(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ce=()=>null,W=e=>typeof e=="boolean"?null:"a boolean",pt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Pe=e=>e instanceof RegExp?null:"a RegExp object",Se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",ie=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",gt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let u=e[r];if(t[r+""]=!0,u===void 0)return;let s=o(u);if(s!==null)throw new Error(`"${r}" must be ${s}`);return u}function J(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Ge(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),o=n(e,t,"wasmModule",gt),u=n(e,t,"worker",W);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:u}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let o=e[r];if(typeof o=="string"||o===!1)t[r]=o;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ae(e,t,r,o,u){let s=n(t,r,"color",W),c=n(t,r,"logLevel",m),i=n(t,r,"logLimit",Se);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${i||0}`)}function Ze(e,t,r){let o=n(t,r,"legalComments",m),u=n(t,r,"sourceRoot",m),s=n(t,r,"sourcesContent",W),c=n(t,r,"target",ht),i=n(t,r,"format",m),y=n(t,r,"globalName",m),O=n(t,r,"mangleProps",Pe),N=n(t,r,"reserveProps",Pe),P=n(t,r,"mangleQuoted",W),$=n(t,r,"minify",W),I=n(t,r,"minifySyntax",W),ne=n(t,r,"minifyWhitespace",W),se=n(t,r,"minifyIdentifiers",W),le=n(t,r,"drop",_),te=n(t,r,"charset",m),oe=n(t,r,"treeShaking",W),ae=n(t,r,"ignoreAnnotations",W),fe=n(t,r,"jsx",m),me=n(t,r,"jsxFactory",m),ce=n(t,r,"jsxFragment",m),ye=n(t,r,"define",ie),he=n(t,r,"logOverride",ie),be=n(t,r,"supported",ie),g=n(t,r,"pure",_),f=n(t,r,"keepNames",W);if(o&&e.push(`--legal-comments=${o}`),u!==void 0&&e.push(`--source-root=${u}`),s!==void 0&&e.push(`--sources-content=${s}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),i&&e.push(`--format=${i}`),y&&e.push(`--global-name=${y}`),$&&e.push("--minify"),I&&e.push("--minify-syntax"),ne&&e.push("--minify-whitespace"),se&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),oe!==void 0&&e.push(`--tree-shaking=${oe}`),ae&&e.push("--ignore-annotations"),le)for(let l of le)e.push(`--drop:${l}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),P!==void 0&&e.push(`--mangle-quoted=${P}`),fe&&e.push(`--jsx=${fe}`),me&&e.push(`--jsx-factory=${me}`),ce&&e.push(`--jsx-fragment=${ce}`),ye)for(let l in ye){if(l.indexOf("=")>=0)throw new Error(`Invalid define: ${l}`);e.push(`--define:${l}=${ye[l]}`)}if(he)for(let l in he){if(l.indexOf("=")>=0)throw new Error(`Invalid log override: ${l}`);e.push(`--log-override:${l}=${he[l]}`)}if(be)for(let l in be){if(l.indexOf("=")>=0)throw new Error(`Invalid supported: ${l}`);e.push(`--supported:${l}=${be[l]}`)}if(g)for(let l of g)e.push(`--pure:${l}`);f&&e.push("--keep-names")}function wt(e,t,r,o,u){var w;let s=[],c=[],i=Object.create(null),y=null,O=null,N=null;Ae(s,t,i,r,o),Ze(s,t,i);let P=n(t,i,"sourcemap",He),$=n(t,i,"bundle",W),I=n(t,i,"watch",pt),ne=n(t,i,"splitting",W),se=n(t,i,"preserveSymlinks",W),le=n(t,i,"metafile",W),te=n(t,i,"outfile",m),oe=n(t,i,"outdir",m),ae=n(t,i,"outbase",m),fe=n(t,i,"platform",m),me=n(t,i,"tsconfig",m),ce=n(t,i,"resolveExtensions",_),ye=n(t,i,"nodePaths",_),he=n(t,i,"mainFields",_),be=n(t,i,"conditions",_),g=n(t,i,"external",_),f=n(t,i,"loader",ie),l=n(t,i,"outExtension",ie),d=n(t,i,"publicPath",m),F=n(t,i,"entryNames",m),T=n(t,i,"chunkNames",m),M=n(t,i,"assetNames",m),x=n(t,i,"inject",_),A=n(t,i,"banner",ie),C=n(t,i,"footer",ie),R=n(t,i,"entryPoints",mt),U=n(t,i,"absWorkingDir",m),S=n(t,i,"stdin",ie),B=(w=n(t,i,"write",W))!=null?w:u,L=n(t,i,"allowOverwrite",W),ee=n(t,i,"incremental",W)===!0,E=n(t,i,"mangleCache",ie);if(i.plugins=!0,J(t,i,`in ${e}() call`),P&&s.push(`--sourcemap${P===!0?"":`=${P}`}`),$&&s.push("--bundle"),L&&s.push("--allow-overwrite"),I)if(s.push("--watch"),typeof I=="boolean")N={};else{let a=Object.create(null),v=n(I,a,"onRebuild",We);J(I,a,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ne&&s.push("--splitting"),se&&s.push("--preserve-symlinks"),le&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),oe&&s.push(`--outdir=${oe}`),ae&&s.push(`--outbase=${ae}`),fe&&s.push(`--platform=${fe}`),me&&s.push(`--tsconfig=${me}`),ce){let a=[];for(let v of ce){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);a.push(v)}s.push(`--resolve-extensions=${a.join(",")}`)}if(d&&s.push(`--public-path=${d}`),F&&s.push(`--entry-names=${F}`),T&&s.push(`--chunk-names=${T}`),M&&s.push(`--asset-names=${M}`),he){let a=[];for(let v of he){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);a.push(v)}s.push(`--main-fields=${a.join(",")}`)}if(be){let a=[];for(let v of be){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);a.push(v)}s.push(`--conditions=${a.join(",")}`)}if(g)for(let a of g)s.push(`--external:${a}`);if(A)for(let a in A){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);s.push(`--banner:${a}=${A[a]}`)}if(C)for(let a in C){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);s.push(`--footer:${a}=${C[a]}`)}if(x)for(let a of x)s.push(`--inject:${a}`);if(f)for(let a in f){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);s.push(`--loader:${a}=${f[a]}`)}if(l)for(let a in l){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);s.push(`--out-extension:${a}=${l[a]}`)}if(R)if(Array.isArray(R))for(let a of R)c.push(["",a+""]);else for(let[a,v]of Object.entries(R))c.push([a+"",v+""]);if(S){let a=Object.create(null),v=n(S,a,"contents",m),Y=n(S,a,"resolveDir",m),h=n(S,a,"sourcefile",m),p=n(S,a,"loader",m);J(S,a,'in "stdin" object'),h&&s.push(`--sourcefile=${h}`),p&&s.push(`--loader=${p}`),Y&&(O=Y+""),y=v?v+"":""}let b=[];if(ye)for(let a of ye)a+="",b.push(a);return{entries:c,flags:s,write:B,stdinContents:y,stdinResolveDir:O,absWorkingDir:U,incremental:ee,nodePaths:b,watch:N,mangleCache:Xe(E)}}function vt(e,t,r,o){let u=[],s=Object.create(null);Ae(u,t,s,r,o),Ze(u,t,s);let c=n(t,s,"sourcemap",He),i=n(t,s,"tsconfigRaw",yt),y=n(t,s,"sourcefile",m),O=n(t,s,"loader",m),N=n(t,s,"banner",m),P=n(t,s,"footer",m),$=n(t,s,"mangleCache",ie);return J(t,s,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),i&&u.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),y&&u.push(`--sourcefile=${y}`),O&&u.push(`--loader=${O}`),N&&u.push(`--banner=${N}`),P&&u.push(`--footer=${P}`),{flags:u,mangleCache:Xe($)}}function et(e){let t=new Map,r=new Map,o=new Map,u=new Map,s=null,c=0,i=0,y=new Uint8Array(16*1024),O=0,N=g=>{let f=O+g.length;if(f>y.length){let d=new Uint8Array(f*2);d.set(y),y=d}y.set(g,O),O+=g.length;let l=0;for(;l+4<=O;){let d=Le(y,l);if(l+4+d>O)break;l+=4,le(y.subarray(l,l+d)),l+=d}l>0&&(y.copyWithin(0,l,O),O-=l)},P=g=>{s={reason:g?": "+(g.message||g):""};let f="The service was stopped"+s.reason;for(let l of t.values())l(f,null);t.clear();for(let l of u.values())l.onWait(f);u.clear();for(let l of o.values())try{l(new Error(f),null)}catch(d){console.error(d)}o.clear()},$=(g,f,l)=>{if(s)return l("The service is no longer running"+s.reason,null);let d=c++;t.set(d,(F,T)=>{try{l(F,T)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ue({id:d,isRequest:!0,value:f}))},I=(g,f)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Ue({id:g,isRequest:!1,value:f}))},ne=(g,f)=>de(this,null,function*(){try{switch(f.command){case"ping":{I(g,{});break}case"on-start":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"on-resolve":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"on-load":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"serve-request":{let l=u.get(f.key);l&&l.onRequest&&l.onRequest(f.args),I(g,{});break}case"serve-wait":{let l=u.get(f.key);l&&l.onWait(f.error),I(g,{});break}case"watch-rebuild":{let l=o.get(f.key);try{l&&l(null,f.args)}catch(d){console.error(d)}I(g,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(l){I(g,{errors:[Re(l,e,null,void 0,"")]})}}),se=!0,le=g=>{if(se){se=!1;let l=String.fromCharCode(...g);if(l!=="0.14.49")throw new Error(`Cannot start service: Host version "0.14.49" does not match binary version ${JSON.stringify(l)}`);return}let f=_e(g);if(f.isRequest)ne(f.id,f.value);else{let l=t.get(f.id);t.delete(f.id),f.value.error?l(f.value.error,{}):l(null,f.value)}},te=(g,f,l,d,F)=>de(this,null,function*(){let T=[],M=[],x={},A={},C=0,R=0,U=[],S=!1;f=[...f];for(let E of f){let b={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n(E,b,"name",m);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let a=n(E,b,"setup",We);if(typeof a!="function")throw new Error("Plugin is missing a setup function");J(E,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=a({initialOptions:g,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(D,k,"pluginName",m),q=n(D,k,"importer",m),K=n(D,k,"namespace",m),X=n(D,k,"resolveDir",m),H=n(D,k,"kind",m),j=n(D,k,"pluginData",Ce);return J(D,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:p,key:l,pluginName:w};Q!=null&&(z.pluginName=Q),q!=null&&(z.importer=q),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),j!=null&&(z.pluginData=d.store(j)),$(F,z,(ue,Z)=>{ue!==null?G(new Error(ue)):V({errors:ge(Z.errors,d),warnings:ge(Z.warnings,d),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:d.load(Z.pluginData)})})})},onStart(p){let D='This error came from the "onStart" callback registered here:',k=$e(new Error(D),e,"onStart");T.push({name:w,callback:p,note:k})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',k=$e(new Error(D),e,"onEnd");M.push({name:w,callback:p,note:k})},onResolve(p,D){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),q={},K=n(p,q,"filter",Pe),X=n(p,q,"namespace",m);if(J(p,q,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=C++;x[H]={name:w,callback:D,note:Q},v.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(p,D){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),q={},K=n(p,q,"filter",Pe),X=n(p,q,"namespace",m);if(J(p,q,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=C++;A[H]={name:w,callback:D,note:Q},v.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),U.push(v)}catch(a){return{ok:!1,error:a,pluginName:w}}}let B=E=>de(this,null,function*(){switch(E.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(T.map(Y=>de(this,[Y],function*({name:w,callback:a,note:v}){try{let h=yield a();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"errors",_),k=n(h,p,"warnings",_);J(h,p,`from onStart() callback in plugin ${JSON.stringify(w)}`),D!=null&&b.errors.push(...ve(D,"errors",d,w)),k!=null&&b.warnings.push(...ve(k,"warnings",d,w))}}catch(h){b.errors.push(Re(h,e,d,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=x[Y]);let h=yield a({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",m),k=n(h,p,"path",m),Q=n(h,p,"namespace",m),q=n(h,p,"suffix",m),K=n(h,p,"external",W),X=n(h,p,"sideEffects",W),H=n(h,p,"pluginData",Ce),j=n(h,p,"errors",_),V=n(h,p,"warnings",_),G=n(h,p,"watchFiles",_),z=n(h,p,"watchDirs",_);J(h,p,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k!=null&&(b.path=k),Q!=null&&(b.namespace=Q),q!=null&&(b.suffix=q),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),H!=null&&(b.pluginData=d.store(H)),j!=null&&(b.errors=ve(j,"errors",d,w)),V!=null&&(b.warnings=ve(V,"warnings",d,w)),G!=null&&(b.watchFiles=Me(G,"watchFiles")),z!=null&&(b.watchDirs=Me(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}case"on-load":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=A[Y]);let h=yield a({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",m),k=n(h,p,"contents",bt),Q=n(h,p,"resolveDir",m),q=n(h,p,"pluginData",Ce),K=n(h,p,"loader",m),X=n(h,p,"errors",_),H=n(h,p,"warnings",_),j=n(h,p,"watchFiles",_),V=n(h,p,"watchDirs",_);J(h,p,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k instanceof Uint8Array?b.contents=k:k!=null&&(b.contents=pe(k)),Q!=null&&(b.resolveDir=Q),q!=null&&(b.pluginData=d.store(q)),K!=null&&(b.loader=K),X!=null&&(b.errors=ve(X,"errors",d,w)),H!=null&&(b.warnings=ve(H,"warnings",d,w)),j!=null&&(b.watchFiles=Me(j,"watchFiles")),V!=null&&(b.watchDirs=Me(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+E.command)}}),L=(E,b,w)=>w();M.length>0&&(L=(E,b,w)=>{(()=>de(this,null,function*(){for(let{name:a,callback:v,note:Y}of M)try{yield v(E)}catch(h){E.errors.push(yield new Promise(p=>b(h,a,Y&&Y(),p)))}}))().then(w)}),S=!0;let ee=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:L,pluginRefs:{ref(){++ee===1&&r.set(l,B)},unref(){--ee===0&&r.delete(l)}}}}),oe=(g,f,l,d)=>{let F={},T=n(f,F,"port",Se),M=n(f,F,"host",m),x=n(f,F,"servedir",m),A=n(f,F,"onRequest",We),C,R=new Promise((U,S)=>{C=B=>{u.delete(d),B!==null?S(new Error(B)):U()}});return l.serve={},J(f,F,"in serve() call"),T!==void 0&&(l.serve.port=T),M!==void 0&&(l.serve.host=M),x!==void 0&&(l.serve.servedir=x),u.set(d,{onRequest:A,onWait:C}),{wait:R,stop(){$(g,{command:"serve-stop",key:d},()=>{})}}},ae="warning",fe="silent",me=g=>{let f=i++,l=Ye(),d,{refs:F,options:T,isTTY:M,callback:x}=g;if(typeof T=="object"){let R=T.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');d=R}}let A=(R,U,S,B)=>{let L=[];try{Ae(L,T,{},M,ae)}catch(E){}let ee=Re(R,e,l,S,U);$(F,{command:"error",flags:L,error:ee},()=>{ee.detail=l.load(ee.detail),B(ee)})},C=(R,U)=>{A(R,U,void 0,S=>{x(Oe("Build failed",[S],[]),null)})};if(d&&d.length>0){if(e.isSync)return C(new Error("Cannot use plugins in synchronous API calls"),"");te(T,d,f,l,F).then(R=>{if(!R.ok)C(R.error,R.pluginName);else try{ce(Fe(Ne({},g),{key:f,details:l,logPluginError:A,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(U){C(U,"")}},R=>C(R,""))}else try{ce(Fe(Ne({},g),{key:f,details:l,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(R,U,S)=>S(),pluginRefs:null}))}catch(R){C(R,"")}},ce=({callName:g,refs:f,serveOptions:l,options:d,isTTY:F,defaultWD:T,callback:M,key:x,details:A,logPluginError:C,requestPlugins:R,runOnEndCallbacks:U,pluginRefs:S})=>{let B={ref(){S&&S.ref(),f&&f.ref()},unref(){S&&S.unref(),f&&f.unref()}},L=!e.isWriteUnavailable,{entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v,incremental:Y,nodePaths:h,watch:p,mangleCache:D}=wt(g,d,F,ae,L),k={command:"build",key:x,entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v||T,incremental:Y,nodePaths:h};R&&(k.plugins=R),D&&(k.mangleCache=D);let Q=l&&oe(B,l,k,x),q,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(we(j.writeToStdout).replace(/\n$/,""))},H=(j,V)=>{let G={errors:ge(j.errors,A),warnings:ge(j.warnings,A)};X(j,G),U(G,C,()=>{if(G.errors.length>0)return V(Oe("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!q){let z=!1;q=()=>new Promise((ue,Z)=>{if(z||s)throw new Error("Cannot rebuild");$(B,{command:"rebuild",key:x},(re,rt)=>{if(re)return V(Oe("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(rt,(De,nt)=>{De?Z(De):ue(nt)})})}),B.ref(),q.dispose=()=>{z||(z=!0,$(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=q}if(j.watch){if(!K){let z=!1;B.ref(),K=()=>{z||(z=!0,o.delete(x),$(B,{command:"watch-stop",key:x},()=>{}),B.unref())},p&&o.set(x,(ue,Z)=>{if(ue){p.onRebuild&&p.onRebuild(ue,null);return}let re={errors:ge(Z.errors,A),warnings:ge(Z.warnings,A)};X(Z,re),U(re,C,()=>{if(re.errors.length>0){p.onRebuild&&p.onRebuild(Oe("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=q),re.stop=K,p.onRebuild&&p.onRebuild(null,re)})})}G.stop=K}V(null,G)})};if(b&&e.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');$(B,k,(j,V)=>{if(j)return M(new Error(j),null);if(Q){let G=V,z=!1;B.ref();let ue={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),B.unref())}};return B.ref(),Q.wait.then(B.unref,B.unref),M(null,ue)}return H(V,M)})};return{readFromStdout:N,afterClose:P,service:{buildOrServe:me,transform:({callName:g,refs:f,input:l,options:d,isTTY:F,fs:T,callback:M})=>{let x=Ye(),A=C=>{try{if(typeof l!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:U}=vt(g,d,F,fe),S={command:"transform",flags:R,inputFS:C!==null,input:C!==null?C:l};U&&(S.mangleCache=U),$(f,S,(B,L)=>{if(B)return M(new Error(B),null);let ee=ge(L.errors,x),E=ge(L.warnings,x),b=1,w=()=>{if(--b===0){let a={warnings:E,code:L.code,map:L.map};L.mangleCache&&(a.mangleCache=L==null?void 0:L.mangleCache),M(null,a)}};if(ee.length>0)return M(Oe("Transform failed",ee,E),null);L.codeFS&&(b++,T.readFile(L.code,(a,v)=>{a!==null?M(a,null):(L.code=v,w())})),L.mapFS&&(b++,T.readFile(L.map,(a,v)=>{a!==null?M(a,null):(L.map=v,w())})),w()})}catch(R){let U=[];try{Ae(U,d,{},F,fe)}catch(B){}let S=Re(R,e,x,void 0,"");$(f,{command:"error",flags:U,error:S},()=>{S.detail=x.load(S.detail),M(Oe("Transform failed",[S],[]),null)})}};if(typeof l=="string"&&l.length>1024*1024){let C=A;A=()=>T.writeFile(l,C)}A(null)},formatMessages:({callName:g,refs:f,messages:l,options:d,callback:F})=>{let T=ve(l,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${g}() call`);let M={},x=n(d,M,"kind",m),A=n(d,M,"color",W),C=n(d,M,"terminalWidth",Se);if(J(d,M,`in ${g}() call`),x===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let R={command:"format-msgs",messages:T,isWarning:x==="warning"};A!==void 0&&(R.color=A),C!==void 0&&(R.terminalWidth=C),$(f,R,(U,S)=>{if(U)return F(new Error(U),null);F(null,S.messages)})},analyzeMetafile:({callName:g,refs:f,metafile:l,options:d,callback:F})=>{d===void 0&&(d={});let T={},M=n(d,T,"color",W),x=n(d,T,"verbose",W);J(d,T,`in ${g}() call`);let A={command:"analyze-metafile",metafile:l};M!==void 0&&(A.color=M),x!==void 0&&(A.verbose=x),$(f,A,(C,R)=>{if(C)return F(new Error(C),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let o=t++;return e.set(o,r),o}}}function $e(e,t,r){let o,u=!1;return()=>{if(u)return o;u=!0;try{let s=(e.stack+"").split(`
|
3
|
+
`);s.splice(1,1);let c=tt(t,s,r);if(c)return o={text:e.message,location:c},o}catch(s){}}}function Re(e,t,r,o,u){let s="Internal error",c=null;try{s=(e&&e.message||e)+""}catch(i){}try{c=tt(t,(e.stack+"").split(`
|
4
|
+
`),"")}catch(i){}return{id:"",pluginName:u,text:s,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function tt(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 s=t[u];if(!!s.startsWith(o))for(s=s.slice(o.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(c){s=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),c){s=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(s),c){let i;try{i=e.readFileSync(c[1],"utf8")}catch(P){break}let y=i.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=y.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:pe(y.slice(0,O)).length,length:pe(y.slice(O,O+N)).length,lineText:y+`
|
5
5
|
`+t.slice(1).join(`
|
6
|
-
`),suggestion:""}}break}}return null}function Oe(e,t,r){let
|
6
|
+
`),suggestion:""}}break}}return null}function Oe(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,i)=>{if(i===o)return`
|
7
7
|
...`;if(!c.location)return`
|
8
|
-
error: ${c.text}`;let{file:
|
9
|
-
${g}:${O}:${N}: ERROR: ${$}${c.text}`}).join(""),i=new Error(`${e}${f}`);return i.errors=t,i.warnings=r,i}function pe(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",y),f=n(e,r,"namespace",y),i=n(e,r,"line",Se),c=n(e,r,"column",Se),l=n(e,r,"length",Se),g=n(e,r,"lineText",y),O=n(e,r,"suggestion",y);return J(e,r,t),{file:s||"",namespace:f||"",line:i||0,column:c||0,length:l||0,lineText:g||"",suggestion:O||""}}function we(e,t,r,s){let f=[],i=0;for(let c of e){let l={},g=n(c,l,"pluginName",y),O=n(c,l,"text",y),N=n(c,l,"location",Je),$=n(c,l,"notes",_),P=n(c,l,"detail",Ce),W=`in element ${i} of "${t}"`;J(c,l,W);let ae=[];if($)for(let re of $){let ne={},le=n(re,ne,"text",y),ie=n(re,ne,"location",Je);J(re,ne,W),ae.push({text:le||"",location:Qe(ie,W)})}f.push({pluginName:g||s,text:O||"",location:Qe(N,W),notes:ae,detail:r?r.store(P):-1}),i++}return f}function Me(e,t){let r=[];for(let s of e){if(typeof s!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(s)}return r}function Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=be(t)),r}}}var St="0.14.42",xt=e=>Be().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Be().transform(e,t),$t=(e,t)=>Be().formatMessages(e,t),Mt=(e,t)=>Be().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},At=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},xe,qe,Be=()=>{if(qe)return qe;throw xe?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Tt=e=>{e=Ge(e||{});let t=e.wasmURL,r=e.wasmModule,s=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(xe)throw new Error('Cannot call "initialize" more than once');return xe=Dt(t||"",r,s),xe.catch(()=>{xe=void 0}),xe},Dt=(e,t,r)=>ce(void 0,null,function*(){let s;if(t)s=t;else{let l=yield fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);s=yield l.arrayBuffer()}let f;if(r){let l=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const g=new TextEncoder("utf-8"),f=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=c(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=g.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.42"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});f=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
|
8
|
+
error: ${c.text}`;let{file:y,line:O,column:N}=c.location,P=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
|
9
|
+
${y}:${O}:${N}: ERROR: ${P}${c.text}`}).join(""),s=new Error(`${e}${u}`);return s.errors=t,s.warnings=r,s}function ge(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",m),u=n(e,r,"namespace",m),s=n(e,r,"line",Se),c=n(e,r,"column",Se),i=n(e,r,"length",Se),y=n(e,r,"lineText",m),O=n(e,r,"suggestion",m);return J(e,r,t),{file:o||"",namespace:u||"",line:s||0,column:c||0,length:i||0,lineText:y||"",suggestion:O||""}}function ve(e,t,r,o){let u=[],s=0;for(let c of e){let i={},y=n(c,i,"id",m),O=n(c,i,"pluginName",m),N=n(c,i,"text",m),P=n(c,i,"location",Je),$=n(c,i,"notes",_),I=n(c,i,"detail",Ce),ne=`in element ${s} of "${t}"`;J(c,i,ne);let se=[];if($)for(let le of $){let te={},oe=n(le,te,"text",m),ae=n(le,te,"location",Je);J(le,te,ne),se.push({text:oe||"",location:Qe(ae,ne)})}u.push({id:y||"",pluginName:O||o,text:N||"",location:Qe(P,ne),notes:se,detail:r?r.store(I):-1}),s++}return u}function Me(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 Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=we(t)),r}}}var St="0.14.49",xt=e=>Te().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Te().transform(e,t),$t=(e,t)=>Te().formatMessages(e,t),Mt=(e,t)=>Te().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},At=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Tt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},xe,qe,Te=()=>{if(qe)return qe;throw xe?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Bt=e=>{e=Ge(e||{});let t=e.wasmURL,r=e.wasmModule,o=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(xe)throw new Error('Cannot call "initialize" more than once');return xe=Dt(t||"",r,o),xe.catch(()=>{xe=void 0}),xe},Dt=(e,t,r)=>de(void 0,null,function*(){let o;if(t)o=t;else{let i=yield fetch(e);if(!i.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=yield i.arrayBuffer()}let u;if(r){let i=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const g=new TextEncoder("utf-8"),f=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=c(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=g.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.49"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});u=new Worker(URL.createObjectURL(i))}else{let i=(postMessage=>{
|
10
10
|
// Copyright 2018 The Go Authors. All rights reserved.
|
11
11
|
// Use of this source code is governed by a BSD-style
|
12
12
|
// license that can be found in the LICENSE file.
|
13
13
|
var y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`
|
14
14
|
`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const g=new TextEncoder("utf-8"),f=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=c(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=g.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`
|
15
15
|
`);d.length>1&&console.log(d.slice(0,-1).join(`
|
16
|
-
`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.
|
16
|
+
`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.49"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(y=>u.onmessage({data:y}));u={onmessage:null,postMessage:y=>setTimeout(()=>i({data:y})),terminate(){}}}u.postMessage(o),u.onmessage=({data:i})=>s(i);let{readFromStdout:s,service:c}=et({writeToStdin(i){u.postMessage(i)},isSync:!1,isWriteUnavailable:!0,esbuild:Be});qe={build:i=>new Promise((y,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:i,isTTY:!1,defaultWD:"/",callback:(N,P)=>N?O(N):y(P)})),transform:(i,y)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:i,options:y||{},isTTY:!1,fs:{readFile(P,$){$(new Error("Internal error"),null)},writeFile(P,$){$(null)}},callback:(P,$)=>P?N(P):O($)})),formatMessages:(i,y)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:i,options:y,callback:(P,$)=>P?N(P):O($)})),analyzeMetafile:(i,y)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof i=="string"?i:JSON.stringify(i),options:y,callback:(P,$)=>P?N(P):O($)}))}}),Nt=Be;
|
17
17
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export type Platform = 'browser' | 'node' | 'neutral';
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm';
|
3
|
-
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
3
|
+
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
5
5
|
export type Charset = 'ascii' | 'utf8';
|
6
6
|
export type Drop = 'console' | 'debugger';
|
@@ -17,10 +17,12 @@ interface CommonOptions {
|
|
17
17
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
19
19
|
format?: Format;
|
20
|
-
/** Documentation: https://esbuild.github.io/api/#
|
20
|
+
/** Documentation: https://esbuild.github.io/api/#global-name */
|
21
21
|
globalName?: string;
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
23
23
|
target?: string | string[];
|
24
|
+
/** Documentation: https://esbuild.github.io/api/#supported */
|
25
|
+
supported?: Record<string, boolean>;
|
24
26
|
|
25
27
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
26
28
|
mangleProps?: RegExp;
|
@@ -94,7 +96,7 @@ export interface BuildOptions extends CommonOptions {
|
|
94
96
|
loader?: { [ext: string]: Loader };
|
95
97
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
96
98
|
resolveExtensions?: string[];
|
97
|
-
/** Documentation: https://esbuild.github.io/api/#
|
99
|
+
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
98
100
|
mainFields?: string[];
|
99
101
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
100
102
|
conditions?: string[];
|
@@ -148,6 +150,7 @@ export interface StdinOptions {
|
|
148
150
|
}
|
149
151
|
|
150
152
|
export interface Message {
|
153
|
+
id: string;
|
151
154
|
pluginName: string;
|
152
155
|
text: string;
|
153
156
|
location: Location | null;
|
@@ -402,6 +405,7 @@ export interface OnLoadResult {
|
|
402
405
|
}
|
403
406
|
|
404
407
|
export interface PartialMessage {
|
408
|
+
id?: string;
|
405
409
|
pluginName?: string;
|
406
410
|
text?: string;
|
407
411
|
location?: Partial<Location> | null;
|