* How many OTHER files depend on each of the given files. * * Counted through the symbols, not the file nodes: an `imports` edge points * at the imported symbol, so a file node almost never receives one and * counting edges into it would report every file as depended on by nobody. * S
(filePaths: string[])
| 3309 | * in the index reaches into this file" — the honest reading of a root. |
| 3310 | */ |
| 3311 | getFileDependentCounts(filePaths: string[]): Array<{ filePath: string; dependents: number }> { |
| 3312 | if (filePaths.length === 0) return []; |
| 3313 | return this.db |
| 3314 | .prepare( |
| 3315 | `SELECT tn.file_path AS filePath, COUNT(DISTINCT sn.file_path) AS dependents |
| 3316 | FROM edges e |
| 3317 | JOIN nodes tn ON tn.id = e.target |
| 3318 | JOIN nodes sn ON sn.id = e.source |
| 3319 | WHERE e.kind != 'contains' |
| 3320 | AND tn.file_path IN (SELECT value FROM json_each(?)) |
| 3321 | AND sn.file_path <> tn.file_path |
| 3322 | GROUP BY tn.file_path` |
| 3323 | ) |
| 3324 | .all(JSON.stringify(filePaths)) as Array<{ filePath: string; dependents: number }>; |
| 3325 | } |
| 3326 | |
| 3327 | /** |
| 3328 | * How far each of the given files reaches OUT: distinct other files its |
no test coverage detected