esbuild-wasm-strapkit 0.28.0-build.1 → 0.28.2-build.1
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/README.md +3 -3
- package/esbuild.wasm +0 -0
- package/esm/browser.d.ts +4 -0
- package/esm/browser.js +9 -5
- package/esm/browser.min.js +3 -3
- package/lib/browser.d.ts +4 -0
- package/lib/browser.js +9 -5
- package/lib/browser.min.js +7 -7
- package/lib/main.d.ts +4 -0
- package/lib/main.js +11 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# esbuild-wasm-strapkit
|
|
2
2
|
|
|
3
|
-
[esbuild-wasm](https://www.npmjs.com/package/esbuild-wasm) **0.28.
|
|
3
|
+
[esbuild-wasm](https://www.npmjs.com/package/esbuild-wasm) **0.28.2**, unchanged,
|
|
4
4
|
compiled with a Go toolchain patched to target 64-bit wasm memory (memory64), so
|
|
5
5
|
the esbuild service isn't capped at a 4GB heap on large projects. The API is
|
|
6
6
|
esbuild-wasm's; use it as a drop-in alias:
|
|
7
7
|
|
|
8
|
-
npm install esbuild-wasm@npm:esbuild-wasm-strapkit@esbuild-0.28.
|
|
8
|
+
npm install esbuild-wasm@npm:esbuild-wasm-strapkit@esbuild-0.28.2
|
|
9
9
|
|
|
10
10
|
The runtime needs wasm memory64: Chrome 133+, Firefox 134+, Node 24+ (or a Node
|
|
11
11
|
22 that enables it by default).
|
|
12
12
|
|
|
13
13
|
The `-build.N` suffix only changes when this build is refreshed; the
|
|
14
|
-
`esbuild-0.28.
|
|
14
|
+
`esbuild-0.28.2` tag always points at the newest build.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
package/esbuild.wasm
CHANGED
|
Binary file
|
package/esm/browser.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type Platform = 'browser' | 'node' | 'neutral'
|
|
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
3
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
export type LogStyle = 'default' | 'visualstudio'
|
|
5
6
|
export type Charset = 'ascii' | 'utf8'
|
|
6
7
|
export type Drop = 'console' | 'debugger'
|
|
7
8
|
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
@@ -86,6 +87,8 @@ interface CommonOptions {
|
|
|
86
87
|
logLimit?: number
|
|
87
88
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
88
89
|
logOverride?: Record<string, LogLevel>
|
|
90
|
+
/** Documentation: https://esbuild.github.io/api/#log-style */
|
|
91
|
+
logStyle?: LogStyle
|
|
89
92
|
|
|
90
93
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
|
91
94
|
tsconfigRaw?: string | TsconfigRaw
|
|
@@ -509,6 +512,7 @@ export interface FormatMessagesOptions {
|
|
|
509
512
|
kind: 'error' | 'warning'
|
|
510
513
|
color?: boolean
|
|
511
514
|
terminalWidth?: number
|
|
515
|
+
logStyle?: LogStyle
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
export interface AnalyzeMetafileOptions {
|
package/esm/browser.js
CHANGED
|
@@ -548,10 +548,12 @@ function pushLogFlags(flags, options, keys, isTTY, logLevelDefault) {
|
|
|
548
548
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
549
549
|
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
550
550
|
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
551
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
551
552
|
if (color !== void 0) flags.push(`--color=${color}`);
|
|
552
553
|
else if (isTTY) flags.push(`--color=true`);
|
|
553
554
|
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
554
555
|
flags.push(`--log-limit=${logLimit || 0}`);
|
|
556
|
+
if (logStyle) flags.push(`--log-style=${logStyle}`);
|
|
555
557
|
}
|
|
556
558
|
function validateStringValue(value, what, key) {
|
|
557
559
|
if (typeof value !== "string") {
|
|
@@ -900,8 +902,8 @@ function createChannel(streamIn) {
|
|
|
900
902
|
if (isFirstPacket) {
|
|
901
903
|
isFirstPacket = false;
|
|
902
904
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
903
|
-
if (binaryVersion !== "0.28.
|
|
904
|
-
throw new Error(`Cannot start service: Host version "${"0.28.
|
|
905
|
+
if (binaryVersion !== "0.28.2") {
|
|
906
|
+
throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`);
|
|
905
907
|
}
|
|
906
908
|
return;
|
|
907
909
|
}
|
|
@@ -1040,6 +1042,7 @@ function createChannel(streamIn) {
|
|
|
1040
1042
|
let kind = getFlag(options, keys, "kind", mustBeString);
|
|
1041
1043
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
1042
1044
|
let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
|
|
1045
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
1043
1046
|
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
1044
1047
|
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
1045
1048
|
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
@@ -1050,6 +1053,7 @@ function createChannel(streamIn) {
|
|
|
1050
1053
|
};
|
|
1051
1054
|
if (color !== void 0) request.color = color;
|
|
1052
1055
|
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
1056
|
+
if (logStyle !== void 0) request.logStyle = logStyle;
|
|
1053
1057
|
sendRequest(refs, request, (error, response) => {
|
|
1054
1058
|
if (error) return callback(new Error(error), null);
|
|
1055
1059
|
callback(null, response.messages);
|
|
@@ -1859,7 +1863,7 @@ function parseJSON(bytes) {
|
|
|
1859
1863
|
}
|
|
1860
1864
|
|
|
1861
1865
|
// lib/npm/browser.ts
|
|
1862
|
-
var version = "0.28.
|
|
1866
|
+
var version = "0.28.2";
|
|
1863
1867
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1864
1868
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1865
1869
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1907,7 +1911,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
|
1907
1911
|
let rejectAllWith;
|
|
1908
1912
|
const rejectAllPromise = new Promise((resolve) => rejectAllWith = resolve);
|
|
1909
1913
|
if (useWorker) {
|
|
1910
|
-
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.28.0"}`];\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" });
|
|
1914
|
+
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.28.2"}`];\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" });
|
|
1911
1915
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1912
1916
|
} else {
|
|
1913
1917
|
let onmessage = ((postMessage) => {
|
|
@@ -2525,7 +2529,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
|
2525
2529
|
callback(null, count);
|
|
2526
2530
|
};
|
|
2527
2531
|
let go = new globalThis.Go();
|
|
2528
|
-
go.argv = ["", `--service=${"0.28.
|
|
2532
|
+
go.argv = ["", `--service=${"0.28.2"}`];
|
|
2529
2533
|
tryToInstantiateModule(wasm, go).then(
|
|
2530
2534
|
(instance) => {
|
|
2531
2535
|
postMessage(null);
|
package/esm/browser.min.js
CHANGED
|
@@ -4,18 +4,18 @@ 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
6
|
`);function Fe(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Ae(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var le=String.fromCharCode;function ee(e,t,n){let i=e[t],u=1,l=0;for(let f=0;f<t;f++)e[f]===10?(u++,l=0):l++;throw new SyntaxError(n||(t===e.length?"Unexpected end of input while parsing JSON":i>=32&&i<=126?`Unexpected character ${le(i)} in JSON at position ${t} (line ${u}, column ${l})`:`Unexpected byte 0x${i.toString(16)} in JSON at position ${t} (line ${u}, column ${l})`))}function Be(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let t=[],n=[],i=[],u=e.length,l=null,f=0,s,o=0;for(;o<u;){let m=e[o++];if(m<=32)continue;let p;switch(f===2&&l===null&&m!==34&&m!==125&&ee(e,--o),m){case 116:{(e[o++]!==114||e[o++]!==117||e[o++]!==101)&&ee(e,--o),p=!0;break}case 102:{(e[o++]!==97||e[o++]!==108||e[o++]!==115||e[o++]!==101)&&ee(e,--o),p=!1;break}case 110:{(e[o++]!==117||e[o++]!==108||e[o++]!==108)&&ee(e,--o),p=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let y=o;for(p=le(m),m=e[o];;){switch(m){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{p+=le(m),m=e[++o];continue}}break}p=+p,isNaN(p)&&ee(e,--y,"Invalid number");break}case 34:{for(p="";o>=u&&ee(e,u),m=e[o++],m!==34;)if(m===92)switch(e[o++]){case 34:p+='"';break;case 47:p+="/";break;case 92:p+="\\";break;case 98:p+="\b";break;case 102:p+="\f";break;case 110:p+=`
|
|
7
|
-
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:{let y=0;for(let P=0;P<4;P++)m=e[o++],y<<=4,m>=48&&m<=57?y|=m-48:m>=97&&m<=102?y|=m+-87:m>=65&&m<=70?y|=m+-55:ee(e,--o);p+=le(y);break}default:ee(e,--o);break}else if(m<=127)p+=le(m);else if((m&224)===192)p+=le((m&31)<<6|e[o++]&63);else if((m&240)===224)p+=le((m&15)<<12|(e[o++]&63)<<6|e[o++]&63);else if((m&248)==240){let y=(m&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;y>65535&&(y-=65536,p+=le(y>>10&1023|55296),y=56320|y&1023),p+=le(y)}p[0];break}case 91:{p=[],t.push(l),n.push(s),i.push(f),l=null,s=p,f=1;continue}case 123:{p={},t.push(l),n.push(s),i.push(f),l=null,s=p,f=2;continue}case 93:{f!==1&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}case 125:{f!==2&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}default:ee(e,--o)}for(m=e[o];m<=32;)m=e[++o];switch(f){case 0:{if(o===u)return p;break}case 1:{if(s.push(p),m===44){o++;continue}if(m===93)continue;break}case 2:{if(l===null){if(l=p,m===58){o++;continue}}else{if(s[l]=p,l=null,m===44){o++;continue}if(m===125)continue}break}}break}ee(e,o)}var _=JSON.stringify,Le="warning",Ue="silent";function pe(e,t){let n=[];for(let i of e){if(Q(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",b=e=>typeof e=="string"?null:"a string",Re=e=>e instanceof RegExp?null:"a RegExp object",ce=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ze=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",je=e=>typeof e=="function"?null:"a function",oe=e=>Array.isArray(e)?null:"an array",Y=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",et=e=>typeof e=="object"&&e!==null?null:"an array or an object",tt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Pe=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ne=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",nt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",qe=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",Ie=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",rt=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 We(e){let t=Object.create(null),n=r(e,t,"wasmURL",rt),i=r(e,t,"wasmModule",tt),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function ze(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 Se(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",b),s=r(t,n,"logLimit",ce);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`)}function Q(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 Ke(e,t,n){let i=r(t,n,"legalComments",b),u=r(t,n,"sourceRoot",b),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",qe),s=r(t,n,"format",b),o=r(t,n,"globalName",b),m=r(t,n,"mangleProps",Re),p=r(t,n,"reserveProps",Re),y=r(t,n,"mangleQuoted",I),P=r(t,n,"minify",I),L=r(t,n,"minifySyntax",I),T=r(t,n,"minifyWhitespace",I),j=r(t,n,"minifyIdentifiers",I),C=r(t,n,"lineLimit",ce),z=r(t,n,"drop",Y),V=r(t,n,"dropLabels",Y),R=r(t,n,"charset",b),h=r(t,n,"treeShaking",I),g=r(t,n,"ignoreAnnotations",I),a=r(t,n,"jsx",b),O=r(t,n,"jsxFactory",b),E=r(t,n,"jsxFragment",b),A=r(t,n,"jsxImportSource",b),k=r(t,n,"jsxDev",I),c=r(t,n,"jsxSideEffects",I),d=r(t,n,"define",G),v=r(t,n,"logOverride",G),D=r(t,n,"supported",G),B=r(t,n,"pure",Y),$=r(t,n,"keepNames",I),S=r(t,n,"platform",b),F=r(t,n,"tsconfigRaw",nt),q=r(t,n,"absPaths",Y);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&e.push(`--target=${pe(Array.isArray(f)?f:[f],"target")}`),s&&e.push(`--format=${s}`),o&&e.push(`--global-name=${o}`),S&&e.push(`--platform=${S}`),F&&e.push(`--tsconfig-raw=${typeof F=="string"?F:JSON.stringify(F)}`),P&&e.push("--minify"),L&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),j&&e.push("--minify-identifiers"),C&&e.push(`--line-limit=${C}`),R&&e.push(`--charset=${R}`),h!==void 0&&e.push(`--tree-shaking=${h}`),g&&e.push("--ignore-annotations"),z)for(let w of z)e.push(`--drop:${Q(w,"drop")}`);if(V&&e.push(`--drop-labels=${pe(V,"drop label")}`),q&&e.push(`--abs-paths=${pe(q,"abs paths")}`),m&&e.push(`--mangle-props=${Oe(m)}`),p&&e.push(`--reserve-props=${Oe(p)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),a&&e.push(`--jsx=${a}`),O&&e.push(`--jsx-factory=${O}`),E&&e.push(`--jsx-fragment=${E}`),A&&e.push(`--jsx-import-source=${A}`),k&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),d)for(let w in d){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${Q(d[w],"define",w)}`)}if(v)for(let w in v){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${Q(v[w],"log override",w)}`)}if(D)for(let w in D){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);let M=D[w];if(typeof M!="boolean")throw new Error(`Expected value for supported ${_(w)} to be a boolean, got ${typeof M} instead`);e.push(`--supported:${w}=${M}`)}if(B)for(let w of B)e.push(`--pure:${Q(w,"pure")}`);$&&e.push("--keep-names")}function it(e,t,n,i,u){var ne;let l=[],f=[],s=Object.create(null),o=null,m=null;Se(l,t,s,n,i),Ke(l,t,s);let p=r(t,s,"sourcemap",Ne),y=r(t,s,"bundle",I),P=r(t,s,"splitting",I),L=r(t,s,"preserveSymlinks",I),T=r(t,s,"metafile",I),j=r(t,s,"outfile",b),C=r(t,s,"outdir",b),z=r(t,s,"outbase",b),V=r(t,s,"tsconfig",b),R=r(t,s,"resolveExtensions",Y),h=r(t,s,"nodePaths",Y),g=r(t,s,"mainFields",Y),a=r(t,s,"conditions",Y),O=r(t,s,"external",Y),E=r(t,s,"packages",b),A=r(t,s,"alias",G),k=r(t,s,"loader",G),c=r(t,s,"outExtension",G),d=r(t,s,"publicPath",b),v=r(t,s,"entryNames",b),D=r(t,s,"chunkNames",b),B=r(t,s,"assetNames",b),$=r(t,s,"inject",Y),S=r(t,s,"banner",G),F=r(t,s,"footer",G),q=r(t,s,"entryPoints",et),w=r(t,s,"absWorkingDir",b),M=r(t,s,"stdin",G),N=(ne=r(t,s,"write",I))!=null?ne:u,U=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",G);if(s.plugins=!0,K(t,s,`in ${e}() call`),p&&l.push(`--sourcemap${p===!0?"":`=${p}`}`),y&&l.push("--bundle"),U&&l.push("--allow-overwrite"),P&&l.push("--splitting"),L&&l.push("--preserve-symlinks"),T&&l.push("--metafile"),j&&l.push(`--outfile=${j}`),C&&l.push(`--outdir=${C}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),E&&l.push(`--packages=${E}`),R&&l.push(`--resolve-extensions=${pe(R,"resolve extension")}`),d&&l.push(`--public-path=${d}`),v&&l.push(`--entry-names=${v}`),D&&l.push(`--chunk-names=${D}`),B&&l.push(`--asset-names=${B}`),g&&l.push(`--main-fields=${pe(g,"main field")}`),a&&l.push(`--conditions=${pe(a,"condition")}`),O)for(let x of O)l.push(`--external:${Q(x,"external")}`);if(A)for(let x in A){if(x.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${x}`);l.push(`--alias:${x}=${Q(A[x],"alias",x)}`)}if(S)for(let x in S){if(x.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${x}`);l.push(`--banner:${x}=${Q(S[x],"banner",x)}`)}if(F)for(let x in F){if(x.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${x}`);l.push(`--footer:${x}=${Q(F[x],"footer",x)}`)}if($)for(let x of $)l.push(`--inject:${Q(x,"inject")}`);if(k)for(let x in k){if(x.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${x}`);l.push(`--loader:${x}=${Q(k[x],"loader",x)}`)}if(c)for(let x in c){if(x.indexOf("=")>=0)throw new Error(`Invalid out extension: ${x}`);l.push(`--out-extension:${x}=${Q(c[x],"out extension",x)}`)}if(q)if(Array.isArray(q))for(let x=0,re=q.length;x<re;x++){let H=q[x];if(typeof H=="object"&&H!==null){let te=Object.create(null),ie=r(H,te,"in",b),X=r(H,te,"out",b);if(K(H,te,"in entry point at index "+x),ie===void 0)throw new Error('Missing property "in" for entry point at index '+x);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+x);f.push([X,ie])}else f.push(["",Q(H,"entry point at index "+x)])}else for(let x in q)f.push([x,Q(q[x],"entry point",x)]);if(M){let x=Object.create(null),re=r(M,x,"contents",Ie),H=r(M,x,"resolveDir",b),te=r(M,x,"sourcefile",b),ie=r(M,x,"loader",b);K(M,x,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),ie&&l.push(`--loader=${ie}`),H&&(m=H),typeof re=="string"?o=Z(re):re instanceof Uint8Array&&(o=re)}let W=[];if(h)for(let x of h)x+="",W.push(x);return{entries:f,flags:l,write:N,stdinContents:o,stdinResolveDir:m,absWorkingDir:w,nodePaths:W,mangleCache:ze(J)}}function lt(e,t,n,i){let u=[],l=Object.create(null);Se(u,t,l,n,i),Ke(u,t,l);let f=r(t,l,"sourcemap",Ne),s=r(t,l,"sourcefile",b),o=r(t,l,"loader",b),m=r(t,l,"banner",b),p=r(t,l,"footer",b),y=r(t,l,"mangleCache",G);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),o&&u.push(`--loader=${o}`),m&&u.push(`--banner=${m}`),p&&u.push(`--footer=${p}`),{flags:u,mangleCache:ze(y)}}function _e(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,o=R=>{let h=s+R.length;if(h>f.length){let a=new Uint8Array(h*2);a.set(f),f=a}f.set(R,s),s+=R.length;let g=0;for(;g+4<=s;){let a=Fe(f,g);if(g+4+a>s)break;g+=4,T(f.subarray(g,g+a)),g+=a}g>0&&(f.copyWithin(0,g,s),s-=g)},m=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let h="The service was stopped"+n.reason;for(let g in i)i[g](h,null);i={}},p=(R,h,g)=>{if(n.didClose)return g("The service is no longer running"+n.reason,null);let a=u++;i[a]=(O,E)=>{try{g(O,E)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(De({id:a,isRequest:!0,value:h}))},y=(R,h)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(De({id:R,isRequest:!1,value:h}))},P=async(R,h)=>{try{if(h.command==="ping"){y(R,{});return}if(typeof h.key=="number"){let g=t[h.key];if(!g)return;let a=g[h.command];if(a){await a(R,h);return}}throw new Error("Invalid command: "+h.command)}catch(g){let a=[ue(g,e,null,void 0,"")];try{y(R,{errors:a})}catch(O){}}},L=!0,T=R=>{if(L){L=!1;let g=String.fromCharCode(...R);if(g!=="0.28.0")throw new Error(`Cannot start service: Host version "0.28.0" does not match binary version ${_(g)}`);return}let h=Me(R);if(h.isRequest)P(h.id,h.value);else{let g=i[h.id];delete i[h.id],h.value.error?g(h.value.error,{}):g(null,h.value)}};return{readFromStdout:o,afterClose:m,service:{buildOrContext:({callName:R,refs:h,options:g,isTTY:a,defaultWD:O,callback:E})=>{let A=0,k=l++,c={},d={ref(){++A===1&&h&&h.ref()},unref(){--A===0&&(delete t[k],h&&h.unref())}};t[k]=c,d.ref(),ot(R,k,p,y,d,e,c,g,a,O,(v,D)=>{try{E(v,D)}finally{d.unref()}})},transform:({callName:R,refs:h,input:g,options:a,isTTY:O,fs:E,callback:A})=>{let k=Ve(),c=d=>{try{if(typeof g!="string"&&!(g instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:v,mangleCache:D}=lt(R,a,O,Ue),B={command:"transform",flags:v,inputFS:d!==null,input:d!==null?Z(d):typeof g=="string"?Z(g):g};D&&(B.mangleCache=D),p(h,B,($,S)=>{if($)return A(new Error($),null);let F=ge(S.errors,k),q=ge(S.warnings,k),w=1,M=()=>{if(--w===0){let N={warnings:q,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(N.legalComments=S==null?void 0:S.legalComments),S.mangleCache&&(N.mangleCache=S==null?void 0:S.mangleCache),A(null,N)}};if(F.length>0)return A(ye("Transform failed",F,q),null);S.codeFS&&(w++,E.readFile(S.code,(N,U)=>{N!==null?A(N,null):(S.code=U,M())})),S.mapFS&&(w++,E.readFile(S.map,(N,U)=>{N!==null?A(N,null):(S.map=U,M())})),M()})}catch(v){let D=[];try{Se(D,a,{},O,Ue)}catch($){}let B=ue(v,e,k,void 0,"");p(h,{command:"error",flags:D,error:B},()=>{B.detail=k.load(B.detail),A(ye("Transform failed",[B],[]),null)})}};if((typeof g=="string"||g instanceof Uint8Array)&&g.length>1024*1024){let d=c;c=()=>E.writeFile(g,d)}c(null)},formatMessages:({callName:R,refs:h,messages:g,options:a,callback:O})=>{if(!a)throw new Error(`Missing second argument in ${R}() call`);let E={},A=r(a,E,"kind",b),k=r(a,E,"color",I),c=r(a,E,"terminalWidth",ce);if(K(a,E,`in ${R}() call`),A===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(A!=="error"&&A!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let d={command:"format-msgs",messages:se(g,"messages",null,"",c),isWarning:A==="warning"};k!==void 0&&(d.color=k),c!==void 0&&(d.terminalWidth=c),p(h,d,(v,D)=>{if(v)return O(new Error(v),null);O(null,D.messages)})},analyzeMetafile:({callName:R,refs:h,metafile:g,options:a,callback:O})=>{a===void 0&&(a={});let E={},A=r(a,E,"color",I),k=r(a,E,"verbose",I);K(a,E,`in ${R}() call`);let c={command:"analyze-metafile",metafile:g};A!==void 0&&(c.color=A),k!==void 0&&(c.verbose=k),p(h,c,(d,v)=>{if(d)return O(new Error(d),null);O(null,v.result)})}}}}function ot(e,t,n,i,u,l,f,s,o,m,p){let y=Ve(),P=e==="context",L=(C,z)=>{let V=[];try{Se(V,s,{},o,Le)}catch(h){}let R=ue(C,l,y,void 0,z);n(u,{command:"error",flags:V,error:R},()=>{R.detail=y.load(R.detail),p(ye(P?"Context failed":"Build failed",[R],[]),null)})},T;if(typeof s=="object"){let C=s.plugins;if(C!==void 0){if(!Array.isArray(C))return L(new Error('"plugins" must be an array'),"");T=C}}if(T&&T.length>0){if(l.isSync)return L(new Error("Cannot use plugins in synchronous API calls"),"");st(t,n,i,u,l,f,s,T,y).then(C=>{if(!C.ok)return L(C.error,C.pluginName);try{j(C.requestPlugins,C.runOnEndCallbacks,C.scheduleOnDisposeCallbacks)}catch(z){L(z,"")}},C=>L(C,""));return}try{j(null,(C,z)=>z([],[]),()=>{})}catch(C){L(C,"")}function j(C,z,V){let R=l.hasFS,{entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:A,nodePaths:k,mangleCache:c}=it(e,s,o,Le,R);if(a&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let d={command:"build",key:t,entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:A||m,nodePaths:k,context:P};C&&(d.plugins=C),c&&(d.mangleCache=c);let v=($,S)=>{let F={errors:ge($.errors,y),warnings:ge($.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=F.errors.slice(),w=F.warnings.slice();$.outputFiles&&(F.outputFiles=$.outputFiles.map(ut)),$.metafile&&$.metafile.length&&(F.metafile=ct($.metafile)),$.mangleCache&&(F.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(ae($.writeToStdout).replace(/\n$/,"")),z(F,(M,N)=>{if(q.length>0||M.length>0){let U=ye("Build failed",q.concat(M),w.concat(N));return S(U,null,M,N)}S(null,F,M,N)})},D,B;P&&(f["on-end"]=($,S)=>new Promise(F=>{v(S,(q,w,M,N)=>{let U={errors:M,warnings:N};B&&B(q,w),D=void 0,B=void 0,i($,U),F()})})),n(u,d,($,S)=>{if($)return p(new Error($),null);if(!P)return v(S,(w,M)=>(V(),p(w,M)));if(S.errors.length>0)return p(ye("Context failed",S.errors,S.warnings),null);let F=!1,q={rebuild:()=>(D||(D=new Promise((w,M)=>{let N;B=(J,W)=>{N||(N=()=>J?M(J):w(W))};let U=()=>{n(u,{command:"rebuild",key:t},(W,ne)=>{W?M(new Error(W)):N?N():U()})};U()})),D),watch:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let U={},J=r(w,U,"delay",ce);K(w,U,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(u,W,ne=>{ne?N(new Error(ne)):M(void 0)})}),serve:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let U={},J=r(w,U,"port",Ze),W=r(w,U,"host",b),ne=r(w,U,"servedir",b),x=r(w,U,"keyfile",b),re=r(w,U,"certfile",b),H=r(w,U,"fallback",b),te=r(w,U,"cors",G),ie=r(w,U,"onRequest",je);K(w,U,"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),x!==void 0&&(X.keyfile=x),re!==void 0&&(X.certfile=re),H!==void 0&&(X.fallback=H),te){let me={},de=r(te,me,"origin",qe);K(te,me,'on "cors" object'),Array.isArray(de)?X.corsOrigin=de:de!==void 0&&(X.corsOrigin=[de])}n(u,X,(me,de)=>{if(me)return N(new Error(me));ie&&(f["serve-request"]=(Qe,Ye)=>{ie(Ye.args),i(Qe,{})}),M(de)})}),cancel:()=>new Promise(w=>{if(F)return w();n(u,{command:"cancel",key:t},()=>{w()})}),dispose:()=>new Promise(w=>{if(F)return w();F=!0,n(u,{command:"dispose",key:t},()=>{w(),V(),u.unref()})})};u.ref(),p(null,q)})}}var st=async(e,t,n,i,u,l,f,s,o)=>{let m=[],p=[],y={},P={},L=[],T=0,j=0,C=[],z=!1;s=[...s];for(let h of s){let g={};if(typeof h!="object")throw new Error(`Plugin at index ${j} must be an object`);let a=r(h,g,"name",b);if(typeof a!="string"||a==="")throw new Error(`Plugin at index ${j} is missing a name`);try{let O=r(h,g,"setup",je);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(h,g,`on plugin ${_(a)}`);let E={name:a,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};j++;let k=O({initialOptions:f,resolve:(c,d={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let v=Object.create(null),D=r(d,v,"pluginName",b),B=r(d,v,"importer",b),$=r(d,v,"namespace",b),S=r(d,v,"resolveDir",b),F=r(d,v,"kind",b),q=r(d,v,"pluginData",ve),w=r(d,v,"with",G);return K(d,v,"in resolve() call"),new Promise((M,N)=>{let U={command:"resolve",path:c,key:e,pluginName:a};if(D!=null&&(U.pluginName=D),B!=null&&(U.importer=B),$!=null&&(U.namespace=$),S!=null&&(U.resolveDir=S),F!=null)U.kind=F;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(U.pluginData=o.store(q)),w!=null&&(U.with=at(w,"with")),t(i,U,(J,W)=>{J!==null?N(new Error(J)):M({errors:ge(W.errors,o),warnings:ge(W.warnings,o),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:o.load(W.pluginData)})})})},onStart(c){let d='This error came from the "onStart" callback registered here:',v=be(new Error(d),u,"onStart");m.push({name:a,callback:c,note:v}),E.onStart=!0},onEnd(c){let d='This error came from the "onEnd" callback registered here:',v=be(new Error(d),u,"onEnd");p.push({name:a,callback:c,note:v}),E.onEnd=!0},onResolve(c,d){let v='This error came from the "onResolve" callback registered here:',D=be(new Error(v),u,"onResolve"),B={},$=r(c,B,"filter",Re),S=r(c,B,"namespace",b);if(K(c,B,`in onResolve() call for plugin ${_(a)}`),$==null)throw new Error("onResolve() call is missing a filter");let F=T++;y[F]={name:a,callback:d,note:D},E.onResolve.push({id:F,filter:Oe($),namespace:S||""})},onLoad(c,d){let v='This error came from the "onLoad" callback registered here:',D=be(new Error(v),u,"onLoad"),B={},$=r(c,B,"filter",Re),S=r(c,B,"namespace",b);if(K(c,B,`in onLoad() call for plugin ${_(a)}`),$==null)throw new Error("onLoad() call is missing a filter");let F=T++;P[F]={name:a,callback:d,note:D},E.onLoad.push({id:F,filter:Oe($),namespace:S||""})},onDispose(c){L.push(c)},esbuild:u.esbuild});k&&await k,C.push(E)}catch(O){return{ok:!1,error:O,pluginName:a}}}l["on-start"]=async(h,g)=>{o.clear();let a={errors:[],warnings:[]};await Promise.all(m.map(async({name:O,callback:E,note:A})=>{try{let k=await E();if(k!=null){if(typeof k!="object")throw new Error(`Expected onStart() callback in plugin ${_(O)} to return an object`);let c={},d=r(k,c,"errors",oe),v=r(k,c,"warnings",oe);K(k,c,`from onStart() callback in plugin ${_(O)}`),d!=null&&a.errors.push(...se(d,"errors",o,O,void 0)),v!=null&&a.warnings.push(...se(v,"warnings",o,O,void 0))}}catch(k){a.errors.push(ue(k,u,o,A&&A(),O))}})),n(h,a)},l["on-resolve"]=async(h,g)=>{let a={},O="",E,A;for(let k of g.ids)try{({name:O,callback:E,note:A}=y[k]);let c=await E({path:g.path,importer:g.importer,namespace:g.namespace,resolveDir:g.resolveDir,kind:g.kind,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),D=r(c,d,"path",b),B=r(c,d,"namespace",b),$=r(c,d,"suffix",b),S=r(c,d,"external",I),F=r(c,d,"sideEffects",I),q=r(c,d,"pluginData",ve),w=r(c,d,"errors",oe),M=r(c,d,"warnings",oe),N=r(c,d,"watchFiles",Y),U=r(c,d,"watchDirs",Y);K(c,d,`from onResolve() callback in plugin ${_(O)}`),a.id=k,v!=null&&(a.pluginName=v),D!=null&&(a.path=D),B!=null&&(a.namespace=B),$!=null&&(a.suffix=$),S!=null&&(a.external=S),F!=null&&(a.sideEffects=F),q!=null&&(a.pluginData=o.store(q)),w!=null&&(a.errors=se(w,"errors",o,O,void 0)),M!=null&&(a.warnings=se(M,"warnings",o,O,void 0)),N!=null&&(a.watchFiles=xe(N,"watchFiles")),U!=null&&(a.watchDirs=xe(U,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,A&&A(),O)]};break}n(h,a)},l["on-load"]=async(h,g)=>{let a={},O="",E,A;for(let k of g.ids)try{({name:O,callback:E,note:A}=P[k]);let c=await E({path:g.path,namespace:g.namespace,suffix:g.suffix,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),D=r(c,d,"contents",Ie),B=r(c,d,"resolveDir",b),$=r(c,d,"pluginData",ve),S=r(c,d,"loader",b),F=r(c,d,"errors",oe),q=r(c,d,"warnings",oe),w=r(c,d,"watchFiles",Y),M=r(c,d,"watchDirs",Y);K(c,d,`from onLoad() callback in plugin ${_(O)}`),a.id=k,v!=null&&(a.pluginName=v),D instanceof Uint8Array?a.contents=D:D!=null&&(a.contents=Z(D)),B!=null&&(a.resolveDir=B),$!=null&&(a.pluginData=o.store($)),S!=null&&(a.loader=S),F!=null&&(a.errors=se(F,"errors",o,O,void 0)),q!=null&&(a.warnings=se(q,"warnings",o,O,void 0)),w!=null&&(a.watchFiles=xe(w,"watchFiles")),M!=null&&(a.watchDirs=xe(M,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,A&&A(),O)]};break}n(h,a)};let V=(h,g)=>g([],[]);p.length>0&&(V=(h,g)=>{(async()=>{let a=[],O=[];for(let{name:E,callback:A,note:k}of p){let c,d;try{let v=await A(h);if(v!=null){if(typeof v!="object")throw new Error(`Expected onEnd() callback in plugin ${_(E)} to return an object`);let D={},B=r(v,D,"errors",oe),$=r(v,D,"warnings",oe);K(v,D,`from onEnd() callback in plugin ${_(E)}`),B!=null&&(c=se(B,"errors",o,E,void 0)),$!=null&&(d=se($,"warnings",o,E,void 0))}}catch(v){c=[ue(v,u,o,k&&k(),E)]}if(c){a.push(...c);try{h.errors.push(...c)}catch(v){}}if(d){O.push(...d);try{h.warnings.push(...d)}catch(v){}}}g(a,O)})()});let R=()=>{for(let h of L)setTimeout(()=>h(),0)};return z=!0,{ok:!0,requestPlugins:C,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:R}};function Ve(){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,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
|
|
7
|
+
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:{let y=0;for(let P=0;P<4;P++)m=e[o++],y<<=4,m>=48&&m<=57?y|=m-48:m>=97&&m<=102?y|=m+-87:m>=65&&m<=70?y|=m+-55:ee(e,--o);p+=le(y);break}default:ee(e,--o);break}else if(m<=127)p+=le(m);else if((m&224)===192)p+=le((m&31)<<6|e[o++]&63);else if((m&240)===224)p+=le((m&15)<<12|(e[o++]&63)<<6|e[o++]&63);else if((m&248)==240){let y=(m&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;y>65535&&(y-=65536,p+=le(y>>10&1023|55296),y=56320|y&1023),p+=le(y)}p[0];break}case 91:{p=[],t.push(l),n.push(s),i.push(f),l=null,s=p,f=1;continue}case 123:{p={},t.push(l),n.push(s),i.push(f),l=null,s=p,f=2;continue}case 93:{f!==1&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}case 125:{f!==2&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}default:ee(e,--o)}for(m=e[o];m<=32;)m=e[++o];switch(f){case 0:{if(o===u)return p;break}case 1:{if(s.push(p),m===44){o++;continue}if(m===93)continue;break}case 2:{if(l===null){if(l=p,m===58){o++;continue}}else{if(s[l]=p,l=null,m===44){o++;continue}if(m===125)continue}break}}break}ee(e,o)}var _=JSON.stringify,Le="warning",Ue="silent";function pe(e,t){let n=[];for(let i of e){if(Q(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",b=e=>typeof e=="string"?null:"a string",Re=e=>e instanceof RegExp?null:"a RegExp object",ce=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ze=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",je=e=>typeof e=="function"?null:"a function",oe=e=>Array.isArray(e)?null:"an array",Y=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",et=e=>typeof e=="object"&&e!==null?null:"an array or an object",tt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Pe=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ne=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",nt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",qe=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",Ie=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",rt=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 We(e){let t=Object.create(null),n=r(e,t,"wasmURL",rt),i=r(e,t,"wasmModule",tt),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function ze(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 Se(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",b),s=r(t,n,"logLimit",ce),o=r(t,n,"logStyle",b);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`),o&&e.push(`--log-style=${o}`)}function Q(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 Ke(e,t,n){let i=r(t,n,"legalComments",b),u=r(t,n,"sourceRoot",b),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",qe),s=r(t,n,"format",b),o=r(t,n,"globalName",b),m=r(t,n,"mangleProps",Re),p=r(t,n,"reserveProps",Re),y=r(t,n,"mangleQuoted",I),P=r(t,n,"minify",I),L=r(t,n,"minifySyntax",I),T=r(t,n,"minifyWhitespace",I),j=r(t,n,"minifyIdentifiers",I),C=r(t,n,"lineLimit",ce),z=r(t,n,"drop",Y),V=r(t,n,"dropLabels",Y),R=r(t,n,"charset",b),h=r(t,n,"treeShaking",I),g=r(t,n,"ignoreAnnotations",I),a=r(t,n,"jsx",b),O=r(t,n,"jsxFactory",b),E=r(t,n,"jsxFragment",b),D=r(t,n,"jsxImportSource",b),k=r(t,n,"jsxDev",I),c=r(t,n,"jsxSideEffects",I),d=r(t,n,"define",G),x=r(t,n,"logOverride",G),A=r(t,n,"supported",G),F=r(t,n,"pure",Y),$=r(t,n,"keepNames",I),S=r(t,n,"platform",b),M=r(t,n,"tsconfigRaw",nt),q=r(t,n,"absPaths",Y);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&e.push(`--target=${pe(Array.isArray(f)?f:[f],"target")}`),s&&e.push(`--format=${s}`),o&&e.push(`--global-name=${o}`),S&&e.push(`--platform=${S}`),M&&e.push(`--tsconfig-raw=${typeof M=="string"?M:JSON.stringify(M)}`),P&&e.push("--minify"),L&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),j&&e.push("--minify-identifiers"),C&&e.push(`--line-limit=${C}`),R&&e.push(`--charset=${R}`),h!==void 0&&e.push(`--tree-shaking=${h}`),g&&e.push("--ignore-annotations"),z)for(let w of z)e.push(`--drop:${Q(w,"drop")}`);if(V&&e.push(`--drop-labels=${pe(V,"drop label")}`),q&&e.push(`--abs-paths=${pe(q,"abs paths")}`),m&&e.push(`--mangle-props=${Oe(m)}`),p&&e.push(`--reserve-props=${Oe(p)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),a&&e.push(`--jsx=${a}`),O&&e.push(`--jsx-factory=${O}`),E&&e.push(`--jsx-fragment=${E}`),D&&e.push(`--jsx-import-source=${D}`),k&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),d)for(let w in d){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${Q(d[w],"define",w)}`)}if(x)for(let w in x){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${Q(x[w],"log override",w)}`)}if(A)for(let w in A){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);let B=A[w];if(typeof B!="boolean")throw new Error(`Expected value for supported ${_(w)} to be a boolean, got ${typeof B} instead`);e.push(`--supported:${w}=${B}`)}if(F)for(let w of F)e.push(`--pure:${Q(w,"pure")}`);$&&e.push("--keep-names")}function it(e,t,n,i,u){var ne;let l=[],f=[],s=Object.create(null),o=null,m=null;Se(l,t,s,n,i),Ke(l,t,s);let p=r(t,s,"sourcemap",Ne),y=r(t,s,"bundle",I),P=r(t,s,"splitting",I),L=r(t,s,"preserveSymlinks",I),T=r(t,s,"metafile",I),j=r(t,s,"outfile",b),C=r(t,s,"outdir",b),z=r(t,s,"outbase",b),V=r(t,s,"tsconfig",b),R=r(t,s,"resolveExtensions",Y),h=r(t,s,"nodePaths",Y),g=r(t,s,"mainFields",Y),a=r(t,s,"conditions",Y),O=r(t,s,"external",Y),E=r(t,s,"packages",b),D=r(t,s,"alias",G),k=r(t,s,"loader",G),c=r(t,s,"outExtension",G),d=r(t,s,"publicPath",b),x=r(t,s,"entryNames",b),A=r(t,s,"chunkNames",b),F=r(t,s,"assetNames",b),$=r(t,s,"inject",Y),S=r(t,s,"banner",G),M=r(t,s,"footer",G),q=r(t,s,"entryPoints",et),w=r(t,s,"absWorkingDir",b),B=r(t,s,"stdin",G),N=(ne=r(t,s,"write",I))!=null?ne:u,U=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",G);if(s.plugins=!0,K(t,s,`in ${e}() call`),p&&l.push(`--sourcemap${p===!0?"":`=${p}`}`),y&&l.push("--bundle"),U&&l.push("--allow-overwrite"),P&&l.push("--splitting"),L&&l.push("--preserve-symlinks"),T&&l.push("--metafile"),j&&l.push(`--outfile=${j}`),C&&l.push(`--outdir=${C}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),E&&l.push(`--packages=${E}`),R&&l.push(`--resolve-extensions=${pe(R,"resolve extension")}`),d&&l.push(`--public-path=${d}`),x&&l.push(`--entry-names=${x}`),A&&l.push(`--chunk-names=${A}`),F&&l.push(`--asset-names=${F}`),g&&l.push(`--main-fields=${pe(g,"main field")}`),a&&l.push(`--conditions=${pe(a,"condition")}`),O)for(let v of O)l.push(`--external:${Q(v,"external")}`);if(D)for(let v in D){if(v.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${v}`);l.push(`--alias:${v}=${Q(D[v],"alias",v)}`)}if(S)for(let v in S){if(v.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${v}`);l.push(`--banner:${v}=${Q(S[v],"banner",v)}`)}if(M)for(let v in M){if(v.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${v}`);l.push(`--footer:${v}=${Q(M[v],"footer",v)}`)}if($)for(let v of $)l.push(`--inject:${Q(v,"inject")}`);if(k)for(let v in k){if(v.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${v}`);l.push(`--loader:${v}=${Q(k[v],"loader",v)}`)}if(c)for(let v in c){if(v.indexOf("=")>=0)throw new Error(`Invalid out extension: ${v}`);l.push(`--out-extension:${v}=${Q(c[v],"out extension",v)}`)}if(q)if(Array.isArray(q))for(let v=0,re=q.length;v<re;v++){let H=q[v];if(typeof H=="object"&&H!==null){let te=Object.create(null),ie=r(H,te,"in",b),X=r(H,te,"out",b);if(K(H,te,"in entry point at index "+v),ie===void 0)throw new Error('Missing property "in" for entry point at index '+v);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+v);f.push([X,ie])}else f.push(["",Q(H,"entry point at index "+v)])}else for(let v in q)f.push([v,Q(q[v],"entry point",v)]);if(B){let v=Object.create(null),re=r(B,v,"contents",Ie),H=r(B,v,"resolveDir",b),te=r(B,v,"sourcefile",b),ie=r(B,v,"loader",b);K(B,v,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),ie&&l.push(`--loader=${ie}`),H&&(m=H),typeof re=="string"?o=Z(re):re instanceof Uint8Array&&(o=re)}let W=[];if(h)for(let v of h)v+="",W.push(v);return{entries:f,flags:l,write:N,stdinContents:o,stdinResolveDir:m,absWorkingDir:w,nodePaths:W,mangleCache:ze(J)}}function lt(e,t,n,i){let u=[],l=Object.create(null);Se(u,t,l,n,i),Ke(u,t,l);let f=r(t,l,"sourcemap",Ne),s=r(t,l,"sourcefile",b),o=r(t,l,"loader",b),m=r(t,l,"banner",b),p=r(t,l,"footer",b),y=r(t,l,"mangleCache",G);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),o&&u.push(`--loader=${o}`),m&&u.push(`--banner=${m}`),p&&u.push(`--footer=${p}`),{flags:u,mangleCache:ze(y)}}function _e(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,o=R=>{let h=s+R.length;if(h>f.length){let a=new Uint8Array(h*2);a.set(f),f=a}f.set(R,s),s+=R.length;let g=0;for(;g+4<=s;){let a=Fe(f,g);if(g+4+a>s)break;g+=4,T(f.subarray(g,g+a)),g+=a}g>0&&(f.copyWithin(0,g,s),s-=g)},m=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let h="The service was stopped"+n.reason;for(let g in i)i[g](h,null);i={}},p=(R,h,g)=>{if(n.didClose)return g("The service is no longer running"+n.reason,null);let a=u++;i[a]=(O,E)=>{try{g(O,E)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(De({id:a,isRequest:!0,value:h}))},y=(R,h)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(De({id:R,isRequest:!1,value:h}))},P=async(R,h)=>{try{if(h.command==="ping"){y(R,{});return}if(typeof h.key=="number"){let g=t[h.key];if(!g)return;let a=g[h.command];if(a){await a(R,h);return}}throw new Error("Invalid command: "+h.command)}catch(g){let a=[ue(g,e,null,void 0,"")];try{y(R,{errors:a})}catch(O){}}},L=!0,T=R=>{if(L){L=!1;let g=String.fromCharCode(...R);if(g!=="0.28.2")throw new Error(`Cannot start service: Host version "0.28.2" does not match binary version ${_(g)}`);return}let h=Me(R);if(h.isRequest)P(h.id,h.value);else{let g=i[h.id];delete i[h.id],h.value.error?g(h.value.error,{}):g(null,h.value)}};return{readFromStdout:o,afterClose:m,service:{buildOrContext:({callName:R,refs:h,options:g,isTTY:a,defaultWD:O,callback:E})=>{let D=0,k=l++,c={},d={ref(){++D===1&&h&&h.ref()},unref(){--D===0&&(delete t[k],h&&h.unref())}};t[k]=c,d.ref(),ot(R,k,p,y,d,e,c,g,a,O,(x,A)=>{try{E(x,A)}finally{d.unref()}})},transform:({callName:R,refs:h,input:g,options:a,isTTY:O,fs:E,callback:D})=>{let k=Ve(),c=d=>{try{if(typeof g!="string"&&!(g instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:x,mangleCache:A}=lt(R,a,O,Ue),F={command:"transform",flags:x,inputFS:d!==null,input:d!==null?Z(d):typeof g=="string"?Z(g):g};A&&(F.mangleCache=A),p(h,F,($,S)=>{if($)return D(new Error($),null);let M=ge(S.errors,k),q=ge(S.warnings,k),w=1,B=()=>{if(--w===0){let N={warnings:q,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(N.legalComments=S==null?void 0:S.legalComments),S.mangleCache&&(N.mangleCache=S==null?void 0:S.mangleCache),D(null,N)}};if(M.length>0)return D(ye("Transform failed",M,q),null);S.codeFS&&(w++,E.readFile(S.code,(N,U)=>{N!==null?D(N,null):(S.code=U,B())})),S.mapFS&&(w++,E.readFile(S.map,(N,U)=>{N!==null?D(N,null):(S.map=U,B())})),B()})}catch(x){let A=[];try{Se(A,a,{},O,Ue)}catch($){}let F=ue(x,e,k,void 0,"");p(h,{command:"error",flags:A,error:F},()=>{F.detail=k.load(F.detail),D(ye("Transform failed",[F],[]),null)})}};if((typeof g=="string"||g instanceof Uint8Array)&&g.length>1024*1024){let d=c;c=()=>E.writeFile(g,d)}c(null)},formatMessages:({callName:R,refs:h,messages:g,options:a,callback:O})=>{if(!a)throw new Error(`Missing second argument in ${R}() call`);let E={},D=r(a,E,"kind",b),k=r(a,E,"color",I),c=r(a,E,"terminalWidth",ce),d=r(a,E,"logStyle",b);if(K(a,E,`in ${R}() call`),D===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(D!=="error"&&D!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let x={command:"format-msgs",messages:se(g,"messages",null,"",c),isWarning:D==="warning"};k!==void 0&&(x.color=k),c!==void 0&&(x.terminalWidth=c),d!==void 0&&(x.logStyle=d),p(h,x,(A,F)=>{if(A)return O(new Error(A),null);O(null,F.messages)})},analyzeMetafile:({callName:R,refs:h,metafile:g,options:a,callback:O})=>{a===void 0&&(a={});let E={},D=r(a,E,"color",I),k=r(a,E,"verbose",I);K(a,E,`in ${R}() call`);let c={command:"analyze-metafile",metafile:g};D!==void 0&&(c.color=D),k!==void 0&&(c.verbose=k),p(h,c,(d,x)=>{if(d)return O(new Error(d),null);O(null,x.result)})}}}}function ot(e,t,n,i,u,l,f,s,o,m,p){let y=Ve(),P=e==="context",L=(C,z)=>{let V=[];try{Se(V,s,{},o,Le)}catch(h){}let R=ue(C,l,y,void 0,z);n(u,{command:"error",flags:V,error:R},()=>{R.detail=y.load(R.detail),p(ye(P?"Context failed":"Build failed",[R],[]),null)})},T;if(typeof s=="object"){let C=s.plugins;if(C!==void 0){if(!Array.isArray(C))return L(new Error('"plugins" must be an array'),"");T=C}}if(T&&T.length>0){if(l.isSync)return L(new Error("Cannot use plugins in synchronous API calls"),"");st(t,n,i,u,l,f,s,T,y).then(C=>{if(!C.ok)return L(C.error,C.pluginName);try{j(C.requestPlugins,C.runOnEndCallbacks,C.scheduleOnDisposeCallbacks)}catch(z){L(z,"")}},C=>L(C,""));return}try{j(null,(C,z)=>z([],[]),()=>{})}catch(C){L(C,"")}function j(C,z,V){let R=l.hasFS,{entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:D,nodePaths:k,mangleCache:c}=it(e,s,o,Le,R);if(a&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let d={command:"build",key:t,entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:D||m,nodePaths:k,context:P};C&&(d.plugins=C),c&&(d.mangleCache=c);let x=($,S)=>{let M={errors:ge($.errors,y),warnings:ge($.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=M.errors.slice(),w=M.warnings.slice();$.outputFiles&&(M.outputFiles=$.outputFiles.map(ut)),$.metafile&&$.metafile.length&&(M.metafile=ct($.metafile)),$.mangleCache&&(M.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(ae($.writeToStdout).replace(/\n$/,"")),z(M,(B,N)=>{if(q.length>0||B.length>0){let U=ye("Build failed",q.concat(B),w.concat(N));return S(U,null,B,N)}S(null,M,B,N)})},A,F;P&&(f["on-end"]=($,S)=>new Promise(M=>{x(S,(q,w,B,N)=>{let U={errors:B,warnings:N};F&&F(q,w),A=void 0,F=void 0,i($,U),M()})})),n(u,d,($,S)=>{if($)return p(new Error($),null);if(!P)return x(S,(w,B)=>(V(),p(w,B)));if(S.errors.length>0)return p(ye("Context failed",S.errors,S.warnings),null);let M=!1,q={rebuild:()=>(A||(A=new Promise((w,B)=>{let N;F=(J,W)=>{N||(N=()=>J?B(J):w(W))};let U=()=>{n(u,{command:"rebuild",key:t},(W,ne)=>{W?B(new Error(W)):N?N():U()})};U()})),A),watch:(w={})=>new Promise((B,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let U={},J=r(w,U,"delay",ce);K(w,U,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(u,W,ne=>{ne?N(new Error(ne)):B(void 0)})}),serve:(w={})=>new Promise((B,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let U={},J=r(w,U,"port",Ze),W=r(w,U,"host",b),ne=r(w,U,"servedir",b),v=r(w,U,"keyfile",b),re=r(w,U,"certfile",b),H=r(w,U,"fallback",b),te=r(w,U,"cors",G),ie=r(w,U,"onRequest",je);K(w,U,"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),v!==void 0&&(X.keyfile=v),re!==void 0&&(X.certfile=re),H!==void 0&&(X.fallback=H),te){let me={},de=r(te,me,"origin",qe);K(te,me,'on "cors" object'),Array.isArray(de)?X.corsOrigin=de:de!==void 0&&(X.corsOrigin=[de])}n(u,X,(me,de)=>{if(me)return N(new Error(me));ie&&(f["serve-request"]=(Qe,Ye)=>{ie(Ye.args),i(Qe,{})}),B(de)})}),cancel:()=>new Promise(w=>{if(M)return w();n(u,{command:"cancel",key:t},()=>{w()})}),dispose:()=>new Promise(w=>{if(M)return w();M=!0,n(u,{command:"dispose",key:t},()=>{w(),V(),u.unref()})})};u.ref(),p(null,q)})}}var st=async(e,t,n,i,u,l,f,s,o)=>{let m=[],p=[],y={},P={},L=[],T=0,j=0,C=[],z=!1;s=[...s];for(let h of s){let g={};if(typeof h!="object")throw new Error(`Plugin at index ${j} must be an object`);let a=r(h,g,"name",b);if(typeof a!="string"||a==="")throw new Error(`Plugin at index ${j} is missing a name`);try{let O=r(h,g,"setup",je);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(h,g,`on plugin ${_(a)}`);let E={name:a,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};j++;let k=O({initialOptions:f,resolve:(c,d={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let x=Object.create(null),A=r(d,x,"pluginName",b),F=r(d,x,"importer",b),$=r(d,x,"namespace",b),S=r(d,x,"resolveDir",b),M=r(d,x,"kind",b),q=r(d,x,"pluginData",ve),w=r(d,x,"with",G);return K(d,x,"in resolve() call"),new Promise((B,N)=>{let U={command:"resolve",path:c,key:e,pluginName:a};if(A!=null&&(U.pluginName=A),F!=null&&(U.importer=F),$!=null&&(U.namespace=$),S!=null&&(U.resolveDir=S),M!=null)U.kind=M;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(U.pluginData=o.store(q)),w!=null&&(U.with=at(w,"with")),t(i,U,(J,W)=>{J!==null?N(new Error(J)):B({errors:ge(W.errors,o),warnings:ge(W.warnings,o),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:o.load(W.pluginData)})})})},onStart(c){let d='This error came from the "onStart" callback registered here:',x=be(new Error(d),u,"onStart");m.push({name:a,callback:c,note:x}),E.onStart=!0},onEnd(c){let d='This error came from the "onEnd" callback registered here:',x=be(new Error(d),u,"onEnd");p.push({name:a,callback:c,note:x}),E.onEnd=!0},onResolve(c,d){let x='This error came from the "onResolve" callback registered here:',A=be(new Error(x),u,"onResolve"),F={},$=r(c,F,"filter",Re),S=r(c,F,"namespace",b);if(K(c,F,`in onResolve() call for plugin ${_(a)}`),$==null)throw new Error("onResolve() call is missing a filter");let M=T++;y[M]={name:a,callback:d,note:A},E.onResolve.push({id:M,filter:Oe($),namespace:S||""})},onLoad(c,d){let x='This error came from the "onLoad" callback registered here:',A=be(new Error(x),u,"onLoad"),F={},$=r(c,F,"filter",Re),S=r(c,F,"namespace",b);if(K(c,F,`in onLoad() call for plugin ${_(a)}`),$==null)throw new Error("onLoad() call is missing a filter");let M=T++;P[M]={name:a,callback:d,note:A},E.onLoad.push({id:M,filter:Oe($),namespace:S||""})},onDispose(c){L.push(c)},esbuild:u.esbuild});k&&await k,C.push(E)}catch(O){return{ok:!1,error:O,pluginName:a}}}l["on-start"]=async(h,g)=>{o.clear();let a={errors:[],warnings:[]};await Promise.all(m.map(async({name:O,callback:E,note:D})=>{try{let k=await E();if(k!=null){if(typeof k!="object")throw new Error(`Expected onStart() callback in plugin ${_(O)} to return an object`);let c={},d=r(k,c,"errors",oe),x=r(k,c,"warnings",oe);K(k,c,`from onStart() callback in plugin ${_(O)}`),d!=null&&a.errors.push(...se(d,"errors",o,O,void 0)),x!=null&&a.warnings.push(...se(x,"warnings",o,O,void 0))}}catch(k){a.errors.push(ue(k,u,o,D&&D(),O))}})),n(h,a)},l["on-resolve"]=async(h,g)=>{let a={},O="",E,D;for(let k of g.ids)try{({name:O,callback:E,note:D}=y[k]);let c=await E({path:g.path,importer:g.importer,namespace:g.namespace,resolveDir:g.resolveDir,kind:g.kind,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${_(O)} to return an object`);let d={},x=r(c,d,"pluginName",b),A=r(c,d,"path",b),F=r(c,d,"namespace",b),$=r(c,d,"suffix",b),S=r(c,d,"external",I),M=r(c,d,"sideEffects",I),q=r(c,d,"pluginData",ve),w=r(c,d,"errors",oe),B=r(c,d,"warnings",oe),N=r(c,d,"watchFiles",Y),U=r(c,d,"watchDirs",Y);K(c,d,`from onResolve() callback in plugin ${_(O)}`),a.id=k,x!=null&&(a.pluginName=x),A!=null&&(a.path=A),F!=null&&(a.namespace=F),$!=null&&(a.suffix=$),S!=null&&(a.external=S),M!=null&&(a.sideEffects=M),q!=null&&(a.pluginData=o.store(q)),w!=null&&(a.errors=se(w,"errors",o,O,void 0)),B!=null&&(a.warnings=se(B,"warnings",o,O,void 0)),N!=null&&(a.watchFiles=xe(N,"watchFiles")),U!=null&&(a.watchDirs=xe(U,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,D&&D(),O)]};break}n(h,a)},l["on-load"]=async(h,g)=>{let a={},O="",E,D;for(let k of g.ids)try{({name:O,callback:E,note:D}=P[k]);let c=await E({path:g.path,namespace:g.namespace,suffix:g.suffix,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${_(O)} to return an object`);let d={},x=r(c,d,"pluginName",b),A=r(c,d,"contents",Ie),F=r(c,d,"resolveDir",b),$=r(c,d,"pluginData",ve),S=r(c,d,"loader",b),M=r(c,d,"errors",oe),q=r(c,d,"warnings",oe),w=r(c,d,"watchFiles",Y),B=r(c,d,"watchDirs",Y);K(c,d,`from onLoad() callback in plugin ${_(O)}`),a.id=k,x!=null&&(a.pluginName=x),A instanceof Uint8Array?a.contents=A:A!=null&&(a.contents=Z(A)),F!=null&&(a.resolveDir=F),$!=null&&(a.pluginData=o.store($)),S!=null&&(a.loader=S),M!=null&&(a.errors=se(M,"errors",o,O,void 0)),q!=null&&(a.warnings=se(q,"warnings",o,O,void 0)),w!=null&&(a.watchFiles=xe(w,"watchFiles")),B!=null&&(a.watchDirs=xe(B,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,D&&D(),O)]};break}n(h,a)};let V=(h,g)=>g([],[]);p.length>0&&(V=(h,g)=>{(async()=>{let a=[],O=[];for(let{name:E,callback:D,note:k}of p){let c,d;try{let x=await D(h);if(x!=null){if(typeof x!="object")throw new Error(`Expected onEnd() callback in plugin ${_(E)} to return an object`);let A={},F=r(x,A,"errors",oe),$=r(x,A,"warnings",oe);K(x,A,`from onEnd() callback in plugin ${_(E)}`),F!=null&&(c=se(F,"errors",o,E,void 0)),$!=null&&(d=se($,"warnings",o,E,void 0))}}catch(x){c=[ue(x,u,o,k&&k(),E)]}if(c){a.push(...c);try{h.errors.push(...c)}catch(x){}}if(d){O.push(...d);try{h.warnings.push(...d)}catch(x){}}}g(a,O)})()});let R=()=>{for(let h of L)setTimeout(()=>h(),0)};return z=!0,{ok:!0,requestPlugins:C,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:R}};function Ve(){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,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
|
|
8
8
|
`);l.splice(1,1);let f=Je(t,l,n);if(f)return i={text:e.message,location:f},i}catch(l){}}}function ue(e,t,n,i,u){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Je(t,(e.stack+"").split(`
|
|
9
9
|
`),"")}catch(s){}return{id:"",pluginName:u,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Je(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 f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(y){break}let o=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",m=+f[3]-1,p=o.slice(m,m+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(o.slice(0,m)).length,length:Z(o.slice(m,m+p)).length,lineText:o+`
|
|
10
10
|
`+t.slice(1).join(`
|
|
11
11
|
`),suggestion:""}}break}}return null}function ye(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,f)=>{if(f===i)return`
|
|
12
12
|
...`;if(!l.location)return`
|
|
13
13
|
error: ${l.text}`;let{file:s,line:o,column:m}=l.location,p=l.pluginName?`[plugin: ${l.pluginName}] `:"";return`
|
|
14
|
-
${s}:${o}:${m}: ERROR: ${p}${l.text}`}).join("");let u=new Error(e);for(let[l,f]of[["errors",t],["warnings",n]])Object.defineProperty(u,l,{configurable:!0,enumerable:!0,get:()=>f,set:s=>Object.defineProperty(u,l,{configurable:!0,enumerable:!0,value:s})});return u}function ge(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Te(e,t,n){if(e==null)return null;let i={},u=r(e,i,"file",b),l=r(e,i,"namespace",b),f=r(e,i,"line",ce),s=r(e,i,"column",ce),o=r(e,i,"length",ce),m=r(e,i,"lineText",b),p=r(e,i,"suggestion",b);if(K(e,i,t),m){let y=m.slice(0,(s&&s>0?s:0)+(o&&o>0?o:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(m)&&(m=y)}return{file:u||"",namespace:l||"",line:f||0,column:s||0,length:o||0,lineText:m||"",suggestion:p||""}}function se(e,t,n,i,u){let l=[],f=0;for(let s of e){let o={},m=r(s,o,"id",b),p=r(s,o,"pluginName",b),y=r(s,o,"text",b),P=r(s,o,"location",Pe),L=r(s,o,"notes",oe),T=r(s,o,"detail",ve),j=`in element ${f} of "${t}"`;K(s,o,j);let C=[];if(L)for(let z of L){let V={},R=r(z,V,"text",b),h=r(z,V,"location",Pe);K(z,V,j),C.push({text:R||"",location:Te(h,j,u)})}l.push({id:m||"",pluginName:p||i,text:y||"",location:Te(P,j,u),notes:C,detail:n?n.store(T):-1}),f++}return l}function xe(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 at(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 ut({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=ae(u)),i}}}function Oe(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function ct(e){let t;try{t=ae(e)}catch(n){return Be(e)}return JSON.parse(t)}var dt="0.28.0",pt=e=>he().build(e),gt=e=>he().context(e),mt=(e,t)=>he().transform(e,t),yt=(e,t)=>he().formatMessages(e,t),ht=(e,t)=>he().analyzeMetafile(e,t),wt=()=>{throw new Error('The "buildSync" API only works in node')},bt=()=>{throw new Error('The "transformSync" API only works in node')},xt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},vt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Rt=()=>(Ee&&Ee(),Promise.resolve()),fe,Ee,ke,he=()=>{if(ke)return ke;throw fe?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')},Ot=e=>{e=We(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(fe)throw new Error('Cannot call "initialize" more than once');return fe=St(t||"",n,i),fe.catch(()=>{fe=void 0}),fe},St=async(e,t,n)=>{let i,u,l=new Promise(y=>u=y);if(n){let y=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.28.0"],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(y))}else{let y=(postMessage=>{
|
|
14
|
+
${s}:${o}:${m}: ERROR: ${p}${l.text}`}).join("");let u=new Error(e);for(let[l,f]of[["errors",t],["warnings",n]])Object.defineProperty(u,l,{configurable:!0,enumerable:!0,get:()=>f,set:s=>Object.defineProperty(u,l,{configurable:!0,enumerable:!0,value:s})});return u}function ge(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Te(e,t,n){if(e==null)return null;let i={},u=r(e,i,"file",b),l=r(e,i,"namespace",b),f=r(e,i,"line",ce),s=r(e,i,"column",ce),o=r(e,i,"length",ce),m=r(e,i,"lineText",b),p=r(e,i,"suggestion",b);if(K(e,i,t),m){let y=m.slice(0,(s&&s>0?s:0)+(o&&o>0?o:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(m)&&(m=y)}return{file:u||"",namespace:l||"",line:f||0,column:s||0,length:o||0,lineText:m||"",suggestion:p||""}}function se(e,t,n,i,u){let l=[],f=0;for(let s of e){let o={},m=r(s,o,"id",b),p=r(s,o,"pluginName",b),y=r(s,o,"text",b),P=r(s,o,"location",Pe),L=r(s,o,"notes",oe),T=r(s,o,"detail",ve),j=`in element ${f} of "${t}"`;K(s,o,j);let C=[];if(L)for(let z of L){let V={},R=r(z,V,"text",b),h=r(z,V,"location",Pe);K(z,V,j),C.push({text:R||"",location:Te(h,j,u)})}l.push({id:m||"",pluginName:p||i,text:y||"",location:Te(P,j,u),notes:C,detail:n?n.store(T):-1}),f++}return l}function xe(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 at(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 ut({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=ae(u)),i}}}function Oe(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function ct(e){let t;try{t=ae(e)}catch(n){return Be(e)}return JSON.parse(t)}var dt="0.28.2",pt=e=>he().build(e),gt=e=>he().context(e),mt=(e,t)=>he().transform(e,t),yt=(e,t)=>he().formatMessages(e,t),ht=(e,t)=>he().analyzeMetafile(e,t),wt=()=>{throw new Error('The "buildSync" API only works in node')},bt=()=>{throw new Error('The "transformSync" API only works in node')},xt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},vt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Rt=()=>(Ee&&Ee(),Promise.resolve()),fe,Ee,ke,he=()=>{if(ke)return ke;throw fe?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')},Ot=e=>{e=We(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(fe)throw new Error('Cannot call "initialize" more than once');return fe=St(t||"",n,i),fe.catch(()=>{fe=void 0}),fe},St=async(e,t,n)=>{let i,u,l=new Promise(y=>u=y);if(n){let y=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.28.2"],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(y))}else{let y=(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
|
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(`
|
|
19
19
|
`);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(`
|
|
20
20
|
`);h.length>1&&console.log(h.slice(0,-1).join(`
|
|
21
|
-
`)),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.28.
|
|
21
|
+
`)),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.28.2"],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);})(L=>i.onmessage({data:L})),P;i={onmessage:null,postMessage:L=>setTimeout(()=>{try{P=y({data:L})}catch(T){u(T)}}),terminate(){if(P)for(let L of P._scheduledTimeouts.values())clearTimeout(L)}}}let f,s,o=new Promise((y,P)=>{f=y,s=P});i.onmessage=({data:y})=>{i.onmessage=({data:P})=>m(P),y?s(y):f()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:m,service:p}=_e({writeToStdin(y){i.postMessage(y)},isSync:!1,hasFS:!1,esbuild:Ce});await o,Ee=()=>{i.terminate(),fe=void 0,Ee=void 0,ke=void 0},ke={build:y=>new Promise((P,L)=>{l.then(L),p.buildOrContext({callName:"build",refs:null,options:y,isTTY:!1,defaultWD:"/",callback:(T,j)=>T?L(T):P(j)})}),context:y=>new Promise((P,L)=>{l.then(L),p.buildOrContext({callName:"context",refs:null,options:y,isTTY:!1,defaultWD:"/",callback:(T,j)=>T?L(T):P(j)})}),transform:(y,P)=>new Promise((L,T)=>{l.then(T),p.transform({callName:"transform",refs:null,input:y,options:P||{},isTTY:!1,fs:{readFile(j,C){C(new Error("Internal error"),null)},writeFile(j,C){C(null)}},callback:(j,C)=>j?T(j):L(C)})}),formatMessages:(y,P)=>new Promise((L,T)=>{l.then(T),p.formatMessages({callName:"formatMessages",refs:null,messages:y,options:P,callback:(j,C)=>j?T(j):L(C)})}),analyzeMetafile:(y,P)=>new Promise((L,T)=>{l.then(T),p.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof y=="string"?y:JSON.stringify(y),options:P,callback:(j,C)=>j?T(j):L(C)})})}},Et=Ce;export{ht as analyzeMetafile,vt as analyzeMetafileSync,pt as build,wt as buildSync,gt as context,Et as default,yt as formatMessages,xt as formatMessagesSync,Ot as initialize,Rt as stop,mt as transform,bt as transformSync,dt as version};
|
package/lib/browser.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type Platform = 'browser' | 'node' | 'neutral'
|
|
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
3
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
export type LogStyle = 'default' | 'visualstudio'
|
|
5
6
|
export type Charset = 'ascii' | 'utf8'
|
|
6
7
|
export type Drop = 'console' | 'debugger'
|
|
7
8
|
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
@@ -86,6 +87,8 @@ interface CommonOptions {
|
|
|
86
87
|
logLimit?: number
|
|
87
88
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
88
89
|
logOverride?: Record<string, LogLevel>
|
|
90
|
+
/** Documentation: https://esbuild.github.io/api/#log-style */
|
|
91
|
+
logStyle?: LogStyle
|
|
89
92
|
|
|
90
93
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
|
91
94
|
tsconfigRaw?: string | TsconfigRaw
|
|
@@ -509,6 +512,7 @@ export interface FormatMessagesOptions {
|
|
|
509
512
|
kind: 'error' | 'warning'
|
|
510
513
|
color?: boolean
|
|
511
514
|
terminalWidth?: number
|
|
515
|
+
logStyle?: LogStyle
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
export interface AnalyzeMetafileOptions {
|
package/lib/browser.js
CHANGED
|
@@ -583,10 +583,12 @@ function pushLogFlags(flags, options, keys, isTTY, logLevelDefault) {
|
|
|
583
583
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
584
584
|
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
585
585
|
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
586
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
586
587
|
if (color !== void 0) flags.push(`--color=${color}`);
|
|
587
588
|
else if (isTTY) flags.push(`--color=true`);
|
|
588
589
|
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
589
590
|
flags.push(`--log-limit=${logLimit || 0}`);
|
|
591
|
+
if (logStyle) flags.push(`--log-style=${logStyle}`);
|
|
590
592
|
}
|
|
591
593
|
function validateStringValue(value, what, key) {
|
|
592
594
|
if (typeof value !== "string") {
|
|
@@ -935,8 +937,8 @@ function createChannel(streamIn) {
|
|
|
935
937
|
if (isFirstPacket) {
|
|
936
938
|
isFirstPacket = false;
|
|
937
939
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
938
|
-
if (binaryVersion !== "0.28.
|
|
939
|
-
throw new Error(`Cannot start service: Host version "${"0.28.
|
|
940
|
+
if (binaryVersion !== "0.28.2") {
|
|
941
|
+
throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`);
|
|
940
942
|
}
|
|
941
943
|
return;
|
|
942
944
|
}
|
|
@@ -1075,6 +1077,7 @@ function createChannel(streamIn) {
|
|
|
1075
1077
|
let kind = getFlag(options, keys, "kind", mustBeString);
|
|
1076
1078
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
1077
1079
|
let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
|
|
1080
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
1078
1081
|
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
1079
1082
|
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
1080
1083
|
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
@@ -1085,6 +1088,7 @@ function createChannel(streamIn) {
|
|
|
1085
1088
|
};
|
|
1086
1089
|
if (color !== void 0) request.color = color;
|
|
1087
1090
|
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
1091
|
+
if (logStyle !== void 0) request.logStyle = logStyle;
|
|
1088
1092
|
sendRequest(refs, request, (error, response) => {
|
|
1089
1093
|
if (error) return callback(new Error(error), null);
|
|
1090
1094
|
callback(null, response.messages);
|
|
@@ -1894,7 +1898,7 @@ function parseJSON(bytes) {
|
|
|
1894
1898
|
}
|
|
1895
1899
|
|
|
1896
1900
|
// lib/npm/browser.ts
|
|
1897
|
-
var version = "0.28.
|
|
1901
|
+
var version = "0.28.2";
|
|
1898
1902
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1899
1903
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1900
1904
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1942,7 +1946,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(null, null
|
|
|
1942
1946
|
let rejectAllWith;
|
|
1943
1947
|
const rejectAllPromise = new Promise((resolve) => rejectAllWith = resolve);
|
|
1944
1948
|
if (useWorker) {
|
|
1945
|
-
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.28.0"}`];\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" });
|
|
1949
|
+
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.28.2"}`];\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" });
|
|
1946
1950
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1947
1951
|
} else {
|
|
1948
1952
|
let onmessage = ((postMessage) => {
|
|
@@ -2582,7 +2586,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(null, null
|
|
|
2582
2586
|
callback(null, count);
|
|
2583
2587
|
};
|
|
2584
2588
|
let go = new globalThis.Go();
|
|
2585
|
-
go.argv = ["", `--service=${"0.28.
|
|
2589
|
+
go.argv = ["", `--service=${"0.28.2"}`];
|
|
2586
2590
|
tryToInstantiateModule(wasm, go).then(
|
|
2587
2591
|
(instance) => {
|
|
2588
2592
|
postMessage(null);
|
package/lib/browser.min.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
(module=>{
|
|
2
|
-
"use strict";var Ae=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.prototype.hasOwnProperty;var tt=(e,t)=>{for(var n in t)Ae(e,n,{get:t[n],enumerable:!0})},nt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ze(t))!et.call(e,a)&&a!==n&&Ae(e,a,{get:()=>t[a],enumerable:!(i=Xe(t,a))||i.enumerable});return e};var rt=e=>nt(Ae({},"__esModule",{value:!0}),e);var ne=(e,t,n)=>new Promise((i,a)=>{var l=o=>{try{s(n.next(o))}catch(
|
|
2
|
+
"use strict";var Ae=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.prototype.hasOwnProperty;var tt=(e,t)=>{for(var n in t)Ae(e,n,{get:t[n],enumerable:!0})},nt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ze(t))!et.call(e,a)&&a!==n&&Ae(e,a,{get:()=>t[a],enumerable:!(i=Xe(t,a))||i.enumerable});return e};var rt=e=>nt(Ae({},"__esModule",{value:!0}),e);var ne=(e,t,n)=>new Promise((i,a)=>{var l=o=>{try{s(n.next(o))}catch(d){a(d)}},f=o=>{try{s(n.throw(o))}catch(d){a(d)}},s=o=>o.done?i(o.value):Promise.resolve(o.value).then(l,f);s((n=n.apply(e,t)).next())});var $e={};tt($e,{analyzeMetafile:()=>Ot,analyzeMetafileSync:()=>Ct,build:()=>bt,buildSync:()=>St,context:()=>xt,default:()=>Ft,formatMessages:()=>Rt,formatMessagesSync:()=>kt,initialize:()=>At,stop:()=>$t,transform:()=>vt,transformSync:()=>Et,version:()=>wt});module.exports=rt($e);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 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 be;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Le(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return ue(n.read());case 4:return n.read();case 5:{let f=n.read32(),s=[];for(let o=0;o<f;o++)s.push(t());return s}case 6:{let f=n.read32(),s={};for(let o=0;o<f;o++)s[ue(n.read())]=t();return s}default:throw new Error("Invalid packet")}},n=new be(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 be=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);Fe(this.buf,t,n)}write(t){let n=this._write(4+t.length);Fe(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 Be(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,ue,De;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;Z=n=>e.encode(n),ue=n=>t.decode(n),De='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")Z=e=>Buffer.from(e),ue=e=>{let{buffer:t,byteOffset:n,byteLength:i}=e;return Buffer.from(t,n,i).toString()},De='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(Z("")instanceof Uint8Array))throw new Error(`Invariant violation: "${De} 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 Be(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Fe(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var oe=String.fromCharCode;function ee(e,t,n){let i=e[t],a=1,l=0;for(let f=0;f<t;f++)e[f]===10?(a++,l=0):l++;throw new SyntaxError(n||(t===e.length?"Unexpected end of input while parsing JSON":i>=32&&i<=126?`Unexpected character ${oe(i)} in JSON at position ${t} (line ${a}, column ${l})`:`Unexpected byte 0x${i.toString(16)} in JSON at position ${t} (line ${a}, column ${l})`))}function Ue(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let t=[],n=[],i=[],a=e.length,l=null,f=0,s,o=0;for(;o<a;){let
|
|
8
|
-
`;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:{let y=0;for(let U=0;U<4;U++)p=e[o++],y<<=4,p>=48&&p<=57?y|=p-48:p>=97&&p<=102?y|=p+-87:p>=65&&p<=70?y|=p+-55:ee(e,--o);g+=oe(y);break}default:ee(e,--o);break}else if(p<=127)g+=oe(p);else if((p&224)===192)g+=oe((p&31)<<6|e[o++]&63);else if((p&240)===224)g+=oe((p&15)<<12|(e[o++]&63)<<6|e[o++]&63);else if((p&248)==240){let y=(p&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;y>65535&&(y-=65536,g+=oe(y>>10&1023|55296),y=56320|y&1023),g+=oe(y)}g[0];break}case 91:{g=[],t.push(l),n.push(s),i.push(f),l=null,s=g,f=1;continue}case 123:{g={},t.push(l),n.push(s),i.push(f),l=null,s=g,f=2;continue}case 93:{f!==1&&ee(e,--o),g=s,l=t.pop(),s=n.pop(),f=i.pop();break}case 125:{f!==2&&ee(e,--o),g=s,l=t.pop(),s=n.pop(),f=i.pop();break}default:ee(e,--o)}for(p=e[o];p<=32;)p=e[++o];switch(f){case 0:{if(o===a)return g;break}case 1:{if(s.push(g),p===44){o++;continue}if(p===93)continue;break}case 2:{if(l===null){if(l=g,p===58){o++;continue}}else{if(s[l]=g,l=null,p===44){o++;continue}if(p===125)continue}break}}break}ee(e,o)}var _=JSON.stringify,Pe="warning",Te="silent";function ge(e,t){let n=[];for(let i of e){if(Q(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var Re=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",b=e=>typeof e=="string"?null:"a string",Oe=e=>e instanceof RegExp?null:"a RegExp object",fe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",lt=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",qe=e=>typeof e=="function"?null:"a function",se=e=>Array.isArray(e)?null:"an array",Y=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ot=e=>typeof e=="object"&&e!==null?null:"an array or an object",st=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ie=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",at=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",We=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",ze=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",ut=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 Ke(e){let t=Object.create(null),n=r(e,t,"wasmURL",ut),i=r(e,t,"wasmModule",st),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:a}}function _e(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 Ee(e,t,n,i,a){let l=r(t,n,"color",I),f=r(t,n,"logLevel",b),s=r(t,n,"logLimit",fe);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||a}`),e.push(`--log-limit=${s||0}`)}function Q(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 Ve(e,t,n){let i=r(t,n,"legalComments",b),a=r(t,n,"sourceRoot",b),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",We),s=r(t,n,"format",b),o=r(t,n,"globalName",b),p=r(t,n,"mangleProps",Oe),g=r(t,n,"reserveProps",Oe),y=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),T=r(t,n,"minifyWhitespace",I),j=r(t,n,"minifyIdentifiers",I),k=r(t,n,"lineLimit",fe),z=r(t,n,"drop",Y),V=r(t,n,"dropLabels",Y),R=r(t,n,"charset",b),h=r(t,n,"treeShaking",I),m=r(t,n,"ignoreAnnotations",I),u=r(t,n,"jsx",b),O=r(t,n,"jsxFactory",b),E=r(t,n,"jsxFragment",b),A=r(t,n,"jsxImportSource",b),P=r(t,n,"jsxDev",I),c=r(t,n,"jsxSideEffects",I),d=r(t,n,"define",G),v=r(t,n,"logOverride",G),C=r(t,n,"supported",G),M=r(t,n,"pure",Y),$=r(t,n,"keepNames",I),S=r(t,n,"platform",b),D=r(t,n,"tsconfigRaw",at),q=r(t,n,"absPaths",Y);if(i&&e.push(`--legal-comments=${i}`),a!==void 0&&e.push(`--source-root=${a}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&e.push(`--target=${ge(Array.isArray(f)?f:[f],"target")}`),s&&e.push(`--format=${s}`),o&&e.push(`--global-name=${o}`),S&&e.push(`--platform=${S}`),D&&e.push(`--tsconfig-raw=${typeof D=="string"?D:JSON.stringify(D)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),j&&e.push("--minify-identifiers"),k&&e.push(`--line-limit=${k}`),R&&e.push(`--charset=${R}`),h!==void 0&&e.push(`--tree-shaking=${h}`),m&&e.push("--ignore-annotations"),z)for(let w of z)e.push(`--drop:${Q(w,"drop")}`);if(V&&e.push(`--drop-labels=${ge(V,"drop label")}`),q&&e.push(`--abs-paths=${ge(q,"abs paths")}`),p&&e.push(`--mangle-props=${Se(p)}`),g&&e.push(`--reserve-props=${Se(g)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),u&&e.push(`--jsx=${u}`),O&&e.push(`--jsx-factory=${O}`),E&&e.push(`--jsx-fragment=${E}`),A&&e.push(`--jsx-import-source=${A}`),P&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),d)for(let w in d){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${Q(d[w],"define",w)}`)}if(v)for(let w in v){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${Q(v[w],"log override",w)}`)}if(C)for(let w in C){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);let F=C[w];if(typeof F!="boolean")throw new Error(`Expected value for supported ${_(w)} to be a boolean, got ${typeof F} instead`);e.push(`--supported:${w}=${F}`)}if(M)for(let w of M)e.push(`--pure:${Q(w,"pure")}`);$&&e.push("--keep-names")}function ct(e,t,n,i,a){var re;let l=[],f=[],s=Object.create(null),o=null,p=null;Ee(l,t,s,n,i),Ve(l,t,s);let g=r(t,s,"sourcemap",Ie),y=r(t,s,"bundle",I),U=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),T=r(t,s,"metafile",I),j=r(t,s,"outfile",b),k=r(t,s,"outdir",b),z=r(t,s,"outbase",b),V=r(t,s,"tsconfig",b),R=r(t,s,"resolveExtensions",Y),h=r(t,s,"nodePaths",Y),m=r(t,s,"mainFields",Y),u=r(t,s,"conditions",Y),O=r(t,s,"external",Y),E=r(t,s,"packages",b),A=r(t,s,"alias",G),P=r(t,s,"loader",G),c=r(t,s,"outExtension",G),d=r(t,s,"publicPath",b),v=r(t,s,"entryNames",b),C=r(t,s,"chunkNames",b),M=r(t,s,"assetNames",b),$=r(t,s,"inject",Y),S=r(t,s,"banner",G),D=r(t,s,"footer",G),q=r(t,s,"entryPoints",ot),w=r(t,s,"absWorkingDir",b),F=r(t,s,"stdin",G),N=(re=r(t,s,"write",I))!=null?re:a,L=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",G);if(s.plugins=!0,K(t,s,`in ${e}() call`),g&&l.push(`--sourcemap${g===!0?"":`=${g}`}`),y&&l.push("--bundle"),L&&l.push("--allow-overwrite"),U&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),T&&l.push("--metafile"),j&&l.push(`--outfile=${j}`),k&&l.push(`--outdir=${k}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),E&&l.push(`--packages=${E}`),R&&l.push(`--resolve-extensions=${ge(R,"resolve extension")}`),d&&l.push(`--public-path=${d}`),v&&l.push(`--entry-names=${v}`),C&&l.push(`--chunk-names=${C}`),M&&l.push(`--asset-names=${M}`),m&&l.push(`--main-fields=${ge(m,"main field")}`),u&&l.push(`--conditions=${ge(u,"condition")}`),O)for(let x of O)l.push(`--external:${Q(x,"external")}`);if(A)for(let x in A){if(x.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${x}`);l.push(`--alias:${x}=${Q(A[x],"alias",x)}`)}if(S)for(let x in S){if(x.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${x}`);l.push(`--banner:${x}=${Q(S[x],"banner",x)}`)}if(D)for(let x in D){if(x.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${x}`);l.push(`--footer:${x}=${Q(D[x],"footer",x)}`)}if($)for(let x of $)l.push(`--inject:${Q(x,"inject")}`);if(P)for(let x in P){if(x.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${x}`);l.push(`--loader:${x}=${Q(P[x],"loader",x)}`)}if(c)for(let x in c){if(x.indexOf("=")>=0)throw new Error(`Invalid out extension: ${x}`);l.push(`--out-extension:${x}=${Q(c[x],"out extension",x)}`)}if(q)if(Array.isArray(q))for(let x=0,ie=q.length;x<ie;x++){let H=q[x];if(typeof H=="object"&&H!==null){let te=Object.create(null),le=r(H,te,"in",b),X=r(H,te,"out",b);if(K(H,te,"in entry point at index "+x),le===void 0)throw new Error('Missing property "in" for entry point at index '+x);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+x);f.push([X,le])}else f.push(["",Q(H,"entry point at index "+x)])}else for(let x in q)f.push([x,Q(q[x],"entry point",x)]);if(F){let x=Object.create(null),ie=r(F,x,"contents",ze),H=r(F,x,"resolveDir",b),te=r(F,x,"sourcefile",b),le=r(F,x,"loader",b);K(F,x,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),le&&l.push(`--loader=${le}`),H&&(p=H),typeof ie=="string"?o=Z(ie):ie instanceof Uint8Array&&(o=ie)}let W=[];if(h)for(let x of h)x+="",W.push(x);return{entries:f,flags:l,write:N,stdinContents:o,stdinResolveDir:p,absWorkingDir:w,nodePaths:W,mangleCache:_e(J)}}function ft(e,t,n,i){let a=[],l=Object.create(null);Ee(a,t,l,n,i),Ve(a,t,l);let f=r(t,l,"sourcemap",Ie),s=r(t,l,"sourcefile",b),o=r(t,l,"loader",b),p=r(t,l,"banner",b),g=r(t,l,"footer",b),y=r(t,l,"mangleCache",G);return K(t,l,`in ${e}() call`),f&&a.push(`--sourcemap=${f===!0?"external":f}`),s&&a.push(`--sourcefile=${s}`),o&&a.push(`--loader=${o}`),p&&a.push(`--banner=${p}`),g&&a.push(`--footer=${g}`),{flags:a,mangleCache:_e(y)}}function Je(e){let t={},n={didClose:!1,reason:""},i={},a=0,l=0,f=new Uint8Array(16*1024),s=0,o=R=>{let h=s+R.length;if(h>f.length){let u=new Uint8Array(h*2);u.set(f),f=u}f.set(R,s),s+=R.length;let m=0;for(;m+4<=s;){let u=Be(f,m);if(m+4+u>s)break;m+=4,T(f.subarray(m,m+u)),m+=u}m>0&&(f.copyWithin(0,m,s),s-=m)},p=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let h="The service was stopped"+n.reason;for(let m in i)i[m](h,null);i={}},g=(R,h,m)=>{if(n.didClose)return m("The service is no longer running"+n.reason,null);let u=a++;i[u]=(O,E)=>{try{m(O,E)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(Me({id:u,isRequest:!0,value:h}))},y=(R,h)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Me({id:R,isRequest:!1,value:h}))},U=(R,h)=>ne(null,null,function*(){try{if(h.command==="ping"){y(R,{});return}if(typeof h.key=="number"){let m=t[h.key];if(!m)return;let u=m[h.command];if(u){yield u(R,h);return}}throw new Error("Invalid command: "+h.command)}catch(m){let u=[ce(m,e,null,void 0,"")];try{y(R,{errors:u})}catch(O){}}}),B=!0,T=R=>{if(B){B=!1;let m=String.fromCharCode(...R);if(m!=="0.28.0")throw new Error(`Cannot start service: Host version "0.28.0" does not match binary version ${_(m)}`);return}let h=Le(R);if(h.isRequest)U(h.id,h.value);else{let m=i[h.id];delete i[h.id],h.value.error?m(h.value.error,{}):m(null,h.value)}};return{readFromStdout:o,afterClose:p,service:{buildOrContext:({callName:R,refs:h,options:m,isTTY:u,defaultWD:O,callback:E})=>{let A=0,P=l++,c={},d={ref(){++A===1&&h&&h.ref()},unref(){--A===0&&(delete t[P],h&&h.unref())}};t[P]=c,d.ref(),dt(R,P,g,y,d,e,c,m,u,O,(v,C)=>{try{E(v,C)}finally{d.unref()}})},transform:({callName:R,refs:h,input:m,options:u,isTTY:O,fs:E,callback:A})=>{let P=Qe(),c=d=>{try{if(typeof m!="string"&&!(m instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:v,mangleCache:C}=ft(R,u,O,Te),M={command:"transform",flags:v,inputFS:d!==null,input:d!==null?Z(d):typeof m=="string"?Z(m):m};C&&(M.mangleCache=C),g(h,M,($,S)=>{if($)return A(new Error($),null);let D=me(S.errors,P),q=me(S.warnings,P),w=1,F=()=>{if(--w===0){let N={warnings:q,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(N.legalComments=S==null?void 0:S.legalComments),S.mangleCache&&(N.mangleCache=S==null?void 0:S.mangleCache),A(null,N)}};if(D.length>0)return A(he("Transform failed",D,q),null);S.codeFS&&(w++,E.readFile(S.code,(N,L)=>{N!==null?A(N,null):(S.code=L,F())})),S.mapFS&&(w++,E.readFile(S.map,(N,L)=>{N!==null?A(N,null):(S.map=L,F())})),F()})}catch(v){let C=[];try{Ee(C,u,{},O,Te)}catch($){}let M=ce(v,e,P,void 0,"");g(h,{command:"error",flags:C,error:M},()=>{M.detail=P.load(M.detail),A(he("Transform failed",[M],[]),null)})}};if((typeof m=="string"||m instanceof Uint8Array)&&m.length>1024*1024){let d=c;c=()=>E.writeFile(m,d)}c(null)},formatMessages:({callName:R,refs:h,messages:m,options:u,callback:O})=>{if(!u)throw new Error(`Missing second argument in ${R}() call`);let E={},A=r(u,E,"kind",b),P=r(u,E,"color",I),c=r(u,E,"terminalWidth",fe);if(K(u,E,`in ${R}() call`),A===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(A!=="error"&&A!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let d={command:"format-msgs",messages:ae(m,"messages",null,"",c),isWarning:A==="warning"};P!==void 0&&(d.color=P),c!==void 0&&(d.terminalWidth=c),g(h,d,(v,C)=>{if(v)return O(new Error(v),null);O(null,C.messages)})},analyzeMetafile:({callName:R,refs:h,metafile:m,options:u,callback:O})=>{u===void 0&&(u={});let E={},A=r(u,E,"color",I),P=r(u,E,"verbose",I);K(u,E,`in ${R}() call`);let c={command:"analyze-metafile",metafile:m};A!==void 0&&(c.color=A),P!==void 0&&(c.verbose=P),g(h,c,(d,v)=>{if(d)return O(new Error(d),null);O(null,v.result)})}}}}function dt(e,t,n,i,a,l,f,s,o,p,g){let y=Qe(),U=e==="context",B=(k,z)=>{let V=[];try{Ee(V,s,{},o,Pe)}catch(h){}let R=ce(k,l,y,void 0,z);n(a,{command:"error",flags:V,error:R},()=>{R.detail=y.load(R.detail),g(he(U?"Context failed":"Build failed",[R],[]),null)})},T;if(typeof s=="object"){let k=s.plugins;if(k!==void 0){if(!Array.isArray(k))return B(new Error('"plugins" must be an array'),"");T=k}}if(T&&T.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");pt(t,n,i,a,l,f,s,T,y).then(k=>{if(!k.ok)return B(k.error,k.pluginName);try{j(k.requestPlugins,k.runOnEndCallbacks,k.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},k=>B(k,""));return}try{j(null,(k,z)=>z([],[]),()=>{})}catch(k){B(k,"")}function j(k,z,V){let R=l.hasFS,{entries:h,flags:m,write:u,stdinContents:O,stdinResolveDir:E,absWorkingDir:A,nodePaths:P,mangleCache:c}=ct(e,s,o,Pe,R);if(u&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let d={command:"build",key:t,entries:h,flags:m,write:u,stdinContents:O,stdinResolveDir:E,absWorkingDir:A||p,nodePaths:P,context:U};k&&(d.plugins=k),c&&(d.mangleCache=c);let v=($,S)=>{let D={errors:me($.errors,y),warnings:me($.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=D.errors.slice(),w=D.warnings.slice();$.outputFiles&&(D.outputFiles=$.outputFiles.map(mt)),$.metafile&&$.metafile.length&&(D.metafile=yt($.metafile)),$.mangleCache&&(D.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(ue($.writeToStdout).replace(/\n$/,"")),z(D,(F,N)=>{if(q.length>0||F.length>0){let L=he("Build failed",q.concat(F),w.concat(N));return S(L,null,F,N)}S(null,D,F,N)})},C,M;U&&(f["on-end"]=($,S)=>new Promise(D=>{v(S,(q,w,F,N)=>{let L={errors:F,warnings:N};M&&M(q,w),C=void 0,M=void 0,i($,L),D()})})),n(a,d,($,S)=>{if($)return g(new Error($),null);if(!U)return v(S,(w,F)=>(V(),g(w,F)));if(S.errors.length>0)return g(he("Context failed",S.errors,S.warnings),null);let D=!1,q={rebuild:()=>(C||(C=new Promise((w,F)=>{let N;M=(J,W)=>{N||(N=()=>J?F(J):w(W))};let L=()=>{n(a,{command:"rebuild",key:t},(W,re)=>{W?F(new Error(W)):N?N():L()})};L()})),C),watch:(w={})=>new Promise((F,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let L={},J=r(w,L,"delay",fe);K(w,L,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(a,W,re=>{re?N(new Error(re)):F(void 0)})}),serve:(w={})=>new Promise((F,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},J=r(w,L,"port",lt),W=r(w,L,"host",b),re=r(w,L,"servedir",b),x=r(w,L,"keyfile",b),ie=r(w,L,"certfile",b),H=r(w,L,"fallback",b),te=r(w,L,"cors",G),le=r(w,L,"onRequest",qe);K(w,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!le};if(J!==void 0&&(X.port=J),W!==void 0&&(X.host=W),re!==void 0&&(X.servedir=re),x!==void 0&&(X.keyfile=x),ie!==void 0&&(X.certfile=ie),H!==void 0&&(X.fallback=H),te){let ye={},pe=r(te,ye,"origin",We);K(te,ye,'on "cors" object'),Array.isArray(pe)?X.corsOrigin=pe:pe!==void 0&&(X.corsOrigin=[pe])}n(a,X,(ye,pe)=>{if(ye)return N(new Error(ye));le&&(f["serve-request"]=(Ge,He)=>{le(He.args),i(Ge,{})}),F(pe)})}),cancel:()=>new Promise(w=>{if(D)return w();n(a,{command:"cancel",key:t},()=>{w()})}),dispose:()=>new Promise(w=>{if(D)return w();D=!0,n(a,{command:"dispose",key:t},()=>{w(),V(),a.unref()})})};a.ref(),g(null,q)})}}var pt=(e,t,n,i,a,l,f,s,o)=>ne(null,null,function*(){let p=[],g=[],y={},U={},B=[],T=0,j=0,k=[],z=!1;s=[...s];for(let h of s){let m={};if(typeof h!="object")throw new Error(`Plugin at index ${j} must be an object`);let u=r(h,m,"name",b);if(typeof u!="string"||u==="")throw new Error(`Plugin at index ${j} is missing a name`);try{let O=r(h,m,"setup",qe);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(h,m,`on plugin ${_(u)}`);let E={name:u,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};j++;let P=O({initialOptions:f,resolve:(c,d={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let v=Object.create(null),C=r(d,v,"pluginName",b),M=r(d,v,"importer",b),$=r(d,v,"namespace",b),S=r(d,v,"resolveDir",b),D=r(d,v,"kind",b),q=r(d,v,"pluginData",Re),w=r(d,v,"with",G);return K(d,v,"in resolve() call"),new Promise((F,N)=>{let L={command:"resolve",path:c,key:e,pluginName:u};if(C!=null&&(L.pluginName=C),M!=null&&(L.importer=M),$!=null&&(L.namespace=$),S!=null&&(L.resolveDir=S),D!=null)L.kind=D;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(L.pluginData=o.store(q)),w!=null&&(L.with=gt(w,"with")),t(i,L,(J,W)=>{J!==null?N(new Error(J)):F({errors:me(W.errors,o),warnings:me(W.warnings,o),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:o.load(W.pluginData)})})})},onStart(c){let d='This error came from the "onStart" callback registered here:',v=xe(new Error(d),a,"onStart");p.push({name:u,callback:c,note:v}),E.onStart=!0},onEnd(c){let d='This error came from the "onEnd" callback registered here:',v=xe(new Error(d),a,"onEnd");g.push({name:u,callback:c,note:v}),E.onEnd=!0},onResolve(c,d){let v='This error came from the "onResolve" callback registered here:',C=xe(new Error(v),a,"onResolve"),M={},$=r(c,M,"filter",Oe),S=r(c,M,"namespace",b);if(K(c,M,`in onResolve() call for plugin ${_(u)}`),$==null)throw new Error("onResolve() call is missing a filter");let D=T++;y[D]={name:u,callback:d,note:C},E.onResolve.push({id:D,filter:Se($),namespace:S||""})},onLoad(c,d){let v='This error came from the "onLoad" callback registered here:',C=xe(new Error(v),a,"onLoad"),M={},$=r(c,M,"filter",Oe),S=r(c,M,"namespace",b);if(K(c,M,`in onLoad() call for plugin ${_(u)}`),$==null)throw new Error("onLoad() call is missing a filter");let D=T++;U[D]={name:u,callback:d,note:C},E.onLoad.push({id:D,filter:Se($),namespace:S||""})},onDispose(c){B.push(c)},esbuild:a.esbuild});P&&(yield P),k.push(E)}catch(O){return{ok:!1,error:O,pluginName:u}}}l["on-start"]=(h,m)=>ne(null,null,function*(){o.clear();let u={errors:[],warnings:[]};yield Promise.all(p.map(P=>ne(null,[P],function*({name:O,callback:E,note:A}){try{let c=yield E();if(c!=null){if(typeof c!="object")throw new Error(`Expected onStart() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"errors",se),C=r(c,d,"warnings",se);K(c,d,`from onStart() callback in plugin ${_(O)}`),v!=null&&u.errors.push(...ae(v,"errors",o,O,void 0)),C!=null&&u.warnings.push(...ae(C,"warnings",o,O,void 0))}}catch(c){u.errors.push(ce(c,a,o,A&&A(),O))}}))),n(h,u)}),l["on-resolve"]=(h,m)=>ne(null,null,function*(){let u={},O="",E,A;for(let P of m.ids)try{({name:O,callback:E,note:A}=y[P]);let c=yield E({path:m.path,importer:m.importer,namespace:m.namespace,resolveDir:m.resolveDir,kind:m.kind,pluginData:o.load(m.pluginData),with:m.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),C=r(c,d,"path",b),M=r(c,d,"namespace",b),$=r(c,d,"suffix",b),S=r(c,d,"external",I),D=r(c,d,"sideEffects",I),q=r(c,d,"pluginData",Re),w=r(c,d,"errors",se),F=r(c,d,"warnings",se),N=r(c,d,"watchFiles",Y),L=r(c,d,"watchDirs",Y);K(c,d,`from onResolve() callback in plugin ${_(O)}`),u.id=P,v!=null&&(u.pluginName=v),C!=null&&(u.path=C),M!=null&&(u.namespace=M),$!=null&&(u.suffix=$),S!=null&&(u.external=S),D!=null&&(u.sideEffects=D),q!=null&&(u.pluginData=o.store(q)),w!=null&&(u.errors=ae(w,"errors",o,O,void 0)),F!=null&&(u.warnings=ae(F,"warnings",o,O,void 0)),N!=null&&(u.watchFiles=ve(N,"watchFiles")),L!=null&&(u.watchDirs=ve(L,"watchDirs"));break}}catch(c){u={id:P,errors:[ce(c,a,o,A&&A(),O)]};break}n(h,u)}),l["on-load"]=(h,m)=>ne(null,null,function*(){let u={},O="",E,A;for(let P of m.ids)try{({name:O,callback:E,note:A}=U[P]);let c=yield E({path:m.path,namespace:m.namespace,suffix:m.suffix,pluginData:o.load(m.pluginData),with:m.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),C=r(c,d,"contents",ze),M=r(c,d,"resolveDir",b),$=r(c,d,"pluginData",Re),S=r(c,d,"loader",b),D=r(c,d,"errors",se),q=r(c,d,"warnings",se),w=r(c,d,"watchFiles",Y),F=r(c,d,"watchDirs",Y);K(c,d,`from onLoad() callback in plugin ${_(O)}`),u.id=P,v!=null&&(u.pluginName=v),C instanceof Uint8Array?u.contents=C:C!=null&&(u.contents=Z(C)),M!=null&&(u.resolveDir=M),$!=null&&(u.pluginData=o.store($)),S!=null&&(u.loader=S),D!=null&&(u.errors=ae(D,"errors",o,O,void 0)),q!=null&&(u.warnings=ae(q,"warnings",o,O,void 0)),w!=null&&(u.watchFiles=ve(w,"watchFiles")),F!=null&&(u.watchDirs=ve(F,"watchDirs"));break}}catch(c){u={id:P,errors:[ce(c,a,o,A&&A(),O)]};break}n(h,u)});let V=(h,m)=>m([],[]);g.length>0&&(V=(h,m)=>{ne(null,null,function*(){let u=[],O=[];for(let{name:E,callback:A,note:P}of g){let c,d;try{let v=yield A(h);if(v!=null){if(typeof v!="object")throw new Error(`Expected onEnd() callback in plugin ${_(E)} to return an object`);let C={},M=r(v,C,"errors",se),$=r(v,C,"warnings",se);K(v,C,`from onEnd() callback in plugin ${_(E)}`),M!=null&&(c=ae(M,"errors",o,E,void 0)),$!=null&&(d=ae($,"warnings",o,E,void 0))}}catch(v){c=[ce(v,a,o,P&&P(),E)]}if(c){u.push(...c);try{h.errors.push(...c)}catch(v){}}if(d){O.push(...d);try{h.warnings.push(...d)}catch(v){}}}m(u,O)})});let R=()=>{for(let h of B)setTimeout(()=>h(),0)};return z=!0,{ok:!0,requestPlugins:k,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:R}});function Qe(){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 xe(e,t,n){let i,a=!1;return()=>{if(a)return i;a=!0;try{let l=(e.stack+"").split(`
|
|
7
|
+
`);function Be(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Fe(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var oe=String.fromCharCode;function ee(e,t,n){let i=e[t],a=1,l=0;for(let f=0;f<t;f++)e[f]===10?(a++,l=0):l++;throw new SyntaxError(n||(t===e.length?"Unexpected end of input while parsing JSON":i>=32&&i<=126?`Unexpected character ${oe(i)} in JSON at position ${t} (line ${a}, column ${l})`:`Unexpected byte 0x${i.toString(16)} in JSON at position ${t} (line ${a}, column ${l})`))}function Ue(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let t=[],n=[],i=[],a=e.length,l=null,f=0,s,o=0;for(;o<a;){let d=e[o++];if(d<=32)continue;let g;switch(f===2&&l===null&&d!==34&&d!==125&&ee(e,--o),d){case 116:{(e[o++]!==114||e[o++]!==117||e[o++]!==101)&&ee(e,--o),g=!0;break}case 102:{(e[o++]!==97||e[o++]!==108||e[o++]!==115||e[o++]!==101)&&ee(e,--o),g=!1;break}case 110:{(e[o++]!==117||e[o++]!==108||e[o++]!==108)&&ee(e,--o),g=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let y=o;for(g=oe(d),d=e[o];;){switch(d){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{g+=oe(d),d=e[++o];continue}}break}g=+g,isNaN(g)&&ee(e,--y,"Invalid number");break}case 34:{for(g="";o>=a&&ee(e,a),d=e[o++],d!==34;)if(d===92)switch(e[o++]){case 34:g+='"';break;case 47:g+="/";break;case 92:g+="\\";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
|
|
8
|
+
`;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:{let y=0;for(let U=0;U<4;U++)d=e[o++],y<<=4,d>=48&&d<=57?y|=d-48:d>=97&&d<=102?y|=d+-87:d>=65&&d<=70?y|=d+-55:ee(e,--o);g+=oe(y);break}default:ee(e,--o);break}else if(d<=127)g+=oe(d);else if((d&224)===192)g+=oe((d&31)<<6|e[o++]&63);else if((d&240)===224)g+=oe((d&15)<<12|(e[o++]&63)<<6|e[o++]&63);else if((d&248)==240){let y=(d&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;y>65535&&(y-=65536,g+=oe(y>>10&1023|55296),y=56320|y&1023),g+=oe(y)}g[0];break}case 91:{g=[],t.push(l),n.push(s),i.push(f),l=null,s=g,f=1;continue}case 123:{g={},t.push(l),n.push(s),i.push(f),l=null,s=g,f=2;continue}case 93:{f!==1&&ee(e,--o),g=s,l=t.pop(),s=n.pop(),f=i.pop();break}case 125:{f!==2&&ee(e,--o),g=s,l=t.pop(),s=n.pop(),f=i.pop();break}default:ee(e,--o)}for(d=e[o];d<=32;)d=e[++o];switch(f){case 0:{if(o===a)return g;break}case 1:{if(s.push(g),d===44){o++;continue}if(d===93)continue;break}case 2:{if(l===null){if(l=g,d===58){o++;continue}}else{if(s[l]=g,l=null,d===44){o++;continue}if(d===125)continue}break}}break}ee(e,o)}var _=JSON.stringify,Pe="warning",Te="silent";function ge(e,t){let n=[];for(let i of e){if(Q(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var Re=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",b=e=>typeof e=="string"?null:"a string",Oe=e=>e instanceof RegExp?null:"a RegExp object",fe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",lt=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",qe=e=>typeof e=="function"?null:"a function",se=e=>Array.isArray(e)?null:"an array",Y=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ot=e=>typeof e=="object"&&e!==null?null:"an array or an object",st=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ie=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",at=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",We=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",ze=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",ut=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 Ke(e){let t=Object.create(null),n=r(e,t,"wasmURL",ut),i=r(e,t,"wasmModule",st),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:a}}function _e(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 Ee(e,t,n,i,a){let l=r(t,n,"color",I),f=r(t,n,"logLevel",b),s=r(t,n,"logLimit",fe),o=r(t,n,"logStyle",b);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||a}`),e.push(`--log-limit=${s||0}`),o&&e.push(`--log-style=${o}`)}function Q(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 Ve(e,t,n){let i=r(t,n,"legalComments",b),a=r(t,n,"sourceRoot",b),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",We),s=r(t,n,"format",b),o=r(t,n,"globalName",b),d=r(t,n,"mangleProps",Oe),g=r(t,n,"reserveProps",Oe),y=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),T=r(t,n,"minifyWhitespace",I),j=r(t,n,"minifyIdentifiers",I),C=r(t,n,"lineLimit",fe),z=r(t,n,"drop",Y),V=r(t,n,"dropLabels",Y),R=r(t,n,"charset",b),h=r(t,n,"treeShaking",I),m=r(t,n,"ignoreAnnotations",I),u=r(t,n,"jsx",b),O=r(t,n,"jsxFactory",b),E=r(t,n,"jsxFragment",b),A=r(t,n,"jsxImportSource",b),P=r(t,n,"jsxDev",I),c=r(t,n,"jsxSideEffects",I),p=r(t,n,"define",G),x=r(t,n,"logOverride",G),k=r(t,n,"supported",G),D=r(t,n,"pure",Y),$=r(t,n,"keepNames",I),S=r(t,n,"platform",b),F=r(t,n,"tsconfigRaw",at),q=r(t,n,"absPaths",Y);if(i&&e.push(`--legal-comments=${i}`),a!==void 0&&e.push(`--source-root=${a}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&e.push(`--target=${ge(Array.isArray(f)?f:[f],"target")}`),s&&e.push(`--format=${s}`),o&&e.push(`--global-name=${o}`),S&&e.push(`--platform=${S}`),F&&e.push(`--tsconfig-raw=${typeof F=="string"?F:JSON.stringify(F)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),j&&e.push("--minify-identifiers"),C&&e.push(`--line-limit=${C}`),R&&e.push(`--charset=${R}`),h!==void 0&&e.push(`--tree-shaking=${h}`),m&&e.push("--ignore-annotations"),z)for(let w of z)e.push(`--drop:${Q(w,"drop")}`);if(V&&e.push(`--drop-labels=${ge(V,"drop label")}`),q&&e.push(`--abs-paths=${ge(q,"abs paths")}`),d&&e.push(`--mangle-props=${Se(d)}`),g&&e.push(`--reserve-props=${Se(g)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),u&&e.push(`--jsx=${u}`),O&&e.push(`--jsx-factory=${O}`),E&&e.push(`--jsx-fragment=${E}`),A&&e.push(`--jsx-import-source=${A}`),P&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),p)for(let w in p){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${Q(p[w],"define",w)}`)}if(x)for(let w in x){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${Q(x[w],"log override",w)}`)}if(k)for(let w in k){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);let M=k[w];if(typeof M!="boolean")throw new Error(`Expected value for supported ${_(w)} to be a boolean, got ${typeof M} instead`);e.push(`--supported:${w}=${M}`)}if(D)for(let w of D)e.push(`--pure:${Q(w,"pure")}`);$&&e.push("--keep-names")}function ct(e,t,n,i,a){var re;let l=[],f=[],s=Object.create(null),o=null,d=null;Ee(l,t,s,n,i),Ve(l,t,s);let g=r(t,s,"sourcemap",Ie),y=r(t,s,"bundle",I),U=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),T=r(t,s,"metafile",I),j=r(t,s,"outfile",b),C=r(t,s,"outdir",b),z=r(t,s,"outbase",b),V=r(t,s,"tsconfig",b),R=r(t,s,"resolveExtensions",Y),h=r(t,s,"nodePaths",Y),m=r(t,s,"mainFields",Y),u=r(t,s,"conditions",Y),O=r(t,s,"external",Y),E=r(t,s,"packages",b),A=r(t,s,"alias",G),P=r(t,s,"loader",G),c=r(t,s,"outExtension",G),p=r(t,s,"publicPath",b),x=r(t,s,"entryNames",b),k=r(t,s,"chunkNames",b),D=r(t,s,"assetNames",b),$=r(t,s,"inject",Y),S=r(t,s,"banner",G),F=r(t,s,"footer",G),q=r(t,s,"entryPoints",ot),w=r(t,s,"absWorkingDir",b),M=r(t,s,"stdin",G),N=(re=r(t,s,"write",I))!=null?re:a,L=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",G);if(s.plugins=!0,K(t,s,`in ${e}() call`),g&&l.push(`--sourcemap${g===!0?"":`=${g}`}`),y&&l.push("--bundle"),L&&l.push("--allow-overwrite"),U&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),T&&l.push("--metafile"),j&&l.push(`--outfile=${j}`),C&&l.push(`--outdir=${C}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),E&&l.push(`--packages=${E}`),R&&l.push(`--resolve-extensions=${ge(R,"resolve extension")}`),p&&l.push(`--public-path=${p}`),x&&l.push(`--entry-names=${x}`),k&&l.push(`--chunk-names=${k}`),D&&l.push(`--asset-names=${D}`),m&&l.push(`--main-fields=${ge(m,"main field")}`),u&&l.push(`--conditions=${ge(u,"condition")}`),O)for(let v of O)l.push(`--external:${Q(v,"external")}`);if(A)for(let v in A){if(v.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${v}`);l.push(`--alias:${v}=${Q(A[v],"alias",v)}`)}if(S)for(let v in S){if(v.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${v}`);l.push(`--banner:${v}=${Q(S[v],"banner",v)}`)}if(F)for(let v in F){if(v.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${v}`);l.push(`--footer:${v}=${Q(F[v],"footer",v)}`)}if($)for(let v of $)l.push(`--inject:${Q(v,"inject")}`);if(P)for(let v in P){if(v.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${v}`);l.push(`--loader:${v}=${Q(P[v],"loader",v)}`)}if(c)for(let v in c){if(v.indexOf("=")>=0)throw new Error(`Invalid out extension: ${v}`);l.push(`--out-extension:${v}=${Q(c[v],"out extension",v)}`)}if(q)if(Array.isArray(q))for(let v=0,ie=q.length;v<ie;v++){let H=q[v];if(typeof H=="object"&&H!==null){let te=Object.create(null),le=r(H,te,"in",b),X=r(H,te,"out",b);if(K(H,te,"in entry point at index "+v),le===void 0)throw new Error('Missing property "in" for entry point at index '+v);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+v);f.push([X,le])}else f.push(["",Q(H,"entry point at index "+v)])}else for(let v in q)f.push([v,Q(q[v],"entry point",v)]);if(M){let v=Object.create(null),ie=r(M,v,"contents",ze),H=r(M,v,"resolveDir",b),te=r(M,v,"sourcefile",b),le=r(M,v,"loader",b);K(M,v,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),le&&l.push(`--loader=${le}`),H&&(d=H),typeof ie=="string"?o=Z(ie):ie instanceof Uint8Array&&(o=ie)}let W=[];if(h)for(let v of h)v+="",W.push(v);return{entries:f,flags:l,write:N,stdinContents:o,stdinResolveDir:d,absWorkingDir:w,nodePaths:W,mangleCache:_e(J)}}function ft(e,t,n,i){let a=[],l=Object.create(null);Ee(a,t,l,n,i),Ve(a,t,l);let f=r(t,l,"sourcemap",Ie),s=r(t,l,"sourcefile",b),o=r(t,l,"loader",b),d=r(t,l,"banner",b),g=r(t,l,"footer",b),y=r(t,l,"mangleCache",G);return K(t,l,`in ${e}() call`),f&&a.push(`--sourcemap=${f===!0?"external":f}`),s&&a.push(`--sourcefile=${s}`),o&&a.push(`--loader=${o}`),d&&a.push(`--banner=${d}`),g&&a.push(`--footer=${g}`),{flags:a,mangleCache:_e(y)}}function Je(e){let t={},n={didClose:!1,reason:""},i={},a=0,l=0,f=new Uint8Array(16*1024),s=0,o=R=>{let h=s+R.length;if(h>f.length){let u=new Uint8Array(h*2);u.set(f),f=u}f.set(R,s),s+=R.length;let m=0;for(;m+4<=s;){let u=Be(f,m);if(m+4+u>s)break;m+=4,T(f.subarray(m,m+u)),m+=u}m>0&&(f.copyWithin(0,m,s),s-=m)},d=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let h="The service was stopped"+n.reason;for(let m in i)i[m](h,null);i={}},g=(R,h,m)=>{if(n.didClose)return m("The service is no longer running"+n.reason,null);let u=a++;i[u]=(O,E)=>{try{m(O,E)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(Me({id:u,isRequest:!0,value:h}))},y=(R,h)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Me({id:R,isRequest:!1,value:h}))},U=(R,h)=>ne(null,null,function*(){try{if(h.command==="ping"){y(R,{});return}if(typeof h.key=="number"){let m=t[h.key];if(!m)return;let u=m[h.command];if(u){yield u(R,h);return}}throw new Error("Invalid command: "+h.command)}catch(m){let u=[ce(m,e,null,void 0,"")];try{y(R,{errors:u})}catch(O){}}}),B=!0,T=R=>{if(B){B=!1;let m=String.fromCharCode(...R);if(m!=="0.28.2")throw new Error(`Cannot start service: Host version "0.28.2" does not match binary version ${_(m)}`);return}let h=Le(R);if(h.isRequest)U(h.id,h.value);else{let m=i[h.id];delete i[h.id],h.value.error?m(h.value.error,{}):m(null,h.value)}};return{readFromStdout:o,afterClose:d,service:{buildOrContext:({callName:R,refs:h,options:m,isTTY:u,defaultWD:O,callback:E})=>{let A=0,P=l++,c={},p={ref(){++A===1&&h&&h.ref()},unref(){--A===0&&(delete t[P],h&&h.unref())}};t[P]=c,p.ref(),dt(R,P,g,y,p,e,c,m,u,O,(x,k)=>{try{E(x,k)}finally{p.unref()}})},transform:({callName:R,refs:h,input:m,options:u,isTTY:O,fs:E,callback:A})=>{let P=Qe(),c=p=>{try{if(typeof m!="string"&&!(m instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:x,mangleCache:k}=ft(R,u,O,Te),D={command:"transform",flags:x,inputFS:p!==null,input:p!==null?Z(p):typeof m=="string"?Z(m):m};k&&(D.mangleCache=k),g(h,D,($,S)=>{if($)return A(new Error($),null);let F=me(S.errors,P),q=me(S.warnings,P),w=1,M=()=>{if(--w===0){let N={warnings:q,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(N.legalComments=S==null?void 0:S.legalComments),S.mangleCache&&(N.mangleCache=S==null?void 0:S.mangleCache),A(null,N)}};if(F.length>0)return A(he("Transform failed",F,q),null);S.codeFS&&(w++,E.readFile(S.code,(N,L)=>{N!==null?A(N,null):(S.code=L,M())})),S.mapFS&&(w++,E.readFile(S.map,(N,L)=>{N!==null?A(N,null):(S.map=L,M())})),M()})}catch(x){let k=[];try{Ee(k,u,{},O,Te)}catch($){}let D=ce(x,e,P,void 0,"");g(h,{command:"error",flags:k,error:D},()=>{D.detail=P.load(D.detail),A(he("Transform failed",[D],[]),null)})}};if((typeof m=="string"||m instanceof Uint8Array)&&m.length>1024*1024){let p=c;c=()=>E.writeFile(m,p)}c(null)},formatMessages:({callName:R,refs:h,messages:m,options:u,callback:O})=>{if(!u)throw new Error(`Missing second argument in ${R}() call`);let E={},A=r(u,E,"kind",b),P=r(u,E,"color",I),c=r(u,E,"terminalWidth",fe),p=r(u,E,"logStyle",b);if(K(u,E,`in ${R}() call`),A===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(A!=="error"&&A!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let x={command:"format-msgs",messages:ae(m,"messages",null,"",c),isWarning:A==="warning"};P!==void 0&&(x.color=P),c!==void 0&&(x.terminalWidth=c),p!==void 0&&(x.logStyle=p),g(h,x,(k,D)=>{if(k)return O(new Error(k),null);O(null,D.messages)})},analyzeMetafile:({callName:R,refs:h,metafile:m,options:u,callback:O})=>{u===void 0&&(u={});let E={},A=r(u,E,"color",I),P=r(u,E,"verbose",I);K(u,E,`in ${R}() call`);let c={command:"analyze-metafile",metafile:m};A!==void 0&&(c.color=A),P!==void 0&&(c.verbose=P),g(h,c,(p,x)=>{if(p)return O(new Error(p),null);O(null,x.result)})}}}}function dt(e,t,n,i,a,l,f,s,o,d,g){let y=Qe(),U=e==="context",B=(C,z)=>{let V=[];try{Ee(V,s,{},o,Pe)}catch(h){}let R=ce(C,l,y,void 0,z);n(a,{command:"error",flags:V,error:R},()=>{R.detail=y.load(R.detail),g(he(U?"Context failed":"Build failed",[R],[]),null)})},T;if(typeof s=="object"){let C=s.plugins;if(C!==void 0){if(!Array.isArray(C))return B(new Error('"plugins" must be an array'),"");T=C}}if(T&&T.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");pt(t,n,i,a,l,f,s,T,y).then(C=>{if(!C.ok)return B(C.error,C.pluginName);try{j(C.requestPlugins,C.runOnEndCallbacks,C.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},C=>B(C,""));return}try{j(null,(C,z)=>z([],[]),()=>{})}catch(C){B(C,"")}function j(C,z,V){let R=l.hasFS,{entries:h,flags:m,write:u,stdinContents:O,stdinResolveDir:E,absWorkingDir:A,nodePaths:P,mangleCache:c}=ct(e,s,o,Pe,R);if(u&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let p={command:"build",key:t,entries:h,flags:m,write:u,stdinContents:O,stdinResolveDir:E,absWorkingDir:A||d,nodePaths:P,context:U};C&&(p.plugins=C),c&&(p.mangleCache=c);let x=($,S)=>{let F={errors:me($.errors,y),warnings:me($.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=F.errors.slice(),w=F.warnings.slice();$.outputFiles&&(F.outputFiles=$.outputFiles.map(mt)),$.metafile&&$.metafile.length&&(F.metafile=yt($.metafile)),$.mangleCache&&(F.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(ue($.writeToStdout).replace(/\n$/,"")),z(F,(M,N)=>{if(q.length>0||M.length>0){let L=he("Build failed",q.concat(M),w.concat(N));return S(L,null,M,N)}S(null,F,M,N)})},k,D;U&&(f["on-end"]=($,S)=>new Promise(F=>{x(S,(q,w,M,N)=>{let L={errors:M,warnings:N};D&&D(q,w),k=void 0,D=void 0,i($,L),F()})})),n(a,p,($,S)=>{if($)return g(new Error($),null);if(!U)return x(S,(w,M)=>(V(),g(w,M)));if(S.errors.length>0)return g(he("Context failed",S.errors,S.warnings),null);let F=!1,q={rebuild:()=>(k||(k=new Promise((w,M)=>{let N;D=(J,W)=>{N||(N=()=>J?M(J):w(W))};let L=()=>{n(a,{command:"rebuild",key:t},(W,re)=>{W?M(new Error(W)):N?N():L()})};L()})),k),watch:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let L={},J=r(w,L,"delay",fe);K(w,L,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(a,W,re=>{re?N(new Error(re)):M(void 0)})}),serve:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},J=r(w,L,"port",lt),W=r(w,L,"host",b),re=r(w,L,"servedir",b),v=r(w,L,"keyfile",b),ie=r(w,L,"certfile",b),H=r(w,L,"fallback",b),te=r(w,L,"cors",G),le=r(w,L,"onRequest",qe);K(w,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!le};if(J!==void 0&&(X.port=J),W!==void 0&&(X.host=W),re!==void 0&&(X.servedir=re),v!==void 0&&(X.keyfile=v),ie!==void 0&&(X.certfile=ie),H!==void 0&&(X.fallback=H),te){let ye={},pe=r(te,ye,"origin",We);K(te,ye,'on "cors" object'),Array.isArray(pe)?X.corsOrigin=pe:pe!==void 0&&(X.corsOrigin=[pe])}n(a,X,(ye,pe)=>{if(ye)return N(new Error(ye));le&&(f["serve-request"]=(Ge,He)=>{le(He.args),i(Ge,{})}),M(pe)})}),cancel:()=>new Promise(w=>{if(F)return w();n(a,{command:"cancel",key:t},()=>{w()})}),dispose:()=>new Promise(w=>{if(F)return w();F=!0,n(a,{command:"dispose",key:t},()=>{w(),V(),a.unref()})})};a.ref(),g(null,q)})}}var pt=(e,t,n,i,a,l,f,s,o)=>ne(null,null,function*(){let d=[],g=[],y={},U={},B=[],T=0,j=0,C=[],z=!1;s=[...s];for(let h of s){let m={};if(typeof h!="object")throw new Error(`Plugin at index ${j} must be an object`);let u=r(h,m,"name",b);if(typeof u!="string"||u==="")throw new Error(`Plugin at index ${j} is missing a name`);try{let O=r(h,m,"setup",qe);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(h,m,`on plugin ${_(u)}`);let E={name:u,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};j++;let P=O({initialOptions:f,resolve:(c,p={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let x=Object.create(null),k=r(p,x,"pluginName",b),D=r(p,x,"importer",b),$=r(p,x,"namespace",b),S=r(p,x,"resolveDir",b),F=r(p,x,"kind",b),q=r(p,x,"pluginData",Re),w=r(p,x,"with",G);return K(p,x,"in resolve() call"),new Promise((M,N)=>{let L={command:"resolve",path:c,key:e,pluginName:u};if(k!=null&&(L.pluginName=k),D!=null&&(L.importer=D),$!=null&&(L.namespace=$),S!=null&&(L.resolveDir=S),F!=null)L.kind=F;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(L.pluginData=o.store(q)),w!=null&&(L.with=gt(w,"with")),t(i,L,(J,W)=>{J!==null?N(new Error(J)):M({errors:me(W.errors,o),warnings:me(W.warnings,o),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:o.load(W.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',x=xe(new Error(p),a,"onStart");d.push({name:u,callback:c,note:x}),E.onStart=!0},onEnd(c){let p='This error came from the "onEnd" callback registered here:',x=xe(new Error(p),a,"onEnd");g.push({name:u,callback:c,note:x}),E.onEnd=!0},onResolve(c,p){let x='This error came from the "onResolve" callback registered here:',k=xe(new Error(x),a,"onResolve"),D={},$=r(c,D,"filter",Oe),S=r(c,D,"namespace",b);if(K(c,D,`in onResolve() call for plugin ${_(u)}`),$==null)throw new Error("onResolve() call is missing a filter");let F=T++;y[F]={name:u,callback:p,note:k},E.onResolve.push({id:F,filter:Se($),namespace:S||""})},onLoad(c,p){let x='This error came from the "onLoad" callback registered here:',k=xe(new Error(x),a,"onLoad"),D={},$=r(c,D,"filter",Oe),S=r(c,D,"namespace",b);if(K(c,D,`in onLoad() call for plugin ${_(u)}`),$==null)throw new Error("onLoad() call is missing a filter");let F=T++;U[F]={name:u,callback:p,note:k},E.onLoad.push({id:F,filter:Se($),namespace:S||""})},onDispose(c){B.push(c)},esbuild:a.esbuild});P&&(yield P),C.push(E)}catch(O){return{ok:!1,error:O,pluginName:u}}}l["on-start"]=(h,m)=>ne(null,null,function*(){o.clear();let u={errors:[],warnings:[]};yield Promise.all(d.map(P=>ne(null,[P],function*({name:O,callback:E,note:A}){try{let c=yield E();if(c!=null){if(typeof c!="object")throw new Error(`Expected onStart() callback in plugin ${_(O)} to return an object`);let p={},x=r(c,p,"errors",se),k=r(c,p,"warnings",se);K(c,p,`from onStart() callback in plugin ${_(O)}`),x!=null&&u.errors.push(...ae(x,"errors",o,O,void 0)),k!=null&&u.warnings.push(...ae(k,"warnings",o,O,void 0))}}catch(c){u.errors.push(ce(c,a,o,A&&A(),O))}}))),n(h,u)}),l["on-resolve"]=(h,m)=>ne(null,null,function*(){let u={},O="",E,A;for(let P of m.ids)try{({name:O,callback:E,note:A}=y[P]);let c=yield E({path:m.path,importer:m.importer,namespace:m.namespace,resolveDir:m.resolveDir,kind:m.kind,pluginData:o.load(m.pluginData),with:m.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${_(O)} to return an object`);let p={},x=r(c,p,"pluginName",b),k=r(c,p,"path",b),D=r(c,p,"namespace",b),$=r(c,p,"suffix",b),S=r(c,p,"external",I),F=r(c,p,"sideEffects",I),q=r(c,p,"pluginData",Re),w=r(c,p,"errors",se),M=r(c,p,"warnings",se),N=r(c,p,"watchFiles",Y),L=r(c,p,"watchDirs",Y);K(c,p,`from onResolve() callback in plugin ${_(O)}`),u.id=P,x!=null&&(u.pluginName=x),k!=null&&(u.path=k),D!=null&&(u.namespace=D),$!=null&&(u.suffix=$),S!=null&&(u.external=S),F!=null&&(u.sideEffects=F),q!=null&&(u.pluginData=o.store(q)),w!=null&&(u.errors=ae(w,"errors",o,O,void 0)),M!=null&&(u.warnings=ae(M,"warnings",o,O,void 0)),N!=null&&(u.watchFiles=ve(N,"watchFiles")),L!=null&&(u.watchDirs=ve(L,"watchDirs"));break}}catch(c){u={id:P,errors:[ce(c,a,o,A&&A(),O)]};break}n(h,u)}),l["on-load"]=(h,m)=>ne(null,null,function*(){let u={},O="",E,A;for(let P of m.ids)try{({name:O,callback:E,note:A}=U[P]);let c=yield E({path:m.path,namespace:m.namespace,suffix:m.suffix,pluginData:o.load(m.pluginData),with:m.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${_(O)} to return an object`);let p={},x=r(c,p,"pluginName",b),k=r(c,p,"contents",ze),D=r(c,p,"resolveDir",b),$=r(c,p,"pluginData",Re),S=r(c,p,"loader",b),F=r(c,p,"errors",se),q=r(c,p,"warnings",se),w=r(c,p,"watchFiles",Y),M=r(c,p,"watchDirs",Y);K(c,p,`from onLoad() callback in plugin ${_(O)}`),u.id=P,x!=null&&(u.pluginName=x),k instanceof Uint8Array?u.contents=k:k!=null&&(u.contents=Z(k)),D!=null&&(u.resolveDir=D),$!=null&&(u.pluginData=o.store($)),S!=null&&(u.loader=S),F!=null&&(u.errors=ae(F,"errors",o,O,void 0)),q!=null&&(u.warnings=ae(q,"warnings",o,O,void 0)),w!=null&&(u.watchFiles=ve(w,"watchFiles")),M!=null&&(u.watchDirs=ve(M,"watchDirs"));break}}catch(c){u={id:P,errors:[ce(c,a,o,A&&A(),O)]};break}n(h,u)});let V=(h,m)=>m([],[]);g.length>0&&(V=(h,m)=>{ne(null,null,function*(){let u=[],O=[];for(let{name:E,callback:A,note:P}of g){let c,p;try{let x=yield A(h);if(x!=null){if(typeof x!="object")throw new Error(`Expected onEnd() callback in plugin ${_(E)} to return an object`);let k={},D=r(x,k,"errors",se),$=r(x,k,"warnings",se);K(x,k,`from onEnd() callback in plugin ${_(E)}`),D!=null&&(c=ae(D,"errors",o,E,void 0)),$!=null&&(p=ae($,"warnings",o,E,void 0))}}catch(x){c=[ce(x,a,o,P&&P(),E)]}if(c){u.push(...c);try{h.errors.push(...c)}catch(x){}}if(p){O.push(...p);try{h.warnings.push(...p)}catch(x){}}}m(u,O)})});let R=()=>{for(let h of B)setTimeout(()=>h(),0)};return z=!0,{ok:!0,requestPlugins:C,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:R}});function Qe(){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 xe(e,t,n){let i,a=!1;return()=>{if(a)return i;a=!0;try{let l=(e.stack+"").split(`
|
|
9
9
|
`);l.splice(1,1);let f=Ye(t,l,n);if(f)return i={text:e.message,location:f},i}catch(l){}}}function ce(e,t,n,i,a){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Ye(t,(e.stack+"").split(`
|
|
10
|
-
`),"")}catch(s){}return{id:"",pluginName:a,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ye(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 f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(y){break}let o=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",
|
|
10
|
+
`),"")}catch(s){}return{id:"",pluginName:a,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ye(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 f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(y){break}let o=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",d=+f[3]-1,g=o.slice(d,d+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(o.slice(0,d)).length,length:Z(o.slice(d,d+g)).length,lineText:o+`
|
|
11
11
|
`+t.slice(1).join(`
|
|
12
12
|
`),suggestion:""}}break}}return null}function he(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,f)=>{if(f===i)return`
|
|
13
13
|
...`;if(!l.location)return`
|
|
14
|
-
error: ${l.text}`;let{file:s,line:o,column:
|
|
15
|
-
${s}:${o}:${p}: ERROR: ${g}${l.text}`}).join("");let a=new Error(e);for(let[l,f]of[["errors",t],["warnings",n]])Object.defineProperty(a,l,{configurable:!0,enumerable:!0,get:()=>f,set:s=>Object.defineProperty(a,l,{configurable:!0,enumerable:!0,value:s})});return a}function me(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ne(e,t,n){if(e==null)return null;let i={},a=r(e,i,"file",b),l=r(e,i,"namespace",b),f=r(e,i,"line",fe),s=r(e,i,"column",fe),o=r(e,i,"length",fe),p=r(e,i,"lineText",b),g=r(e,i,"suggestion",b);if(K(e,i,t),p){let y=p.slice(0,(s&&s>0?s:0)+(o&&o>0?o:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(p)&&(p=y)}return{file:a||"",namespace:l||"",line:f||0,column:s||0,length:o||0,lineText:p||"",suggestion:g||""}}function ae(e,t,n,i,a){let l=[],f=0;for(let s of e){let o={},p=r(s,o,"id",b),g=r(s,o,"pluginName",b),y=r(s,o,"text",b),U=r(s,o,"location",je),B=r(s,o,"notes",se),T=r(s,o,"detail",Re),j=`in element ${f} of "${t}"`;K(s,o,j);let k=[];if(B)for(let z of B){let V={},R=r(z,V,"text",b),h=r(z,V,"location",je);K(z,V,j),k.push({text:R||"",location:Ne(h,j,a)})}l.push({id:p||"",pluginName:g||i,text:y||"",location:Ne(U,j,a),notes:k,detail:n?n.store(T):-1}),f++}return l}function ve(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 gt(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 mt({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=ue(a)),i}}}function Se(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function yt(e){let t;try{t=ue(e)}catch(n){return Ue(e)}return JSON.parse(t)}var wt="0.28.0",bt=e=>we().build(e),xt=e=>we().context(e),vt=(e,t)=>we().transform(e,t),Rt=(e,t)=>we().formatMessages(e,t),Ot=(e,t)=>we().analyzeMetafile(e,t),St=()=>{throw new Error('The "buildSync" API only works in node')},Et=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Ct=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},$t=()=>(ke&&ke(),Promise.resolve()),de,ke,Ce,we=()=>{if(Ce)return Ce;throw de?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')},At=e=>{e=Ke(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(de)throw new Error('Cannot call "initialize" more than once');return de=Dt(t||"",n,i),de.catch(()=>{de=void 0}),de},Dt=(e,t,n)=>ne(null,null,function*(){let i,a,l=new Promise(y=>a=y);if(n){let y=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.28.0"],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(y))}else{let y=(postMessage=>{
|
|
14
|
+
error: ${l.text}`;let{file:s,line:o,column:d}=l.location,g=l.pluginName?`[plugin: ${l.pluginName}] `:"";return`
|
|
15
|
+
${s}:${o}:${d}: ERROR: ${g}${l.text}`}).join("");let a=new Error(e);for(let[l,f]of[["errors",t],["warnings",n]])Object.defineProperty(a,l,{configurable:!0,enumerable:!0,get:()=>f,set:s=>Object.defineProperty(a,l,{configurable:!0,enumerable:!0,value:s})});return a}function me(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ne(e,t,n){if(e==null)return null;let i={},a=r(e,i,"file",b),l=r(e,i,"namespace",b),f=r(e,i,"line",fe),s=r(e,i,"column",fe),o=r(e,i,"length",fe),d=r(e,i,"lineText",b),g=r(e,i,"suggestion",b);if(K(e,i,t),d){let y=d.slice(0,(s&&s>0?s:0)+(o&&o>0?o:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(d)&&(d=y)}return{file:a||"",namespace:l||"",line:f||0,column:s||0,length:o||0,lineText:d||"",suggestion:g||""}}function ae(e,t,n,i,a){let l=[],f=0;for(let s of e){let o={},d=r(s,o,"id",b),g=r(s,o,"pluginName",b),y=r(s,o,"text",b),U=r(s,o,"location",je),B=r(s,o,"notes",se),T=r(s,o,"detail",Re),j=`in element ${f} of "${t}"`;K(s,o,j);let C=[];if(B)for(let z of B){let V={},R=r(z,V,"text",b),h=r(z,V,"location",je);K(z,V,j),C.push({text:R||"",location:Ne(h,j,a)})}l.push({id:d||"",pluginName:g||i,text:y||"",location:Ne(U,j,a),notes:C,detail:n?n.store(T):-1}),f++}return l}function ve(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 gt(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 mt({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=ue(a)),i}}}function Se(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function yt(e){let t;try{t=ue(e)}catch(n){return Ue(e)}return JSON.parse(t)}var wt="0.28.2",bt=e=>we().build(e),xt=e=>we().context(e),vt=(e,t)=>we().transform(e,t),Rt=(e,t)=>we().formatMessages(e,t),Ot=(e,t)=>we().analyzeMetafile(e,t),St=()=>{throw new Error('The "buildSync" API only works in node')},Et=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Ct=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},$t=()=>(ke&&ke(),Promise.resolve()),de,ke,Ce,we=()=>{if(Ce)return Ce;throw de?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')},At=e=>{e=Ke(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(de)throw new Error('Cannot call "initialize" more than once');return de=Dt(t||"",n,i),de.catch(()=>{de=void 0}),de},Dt=(e,t,n)=>ne(null,null,function*(){let i,a,l=new Promise(y=>a=y);if(n){let y=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.28.2"],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(y))}else{let y=(postMessage=>{
|
|
16
16
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
17
17
|
// Use of this source code is governed by a BSD-style
|
|
18
18
|
// license that can be found in the LICENSE file.
|
|
19
19
|
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(`
|
|
20
20
|
`);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(`
|
|
21
21
|
`);h.length>1&&console.log(h.slice(0,-1).join(`
|
|
22
|
-
`)),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.28.
|
|
22
|
+
`)),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.28.2"],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);})(B=>i.onmessage({data:B})),U;i={onmessage:null,postMessage:B=>setTimeout(()=>{try{U=y({data:B})}catch(T){a(T)}}),terminate(){if(U)for(let B of U._scheduledTimeouts.values())clearTimeout(B)}}}let f,s,o=new Promise((y,U)=>{f=y,s=U});i.onmessage=({data:y})=>{i.onmessage=({data:U})=>d(U),y?s(y):f()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:d,service:g}=Je({writeToStdin(y){i.postMessage(y)},isSync:!1,hasFS:!1,esbuild:$e});yield o,ke=()=>{i.terminate(),de=void 0,ke=void 0,Ce=void 0},Ce={build:y=>new Promise((U,B)=>{l.then(B),g.buildOrContext({callName:"build",refs:null,options:y,isTTY:!1,defaultWD:"/",callback:(T,j)=>T?B(T):U(j)})}),context:y=>new Promise((U,B)=>{l.then(B),g.buildOrContext({callName:"context",refs:null,options:y,isTTY:!1,defaultWD:"/",callback:(T,j)=>T?B(T):U(j)})}),transform:(y,U)=>new Promise((B,T)=>{l.then(T),g.transform({callName:"transform",refs:null,input:y,options:U||{},isTTY:!1,fs:{readFile(j,C){C(new Error("Internal error"),null)},writeFile(j,C){C(null)}},callback:(j,C)=>j?T(j):B(C)})}),formatMessages:(y,U)=>new Promise((B,T)=>{l.then(T),g.formatMessages({callName:"formatMessages",refs:null,messages:y,options:U,callback:(j,C)=>j?T(j):B(C)})}),analyzeMetafile:(y,U)=>new Promise((B,T)=>{l.then(T),g.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof y=="string"?y:JSON.stringify(y),options:U,callback:(j,C)=>j?T(j):B(C)})})}}),Ft=$e;
|
|
23
23
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
package/lib/main.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type Platform = 'browser' | 'node' | 'neutral'
|
|
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
3
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
export type LogStyle = 'default' | 'visualstudio'
|
|
5
6
|
export type Charset = 'ascii' | 'utf8'
|
|
6
7
|
export type Drop = 'console' | 'debugger'
|
|
7
8
|
export type AbsPaths = 'code' | 'log' | 'metafile'
|
|
@@ -86,6 +87,8 @@ interface CommonOptions {
|
|
|
86
87
|
logLimit?: number
|
|
87
88
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
88
89
|
logOverride?: Record<string, LogLevel>
|
|
90
|
+
/** Documentation: https://esbuild.github.io/api/#log-style */
|
|
91
|
+
logStyle?: LogStyle
|
|
89
92
|
|
|
90
93
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
|
91
94
|
tsconfigRaw?: string | TsconfigRaw
|
|
@@ -509,6 +512,7 @@ export interface FormatMessagesOptions {
|
|
|
509
512
|
kind: 'error' | 'warning'
|
|
510
513
|
color?: boolean
|
|
511
514
|
terminalWidth?: number
|
|
515
|
+
logStyle?: LogStyle
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
export interface AnalyzeMetafileOptions {
|
package/lib/main.js
CHANGED
|
@@ -562,10 +562,12 @@ function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
|
|
|
562
562
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
563
563
|
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
564
564
|
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
565
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
565
566
|
if (color !== void 0) flags.push(`--color=${color}`);
|
|
566
567
|
else if (isTTY2) flags.push(`--color=true`);
|
|
567
568
|
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
568
569
|
flags.push(`--log-limit=${logLimit || 0}`);
|
|
570
|
+
if (logStyle) flags.push(`--log-style=${logStyle}`);
|
|
569
571
|
}
|
|
570
572
|
function validateStringValue(value, what, key) {
|
|
571
573
|
if (typeof value !== "string") {
|
|
@@ -914,8 +916,8 @@ function createChannel(streamIn) {
|
|
|
914
916
|
if (isFirstPacket) {
|
|
915
917
|
isFirstPacket = false;
|
|
916
918
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
917
|
-
if (binaryVersion !== "0.28.
|
|
918
|
-
throw new Error(`Cannot start service: Host version "${"0.28.
|
|
919
|
+
if (binaryVersion !== "0.28.2") {
|
|
920
|
+
throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`);
|
|
919
921
|
}
|
|
920
922
|
return;
|
|
921
923
|
}
|
|
@@ -1054,6 +1056,7 @@ function createChannel(streamIn) {
|
|
|
1054
1056
|
let kind = getFlag(options, keys, "kind", mustBeString);
|
|
1055
1057
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
1056
1058
|
let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
|
|
1059
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
1057
1060
|
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
1058
1061
|
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
1059
1062
|
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
@@ -1064,6 +1067,7 @@ function createChannel(streamIn) {
|
|
|
1064
1067
|
};
|
|
1065
1068
|
if (color !== void 0) request.color = color;
|
|
1066
1069
|
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
1070
|
+
if (logStyle !== void 0) request.logStyle = logStyle;
|
|
1067
1071
|
sendRequest(refs, request, (error, response) => {
|
|
1068
1072
|
if (error) return callback(new Error(error), null);
|
|
1069
1073
|
callback(null, response.messages);
|
|
@@ -1900,7 +1904,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
|
1900
1904
|
}
|
|
1901
1905
|
}
|
|
1902
1906
|
var _a;
|
|
1903
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.
|
|
1907
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.2";
|
|
1904
1908
|
var esbuildCommandAndArgs = () => {
|
|
1905
1909
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
1906
1910
|
throw new Error(
|
|
@@ -1967,7 +1971,7 @@ var fsAsync = {
|
|
|
1967
1971
|
}
|
|
1968
1972
|
}
|
|
1969
1973
|
};
|
|
1970
|
-
var version = "0.28.
|
|
1974
|
+
var version = "0.28.2";
|
|
1971
1975
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1972
1976
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
1973
1977
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -2070,7 +2074,7 @@ var stopService;
|
|
|
2070
2074
|
var ensureServiceIsRunning = () => {
|
|
2071
2075
|
if (longLivedService) return longLivedService;
|
|
2072
2076
|
let [command, args] = esbuildCommandAndArgs();
|
|
2073
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.28.
|
|
2077
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.28.2"}`, "--ping"), {
|
|
2074
2078
|
windowsHide: true,
|
|
2075
2079
|
stdio: ["pipe", "pipe", "inherit"],
|
|
2076
2080
|
cwd: defaultWD
|
|
@@ -2174,7 +2178,7 @@ var runServiceSync = (callback) => {
|
|
|
2174
2178
|
esbuild: node_exports
|
|
2175
2179
|
});
|
|
2176
2180
|
callback(service);
|
|
2177
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.28.
|
|
2181
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.28.2"}`), {
|
|
2178
2182
|
cwd: defaultWD,
|
|
2179
2183
|
windowsHide: true,
|
|
2180
2184
|
input: stdin,
|
|
@@ -2194,7 +2198,7 @@ var workerThreadService = null;
|
|
|
2194
2198
|
var startWorkerThreadService = (worker_threads2) => {
|
|
2195
2199
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
2196
2200
|
let worker = new worker_threads2.Worker(__filename, {
|
|
2197
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.28.
|
|
2201
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.28.2" },
|
|
2198
2202
|
transferList: [workerPort],
|
|
2199
2203
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
2200
2204
|
//
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esbuild-wasm-strapkit",
|
|
3
|
-
"version": "0.28.
|
|
4
|
-
"esbuildVersion": "0.28.
|
|
5
|
-
"description": "esbuild-wasm 0.28.
|
|
3
|
+
"version": "0.28.2-build.1",
|
|
4
|
+
"esbuildVersion": "0.28.2",
|
|
5
|
+
"description": "esbuild-wasm 0.28.2 built on 64-bit wasm memory (no 4GB heap cap). Install the dist-tag for your esbuild version, e.g. esbuild-wasm-strapkit@esbuild-0.28.2.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=18"
|