@hyperframes/producer 0.8.220 → 0.8.222

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.
@@ -1040,6 +1040,21 @@ function reportFrameProgress(job, stage, progress, onProgress, done, total) {
1040
1040
  total
1041
1041
  });
1042
1042
  }
1043
+ var lastExtractReportAt = /* @__PURE__ */ new WeakMap();
1044
+ function reportExtractProgress(job, done, total, onProgress) {
1045
+ if (total <= 0) return;
1046
+ const frames = Math.min(done, total);
1047
+ reportThrottled(
1048
+ lastExtractReportAt,
1049
+ job,
1050
+ "Extracting video frames",
1051
+ 10 + 10 * frames / total,
1052
+ onProgress,
1053
+ frames === total,
1054
+ { code: "extract_video", done: frames, total },
1055
+ "preprocessing"
1056
+ );
1057
+ }
1043
1058
  var lastEncodeReportAt = /* @__PURE__ */ new WeakMap();
1044
1059
  function reportEncodeProgress(job, done, total, onProgress, from) {
1045
1060
  if (total <= 0) return;
@@ -1056,6 +1071,14 @@ function reportEncodeProgress(job, done, total, onProgress, from) {
1056
1071
  );
1057
1072
  }
1058
1073
  var workerPhasesByJob = /* @__PURE__ */ new WeakMap();
1074
+ function forgetWorkerPhases(job) {
1075
+ workerPhasesByJob.delete(job);
1076
+ }
1077
+ function describeWorkerPhases(job) {
1078
+ const phases = workerPhasesByJob.get(job);
1079
+ if (!phases?.size) return void 0;
1080
+ return `Last phase per worker: ${[...phases].map(([id, phase]) => `worker ${id} ${phase}`).join(", ")}.`;
1081
+ }
1059
1082
  function reportWorkerStartup(job, progress, onProgress) {
1060
1083
  const phase = progress.latestWorkerPhase;
1061
1084
  if (!phase) return;
@@ -1755,16 +1778,17 @@ var RenderStageStalledError = class extends CaptureFailure2 {
1755
1778
  code = "RENDER_STAGE_STALLED";
1756
1779
  owner = "system";
1757
1780
  retryable = false;
1758
- constructor(phase, silentMs, progress) {
1781
+ constructor(phase, silentMs, progress, detail) {
1759
1782
  super({
1760
1783
  kind: "protocol_timeout",
1761
- message: `[Render] ${phase} stalled: no progress for ${silentMs}ms (stuck at ${progress}).`
1784
+ message: `[Render] ${phase} stalled: no progress for ${silentMs}ms (stuck at ${progress}).${detail ? ` ${detail}` : ""}`
1762
1785
  });
1763
1786
  this.name = "RenderStageStalledError";
1764
1787
  }
1765
1788
  };
1766
1789
  var STALL_POLL_MS = 5e3;
1767
1790
  function watchStall(phase, rule) {
1791
+ const detail = rule.detail ?? (() => void 0);
1768
1792
  let last = rule.progress();
1769
1793
  let budgetMs = rule.firstProgressMs;
1770
1794
  let lastChangeAt = Date.now();
@@ -1786,7 +1810,7 @@ function watchStall(phase, rule) {
1786
1810
  }
1787
1811
  if (current !== last) return restartWindow(rule.noProgressMs);
1788
1812
  if (Date.now() - lastChangeAt < budgetMs) return;
1789
- const error = new RenderStageStalledError(phase, budgetMs, current);
1813
+ const error = new RenderStageStalledError(phase, budgetMs, current, detail());
1790
1814
  if (attempt && !attempt.signal.aborted) {
1791
1815
  attempt.abort(error);
1792
1816
  return restartWindow(rule.noProgressMs);
@@ -1800,6 +1824,7 @@ function watchStall(phase, rule) {
1800
1824
  const openAttempt = (parent) => {
1801
1825
  attempt = new AbortController();
1802
1826
  inTail = false;
1827
+ rule.attemptOpened?.();
1803
1828
  restartWindow(rule.firstProgressMs);
1804
1829
  return parent ? AbortSignal.any([parent, attempt.signal]) : attempt.signal;
1805
1830
  };
@@ -3989,7 +4014,7 @@ function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
3989
4014
  const { document: document2 } = parseHTML5(html);
3990
4015
  const assetExists = (path) => existsSync6(resolve6(projectDir, path));
3991
4016
  rewriteAssetPaths(
3992
- document2.querySelectorAll("[src], [href]"),
4017
+ document2.querySelectorAll("[src], [href], [srcset]"),
3993
4018
  entryPath,
3994
4019
  (el, attr) => el.getAttribute(attr),
3995
4020
  (el, attr, value) => el.setAttribute(attr, value),
@@ -5708,6 +5733,8 @@ async function runExtractVideosStage(input) {
5708
5733
  safeVideoExtractionSourceLogMetadata(v.src)
5709
5734
  );
5710
5735
  }
5736
+ let framesPlanned = 0;
5737
+ let framesDone = 0;
5711
5738
  extractionResult = await extractAllVideoFrames(
5712
5739
  composition.videos,
5713
5740
  projectDir,
@@ -5724,7 +5751,12 @@ async function runExtractVideosStage(input) {
5724
5751
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
5725
5752
  deferRangeExtraction,
5726
5753
  contentKeyedDirs: [join9(compiledDir, REMOTE_MEDIA_SUBDIR)],
5727
- urlByAbsentLocalPath
5754
+ urlByAbsentLocalPath,
5755
+ onProgress: ({ planned = 0, done = 0 }) => {
5756
+ framesPlanned += planned;
5757
+ framesDone += done;
5758
+ reportExtractProgress(job, framesDone, framesPlanned, input.onProgress);
5759
+ }
5728
5760
  },
5729
5761
  abortSignal,
5730
5762
  cfg,
@@ -7362,7 +7394,9 @@ function frameStallRule(job, totalFrames) {
7362
7394
  noProgressMs,
7363
7395
  firstProgressMs: Math.max(FIRST_FRAME_STALL_MS, noProgressMs),
7364
7396
  complete: () => (job.framesRendered ?? 0) >= totalFrames,
7365
- tailMs: Math.max(TAIL_STALL_MS, noProgressMs)
7397
+ tailMs: Math.max(TAIL_STALL_MS, noProgressMs),
7398
+ detail: () => describeWorkerPhases(job),
7399
+ attemptOpened: () => forgetWorkerPhases(job)
7366
7400
  };
7367
7401
  }
7368
7402
  function isRecoverableParallelCaptureError(error) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "78efe07295a89a03dcbd14cd5e997eaa9bf6b23f26b19f78bd614c0954b7bd91",
4
+ "sha256": "a1cb1c2e5fd7ed995bd0a96674aab5a38a225021cec0e331162b64b8bcc34f53",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"