@hyperframes/producer 0.9.58 → 0.9.59

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.
@@ -4065,7 +4065,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
4065
4065
  {},
4066
4066
  variableOverrides
4067
4067
  );
4068
- return emitted ? document2.toString() : html;
4068
+ return { html: emitted ? document2.toString() : html, variablesByComp: {} };
4069
4069
  }
4070
4070
  const hostIdentityByElement = new ProducerHostIdentityMap(
4071
4071
  document2,
@@ -4179,7 +4179,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
4179
4179
  variableOverrides
4180
4180
  );
4181
4181
  assignMediaRenderIds(document2);
4182
- return document2.toString();
4182
+ return { html: document2.toString(), variablesByComp: result.variablesByComp };
4183
4183
  }
4184
4184
  function ensureFullDocument(html) {
4185
4185
  const trimmed = html.trim();
@@ -4773,7 +4773,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
4773
4773
  assetRoot
4774
4774
  );
4775
4775
  const fullHtml = ensureFullDocument(compiledHtml);
4776
- const inlinedHtml = inlineSubCompositions(
4776
+ const { html: inlinedHtml, variablesByComp } = inlineSubCompositions(
4777
4777
  fullHtml,
4778
4778
  subCompositions,
4779
4779
  projectDir,
@@ -4926,6 +4926,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
4926
4926
  gradedCanvas,
4927
4927
  ...masterFxChain ? { masterFxChain } : {},
4928
4928
  unresolvedCompositions,
4929
+ variablesByComp,
4929
4930
  externalAssets,
4930
4931
  width,
4931
4932
  height,
@@ -5568,15 +5569,22 @@ function hasAutoStartVideos(html) {
5568
5569
  const { document: document2 } = parseHTML6(html);
5569
5570
  return document2.querySelector("video[data-hf-auto-start]") !== null;
5570
5571
  }
5571
- function variableHasValue(element, variableId, variables) {
5572
+ function scopedVariablesFor(element, variablesByComp) {
5573
+ const scope = element.closest("[data-composition-id]");
5574
+ const compId = scope?.getAttribute("data-composition-id")?.trim() ?? "";
5575
+ return compId && Object.hasOwn(variablesByComp, compId) ? variablesByComp[compId] : void 0;
5576
+ }
5577
+ function variableHasValue(element, variableId, variables, variablesByComp) {
5572
5578
  if (variables && Object.hasOwn(variables, variableId)) return true;
5579
+ const scoped = scopedVariablesFor(element, variablesByComp);
5580
+ if (scoped) return Object.hasOwn(scoped, variableId);
5573
5581
  for (let scope = element.parentElement; scope; scope = scope.parentElement) {
5574
5582
  if (Object.hasOwn(parseHostVariableValues2(scope), variableId)) return true;
5575
5583
  if (Object.hasOwn(readDeclaredDefaults2(scope), variableId)) return true;
5576
5584
  }
5577
5585
  return Object.hasOwn(readDeclaredDefaults2(element.ownerDocument.documentElement), variableId);
5578
5586
  }
5579
- function hasVariableBoundMedia(html, variables) {
5587
+ function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
5580
5588
  const { document: document2 } = parseHTML6(html);
5581
5589
  return Array.from(
5582
5590
  document2.querySelectorAll(
@@ -5584,7 +5592,7 @@ function hasVariableBoundMedia(html, variables) {
5584
5592
  )
5585
5593
  ).some((element) => {
5586
5594
  const variableId = element.getAttribute("data-var-src")?.trim();
5587
- return Boolean(variableId && variableHasValue(element, variableId, variables));
5595
+ return Boolean(variableId && variableHasValue(element, variableId, variables, variablesByComp));
5588
5596
  });
5589
5597
  }
5590
5598
  function authoredMediaStarts(html) {
@@ -5699,7 +5707,11 @@ async function runProbeStage(input) {
5699
5707
  compiled.html,
5700
5708
  composition.audios.length
5701
5709
  );
5702
- const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
5710
+ const hasVariableMedia = hasVariableBoundMedia(
5711
+ compiled.html,
5712
+ job.config.variables,
5713
+ compiled.variablesByComp
5714
+ );
5703
5715
  const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
5704
5716
  const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
5705
5717
  durationSeconds: composition.duration,
@@ -6772,7 +6784,8 @@ import {
6772
6784
  audioFailureDiagnostics,
6773
6785
  processCompositionAudio,
6774
6786
  removeScratch as removeScratch2,
6775
- collectScratchLeftovers
6787
+ collectScratchLeftovers,
6788
+ withFfmpegProgress
6776
6789
  } from "@hyperframes/engine";
6777
6790
 
6778
6791
  // src/services/render/audioDeliveryLimit.ts
@@ -6798,7 +6811,8 @@ import {
6798
6811
  removeScratch,
6799
6812
  renameWithRetry as renameWithRetry5,
6800
6813
  runFfmpeg as runFfmpeg5,
6801
- trackChildProcess
6814
+ trackChildProcess,
6815
+ withPublicOnlyProxy
6802
6816
  } from "@hyperframes/engine";
6803
6817
  import { redactKnownPaths, redactTelemetryString as redactTelemetryString3 } from "@hyperframes/core";
6804
6818
 
@@ -7240,7 +7254,17 @@ async function runFfprobeJson(args, signal) {
7240
7254
  if (!args.includes("--")) {
7241
7255
  throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".');
7242
7256
  }
7257
+ const proxying = withPublicOnlyProxy(args, [args.indexOf("--") + 1]);
7258
+ const routed = proxying && await proxying;
7259
+ try {
7260
+ return await spawnFfprobeJson(routed?.args ?? args, routed?.env, signal);
7261
+ } finally {
7262
+ await routed?.close();
7263
+ }
7264
+ }
7265
+ async function spawnFfprobeJson(args, env, signal) {
7243
7266
  const proc = spawn(getFfprobeBinary(), args, {
7267
+ ...env && { env },
7244
7268
  stdio: ["ignore", "pipe", "pipe"],
7245
7269
  windowsHide: true
7246
7270
  });
@@ -7356,7 +7380,8 @@ function assertAudioNotInterrupted(failures) {
7356
7380
  }
7357
7381
  function runAudioStage(input) {
7358
7382
  return collectScratchLeftovers(
7359
- () => runAudioStageScoped(input),
7383
+ () => withFfmpegProgress(input.onFfmpegProgress ?? (() => {
7384
+ }), () => runAudioStageScoped(input)),
7360
7385
  (left) => {
7361
7386
  if (left.length > 0) input.log?.warn("[audio] scratch left behind", { count: left.length });
7362
7387
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "5b6b258d6319d6e228d848c20a813a33202e00efb7a2de68a626610db8d68a8e",
4
+ "sha256": "73bf2dda8476c060c49e37754736b20068b99580b654d5fe44f5918fc63eeaa8",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"