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

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.4",
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,24 @@
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/linux-arm64": "11.0.0-rc.4",
36
+ "@pnpm/linux-x64": "11.0.0-rc.4",
37
+ "@pnpm/linuxstatic-arm64": "11.0.0-rc.4",
38
+ "@pnpm/linuxstatic-x64": "11.0.0-rc.4",
39
+ "@pnpm/macos-arm64": "11.0.0-rc.4",
40
+ "@pnpm/macos-x64": "11.0.0-rc.4",
41
+ "@pnpm/win-arm64": "11.0.0-rc.4",
42
+ "@pnpm/win-x64": "11.0.0-rc.4"
39
43
  },
40
44
  "devDependencies": {
41
45
  "@jest/globals": "30.3.0",
42
46
  "execa": "npm:safe-execa@0.3.0",
43
- "tar": "^7.5.10",
44
- "@pnpm/jest-config": "1100.0.1",
45
- "@pnpm/exe": "11.0.0-rc.2"
47
+ "@pnpm/jest-config": "1100.0.3",
48
+ "@pnpm/exe": "11.0.0-rc.4"
46
49
  },
47
50
  "jest": {
48
51
  "preset": "@pnpm/jest-config"
@@ -52,7 +55,8 @@
52
55
  "tag": "next-10"
53
56
  },
54
57
  "scripts": {
55
- "preinstall": "node setup.js"
58
+ "preinstall": "node setup.js",
59
+ "build-artifacts": "pn --filter=pnpm prepublishOnly && node ./scripts/build-artifacts.ts"
56
60
  },
57
61
  "bin": {
58
62
  "pnpm": "pnpm",
@@ -0,0 +1,18 @@
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. Returns `@pnpm/<os>-<arch>`, where <os> is `macos` (darwin),
4
+ // `win` (win32), `linux` (glibc), or `linuxstatic` (musl). Pure — no I/O, no
5
+ // detect-libc call — so the musl branch is unit-testable without mocking.
6
+ export function exePlatformPkgName(platform, arch, libcFamily) {
7
+ const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch
8
+ return `@pnpm/${legacyOsSegment(platform, libcFamily)}-${normalizedArch}`
9
+ }
10
+
11
+ function legacyOsSegment(platform, libcFamily) {
12
+ switch (platform) {
13
+ case 'darwin': return 'macos'
14
+ case 'win32': return 'win'
15
+ case 'linux': return libcFamily === 'musl' ? 'linuxstatic' : 'linux'
16
+ default: return platform
17
+ }
18
+ }
package/setup.js CHANGED
@@ -1,17 +1,21 @@
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 package names use the legacy scheme: `@pnpm/macos-<arch>` (darwin),
8
+ // `@pnpm/win-<arch>` (win32), `@pnpm/linux-<arch>` (glibc), and
9
+ // `@pnpm/linuxstatic-<arch>` (musl Linux, detected via detect-libc). This is
10
+ // the naming published on npm, even though the workspace directories use the
11
+ // newer `<os>-<arch>[-musl]` scheme. Keeping these names lets `pnpm
12
+ // self-update` from older majors continue to resolve the right platform child.
13
+ // The name computation lives in platform-pkg-name.js so it can be unit-tested
14
+ // without triggering the side effects of this preinstall script.
15
+ const platform = process.platform
16
+ const pkgName = exePlatformPkgName(platform, process.arch, familySync())
13
17
  const pkgJson = fileURLToPath(import.meta.resolve(`${pkgName}/package.json`))
14
- const executable = platform === 'win' ? 'pnpm.exe' : 'pnpm'
18
+ const executable = platform === 'win32' ? 'pnpm.exe' : 'pnpm'
15
19
  const platformDir = path.dirname(pkgJson)
16
20
  const bin = path.resolve(platformDir, executable)
17
21
 
@@ -21,7 +25,7 @@ if (!fs.existsSync(bin)) process.exit(0)
21
25
 
22
26
  linkSync(bin, path.resolve(ownDir, executable))
23
27
 
24
- if (platform === 'win') {
28
+ if (platform === 'win32') {
25
29
  // On Windows, also hardlink the binary as 'pnpm' (no .exe extension).
26
30
  // npm's bin shims point to the name from publishConfig.bin, and npm
27
31
  // does NOT re-read package.json after preinstall, so rewriting the bin