@hyperframes/producer 0.9.56 → 0.9.59
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 +112 -44
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/hyperframeLintWorker.js +9 -0
- package/dist/index.js +251 -58
- package/dist/logger.d.ts +1 -1
- package/dist/public-server.js +244 -55
- package/dist/services/assetMediaType.d.ts +1 -1
- package/dist/services/htmlCompiler.d.ts +1 -0
- package/dist/services/hyperframeLint.d.ts +8 -2
- package/dist/services/hyperframeLintWorker.d.ts +1 -0
- package/dist/services/render/shared.d.ts +7 -0
- package/dist/services/render/stages/audioStage.d.ts +1 -0
- package/dist/services/render/stages/probeStage.d.ts +4 -2
- package/package.json +7 -7
package/dist/distributed.js
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from "@hyperframes/engine";
|
|
32
32
|
|
|
33
33
|
// src/logger.ts
|
|
34
|
+
import { terminalText } from "@hyperframes/core";
|
|
34
35
|
var LOG_LEVEL_PRIORITY = {
|
|
35
36
|
error: 0,
|
|
36
37
|
warn: 1,
|
|
@@ -40,26 +41,26 @@ var LOG_LEVEL_PRIORITY = {
|
|
|
40
41
|
function createConsoleLogger(level = "info") {
|
|
41
42
|
const threshold = LOG_LEVEL_PRIORITY[level];
|
|
42
43
|
const shouldLog = (msgLevel) => LOG_LEVEL_PRIORITY[msgLevel] <= threshold;
|
|
43
|
-
const formatMeta = (meta) => meta ? ` ${JSON.stringify(meta)}` : "";
|
|
44
|
+
const formatMeta = (meta) => meta ? ` ${terminalText(JSON.stringify(meta))}` : "";
|
|
44
45
|
return {
|
|
45
46
|
error(message, meta) {
|
|
46
47
|
if (shouldLog("error")) {
|
|
47
|
-
console.error(`[ERROR] ${message}${formatMeta(meta)}`);
|
|
48
|
+
console.error(`[ERROR] ${terminalText(message)}${formatMeta(meta)}`);
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
warn(message, meta) {
|
|
51
52
|
if (shouldLog("warn")) {
|
|
52
|
-
console.warn(`[WARN] ${message}${formatMeta(meta)}`);
|
|
53
|
+
console.warn(`[WARN] ${terminalText(message)}${formatMeta(meta)}`);
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
info(message, meta) {
|
|
56
57
|
if (shouldLog("info")) {
|
|
57
|
-
console.error(`[INFO] ${message}${formatMeta(meta)}`);
|
|
58
|
+
console.error(`[INFO] ${terminalText(message)}${formatMeta(meta)}`);
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
debug(message, meta) {
|
|
61
62
|
if (shouldLog("debug")) {
|
|
62
|
-
console.error(`[DEBUG] ${message}${formatMeta(meta)}`);
|
|
63
|
+
console.error(`[DEBUG] ${terminalText(message)}${formatMeta(meta)}`);
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
isLevelEnabled(msgLevel) {
|
|
@@ -392,7 +393,7 @@ import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:p
|
|
|
392
393
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
393
394
|
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
394
395
|
import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
|
|
395
|
-
import { fpsToNumber } from "@hyperframes/core";
|
|
396
|
+
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
396
397
|
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
397
398
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
398
399
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
@@ -1041,7 +1042,7 @@ function createFileServer(options) {
|
|
|
1041
1042
|
const headScripts = options.headScripts ?? [getVerifiedHyperframeRuntimeSource()];
|
|
1042
1043
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
1043
1044
|
const app = new Hono();
|
|
1044
|
-
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
1045
|
+
const warnLeftOut = (line) => console.warn(`[FileServer] ${terminalText2(line)}`);
|
|
1045
1046
|
let listeningPort = -1;
|
|
1046
1047
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
1047
1048
|
await next();
|
|
@@ -1065,7 +1066,7 @@ function createFileServer(options) {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
if (!file) {
|
|
1067
1068
|
if (!/favicon\.ico$/i.test(requestPath)) {
|
|
1068
|
-
console.warn(`[FileServer] 404 Not Found: ${requestPath}`);
|
|
1069
|
+
console.warn(`[FileServer] 404 Not Found: ${terminalText2(requestPath)}`);
|
|
1069
1070
|
}
|
|
1070
1071
|
return c.text("Not found", 404);
|
|
1071
1072
|
}
|
|
@@ -1232,7 +1233,8 @@ import {
|
|
|
1232
1233
|
import { basename as basename2, dirname as dirname2, isAbsolute, join as join3, relative, resolve as resolve3 } from "node:path";
|
|
1233
1234
|
import {
|
|
1234
1235
|
CANVAS_DIMENSIONS,
|
|
1235
|
-
checkOutputResolutionCompatibility
|
|
1236
|
+
checkOutputResolutionCompatibility,
|
|
1237
|
+
terminalText as terminalText3
|
|
1236
1238
|
} from "@hyperframes/core";
|
|
1237
1239
|
import {
|
|
1238
1240
|
mediaIdPathSegment
|
|
@@ -1267,7 +1269,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
1267
1269
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
1268
1270
|
const outPath = join3(compileDir, srcPath);
|
|
1269
1271
|
if (!isPathInside(outPath, compileDir)) {
|
|
1270
|
-
console.warn(`[Render] Skipping sub-composition with unsafe path: ${srcPath}`);
|
|
1272
|
+
console.warn(`[Render] Skipping sub-composition with unsafe path: ${terminalText3(srcPath)}`);
|
|
1271
1273
|
continue;
|
|
1272
1274
|
}
|
|
1273
1275
|
mkdirSync(dirname2(outPath), { recursive: true });
|
|
@@ -1276,7 +1278,9 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
1276
1278
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
1277
1279
|
const outPath = resolve3(join3(compileDir, relativePath));
|
|
1278
1280
|
if (!isPathInside(outPath, compileDir)) {
|
|
1279
|
-
console.warn(
|
|
1281
|
+
console.warn(
|
|
1282
|
+
`[Render] Skipping external asset with unsafe path: ${terminalText3(relativePath)}`
|
|
1283
|
+
);
|
|
1280
1284
|
continue;
|
|
1281
1285
|
}
|
|
1282
1286
|
mkdirSync(dirname2(outPath), { recursive: true });
|
|
@@ -1719,6 +1723,7 @@ import {
|
|
|
1719
1723
|
resolveProjectRelativeSrc,
|
|
1720
1724
|
resolveVideoExtractionWindow,
|
|
1721
1725
|
runFfmpeg,
|
|
1726
|
+
urlInputArgs,
|
|
1722
1727
|
videoStartOnMediaTimeline
|
|
1723
1728
|
} from "@hyperframes/engine";
|
|
1724
1729
|
import { fpsToFfmpegArg, fpsToNumber as fpsToNumber3 } from "@hyperframes/core";
|
|
@@ -2458,7 +2463,8 @@ import {
|
|
|
2458
2463
|
rewriteAssetPath,
|
|
2459
2464
|
rewriteAssetPaths,
|
|
2460
2465
|
rewriteCssAssetUrls,
|
|
2461
|
-
rewriteInlineStyleAssetUrls
|
|
2466
|
+
rewriteInlineStyleAssetUrls,
|
|
2467
|
+
terminalText as terminalText4
|
|
2462
2468
|
} from "@hyperframes/core";
|
|
2463
2469
|
import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
|
|
2464
2470
|
import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
|
|
@@ -2669,6 +2675,7 @@ function placeAudio(audio, window2) {
|
|
|
2669
2675
|
import {
|
|
2670
2676
|
analyzeKeyframeIntervals,
|
|
2671
2677
|
assertMediaPayload,
|
|
2678
|
+
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots3,
|
|
2672
2679
|
NotMediaPayloadError as NotMediaPayloadError2,
|
|
2673
2680
|
parseMasterFxChain,
|
|
2674
2681
|
probeMediaProfile as probeMediaProfile2
|
|
@@ -2696,7 +2703,13 @@ import { copyFileSync as copyFileSync2, existsSync as existsSync5, mkdirSync as
|
|
|
2696
2703
|
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join6, resolve as resolve4 } from "node:path";
|
|
2697
2704
|
import { parseHTML as parseHTML3 } from "linkedom";
|
|
2698
2705
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
2699
|
-
import {
|
|
2706
|
+
import {
|
|
2707
|
+
DEFAULT_VP9_CPU_USED,
|
|
2708
|
+
isPrivateUnderAssetRoots,
|
|
2709
|
+
runFfmpeg as runFfmpeg2,
|
|
2710
|
+
renameWithRetry as renameWithRetry3,
|
|
2711
|
+
urlInputArgs as urlInputArgs2
|
|
2712
|
+
} from "@hyperframes/engine";
|
|
2700
2713
|
import { namesAnotherNetworkRoot } from "@hyperframes/parsers/asset-resolution";
|
|
2701
2714
|
var PREPARED_GIF_SUBDIR = "_animated_gif";
|
|
2702
2715
|
var CACHE_SCHEMA = "hfgif-v1";
|
|
@@ -2739,7 +2752,7 @@ function resolveLocalImageSourcePath(src, options) {
|
|
|
2739
2752
|
isAbsolute2(basePath) ? basePath : resolve4(options.projectDir, projectRelative),
|
|
2740
2753
|
resolve4(options.downloadDir, normalizedBase)
|
|
2741
2754
|
];
|
|
2742
|
-
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && (!escapesAssetRoot(candidate, options.assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
|
|
2755
|
+
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && !isPrivateUnderAssetRoots(candidate, [options.projectDir, options.downloadDir]) && (!escapesAssetRoot(candidate, options.assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
|
|
2743
2756
|
return candidates.find((candidate) => allowed(candidate) && existsSync5(candidate)) ?? null;
|
|
2744
2757
|
}
|
|
2745
2758
|
function isUsableFile(path) {
|
|
@@ -2808,6 +2821,7 @@ function buildAnimatedGifTranscodeArgs(input) {
|
|
|
2808
2821
|
args.push(
|
|
2809
2822
|
"-ignore_loop",
|
|
2810
2823
|
"1",
|
|
2824
|
+
...urlInputArgs2(input.inputPath),
|
|
2811
2825
|
"-i",
|
|
2812
2826
|
input.inputPath,
|
|
2813
2827
|
"-an",
|
|
@@ -3013,7 +3027,7 @@ import {
|
|
|
3013
3027
|
} from "node:fs";
|
|
3014
3028
|
import { dirname as dirname5, join as join7, resolve as resolve5 } from "node:path";
|
|
3015
3029
|
import { parseHTML as parseHTML4 } from "linkedom";
|
|
3016
|
-
import { renameWithRetry as renameWithRetry4, runFfmpeg as runFfmpeg3, runFfprobe } from "@hyperframes/engine";
|
|
3030
|
+
import { renameWithRetry as renameWithRetry4, runFfmpeg as runFfmpeg3, runFfprobe, urlInputArgs as urlInputArgs3 } from "@hyperframes/engine";
|
|
3017
3031
|
|
|
3018
3032
|
// src/services/heifRotation.ts
|
|
3019
3033
|
function* boxes(buf, start, end) {
|
|
@@ -3212,6 +3226,7 @@ async function convertHeifToJpeg(request) {
|
|
|
3212
3226
|
"-hide_banner",
|
|
3213
3227
|
"-loglevel",
|
|
3214
3228
|
"error",
|
|
3229
|
+
...urlInputArgs3(request.inputPath),
|
|
3215
3230
|
"-i",
|
|
3216
3231
|
request.inputPath,
|
|
3217
3232
|
...mapArgs,
|
|
@@ -3335,7 +3350,9 @@ import {
|
|
|
3335
3350
|
fingerprintElementId,
|
|
3336
3351
|
isHttpUrl as isHttpUrl2,
|
|
3337
3352
|
isInsideAssetRoots,
|
|
3353
|
+
isNotImagePayload,
|
|
3338
3354
|
isNotMediaPayload,
|
|
3355
|
+
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots2,
|
|
3339
3356
|
playlistLeavesItsFolder,
|
|
3340
3357
|
NotMediaPayloadError,
|
|
3341
3358
|
probeMediaProfile,
|
|
@@ -3390,6 +3407,10 @@ function dropMediaOutsideProject(input) {
|
|
|
3390
3407
|
const staysInside = ({ id, src }) => {
|
|
3391
3408
|
if (!src || isHttpUrl2(src)) return true;
|
|
3392
3409
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
3410
|
+
if (isPrivateUnderAssetRoots2(path, roots)) {
|
|
3411
|
+
log.warn(`[Render] Media "${id}" source is missing: it is a private project file`, { src });
|
|
3412
|
+
return false;
|
|
3413
|
+
}
|
|
3393
3414
|
if (isInsideAssetRoots(path, roots)) return true;
|
|
3394
3415
|
if (input.allowOutsideProjectAssets) {
|
|
3395
3416
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
@@ -3406,6 +3427,8 @@ function dropMediaOutsideProject(input) {
|
|
|
3406
3427
|
async function notMediaReferences(path, references) {
|
|
3407
3428
|
const videos = references.filter((ref) => ref.expected === "video");
|
|
3408
3429
|
if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
|
|
3430
|
+
const images = references.filter((ref) => ref.expected === "image");
|
|
3431
|
+
if (images.length > 0 && await isNotImagePayload(path)) return images;
|
|
3409
3432
|
return await playlistLeavesItsFolder(path) ? references : [];
|
|
3410
3433
|
}
|
|
3411
3434
|
async function preflightCompositionAssetMediaTypes(input) {
|
|
@@ -3694,7 +3717,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
3694
3717
|
}
|
|
3695
3718
|
return false;
|
|
3696
3719
|
}
|
|
3697
|
-
async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
3720
|
+
async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
3698
3721
|
let filePath = src;
|
|
3699
3722
|
if (isHttpUrl(src)) {
|
|
3700
3723
|
const remoteDir = join9(downloadDir, REMOTE_MEDIA_SUBDIR);
|
|
@@ -3709,7 +3732,9 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
|
|
|
3709
3732
|
} else {
|
|
3710
3733
|
filePath = decodedUrlPath(src);
|
|
3711
3734
|
if (!filePath.startsWith("/")) filePath = join9(baseDir, filePath);
|
|
3712
|
-
if (escapesAssetRoot(filePath, assetRoot)
|
|
3735
|
+
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir, downloadDir])) {
|
|
3736
|
+
return { duration: null, resolvedPath: filePath };
|
|
3737
|
+
}
|
|
3713
3738
|
filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
|
|
3714
3739
|
if (!isHttpUrl(filePath) && namesAnotherNetworkRoot2(baseDir, filePath)) {
|
|
3715
3740
|
return { duration: null, resolvedPath: filePath };
|
|
@@ -3785,7 +3810,7 @@ function markInferredVariableMediaDurations(html, unresolvedMedia) {
|
|
|
3785
3810
|
}
|
|
3786
3811
|
return changed ? document2.toString() : html;
|
|
3787
3812
|
}
|
|
3788
|
-
async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
3813
|
+
async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
3789
3814
|
const { html: staticCompiled, unresolved } = compileTimingAttrs(html);
|
|
3790
3815
|
const mediaUnresolved = unresolved.filter(
|
|
3791
3816
|
(el) => (el.tagName === "video" || el.tagName === "audio") && el.src
|
|
@@ -3797,6 +3822,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
3797
3822
|
el.src,
|
|
3798
3823
|
el.mediaStart,
|
|
3799
3824
|
el.playbackRate,
|
|
3825
|
+
projectDir,
|
|
3800
3826
|
baseDir,
|
|
3801
3827
|
downloadDir,
|
|
3802
3828
|
el.tagName,
|
|
@@ -3821,6 +3847,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
3821
3847
|
el.src,
|
|
3822
3848
|
el.mediaStart,
|
|
3823
3849
|
el.playbackRate,
|
|
3850
|
+
projectDir,
|
|
3824
3851
|
baseDir,
|
|
3825
3852
|
downloadDir,
|
|
3826
3853
|
el.tagName,
|
|
@@ -3876,6 +3903,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
3876
3903
|
workItems.map(async (item) => {
|
|
3877
3904
|
const { html: compiledSub } = await compileHtmlFile(
|
|
3878
3905
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
3906
|
+
projectDir,
|
|
3879
3907
|
dirname7(item.filePath),
|
|
3880
3908
|
downloadDir,
|
|
3881
3909
|
void 0,
|
|
@@ -4037,7 +4065,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
4037
4065
|
{},
|
|
4038
4066
|
variableOverrides
|
|
4039
4067
|
);
|
|
4040
|
-
return emitted ? document2.toString() : html;
|
|
4068
|
+
return { html: emitted ? document2.toString() : html, variablesByComp: {} };
|
|
4041
4069
|
}
|
|
4042
4070
|
const hostIdentityByElement = new ProducerHostIdentityMap(
|
|
4043
4071
|
document2,
|
|
@@ -4078,7 +4106,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
4078
4106
|
flattenInnerRoot: prepareFlattenedInnerRoot,
|
|
4079
4107
|
onMissingComposition: (srcPath, reason) => {
|
|
4080
4108
|
console.warn(
|
|
4081
|
-
|
|
4109
|
+
terminalText4(
|
|
4110
|
+
`[Compiler] Skipping sub-composition "${srcPath}": ${reason ?? "the file is missing or empty"}.`
|
|
4111
|
+
)
|
|
4082
4112
|
);
|
|
4083
4113
|
}
|
|
4084
4114
|
}
|
|
@@ -4149,7 +4179,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
4149
4179
|
variableOverrides
|
|
4150
4180
|
);
|
|
4151
4181
|
assignMediaRenderIds(document2);
|
|
4152
|
-
return document2.toString();
|
|
4182
|
+
return { html: document2.toString(), variablesByComp: result.variablesByComp };
|
|
4153
4183
|
}
|
|
4154
4184
|
function ensureFullDocument(html) {
|
|
4155
4185
|
const trimmed = html.trim();
|
|
@@ -4604,6 +4634,7 @@ async function embedLocalFontFaces(html, projectDir, assetRoot, log = defaultLog
|
|
|
4604
4634
|
embeddedPaths.add(localPath);
|
|
4605
4635
|
continue;
|
|
4606
4636
|
}
|
|
4637
|
+
if (isPrivateCompositionFile(projectDir, absPath)) continue;
|
|
4607
4638
|
const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
|
|
4608
4639
|
try {
|
|
4609
4640
|
if (fileBackedAbsolutePaths.has(absPath)) {
|
|
@@ -4725,6 +4756,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
4725
4756
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
4726
4757
|
rawHtml,
|
|
4727
4758
|
projectDir,
|
|
4759
|
+
projectDir,
|
|
4728
4760
|
downloadDir,
|
|
4729
4761
|
options.log,
|
|
4730
4762
|
options.urlByAbsentLocalPath,
|
|
@@ -4741,7 +4773,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
4741
4773
|
assetRoot
|
|
4742
4774
|
);
|
|
4743
4775
|
const fullHtml = ensureFullDocument(compiledHtml);
|
|
4744
|
-
const inlinedHtml = inlineSubCompositions(
|
|
4776
|
+
const { html: inlinedHtml, variablesByComp } = inlineSubCompositions(
|
|
4745
4777
|
fullHtml,
|
|
4746
4778
|
subCompositions,
|
|
4747
4779
|
projectDir,
|
|
@@ -4857,7 +4889,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
4857
4889
|
for (const video of videos) {
|
|
4858
4890
|
if (isHttpUrl(video.src)) continue;
|
|
4859
4891
|
const videoPath = resolve6(projectDir, video.src);
|
|
4860
|
-
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync7(videoPath) || escapesAssetRoot(videoPath, assetRoot))
|
|
4892
|
+
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync7(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir, downloadDir]))
|
|
4861
4893
|
continue;
|
|
4862
4894
|
advised.add(videoPath);
|
|
4863
4895
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
@@ -4894,6 +4926,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
4894
4926
|
gradedCanvas,
|
|
4895
4927
|
...masterFxChain ? { masterFxChain } : {},
|
|
4896
4928
|
unresolvedCompositions,
|
|
4929
|
+
variablesByComp,
|
|
4897
4930
|
externalAssets,
|
|
4898
4931
|
width,
|
|
4899
4932
|
height,
|
|
@@ -5487,7 +5520,8 @@ import {
|
|
|
5487
5520
|
readMediaStart as readMediaStart2,
|
|
5488
5521
|
shiftRateLane as shiftRateLane2,
|
|
5489
5522
|
sourceTimeAt as sourceTimeAt3,
|
|
5490
|
-
timeAtSourceTime
|
|
5523
|
+
timeAtSourceTime,
|
|
5524
|
+
terminalText as terminalText5
|
|
5491
5525
|
} from "@hyperframes/core";
|
|
5492
5526
|
import { parseHostVariableValues as parseHostVariableValues2, readDeclaredDefaults as readDeclaredDefaults2 } from "@hyperframes/core/compiler";
|
|
5493
5527
|
import { extractMediaSrcMutations } from "@hyperframes/parsers";
|
|
@@ -5535,15 +5569,22 @@ function hasAutoStartVideos(html) {
|
|
|
5535
5569
|
const { document: document2 } = parseHTML6(html);
|
|
5536
5570
|
return document2.querySelector("video[data-hf-auto-start]") !== null;
|
|
5537
5571
|
}
|
|
5538
|
-
function
|
|
5572
|
+
function scopedVariablesFor(element, variablesByComp) {
|
|
5573
|
+
const scope = element.closest("[data-composition-id]");
|
|
5574
|
+
const compId = scope?.getAttribute("data-composition-id")?.trim() ?? "";
|
|
5575
|
+
return compId && Object.hasOwn(variablesByComp, compId) ? variablesByComp[compId] : void 0;
|
|
5576
|
+
}
|
|
5577
|
+
function variableHasValue(element, variableId, variables, variablesByComp) {
|
|
5539
5578
|
if (variables && Object.hasOwn(variables, variableId)) return true;
|
|
5579
|
+
const scoped = scopedVariablesFor(element, variablesByComp);
|
|
5580
|
+
if (scoped) return Object.hasOwn(scoped, variableId);
|
|
5540
5581
|
for (let scope = element.parentElement; scope; scope = scope.parentElement) {
|
|
5541
5582
|
if (Object.hasOwn(parseHostVariableValues2(scope), variableId)) return true;
|
|
5542
5583
|
if (Object.hasOwn(readDeclaredDefaults2(scope), variableId)) return true;
|
|
5543
5584
|
}
|
|
5544
5585
|
return Object.hasOwn(readDeclaredDefaults2(element.ownerDocument.documentElement), variableId);
|
|
5545
5586
|
}
|
|
5546
|
-
function hasVariableBoundMedia(html, variables) {
|
|
5587
|
+
function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
|
|
5547
5588
|
const { document: document2 } = parseHTML6(html);
|
|
5548
5589
|
return Array.from(
|
|
5549
5590
|
document2.querySelectorAll(
|
|
@@ -5551,7 +5592,7 @@ function hasVariableBoundMedia(html, variables) {
|
|
|
5551
5592
|
)
|
|
5552
5593
|
).some((element) => {
|
|
5553
5594
|
const variableId = element.getAttribute("data-var-src")?.trim();
|
|
5554
|
-
return Boolean(variableId && variableHasValue(element, variableId, variables));
|
|
5595
|
+
return Boolean(variableId && variableHasValue(element, variableId, variables, variablesByComp));
|
|
5555
5596
|
});
|
|
5556
5597
|
}
|
|
5557
5598
|
function authoredMediaStarts(html) {
|
|
@@ -5666,7 +5707,11 @@ async function runProbeStage(input) {
|
|
|
5666
5707
|
compiled.html,
|
|
5667
5708
|
composition.audios.length
|
|
5668
5709
|
);
|
|
5669
|
-
const hasVariableMedia = hasVariableBoundMedia(
|
|
5710
|
+
const hasVariableMedia = hasVariableBoundMedia(
|
|
5711
|
+
compiled.html,
|
|
5712
|
+
job.config.variables,
|
|
5713
|
+
compiled.variablesByComp
|
|
5714
|
+
);
|
|
5670
5715
|
const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
|
|
5671
5716
|
const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
|
|
5672
5717
|
durationSeconds: composition.duration,
|
|
@@ -6120,7 +6165,7 @@ async function runProbeStage(input) {
|
|
|
6120
6165
|
failures: failedRequests.slice(0, 10)
|
|
6121
6166
|
});
|
|
6122
6167
|
for (const line of failedRequests.slice(0, 5)) {
|
|
6123
|
-
console.warn(`[Render] Asset load failure: ${line}`);
|
|
6168
|
+
console.warn(`[Render] Asset load failure: ${terminalText5(line)}`);
|
|
6124
6169
|
}
|
|
6125
6170
|
}
|
|
6126
6171
|
}
|
|
@@ -6233,7 +6278,7 @@ import {
|
|
|
6233
6278
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
6234
6279
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
6235
6280
|
isHttpUrl as isHttpUrl3,
|
|
6236
|
-
|
|
6281
|
+
assetRootsRefusal,
|
|
6237
6282
|
assertPublicHttpsUrl,
|
|
6238
6283
|
downloadToTemp as downloadToTemp2,
|
|
6239
6284
|
resolveRestrictPageNetwork,
|
|
@@ -6671,7 +6716,7 @@ function isPublicHttpsUrl(url) {
|
|
|
6671
6716
|
}
|
|
6672
6717
|
}
|
|
6673
6718
|
function opensLocally(path, assetRoots) {
|
|
6674
|
-
return existsSync9(path) && (!assetRoots ||
|
|
6719
|
+
return existsSync9(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
|
|
6675
6720
|
}
|
|
6676
6721
|
function localProbeSource(src, input) {
|
|
6677
6722
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
@@ -6739,7 +6784,8 @@ import {
|
|
|
6739
6784
|
audioFailureDiagnostics,
|
|
6740
6785
|
processCompositionAudio,
|
|
6741
6786
|
removeScratch as removeScratch2,
|
|
6742
|
-
collectScratchLeftovers
|
|
6787
|
+
collectScratchLeftovers,
|
|
6788
|
+
withFfmpegProgress
|
|
6743
6789
|
} from "@hyperframes/engine";
|
|
6744
6790
|
|
|
6745
6791
|
// src/services/render/audioDeliveryLimit.ts
|
|
@@ -6765,7 +6811,8 @@ import {
|
|
|
6765
6811
|
removeScratch,
|
|
6766
6812
|
renameWithRetry as renameWithRetry5,
|
|
6767
6813
|
runFfmpeg as runFfmpeg5,
|
|
6768
|
-
trackChildProcess
|
|
6814
|
+
trackChildProcess,
|
|
6815
|
+
withPublicOnlyProxy
|
|
6769
6816
|
} from "@hyperframes/engine";
|
|
6770
6817
|
import { redactKnownPaths, redactTelemetryString as redactTelemetryString3 } from "@hyperframes/core";
|
|
6771
6818
|
|
|
@@ -7207,7 +7254,17 @@ async function runFfprobeJson(args, signal) {
|
|
|
7207
7254
|
if (!args.includes("--")) {
|
|
7208
7255
|
throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".');
|
|
7209
7256
|
}
|
|
7257
|
+
const proxying = withPublicOnlyProxy(args, [args.indexOf("--") + 1]);
|
|
7258
|
+
const routed = proxying && await proxying;
|
|
7259
|
+
try {
|
|
7260
|
+
return await spawnFfprobeJson(routed?.args ?? args, routed?.env, signal);
|
|
7261
|
+
} finally {
|
|
7262
|
+
await routed?.close();
|
|
7263
|
+
}
|
|
7264
|
+
}
|
|
7265
|
+
async function spawnFfprobeJson(args, env, signal) {
|
|
7210
7266
|
const proc = spawn(getFfprobeBinary(), args, {
|
|
7267
|
+
...env && { env },
|
|
7211
7268
|
stdio: ["ignore", "pipe", "pipe"],
|
|
7212
7269
|
windowsHide: true
|
|
7213
7270
|
});
|
|
@@ -7323,7 +7380,8 @@ function assertAudioNotInterrupted(failures) {
|
|
|
7323
7380
|
}
|
|
7324
7381
|
function runAudioStage(input) {
|
|
7325
7382
|
return collectScratchLeftovers(
|
|
7326
|
-
() =>
|
|
7383
|
+
() => withFfmpegProgress(input.onFfmpegProgress ?? (() => {
|
|
7384
|
+
}), () => runAudioStageScoped(input)),
|
|
7327
7385
|
(left) => {
|
|
7328
7386
|
if (left.length > 0) input.log?.warn("[audio] scratch left behind", { count: left.length });
|
|
7329
7387
|
}
|
|
@@ -10732,9 +10790,12 @@ function resolveDistributedEngineConfig(config) {
|
|
|
10732
10790
|
forceScreenshotExplicitlyOptedOut: true
|
|
10733
10791
|
};
|
|
10734
10792
|
}
|
|
10793
|
+
function leavesRoot(rel) {
|
|
10794
|
+
return rel === ".." || rel.startsWith(`..${sep4}`) || isAbsolute3(rel);
|
|
10795
|
+
}
|
|
10735
10796
|
function pathInside(root, path) {
|
|
10736
10797
|
const rel = relative6(root, path);
|
|
10737
|
-
return rel === "" ||
|
|
10798
|
+
return rel === "" || leavesRoot(rel) ? null : rel;
|
|
10738
10799
|
}
|
|
10739
10800
|
function stableSourcePath(roots, srcPath) {
|
|
10740
10801
|
for (const [root, prefix] of roots) {
|
|
@@ -10828,7 +10889,8 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
10828
10889
|
dereference: true,
|
|
10829
10890
|
filter: (src) => {
|
|
10830
10891
|
const rel = relative6(projectDir, src);
|
|
10831
|
-
if (rel === ""
|
|
10892
|
+
if (rel === "") return true;
|
|
10893
|
+
if (leavesRoot(rel)) return false;
|
|
10832
10894
|
if (job.config.allowOutsideProjectAssets) {
|
|
10833
10895
|
if (refusesOutsideLink(projectDir, src, (line) => log.warn(`[Plan] ${line}`))) return false;
|
|
10834
10896
|
} else if (!isSafePath2(projectDir, src)) return false;
|
|
@@ -13654,7 +13716,7 @@ function hashProjectDir(projectDir, files = listSiteFiles(projectDir)) {
|
|
|
13654
13716
|
}
|
|
13655
13717
|
|
|
13656
13718
|
// src/services/distributed/audioSidecar.ts
|
|
13657
|
-
import { extractAudioMetadata as extractAudioMetadata4, runFfmpeg as runFfmpeg9 } from "@hyperframes/engine";
|
|
13719
|
+
import { extractAudioMetadata as extractAudioMetadata4, runFfmpeg as runFfmpeg9, urlInputArgs as urlInputArgs4 } from "@hyperframes/engine";
|
|
13658
13720
|
import { extname as extname5 } from "node:path";
|
|
13659
13721
|
var AUDIO_SIDECAR_MIN_BYTES = 32 * 1024 * 1024;
|
|
13660
13722
|
var AUDIO_SIDECAR_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov", ".m4v"]);
|
|
@@ -13666,13 +13728,19 @@ async function buildAudioSidecar(inputPath, outputPath, signal) {
|
|
|
13666
13728
|
if (!audio) return await ffmpegIsMissing(signal) ? "unavailable" : "none";
|
|
13667
13729
|
if (audio.audioStreamCount !== 1 || (audio.audioStreamLeadSeconds ?? 0) > 0) return "none";
|
|
13668
13730
|
const result = await runFfmpeg9(
|
|
13669
|
-
[
|
|
13670
|
-
"-
|
|
13671
|
-
"
|
|
13672
|
-
"-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13731
|
+
[
|
|
13732
|
+
"-v",
|
|
13733
|
+
"error",
|
|
13734
|
+
"-y",
|
|
13735
|
+
...urlInputArgs4(inputPath),
|
|
13736
|
+
"-i",
|
|
13737
|
+
inputPath,
|
|
13738
|
+
"-map",
|
|
13739
|
+
"0:a:0",
|
|
13740
|
+
"-vn",
|
|
13741
|
+
"-c:a",
|
|
13742
|
+
"copy"
|
|
13743
|
+
].concat(["-movflags", "+faststart", "-f", "mp4", outputPath]),
|
|
13676
13744
|
{ signal }
|
|
13677
13745
|
);
|
|
13678
13746
|
if (result.success) return "built";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "73bf2dda8476c060c49e37754736b20068b99580b654d5fe44f5918fc63eeaa8",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|