@crawlee/browser-pool 4.0.0-beta.164 → 4.0.0-beta.166

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 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 all managed browsers and tears down the pool.
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 all managed browsers and tears down the pool.
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.closeAllBrowsers();
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.164",
3
+ "version": "4.0.0-beta.166",
4
4
  "description": "Rotate multiple browsers using popular automation libraries such as Playwright or Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -30,10 +30,10 @@
30
30
  "copy": "tsx ../../scripts/copy.ts"
31
31
  },
32
32
  "dependencies": {
33
- "@apify/timeout": "^0.4.4",
34
- "@crawlee/core": "4.0.0-beta.164",
35
- "@crawlee/types": "4.0.0-beta.164",
36
- "@crawlee/utils": "4.0.0-beta.164",
33
+ "@apify/timeout": "^1.0.1",
34
+ "@crawlee/core": "4.0.0-beta.166",
35
+ "@crawlee/types": "4.0.0-beta.166",
36
+ "@crawlee/utils": "4.0.0-beta.166",
37
37
  "fingerprint-generator": "^2.1.68",
38
38
  "fingerprint-injector": "^2.1.68",
39
39
  "lodash.merge": "^4.6.2",
@@ -43,7 +43,7 @@
43
43
  "quick-lru": "^7.0.1",
44
44
  "tiny-typed-emitter": "^2.1.0",
45
45
  "tslib": "^2.8.1",
46
- "zod": "^4.4.3"
46
+ "zod": "^4.5.4"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "playwright": "*",
@@ -64,5 +64,5 @@
64
64
  }
65
65
  }
66
66
  },
67
- "gitHead": "a2e4e2a3aa3a364c8a44fd2e49ca57f500d2c01f"
67
+ "gitHead": "5d34cf3b9da170f22cf5b346014ba44060dad827"
68
68
  }
@@ -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>;
@@ -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
  }