@crawlee/browser-pool 4.0.0-beta.143 → 4.0.0-beta.145
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.
|
@@ -104,7 +104,10 @@ export declare abstract class BrowserController<Library extends CommonLibrary =
|
|
|
104
104
|
activePages: number;
|
|
105
105
|
totalPages: number;
|
|
106
106
|
lastPageOpenedAt: number;
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Returns a promise that resolves once the browser controller has been activated.
|
|
109
|
+
*/
|
|
110
|
+
waitForActive(): Promise<void>;
|
|
108
111
|
constructor(browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>);
|
|
109
112
|
/**
|
|
110
113
|
* Activates the BrowserController. If you try to open new pages before
|
|
@@ -37,10 +37,15 @@ export class BrowserController extends TypedEmitter {
|
|
|
37
37
|
totalPages = 0;
|
|
38
38
|
lastPageOpenedAt = Date.now();
|
|
39
39
|
#activate;
|
|
40
|
-
|
|
41
|
-
isActivePromise = new Promise((resolve) => {
|
|
40
|
+
#isActivePromise = new Promise((resolve) => {
|
|
42
41
|
this.#activate = resolve;
|
|
43
42
|
});
|
|
43
|
+
/**
|
|
44
|
+
* Returns a promise that resolves once the browser controller has been activated.
|
|
45
|
+
*/
|
|
46
|
+
async waitForActive() {
|
|
47
|
+
await this.#isActivePromise;
|
|
48
|
+
}
|
|
44
49
|
#commitBrowser;
|
|
45
50
|
#hasBrowserPromise = new Promise((resolve) => {
|
|
46
51
|
this.#commitBrowser = resolve;
|
|
@@ -115,7 +120,7 @@ export class BrowserController extends TypedEmitter {
|
|
|
115
120
|
async newPage(pageOptions) {
|
|
116
121
|
this.activePages++;
|
|
117
122
|
this.totalPages++;
|
|
118
|
-
await this
|
|
123
|
+
await this.#isActivePromise;
|
|
119
124
|
const page = await this._newPage(pageOptions);
|
|
120
125
|
tryCancel();
|
|
121
126
|
this.lastPageOpenedAt = Date.now();
|
package/browser-pool.js
CHANGED
|
@@ -277,8 +277,7 @@ export class BrowserPool extends TypedEmitter {
|
|
|
277
277
|
async createPageForBrowser(pageId, browserController, pageOptions = {}, proxyUrl, ignoreTlsErrors) {
|
|
278
278
|
// This is needed for concurrent newPage calls to wait for the browser launch.
|
|
279
279
|
// It's not ideal though, we need to come up with a better API.
|
|
280
|
-
|
|
281
|
-
await browserController['isActivePromise'];
|
|
280
|
+
await browserController.waitForActive();
|
|
282
281
|
tryCancel();
|
|
283
282
|
const finalPageOptions = browserController.launchContext.useIncognitoPages ? pageOptions : undefined;
|
|
284
283
|
if (finalPageOptions) {
|
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.145",
|
|
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": "^0.4.4",
|
|
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.145",
|
|
35
|
+
"@crawlee/types": "4.0.0-beta.145",
|
|
36
|
+
"@crawlee/utils": "4.0.0-beta.145",
|
|
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": "e8b4d50265b9e433ae61c69d16cc1fee00a4d7e9"
|
|
68
68
|
}
|