Commit f9f207a
Stage tree-sitter.wasm into pre-init/ for relative
On Windows, bun --compile bundles the wasm bytes (build verification
finds them at a known offset) but the JS-level binding from a
node_modules subpath import returns falsy at runtime:
import wasmPath from 'web-tree-sitter/tree-sitter.wasm'
with { type: 'file' }
// wasmPath is undefined on Windows even though the bytes are in
// the binary
Smoke check on the failed release confirmed it directly:
tree-sitter smoke FAIL: pre-init published neither globalThis bytes
nor an env path. The `with { type: 'file' }` import returned falsy.
OpenTUI's own tree-sitter assets work because they're imported via
*relative* paths from inside the package. Mirror that: copy the wasm
into cli/src/pre-init/ before `bun build --compile`, import it
relatively, remove the copy after the build.
- cli/scripts/build-binary.ts: stagePreInitWasm() copies the source
wasm to cli/src/pre-init/tree-sitter.wasm; cleanup runs after the
compile and is also wired to process.on('exit') so a build-script
crash doesn't leave a multi-MB untracked file in the working tree.
The findWebTreeSitterWasm() lookup is shared with the post-build
verification.
- cli/src/pre-init/tree-sitter-wasm.ts: import is now `./tree-sitter.wasm`
(relative). The file is .gitignored so dev-mode runs see no wasm here
and fall through to init-node.ts's path-based resolution, which
works locally because node_modules has the file.
- cli/.gitignore: ignore the staged copy.
Verified locally: build stages then cleans up the wasm,
post-build verification finds the bytes, --smoke-tree-sitter exits 0
with "tree-sitter smoke ok (wasmBinary, 205488 bytes)".
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>with { type: 'file' }
1 parent b1bd842 commit f9f207a
3 files changed
Lines changed: 94 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
| |||
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
189 | 198 | | |
190 | 199 | | |
191 | 200 | | |
| |||
211 | 220 | | |
212 | 221 | | |
213 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
214 | 287 | | |
215 | 288 | | |
216 | 289 | | |
| |||
226 | 299 | | |
227 | 300 | | |
228 | 301 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 302 | + | |
248 | 303 | | |
249 | 304 | | |
250 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
| |||
0 commit comments