UNPKG

vite-plugin-animated-webp-optimizer

Version:

Vite plugin for optimizing animated WebP files with Sharp and webpmux

132 lines 2.93 kB
export interface AnimatedWebpOptimizerOptions { /** * WebP quality (1-100) * @default 80 */ quality?: number; /** * Compression effort (0-6) * @default 4 */ effort?: number; /** * Enable lossless compression (false = lossy compression for better performance) * @default false */ lossless?: boolean; /** * Enable verbose logging * @default false */ verbose?: boolean; /** * Maximum file size in bytes (0 = no limit) * @default 0 */ maxFileSize?: number; /** * Skip optimization if file is already smaller than this size * @default 0 */ skipIfSmaller?: number; /** * Animation quality for animated WebP (1-100) * @default 80 */ animationQuality?: number; /** * Animation compression method (0-6) * @default 4 */ animationCompression?: number; /** * Enable animation optimization * @default true */ optimizeAnimation?: boolean; /** * Maximum width for resizing (0 = no resize) * @default 0 */ maxWidth?: number; /** * Maximum height for resizing (0 = no resize) * @default 0 */ maxHeight?: number; /** * Number of concurrent images to process * @default 15 */ concurrentImages?: number; /** * Output directory for optimized WebP files * @default 'dist' */ outDir?: string; /** * WebP assets found in bundle with hash mapping * @internal */ webpAssets?: WebPAsset[]; } export interface ProcessOptions { verbose: boolean; maxFileSize: number; skipIfSmaller: number; quality: number; effort: number; lossless: boolean; animationQuality: number; animationCompression: number; optimizeAnimation: boolean; maxWidth: number; maxHeight: number; concurrentImages: number; outDir: string; webpAssets?: WebPAsset[]; } export interface WebPMetadata { pages?: number; loop?: number; delay?: number[]; width?: number; height?: number; size?: number; pageHeight?: number; } export interface WebPAsset { /** * Original file path (source) */ sourcePath: string; /** * Built file name with hash (e.g., "image-abc123.webp") */ fileName: string; /** * Full output path in build directory */ outputPath: string; /** * Temporary directory for optimization (to avoid same file input/output error) */ tempDir: string; /** * File size in bytes */ size: number; /** * Whether the file is animated */ isAnimated?: boolean; } export interface OptimizationResult { success: boolean; originalSize: number; optimizedSize: number; savings: number; savingsPercent: number; error?: string; } //# sourceMappingURL=types.d.ts.map