@pnpm/lockfile.fs 1100.2.3 → 1100.2.4

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,11 @@
1
1
  # @pnpm/lockfile-file
2
2
 
3
+ ## 1100.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed `pnpm install --merge-git-branch-lockfiles --frozen-lockfile` failing with `ERR_PNPM_OUTDATED_LOCKFILE` when a branch lockfile predates the removal of a dependency, or its move to another dependency group [#13966](https://github.com/pnpm/pnpm/issues/13966). A dependency that no project declares anymore is no longer reinstated by the merge, and the packages it was the only path to are dropped with it.
8
+
3
9
  ## 1100.2.3
4
10
 
5
11
  ### Patch Changes
package/lib/read.d.ts CHANGED
@@ -13,6 +13,25 @@ export declare function readWantedLockfileAndAutofixConflicts(pkgPath: string, o
13
13
  lockfile: LockfileObject | null;
14
14
  hadConflicts: boolean;
15
15
  }>;
16
+ /**
17
+ * {@link readWantedLockfile} plus what the caller cannot reconstruct from
18
+ * the returned lockfile: whether autofixing a merge conflict rewrote it,
19
+ * and, under `mergeGitBranchLockfiles`, the importers as they stood
20
+ * before the branch lockfiles were folded in. Telling a merged entry from
21
+ * one the read file already carried needs that "before", which the merged
22
+ * object no longer holds.
23
+ */
24
+ export declare function readWantedLockfileWithMergeInfo(pkgPath: string, opts: {
25
+ wantedVersions?: string[];
26
+ ignoreIncompatible: boolean;
27
+ useGitBranchLockfile?: boolean;
28
+ mergeGitBranchLockfiles?: boolean;
29
+ autofixMergeConflicts?: boolean;
30
+ }): Promise<{
31
+ lockfile: LockfileObject | null;
32
+ hadConflicts: boolean;
33
+ preMergeImporters: LockfileObject['importers'] | undefined;
34
+ }>;
16
35
  export declare function readWantedLockfile(pkgPath: string, opts: {
17
36
  wantedVersions?: string[];
18
37
  ignoreIncompatible: boolean;
package/lib/read.js CHANGED
@@ -25,6 +25,17 @@ export async function readWantedLockfileAndAutofixConflicts(pkgPath, opts) {
25
25
  autofixMergeConflicts: true,
26
26
  });
27
27
  }
28
+ /**
29
+ * {@link readWantedLockfile} plus what the caller cannot reconstruct from
30
+ * the returned lockfile: whether autofixing a merge conflict rewrote it,
31
+ * and, under `mergeGitBranchLockfiles`, the importers as they stood
32
+ * before the branch lockfiles were folded in. Telling a merged entry from
33
+ * one the read file already carried needs that "before", which the merged
34
+ * object no longer holds.
35
+ */
36
+ export async function readWantedLockfileWithMergeInfo(pkgPath, opts) {
37
+ return _readWantedLockfile(pkgPath, opts);
38
+ }
28
39
  export async function readWantedLockfile(pkgPath, opts) {
29
40
  return (await _readWantedLockfile(pkgPath, opts)).lockfile;
30
41
  }
@@ -168,11 +179,13 @@ async function _readWantedLockfile(pkgPath, opts) {
168
179
  }
169
180
  }
170
181
  let result = { lockfile: null, lockfileFile: null, hadConflicts: false };
182
+ let preMergeImporters;
171
183
  /* eslint-disable no-await-in-loop */
172
184
  for (const lockfileName of lockfileNames) {
173
185
  result = await _read(path.join(pkgPath, lockfileName), pkgPath, { ...opts, autofixMergeConflicts: true });
174
186
  if (result.lockfile) {
175
187
  if (opts.mergeGitBranchLockfiles) {
188
+ preMergeImporters = result.lockfile.importers;
176
189
  result.lockfile = await _mergeGitBranchLockfiles(result.lockfile, pkgPath, pkgPath, opts);
177
190
  result.lockfileFile = result.lockfile ? convertToLockfileFile(result.lockfile) : null;
178
191
  }
@@ -180,7 +193,7 @@ async function _readWantedLockfile(pkgPath, opts) {
180
193
  }
181
194
  }
182
195
  /* eslint-enable no-await-in-loop */
183
- return result;
196
+ return { ...result, preMergeImporters };
184
197
  }
185
198
  async function _mergeGitBranchLockfiles(lockfile, lockfileDir, prefix, opts) {
186
199
  if (!lockfile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/lockfile.fs",
3
- "version": "1100.2.3",
3
+ "version": "1100.2.4",
4
4
  "description": "Read/write pnpm-lock.yaml files",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@jest/globals": "30.4.1",
55
- "@pnpm/lockfile.fs": "1100.2.3",
55
+ "@pnpm/lockfile.fs": "1100.2.4",
56
56
  "@pnpm/logger": "1100.0.0",
57
57
  "@types/js-yaml": "^4.0.9",
58
58
  "@types/normalize-path": "^3.0.2",