hyperframes 0.6.65 → 0.6.66

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.6.65" : "0.0.0-dev";
53
+ VERSION = true ? "0.6.66" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -58212,7 +58212,7 @@ function isSafeAttributeValue(name, value) {
58212
58212
  function patchElementInHtml(source, target, operations) {
58213
58213
  const { document: document2, wrappedFragment } = parseSourceDocument(source);
58214
58214
  const el = findTargetElement(document2, target);
58215
- if (!el || !isHTMLElement(el)) return source;
58215
+ if (!el || !isHTMLElement(el)) return { html: source, matched: false };
58216
58216
  const htmlEl = el;
58217
58217
  for (const op of operations) {
58218
58218
  switch (op.type) {
@@ -58247,7 +58247,10 @@ function patchElementInHtml(source, target, operations) {
58247
58247
  break;
58248
58248
  }
58249
58249
  }
58250
- return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
58250
+ return {
58251
+ html: wrappedFragment ? document2.body.innerHTML || "" : document2.toString(),
58252
+ matched: true
58253
+ };
58251
58254
  }
58252
58255
  function probeElementInSource(source, target) {
58253
58256
  if (!target.id && !target.selector) return false;
@@ -58531,12 +58534,16 @@ function registerFileRoutes(api, adapter2) {
58531
58534
  } catch {
58532
58535
  return c3.json({ error: "not found" }, 404);
58533
58536
  }
58534
- return writeIfChanged(
58535
- c3,
58536
- ctx.absPath,
58537
+ const { html: patched, matched } = patchElementInHtml(
58537
58538
  originalContent,
58538
- patchElementInHtml(originalContent, parsed.target, parsed.body.operations)
58539
+ parsed.target,
58540
+ parsed.body.operations
58539
58541
  );
58542
+ if (patched === originalContent) {
58543
+ return c3.json({ ok: true, changed: false, matched, content: originalContent });
58544
+ }
58545
+ writeFileSync8(ctx.absPath, patched, "utf-8");
58546
+ return c3.json({ ok: true, changed: true, matched, content: patched });
58540
58547
  });
58541
58548
  api.post("/projects/:id/file-mutations/probe-element/*", async (c3) => {
58542
58549
  const ctx = await resolveFileMutationContext(c3, adapter2, "probe-element");
@@ -73083,7 +73090,8 @@ async function runCaptureStreamingStage(input2) {
73083
73090
  streamingEncoder = await spawnStreamingEncoder(
73084
73091
  videoOnlyPath,
73085
73092
  streamingEncoderOptions,
73086
- abortSignal
73093
+ abortSignal,
73094
+ cfg
73087
73095
  );
73088
73096
  assertNotAborted();
73089
73097
  } catch (err) {
@@ -81784,6 +81792,14 @@ async function renderDocker(projectDir, outputPath, options) {
81784
81792
  }
81785
81793
  async function renderLocal(projectDir, outputPath, options) {
81786
81794
  const producer = await loadProducer();
81795
+ if (!findFFmpeg()) {
81796
+ errorBox(
81797
+ "FFmpeg not found",
81798
+ "FFmpeg is required to encode video. The render cannot proceed without it.",
81799
+ getFFmpegInstallHint()
81800
+ );
81801
+ process.exit(1);
81802
+ }
81787
81803
  const startTime = Date.now();
81788
81804
  if (options.browserPath && !process.env.PRODUCER_HEADLESS_SHELL_PATH) {
81789
81805
  process.env.PRODUCER_HEADLESS_SHELL_PATH = options.browserPath;
@@ -81810,7 +81826,14 @@ async function renderLocal(projectDir, outputPath, options) {
81810
81826
  try {
81811
81827
  await producer.executeRenderJob(job, projectDir, outputPath, onProgress);
81812
81828
  } catch (error) {
81813
- handleRenderError(error, options, startTime, false, "Try --docker for containerized rendering");
81829
+ handleRenderError(
81830
+ error,
81831
+ options,
81832
+ startTime,
81833
+ false,
81834
+ "Try --docker for containerized rendering",
81835
+ job.failedStage
81836
+ );
81814
81837
  }
81815
81838
  const elapsed = Date.now() - startTime;
81816
81839
  trackRenderMetrics(job, elapsed, options, false);
@@ -81834,7 +81857,7 @@ function getMemorySnapshot() {
81834
81857
  memoryFreeMb: bytesToMb(freemem4())
81835
81858
  };
81836
81859
  }
81837
- function handleRenderError(error, options, startTime, docker, hint) {
81860
+ function handleRenderError(error, options, startTime, docker, hint, failedStage) {
81838
81861
  const message = normalizeErrorMessage2(error);
81839
81862
  trackRenderError({
81840
81863
  fps: fpsToNumber(options.fps),
@@ -81844,6 +81867,7 @@ function handleRenderError(error, options, startTime, docker, hint) {
81844
81867
  gpu: options.gpu,
81845
81868
  elapsedMs: Date.now() - startTime,
81846
81869
  errorMessage: message,
81870
+ failedStage,
81847
81871
  ...getMemorySnapshot()
81848
81872
  });
81849
81873
  errorBox("Render failed", message, hint);
@@ -81934,6 +81958,7 @@ var init_render2 = __esm({
81934
81958
  init_env();
81935
81959
  init_dockerRunArgs();
81936
81960
  init_errorMessage2();
81961
+ init_ffmpeg();
81937
81962
  init_src();
81938
81963
  examples7 = [
81939
81964
  ["Render to MP4", "hyperframes render --output output.mp4"],
@@ -82234,17 +82259,6 @@ var init_render2 = __esm({
82234
82259
  }
82235
82260
  console.log("");
82236
82261
  }
82237
- if (!useDocker) {
82238
- const { findFFmpeg: findFFmpeg2, getFFmpegInstallHint: getFFmpegInstallHint2 } = await Promise.resolve().then(() => (init_ffmpeg(), ffmpeg_exports));
82239
- if (!findFFmpeg2()) {
82240
- errorBox(
82241
- "FFmpeg not found",
82242
- "Rendering requires FFmpeg for video encoding.",
82243
- `Install: ${getFFmpegInstallHint2()}`
82244
- );
82245
- process.exit(1);
82246
- }
82247
- }
82248
82262
  let browserPath;
82249
82263
  if (!useDocker) {
82250
82264
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));