@pnpm/resolving.npm-resolver 1102.1.3 → 1102.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +6 -6
- package/lib/clearMeta.d.ts +0 -16
- package/lib/clearMeta.js +0 -55
- package/lib/createNpmResolutionVerifier.d.ts +0 -89
- package/lib/createNpmResolutionVerifier.js +0 -724
- package/lib/fetch.d.ts +0 -37
- package/lib/fetch.js +0 -224
- package/lib/fetchAttestationPublishedAt.d.ts +0 -31
- package/lib/fetchAttestationPublishedAt.js +0 -99
- package/lib/fetchFullMetadataCached.d.ts +0 -33
- package/lib/fetchFullMetadataCached.js +0 -63
- package/lib/index.d.ts +0 -133
- package/lib/memoizeFetchMetadata.d.ts +0 -24
- package/lib/memoizeFetchMetadata.js +0 -37
- package/lib/normalizeRegistryUrl.d.ts +0 -4
- package/lib/normalizeRegistryUrl.js +0 -12
- package/lib/parseBareSpecifier.d.ts +0 -16
- package/lib/parseBareSpecifier.js +0 -143
- package/lib/pickPackage.d.ts +0 -109
- package/lib/pickPackage.js +0 -631
- package/lib/pickPackageFromMeta.d.ts +0 -20
- package/lib/pickPackageFromMeta.js +0 -227
- package/lib/toRaw.d.ts +0 -2
- package/lib/toRaw.js +0 -4
- package/lib/trustChecks.d.ts +0 -9
- package/lib/trustChecks.js +0 -96
- package/lib/violationCodes.d.ts +0 -14
- package/lib/violationCodes.js +0 -15
- package/lib/whichVersionIsPinned.d.ts +0 -2
- package/lib/whichVersionIsPinned.js +0 -36
- package/lib/workspacePrefToNpm.d.ts +0 -1
- package/lib/workspacePrefToNpm.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @pnpm/npm-resolver
|
|
2
2
|
|
|
3
|
+
## 1102.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Recover from a metadata cache entry that disappears (concurrent cache cleanup, antivirus) after the registry has already answered the conditional request with `304 Not Modified`. The metadata is re-requested once without cache validators instead of failing the install with `ERR_PNPM_CACHE_MISSING_AFTER_304`.
|
|
8
|
+
|
|
9
|
+
- Fixed an out-of-memory regression when workspace projects concurrently resolve a package with large registry metadata [pnpm/pnpm#13077](https://github.com/pnpm/pnpm/issues/13077).
|
|
10
|
+
|
|
11
|
+
- Fixed `pnpm update` rewriting exact version pins that use the `=` operator (for example `=3.5.1`) to a caret range (`^3.5.1`). Exact pins are now preserved and written back as the bare version. See pnpm/pnpm#12745.
|
|
12
|
+
|
|
13
|
+
## 1102.1.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies:
|
|
18
|
+
- @pnpm/core-loggers@1100.2.3
|
|
19
|
+
|
|
3
20
|
## 1102.1.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.npm-resolver",
|
|
3
|
-
"version": "1102.1.
|
|
3
|
+
"version": "1102.1.5",
|
|
4
4
|
"description": "Resolver for npm-hosted packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@pnpm/config.pick-registry-for-package": "1100.0.10",
|
|
33
33
|
"@pnpm/config.version-policy": "1100.1.7",
|
|
34
34
|
"@pnpm/constants": "1100.0.0",
|
|
35
|
-
"@pnpm/core-loggers": "1100.2.
|
|
35
|
+
"@pnpm/core-loggers": "1100.2.3",
|
|
36
36
|
"@pnpm/crypto.hash": "1100.0.1",
|
|
37
37
|
"@pnpm/error": "1100.0.1",
|
|
38
38
|
"@pnpm/fetching.types": "1100.0.2",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@pnpm/logger": "^1100.0.0",
|
|
66
|
-
"@pnpm/worker": "^1100.2.
|
|
66
|
+
"@pnpm/worker": "^1100.2.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@jest/globals": "30.4.1",
|
|
70
70
|
"@pnpm/logger": "1100.0.0",
|
|
71
|
-
"@pnpm/network.fetch": "1100.1.
|
|
72
|
-
"@pnpm/resolving.npm-resolver": "1102.1.
|
|
71
|
+
"@pnpm/network.fetch": "1100.1.6",
|
|
72
|
+
"@pnpm/resolving.npm-resolver": "1102.1.5",
|
|
73
73
|
"@pnpm/test-fixtures": "1100.0.0",
|
|
74
|
-
"@pnpm/testing.mock-agent": "1101.0.
|
|
74
|
+
"@pnpm/testing.mock-agent": "1101.0.6",
|
|
75
75
|
"@types/normalize-path": "^3.0.2",
|
|
76
76
|
"@types/ramda": "0.31.1",
|
|
77
77
|
"@types/semver": "7.7.1",
|
package/lib/clearMeta.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PackageMeta } from '@pnpm/resolving.registry.types';
|
|
2
|
-
/**
|
|
3
|
-
* Reduces a package metadata document to the abbreviated field set that the
|
|
4
|
-
* resolver actually reads, dropping install-irrelevant fields (scripts,
|
|
5
|
-
* exports, readme, custom `_`-prefixed fields, etc.).
|
|
6
|
-
*
|
|
7
|
-
* Used in two places:
|
|
8
|
-
* - The network layer (`fetch.ts`) normalizes a registry that ignored the
|
|
9
|
-
* abbreviated `Accept` header and returned a full document.
|
|
10
|
-
* - The resolver (`pickPackage.ts`) narrows a deliberately-fetched full
|
|
11
|
-
* document into the `filterMetadata` cache slot.
|
|
12
|
-
*
|
|
13
|
-
* Null-safe on `versions` so it can be called on an unpublished package (no
|
|
14
|
-
* versions), which the abbreviated path can reach.
|
|
15
|
-
*/
|
|
16
|
-
export declare function clearMeta(pkg: PackageMeta): PackageMeta;
|
package/lib/clearMeta.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { pick } from 'ramda';
|
|
2
|
-
// The list taken from https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-object
|
|
3
|
-
// with the addition of 'libc'
|
|
4
|
-
const ABBREVIATED_VERSION_FIELDS = [
|
|
5
|
-
'name',
|
|
6
|
-
'version',
|
|
7
|
-
'bin',
|
|
8
|
-
'directories',
|
|
9
|
-
'devDependencies',
|
|
10
|
-
'optionalDependencies',
|
|
11
|
-
'dependencies',
|
|
12
|
-
'peerDependencies',
|
|
13
|
-
'dist',
|
|
14
|
-
'engines',
|
|
15
|
-
'peerDependenciesMeta',
|
|
16
|
-
'cpu',
|
|
17
|
-
'os',
|
|
18
|
-
'libc',
|
|
19
|
-
'deprecated',
|
|
20
|
-
'bundleDependencies',
|
|
21
|
-
'bundledDependencies',
|
|
22
|
-
'hasInstallScript',
|
|
23
|
-
'_npmUser',
|
|
24
|
-
];
|
|
25
|
-
/**
|
|
26
|
-
* Reduces a package metadata document to the abbreviated field set that the
|
|
27
|
-
* resolver actually reads, dropping install-irrelevant fields (scripts,
|
|
28
|
-
* exports, readme, custom `_`-prefixed fields, etc.).
|
|
29
|
-
*
|
|
30
|
-
* Used in two places:
|
|
31
|
-
* - The network layer (`fetch.ts`) normalizes a registry that ignored the
|
|
32
|
-
* abbreviated `Accept` header and returned a full document.
|
|
33
|
-
* - The resolver (`pickPackage.ts`) narrows a deliberately-fetched full
|
|
34
|
-
* document into the `filterMetadata` cache slot.
|
|
35
|
-
*
|
|
36
|
-
* Null-safe on `versions` so it can be called on an unpublished package (no
|
|
37
|
-
* versions), which the abbreviated path can reach.
|
|
38
|
-
*/
|
|
39
|
-
export function clearMeta(pkg) {
|
|
40
|
-
// A null prototype so that a registry-controlled version key named
|
|
41
|
-
// `__proto__` becomes a regular own property instead of mutating the
|
|
42
|
-
// prototype of the map (js/prototype-polluting-assignment).
|
|
43
|
-
const versions = Object.create(null);
|
|
44
|
-
for (const [version, info] of Object.entries(pkg.versions ?? {})) {
|
|
45
|
-
versions[version] = pick(ABBREVIATED_VERSION_FIELDS, info);
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
name: pkg.name,
|
|
49
|
-
'dist-tags': pkg['dist-tags'],
|
|
50
|
-
versions,
|
|
51
|
-
time: pkg.time,
|
|
52
|
-
modified: pkg.modified,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=clearMeta.js.map
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { GetAuthHeader } from '@pnpm/fetching.types';
|
|
2
|
-
import { type ResolutionVerifier } from '@pnpm/resolving.resolver-base';
|
|
3
|
-
import type { Registries, TrustPolicy } from '@pnpm/types';
|
|
4
|
-
import type { FetchMetadataFromFromRegistryOptions } from './fetch.js';
|
|
5
|
-
import { type FetchFullMetadataCachedOptions } from './fetchFullMetadataCached.js';
|
|
6
|
-
import type { PackageMetaCache } from './pickPackage.js';
|
|
7
|
-
export interface CreateNpmResolutionVerifierOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Minimum age (in minutes) a published version must reach before it is
|
|
10
|
-
* accepted. When unset, the verifier is a no-op for the age check.
|
|
11
|
-
*/
|
|
12
|
-
minimumReleaseAge?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Retained on the options bag because the resolver path branches on it
|
|
15
|
-
* (the lowest-version fallback) and tests forward both fields together.
|
|
16
|
-
* The verifier itself no longer gates on this flag — once the loose-mode
|
|
17
|
-
* auto-collect makes every accepted-immature pin explicit in
|
|
18
|
-
* `minimumReleaseAgeExclude`, running the verifier in loose mode is the
|
|
19
|
-
* thing that proves the manifest stays in sync with the lockfile.
|
|
20
|
-
*/
|
|
21
|
-
minimumReleaseAgeStrict?: boolean;
|
|
22
|
-
minimumReleaseAgeExclude?: string[];
|
|
23
|
-
/**
|
|
24
|
-
* When the registry's metadata lacks the per-version `time` field
|
|
25
|
-
* (some self-hosted registries strip it), the verifier can't apply
|
|
26
|
-
* the maturity cutoff. Set this to `true` to mirror the resolver's
|
|
27
|
-
* `pickMatchingVersionFinal` warn-and-skip behavior — the verifier
|
|
28
|
-
* passes the entry with a one-time `globalWarn`, instead of failing
|
|
29
|
-
* closed. Defaults to `false` so the verifier stays stricter than
|
|
30
|
-
* the resolver only when the user has explicitly opted in to the
|
|
31
|
-
* skip on the resolver side.
|
|
32
|
-
*/
|
|
33
|
-
ignoreMissingTimeField?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* `'no-downgrade'` rejects a lockfile entry whose version has weaker
|
|
36
|
-
* trust evidence (no attestations) than an earlier-published version
|
|
37
|
-
* had. This mirrors the resolver-time `failIfTrustDowngraded` check
|
|
38
|
-
* applied during fresh resolution — the verifier catches the same
|
|
39
|
-
* supply-chain signal on entries that bypassed resolution (peek-path,
|
|
40
|
-
* frozen lockfile, etc.).
|
|
41
|
-
*/
|
|
42
|
-
trustPolicy?: TrustPolicy;
|
|
43
|
-
trustPolicyExclude?: string[];
|
|
44
|
-
trustPolicyIgnoreAfter?: number;
|
|
45
|
-
registries: Registries;
|
|
46
|
-
/**
|
|
47
|
-
* Registries reached via the named-registry resolver chain (e.g. `gh:` →
|
|
48
|
-
* GitHub Packages). When a lockfile entry's tarball URL falls under one of
|
|
49
|
-
* these registry base URLs, route the manifest fetch there instead of the
|
|
50
|
-
* scope-derived default.
|
|
51
|
-
*/
|
|
52
|
-
namedRegistries?: Record<string, string>;
|
|
53
|
-
/**
|
|
54
|
-
* Cache-aware full-metadata fetcher. Decoupled from the resolver pipeline
|
|
55
|
-
* so abbreviated metadata and `peekManifestFromStore` fast paths cannot
|
|
56
|
-
* hide the publish timestamp.
|
|
57
|
-
*/
|
|
58
|
-
fetchOpts: FetchMetadataFromFromRegistryOptions;
|
|
59
|
-
getAuthHeaderValueByURI: GetAuthHeader;
|
|
60
|
-
cacheDir?: FetchFullMetadataCachedOptions['cacheDir'];
|
|
61
|
-
/**
|
|
62
|
-
* Per-install LRU shared with the npm resolver's `pickPackage`
|
|
63
|
-
* (`{ get, set }` over `PackageMeta`). When provided, the verifier
|
|
64
|
-
* consults it before fetching: a name the resolver already pulled
|
|
65
|
-
* during the same install yields the cached packument instead of a
|
|
66
|
-
* fresh disk/network round-trip. Optional — frozen-install paths and
|
|
67
|
-
* unit tests don't have a resolver running alongside, in which case
|
|
68
|
-
* the verifier falls back to its own fetch chain.
|
|
69
|
-
*/
|
|
70
|
-
metaCache?: PackageMetaCache;
|
|
71
|
-
/** Overrides Date.now() for tests. */
|
|
72
|
-
now?: number;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns a `ResolutionVerifier` for npm-registry-resolved lockfile
|
|
76
|
-
* entries. It always binds each entry's recorded tarball URL to the
|
|
77
|
-
* artifact the registry's metadata lists (an anti-tamper check that does
|
|
78
|
-
* not depend on any policy), and additionally re-applies the
|
|
79
|
-
* `minimumReleaseAge` and/or `trustPolicy='no-downgrade'` policies when
|
|
80
|
-
* those are configured. Pairs with `createNpmResolver`: each resolver
|
|
81
|
-
* factory may export a sibling verifier factory that the default-resolver
|
|
82
|
-
* combines.
|
|
83
|
-
*
|
|
84
|
-
* Designed for fail-closed semantics: if the manifest can't be loaded or
|
|
85
|
-
* the pinned version is missing from it, the verifier reports a violation
|
|
86
|
-
* rather than silently passing. Mirrors the post-resolution gate bun added
|
|
87
|
-
* for the same shape of bug in oven-sh/bun#30526.
|
|
88
|
-
*/
|
|
89
|
-
export declare function createNpmResolutionVerifier(opts: CreateNpmResolutionVerifierOptions): ResolutionVerifier;
|