snatching amp's walkthrough for my own purposes mwhahaha traverse.dunkirk.sh/diagram/6121f05c-a5ef-4ecf-8ffc-02534c5e767c

chore: fix wasm path

dunkirk.sh 7eed8725 a0b5a662

verified
+31 -3
+3 -2
package.json
··· 1 1 { 2 2 "name": "@taciturnaxolotl/traverse", 3 - "version": "0.1.4", 3 + "version": "0.1.7", 4 4 "description": "Interactive code walkthrough diagrams via MCP", 5 5 "module": "src/index.ts", 6 6 "type": "module", 7 7 "bin": { 8 - "traverse": "./bin/traverse.cjs" 8 + "traverse": "bin/traverse.cjs" 9 9 }, 10 10 "files": [ 11 11 "src", 12 12 "bin", 13 13 "fonts", 14 + "vendor", 14 15 "icon.svg" 15 16 ], 16 17 "scripts": {
+28 -1
src/og.ts
··· 10 10 ]); 11 11 12 12 // Initialize resvg-wasm 13 - const wasmPath = join(import.meta.dir, "../node_modules/@resvg/resvg-wasm/index_bg.wasm"); 13 + // Try bundled WASM first, then fall back to node_modules 14 + const possiblePaths = [ 15 + // Bundled WASM file (most reliable) 16 + join(import.meta.dir, "../vendor/index_bg.wasm"), 17 + // Development: node_modules is a sibling of src 18 + join(import.meta.dir, "../node_modules/@resvg/resvg-wasm/index_bg.wasm"), 19 + // Installed: in parent node_modules 20 + join(import.meta.dir, "../../@resvg/resvg-wasm/index_bg.wasm"), 21 + join(import.meta.dir, "../../../@resvg/resvg-wasm/index_bg.wasm"), 22 + ]; 23 + 24 + let wasmPath: string | undefined; 25 + for (const path of possiblePaths) { 26 + if (await Bun.file(path).exists()) { 27 + wasmPath = path; 28 + break; 29 + } 30 + } 31 + 32 + if (!wasmPath) { 33 + console.error("Failed to find @resvg/resvg-wasm WASM file. Tried:"); 34 + for (const path of possiblePaths) { 35 + console.error(` - ${path}`); 36 + } 37 + console.error(`\nCurrent directory: ${import.meta.dir}`); 38 + throw new Error("Could not find @resvg/resvg-wasm WASM file"); 39 + } 40 + 14 41 await initWasm(Bun.file(wasmPath).arrayBuffer()); 15 42 16 43 // Cache generated images by diagram ID
vendor/index_bg.wasm

This is a binary file and will not be displayed.