@crawlee/browser-pool 4.0.0-beta.165 → 4.0.0-beta.167
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/browser-pool.d.ts +7 -2
- package/browser-pool.js +13 -8
- package/package.json +5 -5
- package/remote-browser-pool.d.ts +5 -0
- package/remote-browser-pool.js +7 -0
package/browser-pool.d.ts
CHANGED
|
@@ -409,10 +409,15 @@ export declare class BrowserPool<Options extends BrowserPoolOptions = BrowserPoo
|
|
|
409
409
|
closeAllBrowsers(): Promise<void>;
|
|
410
410
|
[Symbol.asyncDispose](): Promise<void>;
|
|
411
411
|
/**
|
|
412
|
-
* Closes
|
|
412
|
+
* Closes every managed browser and empties the pool, which stays usable afterwards — a crawler releases its
|
|
413
|
+
* browsers when a run ends and may start another run on the same pool.
|
|
414
|
+
*/
|
|
415
|
+
releaseAllBrowsers(): Promise<void>;
|
|
416
|
+
/**
|
|
417
|
+
* Closes all managed browsers and tears the pool down for good: its intervals are cleared without being
|
|
418
|
+
* re-armed and its listeners are dropped, so it cannot be used again.
|
|
413
419
|
*/
|
|
414
420
|
destroy(): Promise<void>;
|
|
415
|
-
private teardown;
|
|
416
421
|
private getAllBrowserControllers;
|
|
417
422
|
private launchBrowser;
|
|
418
423
|
/**
|
package/browser-pool.js
CHANGED
|
@@ -415,20 +415,25 @@ export class BrowserPool extends TypedEmitter {
|
|
|
415
415
|
await this.destroy();
|
|
416
416
|
}
|
|
417
417
|
/**
|
|
418
|
-
* Closes
|
|
418
|
+
* Closes every managed browser and empties the pool, which stays usable afterwards — a crawler releases its
|
|
419
|
+
* browsers when a run ends and may start another run on the same pool.
|
|
420
|
+
*/
|
|
421
|
+
async releaseAllBrowsers() {
|
|
422
|
+
await this.closeAllBrowsers();
|
|
423
|
+
this.startingBrowserControllers.clear();
|
|
424
|
+
this.activeBrowserControllers.clear();
|
|
425
|
+
this.retiredBrowserControllers.clear();
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Closes all managed browsers and tears the pool down for good: its intervals are cleared without being
|
|
429
|
+
* re-armed and its listeners are dropped, so it cannot be used again.
|
|
419
430
|
*/
|
|
420
431
|
async destroy() {
|
|
421
432
|
clearInterval(this.browserKillerInterval);
|
|
422
433
|
clearInterval(this.#browserRetireInterval);
|
|
423
434
|
this.browserKillerInterval = undefined;
|
|
424
435
|
this.#browserRetireInterval = undefined;
|
|
425
|
-
await this.
|
|
426
|
-
this.teardown();
|
|
427
|
-
}
|
|
428
|
-
teardown() {
|
|
429
|
-
this.startingBrowserControllers.clear();
|
|
430
|
-
this.activeBrowserControllers.clear();
|
|
431
|
-
this.retiredBrowserControllers.clear();
|
|
436
|
+
await this.releaseAllBrowsers();
|
|
432
437
|
this.removeAllListeners();
|
|
433
438
|
}
|
|
434
439
|
getAllBrowserControllers() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/browser-pool",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.167",
|
|
4
4
|
"description": "Rotate multiple browsers using popular automation libraries such as Playwright or Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@apify/timeout": "^1.0.1",
|
|
34
|
-
"@crawlee/core": "4.0.0-beta.
|
|
35
|
-
"@crawlee/types": "4.0.0-beta.
|
|
36
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
34
|
+
"@crawlee/core": "4.0.0-beta.167",
|
|
35
|
+
"@crawlee/types": "4.0.0-beta.167",
|
|
36
|
+
"@crawlee/utils": "4.0.0-beta.167",
|
|
37
37
|
"fingerprint-generator": "^2.1.68",
|
|
38
38
|
"fingerprint-injector": "^2.1.68",
|
|
39
39
|
"lodash.merge": "^4.6.2",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "8b26080bf07dc602aa0970e12fb66e7e9cba509b"
|
|
68
68
|
}
|
package/remote-browser-pool.d.ts
CHANGED
|
@@ -151,6 +151,11 @@ export declare class RemoteBrowserPool<Page = unknown> implements IBrowserPool<P
|
|
|
151
151
|
}): Promise<void>;
|
|
152
152
|
extractPageState(page: Page): Promise<PageState>;
|
|
153
153
|
injectPageState(page: Page, state: PageState): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Closes all browsers and releases their remote sessions, leaving the pool usable. Closing a browser is what
|
|
156
|
+
* releases its session (see the constructor), so this needs no separate release pass.
|
|
157
|
+
*/
|
|
158
|
+
releaseAllBrowsers(): Promise<void>;
|
|
154
159
|
[Symbol.asyncDispose](): Promise<void>;
|
|
155
160
|
/** Closes all browsers, releases any still-open remote sessions, and tears down the wrapped pool. */
|
|
156
161
|
destroy(): Promise<void>;
|
package/remote-browser-pool.js
CHANGED
|
@@ -156,6 +156,13 @@ export class RemoteBrowserPool {
|
|
|
156
156
|
async injectPageState(page, state) {
|
|
157
157
|
return this.#pool.injectPageState(page, state);
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Closes all browsers and releases their remote sessions, leaving the pool usable. Closing a browser is what
|
|
161
|
+
* releases its session (see the constructor), so this needs no separate release pass.
|
|
162
|
+
*/
|
|
163
|
+
async releaseAllBrowsers() {
|
|
164
|
+
await this.browserPool.releaseAllBrowsers();
|
|
165
|
+
}
|
|
159
166
|
async [Symbol.asyncDispose]() {
|
|
160
167
|
await this.destroy();
|
|
161
168
|
}
|