@browserless/screenshot 13.8.3 → 13.9.1

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/README.md CHANGED
@@ -25,7 +25,7 @@ npm install @browserless/screenshot --save
25
25
 
26
26
  This package provides **advanced screenshot capture** with smart defaults, browser frame overlays, gradient backgrounds, and automatic code syntax highlighting. It wraps Puppeteer's `page.screenshot()` with features optimized for production use.
27
27
 
28
- ### What This Package Does
28
+ ### What this package does
29
29
 
30
30
  The `@browserless/screenshot` package allows you to:
31
31
 
@@ -323,7 +323,7 @@ const buffer = await browserless.screenshot('https://example.com', {
323
323
  └── index.js → Tests
324
324
  ```
325
325
 
326
- ### How It Fits in the Monorepo
326
+ ### How it fits in the monorepo
327
327
 
328
328
  This is a **core functionality package** for screenshot capture:
329
329
 
@@ -331,7 +331,7 @@ This is a **core functionality package** for screenshot capture:
331
331
  | -------------------- | ---------------------------------------------- |
332
332
  | `browserless` (core) | Provides the `.screenshot()` method |
333
333
  | `@browserless/cli` | Powers the `browserless screenshot` command |
334
- | `@browserless/pdf` | Uses `isWhiteScreenshot` for content detection |
334
+ | `@browserless/pdf` | Uses `waitForReady` and `isWhiteScreenshot` |
335
335
 
336
336
  ### Dependencies
337
337
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/screenshot",
3
3
  "description": "Capture high-quality screenshots of websites with overlay support, device emulation, and automated image optimization.",
4
4
  "homepage": "https://browserless.js.org/#/?id=screenshoturl-options",
5
- "version": "13.8.3",
5
+ "version": "13.9.1",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@browserless/errors": "13.6.10",
36
- "@browserless/goto": "13.8.3",
36
+ "@browserless/goto": "13.9.0",
37
37
  "@kikobeats/content-type": "~1.0.4",
38
38
  "@kikobeats/time-span": "~1.0.12",
39
39
  "automad-prism-themes": "~0.3.7",
@@ -70,5 +70,5 @@
70
70
  "timeout": "2m",
71
71
  "workerThreads": false
72
72
  },
73
- "gitHead": "8914ca411458b6902e32f9c12f5780a7beea0e56"
73
+ "gitHead": "9c3b5bdb192fd65deec41a870fd848e53b6886ba"
74
74
  }
@@ -95,6 +95,11 @@ const settleDom = async (page, { idle, timeout }, label) => {
95
95
  debug(label, { ...result, duration: Date.now() - started })
96
96
  }
97
97
 
98
+ const isCompleteScroll = scroll =>
99
+ !!scroll?.hasOverflow &&
100
+ Number(scroll.pageHeight) > 0 &&
101
+ scroll.scrolledPx + (scroll.viewport || 0) >= scroll.pageHeight
102
+
98
103
  const scrollFullPageToLoadContent = async (page, timeout) => {
99
104
  const preQuiet = Math.min(PRE_QUIET_MS, Math.floor(timeout / 20))
100
105
  const postQuiet = Math.min(POST_QUIET_MS, Math.floor(timeout / 20))
@@ -183,7 +188,7 @@ const scrollFullPageToLoadContent = async (page, timeout) => {
183
188
  )
184
189
  }
185
190
 
186
- const hydrated = !!(scroll?.hasOverflow && scroll.scrolledPx >= (scroll.viewport || 0))
191
+ const hydrated = isCompleteScroll(scroll)
187
192
  return { ...scroll, hydrated, duration: Date.now() - started }
188
193
  }
189
194
 
@@ -245,5 +250,6 @@ module.exports = {
245
250
  scrollFullPageToLoadContent,
246
251
  prepareFullDocument,
247
252
  resolveScrollTimeout,
248
- tryHydrateScroll
253
+ tryHydrateScroll,
254
+ isCompleteScroll
249
255
  }