PATH:
usr
/
lib
/
node_modules
/
npm
/
node_modules
/
@npmcli
/
arborist
/
lib
// 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
[-] reset-dep-flags.js
[edit]
[-] spec-from-lock.js
[edit]
[-] tracker.js
[edit]
[-] printable.js
[edit]
[-] gather-dep-set.js
[edit]
[-] relpath.js
[edit]
[+]
..
[-] place-dep.js
[edit]
[-] signal-handling.js
[edit]
[-] yarn-lock.js
[edit]
[-] from-path.js
[edit]
[-] override-set.js
[edit]
[-] debug.js
[edit]
[-] deepest-nesting-target.js
[edit]
[-] can-place-dep.js
[edit]
[-] edge.js
[edit]
[-] link.js
[edit]
[-] diff.js
[edit]
[-] audit-report.js
[edit]
[-] consistent-resolve.js
[edit]
[-] calc-dep-flags.js
[edit]
[-] tree-check.js
[edit]
[-] index.js
[edit]
[-] vuln.js
[edit]
[-] optional-set.js
[edit]
[-] realpath.js
[edit]
[-] add-rm-pkg-deps.js
[edit]
[-] inventory.js
[edit]
[-] peer-entry-sets.js
[edit]
[-] get-workspace-nodes.js
[edit]
[-] case-insensitive-map.js
[edit]
[-] retire-path.js
[edit]
[-] query-selector-all.js
[edit]
[-] override-resolves.js
[edit]
[-] node.js
[edit]
[-] shrinkwrap.js
[edit]
[-] signals.js
[edit]
[-] dep-valid.js
[edit]
[+]
arborist
[-] version-from-tgz.js
[edit]