@ecopages/image-processor 0.2.0-alpha.26 → 0.2.0-alpha.28
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/package.json +3 -3
- package/src/bun-plugins.d.ts +1 -1
- package/src/image-plugins.d.ts +1 -1
- package/src/image-processor.js +2 -2
- package/src/plugin.d.ts +1 -2
- package/src/plugin.js +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/image-processor",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.28",
|
|
4
4
|
"description": "Image processor, transform and optimize images for web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"image",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"directory": "packages/processors/image-processor"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
18
|
+
"@ecopages/core": "0.2.0-alpha.28"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ecopages/file-system": "0.2.0-alpha.
|
|
21
|
+
"@ecopages/file-system": "0.2.0-alpha.28",
|
|
22
22
|
"@ecopages/logger": "^0.2.3",
|
|
23
23
|
"react": "^19",
|
|
24
24
|
"react-dom": "^19",
|
package/src/bun-plugins.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file contains the plugins for bundling the image specifications.
|
|
3
3
|
* @module @ecopages/image-processor/bun-plugins
|
|
4
4
|
*/
|
|
5
|
-
import type { EcoBuildPlugin } from '@ecopages/core/
|
|
5
|
+
import type { EcoBuildPlugin } from '@ecopages/core/plugins/processor';
|
|
6
6
|
import type { ImageMap } from './plugin.js';
|
|
7
7
|
/**
|
|
8
8
|
* This function creates a plugin for bundling the image specifications.
|
package/src/image-plugins.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file contains the plugins for bundling the image specifications.
|
|
3
3
|
* @module @ecopages/image-processor/image-plugins
|
|
4
4
|
*/
|
|
5
|
-
import type { EcoBuildPlugin } from '@ecopages/core/
|
|
5
|
+
import type { EcoBuildPlugin } from '@ecopages/core/plugins/processor';
|
|
6
6
|
import type { ImageMap } from './plugin.js';
|
|
7
7
|
/**
|
|
8
8
|
* This function creates a plugin for bundling the image specifications.
|
package/src/image-processor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import { mergeProcessorOptions } from "@ecopages/core/plugins/processor";
|
|
3
3
|
import { fileSystem } from "@ecopages/file-system";
|
|
4
4
|
import { Logger } from "@ecopages/logger";
|
|
5
5
|
import sharp from "sharp";
|
|
@@ -11,7 +11,7 @@ class ImageProcessor {
|
|
|
11
11
|
config;
|
|
12
12
|
cacheManager;
|
|
13
13
|
constructor(config, cacheManager) {
|
|
14
|
-
this.config =
|
|
14
|
+
this.config = mergeProcessorOptions({ cacheEnabled: true }, config);
|
|
15
15
|
this.cacheManager = cacheManager;
|
|
16
16
|
fileSystem.ensureDir(this.config.outputDir);
|
|
17
17
|
}
|
package/src/plugin.d.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* ImageProcessorPlugin
|
|
3
3
|
* @module @ecopages/image-processor
|
|
4
4
|
*/
|
|
5
|
-
import { Processor, type ProcessorConfig } from '@ecopages/core/plugins/processor';
|
|
6
|
-
import type { EcoBuildPlugin } from '@ecopages/core/build/build-types';
|
|
5
|
+
import { Processor, type EcoBuildPlugin, type ProcessorConfig } from '@ecopages/core/plugins/processor';
|
|
7
6
|
import { ImageProcessor } from './image-processor.js';
|
|
8
7
|
import type { ImageSize, ImageSpecifications } from './types.js';
|
|
9
8
|
/**
|
package/src/plugin.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { deepMerge } from "@ecopages/core/utils/deep-merge";
|
|
3
2
|
import { GENERATED_BASE_PATHS } from "@ecopages/core/constants";
|
|
4
3
|
import { fileSystem } from "@ecopages/file-system";
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
mergeProcessorOptions,
|
|
6
|
+
Processor
|
|
7
|
+
} from "@ecopages/core/plugins/processor";
|
|
6
8
|
import { Logger } from "@ecopages/logger";
|
|
7
9
|
import { createImagePlugin, createImagePluginBundler } from "./image-plugins.js";
|
|
8
10
|
import { ImageProcessor } from "./image-processor.js";
|
|
@@ -85,7 +87,7 @@ class ImageProcessorPlugin extends Processor {
|
|
|
85
87
|
extensions: extensionPatterns
|
|
86
88
|
}
|
|
87
89
|
],
|
|
88
|
-
watch: config.watch ?
|
|
90
|
+
watch: config.watch ? mergeProcessorOptions(defaultWatchConfig, config.watch) : defaultWatchConfig
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
93
|
get buildPlugins() {
|
|
@@ -130,7 +132,7 @@ class ImageProcessorPlugin extends Processor {
|
|
|
130
132
|
quality: 80,
|
|
131
133
|
format: "webp"
|
|
132
134
|
};
|
|
133
|
-
const config = this.options ?
|
|
135
|
+
const config = this.options ? mergeProcessorOptions(defaultConfig, this.options) : defaultConfig;
|
|
134
136
|
this.resolvedConfig = config;
|
|
135
137
|
this.processor = new ImageProcessor(config, {
|
|
136
138
|
readCache: (key) => this.readCache(key),
|