@thi.ng/imago 1.1.7 → 1.2.0
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/CHANGELOG.md +7 -1
- package/api.d.ts +5 -0
- package/ops/output.js +4 -1
- package/package.json +3 -3
- package/proc.d.ts +1 -0
- package/proc.js +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-07-
|
|
3
|
+
- **Last updated**: 2025-07-14T10:05:28Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
## [1.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imago@1.2.0) (2025-07-14)
|
|
15
|
+
|
|
16
|
+
#### 🚀 Features
|
|
17
|
+
|
|
18
|
+
- add `outputMeta` for raw outputs ([37810d3](https://github.com/thi-ng/umbrella/commit/37810d3))
|
|
19
|
+
|
|
14
20
|
### [1.1.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/imago@1.1.6) (2025-07-12)
|
|
15
21
|
|
|
16
22
|
#### 🩹 Bug fixes
|
package/api.d.ts
CHANGED
|
@@ -465,6 +465,11 @@ export interface ImgProcCtx {
|
|
|
465
465
|
* {@link output}.
|
|
466
466
|
*/
|
|
467
467
|
outputs: Record<string, string | Buffer>;
|
|
468
|
+
/**
|
|
469
|
+
* Recorded metadata of outputs which requested it, keyed by IDs given via
|
|
470
|
+
* {@link OutputSpec} / {@link output} (current `raw` format only).
|
|
471
|
+
*/
|
|
472
|
+
outputMeta: Record<string, object>;
|
|
468
473
|
/**
|
|
469
474
|
* See {@link ImgProcOpts.env} for details/comments.
|
|
470
475
|
*/
|
package/ops/output.js
CHANGED
|
@@ -88,6 +88,9 @@ const __outputRaw = async (opts, output, ctx, outDir) => {
|
|
|
88
88
|
if (alpha) output = output.ensureAlpha();
|
|
89
89
|
else output = output.removeAlpha();
|
|
90
90
|
const { data, info } = await output.raw().toBuffer({ resolveWithObject: true });
|
|
91
|
+
if (meta) {
|
|
92
|
+
ctx.outputMeta[opts.id] = { ...info, exif: ctx.exif };
|
|
93
|
+
}
|
|
91
94
|
if (opts.path !== void 0) {
|
|
92
95
|
const path = join(outDir, formatPath(opts.path, ctx, opts, data));
|
|
93
96
|
writeFile(path, data, null, ctx.logger);
|
|
@@ -95,7 +98,7 @@ const __outputRaw = async (opts, output, ctx, outDir) => {
|
|
|
95
98
|
if (meta) {
|
|
96
99
|
writeJSON(
|
|
97
100
|
path + ".meta.json",
|
|
98
|
-
|
|
101
|
+
ctx.outputMeta[opts.id],
|
|
99
102
|
void 0,
|
|
100
103
|
void 0,
|
|
101
104
|
ctx.logger
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/imago",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "JSON & API-based declarative and extensible image processing trees/pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"sharp": "^0.34.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@thi.ng/vectors": "^8.3.
|
|
57
|
+
"@thi.ng/vectors": "^8.3.3",
|
|
58
58
|
"@types/node": "^24.0.12",
|
|
59
59
|
"esbuild": "^0.25.6",
|
|
60
60
|
"typedoc": "^0.28.7",
|
|
@@ -189,5 +189,5 @@
|
|
|
189
189
|
"status": "alpha",
|
|
190
190
|
"year": 2024
|
|
191
191
|
},
|
|
192
|
-
"gitHead": "
|
|
192
|
+
"gitHead": "63a8b97642b9c481bb623e8d53e6250749a2cbfb\n"
|
|
193
193
|
}
|
package/proc.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const processImage: (src: string | BufferLike | ArrayBuffer | Int
|
|
|
23
23
|
meta: sharp.Metadata;
|
|
24
24
|
env: import("@thi.ng/api").IObjectOf<any>;
|
|
25
25
|
outputs: Record<string, string | Buffer<ArrayBufferLike>>;
|
|
26
|
+
outputMeta: Record<string, object>;
|
|
26
27
|
}>;
|
|
27
28
|
/**
|
|
28
29
|
* Extensible polymorphic function performing a single image processing step.
|
package/proc.js
CHANGED
|
@@ -32,6 +32,7 @@ const processImage = async (src, specs, opts = {}, parentCtx) => {
|
|
|
32
32
|
const ctx = {
|
|
33
33
|
path: isString(src) ? src : parentCtx?.path,
|
|
34
34
|
outputs: parentCtx ? parentCtx.outputs : {},
|
|
35
|
+
outputMeta: parentCtx ? parentCtx.outputMeta : {},
|
|
35
36
|
env: parentCtx ? parentCtx.env : opts.env || {},
|
|
36
37
|
logger: opts.logger || LOGGER,
|
|
37
38
|
size: [meta.width, meta.height],
|
|
@@ -67,7 +68,13 @@ const processImage = async (src, specs, opts = {}, parentCtx) => {
|
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
img,
|
|
73
|
+
meta,
|
|
74
|
+
env: ctx.env,
|
|
75
|
+
outputs: ctx.outputs,
|
|
76
|
+
outputMeta: ctx.outputMeta
|
|
77
|
+
};
|
|
71
78
|
} finally {
|
|
72
79
|
if (ctx.iccFile) deleteFile(ctx.iccFile, ctx.logger);
|
|
73
80
|
}
|