import type { ImgxOptions } from './types'; /** * Resolve a route's `imgx` config value into runtime options. `false`/absent * disables the integration for the route. */ export declare function resolveImgx(value: boolean | ImgxOptions | undefined): ResolvedImgxOptions | undefined; /** Cheap pre-check so requests without transform params never pay for parsing. */ export declare function hasImgxParams(search: string): boolean; /** * Parse the meema/imgix-compatible transform params out of a query string * (`search` includes the leading `?`). Returns `undefined` when no param that * triggers a transform is present — modifier-only queries (`?fit=crop`) and * unrelated queries cost nothing downstream. * * Supported params: `w`/`h` (px, or a 0–1 fraction of the source), `fit` * (`clip|max|min|crop|scale|fill`), `crop` (position keywords), `ar` (`16:9`), * `dpr`, `q`, `fm`/`format` (+`auto`), `auto=format|compress`, `lossless`, * `blur` (imgix 0–2000 scale), `sharp`, `greyscale`/`grayscale`, `bri`/`sat` * (−100..100), `hue` (degrees), `tint`, `rot`, `flip`, `flop`, `bg`. */ export declare function parseImgxParams(search: string): ImgxTransform | undefined; /** Test hook: reset the memoized ts-images import. */ export declare function resetImgxRuntime(): void; /** * Post-upstream hook: given the request context and the upstream response, * return either the transformed image response or the original response * untouched. This must never throw — every failure path degrades to the * original bytes. */ export declare function applyImgxTransform(req: Request, pathname: string, search: string, imgx: ResolvedImgxOptions | undefined, res: Response, verbose?: boolean): Promise; declare interface Rgba { r: number, g: number, b: number, a?: number } /** A request's parsed transform, normalized and clamped. */ export declare interface ImgxTransform { width?: number height?: number fit: FitMode position: CropPosition aspectRatio?: number dpr: number quality?: number format?: OutputFormat autoFormat: boolean lossless?: boolean blur?: number sharpen: boolean grayscale: boolean brightness?: number saturation?: number hue?: number tint?: Rgba rotate?: number flip: boolean flop: boolean background?: Rgba } export declare interface ResolvedImgxOptions { quality: number maxWidth: number maxHeight: number maxInputBytes: number cache: ImgxCache | null } declare type OutputFormat = 'jpeg' | 'png' | 'webp' | 'avif' | 'gif' | 'bmp'; /** imgix `fit` values rpx implements (`clamp`→clip and `fillmax`→fill degrade). */ declare type FitMode = 'clip' | 'max' | 'min' | 'crop' | 'scale' | 'fill'; declare type CropPosition = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; /** * Lazy `ts-images` loader. The import is deferred to the first transform and * failures are remembered — a missing package means transforms pass through * with a single warning instead of a per-request error. */ declare type TsImages = typeof import('ts-images'); /** * Bounded LRU for transformed variants. Keys embed a hash of the source bytes, * so entries never go stale — a changed upstream simply misses. */ export declare class ImgxCache { constructor(maxBytes: number, maxEntries: number); get(key: string): { bytes: Uint8Array, contentType: string } | undefined; set(key: string, value: { bytes: Uint8Array, contentType: string }): void; get size(): number; }