@pnpm/napi 12.0.0-beta.0 → 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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @pnpm/napi
2
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
+
3
13
  ## 12.0.0-beta.0
4
14
 
5
15
  ## 12.0.0-alpha.21
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 {
@@ -125,6 +134,13 @@ export interface InstallOptions extends SharedEngineOptions {
125
134
  virtualStoreDirMaxLength?: number
126
135
  peersSuffixMaxLength?: number
127
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
128
144
  dedupeDirectDeps?: boolean
129
145
  dedupeInjectedDeps?: boolean
130
146
  resolvePeersFromWorkspaceRoot?: boolean
@@ -134,6 +150,11 @@ export interface InstallOptions extends SharedEngineOptions {
134
150
  minimumReleaseAgeExclude?: string[]
135
151
  includeOptionalDeps?: boolean
136
152
  ignoreScripts?: boolean
153
+ /**
154
+ * Trust lockfile resolutions without verifying them against current registry
155
+ * metadata.
156
+ */
157
+ trustLockfile?: boolean
137
158
  /**
138
159
  * Re-resolve the whole dependency graph to the highest in-range version
139
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-beta.0",
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-beta.0",
31
- "@pnpm/napi.win32-arm64": "12.0.0-beta.0",
32
- "@pnpm/napi.darwin-x64": "12.0.0-beta.0",
33
- "@pnpm/napi.darwin-arm64": "12.0.0-beta.0",
34
- "@pnpm/napi.linux-x64": "12.0.0-beta.0",
35
- "@pnpm/napi.linux-arm64": "12.0.0-beta.0",
36
- "@pnpm/napi.linux-x64-musl": "12.0.0-beta.0",
37
- "@pnpm/napi.linux-arm64-musl": "12.0.0-beta.0"
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"