isomorfeus-asset-manager 0.14.23 → 0.14.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/esbuild-wasm/LICENSE.md +21 -0
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +18 -8
- data/node_modules/esbuild-wasm/esm/browser.js +95 -55
- data/node_modules/esbuild-wasm/esm/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/browser.d.ts +18 -8
- data/node_modules/esbuild-wasm/lib/browser.js +96 -55
- data/node_modules/esbuild-wasm/lib/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/main.d.ts +18 -8
- data/node_modules/esbuild-wasm/lib/main.js +143 -105
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +7 -6
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
(module=>{
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __defProps = Object.defineProperties;
|
@@ -335,9 +336,14 @@ function pushCommonFlags(flags, options, keys) {
|
|
335
336
|
let jsx = getFlag(options, keys, "jsx", mustBeString);
|
336
337
|
let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
|
337
338
|
let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
|
339
|
+
let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
|
340
|
+
let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
|
338
341
|
let define = getFlag(options, keys, "define", mustBeObject);
|
342
|
+
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
343
|
+
let supported = getFlag(options, keys, "supported", mustBeObject);
|
339
344
|
let pure = getFlag(options, keys, "pure", mustBeArray);
|
340
345
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
346
|
+
let platform = getFlag(options, keys, "platform", mustBeString);
|
341
347
|
if (legalComments)
|
342
348
|
flags.push(`--legal-comments=${legalComments}`);
|
343
349
|
if (sourceRoot !== void 0)
|
@@ -354,6 +360,8 @@ function pushCommonFlags(flags, options, keys) {
|
|
354
360
|
flags.push(`--format=${format}`);
|
355
361
|
if (globalName)
|
356
362
|
flags.push(`--global-name=${globalName}`);
|
363
|
+
if (platform)
|
364
|
+
flags.push(`--platform=${platform}`);
|
357
365
|
if (minify)
|
358
366
|
flags.push("--minify");
|
359
367
|
if (minifySyntax)
|
@@ -383,6 +391,10 @@ function pushCommonFlags(flags, options, keys) {
|
|
383
391
|
flags.push(`--jsx-factory=${jsxFactory}`);
|
384
392
|
if (jsxFragment)
|
385
393
|
flags.push(`--jsx-fragment=${jsxFragment}`);
|
394
|
+
if (jsxImportSource)
|
395
|
+
flags.push(`--jsx-import-source=${jsxImportSource}`);
|
396
|
+
if (jsxDev)
|
397
|
+
flags.push(`--jsx-dev`);
|
386
398
|
if (define) {
|
387
399
|
for (let key in define) {
|
388
400
|
if (key.indexOf("=") >= 0)
|
@@ -390,6 +402,20 @@ function pushCommonFlags(flags, options, keys) {
|
|
390
402
|
flags.push(`--define:${key}=${define[key]}`);
|
391
403
|
}
|
392
404
|
}
|
405
|
+
if (logOverride) {
|
406
|
+
for (let key in logOverride) {
|
407
|
+
if (key.indexOf("=") >= 0)
|
408
|
+
throw new Error(`Invalid log override: ${key}`);
|
409
|
+
flags.push(`--log-override:${key}=${logOverride[key]}`);
|
410
|
+
}
|
411
|
+
}
|
412
|
+
if (supported) {
|
413
|
+
for (let key in supported) {
|
414
|
+
if (key.indexOf("=") >= 0)
|
415
|
+
throw new Error(`Invalid supported: ${key}`);
|
416
|
+
flags.push(`--supported:${key}=${supported[key]}`);
|
417
|
+
}
|
418
|
+
}
|
393
419
|
if (pure)
|
394
420
|
for (let fn of pure)
|
395
421
|
flags.push(`--pure:${fn}`);
|
@@ -415,7 +441,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
415
441
|
let outfile = getFlag(options, keys, "outfile", mustBeString);
|
416
442
|
let outdir = getFlag(options, keys, "outdir", mustBeString);
|
417
443
|
let outbase = getFlag(options, keys, "outbase", mustBeString);
|
418
|
-
let platform = getFlag(options, keys, "platform", mustBeString);
|
419
444
|
let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
|
420
445
|
let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray);
|
421
446
|
let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray);
|
@@ -469,8 +494,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
469
494
|
flags.push(`--outdir=${outdir}`);
|
470
495
|
if (outbase)
|
471
496
|
flags.push(`--outbase=${outbase}`);
|
472
|
-
if (platform)
|
473
|
-
flags.push(`--platform=${platform}`);
|
474
497
|
if (tsconfig)
|
475
498
|
flags.push(`--tsconfig=${tsconfig}`);
|
476
499
|
if (resolveExtensions) {
|
@@ -558,7 +581,7 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
558
581
|
}
|
559
582
|
if (stdin) {
|
560
583
|
let stdinKeys = /* @__PURE__ */ Object.create(null);
|
561
|
-
let contents = getFlag(stdin, stdinKeys, "contents",
|
584
|
+
let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
|
562
585
|
let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
|
563
586
|
let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
|
564
587
|
let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
|
@@ -569,7 +592,10 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
569
592
|
flags.push(`--loader=${loader2}`);
|
570
593
|
if (resolveDir)
|
571
594
|
stdinResolveDir = resolveDir + "";
|
572
|
-
|
595
|
+
if (typeof contents === "string")
|
596
|
+
stdinContents = encodeUTF8(contents);
|
597
|
+
else if (contents instanceof Uint8Array)
|
598
|
+
stdinContents = contents;
|
573
599
|
}
|
574
600
|
let nodePaths = [];
|
575
601
|
if (nodePathsInput) {
|
@@ -764,8 +790,8 @@ function createChannel(streamIn) {
|
|
764
790
|
if (isFirstPacket) {
|
765
791
|
isFirstPacket = false;
|
766
792
|
let binaryVersion = String.fromCharCode(...bytes);
|
767
|
-
if (binaryVersion !== "0.14.
|
768
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
793
|
+
if (binaryVersion !== "0.14.53") {
|
794
|
+
throw new Error(`Cannot start service: Host version "${"0.14.53"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
769
795
|
}
|
770
796
|
return;
|
771
797
|
}
|
@@ -1152,24 +1178,27 @@ function createChannel(streamIn) {
|
|
1152
1178
|
if (plugins && plugins.length > 0) {
|
1153
1179
|
if (streamIn.isSync)
|
1154
1180
|
return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
|
1155
|
-
handlePlugins(options, plugins, key, details, refs).then(
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1181
|
+
handlePlugins(options, plugins, key, details, refs).then(
|
1182
|
+
(result) => {
|
1183
|
+
if (!result.ok) {
|
1184
|
+
handleError(result.error, result.pluginName);
|
1185
|
+
} else {
|
1186
|
+
try {
|
1187
|
+
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
1188
|
+
key,
|
1189
|
+
details,
|
1190
|
+
logPluginError,
|
1191
|
+
requestPlugins: result.requestPlugins,
|
1192
|
+
runOnEndCallbacks: result.runOnEndCallbacks,
|
1193
|
+
pluginRefs: result.pluginRefs
|
1194
|
+
}));
|
1195
|
+
} catch (e) {
|
1196
|
+
handleError(e, "");
|
1197
|
+
}
|
1170
1198
|
}
|
1171
|
-
}
|
1172
|
-
|
1199
|
+
},
|
1200
|
+
(e) => handleError(e, "")
|
1201
|
+
);
|
1173
1202
|
} else {
|
1174
1203
|
try {
|
1175
1204
|
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
@@ -1214,7 +1243,7 @@ function createChannel(streamIn) {
|
|
1214
1243
|
callerRefs.unref();
|
1215
1244
|
}
|
1216
1245
|
};
|
1217
|
-
let writeDefault = !streamIn.
|
1246
|
+
let writeDefault = !streamIn.isWriteUnavailable;
|
1218
1247
|
let {
|
1219
1248
|
entries,
|
1220
1249
|
flags,
|
@@ -1272,18 +1301,22 @@ function createChannel(streamIn) {
|
|
1272
1301
|
rebuild = () => new Promise((resolve, reject) => {
|
1273
1302
|
if (isDisposed || closeData)
|
1274
1303
|
throw new Error("Cannot rebuild");
|
1275
|
-
sendRequest(
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1304
|
+
sendRequest(
|
1305
|
+
refs,
|
1306
|
+
{ command: "rebuild", key },
|
1307
|
+
(error2, response2) => {
|
1308
|
+
if (error2) {
|
1309
|
+
const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1310
|
+
return callback2(failureErrorWithLog("Build failed", [message], []), null);
|
1311
|
+
}
|
1312
|
+
buildResponseToResult(response2, (error3, result3) => {
|
1313
|
+
if (error3)
|
1314
|
+
reject(error3);
|
1315
|
+
else
|
1316
|
+
resolve(result3);
|
1317
|
+
});
|
1279
1318
|
}
|
1280
|
-
|
1281
|
-
if (error3)
|
1282
|
-
reject(error3);
|
1283
|
-
else
|
1284
|
-
resolve(result3);
|
1285
|
-
});
|
1286
|
-
});
|
1319
|
+
);
|
1287
1320
|
});
|
1288
1321
|
refs.ref();
|
1289
1322
|
rebuild.dispose = () => {
|
@@ -1342,8 +1375,8 @@ function createChannel(streamIn) {
|
|
1342
1375
|
callback2(null, result);
|
1343
1376
|
});
|
1344
1377
|
};
|
1345
|
-
if (write && streamIn.
|
1346
|
-
throw new Error(`
|
1378
|
+
if (write && streamIn.isWriteUnavailable)
|
1379
|
+
throw new Error(`The "write" option is unavailable in this environment`);
|
1347
1380
|
if (incremental && streamIn.isSync)
|
1348
1381
|
throw new Error(`Cannot use "incremental" with a synchronous build`);
|
1349
1382
|
if (watch && streamIn.isSync)
|
@@ -1378,8 +1411,8 @@ function createChannel(streamIn) {
|
|
1378
1411
|
const details = createObjectStash();
|
1379
1412
|
let start = (inputPath) => {
|
1380
1413
|
try {
|
1381
|
-
if (typeof input !== "string")
|
1382
|
-
throw new Error('The input to "transform" must be a string');
|
1414
|
+
if (typeof input !== "string" && !(input instanceof Uint8Array))
|
1415
|
+
throw new Error('The input to "transform" must be a string or a Uint8Array');
|
1383
1416
|
let {
|
1384
1417
|
flags,
|
1385
1418
|
mangleCache
|
@@ -1388,7 +1421,7 @@ function createChannel(streamIn) {
|
|
1388
1421
|
command: "transform",
|
1389
1422
|
flags,
|
1390
1423
|
inputFS: inputPath !== null,
|
1391
|
-
input: inputPath !== null ? inputPath : input
|
1424
|
+
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
1392
1425
|
};
|
1393
1426
|
if (mangleCache)
|
1394
1427
|
request.mangleCache = mangleCache;
|
@@ -1445,7 +1478,7 @@ function createChannel(streamIn) {
|
|
1445
1478
|
});
|
1446
1479
|
}
|
1447
1480
|
};
|
1448
|
-
if (typeof input === "string" && input.length > 1024 * 1024) {
|
1481
|
+
if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
|
1449
1482
|
let next = start;
|
1450
1483
|
start = () => fs.writeFile(input, next);
|
1451
1484
|
}
|
@@ -1557,7 +1590,7 @@ function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
|
|
1557
1590
|
location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
|
1558
1591
|
} catch (e2) {
|
1559
1592
|
}
|
1560
|
-
return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1593
|
+
return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1561
1594
|
}
|
1562
1595
|
function parseStackLinesV8(streamIn, lines, ident) {
|
1563
1596
|
let at = " at ";
|
@@ -1656,6 +1689,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1656
1689
|
let index = 0;
|
1657
1690
|
for (const message of messages) {
|
1658
1691
|
let keys = {};
|
1692
|
+
let id = getFlag(message, keys, "id", mustBeString);
|
1659
1693
|
let pluginName = getFlag(message, keys, "pluginName", mustBeString);
|
1660
1694
|
let text = getFlag(message, keys, "text", mustBeString);
|
1661
1695
|
let location = getFlag(message, keys, "location", mustBeObjectOrNull);
|
@@ -1677,6 +1711,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1677
1711
|
}
|
1678
1712
|
}
|
1679
1713
|
messagesClone.push({
|
1714
|
+
id: id || "",
|
1680
1715
|
pluginName: pluginName || fallbackPluginName,
|
1681
1716
|
text: text || "",
|
1682
1717
|
location: sanitizeLocation(location, where),
|
@@ -1702,15 +1737,18 @@ function convertOutputFiles({ path, contents }) {
|
|
1702
1737
|
path,
|
1703
1738
|
contents,
|
1704
1739
|
get text() {
|
1705
|
-
|
1706
|
-
|
1740
|
+
const binary = this.contents;
|
1741
|
+
if (text === null || binary !== contents) {
|
1742
|
+
contents = binary;
|
1743
|
+
text = decodeUTF8(binary);
|
1744
|
+
}
|
1707
1745
|
return text;
|
1708
1746
|
}
|
1709
1747
|
};
|
1710
1748
|
}
|
1711
1749
|
|
1712
1750
|
// lib/npm/browser.ts
|
1713
|
-
var version = "0.14.
|
1751
|
+
var version = "0.14.53";
|
1714
1752
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1715
1753
|
var serve = () => {
|
1716
1754
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1766,7 +1804,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
1766
1804
|
}
|
1767
1805
|
let worker;
|
1768
1806
|
if (useWorker) {
|
1769
|
-
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(() => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.39"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1807
|
+
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\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) + 1\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.53"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1770
1808
|
worker = new Worker(URL.createObjectURL(blob));
|
1771
1809
|
} else {
|
1772
1810
|
let onmessage = ((postMessage) => {
|
@@ -2081,13 +2119,16 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2081
2119
|
sp >>>= 0;
|
2082
2120
|
const id = this._nextCallbackTimeoutID;
|
2083
2121
|
this._nextCallbackTimeoutID++;
|
2084
|
-
this._scheduledTimeouts.set(id, setTimeout(
|
2085
|
-
|
2086
|
-
while (this._scheduledTimeouts.has(id)) {
|
2087
|
-
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2122
|
+
this._scheduledTimeouts.set(id, setTimeout(
|
2123
|
+
() => {
|
2088
2124
|
this._resume();
|
2089
|
-
|
2090
|
-
|
2125
|
+
while (this._scheduledTimeouts.has(id)) {
|
2126
|
+
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2127
|
+
this._resume();
|
2128
|
+
}
|
2129
|
+
},
|
2130
|
+
getInt64(sp + 8) + 1
|
2131
|
+
));
|
2091
2132
|
this.mem.setInt32(sp + 16, id, true);
|
2092
2133
|
},
|
2093
2134
|
"runtime.clearTimeoutEvent": (sp) => {
|
@@ -2367,7 +2408,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2367
2408
|
callback(null, count);
|
2368
2409
|
};
|
2369
2410
|
let go = new globalThis.Go();
|
2370
|
-
go.argv = ["", `--service=${"0.14.
|
2411
|
+
go.argv = ["", `--service=${"0.14.53"}`];
|
2371
2412
|
if (wasm instanceof WebAssembly.Module) {
|
2372
2413
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2373
2414
|
} else {
|
@@ -2390,7 +2431,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2390
2431
|
worker.postMessage(bytes);
|
2391
2432
|
},
|
2392
2433
|
isSync: false,
|
2393
|
-
|
2434
|
+
isWriteUnavailable: true,
|
2394
2435
|
esbuild: browser_exports
|
2395
2436
|
});
|
2396
2437
|
longLivedService = {
|