@d-zero/puppeteer-page-scan 2.0.0 → 4.0.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.
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { PageHook, PageScanPhase, Size } from './types.js';
|
|
2
2
|
import type { Listener } from '@d-zero/puppeteer-general-actions';
|
|
3
|
-
import type { Page } from '
|
|
3
|
+
import type { Page } from 'puppeteer';
|
|
4
4
|
type Options = {
|
|
5
5
|
name: string;
|
|
6
6
|
hooks?: readonly PageHook[];
|
|
7
7
|
listener?: Listener<PageScanPhase>;
|
|
8
8
|
} & Size;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param page
|
|
12
|
+
* @param url
|
|
13
|
+
* @param options
|
|
14
|
+
*/
|
|
9
15
|
export declare function beforePageScan(page: Page, url: string, options?: Options): Promise<void>;
|
|
10
16
|
export {};
|
package/dist/before-page-scan.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { scrollAllOver } from '@d-zero/puppeteer-scroll';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param page
|
|
5
|
+
* @param url
|
|
6
|
+
* @param options
|
|
7
|
+
*/
|
|
2
8
|
export async function beforePageScan(page, url, options) {
|
|
3
9
|
const listener = options?.listener;
|
|
4
10
|
const name = options?.name ?? 'default';
|
|
@@ -12,7 +18,7 @@ export async function beforePageScan(page, url, options) {
|
|
|
12
18
|
width > 1000 ? Math.floor(width * 0.75) : Math.floor(width * 1.5),
|
|
13
19
|
deviceScaleFactor: resolution ?? 1,
|
|
14
20
|
});
|
|
15
|
-
if (
|
|
21
|
+
if (page.url() === url) {
|
|
16
22
|
listener?.('load', { name, type: 'reaload' });
|
|
17
23
|
await page.reload({ waitUntil: 'networkidle0' });
|
|
18
24
|
}
|
package/dist/read-page-hooks.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param hooks
|
|
5
|
+
* @param baseDir
|
|
6
|
+
*/
|
|
2
7
|
export async function readPageHooks(hooks, baseDir) {
|
|
3
8
|
const pageHooks = await Promise.all(hooks.map(async (hook) => {
|
|
4
9
|
const hookAbsPath = path.isAbsolute(hook) ? hook : path.resolve(baseDir, hook);
|
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": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Scanning page function for puppeteer",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,11 +24,14 @@
|
|
|
24
24
|
"clean": "tsc --build --clean"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@d-zero/puppeteer-general-actions": "1.
|
|
28
|
-
"@d-zero/puppeteer-scroll": "
|
|
27
|
+
"@d-zero/puppeteer-general-actions": "1.2.0",
|
|
28
|
+
"@d-zero/puppeteer-scroll": "3.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"
|
|
31
|
+
"puppeteer": "24.9.0"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"puppeteer": "24.8.2"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "4e9cc7b87e0fef91b6f2d4edfb66ca9134b2491b"
|
|
34
37
|
}
|