@pnpm/exe 11.0.0-rc.2 → 11.0.0-rc.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exe",
3
- "version": "11.0.0-rc.2",
3
+ "version": "11.0.0-rc.3",
4
4
  "description": "Fast, disk space efficient package manager",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -17,6 +17,7 @@
17
17
  "type": "module",
18
18
  "files": [
19
19
  "setup.js",
20
+ "platform-pkg-name.js",
20
21
  "prepare.js",
21
22
  "dist/",
22
23
  "pn.cmd",
@@ -27,22 +28,25 @@
27
28
  "pnx.ps1"
28
29
  ],
29
30
  "dependencies": {
30
- "@reflink/reflink": "0.1.19"
31
+ "@reflink/reflink": "0.1.19",
32
+ "detect-libc": "^2.0.3"
31
33
  },
32
34
  "optionalDependencies": {
33
- "@pnpm/linux-x64": "11.0.0-rc.2",
34
- "@pnpm/linux-arm64": "11.0.0-rc.2",
35
- "@pnpm/macos-x64": "11.0.0-rc.2",
36
- "@pnpm/win-arm64": "11.0.0-rc.2",
37
- "@pnpm/macos-arm64": "11.0.0-rc.2",
38
- "@pnpm/win-x64": "11.0.0-rc.2"
35
+ "@pnpm/exe.darwin-arm64": "11.0.0-rc.3",
36
+ "@pnpm/exe.darwin-x64": "11.0.0-rc.3",
37
+ "@pnpm/exe.linux-arm64": "11.0.0-rc.3",
38
+ "@pnpm/exe.linux-x64": "11.0.0-rc.3",
39
+ "@pnpm/exe.linux-arm64-musl": "11.0.0-rc.3",
40
+ "@pnpm/exe.linux-x64-musl": "11.0.0-rc.3",
41
+ "@pnpm/exe.win32-arm64": "11.0.0-rc.3",
42
+ "@pnpm/exe.win32-x64": "11.0.0-rc.3"
39
43
  },
40
44
  "devDependencies": {
41
45
  "@jest/globals": "30.3.0",
42
46
  "execa": "npm:safe-execa@0.3.0",
43
47
  "tar": "^7.5.10",
44
- "@pnpm/jest-config": "1100.0.1",
45
- "@pnpm/exe": "11.0.0-rc.2"
48
+ "@pnpm/exe": "11.0.0-rc.3",
49
+ "@pnpm/jest-config": "1100.0.2"
46
50
  },
47
51
  "jest": {
48
52
  "preset": "@pnpm/jest-config"
@@ -0,0 +1,9 @@
1
+ // Shared between setup.js (preinstall hook) and the test suite.
2
+ // Computes the npm package name of the matching @pnpm/exe platform child for a
3
+ // given host: `@pnpm/exe.<platform>-<arch>[-musl]`. Pure — no I/O, no detect-libc
4
+ // call — so the musl branch is unit-testable without mocking.
5
+ export function exePlatformPkgName(platform, arch, libcFamily) {
6
+ const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch
7
+ const libcSuffix = platform === 'linux' && libcFamily === 'musl' ? '-musl' : ''
8
+ return `@pnpm/exe.${platform}-${normalizedArch}${libcSuffix}`
9
+ }
package/setup.js CHANGED
@@ -1,17 +1,18 @@
1
1
  import { fileURLToPath } from 'url'
2
2
  import path from 'path'
3
3
  import fs from 'fs'
4
-
5
- const platform = process.platform === 'win32'
6
- ? 'win'
7
- : process.platform === 'darwin'
8
- ? 'macos'
9
- : process.platform
10
- const arch = platform === 'win' && process.arch === 'ia32' ? 'x86' : process.arch
11
-
12
- const pkgName = `@pnpm/${platform}-${arch}`
4
+ import { familySync } from 'detect-libc'
5
+ import { exePlatformPkgName } from './platform-pkg-name.js'
6
+
7
+ // Platform names match process.platform (linux | darwin | win32). On linux,
8
+ // add a `-musl` libc suffix when detect-libc reports musl, matching the
9
+ // @pnpm/exe.linux-<arch>-musl optional-dep naming. The name computation lives
10
+ // in platform-pkg-name.js so it can be unit-tested without triggering the
11
+ // side effects of this preinstall script.
12
+ const platform = process.platform
13
+ const pkgName = exePlatformPkgName(platform, process.arch, familySync())
13
14
  const pkgJson = fileURLToPath(import.meta.resolve(`${pkgName}/package.json`))
14
- const executable = platform === 'win' ? 'pnpm.exe' : 'pnpm'
15
+ const executable = platform === 'win32' ? 'pnpm.exe' : 'pnpm'
15
16
  const platformDir = path.dirname(pkgJson)
16
17
  const bin = path.resolve(platformDir, executable)
17
18
 
@@ -21,7 +22,7 @@ if (!fs.existsSync(bin)) process.exit(0)
21
22
 
22
23
  linkSync(bin, path.resolve(ownDir, executable))
23
24
 
24
- if (platform === 'win') {
25
+ if (platform === 'win32') {
25
26
  // On Windows, also hardlink the binary as 'pnpm' (no .exe extension).
26
27
  // npm's bin shims point to the name from publishConfig.bin, and npm
27
28
  // does NOT re-read package.json after preinstall, so rewriting the bin