wasm-idle 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -66
- package/dist/playground/aheui.d.ts +18 -0
- package/dist/playground/aheui.js +21 -0
- package/dist/playground/apecode.d.ts +18 -0
- package/dist/playground/apecode.js +21 -0
- package/dist/playground/assets.d.ts +18 -0
- package/dist/playground/assets.js +151 -283
- package/dist/playground/dotnet.js +1 -1
- package/dist/playground/elixir.js +2 -2
- package/dist/playground/fennel.js +1 -1
- package/dist/playground/go.js +1 -1
- package/dist/playground/golfscript.d.ts +6 -0
- package/dist/playground/golfscript.js +8 -0
- package/dist/playground/haskell.js +1 -1
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +81 -0
- package/dist/playground/lua.js +1 -1
- package/dist/playground/python.d.ts +6 -2
- package/dist/playground/python.js +81 -15
- package/dist/playground/r.js +1 -1
- package/dist/playground/ruby.d.ts +6 -0
- package/dist/playground/ruby.js +108 -56
- package/dist/playground/rust.js +1 -1
- package/dist/playground/tinygo.js +1 -1
- package/dist/playground/typescript.js +1 -1
- package/dist/playground/wasiInterpreters.d.ts +15 -0
- package/dist/playground/wasiInterpreters.js +67 -0
- package/dist/playground/wasm.d.ts +3 -0
- package/dist/playground/wasm.js +44 -3
- package/dist/playground/wasmAheuiVersion.d.ts +7 -0
- package/dist/playground/wasmAheuiVersion.js +10 -0
- package/dist/playground/wasmApecodeVersion.d.ts +7 -0
- package/dist/playground/wasmApecodeVersion.js +9 -0
- package/dist/playground/wasmGolfscriptVersion.d.ts +10 -0
- package/dist/playground/wasmGolfscriptVersion.js +10 -0
- package/dist/playground/wat.js +1 -1
- package/dist/playground/worker/elixir.js +1 -1
- package/dist/playground/worker/go.js +1 -1
- package/dist/playground/worker/golfscriptMount.d.ts +45 -0
- package/dist/playground/worker/golfscriptMount.js +79 -0
- package/dist/playground/worker/haskell.js +1 -1
- package/dist/playground/worker/lua.js +1 -1
- package/dist/playground/worker/python.js +227 -34
- package/dist/playground/worker/r.js +1 -1
- package/dist/playground/worker/ruby.js +151 -15
- package/dist/playground/worker/rust.js +1 -1
- package/dist/playground/worker/typescript.js +1 -1
- package/dist/playground/worker/wasm.js +106 -7
- package/dist/playground/worker/wat.js +1 -1
- package/dist/playground/worker/zig.js +1 -1
- package/dist/playground/zig.js +1 -1
- package/package.json +21 -7
- package/dist/testPublicEnv.d.ts +0 -2
- package/dist/testPublicEnv.js +0 -8
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as publicEnv from '$app/env/public';
|
|
2
1
|
import { resolveRuntimeAssetCacheOptions, resolveRuntimeAssetLockEntry } from '@wasm-idle/core';
|
|
3
2
|
import { BUNDLED_CLANG_ASSET_INTEGRITY } from './clangAssetIntegrity';
|
|
4
3
|
import { snapshotDOuterAssetConfig } from './dOuterAssets';
|
|
@@ -13,6 +12,7 @@ import { WASM_RESCRIPT_ASSET_VERSION, WASM_RESCRIPT_RUNNER_RECEIPT, WASM_RESCRIP
|
|
|
13
12
|
import { WASM_J_ASSET_VERSION, WASM_J_RUNNER_RECEIPT, WASM_J_RUNTIME_PROFILE } from './wasmJVersion';
|
|
14
13
|
import { WASM_JANET_RUNTIME_BUNDLE } from './wasmJanetVersion';
|
|
15
14
|
import { WASM_FENNEL_COMPILER_RECEIPT } from './wasmFennelVersion';
|
|
15
|
+
import { WASM_GOLFSCRIPT_ASSET_VERSION, WASM_GOLFSCRIPT_INTERPRETER_RECEIPT } from './wasmGolfscriptVersion';
|
|
16
16
|
import { WASM_JULIA_RUNTIME_BUNDLE } from './wasmJuliaVersion';
|
|
17
17
|
import { WASM_LISP_ASSET_VERSION } from './wasmLispVersion';
|
|
18
18
|
import { WASM_NIM_RUNTIME_BUNDLE } from './wasmNimVersion';
|
|
@@ -86,12 +86,9 @@ const RUNTIME_ASSET_FOLDERS = {
|
|
|
86
86
|
java: {
|
|
87
87
|
folder: 'teavm',
|
|
88
88
|
virtualBaseUrl: 'https://wasm-idle.invalid/java/',
|
|
89
|
-
resolveRootBaseUrl: (rootUrl, currentUrl) =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
? resolveTeaVmBaseUrl(rootUrl, currentUrl, configuredBaseUrl)
|
|
93
|
-
: normalizeBaseUrl('teavm/', currentUrl);
|
|
94
|
-
},
|
|
89
|
+
resolveRootBaseUrl: (rootUrl, currentUrl) => rootUrl
|
|
90
|
+
? resolveTeaVmBaseUrl(rootUrl, currentUrl)
|
|
91
|
+
: normalizeBaseUrl('teavm/', currentUrl),
|
|
95
92
|
resolveConfiguredBaseUrl: normalizeTeaVmConfiguredBaseUrl
|
|
96
93
|
},
|
|
97
94
|
clang: {
|
|
@@ -175,16 +172,14 @@ function resolveRuntimeAssetConfigWithoutCache(runtime, options, currentUrl = ''
|
|
|
175
172
|
};
|
|
176
173
|
}
|
|
177
174
|
export function resolveRustCompilerUrl(options, currentUrl = '') {
|
|
178
|
-
const configuredCompilerUrl =
|
|
179
|
-
(publicEnv.PUBLIC_WASM_RUST_COMPILER_URL || '').trim();
|
|
175
|
+
const configuredCompilerUrl = typeof options === 'object' ? options?.rust?.compilerUrl : undefined;
|
|
180
176
|
if (!configuredCompilerUrl)
|
|
181
177
|
return '';
|
|
182
178
|
return currentUrl ? new URL(configuredCompilerUrl, currentUrl).href : configuredCompilerUrl;
|
|
183
179
|
}
|
|
184
180
|
export function resolveDebugRuntimeUrls(options, currentUrl = '') {
|
|
185
181
|
const configuredDebug = typeof options === 'object' ? options?.debug : undefined;
|
|
186
|
-
const
|
|
187
|
-
const configuredBaseUrl = configuredDebug?.baseUrl || publicBaseUrl;
|
|
182
|
+
const configuredBaseUrl = configuredDebug?.baseUrl;
|
|
188
183
|
const rootUrl = (typeof options === 'string' ? options : options?.rootUrl) || '';
|
|
189
184
|
const bundledBaseUrl = resolveFolderRuntimeBaseUrl('wasm-debug', rootUrl, currentUrl);
|
|
190
185
|
const baseUrl = configuredBaseUrl
|
|
@@ -195,9 +190,7 @@ export function resolveDebugRuntimeUrls(options, currentUrl = '') {
|
|
|
195
190
|
? resolveConfiguredUrl(configuredManifestUrl, currentUrl)
|
|
196
191
|
: new URL('runtime-manifest.v2.json', baseUrl).href;
|
|
197
192
|
const bundledManifestUrl = new URL('runtime-manifest.v2.json', bundledBaseUrl).href;
|
|
198
|
-
const explicitManifestSha256 = (
|
|
199
|
-
? configuredDebug.manifestSha256
|
|
200
|
-
: publicEnv.PUBLIC_WASM_DEBUG_RUNTIME_MANIFEST_SHA256)?.trim();
|
|
193
|
+
const explicitManifestSha256 = configuredDebug?.manifestSha256?.trim();
|
|
201
194
|
const manifestReceipt = explicitManifestSha256
|
|
202
195
|
? Object.freeze({ sha256: explicitManifestSha256 })
|
|
203
196
|
: baseUrl === bundledBaseUrl && manifestUrl === bundledManifestUrl
|
|
@@ -234,15 +227,13 @@ export function resolveRustDebugModuleUrl(options, currentUrl = '') {
|
|
|
234
227
|
}
|
|
235
228
|
}
|
|
236
229
|
export function resolveGoCompilerUrl(options, currentUrl = '') {
|
|
237
|
-
const configuredCompilerUrl =
|
|
238
|
-
(publicEnv.PUBLIC_WASM_GO_COMPILER_URL || '').trim();
|
|
230
|
+
const configuredCompilerUrl = typeof options === 'object' ? options?.go?.compilerUrl : undefined;
|
|
239
231
|
if (!configuredCompilerUrl)
|
|
240
232
|
return '';
|
|
241
233
|
return currentUrl ? new URL(configuredCompilerUrl, currentUrl).href : configuredCompilerUrl;
|
|
242
234
|
}
|
|
243
235
|
export function resolveDModuleUrl(options, currentUrl = '') {
|
|
244
|
-
const configuredModuleUrl =
|
|
245
|
-
(publicEnv.PUBLIC_WASM_D_MODULE_URL || '').trim();
|
|
236
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.d?.moduleUrl : undefined;
|
|
246
237
|
if (configuredModuleUrl) {
|
|
247
238
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
248
239
|
}
|
|
@@ -257,10 +248,9 @@ export function resolveDModuleUrl(options, currentUrl = '') {
|
|
|
257
248
|
export function resolveDRuntimeAssetConfig(options, currentUrl = '') {
|
|
258
249
|
const moduleUrl = resolveDModuleUrl(options, currentUrl);
|
|
259
250
|
if (!moduleUrl) {
|
|
260
|
-
throw new TypeError('D runtime is not configured. Set
|
|
251
|
+
throw new TypeError('D runtime is not configured. Set runtimeAssets.d.moduleUrl.');
|
|
261
252
|
}
|
|
262
|
-
const configuredManifestUrl =
|
|
263
|
-
(publicEnv.PUBLIC_WASM_D_MANIFEST_URL || '').trim();
|
|
253
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.d?.manifestUrl : undefined;
|
|
264
254
|
let manifestUrl;
|
|
265
255
|
if (configuredManifestUrl) {
|
|
266
256
|
manifestUrl = resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
@@ -278,8 +268,7 @@ export function resolveDRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
278
268
|
});
|
|
279
269
|
}
|
|
280
270
|
export function resolveDotnetModuleUrl(options, currentUrl = '') {
|
|
281
|
-
const configuredModuleUrl =
|
|
282
|
-
(publicEnv.PUBLIC_WASM_DOTNET_MODULE_URL || '').trim();
|
|
271
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.dotnet?.moduleUrl : undefined;
|
|
283
272
|
if (configuredModuleUrl) {
|
|
284
273
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
285
274
|
}
|
|
@@ -292,8 +281,7 @@ export function resolveDotnetModuleUrl(options, currentUrl = '') {
|
|
|
292
281
|
return '';
|
|
293
282
|
}
|
|
294
283
|
export function resolveOcamlModuleUrl(options, currentUrl = '') {
|
|
295
|
-
const configuredModuleUrl =
|
|
296
|
-
(publicEnv.PUBLIC_WASM_OCAML_MODULE_URL || '').trim();
|
|
284
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.ocaml?.moduleUrl : undefined;
|
|
297
285
|
if (configuredModuleUrl) {
|
|
298
286
|
return currentUrl ? new URL(configuredModuleUrl, currentUrl).href : configuredModuleUrl;
|
|
299
287
|
}
|
|
@@ -310,8 +298,7 @@ export function resolveOcamlModuleUrl(options, currentUrl = '') {
|
|
|
310
298
|
return '';
|
|
311
299
|
}
|
|
312
300
|
export function resolveOcamlManifestUrl(options, currentUrl = '') {
|
|
313
|
-
const configuredManifestUrl =
|
|
314
|
-
(publicEnv.PUBLIC_WASM_OCAML_MANIFEST_URL || '').trim();
|
|
301
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.ocaml?.manifestUrl : undefined;
|
|
315
302
|
if (configuredManifestUrl) {
|
|
316
303
|
return currentUrl ? new URL(configuredManifestUrl, currentUrl).href : configuredManifestUrl;
|
|
317
304
|
}
|
|
@@ -328,8 +315,7 @@ export function resolveOcamlManifestUrl(options, currentUrl = '') {
|
|
|
328
315
|
return '';
|
|
329
316
|
}
|
|
330
317
|
export function resolveTinyGoAppUrl(options, currentUrl = '') {
|
|
331
|
-
const configuredAppUrl =
|
|
332
|
-
(publicEnv.PUBLIC_WASM_TINYGO_APP_URL || '').trim();
|
|
318
|
+
const configuredAppUrl = typeof options === 'object' ? options?.tinygo?.appUrl : undefined;
|
|
333
319
|
if (configuredAppUrl) {
|
|
334
320
|
return resolveConfiguredUrl(configuredAppUrl, currentUrl);
|
|
335
321
|
}
|
|
@@ -397,13 +383,11 @@ function pinTinyGoExecutableModuleUrl(moduleUrl, currentUrl = '') {
|
|
|
397
383
|
return moduleUrl;
|
|
398
384
|
}
|
|
399
385
|
export function resolveTinyGoModuleUrl(options, currentUrl = '') {
|
|
400
|
-
const configuredModuleUrl =
|
|
401
|
-
(publicEnv.PUBLIC_WASM_TINYGO_MODULE_URL || '').trim();
|
|
386
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.tinygo?.moduleUrl : undefined;
|
|
402
387
|
if (configuredModuleUrl) {
|
|
403
388
|
return pinTinyGoExecutableModuleUrl(resolveConfiguredUrl(configuredModuleUrl, currentUrl), currentUrl);
|
|
404
389
|
}
|
|
405
|
-
const configuredLegacyAppUrl =
|
|
406
|
-
(publicEnv.PUBLIC_WASM_TINYGO_APP_URL || '').trim();
|
|
390
|
+
const configuredLegacyAppUrl = typeof options === 'object' ? options?.tinygo?.appUrl : undefined;
|
|
407
391
|
if (configuredLegacyAppUrl) {
|
|
408
392
|
return pinTinyGoExecutableModuleUrl(deriveTinyGoModuleUrlFromAppUrl(configuredLegacyAppUrl, currentUrl), currentUrl);
|
|
409
393
|
}
|
|
@@ -416,8 +400,7 @@ export function resolveTinyGoModuleUrl(options, currentUrl = '') {
|
|
|
416
400
|
return '';
|
|
417
401
|
}
|
|
418
402
|
export function resolveElixirBundleUrl(options, currentUrl = '') {
|
|
419
|
-
const configuredBundleUrl =
|
|
420
|
-
(publicEnv.PUBLIC_WASM_ELIXIR_BUNDLE_URL || '').trim();
|
|
403
|
+
const configuredBundleUrl = typeof options === 'object' ? options?.elixir?.bundleUrl : undefined;
|
|
421
404
|
if (configuredBundleUrl) {
|
|
422
405
|
return resolveConfiguredUrl(configuredBundleUrl, currentUrl);
|
|
423
406
|
}
|
|
@@ -431,9 +414,7 @@ export function resolveElixirBundleUrl(options, currentUrl = '') {
|
|
|
431
414
|
}
|
|
432
415
|
export function resolveErlangBundleUrl(options, currentUrl = '') {
|
|
433
416
|
const configuredBundleUrl = (typeof options === 'object' && options?.erlang?.bundleUrl) ||
|
|
434
|
-
(
|
|
435
|
-
(typeof options === 'object' && options?.elixir?.bundleUrl) ||
|
|
436
|
-
(publicEnv.PUBLIC_WASM_ELIXIR_BUNDLE_URL || '').trim();
|
|
417
|
+
(typeof options === 'object' && options?.elixir?.bundleUrl);
|
|
437
418
|
if (configuredBundleUrl) {
|
|
438
419
|
return resolveConfiguredUrl(configuredBundleUrl, currentUrl);
|
|
439
420
|
}
|
|
@@ -446,8 +427,7 @@ export function resolveErlangBundleUrl(options, currentUrl = '') {
|
|
|
446
427
|
return '';
|
|
447
428
|
}
|
|
448
429
|
export function resolveTypeScriptModuleUrl(options, currentUrl = '') {
|
|
449
|
-
const configuredModuleUrl =
|
|
450
|
-
(publicEnv.PUBLIC_WASM_TYPESCRIPT_MODULE_URL || '').trim();
|
|
430
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.typescript?.moduleUrl : undefined;
|
|
451
431
|
if (configuredModuleUrl) {
|
|
452
432
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
453
433
|
}
|
|
@@ -460,8 +440,7 @@ export function resolveTypeScriptModuleUrl(options, currentUrl = '') {
|
|
|
460
440
|
return '';
|
|
461
441
|
}
|
|
462
442
|
export function resolveWatModuleUrl(options, currentUrl = '') {
|
|
463
|
-
const configuredModuleUrl =
|
|
464
|
-
(publicEnv.PUBLIC_WASM_WAT_MODULE_URL || '').trim();
|
|
443
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.wat?.moduleUrl : undefined;
|
|
465
444
|
if (configuredModuleUrl) {
|
|
466
445
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
467
446
|
}
|
|
@@ -474,8 +453,7 @@ export function resolveWatModuleUrl(options, currentUrl = '') {
|
|
|
474
453
|
return '';
|
|
475
454
|
}
|
|
476
455
|
export function resolveLuaModuleUrl(options, currentUrl = '') {
|
|
477
|
-
const configuredModuleUrl =
|
|
478
|
-
(publicEnv.PUBLIC_WASM_LUA_MODULE_URL || '').trim();
|
|
456
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.lua?.moduleUrl : undefined;
|
|
479
457
|
if (configuredModuleUrl) {
|
|
480
458
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
481
459
|
}
|
|
@@ -488,8 +466,7 @@ export function resolveLuaModuleUrl(options, currentUrl = '') {
|
|
|
488
466
|
return '';
|
|
489
467
|
}
|
|
490
468
|
export function resolveFennelCompilerUrl(options, currentUrl = '') {
|
|
491
|
-
const configuredCompilerUrl =
|
|
492
|
-
(publicEnv.PUBLIC_WASM_FENNEL_COMPILER_URL || '').trim();
|
|
469
|
+
const configuredCompilerUrl = typeof options === 'object' ? options?.fennel?.compilerUrl : undefined;
|
|
493
470
|
if (configuredCompilerUrl) {
|
|
494
471
|
return resolveConfiguredUrl(configuredCompilerUrl, currentUrl);
|
|
495
472
|
}
|
|
@@ -500,8 +477,7 @@ export function resolveFennelCompilerUrl(options, currentUrl = '') {
|
|
|
500
477
|
return '';
|
|
501
478
|
}
|
|
502
479
|
export function resolveZigCompilerUrl(options, currentUrl = '') {
|
|
503
|
-
const configuredCompilerUrl =
|
|
504
|
-
(publicEnv.PUBLIC_WASM_ZIG_COMPILER_URL || '').trim();
|
|
480
|
+
const configuredCompilerUrl = typeof options === 'object' ? options?.zig?.compilerUrl : undefined;
|
|
505
481
|
if (configuredCompilerUrl) {
|
|
506
482
|
return resolveConfiguredUrl(configuredCompilerUrl, currentUrl);
|
|
507
483
|
}
|
|
@@ -514,8 +490,7 @@ export function resolveZigCompilerUrl(options, currentUrl = '') {
|
|
|
514
490
|
return '';
|
|
515
491
|
}
|
|
516
492
|
export function resolveHaskellModuleUrl(options, currentUrl = '') {
|
|
517
|
-
const configuredModuleUrl =
|
|
518
|
-
(publicEnv.PUBLIC_WASM_HASKELL_MODULE_URL || '').trim();
|
|
493
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.haskell?.moduleUrl : undefined;
|
|
519
494
|
if (configuredModuleUrl) {
|
|
520
495
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
521
496
|
}
|
|
@@ -528,8 +503,7 @@ export function resolveHaskellModuleUrl(options, currentUrl = '') {
|
|
|
528
503
|
return '';
|
|
529
504
|
}
|
|
530
505
|
export function resolveHaskellRootfsUrl(options, currentUrl = '') {
|
|
531
|
-
const configuredRootfsUrl =
|
|
532
|
-
(publicEnv.PUBLIC_WASM_HASKELL_ROOTFS_URL || '').trim();
|
|
506
|
+
const configuredRootfsUrl = typeof options === 'object' ? options?.haskell?.rootfsUrl : undefined;
|
|
533
507
|
if (configuredRootfsUrl) {
|
|
534
508
|
return resolveConfiguredUrl(configuredRootfsUrl, currentUrl);
|
|
535
509
|
}
|
|
@@ -542,8 +516,7 @@ export function resolveHaskellRootfsUrl(options, currentUrl = '') {
|
|
|
542
516
|
return '';
|
|
543
517
|
}
|
|
544
518
|
export function resolveHaskellBsdtarUrl(options, currentUrl = '') {
|
|
545
|
-
const configuredBsdtarUrl =
|
|
546
|
-
(publicEnv.PUBLIC_WASM_HASKELL_BSDTAR_URL || '').trim();
|
|
519
|
+
const configuredBsdtarUrl = typeof options === 'object' ? options?.haskell?.bsdtarUrl : undefined;
|
|
547
520
|
if (configuredBsdtarUrl) {
|
|
548
521
|
return resolveConfiguredUrl(configuredBsdtarUrl, currentUrl);
|
|
549
522
|
}
|
|
@@ -556,8 +529,7 @@ export function resolveHaskellBsdtarUrl(options, currentUrl = '') {
|
|
|
556
529
|
return '';
|
|
557
530
|
}
|
|
558
531
|
export function resolveFortranBaseUrl(options, currentUrl = '') {
|
|
559
|
-
const configuredBaseUrl =
|
|
560
|
-
(publicEnv.PUBLIC_WASM_FORTRAN_BASE_URL || '').trim();
|
|
532
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.fortran?.baseUrl : undefined;
|
|
561
533
|
if (configuredBaseUrl) {
|
|
562
534
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
563
535
|
}
|
|
@@ -569,26 +541,24 @@ export function resolveFortranBaseUrl(options, currentUrl = '') {
|
|
|
569
541
|
}
|
|
570
542
|
return normalizeBaseUrl('/wasm-fortran/', currentUrl);
|
|
571
543
|
}
|
|
572
|
-
function resolveFortranAssetUrl(options, currentUrl, configKey,
|
|
573
|
-
const
|
|
574
|
-
const configuredUrl = (typeof options === 'object' && options?.fortran?.[configKey]) ||
|
|
575
|
-
(env[envKey] || '').trim();
|
|
544
|
+
function resolveFortranAssetUrl(options, currentUrl, configKey, defaultAsset) {
|
|
545
|
+
const configuredUrl = typeof options === 'object' ? options?.fortran?.[configKey] : undefined;
|
|
576
546
|
if (configuredUrl) {
|
|
577
547
|
return resolveConfiguredUrl(configuredUrl, currentUrl);
|
|
578
548
|
}
|
|
579
549
|
return resolveConfiguredUrl(new URL(defaultAsset, resolveFortranBaseUrl(options, currentUrl)).href, currentUrl);
|
|
580
550
|
}
|
|
581
551
|
export function resolveFortranF2cWasmUrl(options, currentUrl = '') {
|
|
582
|
-
return resolveFortranAssetUrl(options, currentUrl, 'f2cWasmUrl', '
|
|
552
|
+
return resolveFortranAssetUrl(options, currentUrl, 'f2cWasmUrl', 'f2c.wasm');
|
|
583
553
|
}
|
|
584
554
|
export function resolveFortranLibf2cUrl(options, currentUrl = '') {
|
|
585
|
-
return resolveFortranAssetUrl(options, currentUrl, 'libf2cUrl', '
|
|
555
|
+
return resolveFortranAssetUrl(options, currentUrl, 'libf2cUrl', 'libf2c.a');
|
|
586
556
|
}
|
|
587
557
|
export function resolveFortranF2cHeaderUrl(options, currentUrl = '') {
|
|
588
|
-
return resolveFortranAssetUrl(options, currentUrl, 'f2cHeaderUrl', '
|
|
558
|
+
return resolveFortranAssetUrl(options, currentUrl, 'f2cHeaderUrl', 'f2c.h');
|
|
589
559
|
}
|
|
590
560
|
export function resolveFortranAnalyzerUrl(options, currentUrl = '') {
|
|
591
|
-
return resolveFortranAssetUrl(options, currentUrl, 'analyzerUrl', '
|
|
561
|
+
return resolveFortranAssetUrl(options, currentUrl, 'analyzerUrl', 'analyzer.js');
|
|
592
562
|
}
|
|
593
563
|
export function resolveFortranRuntimeAssetConfig(options, currentUrl = '') {
|
|
594
564
|
const configuredIntegrity = typeof options === 'object' ? options?.fortran?.integrity : undefined;
|
|
@@ -604,8 +574,7 @@ export function resolveFortranRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
604
574
|
};
|
|
605
575
|
}
|
|
606
576
|
export function resolveCobolBaseUrl(options, currentUrl = '') {
|
|
607
|
-
const configuredBaseUrl =
|
|
608
|
-
(publicEnv.PUBLIC_WASM_COBOL_BASE_URL || '').trim();
|
|
577
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.cobol?.baseUrl : undefined;
|
|
609
578
|
if (configuredBaseUrl) {
|
|
610
579
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
611
580
|
}
|
|
@@ -618,8 +587,7 @@ export function resolveCobolBaseUrl(options, currentUrl = '') {
|
|
|
618
587
|
return normalizeBaseUrl('/wasm-cobol/', currentUrl);
|
|
619
588
|
}
|
|
620
589
|
export function resolveVBaseUrl(options, currentUrl = '') {
|
|
621
|
-
const configuredBaseUrl =
|
|
622
|
-
(publicEnv.PUBLIC_WASM_V_BASE_URL || '').trim();
|
|
590
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.v?.baseUrl : undefined;
|
|
623
591
|
if (configuredBaseUrl) {
|
|
624
592
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
625
593
|
}
|
|
@@ -632,8 +600,7 @@ export function resolveVBaseUrl(options, currentUrl = '') {
|
|
|
632
600
|
return normalizeBaseUrl('/wasm-v/', currentUrl);
|
|
633
601
|
}
|
|
634
602
|
export function resolveObjectiveCBaseUrl(options, currentUrl = '') {
|
|
635
|
-
const configuredBaseUrl =
|
|
636
|
-
(publicEnv.PUBLIC_WASM_OBJECTIVEC_BASE_URL || '').trim();
|
|
603
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.objectivec?.baseUrl : undefined;
|
|
637
604
|
if (configuredBaseUrl) {
|
|
638
605
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
639
606
|
}
|
|
@@ -645,32 +612,30 @@ export function resolveObjectiveCBaseUrl(options, currentUrl = '') {
|
|
|
645
612
|
}
|
|
646
613
|
return normalizeBaseUrl('/wasm-objectivec/', currentUrl);
|
|
647
614
|
}
|
|
648
|
-
function resolveObjectiveCAssetUrl(options, currentUrl, configKey,
|
|
649
|
-
const
|
|
650
|
-
const configuredUrl = (typeof options === 'object' && options?.objectivec?.[configKey]) ||
|
|
651
|
-
(env[envKey] || '').trim();
|
|
615
|
+
function resolveObjectiveCAssetUrl(options, currentUrl, configKey, defaultAsset) {
|
|
616
|
+
const configuredUrl = typeof options === 'object' ? options?.objectivec?.[configKey] : undefined;
|
|
652
617
|
if (configuredUrl) {
|
|
653
618
|
return resolveConfiguredUrl(configuredUrl, currentUrl);
|
|
654
619
|
}
|
|
655
620
|
return resolveConfiguredUrl(new URL(defaultAsset, resolveObjectiveCBaseUrl(options, currentUrl)).href, currentUrl);
|
|
656
621
|
}
|
|
657
622
|
export function resolveObjectiveCLibobjcUrl(options, currentUrl = '') {
|
|
658
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'libobjcUrl', '
|
|
623
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'libobjcUrl', 'libobjc.a');
|
|
659
624
|
}
|
|
660
625
|
export function resolveObjectiveCHeadersUrl(options, currentUrl = '') {
|
|
661
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'headersUrl', '
|
|
626
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'headersUrl', 'headers.json');
|
|
662
627
|
}
|
|
663
628
|
export function resolveObjectiveCLibgnustepBaseUrl(options, currentUrl = '') {
|
|
664
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'libgnustepBaseUrl', '
|
|
629
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'libgnustepBaseUrl', 'libgnustep-base.a');
|
|
665
630
|
}
|
|
666
631
|
export function resolveObjectiveCLibgnustepBaseObjectUrl(options, currentUrl = '') {
|
|
667
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'libgnustepBaseObjectUrl', '
|
|
632
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'libgnustepBaseObjectUrl', 'libgnustep-base.o');
|
|
668
633
|
}
|
|
669
634
|
export function resolveObjectiveCFoundationHeadersUrl(options, currentUrl = '') {
|
|
670
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'foundationHeadersUrl', '
|
|
635
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'foundationHeadersUrl', 'foundation-headers.json');
|
|
671
636
|
}
|
|
672
637
|
export function resolveObjectiveCLibffiUrl(options, currentUrl = '') {
|
|
673
|
-
return resolveObjectiveCAssetUrl(options, currentUrl, 'libffiUrl', '
|
|
638
|
+
return resolveObjectiveCAssetUrl(options, currentUrl, 'libffiUrl', 'libffi.a');
|
|
674
639
|
}
|
|
675
640
|
export function resolveObjectiveCRuntimeAssetConfig(options, currentUrl = '') {
|
|
676
641
|
const configuredIntegrity = typeof options === 'object' ? options?.objectivec?.integrity : undefined;
|
|
@@ -712,8 +677,7 @@ export function resolveObjectiveCRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
712
677
|
};
|
|
713
678
|
}
|
|
714
679
|
export function resolveZigStdlibUrl(options, currentUrl = '') {
|
|
715
|
-
const configuredStdlibUrl =
|
|
716
|
-
(publicEnv.PUBLIC_WASM_ZIG_STDLIB_URL || '').trim();
|
|
680
|
+
const configuredStdlibUrl = typeof options === 'object' ? options?.zig?.stdlibUrl : undefined;
|
|
717
681
|
if (configuredStdlibUrl) {
|
|
718
682
|
return resolveConfiguredUrl(configuredStdlibUrl, currentUrl);
|
|
719
683
|
}
|
|
@@ -734,8 +698,7 @@ export function resolveZigRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
734
698
|
};
|
|
735
699
|
}
|
|
736
700
|
export function resolveLispModuleUrl(options, currentUrl = '') {
|
|
737
|
-
const configuredModuleUrl =
|
|
738
|
-
(publicEnv.PUBLIC_WASM_LISP_MODULE_URL || '').trim();
|
|
701
|
+
const configuredModuleUrl = typeof options === 'object' ? options?.lisp?.moduleUrl : undefined;
|
|
739
702
|
if (configuredModuleUrl) {
|
|
740
703
|
return resolveConfiguredUrl(configuredModuleUrl, currentUrl);
|
|
741
704
|
}
|
|
@@ -766,19 +729,15 @@ function deriveLispManifestUrl(moduleUrl, currentUrl) {
|
|
|
766
729
|
export function resolveLispRuntimeAssetConfig(options, currentUrl = '') {
|
|
767
730
|
const configured = typeof options === 'object' ? options?.lisp : undefined;
|
|
768
731
|
const configuredModuleUrl = configured?.moduleUrl;
|
|
769
|
-
const publicModuleUrl = (publicEnv.PUBLIC_WASM_LISP_MODULE_URL || '').trim();
|
|
770
732
|
const rootUrl = typeof options === 'string' ? options : options?.rootUrl;
|
|
771
733
|
const moduleUrl = configuredModuleUrl
|
|
772
734
|
? resolveConfiguredUrl(configuredModuleUrl, currentUrl)
|
|
773
|
-
:
|
|
774
|
-
? resolveConfiguredUrl(
|
|
775
|
-
:
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
const configuredFingerprint = configured?.manifestFingerprint?.trim() ||
|
|
780
|
-
(publicEnv.PUBLIC_WASM_LISP_MANIFEST_FINGERPRINT || '').trim();
|
|
781
|
-
const usesBundledRoot = !configuredModuleUrl && !publicModuleUrl && rootUrl !== undefined;
|
|
735
|
+
: rootUrl !== undefined
|
|
736
|
+
? resolveConfiguredUrl(`${normalizeRootUrl(rootUrl) || ''}/wasm-lisp/index.js`, currentUrl)
|
|
737
|
+
: '';
|
|
738
|
+
const configuredManifestUrl = configured?.manifestUrl;
|
|
739
|
+
const configuredFingerprint = configured?.manifestFingerprint?.trim();
|
|
740
|
+
const usesBundledRoot = !configuredModuleUrl && rootUrl !== undefined;
|
|
782
741
|
const manifestUrl = configuredManifestUrl
|
|
783
742
|
? resolveConfiguredUrl(configuredManifestUrl, currentUrl)
|
|
784
743
|
: deriveLispManifestUrl(moduleUrl, currentUrl);
|
|
@@ -844,11 +803,7 @@ export function resolveRubyRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
844
803
|
throw new RuntimeConfigurationError('Ruby splitStdlib must be a boolean', {
|
|
845
804
|
runtimeId: 'RUBY'
|
|
846
805
|
});
|
|
847
|
-
const
|
|
848
|
-
const publicWasmUrl = (publicEnv.PUBLIC_WASM_RUBY_WASM_URL || '').trim();
|
|
849
|
-
const usesCustomTrustBoundary = Boolean((configured && RUBY_RUNTIME_CONFIG_KEYS.some((key) => configured[key] !== undefined)) ||
|
|
850
|
-
publicModuleUrl ||
|
|
851
|
-
publicWasmUrl);
|
|
806
|
+
const usesCustomTrustBoundary = Boolean(configured && RUBY_RUNTIME_CONFIG_KEYS.some((key) => configured[key] !== undefined));
|
|
852
807
|
let preflightProfile;
|
|
853
808
|
try {
|
|
854
809
|
preflightProfile = snapshotRubyRuntimePreflightProfile(usesCustomTrustBoundary
|
|
@@ -906,8 +861,8 @@ export function resolveRubyRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
906
861
|
: `${url.pathname}${url.search}`;
|
|
907
862
|
};
|
|
908
863
|
const manifestUrl = resolvePinnedUrl(configured?.manifestUrl, RUBY_RUNTIME_MANIFEST_PATH, preflightProfile.manifestFingerprint);
|
|
909
|
-
const moduleUrl = resolvePinnedUrl(configured?.moduleUrl
|
|
910
|
-
const wasmUrl = resolvePinnedUrl(configured?.wasmUrl
|
|
864
|
+
const moduleUrl = resolvePinnedUrl(configured?.moduleUrl, RUBY_RUNTIME_MODULE_STORAGE_PATH, preflightProfile.moduleJavaScriptReceipt.sha256);
|
|
865
|
+
const wasmUrl = resolvePinnedUrl(configured?.wasmUrl, RUBY_RUNTIME_WASM_STORAGE_PATH, preflightProfile.wasmReceipt.sha256);
|
|
911
866
|
return {
|
|
912
867
|
...(configured?.splitStdlib === true ? { splitStdlib: true } : {}),
|
|
913
868
|
baseUrl,
|
|
@@ -929,8 +884,7 @@ export function resolveRubyWasmUrl(options, currentUrl = '') {
|
|
|
929
884
|
return resolveRubyRuntimeAssetConfig(options, currentUrl).wasmUrl;
|
|
930
885
|
}
|
|
931
886
|
export function resolveRBaseUrl(options, currentUrl = '') {
|
|
932
|
-
const configuredBaseUrl =
|
|
933
|
-
(publicEnv.PUBLIC_WASM_R_BASE_URL || '').trim();
|
|
887
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.r?.baseUrl : undefined;
|
|
934
888
|
if (configuredBaseUrl) {
|
|
935
889
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
936
890
|
}
|
|
@@ -943,8 +897,7 @@ export function resolveRBaseUrl(options, currentUrl = '') {
|
|
|
943
897
|
return '';
|
|
944
898
|
}
|
|
945
899
|
export function resolveOctaveBaseUrl(options, currentUrl = '') {
|
|
946
|
-
const configuredBaseUrl =
|
|
947
|
-
(publicEnv.PUBLIC_WASM_OCTAVE_BASE_URL || '').trim();
|
|
900
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.octave?.baseUrl : undefined;
|
|
948
901
|
if (configuredBaseUrl) {
|
|
949
902
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
950
903
|
}
|
|
@@ -957,8 +910,7 @@ export function resolveOctaveBaseUrl(options, currentUrl = '') {
|
|
|
957
910
|
return normalizeBaseUrl('/wasm-octave/runtime/', currentUrl);
|
|
958
911
|
}
|
|
959
912
|
export function resolveOctaveWorkerUrl(options, currentUrl = '') {
|
|
960
|
-
const configuredWorkerUrl =
|
|
961
|
-
(publicEnv.PUBLIC_WASM_OCTAVE_WORKER_URL || '').trim();
|
|
913
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.octave?.workerUrl : undefined;
|
|
962
914
|
if (configuredWorkerUrl) {
|
|
963
915
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
964
916
|
}
|
|
@@ -971,8 +923,7 @@ export function resolveOctaveWorkerUrl(options, currentUrl = '') {
|
|
|
971
923
|
return resolveConfiguredUrl('/wasm-octave/runner-worker.js', currentUrl);
|
|
972
924
|
}
|
|
973
925
|
export function resolveOctaveManifestUrl(options, currentUrl = '') {
|
|
974
|
-
const configuredManifestUrl =
|
|
975
|
-
(publicEnv.PUBLIC_WASM_OCTAVE_MANIFEST_URL || '').trim();
|
|
926
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.octave?.manifestUrl : undefined;
|
|
976
927
|
if (configuredManifestUrl) {
|
|
977
928
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
978
929
|
}
|
|
@@ -992,8 +943,7 @@ export function resolveOctaveRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
992
943
|
};
|
|
993
944
|
}
|
|
994
945
|
export function resolvePrologBaseUrl(options, currentUrl = '') {
|
|
995
|
-
const configuredBaseUrl =
|
|
996
|
-
(publicEnv.PUBLIC_WASM_PROLOG_BASE_URL || '').trim();
|
|
946
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.prolog?.baseUrl : undefined;
|
|
997
947
|
if (configuredBaseUrl) {
|
|
998
948
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
999
949
|
}
|
|
@@ -1006,8 +956,7 @@ export function resolvePrologBaseUrl(options, currentUrl = '') {
|
|
|
1006
956
|
return normalizeBaseUrl('/wasm-prolog/', currentUrl);
|
|
1007
957
|
}
|
|
1008
958
|
export function resolvePrologWorkerUrl(options, currentUrl = '') {
|
|
1009
|
-
const configuredWorkerUrl =
|
|
1010
|
-
(publicEnv.PUBLIC_WASM_PROLOG_WORKER_URL || '').trim();
|
|
959
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.prolog?.workerUrl : undefined;
|
|
1011
960
|
if (configuredWorkerUrl) {
|
|
1012
961
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1013
962
|
}
|
|
@@ -1068,8 +1017,7 @@ export function resolvePrologRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1068
1017
|
};
|
|
1069
1018
|
}
|
|
1070
1019
|
export function resolveGleamBaseUrl(options, currentUrl = '') {
|
|
1071
|
-
const configuredBaseUrl =
|
|
1072
|
-
(publicEnv.PUBLIC_WASM_GLEAM_BASE_URL || '').trim();
|
|
1020
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.gleam?.baseUrl : undefined;
|
|
1073
1021
|
if (configuredBaseUrl) {
|
|
1074
1022
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1075
1023
|
}
|
|
@@ -1082,8 +1030,7 @@ export function resolveGleamBaseUrl(options, currentUrl = '') {
|
|
|
1082
1030
|
return normalizeBaseUrl('/wasm-gleam/', currentUrl);
|
|
1083
1031
|
}
|
|
1084
1032
|
export function resolveGleamWorkerUrl(options, currentUrl = '') {
|
|
1085
|
-
const configuredWorkerUrl =
|
|
1086
|
-
(publicEnv.PUBLIC_WASM_GLEAM_WORKER_URL || '').trim();
|
|
1033
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.gleam?.workerUrl : undefined;
|
|
1087
1034
|
if (configuredWorkerUrl) {
|
|
1088
1035
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1089
1036
|
}
|
|
@@ -1096,8 +1043,7 @@ export function resolveGleamWorkerUrl(options, currentUrl = '') {
|
|
|
1096
1043
|
return resolveConfiguredUrl('/wasm-gleam/runner-worker.js', currentUrl);
|
|
1097
1044
|
}
|
|
1098
1045
|
export function resolveGleamManifestUrl(options, currentUrl = '') {
|
|
1099
|
-
const configuredManifestUrl =
|
|
1100
|
-
(publicEnv.PUBLIC_WASM_GLEAM_MANIFEST_URL || '').trim();
|
|
1046
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.gleam?.manifestUrl : undefined;
|
|
1101
1047
|
if (configuredManifestUrl) {
|
|
1102
1048
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
1103
1049
|
}
|
|
@@ -1111,38 +1057,18 @@ export function resolveGleamManifestUrl(options, currentUrl = '') {
|
|
|
1111
1057
|
}
|
|
1112
1058
|
export function resolveGleamRuntimeAssetConfig(options, currentUrl = '') {
|
|
1113
1059
|
const configured = typeof options === 'object' ? options?.gleam : undefined;
|
|
1114
|
-
const
|
|
1115
|
-
const envWorkerSha256 = (publicEnv.PUBLIC_WASM_GLEAM_WORKER_SHA256 || '').trim();
|
|
1116
|
-
const envWorkerBytesSource = (publicEnv.PUBLIC_WASM_GLEAM_WORKER_BYTES || '').trim();
|
|
1117
|
-
const envWorkerBytes = /^\d+$/u.test(envWorkerBytesSource)
|
|
1118
|
-
? Number(envWorkerBytesSource)
|
|
1119
|
-
: Number.NaN;
|
|
1120
|
-
const envWorkerReceipt = /^[a-f0-9]{64}$/u.test(envWorkerSha256) &&
|
|
1121
|
-
Number.isSafeInteger(envWorkerBytes) &&
|
|
1122
|
-
envWorkerBytes > 0
|
|
1123
|
-
? { bytes: envWorkerBytes, sha256: envWorkerSha256 }
|
|
1124
|
-
: undefined;
|
|
1125
|
-
const usesCustomUrls = Boolean(configured?.baseUrl ||
|
|
1126
|
-
configured?.workerUrl ||
|
|
1127
|
-
configured?.manifestUrl ||
|
|
1128
|
-
(publicEnv.PUBLIC_WASM_GLEAM_BASE_URL || '').trim() ||
|
|
1129
|
-
(publicEnv.PUBLIC_WASM_GLEAM_WORKER_URL || '').trim() ||
|
|
1130
|
-
(publicEnv.PUBLIC_WASM_GLEAM_MANIFEST_URL || '').trim());
|
|
1060
|
+
const usesCustomUrls = Boolean(configured?.baseUrl || configured?.workerUrl || configured?.manifestUrl);
|
|
1131
1061
|
return {
|
|
1132
1062
|
baseUrl: resolveGleamBaseUrl(options, currentUrl),
|
|
1133
1063
|
workerUrl: resolveGleamWorkerUrl(options, currentUrl),
|
|
1134
1064
|
manifestUrl: resolveGleamManifestUrl(options, currentUrl),
|
|
1135
1065
|
manifestFingerprint: configured?.manifestFingerprint?.trim() ||
|
|
1136
|
-
envManifestFingerprint ||
|
|
1137
1066
|
(!usesCustomUrls ? WASM_GLEAM_ASSET_VERSION : undefined),
|
|
1138
|
-
workerReceipt: configured?.workerReceipt ||
|
|
1139
|
-
envWorkerReceipt ||
|
|
1140
|
-
(!usesCustomUrls ? WASM_GLEAM_RUNNER_RECEIPT : undefined)
|
|
1067
|
+
workerReceipt: configured?.workerReceipt || (!usesCustomUrls ? WASM_GLEAM_RUNNER_RECEIPT : undefined)
|
|
1141
1068
|
};
|
|
1142
1069
|
}
|
|
1143
1070
|
export function resolvePerlBaseUrl(options, currentUrl = '') {
|
|
1144
|
-
const configuredBaseUrl =
|
|
1145
|
-
(publicEnv.PUBLIC_WASM_PERL_BASE_URL || '').trim();
|
|
1071
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.perl?.baseUrl : undefined;
|
|
1146
1072
|
if (configuredBaseUrl) {
|
|
1147
1073
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1148
1074
|
}
|
|
@@ -1155,8 +1081,7 @@ export function resolvePerlBaseUrl(options, currentUrl = '') {
|
|
|
1155
1081
|
return normalizeBaseUrl('/wasm-perl/', currentUrl);
|
|
1156
1082
|
}
|
|
1157
1083
|
export function resolvePerlWorkerUrl(options, currentUrl = '') {
|
|
1158
|
-
const configuredWorkerUrl =
|
|
1159
|
-
(publicEnv.PUBLIC_WASM_PERL_WORKER_URL || '').trim();
|
|
1084
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.perl?.workerUrl : undefined;
|
|
1160
1085
|
if (configuredWorkerUrl) {
|
|
1161
1086
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1162
1087
|
}
|
|
@@ -1169,20 +1094,14 @@ export function resolvePerlWorkerUrl(options, currentUrl = '') {
|
|
|
1169
1094
|
return resolveConfiguredUrl('/wasm-perl/runner-worker.js', currentUrl);
|
|
1170
1095
|
}
|
|
1171
1096
|
export function resolvePerlManifestUrl(options, currentUrl = '') {
|
|
1172
|
-
const configuredManifestUrl =
|
|
1173
|
-
(publicEnv.PUBLIC_WASM_PERL_MANIFEST_URL || '').trim();
|
|
1097
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.perl?.manifestUrl : undefined;
|
|
1174
1098
|
if (configuredManifestUrl)
|
|
1175
1099
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
1176
1100
|
return `${resolvePerlBaseUrl(options, currentUrl)}runtime-manifest.v2.json`;
|
|
1177
1101
|
}
|
|
1178
1102
|
export function resolvePerlRuntimeAssetConfig(options, currentUrl = '') {
|
|
1179
1103
|
const configured = typeof options === 'object' ? options?.perl : undefined;
|
|
1180
|
-
const usesCustomUrls = Boolean(configured?.baseUrl ||
|
|
1181
|
-
configured?.workerUrl ||
|
|
1182
|
-
configured?.manifestUrl ||
|
|
1183
|
-
(publicEnv.PUBLIC_WASM_PERL_BASE_URL || '').trim() ||
|
|
1184
|
-
(publicEnv.PUBLIC_WASM_PERL_WORKER_URL || '').trim() ||
|
|
1185
|
-
(publicEnv.PUBLIC_WASM_PERL_MANIFEST_URL || '').trim());
|
|
1104
|
+
const usesCustomUrls = Boolean(configured?.baseUrl || configured?.workerUrl || configured?.manifestUrl);
|
|
1186
1105
|
const hasConfiguredTrust = !!configured &&
|
|
1187
1106
|
[
|
|
1188
1107
|
configured.manifestFingerprint,
|
|
@@ -1230,8 +1149,7 @@ export function resolvePerlRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1230
1149
|
};
|
|
1231
1150
|
}
|
|
1232
1151
|
export function resolveTclBaseUrl(options, currentUrl = '') {
|
|
1233
|
-
const configuredBaseUrl =
|
|
1234
|
-
(publicEnv.PUBLIC_WASM_TCL_BASE_URL || '').trim();
|
|
1152
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.tcl?.baseUrl : undefined;
|
|
1235
1153
|
if (configuredBaseUrl) {
|
|
1236
1154
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1237
1155
|
}
|
|
@@ -1244,8 +1162,7 @@ export function resolveTclBaseUrl(options, currentUrl = '') {
|
|
|
1244
1162
|
return normalizeBaseUrl('/wasm-tcl/', currentUrl);
|
|
1245
1163
|
}
|
|
1246
1164
|
export function resolveTclWorkerUrl(options, currentUrl = '') {
|
|
1247
|
-
const configuredWorkerUrl =
|
|
1248
|
-
(publicEnv.PUBLIC_WASM_TCL_WORKER_URL || '').trim();
|
|
1165
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.tcl?.workerUrl : undefined;
|
|
1249
1166
|
if (configuredWorkerUrl) {
|
|
1250
1167
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1251
1168
|
}
|
|
@@ -1317,8 +1234,7 @@ export function resolveTclRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1317
1234
|
};
|
|
1318
1235
|
}
|
|
1319
1236
|
export function resolveAwkBaseUrl(options, currentUrl = '') {
|
|
1320
|
-
const configuredBaseUrl =
|
|
1321
|
-
(publicEnv.PUBLIC_WASM_AWK_BASE_URL || '').trim();
|
|
1237
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.awk?.baseUrl : undefined;
|
|
1322
1238
|
if (configuredBaseUrl) {
|
|
1323
1239
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1324
1240
|
}
|
|
@@ -1331,8 +1247,7 @@ export function resolveAwkBaseUrl(options, currentUrl = '') {
|
|
|
1331
1247
|
return normalizeBaseUrl('/wasm-awk/', currentUrl);
|
|
1332
1248
|
}
|
|
1333
1249
|
export function resolveAwkWorkerUrl(options, currentUrl = '') {
|
|
1334
|
-
const configuredWorkerUrl =
|
|
1335
|
-
(publicEnv.PUBLIC_WASM_AWK_WORKER_URL || '').trim();
|
|
1250
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.awk?.workerUrl : undefined;
|
|
1336
1251
|
if (configuredWorkerUrl) {
|
|
1337
1252
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1338
1253
|
}
|
|
@@ -1408,9 +1323,7 @@ export function resolveAwkRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1408
1323
|
preflightProfile = configuredProfile;
|
|
1409
1324
|
}
|
|
1410
1325
|
const baseUrl = resolveAwkBaseUrl(options, currentUrl);
|
|
1411
|
-
const workerUrl = resolveAwkPinnedAssetUrl(configured?.workerUrl ||
|
|
1412
|
-
(publicEnv.PUBLIC_WASM_AWK_WORKER_URL || '').trim() ||
|
|
1413
|
-
`${baseUrl}runner-worker.v2.js`, currentUrl, 'runner-worker.v2.js', preflightProfile.workerReceipt.sha256);
|
|
1326
|
+
const workerUrl = resolveAwkPinnedAssetUrl(configured?.workerUrl || `${baseUrl}runner-worker.v2.js`, currentUrl, 'runner-worker.v2.js', preflightProfile.workerReceipt.sha256);
|
|
1414
1327
|
const manifestUrl = resolveAwkPinnedAssetUrl(configured?.manifestUrl || `${baseUrl}runtime-manifest.v2.json`, currentUrl, 'runtime-manifest.v2.json', preflightProfile.manifestFingerprint);
|
|
1415
1328
|
const identity = { baseUrl, workerUrl, manifestUrl, profile: preflightProfile };
|
|
1416
1329
|
return {
|
|
@@ -1424,8 +1337,7 @@ export function resolveAwkRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1424
1337
|
};
|
|
1425
1338
|
}
|
|
1426
1339
|
export function resolvePascalBaseUrl(options, currentUrl = '') {
|
|
1427
|
-
const configuredBaseUrl =
|
|
1428
|
-
(publicEnv.PUBLIC_WASM_PASCAL_BASE_URL || '').trim();
|
|
1340
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.pascal?.baseUrl : undefined;
|
|
1429
1341
|
if (configuredBaseUrl) {
|
|
1430
1342
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1431
1343
|
}
|
|
@@ -1438,8 +1350,7 @@ export function resolvePascalBaseUrl(options, currentUrl = '') {
|
|
|
1438
1350
|
return normalizeBaseUrl('/wasm-pascal/', currentUrl);
|
|
1439
1351
|
}
|
|
1440
1352
|
export function resolvePascalWorkerUrl(options, currentUrl = '') {
|
|
1441
|
-
const configuredWorkerUrl =
|
|
1442
|
-
(publicEnv.PUBLIC_WASM_PASCAL_WORKER_URL || '').trim();
|
|
1353
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.pascal?.workerUrl : undefined;
|
|
1443
1354
|
if (configuredWorkerUrl) {
|
|
1444
1355
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1445
1356
|
}
|
|
@@ -1453,9 +1364,7 @@ export function resolvePascalWorkerUrl(options, currentUrl = '') {
|
|
|
1453
1364
|
}
|
|
1454
1365
|
export function resolvePascalRuntimeAssetConfig(options, currentUrl = '') {
|
|
1455
1366
|
const configured = typeof options === 'object' ? options?.pascal : undefined;
|
|
1456
|
-
const usesCustomTrustBoundary = Boolean(
|
|
1457
|
-
(publicEnv.PUBLIC_WASM_PASCAL_BASE_URL || '').trim() ||
|
|
1458
|
-
(publicEnv.PUBLIC_WASM_PASCAL_WORKER_URL || '').trim());
|
|
1367
|
+
const usesCustomTrustBoundary = Boolean(configured && Object.values(configured).some((value) => value !== undefined));
|
|
1459
1368
|
let preflightProfile;
|
|
1460
1369
|
try {
|
|
1461
1370
|
preflightProfile = snapshotPascalRuntimePreflightProfile(usesCustomTrustBoundary
|
|
@@ -1517,9 +1426,7 @@ export function resolvePascalRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1517
1426
|
? url.href
|
|
1518
1427
|
: `${url.pathname}${url.search}`;
|
|
1519
1428
|
};
|
|
1520
|
-
const workerUrl = resolvePinnedUrl(configured?.workerUrl ||
|
|
1521
|
-
(publicEnv.PUBLIC_WASM_PASCAL_WORKER_URL || '').trim() ||
|
|
1522
|
-
resolvePascalWorkerUrl(options, currentUrl), 'runner-worker.js', workerReceipt.sha256);
|
|
1429
|
+
const workerUrl = resolvePinnedUrl(configured?.workerUrl || resolvePascalWorkerUrl(options, currentUrl), 'runner-worker.js', workerReceipt.sha256);
|
|
1523
1430
|
const manifestUrl = resolvePinnedUrl(configured?.manifestUrl, 'runtime-manifest.v2.json', preflightProfile.manifestFingerprint);
|
|
1524
1431
|
const compilerJavaScriptUrl = resolvePinnedUrl(configured?.compilerJavaScriptUrl, 'compiler.js.gz.bin', preflightProfile.compilerJavaScriptReceipt.sha256);
|
|
1525
1432
|
const rtlJavaScriptUrl = resolvePinnedUrl(configured?.rtlJavaScriptUrl, 'rtl.js.bin', preflightProfile.rtlJavaScriptReceipt.sha256);
|
|
@@ -1548,8 +1455,7 @@ export function resolvePascalRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1548
1455
|
};
|
|
1549
1456
|
}
|
|
1550
1457
|
export function resolveClojureScriptBaseUrl(options, currentUrl = '') {
|
|
1551
|
-
const configuredBaseUrl =
|
|
1552
|
-
(publicEnv.PUBLIC_WASM_CLOJURESCRIPT_BASE_URL || '').trim();
|
|
1458
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.clojurescript?.baseUrl : undefined;
|
|
1553
1459
|
if (configuredBaseUrl)
|
|
1554
1460
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1555
1461
|
if (typeof options === 'string') {
|
|
@@ -1561,8 +1467,7 @@ export function resolveClojureScriptBaseUrl(options, currentUrl = '') {
|
|
|
1561
1467
|
return normalizeBaseUrl('/wasm-clojurescript/', currentUrl);
|
|
1562
1468
|
}
|
|
1563
1469
|
export function resolveClojureScriptWorkerUrl(options, currentUrl = '') {
|
|
1564
|
-
const configuredWorkerUrl =
|
|
1565
|
-
(publicEnv.PUBLIC_WASM_CLOJURESCRIPT_WORKER_URL || '').trim();
|
|
1470
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.clojurescript?.workerUrl : undefined;
|
|
1566
1471
|
if (configuredWorkerUrl)
|
|
1567
1472
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1568
1473
|
if (typeof options === 'string') {
|
|
@@ -1621,8 +1526,7 @@ export function resolveClojureScriptRuntimeAssetConfig(options, currentUrl = '')
|
|
|
1621
1526
|
};
|
|
1622
1527
|
}
|
|
1623
1528
|
export function resolveReScriptBaseUrl(options, currentUrl = '') {
|
|
1624
|
-
const configuredBaseUrl =
|
|
1625
|
-
(publicEnv.PUBLIC_WASM_RESCRIPT_BASE_URL || '').trim();
|
|
1529
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.rescript?.baseUrl : undefined;
|
|
1626
1530
|
if (configuredBaseUrl)
|
|
1627
1531
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1628
1532
|
if (typeof options === 'string') {
|
|
@@ -1634,8 +1538,7 @@ export function resolveReScriptBaseUrl(options, currentUrl = '') {
|
|
|
1634
1538
|
return normalizeBaseUrl('/wasm-rescript/', currentUrl);
|
|
1635
1539
|
}
|
|
1636
1540
|
export function resolveReScriptWorkerUrl(options, currentUrl = '') {
|
|
1637
|
-
const configuredWorkerUrl =
|
|
1638
|
-
(publicEnv.PUBLIC_WASM_RESCRIPT_WORKER_URL || '').trim();
|
|
1541
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.rescript?.workerUrl : undefined;
|
|
1639
1542
|
if (configuredWorkerUrl)
|
|
1640
1543
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1641
1544
|
if (typeof options === 'string') {
|
|
@@ -1692,8 +1595,7 @@ export function resolveReScriptRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1692
1595
|
};
|
|
1693
1596
|
}
|
|
1694
1597
|
export function resolveForthBaseUrl(options, currentUrl = '') {
|
|
1695
|
-
const configuredBaseUrl =
|
|
1696
|
-
(publicEnv.PUBLIC_WASM_FORTH_BASE_URL || '').trim();
|
|
1598
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.forth?.baseUrl : undefined;
|
|
1697
1599
|
if (configuredBaseUrl) {
|
|
1698
1600
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1699
1601
|
}
|
|
@@ -1706,8 +1608,7 @@ export function resolveForthBaseUrl(options, currentUrl = '') {
|
|
|
1706
1608
|
return normalizeBaseUrl('/wasm-forth/', currentUrl);
|
|
1707
1609
|
}
|
|
1708
1610
|
export function resolveForthWorkerUrl(options, currentUrl = '') {
|
|
1709
|
-
const configuredWorkerUrl =
|
|
1710
|
-
(publicEnv.PUBLIC_WASM_FORTH_WORKER_URL || '').trim();
|
|
1611
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.forth?.workerUrl : undefined;
|
|
1711
1612
|
if (configuredWorkerUrl) {
|
|
1712
1613
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1713
1614
|
}
|
|
@@ -1752,8 +1653,7 @@ export function resolveForthRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1752
1653
|
};
|
|
1753
1654
|
}
|
|
1754
1655
|
export function resolveJBaseUrl(options, currentUrl = '') {
|
|
1755
|
-
const configuredBaseUrl =
|
|
1756
|
-
(publicEnv.PUBLIC_WASM_J_BASE_URL || '').trim();
|
|
1656
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.j?.baseUrl : undefined;
|
|
1757
1657
|
if (configuredBaseUrl) {
|
|
1758
1658
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1759
1659
|
}
|
|
@@ -1766,8 +1666,7 @@ export function resolveJBaseUrl(options, currentUrl = '') {
|
|
|
1766
1666
|
return normalizeBaseUrl('/wasm-j/', currentUrl);
|
|
1767
1667
|
}
|
|
1768
1668
|
export function resolveJWorkerUrl(options, currentUrl = '') {
|
|
1769
|
-
const configuredWorkerUrl =
|
|
1770
|
-
(publicEnv.PUBLIC_WASM_J_WORKER_URL || '').trim();
|
|
1669
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.j?.workerUrl : undefined;
|
|
1771
1670
|
if (configuredWorkerUrl) {
|
|
1772
1671
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1773
1672
|
}
|
|
@@ -1826,8 +1725,7 @@ export function resolveJRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1826
1725
|
};
|
|
1827
1726
|
}
|
|
1828
1727
|
export function resolveBqnBaseUrl(options, currentUrl = '') {
|
|
1829
|
-
const configuredBaseUrl =
|
|
1830
|
-
(publicEnv.PUBLIC_WASM_BQN_BASE_URL || '').trim();
|
|
1728
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.bqn?.baseUrl : undefined;
|
|
1831
1729
|
if (configuredBaseUrl) {
|
|
1832
1730
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1833
1731
|
}
|
|
@@ -1840,8 +1738,7 @@ export function resolveBqnBaseUrl(options, currentUrl = '') {
|
|
|
1840
1738
|
return normalizeBaseUrl('/wasm-bqn/', currentUrl);
|
|
1841
1739
|
}
|
|
1842
1740
|
export function resolveBqnWorkerUrl(options, currentUrl = '') {
|
|
1843
|
-
const configuredWorkerUrl =
|
|
1844
|
-
(publicEnv.PUBLIC_WASM_BQN_WORKER_URL || '').trim();
|
|
1741
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.bqn?.workerUrl : undefined;
|
|
1845
1742
|
if (configuredWorkerUrl) {
|
|
1846
1743
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1847
1744
|
}
|
|
@@ -1900,8 +1797,7 @@ export function resolveBqnRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1900
1797
|
};
|
|
1901
1798
|
}
|
|
1902
1799
|
export function resolveJanetBaseUrl(options, currentUrl = '') {
|
|
1903
|
-
const configuredBaseUrl =
|
|
1904
|
-
(publicEnv.PUBLIC_WASM_JANET_BASE_URL || '').trim();
|
|
1800
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.janet?.baseUrl : undefined;
|
|
1905
1801
|
if (configuredBaseUrl) {
|
|
1906
1802
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1907
1803
|
}
|
|
@@ -1914,8 +1810,7 @@ export function resolveJanetBaseUrl(options, currentUrl = '') {
|
|
|
1914
1810
|
return normalizeBaseUrl('/wasm-janet/', currentUrl);
|
|
1915
1811
|
}
|
|
1916
1812
|
export function resolveJanetWorkerUrl(options, currentUrl = '') {
|
|
1917
|
-
const configuredWorkerUrl =
|
|
1918
|
-
(publicEnv.PUBLIC_WASM_JANET_WORKER_URL || '').trim();
|
|
1813
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.janet?.workerUrl : undefined;
|
|
1919
1814
|
if (configuredWorkerUrl) {
|
|
1920
1815
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
1921
1816
|
}
|
|
@@ -1928,23 +1823,14 @@ export function resolveJanetWorkerUrl(options, currentUrl = '') {
|
|
|
1928
1823
|
return resolveConfiguredUrl('/wasm-janet/runner-worker.js', currentUrl);
|
|
1929
1824
|
}
|
|
1930
1825
|
export function resolveJanetManifestUrl(options, currentUrl = '') {
|
|
1931
|
-
const configuredManifestUrl =
|
|
1932
|
-
(publicEnv.PUBLIC_WASM_JANET_MANIFEST_URL || '').trim();
|
|
1826
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.janet?.manifestUrl : undefined;
|
|
1933
1827
|
if (configuredManifestUrl)
|
|
1934
1828
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
1935
1829
|
return `${resolveJanetBaseUrl(options, currentUrl)}runtime-manifest.v2.json`;
|
|
1936
1830
|
}
|
|
1937
1831
|
export function resolveJanetRuntimeAssetConfig(options, currentUrl = '') {
|
|
1938
1832
|
const configured = typeof options === 'object' ? options?.janet : undefined;
|
|
1939
|
-
const
|
|
1940
|
-
const envWorkerSha256 = (publicEnv.PUBLIC_WASM_JANET_WORKER_SHA256 || '').trim();
|
|
1941
|
-
const envWorkerBytesSource = (publicEnv.PUBLIC_WASM_JANET_WORKER_BYTES || '').trim();
|
|
1942
|
-
const usesCustomUrls = Boolean(configured?.baseUrl ||
|
|
1943
|
-
configured?.workerUrl ||
|
|
1944
|
-
configured?.manifestUrl ||
|
|
1945
|
-
(publicEnv.PUBLIC_WASM_JANET_BASE_URL || '').trim() ||
|
|
1946
|
-
(publicEnv.PUBLIC_WASM_JANET_WORKER_URL || '').trim() ||
|
|
1947
|
-
(publicEnv.PUBLIC_WASM_JANET_MANIFEST_URL || '').trim());
|
|
1833
|
+
const usesCustomUrls = Boolean(configured?.baseUrl || configured?.workerUrl || configured?.manifestUrl);
|
|
1948
1834
|
const hasConfiguredTrust = !!configured &&
|
|
1949
1835
|
[
|
|
1950
1836
|
configured.manifestFingerprint,
|
|
@@ -1957,9 +1843,7 @@ export function resolveJanetRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1957
1843
|
configured.wasmReceipt,
|
|
1958
1844
|
configured.workerReceipt
|
|
1959
1845
|
].some((value) => value !== undefined);
|
|
1960
|
-
const usesCustomTrustBoundary = usesCustomUrls ||
|
|
1961
|
-
hasConfiguredTrust ||
|
|
1962
|
-
Boolean(envManifestFingerprint || envWorkerSha256 || envWorkerBytesSource);
|
|
1846
|
+
const usesCustomTrustBoundary = usesCustomUrls || hasConfiguredTrust;
|
|
1963
1847
|
const selectedProfile = usesCustomTrustBoundary
|
|
1964
1848
|
? {
|
|
1965
1849
|
profileId: configured?.profileId?.trim(),
|
|
@@ -1990,8 +1874,7 @@ export function resolveJanetRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
1990
1874
|
};
|
|
1991
1875
|
}
|
|
1992
1876
|
export function resolveJuliaBaseUrl(options, currentUrl = '') {
|
|
1993
|
-
const configuredBaseUrl =
|
|
1994
|
-
(publicEnv.PUBLIC_WASM_JULIA_BASE_URL || '').trim();
|
|
1877
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.julia?.baseUrl : undefined;
|
|
1995
1878
|
if (configuredBaseUrl) {
|
|
1996
1879
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
1997
1880
|
}
|
|
@@ -2004,8 +1887,7 @@ export function resolveJuliaBaseUrl(options, currentUrl = '') {
|
|
|
2004
1887
|
return normalizeBaseUrl('/wasm-julia/', currentUrl);
|
|
2005
1888
|
}
|
|
2006
1889
|
export function resolveJuliaWorkerUrl(options, currentUrl = '') {
|
|
2007
|
-
const configuredWorkerUrl =
|
|
2008
|
-
(publicEnv.PUBLIC_WASM_JULIA_WORKER_URL || '').trim();
|
|
1890
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.julia?.workerUrl : undefined;
|
|
2009
1891
|
if (configuredWorkerUrl) {
|
|
2010
1892
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
2011
1893
|
}
|
|
@@ -2019,15 +1901,7 @@ export function resolveJuliaWorkerUrl(options, currentUrl = '') {
|
|
|
2019
1901
|
}
|
|
2020
1902
|
export function resolveJuliaRuntimeAssetConfig(options, currentUrl = '') {
|
|
2021
1903
|
const configured = typeof options === 'object' ? options?.julia : undefined;
|
|
2022
|
-
const
|
|
2023
|
-
const envWorkerSha256 = (publicEnv.PUBLIC_WASM_JULIA_WORKER_SHA256 || '').trim();
|
|
2024
|
-
const envWorkerBytesSource = (publicEnv.PUBLIC_WASM_JULIA_WORKER_BYTES || '').trim();
|
|
2025
|
-
const usesCustomUrls = Boolean(configured?.baseUrl ||
|
|
2026
|
-
configured?.workerUrl ||
|
|
2027
|
-
configured?.manifestUrl ||
|
|
2028
|
-
(publicEnv.PUBLIC_WASM_JULIA_BASE_URL || '').trim() ||
|
|
2029
|
-
(publicEnv.PUBLIC_WASM_JULIA_WORKER_URL || '').trim() ||
|
|
2030
|
-
(publicEnv.PUBLIC_WASM_JULIA_MANIFEST_URL || '').trim());
|
|
1904
|
+
const usesCustomUrls = Boolean(configured?.baseUrl || configured?.workerUrl || configured?.manifestUrl);
|
|
2031
1905
|
const hasConfiguredTrust = !!configured &&
|
|
2032
1906
|
[
|
|
2033
1907
|
configured.manifestFingerprint,
|
|
@@ -2042,9 +1916,7 @@ export function resolveJuliaRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2042
1916
|
configured.dataReceipt,
|
|
2043
1917
|
configured.workerReceipt
|
|
2044
1918
|
].some((value) => value !== undefined);
|
|
2045
|
-
const usesCustomTrustBoundary = usesCustomUrls ||
|
|
2046
|
-
hasConfiguredTrust ||
|
|
2047
|
-
Boolean(envManifestFingerprint || envWorkerSha256 || envWorkerBytesSource);
|
|
1919
|
+
const usesCustomTrustBoundary = usesCustomUrls || hasConfiguredTrust;
|
|
2048
1920
|
const selectedProfile = usesCustomTrustBoundary
|
|
2049
1921
|
? {
|
|
2050
1922
|
profileId: configured?.profileId?.trim(),
|
|
@@ -2077,15 +1949,13 @@ export function resolveJuliaRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2077
1949
|
};
|
|
2078
1950
|
}
|
|
2079
1951
|
export function resolveJuliaManifestUrl(options, currentUrl = '') {
|
|
2080
|
-
const configuredManifestUrl =
|
|
2081
|
-
(publicEnv.PUBLIC_WASM_JULIA_MANIFEST_URL || '').trim();
|
|
1952
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.julia?.manifestUrl : undefined;
|
|
2082
1953
|
if (configuredManifestUrl)
|
|
2083
1954
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
2084
1955
|
return `${resolveJuliaBaseUrl(options, currentUrl)}runtime-manifest.v2.json`;
|
|
2085
1956
|
}
|
|
2086
1957
|
export function resolveNimBaseUrl(options, currentUrl = '') {
|
|
2087
|
-
const configuredBaseUrl =
|
|
2088
|
-
(publicEnv.PUBLIC_WASM_NIM_BASE_URL || '').trim();
|
|
1958
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.nim?.baseUrl : undefined;
|
|
2089
1959
|
if (configuredBaseUrl) {
|
|
2090
1960
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
2091
1961
|
}
|
|
@@ -2098,8 +1968,7 @@ export function resolveNimBaseUrl(options, currentUrl = '') {
|
|
|
2098
1968
|
return normalizeBaseUrl('/wasm-nim/', currentUrl);
|
|
2099
1969
|
}
|
|
2100
1970
|
export function resolveNimWorkerUrl(options, currentUrl = '') {
|
|
2101
|
-
const configuredWorkerUrl =
|
|
2102
|
-
(publicEnv.PUBLIC_WASM_NIM_WORKER_URL || '').trim();
|
|
1971
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.nim?.workerUrl : undefined;
|
|
2103
1972
|
if (configuredWorkerUrl) {
|
|
2104
1973
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
2105
1974
|
}
|
|
@@ -2113,23 +1982,7 @@ export function resolveNimWorkerUrl(options, currentUrl = '') {
|
|
|
2113
1982
|
}
|
|
2114
1983
|
export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
2115
1984
|
const configured = typeof options === 'object' ? options?.nim : undefined;
|
|
2116
|
-
const
|
|
2117
|
-
const envWorkerSha256 = (publicEnv.PUBLIC_WASM_NIM_WORKER_SHA256 || '').trim();
|
|
2118
|
-
const envWorkerBytesSource = (publicEnv.PUBLIC_WASM_NIM_WORKER_BYTES || '').trim();
|
|
2119
|
-
const envWorkerBytes = /^\d+$/u.test(envWorkerBytesSource)
|
|
2120
|
-
? Number(envWorkerBytesSource)
|
|
2121
|
-
: Number.NaN;
|
|
2122
|
-
const envWorkerReceipt = /^[a-f0-9]{64}$/u.test(envWorkerSha256) &&
|
|
2123
|
-
Number.isSafeInteger(envWorkerBytes) &&
|
|
2124
|
-
envWorkerBytes > 0
|
|
2125
|
-
? { bytes: envWorkerBytes, sha256: envWorkerSha256 }
|
|
2126
|
-
: undefined;
|
|
2127
|
-
const usesCustomUrls = Boolean(configured?.baseUrl ||
|
|
2128
|
-
configured?.workerUrl ||
|
|
2129
|
-
configured?.manifestUrl ||
|
|
2130
|
-
(publicEnv.PUBLIC_WASM_NIM_BASE_URL || '').trim() ||
|
|
2131
|
-
(publicEnv.PUBLIC_WASM_NIM_WORKER_URL || '').trim() ||
|
|
2132
|
-
(publicEnv.PUBLIC_WASM_NIM_MANIFEST_URL || '').trim());
|
|
1985
|
+
const usesCustomUrls = Boolean(configured?.baseUrl || configured?.workerUrl || configured?.manifestUrl);
|
|
2133
1986
|
const hasConfiguredTrust = !!configured &&
|
|
2134
1987
|
[
|
|
2135
1988
|
configured.manifestFingerprint,
|
|
@@ -2150,9 +2003,7 @@ export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2150
2003
|
configured.sysrootReceipt,
|
|
2151
2004
|
configured.workerReceipt
|
|
2152
2005
|
].some((value) => value !== undefined);
|
|
2153
|
-
const usesCustomTrustBoundary = usesCustomUrls ||
|
|
2154
|
-
hasConfiguredTrust ||
|
|
2155
|
-
Boolean(envManifestFingerprint || envWorkerSha256 || envWorkerBytesSource);
|
|
2006
|
+
const usesCustomTrustBoundary = usesCustomUrls || hasConfiguredTrust;
|
|
2156
2007
|
const selectedProfile = usesCustomTrustBoundary
|
|
2157
2008
|
? {
|
|
2158
2009
|
profileId: configured?.profileId?.trim(),
|
|
@@ -2161,7 +2012,7 @@ export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2161
2012
|
llvmRevision: configured?.llvmRevision?.trim(),
|
|
2162
2013
|
memfsRevision: configured?.memfsRevision?.trim(),
|
|
2163
2014
|
emscriptenRevision: configured?.emscriptenRevision?.trim(),
|
|
2164
|
-
manifestFingerprint: configured?.manifestFingerprint?.trim()
|
|
2015
|
+
manifestFingerprint: configured?.manifestFingerprint?.trim(),
|
|
2165
2016
|
manifestReceipt: configured?.manifestReceipt,
|
|
2166
2017
|
nimJavaScriptReceipt: configured?.nimJavaScriptReceipt,
|
|
2167
2018
|
nimWasmReceipt: configured?.nimWasmReceipt,
|
|
@@ -2175,7 +2026,7 @@ export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2175
2026
|
: WASM_NIM_RUNTIME_BUNDLE.profile;
|
|
2176
2027
|
const preflightProfile = snapshotNimRuntimePreflightProfile(selectedProfile);
|
|
2177
2028
|
const workerReceipt = usesCustomTrustBoundary
|
|
2178
|
-
? configured?.workerReceipt
|
|
2029
|
+
? configured?.workerReceipt
|
|
2179
2030
|
: WASM_NIM_RUNTIME_BUNDLE.workerReceipt;
|
|
2180
2031
|
if (!workerReceipt ||
|
|
2181
2032
|
!Number.isSafeInteger(workerReceipt.bytes) ||
|
|
@@ -2183,7 +2034,7 @@ export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2183
2034
|
!/^[a-f0-9]{64}$/u.test(workerReceipt.sha256)) {
|
|
2184
2035
|
throw new RuntimeConfigurationError('Nim runtime requires one complete profile and runner receipt bundle.', { runtimeId: 'NIM' });
|
|
2185
2036
|
}
|
|
2186
|
-
const hasConfiguredManifestUrl = Boolean(configured?.manifestUrl
|
|
2037
|
+
const hasConfiguredManifestUrl = Boolean(configured?.manifestUrl);
|
|
2187
2038
|
const baseUrl = resolveNimBaseUrl(options, currentUrl);
|
|
2188
2039
|
const resolvedManifestUrl = resolveNimManifestUrl(options, currentUrl);
|
|
2189
2040
|
const manifestUrl = hasConfiguredManifestUrl
|
|
@@ -2211,8 +2062,7 @@ export function resolveNimRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2211
2062
|
};
|
|
2212
2063
|
}
|
|
2213
2064
|
export function resolveNimManifestUrl(options, currentUrl = '') {
|
|
2214
|
-
const configuredManifestUrl =
|
|
2215
|
-
(publicEnv.PUBLIC_WASM_NIM_MANIFEST_URL || '').trim();
|
|
2065
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.nim?.manifestUrl : undefined;
|
|
2216
2066
|
if (configuredManifestUrl)
|
|
2217
2067
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
2218
2068
|
return `${resolveNimBaseUrl(options, currentUrl)}runtime-manifest.v2.json`;
|
|
@@ -2288,8 +2138,7 @@ export function resolveBashRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2288
2138
|
};
|
|
2289
2139
|
}
|
|
2290
2140
|
export function resolveSwiftBaseUrl(options, currentUrl = '') {
|
|
2291
|
-
const configuredBaseUrl =
|
|
2292
|
-
(publicEnv.PUBLIC_WASM_SWIFT_BASE_URL || '').trim();
|
|
2141
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.swift?.baseUrl : undefined;
|
|
2293
2142
|
if (configuredBaseUrl) {
|
|
2294
2143
|
return normalizeBaseUrl(configuredBaseUrl, currentUrl);
|
|
2295
2144
|
}
|
|
@@ -2302,13 +2151,11 @@ export function resolveSwiftBaseUrl(options, currentUrl = '') {
|
|
|
2302
2151
|
return normalizeBaseUrl('/wasm-swift/', currentUrl);
|
|
2303
2152
|
}
|
|
2304
2153
|
export function resolveSwiftWorkerUrl(options, currentUrl = '') {
|
|
2305
|
-
const configuredWorkerUrl =
|
|
2306
|
-
(publicEnv.PUBLIC_WASM_SWIFT_WORKER_URL || '').trim();
|
|
2154
|
+
const configuredWorkerUrl = typeof options === 'object' ? options?.swift?.workerUrl : undefined;
|
|
2307
2155
|
if (configuredWorkerUrl) {
|
|
2308
2156
|
return resolveConfiguredUrl(configuredWorkerUrl, currentUrl);
|
|
2309
2157
|
}
|
|
2310
|
-
const configuredBaseUrl =
|
|
2311
|
-
(publicEnv.PUBLIC_WASM_SWIFT_BASE_URL || '').trim();
|
|
2158
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.swift?.baseUrl : undefined;
|
|
2312
2159
|
if (configuredBaseUrl) {
|
|
2313
2160
|
return resolveConfiguredUrl(`${normalizeBaseUrl(configuredBaseUrl, currentUrl)}runner-worker.js`, currentUrl);
|
|
2314
2161
|
}
|
|
@@ -2321,13 +2168,11 @@ export function resolveSwiftWorkerUrl(options, currentUrl = '') {
|
|
|
2321
2168
|
return resolveConfiguredUrl('/wasm-swift/runner-worker.js', currentUrl);
|
|
2322
2169
|
}
|
|
2323
2170
|
export function resolveSwiftManifestUrl(options, currentUrl = '') {
|
|
2324
|
-
const configuredManifestUrl =
|
|
2325
|
-
(publicEnv.PUBLIC_WASM_SWIFT_MANIFEST_URL || '').trim();
|
|
2171
|
+
const configuredManifestUrl = typeof options === 'object' ? options?.swift?.manifestUrl : undefined;
|
|
2326
2172
|
if (configuredManifestUrl) {
|
|
2327
2173
|
return resolveConfiguredUrl(configuredManifestUrl, currentUrl);
|
|
2328
2174
|
}
|
|
2329
|
-
const configuredBaseUrl =
|
|
2330
|
-
(publicEnv.PUBLIC_WASM_SWIFT_BASE_URL || '').trim();
|
|
2175
|
+
const configuredBaseUrl = typeof options === 'object' ? options?.swift?.baseUrl : undefined;
|
|
2331
2176
|
if (configuredBaseUrl) {
|
|
2332
2177
|
return resolveConfiguredUrl(`${normalizeBaseUrl(configuredBaseUrl, currentUrl)}runtime-manifest.v1.json`, currentUrl);
|
|
2333
2178
|
}
|
|
@@ -2347,42 +2192,40 @@ export function resolveSwiftRuntimeAssetConfig(options, currentUrl = '') {
|
|
|
2347
2192
|
};
|
|
2348
2193
|
}
|
|
2349
2194
|
export function resolveSqliteWasmUrl(options, currentUrl = '') {
|
|
2350
|
-
const configuredWasmUrl =
|
|
2351
|
-
(publicEnv.PUBLIC_WASM_SQLITE_WASM_URL || '').trim();
|
|
2195
|
+
const configuredWasmUrl = typeof options === 'object' ? options?.sqlite?.wasmUrl : undefined;
|
|
2352
2196
|
if (configuredWasmUrl) {
|
|
2353
2197
|
return resolveConfiguredUrl(configuredWasmUrl, currentUrl);
|
|
2354
2198
|
}
|
|
2355
2199
|
return '';
|
|
2356
2200
|
}
|
|
2357
|
-
function resolveStaticRuntimeModuleUrl(options, configuredModuleUrl,
|
|
2358
|
-
const moduleUrl = configuredModuleUrl
|
|
2201
|
+
function resolveStaticRuntimeModuleUrl(options, configuredModuleUrl, folder, currentUrl = '') {
|
|
2202
|
+
const moduleUrl = configuredModuleUrl;
|
|
2359
2203
|
if (moduleUrl)
|
|
2360
2204
|
return resolveConfiguredUrl(moduleUrl, currentUrl);
|
|
2361
2205
|
const rootUrl = typeof options === 'string' ? options : options?.rootUrl || '';
|
|
2362
2206
|
return resolveConfiguredUrl(`${normalizeRootUrl(rootUrl) || ''}/${folder}/runtime.mjs`, currentUrl);
|
|
2363
2207
|
}
|
|
2364
2208
|
export function resolveAssemblyScriptRuntimeModuleUrl(options, currentUrl = '') {
|
|
2365
|
-
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.assemblyscript?.moduleUrl : undefined,
|
|
2209
|
+
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.assemblyscript?.moduleUrl : undefined, 'wasm-assemblyscript', currentUrl);
|
|
2366
2210
|
}
|
|
2367
2211
|
export function resolveDuckDbRuntimeModuleUrl(options, currentUrl = '') {
|
|
2368
|
-
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.duckdb?.moduleUrl : undefined,
|
|
2212
|
+
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.duckdb?.moduleUrl : undefined, 'wasm-duckdb', currentUrl);
|
|
2369
2213
|
}
|
|
2370
2214
|
export function resolvePhpRuntimeModuleUrl(options, currentUrl = '') {
|
|
2371
|
-
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.php?.moduleUrl : undefined,
|
|
2215
|
+
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.php?.moduleUrl : undefined, 'wasm-php', currentUrl);
|
|
2372
2216
|
}
|
|
2373
2217
|
export function resolvePostgresqlRuntimeModuleUrl(options, currentUrl = '') {
|
|
2374
|
-
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.postgresql?.moduleUrl : undefined,
|
|
2218
|
+
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.postgresql?.moduleUrl : undefined, 'wasm-postgresql', currentUrl);
|
|
2375
2219
|
}
|
|
2376
2220
|
export function resolveRubyRuntimeModuleUrl(options, currentUrl = '') {
|
|
2377
2221
|
return resolveRubyRuntimeAssetConfig(options, currentUrl).moduleUrl;
|
|
2378
2222
|
}
|
|
2379
2223
|
export function resolveSqliteRuntimeModuleUrl(options, currentUrl = '') {
|
|
2380
|
-
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.sqlite?.moduleUrl : undefined,
|
|
2224
|
+
return resolveStaticRuntimeModuleUrl(options, typeof options === 'object' ? options?.sqlite?.moduleUrl : undefined, 'wasm-sqlite', currentUrl);
|
|
2381
2225
|
}
|
|
2382
2226
|
/** C3 uses one code-pinned compiler/worker receipt, served from this base URL. */
|
|
2383
2227
|
export function resolveC3BaseUrl(options, currentUrl = '') {
|
|
2384
|
-
const configured =
|
|
2385
|
-
(publicEnv.PUBLIC_WASM_C3_BASE_URL || '').trim();
|
|
2228
|
+
const configured = typeof options === 'object' ? options?.c3?.baseUrl : undefined;
|
|
2386
2229
|
if (configured)
|
|
2387
2230
|
return normalizeBaseUrl(configured, currentUrl);
|
|
2388
2231
|
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
@@ -2390,8 +2233,7 @@ export function resolveC3BaseUrl(options, currentUrl = '') {
|
|
|
2390
2233
|
}
|
|
2391
2234
|
/** Grain uses one code-pinned compiler/stdlib/worker receipt, served from this base URL. */
|
|
2392
2235
|
export function resolveGrainBaseUrl(options, currentUrl = '') {
|
|
2393
|
-
const configured =
|
|
2394
|
-
(publicEnv.PUBLIC_WASM_GRAIN_BASE_URL || '').trim();
|
|
2236
|
+
const configured = typeof options === 'object' ? options?.grain?.baseUrl : undefined;
|
|
2395
2237
|
if (configured)
|
|
2396
2238
|
return normalizeBaseUrl(configured, currentUrl);
|
|
2397
2239
|
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
@@ -2399,10 +2241,36 @@ export function resolveGrainBaseUrl(options, currentUrl = '') {
|
|
|
2399
2241
|
}
|
|
2400
2242
|
/** Hy wheels are code-pinned receipts served from this base URL and installed into Pyodide. */
|
|
2401
2243
|
export function resolveHyBaseUrl(options, currentUrl = '') {
|
|
2402
|
-
const configured =
|
|
2403
|
-
(publicEnv.PUBLIC_WASM_HY_BASE_URL || '').trim();
|
|
2244
|
+
const configured = typeof options === 'object' ? options?.hy?.baseUrl : undefined;
|
|
2404
2245
|
if (configured)
|
|
2405
2246
|
return normalizeBaseUrl(configured, currentUrl);
|
|
2406
2247
|
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
2407
2248
|
return normalizeBaseUrl(`${normalizeRootUrl(root || '') || ''}/wasm-hy/`, currentUrl);
|
|
2408
2249
|
}
|
|
2250
|
+
/** Aheui's receipt-verified upstream wheel is installed into Pyodide from this base URL. */
|
|
2251
|
+
export function resolveAheuiBaseUrl(options, currentUrl = '') {
|
|
2252
|
+
const configured = typeof options === 'object' ? options?.aheui?.baseUrl : undefined;
|
|
2253
|
+
if (configured)
|
|
2254
|
+
return normalizeBaseUrl(configured, currentUrl);
|
|
2255
|
+
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
2256
|
+
return normalizeBaseUrl(`${normalizeRootUrl(root || '') || ''}/wasm-aheui/`, currentUrl);
|
|
2257
|
+
}
|
|
2258
|
+
/** APECode's pinned original wheel is installed into Pyodide from this base URL. */
|
|
2259
|
+
export function resolveApecodeBaseUrl(options = '', currentUrl = globalThis.location?.href || 'http://localhost/') {
|
|
2260
|
+
const configured = typeof options === 'object' ? options?.apecode?.baseUrl : undefined;
|
|
2261
|
+
if (configured)
|
|
2262
|
+
return normalizeBaseUrl(configured, currentUrl);
|
|
2263
|
+
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
2264
|
+
return normalizeBaseUrl(`${normalizeRootUrl(root || '') || ''}/wasm-apecode/`, currentUrl);
|
|
2265
|
+
}
|
|
2266
|
+
/** Resolve the unchanged GolfScript source; its receipt is pinned independently of the URL. */
|
|
2267
|
+
export function resolveGolfscriptRuntimeAssetConfig(options, currentUrl = globalThis.location?.href || 'http://localhost/') {
|
|
2268
|
+
const configured = typeof options === 'object' ? options?.golfscript?.interpreterUrl : undefined;
|
|
2269
|
+
const root = typeof options === 'string' ? options : options?.rootUrl;
|
|
2270
|
+
const interpreterUrl = resolveConfiguredUrl(configured ||
|
|
2271
|
+
`${normalizeRootUrl(root || '')}/wasm-golfscript/golfscript.rb?v=${WASM_GOLFSCRIPT_ASSET_VERSION}`, currentUrl || 'http://localhost/');
|
|
2272
|
+
return {
|
|
2273
|
+
interpreterUrl,
|
|
2274
|
+
assetKey: JSON.stringify({ interpreterUrl, receipt: WASM_GOLFSCRIPT_INTERPRETER_RECEIPT })
|
|
2275
|
+
};
|
|
2276
|
+
}
|