MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / collectCompositions

Function collectCompositions

packages/cli/src/commands/keyframes.ts:556–573  ·  view source on GitHub ↗
(indexPath: string)

Source from the content-addressed store, hash-verified

554}
555
556function 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

Callers 1

resolveScopeFunction · 0.85

Calls 5

surfaceCompositionFunction · 0.85
basenameFunction · 0.85
resolveFunction · 0.85
fromMethod · 0.80
getAttributeMethod · 0.65

Tested by

no test coverage detected