@pnpm/napi 12.0.0-alpha.9 → 12.0.0-beta.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 ADDED
@@ -0,0 +1,43 @@
1
+ # @pnpm/napi
2
+
3
+ ## 12.0.0-beta.1
4
+
5
+ ### Minor Changes
6
+
7
+ - Added the `trustLockfile` install option to skip verifying lockfile resolutions against current registry metadata.
8
+
9
+ ### Patch Changes
10
+
11
+ - Fixed repeat installs ignoring changes in caller-supplied in-memory project manifests.
12
+
13
+ ## 12.0.0-beta.0
14
+
15
+ ## 12.0.0-alpha.21
16
+
17
+ ## 12.0.0-alpha.20
18
+
19
+ ## 12.0.0-alpha.19
20
+
21
+ ## 12.0.0-alpha.18
22
+
23
+ ## 12.0.0-alpha.17
24
+
25
+ ## 12.0.0-alpha.16
26
+
27
+ ## 12.0.0-alpha.15
28
+
29
+ ### Minor Changes
30
+
31
+ - Added `pnpm licenses` command to the Rust pacquet port to list package licenses in a tabular or JSON format.
32
+
33
+ ## 12.0.0-alpha.14
34
+
35
+ ## 12.0.0-alpha.13
36
+
37
+ ## 12.0.0-alpha.12
38
+
39
+ ## 12.0.0-alpha.11
40
+
41
+ ## 12.0.0-alpha.10
42
+
43
+ ## 12.0.0-alpha.9
package/README.md CHANGED
@@ -30,7 +30,10 @@ structured envelope.
30
30
 
31
31
  Auth: pass `authHeaderByUri` — a map of nerf-darted registry URI → `Authorization`
32
32
  header value (with `""` for the default registry). The host resolves these from
33
- its `.npmrc` credentials; the engine applies them as-is.
33
+ its `.npmrc` credentials; the engine applies them as-is. The `""` entry is
34
+ pinned to the `registry` / `registries.default` passed alongside it (npmjs when
35
+ neither is given), so a `registry=` in the project's own `.npmrc` cannot
36
+ redirect that credential to another host.
34
37
 
35
38
  ## Distribution
36
39
 
package/index.d.ts CHANGED
@@ -30,6 +30,15 @@ export interface NodeApiProject {
30
30
  rootDir: string
31
31
  /** In-memory manifest; the engine never reads package.json from disk for listed projects. */
32
32
  manifest: PackageManifest
33
+ /**
34
+ * Manifest used when this project is resolved as a *dependency* of another
35
+ * importer (an injected workspace instance) instead of `manifest`. Lets a
36
+ * host pre-transform its importer manifests (e.g. strip workspace-sibling
37
+ * deps it links itself) while dependency instances keep the raw graph —
38
+ * without a `readPackage` hook round trip. Omit when both views are the
39
+ * same.
40
+ */
41
+ dependencyManifest?: PackageManifest
33
42
  }
34
43
 
35
44
  export interface ProxyConfig {
@@ -85,6 +94,9 @@ export interface SharedEngineOptions {
85
94
  * URI (`//host/path/`), plus `''` for the default registry — e.g.
86
95
  * `{ '': 'Bearer abc', '//npm.example.com/': 'Basic <base64(user:pass)>' }`. The
87
96
  * host resolves these from its `authConfig`; the engine applies them as-is.
97
+ * The `''` entry is pinned to the `registry` / `registries.default` passed
98
+ * alongside it (npmjs when neither is given), so a `registry=` in the
99
+ * project's own `.npmrc` cannot redirect that credential to another host.
88
100
  */
89
101
  authHeaderByUri?: Record<string, string>
90
102
  proxyConfig?: ProxyConfig
@@ -122,6 +134,13 @@ export interface InstallOptions extends SharedEngineOptions {
122
134
  virtualStoreDirMaxLength?: number
123
135
  peersSuffixMaxLength?: number
124
136
  dedupePeerDependents?: boolean
137
+ /**
138
+ * Render every resolved-peer slot in depPath suffixes as `name@version`
139
+ * instead of the peer's own depPath (the `dedupePeers` setting). Must match
140
+ * the value the existing lockfile was generated with, or the install
141
+ * re-resolves from scratch.
142
+ */
143
+ dedupePeers?: boolean
125
144
  dedupeDirectDeps?: boolean
126
145
  dedupeInjectedDeps?: boolean
127
146
  resolvePeersFromWorkspaceRoot?: boolean
@@ -131,6 +150,11 @@ export interface InstallOptions extends SharedEngineOptions {
131
150
  minimumReleaseAgeExclude?: string[]
132
151
  includeOptionalDeps?: boolean
133
152
  ignoreScripts?: boolean
153
+ /**
154
+ * Trust lockfile resolutions without verifying them against current registry
155
+ * metadata.
156
+ */
157
+ trustLockfile?: boolean
134
158
  /**
135
159
  * Re-resolve the whole dependency graph to the highest in-range version
136
160
  * (pnpm's `update: true` / `depth: Infinity`). The binding takes no package
package/index.js CHANGED
@@ -166,4 +166,37 @@ function wrapExports(binding) {
166
166
  return wrapped
167
167
  }
168
168
 
169
- module.exports = wrapExports(loadBinding())
169
+ // The engine dispatches the readPackage hook through a threadsafe function,
170
+ // which costs roughly one event-loop tick per call — tens of thousands of
171
+ // per-manifest calls serialize a large resolution behind the JS event loop.
172
+ // Synthesize the batch form of the consumer's per-manifest hook so the native
173
+ // side can serve a whole batch per call. The extra argument is ignored by
174
+ // binaries that predate the batch contract, and a batch-aware binary falls
175
+ // back to per-manifest dispatch when the wrapper is older than it.
176
+ function withBatchedReadPackageHook(exports) {
177
+ const nativeInstall = exports.install
178
+ if (typeof nativeInstall !== 'function') return exports
179
+ exports.install = function (options, onLog, readPackageHook, ...rest) {
180
+ const batchHook = typeof readPackageHook === 'function'
181
+ ? (manifests, resolvedDirs) => {
182
+ // Guard against a binary that invokes the batch hook without the
183
+ // dirs array (version skew): treat every entry as a non-directory
184
+ // resolution rather than throwing.
185
+ const dirs = Array.isArray(resolvedDirs) ? resolvedDirs : []
186
+ return manifests.map((manifest, i) => {
187
+ const transformed = readPackageHook(manifest, dirs[i] == null ? undefined : dirs[i])
188
+ // The engine cannot await the hook: a returned promise would be
189
+ // serialized as an empty manifest and silently corrupt resolution.
190
+ if (transformed && typeof transformed.then === 'function') {
191
+ throw new TypeError('readPackageHook must be synchronous and return the manifest, not a promise')
192
+ }
193
+ return transformed
194
+ })
195
+ }
196
+ : undefined
197
+ return nativeInstall.call(this, options, onLog, readPackageHook, batchHook, ...rest)
198
+ }
199
+ return exports
200
+ }
201
+
202
+ module.exports = withBatchedReadPackageHook(wrapExports(loadBinding()))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/napi",
3
- "version": "12.0.0-alpha.9",
3
+ "version": "12.0.0-beta.1",
4
4
  "description": "Node.js addon bindings for the pnpm v12 Rust engine (pacquet)",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -27,14 +27,14 @@
27
27
  "README.md"
28
28
  ],
29
29
  "optionalDependencies": {
30
- "@pnpm/napi.win32-x64": "12.0.0-alpha.9",
31
- "@pnpm/napi.win32-arm64": "12.0.0-alpha.9",
32
- "@pnpm/napi.darwin-x64": "12.0.0-alpha.9",
33
- "@pnpm/napi.darwin-arm64": "12.0.0-alpha.9",
34
- "@pnpm/napi.linux-x64": "12.0.0-alpha.9",
35
- "@pnpm/napi.linux-arm64": "12.0.0-alpha.9",
36
- "@pnpm/napi.linux-x64-musl": "12.0.0-alpha.9",
37
- "@pnpm/napi.linux-arm64-musl": "12.0.0-alpha.9"
30
+ "@pnpm/napi.win32-x64": "12.0.0-beta.1",
31
+ "@pnpm/napi.win32-arm64": "12.0.0-beta.1",
32
+ "@pnpm/napi.darwin-x64": "12.0.0-beta.1",
33
+ "@pnpm/napi.darwin-arm64": "12.0.0-beta.1",
34
+ "@pnpm/napi.linux-x64": "12.0.0-beta.1",
35
+ "@pnpm/napi.linux-arm64": "12.0.0-beta.1",
36
+ "@pnpm/napi.linux-x64-musl": "12.0.0-beta.1",
37
+ "@pnpm/napi.linux-arm64-musl": "12.0.0-beta.1"
38
38
  },
39
39
  "scripts": {
40
40
  "generate-packages": "node scripts/generate-packages.mjs"