import type { AuditCategory, AuditReport } from "./types.js"; export interface AuditHooks { /** Receives the unabridged Lighthouse result, for persisting as an artifact. */ onRawResult?: (lhr: unknown) => void; } export interface AuditOptions { url: string; category: AuditCategory; /** "desktop" (default) or "mobile". */ device?: "desktop" | "mobile"; timeoutMs?: number; } export declare class AuditError extends Error { constructor(message: string); } export interface LighthouseFlagOptions { category: AuditCategory; device: "desktop" | "mobile"; port: number; timeoutMs: number; } /** * Builds the flags for a run. * * formFactor and screenEmulation were set but throttling and emulatedUserAgent * were not, so a desktop audit ran a desktop viewport under Lighthouse's * default mobile Slow-4G throttling while identifying itself as a phone — * three settings disagreeing about the device, and a score shaped by whichever * one mattered most. */ export declare function buildLighthouseFlags(options: LighthouseFlagOptions): Promise<{ port: number; output: "json"; logLevel: "error"; onlyCategories: ("accessibility" | "performance" | "seo" | "best-practices")[]; formFactor: "desktop" | "mobile"; screenEmulation: { readonly mobile: false; readonly width: 1350; readonly height: 940; readonly deviceScaleFactor: 1; readonly disabled: false; } | { readonly mobile: true; readonly width: 412; readonly height: 823; readonly deviceScaleFactor: 1.75; readonly disabled: false; }; throttling: any; emulatedUserAgent: any; maxWaitForLoad: number; }>; /** Only real web pages can be audited; anything else is a configuration mistake. */ export declare function assertAuditableUrl(url: string): URL; /** * Runs Lighthouse against a freshly launched headless Chrome. * * Chrome and Lighthouse are imported lazily so that a partial install degrades * to "audits unavailable" instead of preventing the whole server from starting. */ export declare function runLighthouseAudit(options: AuditOptions, hooks?: AuditHooks): Promise;