@hyperframes/producer 0.9.49 → 0.9.50
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 +26 -7
- package/dist/index.js +43 -13
- package/dist/public-server.js +43 -13
- package/dist/services/render/videoShownBoxes.d.ts +3 -3
- package/package.json +7 -7
package/dist/distributed.js
CHANGED
|
@@ -221,6 +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, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
224
225
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
225
226
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
226
227
|
|
|
@@ -876,6 +877,7 @@ function createFileServer(options) {
|
|
|
876
877
|
const candidate = join2(root, relativePath);
|
|
877
878
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
878
879
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
880
|
+
if (isPrivateFileUnder(root, candidate, isVcsOrSecretPath)) continue;
|
|
879
881
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
880
882
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
881
883
|
file = openRegularFile(candidate);
|
|
@@ -2299,7 +2301,7 @@ import {
|
|
|
2299
2301
|
readTextFile,
|
|
2300
2302
|
resolveCompositionSrc
|
|
2301
2303
|
} from "@hyperframes/parsers/asset-resolution";
|
|
2302
|
-
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
2304
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
|
|
2303
2305
|
|
|
2304
2306
|
// src/services/renderMediaCollector.ts
|
|
2305
2307
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -3135,14 +3137,18 @@ import { join as join8 } from "node:path";
|
|
|
3135
3137
|
import {
|
|
3136
3138
|
fingerprintElementId,
|
|
3137
3139
|
isNotMediaPayload,
|
|
3140
|
+
playlistLeavesItsFolder,
|
|
3138
3141
|
NotMediaPayloadError,
|
|
3139
3142
|
probeMediaProfile,
|
|
3140
3143
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc3
|
|
3141
3144
|
} from "@hyperframes/engine";
|
|
3142
3145
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
3143
3146
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
3147
|
+
// fallow-ignore-next-line unused-class-member
|
|
3144
3148
|
code = ASSET_MEDIA_TYPE_MISMATCH;
|
|
3149
|
+
// fallow-ignore-next-line unused-class-member
|
|
3145
3150
|
owner = "user";
|
|
3151
|
+
// fallow-ignore-next-line unused-class-member
|
|
3146
3152
|
retryable = false;
|
|
3147
3153
|
mismatches;
|
|
3148
3154
|
constructor(mismatches) {
|
|
@@ -3198,6 +3204,11 @@ function dropMediaOutsideProject(input) {
|
|
|
3198
3204
|
composition.audios = composition.audios.filter(staysInside);
|
|
3199
3205
|
composition.images = composition.images.filter(staysInside);
|
|
3200
3206
|
}
|
|
3207
|
+
async function notMediaReferences(path, references) {
|
|
3208
|
+
const videos = references.filter((ref) => ref.expected === "video");
|
|
3209
|
+
if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
|
|
3210
|
+
return await playlistLeavesItsFolder(path) ? references : [];
|
|
3211
|
+
}
|
|
3201
3212
|
async function preflightCompositionAssetMediaTypes(input) {
|
|
3202
3213
|
const references = [
|
|
3203
3214
|
...input.composition.videos.map((asset) => ({
|
|
@@ -3233,11 +3244,9 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
3233
3244
|
await Promise.all(
|
|
3234
3245
|
entries.map(
|
|
3235
3246
|
([resolvedPath, pathReferences]) => withMediaProbeSlot(async () => {
|
|
3236
|
-
const
|
|
3237
|
-
if (
|
|
3238
|
-
notMediaFingerprints.push(
|
|
3239
|
-
...sniffableReferences.map((ref) => fingerprintElementId(ref.id))
|
|
3240
|
-
);
|
|
3247
|
+
const refused = await notMediaReferences(resolvedPath, pathReferences);
|
|
3248
|
+
if (refused.length > 0) {
|
|
3249
|
+
notMediaFingerprints.push(...refused.map((ref) => fingerprintElementId(ref.id)));
|
|
3241
3250
|
return;
|
|
3242
3251
|
}
|
|
3243
3252
|
let profile;
|
|
@@ -3324,7 +3333,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
3324
3333
|
const file = resolveCompositionSrc(projectDir, src);
|
|
3325
3334
|
return file === null || escapesAssetRoot(file, assetRoot) ? null : file;
|
|
3326
3335
|
}
|
|
3327
|
-
var isPrivateCompositionFile = (projectDir, filePath) =>
|
|
3336
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
|
|
3328
3337
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
3329
3338
|
const { document: document2 } = parseHTML5(html);
|
|
3330
3339
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -6049,6 +6058,7 @@ import {
|
|
|
6049
6058
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
6050
6059
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
6051
6060
|
isHttpUrl as isHttpUrl2,
|
|
6061
|
+
assertPublicHttpsUrl,
|
|
6052
6062
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
|
|
6053
6063
|
runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
|
|
6054
6064
|
safeVideoExtractionSourceIdentity,
|
|
@@ -6460,6 +6470,14 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
6460
6470
|
existingAudioSrcs.add(video.src);
|
|
6461
6471
|
}
|
|
6462
6472
|
}
|
|
6473
|
+
function isPublicHttpsUrl(url) {
|
|
6474
|
+
try {
|
|
6475
|
+
assertPublicHttpsUrl(url);
|
|
6476
|
+
return true;
|
|
6477
|
+
} catch {
|
|
6478
|
+
return false;
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6463
6481
|
async function appendVideoAudioFromProbe(input) {
|
|
6464
6482
|
const { projectDir, compiledDir, composition, urlByAbsentLocalPath } = input;
|
|
6465
6483
|
const videos = composition.videos.filter(
|
|
@@ -6467,6 +6485,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6467
6485
|
);
|
|
6468
6486
|
const probed = await Promise.all(
|
|
6469
6487
|
videos.map(async (video) => {
|
|
6488
|
+
if (isHttpUrl2(video.src) && !isPublicHttpsUrl(video.src)) return null;
|
|
6470
6489
|
const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
|
|
6471
6490
|
const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
|
|
6472
6491
|
if (!isHttpUrl2(readFrom) && !existsSync9(readFrom)) return null;
|
package/dist/index.js
CHANGED
|
@@ -92,6 +92,7 @@ import { Readable } from "node:stream";
|
|
|
92
92
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
93
93
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
94
94
|
import { fpsToNumber } from "@hyperframes/core";
|
|
95
|
+
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
95
96
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
96
97
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
97
98
|
|
|
@@ -866,6 +867,7 @@ function createFileServer(options) {
|
|
|
866
867
|
const candidate = join2(root, relativePath);
|
|
867
868
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
868
869
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
870
|
+
if (isPrivateFileUnder(root, candidate, isVcsOrSecretPath)) continue;
|
|
869
871
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
870
872
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
871
873
|
file = openRegularFile(candidate);
|
|
@@ -5642,20 +5644,25 @@ async function oversizedVideos(videos, projectDir, compiledDir, canvas) {
|
|
|
5642
5644
|
);
|
|
5643
5645
|
return videos.filter((_, index) => sized[index]);
|
|
5644
5646
|
}
|
|
5645
|
-
function shownBoxTimes(videos, fps) {
|
|
5647
|
+
function shownBoxTimes(videos, fps, duration) {
|
|
5646
5648
|
const frame = fps.den / fps.num;
|
|
5647
5649
|
const times = /* @__PURE__ */ new Set();
|
|
5648
|
-
for (const { start, end } of videos) {
|
|
5650
|
+
for (const { start, end: authoredEnd } of videos) {
|
|
5651
|
+
const end = Math.min(authoredEnd, duration);
|
|
5652
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || start > end) continue;
|
|
5649
5653
|
const last = Math.max(start, end - frame);
|
|
5650
|
-
for (let
|
|
5654
|
+
for (let step = 0; start + step * SHOWN_BOX_STRIDE_S < last; step += 1) {
|
|
5655
|
+
times.add(start + step * SHOWN_BOX_STRIDE_S);
|
|
5656
|
+
}
|
|
5651
5657
|
times.add(last);
|
|
5652
5658
|
}
|
|
5653
5659
|
return [...times].sort((a, b) => a - b);
|
|
5654
5660
|
}
|
|
5655
|
-
async function measureLocalShownBoxes(page, videos, fps, log) {
|
|
5656
|
-
|
|
5661
|
+
async function measureLocalShownBoxes(page, videos, fps, duration, log) {
|
|
5662
|
+
let times = [];
|
|
5657
5663
|
const startedAt = Date.now();
|
|
5658
5664
|
try {
|
|
5665
|
+
times = shownBoxTimes(videos, fps, duration);
|
|
5659
5666
|
const ranges = await measureVideoShownBoxRanges(
|
|
5660
5667
|
page,
|
|
5661
5668
|
videos.map((video) => video.id),
|
|
@@ -6589,7 +6596,7 @@ import {
|
|
|
6589
6596
|
readTextFile,
|
|
6590
6597
|
resolveCompositionSrc
|
|
6591
6598
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6592
|
-
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
6599
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
|
|
6593
6600
|
|
|
6594
6601
|
// src/services/renderMediaCollector.ts
|
|
6595
6602
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7425,14 +7432,18 @@ import { join as join18 } from "node:path";
|
|
|
7425
7432
|
import {
|
|
7426
7433
|
fingerprintElementId,
|
|
7427
7434
|
isNotMediaPayload,
|
|
7435
|
+
playlistLeavesItsFolder,
|
|
7428
7436
|
NotMediaPayloadError,
|
|
7429
7437
|
probeMediaProfile,
|
|
7430
7438
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc3
|
|
7431
7439
|
} from "@hyperframes/engine";
|
|
7432
7440
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
7433
7441
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
7442
|
+
// fallow-ignore-next-line unused-class-member
|
|
7434
7443
|
code = ASSET_MEDIA_TYPE_MISMATCH;
|
|
7444
|
+
// fallow-ignore-next-line unused-class-member
|
|
7435
7445
|
owner = "user";
|
|
7446
|
+
// fallow-ignore-next-line unused-class-member
|
|
7436
7447
|
retryable = false;
|
|
7437
7448
|
mismatches;
|
|
7438
7449
|
constructor(mismatches) {
|
|
@@ -7488,6 +7499,11 @@ function dropMediaOutsideProject(input) {
|
|
|
7488
7499
|
composition.audios = composition.audios.filter(staysInside);
|
|
7489
7500
|
composition.images = composition.images.filter(staysInside);
|
|
7490
7501
|
}
|
|
7502
|
+
async function notMediaReferences(path, references) {
|
|
7503
|
+
const videos = references.filter((ref) => ref.expected === "video");
|
|
7504
|
+
if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
|
|
7505
|
+
return await playlistLeavesItsFolder(path) ? references : [];
|
|
7506
|
+
}
|
|
7491
7507
|
async function preflightCompositionAssetMediaTypes(input) {
|
|
7492
7508
|
const references = [
|
|
7493
7509
|
...input.composition.videos.map((asset) => ({
|
|
@@ -7523,11 +7539,9 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7523
7539
|
await Promise.all(
|
|
7524
7540
|
entries.map(
|
|
7525
7541
|
([resolvedPath, pathReferences]) => withMediaProbeSlot(async () => {
|
|
7526
|
-
const
|
|
7527
|
-
if (
|
|
7528
|
-
notMediaFingerprints.push(
|
|
7529
|
-
...sniffableReferences.map((ref) => fingerprintElementId(ref.id))
|
|
7530
|
-
);
|
|
7542
|
+
const refused = await notMediaReferences(resolvedPath, pathReferences);
|
|
7543
|
+
if (refused.length > 0) {
|
|
7544
|
+
notMediaFingerprints.push(...refused.map((ref) => fingerprintElementId(ref.id)));
|
|
7531
7545
|
return;
|
|
7532
7546
|
}
|
|
7533
7547
|
let profile;
|
|
@@ -7614,7 +7628,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
7614
7628
|
const file = resolveCompositionSrc(projectDir, src);
|
|
7615
7629
|
return file === null || escapesAssetRoot(file, assetRoot) ? null : file;
|
|
7616
7630
|
}
|
|
7617
|
-
var isPrivateCompositionFile = (projectDir, filePath) =>
|
|
7631
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
|
|
7618
7632
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
7619
7633
|
const { document: document2 } = parseHTML5(html);
|
|
7620
7634
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -10342,6 +10356,7 @@ import {
|
|
|
10342
10356
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10343
10357
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10344
10358
|
isHttpUrl as isHttpUrl2,
|
|
10359
|
+
assertPublicHttpsUrl,
|
|
10345
10360
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
|
|
10346
10361
|
runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
|
|
10347
10362
|
safeVideoExtractionSourceIdentity,
|
|
@@ -10753,6 +10768,14 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
10753
10768
|
existingAudioSrcs.add(video.src);
|
|
10754
10769
|
}
|
|
10755
10770
|
}
|
|
10771
|
+
function isPublicHttpsUrl(url) {
|
|
10772
|
+
try {
|
|
10773
|
+
assertPublicHttpsUrl(url);
|
|
10774
|
+
return true;
|
|
10775
|
+
} catch {
|
|
10776
|
+
return false;
|
|
10777
|
+
}
|
|
10778
|
+
}
|
|
10756
10779
|
async function appendVideoAudioFromProbe(input) {
|
|
10757
10780
|
const { projectDir, compiledDir, composition, urlByAbsentLocalPath } = input;
|
|
10758
10781
|
const videos = composition.videos.filter(
|
|
@@ -10760,6 +10783,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10760
10783
|
);
|
|
10761
10784
|
const probed = await Promise.all(
|
|
10762
10785
|
videos.map(async (video) => {
|
|
10786
|
+
if (isHttpUrl2(video.src) && !isPublicHttpsUrl(video.src)) return null;
|
|
10763
10787
|
const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
|
|
10764
10788
|
const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
|
|
10765
10789
|
if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
|
|
@@ -14761,7 +14785,6 @@ async function executeRenderPipeline(input) {
|
|
|
14761
14785
|
compositionHash = computeCompositionObservabilityHash(compiled.html);
|
|
14762
14786
|
fileServer = probeResult.fileServer;
|
|
14763
14787
|
probeSession = probeResult.probeSession;
|
|
14764
|
-
const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
|
|
14765
14788
|
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
14766
14789
|
lastBrowserConsole = probeResult.lastBrowserConsole;
|
|
14767
14790
|
let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
|
|
@@ -14777,6 +14800,13 @@ async function executeRenderPipeline(input) {
|
|
|
14777
14800
|
totalFrames,
|
|
14778
14801
|
fps: fpsToNumber8(job.config.fps)
|
|
14779
14802
|
});
|
|
14803
|
+
const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(
|
|
14804
|
+
probeSession.page,
|
|
14805
|
+
largerThanCanvas,
|
|
14806
|
+
job.config.fps,
|
|
14807
|
+
probeResult.duration,
|
|
14808
|
+
log
|
|
14809
|
+
) : void 0;
|
|
14780
14810
|
perfStages.browserProbeMs = probeResult.browserProbeMs;
|
|
14781
14811
|
perfStages.compileMs = Date.now() - stage1Start;
|
|
14782
14812
|
if (probeResult.beginFrameStalled && !captureForceScreenshot) {
|
package/dist/public-server.js
CHANGED
|
@@ -109,6 +109,7 @@ import { Readable } from "node:stream";
|
|
|
109
109
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
110
110
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
111
111
|
import { fpsToNumber } from "@hyperframes/core";
|
|
112
|
+
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
112
113
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
113
114
|
import { openRangeEnd } from "@hyperframes/studio-server/media-range";
|
|
114
115
|
|
|
@@ -883,6 +884,7 @@ function createFileServer(options) {
|
|
|
883
884
|
const candidate = join2(root, relativePath);
|
|
884
885
|
const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
|
|
885
886
|
if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
|
|
887
|
+
if (isPrivateFileUnder(root, candidate, isVcsOrSecretPath)) continue;
|
|
886
888
|
const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
|
|
887
889
|
if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
|
|
888
890
|
file = openRegularFile(candidate);
|
|
@@ -5655,20 +5657,25 @@ async function oversizedVideos(videos, projectDir, compiledDir, canvas) {
|
|
|
5655
5657
|
);
|
|
5656
5658
|
return videos.filter((_, index) => sized[index]);
|
|
5657
5659
|
}
|
|
5658
|
-
function shownBoxTimes(videos, fps) {
|
|
5660
|
+
function shownBoxTimes(videos, fps, duration) {
|
|
5659
5661
|
const frame = fps.den / fps.num;
|
|
5660
5662
|
const times = /* @__PURE__ */ new Set();
|
|
5661
|
-
for (const { start, end } of videos) {
|
|
5663
|
+
for (const { start, end: authoredEnd } of videos) {
|
|
5664
|
+
const end = Math.min(authoredEnd, duration);
|
|
5665
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || start > end) continue;
|
|
5662
5666
|
const last = Math.max(start, end - frame);
|
|
5663
|
-
for (let
|
|
5667
|
+
for (let step = 0; start + step * SHOWN_BOX_STRIDE_S < last; step += 1) {
|
|
5668
|
+
times.add(start + step * SHOWN_BOX_STRIDE_S);
|
|
5669
|
+
}
|
|
5664
5670
|
times.add(last);
|
|
5665
5671
|
}
|
|
5666
5672
|
return [...times].sort((a, b) => a - b);
|
|
5667
5673
|
}
|
|
5668
|
-
async function measureLocalShownBoxes(page, videos, fps, log) {
|
|
5669
|
-
|
|
5674
|
+
async function measureLocalShownBoxes(page, videos, fps, duration, log) {
|
|
5675
|
+
let times = [];
|
|
5670
5676
|
const startedAt = Date.now();
|
|
5671
5677
|
try {
|
|
5678
|
+
times = shownBoxTimes(videos, fps, duration);
|
|
5672
5679
|
const ranges = await measureVideoShownBoxRanges(
|
|
5673
5680
|
page,
|
|
5674
5681
|
videos.map((video) => video.id),
|
|
@@ -6602,7 +6609,7 @@ import {
|
|
|
6602
6609
|
readTextFile,
|
|
6603
6610
|
resolveCompositionSrc
|
|
6604
6611
|
} from "@hyperframes/parsers/asset-resolution";
|
|
6605
|
-
import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
|
|
6612
|
+
import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
|
|
6606
6613
|
|
|
6607
6614
|
// src/services/renderMediaCollector.ts
|
|
6608
6615
|
import { parseHTML as parseHTML2 } from "linkedom";
|
|
@@ -7438,14 +7445,18 @@ import { join as join18 } from "node:path";
|
|
|
7438
7445
|
import {
|
|
7439
7446
|
fingerprintElementId,
|
|
7440
7447
|
isNotMediaPayload,
|
|
7448
|
+
playlistLeavesItsFolder,
|
|
7441
7449
|
NotMediaPayloadError,
|
|
7442
7450
|
probeMediaProfile,
|
|
7443
7451
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc3
|
|
7444
7452
|
} from "@hyperframes/engine";
|
|
7445
7453
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
7446
7454
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
7455
|
+
// fallow-ignore-next-line unused-class-member
|
|
7447
7456
|
code = ASSET_MEDIA_TYPE_MISMATCH;
|
|
7457
|
+
// fallow-ignore-next-line unused-class-member
|
|
7448
7458
|
owner = "user";
|
|
7459
|
+
// fallow-ignore-next-line unused-class-member
|
|
7449
7460
|
retryable = false;
|
|
7450
7461
|
mismatches;
|
|
7451
7462
|
constructor(mismatches) {
|
|
@@ -7501,6 +7512,11 @@ function dropMediaOutsideProject(input) {
|
|
|
7501
7512
|
composition.audios = composition.audios.filter(staysInside);
|
|
7502
7513
|
composition.images = composition.images.filter(staysInside);
|
|
7503
7514
|
}
|
|
7515
|
+
async function notMediaReferences(path, references) {
|
|
7516
|
+
const videos = references.filter((ref) => ref.expected === "video");
|
|
7517
|
+
if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
|
|
7518
|
+
return await playlistLeavesItsFolder(path) ? references : [];
|
|
7519
|
+
}
|
|
7504
7520
|
async function preflightCompositionAssetMediaTypes(input) {
|
|
7505
7521
|
const references = [
|
|
7506
7522
|
...input.composition.videos.map((asset) => ({
|
|
@@ -7536,11 +7552,9 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7536
7552
|
await Promise.all(
|
|
7537
7553
|
entries.map(
|
|
7538
7554
|
([resolvedPath, pathReferences]) => withMediaProbeSlot(async () => {
|
|
7539
|
-
const
|
|
7540
|
-
if (
|
|
7541
|
-
notMediaFingerprints.push(
|
|
7542
|
-
...sniffableReferences.map((ref) => fingerprintElementId(ref.id))
|
|
7543
|
-
);
|
|
7555
|
+
const refused = await notMediaReferences(resolvedPath, pathReferences);
|
|
7556
|
+
if (refused.length > 0) {
|
|
7557
|
+
notMediaFingerprints.push(...refused.map((ref) => fingerprintElementId(ref.id)));
|
|
7544
7558
|
return;
|
|
7545
7559
|
}
|
|
7546
7560
|
let profile;
|
|
@@ -7627,7 +7641,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
|
|
|
7627
7641
|
const file = resolveCompositionSrc(projectDir, src);
|
|
7628
7642
|
return file === null || escapesAssetRoot(file, assetRoot) ? null : file;
|
|
7629
7643
|
}
|
|
7630
|
-
var isPrivateCompositionFile = (projectDir, filePath) =>
|
|
7644
|
+
var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
|
|
7631
7645
|
function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
|
|
7632
7646
|
const { document: document2 } = parseHTML5(html);
|
|
7633
7647
|
const hosts = [...document2.querySelectorAll("[data-composition-src]")];
|
|
@@ -10320,6 +10334,7 @@ import {
|
|
|
10320
10334
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10321
10335
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10322
10336
|
isHttpUrl as isHttpUrl2,
|
|
10337
|
+
assertPublicHttpsUrl,
|
|
10323
10338
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
|
|
10324
10339
|
runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
|
|
10325
10340
|
safeVideoExtractionSourceIdentity,
|
|
@@ -10726,6 +10741,14 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
10726
10741
|
existingAudioSrcs.add(video.src);
|
|
10727
10742
|
}
|
|
10728
10743
|
}
|
|
10744
|
+
function isPublicHttpsUrl(url) {
|
|
10745
|
+
try {
|
|
10746
|
+
assertPublicHttpsUrl(url);
|
|
10747
|
+
return true;
|
|
10748
|
+
} catch {
|
|
10749
|
+
return false;
|
|
10750
|
+
}
|
|
10751
|
+
}
|
|
10729
10752
|
async function appendVideoAudioFromProbe(input) {
|
|
10730
10753
|
const { projectDir, compiledDir, composition, urlByAbsentLocalPath } = input;
|
|
10731
10754
|
const videos = composition.videos.filter(
|
|
@@ -10733,6 +10756,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10733
10756
|
);
|
|
10734
10757
|
const probed = await Promise.all(
|
|
10735
10758
|
videos.map(async (video) => {
|
|
10759
|
+
if (isHttpUrl2(video.src) && !isPublicHttpsUrl(video.src)) return null;
|
|
10736
10760
|
const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
|
|
10737
10761
|
const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
|
|
10738
10762
|
if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
|
|
@@ -14734,7 +14758,6 @@ async function executeRenderPipeline(input) {
|
|
|
14734
14758
|
compositionHash = computeCompositionObservabilityHash(compiled.html);
|
|
14735
14759
|
fileServer = probeResult.fileServer;
|
|
14736
14760
|
probeSession = probeResult.probeSession;
|
|
14737
|
-
const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
|
|
14738
14761
|
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
14739
14762
|
lastBrowserConsole = probeResult.lastBrowserConsole;
|
|
14740
14763
|
let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
|
|
@@ -14750,6 +14773,13 @@ async function executeRenderPipeline(input) {
|
|
|
14750
14773
|
totalFrames,
|
|
14751
14774
|
fps: fpsToNumber8(job.config.fps)
|
|
14752
14775
|
});
|
|
14776
|
+
const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(
|
|
14777
|
+
probeSession.page,
|
|
14778
|
+
largerThanCanvas,
|
|
14779
|
+
job.config.fps,
|
|
14780
|
+
probeResult.duration,
|
|
14781
|
+
log
|
|
14782
|
+
) : void 0;
|
|
14753
14783
|
perfStages.browserProbeMs = probeResult.browserProbeMs;
|
|
14754
14784
|
perfStages.compileMs = Date.now() - stage1Start;
|
|
14755
14785
|
if (probeResult.beginFrameStalled && !captureForceScreenshot) {
|
|
@@ -6,11 +6,11 @@ export declare function oversizedVideos(videos: readonly VideoElement[], project
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
}): Promise<VideoElement[]>;
|
|
9
|
-
/** Each video's first and last frame and every stride between, in
|
|
9
|
+
/** Each video's first and last frame before `duration` and every stride between, in seconds, ascending. */
|
|
10
10
|
export declare function shownBoxTimes(videos: readonly VideoElement[], fps: {
|
|
11
11
|
num: number;
|
|
12
12
|
den: number;
|
|
13
|
-
}): number[];
|
|
13
|
+
}, duration: number): number[];
|
|
14
14
|
/**
|
|
15
15
|
* The box to extract each video at: the largest it is drawn at, plus headroom when it moves. Undefined when
|
|
16
16
|
* the measure fails, and every video then keeps its full size.
|
|
@@ -18,4 +18,4 @@ export declare function shownBoxTimes(videos: readonly VideoElement[], fps: {
|
|
|
18
18
|
export declare function measureLocalShownBoxes(page: Page, videos: readonly VideoElement[], fps: {
|
|
19
19
|
num: number;
|
|
20
20
|
den: number;
|
|
21
|
-
}, log: ProducerLogger): Promise<Map<string, ShownBox> | undefined>;
|
|
21
|
+
}, duration: number, log: ProducerLogger): Promise<Map<string, ShownBox> | undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.50",
|
|
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/
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/lint": "0.9.
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/parsers": "0.9.50",
|
|
39
|
+
"@hyperframes/studio-server": "0.9.50",
|
|
40
|
+
"@hyperframes/lint": "0.9.50",
|
|
41
|
+
"@hyperframes/core": "0.9.50",
|
|
42
|
+
"@hyperframes/engine": "0.9.50"
|
|
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.50"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|