recker 1.0.28 → 1.0.29-next.604e03b

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.
Files changed (102) hide show
  1. package/README.md +28 -1
  2. package/dist/ai/client-ai.d.ts +41 -0
  3. package/dist/ai/client-ai.js +391 -0
  4. package/dist/ai/index.d.ts +2 -0
  5. package/dist/ai/index.js +2 -0
  6. package/dist/ai/memory.d.ts +35 -0
  7. package/dist/ai/memory.js +136 -0
  8. package/dist/browser/ai/client-ai.d.ts +41 -0
  9. package/dist/browser/ai/client-ai.js +391 -0
  10. package/dist/browser/ai/memory.d.ts +35 -0
  11. package/dist/browser/ai/memory.js +136 -0
  12. package/dist/browser/core/client.d.ts +6 -1
  13. package/dist/browser/core/client.js +18 -0
  14. package/dist/browser/transport/undici.js +11 -2
  15. package/dist/browser/types/ai-client.d.ts +32 -0
  16. package/dist/browser/types/ai-client.js +1 -0
  17. package/dist/browser/types/ai.d.ts +1 -1
  18. package/dist/cli/index.js +261 -1
  19. package/dist/cli/tui/scroll-buffer.js +4 -4
  20. package/dist/cli/tui/shell.d.ts +4 -0
  21. package/dist/cli/tui/shell.js +500 -19
  22. package/dist/core/client.d.ts +6 -1
  23. package/dist/core/client.js +18 -0
  24. package/dist/mcp/server.js +15 -0
  25. package/dist/mcp/tools/scrape.d.ts +3 -0
  26. package/dist/mcp/tools/scrape.js +156 -0
  27. package/dist/mcp/tools/security.d.ts +3 -0
  28. package/dist/mcp/tools/security.js +471 -0
  29. package/dist/mcp/tools/seo.d.ts +3 -0
  30. package/dist/mcp/tools/seo.js +427 -0
  31. package/dist/presets/anthropic.d.ts +3 -1
  32. package/dist/presets/anthropic.js +11 -1
  33. package/dist/presets/azure-openai.d.ts +3 -1
  34. package/dist/presets/azure-openai.js +11 -1
  35. package/dist/presets/cohere.d.ts +3 -1
  36. package/dist/presets/cohere.js +8 -2
  37. package/dist/presets/deepseek.d.ts +3 -1
  38. package/dist/presets/deepseek.js +8 -2
  39. package/dist/presets/fireworks.d.ts +3 -1
  40. package/dist/presets/fireworks.js +8 -2
  41. package/dist/presets/gemini.d.ts +3 -1
  42. package/dist/presets/gemini.js +8 -1
  43. package/dist/presets/groq.d.ts +3 -1
  44. package/dist/presets/groq.js +8 -2
  45. package/dist/presets/huggingface.d.ts +3 -1
  46. package/dist/presets/huggingface.js +8 -1
  47. package/dist/presets/mistral.d.ts +3 -1
  48. package/dist/presets/mistral.js +8 -2
  49. package/dist/presets/openai.d.ts +3 -1
  50. package/dist/presets/openai.js +9 -2
  51. package/dist/presets/perplexity.d.ts +3 -1
  52. package/dist/presets/perplexity.js +8 -2
  53. package/dist/presets/registry.d.ts +4 -0
  54. package/dist/presets/registry.js +48 -0
  55. package/dist/presets/replicate.d.ts +3 -1
  56. package/dist/presets/replicate.js +8 -1
  57. package/dist/presets/together.d.ts +3 -1
  58. package/dist/presets/together.js +8 -2
  59. package/dist/presets/xai.d.ts +3 -1
  60. package/dist/presets/xai.js +8 -2
  61. package/dist/scrape/index.d.ts +2 -0
  62. package/dist/scrape/index.js +1 -0
  63. package/dist/scrape/spider.d.ts +61 -0
  64. package/dist/scrape/spider.js +250 -0
  65. package/dist/seo/analyzer.js +27 -0
  66. package/dist/seo/index.d.ts +3 -1
  67. package/dist/seo/index.js +1 -0
  68. package/dist/seo/rules/accessibility.js +620 -54
  69. package/dist/seo/rules/best-practices.d.ts +2 -0
  70. package/dist/seo/rules/best-practices.js +188 -0
  71. package/dist/seo/rules/crawl.d.ts +2 -0
  72. package/dist/seo/rules/crawl.js +307 -0
  73. package/dist/seo/rules/cwv.d.ts +2 -0
  74. package/dist/seo/rules/cwv.js +337 -0
  75. package/dist/seo/rules/ecommerce.d.ts +2 -0
  76. package/dist/seo/rules/ecommerce.js +252 -0
  77. package/dist/seo/rules/i18n.d.ts +2 -0
  78. package/dist/seo/rules/i18n.js +222 -0
  79. package/dist/seo/rules/index.d.ts +32 -0
  80. package/dist/seo/rules/index.js +71 -0
  81. package/dist/seo/rules/internal-linking.d.ts +2 -0
  82. package/dist/seo/rules/internal-linking.js +375 -0
  83. package/dist/seo/rules/local.d.ts +2 -0
  84. package/dist/seo/rules/local.js +265 -0
  85. package/dist/seo/rules/pwa.d.ts +2 -0
  86. package/dist/seo/rules/pwa.js +302 -0
  87. package/dist/seo/rules/readability.d.ts +2 -0
  88. package/dist/seo/rules/readability.js +255 -0
  89. package/dist/seo/rules/security.js +406 -28
  90. package/dist/seo/rules/social.d.ts +2 -0
  91. package/dist/seo/rules/social.js +373 -0
  92. package/dist/seo/rules/types.d.ts +155 -0
  93. package/dist/seo/seo-spider.d.ts +47 -0
  94. package/dist/seo/seo-spider.js +362 -0
  95. package/dist/seo/types.d.ts +24 -0
  96. package/dist/transport/undici.js +11 -2
  97. package/dist/types/ai-client.d.ts +32 -0
  98. package/dist/types/ai-client.js +1 -0
  99. package/dist/types/ai.d.ts +1 -1
  100. package/dist/utils/colors.d.ts +2 -0
  101. package/dist/utils/colors.js +4 -0
  102. package/package.json +1 -1
@@ -1,4 +1,10 @@
1
1
  export function huggingface(options) {
2
+ const _aiConfig = {
3
+ provider: 'huggingface',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'meta-llama/Meta-Llama-3-70B-Instruct',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api-inference.huggingface.co',
4
10
  headers: {
@@ -11,6 +17,7 @@ export function huggingface(options) {
11
17
  backoff: 'exponential',
12
18
  delay: 1000,
13
19
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
20
+ },
21
+ _aiConfig,
15
22
  };
16
23
  }
@@ -1,5 +1,7 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface MistralPresetOptions {
3
4
  apiKey: string;
5
+ model?: string;
4
6
  }
5
- export declare function mistral(options: MistralPresetOptions): ClientOptions;
7
+ export declare function mistral(options: MistralPresetOptions): ClientOptions & ClientOptionsWithAI;
@@ -1,9 +1,14 @@
1
1
  export function mistral(options) {
2
+ const _aiConfig = {
3
+ provider: 'mistral',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'mistral-large-3',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api.mistral.ai/v1',
4
10
  headers: {
5
11
  'Authorization': `Bearer ${options.apiKey}`,
6
- 'Content-Type': 'application/json',
7
12
  },
8
13
  timeout: 5 * 60 * 1000,
9
14
  retry: {
@@ -11,6 +16,7 @@ export function mistral(options) {
11
16
  backoff: 'exponential',
12
17
  delay: 1000,
13
18
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
19
+ },
20
+ _aiConfig,
15
21
  };
16
22
  }
@@ -1,7 +1,9 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface OpenAIPresetOptions {
3
4
  apiKey: string;
4
5
  organization?: string;
5
6
  project?: string;
7
+ model?: string;
6
8
  }
7
- export declare function openai(options: OpenAIPresetOptions): ClientOptions;
9
+ export declare function openai(options: OpenAIPresetOptions): ClientOptions & ClientOptionsWithAI;
@@ -1,7 +1,6 @@
1
1
  export function openai(options) {
2
2
  const headers = {
3
3
  'Authorization': `Bearer ${options.apiKey}`,
4
- 'Content-Type': 'application/json'
5
4
  };
6
5
  if (options.organization) {
7
6
  headers['OpenAI-Organization'] = options.organization;
@@ -9,6 +8,13 @@ export function openai(options) {
9
8
  if (options.project) {
10
9
  headers['OpenAI-Project'] = options.project;
11
10
  }
11
+ const _aiConfig = {
12
+ provider: 'openai',
13
+ apiKey: options.apiKey,
14
+ model: options.model ?? 'gpt-5.1',
15
+ organization: options.organization,
16
+ memory: { maxPairs: 12 },
17
+ };
12
18
  return {
13
19
  baseUrl: 'https://api.openai.com/v1',
14
20
  headers,
@@ -18,6 +24,7 @@ export function openai(options) {
18
24
  backoff: 'exponential',
19
25
  delay: 1000,
20
26
  statusCodes: [408, 409, 429, 500, 502, 503, 504]
21
- }
27
+ },
28
+ _aiConfig,
22
29
  };
23
30
  }
@@ -1,5 +1,7 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface PerplexityPresetOptions {
3
4
  apiKey: string;
5
+ model?: string;
4
6
  }
5
- export declare function perplexity(options: PerplexityPresetOptions): ClientOptions;
7
+ export declare function perplexity(options: PerplexityPresetOptions): ClientOptions & ClientOptionsWithAI;
@@ -1,9 +1,14 @@
1
1
  export function perplexity(options) {
2
+ const _aiConfig = {
3
+ provider: 'perplexity',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'sonar-pro',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api.perplexity.ai',
4
10
  headers: {
5
11
  'Authorization': `Bearer ${options.apiKey}`,
6
- 'Content-Type': 'application/json',
7
12
  },
8
13
  timeout: 5 * 60 * 1000,
9
14
  retry: {
@@ -11,6 +16,7 @@ export function perplexity(options) {
11
16
  backoff: 'exponential',
12
17
  delay: 1000,
13
18
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
19
+ },
20
+ _aiConfig,
15
21
  };
16
22
  }
@@ -1,4 +1,5 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { AIProvider } from '../types/ai.js';
2
3
  export type PresetFactory = (options: any) => ClientOptions;
3
4
  export interface PresetInfo {
4
5
  name: string;
@@ -8,6 +9,9 @@ export interface PresetInfo {
8
9
  category: 'ai' | 'cloud' | 'saas' | 'devtools';
9
10
  requiredAuth: string[];
10
11
  docsUrl?: string;
12
+ aiProvider?: AIProvider;
13
+ defaultModel?: string;
14
+ chatEndpoint?: string;
11
15
  }
12
16
  export declare const presetRegistry: PresetInfo[];
13
17
  export declare function detectPreset(url: string): PresetInfo | undefined;
@@ -43,6 +43,9 @@ export const presetRegistry = [
43
43
  category: 'ai',
44
44
  requiredAuth: ['apiKey'],
45
45
  docsUrl: 'https://platform.openai.com/docs',
46
+ aiProvider: 'openai',
47
+ defaultModel: 'gpt-4o',
48
+ chatEndpoint: '/chat/completions',
46
49
  },
47
50
  {
48
51
  name: 'anthropic',
@@ -52,6 +55,9 @@ export const presetRegistry = [
52
55
  category: 'ai',
53
56
  requiredAuth: ['apiKey'],
54
57
  docsUrl: 'https://docs.anthropic.com/',
58
+ aiProvider: 'anthropic',
59
+ defaultModel: 'claude-sonnet-4-20250514',
60
+ chatEndpoint: '/messages',
55
61
  },
56
62
  {
57
63
  name: 'gemini',
@@ -61,6 +67,9 @@ export const presetRegistry = [
61
67
  category: 'ai',
62
68
  requiredAuth: ['apiKey'],
63
69
  docsUrl: 'https://ai.google.dev/docs',
70
+ aiProvider: 'google',
71
+ defaultModel: 'gemini-2.0-flash',
72
+ chatEndpoint: '/models/{model}:generateContent',
64
73
  },
65
74
  {
66
75
  name: 'cohere',
@@ -70,6 +79,9 @@ export const presetRegistry = [
70
79
  category: 'ai',
71
80
  requiredAuth: ['apiKey'],
72
81
  docsUrl: 'https://docs.cohere.com/',
82
+ aiProvider: 'cohere',
83
+ defaultModel: 'command-r-plus',
84
+ chatEndpoint: '/chat',
73
85
  },
74
86
  {
75
87
  name: 'mistral',
@@ -79,6 +91,9 @@ export const presetRegistry = [
79
91
  category: 'ai',
80
92
  requiredAuth: ['apiKey'],
81
93
  docsUrl: 'https://docs.mistral.ai/',
94
+ aiProvider: 'mistral',
95
+ defaultModel: 'mistral-large-latest',
96
+ chatEndpoint: '/chat/completions',
82
97
  },
83
98
  {
84
99
  name: 'groq',
@@ -88,6 +103,9 @@ export const presetRegistry = [
88
103
  category: 'ai',
89
104
  requiredAuth: ['apiKey'],
90
105
  docsUrl: 'https://console.groq.com/docs',
106
+ aiProvider: 'groq',
107
+ defaultModel: 'llama-3.3-70b-versatile',
108
+ chatEndpoint: '/openai/v1/chat/completions',
91
109
  },
92
110
  {
93
111
  name: 'together',
@@ -97,6 +115,9 @@ export const presetRegistry = [
97
115
  category: 'ai',
98
116
  requiredAuth: ['apiKey'],
99
117
  docsUrl: 'https://docs.together.ai/',
118
+ aiProvider: 'together',
119
+ defaultModel: 'meta-llama/Llama-3.3-70B-Instruct-Turbo',
120
+ chatEndpoint: '/chat/completions',
100
121
  },
101
122
  {
102
123
  name: 'replicate',
@@ -106,6 +127,9 @@ export const presetRegistry = [
106
127
  category: 'ai',
107
128
  requiredAuth: ['apiKey'],
108
129
  docsUrl: 'https://replicate.com/docs',
130
+ aiProvider: 'replicate',
131
+ defaultModel: 'meta/llama-2-70b-chat',
132
+ chatEndpoint: '/predictions',
109
133
  },
110
134
  {
111
135
  name: 'huggingface',
@@ -115,6 +139,9 @@ export const presetRegistry = [
115
139
  category: 'ai',
116
140
  requiredAuth: ['apiKey'],
117
141
  docsUrl: 'https://huggingface.co/docs/api-inference',
142
+ aiProvider: 'huggingface',
143
+ defaultModel: 'meta-llama/Meta-Llama-3-70B-Instruct',
144
+ chatEndpoint: '/models/{model}',
118
145
  },
119
146
  {
120
147
  name: 'perplexity',
@@ -124,6 +151,9 @@ export const presetRegistry = [
124
151
  category: 'ai',
125
152
  requiredAuth: ['apiKey'],
126
153
  docsUrl: 'https://docs.perplexity.ai/',
154
+ aiProvider: 'perplexity',
155
+ defaultModel: 'llama-3.1-sonar-large-128k-online',
156
+ chatEndpoint: '/chat/completions',
127
157
  },
128
158
  {
129
159
  name: 'deepseek',
@@ -133,6 +163,9 @@ export const presetRegistry = [
133
163
  category: 'ai',
134
164
  requiredAuth: ['apiKey'],
135
165
  docsUrl: 'https://platform.deepseek.com/docs',
166
+ aiProvider: 'deepseek',
167
+ defaultModel: 'deepseek-chat',
168
+ chatEndpoint: '/chat/completions',
136
169
  },
137
170
  {
138
171
  name: 'fireworks',
@@ -142,6 +175,9 @@ export const presetRegistry = [
142
175
  category: 'ai',
143
176
  requiredAuth: ['apiKey'],
144
177
  docsUrl: 'https://docs.fireworks.ai/',
178
+ aiProvider: 'fireworks',
179
+ defaultModel: 'accounts/fireworks/models/llama-v3p1-70b-instruct',
180
+ chatEndpoint: '/inference/v1/chat/completions',
145
181
  },
146
182
  {
147
183
  name: 'xai',
@@ -151,6 +187,9 @@ export const presetRegistry = [
151
187
  category: 'ai',
152
188
  requiredAuth: ['apiKey'],
153
189
  docsUrl: 'https://docs.x.ai/',
190
+ aiProvider: 'xai',
191
+ defaultModel: 'grok-2',
192
+ chatEndpoint: '/v1/chat/completions',
154
193
  },
155
194
  {
156
195
  name: 'grok',
@@ -160,6 +199,9 @@ export const presetRegistry = [
160
199
  category: 'ai',
161
200
  requiredAuth: ['apiKey'],
162
201
  docsUrl: 'https://docs.x.ai/',
202
+ aiProvider: 'xai',
203
+ defaultModel: 'grok-2',
204
+ chatEndpoint: '/v1/chat/completions',
163
205
  },
164
206
  {
165
207
  name: 'azure-openai',
@@ -169,6 +211,9 @@ export const presetRegistry = [
169
211
  category: 'ai',
170
212
  requiredAuth: ['resourceName', 'apiKey'],
171
213
  docsUrl: 'https://learn.microsoft.com/en-us/azure/ai-services/openai/',
214
+ aiProvider: 'azure-openai',
215
+ defaultModel: 'gpt-4o',
216
+ chatEndpoint: '/openai/deployments/{deployment}/chat/completions',
172
217
  },
173
218
  {
174
219
  name: 'cloudflare-workers-ai',
@@ -178,6 +223,9 @@ export const presetRegistry = [
178
223
  category: 'ai',
179
224
  requiredAuth: ['accountId', 'apiToken'],
180
225
  docsUrl: 'https://developers.cloudflare.com/workers-ai/',
226
+ aiProvider: 'cloudflare-workers-ai',
227
+ defaultModel: '@cf/meta/llama-3-8b-instruct',
228
+ chatEndpoint: '/run/{model}',
181
229
  },
182
230
  {
183
231
  name: 'aws',
@@ -1,5 +1,7 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface ReplicatePresetOptions {
3
4
  apiKey: string;
5
+ model?: string;
4
6
  }
5
- export declare function replicate(options: ReplicatePresetOptions): ClientOptions;
7
+ export declare function replicate(options: ReplicatePresetOptions): ClientOptions & ClientOptionsWithAI;
@@ -1,4 +1,10 @@
1
1
  export function replicate(options) {
2
+ const _aiConfig = {
3
+ provider: 'replicate',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'meta/llama-2-70b-chat',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api.replicate.com/v1',
4
10
  headers: {
@@ -11,6 +17,7 @@ export function replicate(options) {
11
17
  backoff: 'exponential',
12
18
  delay: 2000,
13
19
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
20
+ },
21
+ _aiConfig,
15
22
  };
16
23
  }
@@ -1,5 +1,7 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface TogetherPresetOptions {
3
4
  apiKey: string;
5
+ model?: string;
4
6
  }
5
- export declare function together(options: TogetherPresetOptions): ClientOptions;
7
+ export declare function together(options: TogetherPresetOptions): ClientOptions & ClientOptionsWithAI;
@@ -1,9 +1,14 @@
1
1
  export function together(options) {
2
+ const _aiConfig = {
3
+ provider: 'together',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api.together.xyz/v1',
4
10
  headers: {
5
11
  'Authorization': `Bearer ${options.apiKey}`,
6
- 'Content-Type': 'application/json',
7
12
  },
8
13
  timeout: 5 * 60 * 1000,
9
14
  retry: {
@@ -11,6 +16,7 @@ export function together(options) {
11
16
  backoff: 'exponential',
12
17
  delay: 1000,
13
18
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
19
+ },
20
+ _aiConfig,
15
21
  };
16
22
  }
@@ -1,6 +1,8 @@
1
1
  import { ClientOptions } from '../types/index.js';
2
+ import type { ClientOptionsWithAI } from '../types/ai-client.js';
2
3
  export interface XAIPresetOptions {
3
4
  apiKey: string;
5
+ model?: string;
4
6
  }
5
- export declare function xai(options: XAIPresetOptions): ClientOptions;
7
+ export declare function xai(options: XAIPresetOptions): ClientOptions & ClientOptionsWithAI;
6
8
  export declare const grok: typeof xai;
@@ -1,9 +1,14 @@
1
1
  export function xai(options) {
2
+ const _aiConfig = {
3
+ provider: 'xai',
4
+ apiKey: options.apiKey,
5
+ model: options.model ?? 'grok-4.1',
6
+ memory: { maxPairs: 12 },
7
+ };
2
8
  return {
3
9
  baseUrl: 'https://api.x.ai/v1',
4
10
  headers: {
5
11
  'Authorization': `Bearer ${options.apiKey}`,
6
- 'Content-Type': 'application/json',
7
12
  },
8
13
  timeout: 5 * 60 * 1000,
9
14
  retry: {
@@ -11,7 +16,8 @@ export function xai(options) {
11
16
  backoff: 'exponential',
12
17
  delay: 1000,
13
18
  statusCodes: [408, 429, 500, 502, 503, 504]
14
- }
19
+ },
20
+ _aiConfig,
15
21
  };
16
22
  }
17
23
  export const grok = xai;
@@ -1,4 +1,6 @@
1
1
  export { ScrapeDocument } from './document.js';
2
2
  export { ScrapeElement } from './element.js';
3
+ export { Spider, spider } from './spider.js';
4
+ export type { SpiderOptions, SpiderPageResult, SpiderProgress, SpiderResult, } from './spider.js';
3
5
  export { extractLinks, extractImages, extractMeta, extractOpenGraph, extractTwitterCard, extractJsonLd, extractForms, extractTables, extractScripts, extractStyles, } from './extractors.js';
4
6
  export type { ExtractedLink, ExtractedImage, ExtractedMeta, OpenGraphData, TwitterCardData, JsonLdData, ExtractedForm, ExtractedFormField, ExtractedTable, ExtractedScript, ExtractedStyle, ExtractionSchema, ExtractionSchemaField, ScrapeOptions, LinkExtractionOptions, ImageExtractionOptions, } from './types.js';
@@ -1,3 +1,4 @@
1
1
  export { ScrapeDocument } from './document.js';
2
2
  export { ScrapeElement } from './element.js';
3
+ export { Spider, spider } from './spider.js';
3
4
  export { extractLinks, extractImages, extractMeta, extractOpenGraph, extractTwitterCard, extractJsonLd, extractForms, extractTables, extractScripts, extractStyles, } from './extractors.js';
@@ -0,0 +1,61 @@
1
+ import type { ExtractedLink } from './types.js';
2
+ export interface SpiderOptions {
3
+ maxDepth?: number;
4
+ maxPages?: number;
5
+ sameDomain?: boolean;
6
+ concurrency?: number;
7
+ timeout?: number;
8
+ delay?: number;
9
+ exclude?: RegExp[];
10
+ include?: RegExp[];
11
+ userAgent?: string;
12
+ respectRobotsTxt?: boolean;
13
+ onPage?: (result: SpiderPageResult) => void;
14
+ onProgress?: (progress: SpiderProgress) => void;
15
+ }
16
+ export interface SpiderPageResult {
17
+ url: string;
18
+ status: number;
19
+ title: string;
20
+ depth: number;
21
+ links: ExtractedLink[];
22
+ duration: number;
23
+ error?: string;
24
+ }
25
+ export interface SpiderProgress {
26
+ crawled: number;
27
+ queued: number;
28
+ total: number;
29
+ currentUrl: string;
30
+ depth: number;
31
+ }
32
+ export interface SpiderResult {
33
+ startUrl: string;
34
+ pages: SpiderPageResult[];
35
+ visited: Set<string>;
36
+ duration: number;
37
+ errors: Array<{
38
+ url: string;
39
+ error: string;
40
+ }>;
41
+ }
42
+ export declare class Spider {
43
+ private options;
44
+ private client;
45
+ private pool;
46
+ private visited;
47
+ private queue;
48
+ private results;
49
+ private errors;
50
+ private baseHost;
51
+ private running;
52
+ private aborted;
53
+ private pendingCount;
54
+ constructor(options?: SpiderOptions);
55
+ crawl(startUrl: string): Promise<SpiderResult>;
56
+ private crawlPage;
57
+ abort(): void;
58
+ isRunning(): boolean;
59
+ getProgress(): SpiderProgress;
60
+ }
61
+ export declare function spider(url: string, options?: SpiderOptions): Promise<SpiderResult>;