isomorfeus-asset-manager 0.14.25 → 0.15.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.
- 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/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +9 -5
- data/node_modules/esbuild-wasm/esm/browser.js +72 -50
- data/node_modules/esbuild-wasm/esm/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/browser.d.ts +9 -5
- data/node_modules/esbuild-wasm/lib/browser.js +73 -51
- data/node_modules/esbuild-wasm/lib/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/main.d.ts +9 -5
- data/node_modules/esbuild-wasm/lib/main.js +112 -80
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f631be970f0d388d7a31e98797411c37dceb2a519b81c9b366de8fcc332177c4
|
4
|
+
data.tar.gz: 86c1cb0d2dbbcc3ab70d31773b96a443d39564e96f8fcab92f770073c4c2118c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e5c3fff8684db61e97683b258538c1fb8b3cc2492570f908952d2ac2968bdaa8fc052ffa27e5b6201f8f0e45ad44e44051dc892d9f1172e82c9e02ce03a895
|
7
|
+
data.tar.gz: c51b11a50fbbed497a1e8eb84533ba202d118aa29ae0b9a88f8c7a0434a453b98e6436dce02d6e3e9c293c9b557bfc4d1cfdd1c83b772b0f272c8db47955e22b
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.15.4",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.15.4.tgz",
|
9
|
+
"integrity": "sha512-GHRiwACd7X7PB/kfnbXUk5fQLB16lnDvNz9XdeMOJ5rfD/5sSYnhpQPWSnXbdHIuarHgmuVkfbgTvklQ9rKmrg==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
Binary file
|
@@ -23,6 +23,8 @@ interface CommonOptions {
|
|
23
23
|
target?: string | string[];
|
24
24
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
25
25
|
supported?: Record<string, boolean>;
|
26
|
+
/** Documentation: https://esbuild.github.io/api/#platform */
|
27
|
+
platform?: Platform;
|
26
28
|
|
27
29
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
28
30
|
mangleProps?: RegExp;
|
@@ -50,11 +52,15 @@ interface CommonOptions {
|
|
50
52
|
ignoreAnnotations?: boolean;
|
51
53
|
|
52
54
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
53
|
-
jsx?: 'transform' | 'preserve';
|
55
|
+
jsx?: 'transform' | 'preserve' | 'automatic';
|
54
56
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
55
57
|
jsxFactory?: string;
|
56
58
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
57
59
|
jsxFragment?: string;
|
60
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
61
|
+
jsxImportSource?: string;
|
62
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
63
|
+
jsxDev?: boolean;
|
58
64
|
|
59
65
|
/** Documentation: https://esbuild.github.io/api/#define */
|
60
66
|
define?: { [key: string]: string };
|
@@ -88,8 +94,6 @@ export interface BuildOptions extends CommonOptions {
|
|
88
94
|
outdir?: string;
|
89
95
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
90
96
|
outbase?: string;
|
91
|
-
/** Documentation: https://esbuild.github.io/api/#platform */
|
92
|
-
platform?: Platform;
|
93
97
|
/** Documentation: https://esbuild.github.io/api/#external */
|
94
98
|
external?: string[];
|
95
99
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
@@ -143,7 +147,7 @@ export interface WatchMode {
|
|
143
147
|
}
|
144
148
|
|
145
149
|
export interface StdinOptions {
|
146
|
-
contents: string;
|
150
|
+
contents: string | Uint8Array;
|
147
151
|
resolveDir?: string;
|
148
152
|
sourcefile?: string;
|
149
153
|
loader?: Loader;
|
@@ -495,7 +499,7 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
|
|
495
499
|
*
|
496
500
|
* Documentation: https://esbuild.github.io/api/#transform-api
|
497
501
|
*/
|
498
|
-
export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
502
|
+
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
|
499
503
|
|
500
504
|
/**
|
501
505
|
* Converts log messages to formatted message strings suitable for printing in
|
@@ -302,11 +302,14 @@ function pushCommonFlags(flags, options, keys) {
|
|
302
302
|
let jsx = getFlag(options, keys, "jsx", mustBeString);
|
303
303
|
let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
|
304
304
|
let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
|
305
|
+
let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
|
306
|
+
let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
|
305
307
|
let define = getFlag(options, keys, "define", mustBeObject);
|
306
308
|
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
307
309
|
let supported = getFlag(options, keys, "supported", mustBeObject);
|
308
310
|
let pure = getFlag(options, keys, "pure", mustBeArray);
|
309
311
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
312
|
+
let platform = getFlag(options, keys, "platform", mustBeString);
|
310
313
|
if (legalComments)
|
311
314
|
flags.push(`--legal-comments=${legalComments}`);
|
312
315
|
if (sourceRoot !== void 0)
|
@@ -323,6 +326,8 @@ function pushCommonFlags(flags, options, keys) {
|
|
323
326
|
flags.push(`--format=${format}`);
|
324
327
|
if (globalName)
|
325
328
|
flags.push(`--global-name=${globalName}`);
|
329
|
+
if (platform)
|
330
|
+
flags.push(`--platform=${platform}`);
|
326
331
|
if (minify)
|
327
332
|
flags.push("--minify");
|
328
333
|
if (minifySyntax)
|
@@ -352,6 +357,10 @@ function pushCommonFlags(flags, options, keys) {
|
|
352
357
|
flags.push(`--jsx-factory=${jsxFactory}`);
|
353
358
|
if (jsxFragment)
|
354
359
|
flags.push(`--jsx-fragment=${jsxFragment}`);
|
360
|
+
if (jsxImportSource)
|
361
|
+
flags.push(`--jsx-import-source=${jsxImportSource}`);
|
362
|
+
if (jsxDev)
|
363
|
+
flags.push(`--jsx-dev`);
|
355
364
|
if (define) {
|
356
365
|
for (let key in define) {
|
357
366
|
if (key.indexOf("=") >= 0)
|
@@ -398,7 +407,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
398
407
|
let outfile = getFlag(options, keys, "outfile", mustBeString);
|
399
408
|
let outdir = getFlag(options, keys, "outdir", mustBeString);
|
400
409
|
let outbase = getFlag(options, keys, "outbase", mustBeString);
|
401
|
-
let platform = getFlag(options, keys, "platform", mustBeString);
|
402
410
|
let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
|
403
411
|
let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray);
|
404
412
|
let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray);
|
@@ -452,8 +460,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
452
460
|
flags.push(`--outdir=${outdir}`);
|
453
461
|
if (outbase)
|
454
462
|
flags.push(`--outbase=${outbase}`);
|
455
|
-
if (platform)
|
456
|
-
flags.push(`--platform=${platform}`);
|
457
463
|
if (tsconfig)
|
458
464
|
flags.push(`--tsconfig=${tsconfig}`);
|
459
465
|
if (resolveExtensions) {
|
@@ -541,7 +547,7 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
541
547
|
}
|
542
548
|
if (stdin) {
|
543
549
|
let stdinKeys = /* @__PURE__ */ Object.create(null);
|
544
|
-
let contents = getFlag(stdin, stdinKeys, "contents",
|
550
|
+
let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
|
545
551
|
let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
|
546
552
|
let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
|
547
553
|
let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
|
@@ -552,7 +558,10 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
552
558
|
flags.push(`--loader=${loader2}`);
|
553
559
|
if (resolveDir)
|
554
560
|
stdinResolveDir = resolveDir + "";
|
555
|
-
|
561
|
+
if (typeof contents === "string")
|
562
|
+
stdinContents = encodeUTF8(contents);
|
563
|
+
else if (contents instanceof Uint8Array)
|
564
|
+
stdinContents = contents;
|
556
565
|
}
|
557
566
|
let nodePaths = [];
|
558
567
|
if (nodePathsInput) {
|
@@ -747,8 +756,8 @@ function createChannel(streamIn) {
|
|
747
756
|
if (isFirstPacket) {
|
748
757
|
isFirstPacket = false;
|
749
758
|
let binaryVersion = String.fromCharCode(...bytes);
|
750
|
-
if (binaryVersion !== "0.
|
751
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
759
|
+
if (binaryVersion !== "0.15.4") {
|
760
|
+
throw new Error(`Cannot start service: Host version "${"0.15.4"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
752
761
|
}
|
753
762
|
return;
|
754
763
|
}
|
@@ -1135,24 +1144,27 @@ function createChannel(streamIn) {
|
|
1135
1144
|
if (plugins && plugins.length > 0) {
|
1136
1145
|
if (streamIn.isSync)
|
1137
1146
|
return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
|
1138
|
-
handlePlugins(options, plugins, key, details, refs).then(
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1147
|
+
handlePlugins(options, plugins, key, details, refs).then(
|
1148
|
+
(result) => {
|
1149
|
+
if (!result.ok) {
|
1150
|
+
handleError(result.error, result.pluginName);
|
1151
|
+
} else {
|
1152
|
+
try {
|
1153
|
+
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
1154
|
+
key,
|
1155
|
+
details,
|
1156
|
+
logPluginError,
|
1157
|
+
requestPlugins: result.requestPlugins,
|
1158
|
+
runOnEndCallbacks: result.runOnEndCallbacks,
|
1159
|
+
pluginRefs: result.pluginRefs
|
1160
|
+
}));
|
1161
|
+
} catch (e) {
|
1162
|
+
handleError(e, "");
|
1163
|
+
}
|
1153
1164
|
}
|
1154
|
-
}
|
1155
|
-
|
1165
|
+
},
|
1166
|
+
(e) => handleError(e, "")
|
1167
|
+
);
|
1156
1168
|
} else {
|
1157
1169
|
try {
|
1158
1170
|
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
@@ -1255,18 +1267,22 @@ function createChannel(streamIn) {
|
|
1255
1267
|
rebuild = () => new Promise((resolve, reject) => {
|
1256
1268
|
if (isDisposed || closeData)
|
1257
1269
|
throw new Error("Cannot rebuild");
|
1258
|
-
sendRequest(
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1270
|
+
sendRequest(
|
1271
|
+
refs,
|
1272
|
+
{ command: "rebuild", key },
|
1273
|
+
(error2, response2) => {
|
1274
|
+
if (error2) {
|
1275
|
+
const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1276
|
+
return callback2(failureErrorWithLog("Build failed", [message], []), null);
|
1277
|
+
}
|
1278
|
+
buildResponseToResult(response2, (error3, result3) => {
|
1279
|
+
if (error3)
|
1280
|
+
reject(error3);
|
1281
|
+
else
|
1282
|
+
resolve(result3);
|
1283
|
+
});
|
1262
1284
|
}
|
1263
|
-
|
1264
|
-
if (error3)
|
1265
|
-
reject(error3);
|
1266
|
-
else
|
1267
|
-
resolve(result3);
|
1268
|
-
});
|
1269
|
-
});
|
1285
|
+
);
|
1270
1286
|
});
|
1271
1287
|
refs.ref();
|
1272
1288
|
rebuild.dispose = () => {
|
@@ -1361,8 +1377,8 @@ function createChannel(streamIn) {
|
|
1361
1377
|
const details = createObjectStash();
|
1362
1378
|
let start = (inputPath) => {
|
1363
1379
|
try {
|
1364
|
-
if (typeof input !== "string")
|
1365
|
-
throw new Error('The input to "transform" must be a string');
|
1380
|
+
if (typeof input !== "string" && !(input instanceof Uint8Array))
|
1381
|
+
throw new Error('The input to "transform" must be a string or a Uint8Array');
|
1366
1382
|
let {
|
1367
1383
|
flags,
|
1368
1384
|
mangleCache
|
@@ -1371,7 +1387,7 @@ function createChannel(streamIn) {
|
|
1371
1387
|
command: "transform",
|
1372
1388
|
flags,
|
1373
1389
|
inputFS: inputPath !== null,
|
1374
|
-
input: inputPath !== null ? inputPath : input
|
1390
|
+
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
1375
1391
|
};
|
1376
1392
|
if (mangleCache)
|
1377
1393
|
request.mangleCache = mangleCache;
|
@@ -1428,7 +1444,7 @@ function createChannel(streamIn) {
|
|
1428
1444
|
});
|
1429
1445
|
}
|
1430
1446
|
};
|
1431
|
-
if (typeof input === "string" && input.length > 1024 * 1024) {
|
1447
|
+
if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
|
1432
1448
|
let next = start;
|
1433
1449
|
start = () => fs.writeFile(input, next);
|
1434
1450
|
}
|
@@ -1687,15 +1703,18 @@ function convertOutputFiles({ path, contents }) {
|
|
1687
1703
|
path,
|
1688
1704
|
contents,
|
1689
1705
|
get text() {
|
1690
|
-
|
1691
|
-
|
1706
|
+
const binary = this.contents;
|
1707
|
+
if (text === null || binary !== contents) {
|
1708
|
+
contents = binary;
|
1709
|
+
text = decodeUTF8(binary);
|
1710
|
+
}
|
1692
1711
|
return text;
|
1693
1712
|
}
|
1694
1713
|
};
|
1695
1714
|
}
|
1696
1715
|
|
1697
1716
|
// lib/npm/browser.ts
|
1698
|
-
var version = "0.
|
1717
|
+
var version = "0.15.4";
|
1699
1718
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1700
1719
|
var serve = () => {
|
1701
1720
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1751,7 +1770,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
1751
1770
|
}
|
1752
1771
|
let worker;
|
1753
1772
|
if (useWorker) {
|
1754
|
-
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 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 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 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 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)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.49"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1773
|
+
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 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 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 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 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)\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.15.4"}`];\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" });
|
1755
1774
|
worker = new Worker(URL.createObjectURL(blob));
|
1756
1775
|
} else {
|
1757
1776
|
let onmessage = ((postMessage) => {
|
@@ -2046,13 +2065,16 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2046
2065
|
sp >>>= 0;
|
2047
2066
|
const id = this._nextCallbackTimeoutID;
|
2048
2067
|
this._nextCallbackTimeoutID++;
|
2049
|
-
this._scheduledTimeouts.set(id, setTimeout(
|
2050
|
-
|
2051
|
-
while (this._scheduledTimeouts.has(id)) {
|
2052
|
-
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2068
|
+
this._scheduledTimeouts.set(id, setTimeout(
|
2069
|
+
() => {
|
2053
2070
|
this._resume();
|
2054
|
-
|
2055
|
-
|
2071
|
+
while (this._scheduledTimeouts.has(id)) {
|
2072
|
+
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2073
|
+
this._resume();
|
2074
|
+
}
|
2075
|
+
},
|
2076
|
+
getInt64(sp + 8) + 1
|
2077
|
+
));
|
2056
2078
|
this.mem.setInt32(sp + 16, id, true);
|
2057
2079
|
},
|
2058
2080
|
"runtime.clearTimeoutEvent": (sp) => {
|
@@ -2330,7 +2352,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2330
2352
|
callback(null, count);
|
2331
2353
|
};
|
2332
2354
|
let go = new globalThis.Go();
|
2333
|
-
go.argv = ["", `--service=${"0.
|
2355
|
+
go.argv = ["", `--service=${"0.15.4"}`];
|
2334
2356
|
if (wasm instanceof WebAssembly.Module) {
|
2335
2357
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2336
2358
|
} else {
|