@pnpm/napi 12.3.4 → 12.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pnpm/napi
2
2
 
3
+ ## 12.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Rebuilt on the pnpm 12.4.1 engine.
8
+
9
+ ## 12.4.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed a memory leak in the N-API bindings. Concurrent calls that resolved the same configuration each retained their own copy for the life of the process [pnpm/pnpm#14386](https://github.com/pnpm/pnpm/issues/14386).
14
+
3
15
  ## 12.3.4
4
16
 
5
17
  ## 12.3.3
package/README.md CHANGED
@@ -102,12 +102,13 @@ The addon ships as prebuilt per-platform packages, the same model as the
102
102
  `@pnpm/napi.<platform>` optional dependency, then a local build.
103
103
  - CI cross-compiles the addon per target (`napi build --release --target
104
104
  <rust-triple>`), uploads each as `pnpm-napi.<codeTarget>.node` at the repo
105
- root, then runs `scripts/generate-packages.mjs` to produce the eight
106
- `@pnpm/napi.<platform>` packages and wire them as this wrapper's
107
- `optionalDependencies`.
105
+ root, then runs `scripts/generate-packages.mjs` to produce the
106
+ `@pnpm/napi.<platform>` packages listed below and wire them as this
107
+ wrapper's `optionalDependencies`.
108
108
 
109
109
  Supported targets: `win32-x64`, `win32-arm64`, `darwin-x64`, `darwin-arm64`,
110
- `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`.
110
+ `linux-x64`, `linux-arm64`, `linux-riscv64`, `linux-ppc64`, `linux-s390x`,
111
+ `linux-x64-musl`, `linux-arm64-musl`, `freebsd-x64`, `android-arm64`, `android-x64`.
111
112
 
112
113
  ## Local development
113
114
 
package/index.js CHANGED
@@ -13,6 +13,7 @@
13
13
 
14
14
  const path = require('node:path')
15
15
  const fs = require('node:fs')
16
+ const os = require('node:os')
16
17
 
17
18
  // `'glibc' | 'musl' | null` — `null` when the host isn't Linux or the libc
18
19
  // can't be probed (`process.report` may be unavailable/disabled). glibc builds
@@ -39,6 +40,14 @@ function platformTriples() {
39
40
  return [`${platform}-${arch}`]
40
41
  }
41
42
 
43
+ // Node reports both POWER endiannesses as `ppc64` and npm's `cpu` field cannot
44
+ // tell them apart, so a big-endian host can install the little-endian addon.
45
+ // Only the little-endian build is released, so no platform package can serve
46
+ // such a host and one built locally is all that is left.
47
+ function hasReleasedPlatformPackage() {
48
+ return process.arch !== 'ppc64' || os.endianness() === 'LE'
49
+ }
50
+
42
51
  function tryLoad(candidate, loadErrors) {
43
52
  if (!candidate) return null
44
53
  try {
@@ -73,11 +82,12 @@ function isMissingCandidate(err, candidate) {
73
82
  }
74
83
 
75
84
  function loadFailure(triple, loadErrors) {
76
- const error = new Error(
77
- `Failed to load the pnpm Rust engine for ${triple}. ` +
78
- 'Install the matching @pnpm/napi platform package, or point ' +
85
+ const remedy = hasReleasedPlatformPackage()
86
+ ? 'Install the matching @pnpm/napi platform package, or point ' +
79
87
  'PNPM_NAPI_BINARY at a locally built .node file.'
80
- )
88
+ : 'No addon is published for this host, so point PNPM_NAPI_BINARY at a ' +
89
+ 'locally built .node file.'
90
+ const error = new Error(`Failed to load the pnpm Rust engine for ${triple}. ${remedy}`)
81
91
  if (loadErrors.length > 0) {
82
92
  error.cause = loadErrors[0]
83
93
  }
@@ -104,9 +114,10 @@ function loadBinding() {
104
114
  // Platform packages / local artifacts. On Linux both libc variants are tried,
105
115
  // so a wrong-ABI first candidate (an `ERR_DLOPEN_FAILED`) falls through to the
106
116
  // other rather than aborting.
117
+ const platformPackages = hasReleasedPlatformPackage()
107
118
  const candidates = [
108
119
  ...triples.flatMap((triple) => [
109
- `@pnpm/napi.${triple}`,
120
+ ...(platformPackages ? [`@pnpm/napi.${triple}`] : []),
110
121
  path.join(__dirname, `pnpm-napi.${triple}.node`),
111
122
  ]),
112
123
  path.join(__dirname, 'pnpm-napi.node'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/napi",
3
- "version": "12.3.4",
3
+ "version": "12.4.1",
4
4
  "description": "Node.js addon bindings for the pnpm v12 Rust engine (pacquet)",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -28,14 +28,20 @@
28
28
  "THIRD-PARTY-NOTICES.md"
29
29
  ],
30
30
  "optionalDependencies": {
31
- "@pnpm/napi.win32-x64": "12.3.4",
32
- "@pnpm/napi.win32-arm64": "12.3.4",
33
- "@pnpm/napi.darwin-x64": "12.3.4",
34
- "@pnpm/napi.darwin-arm64": "12.3.4",
35
- "@pnpm/napi.linux-x64": "12.3.4",
36
- "@pnpm/napi.linux-arm64": "12.3.4",
37
- "@pnpm/napi.linux-x64-musl": "12.3.4",
38
- "@pnpm/napi.linux-arm64-musl": "12.3.4"
31
+ "@pnpm/napi.win32-x64": "12.4.1",
32
+ "@pnpm/napi.win32-arm64": "12.4.1",
33
+ "@pnpm/napi.darwin-x64": "12.4.1",
34
+ "@pnpm/napi.darwin-arm64": "12.4.1",
35
+ "@pnpm/napi.linux-x64": "12.4.1",
36
+ "@pnpm/napi.linux-arm64": "12.4.1",
37
+ "@pnpm/napi.linux-riscv64": "12.4.1",
38
+ "@pnpm/napi.linux-ppc64": "12.4.1",
39
+ "@pnpm/napi.linux-s390x": "12.4.1",
40
+ "@pnpm/napi.linux-x64-musl": "12.4.1",
41
+ "@pnpm/napi.linux-arm64-musl": "12.4.1",
42
+ "@pnpm/napi.freebsd-x64": "12.4.1",
43
+ "@pnpm/napi.android-arm64": "12.4.1",
44
+ "@pnpm/napi.android-x64": "12.4.1"
39
45
  },
40
46
  "scripts": {
41
47
  "generate-packages": "node scripts/generate-packages.mjs"