Files
hyperframes/packages/producer/src/index.ts
T
Xuanru LiandClaude Opus 4.8 906c8d04f8 fix(cli): localize remote assets before validate so it matches render (#2001)
validate served the composition over a loopback origin and let headless
Chrome fetch remote <img crossorigin>/@font-face assets cross-origin, while
the render pipeline downloads them to disk first. Buckets whose CORS
allowlist omits the loopback origin then failed the CORS-mode request with a
false net::ERR_FAILED that never occurs in the real render, pushing authors
(and agent pipelines) to delete crossorigin — which disables WebGL
color-grading/shaders for that asset.

Reuse producer's localizeRemote{Media,Image,FontFace}Sources in validate,
downloading into a temp dir served as an extra static-server asset root
(project dir untouched, cleaned up after). validate now matches render.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 17:20:18 -07:00

112 lines
4.5 KiB
TypeScript

/**
* @hyperframes/producer
*
* Generic HTML-to-video rendering engine using Chrome's BeginFrame API.
* Framework-agnostic: works with GSAP, Lottie, Three.js, CSS animations,
* or any web content via configurable page contracts and hooks.
*/
// ── Main rendering pipeline ─────────────────────────────────────────────────
export {
createRenderJob,
executeRenderJob,
RenderCancelledError,
type RenderConfig,
type RenderConfigInput,
type RenderJob,
type RenderStatus,
type RenderPerfSummary,
type ProgressCallback,
} from "./services/renderOrchestrator.js";
export {
type BrowserDiagnosticSummary,
type RenderCaptureObservability,
type RenderObservabilitySummary,
type RenderObservationData,
type RenderObservationEvent,
type RenderObservationStatus,
} from "./services/render/observability.js";
// ── HTML asset localization ─────────────────────────────────────────────────
// Rewrite remote <img>/<video>/<audio>/@font-face to same-origin local paths
// before capture. Shared by render and `validate` so both resolve assets alike.
export {
localizeRemoteMediaSources,
localizeRemoteImageSources,
localizeRemoteFontFaces,
} from "./services/htmlCompiler.js";
// ── Frame capture (lower-level) ─────────────────────────────────────────────
export {
createCaptureSession,
initializeSession,
closeCaptureSession,
captureFrame,
captureFrameToBuffer,
getCompositionDuration,
getCapturePerfSummary,
prepareCaptureSessionForReuse,
type CaptureOptions,
type CaptureSession,
type CaptureResult,
type CapturePerfSummary,
type BeforeCaptureHook,
} from "./services/frameCapture.js";
// ── File server ─────────────────────────────────────────────────────────────
export {
createFileServer,
type FileServerOptions,
type FileServerHandle,
} from "./services/fileServer.js";
// ── Video frame injection (Hyperframes-specific hook) ───────────────────────
export { createVideoFrameInjector } from "@hyperframes/engine";
// ── Configuration ───────────────────────────────────────────────────────────
export { resolveConfig, DEFAULT_CONFIG, type ProducerConfig } from "./config.js";
// ── Logger ──────────────────────────────────────────────────────────────────
export {
type ProducerLogger,
type LogLevel,
createConsoleLogger,
defaultLogger,
} from "./logger.js";
// ── Server ──────────────────────────────────────────────────────────────────
export {
createRenderHandlers,
createProducerApp,
startServer,
type HandlerOptions,
type ServerOptions,
type RenderHandlers,
} from "./server.js";
// ── Utilities ───────────────────────────────────────────────────────────────
export { normalizeErrorMessage } from "./utils/errorMessage.js";
export { quantizeTimeToFrame } from "./utils/parityContract.js";
export { resolveRenderPaths, type RenderPaths } from "./utils/paths.js";
export {
prepareHyperframeLintBody,
runHyperframeLint,
type PreparedHyperframeLintInput,
} from "./services/hyperframeLint.js";
// ── Distributed render primitives ───────────────────────────────────────────
// The full surface lives at `@hyperframes/producer/distributed`; we
// additionally re-export the three activity functions + their result
// types here so callers that pin `@hyperframes/producer` don't need a
// separate subpath import.
export {
assemble,
plan,
renderChunk,
type AssembleResult,
type ChunkResult,
type DistributedRenderConfig,
type PlanResult,
} from "./distributed.js";