@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.
- package/README.md +197 -0
- package/dist/build/manifest.d.ts +94 -0
- package/dist/build/manifest.d.ts.map +1 -0
- package/dist/build/optimizer.d.ts +99 -0
- package/dist/build/optimizer.d.ts.map +1 -0
- package/dist/components/Image.d.ts +28 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Picture.d.ts +36 -0
- package/dist/components/Picture.d.ts.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3172 -0
- package/dist/components/types.d.ts +380 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +77 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/schema.d.ts +23 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4870 -0
- package/dist/plugin.d.ts +28 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/processing/blur.d.ts +78 -0
- package/dist/processing/blur.d.ts.map +1 -0
- package/dist/processing/color.d.ts +60 -0
- package/dist/processing/color.d.ts.map +1 -0
- package/dist/processing/processor.d.ts +101 -0
- package/dist/processing/processor.d.ts.map +1 -0
- package/dist/processing/sharp-processor.d.ts +74 -0
- package/dist/processing/sharp-processor.d.ts.map +1 -0
- package/dist/runtime/cache.d.ts +276 -0
- package/dist/runtime/cache.d.ts.map +1 -0
- package/dist/runtime/middleware.d.ts +29 -0
- package/dist/runtime/middleware.d.ts.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# @ereo/plugin-images
|
|
2
|
+
|
|
3
|
+
Complete image optimization plugin for the EreoJS framework. Provides automatic image optimization, blur placeholders, responsive srcset generation, and art direction support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @ereo/plugin-images sharp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
// ereo.config.ts
|
|
15
|
+
import { defineConfig } from '@ereo/core';
|
|
16
|
+
import images from '@ereo/plugin-images';
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
plugins: [
|
|
20
|
+
images({
|
|
21
|
+
formats: { webp: true, avif: true },
|
|
22
|
+
quality: 80,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// In your components
|
|
30
|
+
import { Image, Picture } from '@ereo/plugin-images/components';
|
|
31
|
+
import heroImg from './hero.jpg';
|
|
32
|
+
|
|
33
|
+
function Hero() {
|
|
34
|
+
return (
|
|
35
|
+
<Image
|
|
36
|
+
src={heroImg}
|
|
37
|
+
alt="Hero image"
|
|
38
|
+
placeholder="blur"
|
|
39
|
+
priority
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Key Features
|
|
46
|
+
|
|
47
|
+
- **Automatic Optimization**: Compress and resize images at build time
|
|
48
|
+
- **Modern Formats**: Generate WebP and AVIF variants automatically
|
|
49
|
+
- **Blur Placeholders**: Create LQIP (Low Quality Image Placeholders) for smooth loading
|
|
50
|
+
- **Responsive Images**: Generate srcset with multiple sizes for different viewports
|
|
51
|
+
- **Image and Picture Components**: React components with built-in optimization
|
|
52
|
+
- **Dominant Color Extraction**: Extract colors for placeholder backgrounds using k-means clustering
|
|
53
|
+
- **Runtime Middleware**: On-demand image processing in development
|
|
54
|
+
- **Build-time Processing**: Batch optimize all images during production build
|
|
55
|
+
- **Two-Tier Caching**: Memory and disk caching for optimized images
|
|
56
|
+
- **Format Negotiation**: Automatic best format selection based on browser Accept header
|
|
57
|
+
|
|
58
|
+
## Supported Formats
|
|
59
|
+
|
|
60
|
+
**Input:** JPEG, PNG, WebP, AVIF, GIF, SVG
|
|
61
|
+
|
|
62
|
+
**Output:** WebP, AVIF, JPEG, PNG
|
|
63
|
+
|
|
64
|
+
## Exports
|
|
65
|
+
|
|
66
|
+
### Main Plugin
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import images from '@ereo/plugin-images';
|
|
70
|
+
// or
|
|
71
|
+
import { imagesPlugin } from '@ereo/plugin-images';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Components
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { Image, Picture } from '@ereo/plugin-images/components';
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Processing Utilities
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import {
|
|
84
|
+
// Image processor
|
|
85
|
+
createImageProcessor,
|
|
86
|
+
ImageProcessor,
|
|
87
|
+
createSharpProcessor,
|
|
88
|
+
SharpProcessor,
|
|
89
|
+
|
|
90
|
+
// Blur generation
|
|
91
|
+
generateBlurPlaceholder,
|
|
92
|
+
generateShimmerSVG,
|
|
93
|
+
generateShimmerDataURL,
|
|
94
|
+
|
|
95
|
+
// Color extraction
|
|
96
|
+
extractDominantColor,
|
|
97
|
+
rgbToHex,
|
|
98
|
+
hexToRgb,
|
|
99
|
+
getContrastColor,
|
|
100
|
+
} from '@ereo/plugin-images';
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Build Utilities
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import {
|
|
107
|
+
createBuildOptimizer,
|
|
108
|
+
optimizeImages,
|
|
109
|
+
BuildOptimizer,
|
|
110
|
+
createManifestManager,
|
|
111
|
+
ImageManifestManager,
|
|
112
|
+
} from '@ereo/plugin-images';
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Runtime Utilities
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import {
|
|
119
|
+
createImageMiddleware,
|
|
120
|
+
imageMiddleware,
|
|
121
|
+
MemoryCache,
|
|
122
|
+
DiskCache,
|
|
123
|
+
TwoTierCache,
|
|
124
|
+
generateCacheKey,
|
|
125
|
+
} from '@ereo/plugin-images';
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Configuration Utilities
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import {
|
|
132
|
+
validateConfig,
|
|
133
|
+
matchesRemotePattern,
|
|
134
|
+
ConfigValidationError,
|
|
135
|
+
DEFAULT_DEVICE_SIZES,
|
|
136
|
+
DEFAULT_IMAGE_SIZES,
|
|
137
|
+
DEFAULT_QUALITY,
|
|
138
|
+
MAX_DIMENSION,
|
|
139
|
+
IMAGE_PATH_PREFIX,
|
|
140
|
+
SUPPORTED_INPUT_FORMATS,
|
|
141
|
+
SUPPORTED_OUTPUT_FORMATS,
|
|
142
|
+
FORMAT_MIME_TYPES,
|
|
143
|
+
getAllSizes,
|
|
144
|
+
getSizesForWidth,
|
|
145
|
+
} from '@ereo/plugin-images';
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### TypeScript Types
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import type {
|
|
152
|
+
ImageProps,
|
|
153
|
+
PictureProps,
|
|
154
|
+
PictureSource,
|
|
155
|
+
StaticImageData,
|
|
156
|
+
PlaceholderType,
|
|
157
|
+
ObjectFit,
|
|
158
|
+
ObjectPosition,
|
|
159
|
+
ImageLoading,
|
|
160
|
+
ImageDecoding,
|
|
161
|
+
ImageLoader,
|
|
162
|
+
ImageLoaderParams,
|
|
163
|
+
ImagePluginConfig,
|
|
164
|
+
RemotePattern,
|
|
165
|
+
ImageManifestEntry,
|
|
166
|
+
ImageVariant,
|
|
167
|
+
ImageOptimizationParams,
|
|
168
|
+
ProcessedImage,
|
|
169
|
+
} from '@ereo/plugin-images';
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
For full documentation, visit the [EreoJS Images Plugin Documentation](https://ereojs.dev/docs/api/plugins/images).
|
|
175
|
+
|
|
176
|
+
### Documentation Sections
|
|
177
|
+
|
|
178
|
+
- **[Basic Usage](#quick-start)** - Getting started with the plugin
|
|
179
|
+
- **[Image Component](https://ereojs.dev/docs/api/plugins/images#image-component)** - Props and examples
|
|
180
|
+
- **[Picture Component](https://ereojs.dev/docs/api/plugins/images#picture-component)** - Art direction support
|
|
181
|
+
- **[TypeScript API Reference](https://ereojs.dev/docs/api/plugins/images#typescript-api-reference)** - All exported interfaces
|
|
182
|
+
- **[ImageProcessor Direct Usage](https://ereojs.dev/docs/api/plugins/images#imageprocessor-direct-usage)** - Programmatic processing
|
|
183
|
+
- **[BuildOptimizer Integration](https://ereojs.dev/docs/api/plugins/images#buildoptimizer-integration)** - Build-time optimization
|
|
184
|
+
- **[ManifestManager](https://ereojs.dev/docs/api/plugins/images#manifestmanager)** - Tracking processed images
|
|
185
|
+
- **[Blur Generation Functions](https://ereojs.dev/docs/api/plugins/images#blur-generation-functions)** - LQIP utilities
|
|
186
|
+
- **[Color Utilities](https://ereojs.dev/docs/api/plugins/images#color-utilities)** - Color extraction and manipulation
|
|
187
|
+
- **[Error Handling](https://ereojs.dev/docs/api/plugins/images#error-handling)** - ConfigValidationError and patterns
|
|
188
|
+
- **[Caching](https://ereojs.dev/docs/api/plugins/images#caching)** - Memory and disk cache
|
|
189
|
+
- **[Troubleshooting Guide](https://ereojs.dev/docs/api/plugins/images#troubleshooting-guide)** - Common issues and solutions
|
|
190
|
+
|
|
191
|
+
## Part of EreoJS
|
|
192
|
+
|
|
193
|
+
This package is part of the [EreoJS](https://github.com/ereojs/ereo) monorepo - a modern full-stack JavaScript framework.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/plugin-images - Image Manifest Generation
|
|
3
|
+
*
|
|
4
|
+
* Track processed images and their variants.
|
|
5
|
+
*/
|
|
6
|
+
import type { ImageManifestEntry, ImageVariant } from '../components/types';
|
|
7
|
+
/**
|
|
8
|
+
* Image manifest for tracking all processed images.
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageManifest {
|
|
11
|
+
/** Manifest version */
|
|
12
|
+
version: number;
|
|
13
|
+
/** Build timestamp */
|
|
14
|
+
buildTime: number;
|
|
15
|
+
/** Map of source paths to image entries */
|
|
16
|
+
images: Record<string, ImageManifestEntry>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Image manifest manager.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ImageManifestManager {
|
|
22
|
+
private manifest;
|
|
23
|
+
private readonly manifestPath;
|
|
24
|
+
private dirty;
|
|
25
|
+
constructor(outDir: string);
|
|
26
|
+
/**
|
|
27
|
+
* Load the manifest from disk.
|
|
28
|
+
*/
|
|
29
|
+
load(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Save the manifest to disk.
|
|
32
|
+
*/
|
|
33
|
+
save(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Add or update an image entry.
|
|
36
|
+
*/
|
|
37
|
+
addImage(sourcePath: string, data: Omit<ImageManifestEntry, 'hash'>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get an image entry by source path.
|
|
40
|
+
*/
|
|
41
|
+
getImage(sourcePath: string): ImageManifestEntry | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if an image needs reprocessing.
|
|
44
|
+
*/
|
|
45
|
+
needsReprocessing(sourcePath: string, fileHash: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Remove an image entry.
|
|
48
|
+
*/
|
|
49
|
+
removeImage(sourcePath: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get all image entries.
|
|
52
|
+
*/
|
|
53
|
+
getAllImages(): Record<string, ImageManifestEntry>;
|
|
54
|
+
/**
|
|
55
|
+
* Get total number of images.
|
|
56
|
+
*/
|
|
57
|
+
getImageCount(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Get total number of variants.
|
|
60
|
+
*/
|
|
61
|
+
getVariantCount(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Get total size of all variants.
|
|
64
|
+
*/
|
|
65
|
+
getTotalSize(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Clear all entries.
|
|
68
|
+
*/
|
|
69
|
+
clear(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Generate a hash for an image entry.
|
|
72
|
+
*/
|
|
73
|
+
private generateHash;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate a virtual module for image metadata.
|
|
77
|
+
*
|
|
78
|
+
* This creates a JavaScript module that exports the image metadata
|
|
79
|
+
* for use by the Image component at runtime.
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateImageModule(entry: ImageManifestEntry, publicPath: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Generate a srcset string from image variants.
|
|
84
|
+
*/
|
|
85
|
+
export declare function generateSrcset(variants: ImageVariant[], publicPath: string, format?: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Get the best variant for a given width and format.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getBestVariant(variants: ImageVariant[], width: number, format?: string): ImageVariant | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Create a new manifest manager.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createManifestManager(outDir: string): ImageManifestManager;
|
|
94
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/build/manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC5C;AAWD;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAU3B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAa3B;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,GACrC,IAAI;IAWP;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI5D;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQhE;;OAEG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKrC;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAIlD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,eAAe,IAAI,MAAM;IAOzB;;OAEG;IACH,YAAY,IAAI,MAAM;IAQtB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,OAAO,CAAC,YAAY;CAUrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,kBAAkB,EACzB,UAAU,EAAE,MAAM,GACjB,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,EAAE,EACxB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,EAAE,EACxB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,YAAY,GAAG,SAAS,CAY1B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAE1E"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/plugin-images - Build-time Image Optimizer
|
|
3
|
+
*
|
|
4
|
+
* Scans and processes images during the build phase.
|
|
5
|
+
*/
|
|
6
|
+
import type { ImagePluginConfig } from '../components/types';
|
|
7
|
+
import { type ImageManifestManager } from './manifest';
|
|
8
|
+
/**
|
|
9
|
+
* Build optimizer options.
|
|
10
|
+
*/
|
|
11
|
+
export interface BuildOptimizerOptions {
|
|
12
|
+
/** Project root directory */
|
|
13
|
+
root: string;
|
|
14
|
+
/** Output directory for optimized images */
|
|
15
|
+
outDir: string;
|
|
16
|
+
/** Plugin configuration */
|
|
17
|
+
config?: ImagePluginConfig;
|
|
18
|
+
/** Directories to scan for images */
|
|
19
|
+
scanDirs?: string[];
|
|
20
|
+
/** Whether to force reprocessing all images */
|
|
21
|
+
force?: boolean;
|
|
22
|
+
/** Progress callback */
|
|
23
|
+
onProgress?: (current: number, total: number, file: string) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build result statistics.
|
|
27
|
+
*/
|
|
28
|
+
export interface BuildResult {
|
|
29
|
+
/** Number of images processed */
|
|
30
|
+
processed: number;
|
|
31
|
+
/** Number of images skipped (unchanged) */
|
|
32
|
+
skipped: number;
|
|
33
|
+
/** Total variants generated */
|
|
34
|
+
variants: number;
|
|
35
|
+
/** Total output size in bytes */
|
|
36
|
+
totalSize: number;
|
|
37
|
+
/** Processing time in milliseconds */
|
|
38
|
+
duration: number;
|
|
39
|
+
/** Any errors encountered */
|
|
40
|
+
errors: Array<{
|
|
41
|
+
file: string;
|
|
42
|
+
error: string;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build-time image optimizer.
|
|
47
|
+
*/
|
|
48
|
+
export declare class BuildOptimizer {
|
|
49
|
+
private readonly config;
|
|
50
|
+
private readonly processor;
|
|
51
|
+
private readonly manifest;
|
|
52
|
+
private readonly root;
|
|
53
|
+
private readonly outDir;
|
|
54
|
+
private readonly scanDirs;
|
|
55
|
+
private readonly force;
|
|
56
|
+
private readonly onProgress?;
|
|
57
|
+
constructor(options: BuildOptimizerOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Run the build optimization.
|
|
60
|
+
*/
|
|
61
|
+
run(): Promise<BuildResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Process a single image file.
|
|
64
|
+
*/
|
|
65
|
+
private processImage;
|
|
66
|
+
/**
|
|
67
|
+
* Scan directories for image files.
|
|
68
|
+
*/
|
|
69
|
+
private scanForImages;
|
|
70
|
+
/**
|
|
71
|
+
* Recursively scan a directory for images.
|
|
72
|
+
*/
|
|
73
|
+
private scanDirectory;
|
|
74
|
+
/**
|
|
75
|
+
* Get output formats based on config and image type.
|
|
76
|
+
*/
|
|
77
|
+
private getOutputFormats;
|
|
78
|
+
/**
|
|
79
|
+
* Generate a variant file path.
|
|
80
|
+
*/
|
|
81
|
+
private getVariantPath;
|
|
82
|
+
/**
|
|
83
|
+
* Hash a buffer for cache invalidation.
|
|
84
|
+
*/
|
|
85
|
+
private hashBuffer;
|
|
86
|
+
/**
|
|
87
|
+
* Get the manifest manager.
|
|
88
|
+
*/
|
|
89
|
+
getManifest(): ImageManifestManager;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a build optimizer instance.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createBuildOptimizer(options: BuildOptimizerOptions): BuildOptimizer;
|
|
95
|
+
/**
|
|
96
|
+
* Run a build optimization.
|
|
97
|
+
*/
|
|
98
|
+
export declare function optimizeImages(options: BuildOptimizerOptions): Promise<BuildResult>;
|
|
99
|
+
//# sourceMappingURL=optimizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizer.d.ts","sourceRoot":"","sources":["../../src/build/optimizer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAoC,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAI9E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrE;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAyD;gBAEzE,OAAO,EAAE,qBAAqB;IAW1C;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IAiEjC;;OAEG;YACW,YAAY;IA4G1B;;OAEG;YACW,aAAa;IAgB3B;;OAEG;YACW,aAAa;IAqB3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,WAAW,IAAI,oBAAoB;CAGpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAEnF;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAGzF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/plugin-images - Image Component
|
|
3
|
+
*
|
|
4
|
+
* Optimized image component with automatic srcset, placeholders, and lazy loading.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ImageProps } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* EreoJS Image Component
|
|
10
|
+
*
|
|
11
|
+
* A drop-in replacement for the HTML img element with automatic optimization.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* <Image src="/hero.jpg" alt="Hero image" width={800} height={600} />
|
|
16
|
+
*
|
|
17
|
+
* // With static import
|
|
18
|
+
* import heroImg from './hero.jpg';
|
|
19
|
+
* <Image src={heroImg} alt="Hero" placeholder="blur" />
|
|
20
|
+
*
|
|
21
|
+
* // Fill parent container
|
|
22
|
+
* <div style={{ position: 'relative', width: '100%', height: 400 }}>
|
|
23
|
+
* <Image src="/bg.jpg" alt="Background" fill objectFit="cover" />
|
|
24
|
+
* </div>
|
|
25
|
+
*/
|
|
26
|
+
export declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
27
|
+
export default Image;
|
|
28
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/components/Image.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,SAAS,CAAC;AA2F9E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,qFAkOhB,CAAC;AAIH,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/plugin-images - Picture Component
|
|
3
|
+
*
|
|
4
|
+
* Art direction component for responsive images with different sources.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { PictureProps } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* EreoJS Picture Component
|
|
10
|
+
*
|
|
11
|
+
* Provides art direction for responsive images, allowing different images
|
|
12
|
+
* to be served at different breakpoints.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Art direction with different images for mobile/desktop
|
|
16
|
+
* <Picture
|
|
17
|
+
* alt="Hero image"
|
|
18
|
+
* sources={[
|
|
19
|
+
* { src: heroMobile, media: '(max-width: 640px)' },
|
|
20
|
+
* { src: heroDesktop, media: '(min-width: 641px)' },
|
|
21
|
+
* ]}
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* // With format-based sources
|
|
25
|
+
* <Picture
|
|
26
|
+
* alt="Product photo"
|
|
27
|
+
* sources={[
|
|
28
|
+
* { src: '/product.avif', type: 'image/avif' },
|
|
29
|
+
* { src: '/product.webp', type: 'image/webp' },
|
|
30
|
+
* { src: '/product.jpg' },
|
|
31
|
+
* ]}
|
|
32
|
+
* />
|
|
33
|
+
*/
|
|
34
|
+
export declare const Picture: React.ForwardRefExoticComponent<PictureProps & React.RefAttributes<HTMLImageElement>>;
|
|
35
|
+
export default Picture;
|
|
36
|
+
//# sourceMappingURL=Picture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Picture.d.ts","sourceRoot":"","sources":["../../src/components/Picture.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAqD,MAAM,SAAS,CAAC;AAiF/F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,uFAgOlB,CAAC;AAIH,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/plugin-images - Component Exports
|
|
3
|
+
*
|
|
4
|
+
* React components for optimized images.
|
|
5
|
+
*/
|
|
6
|
+
export { Image, default as ImageComponent } from './Image';
|
|
7
|
+
export { Picture, default as PictureComponent } from './Picture';
|
|
8
|
+
export type { ImageProps, PictureProps, PictureSource, StaticImageData, PlaceholderType, ObjectFit, ObjectPosition, ImageLoading, ImageDecoding, ImageLoader, ImageLoaderParams, } from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACjE,YAAY,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,SAAS,EACT,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
|