@pnpm/resolving.npm-resolver 1101.5.2 → 1102.0.1
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/lib/createNpmResolutionVerifier.d.ts +2 -1
- package/lib/createNpmResolutionVerifier.js +4 -4
- package/lib/fetch.d.ts +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -2
- package/lib/pickPackage.js +11 -0
- package/lib/pickPackageFromMeta.d.ts +1 -1
- package/lib/whichVersionIsPinned.js +6 -0
- package/package.json +20 -20
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GetAuthHeader } from '@pnpm/fetching.types';
|
|
1
2
|
import type { ResolutionVerifier } from '@pnpm/resolving.resolver-base';
|
|
2
3
|
import type { Registries, TrustPolicy } from '@pnpm/types';
|
|
3
4
|
import type { FetchMetadataFromFromRegistryOptions } from './fetch.js';
|
|
@@ -55,7 +56,7 @@ export interface CreateNpmResolutionVerifierOptions {
|
|
|
55
56
|
* hide the publish timestamp.
|
|
56
57
|
*/
|
|
57
58
|
fetchOpts: FetchMetadataFromFromRegistryOptions;
|
|
58
|
-
getAuthHeaderValueByURI:
|
|
59
|
+
getAuthHeaderValueByURI: GetAuthHeader;
|
|
59
60
|
cacheDir?: FetchFullMetadataCachedOptions['cacheDir'];
|
|
60
61
|
/**
|
|
61
62
|
* Per-install LRU shared with the npm resolver's `pickPackage`
|
|
@@ -369,7 +369,7 @@ function fetchFullMetaForTrust(context, registry, name) {
|
|
|
369
369
|
// workspaces OOMs CI runners with a 2GB heap (see #11860).
|
|
370
370
|
cachedPromise = fetchFullMetadataCached(context.fetchOpts, name, {
|
|
371
371
|
registry,
|
|
372
|
-
authHeaderValue: context.getAuthHeaderValueByURI(registry),
|
|
372
|
+
authHeaderValue: context.getAuthHeaderValueByURI(registry, { pkgName: name }),
|
|
373
373
|
cacheDir: context.cacheDir,
|
|
374
374
|
}).then(projectTrustMeta);
|
|
375
375
|
}
|
|
@@ -467,7 +467,7 @@ async function resolvePublishedAt(context, registry, name, version) {
|
|
|
467
467
|
return localTime[version];
|
|
468
468
|
const attestationTime = await fetchAttestationPublishedAt(context.fetchOpts, name, version, {
|
|
469
469
|
registry,
|
|
470
|
-
authHeaderValue: context.getAuthHeaderValueByURI(registry),
|
|
470
|
+
authHeaderValue: context.getAuthHeaderValueByURI(registry, { pkgName: name }),
|
|
471
471
|
});
|
|
472
472
|
if (attestationTime != null)
|
|
473
473
|
return attestationTime;
|
|
@@ -526,7 +526,7 @@ function fetchAbbreviatedMeta(context, registry, name) {
|
|
|
526
526
|
else {
|
|
527
527
|
cachedPromise = fetchAbbreviatedMetadataCached(context.fetchOpts, name, {
|
|
528
528
|
registry,
|
|
529
|
-
authHeaderValue: context.getAuthHeaderValueByURI(registry),
|
|
529
|
+
authHeaderValue: context.getAuthHeaderValueByURI(registry, { pkgName: name }),
|
|
530
530
|
cacheDir: context.cacheDir,
|
|
531
531
|
}).then(projectAbbreviatedMeta, () => undefined);
|
|
532
532
|
}
|
|
@@ -612,7 +612,7 @@ function fetchFullMetaTime(context, registry, name) {
|
|
|
612
612
|
if (cachedPromise == null) {
|
|
613
613
|
cachedPromise = fetchFullMetadataCached(context.fetchOpts, name, {
|
|
614
614
|
registry,
|
|
615
|
-
authHeaderValue: context.getAuthHeaderValueByURI(registry),
|
|
615
|
+
authHeaderValue: context.getAuthHeaderValueByURI(registry, { pkgName: name }),
|
|
616
616
|
cacheDir: context.cacheDir,
|
|
617
617
|
}).then((meta) => meta.time);
|
|
618
618
|
context.fullMetaCache.set(cacheKey, cachedPromise);
|
package/lib/fetch.d.ts
CHANGED
|
@@ -27,4 +27,4 @@ export interface FetchMetadataOptions {
|
|
|
27
27
|
etag?: string;
|
|
28
28
|
modified?: string;
|
|
29
29
|
}
|
|
30
|
-
export declare function fetchMetadataFromFromRegistry(fetchOpts: FetchMetadataFromFromRegistryOptions, pkgName: string, { authHeaderValue, etag: cachedEtag, fullMetadata, modified: cachedModified, registry }: FetchMetadataOptions): Promise<FetchMetadataResult | FetchMetadataNotModifiedResult>;
|
|
30
|
+
export declare function fetchMetadataFromFromRegistry(fetchOpts: FetchMetadataFromFromRegistryOptions, pkgName: string, { authHeaderValue, etag: cachedEtag, fullMetadata, modified: cachedModified, registry, }: FetchMetadataOptions): Promise<FetchMetadataResult | FetchMetadataNotModifiedResult>;
|
package/lib/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { whichVersionIsPinned } from './whichVersionIsPinned.js';
|
|
|
25
25
|
export interface ResolverFactoryOptions {
|
|
26
26
|
cacheDir: string;
|
|
27
27
|
storeDir?: string;
|
|
28
|
+
frozenStore?: boolean;
|
|
28
29
|
fullMetadata?: boolean;
|
|
29
30
|
filterMetadata?: boolean;
|
|
30
31
|
offline?: boolean;
|
|
@@ -82,7 +83,7 @@ export declare function createNpmResolver(fetchFromRegistry: FetchFromRegistry,
|
|
|
82
83
|
};
|
|
83
84
|
export interface ResolveFromNpmContext {
|
|
84
85
|
pickPackage: (spec: RegistryPackageSpec, opts: PickPackageOptions) => ReturnType<typeof pickPackage>;
|
|
85
|
-
getAuthHeaderValueByURI:
|
|
86
|
+
getAuthHeaderValueByURI: GetAuthHeader;
|
|
86
87
|
registries: Registries;
|
|
87
88
|
namedRegistries: Record<string, string>;
|
|
88
89
|
namedRegistryNames: ReadonlySet<string>;
|
package/lib/index.js
CHANGED
|
@@ -99,6 +99,7 @@ export function createNpmResolver(fetchFromRegistry, getAuthHeader, opts) {
|
|
|
99
99
|
const request = readPkgFromCafs({
|
|
100
100
|
storeDir,
|
|
101
101
|
verifyStoreIntegrity: false,
|
|
102
|
+
frozenStore: opts.frozenStore,
|
|
102
103
|
}, filesIndexFile, {
|
|
103
104
|
expectedPkg: { name: peekOpts.name, version: peekOpts.version },
|
|
104
105
|
}).then(({ bundledManifest }) => {
|
|
@@ -275,7 +276,7 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
const authHeaderValue = ctx.getAuthHeaderValueByURI(registry);
|
|
279
|
+
const authHeaderValue = ctx.getAuthHeaderValueByURI(registry, { pkgName: spec.name });
|
|
279
280
|
let pickResult;
|
|
280
281
|
try {
|
|
281
282
|
pickResult = await ctx.pickPackage(spec, {
|
|
@@ -481,7 +482,7 @@ async function resolveFromNamedRegistry(ctx, wantedDependency, opts) {
|
|
|
481
482
|
// fields common to their result envelopes; each caller adds its own
|
|
482
483
|
// resolvedVia, alias, and normalizedBareSpecifier.
|
|
483
484
|
async function pickFromSimpleRegistry(ctx, wantedDependency, opts, spec, registry) {
|
|
484
|
-
const authHeaderValue = ctx.getAuthHeaderValueByURI(registry);
|
|
485
|
+
const authHeaderValue = ctx.getAuthHeaderValueByURI(registry, { pkgName: spec.name });
|
|
485
486
|
const { meta, pickedPackage } = await ctx.pickPackage(spec, {
|
|
486
487
|
pickLowestVersion: opts.pickLowestVersion,
|
|
487
488
|
publishedBy: opts.publishedBy,
|
package/lib/pickPackage.js
CHANGED
|
@@ -240,6 +240,17 @@ export async function pickPackage(ctx, spec, opts) {
|
|
|
240
240
|
if (fetchResult.notModified) {
|
|
241
241
|
metaCachedInStore = metaCachedInStore ?? await limit(async () => loadMeta(pkgMirror));
|
|
242
242
|
if (metaCachedInStore != null) {
|
|
243
|
+
// The registry just vouched that the cached packument equals its
|
|
244
|
+
// current one, so the validation clock restarts now: bump the
|
|
245
|
+
// mirror's mtime so the publishedBy freshness shortcut above can
|
|
246
|
+
// fire again on the next install. Without this, a mirror older
|
|
247
|
+
// than minimumReleaseAge re-validates on every subsequent
|
|
248
|
+
// install — a 304 never rewrites the file. Fire-and-forget: a
|
|
249
|
+
// read-only cache dir only costs another conditional request.
|
|
250
|
+
if (!opts.dryRun) {
|
|
251
|
+
const now = new Date();
|
|
252
|
+
fs.utimes(pkgMirror, now, now).catch(() => { });
|
|
253
|
+
}
|
|
243
254
|
// The cached metadata may be abbreviated (no per-version `time`).
|
|
244
255
|
// When minimumReleaseAge is active we need `time` for the maturity check,
|
|
245
256
|
// so upgrade to full metadata via a follow-up fetch when warranted.
|
|
@@ -14,7 +14,7 @@ export interface PickPackageFromMetaOptions {
|
|
|
14
14
|
publishedBy?: Date;
|
|
15
15
|
publishedByExclude?: PackageVersionPolicy;
|
|
16
16
|
}
|
|
17
|
-
export declare function pickPackageFromMeta(pickVersionByVersionRangeFn: PickVersionByVersionRange, { preferredVersionSelectors, publishedBy, publishedByExclude }: PickPackageFromMetaOptions, meta: PackageMeta, spec: RegistryPackageSpec): PackageInRegistry | null;
|
|
17
|
+
export declare function pickPackageFromMeta(pickVersionByVersionRangeFn: PickVersionByVersionRange, { preferredVersionSelectors, publishedBy, publishedByExclude, }: PickPackageFromMetaOptions, meta: PackageMeta, spec: RegistryPackageSpec): PackageInRegistry | null;
|
|
18
18
|
export declare function assertMetaHasTime(meta: PackageMeta): asserts meta is PackageMetaWithTime;
|
|
19
19
|
export declare function pickLowestVersionByVersionRange({ meta, versionRange, preferredVersionSelectors }: PickVersionByVersionRangeOptions): string | null;
|
|
20
20
|
export declare function pickVersionByVersionRange({ meta, versionRange, preferredVersionSelectors }: PickVersionByVersionRangeOptions): string | null;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { parseRange } from 'semver-utils';
|
|
2
2
|
export function whichVersionIsPinned(spec) {
|
|
3
|
+
// A catalog reference carries no version pinning of its own; the pinning is
|
|
4
|
+
// defined by the catalog entry it points to. Bail out so a catalog name that
|
|
5
|
+
// happens to look like a version (e.g. "catalog:express4-21") isn't misread
|
|
6
|
+
// as a pinned version.
|
|
7
|
+
if (spec.startsWith('catalog:'))
|
|
8
|
+
return undefined;
|
|
3
9
|
const colonIndex = spec.indexOf(':');
|
|
4
10
|
if (colonIndex !== -1) {
|
|
5
11
|
spec = spec.substring(colonIndex + 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.npm-resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1102.0.1",
|
|
4
4
|
"description": "Resolver for npm-hosted packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -39,44 +39,44 @@
|
|
|
39
39
|
"path-temp": "^3.0.0",
|
|
40
40
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
41
41
|
"rename-overwrite": "^7.0.1",
|
|
42
|
-
"semver": "^7.8.
|
|
42
|
+
"semver": "^7.8.4",
|
|
43
43
|
"semver-utils": "^1.1.4",
|
|
44
44
|
"ssri": "13.0.1",
|
|
45
45
|
"version-selector-type": "^3.0.0",
|
|
46
|
-
"@pnpm/
|
|
47
|
-
"@pnpm/core-loggers": "1100.2.0",
|
|
48
|
-
"@pnpm/error": "1100.0.0",
|
|
46
|
+
"@pnpm/core-loggers": "1100.2.1",
|
|
49
47
|
"@pnpm/constants": "1100.0.0",
|
|
50
48
|
"@pnpm/crypto.hash": "1100.0.1",
|
|
51
|
-
"@pnpm/
|
|
52
|
-
"@pnpm/fetching.types": "1100.0.1",
|
|
49
|
+
"@pnpm/error": "1100.0.0",
|
|
53
50
|
"@pnpm/fs.graceful-fs": "1100.1.0",
|
|
54
|
-
"@pnpm/resolving.
|
|
51
|
+
"@pnpm/resolving.resolver-base": "1100.4.2",
|
|
55
52
|
"@pnpm/resolving.jsr-specifier-parser": "1100.0.0",
|
|
56
|
-
"@pnpm/
|
|
57
|
-
"@pnpm/resolving.
|
|
58
|
-
"@pnpm/
|
|
59
|
-
"@pnpm/
|
|
60
|
-
"@pnpm/
|
|
53
|
+
"@pnpm/resolving.registry.types": "1100.1.3",
|
|
54
|
+
"@pnpm/resolving.registry.pkg-metadata-filter": "1100.0.9",
|
|
55
|
+
"@pnpm/fetching.types": "1100.0.2",
|
|
56
|
+
"@pnpm/store.cafs": "1100.1.10",
|
|
57
|
+
"@pnpm/store.index": "1100.2.0",
|
|
58
|
+
"@pnpm/types": "1101.3.2",
|
|
61
59
|
"@pnpm/workspace.spec-parser": "1100.0.0",
|
|
62
|
-
"@pnpm/
|
|
60
|
+
"@pnpm/config.pick-registry-for-package": "1100.0.9",
|
|
61
|
+
"@pnpm/config.version-policy": "1100.1.5",
|
|
62
|
+
"@pnpm/workspace.range-resolver": "1100.0.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@pnpm/logger": "^
|
|
66
|
-
"@pnpm/worker": "^1100.1
|
|
65
|
+
"@pnpm/logger": "^1100.0.0",
|
|
66
|
+
"@pnpm/worker": "^1100.2.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@jest/globals": "30.
|
|
69
|
+
"@jest/globals": "30.4.1",
|
|
70
70
|
"@types/normalize-path": "^3.0.2",
|
|
71
71
|
"@types/ramda": "0.31.1",
|
|
72
72
|
"@types/semver": "7.7.1",
|
|
73
73
|
"@types/ssri": "^7.1.5",
|
|
74
74
|
"load-json-file": "^7.0.1",
|
|
75
75
|
"tempy": "3.0.0",
|
|
76
|
-
"@pnpm/resolving.npm-resolver": "1101.5.2",
|
|
77
|
-
"@pnpm/network.fetch": "1100.1.2",
|
|
78
76
|
"@pnpm/logger": "1100.0.0",
|
|
79
|
-
"@pnpm/
|
|
77
|
+
"@pnpm/network.fetch": "1100.1.3",
|
|
78
|
+
"@pnpm/resolving.npm-resolver": "1102.0.1",
|
|
79
|
+
"@pnpm/testing.mock-agent": "1101.0.3",
|
|
80
80
|
"@pnpm/test-fixtures": "1100.0.0"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|