PHP 8.2.30
Preview: optional-set.js Size: 1.32 KB
/opt/alt/alt-nodejs19/root/usr/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: 38

Name Size Perms Modified Actions
arborist DIR
- drwxr-xr-x 2024-03-03 22:54:11
Edit Download
4.89 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
11.99 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
3.07 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
13.94 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.32 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.29 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.20 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
691 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
4.94 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
9.57 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
6.83 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.04 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.26 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
863 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
353 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
3.20 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
3.06 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
43.26 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.32 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
225 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
3.12 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
2.57 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
19.76 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
5.09 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
26.17 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
2.58 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
131 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
638 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
491 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
36.60 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
2.19 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.35 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
874 B lrw-r--r-- 2023-12-06 18:07:50
Edit Download
3.29 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
4.02 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
1.45 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
5.93 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download
10.58 KB lrw-r--r-- 2023-12-06 18:07:50
Edit Download

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