@hyperframes/producer 0.9.52 → 0.9.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.d.ts CHANGED
@@ -31,10 +31,22 @@ export interface HandlerOptions {
31
31
  artifactTtlMs?: number;
32
32
  /** Max renders that execute simultaneously. Queued requests wait FIFO. Default: 2. */
33
33
  maxConcurrentRenders?: number;
34
+ /** Extra browser-facing host names (e.g. a proxy's); merged with PRODUCER_ALLOWED_HOSTS. */
35
+ allowedHosts?: readonly string[];
36
+ /** Confine request paths and debug as below. Default: true in `createProducerApp`, false in `createRenderHandlers`. */
37
+ confineRequests?: boolean;
38
+ /** With `confineRequests`: where every `projectDir` must resolve. Defaults to PRODUCER_PROJECTS_DIR or the working directory. */
39
+ projectsDir?: string;
40
+ /** With `confineRequests`: let requests set `debug: true`, which keeps work dirs on disk. Defaults to PRODUCER_ALLOW_DEBUG=1. */
41
+ allowDebug?: boolean;
42
+ /** Bearer token `createProducerApp` requires on every route but /health. Defaults to PRODUCER_AUTH_TOKEN. */
43
+ authToken?: string;
34
44
  }
35
45
  export interface ServerOptions extends HandlerOptions {
36
46
  /** Port to listen on. Default: 9847. */
37
47
  port?: number;
48
+ /** Address to listen on. Default: PRODUCER_HOST or 127.0.0.1. A non-loopback address requires `authToken`. */
49
+ hostname?: string;
38
50
  }
39
51
  interface RenderInput {
40
52
  projectDir: string;
@@ -104,7 +116,12 @@ type PrepareRenderResult = {
104
116
  } | {
105
117
  error: string;
106
118
  };
107
- export declare function prepareRenderBody(body: Record<string, unknown>): Promise<PrepareRenderResult>;
119
+ /** What a request may reach on disk; see `HandlerOptions.projectsDir` and `allowDebug`. */
120
+ export interface RenderRequestPolicy {
121
+ projectsDir: string;
122
+ allowDebug: boolean;
123
+ }
124
+ export declare function prepareRenderBody(body: Record<string, unknown>, policy?: RenderRequestPolicy): Promise<PrepareRenderResult>;
108
125
  export interface RenderHandlers {
109
126
  render: (c: Context) => Promise<Response>;
110
127
  renderStream: (c: Context) => Response | Promise<Response>;
@@ -23,6 +23,7 @@ interface CompositionMediaAssets {
23
23
  audios: readonly AudioElement[];
24
24
  images: readonly ImageElement[];
25
25
  }
26
+ export declare function mediaAssetRoots(projectDir: string, compiledDir: string): string[];
26
27
  /** Treats local media outside the project, compiled and download dirs as missing: no probe or extraction opens it. */
27
28
  export declare function dropMediaOutsideProject(input: {
28
29
  projectDir: string;
@@ -135,6 +135,17 @@ export declare function localizeRemoteBackgroundImages(html: string, downloadDir
135
135
  html: string;
136
136
  remoteMediaAssets: Map<string, string>;
137
137
  }>;
138
+ /**
139
+ * Extract all `@font-face { ... }` blocks from a CSS string, preserving the
140
+ * full rule text (including the `@font-face` keyword and braces).
141
+ *
142
+ * Uses a depth-tracking scan instead of `[^}]*` so blocks with nested
143
+ * descriptor values that happen to contain `}` (rare but valid in
144
+ * `format(...)` hints with custom idents) are captured correctly.
145
+ *
146
+ * @internal exported for unit testing only
147
+ */
148
+ export declare function extractFontFaceBlocks(css: string): string[];
138
149
  /** @internal exported for unit testing only */
139
150
  export declare function localizeRemoteFontFaces(html: string, downloadDir: string): Promise<{
140
151
  html: string;
@@ -4,7 +4,7 @@ export interface PreparedHyperframeLintInput {
4
4
  html: string;
5
5
  source: "projectDir" | "files" | "html";
6
6
  }
7
- export declare function prepareHyperframeLintBody(body: Record<string, unknown>): {
7
+ export declare function prepareHyperframeLintBody(body: Record<string, unknown>, isAllowedEntry?: (absolutePath: string) => boolean): {
8
8
  prepared: PreparedHyperframeLintInput;
9
9
  } | {
10
10
  error: string;
@@ -30,6 +30,7 @@ export interface CompositionMetadata {
30
30
  * slightly different `end` / `mediaStart` / `volume` than the compiled
31
31
  * HTML and we want to ignore sub-millisecond float noise.
32
32
  */
33
+ export declare function audioWorkDir(workDir: string): string;
33
34
  export declare const BROWSER_MEDIA_EPSILON = 0.0001;
34
35
  /**
35
36
  * Resolve the browser/runtime end for a media element.
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import type { Fps } from "@hyperframes/core";
20
20
  import { type AudioProcessingFailure, type MixResult } from "@hyperframes/engine";
21
- import type { CompositionMetadata } from "../shared.js";
21
+ import { type CompositionMetadata } from "../shared.js";
22
22
  import type { ProducerLogger } from "../../../logger.js";
23
23
  export interface AudioStageInput {
24
24
  projectDir: string;
@@ -37,6 +37,7 @@ export interface AudioStageInput {
37
37
  masterFxChain?: string;
38
38
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
39
39
  audioSidecarUrlByLocalPath?: ReadonlyMap<string, string>;
40
+ allowOutsideProjectAssets?: boolean;
40
41
  abortSignal: AbortSignal | undefined;
41
42
  assertNotAborted: () => void;
42
43
  /** Where a per-track failure's detail goes. Optional so tests need not pass one. */
@@ -34,7 +34,7 @@
34
34
  * fires only when the composition hint is the deciding factor —
35
35
  * same behavior as before this PR.
36
36
  */
37
- import type { EngineConfig } from "@hyperframes/engine";
37
+ import { type EngineConfig } from "@hyperframes/engine";
38
38
  import type { CompiledComposition } from "../../htmlCompiler.js";
39
39
  import type { ProducerLogger } from "../../../logger.js";
40
40
  import { type CompositionMetadata } from "../shared.js";
@@ -55,6 +55,7 @@ export interface ExtractVideosStageInput {
55
55
  shownBoxes?: ReadonlyMap<string, ShownBox>;
56
56
  skipFrameExtractionIds?: readonly string[];
57
57
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
58
+ audioDownloadDir?: string;
58
59
  onProgress?: ProgressCallback;
59
60
  }
60
61
  export interface ExtractVideosStageResult {
@@ -137,13 +138,20 @@ export declare function appendAutoDetectedVideoAudio(composition: Pick<Compositi
137
138
  hasAudio: boolean;
138
139
  };
139
140
  }>): void;
140
- /**
141
- * The audio-only form of the extract stage: which videos carry sound takes a probe per source, not their frames.
142
- * Each video is moved to its extraction window first, as extraction does, so its sound lands where its picture does.
143
- */
144
- export declare function appendVideoAudioFromProbe(input: {
141
+ interface VideoAudioProbeInput {
145
142
  projectDir: string;
146
143
  compiledDir: string;
147
144
  composition: CompositionMetadata;
148
145
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
149
- }): Promise<void>;
146
+ /** Where a composition URL is downloaded before probing on a render service: the mixer's work folder, so the mix reuses it. */
147
+ downloadDir?: string;
148
+ allowOutsideProjectAssets?: boolean;
149
+ signal?: AbortSignal;
150
+ log?: ProducerLogger;
151
+ }
152
+ /**
153
+ * The audio-only form of the extract stage: which videos carry sound takes a probe per source, not their frames.
154
+ * Each video is moved to its extraction window first, as extraction does, so its sound lands where its picture does.
155
+ */
156
+ export declare function appendVideoAudioFromProbe(input: VideoAudioProbeInput): Promise<void>;
157
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { type CanvasResolution, type Fps, type FpsInput, type HfVfxCapture } from "@hyperframes/core";
2
2
  import type { CompileForRenderOptions } from "./htmlCompiler.js";
3
- import { type EngineConfig, type ExtractionPhaseBreakdown, type VideoFrameFormat, type CaptureOptions, type CaptureVideoMetadataHint, type CaptureSession, type BeforeCaptureHook, type ProresProfile, type ParallelProgress, type WorkerTask, type CapturePerfSummary, type CaptureWarning, type SubTimelineWaitOutcome, type WorkerSizing, type StaticVerificationOutcome, explainDrawElementDisabled, type CaptureFailureKind, displaySize, type ChromaSubsampling, type MotionBlurOptions, type PageMotionBlurSummary } from "@hyperframes/engine";
3
+ import { type EngineConfig, type ExtractionPhaseBreakdown, type VideoFrameFormat, closeCaptureSession, initializeSession, type CaptureOptions, type CaptureVideoMetadataHint, type CaptureSession, type BeforeCaptureHook, type ProresProfile, type ParallelProgress, type WorkerTask, type CapturePerfSummary, type CaptureWarning, type SubTimelineWaitOutcome, type WorkerSizing, type StaticVerificationOutcome, explainDrawElementDisabled, type CaptureFailureKind, displaySize, type ChromaSubsampling, type MotionBlurOptions, type PageMotionBlurSummary } from "@hyperframes/engine";
4
4
  import { type ReferenceBackgroundResult } from "@hyperframes/engine";
5
5
  import { type ProducerLogger } from "../logger.js";
6
6
  import { type RenderOutputFormat } from "./render/renderFormat.js";
@@ -1306,6 +1306,11 @@ export declare function shouldDiscardProbeSessionForPageSideCompositing(args: {
1306
1306
  hasProbeSession: boolean;
1307
1307
  usePageSideCompositing: boolean;
1308
1308
  }): boolean;
1309
+ /** Loads the page with the page-side stub and reports whether its shader-transitions build installed the compositor. */
1310
+ export declare function pageInstallsShaderCompositor(open: () => Promise<CaptureSession>, session?: {
1311
+ initializeSession: typeof initializeSession;
1312
+ closeCaptureSession: typeof closeCaptureSession;
1313
+ }): Promise<boolean>;
1309
1314
  /** Where `--debug` renders keep their work dirs, one per job id. */
1310
1315
  export declare function resolveRenderDebugDir(): string;
1311
1316
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.52",
3
+ "version": "0.9.54",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.13.0",
37
37
  "puppeteer-core": "^25.13.0",
38
- "@hyperframes/core": "0.9.52",
39
- "@hyperframes/engine": "0.9.52",
40
- "@hyperframes/lint": "0.9.52",
41
- "@hyperframes/parsers": "0.9.52",
42
- "@hyperframes/studio-server": "0.9.52"
38
+ "@hyperframes/core": "0.9.54",
39
+ "@hyperframes/engine": "0.9.54",
40
+ "@hyperframes/lint": "0.9.54",
41
+ "@hyperframes/parsers": "0.9.54",
42
+ "@hyperframes/studio-server": "0.9.54"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",
@@ -48,7 +48,7 @@
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^4.1.12",
51
- "@hyperframes/aws-lambda": "0.9.52"
51
+ "@hyperframes/aws-lambda": "0.9.54"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"