@hyperframes/producer 0.9.102 → 0.9.104

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.
@@ -23,7 +23,7 @@ import {
23
23
  existsSync as existsSync26,
24
24
  fstatSync as fstatSync5,
25
25
  lstatSync as lstatSync4,
26
- mkdirSync as mkdirSync15,
26
+ mkdirSync as mkdirSync16,
27
27
  openSync as openSync7,
28
28
  statSync as statSync12,
29
29
  mkdtempSync,
@@ -52,7 +52,7 @@ import { foreignWritablePath } from "@hyperframes/core/cache-dir";
52
52
  import { audioFailureDiagnostics as audioFailureDiagnostics2, cpuBudget } from "@hyperframes/engine";
53
53
  import {
54
54
  existsSync as existsSync22,
55
- mkdirSync as mkdirSync14,
55
+ mkdirSync as mkdirSync15,
56
56
  readdirSync as readdirSync6,
57
57
  rmSync as rmSync13,
58
58
  statSync as statSync10,
@@ -523,7 +523,7 @@ function servedPath(urlPath) {
523
523
  }
524
524
 
525
525
  // src/generated/hf-early-stub-inline.ts
526
- var HF_EARLY_STUB_IIFE = '"use strict";(()=>{var x=100,b=[],s=[],c=!1,w=!1,h=new Set;function _(n){let o=window.__HF_VIRTUAL_TIME__?.originalRequestAnimationFrame;return typeof o=="function"?o(n):requestAnimationFrame(n)}function O(n){let o=window.__HF_VIRTUAL_TIME__?.originalSetTimeout;if(typeof o=="function"){o(n,0);return}setTimeout(n,0)}function v(n){return n!==null&&typeof n=="object"&&"__hfIsProxy"in n?n.__hfReal:n}function m(n,o){n!=="add"&&A(o)}function p(n){if(n===null||typeof n!="object"||Array.isArray(n))return!1;let o=n;return"rotationX"in o||"rotationY"in o||"transformPerspective"in o}var d=new Set;function A(n){let o=n[0];if(o==null)return;let e=window;d.has(o)||(d.add(o),e.__hfAllTweenTargets=Array.from(d)),(p(n[1])||p(n[2]))&&(h.add(o),e.__hf3dTweenTargets=Array.from(h))}function y(n){let o=n.proxy.__hfReal,e=o[n.method];if(typeof e=="function"){let i=n.method==="add"?n.args.map(v):n.args;e.call(o,...i)}}function l(n,o,e){m(o,e);let i={proxy:n,method:o,args:e};return n.__hfQueue.push(i),s.push(i),R(),n}function g(n){let o=n.proxy.__hfQueue.indexOf(n);o>=0&&n.proxy.__hfQueue.splice(o,1)}function t(){for(;s.length>0;){let n=s.shift();n&&(g(n),y(n))}S()}function k(){w=!1,window.__hfTimelinesBuilding=!1;try{window.dispatchEvent(new CustomEvent("hf-timelines-built"))}catch{}}function S(){w||(w=!0,O(()=>{s.length===0?k():w=!1}))}function P(){c=!1;let n=s.splice(0,x);for(let o of n)g(o),y(o);s.length>0?(c=!0,_(P)):k()}function R(){c||(c=!0,window.__hfTimelinesBuilding=!0,_(P))}var I=new Set(["to","from","fromTo","set","add"]);function G(n,o){let e=o;for(;e!==null&&e!==Object.prototype;){for(let i of Object.getOwnPropertyNames(e)){if(i==="constructor"||i==="then"||i in n||I.has(i)||i.charAt(0)==="_")continue;let a=Object.getOwnPropertyDescriptor(e,i);if(!a||typeof a.value!="function")continue;let u=a.value;n[i]=function(...r){t();let f=u.call(o,...r);return f===o?n:f}}e=Object.getPrototypeOf(e)}}function B(n){let o={__hfReal:n,__hfQueue:[],__hfIsProxy:!0,to(...e){return l(o,"to",e)},from(...e){return l(o,"from",e)},fromTo(...e){return l(o,"fromTo",e)},set(...e){return l(o,"set",e)},add(...e){return l(o,"add",e)},pause(...e){return t(),n.pause(...e),o},play(...e){return t(),n.play(...e),o},seek(...e){return t(),n.seek(...e),o},totalTime(...e){return t(),e.length>0?(n.totalTime(...e),o):n.totalTime()},time(...e){return t(),e.length>0?(n.time(...e),o):n.time()},duration(...e){return t(),e.length>0?(n.duration(...e),o):n.duration()},getChildren(...e){t();let i=n.getChildren(...e);return Array.isArray(i)?i:[]},paused(...e){return t(),e.length>0?(n.paused(...e),o):n.paused()},timeScale(...e){return t(),e.length>0?(n.timeScale(...e),o):n.timeScale()},kill(){t(),n.kill()}};return G(o,n),b.push(o),o}if(typeof window<"u"){window.__hf||(window.__hf={}),window.__hfTimelinesBuilding=!1,window.__hfFlushSync=()=>{t(),s.length===0&&window.__hfTimelinesBuilding&&k()};let n=null,o=new WeakSet;try{Object.defineProperty(window,"gsap",{configurable:!0,enumerable:!0,get(){return n},set(e){if(n=e,!e||typeof e.timeline!="function"||o.has(e))return;o.add(e);let i=e.timeline.bind(e);e.timeline=u=>B(i(u));for(let u of["to","from","set"]){let r=e[u];if(typeof r!="function")continue;let f=r.bind(e);e[u]=(...T)=>(m(u,T),f(...T))}let a=e.fromTo;if(typeof a=="function"){let u=a.bind(e);e.fromTo=(...r)=>(m("fromTo",r),u(...r))}}})}catch{}}})();\n';
526
+ var HF_EARLY_STUB_IIFE = '"use strict";(()=>{var b=100,A=[],s=[],c=!1,l=!1,k=new Set;function h(n){let e=window.__HF_VIRTUAL_TIME__?.originalRequestAnimationFrame;return typeof e=="function"?e(n):requestAnimationFrame(n)}function P(n){let e=window.__HF_VIRTUAL_TIME__?.originalSetTimeout;if(typeof e=="function"){e(n,0);return}setTimeout(n,0)}function v(n){return n!==null&&typeof n=="object"&&"__hfIsProxy"in n?n.__hfReal:n}function d(n,e){n!=="add"&&x(e)}function T(n){if(n===null||typeof n!="object"||Array.isArray(n))return!1;let e=n;return"rotationX"in e||"rotationY"in e||"transformPerspective"in e}var w=new Set;function x(n){let e=n[0];if(e==null)return;let o=window;w.has(e)||(w.add(e),o.__hfAllTweenTargets=Array.from(w)),(T(n[1])||T(n[2]))&&(k.add(e),o.__hf3dTweenTargets=Array.from(k))}function _(n){let e=n.proxy.__hfReal,o=e[n.method];if(typeof o=="function"){let i=n.method==="add"?n.args.map(v):n.args;o.call(e,...i)}}function S(n,e,o){d(e,o);let i={proxy:n,method:e,args:o};return n.__hfQueue.push(i),s.push(i),E(),n}function y(n){let e=n.proxy.__hfQueue.indexOf(n);e>=0&&n.proxy.__hfQueue.splice(e,1)}function a(){for(;s.length>0;){let n=s.shift();n&&(y(n),_(n))}R()}function m(){l=!1,window.__hfTimelinesBuilding=!1;try{window.dispatchEvent(new CustomEvent("hf-timelines-built"))}catch{}}function R(){l||(l=!0,P(()=>{s.length===0?m():l=!1}))}function g(){c=!1;let n=s.splice(0,b);for(let e of n)y(e),_(e);s.length>0?(c=!0,h(g)):m()}function E(){c||(c=!0,window.__hfTimelinesBuilding=!0,h(g))}var O=["to","from","fromTo","set","add"],I=new Set(O),C=["pause","play","seek"],G=["totalTime","time","duration","paused","timeScale"];function B(n,e){let o=e;for(;o!==null&&o!==Object.prototype;){for(let i of Object.getOwnPropertyNames(o)){if(i==="constructor"||i==="then"||i in n||I.has(i)||i.charAt(0)==="_")continue;let u=Object.getOwnPropertyDescriptor(o,i);if(!u||typeof u.value!="function")continue;let r=u.value;n[i]=function(...t){a();let f=r.call(e,...t);return f===e?n:f}}o=Object.getPrototypeOf(o)}}function M(n){let e={__hfReal:n,__hfQueue:[],__hfIsProxy:!0};for(let o of O)typeof n[o]=="function"&&(e[o]=(...i)=>S(e,o,i));for(let o of C)typeof n[o]=="function"&&(e[o]=(...i)=>(a(),n[o].apply(n,i),e));for(let o of G)typeof n[o]=="function"&&(e[o]=(...i)=>{a();let u=n[o];return i.length>0?(u.apply(n,i),e):u.call(n)});return typeof n.getChildren=="function"&&(e.getChildren=(...o)=>{a();let i=n.getChildren(...o);return Array.isArray(i)?i:[]}),typeof n.kill=="function"&&(e.kill=()=>{a(),n.kill()}),B(e,n),A.push(e),e}if(typeof window<"u"){window.__hf||(window.__hf={}),window.__hfTimelinesBuilding=!1,window.__hfFlushSync=()=>{a(),s.length===0&&window.__hfTimelinesBuilding&&m()};let n=null,e=new WeakSet;try{Object.defineProperty(window,"gsap",{configurable:!0,enumerable:!0,get(){return n},set(o){if(n=o,!o||typeof o.timeline!="function"||e.has(o))return;e.add(o);let i=o.timeline.bind(o);o.timeline=r=>{let t=i(r);return t&&(typeof t=="object"||typeof t=="function")?M(t):t};for(let r of["to","from","set"]){let t=o[r];if(typeof t!="function")continue;let f=t.bind(o);o[r]=(...p)=>(d(r,p),f(...p))}let u=o.fromTo;if(typeof u=="function"){let r=u.bind(o);o.fromTo=(...t)=>(d("fromTo",t),r(...t))}}})}catch{}}})();\n';
527
527
  function getHfEarlyStub() {
528
528
  return HF_EARLY_STUB_IIFE;
529
529
  }
@@ -2123,6 +2123,7 @@ var RenderExecutionContext = class {
2123
2123
  // src/services/render/artifactTransaction.ts
2124
2124
  import { closeSync as closeSync2, existsSync as existsSync6, fstatSync as fstatSync2, openSync as openSync2, readSync, readdirSync as readdirSync2, rmSync as rmSync3 } from "node:fs";
2125
2125
  import { basename as basename5, dirname as dirname4, extname as extname2, join as join6, resolve as resolve5 } from "node:path";
2126
+ import { toWin32LongPath as toWin32LongPath2 } from "@hyperframes/core/atomic-file";
2126
2127
  import { HLS_MASTER_PLAYLIST, HLS_VIDEO_PLAYLIST, renameWithRetry } from "@hyperframes/engine";
2127
2128
 
2128
2129
  // src/utils/ffprobe.ts
@@ -2136,6 +2137,7 @@ import {
2136
2137
  import {
2137
2138
  existsSync as existsSync5,
2138
2139
  lstatSync as lstatSync2,
2140
+ mkdirSync as mkdirSync2,
2139
2141
  readFileSync as readFileSync2,
2140
2142
  readdirSync,
2141
2143
  readlinkSync as readlinkSync2,
@@ -2146,7 +2148,7 @@ import { execFileSync } from "node:child_process";
2146
2148
  import { hostname, uptime } from "node:os";
2147
2149
  import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
2148
2150
  import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
2149
- import { createStagingDir } from "@hyperframes/core/atomic-file";
2151
+ import { createStagingDir, toWin32LongPath } from "@hyperframes/core/atomic-file";
2150
2152
  var OWNER_FILE = "owner.json";
2151
2153
  var TRANSACTION_BACKUP = "backup";
2152
2154
  var machineIdRead;
@@ -2199,7 +2201,7 @@ function pidScope() {
2199
2201
  function createOwnedRenderDir(prefix) {
2200
2202
  const dir = createStagingDir(dirname3(prefix), basename4(prefix));
2201
2203
  const owner = { pid: process.pid, ...pidScope() };
2202
- writeFileSync2(join5(dir, OWNER_FILE), JSON.stringify(owner));
2204
+ writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(owner));
2203
2205
  return dir;
2204
2206
  }
2205
2207
  function alive(pid) {
@@ -2267,7 +2269,9 @@ function listAbandonedRenderDirs(parent, options = {}) {
2267
2269
  return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) => join5(parent, name)).filter((dir) => isAbandoned(dir, options.ownerlessIdleMs, now));
2268
2270
  }
2269
2271
  function createRenderWorkDir(prefix, outputDir) {
2270
- for (const parent of /* @__PURE__ */ new Set([outputDir, dirname3(prefix)])) {
2272
+ const workParent = dirname3(prefix);
2273
+ mkdirSync2(toWin32LongPath(workParent), { recursive: true });
2274
+ for (const parent of /* @__PURE__ */ new Set([outputDir, workParent])) {
2271
2275
  for (const dir of listAbandonedRenderDirs(parent)) {
2272
2276
  try {
2273
2277
  rmSync2(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
@@ -2280,9 +2284,9 @@ function createRenderWorkDir(prefix, outputDir) {
2280
2284
 
2281
2285
  // src/services/render/artifactTransaction.ts
2282
2286
  var defaultFileSystem = {
2283
- existsSync: existsSync6,
2284
- renameSync: (source, destination) => renameWithRetry(source, destination),
2285
- rmSync: rmSync3
2287
+ existsSync: (path) => existsSync6(toWin32LongPath2(path)),
2288
+ renameSync: (source, destination) => renameWithRetry(toWin32LongPath2(source), toWin32LongPath2(destination)),
2289
+ rmSync: (path, options) => rmSync3(toWin32LongPath2(path), options)
2286
2290
  };
2287
2291
  async function defaultArtifactDurationProbe(path) {
2288
2292
  const meta = await extractMediaMetadata(path);
@@ -2310,14 +2314,28 @@ function buildArtifactExpectation(input) {
2310
2314
  requiredFiles: [HLS_MASTER_PLAYLIST]
2311
2315
  };
2312
2316
  }
2317
+ var WINDOWS_PATH_LIMIT = 259;
2318
+ var TRANSACTION_SUFFIX = ".hf-transaction-";
2319
+ var TRANSACTION_RANDOM_LEN = 6;
2320
+ var SHORT_TRANSACTION_STEM = "hf";
2321
+ function transactionStem(parent, name, rawStem) {
2322
+ const overhead = parent.length + 1 + 1 + TRANSACTION_SUFFIX.length + TRANSACTION_RANDOM_LEN + 1 + name.length;
2323
+ const maxStem = WINDOWS_PATH_LIMIT - overhead;
2324
+ if (rawStem.length <= maxStem) return rawStem;
2325
+ if (maxStem < SHORT_TRANSACTION_STEM.length) return SHORT_TRANSACTION_STEM;
2326
+ const trimmed = rawStem.slice(0, maxStem).replace(/[\uD800-\uDBFF]$/, "").replace(/[. ]+$/, "");
2327
+ return trimmed || SHORT_TRANSACTION_STEM;
2328
+ }
2313
2329
  function createSiblingTransactionDirectory(destination) {
2314
2330
  const parent = dirname4(destination);
2331
+ const name = basename5(destination);
2315
2332
  const extension = extname2(destination);
2316
- const stem = extension ? basename5(destination, extension) : basename5(destination);
2317
- return createOwnedRenderDir(join6(parent, `.${stem}.hf-transaction-`));
2333
+ const rawStem = extension ? basename5(destination, extension) : name;
2334
+ const stem = transactionStem(parent, name, rawStem);
2335
+ return createOwnedRenderDir(join6(parent, `.${stem}${TRANSACTION_SUFFIX}`));
2318
2336
  }
2319
2337
  function assertReadableNonEmptyFile(path) {
2320
- const fd = openSync2(path, "r");
2338
+ const fd = openSync2(toWin32LongPath2(path), "r");
2321
2339
  try {
2322
2340
  const stat = fstatSync2(fd);
2323
2341
  if (!stat.isFile() || stat.size <= 0) {
@@ -2331,7 +2349,7 @@ function assertReadableNonEmptyFile(path) {
2331
2349
  function collectDirectoryFiles(root) {
2332
2350
  const files = [];
2333
2351
  const visit = (directory) => {
2334
- for (const entry of readdirSync2(directory, { withFileTypes: true })) {
2352
+ for (const entry of readdirSync2(toWin32LongPath2(directory), { withFileTypes: true })) {
2335
2353
  const path = join6(directory, entry.name);
2336
2354
  if (entry.isDirectory()) visit(path);
2337
2355
  else if (entry.isFile()) files.push(path);
@@ -2434,7 +2452,7 @@ var ArtifactTransaction = class {
2434
2452
  async assertDirectoryExpectation(expected, files) {
2435
2453
  for (const required of expected.requiredFiles ?? []) {
2436
2454
  const path = join6(this.stagingPath, required);
2437
- if (!existsSync6(path)) {
2455
+ if (!existsSync6(toWin32LongPath2(path))) {
2438
2456
  throw new Error(`Render artifact directory is missing ${required}: ${this.stagingPath}`);
2439
2457
  }
2440
2458
  assertReadableNonEmptyFile(path);
@@ -2683,7 +2701,7 @@ function replanAfterFailure(plan, failure) {
2683
2701
  }
2684
2702
 
2685
2703
  // src/services/render/stages/captureSegmentedStage.ts
2686
- import { existsSync as existsSync7, mkdirSync as mkdirSync4, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
2704
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
2687
2705
  import { join as join12 } from "node:path";
2688
2706
  import {
2689
2707
  captureFrameToBuffer as captureFrameToBuffer2,
@@ -3607,7 +3625,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
3607
3625
  }
3608
3626
 
3609
3627
  // src/services/render/stages/captureHdrResources.ts
3610
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync3, statfsSync } from "node:fs";
3628
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync3, statfsSync } from "node:fs";
3611
3629
  import {
3612
3630
  decodePngToRgb48le,
3613
3631
  extractMediaMetadata as extractMediaMetadata2,
@@ -3937,7 +3955,7 @@ async function extractHdrVideoFrames(args) {
3937
3955
  const resolveFinalFrameExtractionWindowImpl = args.resolveFinalFrameExtractionWindowImpl ?? resolveFinalFrameExtractionWindow;
3938
3956
  const fps = fpsToNumber3(job.config.fps);
3939
3957
  const out = /* @__PURE__ */ new Map();
3940
- mkdirSync2(framesDir, { recursive: true });
3958
+ mkdirSync3(framesDir, { recursive: true });
3941
3959
  let scratchBytes = 0;
3942
3960
  const extractionWindows = /* @__PURE__ */ new Map();
3943
3961
  for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
@@ -3973,7 +3991,7 @@ async function extractHdrVideoFrames(args) {
3973
3991
  const planned = extractionWindows.get(videoId);
3974
3992
  if (!video || !planned) continue;
3975
3993
  const { window: window2, metadata } = planned;
3976
- mkdirSync2(framesDir, { recursive: true });
3994
+ mkdirSync3(framesDir, { recursive: true });
3977
3995
  const frameDir = createStagingDir2(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`);
3978
3996
  createdFrameDirs.add(frameDir);
3979
3997
  const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
@@ -4459,7 +4477,7 @@ import {
4459
4477
  createReadStream as createReadStream2,
4460
4478
  fstatSync as fstatSync3,
4461
4479
  lstatSync as lstatSync3,
4462
- mkdirSync as mkdirSync3,
4480
+ mkdirSync as mkdirSync4,
4463
4481
  openSync as openSync4,
4464
4482
  readFileSync as readFileSync4
4465
4483
  } from "node:fs";
@@ -4577,7 +4595,7 @@ async function hashSegmentFile(path) {
4577
4595
  return hash.digest("hex");
4578
4596
  }
4579
4597
  function writeSegmentManifest(segmentDir, manifest, key) {
4580
- mkdirSync3(segmentDir, { recursive: true });
4598
+ mkdirSync4(segmentDir, { recursive: true });
4581
4599
  replaceFileAtomically(
4582
4600
  join10(segmentDir, MANIFEST_FILENAME),
4583
4601
  JSON.stringify(signSegmentManifest(manifest, key), null, 2),
@@ -5817,7 +5835,7 @@ async function runCaptureSegmentedStage(input) {
5817
5835
  const deps = { ...DEFAULT_DEPS, ...input.deps };
5818
5836
  const segments = planSegments(input.totalFrames, input.segmentFrames);
5819
5837
  const segmentDir = input.segmentDir ?? join12(input.workDir, "segments");
5820
- mkdirSync4(segmentDir, { recursive: true });
5838
+ mkdirSync5(segmentDir, { recursive: true });
5821
5839
  const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
5822
5840
  const pending = segments.filter((s) => !skip.has(s.index));
5823
5841
  for (const index of skip) log.info("[Render] segment skipped (resume)", { index });
@@ -6342,7 +6360,7 @@ function checkPageNeverReady(input) {
6342
6360
  }
6343
6361
 
6344
6362
  // src/services/render/deferredVideoFrames.ts
6345
- import { mkdirSync as mkdirSync5, rmSync as rmSync7 } from "node:fs";
6363
+ import { mkdirSync as mkdirSync6, rmSync as rmSync7 } from "node:fs";
6346
6364
  import { dirname as dirname5, join as join14 } from "node:path";
6347
6365
  import {
6348
6366
  createFrameLookupTable,
@@ -6445,7 +6463,7 @@ async function extractAllDeferredFrames(extracted, input) {
6445
6463
  maxTransientRetries: input.maxTransientRetries,
6446
6464
  onRetry: () => {
6447
6465
  rmSync7(video.outputDir, { recursive: true, force: true });
6448
- mkdirSync5(video.outputDir, { recursive: true });
6466
+ mkdirSync6(video.outputDir, { recursive: true });
6449
6467
  }
6450
6468
  }
6451
6469
  );
@@ -6536,7 +6554,7 @@ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
6536
6554
  }
6537
6555
 
6538
6556
  // src/services/render/segmentVideoFrames.ts
6539
- import { mkdirSync as mkdirSync6, rmSync as rmSync8 } from "node:fs";
6557
+ import { mkdirSync as mkdirSync7, rmSync as rmSync8 } from "node:fs";
6540
6558
  import { join as join15 } from "node:path";
6541
6559
  import {
6542
6560
  createFrameLookupTable as createFrameLookupTable2,
@@ -6595,7 +6613,7 @@ function createSegmentVideoFrames(input) {
6595
6613
  const release = () => rmSync8(dir, { recursive: true, force: true });
6596
6614
  try {
6597
6615
  release();
6598
- mkdirSync6(dir, { recursive: true });
6616
+ mkdirSync7(dir, { recursive: true });
6599
6617
  const table = await tableFor([...frames], dir);
6600
6618
  return { injector: () => createVideoFrameInjector(table, input.injectorOptions), release };
6601
6619
  } catch (error) {
@@ -6624,7 +6642,7 @@ function createSegmentVideoFrames(input) {
6624
6642
  folder = dir;
6625
6643
  try {
6626
6644
  rmSync8(dir, { recursive: true, force: true });
6627
- mkdirSync6(dir, { recursive: true });
6645
+ mkdirSync7(dir, { recursive: true });
6628
6646
  injector = await injectorFor(
6629
6647
  Array.from(
6630
6648
  { length: segment.endFrame - segment.startFrame },
@@ -6793,7 +6811,7 @@ function resolveVideoCaptureBeyondViewport(videoCount) {
6793
6811
  }
6794
6812
 
6795
6813
  // src/services/render/gpuChoice.ts
6796
- import { mkdirSync as mkdirSync7, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
6814
+ import { mkdirSync as mkdirSync8, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
6797
6815
  import { dirname as dirname6 } from "node:path";
6798
6816
  function gpuChoiceStore(cfg, gpu) {
6799
6817
  if (!cfg.gpuChoiceFile || !cfg.hyperframesVersion || !gpu) return void 0;
@@ -6810,7 +6828,7 @@ function readGpuChoice(store) {
6810
6828
  return record.mode === "software" || record.mode === "hardware" ? record.mode : void 0;
6811
6829
  }
6812
6830
  function writeGpuChoice(store, mode, measured) {
6813
- mkdirSync7(dirname6(store.file), { recursive: true });
6831
+ mkdirSync8(dirname6(store.file), { recursive: true });
6814
6832
  const temp = `${store.file}.${process.pid}.tmp`;
6815
6833
  const record = { key: store.key, mode, ...measured, measuredAt: (/* @__PURE__ */ new Date()).toISOString() };
6816
6834
  writeFileSync3(temp, `${JSON.stringify(record, null, 2)}
@@ -7369,9 +7387,10 @@ import {
7369
7387
  stylesheetLinkMatches
7370
7388
  } from "@hyperframes/parsers/css-url-scans";
7371
7389
  import { createHash as createHash6 } from "node:crypto";
7372
- import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync10, readFileSync as readFileSync9, statSync as statSync8 } from "fs";
7390
+ import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync8 } from "fs";
7373
7391
  import { join as join21, dirname as dirname10, resolve as resolve8, basename as basename6, relative as relative3, sep as sep4 } from "path";
7374
7392
  import { parseHTML as parseHTML5 } from "@hyperframes/parsers/linkedom";
7393
+ import { compositionRootSize } from "@hyperframes/parsers";
7375
7394
 
7376
7395
  // src/services/bundledScripts.ts
7377
7396
  import { existsSync as existsSync8, readFileSync as readFileSync6 } from "node:fs";
@@ -7657,7 +7676,7 @@ import {
7657
7676
 
7658
7677
  // src/services/animatedGifPrep.ts
7659
7678
  import { createHash as createHash4, randomUUID } from "node:crypto";
7660
- import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync8, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync6 } from "node:fs";
7679
+ import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync6 } from "node:fs";
7661
7680
  import { dirname as dirname7, isAbsolute as isAbsolute3, join as join18, resolve as resolve6 } from "node:path";
7662
7681
  import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
7663
7682
  import { parseAnimatedGifMetadata } from "@hyperframes/core";
@@ -7845,10 +7864,10 @@ async function runAnimatedGifTranscode(request) {
7845
7864
  }
7846
7865
  async function ensurePreparedWebm(input) {
7847
7866
  if (!existsSync9(dirname7(input.cachePath))) {
7848
- mkdirSync8(dirname7(input.cachePath), { recursive: true });
7867
+ mkdirSync9(dirname7(input.cachePath), { recursive: true });
7849
7868
  }
7850
7869
  if (!existsSync9(dirname7(input.outputPath))) {
7851
- mkdirSync8(dirname7(input.outputPath), { recursive: true });
7870
+ mkdirSync9(dirname7(input.outputPath), { recursive: true });
7852
7871
  }
7853
7872
  if (!isUsableFile(input.cachePath)) {
7854
7873
  const tmpPath = `${input.cachePath}.tmp-${process.pid}-${randomUUID()}`;
@@ -8001,7 +8020,7 @@ import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypt
8001
8020
  import {
8002
8021
  closeSync as closeSync5,
8003
8022
  copyFileSync as copyFileSync3,
8004
- mkdirSync as mkdirSync9,
8023
+ mkdirSync as mkdirSync10,
8005
8024
  openSync as openSync5,
8006
8025
  readFileSync as readFileSync8,
8007
8026
  readSync as readSync3,
@@ -8268,8 +8287,8 @@ function isUsableFile2(path) {
8268
8287
  }
8269
8288
  }
8270
8289
  async function ensurePreparedJpeg(source, cachePath, outputPath, options) {
8271
- mkdirSync9(dirname8(cachePath), { recursive: true });
8272
- mkdirSync9(dirname8(outputPath), { recursive: true });
8290
+ mkdirSync10(dirname8(cachePath), { recursive: true });
8291
+ mkdirSync10(dirname8(outputPath), { recursive: true });
8273
8292
  if (!isUsableFile2(cachePath)) {
8274
8293
  const tmpPath = `${cachePath}.tmp-${process.pid}-${randomUUID2()}`;
8275
8294
  const inlinePath = `${tmpPath}.heic`;
@@ -8907,7 +8926,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
8907
8926
  let filePath = src;
8908
8927
  if (isHttpUrl(src)) {
8909
8928
  const remoteDir = join21(downloadDir, REMOTE_MEDIA_SUBDIR);
8910
- if (!existsSync11(remoteDir)) mkdirSync10(remoteDir, { recursive: true });
8929
+ if (!existsSync11(remoteDir)) mkdirSync11(remoteDir, { recursive: true });
8911
8930
  run?.assets.reserve([src]);
8912
8931
  try {
8913
8932
  filePath = await downloadAsset(src, remoteDir, run?.assets);
@@ -9675,7 +9694,7 @@ var REMOTE_MEDIA_SUBDIR = "_remote_media";
9675
9694
  async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, assets, extraRewrite) {
9676
9695
  assets?.reserve(urlSet);
9677
9696
  if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
9678
- if (!existsSync11(remoteDir)) mkdirSync10(remoteDir, { recursive: true });
9697
+ if (!existsSync11(remoteDir)) mkdirSync11(remoteDir, { recursive: true });
9679
9698
  const urlToLocal = /* @__PURE__ */ new Map();
9680
9699
  await Promise.all(
9681
9700
  [...urlSet].map(async (url) => {
@@ -10343,8 +10362,7 @@ async function compileWithAssets(projectDir, htmlPath, downloadDir, options, ass
10343
10362
  }
10344
10363
  const { document: document2 } = parseHTML5(html);
10345
10364
  const rootEl = document2.querySelector("[data-composition-id]");
10346
- const width = rootEl ? parseInt(rootEl.getAttribute("data-width") || "1080", 10) : 1080;
10347
- const height = rootEl ? parseInt(rootEl.getAttribute("data-height") || "1920", 10) : 1920;
10365
+ const { width, height } = compositionRootSize(rootEl);
10348
10366
  const staticDuration = rootEl ? parseStrictFiniteTimingNumber(rootEl.getAttribute("data-duration")) ?? parseStrictFiniteTimingNumber(rootEl.getAttribute("data-composition-duration")) ?? 0 : 0;
10349
10367
  return {
10350
10368
  html,
@@ -11155,7 +11173,7 @@ function resolveCaptureSurface(input, quality) {
11155
11173
 
11156
11174
  // src/services/render/stages/runtimeAudio.ts
11157
11175
  import { createHash as createHash7 } from "node:crypto";
11158
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync6 } from "node:fs";
11176
+ import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync6 } from "node:fs";
11159
11177
  import { join as join24 } from "node:path";
11160
11178
  var RUNTIME_AUDIO_SUBDIR = "__hf_runtime_audio";
11161
11179
  var MAX_INLINE_AUDIO_BYTES = 64 * 1024 * 1024;
@@ -11224,7 +11242,7 @@ function writeRuntimeAudio(compiledDir, bytes, mimeType) {
11224
11242
  const digest = createHash7("sha256").update(bytes).digest("hex").slice(0, 16);
11225
11243
  const filename = `${digest}${extensionForMime(mimeType)}`;
11226
11244
  const dir = join24(compiledDir, RUNTIME_AUDIO_SUBDIR);
11227
- mkdirSync11(dir, { recursive: true });
11245
+ mkdirSync12(dir, { recursive: true });
11228
11246
  const target = join24(dir, filename);
11229
11247
  try {
11230
11248
  writeFileSync6(target, bytes, { flag: "wx" });
@@ -13949,7 +13967,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
13949
13967
  }
13950
13968
 
13951
13969
  // src/services/render/stages/captureHdrStage.ts
13952
- import { existsSync as existsSync20, mkdirSync as mkdirSync12 } from "node:fs";
13970
+ import { existsSync as existsSync20, mkdirSync as mkdirSync13 } from "node:fs";
13953
13971
  import { join as join34 } from "node:path";
13954
13972
  import {
13955
13973
  closeCaptureSession as closeCaptureSession7,
@@ -14809,7 +14827,7 @@ async function runCaptureHdrStage(input) {
14809
14827
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
14810
14828
  const debugDumpDir = debugDumpEnabled ? join34(framesDir, "debug-composite") : null;
14811
14829
  if (debugDumpDir && !existsSync20(debugDumpDir)) {
14812
- mkdirSync12(debugDumpDir, { recursive: true });
14830
+ mkdirSync13(debugDumpDir, { recursive: true });
14813
14831
  }
14814
14832
  const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
14815
14833
  const hdrTargetTransfer = compositeTransfer === "srgb" ? void 0 : compositeTransfer;
@@ -14972,7 +14990,7 @@ async function runCaptureHdrStage(input) {
14972
14990
  import {
14973
14991
  copyFileSync as copyFileSync4,
14974
14992
  existsSync as existsSync21,
14975
- mkdirSync as mkdirSync13,
14993
+ mkdirSync as mkdirSync14,
14976
14994
  readdirSync as readdirSync5,
14977
14995
  readFileSync as readFileSync10,
14978
14996
  rmSync as rmSync12,
@@ -15274,7 +15292,7 @@ async function runEncodeStage(input) {
15274
15292
  const stage5Start = Date.now();
15275
15293
  if (isPngSequence) {
15276
15294
  const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
15277
- if (!existsSync21(outputPath)) mkdirSync13(outputPath, { recursive: true });
15295
+ if (!existsSync21(outputPath)) mkdirSync14(outputPath, { recursive: true });
15278
15296
  const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
15279
15297
  if (captured.length === 0) {
15280
15298
  throw new Error(
@@ -16509,7 +16527,7 @@ async function renderJob(job, projectDir, outputPath, progressSink, abortSignal,
16509
16527
  validateChromaSubsamplingConfig(job.config);
16510
16528
  const debugDir = resolveRenderDebugDir();
16511
16529
  const outputDir = dirname16(outputPath);
16512
- if (!existsSync22(outputDir)) mkdirSync14(outputDir, { recursive: true });
16530
+ if (!existsSync22(outputDir)) mkdirSync15(outputDir, { recursive: true });
16513
16531
  const workDir = job.config.debug ? join36(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
16514
16532
  const pipelineStart = Date.now();
16515
16533
  const baseLog = job.config.logger ?? defaultLogger;
@@ -16669,7 +16687,7 @@ async function executeRenderPipeline(input) {
16669
16687
  job.startedAt = /* @__PURE__ */ new Date();
16670
16688
  assertNotAborted();
16671
16689
  assertConfiguredFfmpegBinariesExist();
16672
- if (!existsSync22(workDir)) mkdirSync14(workDir, { recursive: true });
16690
+ if (!existsSync22(workDir)) mkdirSync15(workDir, { recursive: true });
16673
16691
  if (job.config.debug) {
16674
16692
  log.info("[Render] Debug artifacts enabled", { workDir, logPath });
16675
16693
  }
@@ -17077,7 +17095,7 @@ async function executeRenderPipeline(input) {
17077
17095
  throw new Error("File server failed to initialize before frame capture");
17078
17096
  }
17079
17097
  const framesDir = join36(workDir, "captured-frames");
17080
- if (!existsSync22(framesDir)) mkdirSync14(framesDir, { recursive: true });
17098
+ if (!existsSync22(framesDir)) mkdirSync15(framesDir, { recursive: true });
17081
17099
  updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
17082
17100
  code: "start_browsers"
17083
17101
  });
@@ -18500,7 +18518,7 @@ async function executeRenderPipeline(input) {
18500
18518
  "drawElement capture failed; retrying with a fresh screenshot session"
18501
18519
  );
18502
18520
  rmSync13(framesDir, { recursive: true, force: true });
18503
- mkdirSync14(framesDir, { recursive: true });
18521
+ mkdirSync15(framesDir, { recursive: true });
18504
18522
  resetCaptureAttemptProgress(job);
18505
18523
  dedupPerfs.length = 0;
18506
18524
  cfg.useDrawElement = false;
@@ -19733,7 +19751,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
19733
19751
  const absoluteOutputPath = resolveOutputPath(input.projectDir, outputCandidate, rendersDir, log);
19734
19752
  const outputDir = dirname20(absoluteOutputPath);
19735
19753
  if (confineOutput) {
19736
- mkdirSync15(rendersDir, { recursive: true, mode: SERVER_FOLDER_MODE });
19754
+ mkdirSync16(rendersDir, { recursive: true, mode: SERVER_FOLDER_MODE });
19737
19755
  if (!isSafePath4(rendersDir, absoluteOutputPath)) {
19738
19756
  throw new Error("outputPath must be inside the renders directory");
19739
19757
  }
@@ -19744,7 +19762,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
19744
19762
  );
19745
19763
  }
19746
19764
  }
19747
- if (!existsSync26(outputDir)) mkdirSync15(outputDir, { recursive: true, mode: SERVER_FOLDER_MODE });
19765
+ if (!existsSync26(outputDir)) mkdirSync16(outputDir, { recursive: true, mode: SERVER_FOLDER_MODE });
19748
19766
  return { input, cleanupProjectDir, absoluteOutputPath, serverNamed };
19749
19767
  }
19750
19768
  var STICKY_BIT = 512;
@@ -20449,7 +20467,7 @@ function serverAuth(options, hostname2, port) {
20449
20467
  options.authTokenFile?.trim() || process.env.PRODUCER_AUTH_TOKEN_FILE?.trim() || join41(homedir(), ".hyperframes", "producer", `${port}.token`)
20450
20468
  );
20451
20469
  const token = crypto.randomBytes(32).toString("base64url");
20452
- mkdirSync15(dirname20(file), { recursive: true, mode: 448 });
20470
+ mkdirSync16(dirname20(file), { recursive: true, mode: 448 });
20453
20471
  rmSync14(file, { force: true });
20454
20472
  writeFileSync9(file, `${token}
20455
20473
  `, { flag: "wx", mode: 384 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.102",
3
+ "version": "0.9.104",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,12 +35,12 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.13.0",
37
37
  "puppeteer-core": "^25.13.0",
38
- "@hyperframes/core": "0.9.102",
39
- "@hyperframes/engine": "0.9.102",
40
- "@hyperframes/lint": "0.9.102",
41
- "@hyperframes/parsers": "0.9.102",
42
- "@hyperframes/share": "0.9.102",
43
- "@hyperframes/studio-server": "0.9.102"
38
+ "@hyperframes/core": "0.9.104",
39
+ "@hyperframes/engine": "0.9.104",
40
+ "@hyperframes/lint": "0.9.104",
41
+ "@hyperframes/parsers": "0.9.104",
42
+ "@hyperframes/share": "0.9.104",
43
+ "@hyperframes/studio-server": "0.9.104"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^25.0.10",
@@ -49,7 +49,7 @@
49
49
  "tsx": "^4.21.0",
50
50
  "typescript": "^5.7.2",
51
51
  "vitest": "^4.1.12",
52
- "@hyperframes/aws-lambda": "0.9.102"
52
+ "@hyperframes/aws-lambda": "0.9.104"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=22"