import { JSDOM } from 'jsdom'; export type JSDOMDocument = JSDOM['window']['document']; /** * Options for fetching and parsing HTML documents. * @interface ReadOptions */ export interface ReadOptions { /** Custom HTTP headers to include in the request */ headers?: Record; /** Custom fetcher function to override the default behavior */ fetcher?: (url: string) => Promise; /** Request timeout in milliseconds (default: 30000ms) */ timeout?: number; /** Maximum number of retries for failed requests (default: 0) */ retries?: number; } /** * Fetches and parses an HTML document from a given URL. * * @param url - The URL of the webpage to fetch. * @param options - Optional configuration for the request. * @param options.headers - Additional headers to include in the request. * @param options.fetcher - Custom function to fetch the HTML content. * @param options.timeout - Request timeout in milliseconds (default: 30000ms). * @param options.retries - Maximum number of retries for failed requests (default: 0). * @returns A Promise that resolves to the parsed JSDOM Document object. * @throws {DocumentError} When URL is invalid, network errors occur, or parsing fails. */ declare function getDocument(url: string, { headers, fetcher, timeout, retries }?: ReadOptions): Promise; export { getDocument };