@hyperframes/producer 0.9.53 → 0.9.54
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 +73 -54
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/index.js +83 -64
- package/dist/public-server.js +61 -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/public-server.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
rmSync as rmSync13,
|
|
11
11
|
createReadStream as createReadStream3
|
|
12
12
|
} from "node:fs";
|
|
13
|
-
import { resolve as resolve10, dirname as
|
|
13
|
+
import { resolve as resolve10, dirname as dirname17, join as join37 } from "node:path";
|
|
14
14
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
15
15
|
import { parseArgs } from "node:util";
|
|
16
16
|
import { isIP } from "node:net";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
referenceBackgroundResult,
|
|
87
87
|
createReferenceBackgroundRecorder
|
|
88
88
|
} from "@hyperframes/engine";
|
|
89
|
-
import { join as join32, dirname as
|
|
89
|
+
import { join as join32, dirname as dirname14, resolve as resolve8 } from "path";
|
|
90
90
|
import { totalmem as totalmem2 } from "node:os";
|
|
91
91
|
import { randomUUID } from "crypto";
|
|
92
92
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -94,7 +94,7 @@ import { fileURLToPath as fileURLToPath4 } from "url";
|
|
|
94
94
|
// src/services/fileServer.ts
|
|
95
95
|
import { Hono } from "hono";
|
|
96
96
|
import { serve } from "@hono/node-server";
|
|
97
|
-
import { settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
97
|
+
import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
98
98
|
import {
|
|
99
99
|
existsSync as existsSync2,
|
|
100
100
|
realpathSync,
|
|
@@ -111,7 +111,7 @@ import { Readable } from "node:stream";
|
|
|
111
111
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
112
112
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
113
113
|
import { fpsToNumber } from "@hyperframes/core";
|
|
114
|
-
import { isPrivateFileUnder,
|
|
114
|
+
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
115
115
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
116
116
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
117
117
|
|
|
@@ -878,10 +878,12 @@ function createFileServer(options) {
|
|
|
878
878
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
879
879
|
const app = new Hono();
|
|
880
880
|
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
881
|
+
let listeningPort = -1;
|
|
881
882
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
882
883
|
await next();
|
|
883
884
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
884
885
|
});
|
|
886
|
+
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
885
887
|
app.get("/*", async (c) => {
|
|
886
888
|
let requestPath = c.req.path;
|
|
887
889
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -891,7 +893,7 @@ function createFileServer(options) {
|
|
|
891
893
|
const candidate = join2(root, relativePath);
|
|
892
894
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
893
895
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
894
|
-
if (isPrivateFileUnder(root, candidate,
|
|
896
|
+
if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
|
|
895
897
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
896
898
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
897
899
|
file = openRegularFile(candidate);
|
|
@@ -977,6 +979,7 @@ function createFileServer(options) {
|
|
|
977
979
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
978
980
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
979
981
|
bound.then((boundPort) => {
|
|
982
|
+
listeningPort = boundPort;
|
|
980
983
|
resolve11({
|
|
981
984
|
url: `http://localhost:${boundPort}`,
|
|
982
985
|
port: boundPort,
|
|
@@ -6561,7 +6564,7 @@ import {
|
|
|
6561
6564
|
} from "@hyperframes/parsers/css-url-scans";
|
|
6562
6565
|
import { createHash as createHash6 } from "node:crypto";
|
|
6563
6566
|
import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync9, readFileSync as readFileSync8 } from "fs";
|
|
6564
|
-
import { join as join19, dirname as
|
|
6567
|
+
import { join as join19, dirname as dirname9, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
|
|
6565
6568
|
import { parseHTML as parseHTML5 } from "linkedom";
|
|
6566
6569
|
|
|
6567
6570
|
// src/services/bundledScripts.ts
|
|
@@ -6633,7 +6636,7 @@ import {
|
|
|
6633
6636
|
readTextFile,
|
|
6634
6637
|
resolveCompositionSrc
|
|
6635
6638
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6636
|
-
import { isPrivateFileUnder as isPrivateFileUnder2,
|
|
6639
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
6637
6640
|
|
|
6638
6641
|
// src/services/renderMediaCollector.ts
|
|
6639
6642
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7465,9 +7468,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
|
|
|
7465
7468
|
|
|
7466
7469
|
// src/services/assetMediaType.ts
|
|
7467
7470
|
import { existsSync as existsSync10 } from "node:fs";
|
|
7468
|
-
import { join as join18 } from "node:path";
|
|
7471
|
+
import { dirname as dirname8, join as join18 } from "node:path";
|
|
7469
7472
|
import {
|
|
7470
7473
|
fingerprintElementId,
|
|
7474
|
+
isHttpUrl as isHttpUrl2,
|
|
7475
|
+
isInsideAssetRoots,
|
|
7471
7476
|
isNotMediaPayload,
|
|
7472
7477
|
playlistLeavesItsFolder,
|
|
7473
7478
|
NotMediaPayloadError,
|
|
@@ -7513,17 +7518,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
7513
7518
|
}
|
|
7514
7519
|
]);
|
|
7515
7520
|
}
|
|
7516
|
-
function
|
|
7517
|
-
return
|
|
7521
|
+
function mediaAssetRoots(projectDir, compiledDir) {
|
|
7522
|
+
return [projectDir, compiledDir, join18(dirname8(compiledDir), "downloads")];
|
|
7518
7523
|
}
|
|
7519
7524
|
function dropMediaOutsideProject(input) {
|
|
7520
7525
|
const { projectDir, workDir, composition, log } = input;
|
|
7521
7526
|
const compiledDir = join18(workDir, "compiled");
|
|
7522
|
-
const roots =
|
|
7527
|
+
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
7523
7528
|
const staysInside = ({ id, src }) => {
|
|
7524
|
-
if (!src ||
|
|
7529
|
+
if (!src || isHttpUrl2(src)) return true;
|
|
7525
7530
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
7526
|
-
if (
|
|
7531
|
+
if (isInsideAssetRoots(path, roots)) return true;
|
|
7527
7532
|
if (input.allowOutsideProjectAssets) {
|
|
7528
7533
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
7529
7534
|
if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
|
|
@@ -7561,7 +7566,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7561
7566
|
];
|
|
7562
7567
|
const byPath = /* @__PURE__ */ new Map();
|
|
7563
7568
|
for (const reference of references) {
|
|
7564
|
-
if (!reference.src ||
|
|
7569
|
+
if (!reference.src || isHttpUrl2(reference.src)) continue;
|
|
7565
7570
|
const resolvedPath = resolveProjectRelativeSrc3(
|
|
7566
7571
|
reference.src,
|
|
7567
7572
|
input.projectDir,
|
|
@@ -7671,7 +7676,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
7671
7676
|
const file = resolveCompositionPath(projectDir, src, assetRoot);
|
|
7672
7677
|
return file !== null && COMPOSITION_FILE.test(file) ? file : null;
|
|
7673
7678
|
}
|
|
7674
|
-
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath,
|
|
7679
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
|
|
7675
7680
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
7676
7681
|
const { document: document2 } = parseHTML5(html);
|
|
7677
7682
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -7690,7 +7695,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
|
|
|
7690
7695
|
continue;
|
|
7691
7696
|
}
|
|
7692
7697
|
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
7693
|
-
problems.push({
|
|
7698
|
+
problems.push({
|
|
7699
|
+
srcPath,
|
|
7700
|
+
detail: "it is git metadata, an env file or a private tool record"
|
|
7701
|
+
});
|
|
7694
7702
|
continue;
|
|
7695
7703
|
}
|
|
7696
7704
|
if (!COMPOSITION_FILE.test(filePath)) {
|
|
@@ -8019,7 +8027,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
8019
8027
|
workItems.map(async (item) => {
|
|
8020
8028
|
const { html: compiledSub } = await compileHtmlFile(
|
|
8021
8029
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
8022
|
-
|
|
8030
|
+
dirname9(item.filePath),
|
|
8023
8031
|
downloadDir,
|
|
8024
8032
|
void 0,
|
|
8025
8033
|
urlByAbsentLocalPath,
|
|
@@ -8681,7 +8689,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
8681
8689
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
8682
8690
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
8683
8691
|
const path = decodedUrlPath(url);
|
|
8684
|
-
const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(
|
|
8692
|
+
const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname9(sheet), path);
|
|
8685
8693
|
return isPathInside(file, projectDir) && existsSync11(file);
|
|
8686
8694
|
});
|
|
8687
8695
|
if (family && shipsFile) families.push(family);
|
|
@@ -10363,7 +10371,8 @@ import {
|
|
|
10363
10371
|
rebaseVideoToWindow,
|
|
10364
10372
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10365
10373
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10366
|
-
isHttpUrl as
|
|
10374
|
+
isHttpUrl as isHttpUrl3,
|
|
10375
|
+
isInsideAssetRoots as isInsideAssetRoots2,
|
|
10367
10376
|
assertPublicHttpsUrl,
|
|
10368
10377
|
downloadToTemp as downloadToTemp2,
|
|
10369
10378
|
resolveRestrictPageNetwork,
|
|
@@ -10608,6 +10617,7 @@ async function runExtractVideosStage(input) {
|
|
|
10608
10617
|
skipFrameExtractionIds = []
|
|
10609
10618
|
} = input;
|
|
10610
10619
|
const stage2Start = Date.now();
|
|
10620
|
+
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
10611
10621
|
const extractionPolicy = resolveVideoExtractionPolicy();
|
|
10612
10622
|
composition.videos = composition.videos.filter(
|
|
10613
10623
|
(video) => !isVideoPastTimelineEnd(video, composition.duration)
|
|
@@ -10626,7 +10636,7 @@ async function runExtractVideosStage(input) {
|
|
|
10626
10636
|
const probeFailures = await Promise.all(
|
|
10627
10637
|
composition.videos.map(async (v) => {
|
|
10628
10638
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
10629
|
-
if (!
|
|
10639
|
+
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
10630
10640
|
try {
|
|
10631
10641
|
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
10632
10642
|
signal: abortSignal,
|
|
@@ -10664,7 +10674,7 @@ async function runExtractVideosStage(input) {
|
|
|
10664
10674
|
const probed = await Promise.all(
|
|
10665
10675
|
composition.images.map(async (img) => {
|
|
10666
10676
|
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
10667
|
-
if (!
|
|
10677
|
+
if (!opensLocally(imgPath, assetRoots)) return null;
|
|
10668
10678
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
10669
10679
|
if (isHdrColorSpace2(colorSpace)) {
|
|
10670
10680
|
nativeHdrImageIds.add(img.id);
|
|
@@ -10683,6 +10693,7 @@ async function runExtractVideosStage(input) {
|
|
|
10683
10693
|
composition,
|
|
10684
10694
|
urlByAbsentLocalPath,
|
|
10685
10695
|
downloadDir: audioDownloadDir,
|
|
10696
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
10686
10697
|
signal: abortSignal,
|
|
10687
10698
|
log
|
|
10688
10699
|
});
|
|
@@ -10716,6 +10727,7 @@ async function runExtractVideosStage(input) {
|
|
|
10716
10727
|
shownBoxes,
|
|
10717
10728
|
contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
10718
10729
|
urlByAbsentLocalPath,
|
|
10730
|
+
assetRoots,
|
|
10719
10731
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
10720
10732
|
framesPlanned += planned;
|
|
10721
10733
|
framesDone += done;
|
|
@@ -10792,10 +10804,14 @@ function isPublicHttpsUrl(url) {
|
|
|
10792
10804
|
return false;
|
|
10793
10805
|
}
|
|
10794
10806
|
}
|
|
10807
|
+
function opensLocally(path, assetRoots) {
|
|
10808
|
+
return existsSync13(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
|
|
10809
|
+
}
|
|
10795
10810
|
function localProbeSource(src, input) {
|
|
10796
10811
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
10797
10812
|
const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
|
|
10798
|
-
|
|
10813
|
+
const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
|
|
10814
|
+
return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
|
|
10799
10815
|
}
|
|
10800
10816
|
async function remoteProbeSource(video, input) {
|
|
10801
10817
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
@@ -10821,7 +10837,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10821
10837
|
);
|
|
10822
10838
|
const probed = await Promise.all(
|
|
10823
10839
|
videos.map(async (video) => {
|
|
10824
|
-
const readFrom =
|
|
10840
|
+
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
10825
10841
|
if (readFrom === null) return null;
|
|
10826
10842
|
const metadata = await extractMediaMetadata4(readFrom);
|
|
10827
10843
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
@@ -10845,7 +10861,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10845
10861
|
import { existsSync as existsSync14 } from "node:fs";
|
|
10846
10862
|
import {
|
|
10847
10863
|
buildVideoLayerInput,
|
|
10848
|
-
isHttpUrl as
|
|
10864
|
+
isHttpUrl as isHttpUrl4,
|
|
10849
10865
|
qualifyVideoLayer,
|
|
10850
10866
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
10851
10867
|
} from "@hyperframes/engine";
|
|
@@ -10908,7 +10924,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10908
10924
|
const q = qualifyVideoLayer(input.videos, input.duration);
|
|
10909
10925
|
if (!q.qualifies) return { reason: q.reason };
|
|
10910
10926
|
const { video } = q;
|
|
10911
|
-
if (
|
|
10927
|
+
if (isHttpUrl4(video.src)) return { reason: "remote_source" };
|
|
10912
10928
|
const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
|
|
10913
10929
|
if (!existsSync14(path)) return { reason: "source_missing" };
|
|
10914
10930
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
@@ -10937,7 +10953,7 @@ import {
|
|
|
10937
10953
|
|
|
10938
10954
|
// src/services/render/audioDeliveryLimit.ts
|
|
10939
10955
|
import { existsSync as existsSync15 } from "node:fs";
|
|
10940
|
-
import { dirname as
|
|
10956
|
+
import { dirname as dirname11, join as join24 } from "node:path";
|
|
10941
10957
|
import {
|
|
10942
10958
|
applyAudioFxChain,
|
|
10943
10959
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
@@ -10947,7 +10963,7 @@ import {
|
|
|
10947
10963
|
|
|
10948
10964
|
// src/services/render/audioPadTrim.ts
|
|
10949
10965
|
import { spawn } from "node:child_process";
|
|
10950
|
-
import { dirname as
|
|
10966
|
+
import { dirname as dirname10, join as join23 } from "node:path";
|
|
10951
10967
|
import {
|
|
10952
10968
|
DEFAULT_CONFIG,
|
|
10953
10969
|
describeFfmpegFailure as describeFfmpegFailure2,
|
|
@@ -11241,7 +11257,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
11241
11257
|
async function enforceAacTruePeak(input) {
|
|
11242
11258
|
let scratchDir;
|
|
11243
11259
|
try {
|
|
11244
|
-
scratchDir = createStagingDir3(
|
|
11260
|
+
scratchDir = createStagingDir3(dirname10(input.audioPath), ".true-peak-");
|
|
11245
11261
|
const correctedPath = join23(scratchDir, "audio.m4a");
|
|
11246
11262
|
const measurements = [];
|
|
11247
11263
|
let attenuationDb = 0;
|
|
@@ -11452,7 +11468,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
11452
11468
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
11453
11469
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
11454
11470
|
const alternating = ["a", "b"].map(
|
|
11455
|
-
(k) => join24(
|
|
11471
|
+
(k) => join24(dirname11(sourcePath), `audio-source-limited-${k}.wav`)
|
|
11456
11472
|
);
|
|
11457
11473
|
let encodedFrom;
|
|
11458
11474
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -11610,7 +11626,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11610
11626
|
masterFxChain,
|
|
11611
11627
|
urlByAbsentLocalPath,
|
|
11612
11628
|
audioSidecarUrlByLocalPath,
|
|
11613
|
-
keepEncoderInputAt: pcmSourcePath
|
|
11629
|
+
keepEncoderInputAt: pcmSourcePath,
|
|
11630
|
+
assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
|
|
11614
11631
|
},
|
|
11615
11632
|
compiledDir
|
|
11616
11633
|
);
|
|
@@ -12290,7 +12307,7 @@ import {
|
|
|
12290
12307
|
// src/services/shaderTransitionWorkerPool.ts
|
|
12291
12308
|
import { Worker } from "node:worker_threads";
|
|
12292
12309
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
12293
|
-
import { dirname as
|
|
12310
|
+
import { dirname as dirname12, join as join28 } from "node:path";
|
|
12294
12311
|
import { createRequire } from "node:module";
|
|
12295
12312
|
import { usableCpuCount } from "@hyperframes/engine";
|
|
12296
12313
|
import { existsSync as existsSync18 } from "node:fs";
|
|
@@ -12303,7 +12320,7 @@ function resolveWorkerEntry(explicit) {
|
|
|
12303
12320
|
const isTs = override.endsWith(".ts");
|
|
12304
12321
|
return { path: override, isTs };
|
|
12305
12322
|
}
|
|
12306
|
-
const moduleDir =
|
|
12323
|
+
const moduleDir = dirname12(fileURLToPath3(import.meta.url));
|
|
12307
12324
|
const jsPath = join28(moduleDir, "shaderTransitionWorker.js");
|
|
12308
12325
|
if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
|
|
12309
12326
|
const tsPath = join28(moduleDir, "shaderTransitionWorker.ts");
|
|
@@ -13032,7 +13049,7 @@ import {
|
|
|
13032
13049
|
writeFileSync as writeFileSync6
|
|
13033
13050
|
} from "node:fs";
|
|
13034
13051
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
13035
|
-
import { dirname as
|
|
13052
|
+
import { dirname as dirname13, join as join31 } from "node:path";
|
|
13036
13053
|
import {
|
|
13037
13054
|
encodeFramesChunkedConcat,
|
|
13038
13055
|
encodeFramesFromDir,
|
|
@@ -13350,7 +13367,7 @@ async function runEncodeStage(input) {
|
|
|
13350
13367
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
13351
13368
|
fps: job.config.fps,
|
|
13352
13369
|
loop,
|
|
13353
|
-
palettePath: join31(
|
|
13370
|
+
palettePath: join31(dirname13(videoOnlyPath), "gif-palette.png"),
|
|
13354
13371
|
preserveAlpha: needsAlpha,
|
|
13355
13372
|
signal: abortSignal,
|
|
13356
13373
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -13795,7 +13812,7 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
13795
13812
|
}
|
|
13796
13813
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
|
|
13797
13814
|
if (platform2 === "win32" || platform2 === "darwin") return join32(systemTempDir, "hf-render-");
|
|
13798
|
-
return join32(
|
|
13815
|
+
return join32(dirname14(outputPath), `work-${jobId}-`);
|
|
13799
13816
|
}
|
|
13800
13817
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
13801
13818
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -14521,7 +14538,7 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
14521
14538
|
};
|
|
14522
14539
|
}
|
|
14523
14540
|
function resolveRenderDebugDir() {
|
|
14524
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(
|
|
14541
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname14(fileURLToPath4(import.meta.url)), "../..");
|
|
14525
14542
|
return join32(producerRoot, ".debug");
|
|
14526
14543
|
}
|
|
14527
14544
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
@@ -14529,7 +14546,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
14529
14546
|
validateDeliveryEncoderConfig(job.config);
|
|
14530
14547
|
validateChromaSubsamplingConfig(job.config);
|
|
14531
14548
|
const debugDir = resolveRenderDebugDir();
|
|
14532
|
-
const outputDir =
|
|
14549
|
+
const outputDir = dirname14(outputPath);
|
|
14533
14550
|
if (!existsSync21(outputDir)) mkdirSync12(outputDir, { recursive: true });
|
|
14534
14551
|
const workDir = job.config.debug ? join32(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
14535
14552
|
const pipelineStart = Date.now();
|
|
@@ -15028,6 +15045,7 @@ async function executeRenderPipeline(input) {
|
|
|
15028
15045
|
audioGain: cfg.audioGain,
|
|
15029
15046
|
audios: composition.audios,
|
|
15030
15047
|
masterFxChain: composition.masterFxChain,
|
|
15048
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
15031
15049
|
abortSignal: executionSignal,
|
|
15032
15050
|
assertNotAborted,
|
|
15033
15051
|
log,
|
|
@@ -16814,7 +16832,7 @@ async function runHyperframeLint(prepared) {
|
|
|
16814
16832
|
// src/services/healthWorker.ts
|
|
16815
16833
|
import { Worker as Worker2 } from "node:worker_threads";
|
|
16816
16834
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
16817
|
-
import { dirname as
|
|
16835
|
+
import { dirname as dirname15, join as join34 } from "node:path";
|
|
16818
16836
|
import { existsSync as existsSync23 } from "node:fs";
|
|
16819
16837
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
16820
16838
|
async function startHealthWorker(options = {}) {
|
|
@@ -16889,7 +16907,7 @@ function defaultLogger2() {
|
|
|
16889
16907
|
};
|
|
16890
16908
|
}
|
|
16891
16909
|
function resolveWorkerEntry2() {
|
|
16892
|
-
const here =
|
|
16910
|
+
const here = dirname15(fileURLToPath5(import.meta.url));
|
|
16893
16911
|
const candidates = [join34(here, "healthWorkerThread.js"), join34(here, "healthWorkerThread.ts")];
|
|
16894
16912
|
for (const candidate of candidates) {
|
|
16895
16913
|
if (existsSync23(candidate)) return candidate;
|
|
@@ -16965,7 +16983,7 @@ import {
|
|
|
16965
16983
|
|
|
16966
16984
|
// src/services/distributed/shared.ts
|
|
16967
16985
|
import { execFile as execFileCallback } from "node:child_process";
|
|
16968
|
-
import { dirname as
|
|
16986
|
+
import { dirname as dirname16, join as join35 } from "node:path";
|
|
16969
16987
|
import { existsSync as existsSync24, readFileSync as readFileSync11 } from "node:fs";
|
|
16970
16988
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
16971
16989
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -16978,7 +16996,7 @@ var execFile = promisify2(execFileCallback);
|
|
|
16978
16996
|
var cachedProducerVersion = null;
|
|
16979
16997
|
function readProducerVersion() {
|
|
16980
16998
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
16981
|
-
const startDir =
|
|
16999
|
+
const startDir = dirname16(fileURLToPath6(import.meta.url));
|
|
16982
17000
|
let current = startDir;
|
|
16983
17001
|
for (let i = 0; i < 10; i++) {
|
|
16984
17002
|
const candidate = join35(current, "package.json");
|
|
@@ -16992,7 +17010,7 @@ function readProducerVersion() {
|
|
|
16992
17010
|
} catch {
|
|
16993
17011
|
}
|
|
16994
17012
|
}
|
|
16995
|
-
const parent =
|
|
17013
|
+
const parent = dirname16(current);
|
|
16996
17014
|
if (parent === current) break;
|
|
16997
17015
|
current = parent;
|
|
16998
17016
|
}
|
|
@@ -17498,7 +17516,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
17498
17516
|
throw new Error("outputPath must be inside the renders directory");
|
|
17499
17517
|
}
|
|
17500
17518
|
}
|
|
17501
|
-
const outputDir =
|
|
17519
|
+
const outputDir = dirname17(absoluteOutputPath);
|
|
17502
17520
|
if (!existsSync25(outputDir)) mkdirSync13(outputDir, { recursive: true });
|
|
17503
17521
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
17504
17522
|
}
|
|
@@ -23,6 +23,7 @@ interface CompositionMediaAssets {
|
|
|
23
23
|
audios: readonly AudioElement[];
|
|
24
24
|
images: readonly ImageElement[];
|
|
25
25
|
}
|
|
26
|
+
export declare function mediaAssetRoots(projectDir: string, compiledDir: string): string[];
|
|
26
27
|
/** Treats local media outside the project, compiled and download dirs as missing: no probe or extraction opens it. */
|
|
27
28
|
export declare function dropMediaOutsideProject(input: {
|
|
28
29
|
projectDir: string;
|
|
@@ -37,6 +37,7 @@ export interface AudioStageInput {
|
|
|
37
37
|
masterFxChain?: string;
|
|
38
38
|
urlByAbsentLocalPath?: ReadonlyMap<string, string>;
|
|
39
39
|
audioSidecarUrlByLocalPath?: ReadonlyMap<string, string>;
|
|
40
|
+
allowOutsideProjectAssets?: boolean;
|
|
40
41
|
abortSignal: AbortSignal | undefined;
|
|
41
42
|
assertNotAborted: () => void;
|
|
42
43
|
/** Where a per-track failure's detail goes. Optional so tests need not pass one. */
|
|
@@ -145,6 +145,7 @@ interface VideoAudioProbeInput {
|
|
|
145
145
|
urlByAbsentLocalPath?: ReadonlyMap<string, string>;
|
|
146
146
|
/** Where a composition URL is downloaded before probing on a render service: the mixer's work folder, so the mix reuses it. */
|
|
147
147
|
downloadDir?: string;
|
|
148
|
+
allowOutsideProjectAssets?: boolean;
|
|
148
149
|
signal?: AbortSignal;
|
|
149
150
|
log?: ProducerLogger;
|
|
150
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.54",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/core": "0.9.
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.54",
|
|
39
|
+
"@hyperframes/engine": "0.9.54",
|
|
40
|
+
"@hyperframes/lint": "0.9.54",
|
|
41
|
+
"@hyperframes/parsers": "0.9.54",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.54"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
50
|
"vitest": "^4.1.12",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.54"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|