@pnpm/installing.deps-installer 1101.9.0 → 1102.1.0

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.
@@ -18,6 +18,7 @@ export interface StrictInstallOptions {
18
18
  cleanupUnusedCatalogs: boolean;
19
19
  frozenLockfile: boolean;
20
20
  frozenLockfileIfExists: boolean;
21
+ frozenStore: boolean;
21
22
  enableGlobalVirtualStore: boolean;
22
23
  enablePnp: boolean;
23
24
  extraBinPaths: string[];
@@ -45,6 +46,13 @@ export interface StrictInstallOptions {
45
46
  preferFrozenLockfile: boolean;
46
47
  saveWorkspaceProtocol: boolean | 'rolling';
47
48
  lockfileCheck?: (prev: LockfileObject, next: LockfileObject) => void;
49
+ /**
50
+ * When true, resolve fully but write nothing to disk (no lockfile, no
51
+ * `node_modules`). The before/after wanted lockfiles are returned in the
52
+ * install result's `dryRunResult` so the caller can report what an install
53
+ * would change. Powers `pnpm install --dry-run`.
54
+ */
55
+ dryRun?: boolean;
48
56
  lockfileIncludeTarballUrl?: boolean;
49
57
  preferWorkspacePackages: boolean;
50
58
  preserveWorkspaceProtocol: boolean;
@@ -64,6 +72,8 @@ export interface StrictInstallOptions {
64
72
  engineStrict: boolean;
65
73
  allowBuilds?: Record<string, boolean | string>;
66
74
  nodeLinker: 'isolated' | 'hoisted' | 'pnp';
75
+ nodeExperimentalPackageMap: boolean;
76
+ nodePackageMapType: 'standard' | 'loose';
67
77
  nodeVersion?: string;
68
78
  packageExtensions: Record<string, PackageExtension>;
69
79
  ignoredOptionalDependencies: string[];
@@ -205,23 +215,33 @@ export interface StrictInstallOptions {
205
215
  packageVulnerabilityAudit?: PackageVulnerabilityAudit;
206
216
  blockExoticSubdeps?: boolean;
207
217
  /**
208
- * Optional alternative install engine. When set, the frozen-install
209
- * path invokes this callback instead of `headlessInstall`. The CLI
210
- * layer constructs it (today: spawning the pacquet binary installed
211
- * via `configDependencies` and forwarding pnpm's own CLI argv); the
212
- * installer treats it as an opaque "do the install" hook so it
213
- * doesn't need to know about pacquet's binary path, CLI surface, or
214
- * any settings that only pacquet consumes.
218
+ * Optional alternative install engine. When set, the installer
219
+ * delegates the install to `run` instead of calling `headlessInstall`.
220
+ * The CLI layer constructs it (today: the pacquet binary installed via
221
+ * `configDependencies`, forwarding pnpm's own CLI argv); the installer
222
+ * treats it as an opaque "do the install" hook so it doesn't need to
223
+ * know about pacquet's binary path, CLI surface, or any settings that
224
+ * only pacquet consumes.
215
225
  *
216
- * `filterResolvedProgress` tells the helper to drop the engine's
217
- * own `pnpm:progress status:resolved` events because pnpm already
218
- * emitted one per package during a preceding lockfileOnly resolve
219
- * pass. The frozen-install path passes `false` (or nothing): no
220
- * resolve pass ran, so the engine's events are the only source.
226
+ * `supportsResolution` is `true` when the engine can resolve
227
+ * dependencies itself (pacquet >= 0.11.7). When `false` the installer
228
+ * runs its own resolve pass first and the engine only materializes the
229
+ * written lockfile.
230
+ *
231
+ * `run`'s `filterResolvedProgress` tells the helper to drop the
232
+ * engine's own `pnpm:progress status:resolved` events because pnpm
233
+ * already emitted one per package during a preceding lockfileOnly
234
+ * resolve pass. `resolve` tells the engine to do the resolution
235
+ * itself (non-frozen install). The frozen/materialize paths leave
236
+ * both unset.
221
237
  */
222
- runPacquet?: (opts?: {
223
- filterResolvedProgress?: boolean;
224
- }) => Promise<void>;
238
+ runPacquet?: {
239
+ supportsResolution: boolean;
240
+ run: (opts?: {
241
+ filterResolvedProgress?: boolean;
242
+ resolve?: boolean;
243
+ }) => Promise<void>;
244
+ };
225
245
  /**
226
246
  * If true, `mutateModules` does not emit the per-install `summary` log
227
247
  * event. Used by `pnpm add -g` when it runs multiple isolated installs
@@ -27,6 +27,7 @@ const defaults = (opts) => {
27
27
  force: false,
28
28
  forceFullResolution: false,
29
29
  frozenLockfile: false,
30
+ frozenStore: false,
30
31
  hoistPattern: undefined,
31
32
  publicHoistPattern: undefined,
32
33
  hooks: {},
@@ -47,6 +48,8 @@ const defaults = (opts) => {
47
48
  updateChecksums: false,
48
49
  nodeVersion: opts.nodeVersion,
49
50
  nodeLinker: 'isolated',
51
+ nodeExperimentalPackageMap: false,
52
+ nodePackageMapType: 'standard',
50
53
  overrides: {},
51
54
  ownLifecycleHooksStdio: 'inherit',
52
55
  ignoreCompatibilityDb: false,
@@ -144,6 +147,17 @@ export function extendOptions(opts) {
144
147
  throw new PnpmError('CONFIG_CONFLICT_LOCKFILE_ONLY_WITH_NO_LOCKFILE', `Cannot generate a ${WANTED_LOCKFILE} because lockfile is set to false`);
145
148
  }
146
149
  }
150
+ if (extendedOpts.frozenStore && extendedOpts.force) {
151
+ throw new PnpmError('CONFIG_CONFLICT_FROZEN_STORE_WITH_FORCE', 'Cannot use force together with frozenStore: --force re-imports packages into the store, which is opened read-only when frozenStore is enabled');
152
+ }
153
+ if (extendedOpts.frozenStore) {
154
+ // The side-effects cache is written into the store, which frozenStore opens
155
+ // read-only. Caching is an optimization, not a correctness requirement, so
156
+ // force it off rather than failing (the writable seed-build already
157
+ // populated it). Without this, a build under frozenStore (e.g. with the
158
+ // global virtual store disabled) would attempt a store write.
159
+ extendedOpts.sideEffectsCacheWrite = false;
160
+ }
147
161
  if (extendedOpts.userAgent.startsWith('npm/')) {
148
162
  extendedOpts.userAgent = `${extendedOpts.packageManager.name}/${extendedOpts.packageManager.version} ${extendedOpts.userAgent}`;
149
163
  }
@@ -2,6 +2,7 @@ import type { Catalogs } from '@pnpm/catalogs.types';
2
2
  import { PnpmError } from '@pnpm/error';
3
3
  import { type PinnedVersion, type UpdateMatchingFunction, type WantedDependency } from '@pnpm/installing.deps-resolver';
4
4
  import { type InstallationResultStats } from '@pnpm/installing.deps-restorer';
5
+ import { type LockfileObject } from '@pnpm/lockfile.fs';
5
6
  import type { PreferredVersions, ResolutionPolicyViolation } from '@pnpm/resolving.resolver-base';
6
7
  import type { DependenciesField, DepPath, IgnoredBuilds, PeerDependencyIssues, ProjectId, ProjectManifest, ProjectRootDir, ReadPackageHook } from '@pnpm/types';
7
8
  import { type InstallOptions } from './extendInstallOptions.js';
@@ -47,6 +48,8 @@ export interface InstallResult {
47
48
  ignoredBuilds: IgnoredBuilds | undefined;
48
49
  /** Forwarded from {@link MutateModulesResult.resolutionPolicyViolations}. */
49
50
  resolutionPolicyViolations: ResolutionPolicyViolation[];
51
+ /** Forwarded from {@link MutateModulesResult.dryRunResult}. */
52
+ dryRunResult?: DryRunInstallResult;
50
53
  }
51
54
  export declare function install(manifest: ProjectManifest, opts: Opts): Promise<InstallResult>;
52
55
  export type MutatedProject = DependenciesMutation & {
@@ -64,6 +67,8 @@ export interface MutateModulesInSingleProjectResult {
64
67
  ignoredBuilds: IgnoredBuilds | undefined;
65
68
  /** Forwarded from {@link MutateModulesResult.resolutionPolicyViolations}. */
66
69
  resolutionPolicyViolations: ResolutionPolicyViolation[];
70
+ /** Forwarded from {@link MutateModulesResult.dryRunResult}. */
71
+ dryRunResult?: DryRunInstallResult;
67
72
  }
68
73
  export declare function mutateModulesInSingleProject(project: MutatedProject & {
69
74
  binsDir?: string;
@@ -86,6 +91,11 @@ export interface MutateModulesResult {
86
91
  * verifier reported a violation or no policy was active.
87
92
  */
88
93
  resolutionPolicyViolations: ResolutionPolicyViolation[];
94
+ /**
95
+ * Present only for a `dryRun` install: the before/after wanted lockfiles
96
+ * the resolve produced without writing, for the caller to diff.
97
+ */
98
+ dryRunResult?: DryRunInstallResult;
89
99
  }
90
100
  export declare function mutateModules(projects: MutatedProject[], maybeOpts: MutateModulesOptions): Promise<MutateModulesResult>;
91
101
  export declare function addDependenciesToPackage(manifest: ProjectManifest, dependencySelectors: string[], opts: Omit<InstallOptions, 'allProjects'> & {
@@ -117,6 +127,14 @@ export interface UpdatedProject {
117
127
  peerDependencyIssues?: PeerDependencyIssues;
118
128
  rootDir: ProjectRootDir;
119
129
  }
130
+ /**
131
+ * The before/after wanted lockfiles a `dryRun` install resolved without
132
+ * writing. The caller diffs them to report what a real install would change.
133
+ */
134
+ export interface DryRunInstallResult {
135
+ originalLockfile: LockfileObject;
136
+ wantedLockfile: LockfileObject;
137
+ }
120
138
  export declare class IgnoredBuildsError extends PnpmError {
121
139
  constructor(ignoredBuilds: IgnoredBuilds);
122
140
  }