wasm-idle 1.0.0 → 1.0.4
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 +46 -5
- package/dist/index.d.ts +1 -0
- package/dist/playground/applicationAssets.js +4 -1
- package/dist/playground/assetBridge.d.ts +6 -5
- package/dist/playground/assetBridge.js +85 -9
- package/dist/playground/assets.d.ts +7 -0
- package/dist/playground/assets.js +11 -0
- package/dist/playground/clang.js +10 -3
- package/dist/playground/clangAssetIntegrity.d.ts +26 -0
- package/dist/playground/clangAssetIntegrity.js +10 -3
- package/dist/playground/clangStreamingPolicy.d.ts +6 -0
- package/dist/playground/clangStreamingPolicy.js +7 -0
- package/dist/playground/dotnet.js +2 -1
- package/dist/playground/index.d.ts +2 -1
- package/dist/playground/index.js +2 -2
- package/dist/playground/java.js +8 -2
- package/dist/playground/loadingProgress.js +2 -1
- package/dist/playground/ruby.js +52 -30
- package/dist/playground/rubyAssets.d.ts +4 -4
- package/dist/playground/rubyAssets.js +10 -3
- package/dist/playground/sandbox.d.ts +4 -0
- package/dist/playground/staticRuntimeModuleVersion.d.ts +1 -1
- package/dist/playground/staticRuntimeModuleVersion.js +1 -1
- package/dist/playground/typescript.js +18 -5
- package/dist/playground/wasmDotnetVersion.d.ts +1 -1
- package/dist/playground/wasmDotnetVersion.js +1 -1
- package/dist/playground/wasmGoVersion.d.ts +1 -1
- package/dist/playground/wasmGoVersion.js +1 -1
- package/dist/playground/wasmRustVersion.d.ts +66 -12
- package/dist/playground/wasmRustVersion.js +71 -11
- package/dist/playground/wasmTypeScriptVersion.d.ts +7 -3
- package/dist/playground/wasmTypeScriptVersion.js +7 -3
- package/dist/playground/worker/assets.js +34 -7
- package/dist/playground/worker/boundedAssetResponse.d.ts +14 -0
- package/dist/playground/worker/boundedAssetResponse.js +148 -0
- package/dist/playground/worker/clang.js +21 -4
- package/dist/playground/worker/clangStreaming.d.ts +3 -0
- package/dist/playground/worker/clangStreaming.js +41 -0
- package/dist/playground/worker/dotnet.js +2 -0
- package/dist/playground/worker/java.js +55 -20
- package/dist/playground/worker/javaStreaming.d.ts +9 -0
- package/dist/playground/worker/javaStreaming.js +99 -0
- package/dist/playground/worker/php.js +52 -12
- package/dist/playground/worker/python.js +37 -9
- package/dist/playground/worker/ruby.js +207 -56
- package/package.json +9 -7
|
@@ -125,7 +125,8 @@ export function createLoadingProgressController({ onChange }) {
|
|
|
125
125
|
measurementValue = Math.max(measurementValue, measurement.completed / measurement.total);
|
|
126
126
|
state = {
|
|
127
127
|
visible: true,
|
|
128
|
-
|
|
128
|
+
// Keep one visible label monotonic when an estimate preceded its first byte sample.
|
|
129
|
+
value: Math.max(measurementValue, state.stage === event.label ? state.value : 0),
|
|
129
130
|
stage: event.label,
|
|
130
131
|
indeterminate: false
|
|
131
132
|
};
|
package/dist/playground/ruby.js
CHANGED
|
@@ -252,6 +252,7 @@ class Ruby {
|
|
|
252
252
|
}
|
|
253
253
|
let limits;
|
|
254
254
|
let nextConfig;
|
|
255
|
+
let startupContext;
|
|
255
256
|
let nextAssetKey;
|
|
256
257
|
let signal;
|
|
257
258
|
let unbindPreSessionAbort = () => undefined;
|
|
@@ -265,39 +266,59 @@ class Ruby {
|
|
|
265
266
|
if (!this.isOperationActive(activeOperation) || signal?.aborted) {
|
|
266
267
|
return Promise.reject(this.releaseBeforeSession(activeOperation, 'Ruby runtime startup cancelled'));
|
|
267
268
|
}
|
|
269
|
+
const workspace = validateExecutionWorkspace(_code, options.workspaceFiles ?? [], options.activePath ?? 'main.rb', {
|
|
270
|
+
...options.workspaceLimits,
|
|
271
|
+
maxFileBytes: Math.min(options.workspaceLimits?.maxFileBytes ??
|
|
272
|
+
DEFAULT_WORKSPACE_LIMITS.maxFileBytes, limits.maxWorkspaceBytes),
|
|
273
|
+
maxTotalBytes: Math.min(options.workspaceLimits?.maxTotalBytes ??
|
|
274
|
+
DEFAULT_WORKSPACE_LIMITS.maxTotalBytes, limits.maxWorkspaceBytes)
|
|
275
|
+
});
|
|
276
|
+
startupContext = {
|
|
277
|
+
args: [...resolveSandboxExecutionArgs('RUBY', _args, options).programArgs],
|
|
278
|
+
activePath: workspace.activePath ?? 'main.rb',
|
|
279
|
+
workspaceFiles: workspace.workspaceFiles.map((file) => ({
|
|
280
|
+
path: file.path,
|
|
281
|
+
content: file.content
|
|
282
|
+
}))
|
|
283
|
+
};
|
|
284
|
+
if (!this.isOperationActive(activeOperation) || signal?.aborted) {
|
|
285
|
+
return Promise.reject(this.releaseBeforeSession(activeOperation, 'Ruby runtime startup cancelled'));
|
|
286
|
+
}
|
|
268
287
|
const currentUrl = typeof window !== 'undefined' ? window.location.href : '';
|
|
269
288
|
nextConfig = resolveRubyRuntimeAssetConfig(runtimeAssets, currentUrl);
|
|
270
289
|
const effectiveMaxAssetBytes = Math.min(limits.maxAssetBytes, RUBY_MAX_ASSET_BYTES);
|
|
271
|
-
|
|
272
|
-
[
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
290
|
+
if (!nextConfig.splitStdlib) {
|
|
291
|
+
for (const [label, bytes, limit] of [
|
|
292
|
+
[
|
|
293
|
+
'manifest',
|
|
294
|
+
nextConfig.preflightProfile.manifestReceipt.bytes,
|
|
295
|
+
Math.min(effectiveMaxAssetBytes, RUBY_MAX_MANIFEST_BYTES)
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
'module JavaScript',
|
|
299
|
+
nextConfig.preflightProfile.moduleJavaScriptReceipt.bytes,
|
|
300
|
+
Math.min(effectiveMaxAssetBytes, RUBY_MAX_MODULE_BYTES)
|
|
301
|
+
],
|
|
302
|
+
[
|
|
303
|
+
'Wasm storage',
|
|
304
|
+
nextConfig.preflightProfile.wasmReceipt.bytes,
|
|
305
|
+
effectiveMaxAssetBytes
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
'Wasm logical',
|
|
309
|
+
nextConfig.preflightProfile.wasmReceipt.uncompressedBytes,
|
|
310
|
+
effectiveMaxAssetBytes
|
|
311
|
+
]
|
|
312
|
+
]) {
|
|
313
|
+
if ((bytes ?? 0) > limit) {
|
|
314
|
+
throw new AssetTooLargeError(`Ruby runtime ${label} exceeds the ${limit} byte limit`, {
|
|
315
|
+
actual: bytes,
|
|
316
|
+
limit,
|
|
317
|
+
phase: 'asset',
|
|
318
|
+
profileId: nextConfig.preflightProfile.profileId,
|
|
319
|
+
runtimeId: 'RUBY'
|
|
320
|
+
});
|
|
321
|
+
}
|
|
301
322
|
}
|
|
302
323
|
}
|
|
303
324
|
nextAssetKey = JSON.stringify([nextConfig.preflightKey, effectiveMaxAssetBytes]);
|
|
@@ -418,6 +439,7 @@ class Ruby {
|
|
|
418
439
|
worker.postMessage({
|
|
419
440
|
load: true,
|
|
420
441
|
runtimePreflight: delivery.payload,
|
|
442
|
+
startupContext,
|
|
421
443
|
maxAssetBytes: Math.min(limits.maxAssetBytes, RUBY_MAX_ASSET_BYTES)
|
|
422
444
|
}, [...transferables]);
|
|
423
445
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedRubyRuntimeAssetConfig } from './assets';
|
|
2
|
-
import { type ExecutionLimits, type RubyRuntimePreflightPayload, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
2
|
+
import { type RubySplitPayload, type ExecutionLimits, type RubyRuntimePreflightPayload, type RuntimeAssetPreflightProgress } from '@wasm-idle/core';
|
|
3
3
|
export interface RubyRuntimePreflightOptions {
|
|
4
4
|
readonly limits?: Partial<ExecutionLimits>;
|
|
5
5
|
readonly signal?: AbortSignal;
|
|
@@ -9,9 +9,9 @@ export interface RubyRuntimePreflightOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export type RubyRuntimePreflightDeliveryState = 'available' | 'consumed' | 'retired';
|
|
11
11
|
export interface RubyRuntimeOwnedPreflightDelivery {
|
|
12
|
-
readonly payload: RubyRuntimePreflightPayload;
|
|
12
|
+
readonly payload: RubyRuntimePreflightPayload | RubySplitPayload;
|
|
13
13
|
readonly state: RubyRuntimePreflightDeliveryState;
|
|
14
|
-
consume(): readonly [
|
|
14
|
+
consume(): readonly ArrayBuffer[];
|
|
15
15
|
retire(): void;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -20,4 +20,4 @@ export interface RubyRuntimeOwnedPreflightDelivery {
|
|
|
20
20
|
* whether postMessage succeeds; a consumed or retired delivery cannot be reused.
|
|
21
21
|
*/
|
|
22
22
|
export declare function createRubyRuntimeOwnedPreflightDelivery(value: unknown): RubyRuntimeOwnedPreflightDelivery;
|
|
23
|
-
export declare function preflightVerifiedRubyRuntimeAssets(config: ResolvedRubyRuntimeAssetConfig, options?: RubyRuntimePreflightOptions): Promise<RubyRuntimePreflightPayload>;
|
|
23
|
+
export declare function preflightVerifiedRubyRuntimeAssets(config: ResolvedRubyRuntimeAssetConfig, options?: RubyRuntimePreflightOptions): Promise<RubyRuntimePreflightPayload | RubySplitPayload>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { preflightRubyRuntimeAssets, requireRubyRuntimePreflightPayload } from '@wasm-idle/core';
|
|
1
|
+
import { preflightRubyRuntimeAssets, preflightRubySplitRuntimeAssets, RUBY_SPLIT_PROTOCOL, requireRubySplitPayload, requireRubyRuntimePreflightPayload } from '@wasm-idle/core';
|
|
2
2
|
function isPlainFrozenRecord(value) {
|
|
3
3
|
if (!value || typeof value !== 'object' || Array.isArray(value) || !Object.isFrozen(value)) {
|
|
4
4
|
return false;
|
|
@@ -24,11 +24,16 @@ export function createRubyRuntimeOwnedPreflightDelivery(value) {
|
|
|
24
24
|
if (!isPlainFrozenRecord(value)) {
|
|
25
25
|
throw new TypeError('Ruby runtime preflight delivery requires one frozen plain payload');
|
|
26
26
|
}
|
|
27
|
-
const payload =
|
|
27
|
+
const payload = Object.getOwnPropertyDescriptor(value, 'protocol')?.value === RUBY_SPLIT_PROTOCOL
|
|
28
|
+
? requireRubySplitPayload(value)
|
|
29
|
+
: requireRubyRuntimePreflightPayload(value);
|
|
28
30
|
const transferables = [
|
|
29
31
|
requireOwnedWholeBuffer(payload.manifestBytes, 'manifest bytes'),
|
|
30
32
|
requireOwnedWholeBuffer(payload.moduleJavaScriptBytes, 'module JavaScript bytes'),
|
|
31
|
-
requireOwnedWholeBuffer(payload.wasmBytes, 'Wasm bytes')
|
|
33
|
+
requireOwnedWholeBuffer(payload.wasmBytes, 'Wasm bytes'),
|
|
34
|
+
...('stdlibBytes' in payload
|
|
35
|
+
? [requireOwnedWholeBuffer(payload.stdlibBytes, 'stdlib bytes')]
|
|
36
|
+
: [])
|
|
32
37
|
];
|
|
33
38
|
if (new Set(transferables).size !== transferables.length) {
|
|
34
39
|
throw new TypeError('Ruby runtime preflight byte buffers must have unique ownership');
|
|
@@ -53,6 +58,8 @@ export function createRubyRuntimeOwnedPreflightDelivery(value) {
|
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
60
|
export async function preflightVerifiedRubyRuntimeAssets(config, options = {}) {
|
|
61
|
+
if (config.splitStdlib)
|
|
62
|
+
return await preflightRubySplitRuntimeAssets({ baseUrl: config.baseUrl, ...options });
|
|
56
63
|
return await preflightRubyRuntimeAssets({
|
|
57
64
|
baseUrl: config.baseUrl,
|
|
58
65
|
manifestUrl: config.manifestUrl,
|
|
@@ -45,4 +45,8 @@ export interface PlaygroundBinding {
|
|
|
45
45
|
runtimeAssets: SandboxRuntimeAssets;
|
|
46
46
|
terminalProps: PlaygroundTerminalProps;
|
|
47
47
|
load: (language: string) => Promise<BoundSandbox>;
|
|
48
|
+
prewarm?: (language: string) => Promise<boolean>;
|
|
49
|
+
setPrewarmEnabled?: (enabled: boolean) => Promise<void>;
|
|
50
|
+
cancelPrewarm?: () => Promise<void>;
|
|
51
|
+
dispose?: () => Promise<void>;
|
|
48
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const STATIC_RUNTIME_MODULE_VERSION = "
|
|
1
|
+
export declare const STATIC_RUNTIME_MODULE_VERSION = "14728c1583cce316";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/build-static-runtime-modules.mjs.
|
|
2
|
-
export const STATIC_RUNTIME_MODULE_VERSION = '
|
|
2
|
+
export const STATIC_RUNTIME_MODULE_VERSION = '14728c1583cce316';
|
|
@@ -3,7 +3,7 @@ import { AssetTooLargeError, BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS
|
|
|
3
3
|
import {} from './options';
|
|
4
4
|
import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
|
|
5
5
|
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
6
|
-
import { WASM_TYPESCRIPT_MODULE_RECEIPT } from './wasmTypeScriptVersion';
|
|
6
|
+
import { WASM_TYPESCRIPT_MODULE_RECEIPT, WASM_JAVASCRIPT_MODULE_RECEIPT } from './wasmTypeScriptVersion';
|
|
7
7
|
import { WorkerSession } from './workerSession';
|
|
8
8
|
import { reportWorkerInputReady, reportWorkerProgress } from './workerProgress';
|
|
9
9
|
const OUTPUT_ENCODER = new TextEncoder();
|
|
@@ -311,6 +311,7 @@ class TypeScriptSandbox {
|
|
|
311
311
|
let signal;
|
|
312
312
|
let limits;
|
|
313
313
|
let nextModuleUrl;
|
|
314
|
+
let moduleReceipt = WASM_TYPESCRIPT_MODULE_RECEIPT;
|
|
314
315
|
let progressTarget;
|
|
315
316
|
let progressSet;
|
|
316
317
|
let unbindPreSessionAbort = () => undefined;
|
|
@@ -328,7 +329,19 @@ class TypeScriptSandbox {
|
|
|
328
329
|
if (typeof runtimeAssets === 'object' && runtimeAssets !== null) {
|
|
329
330
|
const configuredTypeScript = runtimeAssets.typescript;
|
|
330
331
|
this.requireOperationActive(activeOperation);
|
|
331
|
-
const
|
|
332
|
+
const javascriptModuleUrl = this.language === 'JAVASCRIPT'
|
|
333
|
+
? configuredTypeScript?.javascriptModuleUrl
|
|
334
|
+
: undefined;
|
|
335
|
+
this.requireOperationActive(activeOperation);
|
|
336
|
+
if (javascriptModuleUrl !== undefined && typeof javascriptModuleUrl !== 'string') {
|
|
337
|
+
throw new TypeError('JavaScript runtime module URL must be a string');
|
|
338
|
+
}
|
|
339
|
+
const useJavascriptEntry = Boolean(javascriptModuleUrl);
|
|
340
|
+
const configuredModuleUrl = useJavascriptEntry
|
|
341
|
+
? javascriptModuleUrl
|
|
342
|
+
: configuredTypeScript?.moduleUrl;
|
|
343
|
+
if (useJavascriptEntry)
|
|
344
|
+
moduleReceipt = WASM_JAVASCRIPT_MODULE_RECEIPT;
|
|
332
345
|
this.requireOperationActive(activeOperation);
|
|
333
346
|
if (configuredModuleUrl !== undefined && typeof configuredModuleUrl !== 'string') {
|
|
334
347
|
throw new TypeError(`${this.languageLabel} runtime module URL must be a string`);
|
|
@@ -349,11 +362,11 @@ class TypeScriptSandbox {
|
|
|
349
362
|
nextModuleUrl = resolveTypeScriptModuleUrl(runtimeAssets, currentUrl);
|
|
350
363
|
this.requireOperationActive(activeOperation);
|
|
351
364
|
}
|
|
352
|
-
if (
|
|
365
|
+
if (moduleReceipt.bytes > limits.maxAssetBytes) {
|
|
353
366
|
throw new AssetTooLargeError(`${this.languageLabel} runtime module exceeds the ${limits.maxAssetBytes} byte limit`, {
|
|
354
367
|
runtimeId: this.language,
|
|
355
368
|
limit: limits.maxAssetBytes,
|
|
356
|
-
actual:
|
|
369
|
+
actual: moduleReceipt.bytes
|
|
357
370
|
});
|
|
358
371
|
}
|
|
359
372
|
progressTarget = progress;
|
|
@@ -465,7 +478,7 @@ class TypeScriptSandbox {
|
|
|
465
478
|
worker.postMessage({
|
|
466
479
|
load: true,
|
|
467
480
|
moduleUrl: nextModuleUrl,
|
|
468
|
-
moduleReceipt: { ...
|
|
481
|
+
moduleReceipt: { ...moduleReceipt },
|
|
469
482
|
maxAssetBytes: limits.maxAssetBytes
|
|
470
483
|
});
|
|
471
484
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WASM_DOTNET_ASSET_VERSION = "
|
|
1
|
+
export declare const WASM_DOTNET_ASSET_VERSION = "8f1f986689faf541";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WASM_DOTNET_ASSET_VERSION = '
|
|
1
|
+
export const WASM_DOTNET_ASSET_VERSION = '8f1f986689faf541';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WASM_GO_ASSET_VERSION = "
|
|
1
|
+
export declare const WASM_GO_ASSET_VERSION = "ec36de55be7334e4";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WASM_GO_ASSET_VERSION = '
|
|
1
|
+
export const WASM_GO_ASSET_VERSION = 'ec36de55be7334e4';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const WASM_RUST_RUNTIME_PROFILE: Readonly<{
|
|
2
|
-
readonly profileId: "wasm-rust-
|
|
2
|
+
readonly profileId: "wasm-rust-b9d5b748f2d5e53045ef55890676e8ecb81a8ea07a31dfd20e70888c807bf9a6";
|
|
3
3
|
readonly protocolVersion: 1;
|
|
4
4
|
readonly manifestPath: "runtime/runtime-manifest.v3.json";
|
|
5
|
-
readonly manifestFingerprint: "
|
|
5
|
+
readonly manifestFingerprint: "b9d5b748f2d5e53045ef55890676e8ecb81a8ea07a31dfd20e70888c807bf9a6";
|
|
6
6
|
readonly manifestReceipt: {
|
|
7
7
|
readonly bytes: 6185;
|
|
8
8
|
readonly sha256: "30b210003632395a1effd19f7a46565d5f8c52a9d3a28a310fa24219f97a5a9a";
|
|
@@ -383,12 +383,12 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
383
383
|
readonly encoding: "identity";
|
|
384
384
|
};
|
|
385
385
|
readonly storage: {
|
|
386
|
-
readonly bytes:
|
|
387
|
-
readonly sha256: "
|
|
386
|
+
readonly bytes: 21605;
|
|
387
|
+
readonly sha256: "19dd922fd7493a80cb46e9113368376dd8ffce32282d433caaaaebae4d5388f4";
|
|
388
388
|
};
|
|
389
389
|
readonly logical: {
|
|
390
|
-
readonly bytes:
|
|
391
|
-
readonly sha256: "
|
|
390
|
+
readonly bytes: 21605;
|
|
391
|
+
readonly sha256: "19dd922fd7493a80cb46e9113368376dd8ffce32282d433caaaaebae4d5388f4";
|
|
392
392
|
};
|
|
393
393
|
readonly imports: readonly [{
|
|
394
394
|
readonly kind: "static";
|
|
@@ -422,6 +422,14 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
422
422
|
readonly kind: "static";
|
|
423
423
|
readonly specifier: "./runtime-manifest.js";
|
|
424
424
|
readonly target: "runtime-manifest.js";
|
|
425
|
+
}, {
|
|
426
|
+
readonly kind: "static";
|
|
427
|
+
readonly specifier: "./rustc-module-service.js";
|
|
428
|
+
readonly target: "rustc-module-service.js";
|
|
429
|
+
}, {
|
|
430
|
+
readonly kind: "static";
|
|
431
|
+
readonly specifier: "./rustc-module.js";
|
|
432
|
+
readonly target: "rustc-module.js";
|
|
425
433
|
}, {
|
|
426
434
|
readonly kind: "static";
|
|
427
435
|
readonly specifier: "./rustc-runtime.js";
|
|
@@ -448,12 +456,12 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
448
456
|
readonly encoding: "identity";
|
|
449
457
|
};
|
|
450
458
|
readonly storage: {
|
|
451
|
-
readonly bytes:
|
|
452
|
-
readonly sha256: "
|
|
459
|
+
readonly bytes: 33998;
|
|
460
|
+
readonly sha256: "0a6c0bc4483c00265a7ecc228faa5f4252831b5953f0a9a00a685d8fcf4f0825";
|
|
453
461
|
};
|
|
454
462
|
readonly logical: {
|
|
455
|
-
readonly bytes:
|
|
456
|
-
readonly sha256: "
|
|
463
|
+
readonly bytes: 33998;
|
|
464
|
+
readonly sha256: "0a6c0bc4483c00265a7ecc228faa5f4252831b5953f0a9a00a685d8fcf4f0825";
|
|
457
465
|
};
|
|
458
466
|
readonly imports: readonly [{
|
|
459
467
|
readonly kind: "static";
|
|
@@ -491,6 +499,10 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
491
499
|
readonly kind: "static";
|
|
492
500
|
readonly specifier: "./runtime-manifest.js";
|
|
493
501
|
readonly target: "runtime-manifest.js";
|
|
502
|
+
}, {
|
|
503
|
+
readonly kind: "static";
|
|
504
|
+
readonly specifier: "./rustc-module-service.js";
|
|
505
|
+
readonly target: "rustc-module-service.js";
|
|
494
506
|
}, {
|
|
495
507
|
readonly kind: "static";
|
|
496
508
|
readonly specifier: "./rustc-runtime.js";
|
|
@@ -662,6 +674,48 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
662
674
|
readonly assets: readonly [];
|
|
663
675
|
readonly externals: readonly [];
|
|
664
676
|
};
|
|
677
|
+
readonly 'rustc-module-service.js': {
|
|
678
|
+
readonly delivery: {
|
|
679
|
+
readonly storagePath: "rustc-module-service.js.bin";
|
|
680
|
+
readonly encoding: "identity";
|
|
681
|
+
};
|
|
682
|
+
readonly storage: {
|
|
683
|
+
readonly bytes: 4926;
|
|
684
|
+
readonly sha256: "643e87810870eadb9489f4161f2132a158e37c1e343426c58e04e3482e1d7045";
|
|
685
|
+
};
|
|
686
|
+
readonly logical: {
|
|
687
|
+
readonly bytes: 4926;
|
|
688
|
+
readonly sha256: "643e87810870eadb9489f4161f2132a158e37c1e343426c58e04e3482e1d7045";
|
|
689
|
+
};
|
|
690
|
+
readonly imports: readonly [{
|
|
691
|
+
readonly kind: "static";
|
|
692
|
+
readonly specifier: "./runtime-asset.js";
|
|
693
|
+
readonly target: "runtime-asset.js";
|
|
694
|
+
}, {
|
|
695
|
+
readonly kind: "static";
|
|
696
|
+
readonly specifier: "./rustc-module.js";
|
|
697
|
+
readonly target: "rustc-module.js";
|
|
698
|
+
}];
|
|
699
|
+
readonly assets: readonly [];
|
|
700
|
+
readonly externals: readonly [];
|
|
701
|
+
};
|
|
702
|
+
readonly 'rustc-module.js': {
|
|
703
|
+
readonly delivery: {
|
|
704
|
+
readonly storagePath: "rustc-module.js.bin";
|
|
705
|
+
readonly encoding: "identity";
|
|
706
|
+
};
|
|
707
|
+
readonly storage: {
|
|
708
|
+
readonly bytes: 711;
|
|
709
|
+
readonly sha256: "81dee74032dd10187e9b576f2d2fe9291cee1ea6a829d0db37429dabd06c0d1e";
|
|
710
|
+
};
|
|
711
|
+
readonly logical: {
|
|
712
|
+
readonly bytes: 711;
|
|
713
|
+
readonly sha256: "81dee74032dd10187e9b576f2d2fe9291cee1ea6a829d0db37429dabd06c0d1e";
|
|
714
|
+
};
|
|
715
|
+
readonly imports: readonly [];
|
|
716
|
+
readonly assets: readonly [];
|
|
717
|
+
readonly externals: readonly [];
|
|
718
|
+
};
|
|
665
719
|
readonly 'rustc-runtime.js': {
|
|
666
720
|
readonly delivery: {
|
|
667
721
|
readonly storagePath: "rustc-runtime.js.bin";
|
|
@@ -1301,6 +1355,6 @@ export declare const WASM_RUST_EXECUTABLE_GRAPH_PROFILE: Readonly<{
|
|
|
1301
1355
|
readonly externals: readonly [];
|
|
1302
1356
|
};
|
|
1303
1357
|
};
|
|
1304
|
-
readonly fingerprint: "
|
|
1358
|
+
readonly fingerprint: "0c75869e3318fec8de28ba3732a65a4db9e92993cb517339fb729502e689f67f";
|
|
1305
1359
|
}>;
|
|
1306
|
-
export declare const WASM_RUST_ASSET_VERSION: "
|
|
1360
|
+
export declare const WASM_RUST_ASSET_VERSION: "b9d5b748f2d5e53045ef55890676e8ecb81a8ea07a31dfd20e70888c807bf9a6";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export const WASM_RUST_RUNTIME_PROFILE = Object.freeze({
|
|
2
|
-
profileId: 'wasm-rust-
|
|
2
|
+
profileId: 'wasm-rust-b9d5b748f2d5e53045ef55890676e8ecb81a8ea07a31dfd20e70888c807bf9a6',
|
|
3
3
|
protocolVersion: 1,
|
|
4
4
|
manifestPath: 'runtime/runtime-manifest.v3.json',
|
|
5
|
-
manifestFingerprint: '
|
|
5
|
+
manifestFingerprint: 'b9d5b748f2d5e53045ef55890676e8ecb81a8ea07a31dfd20e70888c807bf9a6',
|
|
6
6
|
manifestReceipt: {
|
|
7
7
|
bytes: 6185,
|
|
8
8
|
sha256: '30b210003632395a1effd19f7a46565d5f8c52a9d3a28a310fa24219f97a5a9a'
|
|
@@ -427,12 +427,12 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
427
427
|
encoding: 'identity'
|
|
428
428
|
},
|
|
429
429
|
storage: {
|
|
430
|
-
bytes:
|
|
431
|
-
sha256: '
|
|
430
|
+
bytes: 21605,
|
|
431
|
+
sha256: '19dd922fd7493a80cb46e9113368376dd8ffce32282d433caaaaebae4d5388f4'
|
|
432
432
|
},
|
|
433
433
|
logical: {
|
|
434
|
-
bytes:
|
|
435
|
-
sha256: '
|
|
434
|
+
bytes: 21605,
|
|
435
|
+
sha256: '19dd922fd7493a80cb46e9113368376dd8ffce32282d433caaaaebae4d5388f4'
|
|
436
436
|
},
|
|
437
437
|
imports: [
|
|
438
438
|
{
|
|
@@ -475,6 +475,16 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
475
475
|
specifier: './runtime-manifest.js',
|
|
476
476
|
target: 'runtime-manifest.js'
|
|
477
477
|
},
|
|
478
|
+
{
|
|
479
|
+
kind: 'static',
|
|
480
|
+
specifier: './rustc-module-service.js',
|
|
481
|
+
target: 'rustc-module-service.js'
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
kind: 'static',
|
|
485
|
+
specifier: './rustc-module.js',
|
|
486
|
+
target: 'rustc-module.js'
|
|
487
|
+
},
|
|
478
488
|
{
|
|
479
489
|
kind: 'static',
|
|
480
490
|
specifier: './rustc-runtime.js',
|
|
@@ -505,12 +515,12 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
505
515
|
encoding: 'identity'
|
|
506
516
|
},
|
|
507
517
|
storage: {
|
|
508
|
-
bytes:
|
|
509
|
-
sha256: '
|
|
518
|
+
bytes: 33998,
|
|
519
|
+
sha256: '0a6c0bc4483c00265a7ecc228faa5f4252831b5953f0a9a00a685d8fcf4f0825'
|
|
510
520
|
},
|
|
511
521
|
logical: {
|
|
512
|
-
bytes:
|
|
513
|
-
sha256: '
|
|
522
|
+
bytes: 33998,
|
|
523
|
+
sha256: '0a6c0bc4483c00265a7ecc228faa5f4252831b5953f0a9a00a685d8fcf4f0825'
|
|
514
524
|
},
|
|
515
525
|
imports: [
|
|
516
526
|
{
|
|
@@ -558,6 +568,11 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
558
568
|
specifier: './runtime-manifest.js',
|
|
559
569
|
target: 'runtime-manifest.js'
|
|
560
570
|
},
|
|
571
|
+
{
|
|
572
|
+
kind: 'static',
|
|
573
|
+
specifier: './rustc-module-service.js',
|
|
574
|
+
target: 'rustc-module-service.js'
|
|
575
|
+
},
|
|
561
576
|
{
|
|
562
577
|
kind: 'static',
|
|
563
578
|
specifier: './rustc-runtime.js',
|
|
@@ -745,6 +760,51 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
745
760
|
assets: [],
|
|
746
761
|
externals: []
|
|
747
762
|
},
|
|
763
|
+
'rustc-module-service.js': {
|
|
764
|
+
delivery: {
|
|
765
|
+
storagePath: 'rustc-module-service.js.bin',
|
|
766
|
+
encoding: 'identity'
|
|
767
|
+
},
|
|
768
|
+
storage: {
|
|
769
|
+
bytes: 4926,
|
|
770
|
+
sha256: '643e87810870eadb9489f4161f2132a158e37c1e343426c58e04e3482e1d7045'
|
|
771
|
+
},
|
|
772
|
+
logical: {
|
|
773
|
+
bytes: 4926,
|
|
774
|
+
sha256: '643e87810870eadb9489f4161f2132a158e37c1e343426c58e04e3482e1d7045'
|
|
775
|
+
},
|
|
776
|
+
imports: [
|
|
777
|
+
{
|
|
778
|
+
kind: 'static',
|
|
779
|
+
specifier: './runtime-asset.js',
|
|
780
|
+
target: 'runtime-asset.js'
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
kind: 'static',
|
|
784
|
+
specifier: './rustc-module.js',
|
|
785
|
+
target: 'rustc-module.js'
|
|
786
|
+
}
|
|
787
|
+
],
|
|
788
|
+
assets: [],
|
|
789
|
+
externals: []
|
|
790
|
+
},
|
|
791
|
+
'rustc-module.js': {
|
|
792
|
+
delivery: {
|
|
793
|
+
storagePath: 'rustc-module.js.bin',
|
|
794
|
+
encoding: 'identity'
|
|
795
|
+
},
|
|
796
|
+
storage: {
|
|
797
|
+
bytes: 711,
|
|
798
|
+
sha256: '81dee74032dd10187e9b576f2d2fe9291cee1ea6a829d0db37429dabd06c0d1e'
|
|
799
|
+
},
|
|
800
|
+
logical: {
|
|
801
|
+
bytes: 711,
|
|
802
|
+
sha256: '81dee74032dd10187e9b576f2d2fe9291cee1ea6a829d0db37429dabd06c0d1e'
|
|
803
|
+
},
|
|
804
|
+
imports: [],
|
|
805
|
+
assets: [],
|
|
806
|
+
externals: []
|
|
807
|
+
},
|
|
748
808
|
'rustc-runtime.js': {
|
|
749
809
|
delivery: {
|
|
750
810
|
storagePath: 'rustc-runtime.js.bin',
|
|
@@ -1453,6 +1513,6 @@ export const WASM_RUST_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
|
|
|
1453
1513
|
externals: []
|
|
1454
1514
|
}
|
|
1455
1515
|
},
|
|
1456
|
-
fingerprint: '
|
|
1516
|
+
fingerprint: '0c75869e3318fec8de28ba3732a65a4db9e92993cb517339fb729502e689f67f'
|
|
1457
1517
|
});
|
|
1458
1518
|
export const WASM_RUST_ASSET_VERSION = WASM_RUST_RUNTIME_PROFILE.manifestFingerprint;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export declare const WASM_TYPESCRIPT_ASSET_VERSION = "
|
|
1
|
+
export declare const WASM_TYPESCRIPT_ASSET_VERSION = "39caba34204ca2bc";
|
|
2
2
|
export declare const WASM_TYPESCRIPT_MODULE_RECEIPT: Readonly<{
|
|
3
|
-
bytes:
|
|
4
|
-
sha256: "
|
|
3
|
+
bytes: 3766190;
|
|
4
|
+
sha256: "483aedcb29a0aee52f4167d4bbbb6070d5d187986952a17c849ad65a29374dde";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const WASM_JAVASCRIPT_MODULE_RECEIPT: Readonly<{
|
|
7
|
+
bytes: 35829;
|
|
8
|
+
sha256: "3afa49e47296ad7d97f43a80500d95e55321d197b3ce95ddb823f10e91188c83";
|
|
5
9
|
}>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export const WASM_TYPESCRIPT_ASSET_VERSION = '
|
|
1
|
+
export const WASM_TYPESCRIPT_ASSET_VERSION = '39caba34204ca2bc';
|
|
2
2
|
export const WASM_TYPESCRIPT_MODULE_RECEIPT = Object.freeze({
|
|
3
|
-
bytes:
|
|
4
|
-
sha256: '
|
|
3
|
+
bytes: 3766190,
|
|
4
|
+
sha256: '483aedcb29a0aee52f4167d4bbbb6070d5d187986952a17c849ad65a29374dde'
|
|
5
|
+
});
|
|
6
|
+
export const WASM_JAVASCRIPT_MODULE_RECEIPT = Object.freeze({
|
|
7
|
+
bytes: 35829,
|
|
8
|
+
sha256: '3afa49e47296ad7d97f43a80500d95e55321d197b3ce95ddb823f10e91188c83'
|
|
5
9
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createBoundedAssetResponse } from './boundedAssetResponse';
|
|
1
2
|
const decoder = new TextDecoder();
|
|
2
3
|
const DEFAULT_MAX_ASSET_BYTES = 128 * 1024 * 1024;
|
|
3
4
|
const DEFAULT_STREAM_BUFFER_BYTES = 64 * 1024;
|
|
@@ -124,18 +125,24 @@ const loadAssetFromBridge = async (asset) => {
|
|
|
124
125
|
});
|
|
125
126
|
});
|
|
126
127
|
};
|
|
127
|
-
const
|
|
128
|
+
const fetchAssetFromUrl = async (url, asset, integrity, signal) => {
|
|
128
129
|
const requestUrl = trackedAssetUrl(url);
|
|
129
130
|
if (!requestUrl || trackedAssetName(requestUrl) !== asset || !activeConfig) {
|
|
130
131
|
throw new Error('Untracked runtime asset request');
|
|
131
132
|
}
|
|
132
133
|
const maxAssetBytes = activeConfig.maxAssetBytes ?? DEFAULT_MAX_ASSET_BYTES;
|
|
134
|
+
signal?.throwIfAborted();
|
|
133
135
|
const response = await originalFetch(requestUrl, {
|
|
134
136
|
credentials: 'omit',
|
|
135
137
|
redirect: 'error',
|
|
136
138
|
referrerPolicy: 'no-referrer',
|
|
137
|
-
...(integrity ? { integrity } : {})
|
|
139
|
+
...(integrity ? { integrity } : {}),
|
|
140
|
+
...(signal ? { signal } : {})
|
|
138
141
|
});
|
|
142
|
+
if (signal?.aborted) {
|
|
143
|
+
cancelResponseBody(response, signal.reason);
|
|
144
|
+
signal.throwIfAborted();
|
|
145
|
+
}
|
|
139
146
|
if (response.url) {
|
|
140
147
|
let responseUrl;
|
|
141
148
|
try {
|
|
@@ -174,6 +181,10 @@ const loadAssetFromUrl = async (url, asset, integrity) => {
|
|
|
174
181
|
throw error;
|
|
175
182
|
}
|
|
176
183
|
const mimeType = response.headers.get('content-type') || undefined;
|
|
184
|
+
return { response, maxAssetBytes, total, mimeType };
|
|
185
|
+
};
|
|
186
|
+
const loadAssetFromUrl = async (url, asset, integrity) => {
|
|
187
|
+
const { response, maxAssetBytes, total, mimeType } = await fetchAssetFromUrl(url, asset, integrity);
|
|
177
188
|
if (!response.body) {
|
|
178
189
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
179
190
|
if (bytes.byteLength > maxAssetBytes) {
|
|
@@ -401,11 +412,27 @@ function installRuntimeAssetInterceptors() {
|
|
|
401
412
|
}
|
|
402
413
|
return originalFetch(input, init);
|
|
403
414
|
}
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
415
|
+
const request = typeof Request !== 'undefined' && input instanceof Request ? input : undefined;
|
|
416
|
+
const requestIntegrity = init?.integrity ?? request?.integrity;
|
|
417
|
+
const integrity = typeof requestIntegrity === 'string' ? requestIntegrity : undefined;
|
|
418
|
+
const method = (init?.method ?? request?.method ?? 'GET').toUpperCase();
|
|
419
|
+
if (activeConfig?.useAssetBridge === false &&
|
|
420
|
+
method === 'GET' &&
|
|
421
|
+
new URL(resolvedUrl).pathname.endsWith('.wasm')) {
|
|
422
|
+
const asset = trackedAssetName(resolvedUrl);
|
|
423
|
+
const signal = (init?.signal === undefined ? request?.signal : init.signal) ?? undefined;
|
|
424
|
+
const { response, maxAssetBytes, total } = await fetchAssetFromUrl(resolvedUrl, asset, integrity, signal);
|
|
425
|
+
return createBoundedAssetResponse(response, {
|
|
426
|
+
asset,
|
|
427
|
+
maxAssetBytes,
|
|
428
|
+
total,
|
|
429
|
+
signal,
|
|
430
|
+
onProgress: (loaded, total) => self.postMessage({ assetProgress: { asset, loaded, total } })
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
// Custom host bridges must finish receipt verification before exposing bytes.
|
|
434
|
+
// Archives, module imports, and XHR consumers retain their buffered contracts.
|
|
435
|
+
return createTrackedResponse(await loadTrackedAsset(resolvedUrl, integrity));
|
|
409
436
|
});
|
|
410
437
|
installTrackedFetch();
|
|
411
438
|
}
|