revert changes to npmView (#319352)

This commit is contained in:
Martin Aeschlimann
2026-06-01 18:23:22 +01:00
committed by GitHub
parent 1e5f330ffe
commit a32f3aed02

View File

@@ -323,18 +323,16 @@ export class PackageJSONContribution implements IJSONContribution {
}
private async npmView(npmCommandPath: string, pack: string, resource: Uri | undefined): Promise<ViewPackageInfo | undefined> {
// Request @latest to avoid fetching publish timestamps for all versions in the time field.
const args = ['view', '--json', '--', `${pack}@latest`, 'description', 'homepage', 'version', 'time'];
const args = ['view', '--json', '--', pack, 'description', 'dist-tags.latest', 'homepage', 'version', 'time'];
const stdout = await this.runNpmCommand(npmCommandPath, args, resource);
if (stdout) {
try {
const content = JSON.parse(stdout);
const version = content['version'];
const version = content['dist-tags.latest'] || content['version'];
return {
description: content['description'],
version: content['version'],
time: version ? content['time']?.[version] : undefined,
version,
time: content.time?.[version],
homepage: content['homepage']
};
} catch (e) {