hypha-debugger 0.2.1 → 0.2.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.
@@ -13945,6 +13945,7 @@
13945
13945
  pixelRatio: 1, // always capture at 1x — we'll resize after
13946
13946
  cacheBust: true,
13947
13947
  skipAutoScale: true,
13948
+ skipFonts: true, // CORS-blocked stylesheets can hang font inlining
13948
13949
  filter: (el) => {
13949
13950
  // Exclude the debugger overlay and cursor from screenshots
13950
13951
  return (el.id !== "hypha-debugger-host" &&
@@ -13959,12 +13960,14 @@
13959
13960
  }
13960
13961
  let dataUrl;
13961
13962
  try {
13962
- if (fmt === "jpeg") {
13963
- dataUrl = await toJpeg(node, captureOptions);
13964
- }
13965
- else {
13966
- dataUrl = await toPng(node, captureOptions);
13967
- }
13963
+ const capturePromise = fmt === "jpeg" ? toJpeg(node, captureOptions) : toPng(node, captureOptions);
13964
+ // Hard timeout: pages with cross-origin resources can make
13965
+ // html-to-image wait indefinitely on blocked fetches.
13966
+ const timeoutMs = 15000;
13967
+ dataUrl = await Promise.race([
13968
+ capturePromise,
13969
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Screenshot capture timed out after ${timeoutMs}ms (likely CORS-blocked resources)`)), timeoutMs)),
13970
+ ]);
13968
13971
  }
13969
13972
  catch (captureErr) {
13970
13973
  return {
@@ -17462,7 +17465,14 @@
17462
17465
  if (viewport_only !== undefined) {
17463
17466
  ctrl.config.viewportExpansion = viewport_only ? 0 : -1;
17464
17467
  }
17465
- return ctrl.getBrowserState();
17468
+ // Hard timeout: pages with heavy DOMs or cross-origin iframes can
17469
+ // make the tree walk take much longer than expected. Don't leave
17470
+ // the HTTP caller waiting forever.
17471
+ const timeoutMs = 15000;
17472
+ return Promise.race([
17473
+ ctrl.getBrowserState(),
17474
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`get_browser_state timed out after ${timeoutMs}ms (complex DOM or cross-origin iframes)`)), timeoutMs)),
17475
+ ]);
17466
17476
  }
17467
17477
  getBrowserState.__schema__ = {
17468
17478
  name: "getBrowserState",