esbuild-wasm-strapkit 0.25.5-build.3 → 0.25.7-build.3
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.
- package/esbuild.wasm +0 -0
- package/esm/browser.d.ts +6 -1
- package/esm/browser.js +9 -5
- package/esm/browser.min.js +7 -7
- package/lib/browser.d.ts +6 -1
- package/lib/browser.js +9 -5
- package/lib/browser.min.js +6 -6
- package/lib/main.d.ts +6 -1
- package/lib/main.js +11 -7
- package/package.json +3 -3
package/esbuild.wasm
CHANGED
|
Binary file
|
package/esm/browser.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | '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'
|
|
7
|
+
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
7
8
|
|
|
8
9
|
interface CommonOptions {
|
|
9
10
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
@@ -75,6 +76,8 @@ interface CommonOptions {
|
|
|
75
76
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
76
77
|
keepNames?: boolean
|
|
77
78
|
|
|
79
|
+
/** Documentation: https://esbuild.github.io/api/#abs-paths */
|
|
80
|
+
absPaths?: AbsPaths[]
|
|
78
81
|
/** Documentation: https://esbuild.github.io/api/#color */
|
|
79
82
|
color?: boolean
|
|
80
83
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
@@ -159,7 +162,7 @@ export interface BuildOptions extends CommonOptions {
|
|
|
159
162
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
160
163
|
footer?: { [type: string]: string }
|
|
161
164
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
162
|
-
entryPoints?: string
|
|
165
|
+
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
|
|
163
166
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
164
167
|
stdin?: StdinOptions
|
|
165
168
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
@@ -513,7 +516,9 @@ export interface AnalyzeMetafileOptions {
|
|
|
513
516
|
verbose?: boolean
|
|
514
517
|
}
|
|
515
518
|
|
|
519
|
+
/** Documentation: https://esbuild.github.io/api/#watch-arguments */
|
|
516
520
|
export interface WatchOptions {
|
|
521
|
+
delay?: number // In milliseconds
|
|
517
522
|
}
|
|
518
523
|
|
|
519
524
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
package/esm/browser.js
CHANGED
|
@@ -311,6 +311,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
311
311
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
|
312
312
|
let platform = getFlag(options, keys, "platform", mustBeString);
|
|
313
313
|
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
|
314
|
+
let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
|
|
314
315
|
if (legalComments) flags.push(`--legal-comments=${legalComments}`);
|
|
315
316
|
if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
|
|
316
317
|
if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
|
|
@@ -329,6 +330,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
329
330
|
if (ignoreAnnotations) flags.push(`--ignore-annotations`);
|
|
330
331
|
if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
|
331
332
|
if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
|
|
333
|
+
if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
|
|
332
334
|
if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
|
|
333
335
|
if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
|
|
334
336
|
if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
|
|
@@ -617,8 +619,8 @@ function createChannel(streamIn) {
|
|
|
617
619
|
if (isFirstPacket) {
|
|
618
620
|
isFirstPacket = false;
|
|
619
621
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
620
|
-
if (binaryVersion !== "0.25.
|
|
621
|
-
throw new Error(`Cannot start service: Host version "${"0.25.
|
|
622
|
+
if (binaryVersion !== "0.25.7") {
|
|
623
|
+
throw new Error(`Cannot start service: Host version "${"0.25.7"}" does not match binary version ${quote(binaryVersion)}`);
|
|
622
624
|
}
|
|
623
625
|
return;
|
|
624
626
|
}
|
|
@@ -960,11 +962,13 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
960
962
|
watch: (options2 = {}) => new Promise((resolve, reject) => {
|
|
961
963
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
962
964
|
const keys = {};
|
|
965
|
+
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
963
966
|
checkForInvalidFlags(options2, keys, `in watch() call`);
|
|
964
967
|
const request2 = {
|
|
965
968
|
command: "watch",
|
|
966
969
|
key: buildKey
|
|
967
970
|
};
|
|
971
|
+
if (delay) request2.delay = delay;
|
|
968
972
|
sendRequest(refs, request2, (error2) => {
|
|
969
973
|
if (error2) reject(new Error(error2));
|
|
970
974
|
else resolve(void 0);
|
|
@@ -1565,7 +1569,7 @@ function jsRegExpToGoRegExp(regexp) {
|
|
|
1565
1569
|
}
|
|
1566
1570
|
|
|
1567
1571
|
// lib/npm/browser.ts
|
|
1568
|
-
var version = "0.25.
|
|
1572
|
+
var version = "0.25.7";
|
|
1569
1573
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1570
1574
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1571
1575
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1613,7 +1617,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
|
1613
1617
|
let rejectAllWith;
|
|
1614
1618
|
const rejectAllPromise = new Promise((resolve) => rejectAllWith = resolve);
|
|
1615
1619
|
if (useWorker) {
|
|
1616
|
-
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 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 // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(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 setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, 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 _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\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 // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\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 // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\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 // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\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 // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\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 async run(instance) {\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 // JS values that Go currently has references to, indexed by reference id\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 // mapping from JS values to reference ids\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 await this._exitPromise;\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) 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) resumeStdin();\n }\n return go;\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.25.5"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n return go;\n };\n async function tryToInstantiateModule(wasm, go) {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = await fetch(wasm);\n if (!res.ok) throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = await WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = await res.arrayBuffer();\n const result = await WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
|
1620
|
+
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 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 // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(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 setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, 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 _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\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 // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\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 // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\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 // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\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 // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\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 async run(instance) {\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 // JS values that Go currently has references to, indexed by reference id\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 // mapping from JS values to reference ids\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 await this._exitPromise;\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) 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) resumeStdin();\n }\n return go;\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.25.7"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n return go;\n };\n async function tryToInstantiateModule(wasm, go) {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = await fetch(wasm);\n if (!res.ok) throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = await WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = await res.arrayBuffer();\n const result = await WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
|
1617
1621
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1618
1622
|
} else {
|
|
1619
1623
|
let onmessage = ((postMessage) => {
|
|
@@ -2231,7 +2235,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
|
2231
2235
|
callback(null, count);
|
|
2232
2236
|
};
|
|
2233
2237
|
let go = new globalThis.Go();
|
|
2234
|
-
go.argv = ["", `--service=${"0.25.
|
|
2238
|
+
go.argv = ["", `--service=${"0.25.7"}`];
|
|
2235
2239
|
tryToInstantiateModule(wasm, go).then(
|
|
2236
2240
|
(instance) => {
|
|
2237
2241
|
postMessage(null);
|
package/esm/browser.min.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var Je=Object.defineProperty;var Ye=(e,t)=>{for(var n in t)Je(e,n,{get:t[n],enumerable:!0})};var Se={};Ye(Se,{analyzeMetafile:()=>gt,analyzeMetafileSync:()=>ht,build:()=>ut,buildSync:()=>pt,context:()=>ct,default:()=>Rt,formatMessages:()=>dt,formatMessagesSync:()=>yt,initialize:()=>wt,stop:()=>bt,transform:()=>ft,transformSync:()=>mt,version:()=>at});function Me(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);n.write8(6),n.write32(u.length);for(let l of u)n.write(Z(l)),t(i[l])}},n=new ye;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),$e(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Ae(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return
|
|
1
|
+
var Je=Object.defineProperty;var Ye=(e,t)=>{for(var n in t)Je(e,n,{get:t[n],enumerable:!0})};var Se={};Ye(Se,{analyzeMetafile:()=>gt,analyzeMetafileSync:()=>ht,build:()=>ut,buildSync:()=>pt,context:()=>ct,default:()=>Rt,formatMessages:()=>dt,formatMessagesSync:()=>yt,initialize:()=>wt,stop:()=>bt,transform:()=>ft,transformSync:()=>mt,version:()=>at});function Me(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);n.write8(6),n.write32(u.length);for(let l of u)n.write(Z(l)),t(i[l])}},n=new ye;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),$e(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Ae(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return se(n.read());case 4:return n.read();case 5:{let g=n.read32(),s=[];for(let p=0;p<g;p++)s.push(t());return s}case 6:{let g=n.read32(),s={};for(let p=0;p<g;p++)s[se(n.read())]=t();return s}default:throw new Error("Invalid packet")}},n=new ye(e),i=n.read32(),u=(i&1)===0;i>>>=1;let l=t();if(n.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:u,value:l}}var ye=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 n=new Uint8Array((this.len+t)*2);n.set(this.buf),this.buf=n}return this.len+=t,this.len-t}write8(t){let n=this._write(1);this.buf[n]=t}write32(t){let n=this._write(4);$e(this.buf,t,n)}write(t){let n=this._write(4+t.length);$e(this.buf,t.length,n),this.buf.set(t,n+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 Ce(this.buf,this._read(4))}read(){let t=this.read32(),n=new Uint8Array(t),i=this._read(n.length);return n.set(this.buf.subarray(i,i+t)),n}},Z,se,ke;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;Z=n=>e.encode(n),se=n=>t.decode(n),ke='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")Z=e=>Buffer.from(e),se=e=>{let{buffer:t,byteOffset:n,byteLength:i}=e;return Buffer.from(t,n,i).toString()},ke='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(Z("")instanceof Uint8Array))throw new Error(`Invariant violation: "${ke} instanceof Uint8Array" is incorrectly false
|
|
2
2
|
|
|
3
3
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
4
4
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
5
5
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
6
|
-
`);function Ce(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function $e(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var _=JSON.stringify,Fe="warning",Pe="silent";function ge(e,t){let n=[];for(let i of e){if(J(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var we=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",m=e=>typeof e=="string"?null:"a string",ve=e=>e instanceof RegExp?null:"a RegExp object",ce=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Qe=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Be=e=>typeof e=="function"?null:"a function",re=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",He=e=>typeof e=="object"&&e!==null?null:"an array or an object",Xe=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Te=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ue=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ze=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",je=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",Le=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",et=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${_(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${_(i)}`)}function Ne(e){let t=Object.create(null),n=r(e,t,"wasmURL",et),i=r(e,t,"wasmModule",Xe),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function qe(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${_(n)} in mangle cache to map to either a string or false`)}}return t}function xe(e,t,n,i,u){let l=r(t,n,"color",I),g=r(t,n,"logLevel",m),s=r(t,n,"logLimit",ce);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${g||u}`),e.push(`--log-limit=${s||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+_(n):""} to be a string, got ${typeof e} instead`);return e}function Ie(e,t,n){let i=r(t,n,"legalComments",m),u=r(t,n,"sourceRoot",m),l=r(t,n,"sourcesContent",I),g=r(t,n,"target",je),s=r(t,n,"format",m),p=r(t,n,"globalName",m),U=r(t,n,"mangleProps",ve),F=r(t,n,"reserveProps",ve),b=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),T=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),N=r(t,n,"minifyIdentifiers",I),k=r(t,n,"lineLimit",ce),z=r(t,n,"drop",G),V=r(t,n,"dropLabels",G),w=r(t,n,"charset",m),d=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",m),v=r(t,n,"jsxFactory",m),O=r(t,n,"jsxFragment",m),M=r(t,n,"jsxImportSource",m),E=r(t,n,"jsxDev",I),a=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",Y),h=r(t,n,"logOverride",Y),C=r(t,n,"supported",Y),P=r(t,n,"pure",G),$=r(t,n,"keepNames",I),R=r(t,n,"platform",m),A=r(t,n,"tsconfigRaw",Ze);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),g&&e.push(`--target=${ge(Array.isArray(g)?g:[g],"target")}`),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),R&&e.push(`--platform=${R}`),A&&e.push(`--tsconfig-raw=${typeof A=="string"?A:JSON.stringify(A)}`),j&&e.push("--minify"),T&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),N&&e.push("--minify-identifiers"),k&&e.push(`--line-limit=${k}`),w&&e.push(`--charset=${w}`),d!==void 0&&e.push(`--tree-shaking=${d}`),f&&e.push("--ignore-annotations"),z)for(let x of z)e.push(`--drop:${J(x,"drop")}`);if(V&&e.push(`--drop-labels=${ge(V,"drop label")}`),U&&e.push(`--mangle-props=${Re(U)}`),F&&e.push(`--reserve-props=${Re(F)}`),b!==void 0&&e.push(`--mangle-quoted=${b}`),o&&e.push(`--jsx=${o}`),v&&e.push(`--jsx-factory=${v}`),O&&e.push(`--jsx-fragment=${O}`),M&&e.push(`--jsx-import-source=${M}`),E&&e.push("--jsx-dev"),a&&e.push("--jsx-side-effects"),c)for(let x in c){if(x.indexOf("=")>=0)throw new Error(`Invalid define: ${x}`);e.push(`--define:${x}=${J(c[x],"define",x)}`)}if(h)for(let x in h){if(x.indexOf("=")>=0)throw new Error(`Invalid log override: ${x}`);e.push(`--log-override:${x}=${J(h[x],"log override",x)}`)}if(C)for(let x in C){if(x.indexOf("=")>=0)throw new Error(`Invalid supported: ${x}`);let S=C[x];if(typeof S!="boolean")throw new Error(`Expected value for supported ${_(x)} to be a boolean, got ${typeof S} instead`);e.push(`--supported:${x}=${S}`)}if(P)for(let x of P)e.push(`--pure:${J(x,"pure")}`);$&&e.push("--keep-names")}function tt(e,t,n,i,u){var ae;let l=[],g=[],s=Object.create(null),p=null,U=null;xe(l,t,s,n,i),Ie(l,t,s);let F=r(t,s,"sourcemap",Ue),b=r(t,s,"bundle",I),j=r(t,s,"splitting",I),T=r(t,s,"preserveSymlinks",I),L=r(t,s,"metafile",I),N=r(t,s,"outfile",m),k=r(t,s,"outdir",m),z=r(t,s,"outbase",m),V=r(t,s,"tsconfig",m),w=r(t,s,"resolveExtensions",G),d=r(t,s,"nodePaths",G),f=r(t,s,"mainFields",G),o=r(t,s,"conditions",G),v=r(t,s,"external",G),O=r(t,s,"packages",m),M=r(t,s,"alias",Y),E=r(t,s,"loader",Y),a=r(t,s,"outExtension",Y),c=r(t,s,"publicPath",m),h=r(t,s,"entryNames",m),C=r(t,s,"chunkNames",m),P=r(t,s,"assetNames",m),$=r(t,s,"inject",G),R=r(t,s,"banner",Y),A=r(t,s,"footer",Y),x=r(t,s,"entryPoints",He),S=r(t,s,"absWorkingDir",m),D=r(t,s,"stdin",Y),q=(ae=r(t,s,"write",I))!=null?ae:u,B=r(t,s,"allowOverwrite",I),Q=r(t,s,"mangleCache",Y);if(s.plugins=!0,K(t,s,`in ${e}() call`),F&&l.push(`--sourcemap${F===!0?"":`=${F}`}`),b&&l.push("--bundle"),B&&l.push("--allow-overwrite"),j&&l.push("--splitting"),T&&l.push("--preserve-symlinks"),L&&l.push("--metafile"),N&&l.push(`--outfile=${N}`),k&&l.push(`--outdir=${k}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),O&&l.push(`--packages=${O}`),w&&l.push(`--resolve-extensions=${ge(w,"resolve extension")}`),c&&l.push(`--public-path=${c}`),h&&l.push(`--entry-names=${h}`),C&&l.push(`--chunk-names=${C}`),P&&l.push(`--asset-names=${P}`),f&&l.push(`--main-fields=${ge(f,"main field")}`),o&&l.push(`--conditions=${ge(o,"condition")}`),v)for(let y of v)l.push(`--external:${J(y,"external")}`);if(M)for(let y in M){if(y.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${y}`);l.push(`--alias:${y}=${J(M[y],"alias",y)}`)}if(R)for(let y in R){if(y.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${y}`);l.push(`--banner:${y}=${J(R[y],"banner",y)}`)}if(A)for(let y in A){if(y.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${y}`);l.push(`--footer:${y}=${J(A[y],"footer",y)}`)}if($)for(let y of $)l.push(`--inject:${J(y,"inject")}`);if(E)for(let y in E){if(y.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${y}`);l.push(`--loader:${y}=${J(E[y],"loader",y)}`)}if(a)for(let y in a){if(y.indexOf("=")>=0)throw new Error(`Invalid out extension: ${y}`);l.push(`--out-extension:${y}=${J(a[y],"out extension",y)}`)}if(x)if(Array.isArray(x))for(let y=0,te=x.length;y<te;y++){let H=x[y];if(typeof H=="object"&&H!==null){let ee=Object.create(null),ne=r(H,ee,"in",m),X=r(H,ee,"out",m);if(K(H,ee,"in entry point at index "+y),ne===void 0)throw new Error('Missing property "in" for entry point at index '+y);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+y);g.push([X,ne])}else g.push(["",J(H,"entry point at index "+y)])}else for(let y in x)g.push([y,J(x[y],"entry point",y)]);if(D){let y=Object.create(null),te=r(D,y,"contents",Le),H=r(D,y,"resolveDir",m),ee=r(D,y,"sourcefile",m),ne=r(D,y,"loader",m);K(D,y,'in "stdin" object'),ee&&l.push(`--sourcefile=${ee}`),ne&&l.push(`--loader=${ne}`),H&&(U=H),typeof te=="string"?p=Z(te):te instanceof Uint8Array&&(p=te)}let W=[];if(d)for(let y of d)y+="",W.push(y);return{entries:g,flags:l,write:q,stdinContents:p,stdinResolveDir:U,absWorkingDir:S,nodePaths:W,mangleCache:qe(Q)}}function nt(e,t,n,i){let u=[],l=Object.create(null);xe(u,t,l,n,i),Ie(u,t,l);let g=r(t,l,"sourcemap",Ue),s=r(t,l,"sourcefile",m),p=r(t,l,"loader",m),U=r(t,l,"banner",m),F=r(t,l,"footer",m),b=r(t,l,"mangleCache",Y);return K(t,l,`in ${e}() call`),g&&u.push(`--sourcemap=${g===!0?"external":g}`),s&&u.push(`--sourcefile=${s}`),p&&u.push(`--loader=${p}`),U&&u.push(`--banner=${U}`),F&&u.push(`--footer=${F}`),{flags:u,mangleCache:qe(b)}}function We(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,g=new Uint8Array(16*1024),s=0,p=w=>{let d=s+w.length;if(d>g.length){let o=new Uint8Array(d*2);o.set(g),g=o}g.set(w,s),s+=w.length;let f=0;for(;f+4<=s;){let o=Ce(g,f);if(f+4+o>s)break;f+=4,L(g.subarray(f,f+o)),f+=o}f>0&&(g.copyWithin(0,f,s),s-=f)},U=w=>{n.didClose=!0,w&&(n.reason=": "+(w.message||w));let d="The service was stopped"+n.reason;for(let f in i)i[f](d,null);i={}},F=(w,d,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=u++;i[o]=(v,O)=>{try{f(v,O)}finally{w&&w.unref()}},w&&w.ref(),e.writeToStdin(Me({id:o,isRequest:!0,value:d}))},b=(w,d)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Me({id:w,isRequest:!1,value:d}))},j=async(w,d)=>{try{if(d.command==="ping"){b(w,{});return}if(typeof d.key=="number"){let f=t[d.key];if(!f)return;let o=f[d.command];if(o){await o(w,d);return}}throw new Error("Invalid command: "+d.command)}catch(f){let o=[se(f,e,null,void 0,"")];try{b(w,{errors:o})}catch(v){}}},T=!0,L=w=>{if(T){T=!1;let f=String.fromCharCode(...w);if(f!=="0.25.5")throw new Error(`Cannot start service: Host version "0.25.5" does not match binary version ${_(f)}`);return}let d=Ae(w);if(d.isRequest)j(d.id,d.value);else{let f=i[d.id];delete i[d.id],d.value.error?f(d.value.error,{}):f(null,d.value)}};return{readFromStdout:p,afterClose:U,service:{buildOrContext:({callName:w,refs:d,options:f,isTTY:o,defaultWD:v,callback:O})=>{let M=0,E=l++,a={},c={ref(){++M===1&&d&&d.ref()},unref(){--M===0&&(delete t[E],d&&d.unref())}};t[E]=a,c.ref(),rt(w,E,F,b,c,e,a,f,o,v,(h,C)=>{try{O(h,C)}finally{c.unref()}})},transform:({callName:w,refs:d,input:f,options:o,isTTY:v,fs:O,callback:M})=>{let E=ze(),a=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:C}=nt(w,o,v,Pe),P={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};C&&(P.mangleCache=C),F(d,P,($,R)=>{if($)return M(new Error($),null);let A=fe(R.errors,E),x=fe(R.warnings,E),S=1,D=()=>{if(--S===0){let q={warnings:x,code:R.code,map:R.map,mangleCache:void 0,legalComments:void 0};"legalComments"in R&&(q.legalComments=R==null?void 0:R.legalComments),R.mangleCache&&(q.mangleCache=R==null?void 0:R.mangleCache),M(null,q)}};if(A.length>0)return M(pe("Transform failed",A,x),null);R.codeFS&&(S++,O.readFile(R.code,(q,B)=>{q!==null?M(q,null):(R.code=B,D())})),R.mapFS&&(S++,O.readFile(R.map,(q,B)=>{q!==null?M(q,null):(R.map=B,D())})),D()})}catch(h){let C=[];try{xe(C,o,{},v,Pe)}catch($){}let P=se(h,e,E,void 0,"");F(d,{command:"error",flags:C,error:P},()=>{P.detail=E.load(P.detail),M(pe("Transform failed",[P],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=a;a=()=>O.writeFile(f,c)}a(null)},formatMessages:({callName:w,refs:d,messages:f,options:o,callback:v})=>{if(!o)throw new Error(`Missing second argument in ${w}() call`);let O={},M=r(o,O,"kind",m),E=r(o,O,"color",I),a=r(o,O,"terminalWidth",ce);if(K(o,O,`in ${w}() call`),M===void 0)throw new Error(`Missing "kind" in ${w}() call`);if(M!=="error"&&M!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let c={command:"format-msgs",messages:ie(f,"messages",null,"",a),isWarning:M==="warning"};E!==void 0&&(c.color=E),a!==void 0&&(c.terminalWidth=a),F(d,c,(h,C)=>{if(h)return v(new Error(h),null);v(null,C.messages)})},analyzeMetafile:({callName:w,refs:d,metafile:f,options:o,callback:v})=>{o===void 0&&(o={});let O={},M=r(o,O,"color",I),E=r(o,O,"verbose",I);K(o,O,`in ${w}() call`);let a={command:"analyze-metafile",metafile:f};M!==void 0&&(a.color=M),E!==void 0&&(a.verbose=E),F(d,a,(c,h)=>{if(c)return v(new Error(c),null);v(null,h.result)})}}}}function rt(e,t,n,i,u,l,g,s,p,U,F){let b=ze(),j=e==="context",T=(k,z)=>{let V=[];try{xe(V,s,{},p,Fe)}catch(d){}let w=se(k,l,b,void 0,z);n(u,{command:"error",flags:V,error:w},()=>{w.detail=b.load(w.detail),F(pe(j?"Context failed":"Build failed",[w],[]),null)})},L;if(typeof s=="object"){let k=s.plugins;if(k!==void 0){if(!Array.isArray(k))return T(new Error('"plugins" must be an array'),"");L=k}}if(L&&L.length>0){if(l.isSync)return T(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,g,s,L,b).then(k=>{if(!k.ok)return T(k.error,k.pluginName);try{N(k.requestPlugins,k.runOnEndCallbacks,k.scheduleOnDisposeCallbacks)}catch(z){T(z,"")}},k=>T(k,""));return}try{N(null,(k,z)=>z([],[]),()=>{})}catch(k){T(k,"")}function N(k,z,V){let w=l.hasFS,{entries:d,flags:f,write:o,stdinContents:v,stdinResolveDir:O,absWorkingDir:M,nodePaths:E,mangleCache:a}=tt(e,s,p,Fe,w);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:d,flags:f,write:o,stdinContents:v,stdinResolveDir:O,absWorkingDir:M||U,nodePaths:E,context:j};k&&(c.plugins=k),a&&(c.mangleCache=a);let h=($,R)=>{let A={errors:fe($.errors,b),warnings:fe($.warnings,b),outputFiles:void 0,metafile:void 0,mangleCache:void 0},x=A.errors.slice(),S=A.warnings.slice();$.outputFiles&&(A.outputFiles=$.outputFiles.map(st)),$.metafile&&(A.metafile=JSON.parse($.metafile)),$.mangleCache&&(A.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(le($.writeToStdout).replace(/\n$/,"")),z(A,(D,q)=>{if(x.length>0||D.length>0){let B=pe("Build failed",x.concat(D),S.concat(q));return R(B,null,D,q)}R(null,A,D,q)})},C,P;j&&(g["on-end"]=($,R)=>new Promise(A=>{h(R,(x,S,D,q)=>{let B={errors:D,warnings:q};P&&P(x,S),C=void 0,P=void 0,i($,B),A()})})),n(u,c,($,R)=>{if($)return F(new Error($),null);if(!j)return h(R,(S,D)=>(V(),F(S,D)));if(R.errors.length>0)return F(pe("Context failed",R.errors,R.warnings),null);let A=!1,x={rebuild:()=>(C||(C=new Promise((S,D)=>{let q;P=(Q,W)=>{q||(q=()=>Q?D(Q):S(W))};let B=()=>{n(u,{command:"rebuild",key:t},(W,ae)=>{W?D(new Error(W)):q?q():B()})};B()})),C),watch:(S={})=>new Promise((D,q)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(S,{},"in watch() call"),n(u,{command:"watch",key:t},W=>{W?q(new Error(W)):D(void 0)})}),serve:(S={})=>new Promise((D,q)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let B={},Q=r(S,B,"port",Qe),W=r(S,B,"host",m),ae=r(S,B,"servedir",m),y=r(S,B,"keyfile",m),te=r(S,B,"certfile",m),H=r(S,B,"fallback",m),ee=r(S,B,"cors",Y),ne=r(S,B,"onRequest",Be);K(S,B,"in serve() call");let X={command:"serve",key:t,onRequest:!!ne};if(Q!==void 0&&(X.port=Q),W!==void 0&&(X.host=W),ae!==void 0&&(X.servedir=ae),y!==void 0&&(X.keyfile=y),te!==void 0&&(X.certfile=te),H!==void 0&&(X.fallback=H),ee){let de={},ue=r(ee,de,"origin",je);K(ee,de,'on "cors" object'),Array.isArray(ue)?X.corsOrigin=ue:ue!==void 0&&(X.corsOrigin=[ue])}n(u,X,(de,ue)=>{if(de)return q(new Error(de));ne&&(g["serve-request"]=(_e,Ve)=>{ne(Ve.args),i(_e,{})}),D(ue)})}),cancel:()=>new Promise(S=>{if(A)return S();n(u,{command:"cancel",key:t},()=>{S()})}),dispose:()=>new Promise(S=>{if(A)return S();A=!0,n(u,{command:"dispose",key:t},()=>{S(),V(),u.unref()})})};u.ref(),F(null,x)})}}var it=async(e,t,n,i,u,l,g,s,p)=>{let U=[],F=[],b={},j={},T=[],L=0,N=0,k=[],z=!1;s=[...s];for(let d of s){let f={};if(typeof d!="object")throw new Error(`Plugin at index ${N} must be an object`);let o=r(d,f,"name",m);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${N} is missing a name`);try{let v=r(d,f,"setup",Be);if(typeof v!="function")throw new Error("Plugin is missing a setup function");K(d,f,`on plugin ${_(o)}`);let O={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};N++;let E=v({initialOptions:g,resolve:(a,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let h=Object.create(null),C=r(c,h,"pluginName",m),P=r(c,h,"importer",m),$=r(c,h,"namespace",m),R=r(c,h,"resolveDir",m),A=r(c,h,"kind",m),x=r(c,h,"pluginData",we),S=r(c,h,"with",Y);return K(c,h,"in resolve() call"),new Promise((D,q)=>{let B={command:"resolve",path:a,key:e,pluginName:o};if(C!=null&&(B.pluginName=C),P!=null&&(B.importer=P),$!=null&&(B.namespace=$),R!=null&&(B.resolveDir=R),A!=null)B.kind=A;else throw new Error('Must specify "kind" when calling "resolve"');x!=null&&(B.pluginData=p.store(x)),S!=null&&(B.with=lt(S,"with")),t(i,B,(Q,W)=>{Q!==null?q(new Error(Q)):D({errors:fe(W.errors,p),warnings:fe(W.warnings,p),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:p.load(W.pluginData)})})})},onStart(a){let c='This error came from the "onStart" callback registered here:',h=he(new Error(c),u,"onStart");U.push({name:o,callback:a,note:h}),O.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',h=he(new Error(c),u,"onEnd");F.push({name:o,callback:a,note:h}),O.onEnd=!0},onResolve(a,c){let h='This error came from the "onResolve" callback registered here:',C=he(new Error(h),u,"onResolve"),P={},$=r(a,P,"filter",ve),R=r(a,P,"namespace",m);if(K(a,P,`in onResolve() call for plugin ${_(o)}`),$==null)throw new Error("onResolve() call is missing a filter");let A=L++;b[A]={name:o,callback:c,note:C},O.onResolve.push({id:A,filter:Re($),namespace:R||""})},onLoad(a,c){let h='This error came from the "onLoad" callback registered here:',C=he(new Error(h),u,"onLoad"),P={},$=r(a,P,"filter",ve),R=r(a,P,"namespace",m);if(K(a,P,`in onLoad() call for plugin ${_(o)}`),$==null)throw new Error("onLoad() call is missing a filter");let A=L++;j[A]={name:o,callback:c,note:C},O.onLoad.push({id:A,filter:Re($),namespace:R||""})},onDispose(a){T.push(a)},esbuild:u.esbuild});E&&await E,k.push(O)}catch(v){return{ok:!1,error:v,pluginName:o}}}l["on-start"]=async(d,f)=>{p.clear();let o={errors:[],warnings:[]};await Promise.all(U.map(async({name:v,callback:O,note:M})=>{try{let E=await O();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${_(v)} to return an object`);let a={},c=r(E,a,"errors",re),h=r(E,a,"warnings",re);K(E,a,`from onStart() callback in plugin ${_(v)}`),c!=null&&o.errors.push(...ie(c,"errors",p,v,void 0)),h!=null&&o.warnings.push(...ie(h,"warnings",p,v,void 0))}}catch(E){o.errors.push(se(E,u,p,M&&M(),v))}})),n(d,o)},l["on-resolve"]=async(d,f)=>{let o={},v="",O,M;for(let E of f.ids)try{({name:v,callback:O,note:M}=b[E]);let a=await O({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:p.load(f.pluginData),with:f.with});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${_(v)} to return an object`);let c={},h=r(a,c,"pluginName",m),C=r(a,c,"path",m),P=r(a,c,"namespace",m),$=r(a,c,"suffix",m),R=r(a,c,"external",I),A=r(a,c,"sideEffects",I),x=r(a,c,"pluginData",we),S=r(a,c,"errors",re),D=r(a,c,"warnings",re),q=r(a,c,"watchFiles",G),B=r(a,c,"watchDirs",G);K(a,c,`from onResolve() callback in plugin ${_(v)}`),o.id=E,h!=null&&(o.pluginName=h),C!=null&&(o.path=C),P!=null&&(o.namespace=P),$!=null&&(o.suffix=$),R!=null&&(o.external=R),A!=null&&(o.sideEffects=A),x!=null&&(o.pluginData=p.store(x)),S!=null&&(o.errors=ie(S,"errors",p,v,void 0)),D!=null&&(o.warnings=ie(D,"warnings",p,v,void 0)),q!=null&&(o.watchFiles=be(q,"watchFiles")),B!=null&&(o.watchDirs=be(B,"watchDirs"));break}}catch(a){o={id:E,errors:[se(a,u,p,M&&M(),v)]};break}n(d,o)},l["on-load"]=async(d,f)=>{let o={},v="",O,M;for(let E of f.ids)try{({name:v,callback:O,note:M}=j[E]);let a=await O({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:p.load(f.pluginData),with:f.with});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${_(v)} to return an object`);let c={},h=r(a,c,"pluginName",m),C=r(a,c,"contents",Le),P=r(a,c,"resolveDir",m),$=r(a,c,"pluginData",we),R=r(a,c,"loader",m),A=r(a,c,"errors",re),x=r(a,c,"warnings",re),S=r(a,c,"watchFiles",G),D=r(a,c,"watchDirs",G);K(a,c,`from onLoad() callback in plugin ${_(v)}`),o.id=E,h!=null&&(o.pluginName=h),C instanceof Uint8Array?o.contents=C:C!=null&&(o.contents=Z(C)),P!=null&&(o.resolveDir=P),$!=null&&(o.pluginData=p.store($)),R!=null&&(o.loader=R),A!=null&&(o.errors=ie(A,"errors",p,v,void 0)),x!=null&&(o.warnings=ie(x,"warnings",p,v,void 0)),S!=null&&(o.watchFiles=be(S,"watchFiles")),D!=null&&(o.watchDirs=be(D,"watchDirs"));break}}catch(a){o={id:E,errors:[se(a,u,p,M&&M(),v)]};break}n(d,o)};let V=(d,f)=>f([],[]);F.length>0&&(V=(d,f)=>{(async()=>{let o=[],v=[];for(let{name:O,callback:M,note:E}of F){let a,c;try{let h=await M(d);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${_(O)} to return an object`);let C={},P=r(h,C,"errors",re),$=r(h,C,"warnings",re);K(h,C,`from onEnd() callback in plugin ${_(O)}`),P!=null&&(a=ie(P,"errors",p,O,void 0)),$!=null&&(c=ie($,"warnings",p,O,void 0))}}catch(h){a=[se(h,u,p,E&&E(),O)]}if(a){o.push(...a);try{d.errors.push(...a)}catch(h){}}if(c){v.push(...c);try{d.warnings.push(...c)}catch(h){}}}f(o,v)})()});let w=()=>{for(let d of T)setTimeout(()=>d(),0)};return z=!0,{ok:!0,requestPlugins:k,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:w}};function ze(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function he(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
|
|
7
|
-
`);l.splice(1,1);let g=Ke(t,l,n);if(g)return i={text:e.message,location:g},i}catch(l){}}}function
|
|
8
|
-
`),"")}catch(s){}return{id:"",pluginName:u,text:l,location:g,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ke(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(l.startsWith(i))for(l=l.slice(i.length);;){let g=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(g){l=g[1];continue}if(g=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),g){l=g[1];continue}if(g=/^(\S+):(\d+):(\d+)$/.exec(l),g){let s;try{s=e.readFileSync(g[1],"utf8")}catch(
|
|
6
|
+
`);function Ce(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function $e(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var _=JSON.stringify,Fe="warning",Pe="silent";function fe(e,t){let n=[];for(let i of e){if(Y(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var we=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",ve=e=>e instanceof RegExp?null:"a RegExp object",ae=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Qe=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Be=e=>typeof e=="function"?null:"a function",ie=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",He=e=>typeof e=="object"&&e!==null?null:"an array or an object",Xe=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Te=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ue=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ze=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",je=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",Le=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",et=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${_(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${_(i)}`)}function Ne(e){let t=Object.create(null),n=r(e,t,"wasmURL",et),i=r(e,t,"wasmModule",Xe),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function qe(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${_(n)} in mangle cache to map to either a string or false`)}}return t}function xe(e,t,n,i,u){let l=r(t,n,"color",I),g=r(t,n,"logLevel",y),s=r(t,n,"logLimit",ae);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${g||u}`),e.push(`--log-limit=${s||0}`)}function Y(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+_(n):""} to be a string, got ${typeof e} instead`);return e}function Ie(e,t,n){let i=r(t,n,"legalComments",y),u=r(t,n,"sourceRoot",y),l=r(t,n,"sourcesContent",I),g=r(t,n,"target",je),s=r(t,n,"format",y),p=r(t,n,"globalName",y),B=r(t,n,"mangleProps",ve),F=r(t,n,"reserveProps",ve),w=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),T=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),L=r(t,n,"minifyIdentifiers",I),S=r(t,n,"lineLimit",ae),z=r(t,n,"drop",G),V=r(t,n,"dropLabels",G),v=r(t,n,"charset",y),d=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",y),R=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),$=r(t,n,"jsxImportSource",y),E=r(t,n,"jsxDev",I),a=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",Q),b=r(t,n,"logOverride",Q),M=r(t,n,"supported",Q),P=r(t,n,"pure",G),k=r(t,n,"keepNames",I),x=r(t,n,"platform",y),C=r(t,n,"tsconfigRaw",Ze),q=r(t,n,"absPaths",G);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),g&&e.push(`--target=${fe(Array.isArray(g)?g:[g],"target")}`),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),x&&e.push(`--platform=${x}`),C&&e.push(`--tsconfig-raw=${typeof C=="string"?C:JSON.stringify(C)}`),U&&e.push("--minify"),T&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),L&&e.push("--minify-identifiers"),S&&e.push(`--line-limit=${S}`),v&&e.push(`--charset=${v}`),d!==void 0&&e.push(`--tree-shaking=${d}`),f&&e.push("--ignore-annotations"),z)for(let m of z)e.push(`--drop:${Y(m,"drop")}`);if(V&&e.push(`--drop-labels=${fe(V,"drop label")}`),q&&e.push(`--abs-paths=${fe(q,"abs paths")}`),B&&e.push(`--mangle-props=${Re(B)}`),F&&e.push(`--reserve-props=${Re(F)}`),w!==void 0&&e.push(`--mangle-quoted=${w}`),o&&e.push(`--jsx=${o}`),R&&e.push(`--jsx-factory=${R}`),O&&e.push(`--jsx-fragment=${O}`),$&&e.push(`--jsx-import-source=${$}`),E&&e.push("--jsx-dev"),a&&e.push("--jsx-side-effects"),c)for(let m in c){if(m.indexOf("=")>=0)throw new Error(`Invalid define: ${m}`);e.push(`--define:${m}=${Y(c[m],"define",m)}`)}if(b)for(let m in b){if(m.indexOf("=")>=0)throw new Error(`Invalid log override: ${m}`);e.push(`--log-override:${m}=${Y(b[m],"log override",m)}`)}if(M)for(let m in M){if(m.indexOf("=")>=0)throw new Error(`Invalid supported: ${m}`);let A=M[m];if(typeof A!="boolean")throw new Error(`Expected value for supported ${_(m)} to be a boolean, got ${typeof A} instead`);e.push(`--supported:${m}=${A}`)}if(P)for(let m of P)e.push(`--pure:${Y(m,"pure")}`);k&&e.push("--keep-names")}function tt(e,t,n,i,u){var te;let l=[],g=[],s=Object.create(null),p=null,B=null;xe(l,t,s,n,i),Ie(l,t,s);let F=r(t,s,"sourcemap",Ue),w=r(t,s,"bundle",I),U=r(t,s,"splitting",I),T=r(t,s,"preserveSymlinks",I),j=r(t,s,"metafile",I),L=r(t,s,"outfile",y),S=r(t,s,"outdir",y),z=r(t,s,"outbase",y),V=r(t,s,"tsconfig",y),v=r(t,s,"resolveExtensions",G),d=r(t,s,"nodePaths",G),f=r(t,s,"mainFields",G),o=r(t,s,"conditions",G),R=r(t,s,"external",G),O=r(t,s,"packages",y),$=r(t,s,"alias",Q),E=r(t,s,"loader",Q),a=r(t,s,"outExtension",Q),c=r(t,s,"publicPath",y),b=r(t,s,"entryNames",y),M=r(t,s,"chunkNames",y),P=r(t,s,"assetNames",y),k=r(t,s,"inject",G),x=r(t,s,"banner",Q),C=r(t,s,"footer",Q),q=r(t,s,"entryPoints",He),m=r(t,s,"absWorkingDir",y),A=r(t,s,"stdin",Q),N=(te=r(t,s,"write",I))!=null?te:u,D=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",Q);if(s.plugins=!0,K(t,s,`in ${e}() call`),F&&l.push(`--sourcemap${F===!0?"":`=${F}`}`),w&&l.push("--bundle"),D&&l.push("--allow-overwrite"),U&&l.push("--splitting"),T&&l.push("--preserve-symlinks"),j&&l.push("--metafile"),L&&l.push(`--outfile=${L}`),S&&l.push(`--outdir=${S}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),O&&l.push(`--packages=${O}`),v&&l.push(`--resolve-extensions=${fe(v,"resolve extension")}`),c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),M&&l.push(`--chunk-names=${M}`),P&&l.push(`--asset-names=${P}`),f&&l.push(`--main-fields=${fe(f,"main field")}`),o&&l.push(`--conditions=${fe(o,"condition")}`),R)for(let h of R)l.push(`--external:${Y(h,"external")}`);if($)for(let h in $){if(h.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${h}`);l.push(`--alias:${h}=${Y($[h],"alias",h)}`)}if(x)for(let h in x){if(h.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${h}`);l.push(`--banner:${h}=${Y(x[h],"banner",h)}`)}if(C)for(let h in C){if(h.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${h}`);l.push(`--footer:${h}=${Y(C[h],"footer",h)}`)}if(k)for(let h of k)l.push(`--inject:${Y(h,"inject")}`);if(E)for(let h in E){if(h.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${h}`);l.push(`--loader:${h}=${Y(E[h],"loader",h)}`)}if(a)for(let h in a){if(h.indexOf("=")>=0)throw new Error(`Invalid out extension: ${h}`);l.push(`--out-extension:${h}=${Y(a[h],"out extension",h)}`)}if(q)if(Array.isArray(q))for(let h=0,ne=q.length;h<ne;h++){let H=q[h];if(typeof H=="object"&&H!==null){let ee=Object.create(null),re=r(H,ee,"in",y),X=r(H,ee,"out",y);if(K(H,ee,"in entry point at index "+h),re===void 0)throw new Error('Missing property "in" for entry point at index '+h);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+h);g.push([X,re])}else g.push(["",Y(H,"entry point at index "+h)])}else for(let h in q)g.push([h,Y(q[h],"entry point",h)]);if(A){let h=Object.create(null),ne=r(A,h,"contents",Le),H=r(A,h,"resolveDir",y),ee=r(A,h,"sourcefile",y),re=r(A,h,"loader",y);K(A,h,'in "stdin" object'),ee&&l.push(`--sourcefile=${ee}`),re&&l.push(`--loader=${re}`),H&&(B=H),typeof ne=="string"?p=Z(ne):ne instanceof Uint8Array&&(p=ne)}let W=[];if(d)for(let h of d)h+="",W.push(h);return{entries:g,flags:l,write:N,stdinContents:p,stdinResolveDir:B,absWorkingDir:m,nodePaths:W,mangleCache:qe(J)}}function nt(e,t,n,i){let u=[],l=Object.create(null);xe(u,t,l,n,i),Ie(u,t,l);let g=r(t,l,"sourcemap",Ue),s=r(t,l,"sourcefile",y),p=r(t,l,"loader",y),B=r(t,l,"banner",y),F=r(t,l,"footer",y),w=r(t,l,"mangleCache",Q);return K(t,l,`in ${e}() call`),g&&u.push(`--sourcemap=${g===!0?"external":g}`),s&&u.push(`--sourcefile=${s}`),p&&u.push(`--loader=${p}`),B&&u.push(`--banner=${B}`),F&&u.push(`--footer=${F}`),{flags:u,mangleCache:qe(w)}}function We(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,g=new Uint8Array(16*1024),s=0,p=v=>{let d=s+v.length;if(d>g.length){let o=new Uint8Array(d*2);o.set(g),g=o}g.set(v,s),s+=v.length;let f=0;for(;f+4<=s;){let o=Ce(g,f);if(f+4+o>s)break;f+=4,j(g.subarray(f,f+o)),f+=o}f>0&&(g.copyWithin(0,f,s),s-=f)},B=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let d="The service was stopped"+n.reason;for(let f in i)i[f](d,null);i={}},F=(v,d,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=u++;i[o]=(R,O)=>{try{f(R,O)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(Me({id:o,isRequest:!0,value:d}))},w=(v,d)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Me({id:v,isRequest:!1,value:d}))},U=async(v,d)=>{try{if(d.command==="ping"){w(v,{});return}if(typeof d.key=="number"){let f=t[d.key];if(!f)return;let o=f[d.command];if(o){await o(v,d);return}}throw new Error("Invalid command: "+d.command)}catch(f){let o=[oe(f,e,null,void 0,"")];try{w(v,{errors:o})}catch(R){}}},T=!0,j=v=>{if(T){T=!1;let f=String.fromCharCode(...v);if(f!=="0.25.7")throw new Error(`Cannot start service: Host version "0.25.7" does not match binary version ${_(f)}`);return}let d=Ae(v);if(d.isRequest)U(d.id,d.value);else{let f=i[d.id];delete i[d.id],d.value.error?f(d.value.error,{}):f(null,d.value)}};return{readFromStdout:p,afterClose:B,service:{buildOrContext:({callName:v,refs:d,options:f,isTTY:o,defaultWD:R,callback:O})=>{let $=0,E=l++,a={},c={ref(){++$===1&&d&&d.ref()},unref(){--$===0&&(delete t[E],d&&d.unref())}};t[E]=a,c.ref(),rt(v,E,F,w,c,e,a,f,o,R,(b,M)=>{try{O(b,M)}finally{c.unref()}})},transform:({callName:v,refs:d,input:f,options:o,isTTY:R,fs:O,callback:$})=>{let E=ze(),a=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:M}=nt(v,o,R,Pe),P={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};M&&(P.mangleCache=M),F(d,P,(k,x)=>{if(k)return $(new Error(k),null);let C=de(x.errors,E),q=de(x.warnings,E),m=1,A=()=>{if(--m===0){let N={warnings:q,code:x.code,map:x.map,mangleCache:void 0,legalComments:void 0};"legalComments"in x&&(N.legalComments=x==null?void 0:x.legalComments),x.mangleCache&&(N.mangleCache=x==null?void 0:x.mangleCache),$(null,N)}};if(C.length>0)return $(pe("Transform failed",C,q),null);x.codeFS&&(m++,O.readFile(x.code,(N,D)=>{N!==null?$(N,null):(x.code=D,A())})),x.mapFS&&(m++,O.readFile(x.map,(N,D)=>{N!==null?$(N,null):(x.map=D,A())})),A()})}catch(b){let M=[];try{xe(M,o,{},R,Pe)}catch(k){}let P=oe(b,e,E,void 0,"");F(d,{command:"error",flags:M,error:P},()=>{P.detail=E.load(P.detail),$(pe("Transform failed",[P],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=a;a=()=>O.writeFile(f,c)}a(null)},formatMessages:({callName:v,refs:d,messages:f,options:o,callback:R})=>{if(!o)throw new Error(`Missing second argument in ${v}() call`);let O={},$=r(o,O,"kind",y),E=r(o,O,"color",I),a=r(o,O,"terminalWidth",ae);if(K(o,O,`in ${v}() call`),$===void 0)throw new Error(`Missing "kind" in ${v}() call`);if($!=="error"&&$!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let c={command:"format-msgs",messages:le(f,"messages",null,"",a),isWarning:$==="warning"};E!==void 0&&(c.color=E),a!==void 0&&(c.terminalWidth=a),F(d,c,(b,M)=>{if(b)return R(new Error(b),null);R(null,M.messages)})},analyzeMetafile:({callName:v,refs:d,metafile:f,options:o,callback:R})=>{o===void 0&&(o={});let O={},$=r(o,O,"color",I),E=r(o,O,"verbose",I);K(o,O,`in ${v}() call`);let a={command:"analyze-metafile",metafile:f};$!==void 0&&(a.color=$),E!==void 0&&(a.verbose=E),F(d,a,(c,b)=>{if(c)return R(new Error(c),null);R(null,b.result)})}}}}function rt(e,t,n,i,u,l,g,s,p,B,F){let w=ze(),U=e==="context",T=(S,z)=>{let V=[];try{xe(V,s,{},p,Fe)}catch(d){}let v=oe(S,l,w,void 0,z);n(u,{command:"error",flags:V,error:v},()=>{v.detail=w.load(v.detail),F(pe(U?"Context failed":"Build failed",[v],[]),null)})},j;if(typeof s=="object"){let S=s.plugins;if(S!==void 0){if(!Array.isArray(S))return T(new Error('"plugins" must be an array'),"");j=S}}if(j&&j.length>0){if(l.isSync)return T(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,g,s,j,w).then(S=>{if(!S.ok)return T(S.error,S.pluginName);try{L(S.requestPlugins,S.runOnEndCallbacks,S.scheduleOnDisposeCallbacks)}catch(z){T(z,"")}},S=>T(S,""));return}try{L(null,(S,z)=>z([],[]),()=>{})}catch(S){T(S,"")}function L(S,z,V){let v=l.hasFS,{entries:d,flags:f,write:o,stdinContents:R,stdinResolveDir:O,absWorkingDir:$,nodePaths:E,mangleCache:a}=tt(e,s,p,Fe,v);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:d,flags:f,write:o,stdinContents:R,stdinResolveDir:O,absWorkingDir:$||B,nodePaths:E,context:U};S&&(c.plugins=S),a&&(c.mangleCache=a);let b=(k,x)=>{let C={errors:de(k.errors,w),warnings:de(k.warnings,w),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=C.errors.slice(),m=C.warnings.slice();k.outputFiles&&(C.outputFiles=k.outputFiles.map(st)),k.metafile&&(C.metafile=JSON.parse(k.metafile)),k.mangleCache&&(C.mangleCache=k.mangleCache),k.writeToStdout!==void 0&&console.log(se(k.writeToStdout).replace(/\n$/,"")),z(C,(A,N)=>{if(q.length>0||A.length>0){let D=pe("Build failed",q.concat(A),m.concat(N));return x(D,null,A,N)}x(null,C,A,N)})},M,P;U&&(g["on-end"]=(k,x)=>new Promise(C=>{b(x,(q,m,A,N)=>{let D={errors:A,warnings:N};P&&P(q,m),M=void 0,P=void 0,i(k,D),C()})})),n(u,c,(k,x)=>{if(k)return F(new Error(k),null);if(!U)return b(x,(m,A)=>(V(),F(m,A)));if(x.errors.length>0)return F(pe("Context failed",x.errors,x.warnings),null);let C=!1,q={rebuild:()=>(M||(M=new Promise((m,A)=>{let N;P=(J,W)=>{N||(N=()=>J?A(J):m(W))};let D=()=>{n(u,{command:"rebuild",key:t},(W,te)=>{W?A(new Error(W)):N?N():D()})};D()})),M),watch:(m={})=>new Promise((A,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let D={},J=r(m,D,"delay",ae);K(m,D,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(u,W,te=>{te?N(new Error(te)):A(void 0)})}),serve:(m={})=>new Promise((A,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let D={},J=r(m,D,"port",Qe),W=r(m,D,"host",y),te=r(m,D,"servedir",y),h=r(m,D,"keyfile",y),ne=r(m,D,"certfile",y),H=r(m,D,"fallback",y),ee=r(m,D,"cors",Q),re=r(m,D,"onRequest",Be);K(m,D,"in serve() call");let X={command:"serve",key:t,onRequest:!!re};if(J!==void 0&&(X.port=J),W!==void 0&&(X.host=W),te!==void 0&&(X.servedir=te),h!==void 0&&(X.keyfile=h),ne!==void 0&&(X.certfile=ne),H!==void 0&&(X.fallback=H),ee){let ge={},ce=r(ee,ge,"origin",je);K(ee,ge,'on "cors" object'),Array.isArray(ce)?X.corsOrigin=ce:ce!==void 0&&(X.corsOrigin=[ce])}n(u,X,(ge,ce)=>{if(ge)return N(new Error(ge));re&&(g["serve-request"]=(_e,Ve)=>{re(Ve.args),i(_e,{})}),A(ce)})}),cancel:()=>new Promise(m=>{if(C)return m();n(u,{command:"cancel",key:t},()=>{m()})}),dispose:()=>new Promise(m=>{if(C)return m();C=!0,n(u,{command:"dispose",key:t},()=>{m(),V(),u.unref()})})};u.ref(),F(null,q)})}}var it=async(e,t,n,i,u,l,g,s,p)=>{let B=[],F=[],w={},U={},T=[],j=0,L=0,S=[],z=!1;s=[...s];for(let d of s){let f={};if(typeof d!="object")throw new Error(`Plugin at index ${L} must be an object`);let o=r(d,f,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${L} is missing a name`);try{let R=r(d,f,"setup",Be);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(d,f,`on plugin ${_(o)}`);let O={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};L++;let E=R({initialOptions:g,resolve:(a,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),M=r(c,b,"pluginName",y),P=r(c,b,"importer",y),k=r(c,b,"namespace",y),x=r(c,b,"resolveDir",y),C=r(c,b,"kind",y),q=r(c,b,"pluginData",we),m=r(c,b,"with",Q);return K(c,b,"in resolve() call"),new Promise((A,N)=>{let D={command:"resolve",path:a,key:e,pluginName:o};if(M!=null&&(D.pluginName=M),P!=null&&(D.importer=P),k!=null&&(D.namespace=k),x!=null&&(D.resolveDir=x),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(D.pluginData=p.store(q)),m!=null&&(D.with=lt(m,"with")),t(i,D,(J,W)=>{J!==null?N(new Error(J)):A({errors:de(W.errors,p),warnings:de(W.warnings,p),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:p.load(W.pluginData)})})})},onStart(a){let c='This error came from the "onStart" callback registered here:',b=he(new Error(c),u,"onStart");B.push({name:o,callback:a,note:b}),O.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',b=he(new Error(c),u,"onEnd");F.push({name:o,callback:a,note:b}),O.onEnd=!0},onResolve(a,c){let b='This error came from the "onResolve" callback registered here:',M=he(new Error(b),u,"onResolve"),P={},k=r(a,P,"filter",ve),x=r(a,P,"namespace",y);if(K(a,P,`in onResolve() call for plugin ${_(o)}`),k==null)throw new Error("onResolve() call is missing a filter");let C=j++;w[C]={name:o,callback:c,note:M},O.onResolve.push({id:C,filter:Re(k),namespace:x||""})},onLoad(a,c){let b='This error came from the "onLoad" callback registered here:',M=he(new Error(b),u,"onLoad"),P={},k=r(a,P,"filter",ve),x=r(a,P,"namespace",y);if(K(a,P,`in onLoad() call for plugin ${_(o)}`),k==null)throw new Error("onLoad() call is missing a filter");let C=j++;U[C]={name:o,callback:c,note:M},O.onLoad.push({id:C,filter:Re(k),namespace:x||""})},onDispose(a){T.push(a)},esbuild:u.esbuild});E&&await E,S.push(O)}catch(R){return{ok:!1,error:R,pluginName:o}}}l["on-start"]=async(d,f)=>{p.clear();let o={errors:[],warnings:[]};await Promise.all(B.map(async({name:R,callback:O,note:$})=>{try{let E=await O();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${_(R)} to return an object`);let a={},c=r(E,a,"errors",ie),b=r(E,a,"warnings",ie);K(E,a,`from onStart() callback in plugin ${_(R)}`),c!=null&&o.errors.push(...le(c,"errors",p,R,void 0)),b!=null&&o.warnings.push(...le(b,"warnings",p,R,void 0))}}catch(E){o.errors.push(oe(E,u,p,$&&$(),R))}})),n(d,o)},l["on-resolve"]=async(d,f)=>{let o={},R="",O,$;for(let E of f.ids)try{({name:R,callback:O,note:$}=w[E]);let a=await O({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:p.load(f.pluginData),with:f.with});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${_(R)} to return an object`);let c={},b=r(a,c,"pluginName",y),M=r(a,c,"path",y),P=r(a,c,"namespace",y),k=r(a,c,"suffix",y),x=r(a,c,"external",I),C=r(a,c,"sideEffects",I),q=r(a,c,"pluginData",we),m=r(a,c,"errors",ie),A=r(a,c,"warnings",ie),N=r(a,c,"watchFiles",G),D=r(a,c,"watchDirs",G);K(a,c,`from onResolve() callback in plugin ${_(R)}`),o.id=E,b!=null&&(o.pluginName=b),M!=null&&(o.path=M),P!=null&&(o.namespace=P),k!=null&&(o.suffix=k),x!=null&&(o.external=x),C!=null&&(o.sideEffects=C),q!=null&&(o.pluginData=p.store(q)),m!=null&&(o.errors=le(m,"errors",p,R,void 0)),A!=null&&(o.warnings=le(A,"warnings",p,R,void 0)),N!=null&&(o.watchFiles=be(N,"watchFiles")),D!=null&&(o.watchDirs=be(D,"watchDirs"));break}}catch(a){o={id:E,errors:[oe(a,u,p,$&&$(),R)]};break}n(d,o)},l["on-load"]=async(d,f)=>{let o={},R="",O,$;for(let E of f.ids)try{({name:R,callback:O,note:$}=U[E]);let a=await O({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:p.load(f.pluginData),with:f.with});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${_(R)} to return an object`);let c={},b=r(a,c,"pluginName",y),M=r(a,c,"contents",Le),P=r(a,c,"resolveDir",y),k=r(a,c,"pluginData",we),x=r(a,c,"loader",y),C=r(a,c,"errors",ie),q=r(a,c,"warnings",ie),m=r(a,c,"watchFiles",G),A=r(a,c,"watchDirs",G);K(a,c,`from onLoad() callback in plugin ${_(R)}`),o.id=E,b!=null&&(o.pluginName=b),M instanceof Uint8Array?o.contents=M:M!=null&&(o.contents=Z(M)),P!=null&&(o.resolveDir=P),k!=null&&(o.pluginData=p.store(k)),x!=null&&(o.loader=x),C!=null&&(o.errors=le(C,"errors",p,R,void 0)),q!=null&&(o.warnings=le(q,"warnings",p,R,void 0)),m!=null&&(o.watchFiles=be(m,"watchFiles")),A!=null&&(o.watchDirs=be(A,"watchDirs"));break}}catch(a){o={id:E,errors:[oe(a,u,p,$&&$(),R)]};break}n(d,o)};let V=(d,f)=>f([],[]);F.length>0&&(V=(d,f)=>{(async()=>{let o=[],R=[];for(let{name:O,callback:$,note:E}of F){let a,c;try{let b=await $(d);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${_(O)} to return an object`);let M={},P=r(b,M,"errors",ie),k=r(b,M,"warnings",ie);K(b,M,`from onEnd() callback in plugin ${_(O)}`),P!=null&&(a=le(P,"errors",p,O,void 0)),k!=null&&(c=le(k,"warnings",p,O,void 0))}}catch(b){a=[oe(b,u,p,E&&E(),O)]}if(a){o.push(...a);try{d.errors.push(...a)}catch(b){}}if(c){R.push(...c);try{d.warnings.push(...c)}catch(b){}}}f(o,R)})()});let v=()=>{for(let d of T)setTimeout(()=>d(),0)};return z=!0,{ok:!0,requestPlugins:S,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:v}};function ze(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function he(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
|
|
7
|
+
`);l.splice(1,1);let g=Ke(t,l,n);if(g)return i={text:e.message,location:g},i}catch(l){}}}function oe(e,t,n,i,u){let l="Internal error",g=null;try{l=(e&&e.message||e)+""}catch(s){}try{g=Ke(t,(e.stack+"").split(`
|
|
8
|
+
`),"")}catch(s){}return{id:"",pluginName:u,text:l,location:g,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ke(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(l.startsWith(i))for(l=l.slice(i.length);;){let g=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(g){l=g[1];continue}if(g=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),g){l=g[1];continue}if(g=/^(\S+):(\d+):(\d+)$/.exec(l),g){let s;try{s=e.readFileSync(g[1],"utf8")}catch(w){break}let p=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+g[2]-1]||"",B=+g[3]-1,F=p.slice(B,B+n.length)===n?n.length:0;return{file:g[1],namespace:"file",line:+g[2],column:Z(p.slice(0,B)).length,length:Z(p.slice(B,B+F)).length,lineText:p+`
|
|
9
9
|
`+t.slice(1).join(`
|
|
10
10
|
`),suggestion:""}}break}}return null}function pe(e,t,n){let i=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((l,g)=>{if(g===i)return`
|
|
11
11
|
...`;if(!l.location)return`
|
|
12
|
-
error: ${l.text}`;let{file:s,line:p,column:
|
|
13
|
-
${s}:${p}:${U}: ERROR: ${F}${l.text}`}).join("");let u=new Error(e);for(let[l,g]of[["errors",t],["warnings",n]])Object.defineProperty(u,l,{configurable:!0,enumerable:!0,get:()=>g,set:s=>Object.defineProperty(u,l,{configurable:!0,enumerable:!0,value:s})});return u}function fe(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function De(e,t,n){if(e==null)return null;let i={},u=r(e,i,"file",m),l=r(e,i,"namespace",m),g=r(e,i,"line",ce),s=r(e,i,"column",ce),p=r(e,i,"length",ce),U=r(e,i,"lineText",m),F=r(e,i,"suggestion",m);if(K(e,i,t),U){let b=U.slice(0,(s&&s>0?s:0)+(p&&p>0?p:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(b)&&!/\n/.test(U)&&(U=b)}return{file:u||"",namespace:l||"",line:g||0,column:s||0,length:p||0,lineText:U||"",suggestion:F||""}}function ie(e,t,n,i,u){let l=[],g=0;for(let s of e){let p={},U=r(s,p,"id",m),F=r(s,p,"pluginName",m),b=r(s,p,"text",m),j=r(s,p,"location",Te),T=r(s,p,"notes",re),L=r(s,p,"detail",we),N=`in element ${g} of "${t}"`;K(s,p,N);let k=[];if(T)for(let z of T){let V={},w=r(z,V,"text",m),d=r(z,V,"location",Te);K(z,V,N),k.push({text:w||"",location:De(d,N,u)})}l.push({id:U||"",pluginName:F||i,text:b||"",location:De(j,N,u),notes:k,detail:n?n.store(L):-1}),g++}return l}function be(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${_(t)} must be an array of strings`);n.push(i)}return n}function lt(e,t){let n=Object.create(null);for(let i in e){let u=e[i];if(typeof u!="string")throw new Error(`key ${_(i)} in object ${_(t)} must be a string`);n[i]=u}return n}function st({path:e,contents:t,hash:n}){let i=null;return{path:e,contents:t,hash:n,get text(){let u=this.contents;return(i===null||u!==t)&&(t=u,i=le(u)),i}}}function Re(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var at="0.25.5",ut=e=>me().build(e),ct=e=>me().context(e),ft=(e,t)=>me().transform(e,t),dt=(e,t)=>me().formatMessages(e,t),gt=(e,t)=>me().analyzeMetafile(e,t),pt=()=>{throw new Error('The "buildSync" API only works in node')},mt=()=>{throw new Error('The "transformSync" API only works in node')},yt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ht=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},bt=()=>(Oe&&Oe(),Promise.resolve()),oe,Oe,Ee,me=()=>{if(Ee)return Ee;throw oe?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')},wt=e=>{e=Ne(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(oe)throw new Error('Cannot call "initialize" more than once');return oe=vt(t||"",n,i),oe.catch(()=>{oe=void 0}),oe},vt=async(e,t,n)=>{let i,u,l=new Promise(b=>u=b);if(n){let b=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.\nlet onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){u+=y.decode(s);const n=u.lastIndexOf(`\n`);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(r,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,c,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),y=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 u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,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 r=4096;const s=d=>{const e=r,t=f.encode(d+"\\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=r;if(o.forEach(d=>{this.mem.setUint32(r,d,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const r=this;return function(){const s={id:u,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:c})=>(c.length>0&&(r.push(c),s&&s()),o),y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=r[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.5"],tryToInstantiateModule(i,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)}),o};async function tryToInstantiateModule(i,f){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const y=await fetch(i);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return i=>onmessage(i);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
|
|
12
|
+
error: ${l.text}`;let{file:s,line:p,column:B}=l.location,F=l.pluginName?`[plugin: ${l.pluginName}] `:"";return`
|
|
13
|
+
${s}:${p}:${B}: ERROR: ${F}${l.text}`}).join("");let u=new Error(e);for(let[l,g]of[["errors",t],["warnings",n]])Object.defineProperty(u,l,{configurable:!0,enumerable:!0,get:()=>g,set:s=>Object.defineProperty(u,l,{configurable:!0,enumerable:!0,value:s})});return u}function de(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function De(e,t,n){if(e==null)return null;let i={},u=r(e,i,"file",y),l=r(e,i,"namespace",y),g=r(e,i,"line",ae),s=r(e,i,"column",ae),p=r(e,i,"length",ae),B=r(e,i,"lineText",y),F=r(e,i,"suggestion",y);if(K(e,i,t),B){let w=B.slice(0,(s&&s>0?s:0)+(p&&p>0?p:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(w)&&!/\n/.test(B)&&(B=w)}return{file:u||"",namespace:l||"",line:g||0,column:s||0,length:p||0,lineText:B||"",suggestion:F||""}}function le(e,t,n,i,u){let l=[],g=0;for(let s of e){let p={},B=r(s,p,"id",y),F=r(s,p,"pluginName",y),w=r(s,p,"text",y),U=r(s,p,"location",Te),T=r(s,p,"notes",ie),j=r(s,p,"detail",we),L=`in element ${g} of "${t}"`;K(s,p,L);let S=[];if(T)for(let z of T){let V={},v=r(z,V,"text",y),d=r(z,V,"location",Te);K(z,V,L),S.push({text:v||"",location:De(d,L,u)})}l.push({id:B||"",pluginName:F||i,text:w||"",location:De(U,L,u),notes:S,detail:n?n.store(j):-1}),g++}return l}function be(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${_(t)} must be an array of strings`);n.push(i)}return n}function lt(e,t){let n=Object.create(null);for(let i in e){let u=e[i];if(typeof u!="string")throw new Error(`key ${_(i)} in object ${_(t)} must be a string`);n[i]=u}return n}function st({path:e,contents:t,hash:n}){let i=null;return{path:e,contents:t,hash:n,get text(){let u=this.contents;return(i===null||u!==t)&&(t=u,i=se(u)),i}}}function Re(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var at="0.25.7",ut=e=>me().build(e),ct=e=>me().context(e),ft=(e,t)=>me().transform(e,t),dt=(e,t)=>me().formatMessages(e,t),gt=(e,t)=>me().analyzeMetafile(e,t),pt=()=>{throw new Error('The "buildSync" API only works in node')},mt=()=>{throw new Error('The "transformSync" API only works in node')},yt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ht=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},bt=()=>(Oe&&Oe(),Promise.resolve()),ue,Oe,Ee,me=()=>{if(Ee)return Ee;throw ue?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')},wt=e=>{e=Ne(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ue)throw new Error('Cannot call "initialize" more than once');return ue=vt(t||"",n,i),ue.catch(()=>{ue=void 0}),ue},vt=async(e,t,n)=>{let i,u,l=new Promise(w=>u=w);if(n){let w=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.\nlet onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){u+=y.decode(s);const n=u.lastIndexOf(`\n`);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(r,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,c,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),y=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 u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,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 r=4096;const s=d=>{const e=r,t=f.encode(d+"\\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=r;if(o.forEach(d=>{this.mem.setUint32(r,d,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const r=this;return function(){const s={id:u,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:c})=>(c.length>0&&(r.push(c),s&&s()),o),y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=r[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.7"],tryToInstantiateModule(i,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)}),o};async function tryToInstantiateModule(i,f){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const y=await fetch(i);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return i=>onmessage(i);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
|
|
14
14
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
15
15
|
// Use of this source code is governed by a BSD-style
|
|
16
16
|
// license that can be found in the LICENSE file.
|
|
17
17
|
let onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){u+=y.decode(s);const n=u.lastIndexOf(`
|
|
18
18
|
`);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(r,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,c,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),y=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 u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,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 r=4096;const s=d=>{const e=r,t=f.encode(d+"\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=r;if(o.forEach(d=>{this.mem.setUint32(r,d,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const r=this;return function(){const s={id:u,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`
|
|
19
19
|
`);h.length>1&&console.log(h.slice(0,-1).join(`
|
|
20
|
-
`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:c})=>(c.length>0&&(r.push(c),s&&s()),o),y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=r[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.
|
|
20
|
+
`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:c})=>(c.length>0&&(r.push(c),s&&s()),o),y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=r[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.7"],tryToInstantiateModule(i,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)}),o};async function tryToInstantiateModule(i,f){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const y=await fetch(i);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return i=>onmessage(i);})(T=>i.onmessage({data:T})),U;i={onmessage:null,postMessage:T=>setTimeout(()=>{try{U=w({data:T})}catch(j){u(j)}}),terminate(){if(U)for(let T of U._scheduledTimeouts.values())clearTimeout(T)}}}let g,s,p=new Promise((w,U)=>{g=w,s=U});i.onmessage=({data:w})=>{i.onmessage=({data:U})=>B(U),w?s(w):g()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:B,service:F}=We({writeToStdin(w){i.postMessage(w)},isSync:!1,hasFS:!1,esbuild:Se});await p,Oe=()=>{i.terminate(),ue=void 0,Oe=void 0,Ee=void 0},Ee={build:w=>new Promise((U,T)=>{l.then(T),F.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,L)=>j?T(j):U(L)})}),context:w=>new Promise((U,T)=>{l.then(T),F.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,L)=>j?T(j):U(L)})}),transform:(w,U)=>new Promise((T,j)=>{l.then(j),F.transform({callName:"transform",refs:null,input:w,options:U||{},isTTY:!1,fs:{readFile(L,S){S(new Error("Internal error"),null)},writeFile(L,S){S(null)}},callback:(L,S)=>L?j(L):T(S)})}),formatMessages:(w,U)=>new Promise((T,j)=>{l.then(j),F.formatMessages({callName:"formatMessages",refs:null,messages:w,options:U,callback:(L,S)=>L?j(L):T(S)})}),analyzeMetafile:(w,U)=>new Promise((T,j)=>{l.then(j),F.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:U,callback:(L,S)=>L?j(L):T(S)})})}},Rt=Se;export{gt as analyzeMetafile,ht as analyzeMetafileSync,ut as build,pt as buildSync,ct as context,Rt as default,dt as formatMessages,yt as formatMessagesSync,wt as initialize,bt as stop,ft as transform,mt as transformSync,at as version};
|
package/lib/browser.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | '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'
|
|
7
|
+
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
7
8
|
|
|
8
9
|
interface CommonOptions {
|
|
9
10
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
@@ -75,6 +76,8 @@ interface CommonOptions {
|
|
|
75
76
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
76
77
|
keepNames?: boolean
|
|
77
78
|
|
|
79
|
+
/** Documentation: https://esbuild.github.io/api/#abs-paths */
|
|
80
|
+
absPaths?: AbsPaths[]
|
|
78
81
|
/** Documentation: https://esbuild.github.io/api/#color */
|
|
79
82
|
color?: boolean
|
|
80
83
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
@@ -159,7 +162,7 @@ export interface BuildOptions extends CommonOptions {
|
|
|
159
162
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
160
163
|
footer?: { [type: string]: string }
|
|
161
164
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
162
|
-
entryPoints?: string
|
|
165
|
+
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
|
|
163
166
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
164
167
|
stdin?: StdinOptions
|
|
165
168
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
@@ -513,7 +516,9 @@ export interface AnalyzeMetafileOptions {
|
|
|
513
516
|
verbose?: boolean
|
|
514
517
|
}
|
|
515
518
|
|
|
519
|
+
/** Documentation: https://esbuild.github.io/api/#watch-arguments */
|
|
516
520
|
export interface WatchOptions {
|
|
521
|
+
delay?: number // In milliseconds
|
|
517
522
|
}
|
|
518
523
|
|
|
519
524
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
package/lib/browser.js
CHANGED
|
@@ -346,6 +346,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
346
346
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
|
347
347
|
let platform = getFlag(options, keys, "platform", mustBeString);
|
|
348
348
|
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
|
349
|
+
let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
|
|
349
350
|
if (legalComments) flags.push(`--legal-comments=${legalComments}`);
|
|
350
351
|
if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
|
|
351
352
|
if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
|
|
@@ -364,6 +365,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
364
365
|
if (ignoreAnnotations) flags.push(`--ignore-annotations`);
|
|
365
366
|
if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
|
366
367
|
if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
|
|
368
|
+
if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
|
|
367
369
|
if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
|
|
368
370
|
if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
|
|
369
371
|
if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
|
|
@@ -652,8 +654,8 @@ function createChannel(streamIn) {
|
|
|
652
654
|
if (isFirstPacket) {
|
|
653
655
|
isFirstPacket = false;
|
|
654
656
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
655
|
-
if (binaryVersion !== "0.25.
|
|
656
|
-
throw new Error(`Cannot start service: Host version "${"0.25.
|
|
657
|
+
if (binaryVersion !== "0.25.7") {
|
|
658
|
+
throw new Error(`Cannot start service: Host version "${"0.25.7"}" does not match binary version ${quote(binaryVersion)}`);
|
|
657
659
|
}
|
|
658
660
|
return;
|
|
659
661
|
}
|
|
@@ -995,11 +997,13 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
995
997
|
watch: (options2 = {}) => new Promise((resolve, reject) => {
|
|
996
998
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
997
999
|
const keys = {};
|
|
1000
|
+
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
998
1001
|
checkForInvalidFlags(options2, keys, `in watch() call`);
|
|
999
1002
|
const request2 = {
|
|
1000
1003
|
command: "watch",
|
|
1001
1004
|
key: buildKey
|
|
1002
1005
|
};
|
|
1006
|
+
if (delay) request2.delay = delay;
|
|
1003
1007
|
sendRequest(refs, request2, (error2) => {
|
|
1004
1008
|
if (error2) reject(new Error(error2));
|
|
1005
1009
|
else resolve(void 0);
|
|
@@ -1600,7 +1604,7 @@ function jsRegExpToGoRegExp(regexp) {
|
|
|
1600
1604
|
}
|
|
1601
1605
|
|
|
1602
1606
|
// lib/npm/browser.ts
|
|
1603
|
-
var version = "0.25.
|
|
1607
|
+
var version = "0.25.7";
|
|
1604
1608
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1605
1609
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1606
1610
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1648,7 +1652,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(null, null
|
|
|
1648
1652
|
let rejectAllWith;
|
|
1649
1653
|
const rejectAllPromise = new Promise((resolve) => rejectAllWith = resolve);
|
|
1650
1654
|
if (useWorker) {
|
|
1651
|
-
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 // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(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 setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, 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 _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\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 // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\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 // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\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 // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\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 // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\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 // JS values that Go currently has references to, indexed by reference id\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 // mapping from JS values to reference ids\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) 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) resumeStdin();\n }\n return go;\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.25.5"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n return go;\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok) throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
|
1655
|
+
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 // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(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 setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, 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 _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\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 // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\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 // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\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 // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\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 = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\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 // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\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 // JS values that Go currently has references to, indexed by reference id\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 // mapping from JS values to reference ids\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) 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) resumeStdin();\n }\n return go;\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.25.7"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n return go;\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok) throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
|
1652
1656
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1653
1657
|
} else {
|
|
1654
1658
|
let onmessage = ((postMessage) => {
|
|
@@ -2288,7 +2292,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(null, null
|
|
|
2288
2292
|
callback(null, count);
|
|
2289
2293
|
};
|
|
2290
2294
|
let go = new globalThis.Go();
|
|
2291
|
-
go.argv = ["", `--service=${"0.25.
|
|
2295
|
+
go.argv = ["", `--service=${"0.25.7"}`];
|
|
2292
2296
|
tryToInstantiateModule(wasm, go).then(
|
|
2293
2297
|
(instance) => {
|
|
2294
2298
|
postMessage(null);
|
package/lib/browser.min.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
(module=>{
|
|
2
|
-
"use strict";var $e=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var Xe=(e,t)=>{for(var n in t)$e(e,n,{get:t[n],enumerable:!0})},Ze=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qe(t))!He.call(e,a)&&a!==n&&$e(e,a,{get:()=>t[a],enumerable:!(i=Ge(t,a))||i.enumerable});return e};var et=e=>Ze($e({},"__esModule",{value:!0}),e);var te=(e,t,n)=>new Promise((i,a)=>{var l=d=>{try{s(n.next(d))}catch(P){a(P)}},g=d=>{try{s(n.throw(d))}catch(P){a(P)}},s=d=>d.done?i(d.value):Promise.resolve(d.value).then(l,g);s((n=n.apply(e,t)).next())});var ke={};Xe(ke,{analyzeMetafile:()=>wt,analyzeMetafileSync:()=>Ot,build:()=>mt,buildSync:()=>vt,context:()=>yt,default:()=>$t,formatMessages:()=>bt,formatMessagesSync:()=>xt,initialize:()=>St,stop:()=>Et,transform:()=>ht,transformSync:()=>Rt,version:()=>pt});module.exports=et(ke);function Ae(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let a of i)t(a)}else{let a=Object.keys(i);n.write8(6),n.write32(a.length);for(let l of a)n.write(Z(l)),t(i[l])}},n=new he;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Ce(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Pe(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return
|
|
2
|
+
"use strict";var $e=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var Xe=(e,t)=>{for(var n in t)$e(e,n,{get:t[n],enumerable:!0})},Ze=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qe(t))!He.call(e,a)&&a!==n&&$e(e,a,{get:()=>t[a],enumerable:!(i=Ge(t,a))||i.enumerable});return e};var et=e=>Ze($e({},"__esModule",{value:!0}),e);var te=(e,t,n)=>new Promise((i,a)=>{var l=d=>{try{s(n.next(d))}catch(P){a(P)}},g=d=>{try{s(n.throw(d))}catch(P){a(P)}},s=d=>d.done?i(d.value):Promise.resolve(d.value).then(l,g);s((n=n.apply(e,t)).next())});var ke={};Xe(ke,{analyzeMetafile:()=>wt,analyzeMetafileSync:()=>Ot,build:()=>mt,buildSync:()=>vt,context:()=>yt,default:()=>$t,formatMessages:()=>bt,formatMessagesSync:()=>xt,initialize:()=>St,stop:()=>Et,transform:()=>ht,transformSync:()=>Rt,version:()=>pt});module.exports=et(ke);function Ae(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let a of i)t(a)}else{let a=Object.keys(i);n.write8(6),n.write32(a.length);for(let l of a)n.write(Z(l)),t(i[l])}},n=new he;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Ce(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Pe(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return oe(n.read());case 4:return n.read();case 5:{let g=n.read32(),s=[];for(let d=0;d<g;d++)s.push(t());return s}case 6:{let g=n.read32(),s={};for(let d=0;d<g;d++)s[oe(n.read())]=t();return s}default:throw new Error("Invalid packet")}},n=new he(e),i=n.read32(),a=(i&1)===0;i>>>=1;let l=t();if(n.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:a,value:l}}var he=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 n=new Uint8Array((this.len+t)*2);n.set(this.buf),this.buf=n}return this.len+=t,this.len-t}write8(t){let n=this._write(1);this.buf[n]=t}write32(t){let n=this._write(4);Ce(this.buf,t,n)}write(t){let n=this._write(4+t.length);Ce(this.buf,t.length,n),this.buf.set(t,n+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 Fe(this.buf,this._read(4))}read(){let t=this.read32(),n=new Uint8Array(t),i=this._read(n.length);return n.set(this.buf.subarray(i,i+t)),n}},Z,oe,Me;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;Z=n=>e.encode(n),oe=n=>t.decode(n),Me='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")Z=e=>Buffer.from(e),oe=e=>{let{buffer:t,byteOffset:n,byteLength:i}=e;return Buffer.from(t,n,i).toString()},Me='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(Z("")instanceof Uint8Array))throw new Error(`Invariant violation: "${Me} instanceof Uint8Array" is incorrectly false
|
|
3
3
|
|
|
4
4
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
5
5
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
6
6
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
7
|
-
`);function Fe(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ce(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var _=JSON.stringify,Te="warning",De="silent";function pe(e,t){let n=[];for(let i of e){if(J(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var ve=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",m=e=>typeof e=="string"?null:"a string",Re=e=>e instanceof RegExp?null:"a RegExp object",fe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",nt=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",je=e=>typeof e=="function"?null:"a function",ie=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",rt=e=>typeof e=="object"&&e!==null?null:"an array or an object",it=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Be=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Le=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",lt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ne=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",qe=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",st=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let a=e[n];if(t[n+""]=!0,a===void 0)return;let l=i(a);if(l!==null)throw new Error(`${_(n)} must be ${l}`);return a}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${_(i)}`)}function Ie(e){let t=Object.create(null),n=r(e,t,"wasmURL",st),i=r(e,t,"wasmModule",it),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:a}}function We(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${_(n)} in mangle cache to map to either a string or false`)}}return t}function Oe(e,t,n,i,a){let l=r(t,n,"color",I),g=r(t,n,"logLevel",m),s=r(t,n,"logLimit",fe);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${g||a}`),e.push(`--log-limit=${s||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+_(n):""} to be a string, got ${typeof e} instead`);return e}function ze(e,t,n){let i=r(t,n,"legalComments",m),a=r(t,n,"sourceRoot",m),l=r(t,n,"sourcesContent",I),g=r(t,n,"target",Ne),s=r(t,n,"format",m),d=r(t,n,"globalName",m),P=r(t,n,"mangleProps",Re),A=r(t,n,"reserveProps",Re),b=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),T=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),N=r(t,n,"minifyIdentifiers",I),S=r(t,n,"lineLimit",fe),z=r(t,n,"drop",G),V=r(t,n,"dropLabels",G),w=r(t,n,"charset",m),p=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",m),v=r(t,n,"jsxFactory",m),O=r(t,n,"jsxFragment",m),M=r(t,n,"jsxImportSource",m),D=r(t,n,"jsxDev",I),u=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",Y),h=r(t,n,"logOverride",Y),k=r(t,n,"supported",Y),F=r(t,n,"pure",G),$=r(t,n,"keepNames",I),R=r(t,n,"platform",m),C=r(t,n,"tsconfigRaw",lt);if(i&&e.push(`--legal-comments=${i}`),a!==void 0&&e.push(`--source-root=${a}`),l!==void 0&&e.push(`--sources-content=${l}`),g&&e.push(`--target=${pe(Array.isArray(g)?g:[g],"target")}`),s&&e.push(`--format=${s}`),d&&e.push(`--global-name=${d}`),R&&e.push(`--platform=${R}`),C&&e.push(`--tsconfig-raw=${typeof C=="string"?C:JSON.stringify(C)}`),j&&e.push("--minify"),T&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),N&&e.push("--minify-identifiers"),S&&e.push(`--line-limit=${S}`),w&&e.push(`--charset=${w}`),p!==void 0&&e.push(`--tree-shaking=${p}`),f&&e.push("--ignore-annotations"),z)for(let x of z)e.push(`--drop:${J(x,"drop")}`);if(V&&e.push(`--drop-labels=${pe(V,"drop label")}`),P&&e.push(`--mangle-props=${xe(P)}`),A&&e.push(`--reserve-props=${xe(A)}`),b!==void 0&&e.push(`--mangle-quoted=${b}`),o&&e.push(`--jsx=${o}`),v&&e.push(`--jsx-factory=${v}`),O&&e.push(`--jsx-fragment=${O}`),M&&e.push(`--jsx-import-source=${M}`),D&&e.push("--jsx-dev"),u&&e.push("--jsx-side-effects"),c)for(let x in c){if(x.indexOf("=")>=0)throw new Error(`Invalid define: ${x}`);e.push(`--define:${x}=${J(c[x],"define",x)}`)}if(h)for(let x in h){if(x.indexOf("=")>=0)throw new Error(`Invalid log override: ${x}`);e.push(`--log-override:${x}=${J(h[x],"log override",x)}`)}if(k)for(let x in k){if(x.indexOf("=")>=0)throw new Error(`Invalid supported: ${x}`);let E=k[x];if(typeof E!="boolean")throw new Error(`Expected value for supported ${_(x)} to be a boolean, got ${typeof E} instead`);e.push(`--supported:${x}=${E}`)}if(F)for(let x of F)e.push(`--pure:${J(x,"pure")}`);$&&e.push("--keep-names")}function ot(e,t,n,i,a){var ue;let l=[],g=[],s=Object.create(null),d=null,P=null;Oe(l,t,s,n,i),ze(l,t,s);let A=r(t,s,"sourcemap",Le),b=r(t,s,"bundle",I),j=r(t,s,"splitting",I),T=r(t,s,"preserveSymlinks",I),L=r(t,s,"metafile",I),N=r(t,s,"outfile",m),S=r(t,s,"outdir",m),z=r(t,s,"outbase",m),V=r(t,s,"tsconfig",m),w=r(t,s,"resolveExtensions",G),p=r(t,s,"nodePaths",G),f=r(t,s,"mainFields",G),o=r(t,s,"conditions",G),v=r(t,s,"external",G),O=r(t,s,"packages",m),M=r(t,s,"alias",Y),D=r(t,s,"loader",Y),u=r(t,s,"outExtension",Y),c=r(t,s,"publicPath",m),h=r(t,s,"entryNames",m),k=r(t,s,"chunkNames",m),F=r(t,s,"assetNames",m),$=r(t,s,"inject",G),R=r(t,s,"banner",Y),C=r(t,s,"footer",Y),x=r(t,s,"entryPoints",rt),E=r(t,s,"absWorkingDir",m),B=r(t,s,"stdin",Y),q=(ue=r(t,s,"write",I))!=null?ue:a,U=r(t,s,"allowOverwrite",I),Q=r(t,s,"mangleCache",Y);if(s.plugins=!0,K(t,s,`in ${e}() call`),A&&l.push(`--sourcemap${A===!0?"":`=${A}`}`),b&&l.push("--bundle"),U&&l.push("--allow-overwrite"),j&&l.push("--splitting"),T&&l.push("--preserve-symlinks"),L&&l.push("--metafile"),N&&l.push(`--outfile=${N}`),S&&l.push(`--outdir=${S}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),O&&l.push(`--packages=${O}`),w&&l.push(`--resolve-extensions=${pe(w,"resolve extension")}`),c&&l.push(`--public-path=${c}`),h&&l.push(`--entry-names=${h}`),k&&l.push(`--chunk-names=${k}`),F&&l.push(`--asset-names=${F}`),f&&l.push(`--main-fields=${pe(f,"main field")}`),o&&l.push(`--conditions=${pe(o,"condition")}`),v)for(let y of v)l.push(`--external:${J(y,"external")}`);if(M)for(let y in M){if(y.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${y}`);l.push(`--alias:${y}=${J(M[y],"alias",y)}`)}if(R)for(let y in R){if(y.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${y}`);l.push(`--banner:${y}=${J(R[y],"banner",y)}`)}if(C)for(let y in C){if(y.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${y}`);l.push(`--footer:${y}=${J(C[y],"footer",y)}`)}if($)for(let y of $)l.push(`--inject:${J(y,"inject")}`);if(D)for(let y in D){if(y.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${y}`);l.push(`--loader:${y}=${J(D[y],"loader",y)}`)}if(u)for(let y in u){if(y.indexOf("=")>=0)throw new Error(`Invalid out extension: ${y}`);l.push(`--out-extension:${y}=${J(u[y],"out extension",y)}`)}if(x)if(Array.isArray(x))for(let y=0,ne=x.length;y<ne;y++){let H=x[y];if(typeof H=="object"&&H!==null){let ee=Object.create(null),re=r(H,ee,"in",m),X=r(H,ee,"out",m);if(K(H,ee,"in entry point at index "+y),re===void 0)throw new Error('Missing property "in" for entry point at index '+y);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+y);g.push([X,re])}else g.push(["",J(H,"entry point at index "+y)])}else for(let y in x)g.push([y,J(x[y],"entry point",y)]);if(B){let y=Object.create(null),ne=r(B,y,"contents",qe),H=r(B,y,"resolveDir",m),ee=r(B,y,"sourcefile",m),re=r(B,y,"loader",m);K(B,y,'in "stdin" object'),ee&&l.push(`--sourcefile=${ee}`),re&&l.push(`--loader=${re}`),H&&(P=H),typeof ne=="string"?d=Z(ne):ne instanceof Uint8Array&&(d=ne)}let W=[];if(p)for(let y of p)y+="",W.push(y);return{entries:g,flags:l,write:q,stdinContents:d,stdinResolveDir:P,absWorkingDir:E,nodePaths:W,mangleCache:We(Q)}}function at(e,t,n,i){let a=[],l=Object.create(null);Oe(a,t,l,n,i),ze(a,t,l);let g=r(t,l,"sourcemap",Le),s=r(t,l,"sourcefile",m),d=r(t,l,"loader",m),P=r(t,l,"banner",m),A=r(t,l,"footer",m),b=r(t,l,"mangleCache",Y);return K(t,l,`in ${e}() call`),g&&a.push(`--sourcemap=${g===!0?"external":g}`),s&&a.push(`--sourcefile=${s}`),d&&a.push(`--loader=${d}`),P&&a.push(`--banner=${P}`),A&&a.push(`--footer=${A}`),{flags:a,mangleCache:We(b)}}function Ke(e){let t={},n={didClose:!1,reason:""},i={},a=0,l=0,g=new Uint8Array(16*1024),s=0,d=w=>{let p=s+w.length;if(p>g.length){let o=new Uint8Array(p*2);o.set(g),g=o}g.set(w,s),s+=w.length;let f=0;for(;f+4<=s;){let o=Fe(g,f);if(f+4+o>s)break;f+=4,L(g.subarray(f,f+o)),f+=o}f>0&&(g.copyWithin(0,f,s),s-=f)},P=w=>{n.didClose=!0,w&&(n.reason=": "+(w.message||w));let p="The service was stopped"+n.reason;for(let f in i)i[f](p,null);i={}},A=(w,p,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=a++;i[o]=(v,O)=>{try{f(v,O)}finally{w&&w.unref()}},w&&w.ref(),e.writeToStdin(Ae({id:o,isRequest:!0,value:p}))},b=(w,p)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Ae({id:w,isRequest:!1,value:p}))},j=(w,p)=>te(null,null,function*(){try{if(p.command==="ping"){b(w,{});return}if(typeof p.key=="number"){let f=t[p.key];if(!f)return;let o=f[p.command];if(o){yield o(w,p);return}}throw new Error("Invalid command: "+p.command)}catch(f){let o=[oe(f,e,null,void 0,"")];try{b(w,{errors:o})}catch(v){}}}),T=!0,L=w=>{if(T){T=!1;let f=String.fromCharCode(...w);if(f!=="0.25.5")throw new Error(`Cannot start service: Host version "0.25.5" does not match binary version ${_(f)}`);return}let p=Pe(w);if(p.isRequest)j(p.id,p.value);else{let f=i[p.id];delete i[p.id],p.value.error?f(p.value.error,{}):f(null,p.value)}};return{readFromStdout:d,afterClose:P,service:{buildOrContext:({callName:w,refs:p,options:f,isTTY:o,defaultWD:v,callback:O})=>{let M=0,D=l++,u={},c={ref(){++M===1&&p&&p.ref()},unref(){--M===0&&(delete t[D],p&&p.unref())}};t[D]=u,c.ref(),ut(w,D,A,b,c,e,u,f,o,v,(h,k)=>{try{O(h,k)}finally{c.unref()}})},transform:({callName:w,refs:p,input:f,options:o,isTTY:v,fs:O,callback:M})=>{let D=_e(),u=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:k}=at(w,o,v,De),F={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};k&&(F.mangleCache=k),A(p,F,($,R)=>{if($)return M(new Error($),null);let C=de(R.errors,D),x=de(R.warnings,D),E=1,B=()=>{if(--E===0){let q={warnings:x,code:R.code,map:R.map,mangleCache:void 0,legalComments:void 0};"legalComments"in R&&(q.legalComments=R==null?void 0:R.legalComments),R.mangleCache&&(q.mangleCache=R==null?void 0:R.mangleCache),M(null,q)}};if(C.length>0)return M(me("Transform failed",C,x),null);R.codeFS&&(E++,O.readFile(R.code,(q,U)=>{q!==null?M(q,null):(R.code=U,B())})),R.mapFS&&(E++,O.readFile(R.map,(q,U)=>{q!==null?M(q,null):(R.map=U,B())})),B()})}catch(h){let k=[];try{Oe(k,o,{},v,De)}catch($){}let F=oe(h,e,D,void 0,"");A(p,{command:"error",flags:k,error:F},()=>{F.detail=D.load(F.detail),M(me("Transform failed",[F],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=u;u=()=>O.writeFile(f,c)}u(null)},formatMessages:({callName:w,refs:p,messages:f,options:o,callback:v})=>{if(!o)throw new Error(`Missing second argument in ${w}() call`);let O={},M=r(o,O,"kind",m),D=r(o,O,"color",I),u=r(o,O,"terminalWidth",fe);if(K(o,O,`in ${w}() call`),M===void 0)throw new Error(`Missing "kind" in ${w}() call`);if(M!=="error"&&M!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let c={command:"format-msgs",messages:le(f,"messages",null,"",u),isWarning:M==="warning"};D!==void 0&&(c.color=D),u!==void 0&&(c.terminalWidth=u),A(p,c,(h,k)=>{if(h)return v(new Error(h),null);v(null,k.messages)})},analyzeMetafile:({callName:w,refs:p,metafile:f,options:o,callback:v})=>{o===void 0&&(o={});let O={},M=r(o,O,"color",I),D=r(o,O,"verbose",I);K(o,O,`in ${w}() call`);let u={command:"analyze-metafile",metafile:f};M!==void 0&&(u.color=M),D!==void 0&&(u.verbose=D),A(p,u,(c,h)=>{if(c)return v(new Error(c),null);v(null,h.result)})}}}}function ut(e,t,n,i,a,l,g,s,d,P,A){let b=_e(),j=e==="context",T=(S,z)=>{let V=[];try{Oe(V,s,{},d,Te)}catch(p){}let w=oe(S,l,b,void 0,z);n(a,{command:"error",flags:V,error:w},()=>{w.detail=b.load(w.detail),A(me(j?"Context failed":"Build failed",[w],[]),null)})},L;if(typeof s=="object"){let S=s.plugins;if(S!==void 0){if(!Array.isArray(S))return T(new Error('"plugins" must be an array'),"");L=S}}if(L&&L.length>0){if(l.isSync)return T(new Error("Cannot use plugins in synchronous API calls"),"");ct(t,n,i,a,l,g,s,L,b).then(S=>{if(!S.ok)return T(S.error,S.pluginName);try{N(S.requestPlugins,S.runOnEndCallbacks,S.scheduleOnDisposeCallbacks)}catch(z){T(z,"")}},S=>T(S,""));return}try{N(null,(S,z)=>z([],[]),()=>{})}catch(S){T(S,"")}function N(S,z,V){let w=l.hasFS,{entries:p,flags:f,write:o,stdinContents:v,stdinResolveDir:O,absWorkingDir:M,nodePaths:D,mangleCache:u}=ot(e,s,d,Te,w);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:p,flags:f,write:o,stdinContents:v,stdinResolveDir:O,absWorkingDir:M||P,nodePaths:D,context:j};S&&(c.plugins=S),u&&(c.mangleCache=u);let h=($,R)=>{let C={errors:de($.errors,b),warnings:de($.warnings,b),outputFiles:void 0,metafile:void 0,mangleCache:void 0},x=C.errors.slice(),E=C.warnings.slice();$.outputFiles&&(C.outputFiles=$.outputFiles.map(dt)),$.metafile&&(C.metafile=JSON.parse($.metafile)),$.mangleCache&&(C.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(se($.writeToStdout).replace(/\n$/,"")),z(C,(B,q)=>{if(x.length>0||B.length>0){let U=me("Build failed",x.concat(B),E.concat(q));return R(U,null,B,q)}R(null,C,B,q)})},k,F;j&&(g["on-end"]=($,R)=>new Promise(C=>{h(R,(x,E,B,q)=>{let U={errors:B,warnings:q};F&&F(x,E),k=void 0,F=void 0,i($,U),C()})})),n(a,c,($,R)=>{if($)return A(new Error($),null);if(!j)return h(R,(E,B)=>(V(),A(E,B)));if(R.errors.length>0)return A(me("Context failed",R.errors,R.warnings),null);let C=!1,x={rebuild:()=>(k||(k=new Promise((E,B)=>{let q;F=(Q,W)=>{q||(q=()=>Q?B(Q):E(W))};let U=()=>{n(a,{command:"rebuild",key:t},(W,ue)=>{W?B(new Error(W)):q?q():U()})};U()})),k),watch:(E={})=>new Promise((B,q)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(E,{},"in watch() call"),n(a,{command:"watch",key:t},W=>{W?q(new Error(W)):B(void 0)})}),serve:(E={})=>new Promise((B,q)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let U={},Q=r(E,U,"port",nt),W=r(E,U,"host",m),ue=r(E,U,"servedir",m),y=r(E,U,"keyfile",m),ne=r(E,U,"certfile",m),H=r(E,U,"fallback",m),ee=r(E,U,"cors",Y),re=r(E,U,"onRequest",je);K(E,U,"in serve() call");let X={command:"serve",key:t,onRequest:!!re};if(Q!==void 0&&(X.port=Q),W!==void 0&&(X.host=W),ue!==void 0&&(X.servedir=ue),y!==void 0&&(X.keyfile=y),ne!==void 0&&(X.certfile=ne),H!==void 0&&(X.fallback=H),ee){let ge={},ce=r(ee,ge,"origin",Ne);K(ee,ge,'on "cors" object'),Array.isArray(ce)?X.corsOrigin=ce:ce!==void 0&&(X.corsOrigin=[ce])}n(a,X,(ge,ce)=>{if(ge)return q(new Error(ge));re&&(g["serve-request"]=(Je,Ye)=>{re(Ye.args),i(Je,{})}),B(ce)})}),cancel:()=>new Promise(E=>{if(C)return E();n(a,{command:"cancel",key:t},()=>{E()})}),dispose:()=>new Promise(E=>{if(C)return E();C=!0,n(a,{command:"dispose",key:t},()=>{E(),V(),a.unref()})})};a.ref(),A(null,x)})}}var ct=(e,t,n,i,a,l,g,s,d)=>te(null,null,function*(){let P=[],A=[],b={},j={},T=[],L=0,N=0,S=[],z=!1;s=[...s];for(let p of s){let f={};if(typeof p!="object")throw new Error(`Plugin at index ${N} must be an object`);let o=r(p,f,"name",m);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${N} is missing a name`);try{let v=r(p,f,"setup",je);if(typeof v!="function")throw new Error("Plugin is missing a setup function");K(p,f,`on plugin ${_(o)}`);let O={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};N++;let D=v({initialOptions:g,resolve:(u,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof u!="string")throw new Error("The path to resolve must be a string");let h=Object.create(null),k=r(c,h,"pluginName",m),F=r(c,h,"importer",m),$=r(c,h,"namespace",m),R=r(c,h,"resolveDir",m),C=r(c,h,"kind",m),x=r(c,h,"pluginData",ve),E=r(c,h,"with",Y);return K(c,h,"in resolve() call"),new Promise((B,q)=>{let U={command:"resolve",path:u,key:e,pluginName:o};if(k!=null&&(U.pluginName=k),F!=null&&(U.importer=F),$!=null&&(U.namespace=$),R!=null&&(U.resolveDir=R),C!=null)U.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');x!=null&&(U.pluginData=d.store(x)),E!=null&&(U.with=ft(E,"with")),t(i,U,(Q,W)=>{Q!==null?q(new Error(Q)):B({errors:de(W.errors,d),warnings:de(W.warnings,d),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:d.load(W.pluginData)})})})},onStart(u){let c='This error came from the "onStart" callback registered here:',h=be(new Error(c),a,"onStart");P.push({name:o,callback:u,note:h}),O.onStart=!0},onEnd(u){let c='This error came from the "onEnd" callback registered here:',h=be(new Error(c),a,"onEnd");A.push({name:o,callback:u,note:h}),O.onEnd=!0},onResolve(u,c){let h='This error came from the "onResolve" callback registered here:',k=be(new Error(h),a,"onResolve"),F={},$=r(u,F,"filter",Re),R=r(u,F,"namespace",m);if(K(u,F,`in onResolve() call for plugin ${_(o)}`),$==null)throw new Error("onResolve() call is missing a filter");let C=L++;b[C]={name:o,callback:c,note:k},O.onResolve.push({id:C,filter:xe($),namespace:R||""})},onLoad(u,c){let h='This error came from the "onLoad" callback registered here:',k=be(new Error(h),a,"onLoad"),F={},$=r(u,F,"filter",Re),R=r(u,F,"namespace",m);if(K(u,F,`in onLoad() call for plugin ${_(o)}`),$==null)throw new Error("onLoad() call is missing a filter");let C=L++;j[C]={name:o,callback:c,note:k},O.onLoad.push({id:C,filter:xe($),namespace:R||""})},onDispose(u){T.push(u)},esbuild:a.esbuild});D&&(yield D),S.push(O)}catch(v){return{ok:!1,error:v,pluginName:o}}}l["on-start"]=(p,f)=>te(null,null,function*(){d.clear();let o={errors:[],warnings:[]};yield Promise.all(P.map(D=>te(null,[D],function*({name:v,callback:O,note:M}){try{let u=yield O();if(u!=null){if(typeof u!="object")throw new Error(`Expected onStart() callback in plugin ${_(v)} to return an object`);let c={},h=r(u,c,"errors",ie),k=r(u,c,"warnings",ie);K(u,c,`from onStart() callback in plugin ${_(v)}`),h!=null&&o.errors.push(...le(h,"errors",d,v,void 0)),k!=null&&o.warnings.push(...le(k,"warnings",d,v,void 0))}}catch(u){o.errors.push(oe(u,a,d,M&&M(),v))}}))),n(p,o)}),l["on-resolve"]=(p,f)=>te(null,null,function*(){let o={},v="",O,M;for(let D of f.ids)try{({name:v,callback:O,note:M}=b[D]);let u=yield O({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:d.load(f.pluginData),with:f.with});if(u!=null){if(typeof u!="object")throw new Error(`Expected onResolve() callback in plugin ${_(v)} to return an object`);let c={},h=r(u,c,"pluginName",m),k=r(u,c,"path",m),F=r(u,c,"namespace",m),$=r(u,c,"suffix",m),R=r(u,c,"external",I),C=r(u,c,"sideEffects",I),x=r(u,c,"pluginData",ve),E=r(u,c,"errors",ie),B=r(u,c,"warnings",ie),q=r(u,c,"watchFiles",G),U=r(u,c,"watchDirs",G);K(u,c,`from onResolve() callback in plugin ${_(v)}`),o.id=D,h!=null&&(o.pluginName=h),k!=null&&(o.path=k),F!=null&&(o.namespace=F),$!=null&&(o.suffix=$),R!=null&&(o.external=R),C!=null&&(o.sideEffects=C),x!=null&&(o.pluginData=d.store(x)),E!=null&&(o.errors=le(E,"errors",d,v,void 0)),B!=null&&(o.warnings=le(B,"warnings",d,v,void 0)),q!=null&&(o.watchFiles=we(q,"watchFiles")),U!=null&&(o.watchDirs=we(U,"watchDirs"));break}}catch(u){o={id:D,errors:[oe(u,a,d,M&&M(),v)]};break}n(p,o)}),l["on-load"]=(p,f)=>te(null,null,function*(){let o={},v="",O,M;for(let D of f.ids)try{({name:v,callback:O,note:M}=j[D]);let u=yield O({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:d.load(f.pluginData),with:f.with});if(u!=null){if(typeof u!="object")throw new Error(`Expected onLoad() callback in plugin ${_(v)} to return an object`);let c={},h=r(u,c,"pluginName",m),k=r(u,c,"contents",qe),F=r(u,c,"resolveDir",m),$=r(u,c,"pluginData",ve),R=r(u,c,"loader",m),C=r(u,c,"errors",ie),x=r(u,c,"warnings",ie),E=r(u,c,"watchFiles",G),B=r(u,c,"watchDirs",G);K(u,c,`from onLoad() callback in plugin ${_(v)}`),o.id=D,h!=null&&(o.pluginName=h),k instanceof Uint8Array?o.contents=k:k!=null&&(o.contents=Z(k)),F!=null&&(o.resolveDir=F),$!=null&&(o.pluginData=d.store($)),R!=null&&(o.loader=R),C!=null&&(o.errors=le(C,"errors",d,v,void 0)),x!=null&&(o.warnings=le(x,"warnings",d,v,void 0)),E!=null&&(o.watchFiles=we(E,"watchFiles")),B!=null&&(o.watchDirs=we(B,"watchDirs"));break}}catch(u){o={id:D,errors:[oe(u,a,d,M&&M(),v)]};break}n(p,o)});let V=(p,f)=>f([],[]);A.length>0&&(V=(p,f)=>{te(null,null,function*(){let o=[],v=[];for(let{name:O,callback:M,note:D}of A){let u,c;try{let h=yield M(p);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${_(O)} to return an object`);let k={},F=r(h,k,"errors",ie),$=r(h,k,"warnings",ie);K(h,k,`from onEnd() callback in plugin ${_(O)}`),F!=null&&(u=le(F,"errors",d,O,void 0)),$!=null&&(c=le($,"warnings",d,O,void 0))}}catch(h){u=[oe(h,a,d,D&&D(),O)]}if(u){o.push(...u);try{p.errors.push(...u)}catch(h){}}if(c){v.push(...c);try{p.warnings.push(...c)}catch(h){}}}f(o,v)})});let w=()=>{for(let p of T)setTimeout(()=>p(),0)};return z=!0,{ok:!0,requestPlugins:S,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:w}});function _e(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function be(e,t,n){let i,a=!1;return()=>{if(a)return i;a=!0;try{let l=(e.stack+"").split(`
|
|
8
|
-
`);l.splice(1,1);let g=Ve(t,l,n);if(g)return i={text:e.message,location:g},i}catch(l){}}}function
|
|
9
|
-
`),"")}catch(s){}return{id:"",pluginName:a,text:l,location:g,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ve(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let a=1;a<t.length;a++){let l=t[a];if(l.startsWith(i))for(l=l.slice(i.length);;){let g=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(g){l=g[1];continue}if(g=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),g){l=g[1];continue}if(g=/^(\S+):(\d+):(\d+)$/.exec(l),g){let s;try{s=e.readFileSync(g[1],"utf8")}catch(
|
|
7
|
+
`);function Fe(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ce(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var _=JSON.stringify,Te="warning",De="silent";function de(e,t){let n=[];for(let i of e){if(Y(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var ve=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",Re=e=>e instanceof RegExp?null:"a RegExp object",ue=e=>typeof e=="number"&&e===(e|0)?null:"an integer",nt=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",je=e=>typeof e=="function"?null:"a function",le=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",rt=e=>typeof e=="object"&&e!==null?null:"an array or an object",it=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Be=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Le=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",lt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ne=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",qe=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",st=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let a=e[n];if(t[n+""]=!0,a===void 0)return;let l=i(a);if(l!==null)throw new Error(`${_(n)} must be ${l}`);return a}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${_(i)}`)}function Ie(e){let t=Object.create(null),n=r(e,t,"wasmURL",st),i=r(e,t,"wasmModule",it),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:a}}function We(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${_(n)} in mangle cache to map to either a string or false`)}}return t}function Oe(e,t,n,i,a){let l=r(t,n,"color",I),g=r(t,n,"logLevel",y),s=r(t,n,"logLimit",ue);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${g||a}`),e.push(`--log-limit=${s||0}`)}function Y(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+_(n):""} to be a string, got ${typeof e} instead`);return e}function ze(e,t,n){let i=r(t,n,"legalComments",y),a=r(t,n,"sourceRoot",y),l=r(t,n,"sourcesContent",I),g=r(t,n,"target",Ne),s=r(t,n,"format",y),d=r(t,n,"globalName",y),P=r(t,n,"mangleProps",Re),A=r(t,n,"reserveProps",Re),w=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),T=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),L=r(t,n,"minifyIdentifiers",I),E=r(t,n,"lineLimit",ue),z=r(t,n,"drop",G),V=r(t,n,"dropLabels",G),v=r(t,n,"charset",y),p=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",y),R=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),$=r(t,n,"jsxImportSource",y),B=r(t,n,"jsxDev",I),u=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",Q),b=r(t,n,"logOverride",Q),S=r(t,n,"supported",Q),F=r(t,n,"pure",G),k=r(t,n,"keepNames",I),x=r(t,n,"platform",y),M=r(t,n,"tsconfigRaw",lt),q=r(t,n,"absPaths",G);if(i&&e.push(`--legal-comments=${i}`),a!==void 0&&e.push(`--source-root=${a}`),l!==void 0&&e.push(`--sources-content=${l}`),g&&e.push(`--target=${de(Array.isArray(g)?g:[g],"target")}`),s&&e.push(`--format=${s}`),d&&e.push(`--global-name=${d}`),x&&e.push(`--platform=${x}`),M&&e.push(`--tsconfig-raw=${typeof M=="string"?M:JSON.stringify(M)}`),U&&e.push("--minify"),T&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),L&&e.push("--minify-identifiers"),E&&e.push(`--line-limit=${E}`),v&&e.push(`--charset=${v}`),p!==void 0&&e.push(`--tree-shaking=${p}`),f&&e.push("--ignore-annotations"),z)for(let m of z)e.push(`--drop:${Y(m,"drop")}`);if(V&&e.push(`--drop-labels=${de(V,"drop label")}`),q&&e.push(`--abs-paths=${de(q,"abs paths")}`),P&&e.push(`--mangle-props=${xe(P)}`),A&&e.push(`--reserve-props=${xe(A)}`),w!==void 0&&e.push(`--mangle-quoted=${w}`),o&&e.push(`--jsx=${o}`),R&&e.push(`--jsx-factory=${R}`),O&&e.push(`--jsx-fragment=${O}`),$&&e.push(`--jsx-import-source=${$}`),B&&e.push("--jsx-dev"),u&&e.push("--jsx-side-effects"),c)for(let m in c){if(m.indexOf("=")>=0)throw new Error(`Invalid define: ${m}`);e.push(`--define:${m}=${Y(c[m],"define",m)}`)}if(b)for(let m in b){if(m.indexOf("=")>=0)throw new Error(`Invalid log override: ${m}`);e.push(`--log-override:${m}=${Y(b[m],"log override",m)}`)}if(S)for(let m in S){if(m.indexOf("=")>=0)throw new Error(`Invalid supported: ${m}`);let C=S[m];if(typeof C!="boolean")throw new Error(`Expected value for supported ${_(m)} to be a boolean, got ${typeof C} instead`);e.push(`--supported:${m}=${C}`)}if(F)for(let m of F)e.push(`--pure:${Y(m,"pure")}`);k&&e.push("--keep-names")}function ot(e,t,n,i,a){var ne;let l=[],g=[],s=Object.create(null),d=null,P=null;Oe(l,t,s,n,i),ze(l,t,s);let A=r(t,s,"sourcemap",Le),w=r(t,s,"bundle",I),U=r(t,s,"splitting",I),T=r(t,s,"preserveSymlinks",I),j=r(t,s,"metafile",I),L=r(t,s,"outfile",y),E=r(t,s,"outdir",y),z=r(t,s,"outbase",y),V=r(t,s,"tsconfig",y),v=r(t,s,"resolveExtensions",G),p=r(t,s,"nodePaths",G),f=r(t,s,"mainFields",G),o=r(t,s,"conditions",G),R=r(t,s,"external",G),O=r(t,s,"packages",y),$=r(t,s,"alias",Q),B=r(t,s,"loader",Q),u=r(t,s,"outExtension",Q),c=r(t,s,"publicPath",y),b=r(t,s,"entryNames",y),S=r(t,s,"chunkNames",y),F=r(t,s,"assetNames",y),k=r(t,s,"inject",G),x=r(t,s,"banner",Q),M=r(t,s,"footer",Q),q=r(t,s,"entryPoints",rt),m=r(t,s,"absWorkingDir",y),C=r(t,s,"stdin",Q),N=(ne=r(t,s,"write",I))!=null?ne:a,D=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",Q);if(s.plugins=!0,K(t,s,`in ${e}() call`),A&&l.push(`--sourcemap${A===!0?"":`=${A}`}`),w&&l.push("--bundle"),D&&l.push("--allow-overwrite"),U&&l.push("--splitting"),T&&l.push("--preserve-symlinks"),j&&l.push("--metafile"),L&&l.push(`--outfile=${L}`),E&&l.push(`--outdir=${E}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),O&&l.push(`--packages=${O}`),v&&l.push(`--resolve-extensions=${de(v,"resolve extension")}`),c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),S&&l.push(`--chunk-names=${S}`),F&&l.push(`--asset-names=${F}`),f&&l.push(`--main-fields=${de(f,"main field")}`),o&&l.push(`--conditions=${de(o,"condition")}`),R)for(let h of R)l.push(`--external:${Y(h,"external")}`);if($)for(let h in $){if(h.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${h}`);l.push(`--alias:${h}=${Y($[h],"alias",h)}`)}if(x)for(let h in x){if(h.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${h}`);l.push(`--banner:${h}=${Y(x[h],"banner",h)}`)}if(M)for(let h in M){if(h.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${h}`);l.push(`--footer:${h}=${Y(M[h],"footer",h)}`)}if(k)for(let h of k)l.push(`--inject:${Y(h,"inject")}`);if(B)for(let h in B){if(h.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${h}`);l.push(`--loader:${h}=${Y(B[h],"loader",h)}`)}if(u)for(let h in u){if(h.indexOf("=")>=0)throw new Error(`Invalid out extension: ${h}`);l.push(`--out-extension:${h}=${Y(u[h],"out extension",h)}`)}if(q)if(Array.isArray(q))for(let h=0,re=q.length;h<re;h++){let H=q[h];if(typeof H=="object"&&H!==null){let ee=Object.create(null),ie=r(H,ee,"in",y),X=r(H,ee,"out",y);if(K(H,ee,"in entry point at index "+h),ie===void 0)throw new Error('Missing property "in" for entry point at index '+h);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+h);g.push([X,ie])}else g.push(["",Y(H,"entry point at index "+h)])}else for(let h in q)g.push([h,Y(q[h],"entry point",h)]);if(C){let h=Object.create(null),re=r(C,h,"contents",qe),H=r(C,h,"resolveDir",y),ee=r(C,h,"sourcefile",y),ie=r(C,h,"loader",y);K(C,h,'in "stdin" object'),ee&&l.push(`--sourcefile=${ee}`),ie&&l.push(`--loader=${ie}`),H&&(P=H),typeof re=="string"?d=Z(re):re instanceof Uint8Array&&(d=re)}let W=[];if(p)for(let h of p)h+="",W.push(h);return{entries:g,flags:l,write:N,stdinContents:d,stdinResolveDir:P,absWorkingDir:m,nodePaths:W,mangleCache:We(J)}}function at(e,t,n,i){let a=[],l=Object.create(null);Oe(a,t,l,n,i),ze(a,t,l);let g=r(t,l,"sourcemap",Le),s=r(t,l,"sourcefile",y),d=r(t,l,"loader",y),P=r(t,l,"banner",y),A=r(t,l,"footer",y),w=r(t,l,"mangleCache",Q);return K(t,l,`in ${e}() call`),g&&a.push(`--sourcemap=${g===!0?"external":g}`),s&&a.push(`--sourcefile=${s}`),d&&a.push(`--loader=${d}`),P&&a.push(`--banner=${P}`),A&&a.push(`--footer=${A}`),{flags:a,mangleCache:We(w)}}function Ke(e){let t={},n={didClose:!1,reason:""},i={},a=0,l=0,g=new Uint8Array(16*1024),s=0,d=v=>{let p=s+v.length;if(p>g.length){let o=new Uint8Array(p*2);o.set(g),g=o}g.set(v,s),s+=v.length;let f=0;for(;f+4<=s;){let o=Fe(g,f);if(f+4+o>s)break;f+=4,j(g.subarray(f,f+o)),f+=o}f>0&&(g.copyWithin(0,f,s),s-=f)},P=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let p="The service was stopped"+n.reason;for(let f in i)i[f](p,null);i={}},A=(v,p,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=a++;i[o]=(R,O)=>{try{f(R,O)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(Ae({id:o,isRequest:!0,value:p}))},w=(v,p)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Ae({id:v,isRequest:!1,value:p}))},U=(v,p)=>te(null,null,function*(){try{if(p.command==="ping"){w(v,{});return}if(typeof p.key=="number"){let f=t[p.key];if(!f)return;let o=f[p.command];if(o){yield o(v,p);return}}throw new Error("Invalid command: "+p.command)}catch(f){let o=[ae(f,e,null,void 0,"")];try{w(v,{errors:o})}catch(R){}}}),T=!0,j=v=>{if(T){T=!1;let f=String.fromCharCode(...v);if(f!=="0.25.7")throw new Error(`Cannot start service: Host version "0.25.7" does not match binary version ${_(f)}`);return}let p=Pe(v);if(p.isRequest)U(p.id,p.value);else{let f=i[p.id];delete i[p.id],p.value.error?f(p.value.error,{}):f(null,p.value)}};return{readFromStdout:d,afterClose:P,service:{buildOrContext:({callName:v,refs:p,options:f,isTTY:o,defaultWD:R,callback:O})=>{let $=0,B=l++,u={},c={ref(){++$===1&&p&&p.ref()},unref(){--$===0&&(delete t[B],p&&p.unref())}};t[B]=u,c.ref(),ut(v,B,A,w,c,e,u,f,o,R,(b,S)=>{try{O(b,S)}finally{c.unref()}})},transform:({callName:v,refs:p,input:f,options:o,isTTY:R,fs:O,callback:$})=>{let B=_e(),u=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:S}=at(v,o,R,De),F={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};S&&(F.mangleCache=S),A(p,F,(k,x)=>{if(k)return $(new Error(k),null);let M=ge(x.errors,B),q=ge(x.warnings,B),m=1,C=()=>{if(--m===0){let N={warnings:q,code:x.code,map:x.map,mangleCache:void 0,legalComments:void 0};"legalComments"in x&&(N.legalComments=x==null?void 0:x.legalComments),x.mangleCache&&(N.mangleCache=x==null?void 0:x.mangleCache),$(null,N)}};if(M.length>0)return $(me("Transform failed",M,q),null);x.codeFS&&(m++,O.readFile(x.code,(N,D)=>{N!==null?$(N,null):(x.code=D,C())})),x.mapFS&&(m++,O.readFile(x.map,(N,D)=>{N!==null?$(N,null):(x.map=D,C())})),C()})}catch(b){let S=[];try{Oe(S,o,{},R,De)}catch(k){}let F=ae(b,e,B,void 0,"");A(p,{command:"error",flags:S,error:F},()=>{F.detail=B.load(F.detail),$(me("Transform failed",[F],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=u;u=()=>O.writeFile(f,c)}u(null)},formatMessages:({callName:v,refs:p,messages:f,options:o,callback:R})=>{if(!o)throw new Error(`Missing second argument in ${v}() call`);let O={},$=r(o,O,"kind",y),B=r(o,O,"color",I),u=r(o,O,"terminalWidth",ue);if(K(o,O,`in ${v}() call`),$===void 0)throw new Error(`Missing "kind" in ${v}() call`);if($!=="error"&&$!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let c={command:"format-msgs",messages:se(f,"messages",null,"",u),isWarning:$==="warning"};B!==void 0&&(c.color=B),u!==void 0&&(c.terminalWidth=u),A(p,c,(b,S)=>{if(b)return R(new Error(b),null);R(null,S.messages)})},analyzeMetafile:({callName:v,refs:p,metafile:f,options:o,callback:R})=>{o===void 0&&(o={});let O={},$=r(o,O,"color",I),B=r(o,O,"verbose",I);K(o,O,`in ${v}() call`);let u={command:"analyze-metafile",metafile:f};$!==void 0&&(u.color=$),B!==void 0&&(u.verbose=B),A(p,u,(c,b)=>{if(c)return R(new Error(c),null);R(null,b.result)})}}}}function ut(e,t,n,i,a,l,g,s,d,P,A){let w=_e(),U=e==="context",T=(E,z)=>{let V=[];try{Oe(V,s,{},d,Te)}catch(p){}let v=ae(E,l,w,void 0,z);n(a,{command:"error",flags:V,error:v},()=>{v.detail=w.load(v.detail),A(me(U?"Context failed":"Build failed",[v],[]),null)})},j;if(typeof s=="object"){let E=s.plugins;if(E!==void 0){if(!Array.isArray(E))return T(new Error('"plugins" must be an array'),"");j=E}}if(j&&j.length>0){if(l.isSync)return T(new Error("Cannot use plugins in synchronous API calls"),"");ct(t,n,i,a,l,g,s,j,w).then(E=>{if(!E.ok)return T(E.error,E.pluginName);try{L(E.requestPlugins,E.runOnEndCallbacks,E.scheduleOnDisposeCallbacks)}catch(z){T(z,"")}},E=>T(E,""));return}try{L(null,(E,z)=>z([],[]),()=>{})}catch(E){T(E,"")}function L(E,z,V){let v=l.hasFS,{entries:p,flags:f,write:o,stdinContents:R,stdinResolveDir:O,absWorkingDir:$,nodePaths:B,mangleCache:u}=ot(e,s,d,Te,v);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:p,flags:f,write:o,stdinContents:R,stdinResolveDir:O,absWorkingDir:$||P,nodePaths:B,context:U};E&&(c.plugins=E),u&&(c.mangleCache=u);let b=(k,x)=>{let M={errors:ge(k.errors,w),warnings:ge(k.warnings,w),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=M.errors.slice(),m=M.warnings.slice();k.outputFiles&&(M.outputFiles=k.outputFiles.map(dt)),k.metafile&&(M.metafile=JSON.parse(k.metafile)),k.mangleCache&&(M.mangleCache=k.mangleCache),k.writeToStdout!==void 0&&console.log(oe(k.writeToStdout).replace(/\n$/,"")),z(M,(C,N)=>{if(q.length>0||C.length>0){let D=me("Build failed",q.concat(C),m.concat(N));return x(D,null,C,N)}x(null,M,C,N)})},S,F;U&&(g["on-end"]=(k,x)=>new Promise(M=>{b(x,(q,m,C,N)=>{let D={errors:C,warnings:N};F&&F(q,m),S=void 0,F=void 0,i(k,D),M()})})),n(a,c,(k,x)=>{if(k)return A(new Error(k),null);if(!U)return b(x,(m,C)=>(V(),A(m,C)));if(x.errors.length>0)return A(me("Context failed",x.errors,x.warnings),null);let M=!1,q={rebuild:()=>(S||(S=new Promise((m,C)=>{let N;F=(J,W)=>{N||(N=()=>J?C(J):m(W))};let D=()=>{n(a,{command:"rebuild",key:t},(W,ne)=>{W?C(new Error(W)):N?N():D()})};D()})),S),watch:(m={})=>new Promise((C,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let D={},J=r(m,D,"delay",ue);K(m,D,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(a,W,ne=>{ne?N(new Error(ne)):C(void 0)})}),serve:(m={})=>new Promise((C,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let D={},J=r(m,D,"port",nt),W=r(m,D,"host",y),ne=r(m,D,"servedir",y),h=r(m,D,"keyfile",y),re=r(m,D,"certfile",y),H=r(m,D,"fallback",y),ee=r(m,D,"cors",Q),ie=r(m,D,"onRequest",je);K(m,D,"in serve() call");let X={command:"serve",key:t,onRequest:!!ie};if(J!==void 0&&(X.port=J),W!==void 0&&(X.host=W),ne!==void 0&&(X.servedir=ne),h!==void 0&&(X.keyfile=h),re!==void 0&&(X.certfile=re),H!==void 0&&(X.fallback=H),ee){let pe={},fe=r(ee,pe,"origin",Ne);K(ee,pe,'on "cors" object'),Array.isArray(fe)?X.corsOrigin=fe:fe!==void 0&&(X.corsOrigin=[fe])}n(a,X,(pe,fe)=>{if(pe)return N(new Error(pe));ie&&(g["serve-request"]=(Je,Ye)=>{ie(Ye.args),i(Je,{})}),C(fe)})}),cancel:()=>new Promise(m=>{if(M)return m();n(a,{command:"cancel",key:t},()=>{m()})}),dispose:()=>new Promise(m=>{if(M)return m();M=!0,n(a,{command:"dispose",key:t},()=>{m(),V(),a.unref()})})};a.ref(),A(null,q)})}}var ct=(e,t,n,i,a,l,g,s,d)=>te(null,null,function*(){let P=[],A=[],w={},U={},T=[],j=0,L=0,E=[],z=!1;s=[...s];for(let p of s){let f={};if(typeof p!="object")throw new Error(`Plugin at index ${L} must be an object`);let o=r(p,f,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${L} is missing a name`);try{let R=r(p,f,"setup",je);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(p,f,`on plugin ${_(o)}`);let O={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};L++;let B=R({initialOptions:g,resolve:(u,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof u!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),S=r(c,b,"pluginName",y),F=r(c,b,"importer",y),k=r(c,b,"namespace",y),x=r(c,b,"resolveDir",y),M=r(c,b,"kind",y),q=r(c,b,"pluginData",ve),m=r(c,b,"with",Q);return K(c,b,"in resolve() call"),new Promise((C,N)=>{let D={command:"resolve",path:u,key:e,pluginName:o};if(S!=null&&(D.pluginName=S),F!=null&&(D.importer=F),k!=null&&(D.namespace=k),x!=null&&(D.resolveDir=x),M!=null)D.kind=M;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(D.pluginData=d.store(q)),m!=null&&(D.with=ft(m,"with")),t(i,D,(J,W)=>{J!==null?N(new Error(J)):C({errors:ge(W.errors,d),warnings:ge(W.warnings,d),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:d.load(W.pluginData)})})})},onStart(u){let c='This error came from the "onStart" callback registered here:',b=be(new Error(c),a,"onStart");P.push({name:o,callback:u,note:b}),O.onStart=!0},onEnd(u){let c='This error came from the "onEnd" callback registered here:',b=be(new Error(c),a,"onEnd");A.push({name:o,callback:u,note:b}),O.onEnd=!0},onResolve(u,c){let b='This error came from the "onResolve" callback registered here:',S=be(new Error(b),a,"onResolve"),F={},k=r(u,F,"filter",Re),x=r(u,F,"namespace",y);if(K(u,F,`in onResolve() call for plugin ${_(o)}`),k==null)throw new Error("onResolve() call is missing a filter");let M=j++;w[M]={name:o,callback:c,note:S},O.onResolve.push({id:M,filter:xe(k),namespace:x||""})},onLoad(u,c){let b='This error came from the "onLoad" callback registered here:',S=be(new Error(b),a,"onLoad"),F={},k=r(u,F,"filter",Re),x=r(u,F,"namespace",y);if(K(u,F,`in onLoad() call for plugin ${_(o)}`),k==null)throw new Error("onLoad() call is missing a filter");let M=j++;U[M]={name:o,callback:c,note:S},O.onLoad.push({id:M,filter:xe(k),namespace:x||""})},onDispose(u){T.push(u)},esbuild:a.esbuild});B&&(yield B),E.push(O)}catch(R){return{ok:!1,error:R,pluginName:o}}}l["on-start"]=(p,f)=>te(null,null,function*(){d.clear();let o={errors:[],warnings:[]};yield Promise.all(P.map(B=>te(null,[B],function*({name:R,callback:O,note:$}){try{let u=yield O();if(u!=null){if(typeof u!="object")throw new Error(`Expected onStart() callback in plugin ${_(R)} to return an object`);let c={},b=r(u,c,"errors",le),S=r(u,c,"warnings",le);K(u,c,`from onStart() callback in plugin ${_(R)}`),b!=null&&o.errors.push(...se(b,"errors",d,R,void 0)),S!=null&&o.warnings.push(...se(S,"warnings",d,R,void 0))}}catch(u){o.errors.push(ae(u,a,d,$&&$(),R))}}))),n(p,o)}),l["on-resolve"]=(p,f)=>te(null,null,function*(){let o={},R="",O,$;for(let B of f.ids)try{({name:R,callback:O,note:$}=w[B]);let u=yield O({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:d.load(f.pluginData),with:f.with});if(u!=null){if(typeof u!="object")throw new Error(`Expected onResolve() callback in plugin ${_(R)} to return an object`);let c={},b=r(u,c,"pluginName",y),S=r(u,c,"path",y),F=r(u,c,"namespace",y),k=r(u,c,"suffix",y),x=r(u,c,"external",I),M=r(u,c,"sideEffects",I),q=r(u,c,"pluginData",ve),m=r(u,c,"errors",le),C=r(u,c,"warnings",le),N=r(u,c,"watchFiles",G),D=r(u,c,"watchDirs",G);K(u,c,`from onResolve() callback in plugin ${_(R)}`),o.id=B,b!=null&&(o.pluginName=b),S!=null&&(o.path=S),F!=null&&(o.namespace=F),k!=null&&(o.suffix=k),x!=null&&(o.external=x),M!=null&&(o.sideEffects=M),q!=null&&(o.pluginData=d.store(q)),m!=null&&(o.errors=se(m,"errors",d,R,void 0)),C!=null&&(o.warnings=se(C,"warnings",d,R,void 0)),N!=null&&(o.watchFiles=we(N,"watchFiles")),D!=null&&(o.watchDirs=we(D,"watchDirs"));break}}catch(u){o={id:B,errors:[ae(u,a,d,$&&$(),R)]};break}n(p,o)}),l["on-load"]=(p,f)=>te(null,null,function*(){let o={},R="",O,$;for(let B of f.ids)try{({name:R,callback:O,note:$}=U[B]);let u=yield O({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:d.load(f.pluginData),with:f.with});if(u!=null){if(typeof u!="object")throw new Error(`Expected onLoad() callback in plugin ${_(R)} to return an object`);let c={},b=r(u,c,"pluginName",y),S=r(u,c,"contents",qe),F=r(u,c,"resolveDir",y),k=r(u,c,"pluginData",ve),x=r(u,c,"loader",y),M=r(u,c,"errors",le),q=r(u,c,"warnings",le),m=r(u,c,"watchFiles",G),C=r(u,c,"watchDirs",G);K(u,c,`from onLoad() callback in plugin ${_(R)}`),o.id=B,b!=null&&(o.pluginName=b),S instanceof Uint8Array?o.contents=S:S!=null&&(o.contents=Z(S)),F!=null&&(o.resolveDir=F),k!=null&&(o.pluginData=d.store(k)),x!=null&&(o.loader=x),M!=null&&(o.errors=se(M,"errors",d,R,void 0)),q!=null&&(o.warnings=se(q,"warnings",d,R,void 0)),m!=null&&(o.watchFiles=we(m,"watchFiles")),C!=null&&(o.watchDirs=we(C,"watchDirs"));break}}catch(u){o={id:B,errors:[ae(u,a,d,$&&$(),R)]};break}n(p,o)});let V=(p,f)=>f([],[]);A.length>0&&(V=(p,f)=>{te(null,null,function*(){let o=[],R=[];for(let{name:O,callback:$,note:B}of A){let u,c;try{let b=yield $(p);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${_(O)} to return an object`);let S={},F=r(b,S,"errors",le),k=r(b,S,"warnings",le);K(b,S,`from onEnd() callback in plugin ${_(O)}`),F!=null&&(u=se(F,"errors",d,O,void 0)),k!=null&&(c=se(k,"warnings",d,O,void 0))}}catch(b){u=[ae(b,a,d,B&&B(),O)]}if(u){o.push(...u);try{p.errors.push(...u)}catch(b){}}if(c){R.push(...c);try{p.warnings.push(...c)}catch(b){}}}f(o,R)})});let v=()=>{for(let p of T)setTimeout(()=>p(),0)};return z=!0,{ok:!0,requestPlugins:E,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:v}});function _e(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function be(e,t,n){let i,a=!1;return()=>{if(a)return i;a=!0;try{let l=(e.stack+"").split(`
|
|
8
|
+
`);l.splice(1,1);let g=Ve(t,l,n);if(g)return i={text:e.message,location:g},i}catch(l){}}}function ae(e,t,n,i,a){let l="Internal error",g=null;try{l=(e&&e.message||e)+""}catch(s){}try{g=Ve(t,(e.stack+"").split(`
|
|
9
|
+
`),"")}catch(s){}return{id:"",pluginName:a,text:l,location:g,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ve(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let a=1;a<t.length;a++){let l=t[a];if(l.startsWith(i))for(l=l.slice(i.length);;){let g=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(g){l=g[1];continue}if(g=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),g){l=g[1];continue}if(g=/^(\S+):(\d+):(\d+)$/.exec(l),g){let s;try{s=e.readFileSync(g[1],"utf8")}catch(w){break}let d=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+g[2]-1]||"",P=+g[3]-1,A=d.slice(P,P+n.length)===n?n.length:0;return{file:g[1],namespace:"file",line:+g[2],column:Z(d.slice(0,P)).length,length:Z(d.slice(P,P+A)).length,lineText:d+`
|
|
10
10
|
`+t.slice(1).join(`
|
|
11
11
|
`),suggestion:""}}break}}return null}function me(e,t,n){let i=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((l,g)=>{if(g===i)return`
|
|
12
12
|
...`;if(!l.location)return`
|
|
13
13
|
error: ${l.text}`;let{file:s,line:d,column:P}=l.location,A=l.pluginName?`[plugin: ${l.pluginName}] `:"";return`
|
|
14
|
-
${s}:${d}:${P}: ERROR: ${A}${l.text}`}).join("");let a=new Error(e);for(let[l,g]of[["errors",t],["warnings",n]])Object.defineProperty(a,l,{configurable:!0,enumerable:!0,get:()=>g,set:s=>Object.defineProperty(a,l,{configurable:!0,enumerable:!0,value:s})});return a}function de(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ue(e,t,n){if(e==null)return null;let i={},a=r(e,i,"file",m),l=r(e,i,"namespace",m),g=r(e,i,"line",fe),s=r(e,i,"column",fe),d=r(e,i,"length",fe),P=r(e,i,"lineText",m),A=r(e,i,"suggestion",m);if(K(e,i,t),P){let b=P.slice(0,(s&&s>0?s:0)+(d&&d>0?d:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(b)&&!/\n/.test(P)&&(P=b)}return{file:a||"",namespace:l||"",line:g||0,column:s||0,length:d||0,lineText:P||"",suggestion:A||""}}function le(e,t,n,i,a){let l=[],g=0;for(let s of e){let d={},P=r(s,d,"id",m),A=r(s,d,"pluginName",m),b=r(s,d,"text",m),j=r(s,d,"location",Be),T=r(s,d,"notes",ie),L=r(s,d,"detail",ve),N=`in element ${g} of "${t}"`;K(s,d,N);let S=[];if(T)for(let z of T){let V={},w=r(z,V,"text",m),p=r(z,V,"location",Be);K(z,V,N),S.push({text:w||"",location:Ue(p,N,a)})}l.push({id:P||"",pluginName:A||i,text:b||"",location:Ue(j,N,a),notes:S,detail:n?n.store(L):-1}),g++}return l}function we(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${_(t)} must be an array of strings`);n.push(i)}return n}function ft(e,t){let n=Object.create(null);for(let i in e){let a=e[i];if(typeof a!="string")throw new Error(`key ${_(i)} in object ${_(t)} must be a string`);n[i]=a}return n}function dt({path:e,contents:t,hash:n}){let i=null;return{path:e,contents:t,hash:n,get text(){let a=this.contents;return(i===null||a!==t)&&(t=a,i=se(a)),i}}}function xe(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var pt="0.25.5",mt=e=>ye().build(e),yt=e=>ye().context(e),ht=(e,t)=>ye().transform(e,t),bt=(e,t)=>ye().formatMessages(e,t),wt=(e,t)=>ye().analyzeMetafile(e,t),vt=()=>{throw new Error('The "buildSync" API only works in node')},Rt=()=>{throw new Error('The "transformSync" API only works in node')},xt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Ot=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Et=()=>(Ee&&Ee(),Promise.resolve()),ae,Ee,Se,ye=()=>{if(Se)return Se;throw ae?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')},St=e=>{e=Ie(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ae)throw new Error('Cannot call "initialize" more than once');return ae=kt(t||"",n,i),ae.catch(()=>{ae=void 0}),ae},kt=(e,t,n)=>te(null,null,function*(){let i,a,l=new Promise(b=>a=b);if(n){let b=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 b=(i,f,d)=>new Promise((c,r)=>{var s=u=>{try{o(d.next(u))}catch(m){r(m)}},n=u=>{try{o(d.throw(u))}catch(m){r(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(i,f)).next())});let onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){c+=d.decode(s);const n=c.lastIndexOf(`\n`);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(r,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,u,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),d=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 c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,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 r=4096;const s=g=>{const e=r,t=f.encode(g+"\\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=r;if(o.forEach(g=>{this.mem.setUint32(r,g,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),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(c){const r=this;return function(){const s={id:c,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:u})=>(u.length>0&&(r.push(u),s&&s()),o),d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=r[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.5"],tryToInstantiateModule(i,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)}),o};function tryToInstantiateModule(i,f){return b(this,null,function*(){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const d=yield fetch(i);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return i=>onmessage(i);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
|
|
14
|
+
${s}:${d}:${P}: ERROR: ${A}${l.text}`}).join("");let a=new Error(e);for(let[l,g]of[["errors",t],["warnings",n]])Object.defineProperty(a,l,{configurable:!0,enumerable:!0,get:()=>g,set:s=>Object.defineProperty(a,l,{configurable:!0,enumerable:!0,value:s})});return a}function ge(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ue(e,t,n){if(e==null)return null;let i={},a=r(e,i,"file",y),l=r(e,i,"namespace",y),g=r(e,i,"line",ue),s=r(e,i,"column",ue),d=r(e,i,"length",ue),P=r(e,i,"lineText",y),A=r(e,i,"suggestion",y);if(K(e,i,t),P){let w=P.slice(0,(s&&s>0?s:0)+(d&&d>0?d:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(w)&&!/\n/.test(P)&&(P=w)}return{file:a||"",namespace:l||"",line:g||0,column:s||0,length:d||0,lineText:P||"",suggestion:A||""}}function se(e,t,n,i,a){let l=[],g=0;for(let s of e){let d={},P=r(s,d,"id",y),A=r(s,d,"pluginName",y),w=r(s,d,"text",y),U=r(s,d,"location",Be),T=r(s,d,"notes",le),j=r(s,d,"detail",ve),L=`in element ${g} of "${t}"`;K(s,d,L);let E=[];if(T)for(let z of T){let V={},v=r(z,V,"text",y),p=r(z,V,"location",Be);K(z,V,L),E.push({text:v||"",location:Ue(p,L,a)})}l.push({id:P||"",pluginName:A||i,text:w||"",location:Ue(U,L,a),notes:E,detail:n?n.store(j):-1}),g++}return l}function we(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${_(t)} must be an array of strings`);n.push(i)}return n}function ft(e,t){let n=Object.create(null);for(let i in e){let a=e[i];if(typeof a!="string")throw new Error(`key ${_(i)} in object ${_(t)} must be a string`);n[i]=a}return n}function dt({path:e,contents:t,hash:n}){let i=null;return{path:e,contents:t,hash:n,get text(){let a=this.contents;return(i===null||a!==t)&&(t=a,i=oe(a)),i}}}function xe(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var pt="0.25.7",mt=e=>ye().build(e),yt=e=>ye().context(e),ht=(e,t)=>ye().transform(e,t),bt=(e,t)=>ye().formatMessages(e,t),wt=(e,t)=>ye().analyzeMetafile(e,t),vt=()=>{throw new Error('The "buildSync" API only works in node')},Rt=()=>{throw new Error('The "transformSync" API only works in node')},xt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Ot=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Et=()=>(Ee&&Ee(),Promise.resolve()),ce,Ee,Se,ye=()=>{if(Se)return Se;throw ce?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')},St=e=>{e=Ie(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ce)throw new Error('Cannot call "initialize" more than once');return ce=kt(t||"",n,i),ce.catch(()=>{ce=void 0}),ce},kt=(e,t,n)=>te(null,null,function*(){let i,a,l=new Promise(w=>a=w);if(n){let w=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 b=(i,f,d)=>new Promise((c,r)=>{var s=u=>{try{o(d.next(u))}catch(m){r(m)}},n=u=>{try{o(d.throw(u))}catch(m){r(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(i,f)).next())});let onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){c+=d.decode(s);const n=c.lastIndexOf(`\n`);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(r,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,u,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),d=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 c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,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 r=4096;const s=g=>{const e=r,t=f.encode(g+"\\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=r;if(o.forEach(g=>{this.mem.setUint32(r,g,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),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(c){const r=this;return function(){const s={id:c,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:u})=>(u.length>0&&(r.push(u),s&&s()),o),d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=r[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.7"],tryToInstantiateModule(i,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)}),o};function tryToInstantiateModule(i,f){return b(this,null,function*(){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const d=yield fetch(i);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return i=>onmessage(i);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
|
|
15
15
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
16
16
|
// Use of this source code is governed by a BSD-style
|
|
17
17
|
// license that can be found in the LICENSE file.
|
|
18
18
|
var b=(i,f,d)=>new Promise((c,r)=>{var s=u=>{try{o(d.next(u))}catch(m){r(m)}},n=u=>{try{o(d.throw(u))}catch(m){r(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(i,f)).next())});let onmessage,globalThis={};for(let i=self;i;i=Object.getPrototypeOf(i))for(let f of Object.getOwnPropertyNames(i))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const i=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(r,s){c+=d.decode(s);const n=c.lastIndexOf(`
|
|
19
19
|
`);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(r,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(i());return}const h=this.writeSync(r,s);m(null,h)},chmod(r,s,n){n(i())},chown(r,s,n,o){o(i())},close(r,s){s(i())},fchmod(r,s,n){n(i())},fchown(r,s,n,o){o(i())},fstat(r,s){s(i())},fsync(r,s){s(null)},ftruncate(r,s,n){n(i())},lchown(r,s,n,o){o(i())},link(r,s,n){n(i())},lstat(r,s){s(i())},mkdir(r,s,n){n(i())},open(r,s,n,o){o(i())},read(r,s,n,o,u,m){m(i())},readdir(r,s){s(i())},readlink(r,s){s(i())},rename(r,s,n){n(i())},rmdir(r,s){s(i())},stat(r,s){s(i())},symlink(r,s,n){n(i())},truncate(r,s,n){n(i())},unlink(r,s){s(i())},utimes(r,s,n,o){o(i())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw i()},pid:-1,ppid:-1,umask(){throw i()},cwd(){throw i()},chdir(){throw i()}}),!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 f=new TextEncoder("utf-8"),d=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 c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},r=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(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 y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);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=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);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()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,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 r=4096;const s=g=>{const e=r,t=f.encode(g+"\0");return new Uint8Array(this.mem.buffer,r,t.length).set(t),r+=t.length,r%8!==0&&(r+=8-r%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=r;if(o.forEach(g=>{this.mem.setUint32(r,g,!0),this.mem.setUint32(r+4,0,!0),r+=8}),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),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(c){const r=this;return function(){const s={id:c,this:this,args:arguments};return r._pendingEvent=s,r._resume(),s.result}}}})(),onmessage=({data:i})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`
|
|
20
20
|
`);h.length>1&&console.log(h.slice(0,-1).join(`
|
|
21
|
-
`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:u})=>(u.length>0&&(r.push(u),s&&s()),o),d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=r[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.
|
|
21
|
+
`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let r=[],s,n=0;onmessage=({data:u})=>(u.length>0&&(r.push(u),s&&s()),o),d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(r.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=r[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(r.shift(),n=0),t(null,a)};let o=new globalThis.Go;return o.argv=["","--service=0.25.7"],tryToInstantiateModule(i,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)}),o};function tryToInstantiateModule(i,f){return b(this,null,function*(){if(i instanceof WebAssembly.Module)return WebAssembly.instantiate(i,f.importObject);const d=yield fetch(i);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(i)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return i=>onmessage(i);})(T=>i.onmessage({data:T})),U;i={onmessage:null,postMessage:T=>setTimeout(()=>{try{U=w({data:T})}catch(j){a(j)}}),terminate(){if(U)for(let T of U._scheduledTimeouts.values())clearTimeout(T)}}}let g,s,d=new Promise((w,U)=>{g=w,s=U});i.onmessage=({data:w})=>{i.onmessage=({data:U})=>P(U),w?s(w):g()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:P,service:A}=Ke({writeToStdin(w){i.postMessage(w)},isSync:!1,hasFS:!1,esbuild:ke});yield d,Ee=()=>{i.terminate(),ce=void 0,Ee=void 0,Se=void 0},Se={build:w=>new Promise((U,T)=>{l.then(T),A.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,L)=>j?T(j):U(L)})}),context:w=>new Promise((U,T)=>{l.then(T),A.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,L)=>j?T(j):U(L)})}),transform:(w,U)=>new Promise((T,j)=>{l.then(j),A.transform({callName:"transform",refs:null,input:w,options:U||{},isTTY:!1,fs:{readFile(L,E){E(new Error("Internal error"),null)},writeFile(L,E){E(null)}},callback:(L,E)=>L?j(L):T(E)})}),formatMessages:(w,U)=>new Promise((T,j)=>{l.then(j),A.formatMessages({callName:"formatMessages",refs:null,messages:w,options:U,callback:(L,E)=>L?j(L):T(E)})}),analyzeMetafile:(w,U)=>new Promise((T,j)=>{l.then(j),A.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:U,callback:(L,E)=>L?j(L):T(E)})})}}),$t=ke;
|
|
22
22
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
package/lib/main.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | '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'
|
|
7
|
+
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
7
8
|
|
|
8
9
|
interface CommonOptions {
|
|
9
10
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
@@ -75,6 +76,8 @@ interface CommonOptions {
|
|
|
75
76
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
76
77
|
keepNames?: boolean
|
|
77
78
|
|
|
79
|
+
/** Documentation: https://esbuild.github.io/api/#abs-paths */
|
|
80
|
+
absPaths?: AbsPaths[]
|
|
78
81
|
/** Documentation: https://esbuild.github.io/api/#color */
|
|
79
82
|
color?: boolean
|
|
80
83
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
@@ -159,7 +162,7 @@ export interface BuildOptions extends CommonOptions {
|
|
|
159
162
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
160
163
|
footer?: { [type: string]: string }
|
|
161
164
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
162
|
-
entryPoints?: string
|
|
165
|
+
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
|
|
163
166
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
164
167
|
stdin?: StdinOptions
|
|
165
168
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
@@ -513,7 +516,9 @@ export interface AnalyzeMetafileOptions {
|
|
|
513
516
|
verbose?: boolean
|
|
514
517
|
}
|
|
515
518
|
|
|
519
|
+
/** Documentation: https://esbuild.github.io/api/#watch-arguments */
|
|
516
520
|
export interface WatchOptions {
|
|
521
|
+
delay?: number // In milliseconds
|
|
517
522
|
}
|
|
518
523
|
|
|
519
524
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
package/lib/main.js
CHANGED
|
@@ -325,6 +325,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
325
325
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
|
326
326
|
let platform = getFlag(options, keys, "platform", mustBeString);
|
|
327
327
|
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
|
328
|
+
let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
|
|
328
329
|
if (legalComments) flags.push(`--legal-comments=${legalComments}`);
|
|
329
330
|
if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
|
|
330
331
|
if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
|
|
@@ -343,6 +344,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
|
343
344
|
if (ignoreAnnotations) flags.push(`--ignore-annotations`);
|
|
344
345
|
if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
|
345
346
|
if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
|
|
347
|
+
if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
|
|
346
348
|
if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
|
|
347
349
|
if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
|
|
348
350
|
if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
|
|
@@ -631,8 +633,8 @@ function createChannel(streamIn) {
|
|
|
631
633
|
if (isFirstPacket) {
|
|
632
634
|
isFirstPacket = false;
|
|
633
635
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
634
|
-
if (binaryVersion !== "0.25.
|
|
635
|
-
throw new Error(`Cannot start service: Host version "${"0.25.
|
|
636
|
+
if (binaryVersion !== "0.25.7") {
|
|
637
|
+
throw new Error(`Cannot start service: Host version "${"0.25.7"}" does not match binary version ${quote(binaryVersion)}`);
|
|
636
638
|
}
|
|
637
639
|
return;
|
|
638
640
|
}
|
|
@@ -974,11 +976,13 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
974
976
|
watch: (options2 = {}) => new Promise((resolve, reject) => {
|
|
975
977
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
976
978
|
const keys = {};
|
|
979
|
+
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
977
980
|
checkForInvalidFlags(options2, keys, `in watch() call`);
|
|
978
981
|
const request2 = {
|
|
979
982
|
command: "watch",
|
|
980
983
|
key: buildKey
|
|
981
984
|
};
|
|
985
|
+
if (delay) request2.delay = delay;
|
|
982
986
|
sendRequest(refs, request2, (error2) => {
|
|
983
987
|
if (error2) reject(new Error(error2));
|
|
984
988
|
else resolve(void 0);
|
|
@@ -1606,7 +1610,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
|
1606
1610
|
}
|
|
1607
1611
|
}
|
|
1608
1612
|
var _a;
|
|
1609
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.25.
|
|
1613
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.25.7";
|
|
1610
1614
|
var esbuildCommandAndArgs = () => {
|
|
1611
1615
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
1612
1616
|
throw new Error(
|
|
@@ -1673,7 +1677,7 @@ var fsAsync = {
|
|
|
1673
1677
|
}
|
|
1674
1678
|
}
|
|
1675
1679
|
};
|
|
1676
|
-
var version = "0.25.
|
|
1680
|
+
var version = "0.25.7";
|
|
1677
1681
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1678
1682
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
1679
1683
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1776,7 +1780,7 @@ var stopService;
|
|
|
1776
1780
|
var ensureServiceIsRunning = () => {
|
|
1777
1781
|
if (longLivedService) return longLivedService;
|
|
1778
1782
|
let [command, args] = esbuildCommandAndArgs();
|
|
1779
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.25.
|
|
1783
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.25.7"}`, "--ping"), {
|
|
1780
1784
|
windowsHide: true,
|
|
1781
1785
|
stdio: ["pipe", "pipe", "inherit"],
|
|
1782
1786
|
cwd: defaultWD
|
|
@@ -1880,7 +1884,7 @@ var runServiceSync = (callback) => {
|
|
|
1880
1884
|
esbuild: node_exports
|
|
1881
1885
|
});
|
|
1882
1886
|
callback(service);
|
|
1883
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.25.
|
|
1887
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.25.7"}`), {
|
|
1884
1888
|
cwd: defaultWD,
|
|
1885
1889
|
windowsHide: true,
|
|
1886
1890
|
input: stdin,
|
|
@@ -1900,7 +1904,7 @@ var workerThreadService = null;
|
|
|
1900
1904
|
var startWorkerThreadService = (worker_threads2) => {
|
|
1901
1905
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
1902
1906
|
let worker = new worker_threads2.Worker(__filename, {
|
|
1903
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.25.
|
|
1907
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.25.7" },
|
|
1904
1908
|
transferList: [workerPort],
|
|
1905
1909
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
1906
1910
|
//
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esbuild-wasm-strapkit",
|
|
3
|
-
"version": "0.25.
|
|
4
|
-
"esbuildVersion": "0.25.
|
|
5
|
-
"description": "esbuild-wasm 0.25.
|
|
3
|
+
"version": "0.25.7-build.3",
|
|
4
|
+
"esbuildVersion": "0.25.7",
|
|
5
|
+
"description": "esbuild-wasm 0.25.7",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=18"
|