@hyperframes/producer 0.9.53 → 0.9.55
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 +77 -54
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/index.js +87 -64
- package/dist/public-server.js +65 -43
- package/dist/services/assetMediaType.d.ts +1 -0
- package/dist/services/render/stages/audioStage.d.ts +1 -0
- package/dist/services/render/stages/extractVideosStage.d.ts +1 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
referenceBackgroundResult,
|
|
68
68
|
createReferenceBackgroundRecorder
|
|
69
69
|
} from "@hyperframes/engine";
|
|
70
|
-
import { join as join32, dirname as
|
|
70
|
+
import { join as join32, dirname as dirname14, resolve as resolve8 } from "path";
|
|
71
71
|
import { totalmem as totalmem2 } from "node:os";
|
|
72
72
|
import { randomUUID } from "crypto";
|
|
73
73
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -75,7 +75,7 @@ import { fileURLToPath as fileURLToPath4 } from "url";
|
|
|
75
75
|
// src/services/fileServer.ts
|
|
76
76
|
import { Hono } from "hono";
|
|
77
77
|
import { serve } from "@hono/node-server";
|
|
78
|
-
import { settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
78
|
+
import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
79
79
|
import {
|
|
80
80
|
existsSync as existsSync2,
|
|
81
81
|
realpathSync,
|
|
@@ -91,8 +91,10 @@ import { promisify } from "node:util";
|
|
|
91
91
|
import { Readable } from "node:stream";
|
|
92
92
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
93
93
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
94
|
+
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
95
|
+
import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
|
|
94
96
|
import { fpsToNumber } from "@hyperframes/core";
|
|
95
|
-
import { isPrivateFileUnder,
|
|
97
|
+
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
96
98
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
97
99
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
98
100
|
|
|
@@ -812,6 +814,7 @@ var HF_BRIDGE_SCRIPT = `(function() {
|
|
|
812
814
|
if (bridge()) __realClearInterval(iv);
|
|
813
815
|
}, 50);
|
|
814
816
|
})();`;
|
|
817
|
+
var OFFER_NO_FRAMING_SITE_AN_EDITING_PORT = `<meta name="${PREVIEW_FOR_ANOTHER_SITE_META}">`;
|
|
815
818
|
var RENDER_CAPTURE_MODE_SHIM = "globalThis.__HF_RENDER_CAPTURE_MODE = true;";
|
|
816
819
|
function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
817
820
|
try {
|
|
@@ -859,10 +862,12 @@ function createFileServer(options) {
|
|
|
859
862
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
860
863
|
const app = new Hono();
|
|
861
864
|
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
865
|
+
let listeningPort = -1;
|
|
862
866
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
863
867
|
await next();
|
|
864
868
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
865
869
|
});
|
|
870
|
+
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
866
871
|
app.get("/*", async (c) => {
|
|
867
872
|
let requestPath = c.req.path;
|
|
868
873
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -872,7 +877,7 @@ function createFileServer(options) {
|
|
|
872
877
|
const candidate = join2(root, relativePath);
|
|
873
878
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
874
879
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
875
|
-
if (isPrivateFileUnder(root, candidate,
|
|
880
|
+
if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
|
|
876
881
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
877
882
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
878
883
|
file = openRegularFile(candidate);
|
|
@@ -897,6 +902,7 @@ function createFileServer(options) {
|
|
|
897
902
|
html = injectScriptsAtHeadStart(html, preHeadScripts);
|
|
898
903
|
}
|
|
899
904
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
905
|
+
html = injectTagsAtHeadStart(html, OFFER_NO_FRAMING_SITE_AN_EDITING_PORT);
|
|
900
906
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
901
907
|
}
|
|
902
908
|
if (ext === ".png") {
|
|
@@ -958,6 +964,7 @@ function createFileServer(options) {
|
|
|
958
964
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
959
965
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
960
966
|
bound.then((boundPort) => {
|
|
967
|
+
listeningPort = boundPort;
|
|
961
968
|
resolve13({
|
|
962
969
|
url: `http://localhost:${boundPort}`,
|
|
963
970
|
port: boundPort,
|
|
@@ -6546,7 +6553,7 @@ import {
|
|
|
6546
6553
|
} from "@hyperframes/parsers/css-url-scans";
|
|
6547
6554
|
import { createHash as createHash6 } from "node:crypto";
|
|
6548
6555
|
import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync9, readFileSync as readFileSync8 } from "fs";
|
|
6549
|
-
import { join as join19, dirname as
|
|
6556
|
+
import { join as join19, dirname as dirname9, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
|
|
6550
6557
|
import { parseHTML as parseHTML5 } from "linkedom";
|
|
6551
6558
|
|
|
6552
6559
|
// src/services/bundledScripts.ts
|
|
@@ -6618,7 +6625,7 @@ import {
|
|
|
6618
6625
|
readTextFile,
|
|
6619
6626
|
resolveCompositionSrc
|
|
6620
6627
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6621
|
-
import { isPrivateFileUnder as isPrivateFileUnder2,
|
|
6628
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
6622
6629
|
|
|
6623
6630
|
// src/services/renderMediaCollector.ts
|
|
6624
6631
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7450,9 +7457,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
|
|
|
7450
7457
|
|
|
7451
7458
|
// src/services/assetMediaType.ts
|
|
7452
7459
|
import { existsSync as existsSync10 } from "node:fs";
|
|
7453
|
-
import { join as join18 } from "node:path";
|
|
7460
|
+
import { dirname as dirname8, join as join18 } from "node:path";
|
|
7454
7461
|
import {
|
|
7455
7462
|
fingerprintElementId,
|
|
7463
|
+
isHttpUrl as isHttpUrl2,
|
|
7464
|
+
isInsideAssetRoots,
|
|
7456
7465
|
isNotMediaPayload,
|
|
7457
7466
|
playlistLeavesItsFolder,
|
|
7458
7467
|
NotMediaPayloadError,
|
|
@@ -7498,17 +7507,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
7498
7507
|
}
|
|
7499
7508
|
]);
|
|
7500
7509
|
}
|
|
7501
|
-
function
|
|
7502
|
-
return
|
|
7510
|
+
function mediaAssetRoots(projectDir, compiledDir) {
|
|
7511
|
+
return [projectDir, compiledDir, join18(dirname8(compiledDir), "downloads")];
|
|
7503
7512
|
}
|
|
7504
7513
|
function dropMediaOutsideProject(input) {
|
|
7505
7514
|
const { projectDir, workDir, composition, log } = input;
|
|
7506
7515
|
const compiledDir = join18(workDir, "compiled");
|
|
7507
|
-
const roots =
|
|
7516
|
+
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
7508
7517
|
const staysInside = ({ id, src }) => {
|
|
7509
|
-
if (!src ||
|
|
7518
|
+
if (!src || isHttpUrl2(src)) return true;
|
|
7510
7519
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
7511
|
-
if (
|
|
7520
|
+
if (isInsideAssetRoots(path, roots)) return true;
|
|
7512
7521
|
if (input.allowOutsideProjectAssets) {
|
|
7513
7522
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
7514
7523
|
if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
|
|
@@ -7546,7 +7555,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7546
7555
|
];
|
|
7547
7556
|
const byPath = /* @__PURE__ */ new Map();
|
|
7548
7557
|
for (const reference of references) {
|
|
7549
|
-
if (!reference.src ||
|
|
7558
|
+
if (!reference.src || isHttpUrl2(reference.src)) continue;
|
|
7550
7559
|
const resolvedPath = resolveProjectRelativeSrc3(
|
|
7551
7560
|
reference.src,
|
|
7552
7561
|
input.projectDir,
|
|
@@ -7656,7 +7665,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
7656
7665
|
const file = resolveCompositionPath(projectDir, src, assetRoot);
|
|
7657
7666
|
return file !== null && COMPOSITION_FILE.test(file) ? file : null;
|
|
7658
7667
|
}
|
|
7659
|
-
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath,
|
|
7668
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
|
|
7660
7669
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
7661
7670
|
const { document: document2 } = parseHTML5(html);
|
|
7662
7671
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -7675,7 +7684,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
|
|
|
7675
7684
|
continue;
|
|
7676
7685
|
}
|
|
7677
7686
|
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
7678
|
-
problems.push({
|
|
7687
|
+
problems.push({
|
|
7688
|
+
srcPath,
|
|
7689
|
+
detail: "it is git metadata, an env file or a private tool record"
|
|
7690
|
+
});
|
|
7679
7691
|
continue;
|
|
7680
7692
|
}
|
|
7681
7693
|
if (!COMPOSITION_FILE.test(filePath)) {
|
|
@@ -8004,7 +8016,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
8004
8016
|
workItems.map(async (item) => {
|
|
8005
8017
|
const { html: compiledSub } = await compileHtmlFile(
|
|
8006
8018
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
8007
|
-
|
|
8019
|
+
dirname9(item.filePath),
|
|
8008
8020
|
downloadDir,
|
|
8009
8021
|
void 0,
|
|
8010
8022
|
urlByAbsentLocalPath,
|
|
@@ -8666,7 +8678,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
8666
8678
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
8667
8679
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
8668
8680
|
const path = decodedUrlPath(url);
|
|
8669
|
-
const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(
|
|
8681
|
+
const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname9(sheet), path);
|
|
8670
8682
|
return isPathInside(file, projectDir) && existsSync11(file);
|
|
8671
8683
|
});
|
|
8672
8684
|
if (family && shipsFile) families.push(family);
|
|
@@ -10383,7 +10395,8 @@ import {
|
|
|
10383
10395
|
rebaseVideoToWindow,
|
|
10384
10396
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10385
10397
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10386
|
-
isHttpUrl as
|
|
10398
|
+
isHttpUrl as isHttpUrl3,
|
|
10399
|
+
isInsideAssetRoots as isInsideAssetRoots2,
|
|
10387
10400
|
assertPublicHttpsUrl,
|
|
10388
10401
|
downloadToTemp as downloadToTemp2,
|
|
10389
10402
|
resolveRestrictPageNetwork,
|
|
@@ -10633,6 +10646,7 @@ async function runExtractVideosStage(input) {
|
|
|
10633
10646
|
skipFrameExtractionIds = []
|
|
10634
10647
|
} = input;
|
|
10635
10648
|
const stage2Start = Date.now();
|
|
10649
|
+
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
10636
10650
|
const extractionPolicy = resolveVideoExtractionPolicy();
|
|
10637
10651
|
composition.videos = composition.videos.filter(
|
|
10638
10652
|
(video) => !isVideoPastTimelineEnd(video, composition.duration)
|
|
@@ -10651,7 +10665,7 @@ async function runExtractVideosStage(input) {
|
|
|
10651
10665
|
const probeFailures = await Promise.all(
|
|
10652
10666
|
composition.videos.map(async (v) => {
|
|
10653
10667
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
10654
|
-
if (!
|
|
10668
|
+
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
10655
10669
|
try {
|
|
10656
10670
|
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
10657
10671
|
signal: abortSignal,
|
|
@@ -10689,7 +10703,7 @@ async function runExtractVideosStage(input) {
|
|
|
10689
10703
|
const probed = await Promise.all(
|
|
10690
10704
|
composition.images.map(async (img) => {
|
|
10691
10705
|
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
10692
|
-
if (!
|
|
10706
|
+
if (!opensLocally(imgPath, assetRoots)) return null;
|
|
10693
10707
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
10694
10708
|
if (isHdrColorSpace2(colorSpace)) {
|
|
10695
10709
|
nativeHdrImageIds.add(img.id);
|
|
@@ -10708,6 +10722,7 @@ async function runExtractVideosStage(input) {
|
|
|
10708
10722
|
composition,
|
|
10709
10723
|
urlByAbsentLocalPath,
|
|
10710
10724
|
downloadDir: audioDownloadDir,
|
|
10725
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
10711
10726
|
signal: abortSignal,
|
|
10712
10727
|
log
|
|
10713
10728
|
});
|
|
@@ -10741,6 +10756,7 @@ async function runExtractVideosStage(input) {
|
|
|
10741
10756
|
shownBoxes,
|
|
10742
10757
|
contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
10743
10758
|
urlByAbsentLocalPath,
|
|
10759
|
+
assetRoots,
|
|
10744
10760
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
10745
10761
|
framesPlanned += planned;
|
|
10746
10762
|
framesDone += done;
|
|
@@ -10817,10 +10833,14 @@ function isPublicHttpsUrl(url) {
|
|
|
10817
10833
|
return false;
|
|
10818
10834
|
}
|
|
10819
10835
|
}
|
|
10836
|
+
function opensLocally(path, assetRoots) {
|
|
10837
|
+
return existsSync13(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
|
|
10838
|
+
}
|
|
10820
10839
|
function localProbeSource(src, input) {
|
|
10821
10840
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
10822
10841
|
const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
|
|
10823
|
-
|
|
10842
|
+
const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
|
|
10843
|
+
return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
|
|
10824
10844
|
}
|
|
10825
10845
|
async function remoteProbeSource(video, input) {
|
|
10826
10846
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
@@ -10846,7 +10866,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10846
10866
|
);
|
|
10847
10867
|
const probed = await Promise.all(
|
|
10848
10868
|
videos.map(async (video) => {
|
|
10849
|
-
const readFrom =
|
|
10869
|
+
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
10850
10870
|
if (readFrom === null) return null;
|
|
10851
10871
|
const metadata = await extractMediaMetadata4(readFrom);
|
|
10852
10872
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
@@ -10870,7 +10890,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10870
10890
|
import { existsSync as existsSync14 } from "node:fs";
|
|
10871
10891
|
import {
|
|
10872
10892
|
buildVideoLayerInput,
|
|
10873
|
-
isHttpUrl as
|
|
10893
|
+
isHttpUrl as isHttpUrl4,
|
|
10874
10894
|
qualifyVideoLayer,
|
|
10875
10895
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
10876
10896
|
} from "@hyperframes/engine";
|
|
@@ -10933,7 +10953,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10933
10953
|
const q = qualifyVideoLayer(input.videos, input.duration);
|
|
10934
10954
|
if (!q.qualifies) return { reason: q.reason };
|
|
10935
10955
|
const { video } = q;
|
|
10936
|
-
if (
|
|
10956
|
+
if (isHttpUrl4(video.src)) return { reason: "remote_source" };
|
|
10937
10957
|
const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
|
|
10938
10958
|
if (!existsSync14(path)) return { reason: "source_missing" };
|
|
10939
10959
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
@@ -10962,7 +10982,7 @@ import {
|
|
|
10962
10982
|
|
|
10963
10983
|
// src/services/render/audioDeliveryLimit.ts
|
|
10964
10984
|
import { existsSync as existsSync15 } from "node:fs";
|
|
10965
|
-
import { dirname as
|
|
10985
|
+
import { dirname as dirname11, join as join24 } from "node:path";
|
|
10966
10986
|
import {
|
|
10967
10987
|
applyAudioFxChain,
|
|
10968
10988
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
@@ -10972,7 +10992,7 @@ import {
|
|
|
10972
10992
|
|
|
10973
10993
|
// src/services/render/audioPadTrim.ts
|
|
10974
10994
|
import { spawn } from "node:child_process";
|
|
10975
|
-
import { dirname as
|
|
10995
|
+
import { dirname as dirname10, join as join23 } from "node:path";
|
|
10976
10996
|
import {
|
|
10977
10997
|
DEFAULT_CONFIG,
|
|
10978
10998
|
describeFfmpegFailure as describeFfmpegFailure2,
|
|
@@ -11266,7 +11286,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
11266
11286
|
async function enforceAacTruePeak(input) {
|
|
11267
11287
|
let scratchDir;
|
|
11268
11288
|
try {
|
|
11269
|
-
scratchDir = createStagingDir3(
|
|
11289
|
+
scratchDir = createStagingDir3(dirname10(input.audioPath), ".true-peak-");
|
|
11270
11290
|
const correctedPath = join23(scratchDir, "audio.m4a");
|
|
11271
11291
|
const measurements = [];
|
|
11272
11292
|
let attenuationDb = 0;
|
|
@@ -11477,7 +11497,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
11477
11497
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
11478
11498
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
11479
11499
|
const alternating = ["a", "b"].map(
|
|
11480
|
-
(k) => join24(
|
|
11500
|
+
(k) => join24(dirname11(sourcePath), `audio-source-limited-${k}.wav`)
|
|
11481
11501
|
);
|
|
11482
11502
|
let encodedFrom;
|
|
11483
11503
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -11635,7 +11655,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11635
11655
|
masterFxChain,
|
|
11636
11656
|
urlByAbsentLocalPath,
|
|
11637
11657
|
audioSidecarUrlByLocalPath,
|
|
11638
|
-
keepEncoderInputAt: pcmSourcePath
|
|
11658
|
+
keepEncoderInputAt: pcmSourcePath,
|
|
11659
|
+
assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
|
|
11639
11660
|
},
|
|
11640
11661
|
compiledDir
|
|
11641
11662
|
);
|
|
@@ -12315,7 +12336,7 @@ import {
|
|
|
12315
12336
|
// src/services/shaderTransitionWorkerPool.ts
|
|
12316
12337
|
import { Worker } from "node:worker_threads";
|
|
12317
12338
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
12318
|
-
import { dirname as
|
|
12339
|
+
import { dirname as dirname12, join as join28 } from "node:path";
|
|
12319
12340
|
import { createRequire } from "node:module";
|
|
12320
12341
|
import { usableCpuCount } from "@hyperframes/engine";
|
|
12321
12342
|
import { existsSync as existsSync18 } from "node:fs";
|
|
@@ -12328,7 +12349,7 @@ function resolveWorkerEntry(explicit) {
|
|
|
12328
12349
|
const isTs = override.endsWith(".ts");
|
|
12329
12350
|
return { path: override, isTs };
|
|
12330
12351
|
}
|
|
12331
|
-
const moduleDir =
|
|
12352
|
+
const moduleDir = dirname12(fileURLToPath3(import.meta.url));
|
|
12332
12353
|
const jsPath = join28(moduleDir, "shaderTransitionWorker.js");
|
|
12333
12354
|
if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
|
|
12334
12355
|
const tsPath = join28(moduleDir, "shaderTransitionWorker.ts");
|
|
@@ -13057,7 +13078,7 @@ import {
|
|
|
13057
13078
|
writeFileSync as writeFileSync6
|
|
13058
13079
|
} from "node:fs";
|
|
13059
13080
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
13060
|
-
import { dirname as
|
|
13081
|
+
import { dirname as dirname13, join as join31 } from "node:path";
|
|
13061
13082
|
import {
|
|
13062
13083
|
encodeFramesChunkedConcat,
|
|
13063
13084
|
encodeFramesFromDir,
|
|
@@ -13375,7 +13396,7 @@ async function runEncodeStage(input) {
|
|
|
13375
13396
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
13376
13397
|
fps: job.config.fps,
|
|
13377
13398
|
loop,
|
|
13378
|
-
palettePath: join31(
|
|
13399
|
+
palettePath: join31(dirname13(videoOnlyPath), "gif-palette.png"),
|
|
13379
13400
|
preserveAlpha: needsAlpha,
|
|
13380
13401
|
signal: abortSignal,
|
|
13381
13402
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -13820,7 +13841,7 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
13820
13841
|
}
|
|
13821
13842
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
|
|
13822
13843
|
if (platform2 === "win32" || platform2 === "darwin") return join32(systemTempDir, "hf-render-");
|
|
13823
|
-
return join32(
|
|
13844
|
+
return join32(dirname14(outputPath), `work-${jobId}-`);
|
|
13824
13845
|
}
|
|
13825
13846
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
13826
13847
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -14546,7 +14567,7 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
14546
14567
|
};
|
|
14547
14568
|
}
|
|
14548
14569
|
function resolveRenderDebugDir() {
|
|
14549
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(
|
|
14570
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname14(fileURLToPath4(import.meta.url)), "../..");
|
|
14550
14571
|
return join32(producerRoot, ".debug");
|
|
14551
14572
|
}
|
|
14552
14573
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
@@ -14554,7 +14575,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
14554
14575
|
validateDeliveryEncoderConfig(job.config);
|
|
14555
14576
|
validateChromaSubsamplingConfig(job.config);
|
|
14556
14577
|
const debugDir = resolveRenderDebugDir();
|
|
14557
|
-
const outputDir =
|
|
14578
|
+
const outputDir = dirname14(outputPath);
|
|
14558
14579
|
if (!existsSync21(outputDir)) mkdirSync12(outputDir, { recursive: true });
|
|
14559
14580
|
const workDir = job.config.debug ? join32(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
14560
14581
|
const pipelineStart = Date.now();
|
|
@@ -15053,6 +15074,7 @@ async function executeRenderPipeline(input) {
|
|
|
15053
15074
|
audioGain: cfg.audioGain,
|
|
15054
15075
|
audios: composition.audios,
|
|
15055
15076
|
masterFxChain: composition.masterFxChain,
|
|
15077
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
15056
15078
|
abortSignal: executionSignal,
|
|
15057
15079
|
assertNotAborted,
|
|
15058
15080
|
log,
|
|
@@ -16725,7 +16747,7 @@ import { tmpdir as tmpdir4 } from "node:os";
|
|
|
16725
16747
|
import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync13, rmSync as rmSync13 } from "node:fs";
|
|
16726
16748
|
import { open } from "node:fs/promises";
|
|
16727
16749
|
import { renameWithRetry as renameWithRetry7 } from "@hyperframes/engine";
|
|
16728
|
-
import { basename as basename7, dirname as
|
|
16750
|
+
import { basename as basename7, dirname as dirname15, join as join33 } from "node:path";
|
|
16729
16751
|
import { finished, pipeline } from "node:stream/promises";
|
|
16730
16752
|
import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
|
|
16731
16753
|
function boxAt(src, off, at, limit) {
|
|
@@ -17090,8 +17112,8 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
17090
17112
|
const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
|
|
17091
17113
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
17092
17114
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
17093
|
-
mkdirSync13(
|
|
17094
|
-
const workDir = createStagingDir4(
|
|
17115
|
+
mkdirSync13(dirname15(outputPath), { recursive: true });
|
|
17116
|
+
const workDir = createStagingDir4(dirname15(outputPath), `${basename7(outputPath)}.stitch-`);
|
|
17095
17117
|
const out = createWriteStream(join33(workDir, "out.mp4"));
|
|
17096
17118
|
try {
|
|
17097
17119
|
out.write(header);
|
|
@@ -17157,7 +17179,7 @@ import {
|
|
|
17157
17179
|
|
|
17158
17180
|
// src/services/distributed/shared.ts
|
|
17159
17181
|
import { execFile as execFileCallback } from "node:child_process";
|
|
17160
|
-
import { dirname as
|
|
17182
|
+
import { dirname as dirname16, join as join34 } from "node:path";
|
|
17161
17183
|
import { existsSync as existsSync22, readFileSync as readFileSync10 } from "node:fs";
|
|
17162
17184
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
17163
17185
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -17433,7 +17455,7 @@ function buildSyntheticRenderJob(input) {
|
|
|
17433
17455
|
var cachedProducerVersion = null;
|
|
17434
17456
|
function readProducerVersion() {
|
|
17435
17457
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
17436
|
-
const startDir =
|
|
17458
|
+
const startDir = dirname16(fileURLToPath5(import.meta.url));
|
|
17437
17459
|
let current = startDir;
|
|
17438
17460
|
for (let i = 0; i < 10; i++) {
|
|
17439
17461
|
const candidate = join34(current, "package.json");
|
|
@@ -17447,7 +17469,7 @@ function readProducerVersion() {
|
|
|
17447
17469
|
} catch {
|
|
17448
17470
|
}
|
|
17449
17471
|
}
|
|
17450
|
-
const parent =
|
|
17472
|
+
const parent = dirname16(current);
|
|
17451
17473
|
if (parent === current) break;
|
|
17452
17474
|
current = parent;
|
|
17453
17475
|
}
|
|
@@ -19068,6 +19090,7 @@ function mixPlanAudio(c, compiledDir) {
|
|
|
19068
19090
|
compiledDir,
|
|
19069
19091
|
urlByAbsentLocalPath: c.urlByAbsentLocalPath,
|
|
19070
19092
|
audioSidecarUrlByLocalPath: c.audioSidecarUrlByLocalPath,
|
|
19093
|
+
allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
|
|
19071
19094
|
totalFrames: c.totalFrames,
|
|
19072
19095
|
fps: c.job.config.fps,
|
|
19073
19096
|
ffmpegProcessTimeout: c.cfg.ffmpegProcessTimeout,
|
|
@@ -19426,7 +19449,7 @@ import {
|
|
|
19426
19449
|
writeFileSync as writeFileSync12
|
|
19427
19450
|
} from "node:fs";
|
|
19428
19451
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
19429
|
-
import { dirname as
|
|
19452
|
+
import { dirname as dirname18, isAbsolute as isAbsolute4, join as join44, relative as relative7, resolve as resolve10, sep as sep5 } from "node:path";
|
|
19430
19453
|
import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
|
|
19431
19454
|
import {
|
|
19432
19455
|
createFrameLookupTable as createFrameLookupTable5,
|
|
@@ -19445,7 +19468,7 @@ import {
|
|
|
19445
19468
|
writeFileSync as writeFileSync11
|
|
19446
19469
|
} from "node:fs";
|
|
19447
19470
|
import { renameWithRetry as renameWithRetry9 } from "@hyperframes/engine";
|
|
19448
|
-
import { dirname as
|
|
19471
|
+
import { dirname as dirname17, join as join43 } from "node:path";
|
|
19449
19472
|
|
|
19450
19473
|
// src/services/distributed/planV2Errors.ts
|
|
19451
19474
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -19506,8 +19529,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19506
19529
|
}
|
|
19507
19530
|
this.destinationDir = destinationDir;
|
|
19508
19531
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
19509
|
-
mkdirSync17(
|
|
19510
|
-
this.temporaryDir = createStagingDir5(
|
|
19532
|
+
mkdirSync17(dirname17(destinationDir), { recursive: true });
|
|
19533
|
+
this.temporaryDir = createStagingDir5(dirname17(destinationDir), ".plan-v2-publish-");
|
|
19511
19534
|
}
|
|
19512
19535
|
async putBlob(blob) {
|
|
19513
19536
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -19519,8 +19542,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19519
19542
|
}
|
|
19520
19543
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
19521
19544
|
if (existsSync27(destinationPath)) return;
|
|
19522
|
-
mkdirSync17(
|
|
19523
|
-
const stagingDir = createStagingDir5(
|
|
19545
|
+
mkdirSync17(dirname17(destinationPath), { recursive: true });
|
|
19546
|
+
const stagingDir = createStagingDir5(dirname17(destinationPath), ".plan-v2-blob-");
|
|
19524
19547
|
const temporaryPath = join43(stagingDir, "blob");
|
|
19525
19548
|
try {
|
|
19526
19549
|
try {
|
|
@@ -19811,8 +19834,8 @@ function computeManifestHash(manifest) {
|
|
|
19811
19834
|
}
|
|
19812
19835
|
function writeBlob(sourcePath, destinationPath) {
|
|
19813
19836
|
if (existsSync28(destinationPath)) return;
|
|
19814
|
-
mkdirSync18(
|
|
19815
|
-
const temporaryDir = createStagingDir6(
|
|
19837
|
+
mkdirSync18(dirname18(destinationPath), { recursive: true });
|
|
19838
|
+
const temporaryDir = createStagingDir6(dirname18(destinationPath), ".plan-v2-blob-");
|
|
19816
19839
|
const temporaryPath = join44(temporaryDir, "blob");
|
|
19817
19840
|
try {
|
|
19818
19841
|
copyFileSync8(sourcePath, temporaryPath);
|
|
@@ -19937,8 +19960,8 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
19937
19960
|
if (publication.storedBlobs.length > 0) {
|
|
19938
19961
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
19939
19962
|
}
|
|
19940
|
-
mkdirSync18(
|
|
19941
|
-
const tempDir = createStagingDir6(
|
|
19963
|
+
mkdirSync18(dirname18(planV2Dir), { recursive: true });
|
|
19964
|
+
const tempDir = createStagingDir6(dirname18(planV2Dir), ".plan-v2-build-");
|
|
19942
19965
|
try {
|
|
19943
19966
|
for (const blob of publication.blobs) {
|
|
19944
19967
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
@@ -20022,7 +20045,7 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
20022
20045
|
}
|
|
20023
20046
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
20024
20047
|
const manifest = await planV2WithPublisher(projectDir, config, publisher, {
|
|
20025
|
-
stagingParentDir:
|
|
20048
|
+
stagingParentDir: dirname18(planV2Dir)
|
|
20026
20049
|
});
|
|
20027
20050
|
return resultFromManifest(planV2Dir, manifest);
|
|
20028
20051
|
}
|
|
@@ -20215,12 +20238,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
20215
20238
|
artifact,
|
|
20216
20239
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
20217
20240
|
}));
|
|
20218
|
-
mkdirSync18(
|
|
20219
|
-
const tempDir = createStagingDir6(
|
|
20241
|
+
mkdirSync18(dirname18(destinationDir), { recursive: true });
|
|
20242
|
+
const tempDir = createStagingDir6(dirname18(destinationDir), ".plan-v2-materialize-");
|
|
20220
20243
|
try {
|
|
20221
20244
|
for (const { artifact, sourcePath } of verified) {
|
|
20222
20245
|
const destinationPath = join44(tempDir, ...artifact.path.split("/"));
|
|
20223
|
-
mkdirSync18(
|
|
20246
|
+
mkdirSync18(dirname18(destinationPath), { recursive: true });
|
|
20224
20247
|
copyFileSync8(sourcePath, destinationPath);
|
|
20225
20248
|
}
|
|
20226
20249
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
@@ -21699,7 +21722,7 @@ import {
|
|
|
21699
21722
|
rmSync as rmSync19,
|
|
21700
21723
|
createReadStream as createReadStream5
|
|
21701
21724
|
} from "node:fs";
|
|
21702
|
-
import { resolve as resolve12, dirname as
|
|
21725
|
+
import { resolve as resolve12, dirname as dirname20, join as join49 } from "node:path";
|
|
21703
21726
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
21704
21727
|
import { parseArgs } from "node:util";
|
|
21705
21728
|
import { isIP } from "node:net";
|
|
@@ -21841,7 +21864,7 @@ async function runHyperframeLint(prepared) {
|
|
|
21841
21864
|
// src/services/healthWorker.ts
|
|
21842
21865
|
import { Worker as Worker2 } from "node:worker_threads";
|
|
21843
21866
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
21844
|
-
import { dirname as
|
|
21867
|
+
import { dirname as dirname19, join as join48 } from "node:path";
|
|
21845
21868
|
import { existsSync as existsSync31 } from "node:fs";
|
|
21846
21869
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
21847
21870
|
async function startHealthWorker(options = {}) {
|
|
@@ -21916,7 +21939,7 @@ function defaultLogger2() {
|
|
|
21916
21939
|
};
|
|
21917
21940
|
}
|
|
21918
21941
|
function resolveWorkerEntry2() {
|
|
21919
|
-
const here =
|
|
21942
|
+
const here = dirname19(fileURLToPath6(import.meta.url));
|
|
21920
21943
|
const candidates = [join48(here, "healthWorkerThread.js"), join48(here, "healthWorkerThread.ts")];
|
|
21921
21944
|
for (const candidate of candidates) {
|
|
21922
21945
|
if (existsSync31(candidate)) return candidate;
|
|
@@ -22086,7 +22109,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
22086
22109
|
throw new Error("outputPath must be inside the renders directory");
|
|
22087
22110
|
}
|
|
22088
22111
|
}
|
|
22089
|
-
const outputDir =
|
|
22112
|
+
const outputDir = dirname20(absoluteOutputPath);
|
|
22090
22113
|
if (!existsSync32(outputDir)) mkdirSync21(outputDir, { recursive: true });
|
|
22091
22114
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
22092
22115
|
}
|
|
@@ -22798,7 +22821,7 @@ import {
|
|
|
22798
22821
|
statSync as statSync15,
|
|
22799
22822
|
writeFileSync as writeFileSync15
|
|
22800
22823
|
} from "node:fs";
|
|
22801
|
-
import { basename as basename8, dirname as
|
|
22824
|
+
import { basename as basename8, dirname as dirname21, join as join50 } from "node:path";
|
|
22802
22825
|
import {
|
|
22803
22826
|
appendRateCapArgs as appendRateCapArgs2,
|
|
22804
22827
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
@@ -22845,10 +22868,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22845
22868
|
}
|
|
22846
22869
|
const format = plan2.dimensions.format;
|
|
22847
22870
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
22848
|
-
if (!existsSync33(
|
|
22849
|
-
mkdirSync22(
|
|
22871
|
+
if (!existsSync33(dirname21(outputPath))) {
|
|
22872
|
+
mkdirSync22(dirname21(outputPath), { recursive: true });
|
|
22850
22873
|
}
|
|
22851
|
-
const workDir = createStagingDir7(
|
|
22874
|
+
const workDir = createStagingDir7(dirname21(outputPath), `${basename8(outputPath)}.assemble-work-`);
|
|
22852
22875
|
const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
22853
22876
|
const stageMs = {};
|
|
22854
22877
|
const ctx = {
|