@browserless/goto 10.2.5 → 10.3.0

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/goto",
3
3
  "description": "Go to a page aborting unnecessary requests",
4
4
  "homepage": "https://browserless.js.org/#/?id=gotopage-options",
5
- "version": "10.2.5",
5
+ "version": "10.3.0",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -29,21 +29,21 @@
29
29
  "puppeteer"
30
30
  ],
31
31
  "dependencies": {
32
- "@browserless/devices": "^10.2.5",
32
+ "@browserless/devices": "^10.3.0",
33
33
  "@cliqz/adblocker-puppeteer": "~1.26.15",
34
34
  "@kikobeats/time-span": "~1.0.3",
35
- "@lukeed/ms": "~2.0.2",
36
35
  "debug-logfmt": "~1.2.1",
37
36
  "got": "~11.8.6",
38
37
  "is-url-http": "~2.3.7",
39
38
  "p-reflect": "~2.1.0",
40
39
  "p-timeout": "~4.1.0",
40
+ "pretty-ms": "~7.0.1",
41
41
  "shallow-equal": "~3.1.0",
42
42
  "tough-cookie": "~4.1.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@browserless/test": "^10.2.4",
46
- "ava": "latest",
45
+ "@browserless/test": "^10.3.0",
46
+ "ava": "5",
47
47
  "p-wait-for": "3"
48
48
  },
49
49
  "engines": {
@@ -62,7 +62,7 @@
62
62
  "timeout": "2m",
63
63
  "workerThreads": false
64
64
  },
65
- "gitHead": "d5f5d3bba991e4a2a3f88892e596414ce7a10688",
65
+ "gitHead": "6de02ac566c97aa7f31a3faaca0a02668884cd9c",
66
66
  "scripts": {
67
67
  "postinstall": "node scripts/postinstall",
68
68
  "test": "ava"
package/src/engine.bin CHANGED
Binary file
package/src/index.js CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  const { PuppeteerBlocker } = require('@cliqz/adblocker-puppeteer')
4
4
  const { shallowEqualObjects } = require('shallow-equal')
5
+ const { setTimeout } = require('node:timers/promises')
5
6
  const createDevices = require('@browserless/devices')
6
7
  const toughCookie = require('tough-cookie')
7
- const { format } = require('@lukeed/ms')
8
8
  const pReflect = require('p-reflect')
9
9
  const pTimeout = require('p-timeout')
10
10
  const isUrl = require('is-url-http')
11
11
  const path = require('path')
12
12
  const fs = require('fs')
13
13
 
14
- const timeSpan = require('@kikobeats/time-span')({ format: n => format(Math.round(n)) })
14
+ const timeSpan = require('@kikobeats/time-span')({ format: require('pretty-ms') })
15
15
 
16
16
  const { DEFAULT_INTERCEPT_RESOLUTION_PRIORITY } = require('puppeteer')
17
17
 
@@ -204,7 +204,6 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
204
204
  waitForFunction,
205
205
  waitForSelector,
206
206
  waitForTimeout,
207
- waitForXPath,
208
207
  waitUntil = 'auto',
209
208
  waitUntilAuto = _waitUntilAuto,
210
209
  onPageRequest,
@@ -371,15 +370,17 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
371
370
 
372
371
  for (const [key, value] of Object.entries({
373
372
  waitForSelector,
374
- waitForXPath,
375
- waitForFunction,
376
- waitForTimeout
373
+ waitForFunction
377
374
  })) {
378
375
  if (value) {
379
376
  await run({ fn: page[key](value), timeout: gotoTimeout, debug: { [key]: value } })
380
377
  }
381
378
  }
382
379
 
380
+ if (waitForTimeout) {
381
+ await setTimeout(waitForTimeout)
382
+ }
383
+
383
384
  await inject(page, {
384
385
  timeout: actionTimeout,
385
386
  mediaType,