@macrulez/devtoolz 0.3.3 → 0.4.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.
Files changed (76) hide show
  1. package/README.md +74 -3
  2. package/dist/cli.js +3 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/image-batch/backup.d.ts +22 -0
  5. package/dist/commands/image-batch/backup.js +55 -0
  6. package/dist/commands/image-batch/backup.js.map +1 -0
  7. package/dist/commands/image-batch/cache.d.ts +15 -0
  8. package/dist/commands/image-batch/cache.js +38 -0
  9. package/dist/commands/image-batch/cache.js.map +1 -0
  10. package/dist/commands/image-batch/cli.d.ts +15 -0
  11. package/dist/commands/image-batch/cli.js +308 -0
  12. package/dist/commands/image-batch/cli.js.map +1 -0
  13. package/dist/commands/image-batch/codecs.d.ts +38 -0
  14. package/dist/commands/image-batch/codecs.js +366 -0
  15. package/dist/commands/image-batch/codecs.js.map +1 -0
  16. package/dist/commands/image-batch/config.d.ts +119 -0
  17. package/dist/commands/image-batch/config.js +693 -0
  18. package/dist/commands/image-batch/config.js.map +1 -0
  19. package/dist/commands/image-batch/errors.d.ts +5 -0
  20. package/dist/commands/image-batch/errors.js +8 -0
  21. package/dist/commands/image-batch/errors.js.map +1 -0
  22. package/dist/commands/image-batch/geometry.d.ts +26 -0
  23. package/dist/commands/image-batch/geometry.js +90 -0
  24. package/dist/commands/image-batch/geometry.js.map +1 -0
  25. package/dist/commands/image-batch/inputs.d.ts +22 -0
  26. package/dist/commands/image-batch/inputs.js +87 -0
  27. package/dist/commands/image-batch/inputs.js.map +1 -0
  28. package/dist/commands/image-batch/manage-cli.d.ts +2 -0
  29. package/dist/commands/image-batch/manage-cli.js +199 -0
  30. package/dist/commands/image-batch/manage-cli.js.map +1 -0
  31. package/dist/commands/image-batch/manage.d.ts +50 -0
  32. package/dist/commands/image-batch/manage.js +1000 -0
  33. package/dist/commands/image-batch/manage.js.map +1 -0
  34. package/dist/commands/image-batch/overwrite.d.ts +14 -0
  35. package/dist/commands/image-batch/overwrite.js +31 -0
  36. package/dist/commands/image-batch/overwrite.js.map +1 -0
  37. package/dist/commands/image-batch/plan.d.ts +86 -0
  38. package/dist/commands/image-batch/plan.js +396 -0
  39. package/dist/commands/image-batch/plan.js.map +1 -0
  40. package/dist/commands/image-batch/process.d.ts +8 -0
  41. package/dist/commands/image-batch/process.js +97 -0
  42. package/dist/commands/image-batch/process.js.map +1 -0
  43. package/dist/commands/image-batch/report.d.ts +6 -0
  44. package/dist/commands/image-batch/report.js +251 -0
  45. package/dist/commands/image-batch/report.js.map +1 -0
  46. package/dist/commands/image-batch/restore.d.ts +29 -0
  47. package/dist/commands/image-batch/restore.js +125 -0
  48. package/dist/commands/image-batch/restore.js.map +1 -0
  49. package/dist/commands/image-batch/run.d.ts +122 -0
  50. package/dist/commands/image-batch/run.js +644 -0
  51. package/dist/commands/image-batch/run.js.map +1 -0
  52. package/dist/commands/image-batch/sharpen.d.ts +16 -0
  53. package/dist/commands/image-batch/sharpen.js +32 -0
  54. package/dist/commands/image-batch/sharpen.js.map +1 -0
  55. package/dist/commands/image-batch/template.d.ts +45 -0
  56. package/dist/commands/image-batch/template.js +142 -0
  57. package/dist/commands/image-batch/template.js.map +1 -0
  58. package/dist/commands/image-hash/sharp-loader.d.ts +2 -0
  59. package/dist/commands/image-hash/sharp-loader.js +7 -5
  60. package/dist/commands/image-hash/sharp-loader.js.map +1 -1
  61. package/dist/format/bytes.d.ts +2 -0
  62. package/dist/format/bytes.js +17 -0
  63. package/dist/format/bytes.js.map +1 -0
  64. package/dist/index.d.ts +5 -0
  65. package/dist/index.js +3 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/utils/closest.d.ts +2 -0
  68. package/dist/utils/closest.js +35 -0
  69. package/dist/utils/closest.js.map +1 -0
  70. package/dist/utils/glob.d.ts +4 -0
  71. package/dist/utils/glob.js +86 -0
  72. package/dist/utils/glob.js.map +1 -0
  73. package/dist/utils/tty.d.ts +60 -0
  74. package/dist/utils/tty.js +390 -0
  75. package/dist/utils/tty.js.map +1 -0
  76. package/package.json +1 -1
@@ -0,0 +1,366 @@
1
+ import { didYouMean } from '../../utils/closest.js';
2
+ import { ImageBatchUsageError } from './errors.js';
3
+ export const OUTPUT_FORMATS = ['jpg', 'png', 'webp', 'avif', 'gif', 'tiff', 'jp2', 'heif'];
4
+ export const QUALITY_LEVELS = ['low', 'medium', 'high', 'best'];
5
+ const quality = (min = 1) => ({ kind: 'quality', min, max: 100 });
6
+ const int = (min, max) => ({ kind: 'int', min, max });
7
+ const bool = { kind: 'bool' };
8
+ const choice = (...values) => ({ kind: 'enum', values });
9
+ const subsampling = choice('4:2:0', '4:4:4');
10
+ export const CODEC_SPECS = {
11
+ jpg: {
12
+ quality: quality(),
13
+ mozjpeg: bool,
14
+ progressive: bool,
15
+ chromaSubsampling: subsampling,
16
+ },
17
+ png: {
18
+ compressionLevel: int(0, 9),
19
+ palette: bool,
20
+ colors: int(2, 256),
21
+ quality: quality(0),
22
+ dither: { kind: 'number', min: 0, max: 1 },
23
+ effort: int(1, 10),
24
+ progressive: bool,
25
+ },
26
+ webp: {
27
+ quality: quality(),
28
+ lossless: bool,
29
+ nearLossless: bool,
30
+ alphaQuality: int(0, 100),
31
+ effort: int(0, 6),
32
+ smartSubsample: bool,
33
+ preset: choice('default', 'photo', 'picture', 'drawing', 'icon', 'text'),
34
+ minSize: bool,
35
+ },
36
+ avif: {
37
+ quality: quality(),
38
+ lossless: bool,
39
+ effort: int(0, 9),
40
+ chromaSubsampling: subsampling,
41
+ bitdepth: { kind: 'enum-int', values: [8, 10, 12] },
42
+ tune: choice('auto', 'iq', 'psnr', 'ssim'),
43
+ },
44
+ gif: {
45
+ colors: int(2, 256),
46
+ effort: int(1, 10),
47
+ dither: { kind: 'number', min: 0, max: 1 },
48
+ loop: int(0, 65535),
49
+ delay: int(0, 65535),
50
+ reuse: bool,
51
+ },
52
+ tiff: {
53
+ compression: choice('none', 'jpeg', 'deflate', 'packbits', 'ccittfax4', 'lzw', 'webp', 'zstd', 'jp2k'),
54
+ quality: quality(),
55
+ predictor: choice('none', 'horizontal', 'float'),
56
+ bitdepth: { kind: 'enum-int', values: [1, 2, 4, 8] },
57
+ xres: { kind: 'number', min: 0.001, max: 1000000 },
58
+ yres: { kind: 'number', min: 0.001, max: 1000000 },
59
+ },
60
+ jp2: {
61
+ quality: quality(),
62
+ lossless: bool,
63
+ chromaSubsampling: subsampling,
64
+ },
65
+ heif: {
66
+ quality: quality(),
67
+ lossless: bool,
68
+ effort: int(0, 9),
69
+ compression: choice('av1', 'hevc'),
70
+ chromaSubsampling: subsampling,
71
+ },
72
+ };
73
+ const LEVEL_NUMBERS = {
74
+ jpg: { low: 65, medium: 78, high: 85, best: 92 },
75
+ webp: { low: 60, medium: 75, high: 82, best: 90 },
76
+ avif: { low: 40, medium: 50, high: 60, best: 75 },
77
+ heif: { low: 40, medium: 50, high: 60, best: 75 },
78
+ jp2: { low: 60, medium: 75, high: 85, best: 92 },
79
+ tiff: { low: 65, medium: 78, high: 85, best: 92 },
80
+ png: { low: 40, medium: 60, high: 80, best: 95 },
81
+ };
82
+ export const BUILTIN_DEFAULTS = {
83
+ jpg: { quality: 82, mozjpeg: true, progressive: true },
84
+ png: { compressionLevel: 9 },
85
+ webp: { quality: 80, effort: 4 },
86
+ avif: { quality: 55, effort: 4 },
87
+ gif: {},
88
+ tiff: {},
89
+ jp2: {},
90
+ heif: { compression: 'av1' },
91
+ };
92
+ const FORMAT_ALIASES = {
93
+ jpg: 'jpg',
94
+ jpeg: 'jpg',
95
+ png: 'png',
96
+ webp: 'webp',
97
+ avif: 'avif',
98
+ gif: 'gif',
99
+ tif: 'tiff',
100
+ tiff: 'tiff',
101
+ jp2: 'jp2',
102
+ j2k: 'jp2',
103
+ heif: 'heif',
104
+ original: 'original',
105
+ };
106
+ export const FORMAT_EXTENSIONS = {
107
+ jpg: 'jpg',
108
+ png: 'png',
109
+ webp: 'webp',
110
+ avif: 'avif',
111
+ gif: 'gif',
112
+ tiff: 'tiff',
113
+ jp2: 'jp2',
114
+ heif: 'heif',
115
+ };
116
+ export function normalizeFormat(raw, where = 'format') {
117
+ const found = FORMAT_ALIASES[raw.trim().toLowerCase()];
118
+ if (found === undefined) {
119
+ throw new ImageBatchUsageError(`${where}: unknown format "${raw}" — use ${[...OUTPUT_FORMATS, 'original'].join(', ')}.${didYouMean(raw, Object.keys(FORMAT_ALIASES))}`);
120
+ }
121
+ return found;
122
+ }
123
+ export function isQualityLevel(value) {
124
+ return typeof value === 'string' && QUALITY_LEVELS.includes(value);
125
+ }
126
+ function formatsWithOption(option) {
127
+ return OUTPUT_FORMATS.filter((format) => option in CODEC_SPECS[format]);
128
+ }
129
+ function coerce(spec, raw, label) {
130
+ const fail = (expected) => {
131
+ throw new ImageBatchUsageError(`${label}: expected ${expected} (got ${JSON.stringify(raw)})`);
132
+ };
133
+ const asNumber = () => {
134
+ if (typeof raw === 'number')
135
+ return raw;
136
+ if (typeof raw === 'string' && raw.trim() !== '' && Number.isFinite(Number(raw))) {
137
+ return Number(raw);
138
+ }
139
+ return fail('a number');
140
+ };
141
+ switch (spec.kind) {
142
+ case 'quality': {
143
+ if (isQualityLevel(raw))
144
+ return raw;
145
+ if (typeof raw === 'string' && isQualityLevel(raw.trim()))
146
+ return raw.trim();
147
+ const n = asNumber();
148
+ if (!Number.isInteger(n) || n < (spec.min ?? 1) || n > (spec.max ?? 100)) {
149
+ return fail(`a whole number ${spec.min ?? 1}–${spec.max ?? 100} or ${QUALITY_LEVELS.join('/')}`);
150
+ }
151
+ return n;
152
+ }
153
+ case 'int': {
154
+ const n = asNumber();
155
+ if (!Number.isInteger(n) || n < spec.min || n > spec.max) {
156
+ return fail(`a whole number ${spec.min}–${spec.max}`);
157
+ }
158
+ return n;
159
+ }
160
+ case 'number': {
161
+ const n = asNumber();
162
+ if (n < spec.min || n > spec.max) {
163
+ return fail(`a number ${spec.min}–${spec.max}`);
164
+ }
165
+ return n;
166
+ }
167
+ case 'bool': {
168
+ if (typeof raw === 'boolean')
169
+ return raw;
170
+ if (raw === 'true' || raw === '1' || raw === 'yes')
171
+ return true;
172
+ if (raw === 'false' || raw === '0' || raw === 'no')
173
+ return false;
174
+ return fail('true or false');
175
+ }
176
+ case 'enum': {
177
+ const text = String(raw);
178
+ if (!spec.values.includes(text)) {
179
+ return fail(`one of ${spec.values.join(', ')}`);
180
+ }
181
+ return text;
182
+ }
183
+ case 'enum-int': {
184
+ const n = asNumber();
185
+ if (!spec.values.includes(n)) {
186
+ return fail(`one of ${spec.values.join(', ')}`);
187
+ }
188
+ return n;
189
+ }
190
+ }
191
+ return fail('a valid value');
192
+ }
193
+ export function validateCodecOptions(format, options, where) {
194
+ const specs = CODEC_SPECS[format];
195
+ const result = {};
196
+ for (const [name, raw] of Object.entries(options)) {
197
+ const spec = specs[name];
198
+ if (spec === undefined) {
199
+ const elsewhere = formatsWithOption(name);
200
+ if (elsewhere.length > 0) {
201
+ throw new ImageBatchUsageError(`${where}: "${name}" is not an option of ${format} (it works with ${elsewhere.join(', ')}). ${format} options: ${Object.keys(specs).join(', ') || 'none'}.`);
202
+ }
203
+ throw new ImageBatchUsageError(`${where}: unknown ${format} option "${name}".${didYouMean(name, Object.keys(specs))} ${format} options: ${Object.keys(specs).join(', ') || 'none'}.`);
204
+ }
205
+ result[name] = coerce(spec, raw, `${where}: ${format}.${name}`);
206
+ }
207
+ return result;
208
+ }
209
+ export function validateCodecMap(map, where) {
210
+ if (map === null || typeof map !== 'object' || Array.isArray(map)) {
211
+ throw new ImageBatchUsageError(`${where}: expected an object of format → options`);
212
+ }
213
+ const result = {};
214
+ for (const [rawFormat, options] of Object.entries(map)) {
215
+ const format = normalizeFormat(rawFormat, where);
216
+ if (format === 'original') {
217
+ throw new ImageBatchUsageError(`${where}: "original" has no options of its own`);
218
+ }
219
+ if (options === null || typeof options !== 'object' || Array.isArray(options)) {
220
+ throw new ImageBatchUsageError(`${where}: ${rawFormat} must be an object of options`);
221
+ }
222
+ result[format] = {
223
+ ...result[format],
224
+ ...validateCodecOptions(format, options, `${where}.${rawFormat}`),
225
+ };
226
+ }
227
+ return result;
228
+ }
229
+ export function validateQualityInput(input, where) {
230
+ if (typeof input === 'number' || isQualityLevel(input)) {
231
+ return coerce(CODEC_SPECS.jpg.quality, input, where);
232
+ }
233
+ if (input !== null && typeof input === 'object' && !Array.isArray(input)) {
234
+ const result = {};
235
+ for (const [rawFormat, value] of Object.entries(input)) {
236
+ const format = normalizeFormat(rawFormat, where);
237
+ if (format === 'original') {
238
+ throw new ImageBatchUsageError(`${where}: "original" has no quality of its own`);
239
+ }
240
+ const spec = CODEC_SPECS[format].quality;
241
+ if (spec === undefined) {
242
+ throw new ImageBatchUsageError(`${where}: ${format} has no quality option`);
243
+ }
244
+ result[format] = coerce(spec, value, `${where}.${rawFormat}`);
245
+ }
246
+ return result;
247
+ }
248
+ throw new ImageBatchUsageError(`${where}: expected a number 1–100, ${QUALITY_LEVELS.join('/')}, or an object of format → quality`);
249
+ }
250
+ export function parseQualityArg(text) {
251
+ const trimmed = text.trim();
252
+ if (!trimmed.includes('=')) {
253
+ return validateQualityInput(/^\d+$/.test(trimmed) ? Number(trimmed) : trimmed, '--quality');
254
+ }
255
+ const map = {};
256
+ for (const part of trimmed.split(',')) {
257
+ const [key, value] = part.split('=');
258
+ if (key === undefined || value === undefined || key.trim() === '' || value.trim() === '') {
259
+ throw new ImageBatchUsageError(`--quality: expected "format=value" pairs, e.g. jpg=82,webp=high (got "${part}")`);
260
+ }
261
+ map[key.trim()] = value.trim();
262
+ }
263
+ const converted = {};
264
+ for (const [key, value] of Object.entries(map)) {
265
+ converted[key] = /^\d+$/.test(value) ? Number(value) : value;
266
+ }
267
+ return validateQualityInput(converted, '--quality');
268
+ }
269
+ export function parseCodecArgs(args) {
270
+ const grouped = {};
271
+ for (const arg of args) {
272
+ const match = /^([a-z0-9]+)\.([A-Za-z]+)=(.*)$/.exec(arg);
273
+ if (!match) {
274
+ throw new ImageBatchUsageError(`--codec: expected "format.option=value", e.g. jpg.mozjpeg=true (got "${arg}")`);
275
+ }
276
+ const format = normalizeFormat(match[1], '--codec');
277
+ if (format === 'original') {
278
+ throw new ImageBatchUsageError(`--codec: "original" has no options of its own`);
279
+ }
280
+ grouped[format] = { ...grouped[format], [match[2]]: match[3] };
281
+ }
282
+ const result = {};
283
+ for (const format of OUTPUT_FORMATS) {
284
+ const options = grouped[format];
285
+ if (options)
286
+ result[format] = validateCodecOptions(format, options, '--codec');
287
+ }
288
+ return result;
289
+ }
290
+ function shortcutFor(input, format) {
291
+ if (typeof input === 'number' || isQualityLevel(input))
292
+ return input;
293
+ return input[format];
294
+ }
295
+ export function resolveCodecOptions(format, layers) {
296
+ const options = { ...BUILTIN_DEFAULTS[format] };
297
+ const supportsQuality = 'quality' in CODEC_SPECS[format];
298
+ for (const layer of layers) {
299
+ if (layer.quality !== undefined && supportsQuality) {
300
+ const value = shortcutFor(layer.quality, format);
301
+ if (value !== undefined)
302
+ options.quality = value;
303
+ }
304
+ const own = layer.codecs?.[format];
305
+ if (own)
306
+ Object.assign(options, own);
307
+ }
308
+ if (format === 'png' && options.palette !== true)
309
+ delete options.quality;
310
+ if (typeof options.quality === 'string') {
311
+ const table = LEVEL_NUMBERS[format];
312
+ const level = options.quality;
313
+ options.quality = table ? table[level] : (BUILTIN_DEFAULTS[format].quality ?? 80);
314
+ }
315
+ return options;
316
+ }
317
+ const SHARP_FORMAT_KEYS = {
318
+ jpg: 'jpeg',
319
+ png: 'png',
320
+ webp: 'webp',
321
+ avif: 'heif',
322
+ gif: 'gif',
323
+ tiff: 'tiff',
324
+ jp2: 'jp2k',
325
+ heif: 'heif',
326
+ };
327
+ export function unsupportedFormats(sharp, formats) {
328
+ const table = sharp.format;
329
+ if (!table)
330
+ return [];
331
+ const missing = [];
332
+ for (const format of new Set(formats)) {
333
+ if (table[SHARP_FORMAT_KEYS[format]]?.output?.buffer !== true)
334
+ missing.push(format);
335
+ }
336
+ return missing;
337
+ }
338
+ export function supportsQualityLimit(format, codec) {
339
+ if (format === 'jpg' || format === 'webp' || format === 'avif' || format === 'heif')
340
+ return true;
341
+ if (format === 'jp2')
342
+ return true;
343
+ return format === 'png' && codec.palette === true;
344
+ }
345
+ export function qualityOf(format, codec) {
346
+ const own = codec.quality;
347
+ if (typeof own === 'number')
348
+ return own;
349
+ const fallback = { heif: 50, jp2: 80, png: 100 };
350
+ return fallback[format] ?? 80;
351
+ }
352
+ export function sharpFormatName(format) {
353
+ return format === 'jpg' ? 'jpeg' : format;
354
+ }
355
+ export function toSharpOptions(options) {
356
+ const mapped = {};
357
+ for (const [name, value] of Object.entries(options)) {
358
+ mapped[name === 'colors' ? 'colours' : name] = value;
359
+ }
360
+ return mapped;
361
+ }
362
+ export function describeOptions(options) {
363
+ const parts = Object.entries(options).map(([name, value]) => `${name}=${String(value)}`);
364
+ return parts.join(' ');
365
+ }
366
+ //# sourceMappingURL=codecs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../src/commands/image-batch/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA;AAInG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AAgBxE,MAAM,OAAO,GAAG,CAAC,GAAG,GAAG,CAAC,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;AAC7E,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,GAAW,EAAc,EAAE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C,KAAK,CAAC,EAAE,CAAC,CAAA;IACxF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC"}
@@ -0,0 +1,119 @@
1
+ import { type HashType } from '../image-hash/core.js';
2
+ import { type CodecLayer, type FormatChoice } from './codecs.js';
3
+ import { type Box, type Fit } from './geometry.js';
4
+ import { type SharpenSpec } from './sharpen.js';
5
+ import { type TemplateToken } from './template.js';
6
+ export declare const CONFIG_EXTENSIONS: readonly [".json", ".js", ".mjs", ".ts"];
7
+ export declare const CONFIG_DIR_SEGMENTS: readonly [".devtoolz", "image-batch"];
8
+ export declare const METADATA_MODES: readonly ["strip", "keep", "keep-icc"];
9
+ export type MetadataMode = (typeof METADATA_MODES)[number];
10
+ export declare const POSITIONS: readonly ["centre", "center", "north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest", "top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "entropy", "attention"];
11
+ export interface RecipeLayer extends CodecLayer {
12
+ id?: string;
13
+ preset?: string;
14
+ extends?: string;
15
+ widths?: number[];
16
+ heights?: number[];
17
+ size?: Required<Box>;
18
+ longEdge?: number[];
19
+ shortEdge?: number[];
20
+ megapixels?: number[];
21
+ percent?: number[];
22
+ scale?: number[];
23
+ matchOrientation?: boolean;
24
+ maxBytes?: number;
25
+ formats?: FormatChoice[];
26
+ fit?: Fit;
27
+ position?: string;
28
+ background?: string;
29
+ withoutEnlargement?: boolean;
30
+ template?: {
31
+ text: string;
32
+ tokens: TemplateToken[];
33
+ };
34
+ autoOrient?: boolean;
35
+ metadata?: MetadataMode;
36
+ rotate?: number;
37
+ flip?: boolean;
38
+ flop?: boolean;
39
+ grayscale?: boolean;
40
+ sharpen?: Partial<SharpenSpec>;
41
+ blur?: number;
42
+ flatten?: string | true;
43
+ }
44
+ export interface MatchRule {
45
+ glob: string;
46
+ outputs: RecipeLayer[];
47
+ }
48
+ export interface PlaceholderSettings {
49
+ types: HashType[];
50
+ budget?: number;
51
+ components?: string;
52
+ }
53
+ export interface BatchConfig {
54
+ title?: string;
55
+ description?: string;
56
+ defaults: RecipeLayer;
57
+ presets: Record<string, RecipeLayer>;
58
+ outputs: RecipeLayer[];
59
+ match: MatchRule[];
60
+ placeholders?: PlaceholderSettings;
61
+ }
62
+ export interface ResolvedRecipe {
63
+ id?: string;
64
+ widths: number[];
65
+ heights: number[];
66
+ size?: Required<Box>;
67
+ longEdge: number[];
68
+ shortEdge: number[];
69
+ megapixels: number[];
70
+ percent: number[];
71
+ scales: number[];
72
+ matchOrientation: boolean;
73
+ maxBytes?: number;
74
+ explicitTemplate: boolean;
75
+ formats: FormatChoice[];
76
+ layers: CodecLayer[];
77
+ fit: Fit;
78
+ position?: string;
79
+ background?: string;
80
+ withoutEnlargement: boolean;
81
+ template: {
82
+ text: string;
83
+ tokens: TemplateToken[];
84
+ };
85
+ autoOrient: boolean;
86
+ metadata: MetadataMode;
87
+ rotate?: number;
88
+ flip: boolean;
89
+ flop: boolean;
90
+ grayscale: boolean;
91
+ sharpen?: SharpenSpec;
92
+ blur?: number;
93
+ flatten?: string | true;
94
+ }
95
+ export declare function parseByteSize(value: unknown, where: string): number;
96
+ export declare function parseRecipeLayer(raw: unknown, where: string, allowed: readonly string[]): RecipeLayer;
97
+ export declare function parseConfig(raw: unknown, where?: string): BatchConfig;
98
+ export declare function resolveRecipe(config: BatchConfig, recipe: RecipeLayer, overrides?: RecipeLayer[], where?: string): ResolvedRecipe;
99
+ export interface ConfigLocation {
100
+ name: string;
101
+ path: string;
102
+ scope: 'project' | 'global';
103
+ kind: 'json' | 'js' | 'mjs' | 'ts';
104
+ editable: boolean;
105
+ }
106
+ export interface DiscoverOptions {
107
+ cwd: string;
108
+ globalDir?: string;
109
+ }
110
+ export declare function globalConfigDir(homeDir?: string): string;
111
+ export declare function discoverConfigs(options: DiscoverOptions): ConfigLocation[];
112
+ export declare function locationForPath(path: string): ConfigLocation;
113
+ export declare function resolveConfigRef(ref: string, discovered: ConfigLocation[], cwd: string): ConfigLocation;
114
+ export declare function readConfigSource(location: ConfigLocation): Promise<unknown>;
115
+ export declare function loadConfig(location: ConfigLocation): Promise<{
116
+ raw: unknown;
117
+ config: BatchConfig;
118
+ }>;
119
+ export declare function emptyConfig(): BatchConfig;