@hyperframes/producer 0.9.59 → 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 +380 -150
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/index.js +407 -162
- package/dist/public-server.js +362 -143
- 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 +4 -2
- package/dist/services/htmlTagScans.d.ts +1 -0
- package/dist/services/render/outputDimensions.d.ts +6 -0
- package/dist/services/render/stages/encodeStage.d.ts +26 -1
- package/dist/services/render/stages/probeStage.d.ts +7 -0
- 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/public-server.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/services/render/outputDimensions.ts
|
|
4
|
+
function isExpectedOutputDimensions(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && "width" in value && "height" in value && typeof value.width === "number" && typeof value.height === "number" && Number.isSafeInteger(value.width) && Number.isSafeInteger(value.height) && value.width > 0 && value.height > 0;
|
|
6
|
+
}
|
|
7
|
+
var OutputDimensionsMismatchError = class extends Error {
|
|
8
|
+
code = "OUTPUT_DIMENSIONS_MISMATCH";
|
|
9
|
+
constructor() {
|
|
10
|
+
super("Compiled output dimensions do not match the requested render dimensions.");
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function requireOutputDimensions(expected, width, height) {
|
|
14
|
+
if (expected !== void 0 && (!isExpectedOutputDimensions(expected) || expected.width !== width || expected.height !== height)) {
|
|
15
|
+
throw new OutputDimensionsMismatchError();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
// src/server.ts
|
|
4
20
|
import {
|
|
5
21
|
existsSync as existsSync25,
|
|
6
22
|
mkdirSync as mkdirSync13,
|
|
7
|
-
statSync as
|
|
23
|
+
statSync as statSync13,
|
|
8
24
|
mkdtempSync,
|
|
9
25
|
writeFileSync as writeFileSync8,
|
|
10
26
|
rmSync as rmSync13,
|
|
@@ -32,7 +48,7 @@ import {
|
|
|
32
48
|
mkdirSync as mkdirSync12,
|
|
33
49
|
readdirSync as readdirSync6,
|
|
34
50
|
rmSync as rmSync12,
|
|
35
|
-
statSync as
|
|
51
|
+
statSync as statSync11,
|
|
36
52
|
writeFileSync as writeFileSync7,
|
|
37
53
|
copyFileSync as copyFileSync5,
|
|
38
54
|
appendFileSync
|
|
@@ -200,6 +216,10 @@ function stripPreloadNone(html) {
|
|
|
200
216
|
return attr && attr.index < tagEnd ? [attr.index, attr.index + attr[0].length] : void 0;
|
|
201
217
|
});
|
|
202
218
|
}
|
|
219
|
+
function hasClosedMediaTag(text) {
|
|
220
|
+
const open = /<(?:video|audio)\b/i.exec(text);
|
|
221
|
+
return open !== null && text.includes(">", open.index + open[0].length);
|
|
222
|
+
}
|
|
203
223
|
var REMOTE_SRC_TAGS = {
|
|
204
224
|
media: { opener: "<(?:video|audio)\\b", attr: /\bsrc\s*=\s*["'](https?:\/\/)/gi },
|
|
205
225
|
source: { opener: "<source\\b", attr: /\bsrc\s*=\s*["'](https?:\/\/)/gi },
|
|
@@ -548,6 +568,7 @@ import { isSafePath } from "@hyperframes/core/safe-path";
|
|
|
548
568
|
import {
|
|
549
569
|
isCopiedOutsideFileType,
|
|
550
570
|
isPrivateOutsideFile,
|
|
571
|
+
isUploadedOutsideFileType,
|
|
551
572
|
leftOutWarning,
|
|
552
573
|
linksOutside
|
|
553
574
|
} from "@hyperframes/studio-server/outside-file";
|
|
@@ -569,15 +590,17 @@ function isPathInside(childPath, parentPath, options = {}) {
|
|
|
569
590
|
function escapesAssetRoot(path, assetRoot) {
|
|
570
591
|
return assetRoot !== void 0 && !isSafePath(assetRoot, path);
|
|
571
592
|
}
|
|
572
|
-
function outsideAssetRefusal(projectDir, path) {
|
|
593
|
+
function outsideAssetRefusal(projectDir, path, policy = {}) {
|
|
573
594
|
if (!linksOutside(projectDir, path)) return null;
|
|
574
595
|
if (isPrivateOutsideFile(projectDir, path)) return "blocklisted";
|
|
575
596
|
const folder = statSync(path, { throwIfNoEntry: false })?.isDirectory();
|
|
576
|
-
|
|
597
|
+
if (folder || isUploadedOutsideFileType(path)) return null;
|
|
598
|
+
if (!isCopiedOutsideFileType(path)) return "file_type";
|
|
599
|
+
return policy.includeScripts ? null : "script";
|
|
577
600
|
}
|
|
578
601
|
var leftOutOfRender = (file, reference, reason) => leftOutWarning(file, reference, reason, "render");
|
|
579
|
-
function refusesOutsideLink(projectDir, path, warn) {
|
|
580
|
-
const refusal = outsideAssetRefusal(projectDir, path);
|
|
602
|
+
function refusesOutsideLink(projectDir, path, warn, policy = {}) {
|
|
603
|
+
const refusal = outsideAssetRefusal(projectDir, path, policy);
|
|
581
604
|
if (!refusal) return false;
|
|
582
605
|
const file = nodeRelative(projectDir, path).split(sep).join("/");
|
|
583
606
|
warn(leftOutOfRender(file, realFilePath(path), refusal));
|
|
@@ -1160,7 +1183,8 @@ function createFileServer(options) {
|
|
|
1160
1183
|
compiledDir,
|
|
1161
1184
|
port = 0,
|
|
1162
1185
|
stripEmbeddedRuntime = true,
|
|
1163
|
-
allowOutsideProjectAssets = false
|
|
1186
|
+
allowOutsideProjectAssets = false,
|
|
1187
|
+
includeOutsideScripts = false
|
|
1164
1188
|
} = options;
|
|
1165
1189
|
const preHeadScripts = [
|
|
1166
1190
|
HF_EARLY_STUB,
|
|
@@ -1171,6 +1195,7 @@ function createFileServer(options) {
|
|
|
1171
1195
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
1172
1196
|
const app = new Hono();
|
|
1173
1197
|
const warnLeftOut = (line) => console.warn(`[FileServer] ${terminalText2(line)}`);
|
|
1198
|
+
const outsidePolicy = { includeScripts: includeOutsideScripts };
|
|
1174
1199
|
let listeningPort = -1;
|
|
1175
1200
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
1176
1201
|
await next();
|
|
@@ -1188,7 +1213,7 @@ function createFileServer(options) {
|
|
|
1188
1213
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
1189
1214
|
if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
|
|
1190
1215
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
1191
|
-
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
1216
|
+
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut, outsidePolicy)) continue;
|
|
1192
1217
|
file = openRegularFile(candidate);
|
|
1193
1218
|
if (file) break;
|
|
1194
1219
|
}
|
|
@@ -2748,9 +2773,10 @@ function frameWeightedAvgMs(perfs, avgOf) {
|
|
|
2748
2773
|
function aggregateDedup(perfs) {
|
|
2749
2774
|
if (perfs.length === 0) return void 0;
|
|
2750
2775
|
const armed = perfs.some((p) => p.staticDedupArmed);
|
|
2751
|
-
const
|
|
2752
|
-
...new Set(
|
|
2753
|
-
|
|
2776
|
+
const distinctUnarmed = (values) => {
|
|
2777
|
+
const distinct = armed ? [] : [...new Set(values.filter((v) => !!v))].sort();
|
|
2778
|
+
return distinct.length > 0 ? distinct.join("|") : void 0;
|
|
2779
|
+
};
|
|
2754
2780
|
const verificationPerfs = perfs.filter((perf) => perf.staticDedupVerificationOutcome);
|
|
2755
2781
|
const verificationOutcomes = [
|
|
2756
2782
|
...new Set(
|
|
@@ -2762,7 +2788,8 @@ function aggregateDedup(perfs) {
|
|
|
2762
2788
|
armed,
|
|
2763
2789
|
predictedFrames: perfs.reduce((sum, p) => sum + (p.staticDedupPredicted ?? 0), 0),
|
|
2764
2790
|
reusedFrames: perfs.reduce((sum, p) => sum + (p.staticDedupReused ?? 0), 0),
|
|
2765
|
-
skipReason:
|
|
2791
|
+
skipReason: distinctUnarmed(perfs.map((p) => p.staticDedupSkipReason)),
|
|
2792
|
+
ineligibleCause: distinctUnarmed(perfs.map((p) => p.staticDedupIneligibleCause)),
|
|
2766
2793
|
...verificationPerfs.length === 0 ? {} : {
|
|
2767
2794
|
verifiedFrames: verificationPerfs.reduce(
|
|
2768
2795
|
(sum, perf) => sum + (perf.staticDedupVerified ?? 0),
|
|
@@ -6900,6 +6927,61 @@ import { suggestMatchingPreset } from "@hyperframes/core";
|
|
|
6900
6927
|
import { extractStandaloneEntryFromIndex, isTemplateEntry } from "@hyperframes/core/compiler";
|
|
6901
6928
|
import { readTextFile as readTextFile2 } from "@hyperframes/parsers/asset-resolution";
|
|
6902
6929
|
|
|
6930
|
+
// src/services/compositionSizeLimit.ts
|
|
6931
|
+
import { statSync as statSync7 } from "node:fs";
|
|
6932
|
+
var MAX_COMPOSITION_HTML_BYTES = 16 * 1024 * 1024;
|
|
6933
|
+
var COMPOSITION_TOO_LARGE = "COMPOSITION_TOO_LARGE";
|
|
6934
|
+
var megabytes = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
6935
|
+
var MAX_EXPANDED_COMPOSITION_BYTES = 2 * MAX_COMPOSITION_HTML_BYTES;
|
|
6936
|
+
var MAX_COMPOSITION_MOUNTS = 1e4;
|
|
6937
|
+
var CompositionTooLargeError = class extends Error {
|
|
6938
|
+
constructor(message, publicMetadata) {
|
|
6939
|
+
super(message);
|
|
6940
|
+
this.publicMetadata = publicMetadata;
|
|
6941
|
+
this.name = "CompositionTooLargeError";
|
|
6942
|
+
}
|
|
6943
|
+
publicMetadata;
|
|
6944
|
+
code = COMPOSITION_TOO_LARGE;
|
|
6945
|
+
// The producer server reads these off the error for the wire envelope.
|
|
6946
|
+
owner = "user";
|
|
6947
|
+
retryable = false;
|
|
6948
|
+
};
|
|
6949
|
+
var fileTooLarge = (file, bytes) => new CompositionTooLargeError(
|
|
6950
|
+
`Composition file "${file}" is ${megabytes(bytes)}, over the ${megabytes(MAX_COMPOSITION_HTML_BYTES)} limit for one composition HTML file. Keep large data such as images, fonts and JSON in separate asset files and reference them by path instead of inlining them.`,
|
|
6951
|
+
{ bytes, limitBytes: MAX_COMPOSITION_HTML_BYTES }
|
|
6952
|
+
);
|
|
6953
|
+
var CompositionExpansionBudget = class {
|
|
6954
|
+
bytes = 0;
|
|
6955
|
+
mounts = 0;
|
|
6956
|
+
charge(file, bytes) {
|
|
6957
|
+
this.bytes += bytes;
|
|
6958
|
+
this.mounts += 1;
|
|
6959
|
+
if (this.bytes <= MAX_EXPANDED_COMPOSITION_BYTES && this.mounts <= MAX_COMPOSITION_MOUNTS) {
|
|
6960
|
+
return;
|
|
6961
|
+
}
|
|
6962
|
+
throw new CompositionTooLargeError(
|
|
6963
|
+
`Sub-composition mounts, ending at "${file}", add up to ${megabytes(this.bytes)} across ${this.mounts} mounts. One render inlines at most ${megabytes(MAX_EXPANDED_COMPOSITION_BYTES)} of composition HTML in at most ${MAX_COMPOSITION_MOUNTS} mounts. Mount large or repeated scenes fewer times.`,
|
|
6964
|
+
{
|
|
6965
|
+
bytes: this.bytes,
|
|
6966
|
+
limitBytes: MAX_EXPANDED_COMPOSITION_BYTES,
|
|
6967
|
+
mounts: this.mounts,
|
|
6968
|
+
exceeded: this.mounts > MAX_COMPOSITION_MOUNTS ? "mounts" : "bytes"
|
|
6969
|
+
}
|
|
6970
|
+
);
|
|
6971
|
+
}
|
|
6972
|
+
};
|
|
6973
|
+
function assertCompositionFileSize(path, file) {
|
|
6974
|
+
let bytes;
|
|
6975
|
+
try {
|
|
6976
|
+
const stats = statSync7(path);
|
|
6977
|
+
if (!stats.isFile()) return;
|
|
6978
|
+
bytes = stats.size;
|
|
6979
|
+
} catch {
|
|
6980
|
+
return;
|
|
6981
|
+
}
|
|
6982
|
+
if (bytes > MAX_COMPOSITION_HTML_BYTES) throw fileTooLarge(file, bytes);
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6903
6985
|
// src/services/htmlCompiler.ts
|
|
6904
6986
|
import { decodedUrlPath } from "@hyperframes/parsers/asset-paths";
|
|
6905
6987
|
import {
|
|
@@ -6986,11 +7068,13 @@ import {
|
|
|
6986
7068
|
import {
|
|
6987
7069
|
isUnresolvedAssetPlaceholder,
|
|
6988
7070
|
namesAnotherNetworkRoot as namesAnotherNetworkRoot2,
|
|
7071
|
+
projectAssetExists,
|
|
6989
7072
|
readProjectFile,
|
|
6990
7073
|
readTextFile,
|
|
6991
7074
|
resolveCompositionSrc
|
|
6992
7075
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6993
7076
|
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
7077
|
+
import { linksOutside as linksOutside2 } from "@hyperframes/studio-server/outside-file";
|
|
6994
7078
|
|
|
6995
7079
|
// src/services/renderMediaCollector.ts
|
|
6996
7080
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7184,7 +7268,7 @@ import {
|
|
|
7184
7268
|
|
|
7185
7269
|
// src/services/animatedGifPrep.ts
|
|
7186
7270
|
import { createHash as createHash4 } from "node:crypto";
|
|
7187
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync6, rmSync as rmSync9, statSync as
|
|
7271
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync6, rmSync as rmSync9, statSync as statSync8 } from "node:fs";
|
|
7188
7272
|
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join16, resolve as resolve5 } from "node:path";
|
|
7189
7273
|
import { parseHTML as parseHTML3 } from "linkedom";
|
|
7190
7274
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
@@ -7237,12 +7321,13 @@ function resolveLocalImageSourcePath(src, options) {
|
|
|
7237
7321
|
isAbsolute2(basePath) ? basePath : resolve5(options.projectDir, projectRelative),
|
|
7238
7322
|
resolve5(options.downloadDir, normalizedBase)
|
|
7239
7323
|
];
|
|
7240
|
-
const
|
|
7324
|
+
const assetRoot = options.allowOutsideFiles ? void 0 : options.projectDir;
|
|
7325
|
+
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && !isPrivateUnderAssetRoots(candidate, [options.projectDir, options.downloadDir]) && (!escapesAssetRoot(candidate, assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
|
|
7241
7326
|
return candidates.find((candidate) => allowed(candidate) && existsSync9(candidate)) ?? null;
|
|
7242
7327
|
}
|
|
7243
7328
|
function isUsableFile(path) {
|
|
7244
7329
|
try {
|
|
7245
|
-
const stat =
|
|
7330
|
+
const stat = statSync8(path);
|
|
7246
7331
|
return stat.isFile() && stat.size > 0;
|
|
7247
7332
|
} catch {
|
|
7248
7333
|
return false;
|
|
@@ -7507,7 +7592,7 @@ import {
|
|
|
7507
7592
|
readFileSync as readFileSync7,
|
|
7508
7593
|
readSync as readSync3,
|
|
7509
7594
|
rmSync as rmSync10,
|
|
7510
|
-
statSync as
|
|
7595
|
+
statSync as statSync9,
|
|
7511
7596
|
writeFileSync as writeFileSync4
|
|
7512
7597
|
} from "node:fs";
|
|
7513
7598
|
import { dirname as dirname7, join as join17, resolve as resolve6 } from "node:path";
|
|
@@ -7751,7 +7836,7 @@ function resolveImageSource(src, options) {
|
|
|
7751
7836
|
}
|
|
7752
7837
|
function isUsableFile2(path) {
|
|
7753
7838
|
try {
|
|
7754
|
-
return
|
|
7839
|
+
return statSync9(path).size > 0;
|
|
7755
7840
|
} catch {
|
|
7756
7841
|
return false;
|
|
7757
7842
|
}
|
|
@@ -8030,7 +8115,7 @@ Check that each file referenced by data-composition-src contains valid HTML with
|
|
|
8030
8115
|
};
|
|
8031
8116
|
function normalizeCompositionSrcs(html, projectDir) {
|
|
8032
8117
|
return html.replace(/(\bdata-composition-src=)(["'])([^"']*)\2/g, (whole, name, quote, value) => {
|
|
8033
|
-
if (!value.includes("%") &&
|
|
8118
|
+
if (!value.includes("%") && !/^\.?[\\/]/.test(value)) return whole;
|
|
8034
8119
|
const file = resolveCompositionSrc(projectDir, value);
|
|
8035
8120
|
if (file === null) return whole;
|
|
8036
8121
|
return `${name}${quote}${relative2(projectDir, file).split(sep3).join("/")}${quote}`;
|
|
@@ -8046,68 +8131,94 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
8046
8131
|
const file = resolveCompositionPath(projectDir, src, assetRoot);
|
|
8047
8132
|
return file !== null && COMPOSITION_FILE.test(file) ? file : null;
|
|
8048
8133
|
}
|
|
8134
|
+
var OUTSIDE_COMPOSITION_NEEDS_FLAG = "it is outside the project, and any scripts in it would run; move it into the project, or pass --include-outside-files to hyperframes render, to include it";
|
|
8135
|
+
var runsOutsideMarkupUnasked = (projectDir, filePath, assetRoot, outsideFiles) => assetRoot === void 0 && !outsideFiles.includeScripts && linksOutside2(projectDir, filePath);
|
|
8136
|
+
function assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles) {
|
|
8137
|
+
if (runsOutsideMarkupUnasked(projectDir, filePath, assetRoot, outsideFiles)) {
|
|
8138
|
+
throw new EmptyCompositionError([{ srcPath, detail: OUTSIDE_COMPOSITION_NEEDS_FLAG }]);
|
|
8139
|
+
}
|
|
8140
|
+
}
|
|
8049
8141
|
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
|
|
8050
|
-
|
|
8142
|
+
var mountSrcsUnder = (root) => [...root.querySelectorAll("[data-composition-src]")].map((el) => el.getAttribute("data-composition-src")).filter((srcPath) => !!srcPath && !isUnresolvedAssetPlaceholder(srcPath));
|
|
8143
|
+
function compositionSrcsIn(html) {
|
|
8051
8144
|
const { document: document2 } = parseHTML5(html);
|
|
8052
|
-
const
|
|
8053
|
-
const
|
|
8054
|
-
for (
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8145
|
+
const templated = [];
|
|
8146
|
+
const templates = [...document2.querySelectorAll("template")];
|
|
8147
|
+
for (let template = templates.pop(); template; template = templates.pop()) {
|
|
8148
|
+
templated.push(...mountSrcsUnder(template.content));
|
|
8149
|
+
templates.push(...template.content.querySelectorAll("template"));
|
|
8150
|
+
}
|
|
8151
|
+
return { mounts: mountSrcsUnder(document2), templated };
|
|
8152
|
+
}
|
|
8153
|
+
function compositionPathProblem(projectDir, filePath, assetRoot, outsideFiles) {
|
|
8154
|
+
if (outsideAssetRefusal(projectDir, filePath) === "blocklisted") {
|
|
8155
|
+
return "it is outside the project in a private location";
|
|
8156
|
+
}
|
|
8157
|
+
if (runsOutsideMarkupUnasked(projectDir, filePath, assetRoot, outsideFiles)) {
|
|
8158
|
+
return OUTSIDE_COMPOSITION_NEEDS_FLAG;
|
|
8159
|
+
}
|
|
8160
|
+
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
8161
|
+
return "it is git metadata, an env file or a private tool record";
|
|
8162
|
+
}
|
|
8163
|
+
return COMPOSITION_FILE.test(filePath) ? null : NOT_A_COMPOSITION_FILE;
|
|
8164
|
+
}
|
|
8165
|
+
function readSubCompositionFile(filePath, srcPath) {
|
|
8166
|
+
assertCompositionFileSize(filePath, srcPath);
|
|
8167
|
+
const read = readProjectFile(filePath);
|
|
8168
|
+
if (read.kind === "missing") return { detail: "the file does not exist" };
|
|
8169
|
+
if (read.kind === "folder") return { detail: "it is a folder, not an HTML file" };
|
|
8170
|
+
const validity = checkSubCompositionUsability(read.text, parseSubCompHtmlForValidity);
|
|
8171
|
+
if (!validity.ok)
|
|
8172
|
+
return { detail: validity.detail ?? "the file is empty or could not be parsed" };
|
|
8173
|
+
return { bytes: Buffer.byteLength(read.text), ...compositionSrcsIn(read.text) };
|
|
8174
|
+
}
|
|
8175
|
+
function assertSubCompositionsUsable(html, projectDir, assetRoot, outsideFiles) {
|
|
8176
|
+
const budget = new CompositionExpansionBudget();
|
|
8177
|
+
const files = /* @__PURE__ */ new Map();
|
|
8178
|
+
const problems = /* @__PURE__ */ new Map();
|
|
8179
|
+
const report = (srcPath, detail) => problems.set(`${srcPath}\0${detail}`, { srcPath, detail });
|
|
8180
|
+
const chain = /* @__PURE__ */ new Set();
|
|
8181
|
+
const paths = /* @__PURE__ */ new Map();
|
|
8182
|
+
const resolveMount = (srcPath) => {
|
|
8058
8183
|
const filePath = resolveCompositionPath(projectDir, srcPath, assetRoot);
|
|
8059
|
-
if (filePath === null) {
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
srcPath,
|
|
8070
|
-
detail: "it is git metadata, an env file or a private tool record"
|
|
8071
|
-
});
|
|
8072
|
-
continue;
|
|
8073
|
-
}
|
|
8074
|
-
if (!COMPOSITION_FILE.test(filePath)) {
|
|
8075
|
-
problems.push({ srcPath, detail: NOT_A_COMPOSITION_FILE });
|
|
8076
|
-
continue;
|
|
8077
|
-
}
|
|
8078
|
-
if (visited.has(filePath)) continue;
|
|
8079
|
-
const read = readProjectFile(filePath);
|
|
8080
|
-
if (read.kind === "missing") {
|
|
8081
|
-
problems.push({ srcPath, detail: "the file does not exist" });
|
|
8082
|
-
continue;
|
|
8083
|
-
}
|
|
8084
|
-
if (read.kind === "folder") {
|
|
8085
|
-
problems.push({ srcPath, detail: "it is a folder, not an HTML file" });
|
|
8086
|
-
continue;
|
|
8087
|
-
}
|
|
8088
|
-
const fileHtml = read.text;
|
|
8089
|
-
const validity = checkSubCompositionUsability(fileHtml, parseSubCompHtmlForValidity);
|
|
8090
|
-
if (!validity.ok) {
|
|
8091
|
-
problems.push({
|
|
8092
|
-
srcPath,
|
|
8093
|
-
detail: validity.detail ?? "the file is empty or could not be parsed"
|
|
8094
|
-
});
|
|
8095
|
-
continue;
|
|
8096
|
-
}
|
|
8097
|
-
const nestedVisited = new Set(visited);
|
|
8098
|
-
nestedVisited.add(filePath);
|
|
8099
|
-
try {
|
|
8100
|
-
assertSubCompositionsUsable(fileHtml, projectDir, assetRoot, nestedVisited);
|
|
8101
|
-
} catch (err) {
|
|
8102
|
-
if (err instanceof EmptyCompositionError) {
|
|
8103
|
-
problems.push(...err.problems);
|
|
8104
|
-
} else {
|
|
8105
|
-
throw err;
|
|
8184
|
+
if (filePath === null) return { detail: "it is outside the project folder" };
|
|
8185
|
+
const detail = compositionPathProblem(projectDir, filePath, assetRoot, outsideFiles);
|
|
8186
|
+
return detail ? { detail } : { filePath };
|
|
8187
|
+
};
|
|
8188
|
+
const walk = (srcPaths, quiet) => {
|
|
8189
|
+
for (const srcPath of srcPaths) {
|
|
8190
|
+
let resolved = paths.get(srcPath);
|
|
8191
|
+
if (!resolved) {
|
|
8192
|
+
resolved = resolveMount(srcPath);
|
|
8193
|
+
paths.set(srcPath, resolved);
|
|
8106
8194
|
}
|
|
8195
|
+
if ("detail" in resolved) {
|
|
8196
|
+
if (!quiet) report(srcPath, resolved.detail);
|
|
8197
|
+
continue;
|
|
8198
|
+
}
|
|
8199
|
+
const { filePath } = resolved;
|
|
8200
|
+
if (chain.has(filePath)) continue;
|
|
8201
|
+
let file = files.get(filePath);
|
|
8202
|
+
if (!file) {
|
|
8203
|
+
file = readSubCompositionFile(filePath, srcPath);
|
|
8204
|
+
files.set(filePath, file);
|
|
8205
|
+
}
|
|
8206
|
+
if ("detail" in file) {
|
|
8207
|
+
if (!quiet) report(srcPath, file.detail);
|
|
8208
|
+
continue;
|
|
8209
|
+
}
|
|
8210
|
+
budget.charge(srcPath, file.bytes);
|
|
8211
|
+
chain.add(filePath);
|
|
8212
|
+
walk(file.mounts, quiet);
|
|
8213
|
+
walk(file.templated, true);
|
|
8214
|
+
chain.delete(filePath);
|
|
8107
8215
|
}
|
|
8108
|
-
}
|
|
8109
|
-
|
|
8110
|
-
|
|
8216
|
+
};
|
|
8217
|
+
const entry = compositionSrcsIn(html);
|
|
8218
|
+
walk(entry.mounts, false);
|
|
8219
|
+
walk(entry.templated, true);
|
|
8220
|
+
if (problems.size > 0) {
|
|
8221
|
+
throw new EmptyCompositionError([...problems.values()]);
|
|
8111
8222
|
}
|
|
8112
8223
|
}
|
|
8113
8224
|
var COMPILER_MOUNT_BLOCK_START = "/* __HF_COMPILER_MOUNT_START__ */";
|
|
@@ -8362,7 +8473,7 @@ async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlB
|
|
|
8362
8473
|
compiledHtml = stripCrossoriginAttr(compiledHtml, "audio");
|
|
8363
8474
|
return { html: compiledHtml, unresolvedCompositions };
|
|
8364
8475
|
}
|
|
8365
|
-
async function parseSubCompositions(html, projectDir, downloadDir, visited = /* @__PURE__ */ new Set(), urlByAbsentLocalPath, probes, assetRoot) {
|
|
8476
|
+
async function parseSubCompositions(html, projectDir, downloadDir, visited = /* @__PURE__ */ new Set(), urlByAbsentLocalPath, probes, assetRoot, outsideFiles = {}, compiledSrcs = /* @__PURE__ */ new Set()) {
|
|
8366
8477
|
const subCompositions = /* @__PURE__ */ new Map();
|
|
8367
8478
|
const { document: document2 } = parseHTML5(html);
|
|
8368
8479
|
const compEls = document2.querySelectorAll("[data-composition-src]");
|
|
@@ -8375,6 +8486,10 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
8375
8486
|
if (visited.has(filePath)) {
|
|
8376
8487
|
continue;
|
|
8377
8488
|
}
|
|
8489
|
+
if (compiledSrcs.has(srcPath)) continue;
|
|
8490
|
+
compiledSrcs.add(srcPath);
|
|
8491
|
+
assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
|
|
8492
|
+
assertCompositionFileSize(filePath, srcPath);
|
|
8378
8493
|
const read = readProjectFile(filePath);
|
|
8379
8494
|
if (read.kind !== "file") {
|
|
8380
8495
|
continue;
|
|
@@ -8403,7 +8518,9 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
8403
8518
|
item.nestedVisited,
|
|
8404
8519
|
urlByAbsentLocalPath,
|
|
8405
8520
|
probes,
|
|
8406
|
-
assetRoot
|
|
8521
|
+
assetRoot,
|
|
8522
|
+
outsideFiles,
|
|
8523
|
+
compiledSrcs
|
|
8407
8524
|
);
|
|
8408
8525
|
return {
|
|
8409
8526
|
srcPath: item.srcPath,
|
|
@@ -8539,7 +8656,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
8539
8656
|
}
|
|
8540
8657
|
return document2.toString();
|
|
8541
8658
|
}
|
|
8542
|
-
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot) {
|
|
8659
|
+
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles) {
|
|
8543
8660
|
const { document: document2 } = parseHTML5(html);
|
|
8544
8661
|
const head = document2.querySelector("head");
|
|
8545
8662
|
const body = document2.querySelector("body");
|
|
@@ -8552,6 +8669,27 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8552
8669
|
);
|
|
8553
8670
|
return { html: emitted ? document2.toString() : html, variablesByComp: {} };
|
|
8554
8671
|
}
|
|
8672
|
+
const budget = new CompositionExpansionBudget();
|
|
8673
|
+
const readOnce = /* @__PURE__ */ new Map();
|
|
8674
|
+
const readMountHtml = (srcPath) => {
|
|
8675
|
+
const filePath = resolveCompositionFile(projectDir, srcPath, assetRoot);
|
|
8676
|
+
if (filePath) {
|
|
8677
|
+
assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
|
|
8678
|
+
assertCompositionFileSize(filePath, srcPath);
|
|
8679
|
+
}
|
|
8680
|
+
const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
|
|
8681
|
+
return read?.kind === "file" ? rewriteUnresolvableGsapToCdn(
|
|
8682
|
+
normalizeCompositionSrcs(read.text, projectDir),
|
|
8683
|
+
projectDir,
|
|
8684
|
+
srcPath
|
|
8685
|
+
) : null;
|
|
8686
|
+
};
|
|
8687
|
+
const resolveMountHtml = (srcPath) => {
|
|
8688
|
+
const compiled = subCompositions.get(srcPath);
|
|
8689
|
+
if (compiled) return compiled;
|
|
8690
|
+
if (!readOnce.has(srcPath)) readOnce.set(srcPath, readMountHtml(srcPath));
|
|
8691
|
+
return readOnce.get(srcPath) ?? null;
|
|
8692
|
+
};
|
|
8555
8693
|
const hostIdentityByElement = new ProducerHostIdentityMap(
|
|
8556
8694
|
document2,
|
|
8557
8695
|
hosts
|
|
@@ -8567,20 +8705,14 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8567
8705
|
readVariableDefaults: readDeclaredDefaults,
|
|
8568
8706
|
parseHostVariables: parseHostVariableValues,
|
|
8569
8707
|
resolveHtml: (srcPath) => {
|
|
8570
|
-
|
|
8571
|
-
if (
|
|
8572
|
-
const filePath = resolveCompositionFile(projectDir, srcPath, assetRoot);
|
|
8573
|
-
const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
|
|
8574
|
-
if (read?.kind === "file") {
|
|
8575
|
-
compHtml = rewriteUnresolvableGsapToCdn(read.text, projectDir, srcPath);
|
|
8576
|
-
}
|
|
8577
|
-
}
|
|
8708
|
+
const compHtml = resolveMountHtml(srcPath);
|
|
8709
|
+
if (compHtml) budget.charge(srcPath, Buffer.byteLength(compHtml));
|
|
8578
8710
|
return compHtml;
|
|
8579
8711
|
},
|
|
8580
8712
|
parseHtml: (htmlStr) => parseHTML5(htmlStr).document,
|
|
8581
8713
|
// Mirrors the preview bundler: a sub-composition's SIBLING assets resolve
|
|
8582
8714
|
// against its own directory, project-root refs stay as authored.
|
|
8583
|
-
assetExists: (
|
|
8715
|
+
assetExists: projectAssetExists(projectDir),
|
|
8584
8716
|
// Preserve the authored root wrapper as a child of the host, matching
|
|
8585
8717
|
// the preview bundler's shape (htmlBundler.ts's prepareFlattenedInnerRoot,
|
|
8586
8718
|
// which the runtime compositionLoader mirrors with its own copy for the
|
|
@@ -8785,7 +8917,7 @@ ${safeText}
|
|
|
8785
8917
|
}
|
|
8786
8918
|
return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
|
|
8787
8919
|
}
|
|
8788
|
-
function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html") {
|
|
8920
|
+
function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html", policy = {}) {
|
|
8789
8921
|
const absProjectDir = resolve7(projectDir);
|
|
8790
8922
|
const externalAssets = /* @__PURE__ */ new Map();
|
|
8791
8923
|
const leftOut = /* @__PURE__ */ new Set();
|
|
@@ -8798,7 +8930,7 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
|
|
|
8798
8930
|
}
|
|
8799
8931
|
const onShare = namesAnotherNetworkRoot2(absProjectDir, absPath);
|
|
8800
8932
|
if (!onShare && !existsSync11(absPath)) return null;
|
|
8801
|
-
const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath);
|
|
8933
|
+
const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath, policy);
|
|
8802
8934
|
if (refusal) {
|
|
8803
8935
|
if (!leftOut.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
|
|
8804
8936
|
leftOut.add(trimmed);
|
|
@@ -9184,7 +9316,7 @@ function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
|
|
|
9184
9316
|
const entryPath = relative2(projectDir, htmlPath).replace(/\\/g, "/");
|
|
9185
9317
|
if (!entryPath.includes("/")) return html;
|
|
9186
9318
|
const { document: document2 } = parseHTML5(html);
|
|
9187
|
-
const assetExists = (
|
|
9319
|
+
const assetExists = projectAssetExists(projectDir);
|
|
9188
9320
|
rewriteAssetPaths(
|
|
9189
9321
|
document2.querySelectorAll("[src], [href], [srcset]"),
|
|
9190
9322
|
entryPath,
|
|
@@ -9225,18 +9357,23 @@ function bindVariableMediaSources(html, variables) {
|
|
|
9225
9357
|
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative2(projectDir, htmlPath).split(sep3).join("/") : basename5(htmlPath);
|
|
9226
9358
|
async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
|
|
9227
9359
|
const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
9360
|
+
const outsideFiles = { includeScripts: options.includeOutsideScripts };
|
|
9228
9361
|
if (isPathInside(htmlPath, projectDir) && escapesAssetRoot(htmlPath, assetRoot)) {
|
|
9229
9362
|
throw new Error(`Entry file ${htmlPath} leads outside the project folder`);
|
|
9230
9363
|
}
|
|
9364
|
+
if (isPathInside(htmlPath, projectDir) && runsOutsideMarkupUnasked(projectDir, htmlPath, assetRoot, outsideFiles)) {
|
|
9365
|
+
throw new Error(`Entry file ${htmlPath} ${OUTSIDE_COMPOSITION_NEEDS_FLAG}`);
|
|
9366
|
+
}
|
|
9231
9367
|
if (!COMPOSITION_FILE.test(htmlPath)) {
|
|
9232
9368
|
throw new Error(`Entry file ${htmlPath} is not an .html file, so it is refused`);
|
|
9233
9369
|
}
|
|
9370
|
+
assertCompositionFileSize(htmlPath, basename5(htmlPath));
|
|
9234
9371
|
const entryHtml = rebaseDirectEntryAssetPaths(readTextFile(htmlPath), projectDir, htmlPath);
|
|
9235
9372
|
const rawHtml = bindVariableMediaSources(
|
|
9236
9373
|
normalizeCompositionSrcs(rewriteUnresolvableGsapToCdn(entryHtml, projectDir), projectDir),
|
|
9237
9374
|
options.variables ?? {}
|
|
9238
9375
|
);
|
|
9239
|
-
assertSubCompositionsUsable(rawHtml, projectDir, assetRoot);
|
|
9376
|
+
assertSubCompositionsUsable(rawHtml, projectDir, assetRoot, outsideFiles);
|
|
9240
9377
|
const probes = /* @__PURE__ */ new Map();
|
|
9241
9378
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
9242
9379
|
rawHtml,
|
|
@@ -9255,7 +9392,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9255
9392
|
void 0,
|
|
9256
9393
|
options.urlByAbsentLocalPath,
|
|
9257
9394
|
probes,
|
|
9258
|
-
assetRoot
|
|
9395
|
+
assetRoot,
|
|
9396
|
+
outsideFiles
|
|
9259
9397
|
);
|
|
9260
9398
|
const fullHtml = ensureFullDocument(compiledHtml);
|
|
9261
9399
|
const { html: inlinedHtml, variablesByComp } = inlineSubCompositions(
|
|
@@ -9263,7 +9401,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9263
9401
|
subCompositions,
|
|
9264
9402
|
projectDir,
|
|
9265
9403
|
options.variables ?? {},
|
|
9266
|
-
assetRoot
|
|
9404
|
+
assetRoot,
|
|
9405
|
+
outsideFiles
|
|
9267
9406
|
);
|
|
9268
9407
|
const sanitizedHtml = stripPreloadNone(inlinedHtml);
|
|
9269
9408
|
const renderModeHints = detectRenderModeHints(sanitizedHtml, options.pageMotionBlur);
|
|
@@ -9317,7 +9456,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9317
9456
|
cacheDir: options.animatedGifCacheDir,
|
|
9318
9457
|
sourceAssets: remoteImageAssets,
|
|
9319
9458
|
timeoutMs: options.ffmpegProcessTimeout,
|
|
9320
|
-
assetRoot
|
|
9459
|
+
allowOutsideFiles: assetRoot === void 0
|
|
9321
9460
|
});
|
|
9322
9461
|
if (preparedHeifImages.length > 0) {
|
|
9323
9462
|
defaultLogger.debug(`[Compiler] Converted ${preparedHeifImages.length} HEIC image(s) to JPEG`);
|
|
@@ -9333,7 +9472,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9333
9472
|
cacheDir: options.animatedGifCacheDir,
|
|
9334
9473
|
sourceAssets: gifSourceAssets,
|
|
9335
9474
|
timeoutMs: options.ffmpegProcessTimeout,
|
|
9336
|
-
assetRoot
|
|
9475
|
+
allowOutsideFiles: assetRoot === void 0
|
|
9337
9476
|
});
|
|
9338
9477
|
if (preparedGifs.length > 0) {
|
|
9339
9478
|
defaultLogger.debug(`[Compiler] Prepared ${preparedGifs.length} animated GIF input(s) as WebM`);
|
|
@@ -9348,7 +9487,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9348
9487
|
embeddedHtml,
|
|
9349
9488
|
projectDir,
|
|
9350
9489
|
options.log,
|
|
9351
|
-
entryFileName(projectDir, htmlPath)
|
|
9490
|
+
entryFileName(projectDir, htmlPath),
|
|
9491
|
+
{ includeScripts: options.includeOutsideScripts }
|
|
9352
9492
|
) : { html: embeddedHtml, externalAssets: /* @__PURE__ */ new Map() };
|
|
9353
9493
|
for (const [relPath, absPath] of remoteMediaAssets) {
|
|
9354
9494
|
externalAssets.set(relPath, absPath);
|
|
@@ -9755,7 +9895,7 @@ async function resolveCompositionDurations(page, unresolved) {
|
|
|
9755
9895
|
}
|
|
9756
9896
|
return resolutions;
|
|
9757
9897
|
}
|
|
9758
|
-
async function recompileWithResolutions(compiled, resolutions, projectDir, downloadDir, assetRoot) {
|
|
9898
|
+
async function recompileWithResolutions(compiled, resolutions, projectDir, downloadDir, assetRoot, outsideFiles = {}) {
|
|
9759
9899
|
if (resolutions.length === 0) return compiled;
|
|
9760
9900
|
const html = injectDurations(compiled.html, resolutions);
|
|
9761
9901
|
const { subCompositions } = await parseSubCompositions(
|
|
@@ -9765,7 +9905,8 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
|
|
|
9765
9905
|
void 0,
|
|
9766
9906
|
void 0,
|
|
9767
9907
|
void 0,
|
|
9768
|
-
assetRoot
|
|
9908
|
+
assetRoot,
|
|
9909
|
+
outsideFiles
|
|
9769
9910
|
);
|
|
9770
9911
|
const { videos, audios, images } = compiled;
|
|
9771
9912
|
const remaining = compiled.unresolvedCompositions.filter(
|
|
@@ -9813,6 +9954,7 @@ function resolveEntryHtmlPath(input) {
|
|
|
9813
9954
|
`Entry file "${relative3(projectDir, path)}" leads outside the project folder`
|
|
9814
9955
|
);
|
|
9815
9956
|
}
|
|
9957
|
+
assertCompositionFileSize(path, relative3(projectDir, path));
|
|
9816
9958
|
return readTextFile2(path);
|
|
9817
9959
|
};
|
|
9818
9960
|
const htmlPath = join20(projectDir, entryFile);
|
|
@@ -9874,7 +10016,8 @@ async function runCompileStage(input) {
|
|
|
9874
10016
|
pageMotionBlur: input.pageMotionBlur,
|
|
9875
10017
|
animatedGifCacheDir: animatedGifCacheDir(cfg.extractCacheDir),
|
|
9876
10018
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
|
9877
|
-
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets
|
|
10019
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
10020
|
+
includeOutsideScripts: job.config.includeOutsideScripts
|
|
9878
10021
|
});
|
|
9879
10022
|
assertNotAborted();
|
|
9880
10023
|
const compileOnlyMs = Date.now() - compileStart;
|
|
@@ -9960,6 +10103,8 @@ async function runCompileStage(input) {
|
|
|
9960
10103
|
});
|
|
9961
10104
|
const outputWidth = Math.round(width * deviceScaleFactor);
|
|
9962
10105
|
const outputHeight = Math.round(height * deviceScaleFactor);
|
|
10106
|
+
requireOutputDimensions(job.config.expectedOutputDimensions, outputWidth, outputHeight);
|
|
10107
|
+
if (job.config.expectedOutputDimensions !== void 0) job.outputDimensionsChecked = true;
|
|
9963
10108
|
if (deviceScaleFactor !== 1) {
|
|
9964
10109
|
log.info("Scaling composition via deviceScaleFactor", {
|
|
9965
10110
|
compositionWidth: width,
|
|
@@ -10054,30 +10199,50 @@ function hasAutoStartVideos(html) {
|
|
|
10054
10199
|
const { document: document2 } = parseHTML6(html);
|
|
10055
10200
|
return document2.querySelector("video[data-hf-auto-start]") !== null;
|
|
10056
10201
|
}
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10202
|
+
var MAX_VARIABLE_SCOPE_STEPS = 1e6;
|
|
10203
|
+
function variableIdsOn(scan, element) {
|
|
10204
|
+
let ids = scan.ids.get(element);
|
|
10205
|
+
if (!ids) {
|
|
10206
|
+
ids = /* @__PURE__ */ new Set([
|
|
10207
|
+
...Object.keys(parseHostVariableValues2(element)),
|
|
10208
|
+
...Object.keys(readDeclaredDefaults2(element))
|
|
10209
|
+
]);
|
|
10210
|
+
scan.ids.set(element, ids);
|
|
10211
|
+
}
|
|
10212
|
+
return ids;
|
|
10213
|
+
}
|
|
10214
|
+
function scopedVariablesFor(scan, element, variablesByComp) {
|
|
10215
|
+
for (let node = element; node; node = node.parentElement) {
|
|
10216
|
+
if (++scan.steps > MAX_VARIABLE_SCOPE_STEPS) return null;
|
|
10217
|
+
if (!node.hasAttribute("data-composition-id")) continue;
|
|
10218
|
+
const compId = node.getAttribute("data-composition-id")?.trim() ?? "";
|
|
10219
|
+
return compId && Object.hasOwn(variablesByComp, compId) ? variablesByComp[compId] : void 0;
|
|
10220
|
+
}
|
|
10221
|
+
return void 0;
|
|
10061
10222
|
}
|
|
10062
|
-
function variableHasValue(element, variableId, variables, variablesByComp) {
|
|
10223
|
+
function variableHasValue(scan, element, variableId, variables, variablesByComp) {
|
|
10063
10224
|
if (variables && Object.hasOwn(variables, variableId)) return true;
|
|
10064
|
-
const scoped = scopedVariablesFor(element, variablesByComp);
|
|
10225
|
+
const scoped = scopedVariablesFor(scan, element, variablesByComp);
|
|
10226
|
+
if (scoped === null) return true;
|
|
10065
10227
|
if (scoped) return Object.hasOwn(scoped, variableId);
|
|
10066
10228
|
for (let scope = element.parentElement; scope; scope = scope.parentElement) {
|
|
10067
|
-
if (
|
|
10068
|
-
if (
|
|
10229
|
+
if (++scan.steps > MAX_VARIABLE_SCOPE_STEPS) return true;
|
|
10230
|
+
if (variableIdsOn(scan, scope).has(variableId)) return true;
|
|
10069
10231
|
}
|
|
10070
|
-
return
|
|
10232
|
+
return variableIdsOn(scan, element.ownerDocument.documentElement).has(variableId);
|
|
10071
10233
|
}
|
|
10072
10234
|
function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
|
|
10073
10235
|
const { document: document2 } = parseHTML6(html);
|
|
10236
|
+
const scan = { ids: /* @__PURE__ */ new Map(), steps: 0 };
|
|
10074
10237
|
return Array.from(
|
|
10075
10238
|
document2.querySelectorAll(
|
|
10076
10239
|
"img[data-var-src], audio[data-var-src], video[data-var-src], source[data-var-src]"
|
|
10077
10240
|
)
|
|
10078
10241
|
).some((element) => {
|
|
10079
10242
|
const variableId = element.getAttribute("data-var-src")?.trim();
|
|
10080
|
-
return Boolean(
|
|
10243
|
+
return Boolean(
|
|
10244
|
+
variableId && variableHasValue(scan, element, variableId, variables, variablesByComp)
|
|
10245
|
+
);
|
|
10081
10246
|
});
|
|
10082
10247
|
}
|
|
10083
10248
|
function authoredMediaStarts(html) {
|
|
@@ -10117,29 +10282,54 @@ function reconcileBrowserMediaEnd(existingEnd, projectedEnd, sourceChanged, dura
|
|
|
10117
10282
|
if (sourceChanged && durationInferred) return projectedEnd;
|
|
10118
10283
|
return existingEnd <= 0 ? projectedEnd : Math.min(existingEnd, projectedEnd);
|
|
10119
10284
|
}
|
|
10285
|
+
var MAX_MEDIA_SELECTOR_WORK = 1e6;
|
|
10286
|
+
var SIBLING_COMBINATOR = /[~+]/;
|
|
10287
|
+
function managedMediaElements(document2) {
|
|
10288
|
+
const managed = [];
|
|
10289
|
+
const pending = [];
|
|
10290
|
+
for (const element of Array.from(document2.children)) pending.push({ element, inMedia: false });
|
|
10291
|
+
for (let next = pending.pop(); next; next = pending.pop()) {
|
|
10292
|
+
const name = next.element.tagName.toLowerCase();
|
|
10293
|
+
const isMedia = name === "video" || name === "audio";
|
|
10294
|
+
if (isMedia || next.inMedia && name === "source") managed.push(next.element);
|
|
10295
|
+
for (const child2 of Array.from(next.element.children)) {
|
|
10296
|
+
pending.push({ element: child2, inMedia: next.inMedia || isMedia });
|
|
10297
|
+
}
|
|
10298
|
+
}
|
|
10299
|
+
return managed;
|
|
10300
|
+
}
|
|
10120
10301
|
function hasRuntimeMediaChanges(html) {
|
|
10121
10302
|
const { document: document2 } = parseHTML6(html);
|
|
10122
10303
|
const scriptBodies = [...document2.querySelectorAll("script")].map(
|
|
10123
10304
|
(script) => script.textContent ?? ""
|
|
10124
10305
|
);
|
|
10125
10306
|
const insertedMedia = scriptBodies.some(
|
|
10126
|
-
(script) => /\bcreateElement\s*\(\s*["'`](?:video|audio)["'`]\s*\)/i.test(script) || /\bnew\s+(?:Audio|Video)\s*\(/i.test(script) ||
|
|
10307
|
+
(script) => /\bcreateElement\s*\(\s*["'`](?:video|audio)["'`]\s*\)/i.test(script) || /\bnew\s+(?:Audio|Video)\s*\(/i.test(script) || hasClosedMediaTag(script)
|
|
10127
10308
|
);
|
|
10128
10309
|
if (insertedMedia) return true;
|
|
10129
|
-
const
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10310
|
+
const managed = managedMediaElements(document2);
|
|
10311
|
+
if (managed.length === 0) return false;
|
|
10312
|
+
const managedIds = new Set(managed.map((element) => element.getAttribute("id")).filter(Boolean));
|
|
10313
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
10314
|
+
let selectorChars = 0;
|
|
10134
10315
|
for (const script of scriptBodies) {
|
|
10135
10316
|
for (const mutation of extractMediaSrcMutations(script)) {
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
if (targets.some(isManagedMedia)) return true;
|
|
10141
|
-
} catch {
|
|
10317
|
+
const id = /^#[A-Za-z_][\w-]*$/.test(mutation.selector) ? mutation.selector.slice(1) : null;
|
|
10318
|
+
if (id) {
|
|
10319
|
+
if (managedIds.has(id)) return true;
|
|
10320
|
+
continue;
|
|
10142
10321
|
}
|
|
10322
|
+
if (selectors.has(mutation.selector)) continue;
|
|
10323
|
+
if (SIBLING_COMBINATOR.test(mutation.selector)) return true;
|
|
10324
|
+
selectors.add(mutation.selector);
|
|
10325
|
+
selectorChars += mutation.selector.length;
|
|
10326
|
+
if (selectorChars * managed.length > MAX_MEDIA_SELECTOR_WORK) return true;
|
|
10327
|
+
}
|
|
10328
|
+
}
|
|
10329
|
+
for (const selector of selectors) {
|
|
10330
|
+
try {
|
|
10331
|
+
if (managed.some((element) => element.matches(selector))) return true;
|
|
10332
|
+
} catch {
|
|
10143
10333
|
}
|
|
10144
10334
|
}
|
|
10145
10335
|
return false;
|
|
@@ -10227,7 +10417,8 @@ async function runProbeStage(input) {
|
|
|
10227
10417
|
port: 0,
|
|
10228
10418
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
10229
10419
|
fps: job.config.fps,
|
|
10230
|
-
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets
|
|
10420
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
10421
|
+
includeOutsideScripts: job.config.includeOutsideScripts
|
|
10231
10422
|
});
|
|
10232
10423
|
assertNotAborted();
|
|
10233
10424
|
const motionBlur = job.config.motionBlur;
|
|
@@ -10383,7 +10574,8 @@ async function runProbeStage(input) {
|
|
|
10383
10574
|
resolutions,
|
|
10384
10575
|
projectDir,
|
|
10385
10576
|
join21(workDir, "downloads"),
|
|
10386
|
-
job.config.allowOutsideProjectAssets ? void 0 : projectDir
|
|
10577
|
+
job.config.allowOutsideProjectAssets ? void 0 : projectDir,
|
|
10578
|
+
{ includeScripts: job.config.includeOutsideScripts }
|
|
10387
10579
|
);
|
|
10388
10580
|
assertNotAborted();
|
|
10389
10581
|
composition.videos = compiled.videos;
|
|
@@ -13424,7 +13616,7 @@ import {
|
|
|
13424
13616
|
readdirSync as readdirSync5,
|
|
13425
13617
|
readFileSync as readFileSync9,
|
|
13426
13618
|
rmSync as rmSync11,
|
|
13427
|
-
statSync as
|
|
13619
|
+
statSync as statSync10,
|
|
13428
13620
|
writeFileSync as writeFileSync6
|
|
13429
13621
|
} from "node:fs";
|
|
13430
13622
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -13553,7 +13745,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
13553
13745
|
const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
|
|
13554
13746
|
if (failure) return failure;
|
|
13555
13747
|
}
|
|
13556
|
-
const fileSize = existsSync20(outputPath) ?
|
|
13748
|
+
const fileSize = existsSync20(outputPath) ? statSync10(outputPath).size : 0;
|
|
13557
13749
|
return {
|
|
13558
13750
|
success: true,
|
|
13559
13751
|
outputPath,
|
|
@@ -13576,7 +13768,10 @@ function startEncodeProgress(job, stage, onProgress) {
|
|
|
13576
13768
|
function resolveEngineConfig(input) {
|
|
13577
13769
|
return input.engineConfig ?? input.job.config.producerConfig ?? resolveConfig();
|
|
13578
13770
|
}
|
|
13579
|
-
function
|
|
13771
|
+
function overlapEncoderThreads(workerCount, cpuCount) {
|
|
13772
|
+
return Math.max(1, Math.floor(cpuCount) - Math.floor(workerCount));
|
|
13773
|
+
}
|
|
13774
|
+
function videoEncoderOptions(input, engineCfg, softwareEncoderThreads) {
|
|
13580
13775
|
const { job, preset } = input;
|
|
13581
13776
|
return {
|
|
13582
13777
|
fps: job.config.fps,
|
|
@@ -13596,7 +13791,8 @@ function videoEncoderOptions(input, engineCfg) {
|
|
|
13596
13791
|
// keyframes that survive `-f concat -c copy` at assemble time. In-process
|
|
13597
13792
|
// renders leave both undefined → preserves the existing open-GOP output.
|
|
13598
13793
|
lockGopForChunkConcat: input.lockGopForChunkConcat === true,
|
|
13599
|
-
gopSize: input.gopSize
|
|
13794
|
+
gopSize: input.gopSize,
|
|
13795
|
+
softwareEncoderThreads
|
|
13600
13796
|
};
|
|
13601
13797
|
}
|
|
13602
13798
|
function canEncodeWhileCapturing(input, workerCount, cpuCount) {
|
|
@@ -13612,8 +13808,9 @@ async function readLandedFrame(workerPath, mergedPath) {
|
|
|
13612
13808
|
}
|
|
13613
13809
|
return readFile2(mergedPath);
|
|
13614
13810
|
}
|
|
13615
|
-
function encodeWhileCapturing(input, totalFrames) {
|
|
13811
|
+
function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
13616
13812
|
const engineCfg = resolveEngineConfig(input);
|
|
13813
|
+
const softwareEncoderThreads = captureBudget ? overlapEncoderThreads(captureBudget.workerCount, captureBudget.cpuCount) : void 0;
|
|
13617
13814
|
const stop = new AbortController();
|
|
13618
13815
|
const signal = input.abortSignal ? AbortSignal.any([input.abortSignal, stop.signal]) : stop.signal;
|
|
13619
13816
|
const landed = /* @__PURE__ */ new Map();
|
|
@@ -13628,7 +13825,10 @@ function encodeWhileCapturing(input, totalFrames) {
|
|
|
13628
13825
|
let reportFed = null;
|
|
13629
13826
|
const encoder = spawnStreamingEncoder4(
|
|
13630
13827
|
input.videoOnlyPath,
|
|
13631
|
-
{
|
|
13828
|
+
{
|
|
13829
|
+
...videoEncoderOptions(input, engineCfg, softwareEncoderThreads),
|
|
13830
|
+
imageFormat: "jpeg"
|
|
13831
|
+
},
|
|
13632
13832
|
signal,
|
|
13633
13833
|
engineCfg
|
|
13634
13834
|
);
|
|
@@ -13959,7 +14159,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
13959
14159
|
for (const name of entries) {
|
|
13960
14160
|
const full = join32(current, name);
|
|
13961
14161
|
try {
|
|
13962
|
-
const st =
|
|
14162
|
+
const st = statSync11(full);
|
|
13963
14163
|
if (st.isDirectory()) {
|
|
13964
14164
|
stack.push(full);
|
|
13965
14165
|
} else if (st.isFile()) {
|
|
@@ -14114,7 +14314,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
14114
14314
|
let rangeStart = null;
|
|
14115
14315
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
14116
14316
|
const framePath = join32(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
14117
|
-
const missing = !existsSync21(framePath) ||
|
|
14317
|
+
const missing = !existsSync21(framePath) || statSync11(framePath).size <= 8;
|
|
14118
14318
|
if (missing && rangeStart === null) {
|
|
14119
14319
|
rangeStart = frameIndex;
|
|
14120
14320
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -15451,7 +15651,8 @@ async function executeRenderPipeline(input) {
|
|
|
15451
15651
|
port: 0,
|
|
15452
15652
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
15453
15653
|
fps: job.config.fps,
|
|
15454
|
-
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets
|
|
15654
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
15655
|
+
includeOutsideScripts: job.config.includeOutsideScripts
|
|
15455
15656
|
});
|
|
15456
15657
|
assertNotAborted();
|
|
15457
15658
|
observability.stageEnd("file_server", fileServerStart);
|
|
@@ -16740,7 +16941,10 @@ async function executeRenderPipeline(input) {
|
|
|
16740
16941
|
assertNotAborted,
|
|
16741
16942
|
onProgress
|
|
16742
16943
|
};
|
|
16743
|
-
const overlap = !cfg.useDrawElement && workerSizing !== void 0 && canEncodeWhileCapturing(encodeInput, capturePlan.workerCount, workerSizing.cpuCount) ? encodeWhileCapturing(encodeInput, totalFrames
|
|
16944
|
+
const overlap = !cfg.useDrawElement && workerSizing !== void 0 && canEncodeWhileCapturing(encodeInput, capturePlan.workerCount, workerSizing.cpuCount) ? encodeWhileCapturing(encodeInput, totalFrames, {
|
|
16945
|
+
workerCount: capturePlan.workerCount,
|
|
16946
|
+
cpuCount: workerSizing.cpuCount
|
|
16947
|
+
}) : null;
|
|
16744
16948
|
const captureFrameStart = Date.now();
|
|
16745
16949
|
const invokeDiskCapture = (diskPlan) => observeRenderStage(
|
|
16746
16950
|
observability,
|
|
@@ -17092,7 +17296,7 @@ async function executeRenderPipeline(input) {
|
|
|
17092
17296
|
import {
|
|
17093
17297
|
existsSync as existsSync22,
|
|
17094
17298
|
readFileSync as readFileSync10,
|
|
17095
|
-
statSync as
|
|
17299
|
+
statSync as statSync12,
|
|
17096
17300
|
openSync as openSync5,
|
|
17097
17301
|
fstatSync as fstatSync3,
|
|
17098
17302
|
closeSync as closeSync5,
|
|
@@ -17133,7 +17337,7 @@ function readEntryHtml(filePath) {
|
|
|
17133
17337
|
} catch (error) {
|
|
17134
17338
|
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
17135
17339
|
return null;
|
|
17136
|
-
if (!
|
|
17340
|
+
if (!statSync12(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
17137
17341
|
throw error;
|
|
17138
17342
|
}
|
|
17139
17343
|
try {
|
|
@@ -17149,7 +17353,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
|
17149
17353
|
}
|
|
17150
17354
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
17151
17355
|
const absProjectDir = resolve9(projectDir);
|
|
17152
|
-
if (!existsSync22(absProjectDir) || !
|
|
17356
|
+
if (!existsSync22(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
17153
17357
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
17154
17358
|
}
|
|
17155
17359
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -17748,6 +17952,11 @@ function assertRequestOptionScalars(options) {
|
|
|
17748
17952
|
}
|
|
17749
17953
|
function assertRequestOptionObjects(options) {
|
|
17750
17954
|
validateEngineConfigSnapshot2(options.engineConfig);
|
|
17955
|
+
if (options.expectedOutputDimensions !== void 0 && !isExpectedOutputDimensions(options.expectedOutputDimensions)) {
|
|
17956
|
+
throw new Error(
|
|
17957
|
+
"Render request expectedOutputDimensions must contain positive integer width and height"
|
|
17958
|
+
);
|
|
17959
|
+
}
|
|
17751
17960
|
if (options.variables !== void 0 && !isPlainObject(options.variables)) {
|
|
17752
17961
|
throw new Error("Render request variables must be a JSON object");
|
|
17753
17962
|
}
|
|
@@ -17813,7 +18022,8 @@ function renderConfigFromRequest(request, runtime = {}) {
|
|
|
17813
18022
|
...options,
|
|
17814
18023
|
producerConfig: engineConfig,
|
|
17815
18024
|
logger: runtime.logger,
|
|
17816
|
-
allowOutsideProjectAssets: runtime.allowOutsideProjectAssets === true
|
|
18025
|
+
allowOutsideProjectAssets: runtime.allowOutsideProjectAssets === true,
|
|
18026
|
+
includeOutsideScripts: runtime.includeOutsideScripts === true
|
|
17817
18027
|
};
|
|
17818
18028
|
}
|
|
17819
18029
|
|
|
@@ -17830,7 +18040,9 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
17830
18040
|
"RENDER_TOO_SLOW",
|
|
17831
18041
|
"RENDER_STAGE_STALLED",
|
|
17832
18042
|
"PAGE_NEVER_READY",
|
|
17833
|
-
"VARIABLES_INVALID"
|
|
18043
|
+
"VARIABLES_INVALID",
|
|
18044
|
+
"OUTPUT_DIMENSIONS_MISMATCH",
|
|
18045
|
+
"COMPOSITION_TOO_LARGE"
|
|
17834
18046
|
]);
|
|
17835
18047
|
function extractSafeRenderErrorCode(error) {
|
|
17836
18048
|
if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
|
|
@@ -17937,6 +18149,7 @@ function parseRenderOptions(body) {
|
|
|
17937
18149
|
outputDynamicRange,
|
|
17938
18150
|
variables,
|
|
17939
18151
|
strictVariables,
|
|
18152
|
+
expectedOutputDimensions: isExpectedOutputDimensions(body.expectedOutputDimensions) ? body.expectedOutputDimensions : void 0,
|
|
17940
18153
|
outputResolution,
|
|
17941
18154
|
outputResolutionAspectAgnostic,
|
|
17942
18155
|
videoFrameFormat
|
|
@@ -17976,6 +18189,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
17976
18189
|
entryFile: input.entryFile,
|
|
17977
18190
|
variables: input.variables,
|
|
17978
18191
|
strictVariables: input.strictVariables,
|
|
18192
|
+
expectedOutputDimensions: input.expectedOutputDimensions,
|
|
17979
18193
|
outputResolution: input.outputResolution,
|
|
17980
18194
|
outputResolutionAspectAgnostic: input.outputResolutionAspectAgnostic,
|
|
17981
18195
|
videoFrameFormat: input.videoFrameFormat,
|
|
@@ -18020,6 +18234,9 @@ function validateRenderOverrides(body) {
|
|
|
18020
18234
|
if (body.variables !== void 0 && !isPlainObject2(body.variables)) {
|
|
18021
18235
|
return 'variables must be a JSON object keyed by variable id (e.g. {"title":"Hello"})';
|
|
18022
18236
|
}
|
|
18237
|
+
if (body.expectedOutputDimensions !== void 0 && !isExpectedOutputDimensions(body.expectedOutputDimensions)) {
|
|
18238
|
+
return "expectedOutputDimensions must contain positive integer width and height";
|
|
18239
|
+
}
|
|
18023
18240
|
if (body.strictVariables !== void 0 && typeof body.strictVariables !== "boolean") {
|
|
18024
18241
|
return "strictVariables must be a boolean";
|
|
18025
18242
|
}
|
|
@@ -18070,7 +18287,7 @@ function prepareProjectDirectory(projectDir, options, policy) {
|
|
|
18070
18287
|
if (!candidate) return null;
|
|
18071
18288
|
const absProjectDir = policy ? resolve10(policy.projectsDir, candidate) : resolve10(candidate);
|
|
18072
18289
|
const shown = policy ? candidate : absProjectDir;
|
|
18073
|
-
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync25(absProjectDir) || !
|
|
18290
|
+
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync25(absProjectDir) || !statSync13(absProjectDir).isDirectory()) {
|
|
18074
18291
|
return { error: `Project directory not found: ${shown}` };
|
|
18075
18292
|
}
|
|
18076
18293
|
const entry = options.entryFile || "index.html";
|
|
@@ -18173,7 +18390,7 @@ function publicPerfSummary(job) {
|
|
|
18173
18390
|
return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
|
|
18174
18391
|
}
|
|
18175
18392
|
function outputFileSize(path) {
|
|
18176
|
-
return existsSync25(path) ?
|
|
18393
|
+
return existsSync25(path) ? statSync13(path).size : 0;
|
|
18177
18394
|
}
|
|
18178
18395
|
function createBlockingProgressReporter(log, requestId) {
|
|
18179
18396
|
let lastLoggedPct = -10;
|
|
@@ -18376,7 +18593,8 @@ function createRenderHandlers(options = {}) {
|
|
|
18376
18593
|
outcome: job.outcome ?? "completed",
|
|
18377
18594
|
warnings: job.warnings,
|
|
18378
18595
|
perf: policy ? publicPerfSummary(job) : job.perfSummary ?? null,
|
|
18379
|
-
...strictVariablesResult(job)
|
|
18596
|
+
...strictVariablesResult(job),
|
|
18597
|
+
...job.outputDimensionsChecked === void 0 ? {} : { outputDimensionsChecked: job.outputDimensionsChecked }
|
|
18380
18598
|
});
|
|
18381
18599
|
} catch (error) {
|
|
18382
18600
|
const durationMs = Date.now() - t0;
|
|
@@ -18473,7 +18691,8 @@ function createRenderHandlers(options = {}) {
|
|
|
18473
18691
|
warnings: job.warnings,
|
|
18474
18692
|
perf: policy ? publicPerfSummary(job) : job.perfSummary ?? null,
|
|
18475
18693
|
producerVersion: readProducerVersion(),
|
|
18476
|
-
...strictVariablesResult(job)
|
|
18694
|
+
...strictVariablesResult(job),
|
|
18695
|
+
...job.outputDimensionsChecked === void 0 ? {} : { outputDimensionsChecked: job.outputDimensionsChecked }
|
|
18477
18696
|
})
|
|
18478
18697
|
});
|
|
18479
18698
|
} catch (error) {
|
|
@@ -18502,7 +18721,7 @@ function createRenderHandlers(options = {}) {
|
|
|
18502
18721
|
store.delete(token);
|
|
18503
18722
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
18504
18723
|
}
|
|
18505
|
-
const stats =
|
|
18724
|
+
const stats = statSync13(artifact.path);
|
|
18506
18725
|
return new Response(createReadStream3(artifact.path), {
|
|
18507
18726
|
headers: {
|
|
18508
18727
|
"content-type": "video/mp4",
|