Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/core/src/lib/tree-sitter/download-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ export class DownloadUtils {
try {
const cachedContent = await Bun.file(cacheFile).arrayBuffer()
if (cachedContent.byteLength > 0) {
console.log(`Loaded from cache: ${cacheFile} (${source})`)
return { content: cachedContent, filePath: cacheFile }
}
} catch (error) {
// Cache miss, continue to fetch
}

try {
console.log(`Downloading from URL: ${source}`)
const response = await fetch(source)
if (!response.ok) {
return { error: `Failed to fetch from ${source}: ${response.statusText}` }
Expand All @@ -64,7 +62,6 @@ export class DownloadUtils {

try {
await writeFile(cacheFile, Buffer.from(content))
console.log(`Cached: ${source}`)
} catch (cacheError) {
console.warn(`Failed to cache: ${cacheError}`)
}
Expand All @@ -75,7 +72,6 @@ export class DownloadUtils {
}
} else {
try {
console.log(`Loading from local path: ${source}`)
const content = await Bun.file(source).arrayBuffer()
return { content, filePath: source }
} catch (error) {
Expand All @@ -94,23 +90,20 @@ export class DownloadUtils {

if (isUrl) {
try {
console.log(`Downloading from URL: ${source}`)
const response = await fetch(source)
if (!response.ok) {
return { error: `Failed to fetch from ${source}: ${response.statusText}` }
}
const content = await response.arrayBuffer()

await writeFile(targetPath, Buffer.from(content))
console.log(`Downloaded: ${source} -> ${targetPath}`)

return { content, filePath: targetPath }
} catch (error) {
return { error: `Error downloading from ${source}: ${error}` }
}
} else {
try {
console.log(`Copying from local path: ${source}`)
const content = await Bun.file(source).arrayBuffer()
await writeFile(targetPath, Buffer.from(content))
return { content, filePath: targetPath }
Expand Down
Loading