@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/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,
|
|
@@ -221,7 +221,7 @@ 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
223
|
import { fpsToNumber } from "@hyperframes/core";
|
|
224
|
-
import { isPrivateFileUnder,
|
|
224
|
+
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
225
225
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
226
226
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
227
227
|
|
|
@@ -869,10 +869,12 @@ function createFileServer(options) {
|
|
|
869
869
|
const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
|
|
870
870
|
const app = new Hono();
|
|
871
871
|
const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
|
|
872
|
+
let listeningPort = -1;
|
|
872
873
|
app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
|
|
873
874
|
await next();
|
|
874
875
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
875
876
|
});
|
|
877
|
+
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
876
878
|
app.get("/*", async (c) => {
|
|
877
879
|
let requestPath = c.req.path;
|
|
878
880
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -882,7 +884,7 @@ function createFileServer(options) {
|
|
|
882
884
|
const candidate = join2(root, relativePath);
|
|
883
885
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
884
886
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
885
|
-
if (isPrivateFileUnder(root, candidate,
|
|
887
|
+
if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
|
|
886
888
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
887
889
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
888
890
|
file = openRegularFile(candidate);
|
|
@@ -968,6 +970,7 @@ function createFileServer(options) {
|
|
|
968
970
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
969
971
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
970
972
|
bound.then((boundPort) => {
|
|
973
|
+
listeningPort = boundPort;
|
|
971
974
|
resolve10({
|
|
972
975
|
url: `http://localhost:${boundPort}`,
|
|
973
976
|
port: boundPort,
|
|
@@ -2250,7 +2253,7 @@ import {
|
|
|
2250
2253
|
} from "@hyperframes/parsers/css-url-scans";
|
|
2251
2254
|
import { createHash as createHash5 } from "node:crypto";
|
|
2252
2255
|
import { createReadStream as createReadStream2, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5 } from "fs";
|
|
2253
|
-
import { join as join9, dirname as
|
|
2256
|
+
import { join as join9, dirname as dirname7, resolve as resolve6, basename as basename3, relative as relative2, sep as sep3 } from "path";
|
|
2254
2257
|
import { parseHTML as parseHTML5 } from "linkedom";
|
|
2255
2258
|
|
|
2256
2259
|
// src/services/bundledScripts.ts
|
|
@@ -2322,7 +2325,7 @@ import {
|
|
|
2322
2325
|
readTextFile,
|
|
2323
2326
|
resolveCompositionSrc
|
|
2324
2327
|
} from "@hyperframes/parsers/asset-resolution";
|
|
2325
|
-
import { isPrivateFileUnder as isPrivateFileUnder2,
|
|
2328
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
2326
2329
|
|
|
2327
2330
|
// src/services/renderMediaCollector.ts
|
|
2328
2331
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -3154,9 +3157,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
|
|
|
3154
3157
|
|
|
3155
3158
|
// src/services/assetMediaType.ts
|
|
3156
3159
|
import { existsSync as existsSync6 } from "node:fs";
|
|
3157
|
-
import { join as join8 } from "node:path";
|
|
3160
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
3158
3161
|
import {
|
|
3159
3162
|
fingerprintElementId,
|
|
3163
|
+
isHttpUrl as isHttpUrl2,
|
|
3164
|
+
isInsideAssetRoots,
|
|
3160
3165
|
isNotMediaPayload,
|
|
3161
3166
|
playlistLeavesItsFolder,
|
|
3162
3167
|
NotMediaPayloadError,
|
|
@@ -3202,17 +3207,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
3202
3207
|
}
|
|
3203
3208
|
]);
|
|
3204
3209
|
}
|
|
3205
|
-
function
|
|
3206
|
-
return
|
|
3210
|
+
function mediaAssetRoots(projectDir, compiledDir) {
|
|
3211
|
+
return [projectDir, compiledDir, join8(dirname6(compiledDir), "downloads")];
|
|
3207
3212
|
}
|
|
3208
3213
|
function dropMediaOutsideProject(input) {
|
|
3209
3214
|
const { projectDir, workDir, composition, log } = input;
|
|
3210
3215
|
const compiledDir = join8(workDir, "compiled");
|
|
3211
|
-
const roots =
|
|
3216
|
+
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
3212
3217
|
const staysInside = ({ id, src }) => {
|
|
3213
|
-
if (!src ||
|
|
3218
|
+
if (!src || isHttpUrl2(src)) return true;
|
|
3214
3219
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
3215
|
-
if (
|
|
3220
|
+
if (isInsideAssetRoots(path, roots)) return true;
|
|
3216
3221
|
if (input.allowOutsideProjectAssets) {
|
|
3217
3222
|
const refusal = outsideAssetRefusal(projectDir, path);
|
|
3218
3223
|
if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
|
|
@@ -3250,7 +3255,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
3250
3255
|
];
|
|
3251
3256
|
const byPath = /* @__PURE__ */ new Map();
|
|
3252
3257
|
for (const reference of references) {
|
|
3253
|
-
if (!reference.src ||
|
|
3258
|
+
if (!reference.src || isHttpUrl2(reference.src)) continue;
|
|
3254
3259
|
const resolvedPath = resolveProjectRelativeSrc3(
|
|
3255
3260
|
reference.src,
|
|
3256
3261
|
input.projectDir,
|
|
@@ -3360,7 +3365,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
3360
3365
|
const file = resolveCompositionPath(projectDir, src, assetRoot);
|
|
3361
3366
|
return file !== null && COMPOSITION_FILE.test(file) ? file : null;
|
|
3362
3367
|
}
|
|
3363
|
-
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath,
|
|
3368
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
|
|
3364
3369
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
3365
3370
|
const { document: document2 } = parseHTML5(html);
|
|
3366
3371
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -3379,7 +3384,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
|
|
|
3379
3384
|
continue;
|
|
3380
3385
|
}
|
|
3381
3386
|
if (isPrivateCompositionFile(projectDir, filePath)) {
|
|
3382
|
-
problems.push({
|
|
3387
|
+
problems.push({
|
|
3388
|
+
srcPath,
|
|
3389
|
+
detail: "it is git metadata, an env file or a private tool record"
|
|
3390
|
+
});
|
|
3383
3391
|
continue;
|
|
3384
3392
|
}
|
|
3385
3393
|
if (!COMPOSITION_FILE.test(filePath)) {
|
|
@@ -3708,7 +3716,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
3708
3716
|
workItems.map(async (item) => {
|
|
3709
3717
|
const { html: compiledSub } = await compileHtmlFile(
|
|
3710
3718
|
rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
|
|
3711
|
-
|
|
3719
|
+
dirname7(item.filePath),
|
|
3712
3720
|
downloadDir,
|
|
3713
3721
|
void 0,
|
|
3714
3722
|
urlByAbsentLocalPath,
|
|
@@ -4370,7 +4378,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
4370
4378
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
4371
4379
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
4372
4380
|
const path = decodedUrlPath(url);
|
|
4373
|
-
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(
|
|
4381
|
+
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(dirname7(sheet), path);
|
|
4374
4382
|
return isPathInside(file, projectDir) && existsSync7(file);
|
|
4375
4383
|
});
|
|
4376
4384
|
if (family && shipsFile) families.push(family);
|
|
@@ -6084,7 +6092,8 @@ import {
|
|
|
6084
6092
|
rebaseVideoToWindow,
|
|
6085
6093
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
6086
6094
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
6087
|
-
isHttpUrl as
|
|
6095
|
+
isHttpUrl as isHttpUrl3,
|
|
6096
|
+
isInsideAssetRoots as isInsideAssetRoots2,
|
|
6088
6097
|
assertPublicHttpsUrl,
|
|
6089
6098
|
downloadToTemp as downloadToTemp2,
|
|
6090
6099
|
resolveRestrictPageNetwork,
|
|
@@ -6334,6 +6343,7 @@ async function runExtractVideosStage(input) {
|
|
|
6334
6343
|
skipFrameExtractionIds = []
|
|
6335
6344
|
} = input;
|
|
6336
6345
|
const stage2Start = Date.now();
|
|
6346
|
+
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
6337
6347
|
const extractionPolicy = resolveVideoExtractionPolicy();
|
|
6338
6348
|
composition.videos = composition.videos.filter(
|
|
6339
6349
|
(video) => !isVideoPastTimelineEnd(video, composition.duration)
|
|
@@ -6352,7 +6362,7 @@ async function runExtractVideosStage(input) {
|
|
|
6352
6362
|
const probeFailures = await Promise.all(
|
|
6353
6363
|
composition.videos.map(async (v) => {
|
|
6354
6364
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
6355
|
-
if (!
|
|
6365
|
+
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
6356
6366
|
try {
|
|
6357
6367
|
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
6358
6368
|
signal: abortSignal,
|
|
@@ -6390,7 +6400,7 @@ async function runExtractVideosStage(input) {
|
|
|
6390
6400
|
const probed = await Promise.all(
|
|
6391
6401
|
composition.images.map(async (img) => {
|
|
6392
6402
|
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
6393
|
-
if (!
|
|
6403
|
+
if (!opensLocally(imgPath, assetRoots)) return null;
|
|
6394
6404
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
6395
6405
|
if (isHdrColorSpace2(colorSpace)) {
|
|
6396
6406
|
nativeHdrImageIds.add(img.id);
|
|
@@ -6409,6 +6419,7 @@ async function runExtractVideosStage(input) {
|
|
|
6409
6419
|
composition,
|
|
6410
6420
|
urlByAbsentLocalPath,
|
|
6411
6421
|
downloadDir: audioDownloadDir,
|
|
6422
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
6412
6423
|
signal: abortSignal,
|
|
6413
6424
|
log
|
|
6414
6425
|
});
|
|
@@ -6442,6 +6453,7 @@ async function runExtractVideosStage(input) {
|
|
|
6442
6453
|
shownBoxes,
|
|
6443
6454
|
contentKeyedDirs: [join12(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
6444
6455
|
urlByAbsentLocalPath,
|
|
6456
|
+
assetRoots,
|
|
6445
6457
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
6446
6458
|
framesPlanned += planned;
|
|
6447
6459
|
framesDone += done;
|
|
@@ -6518,10 +6530,14 @@ function isPublicHttpsUrl(url) {
|
|
|
6518
6530
|
return false;
|
|
6519
6531
|
}
|
|
6520
6532
|
}
|
|
6533
|
+
function opensLocally(path, assetRoots) {
|
|
6534
|
+
return existsSync9(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
|
|
6535
|
+
}
|
|
6521
6536
|
function localProbeSource(src, input) {
|
|
6522
6537
|
const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
|
|
6523
6538
|
const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
|
|
6524
|
-
|
|
6539
|
+
const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
|
|
6540
|
+
return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
|
|
6525
6541
|
}
|
|
6526
6542
|
async function remoteProbeSource(video, input) {
|
|
6527
6543
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
@@ -6547,7 +6563,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6547
6563
|
);
|
|
6548
6564
|
const probed = await Promise.all(
|
|
6549
6565
|
videos.map(async (video) => {
|
|
6550
|
-
const readFrom =
|
|
6566
|
+
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
6551
6567
|
if (readFrom === null) return null;
|
|
6552
6568
|
const metadata = await extractMediaMetadata4(readFrom);
|
|
6553
6569
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
@@ -6570,7 +6586,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6570
6586
|
// src/services/render/videoLayerPassthroughPlan.ts
|
|
6571
6587
|
import {
|
|
6572
6588
|
buildVideoLayerInput,
|
|
6573
|
-
isHttpUrl as
|
|
6589
|
+
isHttpUrl as isHttpUrl4,
|
|
6574
6590
|
qualifyVideoLayer,
|
|
6575
6591
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
6576
6592
|
} from "@hyperframes/engine";
|
|
@@ -6588,7 +6604,7 @@ import {
|
|
|
6588
6604
|
|
|
6589
6605
|
// src/services/render/audioDeliveryLimit.ts
|
|
6590
6606
|
import { existsSync as existsSync10 } from "node:fs";
|
|
6591
|
-
import { dirname as
|
|
6607
|
+
import { dirname as dirname9, join as join14 } from "node:path";
|
|
6592
6608
|
import {
|
|
6593
6609
|
applyAudioFxChain,
|
|
6594
6610
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
@@ -6598,7 +6614,7 @@ import {
|
|
|
6598
6614
|
|
|
6599
6615
|
// src/services/render/audioPadTrim.ts
|
|
6600
6616
|
import { spawn } from "node:child_process";
|
|
6601
|
-
import { dirname as
|
|
6617
|
+
import { dirname as dirname8, join as join13 } from "node:path";
|
|
6602
6618
|
import {
|
|
6603
6619
|
DEFAULT_CONFIG,
|
|
6604
6620
|
describeFfmpegFailure as describeFfmpegFailure2,
|
|
@@ -6892,7 +6908,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
6892
6908
|
async function enforceAacTruePeak(input) {
|
|
6893
6909
|
let scratchDir;
|
|
6894
6910
|
try {
|
|
6895
|
-
scratchDir = createStagingDir3(
|
|
6911
|
+
scratchDir = createStagingDir3(dirname8(input.audioPath), ".true-peak-");
|
|
6896
6912
|
const correctedPath = join13(scratchDir, "audio.m4a");
|
|
6897
6913
|
const measurements = [];
|
|
6898
6914
|
let attenuationDb = 0;
|
|
@@ -7103,7 +7119,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
7103
7119
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
7104
7120
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
7105
7121
|
const alternating = ["a", "b"].map(
|
|
7106
|
-
(k) => join14(
|
|
7122
|
+
(k) => join14(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
|
|
7107
7123
|
);
|
|
7108
7124
|
let encodedFrom;
|
|
7109
7125
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -7261,7 +7277,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
7261
7277
|
masterFxChain,
|
|
7262
7278
|
urlByAbsentLocalPath,
|
|
7263
7279
|
audioSidecarUrlByLocalPath,
|
|
7264
|
-
keepEncoderInputAt: pcmSourcePath
|
|
7280
|
+
keepEncoderInputAt: pcmSourcePath,
|
|
7281
|
+
assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
|
|
7265
7282
|
},
|
|
7266
7283
|
compiledDir
|
|
7267
7284
|
);
|
|
@@ -7724,7 +7741,7 @@ import {
|
|
|
7724
7741
|
writeFileSync as writeFileSync4
|
|
7725
7742
|
} from "node:fs";
|
|
7726
7743
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
7727
|
-
import { dirname as
|
|
7744
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
7728
7745
|
import {
|
|
7729
7746
|
encodeFramesChunkedConcat,
|
|
7730
7747
|
encodeFramesFromDir,
|
|
@@ -8042,7 +8059,7 @@ async function runEncodeStage(input) {
|
|
|
8042
8059
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
8043
8060
|
fps: job.config.fps,
|
|
8044
8061
|
loop,
|
|
8045
|
-
palettePath: join17(
|
|
8062
|
+
palettePath: join17(dirname10(videoOnlyPath), "gif-palette.png"),
|
|
8046
8063
|
preserveAlpha: needsAlpha,
|
|
8047
8064
|
signal: abortSignal,
|
|
8048
8065
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -8519,7 +8536,7 @@ import {
|
|
|
8519
8536
|
|
|
8520
8537
|
// src/services/distributed/shared.ts
|
|
8521
8538
|
import { execFile as execFileCallback } from "node:child_process";
|
|
8522
|
-
import { dirname as
|
|
8539
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
8523
8540
|
import { existsSync as existsSync15, readFileSync as readFileSync7 } from "node:fs";
|
|
8524
8541
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8525
8542
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -8795,7 +8812,7 @@ function buildSyntheticRenderJob(input) {
|
|
|
8795
8812
|
var cachedProducerVersion = null;
|
|
8796
8813
|
function readProducerVersion() {
|
|
8797
8814
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
8798
|
-
const startDir =
|
|
8815
|
+
const startDir = dirname12(fileURLToPath3(import.meta.url));
|
|
8799
8816
|
let current = startDir;
|
|
8800
8817
|
for (let i = 0; i < 10; i++) {
|
|
8801
8818
|
const candidate = join19(current, "package.json");
|
|
@@ -8809,7 +8826,7 @@ function readProducerVersion() {
|
|
|
8809
8826
|
} catch {
|
|
8810
8827
|
}
|
|
8811
8828
|
}
|
|
8812
|
-
const parent =
|
|
8829
|
+
const parent = dirname12(current);
|
|
8813
8830
|
if (parent === current) break;
|
|
8814
8831
|
current = parent;
|
|
8815
8832
|
}
|
|
@@ -9545,7 +9562,7 @@ import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFail
|
|
|
9545
9562
|
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, rmSync as rmSync6 } from "node:fs";
|
|
9546
9563
|
import { open } from "node:fs/promises";
|
|
9547
9564
|
import { renameWithRetry as renameWithRetry7 } from "@hyperframes/engine";
|
|
9548
|
-
import { basename as basename5, dirname as
|
|
9565
|
+
import { basename as basename5, dirname as dirname13, join as join24 } from "node:path";
|
|
9549
9566
|
import { finished, pipeline } from "node:stream/promises";
|
|
9550
9567
|
import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
|
|
9551
9568
|
function boxAt(src, off, at, limit) {
|
|
@@ -9910,8 +9927,8 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
9910
9927
|
const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
|
|
9911
9928
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
9912
9929
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
9913
|
-
mkdirSync8(
|
|
9914
|
-
const workDir = createStagingDir4(
|
|
9930
|
+
mkdirSync8(dirname13(outputPath), { recursive: true });
|
|
9931
|
+
const workDir = createStagingDir4(dirname13(outputPath), `${basename5(outputPath)}.stitch-`);
|
|
9915
9932
|
const out = createWriteStream(join24(workDir, "out.mp4"));
|
|
9916
9933
|
try {
|
|
9917
9934
|
out.write(header);
|
|
@@ -10820,6 +10837,7 @@ function mixPlanAudio(c, compiledDir) {
|
|
|
10820
10837
|
compiledDir,
|
|
10821
10838
|
urlByAbsentLocalPath: c.urlByAbsentLocalPath,
|
|
10822
10839
|
audioSidecarUrlByLocalPath: c.audioSidecarUrlByLocalPath,
|
|
10840
|
+
allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
|
|
10823
10841
|
totalFrames: c.totalFrames,
|
|
10824
10842
|
fps: c.job.config.fps,
|
|
10825
10843
|
ffmpegProcessTimeout: c.cfg.ffmpegProcessTimeout,
|
|
@@ -11130,6 +11148,7 @@ async function buildPlanAudio(projectDir, config, workRoot, outputPath, options
|
|
|
11130
11148
|
await appendVideoAudioFromProbe({
|
|
11131
11149
|
...c,
|
|
11132
11150
|
downloadDir: audioWorkDir(c.workDir),
|
|
11151
|
+
allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
|
|
11133
11152
|
signal: c.abortSignal
|
|
11134
11153
|
});
|
|
11135
11154
|
logPlanStage(c.log, "extract", stageStarted);
|
|
@@ -11164,7 +11183,7 @@ import {
|
|
|
11164
11183
|
writeFileSync as writeFileSync10
|
|
11165
11184
|
} from "node:fs";
|
|
11166
11185
|
import { tmpdir } from "node:os";
|
|
11167
|
-
import { dirname as
|
|
11186
|
+
import { dirname as dirname15, isAbsolute as isAbsolute4, join as join30, relative as relative7, resolve as resolve9, sep as sep5 } from "node:path";
|
|
11168
11187
|
import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
|
|
11169
11188
|
import {
|
|
11170
11189
|
createFrameLookupTable as createFrameLookupTable5,
|
|
@@ -11183,7 +11202,7 @@ import {
|
|
|
11183
11202
|
writeFileSync as writeFileSync9
|
|
11184
11203
|
} from "node:fs";
|
|
11185
11204
|
import { renameWithRetry as renameWithRetry9 } from "@hyperframes/engine";
|
|
11186
|
-
import { dirname as
|
|
11205
|
+
import { dirname as dirname14, join as join29 } from "node:path";
|
|
11187
11206
|
|
|
11188
11207
|
// src/services/distributed/planV2Errors.ts
|
|
11189
11208
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -11244,8 +11263,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11244
11263
|
}
|
|
11245
11264
|
this.destinationDir = destinationDir;
|
|
11246
11265
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
11247
|
-
mkdirSync11(
|
|
11248
|
-
this.temporaryDir = createStagingDir5(
|
|
11266
|
+
mkdirSync11(dirname14(destinationDir), { recursive: true });
|
|
11267
|
+
this.temporaryDir = createStagingDir5(dirname14(destinationDir), ".plan-v2-publish-");
|
|
11249
11268
|
}
|
|
11250
11269
|
async putBlob(blob) {
|
|
11251
11270
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -11257,8 +11276,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11257
11276
|
}
|
|
11258
11277
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
11259
11278
|
if (existsSync20(destinationPath)) return;
|
|
11260
|
-
mkdirSync11(
|
|
11261
|
-
const stagingDir = createStagingDir5(
|
|
11279
|
+
mkdirSync11(dirname14(destinationPath), { recursive: true });
|
|
11280
|
+
const stagingDir = createStagingDir5(dirname14(destinationPath), ".plan-v2-blob-");
|
|
11262
11281
|
const temporaryPath = join29(stagingDir, "blob");
|
|
11263
11282
|
try {
|
|
11264
11283
|
try {
|
|
@@ -11549,8 +11568,8 @@ function computeManifestHash(manifest) {
|
|
|
11549
11568
|
}
|
|
11550
11569
|
function writeBlob(sourcePath, destinationPath) {
|
|
11551
11570
|
if (existsSync21(destinationPath)) return;
|
|
11552
|
-
mkdirSync12(
|
|
11553
|
-
const temporaryDir = createStagingDir6(
|
|
11571
|
+
mkdirSync12(dirname15(destinationPath), { recursive: true });
|
|
11572
|
+
const temporaryDir = createStagingDir6(dirname15(destinationPath), ".plan-v2-blob-");
|
|
11554
11573
|
const temporaryPath = join30(temporaryDir, "blob");
|
|
11555
11574
|
try {
|
|
11556
11575
|
copyFileSync8(sourcePath, temporaryPath);
|
|
@@ -11675,8 +11694,8 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
11675
11694
|
if (publication.storedBlobs.length > 0) {
|
|
11676
11695
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
11677
11696
|
}
|
|
11678
|
-
mkdirSync12(
|
|
11679
|
-
const tempDir = createStagingDir6(
|
|
11697
|
+
mkdirSync12(dirname15(planV2Dir), { recursive: true });
|
|
11698
|
+
const tempDir = createStagingDir6(dirname15(planV2Dir), ".plan-v2-build-");
|
|
11680
11699
|
try {
|
|
11681
11700
|
for (const blob of publication.blobs) {
|
|
11682
11701
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
@@ -11760,7 +11779,7 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
11760
11779
|
}
|
|
11761
11780
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
11762
11781
|
const manifest = await planV2WithPublisher(projectDir, config, publisher, {
|
|
11763
|
-
stagingParentDir:
|
|
11782
|
+
stagingParentDir: dirname15(planV2Dir)
|
|
11764
11783
|
});
|
|
11765
11784
|
return resultFromManifest(planV2Dir, manifest);
|
|
11766
11785
|
}
|
|
@@ -11953,12 +11972,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
11953
11972
|
artifact,
|
|
11954
11973
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
11955
11974
|
}));
|
|
11956
|
-
mkdirSync12(
|
|
11957
|
-
const tempDir = createStagingDir6(
|
|
11975
|
+
mkdirSync12(dirname15(destinationDir), { recursive: true });
|
|
11976
|
+
const tempDir = createStagingDir6(dirname15(destinationDir), ".plan-v2-materialize-");
|
|
11958
11977
|
try {
|
|
11959
11978
|
for (const { artifact, sourcePath } of verified) {
|
|
11960
11979
|
const destinationPath = join30(tempDir, ...artifact.path.split("/"));
|
|
11961
|
-
mkdirSync12(
|
|
11980
|
+
mkdirSync12(dirname15(destinationPath), { recursive: true });
|
|
11962
11981
|
copyFileSync8(sourcePath, destinationPath);
|
|
11963
11982
|
}
|
|
11964
11983
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
@@ -12056,7 +12075,7 @@ import {
|
|
|
12056
12075
|
statSync as statSync9,
|
|
12057
12076
|
writeFileSync as writeFileSync11
|
|
12058
12077
|
} from "node:fs";
|
|
12059
|
-
import { basename as basename6, dirname as
|
|
12078
|
+
import { basename as basename6, dirname as dirname16, join as join31 } from "node:path";
|
|
12060
12079
|
import {
|
|
12061
12080
|
appendRateCapArgs as appendRateCapArgs2,
|
|
12062
12081
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
@@ -12103,10 +12122,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
12103
12122
|
}
|
|
12104
12123
|
const format = plan.dimensions.format;
|
|
12105
12124
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
12106
|
-
if (!existsSync22(
|
|
12107
|
-
mkdirSync13(
|
|
12125
|
+
if (!existsSync22(dirname16(outputPath))) {
|
|
12126
|
+
mkdirSync13(dirname16(outputPath), { recursive: true });
|
|
12108
12127
|
}
|
|
12109
|
-
const workDir = createStagingDir7(
|
|
12128
|
+
const workDir = createStagingDir7(dirname16(outputPath), `${basename6(outputPath)}.assemble-work-`);
|
|
12110
12129
|
const fps = { num: plan.dimensions.fpsNum, den: plan.dimensions.fpsDen };
|
|
12111
12130
|
const stageMs = {};
|
|
12112
12131
|
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"
|