PATH:
usr
/
lib
/
node_modules
/
npm
/
node_modules
/
@npmcli
/
arborist
/
lib
// when an optional dep fails to install, we need to remove the branch of the // graph up to the first optionalDependencies, as well as any nodes that are // only required by other nodes in the set. // // This function finds the set of nodes that will need to be removed in that // case. // // Note that this is *only* going to work with trees where calcDepFlags // has been called, because we rely on the node.optional flag. const gatherDepSet = require('./gather-dep-set.js') const optionalSet = node => { if (!node.optional) { return new Set() } // start with the node, then walk up the dependency graph until we // get to the boundaries that define the optional set. since the // node is optional, we know that all paths INTO this area of the // graph are optional, but there may be non-optional dependencies // WITHIN the area. const set = new Set([node]) for (const node of set) { for (const edge of node.edgesIn) { if (!edge.optional) { set.add(edge.from) } } } // now that we've hit the boundary, gather the rest of the nodes in // the optional section. that's the set of dependencies that are only // depended upon by other nodes within the set, or optional dependencies // from outside the set. return gatherDepSet(set, edge => !edge.optional) } module.exports = optionalSet
[-] 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]