@pnpm/resolving.npm-resolver 1102.1.9 → 1103.0.0
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
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @pnpm/npm-resolver
|
|
2
2
|
|
|
3
|
+
## 1103.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Renamed the `PinnedVersion` type to `RangeSpecStyle` and the `pinnedVersion` option fields to `rangeSpecStyle`: the value selects the operator a specifier is saved with, not a pin. `whichVersionIsPinned` is now `inferRangeSpecStyle`, and the new `rangeSpecGranularity` helper collapses the `exact` spelling to its `patch` range width. `@pnpm/types` keeps `PinnedVersion` as a deprecated alias of `RangeSpecStyle`. The rename itself changes no CLI behavior; the `=`-pin handling is described in its own changesets.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- The install summary no longer prints `(X is available)` when the registry's `dist-tags.latest` is still held back by the active `minimumReleaseAge` policy. The hint only ever names the actual latest tag, so an immature latest suppresses the hint instead of advertising the version pnpm just refused to install [#11698](https://github.com/pnpm/pnpm/issues/11698).
|
|
12
|
+
|
|
13
|
+
- `pnpm update` keeps the explicit `=` operator of an exact version pin: a dependency saved as `=3.5.1` now updates to `=3.5.2` instead of the bare `3.5.2`. See pnpm/pnpm#13168.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies:
|
|
16
|
+
- @pnpm/config.pick-registry-for-package@1100.0.14
|
|
17
|
+
- @pnpm/config.version-policy@1100.1.11
|
|
18
|
+
- @pnpm/core-loggers@1100.3.1
|
|
19
|
+
- @pnpm/pkg-manifest.utils@1100.3.0
|
|
20
|
+
- @pnpm/resolving.registry.pkg-metadata-filter@1100.0.14
|
|
21
|
+
- @pnpm/resolving.registry.types@1100.1.8
|
|
22
|
+
- @pnpm/resolving.resolver-base@1101.0.0
|
|
23
|
+
- @pnpm/store.cafs@1100.1.17
|
|
24
|
+
- @pnpm/types@1101.8.0
|
|
25
|
+
|
|
3
26
|
## 1102.1.9
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PnpmError } from '@pnpm/error';
|
|
|
2
2
|
import type { FetchFromRegistry, GetAuthHeader, RetryTimeoutOptions } from '@pnpm/fetching.types';
|
|
3
3
|
import type { PackageMeta } from '@pnpm/resolving.registry.types';
|
|
4
4
|
import type { DirectoryResolution, LatestInfo, LatestQuery, PkgResolutionId, PreferredVersions, ResolveOptions, ResolveResult, TarballResolution, WantedDependency, WorkspacePackages } from '@pnpm/resolving.resolver-base';
|
|
5
|
-
import type { DependencyManifest, PackageVersionPolicy,
|
|
5
|
+
import type { DependencyManifest, PackageVersionPolicy, RangeSpecStyle, Registries, TrustPolicy } from '@pnpm/types';
|
|
6
6
|
import { fetchMetadataFromFromRegistry, type FetchMetadataFromFromRegistryOptions, RegistryResponseError } from './fetch.js';
|
|
7
7
|
import { BUILTIN_NAMED_REGISTRIES, parseBareSpecifier, type RegistryPackageSpec } from './parseBareSpecifier.js';
|
|
8
8
|
import { type PackageMetaCache, pickPackage, type PickPackageOptions } from './pickPackage.js';
|
|
@@ -20,8 +20,8 @@ export declare class NoMatchingVersionError extends PnpmError {
|
|
|
20
20
|
export declare function formatTimeAgo(date: Date): string | null;
|
|
21
21
|
export { BUILTIN_NAMED_REGISTRIES, fetchMetadataFromFromRegistry, type FetchMetadataFromFromRegistryOptions, type PackageMeta, type PackageMetaCache, parseBareSpecifier, pickPackageFromMeta, pickVersionByVersionRange, type RegistryPackageSpec, RegistryResponseError, workspacePrefToNpm, };
|
|
22
22
|
export { createNpmResolutionVerifier, type CreateNpmResolutionVerifierOptions } from './createNpmResolutionVerifier.js';
|
|
23
|
+
export { inferRangeSpecStyle } from './inferRangeSpecStyle.js';
|
|
23
24
|
export { MINIMUM_RELEASE_AGE_VIOLATION_CODE, TRUST_DOWNGRADE_VIOLATION_CODE, } from './violationCodes.js';
|
|
24
|
-
export { whichVersionIsPinned } from './whichVersionIsPinned.js';
|
|
25
25
|
export interface ResolverFactoryOptions {
|
|
26
26
|
cacheDir: string;
|
|
27
27
|
storeDir?: string;
|
|
@@ -115,7 +115,7 @@ export type ResolveFromNpmOptions = {
|
|
|
115
115
|
updateChecksums?: boolean;
|
|
116
116
|
injectWorkspacePackages?: boolean;
|
|
117
117
|
calcSpecifier?: boolean;
|
|
118
|
-
|
|
118
|
+
rangeSpecStyle?: RangeSpecStyle;
|
|
119
119
|
} & ({
|
|
120
120
|
projectDir?: string;
|
|
121
121
|
workspacePackages?: undefined;
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
3
3
|
import { PnpmError } from '@pnpm/error';
|
|
4
4
|
import { globalWarn } from '@pnpm/logger';
|
|
5
|
+
import { rangeSpecGranularity, versionWithRangeSpecStyle } from '@pnpm/pkg-manifest.utils';
|
|
5
6
|
import { EXISTING_VERSION_SELECTOR_WEIGHT, } from '@pnpm/resolving.resolver-base';
|
|
6
7
|
import { storeIndexKey } from '@pnpm/store.index';
|
|
7
8
|
import { readPkgFromCafs, } from '@pnpm/worker';
|
|
@@ -14,6 +15,7 @@ import ssri from 'ssri';
|
|
|
14
15
|
import versionSelectorType from 'version-selector-type';
|
|
15
16
|
import { clearMeta, retainsFullMeta } from './clearMeta.js';
|
|
16
17
|
import { fetchMetadataFromFromRegistry, RegistryResponseError } from './fetch.js';
|
|
18
|
+
import { inferRangeSpecStyle } from './inferRangeSpecStyle.js';
|
|
17
19
|
import { memoizeFetchMetadata } from './memoizeFetchMetadata.js';
|
|
18
20
|
import { normalizeRegistryUrl } from './normalizeRegistryUrl.js';
|
|
19
21
|
import { BUILTIN_NAMED_REGISTRIES, parseBareSpecifier, parseJsrSpecifierToRegistryPackageSpec, parseNamedRegistrySpecifierToRegistryPackageSpec, } from './parseBareSpecifier.js';
|
|
@@ -21,7 +23,6 @@ import { pickPackage, } from './pickPackage.js';
|
|
|
21
23
|
import { pickPackageFromMeta, pickVersionByVersionRange } from './pickPackageFromMeta.js';
|
|
22
24
|
import { failIfTrustDowngraded } from './trustChecks.js';
|
|
23
25
|
import { MINIMUM_RELEASE_AGE_VIOLATION_CODE } from './violationCodes.js';
|
|
24
|
-
import { whichVersionIsPinned } from './whichVersionIsPinned.js';
|
|
25
26
|
import { workspacePrefToNpm } from './workspacePrefToNpm.js';
|
|
26
27
|
export class NoMatchingVersionError extends PnpmError {
|
|
27
28
|
packageMeta;
|
|
@@ -64,8 +65,8 @@ export function formatTimeAgo(date) {
|
|
|
64
65
|
}
|
|
65
66
|
export { BUILTIN_NAMED_REGISTRIES, fetchMetadataFromFromRegistry, parseBareSpecifier, pickPackageFromMeta, pickVersionByVersionRange, RegistryResponseError, workspacePrefToNpm, };
|
|
66
67
|
export { createNpmResolutionVerifier } from './createNpmResolutionVerifier.js';
|
|
68
|
+
export { inferRangeSpecStyle } from './inferRangeSpecStyle.js';
|
|
67
69
|
export { MINIMUM_RELEASE_AGE_VIOLATION_CODE, TRUST_DOWNGRADE_VIOLATION_CODE, } from './violationCodes.js';
|
|
68
|
-
export { whichVersionIsPinned } from './whichVersionIsPinned.js';
|
|
69
70
|
export function createNpmResolver(fetchFromRegistry, getAuthHeader, opts) {
|
|
70
71
|
if (typeof opts.cacheDir !== 'string') {
|
|
71
72
|
throw new TypeError('`opts.cacheDir` is required and needs to be a string');
|
|
@@ -310,7 +311,7 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
310
311
|
update: Boolean(opts.update),
|
|
311
312
|
saveWorkspaceProtocol: ctx.saveWorkspaceProtocol !== false ? ctx.saveWorkspaceProtocol : true,
|
|
312
313
|
calcSpecifier: opts.calcSpecifier,
|
|
313
|
-
|
|
314
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
314
315
|
});
|
|
315
316
|
if (resolvedFromWorkspace != null) {
|
|
316
317
|
return resolvedFromWorkspace;
|
|
@@ -397,7 +398,7 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
397
398
|
update: false,
|
|
398
399
|
saveWorkspaceProtocol: ctx.saveWorkspaceProtocol,
|
|
399
400
|
calcSpecifier: opts.calcSpecifier,
|
|
400
|
-
|
|
401
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
401
402
|
});
|
|
402
403
|
}
|
|
403
404
|
catch (workspaceErr) {
|
|
@@ -424,7 +425,7 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
424
425
|
update: false,
|
|
425
426
|
saveWorkspaceProtocol: ctx.saveWorkspaceProtocol,
|
|
426
427
|
calcSpecifier: opts.calcSpecifier,
|
|
427
|
-
|
|
428
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
428
429
|
});
|
|
429
430
|
}
|
|
430
431
|
catch (workspaceErr) {
|
|
@@ -441,6 +442,7 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
441
442
|
else if (opts.trustPolicy === 'no-downgrade') {
|
|
442
443
|
failIfTrustDowngraded(meta, pickedPackage.version, opts);
|
|
443
444
|
}
|
|
445
|
+
const latest = latestAllowedByPolicy(meta, opts);
|
|
444
446
|
const workspacePkgsMatchingName = workspacePackages?.get(pickedPackage.name);
|
|
445
447
|
if (workspacePkgsMatchingName && opts.projectDir) {
|
|
446
448
|
const matchedPkg = workspacePkgsMatchingName.get(pickedPackage.version);
|
|
@@ -453,9 +455,9 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
453
455
|
hardLinkLocalPackages: opts.injectWorkspacePackages === true || wantedDependency.injected,
|
|
454
456
|
saveWorkspaceProtocol: ctx.saveWorkspaceProtocol,
|
|
455
457
|
calcSpecifier: opts.calcSpecifier,
|
|
456
|
-
|
|
458
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
457
459
|
}),
|
|
458
|
-
latest
|
|
460
|
+
latest,
|
|
459
461
|
};
|
|
460
462
|
}
|
|
461
463
|
const localVersion = pickMatchingLocalVersionOrNull(workspacePkgsMatchingName, spec);
|
|
@@ -468,9 +470,9 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
468
470
|
hardLinkLocalPackages: opts.injectWorkspacePackages === true || wantedDependency.injected,
|
|
469
471
|
saveWorkspaceProtocol: ctx.saveWorkspaceProtocol,
|
|
470
472
|
calcSpecifier: opts.calcSpecifier,
|
|
471
|
-
|
|
473
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
472
474
|
}),
|
|
473
|
-
latest
|
|
475
|
+
latest,
|
|
474
476
|
};
|
|
475
477
|
}
|
|
476
478
|
}
|
|
@@ -486,13 +488,13 @@ async function resolveNpm(ctx, wantedDependency, opts) {
|
|
|
486
488
|
wantedDependency,
|
|
487
489
|
spec,
|
|
488
490
|
version: pickedPackage.version,
|
|
489
|
-
|
|
491
|
+
defaultRangeSpecStyle: opts.rangeSpecStyle,
|
|
490
492
|
});
|
|
491
493
|
}
|
|
492
494
|
const publishedAt = meta.time?.[pickedPackage.version];
|
|
493
495
|
return {
|
|
494
496
|
id,
|
|
495
|
-
latest
|
|
497
|
+
latest,
|
|
496
498
|
manifest: pickedPackage,
|
|
497
499
|
resolution,
|
|
498
500
|
resolvedVia: 'npm-registry',
|
|
@@ -518,7 +520,7 @@ async function resolveJsr(ctx, wantedDependency, opts) {
|
|
|
518
520
|
return {
|
|
519
521
|
...picked,
|
|
520
522
|
normalizedBareSpecifier: opts.calcSpecifier
|
|
521
|
-
? calcPrefixedSpecifier('jsr:', spec.jsrPkgName, wantedDependency, picked.manifest.version, opts.
|
|
523
|
+
? calcPrefixedSpecifier('jsr:', spec.jsrPkgName, wantedDependency, picked.manifest.version, opts.rangeSpecStyle)
|
|
522
524
|
: undefined,
|
|
523
525
|
resolvedVia: 'jsr-registry',
|
|
524
526
|
alias: spec.jsrPkgName,
|
|
@@ -573,7 +575,7 @@ async function resolveFromNamedRegistry(ctx, wantedDependency, opts) {
|
|
|
573
575
|
return {
|
|
574
576
|
...picked,
|
|
575
577
|
normalizedBareSpecifier: opts.calcSpecifier
|
|
576
|
-
? calcPrefixedSpecifier(`${spec.registryName}:`, spec.name, wantedDependency, picked.manifest.version, opts.
|
|
578
|
+
? calcPrefixedSpecifier(`${spec.registryName}:`, spec.name, wantedDependency, picked.manifest.version, opts.rangeSpecStyle)
|
|
577
579
|
: undefined,
|
|
578
580
|
resolvedVia: 'named-registry',
|
|
579
581
|
registryName: spec.registryName,
|
|
@@ -611,7 +613,7 @@ async function pickFromSimpleRegistry(ctx, wantedDependency, opts, spec, registr
|
|
|
611
613
|
const publishedAt = meta.time?.[pickedPackage.version];
|
|
612
614
|
return {
|
|
613
615
|
id: `${pickedPackage.name}@${pickedPackage.version}`,
|
|
614
|
-
latest: meta
|
|
616
|
+
latest: latestAllowedByPolicy(meta, opts),
|
|
615
617
|
manifest: pickedPackage,
|
|
616
618
|
resolution,
|
|
617
619
|
publishedAt,
|
|
@@ -629,29 +631,29 @@ async function pickFromSimpleRegistry(ctx, wantedDependency, opts, spec, registr
|
|
|
629
631
|
// when the dependency alias matches the package name). Shared between the
|
|
630
632
|
// jsr and named-registry resolvers since they only differ in `prefix` and
|
|
631
633
|
// which spec field holds the package name.
|
|
632
|
-
function calcPrefixedSpecifier(prefix, pkgName, wantedDependency, version,
|
|
633
|
-
const range = calcRange(version, wantedDependency,
|
|
634
|
+
function calcPrefixedSpecifier(prefix, pkgName, wantedDependency, version, defaultRangeSpecStyle) {
|
|
635
|
+
const range = calcRange(version, wantedDependency, defaultRangeSpecStyle);
|
|
634
636
|
if (!wantedDependency.alias || pkgName === wantedDependency.alias)
|
|
635
637
|
return `${prefix}${range}`;
|
|
636
638
|
return `${prefix}${pkgName}@${range}`;
|
|
637
639
|
}
|
|
638
|
-
function calcSpecifier({ wantedDependency, spec, version,
|
|
640
|
+
function calcSpecifier({ wantedDependency, spec, version, defaultRangeSpecStyle, }) {
|
|
639
641
|
if (wantedDependency.prevSpecifier === wantedDependency.bareSpecifier && wantedDependency.prevSpecifier && versionSelectorType(wantedDependency.prevSpecifier)?.type === 'tag') {
|
|
640
642
|
return wantedDependency.prevSpecifier;
|
|
641
643
|
}
|
|
642
|
-
const range = calcRange(version, wantedDependency,
|
|
644
|
+
const range = calcRange(version, wantedDependency, defaultRangeSpecStyle);
|
|
643
645
|
if (!wantedDependency.alias || spec.name === wantedDependency.alias)
|
|
644
646
|
return range;
|
|
645
647
|
return `npm:${spec.name}@${range}`;
|
|
646
648
|
}
|
|
647
|
-
function calcRange(version, wantedDependency,
|
|
649
|
+
function calcRange(version, wantedDependency, defaultRangeSpecStyle) {
|
|
648
650
|
if (semver.parse(version)?.prerelease.length) {
|
|
649
651
|
return version;
|
|
650
652
|
}
|
|
651
|
-
const
|
|
652
|
-
(wantedDependency.bareSpecifier ?
|
|
653
|
-
|
|
654
|
-
return
|
|
653
|
+
const rangeSpecStyle = (wantedDependency.prevSpecifier ? inferRangeSpecStyle(wantedDependency.prevSpecifier) : undefined) ??
|
|
654
|
+
(wantedDependency.bareSpecifier ? inferRangeSpecStyle(wantedDependency.bareSpecifier) : undefined) ??
|
|
655
|
+
defaultRangeSpecStyle;
|
|
656
|
+
return versionWithRangeSpecStyle(version, rangeSpecStyle ?? 'major');
|
|
655
657
|
}
|
|
656
658
|
function tryResolveFromWorkspace(wantedDependency, opts) {
|
|
657
659
|
if (!wantedDependency.bareSpecifier?.startsWith('workspace:')) {
|
|
@@ -675,7 +677,7 @@ function tryResolveFromWorkspace(wantedDependency, opts) {
|
|
|
675
677
|
update: opts.update,
|
|
676
678
|
saveWorkspaceProtocol: opts.saveWorkspaceProtocol,
|
|
677
679
|
calcSpecifier: opts.calcSpecifier,
|
|
678
|
-
|
|
680
|
+
rangeSpecStyle: opts.rangeSpecStyle,
|
|
679
681
|
});
|
|
680
682
|
}
|
|
681
683
|
function tryResolveFromWorkspacePackages(workspacePackages, spec, opts) {
|
|
@@ -730,7 +732,7 @@ function resolveFromLocalPackage(localPackage, spec, opts) {
|
|
|
730
732
|
spec,
|
|
731
733
|
saveWorkspaceProtocol: opts.saveWorkspaceProtocol,
|
|
732
734
|
version: localPackage.manifest.version,
|
|
733
|
-
|
|
735
|
+
defaultRangeSpecStyle: opts.rangeSpecStyle,
|
|
734
736
|
});
|
|
735
737
|
}
|
|
736
738
|
return {
|
|
@@ -744,9 +746,9 @@ function resolveFromLocalPackage(localPackage, spec, opts) {
|
|
|
744
746
|
normalizedBareSpecifier,
|
|
745
747
|
};
|
|
746
748
|
}
|
|
747
|
-
function calcSpecifierForWorkspaceDep({ wantedDependency, spec, saveWorkspaceProtocol, version,
|
|
749
|
+
function calcSpecifierForWorkspaceDep({ wantedDependency, spec, saveWorkspaceProtocol, version, defaultRangeSpecStyle, }) {
|
|
748
750
|
if (!saveWorkspaceProtocol && !wantedDependency.bareSpecifier?.startsWith('workspace:')) {
|
|
749
|
-
return calcSpecifier({ wantedDependency, spec, version,
|
|
751
|
+
return calcSpecifier({ wantedDependency, spec, version, defaultRangeSpecStyle });
|
|
750
752
|
}
|
|
751
753
|
const prefix = (!wantedDependency.alias || spec.name === wantedDependency.alias) ? 'workspace:' : `workspace:${spec.name}@`;
|
|
752
754
|
if (saveWorkspaceProtocol === 'rolling') {
|
|
@@ -754,8 +756,8 @@ function calcSpecifierForWorkspaceDep({ wantedDependency, spec, saveWorkspacePro
|
|
|
754
756
|
if (specifier) {
|
|
755
757
|
if ([`${prefix}*`, `${prefix}^`, `${prefix}~`].includes(specifier))
|
|
756
758
|
return specifier;
|
|
757
|
-
const
|
|
758
|
-
switch (
|
|
759
|
+
const rangeSpecStyle = inferRangeSpecStyle(specifier);
|
|
760
|
+
switch (rangeSpecStyle && rangeSpecGranularity(rangeSpecStyle)) {
|
|
759
761
|
case 'major': return `${prefix}^`;
|
|
760
762
|
case 'minor': return `${prefix}~`;
|
|
761
763
|
case 'patch':
|
|
@@ -767,8 +769,8 @@ function calcSpecifierForWorkspaceDep({ wantedDependency, spec, saveWorkspacePro
|
|
|
767
769
|
if (semver.parse(version)?.prerelease.length) {
|
|
768
770
|
return `${prefix}${version}`;
|
|
769
771
|
}
|
|
770
|
-
const
|
|
771
|
-
const range =
|
|
772
|
+
const rangeSpecStyle = (wantedDependency.prevSpecifier ? inferRangeSpecStyle(wantedDependency.prevSpecifier) : undefined) ?? defaultRangeSpecStyle;
|
|
773
|
+
const range = versionWithRangeSpecStyle(version, rangeSpecStyle ?? 'major');
|
|
772
774
|
return `${prefix}${range}`;
|
|
773
775
|
}
|
|
774
776
|
function resolveLocalPackageDir(localPackage) {
|
|
@@ -784,6 +786,31 @@ function defaultTagForAlias(alias, defaultTag) {
|
|
|
784
786
|
type: 'tag',
|
|
785
787
|
};
|
|
786
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* The raw `dist-tags.latest` when the active `minimumReleaseAge` policy would
|
|
791
|
+
* allow installing it, `undefined` otherwise. The install summary's
|
|
792
|
+
* "(X is available)" hint must only ever name the actual latest tag, so an
|
|
793
|
+
* immature latest suppresses the hint instead of being rewritten to an older
|
|
794
|
+
* mature version. Suppression requires positive evidence of immaturity: a
|
|
795
|
+
* missing or unparsable timestamp keeps the raw tag, matching
|
|
796
|
+
* `detectMinReleaseAgeViolation`, which likewise only flags a version it can
|
|
797
|
+
* date.
|
|
798
|
+
*/
|
|
799
|
+
function latestAllowedByPolicy(meta, opts) {
|
|
800
|
+
const latest = meta['dist-tags'].latest;
|
|
801
|
+
if (!latest || !opts.publishedBy)
|
|
802
|
+
return latest;
|
|
803
|
+
const excludeResult = opts.publishedByExclude?.(meta.name);
|
|
804
|
+
if (excludeResult === true)
|
|
805
|
+
return latest;
|
|
806
|
+
if (Array.isArray(excludeResult) && excludeResult.includes(latest))
|
|
807
|
+
return latest;
|
|
808
|
+
const publishedAt = meta.time?.[latest];
|
|
809
|
+
if (publishedAt == null)
|
|
810
|
+
return latest;
|
|
811
|
+
const ts = new Date(publishedAt).getTime();
|
|
812
|
+
return (Number.isNaN(ts) || ts <= opts.publishedBy.getTime()) ? latest : undefined;
|
|
813
|
+
}
|
|
787
814
|
/**
|
|
788
815
|
* Inline minimumReleaseAge detection: returns a violation entry when the
|
|
789
816
|
* picked version's publish timestamp is past the policy cutoff (and
|
|
@@ -831,19 +858,6 @@ function getIntegrity(dist) {
|
|
|
831
858
|
}
|
|
832
859
|
return integrity.toString();
|
|
833
860
|
}
|
|
834
|
-
function createVersionSpec(version, pinnedVersion) {
|
|
835
|
-
switch (pinnedVersion ?? 'major') {
|
|
836
|
-
case 'none':
|
|
837
|
-
case 'major':
|
|
838
|
-
return `^${version}`;
|
|
839
|
-
case 'minor':
|
|
840
|
-
return `~${version}`;
|
|
841
|
-
case 'patch':
|
|
842
|
-
return version;
|
|
843
|
-
default:
|
|
844
|
-
throw new PnpmError('BAD_PINNED_VERSION', `Cannot pin '${pinnedVersion ?? 'undefined'}'`);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
861
|
/**
|
|
848
862
|
* Construct the LRU `PackageMetaCache` instance the resolver uses by
|
|
849
863
|
* default. Exported so the install layer can build one cache and hand
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseRange } from 'semver-utils';
|
|
2
|
-
export function
|
|
2
|
+
export function inferRangeSpecStyle(spec) {
|
|
3
3
|
// A catalog reference carries no version pinning of its own; the pinning is
|
|
4
4
|
// defined by the catalog entry it points to. Bail out so a catalog name that
|
|
5
5
|
// happens to look like a version (e.g. "catalog:express4-21") isn't misread
|
|
@@ -23,11 +23,12 @@ export function whichVersionIsPinned(spec) {
|
|
|
23
23
|
switch (versionObject.operator) {
|
|
24
24
|
case '~': return 'minor';
|
|
25
25
|
case '^': return 'major';
|
|
26
|
-
// A bare '='
|
|
26
|
+
// A bare '=' before a full version is an explicit exact pin; a partial
|
|
27
|
+
// '=' pins the same way the plain version it prefixes does.
|
|
27
28
|
case '=':
|
|
28
29
|
case undefined:
|
|
29
30
|
if (versionObject.patch)
|
|
30
|
-
return 'patch';
|
|
31
|
+
return versionObject.operator === '=' ? 'exact' : 'patch';
|
|
31
32
|
if (versionObject.minor)
|
|
32
33
|
return 'minor';
|
|
33
34
|
if (versionObject.major)
|
|
@@ -35,4 +36,4 @@ export function whichVersionIsPinned(spec) {
|
|
|
35
36
|
}
|
|
36
37
|
return undefined;
|
|
37
38
|
}
|
|
38
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=inferRangeSpecStyle.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.npm-resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1103.0.0",
|
|
4
4
|
"description": "Resolver for npm-hosted packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -29,21 +29,22 @@
|
|
|
29
29
|
"!*.map"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pnpm/config.pick-registry-for-package": "1100.0.
|
|
33
|
-
"@pnpm/config.version-policy": "1100.1.
|
|
32
|
+
"@pnpm/config.pick-registry-for-package": "1100.0.14",
|
|
33
|
+
"@pnpm/config.version-policy": "1100.1.11",
|
|
34
34
|
"@pnpm/constants": "1100.0.1",
|
|
35
|
-
"@pnpm/core-loggers": "1100.3.
|
|
35
|
+
"@pnpm/core-loggers": "1100.3.1",
|
|
36
36
|
"@pnpm/crypto.hash": "1100.0.2",
|
|
37
37
|
"@pnpm/error": "1100.1.0",
|
|
38
38
|
"@pnpm/fetching.types": "1100.0.3",
|
|
39
39
|
"@pnpm/fs.graceful-fs": "1100.1.1",
|
|
40
|
+
"@pnpm/pkg-manifest.utils": "1100.3.0",
|
|
40
41
|
"@pnpm/resolving.jsr-specifier-parser": "1100.0.3",
|
|
41
|
-
"@pnpm/resolving.registry.pkg-metadata-filter": "1100.0.
|
|
42
|
-
"@pnpm/resolving.registry.types": "1100.1.
|
|
43
|
-
"@pnpm/resolving.resolver-base": "
|
|
44
|
-
"@pnpm/store.cafs": "1100.1.
|
|
42
|
+
"@pnpm/resolving.registry.pkg-metadata-filter": "1100.0.14",
|
|
43
|
+
"@pnpm/resolving.registry.types": "1100.1.8",
|
|
44
|
+
"@pnpm/resolving.resolver-base": "1101.0.0",
|
|
45
|
+
"@pnpm/store.cafs": "1100.1.17",
|
|
45
46
|
"@pnpm/store.index": "1100.2.2",
|
|
46
|
-
"@pnpm/types": "1101.
|
|
47
|
+
"@pnpm/types": "1101.8.0",
|
|
47
48
|
"@pnpm/workspace.range-resolver": "1100.0.3",
|
|
48
49
|
"@pnpm/workspace.spec-parser": "1100.0.1",
|
|
49
50
|
"@zkochan/retry": "^0.2.0",
|
|
@@ -63,13 +64,13 @@
|
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"@pnpm/logger": "^1100.0.0",
|
|
66
|
-
"@pnpm/worker": "^1100.2.
|
|
67
|
+
"@pnpm/worker": "^1100.2.9"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@jest/globals": "30.4.1",
|
|
70
71
|
"@pnpm/logger": "1100.0.0",
|
|
71
|
-
"@pnpm/network.fetch": "1100.1.
|
|
72
|
-
"@pnpm/resolving.npm-resolver": "
|
|
72
|
+
"@pnpm/network.fetch": "1100.1.10",
|
|
73
|
+
"@pnpm/resolving.npm-resolver": "1103.0.0",
|
|
73
74
|
"@pnpm/test-fixtures": "1100.0.1",
|
|
74
75
|
"@pnpm/testing.mock-agent": "1101.0.7",
|
|
75
76
|
"@types/normalize-path": "^3.0.2",
|