refactor(types): tighten type safety, dedupe HfTransitionMeta, prune dead LUT export (#366)

## Summary

Four small, mechanical type-safety cleanups across `engine`, `producer`, and `shader-transitions`. Zero behavior change — pure pre-cleanup so the rest of the stack ships against a tighter baseline.

## Why

`Chunk 6` of `plans/hdr-followups.md`. Several non-null assertions and a duplicate interface had accumulated as rebase artifacts and leftover work-in-progress; lands first because it touches files later chunks edit and removes friction during review.

## What changed

- `renderOrchestrator.ts`: replace `layers[layerIdx]!` with a `for (const [layerIdx, layer] of layers.entries())` so both index and element come from the iterator.
- `engine/types.ts`: drop the duplicate `HfTransitionMeta` interface (rebase artifact); the original definition above it is the documented one. The orphaned doc comment now precedes `HfProtocol`.
- `shader-transitions/hyper-shader.ts`: keep the local `HfTransitionMeta` declaration (the package ships as a standalone CDN bundle and must not depend on `@hyperframes/engine`), but add a sync comment pointing at the source of truth in `engine/src/types.ts`.
- `alphaBlit.ts` + `engine/index.ts`: drop `export` from `getSrgbToHdrLut` and remove its re-export. It was only ever called by the internal `blitRgba8OverRgb48le`; the public surface was dead code.

## Test plan

- [x] `bun run --filter @hyperframes/engine typecheck`
- [x] `bun run --filter @hyperframes/producer typecheck`
- [x] `bun run --filter @hyperframes/shader-transitions typecheck`
- [x] `bun run --filter @hyperframes/engine test` — 308/308 pass (no test changes; assertions removed in code only).

## Stack

Chunk 6 of `plans/hdr-followups.md`. Mechanical cleanup landed early per the suggested merge order.
This commit is contained in:
Vance Ingalls
2026-04-22 16:56:17 -07:00
committed by GitHub
parent a6e14da45c
commit 5de5df7fbb
5 changed files with 5 additions and 13 deletions
-1
View File
@@ -170,7 +170,6 @@ export {
blitRgb48leRegion,
blitRgb48leAffine,
parseTransformMatrix,
getSrgbToHdrLut,
roundedRectAlpha,
resampleRgb48leObjectFit,
normalizeObjectFit,
-9
View File
@@ -65,15 +65,6 @@ export interface HfTransitionMeta {
* GSAP, Framer Motion, CSS animations, Three.js — anything works as long
* as `seek()` produces deterministic visual output for a given time.
*/
export interface HfTransitionMeta {
time: number;
duration: number;
shader: string;
ease: string;
fromScene: string;
toScene: string;
}
export interface HfProtocol {
/** Total duration of the composition in seconds */
duration: number;
+1 -1
View File
@@ -292,7 +292,7 @@ const SRGB_TO_HLG = buildSrgbToHdrLut("hlg");
const SRGB_TO_PQ = buildSrgbToHdrLut("pq");
/** Select the correct sRGB→HDR LUT for the given transfer function. */
export function getSrgbToHdrLut(transfer: "hlg" | "pq"): Uint16Array {
function getSrgbToHdrLut(transfer: "hlg" | "pq"): Uint16Array {
return transfer === "pq" ? SRGB_TO_PQ : SRGB_TO_HLG;
}