@pnpm/napi 12.8.2 → 12.9.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 +12 -0
- package/README.md +7 -7
- package/index.d.ts +19 -14
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pnpm/napi
|
|
2
2
|
|
|
3
|
+
## 12.9.1
|
|
4
|
+
|
|
5
|
+
## 12.9.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- `install()` accepts a `readPackageHookChecksum` option. The checksum is recorded as the lockfile's `pnpmfileChecksum`. While it stays the same, installs with a `readPackageHook` reuse the resolved dependencies in the lockfile. Without it, an install with a hook that has to update the lockfile resolves all dependencies again.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- The install summary shows a `link:` dependency as `+ name <- path` again, and the Node.js API's `hideLinkedPkgsDiff` reporter option leaves matching linked dependencies out of the summary.
|
|
14
|
+
|
|
3
15
|
## 12.8.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pnpm/napi
|
|
2
2
|
|
|
3
|
-
Node.js bindings for pnpm
|
|
3
|
+
Node.js bindings for the pnpm engine, exposing pnpm's
|
|
4
4
|
programmatic API — install, rebuild, dependency resolution, and pack — to a
|
|
5
5
|
JavaScript host. The reference consumer is [Bit](https://bit.dev), which drives
|
|
6
6
|
pnpm entirely through its programmatic API.
|
|
@@ -26,7 +26,7 @@ See [`index.d.ts`](./index.d.ts) for the full typed contract.
|
|
|
26
26
|
|
|
27
27
|
| Export | Purpose |
|
|
28
28
|
| --- | --- |
|
|
29
|
-
| `install(options, onLog?, readPackageHook?, onOutput?)` | Install in-memory importers (single or workspace); `readPackageHook` transforms each resolved dependency manifest (must be synchronous). Returns `{ stats, depsRequiringBuild?, storeDir }`. |
|
|
29
|
+
| `install(options, onLog?, readPackageHook?, onOutput?)` | Install in-memory importers (single or workspace); `readPackageHook` transforms each resolved dependency manifest (must be synchronous). Pass `options.readPackageHookChecksum` so installs reuse the lockfile while the hook is unchanged. Returns `{ stats, depsRequiringBuild?, storeDir }`. |
|
|
30
30
|
| `rebuild(options, onLog?, selectedNames?, onOutput?)` | Re-run dependency build scripts against a materialized install (frozen path). |
|
|
31
31
|
| `resolveDependency(wanted, options)` | Resolve an npm-registry specifier to `{ id, manifest, resolvedVia, … }`. |
|
|
32
32
|
| `pack(options, onLog?)` | Build a publishable `.tgz` from a project directory. |
|
|
@@ -36,7 +36,7 @@ See [`index.d.ts`](./index.d.ts) for the full typed contract.
|
|
|
36
36
|
| `readLockfile(options)` / `writeLockfile(options)` | Read and write `pnpm-lock.yaml` (or the current lockfile under the virtual store) with the engine's own parser and emitter. |
|
|
37
37
|
| `filterLockfileByImporters(lockfile, importerIds, options?)` | Narrow a lockfile to the transitive closure of what the named importers reach. |
|
|
38
38
|
| `readModulesManifest(modulesDir)` | The `.modules.yaml` state of an installed `node_modules`. |
|
|
39
|
-
| `engineVersion()` | Version string of the
|
|
39
|
+
| `engineVersion()` | Version string of the pnpm engine. |
|
|
40
40
|
| `getPeerDependencyIssues(options)` | Resolve the in-memory importers without writing an install and return missing or incompatible peer dependencies by importer. `autoInstallPeers` defaults to `false` for this query. |
|
|
41
41
|
|
|
42
42
|
### Output
|
|
@@ -50,7 +50,7 @@ however it likes.
|
|
|
50
50
|
By default the rendered chunks go to stdout. Pass `onOutput` to receive them
|
|
51
51
|
instead, for a host that has redirected its own output at the JavaScript
|
|
52
52
|
level (a monkey-patched `process.stdout.write`, a stream forwarding to a
|
|
53
|
-
remote terminal) where a write from
|
|
53
|
+
remote terminal) where a write from the engine would bypass the redirection. Pass
|
|
54
54
|
`reporter.width` alongside it: the engine cannot see where those chunks end
|
|
55
55
|
up.
|
|
56
56
|
|
|
@@ -75,9 +75,9 @@ the named importers keep only the dependency groups asked for, and
|
|
|
75
75
|
`renderDependents` returns them rendered as a string — it prints nothing
|
|
76
76
|
itself — mirroring the split between
|
|
77
77
|
`@pnpm/deps.inspection.tree-builder` and `@pnpm/deps.inspection.list`. The
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
walk cannot call back into JavaScript, so that API's `nameFormatter`
|
|
79
|
+
callback has no counterpart here: a host that renames nodes after a
|
|
80
|
+
manifest field asks for the field via
|
|
81
81
|
`manifestFields`, writes `displayName` onto the returned trees, and passes
|
|
82
82
|
them back to be rendered.
|
|
83
83
|
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node
|
|
2
|
+
* Node.js bindings for the pnpm engine.
|
|
3
3
|
*
|
|
4
|
-
* Shapes
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shapes mirror the programmatic API of `@pnpm/installing.deps-installer`
|
|
5
|
+
* and `@pnpm/installing.client`, so call sites written for those packages
|
|
6
|
+
* carry over.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export interface PackageManifest {
|
|
@@ -250,6 +250,14 @@ export interface InstallOptions extends SharedEngineOptions {
|
|
|
250
250
|
* at all).
|
|
251
251
|
*/
|
|
252
252
|
reporter?: ReporterOptions
|
|
253
|
+
/**
|
|
254
|
+
* Recorded as the lockfile's `pnpmfileChecksum` for the `readPackageHook`
|
|
255
|
+
* passed to the same call. Change it whenever the hook's behavior changes.
|
|
256
|
+
* The lockfile is reused while it stays the same. Without it the engine
|
|
257
|
+
* cannot tell whether the hook changed, so every install with a hook
|
|
258
|
+
* resolves again.
|
|
259
|
+
*/
|
|
260
|
+
readPackageHookChecksum?: string
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
/** pnpm's `peerDependencyRules`. */
|
|
@@ -304,9 +312,7 @@ export interface ReporterOptions {
|
|
|
304
312
|
* packages-diff summary — an entry is linked when it was symlinked in
|
|
305
313
|
* rather than materialized from the store. A host that links its own
|
|
306
314
|
* runtime into every project silences that noise without silencing the
|
|
307
|
-
* same packages when they are really installed.
|
|
308
|
-
* the TypeScript reporter's `filterPkgsDiff` callback, which cannot
|
|
309
|
-
* cross the addon boundary.
|
|
315
|
+
* same packages when they are really installed.
|
|
310
316
|
*/
|
|
311
317
|
hideLinkedPkgsDiff?: string[]
|
|
312
318
|
/** Verbosity ceiling. Defaults to `'info'`. */
|
|
@@ -332,7 +338,7 @@ export interface ReporterOptions {
|
|
|
332
338
|
* Receives each rendered output chunk instead of the engine writing it to
|
|
333
339
|
* a file descriptor. For a host that has redirected its own output at the
|
|
334
340
|
* JavaScript level — a monkey-patched `process.stdout.write`, a stream
|
|
335
|
-
* that forwards to a remote terminal — where a write from
|
|
341
|
+
* that forwards to a remote terminal — where a write from the engine would
|
|
336
342
|
* bypass the redirection. Chunks arrive in order and already carry their
|
|
337
343
|
* newlines and cursor-control sequences; write them verbatim.
|
|
338
344
|
*/
|
|
@@ -361,6 +367,7 @@ export interface InstallResult {
|
|
|
361
367
|
* @param readPackageHook a **synchronous** `(manifest, resolvedDir?) => manifest`
|
|
362
368
|
* transform applied to every resolved dependency manifest during resolution
|
|
363
369
|
* (the `readPackage` hook). Must return the manifest object, not a promise.
|
|
370
|
+
* Pass `options.readPackageHookChecksum` to let installs reuse the lockfile.
|
|
364
371
|
* @param onOutput receives the rendered output of `options.reporter`
|
|
365
372
|
* instead of the engine writing it to stdout/stderr.
|
|
366
373
|
*/
|
|
@@ -605,11 +612,9 @@ export interface DependentsOptions {
|
|
|
605
612
|
virtualStoreDirMaxLength?: number
|
|
606
613
|
/**
|
|
607
614
|
* `package.json` fields to project onto every package node as
|
|
608
|
-
* `manifest`.
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
* asks for that field here, writes `displayName` on the returned trees,
|
|
612
|
-
* and passes them to {@link renderDependents}. Nodes whose manifest is
|
|
615
|
+
* `manifest`. A host that renames nodes after a manifest field asks for
|
|
616
|
+
* that field here, writes `displayName` on the returned trees, and
|
|
617
|
+
* passes them to {@link renderDependents}. Nodes whose manifest is
|
|
613
618
|
* unreadable — and every workspace-project node — carry none.
|
|
614
619
|
*/
|
|
615
620
|
manifestFields?: string[]
|
|
@@ -787,5 +792,5 @@ export function filterLockfileByImporters<Lockfile = LockfileFile>(
|
|
|
787
792
|
*/
|
|
788
793
|
export function readModulesManifest(modulesDir: string): Promise<Record<string, unknown> | null>
|
|
789
794
|
|
|
790
|
-
/** Version of the
|
|
795
|
+
/** Version of the pnpm engine. */
|
|
791
796
|
export function engineVersion(): string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/napi",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.9.1",
|
|
4
4
|
"description": "Node.js addon bindings for the pnpm v12 Rust engine (pacquet)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"THIRD-PARTY-NOTICES.md"
|
|
29
29
|
],
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@pnpm/napi.win32-x64": "12.
|
|
32
|
-
"@pnpm/napi.win32-arm64": "12.
|
|
33
|
-
"@pnpm/napi.darwin-x64": "12.
|
|
34
|
-
"@pnpm/napi.darwin-arm64": "12.
|
|
35
|
-
"@pnpm/napi.linux-x64": "12.
|
|
36
|
-
"@pnpm/napi.linux-arm64": "12.
|
|
37
|
-
"@pnpm/napi.linux-riscv64": "12.
|
|
38
|
-
"@pnpm/napi.linux-ppc64": "12.
|
|
39
|
-
"@pnpm/napi.linux-s390x": "12.
|
|
40
|
-
"@pnpm/napi.linux-x64-musl": "12.
|
|
41
|
-
"@pnpm/napi.linux-arm64-musl": "12.
|
|
42
|
-
"@pnpm/napi.freebsd-x64": "12.
|
|
43
|
-
"@pnpm/napi.android-arm64": "12.
|
|
44
|
-
"@pnpm/napi.android-x64": "12.
|
|
31
|
+
"@pnpm/napi.win32-x64": "12.9.1",
|
|
32
|
+
"@pnpm/napi.win32-arm64": "12.9.1",
|
|
33
|
+
"@pnpm/napi.darwin-x64": "12.9.1",
|
|
34
|
+
"@pnpm/napi.darwin-arm64": "12.9.1",
|
|
35
|
+
"@pnpm/napi.linux-x64": "12.9.1",
|
|
36
|
+
"@pnpm/napi.linux-arm64": "12.9.1",
|
|
37
|
+
"@pnpm/napi.linux-riscv64": "12.9.1",
|
|
38
|
+
"@pnpm/napi.linux-ppc64": "12.9.1",
|
|
39
|
+
"@pnpm/napi.linux-s390x": "12.9.1",
|
|
40
|
+
"@pnpm/napi.linux-x64-musl": "12.9.1",
|
|
41
|
+
"@pnpm/napi.linux-arm64-musl": "12.9.1",
|
|
42
|
+
"@pnpm/napi.freebsd-x64": "12.9.1",
|
|
43
|
+
"@pnpm/napi.android-arm64": "12.9.1",
|
|
44
|
+
"@pnpm/napi.android-x64": "12.9.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"generate-packages": "node scripts/generate-packages.mjs"
|