@massalabs/gossip-sdk 0.0.2-dev.20260409105143 → 0.0.2-dev.20260409113004
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/dist/db/sqlite-worker.js +10 -3
- package/dist/wasm/loader.js +3 -3
- package/package.json +1 -1
package/dist/db/sqlite-worker.js
CHANGED
|
@@ -53,11 +53,18 @@ async function handleMessage(e) {
|
|
|
53
53
|
case 'init': {
|
|
54
54
|
const { dbPath, wasmUrl, initSql, useOPFS } = e.data;
|
|
55
55
|
const moduleArg = {};
|
|
56
|
-
// Pre-fetch WASM as ArrayBuffer
|
|
57
|
-
//
|
|
56
|
+
// Pre-fetch WASM as ArrayBuffer and override instantiateWasm
|
|
57
|
+
// so Emscripten never calls instantiateStreaming (Safari chokes
|
|
58
|
+
// on chunked Transfer-Encoding).
|
|
58
59
|
if (wasmUrl) {
|
|
59
60
|
const resp = await fetch(wasmUrl);
|
|
60
|
-
|
|
61
|
+
const bytes = await resp.arrayBuffer();
|
|
62
|
+
moduleArg.instantiateWasm = (imports, successCallback) => {
|
|
63
|
+
WebAssembly.instantiate(bytes, imports).then(result => {
|
|
64
|
+
successCallback(result.instance, result.module);
|
|
65
|
+
});
|
|
66
|
+
return {};
|
|
67
|
+
};
|
|
61
68
|
}
|
|
62
69
|
// Load the right WASM build + VFS.
|
|
63
70
|
// NOTE: import() paths must be string literals — Vite can't resolve variables.
|
package/dist/wasm/loader.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* - Node.js / Jiti: init(bytes) with WASM bytes read from the filesystem
|
|
8
8
|
*/
|
|
9
9
|
import { init } from './bindings.js';
|
|
10
|
+
import gossipWasmUrl from '../assets/generated/wasm/gossip_wasm_bg.wasm?url';
|
|
10
11
|
const WASM_PATH = '../assets/generated/wasm/gossip_wasm_bg.wasm';
|
|
11
12
|
/**
|
|
12
13
|
* WASM Initialization State
|
|
@@ -53,10 +54,9 @@ export async function initializeWasm() {
|
|
|
53
54
|
await init(wasmBytes);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
|
-
//
|
|
57
|
+
// Pre-fetch as ArrayBuffer so Safari doesn't choke on
|
|
57
58
|
// chunked Transfer-Encoding during instantiateStreaming.
|
|
58
|
-
const
|
|
59
|
-
const resp = await fetch(wasmUrl);
|
|
59
|
+
const resp = await fetch(gossipWasmUrl);
|
|
60
60
|
const wasmBytes = await resp.arrayBuffer();
|
|
61
61
|
await init(wasmBytes);
|
|
62
62
|
}
|
package/package.json
CHANGED