UNPKG

a11yanalyze

Version:

A command-line tool for developers and QA engineers to test web pages and websites for WCAG 2.2 AA accessibility compliance

182 lines 4.14 kB
import { EventEmitter } from 'events'; import { CrawlerConfig, CrawlSession, CrawlProgress } from '../types/crawler'; import { ScanOptions, BrowserConfig, RuleEngineConfig } from '../types'; import { WCAGLevelConfig } from './wcag-level-handler'; import { ResilienceConfig } from './error-resilience'; /** * Site crawler for multi-page accessibility scanning * Provides crawling capabilities with depth limits, domain restrictions, and rate limiting */ export declare class SiteCrawler extends EventEmitter { private pageScanner; private session; private isRunning; private isPaused; private abortController; private activeRequests; private requestQueue; private lastRequestTime; private robotsCache; private sitemapCache; constructor(browserConfig?: BrowserConfig, ruleEngineConfig?: RuleEngineConfig, resilienceConfig?: Partial<ResilienceConfig>, wcagLevelConfig?: Partial<WCAGLevelConfig>); /** * Start a new crawl session */ startCrawl(startUrls: string[], config?: Partial<CrawlerConfig>, scanOptions?: Partial<ScanOptions>): Promise<string>; /** * Pause the current crawl session */ pauseCrawl(): Promise<void>; /** * Resume the paused crawl session */ resumeCrawl(): Promise<void>; /** * Stop the current crawl session */ stopCrawl(): Promise<void>; /** * Get current crawl progress */ getProgress(): CrawlProgress | null; /** * Get current session information */ getSession(): CrawlSession | null; /** * Main crawling process * @private */ private crawlAsync; /** * Initialize URLs from start URLs * @private */ private initializeUrls; /** * Main URL crawling loop * @private */ private crawlUrls; /** * Process a single URL * @private */ private processUrl; /** * Discover URLs from a scanned page * @private */ private discoverUrlsFromPage; /** * Extract URLs from a page * @private */ private extractUrlsFromPage; /** * Check if URL should be processed * @private */ private shouldProcessUrl; /** * Check if URL should be added to crawl queue * @private */ private shouldAddUrl; /** * Discover URLs from sitemaps * @private */ private discoverFromSitemaps; /** * Fetch and parse sitemap * @private */ private fetchSitemap; /** * Apply rate limiting * @private */ private applyRateLimit; /** * Get next URL to process * @private */ private getNextUrl; /** * Check if there's more work to do * @private */ private hasWorkToDo; /** * Wait for all active requests to complete * @private */ private waitForActiveRequests; /** * Validate start URLs * @private */ private validateStartUrls; /** * Create default crawler configuration * @private */ private createDefaultConfig; /** * Create initial statistics * @private */ private createInitialStats; /** * Update statistics * @private */ private updateStats; /** * Update statistics for completed URL * @private */ private updateStatsForCompletedUrl; /** * Handle crawl errors * @private */ private handleCrawlError; /** * Emit crawl event * @private */ private emitEvent; /** * Get current crawl depth * @private */ private getCurrentDepth; /** * Get current URL being processed * @private */ private getCurrentUrl; /** * Get recent errors * @private */ private getRecentErrors; /** * Generate session ID * @private */ private generateSessionId; /** * Sleep for specified duration * @private */ private sleep; /** * Cleanup resources * @private */ private cleanup; } //# sourceMappingURL=site-crawler.d.ts.map