hypha-debugger 0.2.1 → 0.2.3
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/hypha-debugger.js +14562 -18087
- package/dist/hypha-debugger.js.map +1 -1
- package/dist/hypha-debugger.min.js +39 -48
- package/dist/hypha-debugger.min.js.map +1 -1
- package/dist/hypha-debugger.mjs +17 -7
- package/dist/hypha-debugger.mjs.map +1 -1
- package/package.json +2 -5
package/dist/hypha-debugger.mjs
CHANGED
|
@@ -2065,6 +2065,7 @@ async function takeScreenshot(selector, format, quality, max_width, max_height,
|
|
|
2065
2065
|
pixelRatio: 1, // always capture at 1x — we'll resize after
|
|
2066
2066
|
cacheBust: true,
|
|
2067
2067
|
skipAutoScale: true,
|
|
2068
|
+
skipFonts: true, // CORS-blocked stylesheets can hang font inlining
|
|
2068
2069
|
filter: (el) => {
|
|
2069
2070
|
// Exclude the debugger overlay and cursor from screenshots
|
|
2070
2071
|
return (el.id !== "hypha-debugger-host" &&
|
|
@@ -2079,12 +2080,14 @@ async function takeScreenshot(selector, format, quality, max_width, max_height,
|
|
|
2079
2080
|
}
|
|
2080
2081
|
let dataUrl;
|
|
2081
2082
|
try {
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2083
|
+
const capturePromise = fmt === "jpeg" ? toJpeg(node, captureOptions) : toPng(node, captureOptions);
|
|
2084
|
+
// Hard timeout: pages with cross-origin resources can make
|
|
2085
|
+
// html-to-image wait indefinitely on blocked fetches.
|
|
2086
|
+
const timeoutMs = 15000;
|
|
2087
|
+
dataUrl = await Promise.race([
|
|
2088
|
+
capturePromise,
|
|
2089
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Screenshot capture timed out after ${timeoutMs}ms (likely CORS-blocked resources)`)), timeoutMs)),
|
|
2090
|
+
]);
|
|
2088
2091
|
}
|
|
2089
2092
|
catch (captureErr) {
|
|
2090
2093
|
return {
|
|
@@ -5582,7 +5585,14 @@ async function getBrowserState(viewport_only) {
|
|
|
5582
5585
|
if (viewport_only !== undefined) {
|
|
5583
5586
|
ctrl.config.viewportExpansion = viewport_only ? 0 : -1;
|
|
5584
5587
|
}
|
|
5585
|
-
|
|
5588
|
+
// Hard timeout: pages with heavy DOMs or cross-origin iframes can
|
|
5589
|
+
// make the tree walk take much longer than expected. Don't leave
|
|
5590
|
+
// the HTTP caller waiting forever.
|
|
5591
|
+
const timeoutMs = 15000;
|
|
5592
|
+
return Promise.race([
|
|
5593
|
+
ctrl.getBrowserState(),
|
|
5594
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`get_browser_state timed out after ${timeoutMs}ms (complex DOM or cross-origin iframes)`)), timeoutMs)),
|
|
5595
|
+
]);
|
|
5586
5596
|
}
|
|
5587
5597
|
getBrowserState.__schema__ = {
|
|
5588
5598
|
name: "getBrowserState",
|