@pnpm/engine.pm.commands 1101.0.1 → 1101.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/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);
@@ -6,7 +6,7 @@ import { types as allTypes } from '@pnpm/config.reader';
6
6
  import { PnpmError } from '@pnpm/error';
7
7
  import { createResolver } from '@pnpm/installing.client';
8
8
  import { resolvePackageManagerIntegrities } from '@pnpm/installing.env-installer';
9
- import { globalWarn } from '@pnpm/logger';
9
+ import { globalInfo, globalWarn } from '@pnpm/logger';
10
10
  import { whichVersionIsPinned } from '@pnpm/resolving.npm-resolver';
11
11
  import { createStoreController } from '@pnpm/store.connection-manager';
12
12
  import { readProjectManifest } from '@pnpm/workspace.project-manifest-reader';
@@ -23,6 +23,13 @@ export function cliOptionsTypes() {
23
23
  };
24
24
  }
25
25
  export const commandNames = ['self-update'];
26
+ // Migration guidance printed once when `pnpm self-update` crosses a major
27
+ // boundary. Add an entry here for each future major that ships breaking
28
+ // changes users need to act on.
29
+ const MAJOR_UPGRADE_HINTS = {
30
+ 11: 'pnpm v11 removed or renamed several v10 settings. ' +
31
+ 'See https://pnpm.io/11.x/migration for migration instructions.',
32
+ };
26
33
  export const skipPackageManagerCheck = true;
27
34
  export function help() {
28
35
  return renderHelp({
@@ -41,6 +48,7 @@ export async function handler(opts, params) {
41
48
  if (isExecutedByCorepack()) {
42
49
  throw new PnpmError('CANT_SELF_UPDATE_IN_COREPACK', 'You should update pnpm with corepack');
43
50
  }
51
+ globalInfo('Checking for updates...');
44
52
  const { resolve } = createResolver({ ...opts, configByUri: opts.configByUri });
45
53
  const pkgName = 'pnpm';
46
54
  const bareSpecifier = params[0] ?? 'latest';
@@ -52,6 +60,31 @@ export async function handler(opts, params) {
52
60
  if (!resolution?.manifest) {
53
61
  throw new PnpmError('CANNOT_RESOLVE_PNPM', `Cannot find "${bareSpecifier}" version of pnpm`);
54
62
  }
63
+ // Determine the "previous" pnpm version being upgraded FROM. If the
64
+ // project pins pnpm via `packageManager`/`devEngines.packageManager`,
65
+ // the pin is the source of truth — the running pnpm binary may already
66
+ // be at a newer major (e.g. a globally-installed v11 operating on a
67
+ // project still pinned to v10). Otherwise fall back to the running
68
+ // binary. Skip the hint entirely on a no-op (target === previous).
69
+ const targetVersion = resolution.manifest.version;
70
+ let previousVersion;
71
+ if (opts.wantedPackageManager?.name === packageManager.name) {
72
+ if (opts.wantedPackageManager.version !== targetVersion) {
73
+ previousVersion = opts.wantedPackageManager.version;
74
+ }
75
+ }
76
+ else if (packageManager.version !== targetVersion) {
77
+ previousVersion = packageManager.version;
78
+ }
79
+ const previousMajor = previousVersion != null
80
+ ? semver.coerce(previousVersion)?.major
81
+ : undefined;
82
+ const targetMajor = semver.major(targetVersion);
83
+ if (previousMajor != null && targetMajor > previousMajor) {
84
+ const hint = MAJOR_UPGRADE_HINTS[targetMajor];
85
+ if (hint)
86
+ globalWarn(hint);
87
+ }
55
88
  if (opts.wantedPackageManager?.name === packageManager.name) {
56
89
  if (opts.wantedPackageManager?.version !== resolution.manifest.version) {
57
90
  const { manifest, writeProjectManifest } = await readProjectManifest(opts.rootProjectManifestDir);
@@ -94,6 +127,7 @@ export async function handler(opts, params) {
94
127
  if (resolution.manifest.version === packageManager.version) {
95
128
  return `The currently active ${packageManager.name} v${packageManager.version} is already "${bareSpecifier}" and doesn't need an update`;
96
129
  }
130
+ globalInfo(`Updating pnpm from v${packageManager.version} to v${resolution.manifest.version}...`);
97
131
  const store = await createStoreController(opts);
98
132
  // Resolve integrities and write env lockfile to pnpm-lock.yaml
99
133
  const envLockfile = await resolvePackageManagerIntegrities(resolution.manifest.version, {
@@ -113,7 +147,7 @@ export async function handler(opts, params) {
113
147
  if (alreadyExisted) {
114
148
  return `The ${bareSpecifier} version, v${resolution.manifest.version}, is already present on the system. It was activated by linking it from ${baseDir}.`;
115
149
  }
116
- return undefined;
150
+ return `Successfully updated pnpm to v${resolution.manifest.version}`;
117
151
  }
118
152
  /**
119
153
  * Returns the updated version constraint for devEngines.packageManager.
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.1.0",
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/building.policy": "1100.0.1",
36
- "@pnpm/cli.utils": "1101.0.0",
37
35
  "@pnpm/bins.linker": "1100.0.2",
38
36
  "@pnpm/cli.meta": "1100.0.1",
37
+ "@pnpm/cli.utils": "1101.0.0",
38
+ "@pnpm/config.reader": "1101.1.1",
39
39
  "@pnpm/error": "1100.0.0",
40
- "@pnpm/deps.graph-hasher": "1100.1.0",
41
- "@pnpm/global.commands": "1100.0.3",
40
+ "@pnpm/global.commands": "1100.0.5",
41
+ "@pnpm/building.policy": "1100.0.1",
42
+ "@pnpm/deps.graph-hasher": "1100.1.1",
42
43
  "@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",
44
+ "@pnpm/installing.client": "1100.0.5",
45
+ "@pnpm/installing.deps-restorer": "1101.0.0",
46
+ "@pnpm/installing.env-installer": "1101.0.0",
46
47
  "@pnpm/lockfile.types": "1100.0.2",
47
- "@pnpm/installing.env-installer": "1100.1.1",
48
+ "@pnpm/resolving.npm-resolver": "1101.0.0",
49
+ "@pnpm/store.connection-manager": "1100.0.5",
48
50
  "@pnpm/shell.path": "1100.0.0",
51
+ "@pnpm/store.controller": "1101.0.0",
49
52
  "@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"
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/engine.pm.commands": "1101.1.0",
65
+ "@pnpm/error": "1100.0.0",
66
+ "@pnpm/prepare": "1100.0.3",
67
67
  "@pnpm/testing.mock-agent": "1100.0.1",
68
- "@pnpm/engine.pm.commands": "1101.0.1"
68
+ "@pnpm/logger": "1100.0.0"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=22.13"