@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/distributed.js
CHANGED
|
@@ -198,13 +198,13 @@ import {
|
|
|
198
198
|
referenceBackgroundResult,
|
|
199
199
|
createReferenceBackgroundRecorder
|
|
200
200
|
} from "@hyperframes/engine";
|
|
201
|
-
import { join as join18, dirname as
|
|
201
|
+
import { join as join18, dirname as dirname11, resolve as resolve7 } from "path";
|
|
202
202
|
import { randomUUID } from "crypto";
|
|
203
203
|
|
|
204
204
|
// src/services/fileServer.ts
|
|
205
205
|
import { Hono } from "hono";
|
|
206
206
|
import { serve } from "@hono/node-server";
|
|
207
|
-
import { settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
207
|
+
import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
|
|
208
208
|
import {
|
|
209
209
|
existsSync as existsSync2,
|
|
210
210
|
realpathSync,
|
|
@@ -220,8 +220,10 @@ import { promisify } from "node:util";
|
|
|
220
220
|
import { Readable } from "node:stream";
|
|
221
221
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
222
222
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
223
|
+
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
224
|
+
import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
|
|
223
225
|
import { fpsToNumber } from "@hyperframes/core";
|
|
224
|
-
import { isPrivateFileUnder,
|
|
226
|
+
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
225
227
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
226
228
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
227
229
|
|
|
@@ -822,6 +824,7 @@ var HF_BRIDGE_SCRIPT = `(function() {
|
|
|
822
824
|
if (bridge()) __realClearInterval(iv);
|
|
823
825
|
}, 50);
|
|
824
826
|
})();`;
|
|
827
|
+
var OFFER_NO_FRAMING_SITE_AN_EDITING_PORT = `<meta name="${PREVIEW_FOR_ANOTHER_SITE_META}">`;
|
|
825
828
|
var RENDER_CAPTURE_MODE_SHIM = "globalThis.__HF_RENDER_CAPTURE_MODE = true;";
|
|
826
829
|
function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
827
830
|
try {
|
|
@@ -869,10 +872,12 @@ function createFileServer(options) {
|
|
|
869
872
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
870
873
|
const app = new Hono();
|
|
871
874
|
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
875
|
+
let listeningPort = -1;
|
|
872
876
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
873
877
|
await next();
|
|
874
878
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
875
879
|
});
|
|
880
|
+
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
876
881
|
app.get("/*", async (c) => {
|
|
877
882
|
let requestPath = c.req.path;
|
|
878
883
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -882,7 +887,7 @@ function createFileServer(options) {
|
|
|
882
887
|
const candidate = join2(root, relativePath);
|
|
883
888
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
884
889
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
885
|
-
if (isPrivateFileUnder(root, candidate,
|
|
890
|
+
if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
|
|
886
891
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
887
892
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
888
893
|
file = openRegularFile(candidate);
|
|
@@ -907,6 +912,7 @@ function createFileServer(options) {
|
|
|
907
912
|
html = injectScriptsAtHeadStart(html, preHeadScripts);
|
|
908
913
|
}
|
|
909
914
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
915
|
+
html = injectTagsAtHeadStart(html, OFFER_NO_FRAMING_SITE_AN_EDITING_PORT);
|
|
910
916
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
911
917
|
}
|
|
912
918
|
if (ext === ".png") {
|
|
@@ -968,6 +974,7 @@ function createFileServer(options) {
|
|
|
968
974
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
969
975
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
970
976
|
bound.then((boundPort) => {
|
|
977
|
+
listeningPort = boundPort;
|
|
971
978
|
resolve10({
|
|
972
979
|
url: `http://localhost:${boundPort}`,
|
|
973
980
|
port: boundPort,
|
|
@@ -2250,7 +2257,7 @@ import {
|
|
|
2250
2257
|
} from "@hyperframes/parsers/css-url-scans";
|
|
2251
2258
|
import { createHash as createHash5 } from "node:crypto";
|
|
2252
2259
|
import { createReadStream as createReadStream2, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5 } from "fs";
|
|
2253
|
-
import { join as join9, dirname as
|
|
2260
|
+
import { join as join9, dirname as dirname7, resolve as resolve6, basename as basename3, relative as relative2, sep as sep3 } from "path";
|
|
2254
2261
|
import { parseHTML as parseHTML5 } from "linkedom";
|
|
2255
2262
|
|
|
2256
2263
|
// src/services/bundledScripts.ts
|
|
@@ -2322,7 +2329,7 @@ import {
|
|
|
2322
2329
|
readTextFile,
|
|
2323
2330
|
resolveCompositionSrc
|
|
2324
2331
|
} from "@hyperframes/parsers/asset-resolution";
|
|
2325
|
-
import { isPrivateFileUnder as isPrivateFileUnder2,
|
|
2332
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
2326
2333
|
|
|
2327
2334
|
// src/services/renderMediaCollector.ts
|
|
2328
2335
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -3154,9 +3161,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
|
|
|
3154
3161
|
|
|
3155
3162
|
// src/services/assetMediaType.ts
|
|
3156
3163
|
import { existsSync as existsSync6 } from "node:fs";
|
|
3157
|
-
import { join as join8 } from "node:path";
|
|
3164
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
3158
3165
|
import {
|
|
3159
3166
|
fingerprintElementId,
|
|
3167
|
+
isHttpUrl as isHttpUrl2,
|
|
3168
|
+
isInsideAssetRoots,
|
|
3160
3169
|
isNotMediaPayload,
|
|
3161
3170
|
playlistLeavesItsFolder,
|
|
3162
3171
|
NotMediaPayloadError,
|
|
@@ -3202,17 +3211,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
3202
3211
|
}
|
|
3203
3212
|
]);
|
|
3204
3213
|
}
|
|
3205
|
-
function
|
|
3206
|
-
return
|
|
3214
|
+
function mediaAssetRoots(projectDir, compiledDir) {
|
|
3215
|
+
return [projectDir, compiledDir, join8(dirname6(compiledDir), "downloads")];
|
|
3207
3216
|
}
|
|
3208
3217
|
function dropMediaOutsideProject(input) {
|
|
3209
3218
|
const { projectDir, workDir, composition, log } = input;
|
|
3210
3219
|
const compiledDir = join8(workDir, "compiled");
|
|
3211
|
-
const roots =
|
|
3220
|
+
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
3212
3221
|
const staysInside = ({ id, src }) => {
|
|
3213
|
-
if (!src ||
|
|
3222
|
+
if (!src || isHttpUrl2(src)) return true;
|
|
3214
3223
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
3215
|
-
if (
|
|
3224
|
+
if (isInsideAssetRoots(path, roots)) return true;
|
|
3216
3225
|
if (input.allowOutsideProjectAssets) {
|
|
3217
3226
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
3218
3227
|
if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
|
|
@@ -3250,7 +3259,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
3250
3259
|
];
|
|
3251
3260
|
const byPath = /* @__PURE__ */ new Map();
|
|
3252
3261
|
for (const reference of references) {
|
|
3253
|
-
if (!reference.src ||
|
|
3262
|
+
if (!reference.src || isHttpUrl2(reference.src)) continue;
|
|
3254
3263
|
const resolvedPath = resolveProjectRelativeSrc3(
|
|
3255
3264
|
reference.src,
|
|
3256
3265
|
input.projectDir,
|
|
@@ -3360,7 +3369,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
3360
3369
|
const file = resolveCompositionPath(projectDir, src, assetRoot);
|
|
3361
3370
|
return file !== null && COMPOSITION_FILE.test(file) ? file : null;
|
|
3362
3371
|
}
|
|
3363
|
-
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath,
|
|
3372
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
|
|
3364
3373
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
3365
3374
|
const { document: document2 } = parseHTML5(html);
|
|
3366
3375
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -3379,7 +3388,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
|
|
|
3379
3388
|
continue;
|
|
3380
3389
|
}
|
|
3381
3390
|
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
3382
|
-
problems.push({
|
|
3391
|
+
problems.push({
|
|
3392
|
+
srcPath,
|
|
3393
|
+
detail: "it is git metadata, an env file or a private tool record"
|
|
3394
|
+
});
|
|
3383
3395
|
continue;
|
|
3384
3396
|
}
|
|
3385
3397
|
if (!COMPOSITION_FILE.test(filePath)) {
|
|
@@ -3708,7 +3720,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
3708
3720
|
workItems.map(async (item) => {
|
|
3709
3721
|
const { html: compiledSub } = await compileHtmlFile(
|
|
3710
3722
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
3711
|
-
|
|
3723
|
+
dirname7(item.filePath),
|
|
3712
3724
|
downloadDir,
|
|
3713
3725
|
void 0,
|
|
3714
3726
|
urlByAbsentLocalPath,
|
|
@@ -4370,7 +4382,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
4370
4382
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
4371
4383
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
4372
4384
|
const path = decodedUrlPath(url);
|
|
4373
|
-
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(
|
|
4385
|
+
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(dirname7(sheet), path);
|
|
4374
4386
|
return isPathInside(file, projectDir) && existsSync7(file);
|
|
4375
4387
|
});
|
|
4376
4388
|
if (family && shipsFile) families.push(family);
|
|
@@ -6084,7 +6096,8 @@ import {
|
|
|
6084
6096
|
rebaseVideoToWindow,
|
|
6085
6097
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
6086
6098
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
6087
|
-
isHttpUrl as
|
|
6099
|
+
isHttpUrl as isHttpUrl3,
|
|
6100
|
+
isInsideAssetRoots as isInsideAssetRoots2,
|
|
6088
6101
|
assertPublicHttpsUrl,
|
|
6089
6102
|
downloadToTemp as downloadToTemp2,
|
|
6090
6103
|
resolveRestrictPageNetwork,
|
|
@@ -6334,6 +6347,7 @@ async function runExtractVideosStage(input) {
|
|
|
6334
6347
|
skipFrameExtractionIds = []
|
|
6335
6348
|
} = input;
|
|
6336
6349
|
const stage2Start = Date.now();
|
|
6350
|
+
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
6337
6351
|
const extractionPolicy = resolveVideoExtractionPolicy();
|
|
6338
6352
|
composition.videos = composition.videos.filter(
|
|
6339
6353
|
(video) => !isVideoPastTimelineEnd(video, composition.duration)
|
|
@@ -6352,7 +6366,7 @@ async function runExtractVideosStage(input) {
|
|
|
6352
6366
|
const probeFailures = await Promise.all(
|
|
6353
6367
|
composition.videos.map(async (v) => {
|
|
6354
6368
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
6355
|
-
if (!
|
|
6369
|
+
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
6356
6370
|
try {
|
|
6357
6371
|
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
6358
6372
|
signal: abortSignal,
|
|
@@ -6390,7 +6404,7 @@ async function runExtractVideosStage(input) {
|
|
|
6390
6404
|
const probed = await Promise.all(
|
|
6391
6405
|
composition.images.map(async (img) => {
|
|
6392
6406
|
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
6393
|
-
if (!
|
|
6407
|
+
if (!opensLocally(imgPath, assetRoots)) return null;
|
|
6394
6408
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
6395
6409
|
if (isHdrColorSpace2(colorSpace)) {
|
|
6396
6410
|
nativeHdrImageIds.add(img.id);
|
|
@@ -6409,6 +6423,7 @@ async function runExtractVideosStage(input) {
|
|
|
6409
6423
|
composition,
|
|
6410
6424
|
urlByAbsentLocalPath,
|
|
6411
6425
|
downloadDir: audioDownloadDir,
|
|
6426
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
6412
6427
|
signal: abortSignal,
|
|
6413
6428
|
log
|
|
6414
6429
|
});
|
|
@@ -6442,6 +6457,7 @@ async function runExtractVideosStage(input) {
|
|
|
6442
6457
|
shownBoxes,
|
|
6443
6458
|
contentKeyedDirs: [join12(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
6444
6459
|
urlByAbsentLocalPath,
|
|
6460
|
+
assetRoots,
|
|
6445
6461
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
6446
6462
|
framesPlanned += planned;
|
|
6447
6463
|
framesDone += done;
|
|
@@ -6518,10 +6534,14 @@ function isPublicHttpsUrl(url) {
|
|
|
6518
6534
|
return false;
|
|
6519
6535
|
}
|
|
6520
6536
|
}
|
|
6537
|
+
function opensLocally(path, assetRoots) {
|
|
6538
|
+
return existsSync9(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
|
|
6539
|
+
}
|
|
6521
6540
|
function localProbeSource(src, input) {
|
|
6522
6541
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
6523
6542
|
const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
|
|
6524
|
-
|
|
6543
|
+
const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
|
|
6544
|
+
return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
|
|
6525
6545
|
}
|
|
6526
6546
|
async function remoteProbeSource(video, input) {
|
|
6527
6547
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
@@ -6547,7 +6567,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6547
6567
|
);
|
|
6548
6568
|
const probed = await Promise.all(
|
|
6549
6569
|
videos.map(async (video) => {
|
|
6550
|
-
const readFrom =
|
|
6570
|
+
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
6551
6571
|
if (readFrom === null) return null;
|
|
6552
6572
|
const metadata = await extractMediaMetadata4(readFrom);
|
|
6553
6573
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
@@ -6570,7 +6590,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6570
6590
|
// src/services/render/videoLayerPassthroughPlan.ts
|
|
6571
6591
|
import {
|
|
6572
6592
|
buildVideoLayerInput,
|
|
6573
|
-
isHttpUrl as
|
|
6593
|
+
isHttpUrl as isHttpUrl4,
|
|
6574
6594
|
qualifyVideoLayer,
|
|
6575
6595
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
6576
6596
|
} from "@hyperframes/engine";
|
|
@@ -6588,7 +6608,7 @@ import {
|
|
|
6588
6608
|
|
|
6589
6609
|
// src/services/render/audioDeliveryLimit.ts
|
|
6590
6610
|
import { existsSync as existsSync10 } from "node:fs";
|
|
6591
|
-
import { dirname as
|
|
6611
|
+
import { dirname as dirname9, join as join14 } from "node:path";
|
|
6592
6612
|
import {
|
|
6593
6613
|
applyAudioFxChain,
|
|
6594
6614
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
@@ -6598,7 +6618,7 @@ import {
|
|
|
6598
6618
|
|
|
6599
6619
|
// src/services/render/audioPadTrim.ts
|
|
6600
6620
|
import { spawn } from "node:child_process";
|
|
6601
|
-
import { dirname as
|
|
6621
|
+
import { dirname as dirname8, join as join13 } from "node:path";
|
|
6602
6622
|
import {
|
|
6603
6623
|
DEFAULT_CONFIG,
|
|
6604
6624
|
describeFfmpegFailure as describeFfmpegFailure2,
|
|
@@ -6892,7 +6912,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
6892
6912
|
async function enforceAacTruePeak(input) {
|
|
6893
6913
|
let scratchDir;
|
|
6894
6914
|
try {
|
|
6895
|
-
scratchDir = createStagingDir3(
|
|
6915
|
+
scratchDir = createStagingDir3(dirname8(input.audioPath), ".true-peak-");
|
|
6896
6916
|
const correctedPath = join13(scratchDir, "audio.m4a");
|
|
6897
6917
|
const measurements = [];
|
|
6898
6918
|
let attenuationDb = 0;
|
|
@@ -7103,7 +7123,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
7103
7123
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
7104
7124
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
7105
7125
|
const alternating = ["a", "b"].map(
|
|
7106
|
-
(k) => join14(
|
|
7126
|
+
(k) => join14(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
|
|
7107
7127
|
);
|
|
7108
7128
|
let encodedFrom;
|
|
7109
7129
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -7261,7 +7281,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
7261
7281
|
masterFxChain,
|
|
7262
7282
|
urlByAbsentLocalPath,
|
|
7263
7283
|
audioSidecarUrlByLocalPath,
|
|
7264
|
-
keepEncoderInputAt: pcmSourcePath
|
|
7284
|
+
keepEncoderInputAt: pcmSourcePath,
|
|
7285
|
+
assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
|
|
7265
7286
|
},
|
|
7266
7287
|
compiledDir
|
|
7267
7288
|
);
|
|
@@ -7724,7 +7745,7 @@ import {
|
|
|
7724
7745
|
writeFileSync as writeFileSync4
|
|
7725
7746
|
} from "node:fs";
|
|
7726
7747
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
7727
|
-
import { dirname as
|
|
7748
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
7728
7749
|
import {
|
|
7729
7750
|
encodeFramesChunkedConcat,
|
|
7730
7751
|
encodeFramesFromDir,
|
|
@@ -8042,7 +8063,7 @@ async function runEncodeStage(input) {
|
|
|
8042
8063
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
8043
8064
|
fps: job.config.fps,
|
|
8044
8065
|
loop,
|
|
8045
|
-
palettePath: join17(
|
|
8066
|
+
palettePath: join17(dirname10(videoOnlyPath), "gif-palette.png"),
|
|
8046
8067
|
preserveAlpha: needsAlpha,
|
|
8047
8068
|
signal: abortSignal,
|
|
8048
8069
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -8519,7 +8540,7 @@ import {
|
|
|
8519
8540
|
|
|
8520
8541
|
// src/services/distributed/shared.ts
|
|
8521
8542
|
import { execFile as execFileCallback } from "node:child_process";
|
|
8522
|
-
import { dirname as
|
|
8543
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
8523
8544
|
import { existsSync as existsSync15, readFileSync as readFileSync7 } from "node:fs";
|
|
8524
8545
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8525
8546
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -8795,7 +8816,7 @@ function buildSyntheticRenderJob(input) {
|
|
|
8795
8816
|
var cachedProducerVersion = null;
|
|
8796
8817
|
function readProducerVersion() {
|
|
8797
8818
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
8798
|
-
const startDir =
|
|
8819
|
+
const startDir = dirname12(fileURLToPath3(import.meta.url));
|
|
8799
8820
|
let current = startDir;
|
|
8800
8821
|
for (let i = 0; i < 10; i++) {
|
|
8801
8822
|
const candidate = join19(current, "package.json");
|
|
@@ -8809,7 +8830,7 @@ function readProducerVersion() {
|
|
|
8809
8830
|
} catch {
|
|
8810
8831
|
}
|
|
8811
8832
|
}
|
|
8812
|
-
const parent =
|
|
8833
|
+
const parent = dirname12(current);
|
|
8813
8834
|
if (parent === current) break;
|
|
8814
8835
|
current = parent;
|
|
8815
8836
|
}
|
|
@@ -9545,7 +9566,7 @@ import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFail
|
|
|
9545
9566
|
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, rmSync as rmSync6 } from "node:fs";
|
|
9546
9567
|
import { open } from "node:fs/promises";
|
|
9547
9568
|
import { renameWithRetry as renameWithRetry7 } from "@hyperframes/engine";
|
|
9548
|
-
import { basename as basename5, dirname as
|
|
9569
|
+
import { basename as basename5, dirname as dirname13, join as join24 } from "node:path";
|
|
9549
9570
|
import { finished, pipeline } from "node:stream/promises";
|
|
9550
9571
|
import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
|
|
9551
9572
|
function boxAt(src, off, at, limit) {
|
|
@@ -9910,8 +9931,8 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
9910
9931
|
const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
|
|
9911
9932
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
9912
9933
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
9913
|
-
mkdirSync8(
|
|
9914
|
-
const workDir = createStagingDir4(
|
|
9934
|
+
mkdirSync8(dirname13(outputPath), { recursive: true });
|
|
9935
|
+
const workDir = createStagingDir4(dirname13(outputPath), `${basename5(outputPath)}.stitch-`);
|
|
9915
9936
|
const out = createWriteStream(join24(workDir, "out.mp4"));
|
|
9916
9937
|
try {
|
|
9917
9938
|
out.write(header);
|
|
@@ -10820,6 +10841,7 @@ function mixPlanAudio(c, compiledDir) {
|
|
|
10820
10841
|
compiledDir,
|
|
10821
10842
|
urlByAbsentLocalPath: c.urlByAbsentLocalPath,
|
|
10822
10843
|
audioSidecarUrlByLocalPath: c.audioSidecarUrlByLocalPath,
|
|
10844
|
+
allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
|
|
10823
10845
|
totalFrames: c.totalFrames,
|
|
10824
10846
|
fps: c.job.config.fps,
|
|
10825
10847
|
ffmpegProcessTimeout: c.cfg.ffmpegProcessTimeout,
|
|
@@ -11130,6 +11152,7 @@ async function buildPlanAudio(projectDir, config, workRoot, outputPath, options
|
|
|
11130
11152
|
await appendVideoAudioFromProbe({
|
|
11131
11153
|
...c,
|
|
11132
11154
|
downloadDir: audioWorkDir(c.workDir),
|
|
11155
|
+
allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
|
|
11133
11156
|
signal: c.abortSignal
|
|
11134
11157
|
});
|
|
11135
11158
|
logPlanStage(c.log, "extract", stageStarted);
|
|
@@ -11164,7 +11187,7 @@ import {
|
|
|
11164
11187
|
writeFileSync as writeFileSync10
|
|
11165
11188
|
} from "node:fs";
|
|
11166
11189
|
import { tmpdir } from "node:os";
|
|
11167
|
-
import { dirname as
|
|
11190
|
+
import { dirname as dirname15, isAbsolute as isAbsolute4, join as join30, relative as relative7, resolve as resolve9, sep as sep5 } from "node:path";
|
|
11168
11191
|
import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
|
|
11169
11192
|
import {
|
|
11170
11193
|
createFrameLookupTable as createFrameLookupTable5,
|
|
@@ -11183,7 +11206,7 @@ import {
|
|
|
11183
11206
|
writeFileSync as writeFileSync9
|
|
11184
11207
|
} from "node:fs";
|
|
11185
11208
|
import { renameWithRetry as renameWithRetry9 } from "@hyperframes/engine";
|
|
11186
|
-
import { dirname as
|
|
11209
|
+
import { dirname as dirname14, join as join29 } from "node:path";
|
|
11187
11210
|
|
|
11188
11211
|
// src/services/distributed/planV2Errors.ts
|
|
11189
11212
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -11244,8 +11267,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11244
11267
|
}
|
|
11245
11268
|
this.destinationDir = destinationDir;
|
|
11246
11269
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
11247
|
-
mkdirSync11(
|
|
11248
|
-
this.temporaryDir = createStagingDir5(
|
|
11270
|
+
mkdirSync11(dirname14(destinationDir), { recursive: true });
|
|
11271
|
+
this.temporaryDir = createStagingDir5(dirname14(destinationDir), ".plan-v2-publish-");
|
|
11249
11272
|
}
|
|
11250
11273
|
async putBlob(blob) {
|
|
11251
11274
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -11257,8 +11280,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11257
11280
|
}
|
|
11258
11281
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
11259
11282
|
if (existsSync20(destinationPath)) return;
|
|
11260
|
-
mkdirSync11(
|
|
11261
|
-
const stagingDir = createStagingDir5(
|
|
11283
|
+
mkdirSync11(dirname14(destinationPath), { recursive: true });
|
|
11284
|
+
const stagingDir = createStagingDir5(dirname14(destinationPath), ".plan-v2-blob-");
|
|
11262
11285
|
const temporaryPath = join29(stagingDir, "blob");
|
|
11263
11286
|
try {
|
|
11264
11287
|
try {
|
|
@@ -11549,8 +11572,8 @@ function computeManifestHash(manifest) {
|
|
|
11549
11572
|
}
|
|
11550
11573
|
function writeBlob(sourcePath, destinationPath) {
|
|
11551
11574
|
if (existsSync21(destinationPath)) return;
|
|
11552
|
-
mkdirSync12(
|
|
11553
|
-
const temporaryDir = createStagingDir6(
|
|
11575
|
+
mkdirSync12(dirname15(destinationPath), { recursive: true });
|
|
11576
|
+
const temporaryDir = createStagingDir6(dirname15(destinationPath), ".plan-v2-blob-");
|
|
11554
11577
|
const temporaryPath = join30(temporaryDir, "blob");
|
|
11555
11578
|
try {
|
|
11556
11579
|
copyFileSync8(sourcePath, temporaryPath);
|
|
@@ -11675,8 +11698,8 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
11675
11698
|
if (publication.storedBlobs.length > 0) {
|
|
11676
11699
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
11677
11700
|
}
|
|
11678
|
-
mkdirSync12(
|
|
11679
|
-
const tempDir = createStagingDir6(
|
|
11701
|
+
mkdirSync12(dirname15(planV2Dir), { recursive: true });
|
|
11702
|
+
const tempDir = createStagingDir6(dirname15(planV2Dir), ".plan-v2-build-");
|
|
11680
11703
|
try {
|
|
11681
11704
|
for (const blob of publication.blobs) {
|
|
11682
11705
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
@@ -11760,7 +11783,7 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
11760
11783
|
}
|
|
11761
11784
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
11762
11785
|
const manifest = await planV2WithPublisher(projectDir, config, publisher, {
|
|
11763
|
-
stagingParentDir:
|
|
11786
|
+
stagingParentDir: dirname15(planV2Dir)
|
|
11764
11787
|
});
|
|
11765
11788
|
return resultFromManifest(planV2Dir, manifest);
|
|
11766
11789
|
}
|
|
@@ -11953,12 +11976,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
11953
11976
|
artifact,
|
|
11954
11977
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
11955
11978
|
}));
|
|
11956
|
-
mkdirSync12(
|
|
11957
|
-
const tempDir = createStagingDir6(
|
|
11979
|
+
mkdirSync12(dirname15(destinationDir), { recursive: true });
|
|
11980
|
+
const tempDir = createStagingDir6(dirname15(destinationDir), ".plan-v2-materialize-");
|
|
11958
11981
|
try {
|
|
11959
11982
|
for (const { artifact, sourcePath } of verified) {
|
|
11960
11983
|
const destinationPath = join30(tempDir, ...artifact.path.split("/"));
|
|
11961
|
-
mkdirSync12(
|
|
11984
|
+
mkdirSync12(dirname15(destinationPath), { recursive: true });
|
|
11962
11985
|
copyFileSync8(sourcePath, destinationPath);
|
|
11963
11986
|
}
|
|
11964
11987
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
@@ -12056,7 +12079,7 @@ import {
|
|
|
12056
12079
|
statSync as statSync9,
|
|
12057
12080
|
writeFileSync as writeFileSync11
|
|
12058
12081
|
} from "node:fs";
|
|
12059
|
-
import { basename as basename6, dirname as
|
|
12082
|
+
import { basename as basename6, dirname as dirname16, join as join31 } from "node:path";
|
|
12060
12083
|
import {
|
|
12061
12084
|
appendRateCapArgs as appendRateCapArgs2,
|
|
12062
12085
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
@@ -12103,10 +12126,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
12103
12126
|
}
|
|
12104
12127
|
const format = plan.dimensions.format;
|
|
12105
12128
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
12106
|
-
if (!existsSync22(
|
|
12107
|
-
mkdirSync13(
|
|
12129
|
+
if (!existsSync22(dirname16(outputPath))) {
|
|
12130
|
+
mkdirSync13(dirname16(outputPath), { recursive: true });
|
|
12108
12131
|
}
|
|
12109
|
-
const workDir = createStagingDir7(
|
|
12132
|
+
const workDir = createStagingDir7(dirname16(outputPath), `${basename6(outputPath)}.assemble-work-`);
|
|
12110
12133
|
const fps = { num: plan.dimensions.fpsNum, den: plan.dimensions.fpsDen };
|
|
12111
12134
|
const stageMs = {};
|
|
12112
12135
|
const ctx = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "e9989f5a4b18bb0ae30ba9492234771124c21fc43876f62959ee41098d128b14",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|