wasm-idle 1.0.5 → 1.0.6
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 +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/playground/assetBridge.d.ts +5 -1
- package/dist/playground/assetBridge.js +120 -42
- package/dist/playground/cachedClang.d.ts +10 -0
- package/dist/playground/cachedClang.js +323 -0
- package/dist/playground/clang.d.ts +7 -0
- package/dist/playground/clang.js +39 -7
- package/dist/playground/clangWorkerProtocol.d.ts +57 -0
- package/dist/playground/clangWorkerProtocol.js +11 -0
- package/dist/playground/compiledArtifactCache.d.ts +21 -0
- package/dist/playground/compiledArtifactCache.js +67 -0
- package/dist/playground/python.d.ts +7 -0
- package/dist/playground/python.js +38 -7
- package/dist/playground/runtimeAssetCache.d.ts +26 -0
- package/dist/playground/runtimeAssetCache.js +84 -0
- package/dist/playground/runtimeSession.d.ts +20 -0
- package/dist/playground/runtimeSession.js +119 -0
- package/dist/playground/worker/assets.d.ts +3 -0
- package/dist/playground/worker/assets.js +41 -0
- package/dist/playground/worker/cachedClangCompile.d.ts +1 -0
- package/dist/playground/worker/cachedClangCompile.js +85 -0
- package/dist/playground/worker/cachedClangExecute.d.ts +1 -0
- package/dist/playground/worker/cachedClangExecute.js +67 -0
- package/dist/playground/worker/clang.js +1 -3
- package/dist/playground/worker/clangStreaming.d.ts +1 -1
- package/dist/playground/worker/clangStreaming.js +20 -2
- package/dist/playground/worker/python.js +3 -2
- package/dist/playground/worker/runtimeModule.d.ts +8 -0
- package/dist/playground/worker/runtimeModule.js +49 -0
- package/package.json +6 -6
|
@@ -14,6 +14,7 @@ let activeDirectAssetUrls = new Map();
|
|
|
14
14
|
let interceptorsInstalled = false;
|
|
15
15
|
let nextAssetRequestId = 0;
|
|
16
16
|
const pendingAssetRequests = new Map();
|
|
17
|
+
const pendingModuleRequests = new Map();
|
|
17
18
|
const cancelResponseBody = (response, reason) => {
|
|
18
19
|
try {
|
|
19
20
|
void Promise.resolve(response.body?.cancel(reason)).catch(() => undefined);
|
|
@@ -441,6 +442,10 @@ export function configureWorkerRuntimeAssets(config) {
|
|
|
441
442
|
(!Number.isSafeInteger(config.maxAssetBytes) || config.maxAssetBytes <= 0)) {
|
|
442
443
|
throw new TypeError('Runtime asset maxAssetBytes must be a positive safe integer');
|
|
443
444
|
}
|
|
445
|
+
for (const pending of pendingModuleRequests.values()) {
|
|
446
|
+
pending.reject(new Error('Runtime module configuration changed'));
|
|
447
|
+
}
|
|
448
|
+
pendingModuleRequests.clear();
|
|
444
449
|
activeDirectAssetBaseUrl = null;
|
|
445
450
|
activeDirectAssetUrls = new Map();
|
|
446
451
|
activeConfig = config;
|
|
@@ -508,6 +513,20 @@ export function handleWorkerAssetMessage(data) {
|
|
|
508
513
|
const response = data?.assetResponse;
|
|
509
514
|
if (!response)
|
|
510
515
|
return false;
|
|
516
|
+
const moduleRequest = pendingModuleRequests.get(response.id);
|
|
517
|
+
if (moduleRequest) {
|
|
518
|
+
pendingModuleRequests.delete(response.id);
|
|
519
|
+
if (!response.ok) {
|
|
520
|
+
moduleRequest.reject(new Error(response.error || 'Runtime module request failed'));
|
|
521
|
+
}
|
|
522
|
+
else if (!(response.module instanceof WebAssembly.Module)) {
|
|
523
|
+
moduleRequest.reject(new Error('Runtime module response is invalid'));
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
moduleRequest.resolve(response.module);
|
|
527
|
+
}
|
|
528
|
+
return true;
|
|
529
|
+
}
|
|
511
530
|
const pending = pendingAssetRequests.get(response.id);
|
|
512
531
|
if (!pending)
|
|
513
532
|
return true;
|
|
@@ -531,3 +550,25 @@ export async function loadWorkerRuntimeAsset(asset) {
|
|
|
531
550
|
}
|
|
532
551
|
return await loadTrackedAsset(assetUrl);
|
|
533
552
|
}
|
|
553
|
+
export function hasWorkerRuntimeModuleBridge() {
|
|
554
|
+
return activeConfig?.useAssetBridge === true || activeConfig?.useModuleBridge === true;
|
|
555
|
+
}
|
|
556
|
+
export async function loadWorkerRuntimeModule(asset) {
|
|
557
|
+
if (!hasWorkerRuntimeModuleBridge())
|
|
558
|
+
throw new Error('Runtime module bridge unavailable');
|
|
559
|
+
const assetUrl = trackedAssetUrl(asset);
|
|
560
|
+
if (!assetUrl || !isTrackedAssetUrl(assetUrl)) {
|
|
561
|
+
throw new Error('Untracked runtime module request');
|
|
562
|
+
}
|
|
563
|
+
const id = ++nextAssetRequestId;
|
|
564
|
+
return await new Promise((resolve, reject) => {
|
|
565
|
+
pendingModuleRequests.set(id, { resolve, reject });
|
|
566
|
+
try {
|
|
567
|
+
self.postMessage({ assetRequest: { id, asset, module: true } });
|
|
568
|
+
}
|
|
569
|
+
catch (error) {
|
|
570
|
+
pendingModuleRequests.delete(id);
|
|
571
|
+
reject(error);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BrowserClangRuntime, loadRuntimeManifest, resolveRuntimeManifestUrl } from '@wasm-idle/llvm-core/clang';
|
|
2
|
+
import { configureWorkerRuntimeAssets, handleWorkerAssetMessage } from './assets';
|
|
3
|
+
import { compileWorkerRuntimeAsset } from './runtimeModule';
|
|
4
|
+
import { BUNDLED_CLANG_LANGUAGE_SYSROOT_PROFILES } from '../clangAssetIntegrity';
|
|
5
|
+
const worker = globalThis;
|
|
6
|
+
let started = false;
|
|
7
|
+
worker.onmessage = async ({ data }) => {
|
|
8
|
+
if (handleWorkerAssetMessage(data))
|
|
9
|
+
return;
|
|
10
|
+
if (started)
|
|
11
|
+
return;
|
|
12
|
+
started = true;
|
|
13
|
+
const output = [];
|
|
14
|
+
try {
|
|
15
|
+
if (data.request.debug || (data.request.debugMode && data.request.debugMode !== 'none')) {
|
|
16
|
+
throw new Error('Cached C/C++ execution does not support debug artifacts.');
|
|
17
|
+
}
|
|
18
|
+
configureWorkerRuntimeAssets(data.assets);
|
|
19
|
+
const manifest = await loadRuntimeManifest(resolveRuntimeManifestUrl(data.runtimeBaseUrl), fetch, undefined, data.maxAssetBytes);
|
|
20
|
+
if (data.languageSysroots)
|
|
21
|
+
manifest.compiler.sysroot.profiles = BUNDLED_CLANG_LANGUAGE_SYSROOT_PROFILES;
|
|
22
|
+
const moduleAssets = new Map([
|
|
23
|
+
[
|
|
24
|
+
manifest.compiler.clang.asset,
|
|
25
|
+
new URL(manifest.compiler.clang.asset, data.runtimeBaseUrl).href
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
manifest.compiler.lld.asset,
|
|
29
|
+
new URL(manifest.compiler.lld.asset, data.runtimeBaseUrl).href
|
|
30
|
+
]
|
|
31
|
+
].map(([asset, url]) => [url, asset]));
|
|
32
|
+
class CachedRuntime extends BrowserClangRuntime {
|
|
33
|
+
async getModule(url, progress, signal) {
|
|
34
|
+
const asset = moduleAssets.get(url);
|
|
35
|
+
if (!asset)
|
|
36
|
+
return super.getModule(url, progress, signal);
|
|
37
|
+
signal?.throwIfAborted();
|
|
38
|
+
const module = await compileWorkerRuntimeAsset(asset);
|
|
39
|
+
signal?.throwIfAborted();
|
|
40
|
+
progress?.set?.(1);
|
|
41
|
+
return module;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Every source cache miss gets fresh compiler memory and files. The host
|
|
45
|
+
// session keeps the immutable tool Modules and verified asset bytes alive.
|
|
46
|
+
const runtime = new CachedRuntime({
|
|
47
|
+
runtimeBaseUrl: data.runtimeBaseUrl,
|
|
48
|
+
maxAssetBytes: data.maxAssetBytes,
|
|
49
|
+
manifest,
|
|
50
|
+
log: data.log ?? false,
|
|
51
|
+
stdout: (chunk) => output.push(chunk),
|
|
52
|
+
progress: (value) => worker.postMessage({
|
|
53
|
+
type: 'progress',
|
|
54
|
+
progress: {
|
|
55
|
+
stage: 'bootstrap',
|
|
56
|
+
completed: Math.round(value * 100),
|
|
57
|
+
total: 100,
|
|
58
|
+
percent: value * 100,
|
|
59
|
+
message: 'Loading compiler runtime'
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
await runtime.ready;
|
|
64
|
+
worker.postMessage({
|
|
65
|
+
type: 'progress',
|
|
66
|
+
progress: {
|
|
67
|
+
stage: 'compile',
|
|
68
|
+
completed: 0,
|
|
69
|
+
total: 100,
|
|
70
|
+
percent: 0,
|
|
71
|
+
message: 'Compiling source'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const artifact = await runtime.compileArtifact(data.request.code, data.request);
|
|
75
|
+
worker.postMessage({ type: 'compiled', artifact, stdout: output.join(''), stderr: '' });
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
worker.postMessage({
|
|
79
|
+
type: 'error',
|
|
80
|
+
error: error instanceof Error ? error.message : String(error),
|
|
81
|
+
stdout: output.join(''),
|
|
82
|
+
stderr: ''
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { executeBrowserClangArtifact } from '@wasm-idle/llvm-core/clang';
|
|
2
|
+
import { CLANG_STDIN_DATA, CLANG_STDIN_EOF, CLANG_STDIN_HEADER_BYTES, CLANG_STDIN_WAITING } from '../clangWorkerProtocol';
|
|
3
|
+
const worker = globalThis;
|
|
4
|
+
worker.onmessage = async ({ data }) => {
|
|
5
|
+
worker.onmessage = null;
|
|
6
|
+
try {
|
|
7
|
+
const hasStaticInput = typeof data.stdin === 'string';
|
|
8
|
+
let staticInput = hasStaticInput ? new TextEncoder().encode(data.stdin) : null;
|
|
9
|
+
let reachedEof = false;
|
|
10
|
+
const control = hasStaticInput ? null : new Int32Array(data.inputBuffer, 0, 2);
|
|
11
|
+
const payload = hasStaticInput
|
|
12
|
+
? null
|
|
13
|
+
: new Uint8Array(data.inputBuffer, CLANG_STDIN_HEADER_BYTES);
|
|
14
|
+
if (payload && payload.byteLength === 0)
|
|
15
|
+
throw new Error('C/C++ stdin buffer is empty.');
|
|
16
|
+
const files = (data.workspaceFiles || []).map(({ path, content }) => ({
|
|
17
|
+
path,
|
|
18
|
+
contents: content
|
|
19
|
+
}));
|
|
20
|
+
if (data.code !== undefined) {
|
|
21
|
+
files.push({
|
|
22
|
+
path: data.activePath || (data.artifact.language === 'C' ? 'main.c' : 'main.cc'),
|
|
23
|
+
contents: data.code
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// The public executor creates a fresh WASI host, files, descriptors and Wasm
|
|
27
|
+
// instance. Only the immutable compiled Module is reused across executions.
|
|
28
|
+
const result = await executeBrowserClangArtifact(data.artifact, {
|
|
29
|
+
args: data.programArgs,
|
|
30
|
+
env: data.env,
|
|
31
|
+
files,
|
|
32
|
+
stdin: () => {
|
|
33
|
+
if (hasStaticInput) {
|
|
34
|
+
const next = staticInput;
|
|
35
|
+
staticInput = null;
|
|
36
|
+
return next?.byteLength ? next : null;
|
|
37
|
+
}
|
|
38
|
+
if (reachedEof)
|
|
39
|
+
return null;
|
|
40
|
+
Atomics.store(control, 0, CLANG_STDIN_WAITING);
|
|
41
|
+
worker.postMessage({ type: 'stdin' });
|
|
42
|
+
while (Atomics.load(control, 0) === CLANG_STDIN_WAITING) {
|
|
43
|
+
Atomics.wait(control, 0, CLANG_STDIN_WAITING);
|
|
44
|
+
}
|
|
45
|
+
const state = Atomics.load(control, 0);
|
|
46
|
+
if (state === CLANG_STDIN_EOF) {
|
|
47
|
+
reachedEof = true;
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const length = Atomics.load(control, 1);
|
|
51
|
+
if (state !== CLANG_STDIN_DATA || length < 0 || length > payload.byteLength) {
|
|
52
|
+
throw new Error('Invalid C/C++ stdin buffer response.');
|
|
53
|
+
}
|
|
54
|
+
return payload.slice(0, length);
|
|
55
|
+
},
|
|
56
|
+
stdout: (output) => worker.postMessage({ type: 'output', output }),
|
|
57
|
+
stderr: (output) => worker.postMessage({ type: 'output', output })
|
|
58
|
+
});
|
|
59
|
+
worker.postMessage({ type: 'done', exitCode: result.exitCode });
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
worker.postMessage({
|
|
63
|
+
type: 'error',
|
|
64
|
+
error: error instanceof Error ? error.message : String(error)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -30,9 +30,7 @@ async function loadClang(path, log, maxAssetBytes, verifiedStreaming = false, la
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
: manifest;
|
|
33
|
-
const Runtime = verifiedStreaming
|
|
34
|
-
? withVerifiedStreaming(BrowserClangRuntime, path, maxAssetBytes)
|
|
35
|
-
: BrowserClangRuntime;
|
|
33
|
+
const Runtime = withVerifiedStreaming(BrowserClangRuntime, path, maxAssetBytes, verifiedStreaming);
|
|
36
34
|
clang = new Runtime({
|
|
37
35
|
stdout: (output) => postMessage({ output }),
|
|
38
36
|
onDebugEvent: (debugEvent) => postMessage({ debugEvent }),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BrowserClangRuntime } from '@wasm-idle/llvm-core/clang';
|
|
2
2
|
/** Application-only adapter. The host opts in only for the built-in trust profile. */
|
|
3
|
-
export declare function withVerifiedStreaming(Runtime: typeof BrowserClangRuntime, baseUrl: string, maxAssetBytes?: number): typeof BrowserClangRuntime;
|
|
3
|
+
export declare function withVerifiedStreaming(Runtime: typeof BrowserClangRuntime, baseUrl: string, maxAssetBytes?: number, verifiedStreaming?: boolean): typeof BrowserClangRuntime;
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { compileVerifiedWasmAsset } from '@wasm-idle/llvm-core/core/verified-wasm';
|
|
2
2
|
import { BUNDLED_CLANG_ASSET_INTEGRITY } from '../clangAssetIntegrity';
|
|
3
|
+
import { hasWorkerRuntimeModuleBridge } from './assets';
|
|
4
|
+
import { compileWorkerRuntimeAsset } from './runtimeModule';
|
|
3
5
|
// Capture before configureWorkerRuntimeAssets installs its whole-buffer fetch shim.
|
|
4
6
|
const nativeFetch = globalThis.fetch?.bind(globalThis);
|
|
5
7
|
const toolNames = ['bin/clang.wasm.gz', 'bin/lld.wasm.gz'];
|
|
6
8
|
/** Application-only adapter. The host opts in only for the built-in trust profile. */
|
|
7
|
-
export function withVerifiedStreaming(Runtime, baseUrl, maxAssetBytes = 128 * 1024 * 1024) {
|
|
8
|
-
|
|
9
|
+
export function withVerifiedStreaming(Runtime, baseUrl, maxAssetBytes = 128 * 1024 * 1024, verifiedStreaming = true) {
|
|
10
|
+
const bridgeModules = hasWorkerRuntimeModuleBridge();
|
|
11
|
+
if (!bridgeModules &&
|
|
12
|
+
(!verifiedStreaming ||
|
|
13
|
+
!nativeFetch ||
|
|
14
|
+
!globalThis.crypto?.subtle ||
|
|
15
|
+
typeof DecompressionStream !== 'function'))
|
|
9
16
|
return Runtime;
|
|
10
17
|
const urls = new Map(toolNames.map((name) => [new URL(name, baseUrl).href, name]));
|
|
11
18
|
// Scope the two immutable tool modules to this one runtime construction, not globals.
|
|
12
19
|
const loads = new Map();
|
|
13
20
|
return class extends Runtime {
|
|
14
21
|
async getModule(url, progress, signal) {
|
|
22
|
+
if (bridgeModules) {
|
|
23
|
+
const root = new URL(baseUrl);
|
|
24
|
+
const target = new URL(url, root);
|
|
25
|
+
if (target.origin === root.origin && target.pathname.startsWith(root.pathname)) {
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
const module = await compileWorkerRuntimeAsset(`${target.pathname.slice(root.pathname.length)}${target.search}`);
|
|
28
|
+
signal?.throwIfAborted();
|
|
29
|
+
progress?.set?.(1);
|
|
30
|
+
return module;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
15
33
|
const name = urls.get(url);
|
|
16
34
|
if (!name)
|
|
17
35
|
return super.getModule(url, progress, signal);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { flushQueuedStdin, readBufferedStdin, waitForBufferedStdin } from '../stdinBuffer';
|
|
2
2
|
import { isSharedBufferBackedView } from '../sharedBuffer';
|
|
3
3
|
import { parsePythonPackageLock } from '../pythonPackageLock';
|
|
4
|
+
import { withCachedPyodideModule } from './runtimeModule';
|
|
4
5
|
import { configureWorkerRuntimeAssetAllowlist, configureWorkerRuntimeAssets, handleWorkerAssetMessage, loadWorkerRuntimeAsset } from './assets';
|
|
5
6
|
self.document = {
|
|
6
7
|
querySelector() {
|
|
@@ -215,11 +216,11 @@ async function loadPyodide(path) {
|
|
|
215
216
|
lockFileContents = parsedLock.lock;
|
|
216
217
|
}
|
|
217
218
|
const { loadPyodide } = runtimeModule;
|
|
218
|
-
pyodide = await loadPyodide({
|
|
219
|
+
pyodide = await withCachedPyodideModule(runtimeBaseUrl, () => loadPyodide({
|
|
219
220
|
indexURL: path,
|
|
220
221
|
packageBaseUrl,
|
|
221
222
|
...(lockFileContents ? { lockFileContents } : {})
|
|
222
|
-
});
|
|
223
|
+
}));
|
|
223
224
|
}
|
|
224
225
|
async function loadPackages(code) {
|
|
225
226
|
if (!code)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The host compiles trusted runtime assets; workers never populate the shared module cache. */
|
|
2
|
+
export declare function compileWorkerRuntimeAsset(asset: string): Promise<WebAssembly.Module>;
|
|
3
|
+
/**
|
|
4
|
+
* Pyodide 0.29.3 creates its own instantiateWasm hook, including its sentinel imports.
|
|
5
|
+
* Intercept only the exact bootstrap fetch/Response during initialization so those imports
|
|
6
|
+
* remain intact. Other Wasm (including the sentinel) and all package fetches are untouched.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withCachedPyodideModule<T>(baseUrl: string, initialize: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { decompressGzip } from '@wasm-idle/llvm-core';
|
|
2
|
+
import { hasWorkerRuntimeModuleBridge, loadWorkerRuntimeAsset, loadWorkerRuntimeModule } from './assets';
|
|
3
|
+
/** The host compiles trusted runtime assets; workers never populate the shared module cache. */
|
|
4
|
+
export async function compileWorkerRuntimeAsset(asset) {
|
|
5
|
+
if (hasWorkerRuntimeModuleBridge())
|
|
6
|
+
return await loadWorkerRuntimeModule(asset);
|
|
7
|
+
const { bytes } = await loadWorkerRuntimeAsset(asset);
|
|
8
|
+
const wasm = bytes[0] === 0x1f && bytes[1] === 0x8b ? await decompressGzip(bytes) : bytes;
|
|
9
|
+
return await WebAssembly.compile(wasm.slice().buffer);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pyodide 0.29.3 creates its own instantiateWasm hook, including its sentinel imports.
|
|
13
|
+
* Intercept only the exact bootstrap fetch/Response during initialization so those imports
|
|
14
|
+
* remain intact. Other Wasm (including the sentinel) and all package fetches are untouched.
|
|
15
|
+
*/
|
|
16
|
+
export async function withCachedPyodideModule(baseUrl, initialize) {
|
|
17
|
+
const runtimeUrl = new URL('pyodide.asm.wasm', baseUrl).href;
|
|
18
|
+
// Compile before entering Pyodide, whose bootstrap catches instantiation failures internally.
|
|
19
|
+
const module = await compileWorkerRuntimeAsset('pyodide.asm.wasm');
|
|
20
|
+
const previousFetch = globalThis.fetch;
|
|
21
|
+
const previousInstantiateStreaming = WebAssembly.instantiateStreaming;
|
|
22
|
+
const responses = new WeakSet();
|
|
23
|
+
const fetchRuntime = async (input, init) => {
|
|
24
|
+
const url = input instanceof Request ? input.url : new URL(String(input), baseUrl).href;
|
|
25
|
+
if (url !== runtimeUrl)
|
|
26
|
+
return await previousFetch(input, init);
|
|
27
|
+
const response = new Response(null, { headers: { 'content-type': 'application/wasm' } });
|
|
28
|
+
responses.add(response);
|
|
29
|
+
return response;
|
|
30
|
+
};
|
|
31
|
+
const instantiateRuntime = async (source, imports) => {
|
|
32
|
+
const response = await source;
|
|
33
|
+
if (!responses.has(response))
|
|
34
|
+
return await previousInstantiateStreaming(response, imports);
|
|
35
|
+
return { module, instance: await WebAssembly.instantiate(module, imports) };
|
|
36
|
+
};
|
|
37
|
+
globalThis.fetch = fetchRuntime;
|
|
38
|
+
WebAssembly.instantiateStreaming = instantiateRuntime;
|
|
39
|
+
try {
|
|
40
|
+
return await initialize();
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
if (globalThis.fetch === fetchRuntime)
|
|
44
|
+
globalThis.fetch = previousFetch;
|
|
45
|
+
if (WebAssembly.instantiateStreaming === instantiateRuntime) {
|
|
46
|
+
WebAssembly.instantiateStreaming = previousInstantiateStreaming;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasm-idle",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "A simple web app to run code in the browser",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"vitest": "^4.1.4",
|
|
62
62
|
"waforth": "0.20.1",
|
|
63
63
|
"webr": "0.6.0",
|
|
64
|
-
"@wasm-idle/
|
|
65
|
-
"@wasm-idle/
|
|
66
|
-
"@wasm-idle/
|
|
64
|
+
"@wasm-idle/lsp": "1.0.6",
|
|
65
|
+
"@wasm-idle/terminal": "1.0.6",
|
|
66
|
+
"@wasm-idle/debug": "1.0.6"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@bjorn3/browser_wasi_shim": "^0.4.2",
|
|
70
70
|
"fflate": "0.8.3",
|
|
71
|
-
"@wasm-idle/core": "1.0.
|
|
72
|
-
"@wasm-idle/llvm-core": "1.0.
|
|
71
|
+
"@wasm-idle/core": "1.0.6",
|
|
72
|
+
"@wasm-idle/llvm-core": "1.0.6"
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
"dist",
|