@hyperframes/producer 0.9.33 → 0.9.35
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 +30 -6
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/index.js +57 -14
- package/dist/public-server.js +41 -9
- package/dist/renderRequest.d.ts +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/services/distributed/plan.d.ts +6 -0
- package/dist/services/distributed/planV2.d.ts +3 -0
- package/dist/services/distributed/shared.d.ts +1 -0
- package/dist/services/render/stages/probeStage.d.ts +7 -12
- package/dist/services/renderOrchestrator.d.ts +2 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -6472,6 +6472,7 @@ import {
|
|
|
6472
6472
|
readTextFile,
|
|
6473
6473
|
resolveCompositionSrc
|
|
6474
6474
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6475
|
+
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
6475
6476
|
|
|
6476
6477
|
// src/services/renderMediaCollector.ts
|
|
6477
6478
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7469,6 +7470,7 @@ function normalizeCompositionSrcs(html, projectDir) {
|
|
|
7469
7470
|
return `${name}${quote}${relative2(projectDir, file).split(sep2).join("/")}${quote}`;
|
|
7470
7471
|
});
|
|
7471
7472
|
}
|
|
7473
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
|
|
7472
7474
|
function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */ new Set()) {
|
|
7473
7475
|
const { document: document2 } = parseHTML5(html);
|
|
7474
7476
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -7482,6 +7484,10 @@ function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */
|
|
|
7482
7484
|
problems.push({ srcPath, detail: "it is outside the project folder" });
|
|
7483
7485
|
continue;
|
|
7484
7486
|
}
|
|
7487
|
+
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
7488
|
+
problems.push({ srcPath, detail: "it is git metadata or an env file" });
|
|
7489
|
+
continue;
|
|
7490
|
+
}
|
|
7485
7491
|
if (visited.has(filePath)) continue;
|
|
7486
7492
|
const read = readProjectFile(filePath);
|
|
7487
7493
|
if (read.kind === "missing") {
|
|
@@ -7785,7 +7791,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
7785
7791
|
const srcPath = el.getAttribute("data-composition-src");
|
|
7786
7792
|
if (!srcPath) continue;
|
|
7787
7793
|
const filePath = resolveCompositionSrc(projectDir, srcPath);
|
|
7788
|
-
if (filePath === null) continue;
|
|
7794
|
+
if (filePath === null || isPrivateCompositionFile(projectDir, filePath)) continue;
|
|
7789
7795
|
if (visited.has(filePath)) {
|
|
7790
7796
|
continue;
|
|
7791
7797
|
}
|
|
@@ -7982,7 +7988,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
7982
7988
|
let compHtml = subCompositions.get(srcPath) || null;
|
|
7983
7989
|
if (!compHtml) {
|
|
7984
7990
|
const filePath = resolveCompositionSrc(projectDir, srcPath);
|
|
7985
|
-
const read = filePath ? readProjectFile(filePath) : null;
|
|
7991
|
+
const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
|
|
7986
7992
|
if (read?.kind === "file") {
|
|
7987
7993
|
compHtml = rewriteUnresolvableGsapToCdn(read.text, projectDir, srcPath);
|
|
7988
7994
|
}
|
|
@@ -9481,8 +9487,15 @@ function hasRuntimeMediaChanges(html) {
|
|
|
9481
9487
|
}
|
|
9482
9488
|
return false;
|
|
9483
9489
|
}
|
|
9490
|
+
function checksVariablesInBrowser(config) {
|
|
9491
|
+
return config.strictVariables === true && Object.keys(config.variables ?? {}).length > 0;
|
|
9492
|
+
}
|
|
9493
|
+
function strictVariablesAttestation(config, probeSession) {
|
|
9494
|
+
if (config.strictVariables !== true) return void 0;
|
|
9495
|
+
return !checksVariablesInBrowser(config) || probeSession?.strictVariablesChecked === true;
|
|
9496
|
+
}
|
|
9484
9497
|
function probeRequiresBrowser(args) {
|
|
9485
|
-
return args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
|
|
9498
|
+
return args.requiresVariablesCheck === true || args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
|
|
9486
9499
|
}
|
|
9487
9500
|
function reportedLengthSource(source) {
|
|
9488
9501
|
if (!source) return null;
|
|
@@ -9530,7 +9543,8 @@ async function runProbeStage(input) {
|
|
|
9530
9543
|
hasAutoStart,
|
|
9531
9544
|
hasScriptedAudio,
|
|
9532
9545
|
hasVariableMedia,
|
|
9533
|
-
hasInsertedMedia
|
|
9546
|
+
hasInsertedMedia,
|
|
9547
|
+
requiresVariablesCheck: checksVariablesInBrowser(job.config)
|
|
9534
9548
|
});
|
|
9535
9549
|
try {
|
|
9536
9550
|
if (needsBrowser) {
|
|
@@ -9564,6 +9578,7 @@ async function runProbeStage(input) {
|
|
|
9564
9578
|
job.config.quality
|
|
9565
9579
|
),
|
|
9566
9580
|
variables: job.config.variables,
|
|
9581
|
+
strictVariables: job.config.strictVariables,
|
|
9567
9582
|
deviceScaleFactor,
|
|
9568
9583
|
motionBlur,
|
|
9569
9584
|
pageMotionBlur: job.config.pageMotionBlur,
|
|
@@ -9969,6 +9984,7 @@ async function runProbeStage(input) {
|
|
|
9969
9984
|
}
|
|
9970
9985
|
}
|
|
9971
9986
|
return {
|
|
9987
|
+
strictVariablesChecked: strictVariablesAttestation(job.config, probeSession),
|
|
9972
9988
|
compiled,
|
|
9973
9989
|
fileServer,
|
|
9974
9990
|
probeSession,
|
|
@@ -14486,6 +14502,7 @@ async function executeRenderPipeline(input) {
|
|
|
14486
14502
|
compositionHash = computeCompositionObservabilityHash(compiled.html);
|
|
14487
14503
|
fileServer = probeResult.fileServer;
|
|
14488
14504
|
probeSession = probeResult.probeSession;
|
|
14505
|
+
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
14489
14506
|
lastBrowserConsole = probeResult.lastBrowserConsole;
|
|
14490
14507
|
let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
|
|
14491
14508
|
if (resolvedCaptureBeyondViewport !== void 0) {
|
|
@@ -17017,6 +17034,7 @@ function buildSyntheticRenderJob(input) {
|
|
|
17017
17034
|
strictness: input.strictness,
|
|
17018
17035
|
producerConfig: input.producerConfig,
|
|
17019
17036
|
variables: input.variables,
|
|
17037
|
+
strictVariables: input.strictVariables,
|
|
17020
17038
|
pageMotionBlur: input.pageMotionBlur
|
|
17021
17039
|
};
|
|
17022
17040
|
return createRenderJob(renderConfig);
|
|
@@ -18490,6 +18508,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18490
18508
|
logger: config.logger,
|
|
18491
18509
|
producerConfig: cfg,
|
|
18492
18510
|
variables: config.variables,
|
|
18511
|
+
strictVariables: config.strictVariables,
|
|
18493
18512
|
pageMotionBlur: config.pageMotionBlur
|
|
18494
18513
|
});
|
|
18495
18514
|
const entryFile = config.entryFile ?? "index.html";
|
|
@@ -18602,6 +18621,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18602
18621
|
logPlanStage(log, "reference_background", stageStarted);
|
|
18603
18622
|
}
|
|
18604
18623
|
compiled = probeResult.compiled;
|
|
18624
|
+
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
18605
18625
|
job.duration = probeResult.duration;
|
|
18606
18626
|
job.totalFrames = probeResult.totalFrames;
|
|
18607
18627
|
const totalFrames = probeResult.totalFrames;
|
|
@@ -18949,7 +18969,8 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
18949
18969
|
height,
|
|
18950
18970
|
format: config.format,
|
|
18951
18971
|
ffmpegVersion,
|
|
18952
|
-
producerVersion
|
|
18972
|
+
producerVersion,
|
|
18973
|
+
...job.strictVariablesChecked === void 0 ? {} : { strictVariablesChecked: job.strictVariablesChecked }
|
|
18953
18974
|
};
|
|
18954
18975
|
}
|
|
18955
18976
|
async function plan(projectDir, config, planDir, options = {}) {
|
|
@@ -18966,7 +18987,8 @@ async function plan(projectDir, config, planDir, options = {}) {
|
|
|
18966
18987
|
height: executionPlan.height,
|
|
18967
18988
|
format: executionPlan.format,
|
|
18968
18989
|
ffmpegVersion: executionPlan.ffmpegVersion,
|
|
18969
|
-
producerVersion: executionPlan.producerVersion
|
|
18990
|
+
producerVersion: executionPlan.producerVersion,
|
|
18991
|
+
...executionPlan.strictVariablesChecked === void 0 ? {} : { strictVariablesChecked: executionPlan.strictVariablesChecked }
|
|
18970
18992
|
};
|
|
18971
18993
|
}
|
|
18972
18994
|
|
|
@@ -19576,7 +19598,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19576
19598
|
const stagingRoot = createStagingDir6(options.stagingParentDir ?? tmpdir3(), ".execution-plan-");
|
|
19577
19599
|
const digests = /* @__PURE__ */ new Map();
|
|
19578
19600
|
try {
|
|
19579
|
-
await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
19601
|
+
const planned = await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
19580
19602
|
executionPlanSizeLimitBytes: Number.MAX_SAFE_INTEGER,
|
|
19581
19603
|
deferVideoExtraction: true,
|
|
19582
19604
|
remoteFiles: options.remoteFiles,
|
|
@@ -19592,6 +19614,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19592
19614
|
sliceChunkAudio: true,
|
|
19593
19615
|
deferAudio: options.deferAudio
|
|
19594
19616
|
});
|
|
19617
|
+
options.onPlanned?.({ strictVariablesChecked: planned.strictVariablesChecked });
|
|
19595
19618
|
return await publishExecutionPlan(stagingRoot, publisher, { digests, log: config.logger });
|
|
19596
19619
|
} catch (error) {
|
|
19597
19620
|
try {
|
|
@@ -20667,7 +20690,8 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
20667
20690
|
"ENCODER_INTERRUPTED",
|
|
20668
20691
|
"RENDER_TOO_SLOW",
|
|
20669
20692
|
"RENDER_STAGE_STALLED",
|
|
20670
|
-
"PAGE_NEVER_READY"
|
|
20693
|
+
"PAGE_NEVER_READY",
|
|
20694
|
+
"VARIABLES_INVALID"
|
|
20671
20695
|
]);
|
|
20672
20696
|
function extractSafeRenderErrorCode(error) {
|
|
20673
20697
|
if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
|
|
@@ -20886,6 +20910,9 @@ function validateDistributedRenderConfig(config) {
|
|
|
20886
20910
|
if (config.variables !== void 0) {
|
|
20887
20911
|
validateVariablesPayload(config.variables);
|
|
20888
20912
|
}
|
|
20913
|
+
if (config.strictVariables !== void 0 && typeof config.strictVariables !== "boolean") {
|
|
20914
|
+
throw new InvalidConfigError("config.strictVariables", "must be a boolean");
|
|
20915
|
+
}
|
|
20889
20916
|
if (config.engineConfig !== void 0) {
|
|
20890
20917
|
try {
|
|
20891
20918
|
validateEngineConfigSnapshot(config.engineConfig);
|
|
@@ -21080,6 +21107,9 @@ function assertRequestOptionObjects(options) {
|
|
|
21080
21107
|
if (options.variables !== void 0 && !isPlainObject(options.variables)) {
|
|
21081
21108
|
throw new Error("Render request variables must be a JSON object");
|
|
21082
21109
|
}
|
|
21110
|
+
if (options.strictVariables !== void 0 && typeof options.strictVariables !== "boolean") {
|
|
21111
|
+
throw new Error("Render request strictVariables must be a boolean");
|
|
21112
|
+
}
|
|
21083
21113
|
if (options.distributed !== void 0) assertDistributedOptions(options.distributed);
|
|
21084
21114
|
}
|
|
21085
21115
|
function assertRequestOptions(options) {
|
|
@@ -21192,7 +21222,8 @@ function distributedConfigFromRequest(request, runtime = {}) {
|
|
|
21192
21222
|
strictness: options.strictness,
|
|
21193
21223
|
abortSignal: runtime.abortSignal,
|
|
21194
21224
|
planDirSizeLimitBytes: distributed.planDirSizeLimitBytes,
|
|
21195
|
-
variables: options.variables
|
|
21225
|
+
variables: options.variables,
|
|
21226
|
+
strictVariables: options.strictVariables
|
|
21196
21227
|
};
|
|
21197
21228
|
}
|
|
21198
21229
|
function optionalProperty(key, value) {
|
|
@@ -21233,7 +21264,8 @@ function renderRequestFromDistributedConfig(input) {
|
|
|
21233
21264
|
...optionalProperty("hdrMode", config.hdrMode),
|
|
21234
21265
|
...optionalProperty("strictness", config.strictness),
|
|
21235
21266
|
...optionalProperty("entryFile", config.entryFile),
|
|
21236
|
-
...optionalProperty("variables", config.variables)
|
|
21267
|
+
...optionalProperty("variables", config.variables),
|
|
21268
|
+
...optionalProperty("strictVariables", config.strictVariables)
|
|
21237
21269
|
};
|
|
21238
21270
|
return createRenderRequest({
|
|
21239
21271
|
projectDir: input.projectDir,
|
|
@@ -21517,6 +21549,9 @@ function extractSafeRenderErrorMetadata(error) {
|
|
|
21517
21549
|
...isPlainObject2(publicMetadata) ? { errorMetadata: publicMetadata } : {}
|
|
21518
21550
|
};
|
|
21519
21551
|
}
|
|
21552
|
+
function strictVariablesResult(job) {
|
|
21553
|
+
return job.strictVariablesChecked === void 0 ? {} : { strictVariablesChecked: job.strictVariablesChecked };
|
|
21554
|
+
}
|
|
21520
21555
|
function parseServerFps(value) {
|
|
21521
21556
|
if (typeof value !== "number" && typeof value !== "string") return DEFAULT_SERVER_FPS;
|
|
21522
21557
|
const parsed = parseFps(value);
|
|
@@ -21575,7 +21610,7 @@ function parseRenderOptions(body) {
|
|
|
21575
21610
|
bufferSize,
|
|
21576
21611
|
chromaSubsampling
|
|
21577
21612
|
} = encoder.ok ? encoder.options : {};
|
|
21578
|
-
const { variables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
|
|
21613
|
+
const { variables, strictVariables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
|
|
21579
21614
|
return {
|
|
21580
21615
|
outputPath,
|
|
21581
21616
|
fps,
|
|
@@ -21596,6 +21631,7 @@ function parseRenderOptions(body) {
|
|
|
21596
21631
|
format,
|
|
21597
21632
|
outputDynamicRange,
|
|
21598
21633
|
variables,
|
|
21634
|
+
strictVariables,
|
|
21599
21635
|
outputResolution,
|
|
21600
21636
|
outputResolutionAspectAgnostic,
|
|
21601
21637
|
videoFrameFormat
|
|
@@ -21606,10 +21642,11 @@ function isPlainObject2(value) {
|
|
|
21606
21642
|
}
|
|
21607
21643
|
function parseRenderOverrides(body) {
|
|
21608
21644
|
const variables = isPlainObject2(body.variables) ? body.variables : void 0;
|
|
21645
|
+
const strictVariables = body.strictVariables === true ? true : void 0;
|
|
21609
21646
|
const rawOutputResolution = typeof body.outputResolution === "string" ? body.outputResolution : void 0;
|
|
21610
21647
|
const outputResolution = rawOutputResolution ? normalizeResolutionFlag(rawOutputResolution) : void 0;
|
|
21611
21648
|
const outputResolutionAspectAgnostic = outputResolution ? isAspectAgnosticResolutionAlias(rawOutputResolution) : void 0;
|
|
21612
|
-
return { variables, outputResolution, outputResolutionAspectAgnostic };
|
|
21649
|
+
return { variables, strictVariables, outputResolution, outputResolutionAspectAgnostic };
|
|
21613
21650
|
}
|
|
21614
21651
|
function buildRenderJobConfig(input, outputPath, log) {
|
|
21615
21652
|
const request = createRenderRequest({
|
|
@@ -21633,6 +21670,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
21633
21670
|
strictness: input.strictness,
|
|
21634
21671
|
entryFile: input.entryFile,
|
|
21635
21672
|
variables: input.variables,
|
|
21673
|
+
strictVariables: input.strictVariables,
|
|
21636
21674
|
outputResolution: input.outputResolution,
|
|
21637
21675
|
outputResolutionAspectAgnostic: input.outputResolutionAspectAgnostic,
|
|
21638
21676
|
videoFrameFormat: input.videoFrameFormat,
|
|
@@ -21671,6 +21709,9 @@ function validateRenderOverrides(body) {
|
|
|
21671
21709
|
if (body.variables !== void 0 && !isPlainObject2(body.variables)) {
|
|
21672
21710
|
return 'variables must be a JSON object keyed by variable id (e.g. {"title":"Hello"})';
|
|
21673
21711
|
}
|
|
21712
|
+
if (body.strictVariables !== void 0 && typeof body.strictVariables !== "boolean") {
|
|
21713
|
+
return "strictVariables must be a boolean";
|
|
21714
|
+
}
|
|
21674
21715
|
if (body.outputDynamicRange !== void 0 && parseServerOutputDynamicRange(body.outputDynamicRange) === void 0) {
|
|
21675
21716
|
return 'outputDynamicRange must be one of: "auto", "hdr", "sdr"';
|
|
21676
21717
|
}
|
|
@@ -21989,7 +22030,8 @@ function createRenderHandlers(options = {}) {
|
|
|
21989
22030
|
videoDurationSeconds: job.duration ?? null,
|
|
21990
22031
|
outcome: job.outcome ?? "completed",
|
|
21991
22032
|
warnings: job.warnings,
|
|
21992
|
-
perf: job.perfSummary ?? null
|
|
22033
|
+
perf: job.perfSummary ?? null,
|
|
22034
|
+
...strictVariablesResult(job)
|
|
21993
22035
|
});
|
|
21994
22036
|
} catch (error) {
|
|
21995
22037
|
const durationMs = Date.now() - t0;
|
|
@@ -22085,7 +22127,8 @@ function createRenderHandlers(options = {}) {
|
|
|
22085
22127
|
outcome: job.outcome ?? "completed",
|
|
22086
22128
|
warnings: job.warnings,
|
|
22087
22129
|
perf: job.perfSummary ?? null,
|
|
22088
|
-
producerVersion: readProducerVersion()
|
|
22130
|
+
producerVersion: readProducerVersion(),
|
|
22131
|
+
...strictVariablesResult(job)
|
|
22089
22132
|
})
|
|
22090
22133
|
});
|
|
22091
22134
|
} catch (error) {
|
package/dist/public-server.js
CHANGED
|
@@ -6485,6 +6485,7 @@ import {
|
|
|
6485
6485
|
readTextFile,
|
|
6486
6486
|
resolveCompositionSrc
|
|
6487
6487
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6488
|
+
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
6488
6489
|
|
|
6489
6490
|
// src/services/renderMediaCollector.ts
|
|
6490
6491
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7482,6 +7483,7 @@ function normalizeCompositionSrcs(html, projectDir) {
|
|
|
7482
7483
|
return `${name}${quote}${relative2(projectDir, file).split(sep2).join("/")}${quote}`;
|
|
7483
7484
|
});
|
|
7484
7485
|
}
|
|
7486
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
|
|
7485
7487
|
function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */ new Set()) {
|
|
7486
7488
|
const { document: document2 } = parseHTML5(html);
|
|
7487
7489
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -7495,6 +7497,10 @@ function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */
|
|
|
7495
7497
|
problems.push({ srcPath, detail: "it is outside the project folder" });
|
|
7496
7498
|
continue;
|
|
7497
7499
|
}
|
|
7500
|
+
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
7501
|
+
problems.push({ srcPath, detail: "it is git metadata or an env file" });
|
|
7502
|
+
continue;
|
|
7503
|
+
}
|
|
7498
7504
|
if (visited.has(filePath)) continue;
|
|
7499
7505
|
const read = readProjectFile(filePath);
|
|
7500
7506
|
if (read.kind === "missing") {
|
|
@@ -7798,7 +7804,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
7798
7804
|
const srcPath = el.getAttribute("data-composition-src");
|
|
7799
7805
|
if (!srcPath) continue;
|
|
7800
7806
|
const filePath = resolveCompositionSrc(projectDir, srcPath);
|
|
7801
|
-
if (filePath === null) continue;
|
|
7807
|
+
if (filePath === null || isPrivateCompositionFile(projectDir, filePath)) continue;
|
|
7802
7808
|
if (visited.has(filePath)) {
|
|
7803
7809
|
continue;
|
|
7804
7810
|
}
|
|
@@ -7995,7 +8001,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
7995
8001
|
let compHtml = subCompositions.get(srcPath) || null;
|
|
7996
8002
|
if (!compHtml) {
|
|
7997
8003
|
const filePath = resolveCompositionSrc(projectDir, srcPath);
|
|
7998
|
-
const read = filePath ? readProjectFile(filePath) : null;
|
|
8004
|
+
const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
|
|
7999
8005
|
if (read?.kind === "file") {
|
|
8000
8006
|
compHtml = rewriteUnresolvableGsapToCdn(read.text, projectDir, srcPath);
|
|
8001
8007
|
}
|
|
@@ -9491,8 +9497,15 @@ function hasRuntimeMediaChanges(html) {
|
|
|
9491
9497
|
}
|
|
9492
9498
|
return false;
|
|
9493
9499
|
}
|
|
9500
|
+
function checksVariablesInBrowser(config) {
|
|
9501
|
+
return config.strictVariables === true && Object.keys(config.variables ?? {}).length > 0;
|
|
9502
|
+
}
|
|
9503
|
+
function strictVariablesAttestation(config, probeSession) {
|
|
9504
|
+
if (config.strictVariables !== true) return void 0;
|
|
9505
|
+
return !checksVariablesInBrowser(config) || probeSession?.strictVariablesChecked === true;
|
|
9506
|
+
}
|
|
9494
9507
|
function probeRequiresBrowser(args) {
|
|
9495
|
-
return args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
|
|
9508
|
+
return args.requiresVariablesCheck === true || args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
|
|
9496
9509
|
}
|
|
9497
9510
|
function reportedLengthSource(source) {
|
|
9498
9511
|
if (!source) return null;
|
|
@@ -9540,7 +9553,8 @@ async function runProbeStage(input) {
|
|
|
9540
9553
|
hasAutoStart,
|
|
9541
9554
|
hasScriptedAudio,
|
|
9542
9555
|
hasVariableMedia,
|
|
9543
|
-
hasInsertedMedia
|
|
9556
|
+
hasInsertedMedia,
|
|
9557
|
+
requiresVariablesCheck: checksVariablesInBrowser(job.config)
|
|
9544
9558
|
});
|
|
9545
9559
|
try {
|
|
9546
9560
|
if (needsBrowser) {
|
|
@@ -9574,6 +9588,7 @@ async function runProbeStage(input) {
|
|
|
9574
9588
|
job.config.quality
|
|
9575
9589
|
),
|
|
9576
9590
|
variables: job.config.variables,
|
|
9591
|
+
strictVariables: job.config.strictVariables,
|
|
9577
9592
|
deviceScaleFactor,
|
|
9578
9593
|
motionBlur,
|
|
9579
9594
|
pageMotionBlur: job.config.pageMotionBlur,
|
|
@@ -9979,6 +9994,7 @@ async function runProbeStage(input) {
|
|
|
9979
9994
|
}
|
|
9980
9995
|
}
|
|
9981
9996
|
return {
|
|
9997
|
+
strictVariablesChecked: strictVariablesAttestation(job.config, probeSession),
|
|
9982
9998
|
compiled,
|
|
9983
9999
|
fileServer,
|
|
9984
10000
|
probeSession,
|
|
@@ -14459,6 +14475,7 @@ async function executeRenderPipeline(input) {
|
|
|
14459
14475
|
compositionHash = computeCompositionObservabilityHash(compiled.html);
|
|
14460
14476
|
fileServer = probeResult.fileServer;
|
|
14461
14477
|
probeSession = probeResult.probeSession;
|
|
14478
|
+
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
14462
14479
|
lastBrowserConsole = probeResult.lastBrowserConsole;
|
|
14463
14480
|
let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
|
|
14464
14481
|
if (resolvedCaptureBeyondViewport !== void 0) {
|
|
@@ -16843,6 +16860,9 @@ function assertRequestOptionObjects(options) {
|
|
|
16843
16860
|
if (options.variables !== void 0 && !isPlainObject(options.variables)) {
|
|
16844
16861
|
throw new Error("Render request variables must be a JSON object");
|
|
16845
16862
|
}
|
|
16863
|
+
if (options.strictVariables !== void 0 && typeof options.strictVariables !== "boolean") {
|
|
16864
|
+
throw new Error("Render request strictVariables must be a boolean");
|
|
16865
|
+
}
|
|
16846
16866
|
if (options.distributed !== void 0) assertDistributedOptions(options.distributed);
|
|
16847
16867
|
}
|
|
16848
16868
|
function assertRequestOptions(options) {
|
|
@@ -16917,7 +16937,8 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
16917
16937
|
"ENCODER_INTERRUPTED",
|
|
16918
16938
|
"RENDER_TOO_SLOW",
|
|
16919
16939
|
"RENDER_STAGE_STALLED",
|
|
16920
|
-
"PAGE_NEVER_READY"
|
|
16940
|
+
"PAGE_NEVER_READY",
|
|
16941
|
+
"VARIABLES_INVALID"
|
|
16921
16942
|
]);
|
|
16922
16943
|
function extractSafeRenderErrorCode(error) {
|
|
16923
16944
|
if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
|
|
@@ -16941,6 +16962,9 @@ function extractSafeRenderErrorMetadata(error) {
|
|
|
16941
16962
|
...isPlainObject2(publicMetadata) ? { errorMetadata: publicMetadata } : {}
|
|
16942
16963
|
};
|
|
16943
16964
|
}
|
|
16965
|
+
function strictVariablesResult(job) {
|
|
16966
|
+
return job.strictVariablesChecked === void 0 ? {} : { strictVariablesChecked: job.strictVariablesChecked };
|
|
16967
|
+
}
|
|
16944
16968
|
function parseServerFps(value) {
|
|
16945
16969
|
if (typeof value !== "number" && typeof value !== "string") return DEFAULT_SERVER_FPS;
|
|
16946
16970
|
const parsed = parseFps(value);
|
|
@@ -16999,7 +17023,7 @@ function parseRenderOptions(body) {
|
|
|
16999
17023
|
bufferSize,
|
|
17000
17024
|
chromaSubsampling
|
|
17001
17025
|
} = encoder.ok ? encoder.options : {};
|
|
17002
|
-
const { variables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
|
|
17026
|
+
const { variables, strictVariables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
|
|
17003
17027
|
return {
|
|
17004
17028
|
outputPath,
|
|
17005
17029
|
fps,
|
|
@@ -17020,6 +17044,7 @@ function parseRenderOptions(body) {
|
|
|
17020
17044
|
format,
|
|
17021
17045
|
outputDynamicRange,
|
|
17022
17046
|
variables,
|
|
17047
|
+
strictVariables,
|
|
17023
17048
|
outputResolution,
|
|
17024
17049
|
outputResolutionAspectAgnostic,
|
|
17025
17050
|
videoFrameFormat
|
|
@@ -17030,10 +17055,11 @@ function isPlainObject2(value) {
|
|
|
17030
17055
|
}
|
|
17031
17056
|
function parseRenderOverrides(body) {
|
|
17032
17057
|
const variables = isPlainObject2(body.variables) ? body.variables : void 0;
|
|
17058
|
+
const strictVariables = body.strictVariables === true ? true : void 0;
|
|
17033
17059
|
const rawOutputResolution = typeof body.outputResolution === "string" ? body.outputResolution : void 0;
|
|
17034
17060
|
const outputResolution = rawOutputResolution ? normalizeResolutionFlag(rawOutputResolution) : void 0;
|
|
17035
17061
|
const outputResolutionAspectAgnostic = outputResolution ? isAspectAgnosticResolutionAlias(rawOutputResolution) : void 0;
|
|
17036
|
-
return { variables, outputResolution, outputResolutionAspectAgnostic };
|
|
17062
|
+
return { variables, strictVariables, outputResolution, outputResolutionAspectAgnostic };
|
|
17037
17063
|
}
|
|
17038
17064
|
function buildRenderJobConfig(input, outputPath, log) {
|
|
17039
17065
|
const request = createRenderRequest({
|
|
@@ -17057,6 +17083,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
17057
17083
|
strictness: input.strictness,
|
|
17058
17084
|
entryFile: input.entryFile,
|
|
17059
17085
|
variables: input.variables,
|
|
17086
|
+
strictVariables: input.strictVariables,
|
|
17060
17087
|
outputResolution: input.outputResolution,
|
|
17061
17088
|
outputResolutionAspectAgnostic: input.outputResolutionAspectAgnostic,
|
|
17062
17089
|
videoFrameFormat: input.videoFrameFormat,
|
|
@@ -17095,6 +17122,9 @@ function validateRenderOverrides(body) {
|
|
|
17095
17122
|
if (body.variables !== void 0 && !isPlainObject2(body.variables)) {
|
|
17096
17123
|
return 'variables must be a JSON object keyed by variable id (e.g. {"title":"Hello"})';
|
|
17097
17124
|
}
|
|
17125
|
+
if (body.strictVariables !== void 0 && typeof body.strictVariables !== "boolean") {
|
|
17126
|
+
return "strictVariables must be a boolean";
|
|
17127
|
+
}
|
|
17098
17128
|
if (body.outputDynamicRange !== void 0 && parseServerOutputDynamicRange(body.outputDynamicRange) === void 0) {
|
|
17099
17129
|
return 'outputDynamicRange must be one of: "auto", "hdr", "sdr"';
|
|
17100
17130
|
}
|
|
@@ -17413,7 +17443,8 @@ function createRenderHandlers(options = {}) {
|
|
|
17413
17443
|
videoDurationSeconds: job.duration ?? null,
|
|
17414
17444
|
outcome: job.outcome ?? "completed",
|
|
17415
17445
|
warnings: job.warnings,
|
|
17416
|
-
perf: job.perfSummary ?? null
|
|
17446
|
+
perf: job.perfSummary ?? null,
|
|
17447
|
+
...strictVariablesResult(job)
|
|
17417
17448
|
});
|
|
17418
17449
|
} catch (error) {
|
|
17419
17450
|
const durationMs = Date.now() - t0;
|
|
@@ -17509,7 +17540,8 @@ function createRenderHandlers(options = {}) {
|
|
|
17509
17540
|
outcome: job.outcome ?? "completed",
|
|
17510
17541
|
warnings: job.warnings,
|
|
17511
17542
|
perf: job.perfSummary ?? null,
|
|
17512
|
-
producerVersion: readProducerVersion()
|
|
17543
|
+
producerVersion: readProducerVersion(),
|
|
17544
|
+
...strictVariablesResult(job)
|
|
17513
17545
|
})
|
|
17514
17546
|
});
|
|
17515
17547
|
} catch (error) {
|
package/dist/renderRequest.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface RenderRequestOptions {
|
|
|
47
47
|
chromaSubsampling?: RenderConfig["chromaSubsampling"];
|
|
48
48
|
pageMotionBlur?: RenderConfig["pageMotionBlur"];
|
|
49
49
|
variables?: Record<string, unknown>;
|
|
50
|
+
strictVariables?: boolean;
|
|
50
51
|
outputResolution?: CanvasResolution;
|
|
51
52
|
outputResolutionAspectAgnostic?: boolean;
|
|
52
53
|
engineConfig: EngineConfig;
|
package/dist/server.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ interface RenderInput {
|
|
|
64
64
|
* composition's declared defaults, ignoring per-request overrides.
|
|
65
65
|
*/
|
|
66
66
|
variables?: Record<string, unknown>;
|
|
67
|
+
/** Fails with `VARIABLES_INVALID` before any frame if `variables` mismatch the page's declarations. Default off. */
|
|
68
|
+
strictVariables?: boolean;
|
|
67
69
|
/**
|
|
68
70
|
* Output resolution preset (e.g. `landscape-4k`). Drives the same
|
|
69
71
|
* `resolveDeviceScaleFactor` supersampling path the local CLI uses — Chrome
|
|
@@ -186,6 +186,8 @@ export interface DistributedRenderConfig extends Pick<RenderRequestOptions, "pag
|
|
|
186
186
|
* rather than mid-plan; the producer-side throw is the fallback.
|
|
187
187
|
*/
|
|
188
188
|
variables?: Record<string, unknown>;
|
|
189
|
+
/** Fails with `VARIABLES_INVALID` before any frame if `variables` mismatch the page's declarations. Default off. */
|
|
190
|
+
strictVariables?: boolean;
|
|
189
191
|
}
|
|
190
192
|
/** Shared local representation consumed by both distributed plan transports. */
|
|
191
193
|
export interface LocalExecutionPlan extends Partial<ReferenceBackgroundResult> {
|
|
@@ -199,6 +201,8 @@ export interface LocalExecutionPlan extends Partial<ReferenceBackgroundResult> {
|
|
|
199
201
|
format: DistributedFormat;
|
|
200
202
|
ffmpegVersion: string;
|
|
201
203
|
producerVersion: string;
|
|
204
|
+
/** Present when `strictVariables` was asked; true only if this producer honoured it. */
|
|
205
|
+
strictVariablesChecked?: boolean;
|
|
202
206
|
}
|
|
203
207
|
export interface BuildLocalExecutionPlanOptions {
|
|
204
208
|
/**
|
|
@@ -255,6 +259,8 @@ export interface PlanResult extends Partial<ReferenceBackgroundResult> {
|
|
|
255
259
|
format: DistributedFormat;
|
|
256
260
|
ffmpegVersion: string;
|
|
257
261
|
producerVersion: string;
|
|
262
|
+
/** Present when `strictVariables` was asked; true only if this producer honoured it. */
|
|
263
|
+
strictVariablesChecked?: boolean;
|
|
258
264
|
}
|
|
259
265
|
/** Applies the same audio correctness policy used by the in-process renderer. */
|
|
260
266
|
export declare function applyDistributedAudioWarningPolicy(job: RenderJob, audioError: string, audioFailures?: readonly AudioProcessingFailure[], log?: ProducerLogger): void;
|
|
@@ -81,6 +81,9 @@ export interface PlanV2WithPublisherOptions {
|
|
|
81
81
|
readonly remoteFiles?: BuildLocalExecutionPlanOptions["remoteFiles"];
|
|
82
82
|
readonly chunksCarryAudio?: boolean;
|
|
83
83
|
readonly deferAudio?: boolean;
|
|
84
|
+
readonly onPlanned?: (summary: {
|
|
85
|
+
readonly strictVariablesChecked?: boolean;
|
|
86
|
+
}) => void;
|
|
84
87
|
}
|
|
85
88
|
export interface PlanV2MaterializationResult {
|
|
86
89
|
readonly planDir: string;
|
|
@@ -142,6 +142,7 @@ export interface SyntheticRenderJobInput {
|
|
|
142
142
|
producerConfig?: RenderConfig["producerConfig"];
|
|
143
143
|
/** Render-time overrides consumed by the plan browser probe. */
|
|
144
144
|
variables?: RenderConfig["variables"];
|
|
145
|
+
strictVariables?: RenderConfig["strictVariables"];
|
|
145
146
|
pageMotionBlur?: RenderConfig["pageMotionBlur"];
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
@@ -30,7 +30,7 @@ import type { CompiledComposition } from "../../htmlCompiler.js";
|
|
|
30
30
|
import { type FileServerHandle } from "../../fileServer.js";
|
|
31
31
|
import type { ProducerLogger } from "../../../logger.js";
|
|
32
32
|
import { type CompositionMetadata } from "../shared.js";
|
|
33
|
-
import type { RenderJob } from "../../renderOrchestrator.js";
|
|
33
|
+
import type { RenderConfig, RenderJob } from "../../renderOrchestrator.js";
|
|
34
34
|
export interface ProbeStageInput {
|
|
35
35
|
projectDir: string;
|
|
36
36
|
workDir: string;
|
|
@@ -58,6 +58,7 @@ export interface ProbeStageInput {
|
|
|
58
58
|
staticDedupMemo?: StaticDedupMemo;
|
|
59
59
|
}
|
|
60
60
|
export interface ProbeStageResult {
|
|
61
|
+
strictVariablesChecked: boolean | undefined;
|
|
61
62
|
/** May be reassigned from `recompileWithResolutions`. */
|
|
62
63
|
compiled: CompiledComposition;
|
|
63
64
|
/** Created when `needsBrowser` was true; `null` otherwise. */
|
|
@@ -95,18 +96,11 @@ export declare function hasAutoStartVideos(html: string): boolean;
|
|
|
95
96
|
* element's variable has a value (the render's, its mount's `data-variable-values`, a declared default).
|
|
96
97
|
*/
|
|
97
98
|
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined): boolean;
|
|
99
|
+
/** Reported `strictVariables`: undefined if not asked; true if checked or nothing needed checking; else false. */
|
|
100
|
+
export declare function strictVariablesAttestation(config: RenderConfig, probeSession: CaptureSession | null): boolean | undefined;
|
|
98
101
|
/**
|
|
99
|
-
* Does this render need a browser probe at all?
|
|
100
|
-
*
|
|
101
|
-
* Extracted as a pure predicate because whether a probe runs decides whether
|
|
102
|
-
* a LIVE DOM element count is available downstream, and the short-comp
|
|
103
|
-
* inversion band fails closed without one (see
|
|
104
|
-
* `resolveCompositionElementCount` / `resolveDeShortBand`). Notably NONE of
|
|
105
|
-
* these conditions fire for a known-duration, media-free composition that
|
|
106
|
-
* builds thousands of `div`/`span` nodes in its own init script —
|
|
107
|
-
* `hasRuntimeMediaChanges` matches only media creation/source changes — so
|
|
108
|
-
* that shape is measured statically and must never reach the band's `applied`
|
|
109
|
-
* cohort (review finding, R4).
|
|
102
|
+
* Does this render need a browser probe at all? A pure predicate, because a probe decides whether a LIVE DOM element
|
|
103
|
+
* count exists downstream, and the short-comp inversion band fails closed without one.
|
|
110
104
|
*/
|
|
111
105
|
export declare function probeRequiresBrowser(args: {
|
|
112
106
|
durationSeconds: number;
|
|
@@ -115,6 +109,7 @@ export declare function probeRequiresBrowser(args: {
|
|
|
115
109
|
hasScriptedAudio: boolean;
|
|
116
110
|
hasVariableMedia: boolean;
|
|
117
111
|
hasInsertedMedia: boolean;
|
|
112
|
+
requiresVariablesCheck?: boolean;
|
|
118
113
|
}): boolean;
|
|
119
114
|
export type ReportedLengthSource = {
|
|
120
115
|
from: Exclude<CompositionLengthSource["from"], "media">;
|
|
@@ -136,6 +136,7 @@ export interface RenderConfig {
|
|
|
136
136
|
* `--variables-file <path>`. Must be a JSON-serializable plain object.
|
|
137
137
|
*/
|
|
138
138
|
variables?: Record<string, unknown>;
|
|
139
|
+
strictVariables?: boolean;
|
|
139
140
|
/**
|
|
140
141
|
* Override the output resolution via Chrome `deviceScaleFactor` (DPR).
|
|
141
142
|
* The composition's authored dimensions are unchanged. See
|
|
@@ -435,6 +436,7 @@ export interface RenderStageProgress {
|
|
|
435
436
|
}
|
|
436
437
|
export interface RenderJob extends Partial<ReferenceBackgroundResult> {
|
|
437
438
|
id: string;
|
|
439
|
+
strictVariablesChecked?: boolean;
|
|
438
440
|
config: RenderConfig;
|
|
439
441
|
status: RenderStatus;
|
|
440
442
|
progress: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.35",
|
|
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.11.0",
|
|
37
37
|
"puppeteer-core": "^25.11.0",
|
|
38
|
-
"@hyperframes/
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.35",
|
|
39
|
+
"@hyperframes/engine": "0.9.35",
|
|
40
|
+
"@hyperframes/lint": "0.9.35",
|
|
41
|
+
"@hyperframes/parsers": "0.9.35",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.35"
|
|
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.11",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.35"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|