@skrillex1224/playwright-toolkit 3.0.13 → 3.0.15
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/browser.js +161 -409
- package/dist/browser.js.map +4 -4
- package/dist/index.cjs +479 -976
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +479 -976
- package/dist/index.js.map +4 -4
- package/index.d.ts +9 -40
- package/package.json +1 -7
package/index.d.ts
CHANGED
|
@@ -18,23 +18,14 @@ export interface StatusType {
|
|
|
18
18
|
Failed: 'FAILED';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface ModeType {
|
|
22
|
-
Default: 'default';
|
|
23
|
-
Cloak: 'cloak';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ToolkitMode = 'default' | 'cloak';
|
|
27
|
-
|
|
28
21
|
export interface ConstantsModule {
|
|
29
22
|
Code: CodeType;
|
|
30
23
|
Status: StatusType;
|
|
31
|
-
Mode: ModeType;
|
|
32
24
|
PresetOfLiveViewKey: string;
|
|
33
25
|
Device: {
|
|
34
26
|
Desktop: 'desktop';
|
|
35
27
|
Mobile: 'mobile';
|
|
36
28
|
};
|
|
37
|
-
normalizeMode(value?: unknown, fallback?: ToolkitMode): ToolkitMode;
|
|
38
29
|
normalizeDevice(value?: unknown, fallback?: RuntimeDevice): RuntimeDevice;
|
|
39
30
|
ActorInfo: Record<string, ActorInfoItem>;
|
|
40
31
|
}
|
|
@@ -42,7 +33,7 @@ export interface ConstantsModule {
|
|
|
42
33
|
export type RuntimeDevice = 'desktop' | 'mobile';
|
|
43
34
|
|
|
44
35
|
export interface ActorShareInfo {
|
|
45
|
-
mode: 'dom' | 'response'
|
|
36
|
+
mode: 'dom' | 'response';
|
|
46
37
|
prefix: string;
|
|
47
38
|
xurl: Array<string | string[]>;
|
|
48
39
|
}
|
|
@@ -409,9 +400,9 @@ export interface CrawlerBaseOptions {
|
|
|
409
400
|
requestHandlerTimeoutSecs: number;
|
|
410
401
|
navigationTimeoutSecs: number;
|
|
411
402
|
headless: boolean;
|
|
412
|
-
browserPoolOptions:
|
|
413
|
-
useFingerprints
|
|
414
|
-
fingerprintOptions
|
|
403
|
+
browserPoolOptions: {
|
|
404
|
+
useFingerprints: boolean;
|
|
405
|
+
fingerprintOptions: {
|
|
415
406
|
fingerprintGeneratorOptions: Record<string, any>;
|
|
416
407
|
};
|
|
417
408
|
};
|
|
@@ -426,6 +417,10 @@ export interface CrawlerNavigationHook {
|
|
|
426
417
|
(crawlingContext: any, gotoOptions: Record<string, any>): Promise<void> | void;
|
|
427
418
|
}
|
|
428
419
|
|
|
420
|
+
export interface LaunchHooks {
|
|
421
|
+
modifyPageOptions?: (pageOptions: Record<string, any>, context: { pageId: string; browserController: any }) => Promise<void> | void;
|
|
422
|
+
}
|
|
423
|
+
|
|
429
424
|
export interface GetPlaywrightCrawlerOptionsInput {
|
|
430
425
|
customArgs?: string[];
|
|
431
426
|
proxyConfiguration?: ProxyConfiguration;
|
|
@@ -437,6 +432,7 @@ export interface GetPlaywrightCrawlerOptionsInput {
|
|
|
437
432
|
isRunningOnApify?: boolean;
|
|
438
433
|
launcher?: any;
|
|
439
434
|
runtimeState?: RuntimeEnvState | null;
|
|
435
|
+
hooks?: LaunchHooks;
|
|
440
436
|
preNavigationHooks?: CrawlerNavigationHook[];
|
|
441
437
|
postNavigationHooks?: CrawlerNavigationHook[];
|
|
442
438
|
}
|
|
@@ -450,25 +446,6 @@ export interface LaunchModule {
|
|
|
450
446
|
getPlaywrightCrawlerOptions(options?: GetPlaywrightCrawlerOptionsInput): PlaywrightCrawlerOptions;
|
|
451
447
|
}
|
|
452
448
|
|
|
453
|
-
export interface CloakGetPlaywrightCrawlerOptionsInput extends GetPlaywrightCrawlerOptionsInput {
|
|
454
|
-
cloakOptions?: Record<string, any>;
|
|
455
|
-
humanizeOptions?: boolean | Record<string, any>;
|
|
456
|
-
crawlerBaseOptions?: Partial<CrawlerBaseOptions>;
|
|
457
|
-
browserPoolOptions?: Record<string, any>;
|
|
458
|
-
launchContext?: Record<string, any>;
|
|
459
|
-
recommendedGotoOptions?: Record<string, any>;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export interface CloakPlaywrightCrawlerOptions extends PlaywrightCrawlerOptions {
|
|
463
|
-
cleanup?: () => Promise<void>;
|
|
464
|
-
closeActiveBrowsers?: () => Promise<void>;
|
|
465
|
-
forceTerminateActiveProcesses?: () => Promise<void>;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
export interface CloakLaunchModule {
|
|
469
|
-
getPlaywrightCrawlerOptions(options?: CloakGetPlaywrightCrawlerOptionsInput): Promise<CloakPlaywrightCrawlerOptions>;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
449
|
// =============================================================================
|
|
473
450
|
// LiveView
|
|
474
451
|
// =============================================================================
|
|
@@ -682,8 +659,6 @@ export interface ShareScreenCaptureOptions {
|
|
|
682
659
|
restore?: boolean;
|
|
683
660
|
/** 最大截图高度 (默认: 8000px) */
|
|
684
661
|
maxHeight?: number;
|
|
685
|
-
/** 截图水印合成模式;`cloak` 时走兼容分支。 */
|
|
686
|
-
mode?: 'default' | 'cloak';
|
|
687
662
|
/** 返回 base64 字符串的最大字节数,默认 5MiB。 */
|
|
688
663
|
maxBytes?: number;
|
|
689
664
|
/** maxBytes 的别名。 */
|
|
@@ -870,10 +845,6 @@ export interface PlaywrightToolKit {
|
|
|
870
845
|
};
|
|
871
846
|
}
|
|
872
847
|
|
|
873
|
-
export interface CloakPlaywrightToolKit extends PlaywrightToolKit {
|
|
874
|
-
Launch: CloakLaunchModule;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
848
|
/** Browser/Extension version of the toolkit */
|
|
878
849
|
export interface BrowserPlaywrightToolKit {
|
|
879
850
|
Logger: LoggerModule;
|
|
@@ -888,5 +859,3 @@ export interface BrowserPlaywrightToolKit {
|
|
|
888
859
|
}
|
|
889
860
|
|
|
890
861
|
export declare function usePlaywrightToolKit(): PlaywrightToolKit;
|
|
891
|
-
export declare function usePlaywrightToolKit(mode: 'default'): PlaywrightToolKit;
|
|
892
|
-
export declare function usePlaywrightToolKit(mode: 'cloak'): CloakPlaywrightToolKit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skrillex1224/playwright-toolkit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
4
4
|
"description": "一个在 Apify/Crawlee Actor 中启用实时截图视图的实用工具库。",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -59,16 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"apify": "*",
|
|
62
|
-
"cloakbrowser": "*",
|
|
63
62
|
"crawlee": "*",
|
|
64
63
|
"ghost-cursor-playwright": "*",
|
|
65
64
|
"playwright": "*"
|
|
66
65
|
},
|
|
67
|
-
"peerDependenciesMeta": {
|
|
68
|
-
"cloakbrowser": {
|
|
69
|
-
"optional": true
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
66
|
"devDependencies": {
|
|
73
67
|
"esbuild": "^0.24.2"
|
|
74
68
|
}
|