(packageName: string)
| 68 | } |
| 69 | |
| 70 | export async function fetchLatestStableVersion(packageName: string) { |
| 71 | const metadata = await fetchAsJson(packageName, `latest`); |
| 72 | |
| 73 | const {version, dist: {integrity, signatures, shasum}} = metadata; |
| 74 | |
| 75 | if (!shouldSkipIntegrityCheck()) { |
| 76 | try { |
| 77 | verifySignature({ |
| 78 | packageName, version, |
| 79 | integrity, signatures, |
| 80 | }); |
| 81 | } catch (cause) { |
| 82 | // TODO: consider switching to `UsageError` when https://github.com/arcanis/clipanion/issues/157 is fixed |
| 83 | throw new Error(`Corepack cannot download the latest stable version of ${packageName}; you can disable signature verification by setting COREPACK_INTEGRITY_CHECK to 0 in your env, or instruct Corepack to use the latest stable release known by this version of Corepack by setting COREPACK_USE_LATEST to 0`, {cause}); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | return `${version}+${ |
| 88 | integrity ? |
| 89 | `sha512.${Buffer.from(integrity.slice(7), `base64`).toString(`hex`)}` : |
| 90 | `sha1.${shasum}` |
| 91 | }`; |
| 92 | } |
| 93 | |
| 94 | export async function fetchAvailableTags(packageName: string) { |
| 95 | const metadata = await fetchAsJson(packageName); |
nothing calls this directly
no test coverage detected
searching dependent graphs…