@pnpm/deps.graph-hasher 1100.2.14 → 1100.2.16
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 +18 -0
- package/lib/index.d.ts +4 -6
- package/lib/index.js +16 -3
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @pnpm/calc-dep-state
|
|
2
2
|
|
|
3
|
+
## 1100.2.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `link:` dependencies under `enableGlobalVirtualStore` so linked children are materialized and slots remain isolated by their resolved link targets.
|
|
8
|
+
|
|
9
|
+
## 1100.2.15
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies:
|
|
14
|
+
- @pnpm/deps.path@1100.1.0
|
|
15
|
+
- @pnpm/engine.runtime.system-version@1100.0.9
|
|
16
|
+
- @pnpm/lockfile.types@1100.0.19
|
|
17
|
+
- @pnpm/lockfile.utils@1101.0.0
|
|
18
|
+
- @pnpm/resolving.resolver-base@1101.1.0
|
|
19
|
+
- @pnpm/types@1101.9.0
|
|
20
|
+
|
|
3
21
|
## 1100.2.14
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -94,11 +94,9 @@ export interface GraphNodeHashOptions {
|
|
|
94
94
|
*/
|
|
95
95
|
nodeVersion?: string;
|
|
96
96
|
/**
|
|
97
|
-
* Directory the lockfile lives in. Scopes
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* shared slot, which is only safe for a lockfile known to have no directory
|
|
101
|
-
* dependencies.
|
|
97
|
+
* Directory the lockfile lives in. Scopes local directory dependencies to
|
|
98
|
+
* their project and resolves `link:` targets for recursive dependency
|
|
99
|
+
* hashing. Omitting it is only safe for a lockfile known to contain neither.
|
|
102
100
|
*/
|
|
103
101
|
lockfileDir?: string;
|
|
104
102
|
}
|
|
@@ -128,4 +126,4 @@ export interface PkgMetaAndSnapshot extends PkgMeta {
|
|
|
128
126
|
pkgIdWithPatchHash: PkgIdWithPatchHash;
|
|
129
127
|
}
|
|
130
128
|
export declare function iteratePkgMeta(lockfile: LockfileObject, graph: DepsGraph<DepPath>): PkgMetaIterator<PkgMetaAndSnapshot>;
|
|
131
|
-
export declare function lockfileToDepGraph(lockfile: LockfileObject, supportedArchitectures?: SupportedArchitectures): DepsGraph<DepPath>;
|
|
129
|
+
export declare function lockfileToDepGraph(lockfile: LockfileObject, supportedArchitectures?: SupportedArchitectures, lockfileDir?: string): DepsGraph<DepPath>;
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { hashObject, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher';
|
|
2
3
|
import { getPkgIdWithPatchHash, refToRelative } from '@pnpm/deps.path';
|
|
3
4
|
import { engineName } from '@pnpm/engine.runtime.system-version';
|
|
@@ -253,14 +254,15 @@ export function* iteratePkgMeta(lockfile, graph) {
|
|
|
253
254
|
};
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
export function lockfileToDepGraph(lockfile, supportedArchitectures) {
|
|
257
|
+
export function lockfileToDepGraph(lockfile, supportedArchitectures, lockfileDir) {
|
|
257
258
|
const graph = {};
|
|
259
|
+
const linkTargetNodes = new Set();
|
|
258
260
|
if (lockfile.packages != null) {
|
|
259
261
|
for (const [depPath, pkgSnapshot] of Object.entries(lockfile.packages)) {
|
|
260
262
|
const children = lockfileDepsToGraphChildren({
|
|
261
263
|
...pkgSnapshot.dependencies,
|
|
262
264
|
...pkgSnapshot.optionalDependencies,
|
|
263
|
-
});
|
|
265
|
+
}, lockfileDir, linkTargetNodes);
|
|
264
266
|
graph[depPath] = {
|
|
265
267
|
children,
|
|
266
268
|
resolution: pkgSnapshot.resolution,
|
|
@@ -268,6 +270,12 @@ export function lockfileToDepGraph(lockfile, supportedArchitectures) {
|
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
}
|
|
273
|
+
for (const linkTargetNode of linkTargetNodes) {
|
|
274
|
+
graph[linkTargetNode] = {
|
|
275
|
+
children: {},
|
|
276
|
+
fullPkgId: linkTargetNode,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
271
279
|
return graph;
|
|
272
280
|
}
|
|
273
281
|
function computeBuiltDepPaths(entries, allowBuild) {
|
|
@@ -304,13 +312,18 @@ function transitivelyRequiresBuild(graph, builtDepPaths, cache, depPath, parents
|
|
|
304
312
|
cache[depPath] = false;
|
|
305
313
|
return false;
|
|
306
314
|
}
|
|
307
|
-
function lockfileDepsToGraphChildren(deps) {
|
|
315
|
+
function lockfileDepsToGraphChildren(deps, lockfileDir, linkTargetNodes) {
|
|
308
316
|
const children = {};
|
|
309
317
|
for (const [alias, reference] of Object.entries(deps)) {
|
|
310
318
|
const depPath = refToRelative(reference, alias);
|
|
311
319
|
if (depPath) {
|
|
312
320
|
children[alias] = depPath;
|
|
313
321
|
}
|
|
322
|
+
else if (lockfileDir != null && reference.startsWith('link:')) {
|
|
323
|
+
const linkTargetNode = `link:${path.resolve(lockfileDir, reference.slice(5))}`;
|
|
324
|
+
children[alias] = linkTargetNode;
|
|
325
|
+
linkTargetNodes.add(linkTargetNode);
|
|
326
|
+
}
|
|
314
327
|
}
|
|
315
328
|
return children;
|
|
316
329
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/deps.graph-hasher",
|
|
3
|
-
"version": "1100.2.
|
|
3
|
+
"version": "1100.2.16",
|
|
4
4
|
"description": "Calculates the state of a dependency",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@pnpm/crypto.object-hasher": "1100.0.1",
|
|
31
|
-
"@pnpm/deps.path": "1100.0
|
|
32
|
-
"@pnpm/engine.runtime.system-version": "1100.0.
|
|
33
|
-
"@pnpm/lockfile.types": "1100.0.
|
|
34
|
-
"@pnpm/lockfile.utils": "
|
|
35
|
-
"@pnpm/resolving.resolver-base": "1101.
|
|
36
|
-
"@pnpm/types": "1101.
|
|
31
|
+
"@pnpm/deps.path": "1100.1.0",
|
|
32
|
+
"@pnpm/engine.runtime.system-version": "1100.0.9",
|
|
33
|
+
"@pnpm/lockfile.types": "1100.0.19",
|
|
34
|
+
"@pnpm/lockfile.utils": "1101.0.0",
|
|
35
|
+
"@pnpm/resolving.resolver-base": "1101.1.0",
|
|
36
|
+
"@pnpm/types": "1101.9.0",
|
|
37
37
|
"detect-libc": "^2.1.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@jest/globals": "30.4.1",
|
|
41
|
-
"@pnpm/deps.graph-hasher": "1100.2.
|
|
41
|
+
"@pnpm/deps.graph-hasher": "1100.2.16"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=22.13"
|