@pnpm/lockfile.fs 1100.0.4 → 1100.0.5
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/lib/lockfileFormatConverters.js +25 -0
- package/package.json +12 -12
|
@@ -2,6 +2,16 @@ import { LOCKFILE_VERSION } from '@pnpm/constants';
|
|
|
2
2
|
import { refToRelative, removeSuffix } from '@pnpm/deps.path';
|
|
3
3
|
import { DEPENDENCIES_FIELDS } from '@pnpm/types';
|
|
4
4
|
import { isEmpty, map as _mapValues, omit, pick, pickBy } from 'ramda';
|
|
5
|
+
// Minimal duplicate of `isGitHostedPkgUrl` from `@pnpm/fetching.pick-fetcher`,
|
|
6
|
+
// inlined to avoid pulling the fetcher dep into the lockfile I/O layer. Used
|
|
7
|
+
// to enrich entries written by older pnpm versions (which didn't record the
|
|
8
|
+
// `gitHosted` field on TarballResolution) so every downstream reader can rely
|
|
9
|
+
// on the field directly.
|
|
10
|
+
function isGitHostedTarballUrl(url) {
|
|
11
|
+
return (url.startsWith('https://codeload.github.com/') ||
|
|
12
|
+
url.startsWith('https://bitbucket.org/') ||
|
|
13
|
+
url.startsWith('https://gitlab.com/')) && url.includes('tar.gz');
|
|
14
|
+
}
|
|
5
15
|
export function convertToLockfileFile(lockfile) {
|
|
6
16
|
const packages = {};
|
|
7
17
|
const snapshots = {};
|
|
@@ -116,6 +126,7 @@ export function convertToLockfileObject(lockfile) {
|
|
|
116
126
|
for (const [depPath, pkg] of Object.entries(lockfile.snapshots ?? {})) {
|
|
117
127
|
const pkgId = removeSuffix(depPath);
|
|
118
128
|
packages[depPath] = Object.assign(pkg, lockfile.packages?.[pkgId]);
|
|
129
|
+
enrichGitHostedFlag(packages[depPath]?.resolution);
|
|
119
130
|
}
|
|
120
131
|
return {
|
|
121
132
|
...omit(['snapshots'], rest),
|
|
@@ -124,6 +135,20 @@ export function convertToLockfileObject(lockfile) {
|
|
|
124
135
|
importers: mapValues(importers ?? {}, revertProjectSnapshot),
|
|
125
136
|
};
|
|
126
137
|
}
|
|
138
|
+
// Backfill the `gitHosted` flag for tarball resolutions written by older
|
|
139
|
+
// pnpm versions. Doing it once at load time lets every downstream reader
|
|
140
|
+
// rely on the typed field instead of repeating URL prefix matches.
|
|
141
|
+
function enrichGitHostedFlag(resolution) {
|
|
142
|
+
if (resolution == null)
|
|
143
|
+
return;
|
|
144
|
+
if (resolution.type !== undefined)
|
|
145
|
+
return;
|
|
146
|
+
if (resolution.gitHosted != null)
|
|
147
|
+
return;
|
|
148
|
+
if (resolution.tarball != null && isGitHostedTarballUrl(resolution.tarball)) {
|
|
149
|
+
resolution.gitHosted = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
127
152
|
function migratePatchedDependencies(patchedDependencies) {
|
|
128
153
|
if (!patchedDependencies)
|
|
129
154
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/lockfile.fs",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.5",
|
|
4
4
|
"description": "Read/write pnpm-lock.yaml files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"js-yaml": "npm:@zkochan/js-yaml@0.0.11",
|
|
32
32
|
"normalize-path": "^3.0.0",
|
|
33
33
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
34
|
-
"semver": "^7.7.
|
|
34
|
+
"semver": "^7.7.4",
|
|
35
35
|
"strip-bom": "^5.0.0",
|
|
36
|
-
"write-file-atomic": "^7.0.
|
|
36
|
+
"write-file-atomic": "^7.0.1",
|
|
37
37
|
"@pnpm/constants": "1100.0.0",
|
|
38
|
-
"@pnpm/deps.path": "1100.0.2",
|
|
39
38
|
"@pnpm/error": "1100.0.0",
|
|
40
|
-
"@pnpm/lockfile.
|
|
41
|
-
"@pnpm/
|
|
42
|
-
"@pnpm/
|
|
39
|
+
"@pnpm/lockfile.types": "1100.0.4",
|
|
40
|
+
"@pnpm/deps.path": "1100.0.2",
|
|
41
|
+
"@pnpm/lockfile.merger": "1100.0.4",
|
|
42
|
+
"@pnpm/lockfile.utils": "1100.0.5",
|
|
43
43
|
"@pnpm/object.key-sorting": "1100.0.0",
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
44
|
+
"@pnpm/network.git-utils": "1100.0.1",
|
|
45
|
+
"@pnpm/types": "1101.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@pnpm/logger": "
|
|
48
|
+
"@pnpm/logger": "^1001.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@jest/globals": "30.3.0",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"tempy": "3.0.0",
|
|
58
58
|
"write-yaml-file": "^6.0.0",
|
|
59
59
|
"yaml-tag": "1.1.0",
|
|
60
|
-
"@pnpm/
|
|
61
|
-
"@pnpm/
|
|
60
|
+
"@pnpm/lockfile.fs": "1100.0.5",
|
|
61
|
+
"@pnpm/logger": "1100.0.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.13"
|