@pnpm/building.policy 1100.0.21 → 1100.1.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,19 @@
1
1
  # @pnpm/building.policy
2
2
 
3
+ ## 1100.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Build scripts can now be rejected before the package is installed [#14067](https://github.com/pnpm/pnpm/issues/14067):
8
+
9
+ - `pnpm add --allow-build=!<pkg>` records `<pkg>: false` in `allowBuilds`. It used to write a `!<pkg>: true` entry that matched no package. On a global install the denial was dropped altogether, so the post-install prompt offered the build for approval.
10
+ - `pnpm approve-builds <pkg>` and `pnpm approve-builds !<pkg>` record their decision even when no packages are awaiting approval, and report a package that is not awaiting approval with a warning so a typo stays visible. Both cases used to fail the command with an error.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies:
15
+ - @pnpm/config.version-policy@1100.2.3
16
+
3
17
  ## 1100.0.21
4
18
 
5
19
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -23,3 +23,14 @@ export declare function allowBuildKeyFromIgnoredBuild(depPath: DepPath): string;
23
23
  * this proves absent from a resolved-name index.
24
24
  */
25
25
  export declare function packageNameFromAllowBuildKey(key: string): string | undefined;
26
+ /**
27
+ * The package an `--allow-build` value or an `approve-builds` argument names,
28
+ * and whether it is allowed to build: a leading `!` denies the build.
29
+ *
30
+ * A selector that is empty or only `!` yields an empty name. Callers reject
31
+ * that rather than persist an empty `allowBuilds` key.
32
+ */
33
+ export declare function parseAllowBuildSelector(selector: string): {
34
+ name: string;
35
+ allowed: boolean;
36
+ };
package/lib/index.js CHANGED
@@ -107,6 +107,18 @@ export function packageNameFromAllowBuildKey(key) {
107
107
  return undefined;
108
108
  return name;
109
109
  }
110
+ /**
111
+ * The package an `--allow-build` value or an `approve-builds` argument names,
112
+ * and whether it is allowed to build: a leading `!` denies the build.
113
+ *
114
+ * A selector that is empty or only `!` yields an empty name. Callers reject
115
+ * that rather than persist an empty `allowBuilds` key.
116
+ */
117
+ export function parseAllowBuildSelector(selector) {
118
+ return selector.startsWith('!')
119
+ ? { name: selector.slice(1), allowed: false }
120
+ : { name: selector, allowed: true };
121
+ }
110
122
  function addAllowBuildRule(pkg, target) {
111
123
  if (isGitRepoAllowBuildKey(pkg)) {
112
124
  target.gitRepos.add(pkg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/building.policy",
3
- "version": "1100.0.21",
3
+ "version": "1100.1.0",
4
4
  "description": "Create a function for filtering out dependencies that are not allowed to be built",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -27,13 +27,13 @@
27
27
  "!*.map"
28
28
  ],
29
29
  "dependencies": {
30
- "@pnpm/config.version-policy": "1100.2.2",
30
+ "@pnpm/config.version-policy": "1100.2.3",
31
31
  "@pnpm/deps.path": "1101.0.1",
32
32
  "@pnpm/types": "1102.1.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jest/globals": "30.4.1",
36
- "@pnpm/building.policy": "1100.0.21"
36
+ "@pnpm/building.policy": "1100.1.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22.13"