@browserless/screenshot 13.6.11 → 13.6.12

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/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.6.11",
5
+ "version": "13.6.12",
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.6.10",
36
+ "@browserless/goto": "13.6.12",
37
37
  "@kikobeats/content-type": "~1.0.4",
38
38
  "@kikobeats/time-span": "~1.0.12",
39
39
  "automad-prism-themes": "~0.3.7",
@@ -52,7 +52,6 @@
52
52
  "svg-gradient": "~1.0.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@browserless/test": "13.6.11",
56
55
  "ava": "5"
57
56
  },
58
57
  "engines": {
@@ -71,5 +70,5 @@
71
70
  "timeout": "2m",
72
71
  "workerThreads": false
73
72
  },
74
- "gitHead": "a1336c7b1837cd9fa0918a859f441ff5f74c1920"
73
+ "gitHead": "363898247585b3b6cd51781fbd55ca61ee9ef8a6"
75
74
  }
package/src/index.js CHANGED
@@ -188,11 +188,11 @@ module.exports = ({ goto, ...gotoOpts }) => {
188
188
 
189
189
  do {
190
190
  screenshot = await captureWithNavigationRetry(
191
- () =>
192
- page.screenshot({
193
- ...opts,
194
- ...(opts.fullPage ? { fullPage: false, path: undefined } : {})
195
- }),
191
+ () => {
192
+ if (!opts.fullPage) return page.screenshot(opts)
193
+ const { fullPage, path, quality, ...probeOpts } = opts
194
+ return page.screenshot({ ...probeOpts, fullPage: false })
195
+ },
196
196
  { page, goto, timeout }
197
197
  )
198
198
  isWhite = await isWhiteScreenshot(screenshot)
@@ -206,7 +206,7 @@ module.exports = ({ goto, ...gotoOpts }) => {
206
206
  if (isReady || elapsed() >= timeout) break
207
207
 
208
208
  const remaining = timeout - elapsed()
209
- if (opts.fullPage && !didHydrateAttempt && !isWhite) {
209
+ if (opts.fullPage && !didHydrateAttempt) {
210
210
  didHydrateAttempt = true
211
211
  const { hydrated, info } = await tryHydrateScroll(page, remaining)
212
212
  didHydrateScroll = hydrated
@@ -222,7 +222,7 @@ const prepareFullDocument = async (page, { goto, timeout, scrolled = false } = {
222
222
  duration: elapsed()
223
223
  })
224
224
 
225
- await scrollFullPageToLoadContent(page, scrollTimeout)
225
+ await pReflect(scrollFullPageToLoadContent(page, scrollTimeout))
226
226
  debug('prepareFullDocument:scroll', { duration: elapsed() })
227
227
  } else {
228
228
  debug('prepareFullDocument:skipScroll', { duration: elapsed() })