PHP 8.3.31
Preview: optional-set.js Size: 1.32 KB
/opt/alt/alt-nodejs22/root/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/optional-set.js

// 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

Directory Contents

Dirs: 1 × Files: 39

Name Size Perms Modified Actions
arborist DIR
- drwxr-xr-x 2026-06-18 06:30:31
Edit Download
4.89 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
11.95 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
3.42 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
13.94 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.21 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.27 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.25 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
691 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
5.00 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
9.77 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
6.63 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.07 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.26 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
273 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
3.24 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.65 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
3.04 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
43.49 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.32 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
225 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
8.37 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.50 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.57 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
19.75 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
5.10 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
29.20 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.59 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
136 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
638 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
501 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
36.83 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.19 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.35 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
874 B lrw-r--r-- 2026-05-24 11:43:30
Edit Download
2.92 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
4.04 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
1.45 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
5.82 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download
10.56 KB lrw-r--r-- 2026-05-24 11:43:30
Edit Download

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