freebuff 0.0.64 → 0.0.74
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
|
@@ -373,6 +373,27 @@ async function downloadBinary(version) {
|
|
|
373
373
|
}
|
|
374
374
|
fs.renameSync(tempBinaryPath, CONFIG.binaryPath)
|
|
375
375
|
|
|
376
|
+
// Move tree-sitter.wasm next to the binary if the tarball included
|
|
377
|
+
// it. The CLI binary loads this at startup; embedding it inside the
|
|
378
|
+
// binary itself was unreliable on Windows (bun --compile asset
|
|
379
|
+
// bundling silently dropped or unbound it across several attempts),
|
|
380
|
+
// so we ship it as a sibling file instead. Older artifacts that
|
|
381
|
+
// pre-date this change won't have the wasm and will still install —
|
|
382
|
+
// they'll just hit the same crash they had before, which is fine.
|
|
383
|
+
const tempWasmPath = path.join(CONFIG.tempDownloadDir, 'tree-sitter.wasm')
|
|
384
|
+
if (fs.existsSync(tempWasmPath)) {
|
|
385
|
+
const targetWasmPath = path.join(
|
|
386
|
+
path.dirname(CONFIG.binaryPath),
|
|
387
|
+
'tree-sitter.wasm',
|
|
388
|
+
)
|
|
389
|
+
try {
|
|
390
|
+
if (fs.existsSync(targetWasmPath)) fs.unlinkSync(targetWasmPath)
|
|
391
|
+
} catch {
|
|
392
|
+
// best effort; rename below will surface the real error if it matters
|
|
393
|
+
}
|
|
394
|
+
fs.renameSync(tempWasmPath, targetWasmPath)
|
|
395
|
+
}
|
|
396
|
+
|
|
376
397
|
fs.writeFileSync(
|
|
377
398
|
CONFIG.metadataPath,
|
|
378
399
|
JSON.stringify({ version }, null, 2),
|