isomorfeus-asset-manager 0.14.23 → 0.14.26
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15f32ab3f823176ea010110b2cec38527e9df102e665c82ed8ee826d54579ad8
|
4
|
+
data.tar.gz: 415b8e834d7e016f5c597b06431d0bd79d9f48e2e386dffa0b9c35650802e0ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51fd63894148793f8fb15e1a857afa95b36e5cb45ecee76befc745aeaff14bacecb005cafd9ec40f8b491656a0803924a7502c7ae7b606f05d92b02cb8cca7f
|
7
|
+
data.tar.gz: e28e93611faf24d3ca838e7b61ac08149e075d3457099c8b9af9426c1aa783e7d5d4e33ee0a8babe35ed8250155291829ff973a73402083384b2c3d022eb9eb0
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.14.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.14.53",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.53.tgz",
|
9
|
+
"integrity": "sha512-7b9EaBu6T16D4++/tEecq60wa1/latTo55U2frlpD5ATZSS2CpJ4Dd64Wck+xRXZp8pMJ5eQHEDiCr5bU2naQA==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Evan Wallace
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export type Platform = 'browser' | 'node' | 'neutral';
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm';
|
3
|
-
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
3
|
+
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
5
5
|
export type Charset = 'ascii' | 'utf8';
|
6
6
|
export type Drop = 'console' | 'debugger';
|
@@ -17,10 +17,14 @@ interface CommonOptions {
|
|
17
17
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
19
19
|
format?: Format;
|
20
|
-
/** Documentation: https://esbuild.github.io/api/#
|
20
|
+
/** Documentation: https://esbuild.github.io/api/#global-name */
|
21
21
|
globalName?: string;
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
23
23
|
target?: string | string[];
|
24
|
+
/** Documentation: https://esbuild.github.io/api/#supported */
|
25
|
+
supported?: Record<string, boolean>;
|
26
|
+
/** Documentation: https://esbuild.github.io/api/#platform */
|
27
|
+
platform?: Platform;
|
24
28
|
|
25
29
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
26
30
|
mangleProps?: RegExp;
|
@@ -48,11 +52,15 @@ interface CommonOptions {
|
|
48
52
|
ignoreAnnotations?: boolean;
|
49
53
|
|
50
54
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
51
|
-
jsx?: 'transform' | 'preserve';
|
55
|
+
jsx?: 'transform' | 'preserve' | 'automatic';
|
52
56
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
53
57
|
jsxFactory?: string;
|
54
58
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
55
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;
|
56
64
|
|
57
65
|
/** Documentation: https://esbuild.github.io/api/#define */
|
58
66
|
define?: { [key: string]: string };
|
@@ -67,6 +75,8 @@ interface CommonOptions {
|
|
67
75
|
logLevel?: LogLevel;
|
68
76
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
69
77
|
logLimit?: number;
|
78
|
+
/** Documentation: https://esbuild.github.io/api/#log-override */
|
79
|
+
logOverride?: Record<string, LogLevel>;
|
70
80
|
}
|
71
81
|
|
72
82
|
export interface BuildOptions extends CommonOptions {
|
@@ -84,15 +94,13 @@ export interface BuildOptions extends CommonOptions {
|
|
84
94
|
outdir?: string;
|
85
95
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
86
96
|
outbase?: string;
|
87
|
-
/** Documentation: https://esbuild.github.io/api/#platform */
|
88
|
-
platform?: Platform;
|
89
97
|
/** Documentation: https://esbuild.github.io/api/#external */
|
90
98
|
external?: string[];
|
91
99
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
92
100
|
loader?: { [ext: string]: Loader };
|
93
101
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
94
102
|
resolveExtensions?: string[];
|
95
|
-
/** Documentation: https://esbuild.github.io/api/#
|
103
|
+
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
96
104
|
mainFields?: string[];
|
97
105
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
98
106
|
conditions?: string[];
|
@@ -139,13 +147,14 @@ export interface WatchMode {
|
|
139
147
|
}
|
140
148
|
|
141
149
|
export interface StdinOptions {
|
142
|
-
contents: string;
|
150
|
+
contents: string | Uint8Array;
|
143
151
|
resolveDir?: string;
|
144
152
|
sourcefile?: string;
|
145
153
|
loader?: Loader;
|
146
154
|
}
|
147
155
|
|
148
156
|
export interface Message {
|
157
|
+
id: string;
|
149
158
|
pluginName: string;
|
150
159
|
text: string;
|
151
160
|
location: Location | null;
|
@@ -400,6 +409,7 @@ export interface OnLoadResult {
|
|
400
409
|
}
|
401
410
|
|
402
411
|
export interface PartialMessage {
|
412
|
+
id?: string;
|
403
413
|
pluginName?: string;
|
404
414
|
text?: string;
|
405
415
|
location?: Partial<Location> | null;
|
@@ -489,7 +499,7 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
|
|
489
499
|
*
|
490
500
|
* Documentation: https://esbuild.github.io/api/#transform-api
|
491
501
|
*/
|
492
|
-
export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
502
|
+
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
|
493
503
|
|
494
504
|
/**
|
495
505
|
* Converts log messages to formatted message strings suitable for printing in
|
@@ -302,9 +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);
|
308
|
+
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
309
|
+
let supported = getFlag(options, keys, "supported", mustBeObject);
|
306
310
|
let pure = getFlag(options, keys, "pure", mustBeArray);
|
307
311
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
312
|
+
let platform = getFlag(options, keys, "platform", mustBeString);
|
308
313
|
if (legalComments)
|
309
314
|
flags.push(`--legal-comments=${legalComments}`);
|
310
315
|
if (sourceRoot !== void 0)
|
@@ -321,6 +326,8 @@ function pushCommonFlags(flags, options, keys) {
|
|
321
326
|
flags.push(`--format=${format}`);
|
322
327
|
if (globalName)
|
323
328
|
flags.push(`--global-name=${globalName}`);
|
329
|
+
if (platform)
|
330
|
+
flags.push(`--platform=${platform}`);
|
324
331
|
if (minify)
|
325
332
|
flags.push("--minify");
|
326
333
|
if (minifySyntax)
|
@@ -350,6 +357,10 @@ function pushCommonFlags(flags, options, keys) {
|
|
350
357
|
flags.push(`--jsx-factory=${jsxFactory}`);
|
351
358
|
if (jsxFragment)
|
352
359
|
flags.push(`--jsx-fragment=${jsxFragment}`);
|
360
|
+
if (jsxImportSource)
|
361
|
+
flags.push(`--jsx-import-source=${jsxImportSource}`);
|
362
|
+
if (jsxDev)
|
363
|
+
flags.push(`--jsx-dev`);
|
353
364
|
if (define) {
|
354
365
|
for (let key in define) {
|
355
366
|
if (key.indexOf("=") >= 0)
|
@@ -357,6 +368,20 @@ function pushCommonFlags(flags, options, keys) {
|
|
357
368
|
flags.push(`--define:${key}=${define[key]}`);
|
358
369
|
}
|
359
370
|
}
|
371
|
+
if (logOverride) {
|
372
|
+
for (let key in logOverride) {
|
373
|
+
if (key.indexOf("=") >= 0)
|
374
|
+
throw new Error(`Invalid log override: ${key}`);
|
375
|
+
flags.push(`--log-override:${key}=${logOverride[key]}`);
|
376
|
+
}
|
377
|
+
}
|
378
|
+
if (supported) {
|
379
|
+
for (let key in supported) {
|
380
|
+
if (key.indexOf("=") >= 0)
|
381
|
+
throw new Error(`Invalid supported: ${key}`);
|
382
|
+
flags.push(`--supported:${key}=${supported[key]}`);
|
383
|
+
}
|
384
|
+
}
|
360
385
|
if (pure)
|
361
386
|
for (let fn of pure)
|
362
387
|
flags.push(`--pure:${fn}`);
|
@@ -382,7 +407,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
382
407
|
let outfile = getFlag(options, keys, "outfile", mustBeString);
|
383
408
|
let outdir = getFlag(options, keys, "outdir", mustBeString);
|
384
409
|
let outbase = getFlag(options, keys, "outbase", mustBeString);
|
385
|
-
let platform = getFlag(options, keys, "platform", mustBeString);
|
386
410
|
let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
|
387
411
|
let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray);
|
388
412
|
let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray);
|
@@ -436,8 +460,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
436
460
|
flags.push(`--outdir=${outdir}`);
|
437
461
|
if (outbase)
|
438
462
|
flags.push(`--outbase=${outbase}`);
|
439
|
-
if (platform)
|
440
|
-
flags.push(`--platform=${platform}`);
|
441
463
|
if (tsconfig)
|
442
464
|
flags.push(`--tsconfig=${tsconfig}`);
|
443
465
|
if (resolveExtensions) {
|
@@ -525,7 +547,7 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
525
547
|
}
|
526
548
|
if (stdin) {
|
527
549
|
let stdinKeys = /* @__PURE__ */ Object.create(null);
|
528
|
-
let contents = getFlag(stdin, stdinKeys, "contents",
|
550
|
+
let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
|
529
551
|
let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
|
530
552
|
let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
|
531
553
|
let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
|
@@ -536,7 +558,10 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
|
|
536
558
|
flags.push(`--loader=${loader2}`);
|
537
559
|
if (resolveDir)
|
538
560
|
stdinResolveDir = resolveDir + "";
|
539
|
-
|
561
|
+
if (typeof contents === "string")
|
562
|
+
stdinContents = encodeUTF8(contents);
|
563
|
+
else if (contents instanceof Uint8Array)
|
564
|
+
stdinContents = contents;
|
540
565
|
}
|
541
566
|
let nodePaths = [];
|
542
567
|
if (nodePathsInput) {
|
@@ -731,8 +756,8 @@ function createChannel(streamIn) {
|
|
731
756
|
if (isFirstPacket) {
|
732
757
|
isFirstPacket = false;
|
733
758
|
let binaryVersion = String.fromCharCode(...bytes);
|
734
|
-
if (binaryVersion !== "0.14.
|
735
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
759
|
+
if (binaryVersion !== "0.14.53") {
|
760
|
+
throw new Error(`Cannot start service: Host version "${"0.14.53"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
736
761
|
}
|
737
762
|
return;
|
738
763
|
}
|
@@ -1119,24 +1144,27 @@ function createChannel(streamIn) {
|
|
1119
1144
|
if (plugins && plugins.length > 0) {
|
1120
1145
|
if (streamIn.isSync)
|
1121
1146
|
return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
|
1122
|
-
handlePlugins(options, plugins, key, details, refs).then(
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
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
|
+
}
|
1137
1164
|
}
|
1138
|
-
}
|
1139
|
-
|
1165
|
+
},
|
1166
|
+
(e) => handleError(e, "")
|
1167
|
+
);
|
1140
1168
|
} else {
|
1141
1169
|
try {
|
1142
1170
|
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
@@ -1181,7 +1209,7 @@ function createChannel(streamIn) {
|
|
1181
1209
|
callerRefs.unref();
|
1182
1210
|
}
|
1183
1211
|
};
|
1184
|
-
let writeDefault = !streamIn.
|
1212
|
+
let writeDefault = !streamIn.isWriteUnavailable;
|
1185
1213
|
let {
|
1186
1214
|
entries,
|
1187
1215
|
flags,
|
@@ -1239,18 +1267,22 @@ function createChannel(streamIn) {
|
|
1239
1267
|
rebuild = () => new Promise((resolve, reject) => {
|
1240
1268
|
if (isDisposed || closeData)
|
1241
1269
|
throw new Error("Cannot rebuild");
|
1242
|
-
sendRequest(
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
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
|
+
});
|
1246
1284
|
}
|
1247
|
-
|
1248
|
-
if (error3)
|
1249
|
-
reject(error3);
|
1250
|
-
else
|
1251
|
-
resolve(result3);
|
1252
|
-
});
|
1253
|
-
});
|
1285
|
+
);
|
1254
1286
|
});
|
1255
1287
|
refs.ref();
|
1256
1288
|
rebuild.dispose = () => {
|
@@ -1309,8 +1341,8 @@ function createChannel(streamIn) {
|
|
1309
1341
|
callback2(null, result);
|
1310
1342
|
});
|
1311
1343
|
};
|
1312
|
-
if (write && streamIn.
|
1313
|
-
throw new Error(`
|
1344
|
+
if (write && streamIn.isWriteUnavailable)
|
1345
|
+
throw new Error(`The "write" option is unavailable in this environment`);
|
1314
1346
|
if (incremental && streamIn.isSync)
|
1315
1347
|
throw new Error(`Cannot use "incremental" with a synchronous build`);
|
1316
1348
|
if (watch && streamIn.isSync)
|
@@ -1345,8 +1377,8 @@ function createChannel(streamIn) {
|
|
1345
1377
|
const details = createObjectStash();
|
1346
1378
|
let start = (inputPath) => {
|
1347
1379
|
try {
|
1348
|
-
if (typeof input !== "string")
|
1349
|
-
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');
|
1350
1382
|
let {
|
1351
1383
|
flags,
|
1352
1384
|
mangleCache
|
@@ -1355,7 +1387,7 @@ function createChannel(streamIn) {
|
|
1355
1387
|
command: "transform",
|
1356
1388
|
flags,
|
1357
1389
|
inputFS: inputPath !== null,
|
1358
|
-
input: inputPath !== null ? inputPath : input
|
1390
|
+
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
1359
1391
|
};
|
1360
1392
|
if (mangleCache)
|
1361
1393
|
request.mangleCache = mangleCache;
|
@@ -1412,7 +1444,7 @@ function createChannel(streamIn) {
|
|
1412
1444
|
});
|
1413
1445
|
}
|
1414
1446
|
};
|
1415
|
-
if (typeof input === "string" && input.length > 1024 * 1024) {
|
1447
|
+
if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
|
1416
1448
|
let next = start;
|
1417
1449
|
start = () => fs.writeFile(input, next);
|
1418
1450
|
}
|
@@ -1524,7 +1556,7 @@ function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
|
|
1524
1556
|
location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
|
1525
1557
|
} catch (e2) {
|
1526
1558
|
}
|
1527
|
-
return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1559
|
+
return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1528
1560
|
}
|
1529
1561
|
function parseStackLinesV8(streamIn, lines, ident) {
|
1530
1562
|
let at = " at ";
|
@@ -1623,6 +1655,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1623
1655
|
let index = 0;
|
1624
1656
|
for (const message of messages) {
|
1625
1657
|
let keys = {};
|
1658
|
+
let id = getFlag(message, keys, "id", mustBeString);
|
1626
1659
|
let pluginName = getFlag(message, keys, "pluginName", mustBeString);
|
1627
1660
|
let text = getFlag(message, keys, "text", mustBeString);
|
1628
1661
|
let location = getFlag(message, keys, "location", mustBeObjectOrNull);
|
@@ -1644,6 +1677,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1644
1677
|
}
|
1645
1678
|
}
|
1646
1679
|
messagesClone.push({
|
1680
|
+
id: id || "",
|
1647
1681
|
pluginName: pluginName || fallbackPluginName,
|
1648
1682
|
text: text || "",
|
1649
1683
|
location: sanitizeLocation(location, where),
|
@@ -1669,15 +1703,18 @@ function convertOutputFiles({ path, contents }) {
|
|
1669
1703
|
path,
|
1670
1704
|
contents,
|
1671
1705
|
get text() {
|
1672
|
-
|
1673
|
-
|
1706
|
+
const binary = this.contents;
|
1707
|
+
if (text === null || binary !== contents) {
|
1708
|
+
contents = binary;
|
1709
|
+
text = decodeUTF8(binary);
|
1710
|
+
}
|
1674
1711
|
return text;
|
1675
1712
|
}
|
1676
1713
|
};
|
1677
1714
|
}
|
1678
1715
|
|
1679
1716
|
// lib/npm/browser.ts
|
1680
|
-
var version = "0.14.
|
1717
|
+
var version = "0.14.53";
|
1681
1718
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1682
1719
|
var serve = () => {
|
1683
1720
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1733,7 +1770,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
1733
1770
|
}
|
1734
1771
|
let worker;
|
1735
1772
|
if (useWorker) {
|
1736
|
-
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.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" });
|
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.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" });
|
1737
1774
|
worker = new Worker(URL.createObjectURL(blob));
|
1738
1775
|
} else {
|
1739
1776
|
let onmessage = ((postMessage) => {
|
@@ -2028,13 +2065,16 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2028
2065
|
sp >>>= 0;
|
2029
2066
|
const id = this._nextCallbackTimeoutID;
|
2030
2067
|
this._nextCallbackTimeoutID++;
|
2031
|
-
this._scheduledTimeouts.set(id, setTimeout(
|
2032
|
-
|
2033
|
-
while (this._scheduledTimeouts.has(id)) {
|
2034
|
-
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2068
|
+
this._scheduledTimeouts.set(id, setTimeout(
|
2069
|
+
() => {
|
2035
2070
|
this._resume();
|
2036
|
-
|
2037
|
-
|
2071
|
+
while (this._scheduledTimeouts.has(id)) {
|
2072
|
+
console.warn("scheduleTimeoutEvent: missed timeout event");
|
2073
|
+
this._resume();
|
2074
|
+
}
|
2075
|
+
},
|
2076
|
+
getInt64(sp + 8) + 1
|
2077
|
+
));
|
2038
2078
|
this.mem.setInt32(sp + 16, id, true);
|
2039
2079
|
},
|
2040
2080
|
"runtime.clearTimeoutEvent": (sp) => {
|
@@ -2312,7 +2352,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2312
2352
|
callback(null, count);
|
2313
2353
|
};
|
2314
2354
|
let go = new globalThis.Go();
|
2315
|
-
go.argv = ["", `--service=${"0.14.
|
2355
|
+
go.argv = ["", `--service=${"0.14.53"}`];
|
2316
2356
|
if (wasm instanceof WebAssembly.Module) {
|
2317
2357
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2318
2358
|
} else {
|
@@ -2335,7 +2375,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2335
2375
|
worker.postMessage(bytes);
|
2336
2376
|
},
|
2337
2377
|
isSync: false,
|
2338
|
-
|
2378
|
+
isWriteUnavailable: true,
|
2339
2379
|
esbuild: browser_exports
|
2340
2380
|
});
|
2341
2381
|
longLivedService = {
|