hyperframes 0.7.0 → 0.7.2

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.
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.7.0" : "0.0.0-dev";
53
+ VERSION = true ? "0.7.2" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -35159,8 +35159,10 @@ async function extractAudioMetadata(filePath) {
35159
35159
  const audioStream = output.streams.find((s2) => s2.codec_type === "audio");
35160
35160
  if (!audioStream) throw new Error("[FFmpeg] No audio stream found");
35161
35161
  const durationSeconds = output.format.duration ? parseFloat(output.format.duration) : 0;
35162
+ const streamDuration = audioStream.duration ? parseFloat(audioStream.duration) : void 0;
35162
35163
  return {
35163
35164
  durationSeconds,
35165
+ streamDurationSeconds: streamDuration && streamDuration > 0 ? streamDuration : void 0,
35164
35166
  sampleRate: audioStream.sample_rate ? parseInt(audioStream.sample_rate) : 44100,
35165
35167
  channels: audioStream.channels || 2,
35166
35168
  audioCodec: audioStream.codec_name || "unknown",
@@ -35754,7 +35756,7 @@ async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, confi
35754
35756
  if (fps !== void 0) {
35755
35757
  args.push("-r", fpsToFfmpegArg(fps));
35756
35758
  }
35757
- args.push("-shortest", "-y", outputPath);
35759
+ args.push("-y", outputPath);
35758
35760
  const processTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
35759
35761
  const result = await runFfmpeg(args, { signal, timeout: processTimeout });
35760
35762
  if (signal?.aborted) {
@@ -42425,6 +42427,8 @@ function trackRenderComplete(props) {
42425
42427
  stage_video_extract_ms: props.stageVideoExtractMs,
42426
42428
  stage_audio_process_ms: props.stageAudioProcessMs,
42427
42429
  stage_capture_ms: props.stageCaptureMs,
42430
+ stage_capture_setup_ms: props.stageCaptureSetupMs,
42431
+ stage_capture_frame_ms: props.stageCaptureFrameMs,
42428
42432
  stage_encode_ms: props.stageEncodeMs,
42429
42433
  stage_assemble_ms: props.stageAssembleMs,
42430
42434
  extract_resolve_ms: props.extractResolveMs,
@@ -47115,6 +47119,8 @@ function stagesPayload(stages) {
47115
47119
  stageVideoExtractMs: stages.videoExtractMs,
47116
47120
  stageAudioProcessMs: stages.audioProcessMs,
47117
47121
  stageCaptureMs: stages.captureMs,
47122
+ stageCaptureSetupMs: stages.captureSetupMs,
47123
+ stageCaptureFrameMs: stages.captureFrameMs,
47118
47124
  stageEncodeMs: stages.encodeMs,
47119
47125
  stageAssembleMs: stages.assembleMs
47120
47126
  };
@@ -92490,6 +92496,7 @@ function extractRequestedFontFamilies(html) {
92490
92496
  for (const originalCase of families) {
92491
92497
  const normalized = originalCase.toLowerCase();
92492
92498
  if (!normalized || GENERIC_FAMILIES2.has(normalized)) continue;
92499
+ if (normalized.startsWith("var(")) continue;
92493
92500
  if (!requested.has(normalized)) requested.set(normalized, originalCase);
92494
92501
  }
92495
92502
  }
@@ -93948,18 +93955,6 @@ function updateJobStatus(job, status, stage, progress, onProgress) {
93948
93955
  if (status === "failed" || status === "complete") job.completedAt = /* @__PURE__ */ new Date();
93949
93956
  if (onProgress) onProgress(job, stage);
93950
93957
  }
93951
- function createCompiledFrameSrcResolver(compiledDir) {
93952
- const compiledRoot = resolve23(compiledDir);
93953
- return (framePath) => {
93954
- const resolvedFramePath = resolve23(framePath);
93955
- if (!isPathInside3(resolvedFramePath, compiledRoot)) return null;
93956
- const relativePath = relative7(compiledRoot, resolvedFramePath);
93957
- if (!relativePath || relativePath.startsWith("..") || isAbsolute9(relativePath)) {
93958
- return null;
93959
- }
93960
- return `/${relativePath.split(/[\\/]+/).map((segment) => encodeURIComponent(segment)).join("/")}`;
93961
- };
93962
- }
93963
93958
  function createMemorySampler(intervalMs = 250) {
93964
93959
  let peakRss = 0;
93965
93960
  let peakHeap = 0;
@@ -94347,7 +94342,9 @@ function buildRenderPerfSummary(input2) {
94347
94342
  hdrDiagnostics: input2.hdrDiagnostics.videoExtractionFailures > 0 || input2.hdrDiagnostics.imageDecodeFailures > 0 ? { ...input2.hdrDiagnostics } : void 0,
94348
94343
  hdrPerf: input2.hdrPerf ? finalizeHdrPerf(input2.hdrPerf) : void 0,
94349
94344
  observability: input2.observability,
94350
- captureAvgMs: input2.totalFrames > 0 ? Math.round((input2.perfStages.captureMs ?? 0) / input2.totalFrames) : void 0,
94345
+ captureAvgMs: input2.totalFrames > 0 ? Math.round(
94346
+ (input2.perfStages.captureFrameMs ?? input2.perfStages.captureMs ?? 0) / input2.totalFrames
94347
+ ) : void 0,
94351
94348
  peakRssMb: Math.round(input2.peakRssBytes / (1024 * 1024)),
94352
94349
  peakHeapUsedMb: Math.round(input2.peakHeapUsedBytes / (1024 * 1024)),
94353
94350
  staticDedup: aggregateDedup(input2.dedupPerfs)
@@ -99470,6 +99467,12 @@ function shouldUseStreamingEncode(cfg, outputFormat, workerCount, durationSecond
99470
99467
  if (durationSeconds > cfg.streamingEncodeMaxDurationSeconds) return false;
99471
99468
  return workerCount === 1;
99472
99469
  }
99470
+ function resolveCaptureForceScreenshotForPageSideCompositing(args) {
99471
+ return args.usePageSideCompositing ? true : args.forceScreenshot;
99472
+ }
99473
+ function shouldDiscardProbeSessionForPageSideCompositing(args) {
99474
+ return args.hasProbeSession && args.usePageSideCompositing;
99475
+ }
99473
99476
  function extractStandaloneEntryFromIndex(indexHtml, entryFile) {
99474
99477
  const normalizedEntryFile = normalizeCompositionSrcPath(entryFile);
99475
99478
  const { document: document2 } = parseHTML(indexHtml);
@@ -99800,11 +99803,9 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
99800
99803
  videoMetadataHints,
99801
99804
  skipReadinessVideoIds: videoReadinessSkipIds
99802
99805
  });
99803
- const frameSrcResolver = createCompiledFrameSrcResolver(compiledDir);
99804
99806
  const createRenderVideoFrameInjector = () => createVideoFrameInjector(frameLookup, {
99805
99807
  frameDataUriCacheLimit: cfg.frameDataUriCacheLimit,
99806
- frameDataUriCacheBytesLimitMb: cfg.frameDataUriCacheBytesLimitMb,
99807
- frameSrcResolver
99808
+ frameDataUriCacheBytesLimitMb: cfg.frameDataUriCacheBytesLimitMb
99808
99809
  });
99809
99810
  let captureCalibration;
99810
99811
  const htmlInCanvasDetected = compiled.renderModeHints.reasons.some(
@@ -99889,8 +99890,24 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
99889
99890
  const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && !isPngSequence && !needsAlpha;
99890
99891
  if (usePageSideCompositingForTransitions) {
99891
99892
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
99893
+ if (shouldDiscardProbeSessionForPageSideCompositing({
99894
+ hasProbeSession: probeSession !== null,
99895
+ usePageSideCompositing: true
99896
+ }) && probeSession) {
99897
+ lastBrowserConsole = probeSession.browserConsoleBuffer;
99898
+ await closeCaptureSession(probeSession);
99899
+ probeSession = null;
99900
+ log2.info(
99901
+ "[Render] Recreating capture session so page-side compositing pre-head script is loaded."
99902
+ );
99903
+ }
99904
+ captureForceScreenshot = resolveCaptureForceScreenshotForPageSideCompositing({
99905
+ forceScreenshot: captureForceScreenshot,
99906
+ usePageSideCompositing: true
99907
+ });
99908
+ updateCaptureObservability({ forceScreenshot: captureForceScreenshot });
99892
99909
  log2.info(
99893
- "[Render] Page-side compositing enabled \u2014 bypassing Node-side layered shader-blend path. Engine will capture one opaque RGB frame per output frame."
99910
+ "[Render] Page-side compositing enabled \u2014 bypassing Node-side layered shader-blend path. Engine will capture one opaque RGB screenshot per output frame."
99894
99911
  );
99895
99912
  }
99896
99913
  const useLayeredComposite = !usePageSideCompositingForTransitions && shouldUseLayeredComposite({
@@ -99969,10 +99986,13 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
99969
99986
  lastBrowserConsole = hdrRes.lastBrowserConsole;
99970
99987
  hdrPerf = hdrRes.hdrPerf;
99971
99988
  perfStages.captureMs = hdrRes.captureDurationMs;
99989
+ perfStages.captureFrameMs = hdrRes.captureDurationMs;
99990
+ perfStages.captureSetupMs = Math.max(0, Date.now() - stage4Start - hdrRes.captureDurationMs);
99972
99991
  perfStages.encodeMs = hdrRes.encodeMs;
99973
99992
  } else {
99974
99993
  let streamingHandled = false;
99975
99994
  if (useStreamingEncode) {
99995
+ const captureFrameStart = Date.now();
99976
99996
  const streamingRes = await observeRenderStage(
99977
99997
  observability,
99978
99998
  "capture_streaming",
@@ -100012,6 +100032,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
100012
100032
  dedupPerfs
100013
100033
  })
100014
100034
  );
100035
+ const captureFrameMs = Date.now() - captureFrameStart;
100015
100036
  if (streamingRes.success) {
100016
100037
  streamingHandled = true;
100017
100038
  workerCount = streamingRes.workerCount;
@@ -100019,6 +100040,8 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
100019
100040
  probeSession = streamingRes.probeSession;
100020
100041
  lastBrowserConsole = streamingRes.lastBrowserConsole;
100021
100042
  perfStages.captureMs = Date.now() - stage4Start;
100043
+ perfStages.captureFrameMs = captureFrameMs;
100044
+ perfStages.captureSetupMs = Math.max(0, perfStages.captureMs - captureFrameMs);
100022
100045
  perfStages.encodeMs = streamingRes.encodeMs;
100023
100046
  } else {
100024
100047
  useStreamingEncode = false;
@@ -100027,6 +100050,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
100027
100050
  }
100028
100051
  }
100029
100052
  if (!streamingHandled) {
100053
+ const captureFrameStart = Date.now();
100030
100054
  const captureRes = await observeRenderStage(
100031
100055
  observability,
100032
100056
  "capture_disk",
@@ -100052,11 +100076,14 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
100052
100076
  onProgress
100053
100077
  })
100054
100078
  );
100079
+ const captureFrameMs = Date.now() - captureFrameStart;
100055
100080
  workerCount = captureRes.workerCount;
100056
100081
  updateCaptureObservability({ workerCount });
100057
100082
  probeSession = captureRes.probeSession;
100058
100083
  lastBrowserConsole = captureRes.lastBrowserConsole;
100059
100084
  perfStages.captureMs = Date.now() - stage4Start;
100085
+ perfStages.captureFrameMs = captureFrameMs;
100086
+ perfStages.captureSetupMs = Math.max(0, perfStages.captureMs - captureFrameMs);
100060
100087
  const encodeRes = await observeRenderStage(
100061
100088
  observability,
100062
100089
  "encode",
@@ -107651,6 +107678,8 @@ function trackRenderMetrics(job, elapsedMs, options, docker) {
107651
107678
  stageVideoExtractMs: stages.videoExtractMs,
107652
107679
  stageAudioProcessMs: stages.audioProcessMs,
107653
107680
  stageCaptureMs: stages.captureMs,
107681
+ stageCaptureSetupMs: stages.captureSetupMs,
107682
+ stageCaptureFrameMs: stages.captureFrameMs,
107654
107683
  stageEncodeMs: stages.encodeMs,
107655
107684
  stageAssembleMs: stages.assembleMs,
107656
107685
  extractResolveMs: extract?.resolveMs,
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-CbNg8Ghm.js";/*!
1
+ import{n as Qi}from"./index-C3MVn8bx.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public