Skip to content

Commit d29b77a

Browse files
committed
add default path for tree-sitter.wasm
1 parent 48b7115 commit d29b77a

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

packages/code-map/src/init-node.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,19 @@ export async function initTreeSitterForNode(): Promise<void> {
5454
if (fs.existsSync(fallback)) {
5555
return fallback
5656
}
57-
for (const sharedWasm of sharedWasms) {
58-
if (fs.existsSync(path.dirname(sharedWasm))) {
59-
return sharedWasm
60-
}
57+
58+
// Find the installed package root
59+
const pkgDir = path.dirname(require.resolve('web-tree-sitter'))
60+
// The wasm ships at: node_modules/web-tree-sitter/tree-sitter.wasm
61+
const wasm = path.join(pkgDir, 'tree-sitter.wasm')
62+
if (fs.existsSync(wasm)) {
63+
return wasm
6164
}
62-
// Return our preferred path and let web-tree-sitter handle the error
63-
return sharedWasms[0]
65+
throw new Error(
66+
`Internal error: web-tree-sitter/tree-sitter.wasm not found at ${wasm}. Ensure the file is included in your deployment bundle.`,
67+
)
6468
}
69+
6570
// For other files, use default behavior
6671
return path.join(scriptDir, name)
6772
},

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@codebuff/sdk",
33
"private": false,
4-
"version": "0.3.11",
4+
"version": "0.3.12",
55
"description": "Official SDK for Codebuff — AI coding agent & framework",
66
"license": "Apache-2.0",
77
"type": "module",

0 commit comments

Comments
 (0)