@crawlee/basic 4.0.0-beta.74 → 4.0.0-beta.76
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.
|
@@ -311,6 +311,8 @@ export class BasicCrawler {
|
|
|
311
311
|
extendContext: options.extendContext,
|
|
312
312
|
};
|
|
313
313
|
this.#log = serviceLocator.getLogger().child({ prefix: this.constructor.name });
|
|
314
|
+
// Initialize the Configuration instance to avoid lazy loading in the components
|
|
315
|
+
serviceLocator.getConfiguration();
|
|
314
316
|
// Store whether the user explicitly provided an ID
|
|
315
317
|
this.hasExplicitId = id !== undefined;
|
|
316
318
|
// Store the user-provided ID, or generate a unique one for tracking purposes (not for state key)
|
|
@@ -449,6 +451,11 @@ export class BasicCrawler {
|
|
|
449
451
|
}
|
|
450
452
|
throw this.unwrapError(error);
|
|
451
453
|
}
|
|
454
|
+
finally {
|
|
455
|
+
// Run request-scoped deferred cleanups only after the whole request lifecycle - including the user's error handler - has finished.
|
|
456
|
+
const deferredCleanup = crawlingContext[deferredCleanupKey] ?? [];
|
|
457
|
+
await Promise.all(deferredCleanup.map((fn) => fn().catch((cleanupError) => this.log.debug('Error in deferred cleanup', { error: cleanupError }))));
|
|
458
|
+
}
|
|
452
459
|
},
|
|
453
460
|
isTaskReadyFunction: async () => {
|
|
454
461
|
if (isMaxPagesExceeded()) {
|
|
@@ -511,12 +518,7 @@ export class BasicCrawler {
|
|
|
511
518
|
buildBasicContextPipeline() {
|
|
512
519
|
return ContextPipeline.create()
|
|
513
520
|
.compose({ action: this.checkRobotsTxt.bind(this) })
|
|
514
|
-
.compose({
|
|
515
|
-
action: () => this.createBaseContext(),
|
|
516
|
-
cleanup: async (context) => {
|
|
517
|
-
await Promise.all(context[deferredCleanupKey].map((fn) => fn()));
|
|
518
|
-
},
|
|
519
|
-
})
|
|
521
|
+
.compose({ action: () => this.createBaseContext() })
|
|
520
522
|
.compose({ action: this.resolveSession.bind(this) })
|
|
521
523
|
.compose({ action: this.createContextHelpers.bind(this) });
|
|
522
524
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/basic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.76",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@apify/datastructures": "^2.0.0",
|
|
43
43
|
"@apify/timeout": "^0.3.2",
|
|
44
44
|
"@apify/utilities": "^2.15.5",
|
|
45
|
-
"@crawlee/core": "4.0.0-beta.
|
|
46
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
47
|
-
"@crawlee/types": "4.0.0-beta.
|
|
48
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
45
|
+
"@crawlee/core": "4.0.0-beta.76",
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.76",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.76",
|
|
48
|
+
"@crawlee/utils": "4.0.0-beta.76",
|
|
49
49
|
"csv-stringify": "^6.5.2",
|
|
50
50
|
"fs-extra": "^11.3.0",
|
|
51
51
|
"ow": "^2.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"type-fest": "^4.41.0"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@crawlee/impit-client": "^4.0.0-beta.
|
|
57
|
+
"@crawlee/impit-client": "^4.0.0-beta.76"
|
|
58
58
|
},
|
|
59
59
|
"lerna": {
|
|
60
60
|
"command": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "0f76e7dbac40567e81475a6a77c7dedd8a829d12"
|
|
67
67
|
}
|