(name: string)
| 21 | * @returns Latest version string or null if not found |
| 22 | */ |
| 23 | export async function fetchLatestVersionWithFallback(name: string): Promise<string | null> { |
| 24 | const version = await fetchLatestVersion(name) |
| 25 | if (version) return version |
| 26 | |
| 27 | // Fallback to full packument (also cached) |
| 28 | try { |
| 29 | const packument = await fetchNpmPackage(name) |
| 30 | return packument['dist-tags']?.latest ?? null |
| 31 | } catch { |
| 32 | return null |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Check if a version constraint explicitly includes a prerelease tag. |
no test coverage detected