@ereo/plugin-images 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +197 -0
  2. package/dist/build/manifest.d.ts +94 -0
  3. package/dist/build/manifest.d.ts.map +1 -0
  4. package/dist/build/optimizer.d.ts +99 -0
  5. package/dist/build/optimizer.d.ts.map +1 -0
  6. package/dist/components/Image.d.ts +28 -0
  7. package/dist/components/Image.d.ts.map +1 -0
  8. package/dist/components/Picture.d.ts +36 -0
  9. package/dist/components/Picture.d.ts.map +1 -0
  10. package/dist/components/index.d.ts +9 -0
  11. package/dist/components/index.d.ts.map +1 -0
  12. package/dist/components/index.js +3172 -0
  13. package/dist/components/types.d.ts +380 -0
  14. package/dist/components/types.d.ts.map +1 -0
  15. package/dist/config/defaults.d.ts +77 -0
  16. package/dist/config/defaults.d.ts.map +1 -0
  17. package/dist/config/schema.d.ts +23 -0
  18. package/dist/config/schema.d.ts.map +1 -0
  19. package/dist/index.d.ts +50 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +4870 -0
  22. package/dist/plugin.d.ts +28 -0
  23. package/dist/plugin.d.ts.map +1 -0
  24. package/dist/processing/blur.d.ts +78 -0
  25. package/dist/processing/blur.d.ts.map +1 -0
  26. package/dist/processing/color.d.ts +60 -0
  27. package/dist/processing/color.d.ts.map +1 -0
  28. package/dist/processing/processor.d.ts +101 -0
  29. package/dist/processing/processor.d.ts.map +1 -0
  30. package/dist/processing/sharp-processor.d.ts +74 -0
  31. package/dist/processing/sharp-processor.d.ts.map +1 -0
  32. package/dist/runtime/cache.d.ts +276 -0
  33. package/dist/runtime/cache.d.ts.map +1 -0
  34. package/dist/runtime/middleware.d.ts +29 -0
  35. package/dist/runtime/middleware.d.ts.map +1 -0
  36. package/package.json +51 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @ereo/plugin-images - Plugin Implementation
3
+ *
4
+ * Core plugin that integrates image optimization into the EreoJS framework.
5
+ */
6
+ import type { Plugin } from '@ereo/core';
7
+ import type { ImagePluginConfig } from './components/types';
8
+ /**
9
+ * Create the image optimization plugin.
10
+ *
11
+ * @param options - Plugin configuration
12
+ * @returns EreoJS plugin
13
+ *
14
+ * @example
15
+ * import images from '@ereo/plugin-images';
16
+ *
17
+ * export default defineConfig({
18
+ * plugins: [
19
+ * images({
20
+ * formats: { webp: true, avif: true },
21
+ * quality: 80,
22
+ * }),
23
+ * ],
24
+ * });
25
+ */
26
+ export declare function imagesPlugin(options?: ImagePluginConfig): Plugin;
27
+ export default imagesPlugin;
28
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,oBAAoB,CAAC;AA0B7E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAwLpE;AAeD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @ereo/plugin-images - Blur Placeholder Generation
3
+ *
4
+ * Generate tiny blur placeholders for images (LQIP - Low Quality Image Placeholders).
5
+ */
6
+ /**
7
+ * Options for blur placeholder generation.
8
+ */
9
+ export interface BlurPlaceholderOptions {
10
+ /** Width of the placeholder (default: 8px) */
11
+ width?: number;
12
+ /** Quality for encoding (default: 10) */
13
+ quality?: number;
14
+ /** Blur sigma (default: 1) */
15
+ sigma?: number;
16
+ }
17
+ /**
18
+ * Result of blur placeholder generation.
19
+ */
20
+ export interface BlurPlaceholderResult {
21
+ /** Base64-encoded data URL */
22
+ dataURL: string;
23
+ /** Width of the placeholder */
24
+ width: number;
25
+ /** Height of the placeholder */
26
+ height: number;
27
+ }
28
+ /**
29
+ * Generate a blur placeholder for an image.
30
+ *
31
+ * This creates a tiny (default 8px wide) blurred version of the image
32
+ * encoded as a base64 data URL. The browser can display this immediately
33
+ * while the full image loads, providing a smooth loading experience.
34
+ *
35
+ * @param input - Image buffer or file path
36
+ * @param options - Generation options
37
+ * @returns Base64-encoded data URL and dimensions
38
+ */
39
+ export declare function generateBlurPlaceholder(input: Buffer | string, options?: BlurPlaceholderOptions): Promise<BlurPlaceholderResult>;
40
+ /**
41
+ * Generate a blur placeholder optimized for CSS background.
42
+ *
43
+ * This version uses even more aggressive compression for minimal size.
44
+ *
45
+ * @param input - Image buffer or file path
46
+ * @returns Base64-encoded data URL
47
+ */
48
+ export declare function generateCSSBlurPlaceholder(input: Buffer | string): Promise<string>;
49
+ /**
50
+ * Generate a blur hash string.
51
+ *
52
+ * This is a compact representation that can be decoded client-side
53
+ * without needing the actual image data embedded.
54
+ *
55
+ * Note: This is a simplified implementation. For production,
56
+ * consider using the blurhash library for smaller strings.
57
+ *
58
+ * @param input - Image buffer or file path
59
+ * @returns Blur placeholder result
60
+ */
61
+ export declare function generateBlurHash(input: Buffer | string): Promise<BlurPlaceholderResult>;
62
+ /**
63
+ * Generate a shimmer placeholder SVG.
64
+ *
65
+ * This creates an animated gradient placeholder that shows
66
+ * a shimmer effect while the image loads.
67
+ *
68
+ * @param width - Width of the placeholder
69
+ * @param height - Height of the placeholder
70
+ * @param color - Base color (default: '#f3f4f6')
71
+ * @returns SVG string
72
+ */
73
+ export declare function generateShimmerSVG(width: number, height: number, color?: string): string;
74
+ /**
75
+ * Generate a shimmer placeholder as a data URL.
76
+ */
77
+ export declare function generateShimmerDataURL(width: number, height: number, color?: string): string;
78
+ //# sourceMappingURL=blur.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/processing/blur.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuC7F;AAiCD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAkB,GACxB,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAIR"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @ereo/plugin-images - Dominant Color Extraction
3
+ *
4
+ * Extract dominant colors from images using k-means clustering.
5
+ */
6
+ /**
7
+ * RGB color representation.
8
+ */
9
+ export interface RGBColor {
10
+ r: number;
11
+ g: number;
12
+ b: number;
13
+ }
14
+ /**
15
+ * Color extraction result.
16
+ */
17
+ export interface ColorExtractionResult {
18
+ /** Primary dominant color */
19
+ dominant: string;
20
+ /** Palette of dominant colors */
21
+ palette: string[];
22
+ /** Primary color as RGB object */
23
+ dominantRGB: RGBColor;
24
+ /** Whether the image has significant transparency */
25
+ hasTransparency: boolean;
26
+ }
27
+ /**
28
+ * Options for color extraction.
29
+ */
30
+ export interface ColorExtractionOptions {
31
+ /** Number of colors to extract (default: 5) */
32
+ colorCount?: number;
33
+ /** Sample size for analysis (default: 64) */
34
+ sampleSize?: number;
35
+ /** Minimum saturation for "colorful" detection (default: 0.1) */
36
+ minSaturation?: number;
37
+ /** Transparency threshold (default: 0.5) */
38
+ transparencyThreshold?: number;
39
+ }
40
+ /**
41
+ * Extract dominant colors from an image using k-means clustering.
42
+ *
43
+ * @param input - Image buffer or file path
44
+ * @param options - Extraction options
45
+ * @returns Dominant color and palette
46
+ */
47
+ export declare function extractDominantColor(input: Buffer | string, options?: ColorExtractionOptions): Promise<ColorExtractionResult>;
48
+ /**
49
+ * Convert RGB to hex color.
50
+ */
51
+ export declare function rgbToHex(color: RGBColor): string;
52
+ /**
53
+ * Convert hex to RGB color.
54
+ */
55
+ export declare function hexToRgb(hex: string): RGBColor;
56
+ /**
57
+ * Get a contrasting text color (black or white) for a background.
58
+ */
59
+ export declare function getContrastColor(background: RGBColor): string;
60
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/processing/color.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kCAAkC;IAClC,WAAW,EAAE,QAAQ,CAAC;IACtB,qDAAqD;IACrD,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAoFhC;AAqKD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAGhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAU9C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM,CAI7D"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @ereo/plugin-images - Image Processing Orchestrator
3
+ *
4
+ * Coordinates image processing operations using the Sharp processor.
5
+ */
6
+ import type { ImagePluginConfig, ProcessedImage, ImageOptimizationParams, StaticImageData } from '../components/types';
7
+ import { type ImageMetadata } from './sharp-processor';
8
+ import { type BlurPlaceholderResult } from './blur';
9
+ import { type ColorExtractionResult } from './color';
10
+ /**
11
+ * Image processing result with metadata.
12
+ */
13
+ export interface ImageProcessingResult {
14
+ /** Processed image data */
15
+ processed: ProcessedImage;
16
+ /** Original metadata */
17
+ metadata: ImageMetadata;
18
+ /** Blur placeholder (if generated) */
19
+ blur?: BlurPlaceholderResult;
20
+ /** Color extraction result (if generated) */
21
+ colors?: ColorExtractionResult;
22
+ }
23
+ /**
24
+ * Full image data including all variants.
25
+ */
26
+ export interface FullImageData {
27
+ /** Static image data for component consumption */
28
+ staticData: StaticImageData;
29
+ /** Original file path */
30
+ path: string;
31
+ /** All generated variants */
32
+ variants: Array<{
33
+ width: number;
34
+ height: number;
35
+ format: string;
36
+ path: string;
37
+ buffer: Buffer;
38
+ }>;
39
+ }
40
+ /**
41
+ * Image processor orchestrator.
42
+ */
43
+ export declare class ImageProcessor {
44
+ private readonly config;
45
+ private readonly sharp;
46
+ private readonly cache;
47
+ constructor(config?: ImagePluginConfig);
48
+ /**
49
+ * Process a single image with given parameters.
50
+ */
51
+ process(input: Buffer | string, params: ImageOptimizationParams): Promise<ProcessedImage>;
52
+ /**
53
+ * Process an image and generate all metadata.
54
+ */
55
+ processWithMetadata(input: Buffer | string, params: ImageOptimizationParams): Promise<ImageProcessingResult>;
56
+ /**
57
+ * Process a local image file and generate all variants.
58
+ */
59
+ processFile(filePath: string): Promise<FullImageData>;
60
+ /**
61
+ * Get image metadata without processing.
62
+ */
63
+ getMetadata(input: Buffer | string): Promise<ImageMetadata>;
64
+ /**
65
+ * Generate blur placeholder for an image.
66
+ */
67
+ generateBlur(input: Buffer | string): Promise<BlurPlaceholderResult>;
68
+ /**
69
+ * Extract dominant color from an image.
70
+ */
71
+ extractColor(input: Buffer | string): Promise<ColorExtractionResult>;
72
+ /**
73
+ * Check if a file is a supported image format.
74
+ */
75
+ isSupported(filePath: string): boolean;
76
+ /**
77
+ * Clear the processing cache.
78
+ */
79
+ clearCache(): void;
80
+ /**
81
+ * Get enabled output formats based on config and image type.
82
+ */
83
+ private getEnabledFormats;
84
+ /**
85
+ * Generate a path for a variant file.
86
+ */
87
+ private getVariantPath;
88
+ /**
89
+ * Generate a cache key for a processing operation.
90
+ */
91
+ private getCacheKey;
92
+ /**
93
+ * Simple hash for buffer content.
94
+ */
95
+ private hashBuffer;
96
+ }
97
+ /**
98
+ * Create a new image processor instance.
99
+ */
100
+ export declare function createImageProcessor(config?: ImagePluginConfig): ImageProcessor;
101
+ //# sourceMappingURL=processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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C,cAAc,CAAC;IAmB1B;;OAEG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,qBAAqB,CAAC;IAmCjC;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAyG3D;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjE;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1E;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1E;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKtC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACH,OAAO,CAAC,UAAU;CAOnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAE/E"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @ereo/plugin-images - Sharp-based Image Processor
3
+ *
4
+ * Core image processing using the Sharp library.
5
+ */
6
+ import sharp from 'sharp';
7
+ import type { ProcessedImage, ImageOptimizationParams } from '../components/types';
8
+ /**
9
+ * Sharp processor options.
10
+ */
11
+ export interface SharpProcessorOptions {
12
+ /** Default quality (1-100) */
13
+ quality?: number;
14
+ /** Maximum dimension */
15
+ maxDimension?: number;
16
+ /** Enable caching */
17
+ cache?: boolean;
18
+ }
19
+ /**
20
+ * Image metadata from Sharp.
21
+ */
22
+ export interface ImageMetadata {
23
+ width: number;
24
+ height: number;
25
+ format: string;
26
+ space?: string;
27
+ channels?: number;
28
+ depth?: string;
29
+ density?: number;
30
+ hasAlpha?: boolean;
31
+ orientation?: number;
32
+ }
33
+ /**
34
+ * Sharp-based image processor.
35
+ */
36
+ export declare class SharpProcessor {
37
+ private readonly quality;
38
+ private readonly maxDimension;
39
+ constructor(options?: SharpProcessorOptions);
40
+ /**
41
+ * Process an image with the given parameters.
42
+ */
43
+ process(input: Buffer | string, params: ImageOptimizationParams): Promise<ProcessedImage>;
44
+ /**
45
+ * Get image metadata without processing.
46
+ */
47
+ getMetadata(input: Buffer | string): Promise<ImageMetadata>;
48
+ /**
49
+ * Resize an image to specific dimensions.
50
+ */
51
+ resize(input: Buffer | string, width: number, height?: number, options?: Partial<sharp.ResizeOptions>): Promise<Buffer>;
52
+ /**
53
+ * Convert image to a specific format.
54
+ */
55
+ toFormat(input: Buffer | string, format: 'webp' | 'avif' | 'jpeg' | 'png', quality?: number): Promise<Buffer>;
56
+ /**
57
+ * Check if an image has transparency.
58
+ */
59
+ hasTransparency(input: Buffer | string): Promise<boolean>;
60
+ /**
61
+ * Rotate image based on EXIF orientation and optionally strip metadata.
62
+ */
63
+ normalize(input: Buffer | string): Promise<Buffer>;
64
+ /**
65
+ * Get dominant colors from an image.
66
+ * This is a simple implementation - color.ts has a more sophisticated version.
67
+ */
68
+ getDominantColor(input: Buffer | string): Promise<string>;
69
+ }
70
+ /**
71
+ * Create a new Sharp processor instance.
72
+ */
73
+ export declare function createSharpProcessor(options?: SharpProcessorOptions): SharpProcessor;
74
+ //# sourceMappingURL=sharp-processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharp-processor.d.ts","sourceRoot":"","sources":["../../src/processing/sharp-processor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGnF;;GA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B,GAC7B,OAAO,CAAC,MAAM,CAAC;IAqBlB;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/D;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD;;;OAGG;IACG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAOhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAEpF"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * @ereo/plugin-images - Transform Cache Management
3
+ *
4
+ * LRU memory cache and disk cache for optimized images.
5
+ * Implements the unified CacheAdapter interface from @ereo/core.
6
+ */
7
+ import type { CacheAdapter, CacheSetOptions } from '@ereo/core';
8
+ /**
9
+ * LRU memory cache options.
10
+ */
11
+ export interface MemoryCacheOptions {
12
+ /** Maximum number of items */
13
+ maxItems?: number;
14
+ /** Maximum total size in bytes */
15
+ maxSize?: number;
16
+ /** TTL in milliseconds (0 = no expiry) */
17
+ ttl?: number;
18
+ }
19
+ /**
20
+ * LRU memory cache for image buffers.
21
+ */
22
+ export declare class MemoryCache {
23
+ private readonly cache;
24
+ private readonly maxItems;
25
+ private readonly maxSize;
26
+ private readonly ttl;
27
+ private currentSize;
28
+ constructor(options?: MemoryCacheOptions);
29
+ /**
30
+ * Get an item from cache.
31
+ */
32
+ get(key: string): Buffer | undefined;
33
+ /**
34
+ * Set an item in cache.
35
+ */
36
+ set(key: string, value: Buffer): void;
37
+ /**
38
+ * Check if key exists in cache.
39
+ */
40
+ has(key: string): boolean;
41
+ /**
42
+ * Delete an item from cache.
43
+ */
44
+ delete(key: string): boolean;
45
+ /**
46
+ * Clear the cache.
47
+ */
48
+ clear(): void;
49
+ /**
50
+ * Get cache statistics.
51
+ */
52
+ stats(): {
53
+ items: number;
54
+ size: number;
55
+ maxItems: number;
56
+ maxSize: number;
57
+ };
58
+ /**
59
+ * Evict the least recently used item.
60
+ */
61
+ private evictLRU;
62
+ }
63
+ /**
64
+ * Disk cache options.
65
+ */
66
+ export interface DiskCacheOptions {
67
+ /** Cache directory */
68
+ dir: string;
69
+ /** Maximum total size in bytes */
70
+ maxSize?: number;
71
+ /** TTL in milliseconds (0 = no expiry) */
72
+ ttl?: number;
73
+ }
74
+ /**
75
+ * Disk cache for persisting optimized images.
76
+ */
77
+ export declare class DiskCache {
78
+ private readonly dir;
79
+ private readonly maxSize;
80
+ private readonly ttl;
81
+ private initialized;
82
+ constructor(options: DiskCacheOptions);
83
+ /**
84
+ * Initialize the cache directory.
85
+ */
86
+ private init;
87
+ /**
88
+ * Generate a file path for a cache key.
89
+ */
90
+ private getPath;
91
+ /**
92
+ * Get an item from disk cache.
93
+ */
94
+ get(key: string): Promise<Buffer | undefined>;
95
+ /**
96
+ * Set an item in disk cache.
97
+ */
98
+ set(key: string, value: Buffer): Promise<void>;
99
+ /**
100
+ * Check if key exists in disk cache.
101
+ */
102
+ has(key: string): Promise<boolean>;
103
+ /**
104
+ * Delete an item from disk cache.
105
+ */
106
+ delete(key: string): Promise<boolean>;
107
+ /**
108
+ * Clean up expired entries.
109
+ */
110
+ cleanup(): Promise<{
111
+ deleted: number;
112
+ freed: number;
113
+ }>;
114
+ /**
115
+ * Get cache statistics.
116
+ */
117
+ stats(): Promise<{
118
+ files: number;
119
+ size: number;
120
+ }>;
121
+ }
122
+ /**
123
+ * Two-tier cache combining memory and disk.
124
+ */
125
+ export declare class TwoTierCache {
126
+ private readonly memory;
127
+ private readonly disk;
128
+ constructor(options: {
129
+ memory?: MemoryCacheOptions;
130
+ disk: DiskCacheOptions;
131
+ });
132
+ /**
133
+ * Get an item from cache (checks memory first, then disk).
134
+ */
135
+ get(key: string): Promise<Buffer | undefined>;
136
+ /**
137
+ * Set an item in cache (writes to both memory and disk).
138
+ */
139
+ set(key: string, value: Buffer): Promise<void>;
140
+ /**
141
+ * Check if key exists in either cache.
142
+ */
143
+ has(key: string): Promise<boolean>;
144
+ /**
145
+ * Delete from both caches.
146
+ */
147
+ delete(key: string): Promise<boolean>;
148
+ /**
149
+ * Clear both caches.
150
+ */
151
+ clear(): Promise<void>;
152
+ /**
153
+ * Get combined statistics.
154
+ */
155
+ stats(): Promise<{
156
+ memory: {
157
+ items: number;
158
+ size: number;
159
+ };
160
+ disk: {
161
+ files: number;
162
+ size: number;
163
+ };
164
+ }>;
165
+ /**
166
+ * Clean up expired disk cache entries.
167
+ */
168
+ cleanup(): Promise<{
169
+ deleted: number;
170
+ freed: number;
171
+ }>;
172
+ }
173
+ /**
174
+ * Generate a cache key for image optimization parameters.
175
+ */
176
+ export declare function generateCacheKey(params: {
177
+ src: string;
178
+ width: number;
179
+ height?: number;
180
+ quality?: number;
181
+ format?: string;
182
+ }): string;
183
+ /**
184
+ * Adapter to wrap MemoryCache as a CacheAdapter.
185
+ * Note: This adapter is specifically for Buffer values (images).
186
+ */
187
+ export declare class MemoryCacheAdapter implements CacheAdapter {
188
+ private readonly cache;
189
+ constructor(options?: MemoryCacheOptions);
190
+ get<T>(key: string): Promise<T | undefined>;
191
+ set<T>(key: string, value: T, options?: CacheSetOptions): Promise<void>;
192
+ delete(key: string): Promise<boolean>;
193
+ has(key: string): Promise<boolean>;
194
+ clear(): Promise<void>;
195
+ /**
196
+ * Get cache statistics.
197
+ */
198
+ stats(): {
199
+ items: number;
200
+ size: number;
201
+ maxItems: number;
202
+ maxSize: number;
203
+ };
204
+ }
205
+ /**
206
+ * Adapter to wrap DiskCache as a CacheAdapter.
207
+ * Note: This adapter is specifically for Buffer values (images).
208
+ */
209
+ export declare class DiskCacheAdapter implements CacheAdapter {
210
+ private readonly cache;
211
+ constructor(options: DiskCacheOptions);
212
+ get<T>(key: string): Promise<T | undefined>;
213
+ set<T>(key: string, value: T, _options?: CacheSetOptions): Promise<void>;
214
+ delete(key: string): Promise<boolean>;
215
+ has(key: string): Promise<boolean>;
216
+ clear(): Promise<void>;
217
+ /**
218
+ * Get cache statistics.
219
+ */
220
+ stats(): Promise<{
221
+ files: number;
222
+ size: number;
223
+ }>;
224
+ /**
225
+ * Clean up expired entries.
226
+ */
227
+ cleanup(): Promise<{
228
+ deleted: number;
229
+ freed: number;
230
+ }>;
231
+ }
232
+ /**
233
+ * Adapter to wrap TwoTierCache as a CacheAdapter.
234
+ * Note: This adapter is specifically for Buffer values (images).
235
+ */
236
+ export declare class TwoTierCacheAdapter implements CacheAdapter {
237
+ private readonly cache;
238
+ constructor(options: {
239
+ memory?: MemoryCacheOptions;
240
+ disk: DiskCacheOptions;
241
+ });
242
+ get<T>(key: string): Promise<T | undefined>;
243
+ set<T>(key: string, value: T, _options?: CacheSetOptions): Promise<void>;
244
+ delete(key: string): Promise<boolean>;
245
+ has(key: string): Promise<boolean>;
246
+ clear(): Promise<void>;
247
+ /**
248
+ * Get combined statistics.
249
+ */
250
+ stats(): Promise<{
251
+ memory: {
252
+ items: number;
253
+ size: number;
254
+ };
255
+ disk: {
256
+ files: number;
257
+ size: number;
258
+ };
259
+ }>;
260
+ /**
261
+ * Clean up expired disk cache entries.
262
+ */
263
+ cleanup(): Promise<{
264
+ deleted: number;
265
+ freed: number;
266
+ }>;
267
+ }
268
+ /**
269
+ * Create a CacheAdapter-compatible image cache.
270
+ * Uses a two-tier (memory + disk) cache by default.
271
+ */
272
+ export declare function createImageCacheAdapter(options: {
273
+ memory?: MemoryCacheOptions;
274
+ disk: DiskCacheOptions;
275
+ }): CacheAdapter;
276
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/runtime/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8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AO,CAAC,CAAC,GAAG,SAAS,CAAC;IAK3C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC;QACrB,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACxC,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACvC,CAAC;IAIF;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAG7D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,gBAAgB,CAAC;CACxB,GAAG,YAAY,CAEf"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @ereo/plugin-images - On-Demand Transform Middleware
3
+ *
4
+ * HTTP middleware for runtime image optimization.
5
+ */
6
+ import type { AppContext, MiddlewareHandler } from '@ereo/core';
7
+ import type { ImagePluginConfig } from '../components/types';
8
+ /**
9
+ * Middleware options.
10
+ */
11
+ export interface ImageMiddlewareOptions {
12
+ /** Project root directory */
13
+ root: string;
14
+ /** Plugin configuration */
15
+ config?: ImagePluginConfig;
16
+ /** Enable caching */
17
+ cache?: boolean;
18
+ /** Cache directory */
19
+ cacheDir?: string;
20
+ }
21
+ /**
22
+ * Create the image optimization middleware.
23
+ */
24
+ export declare function createImageMiddleware(options: ImageMiddlewareOptions): (request: Request, context: AppContext, next: () => Promise<Response>) => Promise<Response>;
25
+ /**
26
+ * Create a dev server middleware handler.
27
+ */
28
+ export declare function imageMiddleware(options: ImageMiddlewareOptions): MiddlewareHandler;
29
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/runtime/middleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAatF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA6GD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,IAsBjE,SAAS,OAAO,EAChB,SAAS,UAAU,EACnB,MAAM,MAAM,OAAO,CAAC,QAAQ,CAAC,KAC5B,OAAO,CAAC,QAAQ,CAAC,CA8ErB;AA+BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,CAUlF"}