@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/index.js
CHANGED
|
@@ -382,7 +382,7 @@ import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:p
|
|
|
382
382
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
383
383
|
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
384
384
|
import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
|
|
385
|
-
import { fpsToNumber } from "@hyperframes/core";
|
|
385
|
+
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
386
386
|
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
387
387
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
388
388
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
@@ -473,6 +473,7 @@ function getHfEarlyStub() {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// src/logger.ts
|
|
476
|
+
import { terminalText } from "@hyperframes/core";
|
|
476
477
|
var LOG_LEVEL_PRIORITY = {
|
|
477
478
|
error: 0,
|
|
478
479
|
warn: 1,
|
|
@@ -482,26 +483,26 @@ var LOG_LEVEL_PRIORITY = {
|
|
|
482
483
|
function createConsoleLogger(level = "info") {
|
|
483
484
|
const threshold = LOG_LEVEL_PRIORITY[level];
|
|
484
485
|
const shouldLog = (msgLevel) => LOG_LEVEL_PRIORITY[msgLevel] <= threshold;
|
|
485
|
-
const formatMeta = (meta) => meta ? ` ${JSON.stringify(meta)}` : "";
|
|
486
|
+
const formatMeta = (meta) => meta ? ` ${terminalText(JSON.stringify(meta))}` : "";
|
|
486
487
|
return {
|
|
487
488
|
error(message, meta) {
|
|
488
489
|
if (shouldLog("error")) {
|
|
489
|
-
console.error(`[ERROR] ${message}${formatMeta(meta)}`);
|
|
490
|
+
console.error(`[ERROR] ${terminalText(message)}${formatMeta(meta)}`);
|
|
490
491
|
}
|
|
491
492
|
},
|
|
492
493
|
warn(message, meta) {
|
|
493
494
|
if (shouldLog("warn")) {
|
|
494
|
-
console.warn(`[WARN] ${message}${formatMeta(meta)}`);
|
|
495
|
+
console.warn(`[WARN] ${terminalText(message)}${formatMeta(meta)}`);
|
|
495
496
|
}
|
|
496
497
|
},
|
|
497
498
|
info(message, meta) {
|
|
498
499
|
if (shouldLog("info")) {
|
|
499
|
-
console.error(`[INFO] ${message}${formatMeta(meta)}`);
|
|
500
|
+
console.error(`[INFO] ${terminalText(message)}${formatMeta(meta)}`);
|
|
500
501
|
}
|
|
501
502
|
},
|
|
502
503
|
debug(message, meta) {
|
|
503
504
|
if (shouldLog("debug")) {
|
|
504
|
-
console.error(`[DEBUG] ${message}${formatMeta(meta)}`);
|
|
505
|
+
console.error(`[DEBUG] ${terminalText(message)}${formatMeta(meta)}`);
|
|
505
506
|
}
|
|
506
507
|
},
|
|
507
508
|
isLevelEnabled(msgLevel) {
|
|
@@ -1150,7 +1151,7 @@ function createFileServer(options) {
|
|
|
1150
1151
|
const headScripts = options.headScripts ?? [getVerifiedHyperframeRuntimeSource()];
|
|
1151
1152
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
1152
1153
|
const app = new Hono();
|
|
1153
|
-
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
1154
|
+
const warnLeftOut = (line) => console.warn(`[FileServer] ${terminalText2(line)}`);
|
|
1154
1155
|
let listeningPort = -1;
|
|
1155
1156
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
1156
1157
|
await next();
|
|
@@ -1174,7 +1175,7 @@ function createFileServer(options) {
|
|
|
1174
1175
|
}
|
|
1175
1176
|
if (!file) {
|
|
1176
1177
|
if (!/favicon\.ico$/i.test(requestPath)) {
|
|
1177
|
-
console.warn(`[FileServer] 404 Not Found: ${requestPath}`);
|
|
1178
|
+
console.warn(`[FileServer] 404 Not Found: ${terminalText2(requestPath)}`);
|
|
1178
1179
|
}
|
|
1179
1180
|
return c.text("Not found", 404);
|
|
1180
1181
|
}
|
|
@@ -1415,7 +1416,8 @@ import {
|
|
|
1415
1416
|
import { basename as basename2, dirname as dirname2, isAbsolute, join as join3, relative, resolve as resolve3 } from "node:path";
|
|
1416
1417
|
import {
|
|
1417
1418
|
CANVAS_DIMENSIONS,
|
|
1418
|
-
checkOutputResolutionCompatibility
|
|
1419
|
+
checkOutputResolutionCompatibility,
|
|
1420
|
+
terminalText as terminalText3
|
|
1419
1421
|
} from "@hyperframes/core";
|
|
1420
1422
|
import {
|
|
1421
1423
|
mediaIdPathSegment
|
|
@@ -1460,7 +1462,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
1460
1462
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
1461
1463
|
const outPath = join3(compileDir, srcPath);
|
|
1462
1464
|
if (!isPathInside(outPath, compileDir)) {
|
|
1463
|
-
console.warn(`[Render] Skipping sub-composition with unsafe path: ${srcPath}`);
|
|
1465
|
+
console.warn(`[Render] Skipping sub-composition with unsafe path: ${terminalText3(srcPath)}`);
|
|
1464
1466
|
continue;
|
|
1465
1467
|
}
|
|
1466
1468
|
mkdirSync(dirname2(outPath), { recursive: true });
|
|
@@ -1469,7 +1471,9 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
1469
1471
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
1470
1472
|
const outPath = resolve3(join3(compileDir, relativePath));
|
|
1471
1473
|
if (!isPathInside(outPath, compileDir)) {
|
|
1472
|
-
console.warn(
|
|
1474
|
+
console.warn(
|
|
1475
|
+
`[Render] Skipping external asset with unsafe path: ${terminalText3(relativePath)}`
|
|
1476
|
+
);
|
|
1473
1477
|
continue;
|
|
1474
1478
|
}
|
|
1475
1479
|
mkdirSync(dirname2(outPath), { recursive: true });
|
|
@@ -1576,6 +1580,30 @@ function reportEncodeProgress(job, done, total, onProgress, from) {
|
|
|
1576
1580
|
"encoding"
|
|
1577
1581
|
);
|
|
1578
1582
|
}
|
|
1583
|
+
var AUDIO_STAGE = "Processing audio tracks";
|
|
1584
|
+
var AUDIO_WAIT_REPORT_MS = 5e3;
|
|
1585
|
+
function audioWaitReporter(job, onProgress) {
|
|
1586
|
+
let waiting2 = false;
|
|
1587
|
+
let reportedAt = -Infinity;
|
|
1588
|
+
return {
|
|
1589
|
+
progressed() {
|
|
1590
|
+
const now = Date.now();
|
|
1591
|
+
if (!waiting2 || now - reportedAt < AUDIO_WAIT_REPORT_MS) return;
|
|
1592
|
+
reportedAt = now;
|
|
1593
|
+
updateJobStatus(job, job.status, AUDIO_STAGE, job.progress, onProgress, {
|
|
1594
|
+
code: "process_audio"
|
|
1595
|
+
});
|
|
1596
|
+
},
|
|
1597
|
+
async wait(audio) {
|
|
1598
|
+
waiting2 = true;
|
|
1599
|
+
try {
|
|
1600
|
+
return await audio;
|
|
1601
|
+
} finally {
|
|
1602
|
+
waiting2 = false;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1579
1607
|
var lastAssembleReportAt = /* @__PURE__ */ new WeakMap();
|
|
1580
1608
|
function reportAssembleProgress(job, done, total, onProgress) {
|
|
1581
1609
|
if (total <= 0) return;
|
|
@@ -3369,6 +3397,7 @@ import {
|
|
|
3369
3397
|
resolveProjectRelativeSrc,
|
|
3370
3398
|
resolveVideoExtractionWindow,
|
|
3371
3399
|
runFfmpeg,
|
|
3400
|
+
urlInputArgs,
|
|
3372
3401
|
videoStartOnMediaTimeline
|
|
3373
3402
|
} from "@hyperframes/engine";
|
|
3374
3403
|
import { fpsToFfmpegArg, fpsToNumber as fpsToNumber3 } from "@hyperframes/core";
|
|
@@ -3661,7 +3690,15 @@ function hdrWindowFrames(frameSize, windowBytes) {
|
|
|
3661
3690
|
return Math.max(8, Math.floor(windowBytes / frameSize));
|
|
3662
3691
|
}
|
|
3663
3692
|
async function probeFirstTick(srcPath, mediaStart, fps, runFfmpegImpl, abortSignal) {
|
|
3664
|
-
const args = [
|
|
3693
|
+
const args = [
|
|
3694
|
+
...urlInputArgs(srcPath),
|
|
3695
|
+
"-ss",
|
|
3696
|
+
String(mediaStart),
|
|
3697
|
+
"-i",
|
|
3698
|
+
srcPath,
|
|
3699
|
+
"-frames:v",
|
|
3700
|
+
"1"
|
|
3701
|
+
];
|
|
3665
3702
|
const result = await runFfmpegImpl([...args, ...["-vf", "showinfo", "-f", "null", "-"]], {
|
|
3666
3703
|
signal: abortSignal
|
|
3667
3704
|
});
|
|
@@ -3735,6 +3772,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
3735
3772
|
// Decode before seeking for the one-frame path. Input-side seeking can
|
|
3736
3773
|
// return zero frames for valid unindexed/negative-base transports.
|
|
3737
3774
|
[
|
|
3775
|
+
...urlInputArgs(srcPath),
|
|
3738
3776
|
"-i",
|
|
3739
3777
|
srcPath,
|
|
3740
3778
|
"-ss",
|
|
@@ -3819,6 +3857,7 @@ function hdrWindowFfmpegArgs(a) {
|
|
|
3819
3857
|
const filters = [`fps=${a.fpsArg}:start_time=${(a.firstTick / a.fps).toFixed(6)}`, a.scale];
|
|
3820
3858
|
if (trim > 0) filters.push(`trim=start_frame=${trim}`);
|
|
3821
3859
|
return [
|
|
3860
|
+
...urlInputArgs(a.srcPath),
|
|
3822
3861
|
...["-ss", (a.ffmpegSeek + seekFrame / a.fps).toFixed(6), "-i", a.srcPath],
|
|
3823
3862
|
...["-vf", filters.join(","), "-frames:v", String(a.frames), "-fps_mode", "passthrough"]
|
|
3824
3863
|
];
|
|
@@ -6894,7 +6933,8 @@ import {
|
|
|
6894
6933
|
rewriteAssetPath,
|
|
6895
6934
|
rewriteAssetPaths,
|
|
6896
6935
|
rewriteCssAssetUrls,
|
|
6897
|
-
rewriteInlineStyleAssetUrls
|
|
6936
|
+
rewriteInlineStyleAssetUrls,
|
|
6937
|
+
terminalText as terminalText4
|
|
6898
6938
|
} from "@hyperframes/core";
|
|
6899
6939
|
import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
|
|
6900
6940
|
import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
|
|
@@ -7105,6 +7145,7 @@ function placeAudio(audio, window2) {
|
|
|
7105
7145
|
import {
|
|
7106
7146
|
analyzeKeyframeIntervals,
|
|
7107
7147
|
assertMediaPayload,
|
|
7148
|
+
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots3,
|
|
7108
7149
|
NotMediaPayloadError as NotMediaPayloadError2,
|
|
7109
7150
|
parseMasterFxChain,
|
|
7110
7151
|
probeMediaProfile as probeMediaProfile2
|
|
@@ -7132,7 +7173,13 @@ import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as
|
|
|
7132
7173
|
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join16, resolve as resolve5 } from "node:path";
|
|
7133
7174
|
import { parseHTML as parseHTML3 } from "linkedom";
|
|
7134
7175
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
7135
|
-
import {
|
|
7176
|
+
import {
|
|
7177
|
+
DEFAULT_VP9_CPU_USED,
|
|
7178
|
+
isPrivateUnderAssetRoots,
|
|
7179
|
+
runFfmpeg as runFfmpeg2,
|
|
7180
|
+
renameWithRetry as renameWithRetry3,
|
|
7181
|
+
urlInputArgs as urlInputArgs2
|
|
7182
|
+
} from "@hyperframes/engine";
|
|
7136
7183
|
import { namesAnotherNetworkRoot } from "@hyperframes/parsers/asset-resolution";
|
|
7137
7184
|
var PREPARED_GIF_SUBDIR = "_animated_gif";
|
|
7138
7185
|
var CACHE_SCHEMA = "hfgif-v1";
|
|
@@ -7175,7 +7222,7 @@ function resolveLocalImageSourcePath(src, options) {
|
|
|
7175
7222
|
isAbsolute2(basePath) ? basePath : resolve5(options.projectDir, projectRelative),
|
|
7176
7223
|
resolve5(options.downloadDir, normalizedBase)
|
|
7177
7224
|
];
|
|
7178
|
-
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && (!escapesAssetRoot(candidate, options.assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
|
|
7225
|
+
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));
|
|
7179
7226
|
return candidates.find((candidate) => allowed(candidate) && existsSync9(candidate)) ?? null;
|
|
7180
7227
|
}
|
|
7181
7228
|
function isUsableFile(path) {
|
|
@@ -7244,6 +7291,7 @@ function buildAnimatedGifTranscodeArgs(input) {
|
|
|
7244
7291
|
args.push(
|
|
7245
7292
|
"-ignore_loop",
|
|
7246
7293
|
"1",
|
|
7294
|
+
...urlInputArgs2(input.inputPath),
|
|
7247
7295
|
"-i",
|
|
7248
7296
|
input.inputPath,
|
|
7249
7297
|
"-an",
|
|
@@ -7449,7 +7497,7 @@ import {
|
|
|
7449
7497
|
} from "node:fs";
|
|
7450
7498
|
import { dirname as dirname7, join as join17, resolve as resolve6 } from "node:path";
|
|
7451
7499
|
import { parseHTML as parseHTML4 } from "linkedom";
|
|
7452
|
-
import { renameWithRetry as renameWithRetry4, runFfmpeg as runFfmpeg3, runFfprobe } from "@hyperframes/engine";
|
|
7500
|
+
import { renameWithRetry as renameWithRetry4, runFfmpeg as runFfmpeg3, runFfprobe, urlInputArgs as urlInputArgs3 } from "@hyperframes/engine";
|
|
7453
7501
|
|
|
7454
7502
|
// src/services/heifRotation.ts
|
|
7455
7503
|
function* boxes(buf, start, end) {
|
|
@@ -7648,6 +7696,7 @@ async function convertHeifToJpeg(request) {
|
|
|
7648
7696
|
"-hide_banner",
|
|
7649
7697
|
"-loglevel",
|
|
7650
7698
|
"error",
|
|
7699
|
+
...urlInputArgs3(request.inputPath),
|
|
7651
7700
|
"-i",
|
|
7652
7701
|
request.inputPath,
|
|
7653
7702
|
...mapArgs,
|
|
@@ -7771,7 +7820,9 @@ import {
|
|
|
7771
7820
|
fingerprintElementId,
|
|
7772
7821
|
isHttpUrl as isHttpUrl2,
|
|
7773
7822
|
isInsideAssetRoots,
|
|
7823
|
+
isNotImagePayload,
|
|
7774
7824
|
isNotMediaPayload,
|
|
7825
|
+
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots2,
|
|
7775
7826
|
playlistLeavesItsFolder,
|
|
7776
7827
|
NotMediaPayloadError,
|
|
7777
7828
|
probeMediaProfile,
|
|
@@ -7826,6 +7877,10 @@ function dropMediaOutsideProject(input) {
|
|
|
7826
7877
|
const staysInside = ({ id, src }) => {
|
|
7827
7878
|
if (!src || isHttpUrl2(src)) return true;
|
|
7828
7879
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
7880
|
+
if (isPrivateUnderAssetRoots2(path, roots)) {
|
|
7881
|
+
log.warn(`[Render] Media "${id}" source is missing: it is a private project file`, { src });
|
|
7882
|
+
return false;
|
|
7883
|
+
}
|
|
7829
7884
|
if (isInsideAssetRoots(path, roots)) return true;
|
|
7830
7885
|
if (input.allowOutsideProjectAssets) {
|
|
7831
7886
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
@@ -7842,6 +7897,8 @@ function dropMediaOutsideProject(input) {
|
|
|
7842
7897
|
async function notMediaReferences(path, references) {
|
|
7843
7898
|
const videos = references.filter((ref) => ref.expected === "video");
|
|
7844
7899
|
if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
|
|
7900
|
+
const images = references.filter((ref) => ref.expected === "image");
|
|
7901
|
+
if (images.length > 0 && await isNotImagePayload(path)) return images;
|
|
7845
7902
|
return await playlistLeavesItsFolder(path) ? references : [];
|
|
7846
7903
|
}
|
|
7847
7904
|
async function preflightCompositionAssetMediaTypes(input) {
|
|
@@ -8130,7 +8187,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
8130
8187
|
}
|
|
8131
8188
|
return false;
|
|
8132
8189
|
}
|
|
8133
|
-
async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
8190
|
+
async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
8134
8191
|
let filePath = src;
|
|
8135
8192
|
if (isHttpUrl(src)) {
|
|
8136
8193
|
const remoteDir = join19(downloadDir, REMOTE_MEDIA_SUBDIR);
|
|
@@ -8145,7 +8202,9 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
|
|
|
8145
8202
|
} else {
|
|
8146
8203
|
filePath = decodedUrlPath(src);
|
|
8147
8204
|
if (!filePath.startsWith("/")) filePath = join19(baseDir, filePath);
|
|
8148
|
-
if (escapesAssetRoot(filePath, assetRoot)
|
|
8205
|
+
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir, downloadDir])) {
|
|
8206
|
+
return { duration: null, resolvedPath: filePath };
|
|
8207
|
+
}
|
|
8149
8208
|
filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
|
|
8150
8209
|
if (!isHttpUrl(filePath) && namesAnotherNetworkRoot2(baseDir, filePath)) {
|
|
8151
8210
|
return { duration: null, resolvedPath: filePath };
|
|
@@ -8221,7 +8280,7 @@ function markInferredVariableMediaDurations(html, unresolvedMedia) {
|
|
|
8221
8280
|
}
|
|
8222
8281
|
return changed ? document2.toString() : html;
|
|
8223
8282
|
}
|
|
8224
|
-
async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
8283
|
+
async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
8225
8284
|
const { html: staticCompiled, unresolved } = compileTimingAttrs(html);
|
|
8226
8285
|
const mediaUnresolved = unresolved.filter(
|
|
8227
8286
|
(el) => (el.tagName === "video" || el.tagName === "audio") && el.src
|
|
@@ -8233,6 +8292,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
8233
8292
|
el.src,
|
|
8234
8293
|
el.mediaStart,
|
|
8235
8294
|
el.playbackRate,
|
|
8295
|
+
projectDir,
|
|
8236
8296
|
baseDir,
|
|
8237
8297
|
downloadDir,
|
|
8238
8298
|
el.tagName,
|
|
@@ -8257,6 +8317,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
8257
8317
|
el.src,
|
|
8258
8318
|
el.mediaStart,
|
|
8259
8319
|
el.playbackRate,
|
|
8320
|
+
projectDir,
|
|
8260
8321
|
baseDir,
|
|
8261
8322
|
downloadDir,
|
|
8262
8323
|
el.tagName,
|
|
@@ -8312,6 +8373,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
8312
8373
|
workItems.map(async (item) => {
|
|
8313
8374
|
const { html: compiledSub } = await compileHtmlFile(
|
|
8314
8375
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
8376
|
+
projectDir,
|
|
8315
8377
|
dirname9(item.filePath),
|
|
8316
8378
|
downloadDir,
|
|
8317
8379
|
void 0,
|
|
@@ -8473,7 +8535,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8473
8535
|
{},
|
|
8474
8536
|
variableOverrides
|
|
8475
8537
|
);
|
|
8476
|
-
return emitted ? document2.toString() : html;
|
|
8538
|
+
return { html: emitted ? document2.toString() : html, variablesByComp: {} };
|
|
8477
8539
|
}
|
|
8478
8540
|
const hostIdentityByElement = new ProducerHostIdentityMap(
|
|
8479
8541
|
document2,
|
|
@@ -8514,7 +8576,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8514
8576
|
flattenInnerRoot: prepareFlattenedInnerRoot,
|
|
8515
8577
|
onMissingComposition: (srcPath, reason) => {
|
|
8516
8578
|
console.warn(
|
|
8517
|
-
|
|
8579
|
+
terminalText4(
|
|
8580
|
+
`[Compiler] Skipping sub-composition "${srcPath}": ${reason ?? "the file is missing or empty"}.`
|
|
8581
|
+
)
|
|
8518
8582
|
);
|
|
8519
8583
|
}
|
|
8520
8584
|
}
|
|
@@ -8585,7 +8649,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8585
8649
|
variableOverrides
|
|
8586
8650
|
);
|
|
8587
8651
|
assignMediaRenderIds(document2);
|
|
8588
|
-
return document2.toString();
|
|
8652
|
+
return { html: document2.toString(), variablesByComp: result.variablesByComp };
|
|
8589
8653
|
}
|
|
8590
8654
|
function ensureFullDocument(html) {
|
|
8591
8655
|
const trimmed = html.trim();
|
|
@@ -9043,6 +9107,7 @@ async function embedLocalFontFaces(html, projectDir, assetRoot, log = defaultLog
|
|
|
9043
9107
|
embeddedPaths.add(localPath);
|
|
9044
9108
|
continue;
|
|
9045
9109
|
}
|
|
9110
|
+
if (isPrivateCompositionFile(projectDir, absPath)) continue;
|
|
9046
9111
|
const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
|
|
9047
9112
|
try {
|
|
9048
9113
|
if (fileBackedAbsolutePaths.has(absPath)) {
|
|
@@ -9164,6 +9229,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9164
9229
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
9165
9230
|
rawHtml,
|
|
9166
9231
|
projectDir,
|
|
9232
|
+
projectDir,
|
|
9167
9233
|
downloadDir,
|
|
9168
9234
|
options.log,
|
|
9169
9235
|
options.urlByAbsentLocalPath,
|
|
@@ -9180,7 +9246,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9180
9246
|
assetRoot
|
|
9181
9247
|
);
|
|
9182
9248
|
const fullHtml = ensureFullDocument(compiledHtml);
|
|
9183
|
-
const inlinedHtml = inlineSubCompositions(
|
|
9249
|
+
const { html: inlinedHtml, variablesByComp } = inlineSubCompositions(
|
|
9184
9250
|
fullHtml,
|
|
9185
9251
|
subCompositions,
|
|
9186
9252
|
projectDir,
|
|
@@ -9296,7 +9362,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9296
9362
|
for (const video of videos) {
|
|
9297
9363
|
if (isHttpUrl(video.src)) continue;
|
|
9298
9364
|
const videoPath = resolve7(projectDir, video.src);
|
|
9299
|
-
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync11(videoPath) || escapesAssetRoot(videoPath, assetRoot))
|
|
9365
|
+
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync11(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir, downloadDir]))
|
|
9300
9366
|
continue;
|
|
9301
9367
|
advised.add(videoPath);
|
|
9302
9368
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
@@ -9333,6 +9399,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9333
9399
|
gradedCanvas,
|
|
9334
9400
|
...masterFxChain ? { masterFxChain } : {},
|
|
9335
9401
|
unresolvedCompositions,
|
|
9402
|
+
variablesByComp,
|
|
9336
9403
|
externalAssets,
|
|
9337
9404
|
width,
|
|
9338
9405
|
height,
|
|
@@ -9926,7 +9993,8 @@ import {
|
|
|
9926
9993
|
readMediaStart as readMediaStart2,
|
|
9927
9994
|
shiftRateLane as shiftRateLane2,
|
|
9928
9995
|
sourceTimeAt as sourceTimeAt3,
|
|
9929
|
-
timeAtSourceTime
|
|
9996
|
+
timeAtSourceTime,
|
|
9997
|
+
terminalText as terminalText5
|
|
9930
9998
|
} from "@hyperframes/core";
|
|
9931
9999
|
import { parseHostVariableValues as parseHostVariableValues2, readDeclaredDefaults as readDeclaredDefaults2 } from "@hyperframes/core/compiler";
|
|
9932
10000
|
import { extractMediaSrcMutations } from "@hyperframes/parsers";
|
|
@@ -9974,15 +10042,22 @@ function hasAutoStartVideos(html) {
|
|
|
9974
10042
|
const { document: document2 } = parseHTML6(html);
|
|
9975
10043
|
return document2.querySelector("video[data-hf-auto-start]") !== null;
|
|
9976
10044
|
}
|
|
9977
|
-
function
|
|
10045
|
+
function scopedVariablesFor(element, variablesByComp) {
|
|
10046
|
+
const scope = element.closest("[data-composition-id]");
|
|
10047
|
+
const compId = scope?.getAttribute("data-composition-id")?.trim() ?? "";
|
|
10048
|
+
return compId && Object.hasOwn(variablesByComp, compId) ? variablesByComp[compId] : void 0;
|
|
10049
|
+
}
|
|
10050
|
+
function variableHasValue(element, variableId, variables, variablesByComp) {
|
|
9978
10051
|
if (variables && Object.hasOwn(variables, variableId)) return true;
|
|
10052
|
+
const scoped = scopedVariablesFor(element, variablesByComp);
|
|
10053
|
+
if (scoped) return Object.hasOwn(scoped, variableId);
|
|
9979
10054
|
for (let scope = element.parentElement; scope; scope = scope.parentElement) {
|
|
9980
10055
|
if (Object.hasOwn(parseHostVariableValues2(scope), variableId)) return true;
|
|
9981
10056
|
if (Object.hasOwn(readDeclaredDefaults2(scope), variableId)) return true;
|
|
9982
10057
|
}
|
|
9983
10058
|
return Object.hasOwn(readDeclaredDefaults2(element.ownerDocument.documentElement), variableId);
|
|
9984
10059
|
}
|
|
9985
|
-
function hasVariableBoundMedia(html, variables) {
|
|
10060
|
+
function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
|
|
9986
10061
|
const { document: document2 } = parseHTML6(html);
|
|
9987
10062
|
return Array.from(
|
|
9988
10063
|
document2.querySelectorAll(
|
|
@@ -9990,7 +10065,7 @@ function hasVariableBoundMedia(html, variables) {
|
|
|
9990
10065
|
)
|
|
9991
10066
|
).some((element) => {
|
|
9992
10067
|
const variableId = element.getAttribute("data-var-src")?.trim();
|
|
9993
|
-
return Boolean(variableId && variableHasValue(element, variableId, variables));
|
|
10068
|
+
return Boolean(variableId && variableHasValue(element, variableId, variables, variablesByComp));
|
|
9994
10069
|
});
|
|
9995
10070
|
}
|
|
9996
10071
|
function authoredMediaStarts(html) {
|
|
@@ -10105,7 +10180,11 @@ async function runProbeStage(input) {
|
|
|
10105
10180
|
compiled.html,
|
|
10106
10181
|
composition.audios.length
|
|
10107
10182
|
);
|
|
10108
|
-
const hasVariableMedia = hasVariableBoundMedia(
|
|
10183
|
+
const hasVariableMedia = hasVariableBoundMedia(
|
|
10184
|
+
compiled.html,
|
|
10185
|
+
job.config.variables,
|
|
10186
|
+
compiled.variablesByComp
|
|
10187
|
+
);
|
|
10109
10188
|
const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
|
|
10110
10189
|
const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
|
|
10111
10190
|
durationSeconds: composition.duration,
|
|
@@ -10559,7 +10638,7 @@ async function runProbeStage(input) {
|
|
|
10559
10638
|
failures: failedRequests.slice(0, 10)
|
|
10560
10639
|
});
|
|
10561
10640
|
for (const line of failedRequests.slice(0, 5)) {
|
|
10562
|
-
console.warn(`[Render] Asset load failure: ${line}`);
|
|
10641
|
+
console.warn(`[Render] Asset load failure: ${terminalText5(line)}`);
|
|
10563
10642
|
}
|
|
10564
10643
|
}
|
|
10565
10644
|
}
|
|
@@ -10672,7 +10751,7 @@ import {
|
|
|
10672
10751
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10673
10752
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10674
10753
|
isHttpUrl as isHttpUrl3,
|
|
10675
|
-
|
|
10754
|
+
assetRootsRefusal,
|
|
10676
10755
|
assertPublicHttpsUrl,
|
|
10677
10756
|
downloadToTemp as downloadToTemp2,
|
|
10678
10757
|
resolveRestrictPageNetwork,
|
|
@@ -11110,7 +11189,7 @@ function isPublicHttpsUrl(url) {
|
|
|
11110
11189
|
}
|
|
11111
11190
|
}
|
|
11112
11191
|
function opensLocally(path, assetRoots) {
|
|
11113
|
-
return existsSync13(path) && (!assetRoots ||
|
|
11192
|
+
return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
|
|
11114
11193
|
}
|
|
11115
11194
|
function localProbeSource(src, input) {
|
|
11116
11195
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
@@ -11253,7 +11332,8 @@ import {
|
|
|
11253
11332
|
audioFailureDiagnostics,
|
|
11254
11333
|
processCompositionAudio,
|
|
11255
11334
|
removeScratch as removeScratch2,
|
|
11256
|
-
collectScratchLeftovers
|
|
11335
|
+
collectScratchLeftovers,
|
|
11336
|
+
withFfmpegProgress
|
|
11257
11337
|
} from "@hyperframes/engine";
|
|
11258
11338
|
|
|
11259
11339
|
// src/services/render/audioDeliveryLimit.ts
|
|
@@ -11279,7 +11359,8 @@ import {
|
|
|
11279
11359
|
removeScratch,
|
|
11280
11360
|
renameWithRetry as renameWithRetry5,
|
|
11281
11361
|
runFfmpeg as runFfmpeg5,
|
|
11282
|
-
trackChildProcess
|
|
11362
|
+
trackChildProcess,
|
|
11363
|
+
withPublicOnlyProxy
|
|
11283
11364
|
} from "@hyperframes/engine";
|
|
11284
11365
|
import { redactKnownPaths, redactTelemetryString as redactTelemetryString3 } from "@hyperframes/core";
|
|
11285
11366
|
|
|
@@ -11721,7 +11802,17 @@ async function runFfprobeJson(args, signal) {
|
|
|
11721
11802
|
if (!args.includes("--")) {
|
|
11722
11803
|
throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".');
|
|
11723
11804
|
}
|
|
11805
|
+
const proxying = withPublicOnlyProxy(args, [args.indexOf("--") + 1]);
|
|
11806
|
+
const routed = proxying && await proxying;
|
|
11807
|
+
try {
|
|
11808
|
+
return await spawnFfprobeJson(routed?.args ?? args, routed?.env, signal);
|
|
11809
|
+
} finally {
|
|
11810
|
+
await routed?.close();
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
async function spawnFfprobeJson(args, env, signal) {
|
|
11724
11814
|
const proc = spawn(getFfprobeBinary(), args, {
|
|
11815
|
+
...env && { env },
|
|
11725
11816
|
stdio: ["ignore", "pipe", "pipe"],
|
|
11726
11817
|
windowsHide: true
|
|
11727
11818
|
});
|
|
@@ -11837,7 +11928,8 @@ function assertAudioNotInterrupted(failures) {
|
|
|
11837
11928
|
}
|
|
11838
11929
|
function runAudioStage(input) {
|
|
11839
11930
|
return collectScratchLeftovers(
|
|
11840
|
-
() =>
|
|
11931
|
+
() => withFfmpegProgress(input.onFfmpegProgress ?? (() => {
|
|
11932
|
+
}), () => runAudioStageScoped(input)),
|
|
11841
11933
|
(left) => {
|
|
11842
11934
|
if (left.length > 0) input.log?.warn("[audio] scratch left behind", { count: left.length });
|
|
11843
11935
|
}
|
|
@@ -15342,9 +15434,10 @@ async function executeRenderPipeline(input) {
|
|
|
15342
15434
|
nativeHdrVideoCount: nativeHdrVideoIds.size,
|
|
15343
15435
|
nativeHdrImageCount: nativeHdrImageIds.size
|
|
15344
15436
|
});
|
|
15345
|
-
updateJobStatus(job, "preprocessing",
|
|
15437
|
+
updateJobStatus(job, "preprocessing", AUDIO_STAGE, 20, onProgress, {
|
|
15346
15438
|
code: "process_audio"
|
|
15347
15439
|
});
|
|
15440
|
+
const audioWait = audioWaitReporter(job, onProgress);
|
|
15348
15441
|
const audioStage = observeRenderStage(
|
|
15349
15442
|
observability,
|
|
15350
15443
|
"audio_process",
|
|
@@ -15363,7 +15456,8 @@ async function executeRenderPipeline(input) {
|
|
|
15363
15456
|
abortSignal: executionSignal,
|
|
15364
15457
|
assertNotAborted,
|
|
15365
15458
|
log,
|
|
15366
|
-
keepDeliverySource: true
|
|
15459
|
+
keepDeliverySource: true,
|
|
15460
|
+
onFfmpegProgress: audioWait.progressed
|
|
15367
15461
|
})
|
|
15368
15462
|
);
|
|
15369
15463
|
pendingAudio = audioStage.catch(() => void 0);
|
|
@@ -16173,7 +16267,7 @@ async function executeRenderPipeline(input) {
|
|
|
16173
16267
|
}
|
|
16174
16268
|
const effectiveQuality = job.config.crf ?? preset.quality;
|
|
16175
16269
|
const effectiveBitrate = job.config.crf != null ? void 0 : job.config.videoBitrate;
|
|
16176
|
-
const audioResult = await audioStage;
|
|
16270
|
+
const audioResult = await audioWait.wait(audioStage);
|
|
16177
16271
|
const { audioOutputPath, deliverySourcePath, hasAudio } = audioResult;
|
|
16178
16272
|
perfStages.audioProcessMs = audioResult.audioProcessMs;
|
|
16179
16273
|
recordLimiterAttenuation(job, audioResult.audioLoweredDb);
|
|
@@ -19130,9 +19224,12 @@ function resolveDistributedEngineConfig(config) {
|
|
|
19130
19224
|
forceScreenshotExplicitlyOptedOut: true
|
|
19131
19225
|
};
|
|
19132
19226
|
}
|
|
19227
|
+
function leavesRoot(rel) {
|
|
19228
|
+
return rel === ".." || rel.startsWith(`..${sep4}`) || isAbsolute3(rel);
|
|
19229
|
+
}
|
|
19133
19230
|
function pathInside(root, path) {
|
|
19134
19231
|
const rel = relative6(root, path);
|
|
19135
|
-
return rel === "" ||
|
|
19232
|
+
return rel === "" || leavesRoot(rel) ? null : rel;
|
|
19136
19233
|
}
|
|
19137
19234
|
function stableSourcePath(roots, srcPath) {
|
|
19138
19235
|
for (const [root, prefix] of roots) {
|
|
@@ -19226,7 +19323,8 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
19226
19323
|
dereference: true,
|
|
19227
19324
|
filter: (src) => {
|
|
19228
19325
|
const rel = relative6(projectDir, src);
|
|
19229
|
-
if (rel === ""
|
|
19326
|
+
if (rel === "") return true;
|
|
19327
|
+
if (leavesRoot(rel)) return false;
|
|
19230
19328
|
if (job.config.allowOutsideProjectAssets) {
|
|
19231
19329
|
if (refusesOutsideLink(projectDir, src, (line) => log.warn(`[Plan] ${line}`))) return false;
|
|
19232
19330
|
} else if (!isSafePath2(projectDir, src)) return false;
|
|
@@ -22007,7 +22105,7 @@ import {
|
|
|
22007
22105
|
rmSync as rmSync19,
|
|
22008
22106
|
createReadStream as createReadStream5
|
|
22009
22107
|
} from "node:fs";
|
|
22010
|
-
import { resolve as resolve12, dirname as
|
|
22108
|
+
import { resolve as resolve12, dirname as dirname21, join as join49 } from "node:path";
|
|
22011
22109
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
22012
22110
|
import { parseArgs } from "node:util";
|
|
22013
22111
|
import { isIP } from "node:net";
|
|
@@ -22032,8 +22130,9 @@ import {
|
|
|
22032
22130
|
closeSync as closeSync7,
|
|
22033
22131
|
constants as constants3
|
|
22034
22132
|
} from "node:fs";
|
|
22035
|
-
import { resolve as resolve11, join as join47, relative as relative8, isAbsolute as isAbsolute5, sep as sep6 } from "node:path";
|
|
22036
|
-
import {
|
|
22133
|
+
import { resolve as resolve11, join as join47, relative as relative8, isAbsolute as isAbsolute5, sep as sep6, dirname as dirname19 } from "node:path";
|
|
22134
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
22135
|
+
import { Worker as Worker2 } from "node:worker_threads";
|
|
22037
22136
|
function isStringRecord(value) {
|
|
22038
22137
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
22039
22138
|
return false;
|
|
@@ -22139,17 +22238,111 @@ function prepareHyperframeLintBody(body, isAllowedEntry) {
|
|
|
22139
22238
|
}
|
|
22140
22239
|
return { error: "Missing lint source: provide projectDir, files, or html" };
|
|
22141
22240
|
}
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22241
|
+
var LINT_HEAP_MB = 512;
|
|
22242
|
+
var LINT_TIMEOUT_MS = 15e3;
|
|
22243
|
+
var LINT_MAX_WORKERS = 2;
|
|
22244
|
+
var waiting = [];
|
|
22245
|
+
var running = 0;
|
|
22246
|
+
function takeLintSlot(limit, waitMs) {
|
|
22247
|
+
if (running < limit) {
|
|
22248
|
+
running++;
|
|
22249
|
+
return Promise.resolve(true);
|
|
22250
|
+
}
|
|
22251
|
+
return new Promise((resolve13) => {
|
|
22252
|
+
const entry = () => {
|
|
22253
|
+
clearTimeout(timer);
|
|
22254
|
+
running++;
|
|
22255
|
+
resolve13(true);
|
|
22256
|
+
};
|
|
22257
|
+
const timer = setTimeout(
|
|
22258
|
+
() => {
|
|
22259
|
+
waiting.splice(waiting.indexOf(entry), 1);
|
|
22260
|
+
resolve13(false);
|
|
22261
|
+
},
|
|
22262
|
+
Math.max(0, waitMs)
|
|
22263
|
+
);
|
|
22264
|
+
waiting.push(entry);
|
|
22265
|
+
});
|
|
22266
|
+
}
|
|
22267
|
+
function freeLintSlot() {
|
|
22268
|
+
running--;
|
|
22269
|
+
waiting.shift()?.();
|
|
22270
|
+
}
|
|
22271
|
+
function resolveLintWorkerEntry() {
|
|
22272
|
+
const here = dirname19(fileURLToPath6(import.meta.url));
|
|
22273
|
+
for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
|
|
22274
|
+
const candidate = join47(here, name);
|
|
22275
|
+
if (existsSync30(candidate)) return candidate;
|
|
22276
|
+
}
|
|
22277
|
+
return void 0;
|
|
22278
|
+
}
|
|
22279
|
+
function abortedLintResult(filePath, afterMs) {
|
|
22280
|
+
return {
|
|
22281
|
+
ok: false,
|
|
22282
|
+
errorCount: 1,
|
|
22283
|
+
warningCount: 0,
|
|
22284
|
+
infoCount: 0,
|
|
22285
|
+
findings: [
|
|
22286
|
+
{
|
|
22287
|
+
code: "lint_aborted",
|
|
22288
|
+
severity: "error",
|
|
22289
|
+
message: "This composition's script could not be checked: linting it ran too long or out of memory, so it was stopped. A very large or deeply nested script is the usual cause.",
|
|
22290
|
+
file: filePath
|
|
22291
|
+
}
|
|
22292
|
+
],
|
|
22293
|
+
timings: { totalMs: afterMs, groupMs: {}, slowestRule: "", slowestRuleMs: 0 }
|
|
22294
|
+
};
|
|
22295
|
+
}
|
|
22296
|
+
async function runHyperframeLint(prepared, options = {}) {
|
|
22297
|
+
const began = performance.now();
|
|
22298
|
+
const aborted = () => abortedLintResult(prepared.entryFile, Math.round(performance.now() - began));
|
|
22299
|
+
const entry = options.workerEntry ?? resolveLintWorkerEntry();
|
|
22300
|
+
if (!entry) return aborted();
|
|
22301
|
+
const timeoutMs = options.timeoutMs ?? LINT_TIMEOUT_MS;
|
|
22302
|
+
const gotSlot = await takeLintSlot(options.maxWorkers ?? LINT_MAX_WORKERS, timeoutMs);
|
|
22303
|
+
if (!gotSlot) return aborted();
|
|
22304
|
+
const remainingMs = Math.max(0, timeoutMs - (performance.now() - began));
|
|
22305
|
+
return new Promise((resolvePromise, reject) => {
|
|
22306
|
+
let worker;
|
|
22307
|
+
try {
|
|
22308
|
+
worker = new Worker2(entry, {
|
|
22309
|
+
workerData: {
|
|
22310
|
+
html: prepared.html,
|
|
22311
|
+
opts: { filePath: prepared.entryFile, compSrcPath: prepared.entryFile }
|
|
22312
|
+
},
|
|
22313
|
+
resourceLimits: { maxOldGenerationSizeMb: options.heapMb ?? LINT_HEAP_MB },
|
|
22314
|
+
stdout: false,
|
|
22315
|
+
stderr: false
|
|
22316
|
+
});
|
|
22317
|
+
} catch {
|
|
22318
|
+
freeLintSlot();
|
|
22319
|
+
resolvePromise(aborted());
|
|
22320
|
+
return;
|
|
22321
|
+
}
|
|
22322
|
+
let settled = false;
|
|
22323
|
+
const settle = (finish) => {
|
|
22324
|
+
if (settled) return;
|
|
22325
|
+
settled = true;
|
|
22326
|
+
clearTimeout(timer);
|
|
22327
|
+
void worker.terminate().finally(freeLintSlot);
|
|
22328
|
+
finish();
|
|
22329
|
+
};
|
|
22330
|
+
const timer = setTimeout(() => settle(() => resolvePromise(aborted())), remainingMs);
|
|
22331
|
+
worker.on(
|
|
22332
|
+
"message",
|
|
22333
|
+
(message) => settle(
|
|
22334
|
+
() => message.result ? resolvePromise(message.result) : reject(new Error(message.error))
|
|
22335
|
+
)
|
|
22336
|
+
);
|
|
22337
|
+
worker.on("error", () => settle(() => resolvePromise(aborted())));
|
|
22338
|
+
worker.on("exit", () => settle(() => resolvePromise(aborted())));
|
|
22146
22339
|
});
|
|
22147
22340
|
}
|
|
22148
22341
|
|
|
22149
22342
|
// src/services/healthWorker.ts
|
|
22150
|
-
import { Worker as
|
|
22151
|
-
import { fileURLToPath as
|
|
22152
|
-
import { dirname as
|
|
22343
|
+
import { Worker as Worker3 } from "node:worker_threads";
|
|
22344
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
22345
|
+
import { dirname as dirname20, join as join48 } from "node:path";
|
|
22153
22346
|
import { existsSync as existsSync31 } from "node:fs";
|
|
22154
22347
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
22155
22348
|
async function startHealthWorker(options = {}) {
|
|
@@ -22161,7 +22354,7 @@ async function startHealthWorker(options = {}) {
|
|
|
22161
22354
|
"[healthWorker] could not resolve worker entry. Pass options.workerEntry or ensure healthWorkerThread.{js,ts} is co-located."
|
|
22162
22355
|
);
|
|
22163
22356
|
}
|
|
22164
|
-
const worker = new
|
|
22357
|
+
const worker = new Worker3(entry, {
|
|
22165
22358
|
workerData: { port },
|
|
22166
22359
|
// Keep stdio inherited so the worker's console logs land in the pod logs
|
|
22167
22360
|
// alongside the main thread's.
|
|
@@ -22224,7 +22417,7 @@ function defaultLogger2() {
|
|
|
22224
22417
|
};
|
|
22225
22418
|
}
|
|
22226
22419
|
function resolveWorkerEntry2() {
|
|
22227
|
-
const here =
|
|
22420
|
+
const here = dirname20(fileURLToPath7(import.meta.url));
|
|
22228
22421
|
const candidates = [join48(here, "healthWorkerThread.js"), join48(here, "healthWorkerThread.ts")];
|
|
22229
22422
|
for (const candidate of candidates) {
|
|
22230
22423
|
if (existsSync31(candidate)) return candidate;
|
|
@@ -22394,7 +22587,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
22394
22587
|
throw new Error("outputPath must be inside the renders directory");
|
|
22395
22588
|
}
|
|
22396
22589
|
}
|
|
22397
|
-
const outputDir =
|
|
22590
|
+
const outputDir = dirname21(absoluteOutputPath);
|
|
22398
22591
|
if (!existsSync32(outputDir)) mkdirSync21(outputDir, { recursive: true });
|
|
22399
22592
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
22400
22593
|
}
|
|
@@ -23106,7 +23299,7 @@ import {
|
|
|
23106
23299
|
statSync as statSync15,
|
|
23107
23300
|
writeFileSync as writeFileSync15
|
|
23108
23301
|
} from "node:fs";
|
|
23109
|
-
import { basename as basename8, dirname as
|
|
23302
|
+
import { basename as basename8, dirname as dirname22, join as join50 } from "node:path";
|
|
23110
23303
|
import {
|
|
23111
23304
|
appendRateCapArgs as appendRateCapArgs2,
|
|
23112
23305
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
@@ -23153,10 +23346,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
23153
23346
|
}
|
|
23154
23347
|
const format = plan2.dimensions.format;
|
|
23155
23348
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
23156
|
-
if (!existsSync33(
|
|
23157
|
-
mkdirSync22(
|
|
23349
|
+
if (!existsSync33(dirname22(outputPath))) {
|
|
23350
|
+
mkdirSync22(dirname22(outputPath), { recursive: true });
|
|
23158
23351
|
}
|
|
23159
|
-
const workDir = createStagingDir7(
|
|
23352
|
+
const workDir = createStagingDir7(dirname22(outputPath), `${basename8(outputPath)}.assemble-work-`);
|
|
23160
23353
|
const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
23161
23354
|
const stageMs = {};
|
|
23162
23355
|
const ctx = {
|
|
@@ -23469,7 +23662,7 @@ import { isPrivateFileUnder as isPrivateFileUnder3, isStudioPrivatePath as isStu
|
|
|
23469
23662
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
23470
23663
|
|
|
23471
23664
|
// src/services/distributed/audioSidecar.ts
|
|
23472
|
-
import { extractAudioMetadata as extractAudioMetadata4, runFfmpeg as runFfmpeg9 } from "@hyperframes/engine";
|
|
23665
|
+
import { extractAudioMetadata as extractAudioMetadata4, runFfmpeg as runFfmpeg9, urlInputArgs as urlInputArgs4 } from "@hyperframes/engine";
|
|
23473
23666
|
var AUDIO_SIDECAR_MIN_BYTES = 32 * 1024 * 1024;
|
|
23474
23667
|
|
|
23475
23668
|
// src/services/distributed/probeFacts.ts
|