@pnpm/napi 12.0.0-beta.0 → 12.0.0-beta.2
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 +16 -0
- package/index.d.ts +101 -0
- package/index.js +34 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pnpm/napi
|
|
2
2
|
|
|
3
|
+
## 12.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `readConfig(options)`: resolves the configuration the engine's own installs use — registries with their resolved `Authorization` headers, `authHeaderByUri`, proxy, TLS, network limits, store/cache directories, and install behavior settings from the `.npmrc` / `pnpm-workspace.yaml` cascade — so hosts that embed the engine no longer need a JavaScript config reader.
|
|
8
|
+
|
|
9
|
+
## 12.0.0-beta.1
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Added the `trustLockfile` install option to skip verifying lockfile resolutions against current registry metadata.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Fixed repeat installs ignoring changes in caller-supplied in-memory project manifests.
|
|
18
|
+
|
|
3
19
|
## 12.0.0-beta.0
|
|
4
20
|
|
|
5
21
|
## 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
|
|
@@ -308,5 +329,85 @@ export interface ParsedBareSpecifier {
|
|
|
308
329
|
/** Parses/validates a dependency specifier. Returns null for unparsable input. */
|
|
309
330
|
export function parseBareSpecifier(spec: string, alias?: string): ParsedBareSpecifier | null
|
|
310
331
|
|
|
332
|
+
export interface ReadConfigOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Directory whose config cascade to resolve — its `.npmrc`, the enclosing
|
|
335
|
+
* workspace's `pnpm-workspace.yaml` and `.npmrc`, the user and global
|
|
336
|
+
* config files, and `npm_config_*` environment variables.
|
|
337
|
+
*/
|
|
338
|
+
dir: string
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** One configured registry: the `default` entry plus one per `@scope`. */
|
|
342
|
+
export interface ResolvedRegistry {
|
|
343
|
+
/** `"default"` or the package scope (`"@teambit"`). */
|
|
344
|
+
name: string
|
|
345
|
+
url: string
|
|
346
|
+
/**
|
|
347
|
+
* Ready-to-send `Authorization` header for this registry, when the config
|
|
348
|
+
* carries a static credential for it. `tokenHelper` credentials are not
|
|
349
|
+
* executed here and yield no header.
|
|
350
|
+
*/
|
|
351
|
+
authHeader?: string
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface ResolvedConfig {
|
|
355
|
+
registries: ResolvedRegistry[]
|
|
356
|
+
/**
|
|
357
|
+
* Static `Authorization` headers keyed by nerf-darted registry URI
|
|
358
|
+
* (`//host[:port]/path/`) — the shape `install`'s `authHeaderByUri`
|
|
359
|
+
* accepts.
|
|
360
|
+
*/
|
|
361
|
+
authHeaderByUri: Record<string, string>
|
|
362
|
+
httpProxy?: string
|
|
363
|
+
httpsProxy?: string
|
|
364
|
+
/** `true` (bypass every proxy) or a comma-separated host list. */
|
|
365
|
+
noProxy?: boolean | string
|
|
366
|
+
/** PEM-encoded CA certificates (`ca` / `cafile` already merged). */
|
|
367
|
+
ca?: string[]
|
|
368
|
+
cert?: string
|
|
369
|
+
key?: string
|
|
370
|
+
strictSsl?: boolean
|
|
371
|
+
storeDir: string
|
|
372
|
+
cacheDir: string
|
|
373
|
+
virtualStoreDirMaxLength: number
|
|
374
|
+
networkConcurrency: number
|
|
375
|
+
maxSockets?: number
|
|
376
|
+
fetchRetries: number
|
|
377
|
+
fetchRetryFactor: number
|
|
378
|
+
fetchRetryMintimeout: number
|
|
379
|
+
fetchRetryMaxtimeout: number
|
|
380
|
+
fetchTimeout: number
|
|
381
|
+
/**
|
|
382
|
+
* The explicitly configured user agent, when the cascade set one. The
|
|
383
|
+
* engine's own computed default is omitted — an embedder that passes
|
|
384
|
+
* nothing back to `install` gets that same default.
|
|
385
|
+
*/
|
|
386
|
+
userAgent?: string
|
|
387
|
+
engineStrict: boolean
|
|
388
|
+
nodeVersion?: string
|
|
389
|
+
/** `"auto"` / `"hardlink"` / `"copy"` / `"clone"` / `"clone-or-copy"`. */
|
|
390
|
+
packageImportMethod: string
|
|
391
|
+
hoistPattern?: string[]
|
|
392
|
+
publicHoistPattern?: string[]
|
|
393
|
+
/**
|
|
394
|
+
* The legacy `shamefullyHoist` flag; `publicHoistPattern` already
|
|
395
|
+
* reflects it, exposed for embedders that branch on the flag itself.
|
|
396
|
+
*/
|
|
397
|
+
shamefullyHoist: boolean
|
|
398
|
+
/**
|
|
399
|
+
* The engine's pnpm home directory (`PNPM_HOME` or the platform default) —
|
|
400
|
+
* not a per-project setting. Absent when no home directory is resolvable.
|
|
401
|
+
*/
|
|
402
|
+
pnpmHomeDir?: string
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Resolve the configuration the engine's own installs use — registries,
|
|
407
|
+
* credentials, proxy, TLS, and network settings from the `.npmrc` cascade —
|
|
408
|
+
* so the embedder needs no JavaScript config reader.
|
|
409
|
+
*/
|
|
410
|
+
export function readConfig(options: ReadConfigOptions): ResolvedConfig
|
|
411
|
+
|
|
311
412
|
/** Version of the underlying Rust engine (pacquet). */
|
|
312
413
|
export function engineVersion(): string
|
package/index.js
CHANGED
|
@@ -166,4 +166,37 @@ function wrapExports(binding) {
|
|
|
166
166
|
return wrapped
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
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.
|
|
3
|
+
"version": "12.0.0-beta.2",
|
|
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.
|
|
31
|
-
"@pnpm/napi.win32-arm64": "12.0.0-beta.
|
|
32
|
-
"@pnpm/napi.darwin-x64": "12.0.0-beta.
|
|
33
|
-
"@pnpm/napi.darwin-arm64": "12.0.0-beta.
|
|
34
|
-
"@pnpm/napi.linux-x64": "12.0.0-beta.
|
|
35
|
-
"@pnpm/napi.linux-arm64": "12.0.0-beta.
|
|
36
|
-
"@pnpm/napi.linux-x64-musl": "12.0.0-beta.
|
|
37
|
-
"@pnpm/napi.linux-arm64-musl": "12.0.0-beta.
|
|
30
|
+
"@pnpm/napi.win32-x64": "12.0.0-beta.2",
|
|
31
|
+
"@pnpm/napi.win32-arm64": "12.0.0-beta.2",
|
|
32
|
+
"@pnpm/napi.darwin-x64": "12.0.0-beta.2",
|
|
33
|
+
"@pnpm/napi.darwin-arm64": "12.0.0-beta.2",
|
|
34
|
+
"@pnpm/napi.linux-x64": "12.0.0-beta.2",
|
|
35
|
+
"@pnpm/napi.linux-arm64": "12.0.0-beta.2",
|
|
36
|
+
"@pnpm/napi.linux-x64-musl": "12.0.0-beta.2",
|
|
37
|
+
"@pnpm/napi.linux-arm64-musl": "12.0.0-beta.2"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"generate-packages": "node scripts/generate-packages.mjs"
|