@pnpm/engine.pm.commands 1101.0.1 → 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 { exePlatformPkgDirName, 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 { exePlatformPkgDirName, 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
@@ -41,9 +41,18 @@ export declare function installPnpmToStore(pnpmVersion: string, opts: {
41
41
  }>;
42
42
  /**
43
43
  * Computes the scope-local directory name of the `@pnpm/exe` platform
44
- * package for a given host: `exe.<platform>-<arch>[-musl]`. Pure so that the
45
- * musl branch is unit-testable without mocking detect-libc or patching
46
- * process.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.
47
49
  */
48
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;
49
58
  export declare function linkExePlatformBinary(installDir: string): void;
@@ -230,23 +230,43 @@ async function installFromResolution(installDir, opts, params) {
230
230
  }
231
231
  /**
232
232
  * Computes the scope-local directory name of the `@pnpm/exe` platform
233
- * package for a given host: `exe.<platform>-<arch>[-musl]`. Pure so that the
234
- * musl branch is unit-testable without mocking detect-libc or patching
235
- * process.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.
236
238
  */
237
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) {
238
258
  const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch;
239
259
  const libcSuffix = platform === 'linux' && libcFamily === 'musl' ? '-musl' : '';
240
260
  return `exe.${platform}-${normalizedArch}${libcSuffix}`;
241
261
  }
242
262
  // @pnpm/exe bundles Node.js via optional platform-specific packages
243
- // (e.g. @pnpm/exe.darwin-arm64, @pnpm/exe.linux-x64-musl).
244
- // Its postinstall script links the correct binary into the @pnpm/exe package dir.
245
- // Since scripts are disabled during install (to support systems without Node.js),
246
- // we replicate that linking here.
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.
247
269
  export function linkExePlatformBinary(installDir) {
248
- const platform = process.platform;
249
- const pkgDirName = exePlatformPkgDirName(platform, process.arch, familySync());
250
270
  const exePkgDir = path.join(installDir, 'node_modules', '@pnpm', 'exe');
251
271
  if (!fs.existsSync(exePkgDir))
252
272
  return;
@@ -254,10 +274,23 @@ export function linkExePlatformBinary(installDir) {
254
274
  // to the top-level node_modules. It's a dependency of @pnpm/exe and lives as a
255
275
  // sibling in the virtual store. Resolve through the @pnpm/exe symlink to find it.
256
276
  const exeRealDir = fs.realpathSync(exePkgDir);
257
- const platformPkgDir = path.join(path.dirname(exeRealDir), pkgDirName);
277
+ const platform = process.platform;
278
+ const arch = process.arch;
279
+ const libcFamily = familySync();
258
280
  const executable = platform === 'win32' ? 'pnpm.exe' : 'pnpm';
259
- const src = path.join(platformPkgDir, executable);
260
- if (!fs.existsSync(src))
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)
261
294
  return;
262
295
  const dest = path.join(exePkgDir, executable);
263
296
  forceLink(src, dest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/engine.pm.commands",
3
- "version": "1101.0.1",
3
+ "version": "1101.0.2",
4
4
  "description": "pnpm commands for self-updating and setting up pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -32,25 +32,25 @@
32
32
  "render-help": "^2.0.0",
33
33
  "semver": "^7.7.2",
34
34
  "symlink-dir": "^10.0.1",
35
+ "@pnpm/cli.meta": "1100.0.1",
36
+ "@pnpm/bins.linker": "1100.0.2",
35
37
  "@pnpm/building.policy": "1100.0.1",
36
38
  "@pnpm/cli.utils": "1101.0.0",
37
- "@pnpm/bins.linker": "1100.0.2",
38
- "@pnpm/cli.meta": "1100.0.1",
39
- "@pnpm/error": "1100.0.0",
40
- "@pnpm/deps.graph-hasher": "1100.1.0",
41
- "@pnpm/global.commands": "1100.0.3",
39
+ "@pnpm/deps.graph-hasher": "1100.1.1",
40
+ "@pnpm/global.commands": "1100.0.4",
42
41
  "@pnpm/global.packages": "1100.0.1",
43
- "@pnpm/config.reader": "1101.1.0",
44
- "@pnpm/installing.client": "1100.0.3",
45
- "@pnpm/installing.deps-restorer": "1100.0.3",
42
+ "@pnpm/config.reader": "1101.1.1",
43
+ "@pnpm/installing.client": "1100.0.4",
44
+ "@pnpm/installing.deps-restorer": "1101.0.0",
46
45
  "@pnpm/lockfile.types": "1100.0.2",
47
- "@pnpm/installing.env-installer": "1100.1.1",
48
46
  "@pnpm/shell.path": "1100.0.0",
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",
49
51
  "@pnpm/types": "1101.0.0",
50
- "@pnpm/resolving.npm-resolver": "1100.1.0",
51
- "@pnpm/workspace.project-manifest-reader": "1100.0.2",
52
- "@pnpm/store.controller": "1100.0.2",
53
- "@pnpm/store.connection-manager": "1100.0.3"
52
+ "@pnpm/store.controller": "1101.0.0",
53
+ "@pnpm/workspace.project-manifest-reader": "1100.0.2"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@pnpm/logger": ">=1001.0.0 <1002.0.0"
@@ -60,12 +60,12 @@
60
60
  "@types/cross-spawn": "^6.0.6",
61
61
  "@types/ramda": "0.31.1",
62
62
  "@types/semver": "7.7.1",
63
- "@pnpm/logger": "1100.0.0",
64
- "@pnpm/error": "1100.0.0",
65
63
  "@pnpm/constants": "1100.0.0",
66
- "@pnpm/prepare": "1100.0.2",
64
+ "@pnpm/error": "1100.0.0",
65
+ "@pnpm/engine.pm.commands": "1101.0.2",
67
66
  "@pnpm/testing.mock-agent": "1100.0.1",
68
- "@pnpm/engine.pm.commands": "1101.0.1"
67
+ "@pnpm/prepare": "1100.0.3",
68
+ "@pnpm/logger": "1100.0.0"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=22.13"