@massalabs/gossip-sdk 0.0.2-dev.20260408115913 → 0.0.2-dev.20260409105143
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 +6 -2
- package/dist/wasm/loader.js +8 -3
- package/package.json +1 -1
package/dist/db/sqlite-worker.js
CHANGED
|
@@ -53,8 +53,12 @@ async function handleMessage(e) {
|
|
|
53
53
|
case 'init': {
|
|
54
54
|
const { dbPath, wasmUrl, initSql, useOPFS } = e.data;
|
|
55
55
|
const moduleArg = {};
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
// Pre-fetch WASM as ArrayBuffer so Safari doesn't choke on
|
|
57
|
+
// chunked Transfer-Encoding during instantiateStreaming.
|
|
58
|
+
if (wasmUrl) {
|
|
59
|
+
const resp = await fetch(wasmUrl);
|
|
60
|
+
moduleArg.wasmBinary = await resp.arrayBuffer();
|
|
61
|
+
}
|
|
58
62
|
// Load the right WASM build + VFS.
|
|
59
63
|
// NOTE: import() paths must be string literals — Vite can't resolve variables.
|
|
60
64
|
if (useOPFS) {
|
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
|
+
const WASM_PATH = '../assets/generated/wasm/gossip_wasm_bg.wasm';
|
|
10
11
|
/**
|
|
11
12
|
* WASM Initialization State
|
|
12
13
|
*/
|
|
@@ -47,13 +48,17 @@ export async function initializeWasm() {
|
|
|
47
48
|
const url = await import('node:url');
|
|
48
49
|
const path = await import('node:path');
|
|
49
50
|
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
50
|
-
const wasmPath = path.resolve(currentDir,
|
|
51
|
+
const wasmPath = path.resolve(currentDir, WASM_PATH);
|
|
51
52
|
const wasmBytes = fs.readFileSync(wasmPath);
|
|
52
53
|
await init(wasmBytes);
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
|
-
// Browser:
|
|
56
|
-
|
|
56
|
+
// Browser: pre-fetch as ArrayBuffer so Safari doesn't choke on
|
|
57
|
+
// chunked Transfer-Encoding during instantiateStreaming.
|
|
58
|
+
const wasmUrl = new URL(WASM_PATH, import.meta.url);
|
|
59
|
+
const resp = await fetch(wasmUrl);
|
|
60
|
+
const wasmBytes = await resp.arrayBuffer();
|
|
61
|
+
await init(wasmBytes);
|
|
57
62
|
}
|
|
58
63
|
isInitialized = true;
|
|
59
64
|
isInitializing = false;
|
package/package.json
CHANGED