Server IP : 85.214.239.14 / Your IP : 18.118.208.127 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/cwd/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/ |
Upload File : |
// 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