@hyperframes/producer 0.9.93 → 0.9.94
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/compileWorker.js +18 -11
- package/dist/distributed.js +41 -27
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -66
- package/dist/index.js +369 -226
- package/dist/public-server.js +281 -138
- package/dist/services/render/captureCost.d.ts +4 -1
- package/dist/services/render/frameWindow.d.ts +17 -0
- package/dist/services/render/gpuChoice.d.ts +15 -0
- package/dist/services/render/stages/audioStage.d.ts +6 -1
- package/dist/services/render/stages/captureHdrFrameShared.d.ts +4 -1
- package/dist/services/renderOrchestrator.d.ts +5 -0
- package/package.json +7 -7
package/dist/compileWorker.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import { createHash as createHash3 } from "node:crypto";
|
|
29
29
|
import { createReadStream, existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync4, statSync as statSync4 } from "fs";
|
|
30
30
|
import { join as join5, dirname as dirname3, resolve as resolve3, basename as basename3, relative, sep as sep2 } from "path";
|
|
31
|
-
import { parseHTML as parseHTML4 } from "linkedom";
|
|
31
|
+
import { parseHTML as parseHTML4 } from "@hyperframes/parsers/linkedom";
|
|
32
32
|
|
|
33
33
|
// src/services/bundledScripts.ts
|
|
34
34
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
readTextFile,
|
|
279
279
|
resolveCompositionSrc
|
|
280
280
|
} from "@hyperframes/parsers/asset-resolution";
|
|
281
|
-
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
281
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
282
282
|
import { linksOutside as linksOutside2 } from "@hyperframes/studio-server/outside-file";
|
|
283
283
|
|
|
284
284
|
// src/utils/ffprobe.ts
|
|
@@ -308,7 +308,7 @@ import {
|
|
|
308
308
|
} from "node:path";
|
|
309
309
|
import { statSync } from "node:fs";
|
|
310
310
|
import { fileURLToPath } from "node:url";
|
|
311
|
-
import { isSafePath } from "@hyperframes/core/safe-path";
|
|
311
|
+
import { isPrivateFileUnder, isSafePath, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
312
312
|
import {
|
|
313
313
|
isCopiedOutsideFileType,
|
|
314
314
|
isPrivateOutsideFile,
|
|
@@ -335,7 +335,10 @@ function escapesAssetRoot(path, assetRoot) {
|
|
|
335
335
|
return assetRoot !== void 0 && !isSafePath(assetRoot, path);
|
|
336
336
|
}
|
|
337
337
|
function outsideAssetRefusal(projectDir2, path, policy = {}) {
|
|
338
|
-
if (!linksOutside(projectDir2, path))
|
|
338
|
+
if (!linksOutside(projectDir2, path)) {
|
|
339
|
+
const privateByAnotherSpelling = !isPathInside(path, projectDir2) && isPrivateFileUnder(projectDir2, path, isStudioPrivatePath);
|
|
340
|
+
return privateByAnotherSpelling ? "blocklisted" : null;
|
|
341
|
+
}
|
|
339
342
|
if (isPrivateOutsideFile(projectDir2, path)) return "blocklisted";
|
|
340
343
|
const folder = statSync(path, { throwIfNoEntry: false })?.isDirectory();
|
|
341
344
|
if (folder || isUploadedOutsideFileType(path)) return null;
|
|
@@ -362,7 +365,7 @@ function toExternalAssetKey(absPath) {
|
|
|
362
365
|
}
|
|
363
366
|
|
|
364
367
|
// src/services/renderMediaCollector.ts
|
|
365
|
-
import { parseHTML } from "linkedom";
|
|
368
|
+
import { parseHTML } from "@hyperframes/parsers/linkedom";
|
|
366
369
|
import {
|
|
367
370
|
MEDIA_RENDER_ID_ATTR,
|
|
368
371
|
normalizeRateSpec,
|
|
@@ -556,7 +559,7 @@ import {
|
|
|
556
559
|
import { createHash, randomUUID } from "node:crypto";
|
|
557
560
|
import { copyFileSync, existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, rmSync, statSync as statSync2 } from "node:fs";
|
|
558
561
|
import { dirname, isAbsolute, join as join3, resolve } from "node:path";
|
|
559
|
-
import { parseHTML as parseHTML2 } from "linkedom";
|
|
562
|
+
import { parseHTML as parseHTML2 } from "@hyperframes/parsers/linkedom";
|
|
560
563
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
561
564
|
import {
|
|
562
565
|
DEFAULT_VP9_CPU_USED,
|
|
@@ -631,7 +634,11 @@ function resolveLocalImageSourcePath(src, options2) {
|
|
|
631
634
|
resolve(options2.downloadDir, normalizedBase)
|
|
632
635
|
];
|
|
633
636
|
const assetRoot = options2.allowOutsideFiles ? void 0 : options2.projectDir;
|
|
634
|
-
const allowed = (candidate) => !namesAnotherNetworkRoot(options2.projectDir, candidate) && !isPrivateUnderAssetRoots(
|
|
637
|
+
const allowed = (candidate) => !namesAnotherNetworkRoot(options2.projectDir, candidate) && !isPrivateUnderAssetRoots(
|
|
638
|
+
candidate,
|
|
639
|
+
[options2.projectDir, options2.downloadDir],
|
|
640
|
+
options2.allowOutsideFiles
|
|
641
|
+
) && (!escapesAssetRoot(candidate, assetRoot) && outsideAssetRefusal(options2.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options2.downloadDir));
|
|
635
642
|
return candidates.find((candidate) => allowed(candidate) && existsSync2(candidate)) ?? null;
|
|
636
643
|
}
|
|
637
644
|
function isUsableFile(path) {
|
|
@@ -926,7 +933,7 @@ import {
|
|
|
926
933
|
writeFileSync
|
|
927
934
|
} from "node:fs";
|
|
928
935
|
import { dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
|
|
929
|
-
import { parseHTML as parseHTML3 } from "linkedom";
|
|
936
|
+
import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
|
|
930
937
|
import { renameWithRetry as renameWithRetry2, runFfmpeg as runFfmpeg2, runFfprobe, urlInputArgs as urlInputArgs2 } from "@hyperframes/engine";
|
|
931
938
|
|
|
932
939
|
// src/services/heifRotation.ts
|
|
@@ -1433,7 +1440,7 @@ function assertOutsideMarkupAsked(projectDir2, filePath, srcPath, assetRoot, out
|
|
|
1433
1440
|
throw new EmptyCompositionError([{ srcPath, detail: OUTSIDE_COMPOSITION_NEEDS_FLAG }]);
|
|
1434
1441
|
}
|
|
1435
1442
|
}
|
|
1436
|
-
var isPrivateCompositionFile = (projectDir2, filePath) =>
|
|
1443
|
+
var isPrivateCompositionFile = (projectDir2, filePath) => isPrivateFileUnder2(projectDir2, filePath, isStudioPrivatePath2);
|
|
1437
1444
|
function compositionSrcsIn(html) {
|
|
1438
1445
|
const { document: document2 } = parseHTML4(html);
|
|
1439
1446
|
const mounts = [];
|
|
@@ -1770,7 +1777,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir2,
|
|
|
1770
1777
|
} else {
|
|
1771
1778
|
filePath = decodedUrlPath(src);
|
|
1772
1779
|
if (!filePath.startsWith("/")) filePath = join5(baseDir, filePath);
|
|
1773
|
-
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir2, downloadDir2])) {
|
|
1780
|
+
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir2, downloadDir2], assetRoot === void 0)) {
|
|
1774
1781
|
return { duration: null, resolvedPath: filePath };
|
|
1775
1782
|
}
|
|
1776
1783
|
filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
|
|
@@ -3170,7 +3177,7 @@ async function compileWithAssets(projectDir2, htmlPath2, downloadDir2, options2,
|
|
|
3170
3177
|
for (const video of videos) {
|
|
3171
3178
|
if (isHttpUrl(video.src)) continue;
|
|
3172
3179
|
const videoPath = resolve3(projectDir2, video.src);
|
|
3173
|
-
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir2, videoPath) || !existsSync3(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir2, downloadDir2]))
|
|
3180
|
+
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir2, videoPath) || !existsSync3(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir2, downloadDir2], assetRoot === void 0))
|
|
3174
3181
|
continue;
|
|
3175
3182
|
advised.add(videoPath);
|
|
3176
3183
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
package/dist/distributed.js
CHANGED
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
} from "node:path";
|
|
84
84
|
import { statSync } from "node:fs";
|
|
85
85
|
import { fileURLToPath } from "node:url";
|
|
86
|
-
import { isSafePath } from "@hyperframes/core/safe-path";
|
|
86
|
+
import { isPrivateFileUnder, isSafePath, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
87
87
|
import {
|
|
88
88
|
isCopiedOutsideFileType,
|
|
89
89
|
isPrivateOutsideFile,
|
|
@@ -110,7 +110,10 @@ function escapesAssetRoot(path, assetRoot) {
|
|
|
110
110
|
return assetRoot !== void 0 && !isSafePath(assetRoot, path);
|
|
111
111
|
}
|
|
112
112
|
function outsideAssetRefusal(projectDir, path, policy = {}) {
|
|
113
|
-
if (!linksOutside(projectDir, path))
|
|
113
|
+
if (!linksOutside(projectDir, path)) {
|
|
114
|
+
const privateByAnotherSpelling = !isPathInside(path, projectDir) && isPrivateFileUnder(projectDir, path, isStudioPrivatePath);
|
|
115
|
+
return privateByAnotherSpelling ? "blocklisted" : null;
|
|
116
|
+
}
|
|
114
117
|
if (isPrivateOutsideFile(projectDir, path)) return "blocklisted";
|
|
115
118
|
const folder = statSync(path, { throwIfNoEntry: false })?.isDirectory();
|
|
116
119
|
if (folder || isUploadedOutsideFileType(path)) return null;
|
|
@@ -355,6 +358,7 @@ import {
|
|
|
355
358
|
LOW_MEMORY_TOTAL_MB_THRESHOLD,
|
|
356
359
|
assertConfiguredFfmpegBinariesExist,
|
|
357
360
|
resolveBrowserGpuMode,
|
|
361
|
+
probedHardwareGpu,
|
|
358
362
|
resolveHeadlessShellPath,
|
|
359
363
|
compositionRequiresWebGpu as compositionRequiresWebGpu2,
|
|
360
364
|
applyConcreteGpuScreenshotClamp,
|
|
@@ -404,7 +408,7 @@ import {
|
|
|
404
408
|
serviceWorkerScriptFetch
|
|
405
409
|
} from "@hyperframes/core/studio-preview-mark";
|
|
406
410
|
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
407
|
-
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
411
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
408
412
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
409
413
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
410
414
|
|
|
@@ -1076,7 +1080,7 @@ function createFileServer(options) {
|
|
|
1076
1080
|
const candidate = join2(root, relativePath);
|
|
1077
1081
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
1078
1082
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
1079
|
-
if (
|
|
1083
|
+
if (isPrivateFileUnder2(root, candidate, isStudioPrivatePath2)) continue;
|
|
1080
1084
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
1081
1085
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut, outsidePolicy)) continue;
|
|
1082
1086
|
file = openRegularFile(candidate);
|
|
@@ -1941,8 +1945,8 @@ function selectCaptureCalibrationFrames(totalFrames) {
|
|
|
1941
1945
|
new Set(candidates.map((frame) => Math.max(0, Math.min(lastFrame, frame))))
|
|
1942
1946
|
).sort((a, b) => a - b);
|
|
1943
1947
|
}
|
|
1944
|
-
async function measureCaptureCostFromSession(session, totalFrames, fps, log) {
|
|
1945
|
-
const sampledFrames = selectCaptureCalibrationFrames(totalFrames);
|
|
1948
|
+
async function measureCaptureCostFromSession(session, totalFrames, fps, log, firstFrame = 0) {
|
|
1949
|
+
const sampledFrames = selectCaptureCalibrationFrames(totalFrames).map((i) => firstFrame + i);
|
|
1946
1950
|
const samples = [];
|
|
1947
1951
|
const totalSamples = sampledFrames.length;
|
|
1948
1952
|
const savedStaticFrames = session.staticFrames;
|
|
@@ -2426,7 +2430,7 @@ async function observeRenderStage(recorder, phase, data, fn, options = {}) {
|
|
|
2426
2430
|
}
|
|
2427
2431
|
|
|
2428
2432
|
// src/services/render/videoFrameCoverage.ts
|
|
2429
|
-
import { parseHTML } from "linkedom";
|
|
2433
|
+
import { parseHTML } from "@hyperframes/parsers/linkedom";
|
|
2430
2434
|
import {
|
|
2431
2435
|
fpsToNumber as fpsToNumber5,
|
|
2432
2436
|
normalizeRateSpec,
|
|
@@ -2487,7 +2491,7 @@ import {
|
|
|
2487
2491
|
import { createHash as createHash5 } from "node:crypto";
|
|
2488
2492
|
import { createReadStream as createReadStream2, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5, statSync as statSync5 } from "fs";
|
|
2489
2493
|
import { join as join9, dirname as dirname7, resolve as resolve6, basename as basename3, relative as relative2, sep as sep3 } from "path";
|
|
2490
|
-
import { parseHTML as parseHTML5 } from "linkedom";
|
|
2494
|
+
import { parseHTML as parseHTML5 } from "@hyperframes/parsers/linkedom";
|
|
2491
2495
|
|
|
2492
2496
|
// src/services/bundledScripts.ts
|
|
2493
2497
|
import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -2569,7 +2573,7 @@ import {
|
|
|
2569
2573
|
readTextFile,
|
|
2570
2574
|
resolveCompositionSrc
|
|
2571
2575
|
} from "@hyperframes/parsers/asset-resolution";
|
|
2572
|
-
import { isPrivateFileUnder as
|
|
2576
|
+
import { isPrivateFileUnder as isPrivateFileUnder3, isStudioPrivatePath as isStudioPrivatePath3 } from "@hyperframes/core/safe-path";
|
|
2573
2577
|
import { linksOutside as linksOutside2 } from "@hyperframes/studio-server/outside-file";
|
|
2574
2578
|
import {
|
|
2575
2579
|
assertCompositionFileSize,
|
|
@@ -2580,7 +2584,7 @@ import {
|
|
|
2580
2584
|
} from "@hyperframes/core/compiler";
|
|
2581
2585
|
|
|
2582
2586
|
// src/services/renderMediaCollector.ts
|
|
2583
|
-
import { parseHTML as parseHTML2 } from "linkedom";
|
|
2587
|
+
import { parseHTML as parseHTML2 } from "@hyperframes/parsers/linkedom";
|
|
2584
2588
|
import {
|
|
2585
2589
|
MEDIA_RENDER_ID_ATTR,
|
|
2586
2590
|
normalizeRateSpec as normalizeRateSpec2,
|
|
@@ -2774,7 +2778,7 @@ import {
|
|
|
2774
2778
|
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
2775
2779
|
import { copyFileSync as copyFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync as rmSync2, statSync as statSync3 } from "node:fs";
|
|
2776
2780
|
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join6, resolve as resolve4 } from "node:path";
|
|
2777
|
-
import { parseHTML as parseHTML3 } from "linkedom";
|
|
2781
|
+
import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
|
|
2778
2782
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
2779
2783
|
import {
|
|
2780
2784
|
DEFAULT_VP9_CPU_USED,
|
|
@@ -2826,7 +2830,11 @@ function resolveLocalImageSourcePath(src, options) {
|
|
|
2826
2830
|
resolve4(options.downloadDir, normalizedBase)
|
|
2827
2831
|
];
|
|
2828
2832
|
const assetRoot = options.allowOutsideFiles ? void 0 : options.projectDir;
|
|
2829
|
-
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && !isPrivateUnderAssetRoots(
|
|
2833
|
+
const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && !isPrivateUnderAssetRoots(
|
|
2834
|
+
candidate,
|
|
2835
|
+
[options.projectDir, options.downloadDir],
|
|
2836
|
+
options.allowOutsideFiles
|
|
2837
|
+
) && (!escapesAssetRoot(candidate, assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
|
|
2830
2838
|
return candidates.find((candidate) => allowed(candidate) && existsSync5(candidate)) ?? null;
|
|
2831
2839
|
}
|
|
2832
2840
|
function isUsableFile(path) {
|
|
@@ -3121,7 +3129,7 @@ import {
|
|
|
3121
3129
|
writeFileSync as writeFileSync2
|
|
3122
3130
|
} from "node:fs";
|
|
3123
3131
|
import { dirname as dirname5, join as join7, resolve as resolve5 } from "node:path";
|
|
3124
|
-
import { parseHTML as parseHTML4 } from "linkedom";
|
|
3132
|
+
import { parseHTML as parseHTML4 } from "@hyperframes/parsers/linkedom";
|
|
3125
3133
|
import { renameWithRetry as renameWithRetry3, runFfmpeg as runFfmpeg3, runFfprobe, urlInputArgs as urlInputArgs3 } from "@hyperframes/engine";
|
|
3126
3134
|
|
|
3127
3135
|
// src/services/heifRotation.ts
|
|
@@ -3522,7 +3530,7 @@ function dropMediaOutsideProject(input) {
|
|
|
3522
3530
|
const staysInside = ({ id, src }) => {
|
|
3523
3531
|
if (!src || isHttpUrl2(src)) return true;
|
|
3524
3532
|
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
3525
|
-
if (isPrivateUnderAssetRoots2(path, roots)) {
|
|
3533
|
+
if (isPrivateUnderAssetRoots2(path, roots, input.allowOutsideProjectAssets)) {
|
|
3526
3534
|
log.warn(`[Render] Media "${id}" source is missing: it is a private project file`, { src });
|
|
3527
3535
|
return false;
|
|
3528
3536
|
}
|
|
@@ -3692,7 +3700,7 @@ function assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outs
|
|
|
3692
3700
|
throw new EmptyCompositionError([{ srcPath, detail: OUTSIDE_COMPOSITION_NEEDS_FLAG }]);
|
|
3693
3701
|
}
|
|
3694
3702
|
}
|
|
3695
|
-
var isPrivateCompositionFile = (projectDir, filePath) =>
|
|
3703
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder3(projectDir, filePath, isStudioPrivatePath3);
|
|
3696
3704
|
function compositionSrcsIn(html) {
|
|
3697
3705
|
const { document: document2 } = parseHTML5(html);
|
|
3698
3706
|
const mounts = [];
|
|
@@ -4029,7 +4037,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
4029
4037
|
} else {
|
|
4030
4038
|
filePath = decodedUrlPath(src);
|
|
4031
4039
|
if (!filePath.startsWith("/")) filePath = join9(baseDir, filePath);
|
|
4032
|
-
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir, downloadDir])) {
|
|
4040
|
+
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots3(filePath, [projectDir, downloadDir], assetRoot === void 0)) {
|
|
4033
4041
|
return { duration: null, resolvedPath: filePath };
|
|
4034
4042
|
}
|
|
4035
4043
|
filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
|
|
@@ -5429,7 +5437,7 @@ async function compileWithAssets(projectDir, htmlPath, downloadDir, options, ass
|
|
|
5429
5437
|
for (const video of videos) {
|
|
5430
5438
|
if (isHttpUrl(video.src)) continue;
|
|
5431
5439
|
const videoPath = resolve6(projectDir, video.src);
|
|
5432
|
-
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync7(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir, downloadDir]))
|
|
5440
|
+
if (advised.has(videoPath) || namesAnotherNetworkRoot2(projectDir, videoPath) || !existsSync7(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots3(videoPath, [projectDir, downloadDir], assetRoot === void 0))
|
|
5433
5441
|
continue;
|
|
5434
5442
|
advised.add(videoPath);
|
|
5435
5443
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
@@ -6205,7 +6213,7 @@ async function runCompileStage(input) {
|
|
|
6205
6213
|
// src/services/render/stages/probeStage.ts
|
|
6206
6214
|
import { createHash as createHash6 } from "node:crypto";
|
|
6207
6215
|
import { basename as basename4, join as join12 } from "node:path";
|
|
6208
|
-
import { parseHTML as parseHTML6 } from "linkedom";
|
|
6216
|
+
import { parseHTML as parseHTML6 } from "@hyperframes/parsers/linkedom";
|
|
6209
6217
|
import {
|
|
6210
6218
|
closeCaptureSession as closeCaptureSession4,
|
|
6211
6219
|
compositionRequiresWebGpu,
|
|
@@ -8237,10 +8245,15 @@ function runAudioStage(input) {
|
|
|
8237
8245
|
async function runAudioStageScoped(input) {
|
|
8238
8246
|
const stageStart = Date.now();
|
|
8239
8247
|
const pcmSourcePath = join16(input.workDir, "audio-source.wav");
|
|
8240
|
-
const
|
|
8248
|
+
const seconds = (frames) => frames * input.fps.den / input.fps.num;
|
|
8249
|
+
const duration = seconds(input.totalFrames);
|
|
8250
|
+
const window2 = input.frameWindow && {
|
|
8251
|
+
startSeconds: seconds(input.frameWindow.startFrame),
|
|
8252
|
+
durationSeconds: seconds(input.frameWindow.endFrame - input.frameWindow.startFrame)
|
|
8253
|
+
};
|
|
8241
8254
|
let deliverySourcePath;
|
|
8242
8255
|
try {
|
|
8243
|
-
const result = await mixAudioForDelivery(input, duration, pcmSourcePath);
|
|
8256
|
+
const result = await mixAudioForDelivery(input, duration, pcmSourcePath, window2);
|
|
8244
8257
|
let audioLoweredDb;
|
|
8245
8258
|
if (result.hasAudio) {
|
|
8246
8259
|
const guardStart = Date.now();
|
|
@@ -8248,7 +8261,7 @@ async function runAudioStageScoped(input) {
|
|
|
8248
8261
|
input,
|
|
8249
8262
|
result.audioOutputPath,
|
|
8250
8263
|
pcmSourcePath,
|
|
8251
|
-
duration
|
|
8264
|
+
window2?.durationSeconds ?? duration
|
|
8252
8265
|
);
|
|
8253
8266
|
audioLoweredDb = guard.loweredDb;
|
|
8254
8267
|
input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
|
|
@@ -8286,7 +8299,7 @@ async function guardDeliveryPeaks(input, audioPath, sourcePath, duration) {
|
|
|
8286
8299
|
if (!peak.success) throw encoderFailureError("Audio true-peak check failed", peak);
|
|
8287
8300
|
return { loweredDb: peak.loweredDb, sourceStale: peak.sourceStale };
|
|
8288
8301
|
}
|
|
8289
|
-
async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
8302
|
+
async function mixAudioForDelivery(input, duration, pcmSourcePath, window2) {
|
|
8290
8303
|
const {
|
|
8291
8304
|
projectDir,
|
|
8292
8305
|
workDir,
|
|
@@ -8323,6 +8336,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
8323
8336
|
urlByAbsentLocalPath,
|
|
8324
8337
|
audioSidecarUrlByLocalPath,
|
|
8325
8338
|
keepEncoderInputAt: pcmSourcePath,
|
|
8339
|
+
window: window2,
|
|
8326
8340
|
assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
|
|
8327
8341
|
},
|
|
8328
8342
|
compiledDir
|
|
@@ -8711,7 +8725,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
8711
8725
|
assertNotAborted();
|
|
8712
8726
|
const absoluteIdx = rangeStart + i;
|
|
8713
8727
|
const time = absoluteIdx * job.config.fps.den / job.config.fps.num;
|
|
8714
|
-
const { encodeResult } = await captureFrameToBufferPipelined2(session,
|
|
8728
|
+
const { encodeResult } = await captureFrameToBufferPipelined2(session, absoluteIdx, time);
|
|
8715
8729
|
await drainPrev();
|
|
8716
8730
|
prev = { fileIndex: i, encodeResult };
|
|
8717
8731
|
}
|
|
@@ -8721,7 +8735,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
8721
8735
|
assertNotAborted();
|
|
8722
8736
|
const absoluteIdx = rangeStart + i;
|
|
8723
8737
|
const time = absoluteIdx * job.config.fps.den / job.config.fps.num;
|
|
8724
|
-
await captureFrame(session,
|
|
8738
|
+
await captureFrame(session, absoluteIdx, time, i);
|
|
8725
8739
|
reportFrame(i);
|
|
8726
8740
|
}
|
|
8727
8741
|
}
|
|
@@ -14525,10 +14539,10 @@ function validateIntDimension(field, value) {
|
|
|
14525
14539
|
import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync10, readSync as readSync4, realpathSync as realpathSync2, statSync as statSync11 } from "node:fs";
|
|
14526
14540
|
import { createHash as createHash9 } from "node:crypto";
|
|
14527
14541
|
import { join as join35, sep as sep6 } from "node:path";
|
|
14528
|
-
import { isPrivateFileUnder as
|
|
14542
|
+
import { isPrivateFileUnder as isPrivateFileUnder4, isStudioPrivatePath as isStudioPrivatePath4 } from "@hyperframes/core/safe-path";
|
|
14529
14543
|
var SITE_ID_SCHEME = "site-v2\0";
|
|
14530
14544
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
14531
|
-
var isPrivateSitePath = (relPath) =>
|
|
14545
|
+
var isPrivateSitePath = (relPath) => isStudioPrivatePath4(relPath);
|
|
14532
14546
|
function statEntry(full, relPath) {
|
|
14533
14547
|
try {
|
|
14534
14548
|
return statSync11(full);
|
|
@@ -14542,7 +14556,7 @@ function listSiteFiles(projectDir, onPrivate, onOutside = () => {
|
|
|
14542
14556
|
const root = realpathSync2(projectDir);
|
|
14543
14557
|
const ancestors = /* @__PURE__ */ new Set([root]);
|
|
14544
14558
|
function visit(full, relPath) {
|
|
14545
|
-
if (
|
|
14559
|
+
if (isPrivateFileUnder4(projectDir, full, isStudioPrivatePath4)) return void onPrivate?.(relPath);
|
|
14546
14560
|
const stat = statEntry(full, relPath);
|
|
14547
14561
|
if (!stat.isFile() && !stat.isDirectory()) return;
|
|
14548
14562
|
if (onOutside !== "include" && outsideFolder(root, realpathSync2(full))) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "874346801fcf8668e76936bb5e768da21e3eee11045954a39fba983539dcb51b",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|