@hyperframes/producer 0.9.49 → 0.9.51

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.
@@ -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 sniffableReferences = pathReferences.filter((ref) => ref.expected === "video");
3237
- if (sniffableReferences.length > 0 && await isNotMediaPayload(resolvedPath)) {
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) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
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.d.ts CHANGED
@@ -18,6 +18,7 @@ export { createFileServer, type FileServerOptions, type FileServerHandle, } from
18
18
  export { prepareAnimatedGifInputs } from "./services/animatedGifPrep.js";
19
19
  export { prepareHeifImageInputs } from "./services/heifImagePrep.js";
20
20
  export { createVideoFrameInjector } from "@hyperframes/engine";
21
+ export { isBlockedNetworkHost } from "@hyperframes/engine";
21
22
  export { resolveConfig, DEFAULT_CONFIG, type ProducerConfig } from "./config.js";
22
23
  export { type ProducerLogger, type LogLevel, createConsoleLogger, defaultLogger, } from "./logger.js";
23
24
  export { createRenderHandlers, createProducerApp, startServer, type HandlerOptions, type ServerOptions, type RenderHandlers, } from "./server.js";
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,26 @@ 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 t = start; t < last; t += SHOWN_BOX_STRIDE_S) times.add(t);
5654
+ times.add(start);
5655
+ for (let step = Math.floor(start / SHOWN_BOX_STRIDE_S) + 1; step * SHOWN_BOX_STRIDE_S < last; step += 1) {
5656
+ times.add(step * SHOWN_BOX_STRIDE_S);
5657
+ }
5651
5658
  times.add(last);
5652
5659
  }
5653
5660
  return [...times].sort((a, b) => a - b);
5654
5661
  }
5655
- async function measureLocalShownBoxes(page, videos, fps, log) {
5656
- const times = shownBoxTimes(videos, fps);
5662
+ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
5663
+ let times = [];
5657
5664
  const startedAt = Date.now();
5658
5665
  try {
5666
+ times = shownBoxTimes(videos, fps, duration);
5659
5667
  const ranges = await measureVideoShownBoxRanges(
5660
5668
  page,
5661
5669
  videos.map((video) => video.id),
@@ -6589,7 +6597,7 @@ import {
6589
6597
  readTextFile,
6590
6598
  resolveCompositionSrc
6591
6599
  } from "@hyperframes/parsers/asset-resolution";
6592
- import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
6600
+ import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
6593
6601
 
6594
6602
  // src/services/renderMediaCollector.ts
6595
6603
  import { parseHTML as parseHTML2 } from "linkedom";
@@ -7425,14 +7433,18 @@ import { join as join18 } from "node:path";
7425
7433
  import {
7426
7434
  fingerprintElementId,
7427
7435
  isNotMediaPayload,
7436
+ playlistLeavesItsFolder,
7428
7437
  NotMediaPayloadError,
7429
7438
  probeMediaProfile,
7430
7439
  resolveProjectRelativeSrc as resolveProjectRelativeSrc3
7431
7440
  } from "@hyperframes/engine";
7432
7441
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
7433
7442
  var AssetMediaTypeMismatchError = class extends Error {
7443
+ // fallow-ignore-next-line unused-class-member
7434
7444
  code = ASSET_MEDIA_TYPE_MISMATCH;
7445
+ // fallow-ignore-next-line unused-class-member
7435
7446
  owner = "user";
7447
+ // fallow-ignore-next-line unused-class-member
7436
7448
  retryable = false;
7437
7449
  mismatches;
7438
7450
  constructor(mismatches) {
@@ -7488,6 +7500,11 @@ function dropMediaOutsideProject(input) {
7488
7500
  composition.audios = composition.audios.filter(staysInside);
7489
7501
  composition.images = composition.images.filter(staysInside);
7490
7502
  }
7503
+ async function notMediaReferences(path, references) {
7504
+ const videos = references.filter((ref) => ref.expected === "video");
7505
+ if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
7506
+ return await playlistLeavesItsFolder(path) ? references : [];
7507
+ }
7491
7508
  async function preflightCompositionAssetMediaTypes(input) {
7492
7509
  const references = [
7493
7510
  ...input.composition.videos.map((asset) => ({
@@ -7523,11 +7540,9 @@ async function preflightCompositionAssetMediaTypes(input) {
7523
7540
  await Promise.all(
7524
7541
  entries.map(
7525
7542
  ([resolvedPath, pathReferences]) => withMediaProbeSlot(async () => {
7526
- const sniffableReferences = pathReferences.filter((ref) => ref.expected === "video");
7527
- if (sniffableReferences.length > 0 && await isNotMediaPayload(resolvedPath)) {
7528
- notMediaFingerprints.push(
7529
- ...sniffableReferences.map((ref) => fingerprintElementId(ref.id))
7530
- );
7543
+ const refused = await notMediaReferences(resolvedPath, pathReferences);
7544
+ if (refused.length > 0) {
7545
+ notMediaFingerprints.push(...refused.map((ref) => fingerprintElementId(ref.id)));
7531
7546
  return;
7532
7547
  }
7533
7548
  let profile;
@@ -7614,7 +7629,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
7614
7629
  const file = resolveCompositionSrc(projectDir, src);
7615
7630
  return file === null || escapesAssetRoot(file, assetRoot) ? null : file;
7616
7631
  }
7617
- var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
7632
+ var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
7618
7633
  function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
7619
7634
  const { document: document2 } = parseHTML5(html);
7620
7635
  const hosts = [...document2.querySelectorAll("[data-composition-src]")];
@@ -10342,6 +10357,7 @@ import {
10342
10357
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10343
10358
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10344
10359
  isHttpUrl as isHttpUrl2,
10360
+ assertPublicHttpsUrl,
10345
10361
  resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10346
10362
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
10347
10363
  safeVideoExtractionSourceIdentity,
@@ -10753,6 +10769,14 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
10753
10769
  existingAudioSrcs.add(video.src);
10754
10770
  }
10755
10771
  }
10772
+ function isPublicHttpsUrl(url) {
10773
+ try {
10774
+ assertPublicHttpsUrl(url);
10775
+ return true;
10776
+ } catch {
10777
+ return false;
10778
+ }
10779
+ }
10756
10780
  async function appendVideoAudioFromProbe(input) {
10757
10781
  const { projectDir, compiledDir, composition, urlByAbsentLocalPath } = input;
10758
10782
  const videos = composition.videos.filter(
@@ -10760,6 +10784,7 @@ async function appendVideoAudioFromProbe(input) {
10760
10784
  );
10761
10785
  const probed = await Promise.all(
10762
10786
  videos.map(async (video) => {
10787
+ if (isHttpUrl2(video.src) && !isPublicHttpsUrl(video.src)) return null;
10763
10788
  const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
10764
10789
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
10765
10790
  if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
@@ -14761,7 +14786,6 @@ async function executeRenderPipeline(input) {
14761
14786
  compositionHash = computeCompositionObservabilityHash(compiled.html);
14762
14787
  fileServer = probeResult.fileServer;
14763
14788
  probeSession = probeResult.probeSession;
14764
- const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
14765
14789
  job.strictVariablesChecked = probeResult.strictVariablesChecked;
14766
14790
  lastBrowserConsole = probeResult.lastBrowserConsole;
14767
14791
  let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
@@ -14777,6 +14801,13 @@ async function executeRenderPipeline(input) {
14777
14801
  totalFrames,
14778
14802
  fps: fpsToNumber8(job.config.fps)
14779
14803
  });
14804
+ const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(
14805
+ probeSession.page,
14806
+ largerThanCanvas,
14807
+ job.config.fps,
14808
+ probeResult.duration,
14809
+ log
14810
+ ) : void 0;
14780
14811
  perfStages.browserProbeMs = probeResult.browserProbeMs;
14781
14812
  perfStages.compileMs = Date.now() - stage1Start;
14782
14813
  if (probeResult.beginFrameStalled && !captureForceScreenshot) {
@@ -21556,6 +21587,7 @@ import {
21556
21587
 
21557
21588
  // src/index.ts
21558
21589
  import { createVideoFrameInjector as createVideoFrameInjector4 } from "@hyperframes/engine";
21590
+ import { isBlockedNetworkHost } from "@hyperframes/engine";
21559
21591
 
21560
21592
  // src/config.ts
21561
21593
  import {
@@ -22965,6 +22997,7 @@ export {
22965
22997
  getPlanV2ExecutionPlanHash,
22966
22998
  initializeSession11 as initializeSession,
22967
22999
  injectDeterministicFontFaces2 as injectDeterministicFontFaces,
23000
+ isBlockedNetworkHost,
22968
23001
  isTransientBrowserError3 as isTransientBrowserError,
22969
23002
  listAbandonedRenderDirs,
22970
23003
  listPlanV2ArtifactsForTarget,
@@ -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,26 @@ 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 t = start; t < last; t += SHOWN_BOX_STRIDE_S) times.add(t);
5667
+ times.add(start);
5668
+ for (let step = Math.floor(start / SHOWN_BOX_STRIDE_S) + 1; step * SHOWN_BOX_STRIDE_S < last; step += 1) {
5669
+ times.add(step * SHOWN_BOX_STRIDE_S);
5670
+ }
5664
5671
  times.add(last);
5665
5672
  }
5666
5673
  return [...times].sort((a, b) => a - b);
5667
5674
  }
5668
- async function measureLocalShownBoxes(page, videos, fps, log) {
5669
- const times = shownBoxTimes(videos, fps);
5675
+ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
5676
+ let times = [];
5670
5677
  const startedAt = Date.now();
5671
5678
  try {
5679
+ times = shownBoxTimes(videos, fps, duration);
5672
5680
  const ranges = await measureVideoShownBoxRanges(
5673
5681
  page,
5674
5682
  videos.map((video) => video.id),
@@ -6602,7 +6610,7 @@ import {
6602
6610
  readTextFile,
6603
6611
  resolveCompositionSrc
6604
6612
  } from "@hyperframes/parsers/asset-resolution";
6605
- import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
6613
+ import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
6606
6614
 
6607
6615
  // src/services/renderMediaCollector.ts
6608
6616
  import { parseHTML as parseHTML2 } from "linkedom";
@@ -7438,14 +7446,18 @@ import { join as join18 } from "node:path";
7438
7446
  import {
7439
7447
  fingerprintElementId,
7440
7448
  isNotMediaPayload,
7449
+ playlistLeavesItsFolder,
7441
7450
  NotMediaPayloadError,
7442
7451
  probeMediaProfile,
7443
7452
  resolveProjectRelativeSrc as resolveProjectRelativeSrc3
7444
7453
  } from "@hyperframes/engine";
7445
7454
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
7446
7455
  var AssetMediaTypeMismatchError = class extends Error {
7456
+ // fallow-ignore-next-line unused-class-member
7447
7457
  code = ASSET_MEDIA_TYPE_MISMATCH;
7458
+ // fallow-ignore-next-line unused-class-member
7448
7459
  owner = "user";
7460
+ // fallow-ignore-next-line unused-class-member
7449
7461
  retryable = false;
7450
7462
  mismatches;
7451
7463
  constructor(mismatches) {
@@ -7501,6 +7513,11 @@ function dropMediaOutsideProject(input) {
7501
7513
  composition.audios = composition.audios.filter(staysInside);
7502
7514
  composition.images = composition.images.filter(staysInside);
7503
7515
  }
7516
+ async function notMediaReferences(path, references) {
7517
+ const videos = references.filter((ref) => ref.expected === "video");
7518
+ if (videos.length > 0 && await isNotMediaPayload(path)) return videos;
7519
+ return await playlistLeavesItsFolder(path) ? references : [];
7520
+ }
7504
7521
  async function preflightCompositionAssetMediaTypes(input) {
7505
7522
  const references = [
7506
7523
  ...input.composition.videos.map((asset) => ({
@@ -7536,11 +7553,9 @@ async function preflightCompositionAssetMediaTypes(input) {
7536
7553
  await Promise.all(
7537
7554
  entries.map(
7538
7555
  ([resolvedPath, pathReferences]) => withMediaProbeSlot(async () => {
7539
- const sniffableReferences = pathReferences.filter((ref) => ref.expected === "video");
7540
- if (sniffableReferences.length > 0 && await isNotMediaPayload(resolvedPath)) {
7541
- notMediaFingerprints.push(
7542
- ...sniffableReferences.map((ref) => fingerprintElementId(ref.id))
7543
- );
7556
+ const refused = await notMediaReferences(resolvedPath, pathReferences);
7557
+ if (refused.length > 0) {
7558
+ notMediaFingerprints.push(...refused.map((ref) => fingerprintElementId(ref.id)));
7544
7559
  return;
7545
7560
  }
7546
7561
  let profile;
@@ -7627,7 +7642,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
7627
7642
  const file = resolveCompositionSrc(projectDir, src);
7628
7643
  return file === null || escapesAssetRoot(file, assetRoot) ? null : file;
7629
7644
  }
7630
- var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
7645
+ var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
7631
7646
  function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
7632
7647
  const { document: document2 } = parseHTML5(html);
7633
7648
  const hosts = [...document2.querySelectorAll("[data-composition-src]")];
@@ -10320,6 +10335,7 @@ import {
10320
10335
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10321
10336
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10322
10337
  isHttpUrl as isHttpUrl2,
10338
+ assertPublicHttpsUrl,
10323
10339
  resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10324
10340
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
10325
10341
  safeVideoExtractionSourceIdentity,
@@ -10726,6 +10742,14 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
10726
10742
  existingAudioSrcs.add(video.src);
10727
10743
  }
10728
10744
  }
10745
+ function isPublicHttpsUrl(url) {
10746
+ try {
10747
+ assertPublicHttpsUrl(url);
10748
+ return true;
10749
+ } catch {
10750
+ return false;
10751
+ }
10752
+ }
10729
10753
  async function appendVideoAudioFromProbe(input) {
10730
10754
  const { projectDir, compiledDir, composition, urlByAbsentLocalPath } = input;
10731
10755
  const videos = composition.videos.filter(
@@ -10733,6 +10757,7 @@ async function appendVideoAudioFromProbe(input) {
10733
10757
  );
10734
10758
  const probed = await Promise.all(
10735
10759
  videos.map(async (video) => {
10760
+ if (isHttpUrl2(video.src) && !isPublicHttpsUrl(video.src)) return null;
10736
10761
  const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
10737
10762
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
10738
10763
  if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
@@ -14734,7 +14759,6 @@ async function executeRenderPipeline(input) {
14734
14759
  compositionHash = computeCompositionObservabilityHash(compiled.html);
14735
14760
  fileServer = probeResult.fileServer;
14736
14761
  probeSession = probeResult.probeSession;
14737
- const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
14738
14762
  job.strictVariablesChecked = probeResult.strictVariablesChecked;
14739
14763
  lastBrowserConsole = probeResult.lastBrowserConsole;
14740
14764
  let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
@@ -14750,6 +14774,13 @@ async function executeRenderPipeline(input) {
14750
14774
  totalFrames,
14751
14775
  fps: fpsToNumber8(job.config.fps)
14752
14776
  });
14777
+ const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(
14778
+ probeSession.page,
14779
+ largerThanCanvas,
14780
+ job.config.fps,
14781
+ probeResult.duration,
14782
+ log
14783
+ ) : void 0;
14753
14784
  perfStages.browserProbeMs = probeResult.browserProbeMs;
14754
14785
  perfStages.compileMs = Date.now() - stage1Start;
14755
14786
  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 composition seconds, ascending. */
9
+ /** Each video's first and last frame before `duration`, and the one stride grid all videos share between. */
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.49",
3
+ "version": "0.9.51",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.13.0",
37
37
  "puppeteer-core": "^25.13.0",
38
- "@hyperframes/core": "0.9.49",
39
- "@hyperframes/engine": "0.9.49",
40
- "@hyperframes/lint": "0.9.49",
41
- "@hyperframes/parsers": "0.9.49",
42
- "@hyperframes/studio-server": "0.9.49"
38
+ "@hyperframes/core": "0.9.51",
39
+ "@hyperframes/lint": "0.9.51",
40
+ "@hyperframes/parsers": "0.9.51",
41
+ "@hyperframes/engine": "0.9.51",
42
+ "@hyperframes/studio-server": "0.9.51"
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.49"
51
+ "@hyperframes/aws-lambda": "0.9.51"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"