@crawlee/cli 4.0.0-beta.323 → 4.0.0-beta.325
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/cli",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.325",
|
|
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.13.0"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@crawlee/templates": "4.0.0-beta.
|
|
48
|
+
"@crawlee/templates": "4.0.0-beta.325",
|
|
49
49
|
"@inquirer/prompts": "^8.8.1",
|
|
50
50
|
"ansi-colors": "^4.1.3",
|
|
51
51
|
"semver": "^7.8.5",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "72ed70d29fe1a4122d4b7384c14ee4828229345f"
|
|
63
63
|
}
|
|
@@ -154,7 +154,7 @@ try {
|
|
|
154
154
|
}
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
One behavioral change: options validated against class interfaces (`httpClient`, `configuration
|
|
157
|
+
One behavioral change: options validated against class interfaces (`httpClient`, `configuration`) now require actual instances (`instanceof BaseHttpClient`, …) rather than duck-typed plain objects — extend the class (or `Object.create(BaseHttpClient.prototype)` in tests) instead of passing an object literal.
|
|
158
158
|
|
|
159
159
|
### Zod 4 required
|
|
160
160
|
|
|
@@ -374,10 +374,10 @@ const eventManager = serviceLocator.getEventManager();
|
|
|
374
374
|
|
|
375
375
|
#### Using per-crawler services (recommended)
|
|
376
376
|
|
|
377
|
-
The new `ServiceLocator` supports per-crawler service isolation, allowing you to use different storage
|
|
377
|
+
The new `ServiceLocator` supports per-crawler service isolation, allowing you to use a different configuration, storage backend or logger for different crawlers by passing them via options:
|
|
378
378
|
|
|
379
379
|
```typescript
|
|
380
|
-
import { BasicCrawler, Configuration,
|
|
380
|
+
import { BasicCrawler, Configuration, MemoryStorageBackend } from 'crawlee';
|
|
381
381
|
|
|
382
382
|
const crawler = new BasicCrawler({
|
|
383
383
|
requestHandler: async ({ request, log }) => {
|
|
@@ -385,7 +385,6 @@ const crawler = new BasicCrawler({
|
|
|
385
385
|
},
|
|
386
386
|
configuration: new Configuration({ headless: false }),
|
|
387
387
|
storageBackend: new MemoryStorageBackend(),
|
|
388
|
-
eventManager: LocalEventManager.fromConfiguration(),
|
|
389
388
|
});
|
|
390
389
|
|
|
391
390
|
await crawler.run(['https://example.com']);
|
|
@@ -456,6 +455,15 @@ Renamed properties — `Dataset.config`, `KeyValueStore.config` and `BrowserLaun
|
|
|
456
455
|
|
|
457
456
|
The `configuration` crawler option is unchanged, as are `serviceLocator.getConfiguration()` and `serviceLocator.setConfiguration()`.
|
|
458
457
|
|
|
458
|
+
### The event manager no longer follows the crawler run
|
|
459
|
+
|
|
460
|
+
There is a single event manager per process, shared by all crawlers, and `crawler.run()` no longer initializes and closes it. It starts itself with the first listener and emits a final `persistState` event before the process exits, so a `RequestList`, a `SitemapRequestLoader` or a `KeyValueStore.getAutoSavedValue()` used outside of a crawler now persists its state periodically too. A crawler emits `persistState` at the end of every run.
|
|
461
|
+
|
|
462
|
+
- Calling `init()` yourself takes over the lifecycle, and it is then on you to call `close()`. A custom event manager that needs to await something to start (e.g. a connection) has to be initialized this way.
|
|
463
|
+
- To use a custom event manager, call `serviceLocator.setEventManager()` before anything else resolves one.
|
|
464
|
+
- `persistStateIntervalMillis` and `systemInfoIntervalMillis` are read from the configuration of whoever resolves the event manager first, so set them on the global configuration rather than on the one passed to a crawler.
|
|
465
|
+
- `LocalEventManager` emits `systemInfo` events only while something listens to them.
|
|
466
|
+
|
|
459
467
|
### Navigation and the request handler are timed separately
|
|
460
468
|
|
|
461
469
|
In v3, navigation ran inside the request handler's time window, and the two options were summed (plus an undocumented 10 second buffer) to form the actual limit. Setting `requestHandlerTimeoutSecs: 60` on a `PlaywrightCrawler` therefore produced errors complaining about 130 seconds.
|
|
@@ -510,7 +518,7 @@ const crawler = new BasicCrawler({
|
|
|
510
518
|
});
|
|
511
519
|
```
|
|
512
520
|
|
|
513
|
-
|
|
521
|
+
Passing both `sessionPool` and `proxyConfiguration` to a crawler throws, since a supplied pool would ignore the proxies. Assign the proxies in the pool's `createSessionFunction` instead:
|
|
514
522
|
|
|
515
523
|
```typescript
|
|
516
524
|
import { Session, SessionPool } from '@crawlee/basic';
|