@hyperframes/producer 0.8.208 → 0.8.210

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.
@@ -794,7 +794,7 @@ function createFileServer(options) {
794
794
  if (!streamOwnsFd) closeSync(fd);
795
795
  }
796
796
  });
797
- return new Promise((resolve10) => {
797
+ return new Promise((resolve10, reject) => {
798
798
  const connections = /* @__PURE__ */ new Set();
799
799
  const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
800
800
  resolve10({
@@ -814,6 +814,7 @@ function createFileServer(options) {
814
814
  connections.add(socket);
815
815
  socket.on("close", () => connections.delete(socket));
816
816
  });
817
+ server.on("error", reject);
817
818
  });
818
819
  }
819
820
 
@@ -826,9 +827,26 @@ function outputNeedsAlpha(format) {
826
827
  import { keyframeIntervalToGopSize } from "@hyperframes/engine";
827
828
 
828
829
  // src/services/render/deliveryEncoder.ts
829
- import { appendRateCapArgs, keyframeIntervalToGopSize as keyframeIntervalToGopSize2 } from "@hyperframes/engine";
830
+ import {
831
+ PRORES_PROFILE_NAMES,
832
+ appendRateCapArgs,
833
+ isProresProfile,
834
+ keyframeIntervalToGopSize as keyframeIntervalToGopSize2
835
+ } from "@hyperframes/engine";
836
+ function validateProresProfile(format, proresProfile) {
837
+ if (proresProfile === void 0) return;
838
+ if (!isProresProfile(proresProfile)) {
839
+ throw new Error(
840
+ `proresProfile must be one of ${PRORES_PROFILE_NAMES.join(", ")}; got ${JSON.stringify(proresProfile)}`
841
+ );
842
+ }
843
+ if (format !== void 0 && format !== "mov") {
844
+ throw new Error(`proresProfile applies to mov renders, not ${format}`);
845
+ }
846
+ }
830
847
  function validateDeliveryEncoderConfig(config) {
831
- const { keyframeIntervalSeconds, maxBitrate, bufferSize, format } = config;
848
+ const { keyframeIntervalSeconds, maxBitrate, bufferSize, format, proresProfile } = config;
849
+ validateProresProfile(format, proresProfile);
832
850
  if (keyframeIntervalSeconds === void 0 && maxBitrate === void 0 && bufferSize === void 0)
833
851
  return;
834
852
  if (keyframeIntervalSeconds !== void 0) {
@@ -1395,6 +1413,12 @@ import {
1395
1413
  isHdrColorSpace,
1396
1414
  sanitizeHdrAutoPromotionAsset
1397
1415
  } from "@hyperframes/engine";
1416
+ function formatCarriesHdr(format) {
1417
+ return format === "mp4";
1418
+ }
1419
+ function rendersSdrOnly(config) {
1420
+ return config.hdrMode === "force-sdr" || !formatCarriesHdr(config.format ?? "mp4");
1421
+ }
1398
1422
 
1399
1423
  // src/services/render/captureBeyondViewport.ts
1400
1424
  function resolveVideoCaptureBeyondViewport(videoCount) {
@@ -1858,7 +1882,7 @@ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
1858
1882
  import {
1859
1883
  assignBundledRuntimeCompositionIds,
1860
1884
  assignMediaRenderIds,
1861
- buildVariablesByCompScript,
1885
+ emitVariablesByCompScript,
1862
1886
  inlineSubCompositions as inlineSubCompositionsShared,
1863
1887
  ensureExternalLinkTag,
1864
1888
  ensureExternalScriptTag,
@@ -3430,9 +3454,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
3430
3454
  }
3431
3455
  }
3432
3456
  }
3433
- const variablesByCompScript = buildVariablesByCompScript(result.variablesByComp);
3457
+ emitVariablesByCompScript(document2, result.variablesByComp);
3434
3458
  if (body) {
3435
- let pending = variablesByCompScript ? [variablesByCompScript] : [];
3459
+ let pending = [];
3436
3460
  const flushInline = () => {
3437
3461
  if (!pending.length) return;
3438
3462
  const joined = pending.join("\n;\n");
@@ -5666,7 +5690,7 @@ async function runExtractVideosStage(input) {
5666
5690
  fps: job.config.fps,
5667
5691
  outputDir: join9(compiledDir, "__hyperframes_video_frames"),
5668
5692
  format: job.config.videoFrameFormat ?? "auto",
5669
- toneMapHdrToSdr: job.config.hdrMode === "force-sdr",
5693
+ toneMapHdrToSdr: rendersSdrOnly(job.config),
5670
5694
  timelineEnd: composition.duration,
5671
5695
  maxTransientRetries: extractionPolicy.maxTransientRetries,
5672
5696
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
@@ -9498,6 +9522,8 @@ function buildLockedRenderConfig(input) {
9498
9522
  closedGop: true,
9499
9523
  forceKeyframes: "n=0",
9500
9524
  pixelFormat,
9525
+ // Omitted for the default so existing 4444 plans keep their planHash.
9526
+ ...config.proresProfile && config.proresProfile !== "4444" ? { proresProfile: config.proresProfile } : {},
9501
9527
  chunkSize: input.effectiveChunkSize,
9502
9528
  chunkCount: input.chunkCount,
9503
9529
  runtimeEnv: input.runtimeEnv,
@@ -9519,7 +9545,11 @@ function resolveEncoderTriple(config) {
9519
9545
  `[plan] DistributedRenderConfig.codec is only valid for format="mp4"; received codec=${JSON.stringify(config.codec)} with format=${JSON.stringify(config.format)}. Omit codec for non-mp4 formats: mov is always ProRes 4444, webm is always libvpx-vp9, and png-sequence has no encoder.`
9520
9546
  );
9521
9547
  }
9522
- return resolveNonMp4EncoderTriple(config.format, config.quality ?? "standard");
9548
+ return resolveNonMp4EncoderTriple(
9549
+ config.format,
9550
+ config.quality ?? "standard",
9551
+ config.proresProfile
9552
+ );
9523
9553
  }
9524
9554
  function resolveMp4EncoderTriple(codec) {
9525
9555
  const c = codec ?? "h264";
@@ -9533,9 +9563,10 @@ function resolveMp4EncoderTriple(codec) {
9533
9563
  }
9534
9564
  return { encoder: "libx264-software", pixelFormat: "yuv420p", preset: "medium" };
9535
9565
  }
9536
- function resolveNonMp4EncoderTriple(format, quality) {
9566
+ function resolveNonMp4EncoderTriple(format, quality, proresProfile) {
9537
9567
  if (format === "mov") {
9538
- return { encoder: "prores-software", pixelFormat: "yuva444p10le", preset: "4444" };
9568
+ const { pixelFormat, preset } = getEncoderPreset4(quality, "mov", void 0, proresProfile);
9569
+ return { encoder: "prores-software", pixelFormat, preset };
9539
9570
  }
9540
9571
  if (format === "webm") {
9541
9572
  const enginePreset = getEncoderPreset4(quality, "webm");
@@ -11783,7 +11814,12 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
11783
11814
  const isPngSequence = plan2.dimensions.format === "png-sequence";
11784
11815
  outputKind = isPngSequence ? "frame-dir" : "file";
11785
11816
  const presetFormat = isPngSequence ? "mp4" : plan2.dimensions.format;
11786
- const basePreset = getEncoderPreset6(job.config.quality, presetFormat, void 0);
11817
+ const basePreset = getEncoderPreset6(
11818
+ job.config.quality,
11819
+ presetFormat,
11820
+ void 0,
11821
+ encoder.proresProfile
11822
+ );
11787
11823
  const preset = resolvePresetForLockedEncoder(basePreset, encoder.encoder);
11788
11824
  const effectiveQuality = encoder.crf ?? preset.quality;
11789
11825
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
@@ -12168,6 +12204,18 @@ function validateDistributedRenderConfig(config) {
12168
12204
  error instanceof Error ? error.message : String(error)
12169
12205
  );
12170
12206
  }
12207
+ try {
12208
+ validateDeliveryEncoderConfig({
12209
+ format: config.format,
12210
+ fps: { num: config.fps, den: 1 },
12211
+ proresProfile: config.proresProfile
12212
+ });
12213
+ } catch (error) {
12214
+ throw new InvalidConfigError(
12215
+ "config.proresProfile",
12216
+ error instanceof Error ? error.message : String(error)
12217
+ );
12218
+ }
12171
12219
  if (config.chunkSize !== void 0) {
12172
12220
  if (!Number.isInteger(config.chunkSize) || config.chunkSize < 1) {
12173
12221
  throw new InvalidConfigError(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "e7380e2810c1db76b94231462d6756bbd8fd7047ab2014b7428a26dc7105b099",
4
+ "sha256": "7ab9e58fd46ca6b2743d6347ac25614c879b13b5dc8f6da20c0261d275d7b685",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"