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
@@ -2,10 +2,10 @@ export declare const WASM_TINYGO_RUNTIME_PROFILE: Readonly<{
2
2
  profileId: "tinygo-0.40.1-wasip1-protocol-v6";
3
3
  protocolVersion: 6;
4
4
  manifestPath: "tools/upstream/upstream-toolchain.v2.json";
5
- manifestFingerprint: "d3f20ca1974c52fa8e4b20e37a75f8171044e0351192b8bed85d7f83d4fffbbc";
5
+ manifestFingerprint: "03140d8fe8b9b477764da72a3a497077984faa4553e7a94901c8130b26680ce5";
6
6
  manifestReceipt: Readonly<{
7
- bytes: 1123;
8
- sha256: "4f95485c52f5eec87d1b0906ac8ab4bcb403b8e3bdbcbac2319469353c6a4dfc";
7
+ bytes: 1124;
8
+ sha256: "e53790b97125e48d77967bc87cc400fdfacfb678e6d847de372efa647cb4de4f";
9
9
  }>;
10
10
  assetReceipts: Readonly<{
11
11
  'tools/upstream/lld.wasm': Readonly<{
@@ -19,14 +19,14 @@ export declare const WASM_TINYGO_RUNTIME_PROFILE: Readonly<{
19
19
  sha256: "b25c8ffd86af0e540cf058e38b273271100ff297316f30a38c8239c77d9357d1";
20
20
  }>;
21
21
  'tools/upstream/producer-receipt.json': Readonly<{
22
- bytes: 7572;
23
- sha256: "bcf1ca1951a64896df98ae8d04137c80c503b1f5e64a099fae99d90deffe8b60";
22
+ bytes: 10207;
23
+ sha256: "a400355ee1ca13c6a79bca0c7c2e8cf05ecf457fdc61c9fc69692bb17500842a";
24
24
  }>;
25
25
  'tools/upstream/tinygo-compiler.wasm': Readonly<{
26
- bytes: 19961972;
27
- sha256: "37e07f96700ee4a98c37879553144e4c3872fa91136be3a193cb33d5d11a372f";
28
- uncompressedBytes: 70288217;
29
- uncompressedSha256: "a5f6cb6cbfff45e6c5ee6ab8f3bca37c5dabd19d443107707ad1de330ecb8db2";
26
+ bytes: 17488480;
27
+ sha256: "9700dd4403162a89cffa065011bb26c919b70a82b3e86d612ceb064a598111de";
28
+ uncompressedBytes: 54057556;
29
+ uncompressedSha256: "a65f51c7d2845ea1469328705f2c9839f0151ee221e6a3efea851226e4e2d649";
30
30
  }>;
31
31
  'tools/upstream/tinygo-package-graph.wasm': Readonly<{
32
32
  bytes: 6058150;
@@ -35,8 +35,8 @@ export declare const WASM_TINYGO_RUNTIME_PROFILE: Readonly<{
35
35
  uncompressedSha256: "b7b28719bf97d5c5e140c3ec6f8f40a40fc7d02216e0160e460a34b79f61cb14";
36
36
  }>;
37
37
  'tools/upstream/tinygoroot.tar.gz.bin': Readonly<{
38
- bytes: 28919860;
39
- sha256: "e9e8314b406e57a512b49d9716455665bfac36e24694763bdecf86f4b0c2fae3";
38
+ bytes: 29058996;
39
+ sha256: "6c085f441ecc5990b71628f0b47b80e9e9810ae6384093e65723f795b4bd8688";
40
40
  }>;
41
41
  }>;
42
42
  }>;
@@ -46,16 +46,32 @@ export declare const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE: Readonly<{
46
46
  schemaVersion: 1;
47
47
  format: "wasm-idle-tinygo-executable-graph-v1";
48
48
  entryPath: "upstream.js";
49
- fingerprint: "33fe04eb515aaaea7e7dd5571a4a614a48d51b991115f05288b236377c53c5b9";
49
+ fingerprint: "8ecbffd4b4e44ff67288d8c46328a1b06d0a0ac76d7a50a9e458603b68d0d795";
50
50
  modules: Readonly<{
51
+ 'assets/upstream-binaryen-59aad93503b5fd53.wasm.gz.bin': Readonly<{
52
+ bytes: 2366782;
53
+ sha256: "e497b67a6bcbee29639792a3d58ecacb22781287f7fe155bfdf079e6ca159dff";
54
+ uncompressedBytes: 9282194;
55
+ uncompressedSha256: "59aad93503b5fd539993f2f5571c11dce9ddb4c5d10b681abc8e5dc124aed526";
56
+ imports: readonly never[];
57
+ }>;
51
58
  'assets/upstream-compile-worker-CFw6Ych6.js': Readonly<{
52
59
  bytes: 558;
53
60
  sha256: "03a76345c69f8bd751dac18894f65c0918f1690fbbb661f38052819cd5ae8209";
54
61
  imports: readonly never[];
55
62
  }>;
56
- 'assets/upstream-compile-worker-Dat9LBTc.js': Readonly<{
57
- bytes: 12538521;
58
- sha256: "b8d987c32914715b0ba91ace85585f5db467957d14982aa163c1febe9d6dfc04";
63
+ 'assets/upstream-compile-worker-CUrboB1_.js': Readonly<{
64
+ bytes: 103559;
65
+ sha256: "42337c2f06d04b51d79f0ec66ae685f0cfb2a78718b0636df980dc92dd1db9d5";
66
+ imports: readonly Readonly<{
67
+ specifier: "./upstream-compile-worker-CeYS3ydo.js";
68
+ target: "assets/upstream-compile-worker-CeYS3ydo.js";
69
+ kind: "dynamic";
70
+ }>[];
71
+ }>;
72
+ 'assets/upstream-compile-worker-CeYS3ydo.js': Readonly<{
73
+ bytes: 181175;
74
+ sha256: "faa2bf6a310cd23991babde1fb62cd34253d692fee03029fe3508eae4c24b1c0";
59
75
  imports: readonly (Readonly<{
60
76
  specifier: "./upstream-compile-worker-CFw6Ych6.js";
61
77
  target: "assets/upstream-compile-worker-CFw6Ych6.js";
@@ -64,6 +80,10 @@ export declare const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE: Readonly<{
64
80
  specifier: "./upstream-compile-worker-NPJcbr3r.js";
65
81
  target: "assets/upstream-compile-worker-NPJcbr3r.js";
66
82
  kind: "dynamic";
83
+ }> | Readonly<{
84
+ specifier: "./upstream-binaryen-59aad93503b5fd53.wasm.gz.bin";
85
+ target: "assets/upstream-binaryen-59aad93503b5fd53.wasm.gz.bin";
86
+ kind: "asset";
67
87
  }>)[];
68
88
  }>;
69
89
  'assets/upstream-compile-worker-NPJcbr3r.js': Readonly<{
@@ -75,24 +95,15 @@ export declare const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE: Readonly<{
75
95
  kind: "static";
76
96
  }>[];
77
97
  }>;
78
- 'assets/upstream-compile-worker-R7P8Uy5f.js': Readonly<{
79
- bytes: 100032;
80
- sha256: "1cc51b6435aa72d0ad9c513658a8ed4b2e9d5f94a28b0902b1f200364bccbf82";
81
- imports: readonly Readonly<{
82
- specifier: "./upstream-compile-worker-Dat9LBTc.js";
83
- target: "assets/upstream-compile-worker-Dat9LBTc.js";
84
- kind: "dynamic";
85
- }>[];
86
- }>;
87
98
  'upstream.js': Readonly<{
88
- bytes: 123164;
89
- sha256: "bee971f17a538c1afc3fa01f2050a233a4b75030f0a8e258fd8ca76584cc93a6";
99
+ bytes: 126073;
100
+ sha256: "136a957aa940c3e2b8c7a925eb538f3fce81f699aa9113e1fd93ce0b35c879aa";
90
101
  imports: readonly Readonly<{
91
- specifier: "assets/upstream-compile-worker-R7P8Uy5f.js";
92
- target: "assets/upstream-compile-worker-R7P8Uy5f.js";
102
+ specifier: "assets/upstream-compile-worker-CUrboB1_.js";
103
+ target: "assets/upstream-compile-worker-CUrboB1_.js";
93
104
  kind: "worker";
94
105
  }>[];
95
106
  }>;
96
107
  }>;
97
108
  }>;
98
- export declare const WASM_TINYGO_ASSET_VERSION = "5ff593680ea205ac06ce66afd181d811f46933a5358113a11206b6b89d95707f";
109
+ export declare const WASM_TINYGO_ASSET_VERSION = "0b2e827ae219eecc806d4118ee4a2b6032adbe7a960e6c0e471c4491d9a1f2f3";
@@ -2,10 +2,10 @@ export const WASM_TINYGO_RUNTIME_PROFILE = Object.freeze({
2
2
  profileId: 'tinygo-0.40.1-wasip1-protocol-v6',
3
3
  protocolVersion: 6,
4
4
  manifestPath: 'tools/upstream/upstream-toolchain.v2.json',
5
- manifestFingerprint: 'd3f20ca1974c52fa8e4b20e37a75f8171044e0351192b8bed85d7f83d4fffbbc',
5
+ manifestFingerprint: '03140d8fe8b9b477764da72a3a497077984faa4553e7a94901c8130b26680ce5',
6
6
  manifestReceipt: Object.freeze({
7
- bytes: 1123,
8
- sha256: '4f95485c52f5eec87d1b0906ac8ab4bcb403b8e3bdbcbac2319469353c6a4dfc'
7
+ bytes: 1124,
8
+ sha256: 'e53790b97125e48d77967bc87cc400fdfacfb678e6d847de372efa647cb4de4f'
9
9
  }),
10
10
  assetReceipts: Object.freeze({
11
11
  'tools/upstream/lld.wasm': Object.freeze({
@@ -19,14 +19,14 @@ export const WASM_TINYGO_RUNTIME_PROFILE = Object.freeze({
19
19
  sha256: 'b25c8ffd86af0e540cf058e38b273271100ff297316f30a38c8239c77d9357d1'
20
20
  }),
21
21
  'tools/upstream/producer-receipt.json': Object.freeze({
22
- bytes: 7572,
23
- sha256: 'bcf1ca1951a64896df98ae8d04137c80c503b1f5e64a099fae99d90deffe8b60'
22
+ bytes: 10207,
23
+ sha256: 'a400355ee1ca13c6a79bca0c7c2e8cf05ecf457fdc61c9fc69692bb17500842a'
24
24
  }),
25
25
  'tools/upstream/tinygo-compiler.wasm': Object.freeze({
26
- bytes: 19961972,
27
- sha256: '37e07f96700ee4a98c37879553144e4c3872fa91136be3a193cb33d5d11a372f',
28
- uncompressedBytes: 70288217,
29
- uncompressedSha256: 'a5f6cb6cbfff45e6c5ee6ab8f3bca37c5dabd19d443107707ad1de330ecb8db2'
26
+ bytes: 17488480,
27
+ sha256: '9700dd4403162a89cffa065011bb26c919b70a82b3e86d612ceb064a598111de',
28
+ uncompressedBytes: 54057556,
29
+ uncompressedSha256: 'a65f51c7d2845ea1469328705f2c9839f0151ee221e6a3efea851226e4e2d649'
30
30
  }),
31
31
  'tools/upstream/tinygo-package-graph.wasm': Object.freeze({
32
32
  bytes: 6058150,
@@ -35,8 +35,8 @@ export const WASM_TINYGO_RUNTIME_PROFILE = Object.freeze({
35
35
  uncompressedSha256: 'b7b28719bf97d5c5e140c3ec6f8f40a40fc7d02216e0160e460a34b79f61cb14'
36
36
  }),
37
37
  'tools/upstream/tinygoroot.tar.gz.bin': Object.freeze({
38
- bytes: 28919860,
39
- sha256: 'e9e8314b406e57a512b49d9716455665bfac36e24694763bdecf86f4b0c2fae3'
38
+ bytes: 29058996,
39
+ sha256: '6c085f441ecc5990b71628f0b47b80e9e9810ae6384093e65723f795b4bd8688'
40
40
  })
41
41
  })
42
42
  });
@@ -46,16 +46,34 @@ export const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
46
46
  schemaVersion: 1,
47
47
  format: WASM_TINYGO_EXECUTABLE_GRAPH_FORMAT,
48
48
  entryPath: 'upstream.js',
49
- fingerprint: '33fe04eb515aaaea7e7dd5571a4a614a48d51b991115f05288b236377c53c5b9',
49
+ fingerprint: '8ecbffd4b4e44ff67288d8c46328a1b06d0a0ac76d7a50a9e458603b68d0d795',
50
50
  modules: Object.freeze({
51
+ 'assets/upstream-binaryen-59aad93503b5fd53.wasm.gz.bin': Object.freeze({
52
+ bytes: 2366782,
53
+ sha256: 'e497b67a6bcbee29639792a3d58ecacb22781287f7fe155bfdf079e6ca159dff',
54
+ uncompressedBytes: 9282194,
55
+ uncompressedSha256: '59aad93503b5fd539993f2f5571c11dce9ddb4c5d10b681abc8e5dc124aed526',
56
+ imports: Object.freeze([])
57
+ }),
51
58
  'assets/upstream-compile-worker-CFw6Ych6.js': Object.freeze({
52
59
  bytes: 558,
53
60
  sha256: '03a76345c69f8bd751dac18894f65c0918f1690fbbb661f38052819cd5ae8209',
54
61
  imports: Object.freeze([])
55
62
  }),
56
- 'assets/upstream-compile-worker-Dat9LBTc.js': Object.freeze({
57
- bytes: 12538521,
58
- sha256: 'b8d987c32914715b0ba91ace85585f5db467957d14982aa163c1febe9d6dfc04',
63
+ 'assets/upstream-compile-worker-CUrboB1_.js': Object.freeze({
64
+ bytes: 103559,
65
+ sha256: '42337c2f06d04b51d79f0ec66ae685f0cfb2a78718b0636df980dc92dd1db9d5',
66
+ imports: Object.freeze([
67
+ Object.freeze({
68
+ specifier: './upstream-compile-worker-CeYS3ydo.js',
69
+ target: 'assets/upstream-compile-worker-CeYS3ydo.js',
70
+ kind: 'dynamic'
71
+ })
72
+ ])
73
+ }),
74
+ 'assets/upstream-compile-worker-CeYS3ydo.js': Object.freeze({
75
+ bytes: 181175,
76
+ sha256: 'faa2bf6a310cd23991babde1fb62cd34253d692fee03029fe3508eae4c24b1c0',
59
77
  imports: Object.freeze([
60
78
  Object.freeze({
61
79
  specifier: './upstream-compile-worker-CFw6Ych6.js',
@@ -66,6 +84,11 @@ export const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
66
84
  specifier: './upstream-compile-worker-NPJcbr3r.js',
67
85
  target: 'assets/upstream-compile-worker-NPJcbr3r.js',
68
86
  kind: 'dynamic'
87
+ }),
88
+ Object.freeze({
89
+ specifier: './upstream-binaryen-59aad93503b5fd53.wasm.gz.bin',
90
+ target: 'assets/upstream-binaryen-59aad93503b5fd53.wasm.gz.bin',
91
+ kind: 'asset'
69
92
  })
70
93
  ])
71
94
  }),
@@ -80,28 +103,17 @@ export const WASM_TINYGO_EXECUTABLE_GRAPH_PROFILE = Object.freeze({
80
103
  })
81
104
  ])
82
105
  }),
83
- 'assets/upstream-compile-worker-R7P8Uy5f.js': Object.freeze({
84
- bytes: 100032,
85
- sha256: '1cc51b6435aa72d0ad9c513658a8ed4b2e9d5f94a28b0902b1f200364bccbf82',
86
- imports: Object.freeze([
87
- Object.freeze({
88
- specifier: './upstream-compile-worker-Dat9LBTc.js',
89
- target: 'assets/upstream-compile-worker-Dat9LBTc.js',
90
- kind: 'dynamic'
91
- })
92
- ])
93
- }),
94
106
  'upstream.js': Object.freeze({
95
- bytes: 123164,
96
- sha256: 'bee971f17a538c1afc3fa01f2050a233a4b75030f0a8e258fd8ca76584cc93a6',
107
+ bytes: 126073,
108
+ sha256: '136a957aa940c3e2b8c7a925eb538f3fce81f699aa9113e1fd93ce0b35c879aa',
97
109
  imports: Object.freeze([
98
110
  Object.freeze({
99
- specifier: 'assets/upstream-compile-worker-R7P8Uy5f.js',
100
- target: 'assets/upstream-compile-worker-R7P8Uy5f.js',
111
+ specifier: 'assets/upstream-compile-worker-CUrboB1_.js',
112
+ target: 'assets/upstream-compile-worker-CUrboB1_.js',
101
113
  kind: 'worker'
102
114
  })
103
115
  ])
104
116
  })
105
117
  })
106
118
  });
107
- export const WASM_TINYGO_ASSET_VERSION = '5ff593680ea205ac06ce66afd181d811f46933a5358113a11206b6b89d95707f';
119
+ export const WASM_TINYGO_ASSET_VERSION = '0b2e827ae219eecc806d4118ee4a2b6032adbe7a960e6c0e471c4491d9a1f2f3';
@@ -4,11 +4,7 @@ import { isSharedBufferBackedView } from '../sharedBuffer';
4
4
  import { configureWorkerRuntimeAssets, handleWorkerAssetMessage } from './assets';
5
5
  import { withVerifiedStreaming } from './clangStreaming';
6
6
  import { BUNDLED_CLANG_LANGUAGE_SYSROOT_PROFILES } from '../clangAssetIntegrity';
7
- self.document = {
8
- querySelectorAll() {
9
- return [];
10
- }
11
- };
7
+ // Preserve native Worker globals: a partial document makes dev loaders misdetect a DOM.
12
8
  let stdinBufferClang, debugBufferClang, watchBufferClang, watchResultBufferClang, interruptBufferClang, clang;
13
9
  let hasInitialStdinClang = false;
14
10
  let initialStdinClang = null;
@@ -1,7 +1,7 @@
1
1
  import { waitForBufferedStdin } from '../stdinBuffer';
2
2
  import { ELIXIR_RUNTIME_ASSET_NAMES, snapshotElixirRuntimeAssetReceipts } from '../elixirAssets';
3
3
  import { fetchRuntimeAssetBytes } from './runtimeAssetFetch';
4
- import { verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
4
+ import { configureRuntimeAssetCache, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
5
5
  const workerDocument = {
6
6
  querySelectorAll() {
7
7
  return [];
@@ -403,15 +403,16 @@ async function loadRuntime(nextBundleUrl, nextAssetReceipts, nextMaxAssetBytes,
403
403
  const bytes = await fetchRuntimeAssetBytes({
404
404
  url: assetUrl,
405
405
  label: `Elixir runtime asset ${asset}`,
406
+ expected: { sha256: receipt.uncompressedSha256, bytes: receipt.uncompressedBytes },
407
+ verify: (bytes) => verifyRuntimeAssetIntegrity({
408
+ asset,
409
+ bytes,
410
+ expected: receipt,
411
+ stage: 'uncompressed',
412
+ runtimeId: 'ELIXIR'
413
+ }),
406
414
  maxAssetBytes: Math.min(receipt.uncompressedBytes, effectiveMaxAssetBytes)
407
415
  });
408
- await verifyRuntimeAssetIntegrity({
409
- asset,
410
- bytes,
411
- expected: receipt,
412
- stage: 'uncompressed',
413
- runtimeId: 'ELIXIR'
414
- });
415
416
  loadedAssets.push([asset, bytes]);
416
417
  }
417
418
  const assets = Object.freeze(Object.fromEntries(loadedAssets));
@@ -465,6 +466,7 @@ self.onmessage = async (event) => {
465
466
  const evalLanguage = language === 'ERLANG' ? 'ERLANG' : 'ELIXIR';
466
467
  try {
467
468
  if (load) {
469
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
468
470
  await loadRuntime(nextBundleUrl, nextAssetReceipts, nextMaxAssetBytes, log);
469
471
  const configuredReceipts = snapshotElixirRuntimeAssetReceipts(nextAssetReceipts);
470
472
  bundleUrl = nextBundleUrl;
@@ -4,7 +4,7 @@ import { snapshotFortranExecutionAssetReceipts } from '../fortranAssets';
4
4
  import { configureWorkerRuntimeAssets, handleWorkerAssetMessage } from './assets';
5
5
  import { fetchRuntimeAssetBytes, resolveRuntimeAssetUrl } from './runtimeAssetFetch';
6
6
  import { BrowserClangRuntime, createBrowserWasiHost, executeBrowserClangArtifact, loadRuntimeManifest, resolveRuntimeManifestUrl } from '@wasm-idle/llvm-core/clang';
7
- import { verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
7
+ import { configureRuntimeAssetCache, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
8
8
  self.document = {
9
9
  querySelectorAll() {
10
10
  return [];
@@ -73,13 +73,9 @@ async function fetchVerifiedBytes(url, asset, receipt) {
73
73
  const bytes = await fetchRuntimeAssetBytes({
74
74
  url,
75
75
  label: asset,
76
- maxAssetBytes: receipt.bytes
77
- });
78
- await verifyRuntimeAssetIntegrity({
79
- asset,
80
- bytes,
81
76
  expected: receipt,
82
- runtimeId: 'FORTRAN'
77
+ verify: (bytes) => verifyRuntimeAssetIntegrity({ asset, bytes, expected: receipt, runtimeId: 'FORTRAN' }),
78
+ maxAssetBytes: receipt.bytes
83
79
  });
84
80
  return bytes;
85
81
  }
@@ -248,6 +244,7 @@ self.onmessage = async (event) => {
248
244
  return;
249
245
  const { code, buffer, load, log, prepare, compileArgs, programArgs, activePath, workspaceFiles, stdin, clangAssets, fortranAssets } = event.data;
250
246
  if (load) {
247
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
251
248
  try {
252
249
  await loadFortranRuntime(clangAssets, fortranAssets, log);
253
250
  postMessage({ load: true });
@@ -1,5 +1,6 @@
1
1
  import { ConsoleStdout, Directory, File, OpenFile, PreopenDirectory, WASI, wasi } from '@bjorn3/browser_wasi_shim';
2
2
  import { installWasiExtractionQuota } from '@wasm-idle/llvm-core';
3
+ import { configureRuntimeAssetCache } from '@wasm-idle/core';
3
4
  import { loadVerifiedHaskellRuntimeAssets, snapshotHaskellRuntimeAssetConfig } from '../haskellAssets';
4
5
  import { waitForBufferedStdin } from '../stdinBuffer';
5
6
  let moduleUrl = '';
@@ -397,6 +398,7 @@ self.onmessage = async (event) => {
397
398
  const { load, moduleUrl: nextModuleUrl, rootfsUrl: nextRootfsUrl, bsdtarUrl: nextBsdtarUrl, integrity: nextIntegrity, maxAssetBytes: nextMaxAssetBytes, mainSoPath: nextMainSoPath, searchDirs: nextSearchDirs, code, prepare, buffer, stdin, ghcArgs = '', activePath = 'main.hs', workspaceFiles = [], log } = event.data;
398
399
  try {
399
400
  if (load) {
401
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
400
402
  const nextConfig = snapshotHaskellRuntimeAssetConfig({
401
403
  moduleUrl: nextModuleUrl,
402
404
  rootfsUrl: nextRootfsUrl,
@@ -1,4 +1,5 @@
1
1
  import { waitForBufferedStdin } from '../stdinBuffer';
2
+ import { configureRuntimeAssetCache } from '@wasm-idle/core';
2
3
  import { loadVerifiedLispRuntimeAssets } from '../lispAssets';
3
4
  let stdinBufferLisp = null;
4
5
  let runtimeConfig = null;
@@ -80,6 +81,7 @@ self.onmessage = async (event) => {
80
81
  const { load, runtimeConfig: nextRuntimeConfig, maxAssetBytes: nextMaxAssetBytes, buffer, code, prepare, args = [], stdin, activePath = 'main.scm', workspaceFiles = [], log } = event.data;
81
82
  try {
82
83
  if (load) {
84
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
83
85
  runtimeConfig = nextRuntimeConfig;
84
86
  runtimeMaxAssetBytes = resolveMaxAssetBytes(nextMaxAssetBytes);
85
87
  if (log) {
@@ -1,5 +1,5 @@
1
1
  import { waitForBufferedStdin } from '../stdinBuffer';
2
- import { verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
2
+ import { configureRuntimeAssetCache, createRuntimeAssetCacheBackend, getRuntimeAssetCacheOptions, resolveRuntimeAssetCacheOptions, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
3
3
  import { fetchRuntimeAssetBytes } from './runtimeAssetFetch';
4
4
  const MAX_OCAML_MANIFEST_BYTES = 4 * 1024 * 1024;
5
5
  const MAX_OCAML_RUNTIME_ENTRY_BYTES = 32 * 1024 * 1024;
@@ -9,6 +9,7 @@ let moduleUrl = '';
9
9
  let manifestUrl = '';
10
10
  let moduleReceipt = null;
11
11
  let manifestReceipt = null;
12
+ let loadPersistentCache;
12
13
  let maxAssetBytes = DEFAULT_MAX_OCAML_ASSET_BYTES;
13
14
  let loadedModuleIdentity = '';
14
15
  let loadedManifestIdentity = '';
@@ -124,6 +125,8 @@ async function loadCompiler(nextModuleUrl, nextReceipt, nextMaxAssetBytes) {
124
125
  const bytes = await fetchRuntimeAssetBytes({
125
126
  url: nextModuleUrl,
126
127
  label: 'OCaml runtime module',
128
+ expected: nextReceipt,
129
+ integrityContext: { runtimeId: 'OCAML' },
127
130
  cache: 'no-store',
128
131
  maxAssetBytes: nextReceipt.bytes
129
132
  });
@@ -218,6 +221,8 @@ async function loadManifest(nextManifestUrl, nextReceipt, nextMaxAssetBytes) {
218
221
  const bytes = await fetchRuntimeAssetBytes({
219
222
  url: nextManifestUrl,
220
223
  label: 'OCaml manifest',
224
+ expected: nextReceipt,
225
+ integrityContext: { runtimeId: 'OCAML' },
221
226
  cache: 'no-store',
222
227
  maxAssetBytes: nextReceipt.bytes
223
228
  });
@@ -493,6 +498,8 @@ self.onmessage = async (event) => {
493
498
  let log = true;
494
499
  try {
495
500
  if (event.data.load) {
501
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
502
+ loadPersistentCache = getRuntimeAssetCacheOptions();
496
503
  moduleUrl = event.data.moduleUrl;
497
504
  manifestUrl = event.data.manifestUrl;
498
505
  moduleReceipt = requireOuterAssetReceipt(event.data.moduleReceipt, 'module');
@@ -504,6 +511,10 @@ self.onmessage = async (event) => {
504
511
  return;
505
512
  }
506
513
  const { code, prepare, target = 'wasm', wasmBinaryenMode = 'fast', log: configuredLog = true, buffer, stdin, activePath = 'main.ml', workspaceFiles = [] } = event.data;
514
+ configureRuntimeAssetCache(resolveRuntimeAssetCacheOptions(loadPersistentCache, event.data.persistentCache));
515
+ const persistentCache = getRuntimeAssetCacheOptions().enabled
516
+ ? createRuntimeAssetCacheBackend()
517
+ : undefined;
507
518
  log = configuredLog;
508
519
  stdinBufferOcaml = buffer ? new Int32Array(buffer) : null;
509
520
  if (log) {
@@ -538,6 +549,7 @@ self.onmessage = async (event) => {
538
549
  system: compilerModule.createBrowserWorkerSystemDispatcher({
539
550
  manifest,
540
551
  runtimeAssets: {
552
+ ...(persistentCache ? { persistentCache } : {}),
541
553
  limits: {
542
554
  maxAssetBytes,
543
555
  maxMetadataBytes: Math.min(MAX_OCAML_MANIFEST_BYTES, maxAssetBytes),
@@ -1,3 +1,4 @@
1
+ import { type RuntimeAssetCacheOptions, type RuntimeAssetIntegrityEntry } from '@wasm-idle/core';
1
2
  export interface RuntimeAssetDownloadProgress {
2
3
  loaded: number;
3
4
  total?: number;
@@ -9,7 +10,16 @@ export interface RuntimeAssetFetchOptions {
9
10
  maxAssetBytes?: number;
10
11
  onProgress?: (progress: RuntimeAssetDownloadProgress) => void;
11
12
  signal?: AbortSignal;
13
+ expected?: RuntimeAssetIntegrityEntry;
14
+ persistentCache?: RuntimeAssetCacheOptions;
15
+ /** Preserve an existing runtime-specific verification boundary, including its diagnostics. */
16
+ verify?: (bytes: Uint8Array) => Promise<unknown>;
17
+ integrityContext?: {
18
+ asset?: string;
19
+ runtimeId?: string;
20
+ profileId?: string;
21
+ };
12
22
  }
13
23
  export declare const DEFAULT_RUNTIME_ASSET_MAX_BYTES: number;
14
24
  export declare function resolveRuntimeAssetUrl(value: string, label: string): URL;
15
- export declare function fetchRuntimeAssetBytes({ url, label, cache, maxAssetBytes, onProgress, signal }: RuntimeAssetFetchOptions): Promise<Uint8Array<ArrayBuffer>>;
25
+ export declare function fetchRuntimeAssetBytes(options: RuntimeAssetFetchOptions): Promise<Uint8Array<ArrayBuffer>>;
@@ -1,3 +1,4 @@
1
+ import { readPersistentRuntimeAsset, resolveRuntimeAssetCacheOptions, verifyRuntimeAssetIntegrity, writePersistentRuntimeAsset } from '@wasm-idle/core';
1
2
  export const DEFAULT_RUNTIME_ASSET_MAX_BYTES = 128 * 1024 * 1024;
2
3
  const DEFAULT_STREAM_BUFFER_BYTES = 64 * 1024;
3
4
  export function resolveRuntimeAssetUrl(value, label) {
@@ -33,7 +34,69 @@ function abortReason(signal) {
33
34
  ? reason
34
35
  : new DOMException('The runtime asset download was aborted', 'AbortError');
35
36
  }
36
- export async function fetchRuntimeAssetBytes({ url, label, cache, maxAssetBytes = DEFAULT_RUNTIME_ASSET_MAX_BYTES, onProgress, signal }) {
37
+ export async function fetchRuntimeAssetBytes(options) {
38
+ // Unpinned custom assets retain their existing network path, with no implicit URL trust.
39
+ if (!options.expected)
40
+ return fetchRuntimeAssetBytesFromNetwork(options);
41
+ const maxAssetBytes = options.maxAssetBytes ?? DEFAULT_RUNTIME_ASSET_MAX_BYTES;
42
+ if (!Number.isSafeInteger(maxAssetBytes) || maxAssetBytes <= 0) {
43
+ throw new TypeError('Runtime asset maxAssetBytes must be a positive safe integer');
44
+ }
45
+ const url = resolveRuntimeAssetUrl(options.url, options.label).href;
46
+ const cache = resolveRuntimeAssetCacheOptions(options.persistentCache);
47
+ const expected = { ...options.expected };
48
+ const candidates = [{ sha256: expected.sha256, bytes: expected.bytes }];
49
+ if (expected.uncompressedSha256 !== undefined && expected.uncompressedBytes !== undefined) {
50
+ candidates.push({ sha256: expected.uncompressedSha256, bytes: expected.uncompressedBytes });
51
+ }
52
+ const validationKey = JSON.stringify([
53
+ 'worker-asset-fetch-v1',
54
+ 'exact-url',
55
+ 'redirect-error',
56
+ 'mime-unchecked',
57
+ maxAssetBytes
58
+ ]);
59
+ for (const receipt of candidates) {
60
+ if (receipt.bytes !== undefined && receipt.bytes > maxAssetBytes)
61
+ continue;
62
+ const hit = await readPersistentRuntimeAsset({
63
+ identity: { url, ...receipt, validationKey },
64
+ cache,
65
+ signal: options.signal
66
+ });
67
+ if (hit) {
68
+ if (hit.byteLength > maxAssetBytes)
69
+ throw new Error(`${options.label} exceeds the ${maxAssetBytes} byte limit`);
70
+ await options.verify?.(hit);
71
+ options.onProgress?.({ loaded: hit.byteLength, total: hit.byteLength });
72
+ if (options.signal?.aborted)
73
+ throw abortReason(options.signal);
74
+ return Uint8Array.from(hit);
75
+ }
76
+ }
77
+ const bytes = await fetchRuntimeAssetBytesFromNetwork(options);
78
+ const isGzip = bytes[0] === 0x1f && bytes[1] === 0x8b;
79
+ const receipt = !isGzip && candidates.length > 1 ? candidates[1] : candidates[0];
80
+ if (options.verify)
81
+ await options.verify(bytes);
82
+ else
83
+ await verifyRuntimeAssetIntegrity({
84
+ asset: url,
85
+ ...options.integrityContext,
86
+ bytes,
87
+ expected: receipt
88
+ });
89
+ await writePersistentRuntimeAsset({
90
+ identity: { url, ...receipt, validationKey },
91
+ cache,
92
+ signal: options.signal,
93
+ bytes
94
+ });
95
+ if (options.signal?.aborted)
96
+ throw abortReason(options.signal);
97
+ return bytes;
98
+ }
99
+ async function fetchRuntimeAssetBytesFromNetwork({ url, label, cache, maxAssetBytes = DEFAULT_RUNTIME_ASSET_MAX_BYTES, onProgress, signal }) {
37
100
  if (!Number.isSafeInteger(maxAssetBytes) || maxAssetBytes <= 0) {
38
101
  throw new TypeError('Runtime asset maxAssetBytes must be a positive safe integer');
39
102
  }
@@ -2,7 +2,7 @@ import { waitForBufferedStdin } from '../stdinBuffer';
2
2
  import { isSharedBufferBackedView } from '../sharedBuffer';
3
3
  import { snapshotRustNonDebugResourceLimits } from '../rustWorkerLimits';
4
4
  import { WASM_RUST_EXECUTABLE_GRAPH_PROFILE, WASM_RUST_RUNTIME_PROFILE } from '../wasmRustVersion';
5
- import { createRuntimeAssetDeliveryBudget } from '@wasm-idle/core';
5
+ import { createRuntimeAssetDeliveryBudget, createRuntimeAssetCacheBackend, resolveRuntimeAssetCacheOptions } from '@wasm-idle/core';
6
6
  const lowercaseSha256Pattern = /^[0-9a-f]{64}$/u;
7
7
  const testOnlyCompilerModuleImporter = import.meta.env.MODE === 'test'
8
8
  ? globalThis.__WASM_IDLE_TEST_ONLY_RUST_COMPILER_MODULE_IMPORTER__
@@ -27,6 +27,7 @@ let loadedCompilerUrl = '';
27
27
  let loadedExecutableGraphFingerprint = '';
28
28
  let acceptedCompilerBootstrap = false;
29
29
  let activeExecution = false;
30
+ let persistentCacheBaseline;
30
31
  let compilerPromise = null;
31
32
  let compiledArtifact = null;
32
33
  let compiledCacheKey = '';
@@ -402,7 +403,7 @@ function createRustDebugHost(options) {
402
403
  };
403
404
  }
404
405
  self.onmessage = async (event) => {
405
- const { load, compilerUrl: nextCompilerUrl, runtimeProfile: nextRuntimeProfile, verifiedModuleUrls: nextVerifiedModuleUrls, executableGraphFingerprint: nextExecutableGraphFingerprint, debugModuleUrl: nextDebugModuleUrl, buffer, debugBuffer, code, prepare, args = [], stdin, targetTriple = 'wasm32-wasip1', log, debug = false, debugMode: requestedDebugMode, breakpoints = [], pauseOnEntry = false, limits: executionLimits } = event.data;
406
+ const { load, persistentCache, compilerUrl: nextCompilerUrl, runtimeProfile: nextRuntimeProfile, verifiedModuleUrls: nextVerifiedModuleUrls, executableGraphFingerprint: nextExecutableGraphFingerprint, debugModuleUrl: nextDebugModuleUrl, buffer, debugBuffer, code, prepare, args = [], stdin, targetTriple = 'wasm32-wasip1', log, debug = false, debugMode: requestedDebugMode, breakpoints = [], pauseOnEntry = false, limits: executionLimits } = event.data;
406
407
  let ownsExecution = false;
407
408
  try {
408
409
  if (load) {
@@ -410,6 +411,7 @@ self.onmessage = async (event) => {
410
411
  throw new Error('wasm-rust application worker accepts exactly one bootstrap');
411
412
  }
412
413
  acceptedCompilerBootstrap = true;
414
+ persistentCacheBaseline = resolveRuntimeAssetCacheOptions(persistentCache);
413
415
  compilerUrl = nextCompilerUrl;
414
416
  debugModuleUrl = nextDebugModuleUrl;
415
417
  runtimeProfile = nextRuntimeProfile || null;
@@ -430,6 +432,10 @@ self.onmessage = async (event) => {
430
432
  }
431
433
  activeExecution = true;
432
434
  ownsExecution = true;
435
+ const executionCache = resolveRuntimeAssetCacheOptions(persistentCacheBaseline, persistentCache);
436
+ const assetCache = executionCache.enabled
437
+ ? createRuntimeAssetCacheBackend(executionCache)
438
+ : undefined;
433
439
  const debugMode = requestedDebugMode === undefined ? (debug ? 'trace' : 'none') : requestedDebugMode;
434
440
  if (debugMode !== 'none' && debugMode !== 'trace' && debugMode !== 'lldb') {
435
441
  throw new Error(`Unsupported Rust debug mode: ${String(debugMode)}`);
@@ -481,6 +487,7 @@ self.onmessage = async (event) => {
481
487
  console.log(`[wasm-idle:rust-worker] compile start prepare=${String(prepare)} target=${targetTriple} bytes=${compileCode.length}`);
482
488
  }
483
489
  const result = await runtime.compiler.compile({
490
+ ...(assetCache ? { assetCache } : {}),
484
491
  code: compileCode,
485
492
  debugMode,
486
493
  ...(nonDebugResourceLimits
@@ -1,3 +1,4 @@
1
+ import { configureRuntimeAssetCache } from '@wasm-idle/core';
1
2
  import { executeStaticRuntimePreflight } from '../staticRuntimePreflightExecute';
2
3
  import { STATIC_RUNTIME_PREFLIGHT_PROTOCOL_VERSION, collectStaticRuntimePreflightTransferables, serializeStaticRuntimePreflightError } from '../staticRuntimePreflightProtocol';
3
4
  const workerSelf = globalThis;
@@ -29,6 +30,7 @@ workerSelf.onmessage = async (event) => {
29
30
  return;
30
31
  handled = true;
31
32
  try {
33
+ configureRuntimeAssetCache(request.persistentCache ?? false);
32
34
  const payload = await executeStaticRuntimePreflight(request, (progress) => {
33
35
  workerSelf.postMessage({
34
36
  protocolVersion: STATIC_RUNTIME_PREFLIGHT_PROTOCOL_VERSION,
@@ -1,6 +1,6 @@
1
1
  import { waitForBufferedStdin } from '../stdinBuffer';
2
2
  import { fetchRuntimeAssetBytes } from './runtimeAssetFetch';
3
- import { verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
3
+ import { configureRuntimeAssetCache, verifyRuntimeAssetIntegrity } from '@wasm-idle/core';
4
4
  let stdinBufferTypeScript = null;
5
5
  let moduleUrl = '';
6
6
  let moduleReceipt = null;
@@ -69,6 +69,8 @@ async function loadRuntime(urlValue, receiptValue, maxAssetBytesValue) {
69
69
  const bytes = await fetchRuntimeAssetBytes({
70
70
  url,
71
71
  label: 'TypeScript runtime module',
72
+ expected: receipt,
73
+ integrityContext: { runtimeId: 'TYPESCRIPT' },
72
74
  maxAssetBytes: receipt.bytes
73
75
  });
74
76
  await verifyRuntimeAssetIntegrity({
@@ -133,6 +135,7 @@ self.onmessage = async (event) => {
133
135
  const { load, moduleUrl: nextModuleUrl, moduleReceipt: nextModuleReceipt, maxAssetBytes: nextMaxAssetBytes, buffer, code, prepare, args = [], stdin, language = 'typescript', activePath = language === 'typescript' ? 'main.ts' : 'main.js', workspaceFiles = [], log } = event.data;
134
136
  try {
135
137
  if (load) {
138
+ configureRuntimeAssetCache(event.data.persistentCache ?? {});
136
139
  const configuredModuleUrl = requireModuleUrl(nextModuleUrl);
137
140
  const configuredModuleReceipt = snapshotModuleReceipt(nextModuleReceipt);
138
141
  const configuredMaxAssetBytes = requireMaxAssetBytes(nextMaxAssetBytes);