(pathA: string, pathB: string)
| 1368 | // ── Diff ─────────────────────────────────────────────────────── |
| 1369 | |
| 1370 | async diff(pathA: string, pathB: string): Promise<string> { |
| 1371 | const contentA = await this.readFile(pathA); |
| 1372 | if (contentA === null) throw new Error(`ENOENT: no such file: ${pathA}`); |
| 1373 | const contentB = await this.readFile(pathB); |
| 1374 | if (contentB === null) throw new Error(`ENOENT: no such file: ${pathB}`); |
| 1375 | const linesA = contentA.split("\n").length; |
| 1376 | const linesB = contentB.split("\n").length; |
| 1377 | if (linesA > MAX_DIFF_LINES || linesB > MAX_DIFF_LINES) { |
| 1378 | throw new Error( |
| 1379 | `EFBIG: files too large for diff (max ${MAX_DIFF_LINES} lines)` |
| 1380 | ); |
| 1381 | } |
| 1382 | return unifiedDiff( |
| 1383 | contentA, |
| 1384 | contentB, |
| 1385 | normalizePath(pathA), |
| 1386 | normalizePath(pathB) |
| 1387 | ); |
| 1388 | } |
| 1389 | |
| 1390 | async diffContent(path: string, newContent: string): Promise<string> { |
| 1391 | const existing = await this.readFile(path); |
nothing calls this directly
no test coverage detected