@pnpm/config.version-policy 1100.1.12 → 1100.2.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/CHANGELOG.md +25 -0
- package/lib/index.d.ts +11 -2
- package/lib/index.js +8 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @pnpm/config.version-policy
|
|
2
2
|
|
|
3
|
+
## 1100.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `trustPolicyExclude` and `minimumReleaseAgeExclude` being ignored when set to a single string instead of a list. The value was read one character at a time, so the exclusion never matched the package it named — and a `*` anywhere in it matched every package, silently switching the policy off.
|
|
8
|
+
|
|
9
|
+
- Fixed an inconsistency where `minimumReleaseAgeExclude` (and `trustPolicyExclude`) wildcard/bare-name rules behaved differently in the evaluator and normalizer. A bare rule now consistently evaluates as matching every version, preventing unexpected behavior and silent widening of version policy exemptions when pnpm rewrites the workspace manifest [pnpm/pnpm#13725](https://github.com/pnpm/pnpm/issues/13725).
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/error@1100.1.3
|
|
13
|
+
- @pnpm/types@1102.0.0
|
|
14
|
+
|
|
15
|
+
## 1100.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Added a new setting `minimumReleaseAgeExcludePrune`. When enabled, `pnpm add`, `pnpm update`, and `pnpm remove` prune the entries of `minimumReleaseAgeExclude` in `pnpm-workspace.yaml` that the freshly written lockfile no longer resolves: versions that are gone are dropped (an entry is removed once none of its versions remain), and entries for packages that are no longer in the lockfile are removed too. Name patterns (`@scope/*`) are always kept. The cleanup is skipped when the install's lockfile does not cover the whole workspace (`sharedWorkspaceLockfile: false`), since entries another project still needs would look stale.
|
|
20
|
+
|
|
21
|
+
Renamed `cleanupUnusedCatalogs` to `catalogPrune`, so that catalog pruning and release-age exclude pruning use one vocabulary. `cleanupUnusedCatalogs` continues to work; when both are set, `catalogPrune` wins.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies:
|
|
26
|
+
- @pnpm/error@1100.1.2
|
|
27
|
+
|
|
3
28
|
## 1100.1.12
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { PackageVersionPolicy } from '@pnpm/types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `patterns` arrives as a lone string when the setting is written as a YAML
|
|
4
|
+
* scalar or comes from a `PNPM_CONFIG_*` env var.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createPackageVersionPolicy(patterns: string[] | string): PackageVersionPolicy;
|
|
3
7
|
/**
|
|
4
8
|
* Like {@link createPackageVersionPolicy}, but rewraps parser errors with an
|
|
5
9
|
* `INVALID_<KEY>` PnpmError so the message points at the user-facing config key
|
|
6
10
|
* (e.g. `minimumReleaseAgeExclude`) instead of the internal parser code.
|
|
7
11
|
*/
|
|
8
|
-
export declare function createPackageVersionPolicyOrThrow(patterns: string[], key: string): PackageVersionPolicy;
|
|
12
|
+
export declare function createPackageVersionPolicyOrThrow(patterns: string[] | string, key: string): PackageVersionPolicy;
|
|
9
13
|
export interface PublishedByPolicyOptions {
|
|
10
14
|
minimumReleaseAge?: number;
|
|
11
15
|
minimumReleaseAgeExclude?: string[];
|
|
@@ -31,3 +35,8 @@ export declare function getPublishedByPolicy(opts: PublishedByPolicyOptions): Pu
|
|
|
31
35
|
*/
|
|
32
36
|
export declare function mergePackageVersionSpecs(specs: string[]): string[];
|
|
33
37
|
export declare function expandPackageVersionSpecs(specs: string[]): Set<string>;
|
|
38
|
+
export interface ParsedVersionPolicyRule {
|
|
39
|
+
packageName: string;
|
|
40
|
+
exactVersions: string[];
|
|
41
|
+
}
|
|
42
|
+
export declare function parseVersionPolicyRule(pattern: string): ParsedVersionPolicyRule;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { createMatcher } from '@pnpm/config.matcher';
|
|
2
2
|
import { PnpmError } from '@pnpm/error';
|
|
3
3
|
import semver from 'semver';
|
|
4
|
+
/**
|
|
5
|
+
* `patterns` arrives as a lone string when the setting is written as a YAML
|
|
6
|
+
* scalar or comes from a `PNPM_CONFIG_*` env var.
|
|
7
|
+
*/
|
|
4
8
|
export function createPackageVersionPolicy(patterns) {
|
|
5
9
|
const rules = [];
|
|
6
|
-
|
|
10
|
+
const patternList = typeof patterns === 'string' ? [patterns] : patterns;
|
|
11
|
+
for (const pattern of patternList) {
|
|
7
12
|
const parsed = parseVersionPolicyRule(pattern);
|
|
8
13
|
rules.push({ nameMatcher: createMatcher(parsed.packageName), exactVersions: parsed.exactVersions });
|
|
9
14
|
}
|
|
@@ -91,7 +96,7 @@ function evaluateVersionPolicy(rules, pkgName) {
|
|
|
91
96
|
continue;
|
|
92
97
|
}
|
|
93
98
|
if (exactVersions.length === 0) {
|
|
94
|
-
return
|
|
99
|
+
return true;
|
|
95
100
|
}
|
|
96
101
|
if (matchedVersions == null) {
|
|
97
102
|
matchedVersions = [];
|
|
@@ -106,7 +111,7 @@ function evaluateVersionPolicy(rules, pkgName) {
|
|
|
106
111
|
}
|
|
107
112
|
return matchedVersions ?? false;
|
|
108
113
|
}
|
|
109
|
-
function parseVersionPolicyRule(pattern) {
|
|
114
|
+
export function parseVersionPolicyRule(pattern) {
|
|
110
115
|
const isScoped = pattern.startsWith('@');
|
|
111
116
|
const atIndex = isScoped ? pattern.indexOf('@', 1) : pattern.indexOf('@');
|
|
112
117
|
if (atIndex === -1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/config.version-policy",
|
|
3
|
-
"version": "1100.1
|
|
3
|
+
"version": "1100.2.1",
|
|
4
4
|
"description": "Parses and evaluates package version policy specs and produces package-version matchers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@pnpm/config.matcher": "1100.0.2",
|
|
31
|
-
"@pnpm/error": "1100.1.
|
|
32
|
-
"@pnpm/types": "
|
|
31
|
+
"@pnpm/error": "1100.1.3",
|
|
32
|
+
"@pnpm/types": "1102.0.0",
|
|
33
33
|
"semver": "^7.8.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@jest/globals": "30.4.1",
|
|
37
|
-
"@pnpm/config.version-policy": "1100.1
|
|
38
|
-
"@types/semver": "7.
|
|
37
|
+
"@pnpm/config.version-policy": "1100.2.1",
|
|
38
|
+
"@types/semver": "7.8.0"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=22.13"
|