@hyperframes/producer 0.9.80 → 0.9.82

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.
@@ -359,7 +359,7 @@ function firstCompositionIdTag(html) {
359
359
  // src/services/renderOrchestrator.ts
360
360
  import { matchHtmlBodyCssHeightFirst, matchHtmlBodyCssWidthFirst } from "@hyperframes/parsers";
361
361
  import {
362
- extractMediaMetadata as extractMediaMetadata5,
362
+ extractMediaMetadata as extractMediaMetadata6,
363
363
  resolveConfig as resolveConfig2,
364
364
  closeCaptureSession as closeCaptureSession8,
365
365
  createCaptureSession as createCaptureSession8,
@@ -382,7 +382,7 @@ import {
382
382
  scaleProtocolTimeoutForComposition,
383
383
  classifyCaptureFailure as classifyCaptureFailure3,
384
384
  cloneCaptureWarning,
385
- isMemoryExhaustionError,
385
+ isMemoryExhaustionError as isMemoryExhaustionError2,
386
386
  isTransientBrowserError as isTransientBrowserError2,
387
387
  isDrawElementVerificationError,
388
388
  isDrawElementCaptureError,
@@ -2129,9 +2129,9 @@ import { createStagingDir } from "@hyperframes/core/atomic-file";
2129
2129
  var OWNER_FILE = "owner.json";
2130
2130
  var TRANSACTION_BACKUP = "backup";
2131
2131
  function pidScope() {
2132
- const attempt = (read) => {
2132
+ const attempt = (read2) => {
2133
2133
  try {
2134
- return read();
2134
+ return read2();
2135
2135
  } catch {
2136
2136
  return void 0;
2137
2137
  }
@@ -7139,13 +7139,21 @@ import { parseHTML as parseHTML5 } from "linkedom";
7139
7139
  // src/services/bundledScripts.ts
7140
7140
  import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
7141
7141
  import { join as join17 } from "node:path";
7142
- import { gsapCdnDist } from "@hyperframes/core/gsap-cdn";
7142
+ import { GSAP_CDN_VERSION } from "@hyperframes/core/gsap-cdn";
7143
7143
  var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
7144
+ var DEFAULT_CDN_GSAP_3 = /^https:\/\/cdn\.jsdelivr\.net\/npm\/gsap@(3\.\d+\.\d+)\/dist\/([A-Za-z]+\.min\.js)$/;
7145
+ var read = (file) => existsSync8(file) ? readFileSync5(file) : null;
7144
7146
  function bundledScript(url) {
7145
7147
  const dir = process.env[GSAP_VENDOR_DIR_ENV];
7146
- if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
7147
- const file = join17(dir, "gsap.min.js");
7148
- return existsSync8(file) ? readFileSync5(file) : null;
7148
+ const [, version, file] = DEFAULT_CDN_GSAP_3.exec(url) ?? [];
7149
+ if (!dir || !version || !file) return null;
7150
+ const at = version === GSAP_CDN_VERSION ? dir : join17(dir, "..", "..", `gsap@${version}`, "dist");
7151
+ return read(join17(at, file));
7152
+ }
7153
+ function bundledGsapStandIn(url) {
7154
+ const dir = process.env[GSAP_VENDOR_DIR_ENV];
7155
+ const [, , file] = DEFAULT_CDN_GSAP_3.exec(url) ?? [];
7156
+ return dir && file ? read(join17(dir, file)) : null;
7149
7157
  }
7150
7158
 
7151
7159
  // src/services/htmlCompiler.ts
@@ -7171,7 +7179,7 @@ import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
7171
7179
  import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
7172
7180
  import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
7173
7181
  import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
7174
- import { gsapCdnDist as gsapCdnDist2, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
7182
+ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
7175
7183
  import {
7176
7184
  assignBundledRuntimeCompositionIds,
7177
7185
  assignMediaRenderIds,
@@ -8317,13 +8325,13 @@ function compositionPathProblem(projectDir, filePath, assetRoot, outsideFiles) {
8317
8325
  }
8318
8326
  function readSubCompositionFile(filePath, srcPath) {
8319
8327
  assertCompositionFileSize(filePath, srcPath);
8320
- const read = readProjectFile(filePath);
8321
- if (read.kind === "missing") return { detail: "the file does not exist" };
8322
- if (read.kind === "folder") return { detail: "it is a folder, not an HTML file" };
8323
- const validity = checkSubCompositionUsability(read.text, parseSubCompHtmlForValidity);
8328
+ const read2 = readProjectFile(filePath);
8329
+ if (read2.kind === "missing") return { detail: "the file does not exist" };
8330
+ if (read2.kind === "folder") return { detail: "it is a folder, not an HTML file" };
8331
+ const validity = checkSubCompositionUsability(read2.text, parseSubCompHtmlForValidity);
8324
8332
  if (!validity.ok)
8325
8333
  return { detail: validity.detail ?? "the file is empty or could not be parsed" };
8326
- return { bytes: Buffer.byteLength(read.text), ...compositionSrcsIn(read.text) };
8334
+ return { bytes: Buffer.byteLength(read2.text), ...compositionSrcsIn(read2.text) };
8327
8335
  }
8328
8336
  function assertSubCompositionsUsable(html, projectDir, assetRoot, outsideFiles) {
8329
8337
  const budget = new CompositionExpansionBudget();
@@ -8698,11 +8706,11 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
8698
8706
  compiledSrcs.add(srcPath);
8699
8707
  assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
8700
8708
  assertCompositionFileSize(filePath, srcPath);
8701
- const read = readProjectFile(filePath);
8702
- if (read.kind !== "file") {
8709
+ const read2 = readProjectFile(filePath);
8710
+ if (read2.kind !== "file") {
8703
8711
  continue;
8704
8712
  }
8705
- const rawSubHtml = normalizeCompositionSrcs(read.text, projectDir);
8713
+ const rawSubHtml = normalizeCompositionSrcs(read2.text, projectDir);
8706
8714
  const nestedVisited = new Set(visited);
8707
8715
  nestedVisited.add(filePath);
8708
8716
  workItems.push({ srcPath, filePath, rawSubHtml, nestedVisited });
@@ -8904,9 +8912,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
8904
8912
  assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
8905
8913
  assertCompositionFileSize(filePath, srcPath);
8906
8914
  }
8907
- const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
8908
- return read?.kind === "file" ? rewriteUnresolvableGsapToCdn(
8909
- normalizeCompositionSrcs(read.text, projectDir),
8915
+ const read2 = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
8916
+ return read2?.kind === "file" ? rewriteUnresolvableGsapToCdn(
8917
+ normalizeCompositionSrcs(read2.text, projectDir),
8910
8918
  projectDir,
8911
8919
  srcPath
8912
8920
  ) : null;
@@ -9133,6 +9141,9 @@ async function inlineExternalScripts(html, budget = new CompositionExpansionBudg
9133
9141
  });
9134
9142
  const remote = new Set(externalScripts.filter((_, i) => !local[i]).map(({ src }) => src));
9135
9143
  assertRemoteFetchCount("scripts", remote.size);
9144
+ const pinned = new Set(
9145
+ externalScripts.filter(({ el }) => el.getAttribute("integrity")).map(({ src }) => src)
9146
+ );
9136
9147
  const mirror = operatorGsapMirror();
9137
9148
  const limit = createConcurrencyLimit(MAX_CONCURRENT_SCRIPT_FETCHES);
9138
9149
  const stop = new AbortController();
@@ -9155,7 +9166,16 @@ async function inlineExternalScripts(html, budget = new CompositionExpansionBudg
9155
9166
  if (!bytes) {
9156
9167
  bytes = limit(async () => {
9157
9168
  fetchSignal.throwIfAborted();
9158
- const downloaded = await downloadScript(src, mirror, fetchSignal);
9169
+ const downloaded = await downloadScript(src, mirror, fetchSignal).catch(
9170
+ (error) => {
9171
+ const standIn = pinned.has(src) || fetchSignal.aborted ? null : bundledGsapStandIn(src);
9172
+ if (!standIn) throw error;
9173
+ defaultLogger.warn(
9174
+ `[Compiler] Could not download ${src} (${error}); using the host's own GSAP instead.`
9175
+ );
9176
+ return standIn;
9177
+ }
9178
+ );
9159
9179
  charge(downloaded.byteLength);
9160
9180
  return downloaded;
9161
9181
  }, fetchSignal);
@@ -9639,7 +9659,7 @@ async function embedLocalFontFaces(html, projectDir, assetRoot, budget, log = de
9639
9659
  }
9640
9660
  function renderGsapDist() {
9641
9661
  try {
9642
- return gsapCdnDist2(void 0, normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL));
9662
+ return gsapCdnDist(void 0, normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL));
9643
9663
  } catch (cause) {
9644
9664
  throw new Error(
9645
9665
  "Invalid HYPERFRAMES_GSAP_BASE_URL: use an absolute HTTPS npm mirror root (plain HTTP only for localhost) without credentials, query, or fragment",
@@ -10527,11 +10547,14 @@ import {
10527
10547
  compositionRequiresWebGpu,
10528
10548
  createCaptureSession as createCaptureSession4,
10529
10549
  deriveBeginFrameProbeTimeTicks,
10550
+ extractMediaMetadata as extractMediaMetadata4,
10530
10551
  getCompositionDuration,
10531
10552
  getCompositionLengthSource,
10532
10553
  initializeSession as initializeSession4,
10554
+ isMemoryExhaustionError,
10533
10555
  isTransientBrowserError,
10534
10556
  probeBeginFrameLiveness,
10557
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10535
10558
  videoAudioId
10536
10559
  } from "@hyperframes/engine";
10537
10560
  import {
@@ -10636,6 +10659,33 @@ function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
10636
10659
  );
10637
10660
  });
10638
10661
  }
10662
+ async function probeVideoHold(videos, html, projectDir, compiledDir) {
10663
+ const { document: document2 } = parseHTML6(html);
10664
+ const bound = /* @__PURE__ */ new Set();
10665
+ for (const video of document2.querySelectorAll("video")) {
10666
+ if (!video.matches("[data-var-src]") && !video.querySelector("source[data-var-src]")) continue;
10667
+ const id = video.getAttribute(MEDIA_RENDER_ID_ATTR2) || video.getAttribute("id");
10668
+ if (id) bound.add(id);
10669
+ }
10670
+ const hints = await Promise.all(
10671
+ videos.map(async ({ id, src }) => {
10672
+ if (bound.has(id) || /^https?:\/\//i.test(src)) return null;
10673
+ try {
10674
+ const path = resolveProjectRelativeSrc4(src, projectDir, compiledDir);
10675
+ const { width, height } = await extractMediaMetadata4(path);
10676
+ return width > 0 && height > 0 ? { id, width, height } : null;
10677
+ } catch {
10678
+ return null;
10679
+ }
10680
+ })
10681
+ );
10682
+ const held = hints.filter((hint) => hint !== null);
10683
+ return { skipReadinessVideoIds: held.map((hint) => hint.id), videoMetadataHints: held };
10684
+ }
10685
+ function probeHoldFitsCapture(probeHeld, captureHeld) {
10686
+ const held = new Set(captureHeld);
10687
+ return (probeHeld ?? []).every((id) => held.has(id));
10688
+ }
10639
10689
  function authoredMediaStarts(html) {
10640
10690
  const { document: document2 } = parseHTML6(html);
10641
10691
  const starts = /* @__PURE__ */ new Map();
@@ -10772,6 +10822,16 @@ function reportedLengthSource(source) {
10772
10822
  const srcHash = createHash7("sha256").update(name).digest("hex").slice(0, 12);
10773
10823
  return { from: "media", tag: source.tag, trimmed: source.trimmed, srcHash };
10774
10824
  }
10825
+ var STOPPED = "Preparing the render stopped while ";
10826
+ async function probeStep(step, call) {
10827
+ try {
10828
+ return await call();
10829
+ } catch (error) {
10830
+ if (error instanceof Error && !error.message.startsWith(STOPPED) && !isMemoryExhaustionError(error))
10831
+ error.message = `${STOPPED}${step}: ${error.message}`;
10832
+ throw error;
10833
+ }
10834
+ }
10775
10835
  async function runProbeStage(input) {
10776
10836
  const {
10777
10837
  projectDir,
@@ -10844,6 +10904,12 @@ async function runProbeStage(input) {
10844
10904
  assertNotAborted();
10845
10905
  const motionBlur = job.config.motionBlur;
10846
10906
  const captureOpts = {
10907
+ ...await probeVideoHold(
10908
+ composition.videos,
10909
+ compiled.html,
10910
+ projectDir,
10911
+ join23(workDir, "compiled")
10912
+ ),
10847
10913
  recordReferenceBackground: input.recordReferenceBackground,
10848
10914
  width,
10849
10915
  height,
@@ -10882,7 +10948,8 @@ async function runProbeStage(input) {
10882
10948
  log.info(`Still waiting for browser initialization... (${elapsed}s elapsed)`);
10883
10949
  }, 3e4);
10884
10950
  try {
10885
- await initializeSession4(probeSession);
10951
+ const opening = probeSession;
10952
+ await probeStep("opening the film in the browser", () => initializeSession4(opening));
10886
10953
  } finally {
10887
10954
  clearInterval(heartbeat);
10888
10955
  }
@@ -10961,7 +11028,8 @@ async function runProbeStage(input) {
10961
11028
  null,
10962
11029
  { ...probeCfg, forceScreenshot: true }
10963
11030
  );
10964
- await initializeSession4(probeSession);
11031
+ const reopening = probeSession;
11032
+ await probeStep("opening the film in the browser", () => initializeSession4(reopening));
10965
11033
  assertNotAborted();
10966
11034
  lastBrowserConsole = probeSession.browserConsoleBuffer;
10967
11035
  }
@@ -10969,8 +11037,13 @@ async function runProbeStage(input) {
10969
11037
  const session = probeSession;
10970
11038
  if (composition.duration <= 0) {
10971
11039
  log.info("Discovering composition duration...");
10972
- const discoveredDuration = await getCompositionDuration(session);
10973
- lengthSource = reportedLengthSource(await getCompositionLengthSource(session));
11040
+ const discoveredDuration = await probeStep(
11041
+ "reading the film's length",
11042
+ () => getCompositionDuration(session)
11043
+ );
11044
+ lengthSource = reportedLengthSource(
11045
+ await probeStep("reading the film's length", () => getCompositionLengthSource(session))
11046
+ );
10974
11047
  assertNotAborted();
10975
11048
  log.info("Probed composition duration from browser", {
10976
11049
  discoveredDuration,
@@ -10984,9 +11057,9 @@ async function runProbeStage(input) {
10984
11057
  });
10985
11058
  }
10986
11059
  if (compiled.unresolvedCompositions.length > 0) {
10987
- const resolutions = await resolveCompositionDurations(
10988
- session.page,
10989
- compiled.unresolvedCompositions
11060
+ const resolutions = await probeStep(
11061
+ "reading each scene's length",
11062
+ () => resolveCompositionDurations(session.page, compiled.unresolvedCompositions)
10990
11063
  );
10991
11064
  assertNotAborted();
10992
11065
  if (resolutions.length > 0) {
@@ -11006,7 +11079,10 @@ async function runProbeStage(input) {
11006
11079
  }
11007
11080
  }
11008
11081
  log.info("Discovering media assets from browser DOM...");
11009
- const browserMedia = await discoverMediaFromBrowser(session.page);
11082
+ const browserMedia = await probeStep(
11083
+ "listing the film's videos, audio and images",
11084
+ () => discoverMediaFromBrowser(session.page)
11085
+ );
11010
11086
  assertNotAborted();
11011
11087
  if (browserMedia.length > 0) {
11012
11088
  const existingVideoIds = new Set(composition.videos.map((v) => v.id));
@@ -11144,11 +11220,14 @@ async function runProbeStage(input) {
11144
11220
  log.info("Discovering audio volume automation...", {
11145
11221
  audioCount: composition.audios.length
11146
11222
  });
11147
- const automation = await discoverAudioVolumeAutomationFromTimeline(
11148
- session.page,
11149
- composition.audios.map((audio) => audio.id),
11150
- composition.duration,
11151
- fpsToNumber6(job.config.fps)
11223
+ const automation = await probeStep(
11224
+ "reading the audio's volume changes",
11225
+ () => discoverAudioVolumeAutomationFromTimeline(
11226
+ session.page,
11227
+ composition.audios.map((audio) => audio.id),
11228
+ composition.duration,
11229
+ fpsToNumber6(job.config.fps)
11230
+ )
11152
11231
  );
11153
11232
  assertNotAborted();
11154
11233
  if (automation.length > 0) {
@@ -11167,9 +11246,9 @@ async function runProbeStage(input) {
11167
11246
  log.info("Discovering video visibility windows...", {
11168
11247
  videoCount: composition.videos.length
11169
11248
  });
11170
- const visibilityWindows = await discoverVideoVisibilityFromTimeline(
11171
- session.page,
11172
- composition.duration
11249
+ const visibilityWindows = await probeStep(
11250
+ "finding when each video is on screen",
11251
+ () => discoverVideoVisibilityFromTimeline(session.page, composition.duration)
11173
11252
  );
11174
11253
  assertNotAborted();
11175
11254
  for (const win of visibilityWindows) {
@@ -11336,7 +11415,7 @@ import {
11336
11415
  createFrameLookupTable as createFrameLookupTable3,
11337
11416
  detectTransfer,
11338
11417
  extractAllVideoFrames,
11339
- extractMediaMetadata as extractMediaMetadata4,
11418
+ extractMediaMetadata as extractMediaMetadata5,
11340
11419
  gradingKeepsSdr as gradingKeepsSdr2,
11341
11420
  isVideoPastTimelineEnd,
11342
11421
  isHdrColorSpace as isHdrColorSpace2,
@@ -11350,7 +11429,7 @@ import {
11350
11429
  resolveRestrictPageNetwork,
11351
11430
  isUrlNotPermittedError,
11352
11431
  writeUrlDownloadTelemetry as writeUrlDownloadTelemetry2,
11353
- resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
11432
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc5,
11354
11433
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
11355
11434
  safeVideoExtractionSourceIdentity,
11356
11435
  videoAudioId as videoAudioId2
@@ -11561,7 +11640,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
11561
11640
  }
11562
11641
  async function probeColorSpaceSafely(path, log) {
11563
11642
  try {
11564
- const meta = await extractMediaMetadata4(path);
11643
+ const meta = await extractMediaMetadata5(path);
11565
11644
  return meta.colorSpace;
11566
11645
  } catch (error) {
11567
11646
  log?.warn("HDR color-space probe failed; treating source as SDR", {
@@ -11607,14 +11686,14 @@ async function runExtractVideosStage(input) {
11607
11686
  log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
11608
11687
  const probeFailures = await Promise.all(
11609
11688
  composition.videos.map(async (v) => {
11610
- const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
11689
+ const videoPath = resolveProjectRelativeSrc5(v.src, projectDir, compiledDir);
11611
11690
  if (!opensLocally(videoPath, assetRoots)) return null;
11612
11691
  try {
11613
11692
  const attempted = extractionPolicy.maxTransientRetries === 0 ? {
11614
- result: await extractMediaMetadata4(videoPath, { signal: abortSignal }),
11693
+ result: await extractMediaMetadata5(videoPath, { signal: abortSignal }),
11615
11694
  retries: 0
11616
11695
  } : await runVideoExtractionWithRetry2(
11617
- () => extractMediaMetadata4(videoPath, { signal: abortSignal }),
11696
+ () => extractMediaMetadata5(videoPath, { signal: abortSignal }),
11618
11697
  {
11619
11698
  signal: abortSignal,
11620
11699
  maxTransientRetries: extractionPolicy.maxTransientRetries,
@@ -11651,7 +11730,7 @@ async function runExtractVideosStage(input) {
11651
11730
  if (probesHdr && composition.images.length > 0) {
11652
11731
  const probed = await Promise.all(
11653
11732
  composition.images.map(async (img) => {
11654
- const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
11733
+ const imgPath = resolveProjectRelativeSrc5(img.src, projectDir, compiledDir);
11655
11734
  if (!opensLocally(imgPath, assetRoots)) return null;
11656
11735
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
11657
11736
  if (isHdrColorSpace2(colorSpace)) {
@@ -11786,7 +11865,7 @@ function opensLocally(path, assetRoots) {
11786
11865
  return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
11787
11866
  }
11788
11867
  function localProbeSource(src, input) {
11789
- const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
11868
+ const path = resolveProjectRelativeSrc5(src, input.projectDir, input.compiledDir);
11790
11869
  const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
11791
11870
  const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
11792
11871
  return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
@@ -11817,7 +11896,7 @@ async function appendVideoAudioFromProbe(input) {
11817
11896
  videos.map(async (video) => {
11818
11897
  const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
11819
11898
  if (readFrom === null) return null;
11820
- const metadata = await extractMediaMetadata4(readFrom, { signal: input.signal });
11899
+ const metadata = await extractMediaMetadata5(readFrom, { signal: input.signal });
11821
11900
  const window2 = await resolveFinalFrameExtractionWindow2(
11822
11901
  readFrom,
11823
11902
  video,
@@ -11841,7 +11920,7 @@ import {
11841
11920
  buildVideoLayerInput,
11842
11921
  isHttpUrl as isHttpUrl4,
11843
11922
  qualifyVideoLayer,
11844
- resolveProjectRelativeSrc as resolveProjectRelativeSrc5
11923
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc6
11845
11924
  } from "@hyperframes/engine";
11846
11925
  var SAMPLES = 9;
11847
11926
  function inspectVideoLayout(id, w, h, time) {
@@ -11903,7 +11982,7 @@ async function planVideoLayerPassthrough(input) {
11903
11982
  if (!q.qualifies) return { reason: q.reason };
11904
11983
  const { video } = q;
11905
11984
  if (isHttpUrl4(video.src)) return { reason: "remote_source" };
11906
- const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
11985
+ const path = resolveProjectRelativeSrc6(video.src, input.projectDir, input.compiledDir);
11907
11986
  if (!existsSync14(path)) return { reason: "source_missing" };
11908
11987
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
11909
11988
  if ("reason" in layout) return layout;
@@ -14866,7 +14945,7 @@ function isRecoverableParallelCaptureError(error) {
14866
14945
  return kind === "transient_browser" || kind === "protocol_timeout";
14867
14946
  }
14868
14947
  function describeMemoryExhaustion(error, ctx) {
14869
- if (!isMemoryExhaustionError(error)) return null;
14948
+ if (!isMemoryExhaustionError2(error)) return null;
14870
14949
  const raw = normalizeErrorMessage(error);
14871
14950
  const dims = ctx.width && ctx.height ? ` (${ctx.width}\xD7${ctx.height}${ctx.totalFrames ? `, ${ctx.totalFrames} frames` : ""})` : "";
14872
14951
  return `Render ran out of memory${dims}: ${raw}
@@ -16012,6 +16091,11 @@ async function executeRenderPipeline(input) {
16012
16091
  failureToEnforce
16013
16092
  } = extractResult;
16014
16093
  perfStages.videoExtractMs = extractResult.videoExtractMs;
16094
+ if (probeSession && !probeHoldFitsCapture(probeSession.options.skipReadinessVideoIds, videoReadinessSkipIds)) {
16095
+ const held = probeSession;
16096
+ probeSession = null;
16097
+ await closeCaptureSession8(held);
16098
+ }
16015
16099
  const coverageReports = extractionResult ? computeVideoFrameCoverage(composition.videos, extractionResult.extracted, job.config.fps) : [];
16016
16100
  const coverageThreshold = resolveVideoCoverageThreshold();
16017
16101
  const authoredTimedClipCount = countAuthoredTimedClips(compiled.html);
@@ -17033,7 +17117,7 @@ async function executeRenderPipeline(input) {
17033
17117
  totalFrames,
17034
17118
  segmentFrames,
17035
17119
  key: manifestKey,
17036
- probeFrames: (path) => probeSegmentFrameCount(path, extractMediaMetadata5)
17120
+ probeFrames: (path) => probeSegmentFrameCount(path, extractMediaMetadata6)
17037
17121
  });
17038
17122
  segmentManifest.completed = existing.completed.filter(
17039
17123
  (entry) => completedSegments.has(entry.index)
@@ -17269,7 +17353,7 @@ async function executeRenderPipeline(input) {
17269
17353
  isBeginFrameCapture: !capturePlan.forceScreenshot && !cfg.useDrawElement && parallelCaptureMode === "beginframe"
17270
17354
  }))
17271
17355
  throw err;
17272
- const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError(err);
17356
+ const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError2(err);
17273
17357
  deSelfVerifyFallback = isVerifyError;
17274
17358
  if (isVerifyError) {
17275
17359
  const t = deVerifyFallbackTelemetry(err);
@@ -1,4 +1,6 @@
1
- /** The folder a host that ships its own GSAP names, so a render needs no network for it. */
1
+ /** The host's GSAP_CDN_VERSION files; other versions it ships sit beside them at `../../gsap@<version>/dist`. */
2
2
  export declare const GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
3
- /** The host's bytes for exactly the default CDN's GSAP file; a mirror's URL differs, so it never matches. */
3
+ /** The host's bytes for exactly this default-CDN GSAP file, at any version the host ships. */
4
4
  export declare function bundledScript(url: string): Uint8Array | null;
5
+ /** The same file at the host's own GSAP version, for one the network could not bring. */
6
+ export declare function bundledGsapStandIn(url: string): Uint8Array | null;
@@ -98,6 +98,16 @@ type VariablesByComp = Record<string, Record<string, unknown>>;
98
98
  * element's variable has a value (the render's, its scope's compiled table entry, its mount's, a declared default).
99
99
  */
100
100
  export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined, variablesByComp?: VariablesByComp): boolean;
101
+ /**
102
+ * Videos the probe page holds at preload none with their FFmpeg size, as capture pages hold extracted ones:
103
+ * live, 40 clips of one 4K file stop Chrome answering. A runtime-set or sizeless source stays live.
104
+ */
105
+ export declare function probeVideoHold(videos: readonly {
106
+ id: string;
107
+ src: string;
108
+ }[], html: string, projectDir: string, compiledDir: string): Promise<Pick<CaptureOptions, "skipReadinessVideoIds" | "videoMetadataHints">>;
109
+ /** A probe page can serve capture only when capture holds every video it held: an unextracted one needs Chrome. */
110
+ export declare function probeHoldFitsCapture(probeHeld: readonly string[] | undefined, captureHeld: readonly string[]): boolean;
101
111
  /**
102
112
  * Runtime-created media does not exist when the static compiler scans the HTML.
103
113
  * Launch a browser probe so discoverMediaFromBrowser can reconcile it before
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.80",
3
+ "version": "0.9.82",
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/engine": "0.9.80",
39
- "@hyperframes/core": "0.9.80",
40
- "@hyperframes/lint": "0.9.80",
41
- "@hyperframes/studio-server": "0.9.80",
42
- "@hyperframes/parsers": "0.9.80"
38
+ "@hyperframes/engine": "0.9.82",
39
+ "@hyperframes/lint": "0.9.82",
40
+ "@hyperframes/core": "0.9.82",
41
+ "@hyperframes/parsers": "0.9.82",
42
+ "@hyperframes/studio-server": "0.9.82"
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.80"
51
+ "@hyperframes/aws-lambda": "0.9.82"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"