Skip to content

Commit

Permalink
Revert pacote.manifest since it is the same fetch as pacote.packument.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Nov 19, 2023
1 parent 2fe9bf8 commit 5a1e892
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/package-managers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,7 @@ async function viewMany(

let result: any
try {
// when just fetching the dist-tag, use pacote.manifest instead of pacote.packument for a much smaller payload
if (!fullMetadata && fields.length === 1 && fields[0].startsWith('dist-tags.')) {
const [, tag] = fields[0].split('dist-tags.')
const manifest = await pacote.manifest(packageName, npmConfigMerged)
result = {
[`dist-tags.${tag}`]: {
name: packageName,
version: manifest?.version,
},
}
} else {
result = await pacote.packument(packageName, npmConfigMerged)
}
result = await pacote.packument(packageName, npmConfigMerged)
} catch (err: any) {
if (options.retry && ++retried <= options.retry) {
return viewMany(packageName, fieldsExtended, currentVersion, options, retried, npmConfigLocal)
Expand Down

0 comments on commit 5a1e892

Please sign in to comment.