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.
Files changed (95) hide show
  1. package/README.md +18 -5
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.js +1 -0
  4. package/dist/playground/assetBridge.d.ts +6 -1
  5. package/dist/playground/assetBridge.js +77 -4
  6. package/dist/playground/assets.d.ts +9 -1
  7. package/dist/playground/assets.js +29 -5
  8. package/dist/playground/awk.js +1 -0
  9. package/dist/playground/bash.d.ts +1 -0
  10. package/dist/playground/bash.js +7 -1
  11. package/dist/playground/bqn.js +1 -0
  12. package/dist/playground/bqnPreflight.d.ts +2 -1
  13. package/dist/playground/bqnPreflight.js +1 -0
  14. package/dist/playground/c3.js +1 -0
  15. package/dist/playground/cachedClang.js +15 -8
  16. package/dist/playground/clang.d.ts +1 -0
  17. package/dist/playground/clang.js +8 -1
  18. package/dist/playground/clangAssetIntegrity.d.ts +6 -0
  19. package/dist/playground/clangAssetIntegrity.js +3 -2
  20. package/dist/playground/clojurescript.js +1 -0
  21. package/dist/playground/clojurescriptPreflight.d.ts +2 -1
  22. package/dist/playground/clojurescriptPreflight.js +1 -0
  23. package/dist/playground/elixir.js +4 -1
  24. package/dist/playground/forth.js +1 -0
  25. package/dist/playground/forthPreflight.d.ts +2 -1
  26. package/dist/playground/forthPreflight.js +1 -0
  27. package/dist/playground/fortran.js +7 -1
  28. package/dist/playground/haskell.js +4 -1
  29. package/dist/playground/haskellAssets.d.ts +2 -1
  30. package/dist/playground/haskellAssets.js +8 -8
  31. package/dist/playground/index.d.ts +1 -1
  32. package/dist/playground/index.js +2 -2
  33. package/dist/playground/j.js +1 -0
  34. package/dist/playground/jPreflight.d.ts +2 -1
  35. package/dist/playground/jPreflight.js +1 -0
  36. package/dist/playground/janet.js +1 -0
  37. package/dist/playground/java.js +20 -8
  38. package/dist/playground/julia.js +1 -0
  39. package/dist/playground/lfortranAssets.d.ts +2 -1
  40. package/dist/playground/lfortranAssets.js +1 -0
  41. package/dist/playground/lisp.js +4 -1
  42. package/dist/playground/lispAssets.d.ts +2 -1
  43. package/dist/playground/lispAssets.js +10 -0
  44. package/dist/playground/lldbManifest.d.ts +2 -2
  45. package/dist/playground/lldbManifest.js +17 -3
  46. package/dist/playground/lldbSession.d.ts +1 -0
  47. package/dist/playground/lldbSession.js +2 -1
  48. package/dist/playground/nim.js +1 -0
  49. package/dist/playground/ocaml.d.ts +1 -0
  50. package/dist/playground/ocaml.js +12 -1
  51. package/dist/playground/options.d.ts +2 -0
  52. package/dist/playground/pascal.js +1 -0
  53. package/dist/playground/perl.js +1 -0
  54. package/dist/playground/prolog.js +1 -0
  55. package/dist/playground/python.js +3 -1
  56. package/dist/playground/runtimeSession.d.ts +2 -1
  57. package/dist/playground/runtimeSession.js +2 -2
  58. package/dist/playground/rust.d.ts +1 -0
  59. package/dist/playground/rust.js +11 -1
  60. package/dist/playground/rustExecutableGraph.d.ts +1 -0
  61. package/dist/playground/rustExecutableGraph.js +1 -0
  62. package/dist/playground/staticRuntimePreflight.d.ts +2 -1
  63. package/dist/playground/staticRuntimePreflight.js +4 -2
  64. package/dist/playground/staticRuntimePreflightExecute.js +1 -0
  65. package/dist/playground/staticRuntimePreflightProtocol.d.ts +2 -1
  66. package/dist/playground/staticWorkerRuntime.d.ts +3 -1
  67. package/dist/playground/staticWorkerRuntime.js +44 -3
  68. package/dist/playground/tcl.js +1 -0
  69. package/dist/playground/tinygo.d.ts +2 -0
  70. package/dist/playground/tinygo.js +57 -3
  71. package/dist/playground/tinygoExecutableGraph.d.ts +4 -1
  72. package/dist/playground/tinygoExecutableGraph.js +59 -7
  73. package/dist/playground/typescript.js +4 -1
  74. package/dist/playground/wasmGoVersion.d.ts +1 -1
  75. package/dist/playground/wasmGoVersion.js +1 -1
  76. package/dist/playground/wasmOcamlVersion.d.ts +2 -2
  77. package/dist/playground/wasmOcamlVersion.js +1 -1
  78. package/dist/playground/wasmRustVersion.d.ts +90 -24
  79. package/dist/playground/wasmRustVersion.js +98 -23
  80. package/dist/playground/wasmTinyGoVersion.d.ts +40 -29
  81. package/dist/playground/wasmTinyGoVersion.js +43 -31
  82. package/dist/playground/worker/clang.js +1 -5
  83. package/dist/playground/worker/elixir.js +10 -8
  84. package/dist/playground/worker/fortran.js +4 -7
  85. package/dist/playground/worker/haskell.js +2 -0
  86. package/dist/playground/worker/lisp.js +2 -0
  87. package/dist/playground/worker/ocaml.js +13 -1
  88. package/dist/playground/worker/runtimeAssetFetch.d.ts +11 -1
  89. package/dist/playground/worker/runtimeAssetFetch.js +64 -1
  90. package/dist/playground/worker/rust.js +9 -2
  91. package/dist/playground/worker/staticRuntimePreflight.js +2 -0
  92. package/dist/playground/worker/typescript.js +4 -1
  93. package/dist/playground/worker/zig.js +7 -4
  94. package/dist/playground/zig.js +4 -1
  95. package/package.json +10 -7
@@ -1,6 +1,6 @@
1
1
  import { ConsoleStdout, Directory, Fd, File, OpenFile, PreopenDirectory, WASI, wasi } from '@bjorn3/browser_wasi_shim';
2
2
  import { decompressGzip, untar } from '@wasm-idle/llvm-core';
3
- import { verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
3
+ import { configureRuntimeAssetCache, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
4
4
  import { waitForBufferedStdin } from '../stdinBuffer';
5
5
  import { snapshotZigExecutionAssetReceipts } from '../zigAssets';
6
6
  import { fetchRuntimeAssetBytes, resolveRuntimeAssetUrl } from './runtimeAssetFetch';
@@ -138,10 +138,12 @@ function buildWorkspaceRoot(code, activePath, workspaceFiles) {
138
138
  addFileToDirectory(root, entryPath, encoder.encode(code));
139
139
  return { root, entryPath };
140
140
  }
141
- async function fetchBytes(url, asset, maxAssetBytes, progressStart, progressEnd) {
141
+ async function fetchBytes(url, asset, maxAssetBytes, progressStart, progressEnd, expected) {
142
142
  const data = await fetchRuntimeAssetBytes({
143
143
  url,
144
144
  label: asset,
145
+ expected,
146
+ integrityContext: { asset, runtimeId: 'ZIG' },
145
147
  maxAssetBytes,
146
148
  onProgress: ({ loaded, total }) => {
147
149
  if (total && total > 0) {
@@ -398,8 +400,8 @@ async function loadAssets(nextCompilerUrl, nextStdlibUrl, nextIntegrity, maxAsse
398
400
  const pending = (async () => {
399
401
  postProgress(5);
400
402
  const [compilerBytes, stdlibBytes] = await Promise.all([
401
- fetchBytes(nextCompilerUrl, 'zig_small.wasm', receipts['zig_small.wasm'].bytes, 5, 45),
402
- fetchBytes(nextStdlibUrl, 'std.tar.gz', Math.max(receipts['std.tar.gz'].bytes, receipts['std.tar.gz'].uncompressedBytes || 0), 45, 70)
403
+ fetchBytes(nextCompilerUrl, 'zig_small.wasm', receipts['zig_small.wasm'].bytes, 5, 45, receipts['zig_small.wasm']),
404
+ fetchBytes(nextStdlibUrl, 'std.tar.gz', Math.max(receipts['std.tar.gz'].bytes, receipts['std.tar.gz'].uncompressedBytes || 0), 45, 70, receipts['std.tar.gz'])
403
405
  ]);
404
406
  await verifyRuntimeAssetIntegrity({
405
407
  asset: 'zig_small.wasm',
@@ -526,6 +528,7 @@ self.onmessage = async (event) => {
526
528
  const { load, compilerUrl: nextCompilerUrl, stdlibUrl: nextStdlibUrl, integrity: nextIntegrity, maxAssetBytes: nextMaxAssetBytes, buffer, code, prepare, args = [], compileArgs = [], stdin, activePath = 'main.zig', workspaceFiles = [], targetTriple = 'wasm64-wasi', log } = event.data;
527
529
  try {
528
530
  if (load) {
531
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
529
532
  if (log) {
530
533
  console.log(`[wasm-idle:zig-worker] load compilerUrl=${nextCompilerUrl} stdlibUrl=${nextStdlibUrl}`);
531
534
  }
@@ -2,7 +2,7 @@ import { resolveSandboxExecutionArgs } from './options';
2
2
  import { resolveZigCompilerUrl, resolveZigStdlibUrl } from './assets';
3
3
  import { snapshotZigExecutionAssetReceipts } from './zigAssets';
4
4
  import { WASM_ZIG_ASSET_RECEIPTS } from './wasmZigVersion';
5
- import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
5
+ import { BusyError, CancelledError, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, TimeoutError, resolveExecutionLimits, resolveRuntimeAssetCacheOptions, validateExecutionWorkspace } from '@wasm-idle/core';
6
6
  import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
7
7
  import { createWasmIdleSharedBuffer } from './sharedBuffer';
8
8
  import { WorkerSession } from './workerSession';
@@ -370,6 +370,9 @@ class Zig {
370
370
  worker.onmessage = handler;
371
371
  worker.postMessage({
372
372
  load: true,
373
+ persistentCache: resolveRuntimeAssetCacheOptions(typeof runtimeAssets === 'object'
374
+ ? runtimeAssets?.persistentCache
375
+ : undefined, options.persistentCache),
373
376
  compilerUrl: nextCompilerUrl,
374
377
  stdlibUrl: nextStdlibUrl,
375
378
  integrity: nextIntegrity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-idle",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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/lsp": "1.0.6",
65
- "@wasm-idle/terminal": "1.0.6",
66
- "@wasm-idle/debug": "1.0.6"
64
+ "@wasm-idle/debug": "1.0.8",
65
+ "@wasm-idle/lsp": "1.0.8",
66
+ "@wasm-idle/terminal": "1.0.8"
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.6",
72
- "@wasm-idle/llvm-core": "1.0.6"
71
+ "@wasm-idle/core": "1.0.8",
72
+ "@wasm-idle/llvm-core": "1.0.8"
73
73
  },
74
74
  "files": [
75
75
  "dist",
@@ -190,8 +190,11 @@
190
190
  "sync:webr": "node scripts/sync-runtime.mjs webr",
191
191
  "compress:static-runtimes": "node scripts/compress-static-runtime-assets.mjs static",
192
192
  "compress:build-runtimes": "node scripts/compress-static-runtime-assets.mjs build",
193
+ "compact:build-runtimes": "node scripts/compact-runtime-aliases.mjs build",
193
194
  "layer:static-runtimes": "node scripts/build-layered-runtime-assets.mjs static",
194
195
  "asset:sizes": "node scripts/static-asset-sizes.mjs report",
196
+ "assets:lock": "node scripts/generate-runtime-asset-lock.mjs",
197
+ "check:assets-lock": "node scripts/generate-runtime-asset-lock.mjs --check",
195
198
  "check:asset-sizes": "node scripts/static-asset-sizes.mjs check",
196
199
  "build:page-runtimes": "node scripts/prepare-page-runtimes.mjs",
197
200
  "verify:wasm-typescript-freshness": "pnpm --dir runtimes/wasm-typescript build && node scripts/sync-wasm-typescript.mjs --verify",
@@ -201,7 +204,7 @@
201
204
  "support:matrix": "node scripts/support-matrix.mjs write",
202
205
  "check:support-matrix": "node scripts/support-matrix.mjs check",
203
206
  "sync:page-runtimes": "pnpm run sync:pyodide && pnpm run sync:webr && pnpm run sync:wasm-of-js-of-ocaml && pnpm run sync:wasm-typescript && pnpm run sync:wasm-octave && pnpm run sync:wasm-prolog && pnpm run sync:wasm-gleam && pnpm run sync:wasm-perl && pnpm run sync:wasm-tcl && pnpm run sync:wasm-awk && pnpm run sync:wasm-pascal && pnpm run sync:wasm-forth && pnpm run sync:wasm-j && pnpm run sync:wasm-bqn && pnpm run sync:wasm-janet && pnpm run sync:wasm-julia && pnpm run sync:wasm-nim && pnpm run sync:wasm-ruby && pnpm run sync:wasm-bash && pnpm run sync:wasm-clojurescript",
204
- "page:build": "pnpm run verify:page-c3 && pnpm run verify:page-lfortran && pnpm run prepare:test-assets -- clang && pnpm run build:page-runtimes && pnpm run sync:page-runtimes && pnpm run build:static-runtime-modules && pnpm run prepare:wasm-debug-release && pnpm run layer:static-runtimes && pnpm run compress:static-runtimes && pnpm run build && pnpm run compress:build-runtimes && pnpm run verify:page-c3 build && pnpm run verify:page-lfortran build",
207
+ "page:build": "pnpm run verify:page-c3 && pnpm run verify:page-lfortran && pnpm run prepare:test-assets -- clang && pnpm run build:page-runtimes && pnpm run sync:page-runtimes && pnpm run build:static-runtime-modules && pnpm run prepare:wasm-debug-release && pnpm run layer:static-runtimes && pnpm run compress:static-runtimes && pnpm run assets:lock && pnpm run check:assets-lock && pnpm run build && pnpm run compress:build-runtimes && pnpm run verify:page-c3 build && pnpm run verify:page-lfortran build",
205
208
  "package:root": "svelte-kit sync && node scripts/clean-package-output.mjs && svelte-package --tsconfig ./tsconfig.package.json && publint",
206
209
  "package": "pnpm run build:publish-deps && pnpm run package:root",
207
210
  "verify:package": "node scripts/verify-package.mjs",