@pnpm/engine.pm.commands 1101.0.0 → 1101.0.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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { selfUpdate } from './self-updater/index.js';
2
- export { installPnpm, installPnpmToStore, linkExePlatformBinary } from './self-updater/installPnpm.js';
2
+ export { exePlatformPkgDirName, exePlatformPkgDirNameNext, installPnpm, installPnpmToStore, linkExePlatformBinary } from './self-updater/installPnpm.js';
3
3
  export { setup } from './setup/index.js';
4
4
  export { withCmd } from './with/index.js';
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { selfUpdate } from './self-updater/index.js';
2
- export { installPnpm, installPnpmToStore, linkExePlatformBinary } from './self-updater/installPnpm.js';
2
+ export { exePlatformPkgDirName, exePlatformPkgDirNameNext, installPnpm, installPnpmToStore, linkExePlatformBinary } from './self-updater/installPnpm.js';
3
3
  export { setup } from './setup/index.js';
4
4
  export { withCmd } from './with/index.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -39,4 +39,20 @@ export declare function installPnpmToStore(pnpmVersion: string, opts: {
39
39
  }): Promise<{
40
40
  binDir: string;
41
41
  }>;
42
+ /**
43
+ * Computes the scope-local directory name of the `@pnpm/exe` platform
44
+ * package for a given host. Returns the legacy name currently published on npm
45
+ * (`macos-<arch>`, `win-<arch>`, `linux-<arch>`, `linuxstatic-<arch>`); callers
46
+ * should also consider the future `exe.<platform>-<arch>[-musl]` scheme, since
47
+ * a later release will switch to it. Pure so that the musl branch is
48
+ * unit-testable without mocking detect-libc or patching process.platform.
49
+ */
50
+ export declare function exePlatformPkgDirName(platform: NodeJS.Platform, arch: string, libcFamily: string | null): string;
51
+ /**
52
+ * Future scope-local directory name of the `@pnpm/exe` platform package, under
53
+ * the `exe.<platform>-<arch>[-musl]` scheme that matches the workspace
54
+ * directory layout. `linkExePlatformBinary` checks this as a fallback so a
55
+ * future rename of the published packages works without touching this logic.
56
+ */
57
+ export declare function exePlatformPkgDirNameNext(platform: NodeJS.Platform, arch: string, libcFamily: string | null): string;
42
58
  export declare function linkExePlatformBinary(installDir: string): void;
@@ -9,6 +9,7 @@ import { installGlobalPackages } from '@pnpm/global.commands';
9
9
  import { cleanOrphanedInstallDirs, createGlobalCacheKey, createInstallDir, findGlobalPackage, getHashLink, } from '@pnpm/global.packages';
10
10
  import { headlessInstall } from '@pnpm/installing.deps-restorer';
11
11
  import { registerProject } from '@pnpm/store.controller';
12
+ import { familySync } from 'detect-libc';
12
13
  import { symlinkDir } from 'symlink-dir';
13
14
  // @pnpm/exe has platform-specific binaries, so its GVS hash must
14
15
  // include ENGINE_NAME for correct per-platform resolution.
@@ -227,17 +228,45 @@ async function installFromResolution(installDir, opts, params) {
227
228
  allowBuilds: {},
228
229
  }, params);
229
230
  }
230
- // @pnpm/exe bundles Node.js via optional platform-specific packages (e.g. @pnpm/macos-arm64).
231
- // Its postinstall script links the correct binary into the @pnpm/exe package dir.
232
- // Since scripts are disabled during install (to support systems without Node.js),
233
- // we replicate that linking here.
231
+ /**
232
+ * Computes the scope-local directory name of the `@pnpm/exe` platform
233
+ * package for a given host. Returns the legacy name currently published on npm
234
+ * (`macos-<arch>`, `win-<arch>`, `linux-<arch>`, `linuxstatic-<arch>`); callers
235
+ * should also consider the future `exe.<platform>-<arch>[-musl]` scheme, since
236
+ * a later release will switch to it. Pure so that the musl branch is
237
+ * unit-testable without mocking detect-libc or patching process.platform.
238
+ */
239
+ export function exePlatformPkgDirName(platform, arch, libcFamily) {
240
+ const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch;
241
+ return `${legacyOsSegment(platform, libcFamily)}-${normalizedArch}`;
242
+ }
243
+ function legacyOsSegment(platform, libcFamily) {
244
+ switch (platform) {
245
+ case 'darwin': return 'macos';
246
+ case 'win32': return 'win';
247
+ case 'linux': return libcFamily === 'musl' ? 'linuxstatic' : 'linux';
248
+ default: return platform;
249
+ }
250
+ }
251
+ /**
252
+ * Future scope-local directory name of the `@pnpm/exe` platform package, under
253
+ * the `exe.<platform>-<arch>[-musl]` scheme that matches the workspace
254
+ * directory layout. `linkExePlatformBinary` checks this as a fallback so a
255
+ * future rename of the published packages works without touching this logic.
256
+ */
257
+ export function exePlatformPkgDirNameNext(platform, arch, libcFamily) {
258
+ const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch;
259
+ const libcSuffix = platform === 'linux' && libcFamily === 'musl' ? '-musl' : '';
260
+ return `exe.${platform}-${normalizedArch}${libcSuffix}`;
261
+ }
262
+ // @pnpm/exe bundles Node.js via optional platform-specific packages
263
+ // (e.g. @pnpm/macos-arm64, @pnpm/linuxstatic-x64; or, after a future rename,
264
+ // @pnpm/exe.darwin-arm64, @pnpm/exe.linux-x64-musl). Its postinstall script
265
+ // links the correct binary into the @pnpm/exe package dir. Since scripts are
266
+ // disabled during install (to support systems without Node.js), we replicate
267
+ // that linking here, checking both naming schemes so self-update works across
268
+ // the rename.
234
269
  export function linkExePlatformBinary(installDir) {
235
- const platform = process.platform === 'win32'
236
- ? 'win'
237
- : process.platform === 'darwin'
238
- ? 'macos'
239
- : process.platform;
240
- const arch = platform === 'win' && process.arch === 'ia32' ? 'x86' : process.arch;
241
270
  const exePkgDir = path.join(installDir, 'node_modules', '@pnpm', 'exe');
242
271
  if (!fs.existsSync(exePkgDir))
243
272
  return;
@@ -245,14 +274,27 @@ export function linkExePlatformBinary(installDir) {
245
274
  // to the top-level node_modules. It's a dependency of @pnpm/exe and lives as a
246
275
  // sibling in the virtual store. Resolve through the @pnpm/exe symlink to find it.
247
276
  const exeRealDir = fs.realpathSync(exePkgDir);
248
- const platformPkgDir = path.join(path.dirname(exeRealDir), `${platform}-${arch}`);
249
- const executable = platform === 'win' ? 'pnpm.exe' : 'pnpm';
250
- const src = path.join(platformPkgDir, executable);
251
- if (!fs.existsSync(src))
277
+ const platform = process.platform;
278
+ const arch = process.arch;
279
+ const libcFamily = familySync();
280
+ const executable = platform === 'win32' ? 'pnpm.exe' : 'pnpm';
281
+ const candidateDirNames = [
282
+ exePlatformPkgDirName(platform, arch, libcFamily),
283
+ exePlatformPkgDirNameNext(platform, arch, libcFamily),
284
+ ];
285
+ let src;
286
+ for (const dirName of candidateDirNames) {
287
+ const candidate = path.join(path.dirname(exeRealDir), dirName, executable);
288
+ if (fs.existsSync(candidate)) {
289
+ src = candidate;
290
+ break;
291
+ }
292
+ }
293
+ if (src == null)
252
294
  return;
253
295
  const dest = path.join(exePkgDir, executable);
254
296
  forceLink(src, dest);
255
- if (platform === 'win') {
297
+ if (platform === 'win32') {
256
298
  const exePkgJsonPath = path.join(exePkgDir, 'package.json');
257
299
  const exePkg = JSON.parse(fs.readFileSync(exePkgJsonPath, 'utf8'));
258
300
  exePkg.bin.pnpm = 'pnpm.exe';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/engine.pm.commands",
3
- "version": "1101.0.0",
3
+ "version": "1101.0.2",
4
4
  "description": "pnpm commands for self-updating and setting up pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -26,29 +26,30 @@
26
26
  "dependencies": {
27
27
  "@pnpm/os.env.path-extender": "^3.0.0",
28
28
  "cross-spawn": "^7.0.6",
29
+ "detect-libc": "^2.0.3",
29
30
  "path-name": "^1.0.0",
30
31
  "ramda": "npm:@pnpm/ramda@0.28.1",
31
32
  "render-help": "^2.0.0",
32
33
  "semver": "^7.7.2",
33
34
  "symlink-dir": "^10.0.1",
34
- "@pnpm/building.policy": "1100.0.1",
35
- "@pnpm/bins.linker": "1100.0.2",
36
35
  "@pnpm/cli.meta": "1100.0.1",
36
+ "@pnpm/bins.linker": "1100.0.2",
37
+ "@pnpm/building.policy": "1100.0.1",
37
38
  "@pnpm/cli.utils": "1101.0.0",
38
- "@pnpm/config.reader": "1101.0.0",
39
- "@pnpm/deps.graph-hasher": "1100.0.1",
40
- "@pnpm/error": "1100.0.0",
41
- "@pnpm/installing.client": "1100.0.2",
42
- "@pnpm/global.commands": "1100.0.2",
39
+ "@pnpm/deps.graph-hasher": "1100.1.1",
40
+ "@pnpm/global.commands": "1100.0.4",
43
41
  "@pnpm/global.packages": "1100.0.1",
44
- "@pnpm/installing.deps-restorer": "1100.0.2",
45
- "@pnpm/installing.env-installer": "1100.1.0",
46
- "@pnpm/lockfile.types": "1100.0.1",
42
+ "@pnpm/config.reader": "1101.1.1",
43
+ "@pnpm/installing.client": "1100.0.4",
44
+ "@pnpm/installing.deps-restorer": "1101.0.0",
45
+ "@pnpm/lockfile.types": "1100.0.2",
47
46
  "@pnpm/shell.path": "1100.0.0",
48
- "@pnpm/resolving.npm-resolver": "1100.0.1",
49
- "@pnpm/store.connection-manager": "1100.0.2",
50
- "@pnpm/store.controller": "1100.0.1",
47
+ "@pnpm/store.connection-manager": "1100.0.4",
48
+ "@pnpm/installing.env-installer": "1101.0.0",
49
+ "@pnpm/resolving.npm-resolver": "1101.0.0",
50
+ "@pnpm/error": "1100.0.0",
51
51
  "@pnpm/types": "1101.0.0",
52
+ "@pnpm/store.controller": "1101.0.0",
52
53
  "@pnpm/workspace.project-manifest-reader": "1100.0.2"
53
54
  },
54
55
  "peerDependencies": {
@@ -61,10 +62,10 @@
61
62
  "@types/semver": "7.7.1",
62
63
  "@pnpm/constants": "1100.0.0",
63
64
  "@pnpm/error": "1100.0.0",
64
- "@pnpm/logger": "1100.0.0",
65
- "@pnpm/engine.pm.commands": "1101.0.0",
66
- "@pnpm/prepare": "1100.0.1",
67
- "@pnpm/testing.mock-agent": "1100.0.1"
65
+ "@pnpm/engine.pm.commands": "1101.0.2",
66
+ "@pnpm/testing.mock-agent": "1100.0.1",
67
+ "@pnpm/prepare": "1100.0.3",
68
+ "@pnpm/logger": "1100.0.0"
68
69
  },
69
70
  "engines": {
70
71
  "node": ">=22.13"