@crawlee/cheerio 3.17.1-beta.21 → 3.17.1-beta.23

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.
@@ -1,5 +1,5 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
- import type { BasicCrawlingContext, Configuration, EnqueueLinksOptions, ErrorHandler, GetUserDataFromRequest, HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, RequestHandler, RequestProvider, RouterRoutes, SkippedRequestCallback } from '@crawlee/http';
2
+ import type { BasicCrawlingContext, Configuration, EnqueueLinksOptions, ErrorHandler, GetUserDataFromRequest, HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, RequestHandler, RequestProvider, RouterHandler, RouterRoutes, SkippedRequestCallback } from '@crawlee/http';
3
3
  import { HttpCrawler } from '@crawlee/http';
4
4
  import type { Dictionary } from '@crawlee/types';
5
5
  import { type CheerioRoot, type RobotsTxtFile } from '@crawlee/utils';
@@ -184,6 +184,6 @@ export declare function cheerioCrawlerEnqueueLinks(options: EnqueueLinksInternal
184
184
  * await crawler.run();
185
185
  * ```
186
186
  */
187
- // @ts-ignore optional peer dependency or compatibility with es2022
188
- export declare function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): import("@crawlee/http").RouterHandler<Context>;
187
+ export declare function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
188
+ export declare function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
189
189
  export {};
@@ -187,30 +187,6 @@ async function cheerioCrawlerEnqueueLinks(options) {
187
187
  ...enqueueLinksOptions,
188
188
  });
189
189
  }
190
- /**
191
- * Creates new {@link Router} instance that works based on request labels.
192
- * This instance can then serve as a `requestHandler` of your {@link CheerioCrawler}.
193
- * Defaults to the {@link CheerioCrawlingContext}.
194
- *
195
- * > Serves as a shortcut for using `Router.create<CheerioCrawlingContext>()`.
196
- *
197
- * ```ts
198
- * import { CheerioCrawler, createCheerioRouter } from 'crawlee';
199
- *
200
- * const router = createCheerioRouter();
201
- * router.addHandler('label-a', async (ctx) => {
202
- * ctx.log.info('...');
203
- * });
204
- * router.addDefaultHandler(async (ctx) => {
205
- * ctx.log.info('...');
206
- * });
207
- *
208
- * const crawler = new CheerioCrawler({
209
- * requestHandler: router,
210
- * });
211
- * await crawler.run();
212
- * ```
213
- */
214
190
  function createCheerioRouter(routes) {
215
191
  return http_1.Router.create(routes);
216
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/cheerio",
3
- "version": "3.17.1-beta.21",
3
+ "version": "3.17.1-beta.23",
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": ">=16.0.0"
@@ -53,9 +53,9 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@crawlee/http": "3.17.1-beta.21",
57
- "@crawlee/types": "3.17.1-beta.21",
58
- "@crawlee/utils": "3.17.1-beta.21",
56
+ "@crawlee/http": "3.17.1-beta.23",
57
+ "@crawlee/types": "3.17.1-beta.23",
58
+ "@crawlee/utils": "3.17.1-beta.23",
59
59
  "cheerio": "1.0.0-rc.12",
60
60
  "htmlparser2": "^9.0.0",
61
61
  "tslib": "^2.4.0"
@@ -67,5 +67,5 @@
67
67
  }
68
68
  }
69
69
  },
70
- "gitHead": "b315b66d9e3dffe8963cad291a85058ee0ef07c9"
70
+ "gitHead": "704d91af7d46c2efaf8bff883025e4a7d8ffd6d7"
71
71
  }