@pnpm/global.packages 1101.1.0 → 1101.1.2

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,21 @@
1
1
  # @pnpm/global.packages
2
2
 
3
+ ## 1101.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed `pnpm add -g`, `pnpm update -g`, and `pnpm remove -g` mutating global bins or install directories after only partially reading an installed package group. If any declared package manifest is missing, malformed, or unreadable, pnpm now fails before activation or removal and leaves the existing global installation intact [pnpm/pnpm#13796](https://github.com/pnpm/pnpm/issues/13796).
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/crypto.hash@1100.0.4
11
+
12
+ ## 1101.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies:
17
+ - @pnpm/pkg-manifest.reader@1100.0.19
18
+
3
19
  ## 1101.1.0
4
20
 
5
21
  ### Minor Changes
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { createGlobalCacheKey } from './cacheKey.js';
2
2
  export { createInstallDir, getHashLink, resolveInstallDir, } from './globalPackageDir.js';
3
- export { cleanOrphanedInstallDirs, findGlobalPackage, getGlobalPackageDetails, getInstalledBinNames, type GlobalPackageInfo, type InstalledGlobalPackage, isValidGlobalDependencyAlias, scanGlobalPackages, } from './scanGlobalPackages.js';
3
+ export { cleanOrphanedInstallDirs, findGlobalPackage, getGlobalPackageDetails, getInstalledBinNames, type GlobalPackageBinSnapshot, type GlobalPackageInfo, type InstalledGlobalPackage, isValidGlobalDependencyAlias, scanGlobalPackages, } from './scanGlobalPackages.js';
@@ -5,6 +5,10 @@ export interface GlobalPackageInfo {
5
5
  installDir: string;
6
6
  dependencies: Record<string, string>;
7
7
  }
8
+ export interface GlobalPackageBinSnapshot {
9
+ info: GlobalPackageInfo;
10
+ binNames: string[];
11
+ }
8
12
  export interface InstalledGlobalPackage {
9
13
  alias: string;
10
14
  version: string;
@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import util from 'node:util';
4
4
  import { getBinsFromPackageManifest } from '@pnpm/bins.resolver';
5
- import { readPackageJsonFromDirRawSync, safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
5
+ import { readPackageJsonFromDir, readPackageJsonFromDirRawSync, safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
6
6
  const RESERVED_ALIASES = new Set(['node_modules', 'favicon.ico']);
7
7
  const isUrlFriendly = (segment) => encodeURIComponent(segment) === segment;
8
8
  // A dependency alias from a global group's package.json becomes a directory
@@ -145,9 +145,7 @@ export async function getInstalledBinNames(info) {
145
145
  const modulesDir = path.join(info.installDir, 'node_modules');
146
146
  await Promise.all(aliases.map(async (alias) => {
147
147
  const depDir = path.join(modulesDir, alias);
148
- const manifest = await safeReadPackageJsonFromDir(depDir);
149
- if (!manifest)
150
- return;
148
+ const manifest = await readPackageJsonFromDir(depDir);
151
149
  const binsOfPkg = await getBinsFromPackageManifest(manifest, depDir);
152
150
  for (const bin of binsOfPkg) {
153
151
  bins.add(bin.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/global.packages",
3
- "version": "1101.1.0",
3
+ "version": "1101.1.2",
4
4
  "description": "Utilities for managing isolated global packages",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@pnpm/bins.resolver": "1100.0.16",
32
- "@pnpm/crypto.hash": "1100.0.3",
33
- "@pnpm/pkg-manifest.reader": "1100.0.18",
32
+ "@pnpm/crypto.hash": "1100.0.4",
33
+ "@pnpm/pkg-manifest.reader": "1100.0.19",
34
34
  "@pnpm/text.ordinal-comparator": "1100.0.0",
35
35
  "@pnpm/types": "1102.1.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@pnpm/global.packages": "1101.1.0"
38
+ "@pnpm/global.packages": "1101.1.2"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=22.13"