@d-zero/puppeteer-page-scan 4.2.8 → 4.3.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/dist/before-page-scan.js
CHANGED
|
@@ -10,7 +10,8 @@ export async function beforePageScan(page, url, options) {
|
|
|
10
10
|
const name = options?.name ?? 'default';
|
|
11
11
|
const width = options?.width ?? 1400;
|
|
12
12
|
const resolution = options?.resolution;
|
|
13
|
-
const timeout = options?.timeout;
|
|
13
|
+
const timeout = options?.timeout || 30_000;
|
|
14
|
+
const countDownId = `${name}${url}_timeout`;
|
|
14
15
|
listener?.('setViewport', { name, width, resolution });
|
|
15
16
|
await page.setViewport({
|
|
16
17
|
width,
|
|
@@ -20,11 +21,11 @@ export async function beforePageScan(page, url, options) {
|
|
|
20
21
|
deviceScaleFactor: resolution ?? 1,
|
|
21
22
|
});
|
|
22
23
|
if (page.url() === url) {
|
|
23
|
-
listener?.('load', { name, type: 'reaload' });
|
|
24
|
+
listener?.('load', { name, type: 'reaload', timeout, id: countDownId });
|
|
24
25
|
await navigateWithFallback(page, url, timeout, true, listener, name);
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
27
|
-
listener?.('load', { name, type: 'open' });
|
|
28
|
+
listener?.('load', { name, type: 'open', timeout, id: countDownId });
|
|
28
29
|
await navigateWithFallback(page, url, timeout, false, listener, name);
|
|
29
30
|
}
|
|
30
31
|
for (const hook of options?.hooks ?? []) {
|
|
@@ -3,8 +3,9 @@ export const pageScanLoggers = (log) => ({
|
|
|
3
3
|
setViewport: ({ width }) => {
|
|
4
4
|
log(`↔️ Change viewport size to ${width}px`);
|
|
5
5
|
},
|
|
6
|
-
load({ type }) {
|
|
7
|
-
|
|
6
|
+
load({ type, timeout, id }) {
|
|
7
|
+
const timeoutSec = Math.floor(timeout / 1000);
|
|
8
|
+
log(`%earth% ${type === 'open' ? 'Open' : 'Reload'} page / Timeout: %countdown(${timeoutSec},${id}_timeout,s)%s/${timeoutSec}s`);
|
|
8
9
|
},
|
|
9
10
|
hook({ message }) {
|
|
10
11
|
log(message);
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/puppeteer-page-scan",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Scanning page function for puppeteer",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@d-zero/puppeteer-general-actions": "1.2.1",
|
|
27
|
-
"@d-zero/puppeteer-scroll": "3.1.
|
|
27
|
+
"@d-zero/puppeteer-scroll": "3.1.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"puppeteer": "24.
|
|
30
|
+
"puppeteer": "24.31.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"puppeteer": "24.
|
|
33
|
+
"puppeteer": "24.31.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "9ed6da4277cf2f9d771df2a07e146fce6c7d4f3f"
|
|
36
36
|
}
|