perf(studio): leave scene files for the preview runtime to fetch

The preview inlined every data-composition-src scene into one document, so
nothing could play until the whole film had arrived and parsed. The bundler
gains subCompositions: external, used only by the Studio preview: the root
keeps its scene hosts and the runtime fetches each scene file. Renders keep
inlining. Frames at sampled times match the inlined preview exactly.
This commit is contained in:
Miguel Ángel
2026-09-23 00:23:23 -04:00
parent e39caa8133
commit bd87e8524f
4 changed files with 42 additions and 6 deletions
@@ -66,8 +66,11 @@ describe("studio preview document", () => {
// Kept URLs resolve against the preview's <base href> through the asset route.
expect(html).toContain('<base href="/api/projects/film/preview/">');
expect(await fetchAsset("assets/pic.png")).toEqual(PIC);
const nested = html.match(/<img [^>]*id="nested" src="([^"]+)"/)?.[1];
expect(nested).toBe("assets/pic@2x.png");
expect(await fetchAsset(nested ?? "")).toEqual(PIC_2X);
// Scenes stay separate files the runtime fetches, so the first scene can play before the rest.
expect(html).toContain('data-composition-src="compositions/scene.html"');
expect(html).not.toContain('id="nested"');
const scene = (await fetchAsset("compositions/scene.html")).toString("utf-8");
expect(scene.match(/<img [^>]*id="nested" src="([^"]+)"/)?.[1]).toBe("../assets/pic@2x.png");
expect(await fetchAsset("assets/pic@2x.png")).toEqual(PIC_2X);
});
});