@pnpm/deps.inspection.tree-builder 1101.0.8 → 1101.0.9

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,14 @@
1
1
  # @pnpm/reviewing.dependencies-hierarchy
2
2
 
3
+ ## 1101.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - @pnpm/config.matcher@1100.0.3
9
+ - @pnpm/lockfile.fs@1100.2.12
10
+ - @pnpm/store.cafs@1100.3.6
11
+
3
12
  ## 1101.0.8
4
13
 
5
14
  ### Patch Changes
@@ -69,8 +69,8 @@ async function buildProjectsTrees(projectPaths, maybeOpts, linkedWalk) {
69
69
  return Object.fromEntries(pairs);
70
70
  }
71
71
  async function readLockfiles(modulesDir, lockfileDir) {
72
- const internalPnpmDir = path.join(modulesDir, '.pnpm');
73
- const currentLockfile = await readCurrentLockfile(internalPnpmDir, { ignoreIncompatible: false });
72
+ const installStateDir = path.join(modulesDir, '.pnpm');
73
+ const currentLockfile = await readCurrentLockfile(installStateDir, { ignoreIncompatible: false });
74
74
  const wantedLockfile = await readWantedLockfile(lockfileDir, { ignoreIncompatible: false });
75
75
  return { currentLockfile, wantedLockfile };
76
76
  }
@@ -238,8 +238,6 @@ async function dependenciesHierarchyForPackage(opts, projectPath) {
238
238
  ? opts.modulesDir
239
239
  : path.join(projectPath, opts.modulesDir ?? 'node_modules');
240
240
  const { result, fieldMap } = initDependencyFields(projectSnapshot, opts.include);
241
- // Materialize the tree rooted at this importer in a single getTree call.
242
- // materializeChildren handles all dedup, search, and circular detection.
243
241
  // The depth is incremented by 1 because the importer itself is one level;
244
242
  // opts.depth controls how deep *below* the direct dependencies we go.
245
243
  const nodes = getTree({
@@ -251,7 +249,6 @@ async function dependenciesHierarchyForPackage(opts, projectPath) {
251
249
  wantedPackages: wantedLockfile?.packages ?? {},
252
250
  modulesDir,
253
251
  }, { type: 'importer', importerId });
254
- // Categorize the materialized nodes into their dependency fields.
255
252
  for (const node of nodes) {
256
253
  const field = fieldMap.get(node.alias);
257
254
  if (field != null) {
@@ -268,7 +265,6 @@ async function dependenciesHierarchyForPackage(opts, projectPath) {
268
265
  return result;
269
266
  }
270
267
  function initDependencyFields(projectSnapshot, include) {
271
- // Build a map from alias → dependency field for post-categorization.
272
268
  const result = {};
273
269
  const fieldMap = new Map();
274
270
  for (const field of DEPENDENCIES_FIELDS.sort().filter(f => include[f])) {
@@ -56,7 +56,6 @@ function buildSelectedProjectsGraph(projectPaths, opts) {
56
56
  devDependencies: true,
57
57
  optionalDependencies: true,
58
58
  };
59
- // Build root IDs from the selected project paths (respects --filter / --recursive)
60
59
  const allRootIds = [];
61
60
  for (const projectPath of projectPaths) {
62
61
  const importerId = getLockfileImporterId(opts.lockfileDir, projectPath);
@@ -125,7 +124,6 @@ function buildTreeIfMatched(search, { serialized, depPath }, ctx) {
125
124
  }
126
125
  function searchPackage(search, pkg, ctx) {
127
126
  const { name, version, readManifest } = pkg;
128
- // Check canonical name first
129
127
  const matched = search({ alias: name, name, version, readManifest });
130
128
  if (matched)
131
129
  return matched;
package/lib/getTree.js CHANGED
@@ -12,11 +12,6 @@ export function getTree(opts, parentId) {
12
12
  ancestors,
13
13
  };
14
14
  const result = materializeChildren(ctx, parentId, opts.maxDepth, opts.parentDir);
15
- // Mark circular back-edges. materializeChildren truncates dependencies
16
- // at cycle boundaries but does not set the `circular` flag, so that cached
17
- // subtrees stay context-independent. fixCircularRefs walks the final tree
18
- // and adds `circular: true` wherever a node's path matches an ancestor.
19
- //
20
15
  // Seed the ancestors with parentDir (the filesystem path of parentId) so
21
16
  // that back-edges to the root of this subtree are detected — the root
22
17
  // itself does not appear as a node in the tree, only its children do.
@@ -154,7 +149,6 @@ function materializeTarget(ctx, { target, maxDepth, dir }) {
154
149
  ctx.ancestors.add(target.id);
155
150
  const childResult = materializeChildren(ctx, target.nodeId, maxDepth, dir);
156
151
  ctx.ancestors.delete(target.id);
157
- // Always cache — even results with circular truncations.
158
152
  ctx.materializationCache.set(cacheKey, {
159
153
  count: childResult.count,
160
154
  hasSearchMatch: childResult.hasSearchMatch,
@@ -228,7 +222,6 @@ function markSearchMatch(newEntry, { searchMatch, subtree, result }) {
228
222
  function fixCircularRefs(nodes, ancestors) {
229
223
  let changed = false;
230
224
  const result = nodes.map(node => {
231
- // A node whose path matches an ancestor is a circular back-edge.
232
225
  if (node.path && ancestors.has(node.path)) {
233
226
  changed = true;
234
227
  const { dependencies: _, deduped: _d, dedupedDependenciesCount: _c, ...rest } = node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/deps.inspection.tree-builder",
3
- "version": "1101.0.8",
3
+ "version": "1101.0.9",
4
4
  "description": "Creates a dependencies hierarchy for a symlinked `node_modules`",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -30,18 +30,18 @@
30
30
  "!*.map"
31
31
  ],
32
32
  "dependencies": {
33
- "@pnpm/config.matcher": "1100.0.2",
33
+ "@pnpm/config.matcher": "1100.0.3",
34
34
  "@pnpm/config.normalize-registries": "1101.0.2",
35
35
  "@pnpm/deps.path": "1101.0.5",
36
36
  "@pnpm/fs.read-modules-dir": "1100.0.3",
37
37
  "@pnpm/installing.modules-yaml": "1101.0.5",
38
38
  "@pnpm/lockfile.detect-dep-types": "1100.0.26",
39
- "@pnpm/lockfile.fs": "1100.2.11",
39
+ "@pnpm/lockfile.fs": "1100.2.12",
40
40
  "@pnpm/lockfile.peer-edges": "1100.0.1",
41
41
  "@pnpm/lockfile.utils": "1102.1.5",
42
42
  "@pnpm/npm-package-arg": "^2.0.0",
43
43
  "@pnpm/pkg-manifest.reader": "1100.0.21",
44
- "@pnpm/store.cafs": "1100.3.5",
44
+ "@pnpm/store.cafs": "1100.3.6",
45
45
  "@pnpm/store.index": "1101.0.0",
46
46
  "@pnpm/text.ordinal-comparator": "1100.0.0",
47
47
  "@pnpm/types": "1102.1.1",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@jest/globals": "30.4.1",
58
58
  "@pnpm/constants": "1102.0.0",
59
- "@pnpm/deps.inspection.tree-builder": "1101.0.8",
59
+ "@pnpm/deps.inspection.tree-builder": "1101.0.9",
60
60
  "@pnpm/test-fixtures": "1100.0.1",
61
61
  "@types/normalize-path": "^3.0.2",
62
62
  "@types/semver": "7.8.0"