(from, to)
| 124 | return { file: resolved, dependencies: (index.graph && index.graph[resolved]) || [] }; |
| 125 | } |
| 126 | |
| 127 | function tracePath(from, to) { |
| 128 | const index = ensureIndex(); |
| 129 | const a = resolveFile(index, from); |
| 130 | const b = resolveFile(index, to); |
| 131 | if (!a || Array.isArray(a) || !b || Array.isArray(b)) return { path: null, note: 'from/to not uniquely resolved' }; |
| 132 | const graph = index.graph || {}; |
| 133 | const queue = [[a]]; |
| 134 | const seen = new Set([a]); |
| 135 | while (queue.length) { |
| 136 | const trail = queue.shift(); |
| 137 | const head = trail[trail.length - 1]; |
| 138 | if (head === b) return { path: trail }; |
| 139 | for (const dep of graph[head] || []) { |
| 140 | if (seen.has(dep)) continue; |
| 141 | seen.add(dep); |
| 142 | queue.push(trail.concat(dep)); |
| 143 | } |
| 144 | } |
| 145 | return { path: null, note: 'no dependency path' }; |
| 146 | } |
| 147 | |
| 148 | function impactOfChange(base) { |
no test coverage detected