@hyperframes/producer 0.8.189 → 0.8.190

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.
@@ -1097,6 +1097,14 @@ function materializeExtractedFramesForCompiledDir(extracted, compiledDir, option
1097
1097
  }
1098
1098
  }
1099
1099
 
1100
+ // src/services/render/frameCacheBudget.ts
1101
+ function frameCacheOptions(cfg, workers) {
1102
+ return {
1103
+ frameDataUriCacheLimit: cfg.frameDataUriCacheLimit,
1104
+ frameDataUriCacheBytesLimitMb: Math.floor(cfg.frameDataUriCacheBytesLimitMb / (workers || 1))
1105
+ };
1106
+ }
1107
+
1100
1108
  // src/utils/errorMessage.ts
1101
1109
  function normalizeErrorMessage(error) {
1102
1110
  if (error instanceof Error) return error.message;
@@ -6847,12 +6855,13 @@ var RenderChunkValidationError = class extends Error {
6847
6855
  this.code = code;
6848
6856
  }
6849
6857
  };
6850
- function createChunkVideoFrameInjectorFactory(frameLookup) {
6851
- if (!(frameLookup instanceof Promise)) return () => createVideoFrameInjector2(frameLookup);
6858
+ function createChunkVideoFrameInjectorFactory(frameLookup, options) {
6859
+ if (!(frameLookup instanceof Promise))
6860
+ return () => createVideoFrameInjector2(frameLookup, options);
6852
6861
  return () => {
6853
6862
  let hook;
6854
6863
  return async (page, time, heldVideoTime) => {
6855
- hook ??= createVideoFrameInjector2(await frameLookup);
6864
+ hook ??= createVideoFrameInjector2(await frameLookup, options);
6856
6865
  await hook?.(page, time, heldVideoTime);
6857
6866
  };
6858
6867
  };
@@ -10283,6 +10292,22 @@ async function createVerifiedDistributedCaptureSession(serverUrl, framesDir, cap
10283
10292
  function isCaptureMode(value) {
10284
10293
  return value === "beginframe" || value === "screenshot" || value === "drawelement";
10285
10294
  }
10295
+ var MixedCaptureModesError = class extends Error {
10296
+ constructor(modes) {
10297
+ super(`[renderChunk] capture workers reported inconsistent modes: ${modes.join(",")}`);
10298
+ this.modes = modes;
10299
+ this.name = "MixedCaptureModesError";
10300
+ }
10301
+ };
10302
+ function observedChunkCaptureMode(perfs) {
10303
+ const modes = [...new Set(perfs.map((perf) => perf.captureMode))];
10304
+ if (modes.length > 1) throw new MixedCaptureModesError(modes);
10305
+ const [mode] = modes;
10306
+ if (!mode || !isCaptureMode(mode)) {
10307
+ throw new Error(`[renderChunk] capture workers reported an invalid mode: ${mode ?? "<none>"}`);
10308
+ }
10309
+ return mode;
10310
+ }
10286
10311
  function shouldRetryChunkCaptureWithScreenshot(error) {
10287
10312
  const failure = classifyCaptureFailure4(error);
10288
10313
  if (failure.kind === "cancelled" || failure.kind === "memory_exhaustion") return false;
@@ -10580,7 +10605,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10580
10605
  ) : null;
10581
10606
  videoFrameLookup?.catch(() => {
10582
10607
  });
10583
- const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(videoFrameLookup);
10608
+ const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(
10609
+ videoFrameLookup,
10610
+ frameCacheOptions(cfg, chunkWorkerCount)
10611
+ );
10584
10612
  const captureStarted = Date.now();
10585
10613
  captureMode = await runCaptureWithScreenshotFallback({
10586
10614
  forceScreenshot: forceScreenshotForChunk,
@@ -10634,17 +10662,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10634
10662
  },
10635
10663
  frameRange: range
10636
10664
  });
10637
- const observedModes = new Set(capturePerfs.map((perf) => perf.captureMode));
10638
- if (observedModes.size !== 1 || ![...observedModes].every(isCaptureMode)) {
10639
- throw new Error(
10640
- `[renderChunk] capture workers reported invalid or inconsistent modes: ${[...observedModes].join(",") || "<none>"}`
10641
- );
10642
- }
10643
- const [observedMode] = observedModes;
10644
- if (!observedMode || !isCaptureMode(observedMode)) {
10645
- throw new Error("[renderChunk] capture completed without an observed mode");
10646
- }
10647
- return observedMode;
10665
+ return observedChunkCaptureMode(capturePerfs);
10648
10666
  },
10649
10667
  resetForScreenshotRetry: () => {
10650
10668
  rmSync13(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "eee27ae31219b3ee97526ca8d8716b921e7f5bce461e1d62f1ff2a49eb26ea67",
4
+ "sha256": "54a6d80fb24c9d14b82e50000abc5ff73819d53fe7951b53299a20e941371b5b",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"