@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.
@@ -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 so Safari doesn't choke on
57
- // chunked Transfer-Encoding during instantiateStreaming.
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
- moduleArg.wasmBinary = await resp.arrayBuffer();
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.
@@ -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
- // Browser: pre-fetch as ArrayBuffer so Safari doesn't choke on
57
+ // Pre-fetch as ArrayBuffer so Safari doesn't choke on
57
58
  // chunked Transfer-Encoding during instantiateStreaming.
58
- const wasmUrl = new URL(WASM_PATH, import.meta.url);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/gossip-sdk",
3
- "version": "0.0.2-dev.20260409105143",
3
+ "version": "0.0.2-dev.20260409113004",
4
4
  "description": "Gossip SDK for automation, chatbot, and integration use cases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",