MCPcopy Index your code
hub / github.com/nodejs/node / explain

Function explain

deps/npm/lib/utils/explain-eresolve.js:7–39  ·  view source on GitHub ↗
(expl, chalk, depth)

Source from the content-addressed store, hash-verified

5// Depth is how far we want to want to descend into the object making a report.
6// The full report (ie, depth=Infinity) is always written to the cache folder at ${cache}/eresolve-report.txt along with full json.
7const explain = (expl, chalk, depth) => {
8 const { edge, dep, current, peerConflict, currentEdge } = expl
9
10 const out = []
11 const whileInstalling = dep && dep.whileInstalling ||
12 current && current.whileInstalling ||
13 edge && edge.from && edge.from.whileInstalling
14 if (whileInstalling) {
15 out.push('While resolving: ' + printNode(whileInstalling, chalk))
16 }
17
18 // it "should" be impossible for an ERESOLVE explanation to lack both current and currentEdge, but better to have a less helpful error than a crashing failure.
19 if (current) {
20 out.push('Found: ' + explainNode(current, depth, chalk))
21 } else if (peerConflict && peerConflict.current) {
22 out.push('Found: ' + explainNode(peerConflict.current, depth, chalk))
23 } else if (currentEdge) {
24 out.push('Found: ' + explainEdge(currentEdge, depth, chalk))
25 } else /* istanbul ignore else - should always have one */ if (edge) {
26 out.push('Found: ' + explainEdge(edge, depth, chalk))
27 }
28
29 out.push('\nCould not resolve dependency:\n' +
30 explainEdge(edge, depth, chalk))
31
32 if (peerConflict) {
33 const heading = '\nConflicting peer dependency:'
34 const pc = explainNode(peerConflict.peer, depth, chalk)
35 out.push(heading + ' ' + pc)
36 }
37
38 return out.join('\n')
39}
40
41// generate a full verbose report and tell the user how to fix it
42const report = (expl, chalk, noColorChalk) => {

Callers 3

#tryWriteLogMethod · 0.85
reportFunction · 0.85

Calls 5

explainNodeFunction · 0.85
explainEdgeFunction · 0.85
printNodeFunction · 0.70
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…