@skrillex1224/playwright-toolkit 2.1.38 → 2.1.40

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/index.d.ts CHANGED
@@ -50,6 +50,108 @@ export interface ErrorsModule {
50
50
  CrawlerError: typeof CrawlerError;
51
51
  }
52
52
 
53
+ // =============================================================================
54
+ // Logger
55
+ // =============================================================================
56
+ export interface LoggerTemplate {
57
+ step(
58
+ step: string,
59
+ status?: string,
60
+ details?: string[],
61
+ level?: 'info' | 'warn' | 'warning' | 'error' | 'success' | 'start'
62
+ ): void;
63
+ taskStart(url?: string): void;
64
+ taskSuccess(): void;
65
+ taskFail(url?: string, err?: unknown): void;
66
+ runtimeHeadless(): void;
67
+ loginInjectSuccess(detail?: string): void;
68
+ loginInjectSkip(reason?: string): void;
69
+ loginInjectFail(err?: unknown): void;
70
+ loginVerifySuccess(detail?: string): void;
71
+ loginVerifySkip(reason?: string): void;
72
+ loginVerifyFail(err?: unknown): void;
73
+ envCheckSuccess(detail?: string): void;
74
+ envCheckFail(err?: unknown): void;
75
+ inputQuery(query?: string): void;
76
+ sendAction(): void;
77
+ responseListenStart(label?: string, timeoutSec?: number): void;
78
+ responseListenReady(label?: string): void;
79
+ responseListenDetected(label?: string): void;
80
+ responseListenTimeout(label?: string, err?: unknown): void;
81
+ responseListenEnd(label?: string): void;
82
+ streamChunk(length?: number, snippet?: string): void;
83
+ streamEventsParsed(count?: number): void;
84
+ streamCompleteEvent(): void;
85
+ streamEnd(): void;
86
+ responseWaitStart(label?: string): void;
87
+ responseWaitSuccess(label?: string): void;
88
+ responseWaitFail(label?: string, err?: unknown): void;
89
+ responseWaitRetry(label?: string, attempt?: number): void;
90
+ referenceExpandStart(label?: string): void;
91
+ referenceExpandFail(err?: unknown): void;
92
+ screenshotStart(): void;
93
+ screenshotSuccess(): void;
94
+ screenshotFail(err?: unknown): void;
95
+ shareStart(): void;
96
+ shareProgress(label?: string): void;
97
+ shareSuccess(link?: string): void;
98
+ shareFail(err?: unknown): void;
99
+ shareSkip(reason?: string): void;
100
+ dataPushSuccess(label?: string): void;
101
+ dataPushFail(err?: unknown): void;
102
+ popupDetected(detail?: string): void;
103
+ popupCloseAttempt(detail?: string): void;
104
+ popupCloseSuccess(): void;
105
+ popupCloseFail(err?: unknown): void;
106
+ info(message: string): void;
107
+ success(message: string): void;
108
+ warning(message: string): void;
109
+ warn(message: string): void;
110
+ error(message: string): void;
111
+ debug(message: string): void;
112
+ start(message: string): void;
113
+ }
114
+
115
+ export interface LoggerAdapter {
116
+ info(message: string): void;
117
+ warning?(message: string): void;
118
+ warn?(message: string): void;
119
+ error(message: string): void;
120
+ debug?(message: string): void;
121
+ }
122
+
123
+ export interface LoggerModule {
124
+ info(message: string): void;
125
+ success(message: string): void;
126
+ warning(message: string): void;
127
+ warn(message: string): void;
128
+ error(message: string): void;
129
+ debug(message: string): void;
130
+ start(message: string): void;
131
+ setLogger(logger: LoggerAdapter | null): void;
132
+ useTemplate(logger?: LoggerAdapter | null): LoggerTemplate;
133
+ }
134
+
135
+ export interface LogTemplate {
136
+ key: string;
137
+ label: string;
138
+ group: string;
139
+ attention: 'low' | 'medium' | 'high' | 'critical';
140
+ patterns: RegExp[];
141
+ defaultSelected?: boolean;
142
+ }
143
+
144
+ export const Logger: LoggerModule;
145
+ export const LOG_TEMPLATES: LogTemplate[];
146
+ export function stripAnsi(input: string): string;
147
+ export interface BrowserModule {
148
+ Logger: LoggerModule;
149
+ LOG_TEMPLATES: LogTemplate[];
150
+ stripAnsi(input: string): string;
151
+ }
152
+
153
+ export const browser: BrowserModule;
154
+
53
155
  // =============================================================================
54
156
  // ApifyKit
55
157
  // =============================================================================
@@ -336,6 +438,7 @@ export interface PlaywrightToolKit {
336
438
  Errors: ErrorsModule;
337
439
  Interception: InterceptionModule;
338
440
  Mutation: MutationModule;
441
+ Logger: LoggerModule;
339
442
  }
340
443
 
341
444
  export declare function usePlaywrightToolKit(): PlaywrightToolKit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrillex1224/playwright-toolkit",
3
- "version": "2.1.38",
3
+ "version": "2.1.40",
4
4
  "description": "一个在 Apify/Crawlee Actor 中启用实时截图视图的实用工具库。",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./index.d.ts",
12
+ "browser": "./dist/browser.js",
12
13
  "import": "./dist/index.js",
13
14
  "require": "./dist/index.cjs"
14
15
  }