@hyperframes/producer 0.9.58 → 0.9.61
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/distributed.js +408 -153
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/hyperframeLintWorker.js +9 -0
- package/dist/index.js +576 -185
- package/dist/public-server.js +531 -166
- package/dist/renderRequest.d.ts +3 -0
- package/dist/server.d.ts +2 -0
- package/dist/services/animatedGifPrep.d.ts +2 -2
- package/dist/services/compositionSizeLimit.d.ts +22 -0
- package/dist/services/distributed/plan.d.ts +6 -1
- package/dist/services/distributed/planV2.d.ts +1 -0
- package/dist/services/distributed/projectHash.d.ts +9 -4
- package/dist/services/distributed/renderConfigValidation.d.ts +0 -18
- package/dist/services/distributed/renderSpan.d.ts +1 -0
- package/dist/services/distributed/shared.d.ts +2 -0
- package/dist/services/fileServer.d.ts +1 -0
- package/dist/services/heifImagePrep.d.ts +1 -1
- package/dist/services/htmlCompiler.d.ts +5 -2
- package/dist/services/htmlTagScans.d.ts +1 -0
- package/dist/services/hyperframeLint.d.ts +8 -2
- package/dist/services/hyperframeLintWorker.d.ts +1 -0
- package/dist/services/render/outputDimensions.d.ts +6 -0
- package/dist/services/render/shared.d.ts +7 -0
- package/dist/services/render/stages/audioStage.d.ts +1 -0
- package/dist/services/render/stages/encodeStage.d.ts +26 -1
- package/dist/services/render/stages/probeStage.d.ts +11 -2
- package/dist/services/renderOrchestrator.d.ts +5 -0
- package/dist/utils/paths.d.ts +6 -2
- package/dist/verifyStaticPage.d.ts +1 -1
- package/package.json +7 -7
package/dist/renderRequest.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ExpectedOutputDimensions } from "./services/render/outputDimensions.js";
|
|
1
2
|
import { type EngineConfig, type ProresProfile, type VideoFrameFormat } from "@hyperframes/engine";
|
|
2
3
|
import { type CanvasResolution, type Fps } from "@hyperframes/core";
|
|
3
4
|
import type { ProducerLogger } from "./logger.js";
|
|
@@ -48,6 +49,7 @@ export interface RenderRequestOptions {
|
|
|
48
49
|
pageMotionBlur?: RenderConfig["pageMotionBlur"];
|
|
49
50
|
variables?: Record<string, unknown>;
|
|
50
51
|
strictVariables?: boolean;
|
|
52
|
+
expectedOutputDimensions?: ExpectedOutputDimensions;
|
|
51
53
|
outputResolution?: CanvasResolution;
|
|
52
54
|
outputResolutionAspectAgnostic?: boolean;
|
|
53
55
|
engineConfig: EngineConfig;
|
|
@@ -72,6 +74,7 @@ export declare function createRenderRequest(input: CreateRenderRequestInput): Re
|
|
|
72
74
|
export declare function renderConfigFromRequest(request: RenderRequest, runtime?: {
|
|
73
75
|
logger?: ProducerLogger;
|
|
74
76
|
allowOutsideProjectAssets?: boolean;
|
|
77
|
+
includeOutsideScripts?: boolean;
|
|
75
78
|
}): RenderConfig;
|
|
76
79
|
export declare function distributedConfigFromRequest(request: RenderRequest, runtime?: {
|
|
77
80
|
logger?: ProducerLogger;
|
package/dist/server.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* GET /health — health check
|
|
13
13
|
* GET /outputs/:token — download rendered MP4
|
|
14
14
|
*/
|
|
15
|
+
import { type ExpectedOutputDimensions } from "./services/render/outputDimensions.js";
|
|
15
16
|
import { Hono, type Context } from "hono";
|
|
16
17
|
import { type RenderConfig } from "./services/renderOrchestrator.js";
|
|
17
18
|
import { type ProducerLogger } from "./logger.js";
|
|
@@ -78,6 +79,7 @@ interface RenderInput {
|
|
|
78
79
|
variables?: Record<string, unknown>;
|
|
79
80
|
/** Fails with `VARIABLES_INVALID` before any frame if `variables` mismatch the page's declarations. Default off. */
|
|
80
81
|
strictVariables?: boolean;
|
|
82
|
+
expectedOutputDimensions?: ExpectedOutputDimensions;
|
|
81
83
|
/**
|
|
82
84
|
* Output resolution preset (e.g. `landscape-4k`). Drives the same
|
|
83
85
|
* `resolveDeviceScaleFactor` supersampling path the local CLI uses — Chrome
|
|
@@ -18,7 +18,7 @@ export interface PrepareAnimatedGifInputsOptions {
|
|
|
18
18
|
sourceAssets?: Map<string, string>;
|
|
19
19
|
timeoutMs?: number;
|
|
20
20
|
transcode?: (input: AnimatedGifTranscodeRequest) => Promise<void>;
|
|
21
|
-
|
|
21
|
+
allowOutsideFiles?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export interface AnimatedGifTranscodeRequest {
|
|
24
24
|
inputPath: string;
|
|
@@ -36,7 +36,7 @@ export declare function splitUrlSuffix(src: string): {
|
|
|
36
36
|
suffix: string;
|
|
37
37
|
};
|
|
38
38
|
export declare function normalizeRelPath(path: string): string;
|
|
39
|
-
export declare function resolveLocalImageSourcePath(src: string, options: Pick<PrepareAnimatedGifInputsOptions, "projectDir" | "downloadDir" | "sourceAssets" | "
|
|
39
|
+
export declare function resolveLocalImageSourcePath(src: string, options: Pick<PrepareAnimatedGifInputsOptions, "projectDir" | "downloadDir" | "sourceAssets" | "allowOutsideFiles">): string | null;
|
|
40
40
|
export declare function buildAnimatedGifTranscodeArgs(input: {
|
|
41
41
|
inputPath: string;
|
|
42
42
|
outputPath: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The largest entry or sub-composition HTML file a render compiles. Compiling and probing a page
|
|
3
|
+
* runs on the render server's main thread, and their cost grows with the page's size, so one huge
|
|
4
|
+
* page would hold up every other render in the same process.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MAX_COMPOSITION_HTML_BYTES: number;
|
|
7
|
+
/**
|
|
8
|
+
* What one render may inline across every sub-composition mount. Each file is checked on its own
|
|
9
|
+
* above, but a few small files that mount each other many times assemble a page far larger.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MAX_EXPANDED_COMPOSITION_BYTES: number;
|
|
12
|
+
/** Adds up every mount a render inlines and throws once the total passes either limit. */
|
|
13
|
+
export declare class CompositionExpansionBudget {
|
|
14
|
+
private bytes;
|
|
15
|
+
private mounts;
|
|
16
|
+
charge(file: string, bytes: number): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Throws {@link CompositionTooLargeError} when `path` is a file over the limit, before anything
|
|
20
|
+
* reads it. A missing path or a folder passes, so the caller's own read reports it as before.
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertCompositionFileSize(path: string, file: string): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExpectedOutputDimensions } from "../render/outputDimensions.js";
|
|
1
2
|
import { type ReferenceBackgroundResult } from "@hyperframes/engine";
|
|
2
3
|
import { type CanvasResolution, type DistributedFps } from "@hyperframes/core";
|
|
3
4
|
import { type EngineConfig, type VideoFrameFormat, type ProresProfile, type AudioProcessingFailure } from "@hyperframes/engine";
|
|
@@ -188,6 +189,7 @@ export interface DistributedRenderConfig extends Pick<RenderRequestOptions, "pag
|
|
|
188
189
|
variables?: Record<string, unknown>;
|
|
189
190
|
/** Fails with `VARIABLES_INVALID` before any frame if `variables` mismatch the page's declarations. Default off. */
|
|
190
191
|
strictVariables?: boolean;
|
|
192
|
+
expectedOutputDimensions?: ExpectedOutputDimensions;
|
|
191
193
|
}
|
|
192
194
|
/** Shared local representation consumed by both distributed plan transports. */
|
|
193
195
|
export interface LocalExecutionPlan extends Partial<ReferenceBackgroundResult> {
|
|
@@ -203,6 +205,7 @@ export interface LocalExecutionPlan extends Partial<ReferenceBackgroundResult> {
|
|
|
203
205
|
producerVersion: string;
|
|
204
206
|
/** Present when `strictVariables` was asked; true only if this producer honoured it. */
|
|
205
207
|
strictVariablesChecked?: boolean;
|
|
208
|
+
outputDimensionsChecked?: boolean;
|
|
206
209
|
}
|
|
207
210
|
export interface BuildLocalExecutionPlanOptions {
|
|
208
211
|
/**
|
|
@@ -231,6 +234,7 @@ export interface BuildLocalExecutionPlanOptions {
|
|
|
231
234
|
readonly deferAudio?: boolean;
|
|
232
235
|
/** Trusted local callers only; see CompileForRenderOptions. Never read from config. */
|
|
233
236
|
readonly allowOutsideProjectAssets?: boolean;
|
|
237
|
+
readonly includeOutsideScripts?: boolean;
|
|
234
238
|
}
|
|
235
239
|
export interface RemoteProjectFile {
|
|
236
240
|
readonly url: string;
|
|
@@ -263,6 +267,7 @@ export interface PlanResult extends Partial<ReferenceBackgroundResult> {
|
|
|
263
267
|
producerVersion: string;
|
|
264
268
|
/** Present when `strictVariables` was asked; true only if this producer honoured it. */
|
|
265
269
|
strictVariablesChecked?: boolean;
|
|
270
|
+
outputDimensionsChecked?: boolean;
|
|
266
271
|
}
|
|
267
272
|
/** Applies the same audio correctness policy used by the in-process renderer. */
|
|
268
273
|
export declare function applyDistributedAudioWarningPolicy(job: RenderJob, audioError: string, audioFailures?: readonly AudioProcessingFailure[], log?: ProducerLogger): void;
|
|
@@ -450,4 +455,4 @@ export declare function buildPlanAudio(projectDir: string, config: DistributedRe
|
|
|
450
455
|
* @deprecated Use `planV2()` or `planV2WithPublisher()` for new integrations.
|
|
451
456
|
* This wrapper, its layout, and its result shape remain supported.
|
|
452
457
|
*/
|
|
453
|
-
export declare function plan(projectDir: string, config: DistributedRenderConfig, planDir: string, options?: Pick<BuildLocalExecutionPlanOptions, "chunksCarryAudio" | "allowOutsideProjectAssets">): Promise<PlanResult>;
|
|
458
|
+
export declare function plan(projectDir: string, config: DistributedRenderConfig, planDir: string, options?: Pick<BuildLocalExecutionPlanOptions, "chunksCarryAudio" | "allowOutsideProjectAssets" | "includeOutsideScripts">): Promise<PlanResult>;
|
|
@@ -83,6 +83,7 @@ export interface PlanV2WithPublisherOptions {
|
|
|
83
83
|
readonly deferAudio?: boolean;
|
|
84
84
|
readonly onPlanned?: (summary: {
|
|
85
85
|
readonly strictVariablesChecked?: boolean;
|
|
86
|
+
readonly outputDimensionsChecked?: boolean;
|
|
86
87
|
}) => void;
|
|
87
88
|
}
|
|
88
89
|
export interface PlanV2MaterializationResult {
|
|
@@ -15,11 +15,16 @@ export declare const isPrivateSitePath: (relPath: string) => boolean;
|
|
|
15
15
|
* (root included), top-level {@link PLAN_PROJECT_DIR_SKIP_SEGMENTS} are left out as the plan stage
|
|
16
16
|
* does, and a dangling symlink throws. Private files (env, Git, credentials, tool and agent state,
|
|
17
17
|
* app records) are left out at every depth, by name or by where a link points; `onPrivate` hears
|
|
18
|
-
* each one left out, a folder once.
|
|
18
|
+
* each one left out, a folder once. With `onOutside`, a file or folder whose link points outside
|
|
19
|
+
* the project is left out too, and `onOutside` hears it, a folder once.
|
|
19
20
|
*/
|
|
20
|
-
export declare function listSiteFiles(projectDir: string, onPrivate?: (relPath: string) => void): string[];
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
export declare function listSiteFiles(projectDir: string, onPrivate?: (relPath: string) => void, onOutside?: (relPath: string) => void): string[];
|
|
22
|
+
/**
|
|
23
|
+
* {@link listSiteFiles} for an upload: one line to `onNotice` names the private files left out.
|
|
24
|
+
* Files linked in from outside the project ship only with `includeOutsideFiles`; otherwise a second
|
|
25
|
+
* line names each one, since the person may not know a link put them in the project.
|
|
26
|
+
*/
|
|
27
|
+
export declare function listSiteFilesForUpload(projectDir: string, onNotice?: (message: string) => void, includeOutsideFiles?: boolean): string[];
|
|
23
28
|
/**
|
|
24
29
|
* SHA-256 over a scheme tag plus each of {@link listSiteFiles}'s paths and
|
|
25
30
|
* bytes → 16-character hex prefix. The prefix is the `siteId`.
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cloud-agnostic validation of a serializable `DistributedRenderConfig`.
|
|
3
|
-
*
|
|
4
|
-
* The distributed-render adapters (`@hyperframes/aws-lambda`,
|
|
5
|
-
* `@hyperframes/gcp-cloud-run`, …) all need to fail fast on shape errors
|
|
6
|
-
* *before* they start a cloud execution — a caller staring at a runtime
|
|
7
|
-
* failure minutes into a Step Functions / Cloud Workflows run shouldn't have
|
|
8
|
-
* to dig through execution history to learn they passed an unsupported
|
|
9
|
-
* format. The shape validation is identical across adapters, so it lives
|
|
10
|
-
* here; each adapter layers only its own wire-format size cap (Step
|
|
11
|
-
* Functions' 256 KiB vs Cloud Workflows' 512 KiB) on top.
|
|
12
|
-
*
|
|
13
|
-
* The check is deliberately narrow — it covers the *shape* errors any caller
|
|
14
|
-
* could have surfaced with `tsc` if they passed a literal, plus the
|
|
15
|
-
* `force-hdr` rejection (HDR mp4 isn't supported in distributed mode).
|
|
16
|
-
* Anything deeper (font availability, plan size cap, GPU mode at runtime)
|
|
17
|
-
* needs the actual planner.
|
|
18
|
-
*/
|
|
19
1
|
import { type DistributedRenderConfig } from "./plan.js";
|
|
20
2
|
/**
|
|
21
3
|
* `DistributedRenderConfig` minus the runtime-only fields (`logger`,
|
|
@@ -143,8 +143,10 @@ export interface SyntheticRenderJobInput {
|
|
|
143
143
|
/** Render-time overrides consumed by the plan browser probe. */
|
|
144
144
|
variables?: RenderConfig["variables"];
|
|
145
145
|
strictVariables?: RenderConfig["strictVariables"];
|
|
146
|
+
expectedOutputDimensions?: RenderConfig["expectedOutputDimensions"];
|
|
146
147
|
pageMotionBlur?: RenderConfig["pageMotionBlur"];
|
|
147
148
|
allowOutsideProjectAssets?: boolean;
|
|
149
|
+
includeOutsideScripts?: boolean;
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* Synthesize a `RenderJob` from a distributed-render config. The distributed
|
|
@@ -142,6 +142,7 @@ export interface FileServerOptions {
|
|
|
142
142
|
stripEmbeddedRuntime?: boolean;
|
|
143
143
|
/** Serve project symlinks that lead outside projectDir, as local preview does. Default: false. */
|
|
144
144
|
allowOutsideProjectAssets?: boolean;
|
|
145
|
+
includeOutsideScripts?: boolean;
|
|
145
146
|
}
|
|
146
147
|
export interface FileServerHandle {
|
|
147
148
|
url: string;
|
|
@@ -26,7 +26,7 @@ export interface PrepareHeifImageInputsOptions {
|
|
|
26
26
|
sourceAssets?: Map<string, string>;
|
|
27
27
|
timeoutMs?: number;
|
|
28
28
|
transcode?: (input: HeifTranscodeRequest) => Promise<void>;
|
|
29
|
-
|
|
29
|
+
allowOutsideFiles?: boolean;
|
|
30
30
|
/** Leaves an image whose conversion failed as authored and reports it, instead of throwing. */
|
|
31
31
|
onFailure?: (error: HeifImageConversionError | HeifToolUnavailableError) => void;
|
|
32
32
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RateSpec, type ResolvedDuration, type UnresolvedElement } from "@hyperframes/core";
|
|
2
|
+
import { type OutsideFilePolicy } from "../utils/paths.js";
|
|
2
3
|
import { type VideoElement, type ImageElement, type AudioElement, type AudioVolumeKeyframe } from "@hyperframes/engine";
|
|
3
4
|
import type { Page } from "puppeteer-core";
|
|
4
5
|
import { type ProducerLogger } from "../logger.js";
|
|
@@ -12,6 +13,7 @@ export interface CompiledComposition {
|
|
|
12
13
|
gradedCanvas: boolean;
|
|
13
14
|
masterFxChain?: string;
|
|
14
15
|
unresolvedCompositions: UnresolvedElement[];
|
|
16
|
+
variablesByComp: Record<string, Record<string, unknown>>;
|
|
15
17
|
/** Assets that resolve outside projectDir. Keys are the path used in HTML, values are absolute filesystem paths. */
|
|
16
18
|
externalAssets: Map<string, string>;
|
|
17
19
|
width: number;
|
|
@@ -64,7 +66,7 @@ export declare function inlineExternalScripts(html: string): Promise<string>;
|
|
|
64
66
|
*
|
|
65
67
|
* Handles: src/href attributes, CSS url(), inline style url().
|
|
66
68
|
*/
|
|
67
|
-
export declare function collectExternalAssets(html: string, projectDir: string, log?: ProducerLogger, file?: string): {
|
|
69
|
+
export declare function collectExternalAssets(html: string, projectDir: string, log?: ProducerLogger, file?: string, policy?: OutsideFilePolicy): {
|
|
68
70
|
html: string;
|
|
69
71
|
externalAssets: Map<string, string>;
|
|
70
72
|
};
|
|
@@ -201,6 +203,7 @@ export interface CompileForRenderOptions {
|
|
|
201
203
|
pageMotionBlur?: "off";
|
|
202
204
|
/** Trusted local renders only (CLI, Studio): import files markup reaches outside projectDir. */
|
|
203
205
|
allowOutsideProjectAssets?: boolean;
|
|
206
|
+
includeOutsideScripts?: boolean;
|
|
204
207
|
}
|
|
205
208
|
/**
|
|
206
209
|
* Compile an HTML composition project into a single self-contained HTML string
|
|
@@ -257,4 +260,4 @@ export declare function resolveCompositionDurations(page: Page, unresolved: Unre
|
|
|
257
260
|
* Re-compile after composition durations are resolved.
|
|
258
261
|
* Injects durations into the HTML and re-parses sub-composition media with proper bounds.
|
|
259
262
|
*/
|
|
260
|
-
export declare function recompileWithResolutions(compiled: CompiledComposition, resolutions: ResolvedDuration[], projectDir: string, downloadDir: string, assetRoot?: string): Promise<CompiledComposition>;
|
|
263
|
+
export declare function recompileWithResolutions(compiled: CompiledComposition, resolutions: ResolvedDuration[], projectDir: string, downloadDir: string, assetRoot?: string, outsideFiles?: OutsideFilePolicy): Promise<CompiledComposition>;
|
|
@@ -21,6 +21,7 @@ export declare function replaceGsapDistScripts(html: string, replace: GsapScript
|
|
|
21
21
|
export declare function stripCrossoriginAttr(html: string, tagName: "video" | "img" | "audio"): string;
|
|
22
22
|
/** `html.replace(/(<(?:video|audio)\b[^>]*?)\s+preload\s*=\s*["']none["']/gi, "$1")`. */
|
|
23
23
|
export declare function stripPreloadNone(html: string): string;
|
|
24
|
+
export declare function hasClosedMediaTag(text: string): boolean;
|
|
24
25
|
declare const REMOTE_SRC_TAGS: {
|
|
25
26
|
readonly media: {
|
|
26
27
|
readonly opener: "<(?:video|audio)\\b";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HyperframeLintResult } from "@hyperframes/lint";
|
|
2
2
|
export interface PreparedHyperframeLintInput {
|
|
3
3
|
entryFile: string;
|
|
4
4
|
html: string;
|
|
@@ -9,4 +9,10 @@ export declare function prepareHyperframeLintBody(body: Record<string, unknown>,
|
|
|
9
9
|
} | {
|
|
10
10
|
error: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export interface HyperframeLintWorkerOptions {
|
|
13
|
+
workerEntry?: string;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
heapMb?: number;
|
|
16
|
+
maxWorkers?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function runHyperframeLint(prepared: PreparedHyperframeLintInput, options?: HyperframeLintWorkerOptions): Promise<HyperframeLintResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ExpectedOutputDimensions {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function isExpectedOutputDimensions(value: unknown): value is ExpectedOutputDimensions;
|
|
6
|
+
export declare function requireOutputDimensions(expected: ExpectedOutputDimensions | undefined, width: number, height: number): void;
|
|
@@ -112,6 +112,13 @@ export declare function reportFrameProgress(job: RenderJob, stage: string, progr
|
|
|
112
112
|
export declare function reportExtractProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined): void;
|
|
113
113
|
/** Frames ffmpeg has encoded, from where capture left the bar up to 90%; same cadence as capture. */
|
|
114
114
|
export declare function reportEncodeProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined, from: number): void;
|
|
115
|
+
export declare const AUDIO_STAGE = "Processing audio tracks";
|
|
116
|
+
/** Once capture waits on the audio mix: a line at most every 5 s in which an FFmpeg of the mix wrote more, so whoever
|
|
117
|
+
* watches the render for silence hears it working, and a mix that writes nothing stays silent. */
|
|
118
|
+
export declare function audioWaitReporter(job: RenderJob, onProgress: ProgressCallback | undefined): {
|
|
119
|
+
progressed(): void;
|
|
120
|
+
wait<T>(audio: Promise<T>): Promise<T>;
|
|
121
|
+
};
|
|
115
122
|
/** Seconds of the final file written, 90% to 99%: only a complete file reaches 100. */
|
|
116
123
|
export declare function reportAssembleProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined): void;
|
|
117
124
|
export declare function forgetWorkerPhases(job: object): void;
|
|
@@ -44,6 +44,7 @@ export interface AudioStageInput {
|
|
|
44
44
|
log?: ProducerLogger;
|
|
45
45
|
/** Leave the delivered PCM in `workDir` for the assemble stage; its owner removes the dir. */
|
|
46
46
|
keepDeliverySource?: boolean;
|
|
47
|
+
onFfmpegProgress?: () => void;
|
|
47
48
|
}
|
|
48
49
|
export interface AudioStageResult {
|
|
49
50
|
/** Actual delivery attenuation, for the render warning and metadata. */
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* stage's encode if it fails.
|
|
33
33
|
*/
|
|
34
34
|
import { getEncoderPreset, type EngineConfig, type LandedFrame } from "@hyperframes/engine";
|
|
35
|
+
import { type Fps } from "@hyperframes/core";
|
|
35
36
|
import type { ProducerLogger } from "../../../logger.js";
|
|
36
37
|
import type { ProgressCallback, RenderJob } from "../../renderOrchestrator.js";
|
|
37
38
|
export interface EncodeStageInput {
|
|
@@ -103,6 +104,27 @@ export interface EncodeStageResult {
|
|
|
103
104
|
/** Wall-clock ms for the encode (or png-copy) phase. */
|
|
104
105
|
encodeMs: number;
|
|
105
106
|
}
|
|
107
|
+
export declare function overlapEncoderThreads(workerCount: number, cpuCount: number): number;
|
|
108
|
+
export declare function videoEncoderOptions(input: EncodeStageInput, engineCfg: Pick<EngineConfig, "vp9CpuUsed">, softwareEncoderThreads?: number): {
|
|
109
|
+
fps: Fps;
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
codec: "h264" | "vp9" | "h265" | "prores";
|
|
113
|
+
preset: string;
|
|
114
|
+
quality: number;
|
|
115
|
+
bitrate: string | undefined;
|
|
116
|
+
maxBitrate: string | undefined;
|
|
117
|
+
bufferSize: string | undefined;
|
|
118
|
+
pixelFormat: string;
|
|
119
|
+
vp9CpuUsed: number;
|
|
120
|
+
useGpu: boolean | undefined;
|
|
121
|
+
hdr: {
|
|
122
|
+
transfer: import("@hyperframes/engine").HdrTransfer;
|
|
123
|
+
} | undefined;
|
|
124
|
+
lockGopForChunkConcat: boolean;
|
|
125
|
+
gopSize: number | undefined;
|
|
126
|
+
softwareEncoderThreads: number | undefined;
|
|
127
|
+
};
|
|
106
128
|
/**
|
|
107
129
|
* h264 from JPEG only, software or GPU: the streaming encoder then runs the disk encoder's
|
|
108
130
|
* arguments. Needs a core the capture workers leave free.
|
|
@@ -122,5 +144,8 @@ export interface EncodeWhileCapturing {
|
|
|
122
144
|
* Feeds frames 0, 1, 2… to the encoder as each lands; capture never waits on it.
|
|
123
145
|
* On failure `finish` re-runs `runEncodeStage` on the same frames.
|
|
124
146
|
*/
|
|
125
|
-
export declare function encodeWhileCapturing(input: EncodeStageInput, totalFrames: number
|
|
147
|
+
export declare function encodeWhileCapturing(input: EncodeStageInput, totalFrames: number, captureBudget?: {
|
|
148
|
+
workerCount: number;
|
|
149
|
+
cpuCount: number;
|
|
150
|
+
}): EncodeWhileCapturing;
|
|
126
151
|
export declare function runEncodeStage(input: EncodeStageInput): Promise<EncodeStageResult>;
|
|
@@ -92,11 +92,19 @@ export declare function hasScriptedAudioVolumeAutomation(html: string, audioCoun
|
|
|
92
92
|
* comment or prose that merely mentions the attribute (issue #1938).
|
|
93
93
|
*/
|
|
94
94
|
export declare function hasAutoStartVideos(html: string): boolean;
|
|
95
|
+
type VariablesByComp = Record<string, Record<string, unknown>>;
|
|
95
96
|
/**
|
|
96
97
|
* Variable-bound sources are resolved by the browser runtime, not the static compiler. Probe them whenever the
|
|
97
|
-
* element's variable has a value (the render's, its mount's
|
|
98
|
+
* element's variable has a value (the render's, its scope's compiled table entry, its mount's, a declared default).
|
|
98
99
|
*/
|
|
99
|
-
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined): boolean;
|
|
100
|
+
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined, variablesByComp?: VariablesByComp): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Runtime-created media does not exist when the static compiler scans the HTML.
|
|
103
|
+
* Launch a browser probe so discoverMediaFromBrowser can reconcile it before
|
|
104
|
+
* extraction, even when the root duration is already known. External script
|
|
105
|
+
* sources have no inline text to inspect and remain a known heuristic gap.
|
|
106
|
+
*/
|
|
107
|
+
export declare function hasRuntimeMediaChanges(html: string): boolean;
|
|
100
108
|
/** Reported `strictVariables`: undefined if not asked; true if checked or nothing needed checking; else false. */
|
|
101
109
|
export declare function strictVariablesAttestation(config: RenderConfig, probeSession: CaptureSession | null): boolean | undefined;
|
|
102
110
|
/**
|
|
@@ -143,3 +151,4 @@ export declare function pruneMutedBrowserMedia(composition: {
|
|
|
143
151
|
tagName: string;
|
|
144
152
|
muted?: boolean;
|
|
145
153
|
}[], existingAudioIds?: Set<string>): void;
|
|
154
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExpectedOutputDimensions } from "./render/outputDimensions.js";
|
|
1
2
|
import { type CanvasResolution, type Fps, type FpsInput, type HfVfxCapture } from "@hyperframes/core";
|
|
2
3
|
import type { CompileForRenderOptions } from "./htmlCompiler.js";
|
|
3
4
|
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";
|
|
@@ -96,6 +97,7 @@ export interface RenderConfig {
|
|
|
96
97
|
/** Entry HTML file relative to projectDir. Defaults to "index.html". */
|
|
97
98
|
entryFile?: string;
|
|
98
99
|
allowOutsideProjectAssets?: CompileForRenderOptions["allowOutsideProjectAssets"];
|
|
100
|
+
includeOutsideScripts?: CompileForRenderOptions["includeOutsideScripts"];
|
|
99
101
|
/** Full producer config. When provided, env vars are not read. */
|
|
100
102
|
producerConfig?: EngineConfig;
|
|
101
103
|
/** Custom logger. Defaults to console-based defaultLogger. */
|
|
@@ -139,6 +141,7 @@ export interface RenderConfig {
|
|
|
139
141
|
*/
|
|
140
142
|
variables?: Record<string, unknown>;
|
|
141
143
|
strictVariables?: boolean;
|
|
144
|
+
expectedOutputDimensions?: ExpectedOutputDimensions;
|
|
142
145
|
/**
|
|
143
146
|
* Override the output resolution via Chrome `deviceScaleFactor` (DPR).
|
|
144
147
|
* The composition's authored dimensions are unchanged. See
|
|
@@ -264,6 +267,7 @@ export interface RenderPerfSummary {
|
|
|
264
267
|
verifiedFrames?: number;
|
|
265
268
|
reusedFrames: number;
|
|
266
269
|
skipReason?: string;
|
|
270
|
+
ineligibleCause?: string;
|
|
267
271
|
verificationOutcomes?: StaticVerificationOutcome[];
|
|
268
272
|
plannedRuns?: number;
|
|
269
273
|
completedRuns?: number;
|
|
@@ -439,6 +443,7 @@ export interface RenderStageProgress {
|
|
|
439
443
|
export interface RenderJob extends Partial<ReferenceBackgroundResult> {
|
|
440
444
|
id: string;
|
|
441
445
|
strictVariablesChecked?: boolean;
|
|
446
|
+
outputDimensionsChecked?: boolean;
|
|
442
447
|
config: RenderConfig;
|
|
443
448
|
status: RenderStatus;
|
|
444
449
|
progress: number;
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -29,11 +29,15 @@ type IsPathInsideOptions = {
|
|
|
29
29
|
export declare function isPathInside(childPath: string, parentPath: string, options?: IsPathInsideOptions): boolean;
|
|
30
30
|
/** True when `assetRoot` is set and `path`, symlinks resolved, leaves it. */
|
|
31
31
|
export declare function escapesAssetRoot(path: string, assetRoot: string | undefined): boolean;
|
|
32
|
+
export interface OutsideFilePolicy {
|
|
33
|
+
/** The person passed --include-outside-files, so scripts outside the project run too. */
|
|
34
|
+
includeScripts?: boolean;
|
|
35
|
+
}
|
|
32
36
|
/** Why a trusted local render leaves out `path`, which leads outside `projectDir`, as publish does; null to bring it in. */
|
|
33
|
-
export declare function outsideAssetRefusal(projectDir: string, path: string): LeftOutReason | null;
|
|
37
|
+
export declare function outsideAssetRefusal(projectDir: string, path: string, policy?: OutsideFilePolicy): LeftOutReason | null;
|
|
34
38
|
export declare const leftOutOfRender: (file: string, reference: string, reason: LeftOutReason) => string;
|
|
35
39
|
/** True, after a warning, when a trusted local render must not serve or copy `path`, a project file that leads outside. */
|
|
36
|
-
export declare function refusesOutsideLink(projectDir: string, path: string, warn: (line: string) => void): boolean;
|
|
40
|
+
export declare function refusesOutsideLink(projectDir: string, path: string, warn: (line: string) => void, policy?: OutsideFilePolicy): boolean;
|
|
37
41
|
/**
|
|
38
42
|
* Build a safe, cross-platform relative key for an absolute asset path
|
|
39
43
|
* that lives outside the project directory.
|
|
@@ -2,5 +2,5 @@ import { type Browser } from "puppeteer";
|
|
|
2
2
|
export interface PageCheckResult {
|
|
3
3
|
failures: string[];
|
|
4
4
|
}
|
|
5
|
-
export declare function launchVerifyBrowser(): Promise<Browser>;
|
|
5
|
+
export declare function launchVerifyBrowser(sandbox?: boolean): Promise<Browser>;
|
|
6
6
|
export declare function checkPageLoads(browser: Browser, originUrl: string, html: string, settleMs?: number): Promise<PageCheckResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.61",
|
|
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/
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/lint": "0.9.61",
|
|
39
|
+
"@hyperframes/core": "0.9.61",
|
|
40
|
+
"@hyperframes/parsers": "0.9.61",
|
|
41
|
+
"@hyperframes/studio-server": "0.9.61",
|
|
42
|
+
"@hyperframes/engine": "0.9.61"
|
|
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.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.61"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|