import type { ImageMetadata, ImageOp, ImageProcessor } from '@basaltkit/storage'; /** * The slice of sharp's fluent API this driver uses. Declared structurally so the * op translator is testable with a fake and the core never imports sharp's types. */ export interface SharpLike { resize(options: { width?: number; height?: number; fit?: string; position?: string; }): SharpLike; rotate(degrees?: number): SharpLike; blur(sigma?: number): SharpLike; grayscale(): SharpLike; flip(): SharpLike; flop(): SharpLike; jpeg(options?: { quality?: number; }): SharpLike; png(options?: { quality?: number; }): SharpLike; webp(options?: { quality?: number; }): SharpLike; avif(options?: { quality?: number; }): SharpLike; toBuffer(): Promise; metadata(): Promise<{ format?: string; width?: number; height?: number; size?: number; }>; } /** `sharp(input)` — the module's callable default export. */ export type SharpFactory = (input: Buffer) => SharpLike; /** * Applies the engine-neutral op list to a sharp instance, in order. Pure and * synchronous over the chainable — unit-tested without the native binary. */ export declare function applyOps(image: SharpLike, ops: readonly ImageOp[]): SharpLike; export interface SharpImageProcessorOptions { /** * Injectable sharp factory — the real `sharp` by default (lazy-loaded). Tests * pass a fake so no native binary is required. */ sharp?: SharpFactory; } /** * A {@link ImageProcessor} backed by [sharp](https://sharp.pixelplumbing.com). * Wire it into storage: `storagePlugin({ imageProcessor: new SharpImageProcessor(), ... })`. * `sharp` is a **peer dependency** (native `libvips`), loaded on first use so the * app fails fast with a clear message if it isn't installed. */ export declare class SharpImageProcessor implements ImageProcessor { readonly name = "sharp"; private factory; constructor(options?: SharpImageProcessorOptions); run(input: Buffer, ops: ImageOp[]): Promise; metadata(input: Buffer): Promise; private load; }