codebuff 1.0.654 → 1.0.667
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.
- package/index.js +21 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -383,6 +383,27 @@ async function downloadBinary(version) {
|
|
|
383
383
|
}
|
|
384
384
|
fs.renameSync(tempBinaryPath, CONFIG.binaryPath)
|
|
385
385
|
|
|
386
|
+
// Move tree-sitter.wasm next to the binary if the tarball included
|
|
387
|
+
// it. The CLI binary loads this at startup; embedding it inside the
|
|
388
|
+
// binary itself was unreliable on Windows (bun --compile asset
|
|
389
|
+
// bundling silently dropped or unbound it across several attempts),
|
|
390
|
+
// so we ship it as a sibling file instead. Older artifacts that
|
|
391
|
+
// pre-date this change won't have the wasm and will still install —
|
|
392
|
+
// they'll just hit the same crash they had before, which is fine.
|
|
393
|
+
const tempWasmPath = path.join(CONFIG.tempDownloadDir, 'tree-sitter.wasm')
|
|
394
|
+
if (fs.existsSync(tempWasmPath)) {
|
|
395
|
+
const targetWasmPath = path.join(
|
|
396
|
+
path.dirname(CONFIG.binaryPath),
|
|
397
|
+
'tree-sitter.wasm',
|
|
398
|
+
)
|
|
399
|
+
try {
|
|
400
|
+
if (fs.existsSync(targetWasmPath)) fs.unlinkSync(targetWasmPath)
|
|
401
|
+
} catch {
|
|
402
|
+
// best effort; rename below will surface the real error if it matters
|
|
403
|
+
}
|
|
404
|
+
fs.renameSync(tempWasmPath, targetWasmPath)
|
|
405
|
+
}
|
|
406
|
+
|
|
386
407
|
// Save version metadata for fast version checking
|
|
387
408
|
fs.writeFileSync(
|
|
388
409
|
CONFIG.metadataPath,
|