X7ROOT File Manager
Current Path:
/opt/alt/alt-nodejs19/root/usr/lib/node_modules/npm/lib/utils
opt
/
alt
/
alt-nodejs19
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
/
utils
/
ðŸ“
..
📄
ansi-trim.js
(173 B)
📄
audit-error.js
(1.02 KB)
📄
auth.js
(2.8 KB)
📄
cmd-list.js
(2.16 KB)
ðŸ“
completion
📄
completion.fish
(1.56 KB)
📄
completion.sh
(1.85 KB)
ðŸ“
config
📄
did-you-mean.js
(1.46 KB)
📄
display.js
(3.43 KB)
📄
error-message.js
(13.53 KB)
📄
exit-handler.js
(6.74 KB)
📄
explain-dep.js
(3.5 KB)
📄
explain-eresolve.js
(2.55 KB)
📄
format-bytes.js
(629 B)
📄
format-search-stream.js
(3.93 KB)
📄
get-identity.js
(802 B)
📄
is-windows.js
(233 B)
📄
log-file.js
(7.03 KB)
📄
log-shim.js
(1.68 KB)
📄
npm-usage.js
(2.04 KB)
📄
open-url-prompt.js
(1.44 KB)
📄
open-url.js
(1.09 KB)
📄
otplease.js
(1.23 KB)
📄
ping.js
(252 B)
📄
pulse-till-done.js
(412 B)
📄
queryable.js
(9.56 KB)
📄
read-user-info.js
(2 KB)
📄
reify-finish.js
(876 B)
📄
reify-output.js
(4.97 KB)
📄
replace-info.js
(807 B)
📄
tar.js
(3.9 KB)
📄
timers.js
(2.73 KB)
📄
update-notifier.js
(4.19 KB)
📄
validate-lockfile.js
(1023 B)
📄
web-auth.js
(558 B)
Editing: explain-dep.js
const { relative } = require('path') const explainNode = (node, depth, chalk) => printNode(node, chalk) + explainDependents(node, depth, chalk) + explainLinksIn(node, depth, chalk) const colorType = (type, chalk) => { const { red, yellow, cyan, magenta, blue, green, gray } = chalk const style = type === 'extraneous' ? red : type === 'dev' ? yellow : type === 'optional' ? cyan : type === 'peer' ? magenta : type === 'bundled' ? blue : type === 'workspace' ? green : type === 'overridden' ? gray : /* istanbul ignore next */ s => s return style(type) } const printNode = (node, chalk) => { const { name, version, location, extraneous, dev, optional, peer, bundled, isWorkspace, overridden, } = node const { bold, dim, green } = chalk const extra = [] if (extraneous) { extra.push(' ' + bold(colorType('extraneous', chalk))) } if (dev) { extra.push(' ' + bold(colorType('dev', chalk))) } if (optional) { extra.push(' ' + bold(colorType('optional', chalk))) } if (peer) { extra.push(' ' + bold(colorType('peer', chalk))) } if (bundled) { extra.push(' ' + bold(colorType('bundled', chalk))) } if (overridden) { extra.push(' ' + bold(colorType('overridden', chalk))) } const pkgid = isWorkspace ? green(`${name}@${version}`) : `${bold(name)}@${bold(version)}` return `${pkgid}${extra.join('')}` + (location ? dim(`\n${location}`) : '') } const explainLinksIn = ({ linksIn }, depth, chalk) => { if (!linksIn || !linksIn.length || depth <= 0) { return '' } const messages = linksIn.map(link => explainNode(link, depth - 1, chalk)) const str = '\n' + messages.join('\n') return str.split('\n').join('\n ') } const explainDependents = ({ name, dependents }, depth, chalk) => { if (!dependents || !dependents.length || depth <= 0) { return '' } const max = Math.ceil(depth / 2) const messages = dependents.slice(0, max) .map(edge => explainEdge(edge, depth, chalk)) // show just the names of the first 5 deps that overflowed the list if (dependents.length > max) { let len = 0 const maxLen = 50 const showNames = [] for (let i = max; i < dependents.length; i++) { const { from: { name: depName = 'the root project' } } = dependents[i] len += depName.length if (len >= maxLen && i < dependents.length - 1) { showNames.push('...') break } showNames.push(depName) } const show = `(${showNames.join(', ')})` messages.push(`${dependents.length - max} more ${show}`) } const str = '\n' + messages.join('\n') return str.split('\n').join('\n ') } const explainEdge = ({ name, type, bundled, from, spec, rawSpec, overridden }, depth, chalk) => { const { bold } = chalk let dep = type === 'workspace' ? bold(relative(from.location, spec.slice('file:'.length))) : `${bold(name)}@"${bold(spec)}"` if (overridden) { dep = `${colorType('overridden', chalk)} ${dep} (was "${rawSpec}")` } const fromMsg = ` from ${explainFrom(from, depth, chalk)}` return (type === 'prod' ? '' : `${colorType(type, chalk)} `) + (bundled ? `${colorType('bundled', chalk)} ` : '') + `${dep}${fromMsg}` } const explainFrom = (from, depth, chalk) => { if (!from.name && !from.version) { return 'the root project' } return printNode(from, chalk) + explainDependents(from, depth - 1, chalk) + explainLinksIn(from, depth - 1, chalk) } module.exports = { explainNode, printNode, explainEdge }
Upload File
Create Folder