(indexPath: string)
| 554 | } |
| 555 | |
| 556 | function collectCompositions(indexPath: string): SurfacedComposition[] { |
| 557 | const html = readFileSync(indexPath, "utf-8"); |
| 558 | const baseDir = dirname(indexPath); |
| 559 | const out: SurfacedComposition[] = [ |
| 560 | surfaceComposition(html, basename(indexPath), basename(indexPath)), |
| 561 | ]; |
| 562 | |
| 563 | const doc = new DOMParser().parseFromString(html, "text/html"); |
| 564 | for (const div of Array.from(doc.querySelectorAll("[data-composition-src]"))) { |
| 565 | const src = div.getAttribute("data-composition-src"); |
| 566 | if (!src) continue; |
| 567 | const subPath = resolve(baseDir, src); |
| 568 | if (!existsSync(subPath)) continue; |
| 569 | const id = div.getAttribute("data-composition-id") ?? src; |
| 570 | out.push(surfaceComposition(readFileSync(subPath, "utf-8"), id, src)); |
| 571 | } |
| 572 | return out; |
| 573 | } |
| 574 | |
| 575 | // ── Render (human) ─────────────────────────────────────────────────────────── |
| 576 |
no test coverage detected