Fix crash when a package does not contain a version (retracted packages)

This commit is contained in:
Sander Declerck 2025-10-21 14:29:17 +02:00
parent b935f8d4f4
commit da865f855d
No known key found for this signature in database

View file

@ -25,6 +25,10 @@ export async function resolvePackageVersion(packageName, versionRange) {
return distTags[versionRange];
}
if (!packageInfo.versions) {
return null;
}
// If the version range is not a dist-tag, we need to resolve the highest version matching the range.
// This is useful for ranges like "^1.0.0" or "~2.3.4".
const availableVersions = Object.keys(packageInfo.versions);