fix: resolve 'latest' to actual version when caching plugins (#5292)

This commit is contained in:
Nick 2025-12-09 23:07:59 +02:00 committed by GitHub
parent 802b862aae
commit c33a90320c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,7 +127,18 @@ export namespace BunProc {
await runInstall()
parsed.dependencies[pkg] = version
// Resolve actual version from installed package when using "latest"
// This ensures subsequent starts use the cached version until explicitly updated
let resolvedVersion = version
if (version === "latest") {
const installedPkgJson = Bun.file(path.join(mod, "package.json"))
const installedPkg = await installedPkgJson.json().catch(() => null)
if (installedPkg?.version) {
resolvedVersion = installedPkg.version
}
}
parsed.dependencies[pkg] = resolvedVersion
await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2))
return mod
}