You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 99982b9
Browse filesBrowse the repository at this point in the historyBrowse files
pnpm requests abbreviated package metadata (Accept:
application/vnd.npm.install-v1+json). Some registries (e.g. Azure DevOps
Artifacts) ignore that header and return the full CouchDB document, including
per-version fields the installer never reads (scripts, exports, devDependencies,
readme, custom package.json fields). pnpm stored that response verbatim in the
abbreviated metadata cache, so every later resolution re-read and re-parsed
those unused fields.
Fix the response at the boundary where it enters pnpm:
fetchMetadataFromFromRegistry inspects the response Content-Type. When an
abbreviated request comes back with anything other than
application/vnd.npm.install-v1+json, the registry ignored the header and served
the full document, so the fetch layer strips it to the abbreviated field set
(via the existing clearMeta helper) and re-serializes. Registries that honor the
header (the npm registry echoes the abbreviated Content-Type) take an early
return: no clearMeta, no re-serialization.
clearMeta is extracted from pickPackage.ts into its own module so the network
layer can use it without a circular import, and is made null-safe on versions.
pickPackage's abbreviated slot no longer needs special-casing.
Alternative to #12766, which applied the same normalization in
pickPackage; both produce a byte-identical cache, this variant skips the work
for spec-compliant registries and removes resolver special-casing.
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Zoltan Kochan <[email protected]>
Sped up resolution and reduced memory use against registries that ignore npm's abbreviated metadata format and always return the full package document (for example, Azure DevOps Artifacts). pnpm now strips such documents down to the abbreviated field set before caching them. Resolution output is unchanged, and registries that honor the abbreviated format (such as the npm registry) pay no extra cost.
// The list taken from https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-object
5
+
// with the addition of 'libc'
6
+
constABBREVIATED_VERSION_FIELDS=[
7
+
'name',
8
+
'version',
9
+
'bin',
10
+
'directories',
11
+
'devDependencies',
12
+
'optionalDependencies',
13
+
'dependencies',
14
+
'peerDependencies',
15
+
'dist',
16
+
'engines',
17
+
'peerDependenciesMeta',
18
+
'cpu',
19
+
'os',
20
+
'libc',
21
+
'deprecated',
22
+
'bundleDependencies',
23
+
'bundledDependencies',
24
+
'hasInstallScript',
25
+
'_npmUser',
26
+
]asconst
27
+
28
+
/**
29
+
* Reduces a package metadata document to the abbreviated field set that the
0 commit comments