(index: number, paths: string[])
| 144 | })); |
| 145 | if (selections.length > 4) warnings.push('Compare at most four indexed projects at once.'); |
| 146 | const read = async (index: number, paths: string[]) => { |
| 147 | const inventory = selections[index].inventory; |
| 148 | // Four requests at a time keep a large repo from monopolizing the daemon. |
| 149 | for (let offset = 0; offset < paths.length; offset += 4) { |
| 150 | checkAbort(signal); |
| 151 | if (sourceChars >= 4_000_000) { warnings.push('Source inspection reached the four-million-character budget.'); break; } |
| 152 | await Promise.all(paths.slice(offset, offset + 4).map(async path => { |
| 153 | try { |
| 154 | const source = await readContainerSource(inventory, path, client, signal); |
| 155 | if (sourceChars + source.length > 4_000_000) { sourceChars = 4_000_000; warnings.push('Source inspection reached the four-million-character budget.'); return; } |
| 156 | sourceChars += source.length; |
| 157 | (projects[index].sources as Map<string, string>).set(path, source); filesRead++; |
| 158 | if (inventory.sourceSpans?.has(path) && !inventory.sourceEnds?.has(path)) rangeFiles.add(`${inventory.project}:${path}`); |
| 159 | } catch { |
| 160 | checkAbort(signal); |
| 161 | warnings.push(`${inventory.project}: ${path} was unavailable, incomplete, or exceeded the source limit.`); |
| 162 | } |
| 163 | })); |
| 164 | } |
| 165 | }; |
| 166 | for (let index = 0; index < projects.length; index++) { |
| 167 | warnings.push(...selections[index].inventory.warnings); |
| 168 | if (projects[index].manifest) await read(index, [projects[index].manifest]); |
no test coverage detected