Skip to content

Commit 2fe131a

Browse files
committed
fix env thing
1 parent 1c56ed2 commit 2fe131a

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

cli/src/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ async function main(): Promise<void> {
195195
const wasmBinary = (
196196
globalThis as { __CODEBUFF_TREE_SITTER_WASM_BINARY__?: Uint8Array }
197197
).__CODEBUFF_TREE_SITTER_WASM_BINARY__
198-
const wasmPath = process.env.CODEBUFF_TREE_SITTER_WASM_PATH
198+
const wasmPath = (
199+
globalThis as { __CODEBUFF_TREE_SITTER_WASM_PATH__?: string }
200+
).__CODEBUFF_TREE_SITTER_WASM_PATH__
199201

200202
// Diagnostic dump so CI logs (and bug reports) show exactly what
201203
// the runtime saw when smoke fails. process.execPath, the
@@ -216,7 +218,7 @@ async function main(): Promise<void> {
216218
`[smoke diag] siblingPath=${siblingPath}\n` +
217219
`[smoke diag] siblingExists=${fs.existsSync(siblingPath)}\n` +
218220
`[smoke diag] dir contents (${dirListing.length}): ${dirListing.slice(0, 30).join(', ')}\n` +
219-
`[smoke diag] env.CODEBUFF_TREE_SITTER_WASM_PATH=${wasmPath ?? '<unset>'}\n` +
221+
`[smoke diag] globalThis wasmPath=${wasmPath ?? '<unset>'}\n` +
220222
`[smoke diag] globalThis wasmBinary bytes=${wasmBinary?.byteLength ?? 0}\n`,
221223
)
222224

cli/src/pre-init/tree-sitter-wasm.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ if (siblingPath) {
6262
// emscripten, which fs.readFile's it.
6363
process.env.CODEBUFF_TREE_SITTER_WASM_PATH = siblingPath
6464

65+
// Also publish on globalThis so the smoke handler in index.tsx can
66+
// read it without touching process.env (which is gated by the env
67+
// architecture check outside the allowlisted pre-init files).
68+
;(
69+
globalThis as { __CODEBUFF_TREE_SITTER_WASM_PATH__?: string }
70+
).__CODEBUFF_TREE_SITTER_WASM_PATH__ = siblingPath
71+
6572
// Also try the synchronous-bytes path: hand the bytes straight to
6673
// Parser.init({ wasmBinary }) so the SDK doesn't need to round-trip
6774
// through emscripten's path resolution. Both channels feed the same

0 commit comments

Comments
 (0)