@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,122 @@
1
+ import type { VibesOptions } from '../../format/vibes.js';
2
+ import { type TerminalIO } from '../../utils/tty.js';
3
+ import { type CodecMap, type OutputFormatName, type QualityInput } from './codecs.js';
4
+ import { type BatchConfig, type PlaceholderSettings } from './config.js';
5
+ import type { Fit } from './geometry.js';
6
+ import { type ConflictPrompt, type OverwriteMode } from './overwrite.js';
7
+ import { type Placement, type SharpFn } from './plan.js';
8
+ import type { SharpenSpec } from './sharpen.js';
9
+ export interface BatchOverrides {
10
+ widths?: number[];
11
+ heights?: number[];
12
+ formats?: string[];
13
+ quality?: QualityInput;
14
+ codecs?: CodecMap;
15
+ fit?: Fit;
16
+ name?: string;
17
+ flatten?: boolean | string;
18
+ longEdge?: number[];
19
+ shortEdge?: number[];
20
+ megapixels?: number[];
21
+ percent?: number[];
22
+ matchOrientation?: boolean;
23
+ maxBytes?: number;
24
+ sharpen?: Partial<SharpenSpec>;
25
+ }
26
+ export interface BatchProgress {
27
+ done: number;
28
+ total: number;
29
+ }
30
+ export interface ReplaceSummary {
31
+ count: number;
32
+ bytes: number;
33
+ backupDir: string | null;
34
+ }
35
+ export interface ImageBatchOptions {
36
+ paths: string[];
37
+ cwd: string;
38
+ out?: string;
39
+ beside?: boolean;
40
+ replace?: boolean;
41
+ backup?: string | false;
42
+ onlyIfSmaller?: boolean;
43
+ config?: BatchConfig;
44
+ configLabel?: string;
45
+ overrides?: BatchOverrides;
46
+ recursive?: boolean;
47
+ extensions?: string[];
48
+ ignoreGlobs?: string[];
49
+ respectGitignore?: boolean;
50
+ include?: string[];
51
+ exclude?: string[];
52
+ flat?: boolean;
53
+ list?: boolean;
54
+ select?: boolean;
55
+ overwrite?: OverwriteMode;
56
+ force?: boolean;
57
+ placeholders?: PlaceholderSettings;
58
+ emit?: string;
59
+ keyPrefix?: string;
60
+ cache?: string | false;
61
+ cacheBase?: string;
62
+ concurrency?: number;
63
+ maxPixels?: number;
64
+ dryRun?: boolean;
65
+ assumeYes?: boolean;
66
+ sharp?: SharpFn;
67
+ io?: TerminalIO;
68
+ interactive?: boolean;
69
+ prompt?: ConflictPrompt;
70
+ confirm?: (summary: ReplaceSummary) => Promise<boolean>;
71
+ now?: Date;
72
+ style?: VibesOptions;
73
+ onProgress?: (progress: BatchProgress) => void;
74
+ }
75
+ export type JobStatus = 'written' | 'up-to-date' | 'skipped' | 'conflict' | 'would-write' | 'would-overwrite' | 'replaced' | 'kept' | 'already-processed' | 'would-replace' | 'would-keep' | 'error';
76
+ export interface BatchJobResult {
77
+ source: string;
78
+ output: string;
79
+ recipe: string;
80
+ format: OutputFormatName;
81
+ width: number;
82
+ height: number;
83
+ status: JobStatus;
84
+ bytes?: number;
85
+ before?: number;
86
+ message?: string;
87
+ }
88
+ export interface BatchSourceSummary {
89
+ file: string;
90
+ width: number;
91
+ height: number;
92
+ format: string;
93
+ bytes: number;
94
+ }
95
+ export interface ImageBatchReport {
96
+ placement: Placement;
97
+ out: string;
98
+ backupDir?: string;
99
+ backupEnabled: boolean;
100
+ configLabel?: string;
101
+ dryRun: boolean;
102
+ listOnly: boolean;
103
+ sources: BatchSourceSummary[];
104
+ failures: {
105
+ file: string;
106
+ message: string;
107
+ }[];
108
+ unmatched: string[];
109
+ derived: string[];
110
+ vectors: string[];
111
+ results: BatchJobResult[];
112
+ counts: Record<JobStatus, number>;
113
+ deduped: number;
114
+ bytesIn: number;
115
+ bytesOut: number;
116
+ emitPath?: string;
117
+ aborted: boolean;
118
+ cancelled: boolean;
119
+ nothingSelected: boolean;
120
+ exitCode: number;
121
+ }
122
+ export declare function runImageBatch(options: ImageBatchOptions): Promise<ImageBatchReport>;