@crawlee/jsdom 4.0.0-beta.15 → 4.0.0-beta.150

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/README.md CHANGED
@@ -1,23 +1,23 @@
1
1
  <h1 align="center">
2
2
  <a href="https://crawlee.dev">
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-dark.svg?sanitize=true">
5
- <img alt="Crawlee" src="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-light.svg?sanitize=true" width="500">
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-dark.svg?sanitize=true" />
5
+ <img alt="Crawlee" src="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-light.svg?sanitize=true" width="500" />
6
6
  </picture>
7
7
  </a>
8
- <br>
8
+ <br />
9
9
  <small>A web scraping and browser automation library</small>
10
10
  </h1>
11
11
 
12
- <p align=center>
13
- <a href="https://trendshift.io/repositories/5179" target="_blank"><img src="https://trendshift.io/api/badge/repositories/5179" alt="apify%2Fcrawlee | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
12
+ <p align="center">
13
+ <a href="https://trendshift.io/repositories/5179" target="_blank"><img src="https://trendshift.io/api/badge/repositories/5179" alt="apify%2Fcrawlee | Trendshift" width="250" height="55"/></a>
14
14
  </p>
15
15
 
16
- <p align=center>
17
- <a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core.svg" alt="NPM latest version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" style="max-width: 100%;"></a>
18
- <a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/dm/@crawlee/core.svg" alt="Downloads" data-canonical-src="https://img.shields.io/npm/dm/@crawlee/core.svg" style="max-width: 100%;"></a>
19
- <a href="https://discord.gg/jyEM2PRvMU" rel="nofollow"><img src="https://img.shields.io/discord/801163717915574323?label=discord" alt="Chat on discord" data-canonical-src="https://img.shields.io/discord/801163717915574323?label=discord" style="max-width: 100%;"></a>
20
- <a href="https://github.com/apify/crawlee/actions/workflows/test-ci.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-ci.yml/badge.svg?branch=master" alt="Build Status" style="max-width: 100%;"></a>
16
+ <p align="center">
17
+ <a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core.svg" alt="NPM latest version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" /></a>
18
+ <a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/dm/@crawlee/core.svg" alt="Downloads" data-canonical-src="https://img.shields.io/npm/dm/@crawlee/core.svg" /></a>
19
+ <a href="https://discord.gg/jyEM2PRvMU" rel="nofollow"><img src="https://img.shields.io/discord/801163717915574323?label=discord" alt="Chat on discord" data-canonical-src="https://img.shields.io/discord/801163717915574323?label=discord" /></a>
20
+ <a href="https://github.com/apify/crawlee/actions/workflows/test-ci.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-ci.yml/badge.svg?branch=master" alt="Build Status" /></a>
21
21
  </p>
22
22
 
23
23
  Crawlee covers your crawling and scraping end-to-end and **helps you build reliable scrapers. Fast.**
@@ -89,7 +89,7 @@ By default, Crawlee stores data to `./storage` in the current working directory.
89
89
  We provide automated beta builds for every merged code change in Crawlee. You can find them in the npm [list of releases](https://www.npmjs.com/package/crawlee?activeTab=versions). If you want to test new features or bug fixes before we release them, feel free to install a beta build like this:
90
90
 
91
91
  ```bash
92
- npm install crawlee@3.12.3-beta.13
92
+ npm install crawlee@next
93
93
  ```
94
94
 
95
95
  If you also use the [Apify SDK](https://github.com/apify/apify-sdk-js), you need to specify dependency overrides in your `package.json` file so that you don't end up with multiple versions of Crawlee installed:
@@ -98,9 +98,9 @@ If you also use the [Apify SDK](https://github.com/apify/apify-sdk-js), you need
98
98
  {
99
99
  "overrides": {
100
100
  "apify": {
101
- "@crawlee/core": "3.12.3-beta.13",
102
- "@crawlee/types": "3.12.3-beta.13",
103
- "@crawlee/utils": "3.12.3-beta.13"
101
+ "@crawlee/core": "$crawlee",
102
+ "@crawlee/types": "$crawlee",
103
+ "@crawlee/utils": "$crawlee"
104
104
  }
105
105
  }
106
106
  }
package/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from '@crawlee/http';
2
2
  export * from './internals/jsdom-crawler.js';
3
- //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from '@crawlee/http';
2
2
  export * from './internals/jsdom-crawler.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,13 +1,16 @@
1
- import type { BasicCrawlingContext, Configuration, EnqueueLinksOptions, ErrorHandler, GetUserDataFromRequest, HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, RequestHandler, RequestProvider, RouterRoutes, SkippedRequestCallback } from '@crawlee/http';
1
+ import type { AddRequestsBatchedResult, ContextPipeline, CrawlingContext, EnqueueLinksOptions, ErrorHandler, ExtractLinksOptions, GetUserDataFromRequest, HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, RequestHandler, RouterHandler, RouterRoutes, RouteSchemas, RoutesFromSchemas } from '@crawlee/http';
2
2
  import { HttpCrawler } from '@crawlee/http';
3
3
  import type { Dictionary } from '@crawlee/types';
4
- import { type CheerioRoot, type RobotsTxtFile } from '@crawlee/utils';
4
+ import type { CheerioAPI } from 'cheerio';
5
5
  import type { DOMWindow } from 'jsdom';
6
6
  import { VirtualConsole } from 'jsdom';
7
+ import { z } from 'zod';
7
8
  export type JSDOMErrorHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
8
- JSONData extends Dictionary = any> = ErrorHandler<JSDOMCrawlingContext<UserData, JSONData>>;
9
- export interface JSDOMCrawlerOptions<ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext, UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
10
- JSONData extends Dictionary = any> extends HttpCrawlerOptions<JSDOMCrawlingContext<UserData, JSONData>, ExtendedContext> {
9
+ JSONData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
10
+ ContextExtension = Dictionary<never>> = ErrorHandler<CrawlingContext, JSDOMCrawlingContext<UserData, JSONData> & ContextExtension>;
11
+ export interface JSDOMCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext & ContextExtension, UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
12
+ JSONData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
13
+ Routes extends Record<keyof Routes, Dictionary> = Record<string, UserData>, StatisticStateExtension extends object = {}> extends HttpCrawlerOptions<JSDOMCrawlingContext<UserData, JSONData>, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
11
14
  /**
12
15
  * Download and run scripts.
13
16
  */
@@ -50,101 +53,142 @@ JSONData extends Dictionary = any> extends InternalHttpCrawlingContext<UserData,
50
53
  * });
51
54
  * ```
52
55
  */
53
- parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioRoot>;
56
+ parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioAPI>;
57
+ /**
58
+ * Extracts URLs from the parsed DOM, without adding them to the request queue.
59
+ */
60
+ extractLinks(options?: ExtractLinksOptions): Promise<string[]>;
61
+ /**
62
+ * Helper function for extracting URLs from the parsed DOM and adding them to the request queue.
63
+ */
64
+ enqueueLinks(options?: EnqueueLinksOptions): Promise<AddRequestsBatchedResult>;
54
65
  }
55
66
  export type JSDOMRequestHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
56
67
  JSONData extends Dictionary = any> = RequestHandler<JSDOMCrawlingContext<UserData, JSONData>>;
57
- export declare class JSDOMCrawler<ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext> extends HttpCrawler<JSDOMCrawlingContext, ExtendedContext> {
68
+ export declare class JSDOMCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<JSDOMCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends HttpCrawler<JSDOMCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
69
+ #private;
70
+ /**
71
+ * @internal
72
+ */
58
73
  protected static optionsShape: {
59
- // @ts-ignore optional peer dependency or compatibility with es2022
60
- runScripts: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
61
- // @ts-ignore optional peer dependency or compatibility with es2022
62
- hideInternalConsole: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
63
- // @ts-ignore optional peer dependency or compatibility with es2022
64
- navigationTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
65
- // @ts-ignore optional peer dependency or compatibility with es2022
66
- ignoreSslErrors: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
67
- // @ts-ignore optional peer dependency or compatibility with es2022
68
- additionalMimeTypes: import("ow").ArrayPredicate<string>;
69
- // @ts-ignore optional peer dependency or compatibility with es2022
70
- suggestResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
71
- // @ts-ignore optional peer dependency or compatibility with es2022
72
- forceResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
73
- // @ts-ignore optional peer dependency or compatibility with es2022
74
- persistCookiesPerSession: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
75
- // @ts-ignore optional peer dependency or compatibility with es2022
76
- additionalHttpErrorStatusCodes: import("ow").ArrayPredicate<number>;
77
- // @ts-ignore optional peer dependency or compatibility with es2022
78
- ignoreHttpErrorStatusCodes: import("ow").ArrayPredicate<number>;
79
- // @ts-ignore optional peer dependency or compatibility with es2022
80
- preNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
81
- // @ts-ignore optional peer dependency or compatibility with es2022
82
- postNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
83
- // @ts-ignore optional peer dependency or compatibility with es2022
84
- contextPipelineBuilder: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
85
- // @ts-ignore optional peer dependency or compatibility with es2022
86
- extendContext: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
87
- // @ts-ignore optional peer dependency or compatibility with es2022
88
- requestList: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
89
- // @ts-ignore optional peer dependency or compatibility with es2022
90
- requestQueue: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
91
- // @ts-ignore optional peer dependency or compatibility with es2022
92
- requestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
93
- // @ts-ignore optional peer dependency or compatibility with es2022
94
- requestHandlerTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
95
- // @ts-ignore optional peer dependency or compatibility with es2022
96
- errorHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
97
- // @ts-ignore optional peer dependency or compatibility with es2022
98
- failedRequestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
99
- // @ts-ignore optional peer dependency or compatibility with es2022
100
- maxRequestRetries: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
101
- // @ts-ignore optional peer dependency or compatibility with es2022
102
- sameDomainDelaySecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
103
- // @ts-ignore optional peer dependency or compatibility with es2022
104
- maxSessionRotations: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
105
- // @ts-ignore optional peer dependency or compatibility with es2022
106
- maxRequestsPerCrawl: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
107
- // @ts-ignore optional peer dependency or compatibility with es2022
108
- maxCrawlDepth: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
109
- // @ts-ignore optional peer dependency or compatibility with es2022
110
- autoscaledPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
111
- // @ts-ignore optional peer dependency or compatibility with es2022
112
- sessionPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
113
- // @ts-ignore optional peer dependency or compatibility with es2022
114
- useSessionPool: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
115
- // @ts-ignore optional peer dependency or compatibility with es2022
116
- proxyConfiguration: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
117
- // @ts-ignore optional peer dependency or compatibility with es2022
118
- statusMessageLoggingInterval: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
119
- // @ts-ignore optional peer dependency or compatibility with es2022
120
- statusMessageCallback: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
121
- // @ts-ignore optional peer dependency or compatibility with es2022
122
- retryOnBlocked: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
123
- // @ts-ignore optional peer dependency or compatibility with es2022
124
- respectRobotsTxtFile: import("ow").AnyPredicate<boolean | object>;
125
- // @ts-ignore optional peer dependency or compatibility with es2022
126
- onSkippedRequest: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
127
- // @ts-ignore optional peer dependency or compatibility with es2022
128
- httpClient: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
129
- // @ts-ignore optional peer dependency or compatibility with es2022
130
- minConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
131
- // @ts-ignore optional peer dependency or compatibility with es2022
132
- maxConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
133
- // @ts-ignore optional peer dependency or compatibility with es2022
134
- maxRequestsPerMinute: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
135
- // @ts-ignore optional peer dependency or compatibility with es2022
136
- keepAlive: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
137
- // @ts-ignore optional peer dependency or compatibility with es2022
138
- log: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
139
- // @ts-ignore optional peer dependency or compatibility with es2022
140
- experiments: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
141
- // @ts-ignore optional peer dependency or compatibility with es2022
142
- statisticsOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
74
+ contextPipelineBuilder: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
75
+ extendContext: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
76
+ requestList: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
77
+ requestQueue: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
78
+ requestManager: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
79
+ requestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
80
+ requestHandlerTimeoutSecs: z.ZodOptional<z.ZodCustom<number, number>>;
81
+ errorHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
82
+ failedRequestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
83
+ maxRequestRetries: z.ZodDefault<z.ZodCustom<number, number>>;
84
+ sameDomainDelaySecs: z.ZodDefault<z.ZodCustom<number, number>>;
85
+ maxRequestsPerCrawl: z.ZodOptional<z.ZodCustom<number, number>>;
86
+ maxCrawlDepth: z.ZodOptional<z.ZodCustom<number, number>>;
87
+ taskLoopOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
88
+ concurrencySystem: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
89
+ sessionPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
90
+ proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
91
+ statusMessageLoggingInterval: z.ZodDefault<z.ZodCustom<number, number>>;
92
+ statusMessageCallback: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
93
+ additionalHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
94
+ ignoreHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
95
+ blockedStatusCodes: z.ZodOptional<z.ZodArray<z.ZodCustom<number, number>>>;
96
+ retryOnBlocked: z.ZodDefault<z.ZodBoolean>;
97
+ respectRobotsTxtFile: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<Dictionary, Dictionary>]>>;
98
+ transactionalStorage: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
99
+ requestQueue: z.ZodOptional<z.ZodEnum<{
100
+ deferred: "deferred";
101
+ writeThrough: "writeThrough";
102
+ }>>;
103
+ }, z.core.$strict>]>>;
104
+ onSkippedRequest: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
105
+ // @ts-ignore optional peer dependency or compatibility with es2022
106
+ httpClient: z.ZodOptional<z.ZodCustom<import("@crawlee/http-client").BaseHttpClient, import("@crawlee/http-client").BaseHttpClient>>;
107
+ // @ts-ignore optional peer dependency or compatibility with es2022
108
+ configuration: z.ZodOptional<z.ZodCustom<import("@crawlee/http").Configuration, import("@crawlee/http").Configuration>>;
109
+ storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
110
+ // @ts-ignore optional peer dependency or compatibility with es2022
111
+ eventManager: z.ZodOptional<z.ZodCustom<import("@crawlee/http").EventManager, import("@crawlee/http").EventManager>>;
112
+ logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
113
+ minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
114
+ maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
115
+ initialConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
116
+ maxRequestsPerMinute: z.ZodOptional<z.ZodCustom<number, number>>;
117
+ keepAlive: z.ZodOptional<z.ZodBoolean>;
118
+ statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
119
+ id: z.ZodOptional<z.ZodString>;
120
+ navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
121
+ ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
122
+ additionalMimeTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
123
+ suggestResponseEncoding: z.ZodOptional<z.ZodString>;
124
+ forceResponseEncoding: z.ZodOptional<z.ZodString>;
125
+ saveResponseCookies: z.ZodDefault<z.ZodBoolean>;
126
+ preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
127
+ postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
128
+ runScripts: z.ZodOptional<z.ZodBoolean>;
129
+ hideInternalConsole: z.ZodOptional<z.ZodBoolean>;
143
130
  };
144
- protected runScripts: boolean;
145
- protected hideInternalConsole: boolean;
146
- protected virtualConsole: VirtualConsole | null;
147
- constructor(options?: JSDOMCrawlerOptions<ExtendedContext>, config?: Configuration);
131
+ /** @internal */
132
+ protected static optionsSchema: z.ZodObject<{
133
+ contextPipelineBuilder: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
134
+ extendContext: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
135
+ requestList: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
136
+ requestQueue: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
137
+ requestManager: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
138
+ requestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
139
+ requestHandlerTimeoutSecs: z.ZodOptional<z.ZodCustom<number, number>>;
140
+ errorHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
141
+ failedRequestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
142
+ maxRequestRetries: z.ZodDefault<z.ZodCustom<number, number>>;
143
+ sameDomainDelaySecs: z.ZodDefault<z.ZodCustom<number, number>>;
144
+ maxRequestsPerCrawl: z.ZodOptional<z.ZodCustom<number, number>>;
145
+ maxCrawlDepth: z.ZodOptional<z.ZodCustom<number, number>>;
146
+ taskLoopOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
147
+ concurrencySystem: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
148
+ sessionPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
149
+ proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
150
+ statusMessageLoggingInterval: z.ZodDefault<z.ZodCustom<number, number>>;
151
+ statusMessageCallback: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
152
+ additionalHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
153
+ ignoreHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
154
+ blockedStatusCodes: z.ZodOptional<z.ZodArray<z.ZodCustom<number, number>>>;
155
+ retryOnBlocked: z.ZodDefault<z.ZodBoolean>;
156
+ respectRobotsTxtFile: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<Dictionary, Dictionary>]>>;
157
+ transactionalStorage: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
158
+ requestQueue: z.ZodOptional<z.ZodEnum<{
159
+ deferred: "deferred";
160
+ writeThrough: "writeThrough";
161
+ }>>;
162
+ }, z.core.$strict>]>>;
163
+ onSkippedRequest: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
164
+ // @ts-ignore optional peer dependency or compatibility with es2022
165
+ httpClient: z.ZodOptional<z.ZodCustom<import("@crawlee/http-client").BaseHttpClient, import("@crawlee/http-client").BaseHttpClient>>;
166
+ // @ts-ignore optional peer dependency or compatibility with es2022
167
+ configuration: z.ZodOptional<z.ZodCustom<import("@crawlee/http").Configuration, import("@crawlee/http").Configuration>>;
168
+ storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
169
+ // @ts-ignore optional peer dependency or compatibility with es2022
170
+ eventManager: z.ZodOptional<z.ZodCustom<import("@crawlee/http").EventManager, import("@crawlee/http").EventManager>>;
171
+ logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
172
+ minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
173
+ maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
174
+ initialConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
175
+ maxRequestsPerMinute: z.ZodOptional<z.ZodCustom<number, number>>;
176
+ keepAlive: z.ZodOptional<z.ZodBoolean>;
177
+ statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
178
+ id: z.ZodOptional<z.ZodString>;
179
+ navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
180
+ ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
181
+ additionalMimeTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
182
+ suggestResponseEncoding: z.ZodOptional<z.ZodString>;
183
+ forceResponseEncoding: z.ZodOptional<z.ZodString>;
184
+ saveResponseCookies: z.ZodDefault<z.ZodBoolean>;
185
+ preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
186
+ postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
187
+ runScripts: z.ZodOptional<z.ZodBoolean>;
188
+ hideInternalConsole: z.ZodOptional<z.ZodBoolean>;
189
+ }, z.core.$strict>;
190
+ constructor(options?: JSDOMCrawlerOptions<ContextExtension, ExtendedContext, any, any, Routes, StatisticStateExtension>);
191
+ protected buildContextPipeline(): ContextPipeline<CrawlingContext, JSDOMCrawlingContext>;
148
192
  /**
149
193
  * Returns the currently used `VirtualConsole` instance. Can be used to listen for the JSDOM's internal console messages.
150
194
  *
@@ -164,24 +208,6 @@ export declare class JSDOMCrawler<ExtendedContext extends JSDOMCrawlingContext =
164
208
  private parseContent;
165
209
  private addHelpers;
166
210
  }
167
- interface EnqueueLinksInternalOptions {
168
- options?: EnqueueLinksOptions;
169
- window: DOMWindow | null;
170
- requestQueue: RequestProvider;
171
- robotsTxtFile?: RobotsTxtFile;
172
- onSkippedRequest?: SkippedRequestCallback;
173
- originalRequestUrl: string;
174
- finalRequestUrl?: string;
175
- }
176
- interface BoundEnqueueLinksInternalOptions {
177
- enqueueLinks: BasicCrawlingContext['enqueueLinks'];
178
- options?: EnqueueLinksOptions;
179
- window: DOMWindow | null;
180
- originalRequestUrl: string;
181
- finalRequestUrl?: string;
182
- }
183
- /** @internal */
184
- export declare function domCrawlerEnqueueLinks(options: EnqueueLinksInternalOptions | BoundEnqueueLinksInternalOptions): Promise<unknown>;
185
211
  /**
186
212
  * Creates new {@link Router} instance that works based on request labels.
187
213
  * This instance can then serve as a `requestHandler` of your {@link JSDOMCrawler}.
@@ -206,7 +232,6 @@ export declare function domCrawlerEnqueueLinks(options: EnqueueLinksInternalOpti
206
232
  * await crawler.run();
207
233
  * ```
208
234
  */
209
- // @ts-ignore optional peer dependency or compatibility with es2022
210
- export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): import("@crawlee/http").RouterHandler<Context>;
211
- export {};
212
- //# sourceMappingURL=jsdom-crawler.d.ts.map
235
+ export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
236
+ export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
237
+ export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, const Schemas extends RouteSchemas = RouteSchemas>(schemas: Schemas): RouterHandler<Context, RoutesFromSchemas<Schemas>>;
@@ -1,8 +1,8 @@
1
- import { enqueueLinks, HttpCrawler, resolveBaseUrlForEnqueueLinksFiltering, Router, tryAbsoluteURL, } from '@crawlee/http';
1
+ import { EnqueueStrategy, HttpCrawler, NavigationSkippedError, resolveBaseUrlForEnqueueLinksFiltering, Router, } from '@crawlee/http';
2
2
  import { sleep } from '@crawlee/utils';
3
- import * as cheerio from 'cheerio';
3
+ import { parseArgument, tryAbsoluteURL } from '@crawlee/utils/internal';
4
4
  import { JSDOM, ResourceLoader, VirtualConsole } from 'jsdom';
5
- import ow from 'ow';
5
+ import { z } from 'zod';
6
6
  import { addTimeoutToPromise } from '@apify/timeout';
7
7
  /**
8
8
  * Provides a framework for the parallel crawling of web pages using plain HTTP requests and
@@ -26,38 +26,40 @@ import { addTimeoutToPromise } from '@apify/timeout';
26
26
  * and then invokes the user-provided {@link JSDOMCrawlerOptions.requestHandler} to extract page data
27
27
  * using the `window` object.
28
28
  *
29
- * The source URLs are represented using {@link Request} objects that are fed from
30
- * {@link RequestList} or {@link RequestQueue} instances provided by the {@link JSDOMCrawlerOptions.requestList}
31
- * or {@link JSDOMCrawlerOptions.requestQueue} constructor options, respectively.
29
+ * The source URLs are represented using {@link Request} objects that are fed from the
30
+ * {@link IRequestManager|request manager} provided via the {@link JSDOMCrawlerOptions.requestManager|`requestManager`}
31
+ * constructor option (a {@link RequestQueue} is itself a request manager). To read from a read-only source such
32
+ * as a {@link RequestList} while still being able to enqueue new requests, combine it with a queue into a
33
+ * {@link RequestManagerTandem} via {@link IRequestLoader.toTandem|`requestLoader.toTandem()`} and pass the
34
+ * result as `requestManager`.
32
35
  *
33
- * If both {@link JSDOMCrawlerOptions.requestList} and {@link JSDOMCrawlerOptions.requestQueue} are used,
34
- * the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
35
- * to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
36
+ * > The {@link JSDOMCrawlerOptions.requestList|`requestList`} and {@link JSDOMCrawlerOptions.requestQueue|`requestQueue`}
37
+ * > options are deprecated; they are still accepted and folded into a single `requestManager` for back-compat.
36
38
  *
37
39
  * The crawler finishes when there are no more {@link Request} objects to crawl.
38
40
  *
39
- * We can use the `preNavigationHooks` to adjust `gotOptions`:
41
+ * We can use the `preNavigationHooks` to adjust the crawling context before the request is made:
40
42
  *
41
43
  * ```
42
44
  * preNavigationHooks: [
43
- * (crawlingContext, gotOptions) => {
45
+ * (crawlingContext) => {
44
46
  * // ...
45
47
  * },
46
48
  * ]
47
49
  * ```
48
50
  *
49
- * By default, `JSDOMCrawler` only processes web pages with the `text/html`
50
- * and `application/xhtml+xml` MIME content types (as reported by the `Content-Type` HTTP header),
51
+ * By default, `JSDOMCrawler` only processes web pages with the `text/html`, `application/xhtml+xml`, `text/xml`, `application/xml`,
52
+ * and `application/json` MIME content types (as reported by the `Content-Type` HTTP header),
51
53
  * and skips pages with other content types. If you want the crawler to process other content types,
52
54
  * use the {@link JSDOMCrawlerOptions.additionalMimeTypes} constructor option.
53
55
  * Beware that the parsing behavior differs for HTML, XML, JSON and other types of content.
54
56
  * For more details, see {@link JSDOMCrawlerOptions.requestHandler}.
55
57
  *
56
- * New requests are only dispatched when there is enough free CPU and memory available,
57
- * using the functionality provided by the {@link AutoscaledPool} class.
58
- * All {@link AutoscaledPool} configuration options can be passed to the `autoscaledPoolOptions`
59
- * parameter of the `CheerioCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
60
- * {@link AutoscaledPool} options are available directly in the `CheerioCrawler` constructor.
58
+ * New requests are only dispatched when there is enough free CPU and memory available, as judged by the crawler's
59
+ * {@link ConcurrencySystem}.
60
+ * Concurrency is tuned via the `minConcurrency`, `maxConcurrency` and `maxRequestsPerMinute` options of the
61
+ * `JSDOMCrawler` constructor, or, for finer control, by injecting a pre-configured
62
+ * {@link ConcurrencySystem|`concurrencySystem`}.
61
63
  *
62
64
  * **Example usage:**
63
65
  *
@@ -83,30 +85,39 @@ const resources = new ResourceLoader({
83
85
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
84
86
  });
85
87
  export class JSDOMCrawler extends HttpCrawler {
88
+ /**
89
+ * @internal
90
+ */
86
91
  static optionsShape = {
87
92
  ...HttpCrawler.optionsShape,
88
- runScripts: ow.optional.boolean,
89
- hideInternalConsole: ow.optional.boolean,
93
+ runScripts: z.boolean().optional(),
94
+ hideInternalConsole: z.boolean().optional(),
90
95
  };
91
- runScripts;
92
- hideInternalConsole;
93
- virtualConsole = null;
94
- constructor(options = {}, config) {
95
- const { runScripts = false, hideInternalConsole = false, ...httpOptions } = options;
96
+ /** @internal */
97
+ static optionsSchema = z.strictObject(JSDOMCrawler.optionsShape);
98
+ #runScripts;
99
+ #hideInternalConsole;
100
+ #virtualConsole = null;
101
+ constructor(options = {}) {
102
+ const { runScripts = false, hideInternalConsole = false, contextPipelineBuilder, ...httpOptions } = parseArgument(options, JSDOMCrawler.optionsSchema, 'JSDOMCrawlerOptions');
96
103
  super({
97
104
  ...httpOptions,
98
- contextPipelineBuilder: () => this.buildContextPipeline()
99
- .compose({
100
- action: async (context) => await this.parseContent(context),
101
- cleanup: async (context) => {
102
- this.getVirtualConsole().off('jsdomError', this.jsdomErrorHandler);
103
- context.window?.close();
104
- },
105
- })
106
- .compose({ action: async (context) => await this.addHelpers(context) }),
107
- }, config);
108
- this.runScripts = runScripts;
109
- this.hideInternalConsole = hideInternalConsole;
105
+ contextPipelineBuilder: contextPipelineBuilder ?? (() => this.buildContextPipeline()),
106
+ });
107
+ this.#runScripts = runScripts;
108
+ this.#hideInternalConsole = hideInternalConsole;
109
+ }
110
+ buildContextPipeline() {
111
+ return super
112
+ .buildContextPipeline()
113
+ .compose({
114
+ action: async (context) => await this.parseContent(context),
115
+ cleanup: async (context) => {
116
+ this.getVirtualConsole().off('jsdomError', this.jsdomErrorHandler);
117
+ context.window?.close();
118
+ },
119
+ })
120
+ .compose({ action: async (context) => await this.addHelpers(context) });
110
121
  }
111
122
  /**
112
123
  * Returns the currently used `VirtualConsole` instance. Can be used to listen for the JSDOM's internal console messages.
@@ -123,86 +134,116 @@ export class JSDOMCrawler extends HttpCrawler {
123
134
  * ```
124
135
  */
125
136
  getVirtualConsole() {
126
- if (this.virtualConsole) {
127
- return this.virtualConsole;
137
+ if (this.#virtualConsole) {
138
+ return this.#virtualConsole;
128
139
  }
129
- this.virtualConsole = new VirtualConsole();
130
- if (!this.hideInternalConsole) {
131
- this.virtualConsole.sendTo(console, { omitJSDOMErrors: true });
140
+ this.#virtualConsole = new VirtualConsole();
141
+ if (!this.#hideInternalConsole) {
142
+ this.#virtualConsole.sendTo(console, { omitJSDOMErrors: true });
132
143
  }
133
- this.virtualConsole.on('jsdomError', this.jsdomErrorHandler);
134
- return this.virtualConsole;
144
+ this.#virtualConsole.on('jsdomError', this.jsdomErrorHandler);
145
+ return this.#virtualConsole;
135
146
  }
136
- jsdomErrorHandler = (error) => this.log.debug('JSDOM error from console', error);
147
+ jsdomErrorHandler = (error) => this.log.debug('JSDOM error from console', { error });
137
148
  async parseContent(crawlingContext) {
138
- const isXml = crawlingContext.contentType.type.includes('xml');
139
- // TODO handle non-string
140
- const { window } = new JSDOM(crawlingContext.body.toString(), {
141
- url: crawlingContext.response.url,
142
- contentType: isXml ? 'text/xml' : 'text/html',
143
- runScripts: this.runScripts ? 'dangerously' : undefined,
144
- resources,
145
- virtualConsole: this.getVirtualConsole(),
146
- pretendToBeVisual: true,
147
- });
148
- // add some stubs in place of missing API so processing won't fail
149
- Object.defineProperty(window, 'matchMedia', {
150
- writable: true,
151
- value: (query) => ({
152
- matches: false,
153
- media: query,
154
- onchange: null,
155
- addListener: () => { },
156
- removeListener: () => { },
157
- addEventListener: () => { },
158
- removeEventListener: () => { },
159
- dispatchEvent: () => { },
160
- }),
161
- });
162
- window.document.createRange = () => {
163
- const range = new window.Range();
164
- range.getBoundingClientRect = () => ({});
165
- range.getClientRects = () => ({ item: () => null, length: 0 });
166
- return range;
167
- };
168
- if (this.runScripts) {
169
- try {
170
- await addTimeoutToPromise(async () => {
171
- return new Promise((resolve) => {
172
- window.addEventListener('load', () => {
173
- resolve();
174
- }, false);
175
- }).catch();
176
- }, 10_000, 'Window.load event not fired after 10 seconds.').catch();
149
+ try {
150
+ const isXml = crawlingContext.contentType.type.includes('xml');
151
+ // TODO handle non-string
152
+ const { window } = new JSDOM(crawlingContext.body.toString(), {
153
+ url: crawlingContext.response.url,
154
+ contentType: isXml ? 'text/xml' : 'text/html',
155
+ runScripts: this.#runScripts ? 'dangerously' : undefined,
156
+ resources,
157
+ virtualConsole: this.getVirtualConsole(),
158
+ pretendToBeVisual: true,
159
+ });
160
+ // add some stubs in place of missing API so processing won't fail
161
+ Object.defineProperty(window, 'matchMedia', {
162
+ writable: true,
163
+ value: (query) => ({
164
+ matches: false,
165
+ media: query,
166
+ onchange: null,
167
+ addListener: () => { },
168
+ removeListener: () => { },
169
+ addEventListener: () => { },
170
+ removeEventListener: () => { },
171
+ dispatchEvent: () => { },
172
+ }),
173
+ });
174
+ window.document.createRange = () => {
175
+ const range = new window.Range();
176
+ range.getBoundingClientRect = () => ({});
177
+ range.getClientRects = () => ({ item: () => null, length: 0 });
178
+ return range;
179
+ };
180
+ if (this.#runScripts) {
181
+ try {
182
+ await addTimeoutToPromise(async () => {
183
+ return new Promise((resolve) => {
184
+ window.addEventListener('load', () => {
185
+ resolve();
186
+ }, false);
187
+ }).catch();
188
+ }, 10_000, 'Window.load event not fired after 10 seconds.').catch();
189
+ }
190
+ catch (e) {
191
+ this.log.debug(e.message);
192
+ }
177
193
  }
178
- catch (e) {
179
- this.log.debug(e.message);
194
+ return {
195
+ window,
196
+ get body() {
197
+ return window.document.documentElement.outerHTML;
198
+ },
199
+ get document() {
200
+ return window.document;
201
+ },
202
+ };
203
+ }
204
+ catch (err) {
205
+ if (err instanceof NavigationSkippedError) {
206
+ return {
207
+ get window() {
208
+ throw new NavigationSkippedError('The `window` property is not available - `skipNavigation` was used', { cause: err });
209
+ },
210
+ get body() {
211
+ throw new NavigationSkippedError('The `body` property is not available - `skipNavigation` was used', { cause: err });
212
+ },
213
+ get document() {
214
+ throw new NavigationSkippedError('The `document` property is not available - `skipNavigation` was used', { cause: err });
215
+ },
216
+ };
180
217
  }
218
+ throw err;
181
219
  }
182
- return {
183
- window,
184
- get body() {
185
- return window.document.documentElement.outerHTML;
186
- },
187
- get document() {
188
- return window.document;
189
- },
190
- };
191
220
  }
192
221
  async addHelpers(crawlingContext) {
222
+ const addRequests = crawlingContext.addRequests;
223
+ const extractLinks = async (options) => {
224
+ if (!crawlingContext.window) {
225
+ throw new Error('Cannot extract links because the JSDOM is not available.');
226
+ }
227
+ return extractUrlsFromWindow(crawlingContext.window, options?.selector ?? 'a', options?.baseUrl ?? crawlingContext.request.loadedUrl ?? crawlingContext.request.url);
228
+ };
193
229
  return {
194
- enqueueLinks: async (enqueueOptions) => {
195
- return domCrawlerEnqueueLinks({
196
- options: { ...enqueueOptions, limit: this.calculateEnqueuedRequestLimit(enqueueOptions?.limit) },
197
- window: crawlingContext.window,
198
- requestQueue: await this.getRequestQueue(),
199
- robotsTxtFile: await this.getRobotsTxtFileForUrl(crawlingContext.request.url),
200
- onSkippedRequest: this.handleSkippedRequest,
201
- originalRequestUrl: crawlingContext.request.url,
230
+ extractLinks,
231
+ enqueueLinks: async (options = {}) => {
232
+ const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({
233
+ enqueueStrategy: options.strategy,
202
234
  finalRequestUrl: crawlingContext.request.loadedUrl,
235
+ originalRequestUrl: crawlingContext.request.url,
236
+ userProvidedBaseUrl: options.baseUrl,
237
+ });
238
+ const urls = await extractLinks(options);
239
+ return addRequests(urls, {
240
+ ...options,
241
+ baseUrl,
242
+ strategy: options.strategy ?? EnqueueStrategy.SameHostname,
203
243
  });
204
244
  },
205
245
  async waitForSelector(selector, timeoutMs = 5_000) {
246
+ const cheerio = await import('cheerio');
206
247
  const $ = cheerio.load(crawlingContext.body);
207
248
  if ($(selector).get().length === 0) {
208
249
  if (timeoutMs) {
@@ -214,6 +255,7 @@ export class JSDOMCrawler extends HttpCrawler {
214
255
  }
215
256
  },
216
257
  async parseWithCheerio(selector, _timeoutMs = 5_000) {
258
+ const cheerio = await import('cheerio');
217
259
  const $ = cheerio.load(crawlingContext.body);
218
260
  if (selector && $(selector).get().length === 0) {
219
261
  throw new Error(`Selector '${selector}' not found.`);
@@ -223,39 +265,6 @@ export class JSDOMCrawler extends HttpCrawler {
223
265
  };
224
266
  }
225
267
  }
226
- /** @internal */
227
- function containsEnqueueLinks(options) {
228
- return !!options.enqueueLinks;
229
- }
230
- /** @internal */
231
- export async function domCrawlerEnqueueLinks(options) {
232
- const { options: enqueueLinksOptions, window, originalRequestUrl, finalRequestUrl } = options;
233
- if (!window) {
234
- throw new Error('Cannot enqueue links because the JSDOM is not available.');
235
- }
236
- const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({
237
- enqueueStrategy: enqueueLinksOptions?.strategy,
238
- finalRequestUrl,
239
- originalRequestUrl,
240
- userProvidedBaseUrl: enqueueLinksOptions?.baseUrl,
241
- });
242
- const urls = extractUrlsFromWindow(window, enqueueLinksOptions?.selector ?? 'a', enqueueLinksOptions?.baseUrl ?? finalRequestUrl ?? originalRequestUrl);
243
- if (containsEnqueueLinks(options)) {
244
- return options.enqueueLinks({
245
- urls,
246
- baseUrl,
247
- ...enqueueLinksOptions,
248
- });
249
- }
250
- return enqueueLinks({
251
- requestQueue: options.requestQueue,
252
- robotsTxtFile: options.robotsTxtFile,
253
- onSkippedRequest: options.onSkippedRequest,
254
- urls,
255
- baseUrl,
256
- ...enqueueLinksOptions,
257
- });
258
- }
259
268
  /**
260
269
  * Extracts URLs from a given Window object.
261
270
  * @ignore
@@ -272,31 +281,6 @@ function extractUrlsFromWindow(window, selector, baseUrl) {
272
281
  })
273
282
  .filter((href) => href !== undefined && href !== '');
274
283
  }
275
- /**
276
- * Creates new {@link Router} instance that works based on request labels.
277
- * This instance can then serve as a `requestHandler` of your {@link JSDOMCrawler}.
278
- * Defaults to the {@link JSDOMCrawlingContext}.
279
- *
280
- * > Serves as a shortcut for using `Router.create<JSDOMCrawlingContext>()`.
281
- *
282
- * ```ts
283
- * import { JSDOMCrawler, createJSDOMRouter } from 'crawlee';
284
- *
285
- * const router = createJSDOMRouter();
286
- * router.addHandler('label-a', async (ctx) => {
287
- * ctx.log.info('...');
288
- * });
289
- * router.addDefaultHandler(async (ctx) => {
290
- * ctx.log.info('...');
291
- * });
292
- *
293
- * const crawler = new JSDOMCrawler({
294
- * requestHandler: router,
295
- * });
296
- * await crawler.run();
297
- * ```
298
- */
299
- export function createJSDOMRouter(routes) {
300
- return Router.create(routes);
284
+ export function createJSDOMRouter(routesOrSchemas) {
285
+ return Router.create(routesOrSchemas);
301
286
  }
302
- //# sourceMappingURL=jsdom-crawler.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/jsdom",
3
- "version": "4.0.0-beta.15",
3
+ "version": "4.0.0-beta.150",
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"
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://crawlee.dev",
40
40
  "scripts": {
41
- "build": "yarn clean && yarn compile && yarn copy",
41
+ "build": "pnpm clean && pnpm compile && pnpm copy",
42
42
  "clean": "rimraf ./dist",
43
43
  "compile": "tsc -p tsconfig.build.json",
44
44
  "copy": "tsx ../../scripts/copy.ts"
@@ -47,16 +47,16 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@apify/timeout": "^0.3.0",
50
+ "@apify/timeout": "^0.4.4",
51
51
  "@apify/utilities": "^2.7.10",
52
- "@crawlee/http": "4.0.0-beta.15",
53
- "@crawlee/types": "4.0.0-beta.15",
54
- "@crawlee/utils": "4.0.0-beta.15",
52
+ "@crawlee/http": "4.0.0-beta.150",
53
+ "@crawlee/types": "4.0.0-beta.150",
54
+ "@crawlee/utils": "4.0.0-beta.150",
55
55
  "@types/jsdom": "^21.1.7",
56
56
  "cheerio": "^1.0.0",
57
57
  "jsdom": "^26.1.0",
58
- "ow": "^2.0.0",
59
- "tslib": "^2.8.1"
58
+ "tslib": "^2.8.1",
59
+ "zod": "^4.4.3"
60
60
  },
61
61
  "lerna": {
62
62
  "command": {
@@ -65,5 +65,5 @@
65
65
  }
66
66
  }
67
67
  },
68
- "gitHead": "3276fd24a03ecb0204369c197db781010d6d3e7a"
68
+ "gitHead": "ef7e9fb2e2fcaa0f74e60a30fa8ae61c60c64626"
69
69
  }
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsdom-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/jsdom-crawler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,sBAAsB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEH,WAAW,EAId,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAS,MAAM,gBAAgB,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAyB,cAAc,EAAE,MAAM,OAAO,CAAC;AAK9D,MAAM,MAAM,iBAAiB,CACzB,QAAQ,SAAS,UAAU,GAAG,GAAG,EAAE,2EAA2E;AAC9G,QAAQ,SAAS,UAAU,GAAG,GAAG,IACjC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB,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