hyperframes 0.7.19 → 0.7.20

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.19" : "0.0.0-dev";
53
+ VERSION = true ? "0.7.20" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -65567,13 +65567,15 @@ function findRootTag(source) {
65567
65567
  function readAttr(tagSource, attr2) {
65568
65568
  if (!tagSource) return null;
65569
65569
  const escaped = attr2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
65570
- const match = tagSource.match(new RegExp(`\\b${escaped}\\s*=\\s*["']([^"']+)["']`, "i"));
65570
+ const match = tagSource.match(new RegExp(`(?<![\\w-])${escaped}\\s*=\\s*["']([^"']+)["']`, "i"));
65571
65571
  return match?.[1] || null;
65572
65572
  }
65573
65573
  function readJsonAttr(tagSource, attr2) {
65574
65574
  if (!tagSource) return null;
65575
65575
  const escaped = attr2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
65576
- const match = tagSource.match(new RegExp(`\\b${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i"));
65576
+ const match = tagSource.match(
65577
+ new RegExp(`(?<![\\w-])${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i")
65578
+ );
65577
65579
  if (!match) return null;
65578
65580
  return match[1] ?? match[2] ?? null;
65579
65581
  }
@@ -99121,6 +99123,17 @@ var init_captureStageError = __esm({
99121
99123
  }
99122
99124
  });
99123
99125
 
99126
+ // ../producer/src/services/render/captureBeyondViewport.ts
99127
+ function resolveVideoCaptureBeyondViewport(videoCount, browserGpuMode) {
99128
+ if (videoCount <= 0) return void 0;
99129
+ return browserGpuMode === "hardware";
99130
+ }
99131
+ var init_captureBeyondViewport = __esm({
99132
+ "../producer/src/services/render/captureBeyondViewport.ts"() {
99133
+ "use strict";
99134
+ }
99135
+ });
99136
+
99124
99137
  // ../producer/src/services/render/captureCost.ts
99125
99138
  import { join as join34 } from "path";
99126
99139
  function estimateCaptureCostMultiplier(compiled) {
@@ -100762,6 +100775,18 @@ function rewriteUnresolvableGsapToCdn(html, projectDir) {
100762
100775
  }
100763
100776
  );
100764
100777
  }
100778
+ function assignMissingMediaIds(html) {
100779
+ const { document: document2 } = parseHTML(html);
100780
+ const media = document2.querySelectorAll("video[data-start], audio[data-start]");
100781
+ let seq = 0;
100782
+ let changed = false;
100783
+ for (const el of Array.from(media)) {
100784
+ if (el.getAttribute("id")) continue;
100785
+ el.setAttribute("id", `hf-media-${seq++}`);
100786
+ changed = true;
100787
+ }
100788
+ return changed ? document2.toString() : html;
100789
+ }
100765
100790
  async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
100766
100791
  const rawHtml = rewriteUnresolvableGsapToCdn(readFileSync23(htmlPath, "utf-8"), projectDir);
100767
100792
  const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
@@ -100827,7 +100852,11 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
100827
100852
  defaultLogger.info(`[Compiler] Prepared ${preparedGifs.length} animated GIF input(s) as WebM`);
100828
100853
  }
100829
100854
  const embeddedHtml = await embedLocalFontFaces(htmlWithPreparedGifs, projectDir);
100830
- const { html, externalAssets } = collectExternalAssets(embeddedHtml, projectDir);
100855
+ const { html: htmlBeforeMediaIds, externalAssets } = collectExternalAssets(
100856
+ embeddedHtml,
100857
+ projectDir
100858
+ );
100859
+ const html = assignMissingMediaIds(htmlBeforeMediaIds);
100831
100860
  for (const [relPath, absPath] of remoteMediaAssets) {
100832
100861
  externalAssets.set(relPath, absPath);
100833
100862
  }
@@ -104896,6 +104925,15 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
104896
104925
  }
104897
104926
  const framesDir = join49(workDir, "captured-frames");
104898
104927
  if (!existsSync43(framesDir)) mkdirSync23(framesDir, { recursive: true });
104928
+ const resolvedBrowserGpuMode = await resolveBrowserGpuMode(cfg.browserGpuMode, {
104929
+ chromePath: resolveHeadlessShellPath(cfg),
104930
+ browserTimeout: cfg.browserTimeout
104931
+ });
104932
+ updateCaptureObservability({ browserGpuMode: resolvedBrowserGpuMode });
104933
+ const videoCaptureBeyondViewport = resolveVideoCaptureBeyondViewport(
104934
+ composition.videos.length,
104935
+ resolvedBrowserGpuMode
104936
+ );
104899
104937
  const captureOptions = {
104900
104938
  width,
104901
104939
  height,
@@ -104904,7 +104942,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
104904
104942
  quality: needsAlpha ? void 0 : job.config.quality === "draft" ? 80 : 95,
104905
104943
  variables: job.config.variables,
104906
104944
  deviceScaleFactor,
104907
- ...composition.videos.length > 0 ? { captureBeyondViewport: true } : {}
104945
+ ...videoCaptureBeyondViewport !== void 0 ? { captureBeyondViewport: videoCaptureBeyondViewport } : {}
104908
104946
  };
104909
104947
  resolvedCaptureBeyondViewport = captureOptions.captureBeyondViewport ?? resolvedCaptureBeyondViewport;
104910
104948
  if (resolvedCaptureBeyondViewport !== void 0) {
@@ -105425,6 +105463,7 @@ var init_renderOrchestrator = __esm({
105425
105463
  init_hdrMode();
105426
105464
  init_perfSummary();
105427
105465
  init_captureStageError();
105466
+ init_captureBeyondViewport();
105428
105467
  init_captureCost();
105429
105468
  init_observability();
105430
105469
  init_compileStage();
@@ -107260,6 +107299,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
107260
107299
  rebuildExtractedFramesFromPlanDir(planDir, planVideos.extracted)
107261
107300
  )
107262
107301
  ) : null;
107302
+ const videoCaptureBeyondViewport = resolveVideoCaptureBeyondViewport(
107303
+ planVideos?.videos.length ?? 0,
107304
+ "software"
107305
+ );
107263
107306
  const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes2(4).toString("hex")}`;
107264
107307
  mkdirSync27(workDir, { recursive: true });
107265
107308
  const framesDir = join57(workDir, "captured-frames");
@@ -107286,7 +107329,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
107286
107329
  // declare `data-composition-variables` leave this undefined and the
107287
107330
  // engine skips the `evaluateOnNewDocument` injection.
107288
107331
  variables: encoder.variables,
107289
- ...(planVideos?.videos.length ?? 0) > 0 ? { captureBeyondViewport: true } : {},
107332
+ ...videoCaptureBeyondViewport !== void 0 ? { captureBeyondViewport: videoCaptureBeyondViewport } : {},
107290
107333
  // lock the BeginFrame warmup loop to a fixed iteration count so
107291
107334
  // `beginFrameTimeTicks` is host-independent. Only chunks ever set this.
107292
107335
  lockWarmupTicks: true
@@ -107454,6 +107497,7 @@ var init_renderChunk = __esm({
107454
107497
  init_logger();
107455
107498
  init_encodeStage();
107456
107499
  init_captureStage();
107500
+ init_captureBeyondViewport();
107457
107501
  init_freezePlan();
107458
107502
  init_planHash();
107459
107503
  init_runtimeEnvSnapshot();
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-DXWeH-EY.js";/*!
1
+ import{n as Qi}from"./index-WxXW8fW3.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
@@ -1 +1 @@
1
- import{g as P}from"./index-DXWeH-EY.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-WxXW8fW3.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};