All files / src index.ts

0% Statements 0/33
100% Branches 0/0
0% Functions 0/22
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79                                                                                                                                                             
/**
 * @fileoverview Crawlee Scraper Toolkit - Main Entry Point
 *
 * A comprehensive TypeScript toolkit for building robust web scrapers with Crawlee,
 * featuring maximum configurability, plugin system, and CLI generator.
 *
 * @author Alexander Daza <dev.alexander.daza@gmail.com>
 * @version 1.0.0
 * @license MIT
 *
 * @example
 * ```typescript
 * import { CrawleeScraperEngine, createConfig, ScraperDefinition } from 'crawlee-scraper-toolkit';
 *
 * // Create a simple scraper
 * const scraper: ScraperDefinition = {
 *   id: 'my-scraper',
 *   name: 'My Web Scraper',
 *   url: 'https://example.com',
 *   navigation: { type: 'direct', config: {} },
 *   waitStrategy: { type: 'selector', config: { selector: 'body' } },
 *   requiresCaptcha: false,
 *   parse: async (context) => {
 *     return {
 *       title: await context.page.textContent('h1'),
 *       content: await context.page.textContent('p')
 *     };
 *   }
 * };
 *
 * // Configure and run
 * const config = createConfig().build();
 * const engine = new CrawleeScraperEngine(config);
 * const result = await engine.execute(scraper, 'input');
 * ```
 */
 
// Core exports
export { CrawleeScraperEngine } from './core/scraper';
export { BrowserPool, defaultBrowserPoolConfig } from './core/browser-pool';
export { ConfigManager, configManager, createConfig } from './core/config-manager';
 
// Type exports
export type {
  ScraperDefinition,
  ScraperExecutionOptions,
  ScraperResult,
  ScraperContext,
  ScraperEngine,
  ScraperEngineConfig,
  ScraperPlugin,
  ScraperHook,
  HookHandler,
  BrowserInstance,
  BrowserPoolConfig,
  NavigationStrategy,
  WaitStrategy,
} from './core/types';
 
// Plugin exports
export { RetryPlugin, CachePlugin, ProxyPlugin, RateLimitPlugin, MetricsPlugin } from './plugins';
 
// Utility exports
export { createLogger, defaultLogger } from './utils/logger';
export type { Logger, LoggerConfig } from './utils/logger';
 
export { validators, schemas, validateWithSchema } from './utils/validators';
export type { ValidationResult } from './utils/validators';
 
// CLI exports (for programmatic usage)
export { generateScraper } from './cli/commands/generate';
export { initProject } from './cli/commands/init';
export { validateConfig } from './cli/commands/validate';
export { runScraper } from './cli/commands/run';
export { getTemplate, getAvailableTemplates } from './cli/templates';
 
// Re-export commonly used types from dependencies
export type { Page, Browser, BrowserContext } from 'playwright';