PHP 8.2.30
Preview: gather-dep-set.js Size: 1.26 KB
//opt/alt/alt-nodejs22/root/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/gather-dep-set.js

// Given a set of nodes in a tree, and a filter function to test
// incoming edges to the dep set that should be ignored otherwise.
//
// find the set of deps that are only depended upon by nodes in the set, or
// their dependencies, or edges that are ignored.
//
// Used when figuring out what to prune when replacing a node with a newer
// version, or when an optional dep fails to install.

const gatherDepSet = (set, edgeFilter) => {
  const deps = new Set(set)

  // add the full set of dependencies.  note that this loop will continue
  // as the deps set increases in size.
  for (const node of deps) {
    for (const edge of node.edgesOut.values()) {
      if (edge.to && edgeFilter(edge)) {
        deps.add(edge.to)
      }
    }
  }

  // now remove all nodes in the set that have a dependant outside the set
  // if any change is made, then re-check
  // continue until no changes made, or deps set evaporates fully.
  let changed = true
  while (changed === true && deps.size > 0) {
    changed = false
    for (const dep of deps) {
      for (const edge of dep.edgesIn) {
        if (!deps.has(edge.from) && edgeFilter(edge)) {
          changed = true
          deps.delete(dep)
          break
        }
      }
    }
  }

  return deps
}

module.exports = gatherDepSet

Directory Contents

Dirs: 1 × Files: 38

Name Size Perms Modified Actions
arborist DIR
- drwxr-xr-x 2026-03-14 07:02:09
Edit Download
4.89 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
11.95 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
3.42 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
13.94 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.21 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.27 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.25 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
691 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
5.00 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
9.57 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
6.63 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.07 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.26 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
273 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
3.25 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
3.04 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
42.95 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.32 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
225 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
3.12 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
2.50 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
2.57 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
19.75 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
5.10 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
28.84 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
2.59 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
136 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
638 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
501 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
36.83 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
2.19 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.35 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
874 B lrw-r--r-- 2026-02-23 06:54:00
Edit Download
2.92 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
4.04 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
1.45 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
5.82 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download
10.56 KB lrw-r--r-- 2026-02-23 06:54:00
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).