@pnpm/installing.deps-installer 1101.4.0 → 1101.6.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.
@@ -32,6 +32,7 @@ export interface StrictInstallOptions {
32
32
  lockfileOnly: boolean;
33
33
  forceFullResolution: boolean;
34
34
  fixLockfile: boolean;
35
+ updateChecksums: boolean;
35
36
  dedupe: boolean;
36
37
  ignoreCompatibilityDb: boolean;
37
38
  ignorePackageManifest: boolean;
@@ -44,6 +44,7 @@ const defaults = (opts) => {
44
44
  },
45
45
  lockfileDir: opts.lockfileDir ?? opts.dir ?? process.cwd(),
46
46
  lockfileOnly: false,
47
+ updateChecksums: false,
47
48
  nodeVersion: opts.nodeVersion,
48
49
  nodeLinker: 'isolated',
49
50
  overrides: {},
@@ -15,7 +15,7 @@ import { getContext } from '@pnpm/installing.context';
15
15
  import { getWantedDependencies, resolveDependencies, } from '@pnpm/installing.deps-resolver';
16
16
  import { extendProjectsWithTargetDirs, headlessInstall } from '@pnpm/installing.deps-restorer';
17
17
  import { writeModulesManifest } from '@pnpm/installing.modules-yaml';
18
- import { cleanGitBranchLockfiles, getWantedLockfileName, readWantedLockfile, writeCurrentLockfile, writeLockfiles, writeWantedLockfile, } from '@pnpm/lockfile.fs';
18
+ import { cleanGitBranchLockfiles, getWantedLockfileName, isEmptyLockfile, readWantedLockfile, writeCurrentLockfile, writeLockfiles, writeWantedLockfile, } from '@pnpm/lockfile.fs';
19
19
  import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions';
20
20
  import { calcPatchHashes, createOverridesMapFromParsed, getOutdatedLockfileSetting, } from '@pnpm/lockfile.settings-checker';
21
21
  import { writePnpFile } from '@pnpm/lockfile.to-pnp';
@@ -370,6 +370,7 @@ export async function mutateModules(projects, maybeOpts) {
370
370
  const upToDateLockfileMajorVersion = ctx.wantedLockfile.lockfileVersion.toString().startsWith(`${LOCKFILE_MAJOR_VERSION}.`);
371
371
  let needsFullResolution = outdatedLockfileSettings ||
372
372
  opts.fixLockfile ||
373
+ opts.updateChecksums ||
373
374
  !upToDateLockfileMajorVersion ||
374
375
  opts.forceFullResolution ||
375
376
  forceResolutionFromHook;
@@ -630,7 +631,7 @@ export async function mutateModules(projects, maybeOpts) {
630
631
  !needsFullResolution &&
631
632
  opts.preferFrozenLockfile &&
632
633
  (!opts.pruneLockfileImporters || Object.keys(ctx.wantedLockfile.importers).length === Object.keys(ctx.projects).length) &&
633
- ctx.existsNonEmptyWantedLockfile &&
634
+ !isEmptyLockfile(ctx.wantedLockfile) &&
634
635
  ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION &&
635
636
  await allProjectsAreUpToDate(Object.values(ctx.projects), {
636
637
  catalogs: opts.catalogs,
@@ -654,6 +655,16 @@ Note that in CI environments, this setting is enabled by default.`,
654
655
  });
655
656
  }
656
657
  if (!opts.ignorePackageManifest) {
658
+ // `--frozen-lockfile` (the CI default) means "fail if pnpm-lock.yaml is
659
+ // out of sync." Treat its absence as a sync failure even when the
660
+ // synthesized snapshot from node_modules/.pnpm/lock.yaml would satisfy
661
+ // the manifest — the developer needs to commit the regenerated file.
662
+ if (frozenLockfile && !ctx.existsWantedLockfile &&
663
+ Object.values(ctx.projects).some((project) => pkgHasDependencies(project.manifest))) {
664
+ throw new PnpmError('NO_LOCKFILE', `Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is absent`, {
665
+ hint: 'Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"',
666
+ });
667
+ }
657
668
  const _satisfiesPackageManifest = satisfiesPackageManifest.bind(null, {
658
669
  autoInstallPeers: opts.autoInstallPeers,
659
670
  excludeLinksFromLockfile: opts.excludeLinksFromLockfile,
@@ -684,7 +695,7 @@ Note that in CI environments, this setting is enabled by default.`,
684
695
  ignoredBuilds: undefined,
685
696
  };
686
697
  }
687
- if (!ctx.existsNonEmptyWantedLockfile) {
698
+ if (isEmptyLockfile(ctx.wantedLockfile)) {
688
699
  if (Object.values(ctx.projects).some((project) => pkgHasDependencies(project.manifest))) {
689
700
  throw new Error(`Headless installation requires a ${WANTED_LOCKFILE} file`);
690
701
  }
@@ -760,18 +771,13 @@ Note that in CI environments, this setting is enabled by default.`,
760
771
  };
761
772
  }
762
773
  catch (error) { // eslint-disable-line
774
+ const isIntegrityError = BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code);
763
775
  if (frozenLockfile ||
764
776
  (error.code !== 'ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY' &&
765
- !BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)) ||
766
- (!ctx.existsNonEmptyWantedLockfile && !ctx.existsCurrentLockfile))
777
+ !isIntegrityError) ||
778
+ (!ctx.existsNonEmptyWantedLockfile && !ctx.existsCurrentLockfile) ||
779
+ (isIntegrityError && !opts.updateChecksums))
767
780
  throw error;
768
- if (BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)) {
769
- needsFullResolution = true;
770
- // Ideally, we would not update but currently there is no other way to redownload the integrity of the package
771
- for (const project of projects) {
772
- project.update = true;
773
- }
774
- }
775
781
  // A broken lockfile may be caused by a badly resolved Git conflict
776
782
  logger.warn({
777
783
  error,
@@ -1014,6 +1020,7 @@ const _installInContext = async (projects, ctx, opts) => {
1014
1020
  excludeLinksFromLockfile: opts.excludeLinksFromLockfile,
1015
1021
  force: opts.force,
1016
1022
  forceFullResolution,
1023
+ updateChecksums: opts.updateChecksums,
1017
1024
  ignoreScripts: opts.ignoreScripts,
1018
1025
  hooks: {
1019
1026
  readPackage: opts.readPackageHook,
@@ -1529,19 +1536,16 @@ const installInContext = async (projects, ctx, opts) => {
1529
1536
  }
1530
1537
  catch (error) { // eslint-disable-line
1531
1538
  if (!BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code) ||
1532
- (!ctx.existsNonEmptyWantedLockfile && !ctx.existsCurrentLockfile))
1539
+ (!ctx.existsNonEmptyWantedLockfile && !ctx.existsCurrentLockfile) ||
1540
+ !opts.updateChecksums)
1533
1541
  throw error;
1534
1542
  opts.needsFullResolution = true;
1535
- // Ideally, we would not update but currently there is no other way to redownload the integrity of the package
1536
- for (const project of projects) {
1537
- project.update = true;
1538
- }
1539
1543
  logger.warn({
1540
1544
  error,
1541
1545
  message: error.message,
1542
1546
  prefix: ctx.lockfileDir,
1543
1547
  });
1544
- logger.error(new PnpmError(error.code, 'The lockfile is broken! A full installation will be performed in an attempt to fix it.'));
1548
+ logger.error(new PnpmError(error.code, 'Refreshing the locked integrity from the registry as requested by --update-checksums. A full installation will be performed.'));
1545
1549
  return _installInContext(projects, ctx, opts);
1546
1550
  }
1547
1551
  finally {
@@ -1,10 +1,10 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { confirm } from '@inquirer/prompts';
3
4
  import { PnpmError } from '@pnpm/error';
4
5
  import { logger } from '@pnpm/logger';
5
6
  import { DEPENDENCIES_FIELDS, } from '@pnpm/types';
6
7
  import { rimraf } from '@zkochan/rimraf';
7
- import enquirer from 'enquirer';
8
8
  import { pathAbsolute } from 'path-absolute';
9
9
  import { equals } from 'ramda';
10
10
  import { checkCompatibility } from './checkCompatibility/index.js';
@@ -87,15 +87,22 @@ async function purgeModulesDirsOfImporters(opts, importers) {
87
87
  hint: 'If you are running pnpm in CI, set the CI environment variable to "true", or set "confirmModulesPurge" to "false".',
88
88
  });
89
89
  }
90
- const confirmed = await enquirer.prompt({
91
- type: 'confirm',
92
- name: 'question',
93
- message: importers.length === 1
94
- ? `The modules directory at "${importers[0].modulesDir}" will be removed and reinstalled from scratch. Proceed?`
95
- : 'The modules directories will be removed and reinstalled from scratch. Proceed?',
96
- initial: true,
97
- });
98
- if (!confirmed.question) {
90
+ let confirmed;
91
+ try {
92
+ confirmed = await confirm({
93
+ message: importers.length === 1
94
+ ? `The modules directory at "${importers[0].modulesDir}" will be removed and reinstalled from scratch. Proceed?`
95
+ : 'The modules directories will be removed and reinstalled from scratch. Proceed?',
96
+ default: true,
97
+ });
98
+ }
99
+ catch (err) {
100
+ if (err instanceof Error && err.name === 'ExitPromptError') {
101
+ throw new PnpmError('ABORTED_REMOVE_MODULES_DIR', 'Aborted removal of modules directory');
102
+ }
103
+ throw err;
104
+ }
105
+ if (!confirmed) {
99
106
  throw new PnpmError('ABORTED_REMOVE_MODULES_DIR', 'Aborted removal of modules directory');
100
107
  }
101
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.deps-installer",
3
- "version": "1101.4.0",
3
+ "version": "1101.6.0",
4
4
  "description": "Fast, disk space efficient installation engine",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -47,86 +47,85 @@
47
47
  "test": "test"
48
48
  },
49
49
  "dependencies": {
50
+ "@inquirer/prompts": "^8.4.3",
50
51
  "@pnpm/npm-package-arg": "^2.0.0",
51
52
  "@pnpm/util.lex-comparator": "^3.0.2",
52
53
  "@zkochan/rimraf": "^4.0.0",
53
- "enquirer": "^2.4.1",
54
54
  "is-inner-link": "^5.0.0",
55
55
  "is-subdir": "^2.0.0",
56
56
  "load-json-file": "^7.0.1",
57
57
  "normalize-path": "^3.0.0",
58
58
  "p-filter": "^4.1.0",
59
- "p-limit": "^7.1.0",
59
+ "p-limit": "^7.3.0",
60
60
  "path-absolute": "^2.0.0",
61
61
  "path-exists": "^5.0.0",
62
62
  "ramda": "npm:@pnpm/ramda@0.28.1",
63
63
  "run-groups": "^5.0.0",
64
- "semver": "^7.7.2",
65
- "@pnpm/agent.client": "1.0.7",
66
- "@pnpm/bins.linker": "1100.0.9",
67
- "@pnpm/bins.remover": "1100.0.5",
68
- "@pnpm/building.after-install": "1101.0.16",
69
- "@pnpm/building.during-install": "1101.0.13",
70
- "@pnpm/building.policy": "1100.0.6",
64
+ "semver": "^7.8.1",
65
+ "@pnpm/bins.linker": "1100.0.10",
66
+ "@pnpm/bins.remover": "1100.0.6",
67
+ "@pnpm/building.after-install": "1101.0.18",
68
+ "@pnpm/agent.client": "1.0.8",
71
69
  "@pnpm/catalogs.resolver": "1100.0.0",
70
+ "@pnpm/building.policy": "1100.0.7",
72
71
  "@pnpm/catalogs.protocol-parser": "1100.0.0",
73
72
  "@pnpm/catalogs.types": "1100.0.0",
74
- "@pnpm/config.matcher": "1100.0.1",
73
+ "@pnpm/building.during-install": "1101.0.15",
74
+ "@pnpm/config.normalize-registries": "1100.0.5",
75
75
  "@pnpm/config.parse-overrides": "1100.0.1",
76
- "@pnpm/core-loggers": "1100.1.1",
77
- "@pnpm/constants": "1100.0.0",
76
+ "@pnpm/crypto.object-hasher": "1100.0.0",
77
+ "@pnpm/core-loggers": "1100.1.2",
78
+ "@pnpm/deps.graph-hasher": "1100.2.2",
78
79
  "@pnpm/crypto.hash": "1100.0.1",
79
- "@pnpm/config.normalize-registries": "1100.0.4",
80
- "@pnpm/deps.graph-hasher": "1100.2.1",
80
+ "@pnpm/deps.path": "1100.0.5",
81
+ "@pnpm/constants": "1100.0.0",
82
+ "@pnpm/config.matcher": "1100.0.1",
83
+ "@pnpm/exec.lifecycle": "1100.0.14",
81
84
  "@pnpm/deps.graph-sequencer": "1100.0.0",
82
- "@pnpm/deps.path": "1100.0.4",
85
+ "@pnpm/fs.symlink-dependency": "1100.0.6",
86
+ "@pnpm/installing.context": "1100.0.14",
87
+ "@pnpm/hooks.read-package-hook": "1100.0.5",
88
+ "@pnpm/installing.deps-resolver": "1100.1.5",
83
89
  "@pnpm/error": "1100.0.0",
84
- "@pnpm/exec.lifecycle": "1100.0.13",
90
+ "@pnpm/installing.deps-restorer": "1101.1.7",
91
+ "@pnpm/hooks.types": "1100.0.9",
92
+ "@pnpm/installing.linking.hoist": "1100.0.10",
93
+ "@pnpm/installing.linking.direct-dep-linker": "1100.0.6",
94
+ "@pnpm/installing.linking.modules-cleaner": "1100.1.4",
95
+ "@pnpm/installing.modules-yaml": "1100.0.6",
96
+ "@pnpm/lockfile.filtering": "1100.1.3",
85
97
  "@pnpm/fs.read-modules-dir": "1100.0.1",
86
- "@pnpm/fs.symlink-dependency": "1100.0.5",
87
- "@pnpm/hooks.read-package-hook": "1100.0.4",
88
- "@pnpm/hooks.types": "1100.0.8",
89
- "@pnpm/installing.deps-resolver": "1100.1.3",
90
- "@pnpm/installing.context": "1100.0.12",
91
- "@pnpm/installing.linking.direct-dep-linker": "1100.0.5",
92
- "@pnpm/installing.deps-restorer": "1101.1.5",
93
- "@pnpm/installing.linking.modules-cleaner": "1100.1.3",
94
- "@pnpm/installing.linking.hoist": "1100.0.9",
95
- "@pnpm/crypto.object-hasher": "1100.0.0",
96
- "@pnpm/installing.modules-yaml": "1100.0.5",
97
- "@pnpm/installing.package-requester": "1101.0.8",
98
- "@pnpm/lockfile.fs": "1100.1.1",
99
- "@pnpm/lockfile.filtering": "1100.1.2",
100
- "@pnpm/lockfile.preferred-versions": "1100.0.11",
101
- "@pnpm/lockfile.pruner": "1100.0.7",
102
- "@pnpm/lockfile.to-pnp": "1100.0.10",
103
- "@pnpm/lockfile.utils": "1100.0.9",
104
- "@pnpm/lockfile.verification": "1100.0.12",
105
- "@pnpm/lockfile.walker": "1100.0.7",
106
- "@pnpm/patching.config": "1100.0.4",
107
- "@pnpm/pkg-manifest.utils": "1100.2.0",
98
+ "@pnpm/lockfile.fs": "1100.1.2",
99
+ "@pnpm/lockfile.preferred-versions": "1100.0.12",
100
+ "@pnpm/lockfile.settings-checker": "1100.0.14",
101
+ "@pnpm/lockfile.to-pnp": "1100.0.11",
102
+ "@pnpm/lockfile.pruner": "1100.0.8",
103
+ "@pnpm/lockfile.utils": "1100.0.10",
104
+ "@pnpm/lockfile.walker": "1100.0.8",
105
+ "@pnpm/patching.config": "1100.0.5",
106
+ "@pnpm/pkg-manifest.utils": "1100.2.1",
108
107
  "@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
109
- "@pnpm/lockfile.settings-checker": "1100.0.12",
110
- "@pnpm/resolving.resolver-base": "1100.3.0",
111
- "@pnpm/store.controller-types": "1100.1.1",
108
+ "@pnpm/store.controller-types": "1100.1.2",
109
+ "@pnpm/types": "1101.2.0",
110
+ "@pnpm/workspace.project-manifest-reader": "1100.0.9",
112
111
  "@pnpm/store.index": "1100.1.0",
113
- "@pnpm/types": "1101.1.1",
114
- "@pnpm/workspace.project-manifest-reader": "1100.0.8"
112
+ "@pnpm/installing.package-requester": "1101.0.10",
113
+ "@pnpm/resolving.resolver-base": "1100.3.1",
114
+ "@pnpm/lockfile.verification": "1100.0.14"
115
115
  },
116
116
  "peerDependencies": {
117
- "@pnpm/logger": ">=1001.0.0 <1002.0.0",
118
- "@pnpm/worker": "^1100.1.7"
117
+ "@pnpm/logger": "^1001.0.1",
118
+ "@pnpm/worker": "^1100.1.8"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@jest/globals": "30.3.0",
122
- "@pnpm/registry-mock": "6.0.0",
123
122
  "@types/fs-extra": "^11.0.4",
124
123
  "@types/is-windows": "^1.0.2",
125
124
  "@types/normalize-path": "^3.0.2",
126
125
  "@types/ramda": "0.31.1",
127
126
  "@types/semver": "7.7.1",
128
127
  "@yarnpkg/core": "4.5.0",
129
- "ci-info": "^4.3.0",
128
+ "ci-info": "^4.4.0",
130
129
  "deep-require-cwd": "1.0.0",
131
130
  "execa": "npm:safe-execa@0.3.0",
132
131
  "exists-link": "2.0.0",
@@ -138,21 +137,22 @@
138
137
  "symlink-dir": "^10.0.1",
139
138
  "write-json-file": "^7.0.0",
140
139
  "write-yaml-file": "^6.0.0",
141
- "@pnpm/assert-project": "1100.0.10",
142
- "@pnpm/assert-store": "1100.0.10",
143
- "@pnpm/installing.deps-installer": "1101.4.0",
144
- "@pnpm/lockfile.types": "1100.0.7",
145
- "@pnpm/logger": "1100.0.0",
140
+ "@pnpm/assert-project": "1100.0.12",
141
+ "@pnpm/lockfile.types": "1100.0.8",
142
+ "@pnpm/installing.deps-installer": "1101.6.0",
143
+ "@pnpm/assert-store": "1100.0.12",
144
+ "@pnpm/prepare": "1100.0.12",
146
145
  "@pnpm/network.git-utils": "1100.0.1",
147
- "@pnpm/pkg-manifest.reader": "1100.0.4",
148
- "@pnpm/prepare": "1100.0.10",
149
- "@pnpm/resolving.registry.types": "1100.0.4",
150
- "@pnpm/store.cafs": "1100.1.6",
151
- "@pnpm/test-fixtures": "1100.0.0",
152
- "@pnpm/store.path": "1100.0.1",
146
+ "@pnpm/pkg-manifest.reader": "1100.0.5",
147
+ "@pnpm/logger": "1100.0.0",
148
+ "@pnpm/store.cafs": "1100.1.7",
153
149
  "@pnpm/test-ipc-server": "1100.0.0",
154
- "@pnpm/testing.mock-agent": "1100.0.6",
155
- "@pnpm/testing.temp-store": "1100.1.3"
150
+ "@pnpm/resolving.registry.types": "1100.1.0",
151
+ "@pnpm/testing.mock-agent": "1100.0.8",
152
+ "@pnpm/testing.temp-store": "1100.1.5",
153
+ "@pnpm/store.path": "1100.0.1",
154
+ "@pnpm/test-fixtures": "1100.0.0",
155
+ "@pnpm/testing.registry-mock": "1100.0.2"
156
156
  },
157
157
  "engines": {
158
158
  "node": ">=22.13"