wasm-idle 1.0.6 → 1.0.8
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 +18 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/playground/assetBridge.d.ts +6 -1
- package/dist/playground/assetBridge.js +77 -4
- package/dist/playground/assets.d.ts +9 -1
- package/dist/playground/assets.js +29 -5
- package/dist/playground/awk.js +1 -0
- package/dist/playground/bash.d.ts +1 -0
- package/dist/playground/bash.js +7 -1
- package/dist/playground/bqn.js +1 -0
- package/dist/playground/bqnPreflight.d.ts +2 -1
- package/dist/playground/bqnPreflight.js +1 -0
- package/dist/playground/c3.js +1 -0
- package/dist/playground/cachedClang.js +15 -8
- package/dist/playground/clang.d.ts +1 -0
- package/dist/playground/clang.js +8 -1
- package/dist/playground/clangAssetIntegrity.d.ts +6 -0
- package/dist/playground/clangAssetIntegrity.js +3 -2
- package/dist/playground/clojurescript.js +1 -0
- package/dist/playground/clojurescriptPreflight.d.ts +2 -1
- package/dist/playground/clojurescriptPreflight.js +1 -0
- package/dist/playground/elixir.js +4 -1
- package/dist/playground/forth.js +1 -0
- package/dist/playground/forthPreflight.d.ts +2 -1
- package/dist/playground/forthPreflight.js +1 -0
- package/dist/playground/fortran.js +7 -1
- package/dist/playground/haskell.js +4 -1
- package/dist/playground/haskellAssets.d.ts +2 -1
- package/dist/playground/haskellAssets.js +8 -8
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +2 -2
- package/dist/playground/j.js +1 -0
- package/dist/playground/jPreflight.d.ts +2 -1
- package/dist/playground/jPreflight.js +1 -0
- package/dist/playground/janet.js +1 -0
- package/dist/playground/java.js +20 -8
- package/dist/playground/julia.js +1 -0
- package/dist/playground/lfortranAssets.d.ts +2 -1
- package/dist/playground/lfortranAssets.js +1 -0
- package/dist/playground/lisp.js +4 -1
- package/dist/playground/lispAssets.d.ts +2 -1
- package/dist/playground/lispAssets.js +10 -0
- package/dist/playground/lldbManifest.d.ts +2 -2
- package/dist/playground/lldbManifest.js +17 -3
- package/dist/playground/lldbSession.d.ts +1 -0
- package/dist/playground/lldbSession.js +2 -1
- package/dist/playground/nim.js +1 -0
- package/dist/playground/ocaml.d.ts +1 -0
- package/dist/playground/ocaml.js +12 -1
- package/dist/playground/options.d.ts +2 -0
- package/dist/playground/pascal.js +1 -0
- package/dist/playground/perl.js +1 -0
- package/dist/playground/prolog.js +1 -0
- package/dist/playground/python.js +3 -1
- package/dist/playground/runtimeSession.d.ts +2 -1
- package/dist/playground/runtimeSession.js +2 -2
- package/dist/playground/rust.d.ts +1 -0
- package/dist/playground/rust.js +11 -1
- package/dist/playground/rustExecutableGraph.d.ts +1 -0
- package/dist/playground/rustExecutableGraph.js +1 -0
- package/dist/playground/staticRuntimePreflight.d.ts +2 -1
- package/dist/playground/staticRuntimePreflight.js +4 -2
- package/dist/playground/staticRuntimePreflightExecute.js +1 -0
- package/dist/playground/staticRuntimePreflightProtocol.d.ts +2 -1
- package/dist/playground/staticWorkerRuntime.d.ts +3 -1
- package/dist/playground/staticWorkerRuntime.js +44 -3
- package/dist/playground/tcl.js +1 -0
- package/dist/playground/tinygo.d.ts +2 -0
- package/dist/playground/tinygo.js +57 -3
- package/dist/playground/tinygoExecutableGraph.d.ts +4 -1
- package/dist/playground/tinygoExecutableGraph.js +59 -7
- package/dist/playground/typescript.js +4 -1
- package/dist/playground/wasmGoVersion.d.ts +1 -1
- package/dist/playground/wasmGoVersion.js +1 -1
- package/dist/playground/wasmOcamlVersion.d.ts +2 -2
- package/dist/playground/wasmOcamlVersion.js +1 -1
- package/dist/playground/wasmRustVersion.d.ts +90 -24
- package/dist/playground/wasmRustVersion.js +98 -23
- package/dist/playground/wasmTinyGoVersion.d.ts +40 -29
- package/dist/playground/wasmTinyGoVersion.js +43 -31
- package/dist/playground/worker/clang.js +1 -5
- package/dist/playground/worker/elixir.js +10 -8
- package/dist/playground/worker/fortran.js +4 -7
- package/dist/playground/worker/haskell.js +2 -0
- package/dist/playground/worker/lisp.js +2 -0
- package/dist/playground/worker/ocaml.js +13 -1
- package/dist/playground/worker/runtimeAssetFetch.d.ts +11 -1
- package/dist/playground/worker/runtimeAssetFetch.js +64 -1
- package/dist/playground/worker/rust.js +9 -2
- package/dist/playground/worker/staticRuntimePreflight.js +2 -0
- package/dist/playground/worker/typescript.js +4 -1
- package/dist/playground/worker/zig.js +7 -4
- package/dist/playground/zig.js +4 -1
- package/package.json +10 -7
|
@@ -13,6 +13,12 @@ export declare const BUNDLED_CLANG_ASSET_INTEGRITY: Readonly<{
|
|
|
13
13
|
uncompressedBytes: number;
|
|
14
14
|
uncompressedSha256: string;
|
|
15
15
|
}>;
|
|
16
|
+
'libc-printscan-long-double.a.gz': Readonly<{
|
|
17
|
+
bytes: number;
|
|
18
|
+
sha256: string;
|
|
19
|
+
uncompressedBytes: number;
|
|
20
|
+
uncompressedSha256: string;
|
|
21
|
+
}>;
|
|
16
22
|
'bin/memfs.wasm.gz': Readonly<{
|
|
17
23
|
bytes: number;
|
|
18
24
|
sha256: string;
|
|
@@ -4,8 +4,9 @@ export const BUNDLED_CLANG_LANGUAGE_SYSROOT_PROFILES = Object.freeze({
|
|
|
4
4
|
cppAddon: Object.freeze({ asset: 'bin/cpp-addon.tar.gz' })
|
|
5
5
|
});
|
|
6
6
|
export const BUNDLED_CLANG_ASSET_INTEGRITY = Object.freeze({
|
|
7
|
-
'runtime-manifest.v1.json': integrityEntry(
|
|
8
|
-
'
|
|
7
|
+
'runtime-manifest.v1.json': integrityEntry(967, '0b854bc6b41924420cfcc840509ecbe03af3c63ca3edd4940897917e32c8d8ad'),
|
|
8
|
+
'libc-printscan-long-double.a.gz': integrityEntry(52_723, 'b3f11e17e40fb13371a97244fdde00d5bd951ad8e20dfdf88a069167d6be628b', 111_062, '33e04007d3547095068391b42189d1ac5398dd04e9da3118dfa644ffea7f4148'),
|
|
9
|
+
'bin/memfs.wasm.gz': integrityEntry(16_111, 'a3e43451bc15ae69a7f113009e2ee82ab4db711625c1782cd45d0d3c4d38175a', 38_071, '5b741e03dd3502bcfd80e4e5055232b5d633604e1461752efed0189f93407dc3'),
|
|
9
10
|
'bin/clang.wasm.gz': integrityEntry(13_121_917, '8dc032057fbeb41e4a9986dfc54b2336c17532033dee172eb0095eba9c5fbe75', 35_658_969, 'd92ef06cdd3fea88acf384db15a6f2a344790c05bcba8e9f13f5b75b36ad4a99'),
|
|
10
11
|
'bin/lld.wasm.gz': integrityEntry(6_417_339, '495813efde8f354c38483749cdface7a7d9e23c8411da45a6f5f80030159eb11', 16_171_013, '34d39bc410c098e7e09933b61cc8e28699447af9a28abf4544d71b6e9cad1f9d'),
|
|
11
12
|
'bin/sysroot.tar.gz': integrityEntry(5_059_493, 'c0ef46e903492383a3c7069bfd4aed0e764e8df988f92bb81eb96bea50bf2c00', 19_312_640, 'e122f1acec0642d62d8976101c542aaa5346460df6eae5a3f8efb594ff32f5ae'),
|
|
@@ -35,6 +35,7 @@ class ClojureScript extends StaticWorkerRuntimeSandbox {
|
|
|
35
35
|
manifestUrl: urls.manifestUrl || '',
|
|
36
36
|
profile,
|
|
37
37
|
limits: context.limits,
|
|
38
|
+
persistentCache: context.persistentCache,
|
|
38
39
|
signal: context.signal,
|
|
39
40
|
reportProgress(progress) {
|
|
40
41
|
if (progress.kind === 'asset') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClojureScriptRuntimePreflightProfile } from './assets';
|
|
2
|
-
import { type ExecutionLimits, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
2
|
+
import { type ExecutionLimits, type RuntimeAssetCacheOptions, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
3
3
|
export declare const CLOJURESCRIPT_PREFLIGHT_PROTOCOL: "wasm-idle-clojurescript-preflight";
|
|
4
4
|
export declare const CLOJURESCRIPT_PREFLIGHT_PROTOCOL_VERSION: 1;
|
|
5
5
|
export declare const CLOJURESCRIPT_PREFLIGHT_RUNTIME_ID: "CLOJURESCRIPT";
|
|
@@ -8,6 +8,7 @@ export interface ClojureScriptRuntimePreflightRequest {
|
|
|
8
8
|
readonly manifestUrl: string;
|
|
9
9
|
readonly profile: ClojureScriptRuntimePreflightProfile;
|
|
10
10
|
readonly limits?: Partial<ExecutionLimits>;
|
|
11
|
+
readonly persistentCache?: RuntimeAssetCacheOptions;
|
|
11
12
|
readonly signal?: AbortSignal;
|
|
12
13
|
readonly fetch?: typeof globalThis.fetch;
|
|
13
14
|
readonly reportProgress?: (progress: RuntimeAssetPreflightProgress) => void;
|
|
@@ -219,6 +219,7 @@ export async function preflightClojureScriptRuntimeAssets(request) {
|
|
|
219
219
|
compiler: compilerRequestUrl
|
|
220
220
|
},
|
|
221
221
|
fetch: request.fetch,
|
|
222
|
+
persistentCache: request.persistentCache,
|
|
222
223
|
signal: controller.signal,
|
|
223
224
|
limits: { ...limits, maxAssetBytes },
|
|
224
225
|
maxConcurrentDownloads: 2,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveElixirBundleUrl, resolveErlangBundleUrl } from './assets';
|
|
2
2
|
import { snapshotElixirRuntimeAssetReceipts } from './elixirAssets';
|
|
3
|
-
import { AssetTooLargeError, BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
3
|
+
import { AssetTooLargeError, BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
4
4
|
import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
|
|
5
5
|
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
6
6
|
import { WorkerSession } from './workerSession';
|
|
@@ -285,6 +285,9 @@ class Elixir {
|
|
|
285
285
|
worker.onmessage = handler;
|
|
286
286
|
worker.postMessage({
|
|
287
287
|
load: true,
|
|
288
|
+
persistentCache: resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object'
|
|
289
|
+
? runtimeAssets?.persistentCache
|
|
290
|
+
: undefined, options.persistentCache),
|
|
288
291
|
bundleUrl: this.bundleUrl,
|
|
289
292
|
assetReceipts,
|
|
290
293
|
maxAssetBytes: limits.maxAssetBytes,
|
package/dist/playground/forth.js
CHANGED
|
@@ -35,6 +35,7 @@ class Forth extends StaticWorkerRuntimeSandbox {
|
|
|
35
35
|
manifestUrl: urls.manifestUrl || '',
|
|
36
36
|
profile,
|
|
37
37
|
limits: context.limits,
|
|
38
|
+
persistentCache: context.persistentCache,
|
|
38
39
|
signal: context.signal,
|
|
39
40
|
reportProgress(progress) {
|
|
40
41
|
if (progress.kind !== 'asset')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ForthRuntimePreflightProfile } from './assets';
|
|
2
|
-
import { type ExecutionLimits, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
2
|
+
import { type ExecutionLimits, type RuntimeAssetCacheOptions, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
3
3
|
export declare const FORTH_PREFLIGHT_PROTOCOL: "wasm-idle-forth-preflight";
|
|
4
4
|
export declare const FORTH_PREFLIGHT_PROTOCOL_VERSION: 1;
|
|
5
5
|
export declare const FORTH_PREFLIGHT_RUNTIME_ID: "FORTH";
|
|
@@ -8,6 +8,7 @@ export interface ForthRuntimePreflightRequest {
|
|
|
8
8
|
readonly manifestUrl: string;
|
|
9
9
|
readonly profile: ForthRuntimePreflightProfile;
|
|
10
10
|
readonly limits?: Partial<ExecutionLimits>;
|
|
11
|
+
readonly persistentCache?: RuntimeAssetCacheOptions;
|
|
11
12
|
readonly signal?: AbortSignal;
|
|
12
13
|
readonly fetch?: typeof globalThis.fetch;
|
|
13
14
|
readonly reportProgress?: (progress: RuntimeAssetPreflightProgress) => void;
|
|
@@ -172,6 +172,7 @@ export async function preflightForthRuntimeAssets(request) {
|
|
|
172
172
|
runtime: runtimeRequestUrl
|
|
173
173
|
},
|
|
174
174
|
fetch: request.fetch,
|
|
175
|
+
persistentCache: request.persistentCache,
|
|
175
176
|
signal: request.signal,
|
|
176
177
|
limits: request.limits,
|
|
177
178
|
maxConcurrentDownloads: 2,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkerAssetBridge } from './assetBridge';
|
|
2
2
|
import { resolveFortranRuntimeAssetConfig, resolveRuntimeAssetConfig } from './assets';
|
|
3
|
-
import { AssetTooLargeError, BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
3
|
+
import { AssetTooLargeError, BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
4
4
|
import { FORTRAN_EXECUTION_ASSET_NAMES } from './fortranAssets';
|
|
5
5
|
import { resolveSandboxExecutionArgs } from './options';
|
|
6
6
|
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
@@ -288,6 +288,7 @@ class Fortran {
|
|
|
288
288
|
let assetBridge;
|
|
289
289
|
try {
|
|
290
290
|
assetBridge = new WorkerAssetBridge(worker, 'clang', clangAssets, progress, limits.maxAssetBytes);
|
|
291
|
+
assetBridge.setExecutionPersistentCache(options.persistentCache);
|
|
291
292
|
}
|
|
292
293
|
catch (error) {
|
|
293
294
|
try {
|
|
@@ -353,6 +354,9 @@ class Fortran {
|
|
|
353
354
|
worker.onmessage = handler;
|
|
354
355
|
worker.postMessage({
|
|
355
356
|
load: true,
|
|
357
|
+
persistentCache: resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object'
|
|
358
|
+
? runtimeAssets?.persistentCache
|
|
359
|
+
: undefined, options.persistentCache),
|
|
356
360
|
log,
|
|
357
361
|
code,
|
|
358
362
|
args,
|
|
@@ -373,6 +377,7 @@ class Fortran {
|
|
|
373
377
|
if (!assetBridge)
|
|
374
378
|
return rejectOperation('Fortran asset bridge is not loaded');
|
|
375
379
|
assetBridge.rebind(worker, clangAssets, progress, limits.maxAssetBytes);
|
|
380
|
+
assetBridge.setExecutionPersistentCache(options.persistentCache);
|
|
376
381
|
if (!this.isOperationActive(operation) ||
|
|
377
382
|
this.worker !== worker ||
|
|
378
383
|
this.assetBridge !== assetBridge) {
|
|
@@ -444,6 +449,7 @@ class Fortran {
|
|
|
444
449
|
const assetBridge = this.assetBridge;
|
|
445
450
|
if (!assetBridge)
|
|
446
451
|
throw 'Fortran asset bridge is not loaded';
|
|
452
|
+
assetBridge.setExecutionPersistentCache(options.persistentCache);
|
|
447
453
|
const hasExplicitStdin = stdin !== undefined;
|
|
448
454
|
if (hasExplicitStdin) {
|
|
449
455
|
activeOperation.explicitStdin = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveHaskellBsdtarUrl, resolveHaskellModuleUrl, resolveHaskellRootfsUrl } from './assets';
|
|
2
|
-
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, snapshotHaskellRuntimeAssetReceipts, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
2
|
+
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, snapshotHaskellRuntimeAssetReceipts, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
3
3
|
import { resolveSandboxExecutionArgs } from './options';
|
|
4
4
|
import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
|
|
5
5
|
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
@@ -367,6 +367,9 @@ class Haskell {
|
|
|
367
367
|
worker.onmessage = handler;
|
|
368
368
|
worker.postMessage({
|
|
369
369
|
load: true,
|
|
370
|
+
persistentCache: resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object'
|
|
371
|
+
? runtimeAssets?.persistentCache
|
|
372
|
+
: undefined, options.persistentCache),
|
|
370
373
|
...runtime,
|
|
371
374
|
log: _log
|
|
372
375
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HaskellRuntimeAssetName, type HaskellRuntimeAssetReceipt, type HaskellRuntimeAssetReceipts } from '@wasm-idle/core';
|
|
1
|
+
import { type RuntimeAssetCacheOptions, type HaskellRuntimeAssetName, type HaskellRuntimeAssetReceipt, type HaskellRuntimeAssetReceipts } from '@wasm-idle/core';
|
|
2
2
|
export type { HaskellRuntimeAssetReceipt, HaskellRuntimeAssetReceipts };
|
|
3
3
|
export interface HaskellRuntimeAssetConfig {
|
|
4
4
|
readonly moduleUrl: string;
|
|
@@ -15,6 +15,7 @@ export interface HaskellRuntimeAssetProgress {
|
|
|
15
15
|
export declare function snapshotHaskellRuntimeAssetConfig(config: HaskellRuntimeAssetConfig): HaskellRuntimeAssetConfig;
|
|
16
16
|
export declare function loadVerifiedHaskellRuntimeAssets(config: HaskellRuntimeAssetConfig, options?: {
|
|
17
17
|
readonly signal?: AbortSignal;
|
|
18
|
+
readonly persistentCache?: RuntimeAssetCacheOptions;
|
|
18
19
|
readonly onProgress?: (progress: HaskellRuntimeAssetProgress) => void;
|
|
19
20
|
}): Promise<Readonly<{
|
|
20
21
|
config: HaskellRuntimeAssetConfig;
|
|
@@ -51,20 +51,20 @@ export async function loadVerifiedHaskellRuntimeAssets(config, options = {}) {
|
|
|
51
51
|
? 'Haskell GHC rootfs'
|
|
52
52
|
: 'Haskell rootfs extractor',
|
|
53
53
|
cache: 'no-store',
|
|
54
|
+
expected: receipt,
|
|
55
|
+
verify: (bytes) => verifyRuntimeAssetIntegrity({
|
|
56
|
+
asset,
|
|
57
|
+
bytes,
|
|
58
|
+
expected: receipt,
|
|
59
|
+
runtimeId: 'HASKELL'
|
|
60
|
+
}),
|
|
61
|
+
persistentCache: options.persistentCache,
|
|
54
62
|
maxAssetBytes: Math.min(receipt.bytes, snapshot.maxAssetBytes),
|
|
55
63
|
signal: controller.signal,
|
|
56
64
|
onProgress(progress) {
|
|
57
65
|
options.onProgress?.({ asset, ...progress });
|
|
58
66
|
}
|
|
59
67
|
});
|
|
60
|
-
if (controller.signal.aborted)
|
|
61
|
-
throw controller.signal.reason;
|
|
62
|
-
await verifyRuntimeAssetIntegrity({
|
|
63
|
-
asset,
|
|
64
|
-
bytes,
|
|
65
|
-
expected: receipt,
|
|
66
|
-
runtimeId: 'HASKELL'
|
|
67
|
-
});
|
|
68
68
|
if (controller.signal.aborted)
|
|
69
69
|
throw controller.signal.reason;
|
|
70
70
|
return bytes;
|
|
@@ -3,5 +3,5 @@ import { type PlaygroundBindingOptions } from '@wasm-idle/core';
|
|
|
3
3
|
export declare const supportedLanguages: ("C" | "CPP" | "OBJC" | "D" | "TINYGO" | "RUBY" | "PERL" | "TCL" | "AWK" | "PASCAL" | "JANET" | "JULIA" | "NIM" | "BASH" | "BQN" | "CLOJURESCRIPT" | "FORTH" | "J" | "PROLOG" | "C3" | "PYTHON3" | "JAVA" | "RUST" | "GO" | "CSHARP" | "FSHARP" | "VBNET" | "ELIXIR" | "ERLANG" | "GLEAM" | "FORTRAN" | "LFORTRAN" | "COBOL" | "OCAML" | "JAVASCRIPT" | "TYPESCRIPT" | "ASSEMBLYSCRIPT" | "WAT" | "WASM" | "LUA" | "ZIG" | "LISP" | "HASKELL" | "R" | "OCTAVE" | "DUCKDB" | "SQLITE" | "PHP")[];
|
|
4
4
|
export declare function createPlaygroundBinding(runtimeAssets: SandboxRuntimeAssets, options?: PlaygroundBindingOptions): PlaygroundBinding;
|
|
5
5
|
declare function playground(language: string): Promise<Sandbox>;
|
|
6
|
-
declare function playground(language: string, runtimeAssets: SandboxRuntimeAssets): Promise<BoundSandbox>;
|
|
6
|
+
declare function playground(language: string, runtimeAssets: SandboxRuntimeAssets, options?: PlaygroundBindingOptions): Promise<BoundSandbox>;
|
|
7
7
|
export default playground;
|
package/dist/playground/index.js
CHANGED
|
@@ -353,7 +353,7 @@ export const supportedLanguages = [...supportedLanguageIds];
|
|
|
353
353
|
export function createPlaygroundBinding(runtimeAssets, options = {}) {
|
|
354
354
|
return createCorePlaygroundBinding(runtimeAssets, playground, options);
|
|
355
355
|
}
|
|
356
|
-
async function playground(language, runtimeAssets) {
|
|
356
|
+
async function playground(language, runtimeAssets, options = {}) {
|
|
357
357
|
const normalizedLanguage = normalizeLanguageId(language);
|
|
358
358
|
if (!isSupportedLanguageId(normalizedLanguage)) {
|
|
359
359
|
throw new Error(`Unsupported language: ${language}`);
|
|
@@ -362,7 +362,7 @@ async function playground(language, runtimeAssets) {
|
|
|
362
362
|
if (!route)
|
|
363
363
|
throw new Error(`Missing sandbox route: ${normalizedLanguage}`);
|
|
364
364
|
return runtimeAssets
|
|
365
|
-
? createPlaygroundBinding(runtimeAssets).load(normalizedLanguage)
|
|
365
|
+
? createPlaygroundBinding(runtimeAssets, options).load(normalizedLanguage)
|
|
366
366
|
: route.load();
|
|
367
367
|
}
|
|
368
368
|
export default playground;
|
package/dist/playground/j.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JRuntimePreflightProfile } from './assets';
|
|
2
|
-
import { type ExecutionLimits, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
2
|
+
import { type ExecutionLimits, type RuntimeAssetCacheOptions, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
3
3
|
export declare const J_PREFLIGHT_PROTOCOL: "wasm-idle-j-preflight";
|
|
4
4
|
export declare const J_PREFLIGHT_PROTOCOL_VERSION: 1;
|
|
5
5
|
export declare const J_PREFLIGHT_RUNTIME_ID: "J";
|
|
@@ -8,6 +8,7 @@ export interface JRuntimePreflightRequest {
|
|
|
8
8
|
readonly manifestUrl: string;
|
|
9
9
|
readonly profile: JRuntimePreflightProfile;
|
|
10
10
|
readonly limits?: Partial<ExecutionLimits>;
|
|
11
|
+
readonly persistentCache?: RuntimeAssetCacheOptions;
|
|
11
12
|
readonly signal?: AbortSignal;
|
|
12
13
|
readonly fetch?: typeof globalThis.fetch;
|
|
13
14
|
readonly reportProgress?: (progress: RuntimeAssetPreflightProgress) => void;
|
package/dist/playground/janet.js
CHANGED
|
@@ -40,6 +40,7 @@ class Janet extends StaticWorkerRuntimeSandbox {
|
|
|
40
40
|
manifestUrl: urls.manifestUrl || '',
|
|
41
41
|
profile,
|
|
42
42
|
limits: context.limits,
|
|
43
|
+
persistentCache: context.persistentCache,
|
|
43
44
|
signal: context.signal,
|
|
44
45
|
reportProgress(progress) {
|
|
45
46
|
if (progress.kind === 'asset') {
|
package/dist/playground/java.js
CHANGED
|
@@ -285,10 +285,16 @@ class Java {
|
|
|
285
285
|
let resolverAssets = runtimeAssets;
|
|
286
286
|
if (runtimeAssets && typeof runtimeAssets === 'object') {
|
|
287
287
|
const runtimeConfig = runtimeAssets.java;
|
|
288
|
+
if (!this.isOperationActive(activeOperation))
|
|
289
|
+
return;
|
|
290
|
+
const persistentCache = runtimeAssets.persistentCache;
|
|
288
291
|
if (!this.isOperationActive(activeOperation))
|
|
289
292
|
return;
|
|
290
293
|
let java;
|
|
291
294
|
if (runtimeConfig) {
|
|
295
|
+
const persistentCache = runtimeConfig.persistentCache;
|
|
296
|
+
if (!this.isOperationActive(activeOperation))
|
|
297
|
+
return;
|
|
292
298
|
const baseUrl = runtimeConfig.baseUrl;
|
|
293
299
|
if (!this.isOperationActive(activeOperation))
|
|
294
300
|
return;
|
|
@@ -352,7 +358,7 @@ class Java {
|
|
|
352
358
|
: undefined;
|
|
353
359
|
if (!this.isOperationActive(activeOperation))
|
|
354
360
|
return;
|
|
355
|
-
java = { baseUrl, loader, integrity, allowedBaseUrls };
|
|
361
|
+
java = { baseUrl, loader, integrity, allowedBaseUrls, persistentCache };
|
|
356
362
|
}
|
|
357
363
|
let rootUrl;
|
|
358
364
|
let rootUrlRead = false;
|
|
@@ -367,10 +373,11 @@ class Java {
|
|
|
367
373
|
}
|
|
368
374
|
return rootUrl;
|
|
369
375
|
},
|
|
370
|
-
java
|
|
376
|
+
java,
|
|
377
|
+
persistentCache
|
|
371
378
|
};
|
|
372
379
|
}
|
|
373
|
-
const assetConfig = resolveRuntimeAssetConfig('java', resolverAssets, currentUrl);
|
|
380
|
+
const assetConfig = resolveRuntimeAssetConfig('java', resolverAssets, currentUrl, options.persistentCache);
|
|
374
381
|
if (!this.isOperationActive(activeOperation))
|
|
375
382
|
return;
|
|
376
383
|
for (const asset of TEAVM_RUNTIME_ASSET_NAMES) {
|
|
@@ -449,11 +456,14 @@ class Java {
|
|
|
449
456
|
baseUrl: assetConfig.baseUrl,
|
|
450
457
|
useAssetBridge: assetConfig.useAssetBridge,
|
|
451
458
|
maxAssetBytes: limits.maxAssetBytes,
|
|
452
|
-
streamCompiler: !assetConfig.loader &&
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
459
|
+
streamCompiler: !assetConfig.loader &&
|
|
460
|
+
TEAVM_RUNTIME_ASSET_NAMES.every((asset) => {
|
|
461
|
+
const receipt = assetConfig.integrity?.[asset];
|
|
462
|
+
const expected = TEAVM_RUNTIME_ASSET_RECEIPTS[asset];
|
|
463
|
+
return (typeof receipt === 'object' &&
|
|
464
|
+
receipt.bytes === expected.bytes &&
|
|
465
|
+
receipt.sha256 === expected.sha256);
|
|
466
|
+
})
|
|
457
467
|
}
|
|
458
468
|
});
|
|
459
469
|
}
|
|
@@ -556,9 +566,11 @@ class Java {
|
|
|
556
566
|
maxTotalBytes: Math.min(workspaceLimits.maxTotalBytes ?? DEFAULT_WORKSPACE_LIMITS.maxTotalBytes, limits.maxWorkspaceBytes)
|
|
557
567
|
});
|
|
558
568
|
stdin = options.stdin;
|
|
569
|
+
const persistentCache = options.persistentCache;
|
|
559
570
|
if (!this.isOperationActive(activeOperation) || signal?.aborted) {
|
|
560
571
|
return Promise.reject(this.releaseBeforeSession(activeOperation, 'Java execution cancelled'));
|
|
561
572
|
}
|
|
573
|
+
assetBridge?.setExecutionPersistentCache(persistentCache);
|
|
562
574
|
unbindPreSessionAbort();
|
|
563
575
|
}
|
|
564
576
|
catch (error) {
|
package/dist/playground/julia.js
CHANGED
|
@@ -40,6 +40,7 @@ class Julia extends StaticWorkerRuntimeSandbox {
|
|
|
40
40
|
manifestUrl: urls.manifestUrl || '',
|
|
41
41
|
profile,
|
|
42
42
|
limits: context.limits,
|
|
43
|
+
persistentCache: context.persistentCache,
|
|
43
44
|
signal: context.signal,
|
|
44
45
|
reportProgress(progress) {
|
|
45
46
|
loadedByAsset.set(progress.assetKey, progress.loadedBytes);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExecutionLimits } from '@wasm-idle/core';
|
|
1
|
+
import { type ExecutionLimits, type RuntimeAssetCacheOptions } from '@wasm-idle/core';
|
|
2
2
|
import type { PlaygroundRuntimeAssets } from './assets';
|
|
3
3
|
export declare const LFORTRAN_INITIAL_MEMORY_BYTES: number;
|
|
4
4
|
export declare const LFORTRAN_RUNTIME_MANIFEST: import("@wasm-idle/core").RuntimeRegistryManifest;
|
|
@@ -13,6 +13,7 @@ export declare function resolveLfortranRuntimeAssetConfig(assets: string | Playg
|
|
|
13
13
|
};
|
|
14
14
|
export declare function preflightLfortranRuntimeAssets(baseUrl: string, options: {
|
|
15
15
|
limits: ExecutionLimits;
|
|
16
|
+
persistentCache?: RuntimeAssetCacheOptions;
|
|
16
17
|
signal?: AbortSignal;
|
|
17
18
|
reportProgress?: (value: number, stage: string) => void;
|
|
18
19
|
fetch?: typeof globalThis.fetch;
|
|
@@ -100,6 +100,7 @@ export async function preflightLfortranRuntimeAssets(baseUrl, options) {
|
|
|
100
100
|
new URL(`${name === 'lfortran.data' ? 'lfortran.data.bin' : name}?v=${asset.sha256}`, baseUrl)
|
|
101
101
|
])),
|
|
102
102
|
limits: options.limits,
|
|
103
|
+
persistentCache: options.persistentCache,
|
|
103
104
|
signal: options.signal,
|
|
104
105
|
fetch: options.fetch,
|
|
105
106
|
redirect: 'error',
|
package/dist/playground/lisp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveLispRuntimeAssetConfig } from './assets';
|
|
2
|
-
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
2
|
+
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
3
3
|
import { resolveSandboxExecutionArgs } from './options';
|
|
4
4
|
import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
|
|
5
5
|
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
@@ -329,6 +329,9 @@ class Lisp {
|
|
|
329
329
|
worker.onmessage = handler;
|
|
330
330
|
worker.postMessage({
|
|
331
331
|
load: true,
|
|
332
|
+
persistentCache: resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object'
|
|
333
|
+
? runtimeAssets?.persistentCache
|
|
334
|
+
: undefined, options.persistentCache),
|
|
332
335
|
runtimeConfig: nextRuntimeConfig,
|
|
333
336
|
maxAssetBytes: limits.maxAssetBytes
|
|
334
337
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type LispRuntimeModuleEnvironment, type VerifiedLispRuntime } from '@wasm-idle/core';
|
|
1
|
+
import { type RuntimeAssetCacheOptions, type LispRuntimeModuleEnvironment, type VerifiedLispRuntime } from '@wasm-idle/core';
|
|
2
2
|
import type { ResolvedLispRuntimeAssetConfig } from './assets';
|
|
3
3
|
export interface LoadVerifiedLispRuntimeAssetsOptions {
|
|
4
|
+
persistentCache?: RuntimeAssetCacheOptions;
|
|
4
5
|
signal?: AbortSignal;
|
|
5
6
|
maxAssetBytes?: number;
|
|
6
7
|
moduleEnvironment?: LispRuntimeModuleEnvironment;
|
|
@@ -41,6 +41,8 @@ export async function loadVerifiedLispRuntimeAssets(config, options = {}) {
|
|
|
41
41
|
url: manifestUrl.href,
|
|
42
42
|
label: 'Lisp runtime manifest',
|
|
43
43
|
cache: 'no-cache',
|
|
44
|
+
expected: config.manifestReceipt,
|
|
45
|
+
persistentCache: options.persistentCache,
|
|
44
46
|
maxAssetBytes: Math.min(MAX_LISP_MANIFEST_BYTES, maxAssetBytes),
|
|
45
47
|
signal: options.signal
|
|
46
48
|
});
|
|
@@ -63,6 +65,14 @@ export async function loadVerifiedLispRuntimeAssets(config, options = {}) {
|
|
|
63
65
|
url: assetUrl.href,
|
|
64
66
|
label: `Lisp runtime asset ${asset.logicalPath}`,
|
|
65
67
|
cache: 'force-cache',
|
|
68
|
+
expected: {
|
|
69
|
+
sha256: asset.sha256,
|
|
70
|
+
bytes: asset.size,
|
|
71
|
+
uncompressedSha256: logicalAsset.sha256,
|
|
72
|
+
uncompressedBytes: logicalAsset.size
|
|
73
|
+
},
|
|
74
|
+
persistentCache: options.persistentCache,
|
|
75
|
+
integrityContext: { asset: asset.logicalPath, runtimeId: 'LISP' },
|
|
66
76
|
maxAssetBytes: Math.min(maxAssetBytes, Math.max(asset.size, logicalAsset.size)),
|
|
67
77
|
signal
|
|
68
78
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type RuntimeAssetIntegrityEntry } from '@wasm-idle/core';
|
|
1
|
+
import { type RuntimeAssetCacheOptions, type RuntimeAssetIntegrityEntry } from '@wasm-idle/core';
|
|
2
2
|
import { type RuntimeManifestV2 } from '@wasm-idle/llvm-core/debug';
|
|
3
|
-
export declare function loadVerifiedDebugRuntimeManifest(url: string, expected: Readonly<RuntimeAssetIntegrityEntry> | undefined, fetchImpl: typeof fetch, signal?: AbortSignal): Promise<RuntimeManifestV2>;
|
|
3
|
+
export declare function loadVerifiedDebugRuntimeManifest(url: string, expected: Readonly<RuntimeAssetIntegrityEntry> | undefined, fetchImpl: typeof fetch, signal?: AbortSignal, persistentCache?: RuntimeAssetCacheOptions): Promise<RuntimeManifestV2>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetIntegrityError, AssetTooLargeError, RuntimeConfigurationError, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
|
|
1
|
+
import { AssetIntegrityError, AssetTooLargeError, RuntimeConfigurationError, verifyRuntimeAssetIntegrity, readPersistentRuntimeAsset, resolveRuntimeAssetCacheOptions, writePersistentRuntimeAsset } from '@wasm-idle/core';
|
|
2
2
|
import { parseDebugRuntimeManifest } from '@wasm-idle/llvm-core/debug';
|
|
3
3
|
const MAX_DEBUG_MANIFEST_BYTES = 64 * 1024;
|
|
4
4
|
function abortReason(signal) {
|
|
@@ -16,7 +16,7 @@ async function cancelResponseBody(response, reason) {
|
|
|
16
16
|
// Preserve the validation or lifecycle failure that initiated cancellation.
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
export async function loadVerifiedDebugRuntimeManifest(url, expected, fetchImpl, signal) {
|
|
19
|
+
export async function loadVerifiedDebugRuntimeManifest(url, expected, fetchImpl, signal, persistentCache) {
|
|
20
20
|
if (!expected || !/^[a-f0-9]{64}$/u.test(expected.sha256)) {
|
|
21
21
|
throw new RuntimeConfigurationError('LLDB runtime requires an expected manifest SHA-256 receipt.');
|
|
22
22
|
}
|
|
@@ -37,6 +37,18 @@ export async function loadVerifiedDebugRuntimeManifest(url, expected, fetchImpl,
|
|
|
37
37
|
...(expected.bytes === undefined ? {} : { bytes: expected.bytes })
|
|
38
38
|
});
|
|
39
39
|
throwIfAborted(signal);
|
|
40
|
+
const policy = resolveRuntimeAssetCacheOptions(persistentCache);
|
|
41
|
+
const cache = {
|
|
42
|
+
...policy,
|
|
43
|
+
maxEntryBytes: Math.min(policy.maxEntryBytes, MAX_DEBUG_MANIFEST_BYTES)
|
|
44
|
+
};
|
|
45
|
+
const identity = { url, ...receipt, validationKey: 'lldb-manifest-v1' };
|
|
46
|
+
const cached = await readPersistentRuntimeAsset({ identity, cache, signal });
|
|
47
|
+
if (cached) {
|
|
48
|
+
if (cached.byteLength > MAX_DEBUG_MANIFEST_BYTES)
|
|
49
|
+
throw new Error('Cached LLDB manifest exceeds size limit');
|
|
50
|
+
return parseDebugRuntimeManifest(JSON.parse(new TextDecoder().decode(cached)));
|
|
51
|
+
}
|
|
40
52
|
const response = await fetchImpl(url, { cache: 'no-store', signal });
|
|
41
53
|
if (!response.ok) {
|
|
42
54
|
const error = new Error(`Unable to load the LLDB runtime manifest (${response.status}).`);
|
|
@@ -151,5 +163,7 @@ export async function loadVerifiedDebugRuntimeManifest(url, expected, fetchImpl,
|
|
|
151
163
|
runtimeId: 'wasm-debug',
|
|
152
164
|
profileId: 'lldb-v2'
|
|
153
165
|
});
|
|
154
|
-
|
|
166
|
+
const manifest = parseDebugRuntimeManifest(JSON.parse(new TextDecoder().decode(bytes)));
|
|
167
|
+
await writePersistentRuntimeAsset({ identity, cache, signal, bytes });
|
|
168
|
+
return manifest;
|
|
155
169
|
}
|
|
@@ -19,6 +19,7 @@ export interface LldbArtifactPayload {
|
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
21
21
|
export interface LldbSandboxSessionOptions {
|
|
22
|
+
persistentCache?: import('@wasm-idle/core').RuntimeAssetCacheOptions;
|
|
22
23
|
manifestUrl: string;
|
|
23
24
|
manifestReceipt?: Readonly<RuntimeAssetIntegrityEntry>;
|
|
24
25
|
runtimeBaseUrl: string;
|
|
@@ -184,7 +184,7 @@ export class LldbSandboxSession {
|
|
|
184
184
|
}
|
|
185
185
|
let manifest;
|
|
186
186
|
try {
|
|
187
|
-
manifest = await loadVerifiedDebugRuntimeManifest(this.options.manifestUrl, this.options.manifestReceipt, this.options.fetchImpl ?? fetch, startupAbortController.signal);
|
|
187
|
+
manifest = await loadVerifiedDebugRuntimeManifest(this.options.manifestUrl, this.options.manifestReceipt, this.options.fetchImpl ?? fetch, startupAbortController.signal, this.options.persistentCache);
|
|
188
188
|
}
|
|
189
189
|
catch (error) {
|
|
190
190
|
if (lifecycleVersion !== this.lifecycleVersion)
|
|
@@ -223,6 +223,7 @@ export class LldbSandboxSession {
|
|
|
223
223
|
}));
|
|
224
224
|
const configuredBreakpointVersion = this.breakpointVersion;
|
|
225
225
|
session = createBrowserLldbSession({
|
|
226
|
+
persistentCache: this.options.persistentCache,
|
|
226
227
|
manifest,
|
|
227
228
|
runtimeBaseUrl: this.options.runtimeBaseUrl,
|
|
228
229
|
module: this.options.artifact.bytes,
|
package/dist/playground/nim.js
CHANGED
|
@@ -52,6 +52,7 @@ class Nim extends StaticWorkerRuntimeSandbox {
|
|
|
52
52
|
manifestUrl: urls.manifestUrl || '',
|
|
53
53
|
profile,
|
|
54
54
|
limits: context.limits,
|
|
55
|
+
persistentCache: context.persistentCache,
|
|
55
56
|
signal: context.signal,
|
|
56
57
|
reportProgress(progress) {
|
|
57
58
|
loadedByAsset.set(progress.assetKey, progress.loadedBytes);
|
|
@@ -15,6 +15,7 @@ declare class Ocaml implements Sandbox {
|
|
|
15
15
|
private moduleReceiptIdentity;
|
|
16
16
|
private manifestReceiptIdentity;
|
|
17
17
|
private maxAssetBytes;
|
|
18
|
+
private persistentCache;
|
|
18
19
|
oncompilerdiagnostic?: (diagnostic: CompilerDiagnostic) => void;
|
|
19
20
|
waitingForInput: boolean;
|
|
20
21
|
pendingEof: boolean;
|
package/dist/playground/ocaml.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
|
5
5
|
import { WorkerSession } from './workerSession';
|
|
6
6
|
import { reportWorkerInputReady, reportWorkerProgress } from './workerProgress';
|
|
7
7
|
import { WASM_OCAML_RUNTIME_PROFILE } from './wasmOcamlVersion';
|
|
8
|
-
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, ProtocolError, RuntimeConfigurationError, TimeoutError, WorkspaceValidationError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
8
|
+
import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, ProtocolError, RuntimeConfigurationError, TimeoutError, WorkspaceValidationError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
9
9
|
const OCAML_EXECUTION_LIMIT_KEYS = [
|
|
10
10
|
'assetTimeoutMs',
|
|
11
11
|
'startupTimeoutMs',
|
|
@@ -55,6 +55,7 @@ class Ocaml {
|
|
|
55
55
|
moduleReceiptIdentity = '';
|
|
56
56
|
manifestReceiptIdentity = '';
|
|
57
57
|
maxAssetBytes = 0;
|
|
58
|
+
persistentCache = resolveRuntimeAssetCacheOptions();
|
|
58
59
|
oncompilerdiagnostic;
|
|
59
60
|
waitingForInput = false;
|
|
60
61
|
pendingEof = false;
|
|
@@ -308,6 +309,7 @@ class Ocaml {
|
|
|
308
309
|
let nextModuleReceipt;
|
|
309
310
|
let nextManifestReceipt;
|
|
310
311
|
let buffer;
|
|
312
|
+
let persistentCache;
|
|
311
313
|
try {
|
|
312
314
|
signal = options.signal;
|
|
313
315
|
if (!this.isOperationActive(operation)) {
|
|
@@ -322,6 +324,7 @@ class Ocaml {
|
|
|
322
324
|
return Promise.reject(this.releaseBeforeSession(operation, 'OCaml runtime startup cancelled'));
|
|
323
325
|
}
|
|
324
326
|
limits = this.resolveOperationLimits(operation, configuredLimits);
|
|
327
|
+
persistentCache = resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object' ? runtimeAssets?.persistentCache : undefined, options.persistentCache);
|
|
325
328
|
if (!this.isOperationActive(operation)) {
|
|
326
329
|
return Promise.reject(this.releaseBeforeSession(operation, 'OCaml runtime startup cancelled'));
|
|
327
330
|
}
|
|
@@ -459,6 +462,7 @@ class Ocaml {
|
|
|
459
462
|
this.moduleReceiptIdentity = receiptIdentity(nextModuleReceipt);
|
|
460
463
|
this.manifestReceiptIdentity = receiptIdentity(nextManifestReceipt);
|
|
461
464
|
this.maxAssetBytes = limits.maxAssetBytes;
|
|
465
|
+
this.persistentCache = persistentCache;
|
|
462
466
|
resolve();
|
|
463
467
|
this.completeOperation(operation);
|
|
464
468
|
return;
|
|
@@ -473,6 +477,7 @@ class Ocaml {
|
|
|
473
477
|
worker.onmessage = handler;
|
|
474
478
|
worker.postMessage({
|
|
475
479
|
load: true,
|
|
480
|
+
persistentCache,
|
|
476
481
|
moduleUrl: nextModuleUrl,
|
|
477
482
|
manifestUrl: nextManifestUrl,
|
|
478
483
|
moduleReceipt: nextModuleReceipt,
|
|
@@ -481,6 +486,7 @@ class Ocaml {
|
|
|
481
486
|
});
|
|
482
487
|
}
|
|
483
488
|
else {
|
|
489
|
+
this.persistentCache = persistentCache;
|
|
484
490
|
progress?.set?.(1);
|
|
485
491
|
if (!this.isOperationActive(operation))
|
|
486
492
|
return;
|
|
@@ -529,6 +535,7 @@ class Ocaml {
|
|
|
529
535
|
let buffer;
|
|
530
536
|
let outputCallback;
|
|
531
537
|
let onDiagnostic;
|
|
538
|
+
let persistentCache;
|
|
532
539
|
try {
|
|
533
540
|
signal = options.signal;
|
|
534
541
|
if (!this.isOperationActive(operation)) {
|
|
@@ -545,6 +552,9 @@ class Ocaml {
|
|
|
545
552
|
if (!configuredWorker)
|
|
546
553
|
throw 'Worker not loaded';
|
|
547
554
|
worker = configuredWorker;
|
|
555
|
+
persistentCache = resolveRuntimeAssetCacheOptions(this.persistentCache, options.persistentCache);
|
|
556
|
+
if (!this.isOperationActive(operation))
|
|
557
|
+
throw this.releaseBeforeSession(operation, 'OCaml execution cancelled');
|
|
548
558
|
const configuredTarget = options.ocamlBackend;
|
|
549
559
|
if (!this.isOperationActive(operation)) {
|
|
550
560
|
throw this.releaseBeforeSession(operation, 'OCaml execution cancelled');
|
|
@@ -814,6 +824,7 @@ class Ocaml {
|
|
|
814
824
|
try {
|
|
815
825
|
worker.postMessage({
|
|
816
826
|
code,
|
|
827
|
+
persistentCache,
|
|
817
828
|
prepare,
|
|
818
829
|
target,
|
|
819
830
|
wasmBinaryenMode,
|