@mediaproc/core 1.0.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/README.md ADDED
@@ -0,0 +1,414 @@
1
+ # @mediaproc/core
2
+
3
+ > Core utilities for MediaProc CLI and Plugins
4
+
5
+ [![Version](https://img.shields.io/npm/v/@mediaproc/core.svg)](https://www.npmjs.com/package/@mediaproc/core)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/)
8
+
9
+ This package contains shared utilities used across MediaProc CLI and all plugins, ensuring consistency and reducing code duplication.
10
+
11
+ ## ๐Ÿ“ฆ Installation (Don't need install directly, this package will install automatically with cli and plugins)
12
+
13
+ ```bash
14
+ # For plugin developers
15
+ npm install @mediaproc/core
16
+
17
+ # or
18
+ pnpm add @mediaproc/core
19
+
20
+ # or
21
+ yarn add @mediaproc/core
22
+ ```
23
+
24
+ ## ๐ŸŽฏ What's Included
25
+
26
+ ### 1. Branding Utilities
27
+
28
+ Consistent CLI/plugin footers with version information and links.
29
+
30
+ ```typescript
31
+ import { showBranding, showPluginBranding } from "@mediaproc/core";
32
+
33
+ // Show CLI branding
34
+ showBranding();
35
+ // Output:
36
+ // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
37
+ // ๐Ÿ’™ Powered by MediaProc CLI v0.6.0
38
+ // ๐Ÿ“š Documentation: https://docs-mediaproc.vercel.app/
39
+ // โญ Star us: https://github.com/0xshariq/mediaproc-cli
40
+ // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
41
+
42
+ // Show plugin branding (automatically detects version)
43
+ showPluginBranding("Image");
44
+ // Output:
45
+ // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
46
+ // ๐Ÿ’Ž Image Plugin v1.3.3 ยท Powered by MediaProc
47
+ // ๐Ÿ“š Documentation: https://docs-mediaproc.vercel.app/
48
+ // โญ Star us: https://github.com/0xshariq/mediaproc-cli
49
+ // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
50
+ ```
51
+
52
+ ### 2. Help Formatter
53
+
54
+ Standardized, beautiful help displays for commands.
55
+
56
+ ```typescript
57
+ import { displayCommandHelp } from "@mediaproc/core";
58
+
59
+ displayCommandHelp({
60
+ commandName: "resize",
61
+ description:
62
+ "Resize images to specified dimensions while maintaining aspect ratio",
63
+ usage: [
64
+ "resize <input> [options]",
65
+ "resize <input> -w 1920 -h 1080",
66
+ "resize folder/*.jpg -w 800",
67
+ ],
68
+ options: [
69
+ { flag: "-w, --width <number>", description: "Target width in pixels" },
70
+ { flag: "-h, --height <number>", description: "Target height in pixels" },
71
+ {
72
+ flag: "-f, --fit <mode>",
73
+ description: "Fit mode: cover, contain, fill, inside, outside",
74
+ },
75
+ ],
76
+ examples: [
77
+ {
78
+ command: "resize photo.jpg -w 1920",
79
+ description: "Resize to 1920px wide, auto height",
80
+ },
81
+ {
82
+ command: "resize img.png -w 800 -h 600 --fit cover",
83
+ description: "Resize and crop to exact size",
84
+ },
85
+ ],
86
+ notes: [
87
+ "Maintains aspect ratio by default",
88
+ "Supports all major image formats (JPEG, PNG, WebP, AVIF, TIFF)",
89
+ "Use --fit option to control resize behavior",
90
+ ],
91
+ tips: [
92
+ "Use -w only to maintain aspect ratio",
93
+ "Combine with --quality for web optimization",
94
+ ],
95
+ });
96
+ ```
97
+
98
+ ### 3. Path Validator
99
+
100
+ Robust file and directory path validation and resolution.
101
+
102
+ ```typescript
103
+ import {
104
+ validateAndResolvePath,
105
+ validateInputPath,
106
+ validateOutputPath,
107
+ ensureOutputDirectory,
108
+ isDirectory,
109
+ isSupportedImageFormat,
110
+ } from "@mediaproc/core";
111
+
112
+ // Validate and resolve input path
113
+ const inputPath = validateAndResolvePath("./images/photo.jpg", "input");
114
+ // Returns: '/absolute/path/to/images/photo.jpg'
115
+ // Throws error if file doesn't exist
116
+
117
+ // Validate output path (creates directories if needed)
118
+ const outputPath = validateOutputPath("./output/resized.jpg");
119
+
120
+ // Check if path is a directory
121
+ if (isDirectory("./images")) {
122
+ console.log("It's a directory!");
123
+ }
124
+
125
+ // Validate image format
126
+ if (isSupportedImageFormat("photo.jpg")) {
127
+ console.log("Supported format!");
128
+ }
129
+ ```
130
+
131
+ ### 4. Explain Formatter
132
+
133
+ Detailed operation explanations when `--explain` flag is used.
134
+
135
+ ```typescript
136
+ import { explainOperation } from "@mediaproc/core";
137
+
138
+ // Show detailed explanation of what will happen
139
+ if (options.explain) {
140
+ explainOperation({
141
+ operation: "resize",
142
+ parameters: {
143
+ width: 1920,
144
+ height: 1080,
145
+ fit: "cover",
146
+ },
147
+ inputFiles: ["photo1.jpg", "photo2.jpg"],
148
+ outputPath: "./output",
149
+ details: [
150
+ "Images will be resized to exactly 1920x1080 pixels",
151
+ "Aspect ratio will be maintained by cropping (fit: cover)",
152
+ "Original files will not be modified",
153
+ "Output files will be saved to ./output directory",
154
+ ],
155
+ });
156
+ return; // Exit before actual processing
157
+ }
158
+ ```
159
+
160
+ ### 5. Supported Extensions
161
+
162
+ Registry of supported file extensions for various media types.
163
+
164
+ ```typescript
165
+ import {
166
+ SUPPORTED_IMAGE_FORMATS,
167
+ SUPPORTED_VIDEO_FORMATS,
168
+ SUPPORTED_AUDIO_FORMATS,
169
+ isSupportedImageFormat,
170
+ isSupportedVideoFormat,
171
+ } from "@mediaproc/core";
172
+
173
+ console.log(SUPPORTED_IMAGE_FORMATS);
174
+ // ['jpg', 'jpeg', 'png', 'webp', 'avif', 'tiff', 'gif', 'svg']
175
+
176
+ console.log(SUPPORTED_VIDEO_FORMATS);
177
+ // ['mp4', 'webm', 'avi', 'mkv', 'mov']
178
+
179
+ console.log(SUPPORTED_AUDIO_FORMATS);
180
+ // ['mp3', 'aac', 'wav', 'flac', 'ogg', 'opus']
181
+ ```
182
+
183
+ ## ๐Ÿ“š API Reference
184
+
185
+ ### Branding
186
+
187
+ #### `showBranding(): void`
188
+
189
+ Displays CLI branding footer with version, documentation, and GitHub links.
190
+
191
+ #### `showPluginBranding(pluginName: string, pluginPath?: string): void`
192
+
193
+ Displays plugin-specific branding with plugin version and MediaProc attribution.
194
+
195
+ - `pluginName` - Display name of the plugin (e.g., 'Image', 'Video', 'Audio')
196
+ - `pluginPath` - Optional custom path to plugin's package.json (auto-detected if omitted)
197
+
198
+ ### Help Formatter
199
+
200
+ #### `displayCommandHelp(config: CommandHelpConfig): void`
201
+
202
+ Displays formatted help information for a command.
203
+
204
+ **CommandHelpConfig:**
205
+
206
+ ```typescript
207
+ interface CommandHelpConfig {
208
+ commandName: string; // Command name
209
+ description: string; // Short description
210
+ usage: string | string[]; // Usage examples
211
+ options: HelpOption[]; // Command options
212
+ examples: HelpExample[]; // Usage examples
213
+ sections?: HelpSection[]; // Additional custom sections
214
+ notes?: string[]; // Important notes
215
+ tips?: string[]; // Pro tips
216
+ warnings?: string[]; // Warnings
217
+ seeAlso?: string[]; // Related commands
218
+ }
219
+ ```
220
+
221
+ ### Path Validator
222
+
223
+ #### `validateAndResolvePath(path: string, type: 'input' | 'output'): string`
224
+
225
+ Validates and resolves a file path to absolute path.
226
+
227
+ - Throws error if input file doesn't exist
228
+ - Creates parent directories for output paths
229
+ - Returns absolute path
230
+
231
+ #### `validateInputPath(path: string): string`
232
+
233
+ Validates that input path exists and is accessible.
234
+
235
+ #### `validateOutputPath(path: string): string`
236
+
237
+ Validates output path and creates parent directories if needed.
238
+
239
+ #### `ensureOutputDirectory(dirPath: string): void`
240
+
241
+ Creates directory and all parent directories if they don't exist.
242
+
243
+ #### `isDirectory(path: string): boolean`
244
+
245
+ Checks if path is a directory.
246
+
247
+ #### `isSupportedImageFormat(filePath: string): boolean`
248
+
249
+ Checks if file has supported image extension.
250
+
251
+ ### Explain Formatter
252
+
253
+ #### `explainOperation(config: ExplainConfig): void`
254
+
255
+ Displays detailed explanation of what an operation will do.
256
+
257
+ **ExplainConfig:**
258
+
259
+ ```typescript
260
+ interface ExplainConfig {
261
+ operation: string; // Operation name
262
+ parameters: Record<string, any>; // Operation parameters
263
+ inputFiles: string[]; // Input files
264
+ outputPath?: string; // Output path
265
+ details: string[]; // Detailed explanation steps
266
+ }
267
+ ```
268
+
269
+ ### Supported Extensions
270
+
271
+ #### Constants
272
+
273
+ - `SUPPORTED_IMAGE_FORMATS: string[]` - Array of supported image extensions
274
+ - `SUPPORTED_VIDEO_FORMATS: string[]` - Array of supported video extensions
275
+ - `SUPPORTED_AUDIO_FORMATS: string[]` - Array of supported audio extensions
276
+
277
+ #### Functions
278
+
279
+ - `isSupportedImageFormat(filePath: string): boolean`
280
+ - `isSupportedVideoFormat(filePath: string): boolean`
281
+ - `isSupportedAudioFormat(filePath: string): boolean`
282
+
283
+ ## ๐Ÿ”ง Usage in Plugins
284
+
285
+ ### Example: Image Plugin Command
286
+
287
+ ```typescript
288
+ import { Command } from "commander";
289
+ import {
290
+ showPluginBranding,
291
+ displayCommandHelp,
292
+ validateAndResolvePath,
293
+ explainOperation,
294
+ } from "@mediaproc/core";
295
+
296
+ export function resizeCommand(imageCmd: Command): void {
297
+ imageCmd
298
+ .command("resize")
299
+ .description("Resize images to specified dimensions")
300
+ .argument("<input>", "Input image file")
301
+ .option("-w, --width <number>", "Target width")
302
+ .option("-h, --height <number>", "Target height")
303
+ .option("--explain", "Show what will happen without processing")
304
+ .action(async (input: string, options) => {
305
+ // Show help if requested
306
+ if (options.help) {
307
+ displayCommandHelp({
308
+ commandName: "resize",
309
+ description: "Resize images to specified dimensions",
310
+ usage: ["resize <input> -w <width> -h <height>"],
311
+ options: [
312
+ { flag: "-w, --width <number>", description: "Target width" },
313
+ { flag: "-h, --height <number>", description: "Target height" },
314
+ ],
315
+ examples: [
316
+ {
317
+ command: "resize photo.jpg -w 1920",
318
+ description: "Resize to 1920px wide",
319
+ },
320
+ ],
321
+ });
322
+ return;
323
+ }
324
+
325
+ // Validate input path
326
+ const inputPath = validateAndResolvePath(input, "input");
327
+
328
+ // Show explanation if requested
329
+ if (options.explain) {
330
+ explainOperation({
331
+ operation: "resize",
332
+ parameters: { width: options.width, height: options.height },
333
+ inputFiles: [inputPath],
334
+ details: [
335
+ `Image will be resized to ${options.width}x${options.height}`,
336
+ "Aspect ratio will be maintained",
337
+ "Output will be saved with same format",
338
+ ],
339
+ });
340
+ return;
341
+ }
342
+
343
+ // Actual processing logic here
344
+ console.log("โœ“ Image resized successfully");
345
+
346
+ // Show branding footer
347
+ showPluginBranding("Image");
348
+ });
349
+ }
350
+ ```
351
+
352
+ ## ๐Ÿ—๏ธ Architecture
353
+
354
+ The core package is designed to be:
355
+
356
+ - **Lightweight** - Only essential utilities, no heavy dependencies
357
+ - **Type-safe** - Full TypeScript support with exported types
358
+ - **Tree-shakeable** - ES modules with granular exports
359
+ - **Zero-config** - Works out of the box with sensible defaults
360
+ - **Extensible** - Easy to add new utilities as needed
361
+
362
+ ## ๐Ÿ“ฆ Package Structure
363
+
364
+ ```
365
+ @mediaproc/core/
366
+ โ”œโ”€โ”€ dist/ # Compiled JavaScript + TypeScript definitions
367
+ โ”‚ โ”œโ”€โ”€ index.js # Main entry point
368
+ โ”‚ โ”œโ”€โ”€ index.d.ts # Type definitions
369
+ โ”‚ โ”œโ”€โ”€ branding.js
370
+ โ”‚ โ”œโ”€โ”€ branding.d.ts
371
+ โ”‚ โ”œโ”€โ”€ helpFormatter.js
372
+ โ”‚ โ”œโ”€โ”€ helpFormatter.d.ts
373
+ โ”‚ โ”œโ”€โ”€ pathValidator.js
374
+ โ”‚ โ”œโ”€โ”€ pathValidator.d.ts
375
+ โ”‚ โ”œโ”€โ”€ explainFormatter.js
376
+ โ”‚ โ”œโ”€โ”€ explainFormatter.d.ts
377
+ โ”‚ โ”œโ”€โ”€ supportedExtensions.js
378
+ โ”‚ โ””โ”€โ”€ supportedExtensions.d.ts
379
+ โ”œโ”€โ”€ src/ # TypeScript source files
380
+ โ”‚ โ”œโ”€โ”€ index.ts
381
+ โ”‚ โ”œโ”€โ”€ branding.ts
382
+ โ”‚ โ”œโ”€โ”€ helpFormatter.ts
383
+ โ”‚ โ”œโ”€โ”€ pathValidator.ts
384
+ โ”‚ โ”œโ”€โ”€ explainFormatter.ts
385
+ โ”‚ โ””โ”€โ”€ supportedExtensions.ts
386
+ โ”œโ”€โ”€ package.json
387
+ โ”œโ”€โ”€ tsconfig.json
388
+ โ””โ”€โ”€ README.md
389
+ ```
390
+
391
+ ## ๐Ÿ”— Related Packages
392
+
393
+ - [@mediaproc/cli](https://www.npmjs.com/package/@mediaproc/cli) - Main CLI tool
394
+ - [@mediaproc/image](https://www.npmjs.com/package/@mediaproc/image) - Image processing plugin
395
+ - [@mediaproc/video](https://www.npmjs.com/package/@mediaproc/video) - Video processing plugin
396
+ - [@mediaproc/audio](https://www.npmjs.com/package/@mediaproc/audio) - Audio processing plugin
397
+
398
+ ## ๐Ÿ“ License
399
+
400
+ MIT ยฉ [0xshariq](https://github.com/0xshariq)
401
+
402
+ ## ๐Ÿ”— Links
403
+
404
+ - **Documentation:** [https://docs-mediaproc.vercel.app](https://docs-mediaproc.vercel.app)
405
+ - **GitHub:** [https://github.com/0xshariq/mediaproc-cli](https://github.com/0xshariq/mediaproc-cli)
406
+ - **Issues:** [https://github.com/0xshariq/mediaproc-cli/issues](https://github.com/0xshariq/mediaproc-cli/issues)
407
+
408
+ ---
409
+
410
+ <div align="center">
411
+
412
+ **Built with โค๏ธ for the MediaProc ecosystem**
413
+
414
+ </div>
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Show CLI branding footer with documentation and GitHub links
3
+ */
4
+ export declare function showBranding(): void;
5
+ /**
6
+ * Show plugin branding footer with version
7
+ * @param pluginName - Name of the plugin (e.g., 'image', 'video', 'audio')
8
+ * @param pluginPath - Path to plugin's package.json
9
+ */
10
+ export declare function showPluginBranding(pluginName: string, pluginPath: string): void;
11
+ //# sourceMappingURL=branding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../src/branding.ts"],"names":[],"mappings":"AAmCA;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAOnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAO/E"}
@@ -0,0 +1,59 @@
1
+ import { readFileSync } from 'fs';
2
+ import { join, dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ /**
5
+ * Get version from package.json
6
+ */
7
+ function getVersion(packagePath) {
8
+ try {
9
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
10
+ return packageJson.version || '0.0.0';
11
+ }
12
+ catch {
13
+ return '0.0.0';
14
+ }
15
+ }
16
+ /**
17
+ * Get CLI version from root package.json
18
+ */
19
+ function getCliVersion() {
20
+ try {
21
+ // For ES modules, use import.meta.url
22
+ if (typeof import.meta.url !== 'undefined') {
23
+ const currentDir = dirname(fileURLToPath(import.meta.url));
24
+ const packagePath = join(currentDir, '../../package.json');
25
+ return getVersion(packagePath);
26
+ }
27
+ // Fallback: try from process.cwd()
28
+ const packagePath = join(process.cwd(), 'package.json');
29
+ return getVersion(packagePath);
30
+ }
31
+ catch {
32
+ return '0.6.0'; // Fallback version
33
+ }
34
+ }
35
+ /**
36
+ * Show CLI branding footer with documentation and GitHub links
37
+ */
38
+ export function showBranding() {
39
+ const version = getCliVersion();
40
+ console.log('\n' + 'โ”€'.repeat(60));
41
+ console.log(` ๐Ÿ’™ Powered by MediaProc CLI v${version}`);
42
+ console.log(' ๐Ÿ“š Documentation: \x1b[36mhttps://docs-mediaproc.vercel.app/\x1b[0m');
43
+ console.log(' โญ Star us: \x1b[36mhttps://github.com/0xshariq/mediaproc-cli\x1b[0m');
44
+ console.log('โ”€'.repeat(60) + '\n');
45
+ }
46
+ /**
47
+ * Show plugin branding footer with version
48
+ * @param pluginName - Name of the plugin (e.g., 'image', 'video', 'audio')
49
+ * @param pluginPath - Path to plugin's package.json
50
+ */
51
+ export function showPluginBranding(pluginName, pluginPath) {
52
+ const version = getVersion(pluginPath);
53
+ console.log('\n' + 'โ”€'.repeat(60));
54
+ console.log(` ๐Ÿ’™ ${pluginName.charAt(0).toUpperCase() + pluginName.slice(1)} Plugin v${version} ยท Powered by MediaProc`);
55
+ console.log(' ๐Ÿ“š Documentation: \x1b[36mhttps://docs-mediaproc.vercel.app/\x1b[0m');
56
+ console.log(' โญ Star us: \x1b[36mhttps://github.com/0xshariq/mediaproc-cli\x1b[0m');
57
+ console.log('โ”€'.repeat(60) + '\n');
58
+ }
59
+ //# sourceMappingURL=branding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branding.js","sourceRoot":"","sources":["../src/branding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,SAAS,UAAU,CAAC,WAAmB;IACrC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QACnE,OAAO,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,aAAa;IACpB,IAAI,CAAC;QACH,sCAAsC;QACtC,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;YAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;YAC3D,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;QACjC,CAAC;QACD,mCAAmC;QACnC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,CAAC,mBAAmB;IACrC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,UAAkB;IACvE,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,QAAQ,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,OAAO,yBAAyB,CAAC,CAAC;IAC1H,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=explainFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explainFormatter.d.ts","sourceRoot":"","sources":["../src/explainFormatter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import chalk from "chalk";
2
+ console.log(chalk.gray('Explain Flag Formatter Coming Soon...'));
3
+ console.log(chalk.gray('This utility will format and display explanations for image command operations in a detailed manner.'));
4
+ //# sourceMappingURL=explainFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explainFormatter.js","sourceRoot":"","sources":["../src/explainFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC,CAAC;AACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,sGAAsG,CAAC,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Standardized Help Formatter for MediaProc Image CLI
3
+ * Creates consistent, beautiful help displays for all image commands
4
+ */
5
+ /**
6
+ * Interface for command help options
7
+ */
8
+ export interface HelpOption {
9
+ flag: string;
10
+ description: string;
11
+ }
12
+ /**
13
+ * Interface for command help examples
14
+ */
15
+ export interface HelpExample {
16
+ command: string;
17
+ description: string;
18
+ }
19
+ /**
20
+ * Interface for help section
21
+ */
22
+ export interface HelpSection {
23
+ title: string;
24
+ items: string[];
25
+ }
26
+ /**
27
+ * Interface for command help configuration
28
+ */
29
+ export interface CommandHelpConfig {
30
+ commandName: string;
31
+ emoji: string;
32
+ description: string;
33
+ usage: string[];
34
+ options: HelpOption[];
35
+ examples: HelpExample[];
36
+ additionalSections?: HelpSection[];
37
+ tips?: string[];
38
+ }
39
+ /**
40
+ * Create standardized help display for commands
41
+ */
42
+ export declare function createStandardHelp(config: CommandHelpConfig): void;
43
+ /**
44
+ * Quick help display for commands with minimal options
45
+ */
46
+ export declare function createQuickHelp(commandName: string, emoji: string, description: string, usage: string, options: string[]): void;
47
+ /**
48
+ * Create error help display
49
+ */
50
+ export declare function createErrorHelp(commandName: string, error: string, suggestion?: string): void;
51
+ /**
52
+ * Create success message display
53
+ */
54
+ export declare function createSuccessMessage(message: string, details?: string[]): void;
55
+ /**
56
+ * Create info message display
57
+ */
58
+ export declare function createInfoMessage(title: string, items: string[]): void;
59
+ /**
60
+ * Create warning message display
61
+ */
62
+ export declare function createWarningMessage(message: string, details?: string[]): void;
63
+ //# sourceMappingURL=helpFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpFormatter.d.ts","sourceRoot":"","sources":["../src/helpFormatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAsCD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAiFlE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CAgBN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAa7F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAW9E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAMtE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAW9E"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Standardized Help Formatter for MediaProc Image CLI
3
+ * Creates consistent, beautiful help displays for all image commands
4
+ */
5
+ import chalk from 'chalk';
6
+ /**
7
+ * Create a gradient-like effect using chalk
8
+ */
9
+ function createGradientText(text, startColor) {
10
+ // Simple gradient simulation using chalk colors
11
+ return chalk.hex(startColor)(text);
12
+ }
13
+ /**
14
+ * Create a box around content
15
+ */
16
+ function createBox(content, borderColor = 'cyan') {
17
+ const lines = content.split('\n');
18
+ const maxLength = Math.max(...lines.map(line => stripAnsi(line).length));
19
+ const width = Math.min(maxLength + 4, 100);
20
+ const colorFn = chalk[borderColor];
21
+ const topBorder = colorFn('โ•ญ' + 'โ”€'.repeat(width - 2) + 'โ•ฎ');
22
+ const bottomBorder = colorFn('โ•ฐ' + 'โ”€'.repeat(width - 2) + 'โ•ฏ');
23
+ const boxedLines = lines.map(line => {
24
+ const stripped = stripAnsi(line);
25
+ const padding = ' '.repeat(Math.max(0, width - stripped.length - 4));
26
+ return colorFn('โ”‚ ') + line + padding + colorFn(' โ”‚');
27
+ });
28
+ return '\n' + topBorder + '\n' + boxedLines.join('\n') + '\n' + bottomBorder + '\n';
29
+ }
30
+ /**
31
+ * Strip ANSI codes from string for length calculation
32
+ */
33
+ function stripAnsi(str) {
34
+ return str.replace(/\x1b\[[0-9;]*m/g, '');
35
+ }
36
+ /**
37
+ * Create standardized help display for commands
38
+ */
39
+ export function createStandardHelp(config) {
40
+ let helpContent = '';
41
+ // Header
42
+ helpContent += createGradientText(`${config.emoji} MediaProc Image - ${config.commandName} Command`, '#4facfe') + '\n\n';
43
+ // Description
44
+ helpContent += chalk.white(config.description) + '\n\n';
45
+ // Usage
46
+ helpContent += chalk.cyan.bold('Usage:') + '\n';
47
+ config.usage.forEach(usage => {
48
+ helpContent += chalk.white(` ${chalk.magenta('mediaproc')} ${chalk.cyan('image')} ${usage}`) + '\n';
49
+ });
50
+ helpContent += '\n';
51
+ // Options
52
+ helpContent += chalk.cyan.bold('Options:') + '\n';
53
+ // Check if help flag already exists
54
+ const hasHelpFlag = config.options && config.options.some(option => option.flag.includes('-h') || option.flag.includes('--help'));
55
+ // Add custom options first
56
+ if (config.options && config.options.length > 0) {
57
+ config.options.forEach(option => {
58
+ const flagPart = chalk.yellow(option.flag.padEnd(30));
59
+ const descPart = chalk.gray(option.description);
60
+ helpContent += ` ${flagPart} ${descPart}\n`;
61
+ });
62
+ }
63
+ // Add the global help flag only if it doesn't already exist
64
+ if (!hasHelpFlag) {
65
+ helpContent += ` ${chalk.yellow('-h, --help'.padEnd(30))} ${chalk.gray('Show this help message')}\n`;
66
+ }
67
+ helpContent += '\n';
68
+ // Examples
69
+ if (config.examples && config.examples.length > 0) {
70
+ helpContent += chalk.cyan.bold('Examples:') + '\n';
71
+ config.examples.forEach(example => {
72
+ // Check if command already starts with 'mediaproc image', if not add it
73
+ const command = example.command.startsWith('mediaproc image ')
74
+ ? example.command
75
+ : `mediaproc image ${example.command}`;
76
+ const formattedCommand = command
77
+ .replace(/^mediaproc /, `${chalk.magenta('mediaproc')} `)
78
+ .replace(/image /, `${chalk.cyan('image')} `);
79
+ helpContent += chalk.white(` ${formattedCommand}`) + '\n';
80
+ helpContent += chalk.dim(` โ†’ ${example.description}`) + '\n\n';
81
+ });
82
+ }
83
+ // Additional sections
84
+ if (config.additionalSections && config.additionalSections.length > 0) {
85
+ config.additionalSections.forEach(section => {
86
+ helpContent += chalk.hex('#00d2d3').bold(`๐Ÿ’ก ${section.title}:`) + '\n';
87
+ section.items.forEach(item => {
88
+ helpContent += chalk.hex('#95afc0')(` โ€ข ${item}`) + '\n';
89
+ });
90
+ helpContent += '\n';
91
+ });
92
+ }
93
+ // Tips
94
+ if (config.tips && config.tips.length > 0) {
95
+ config.tips.forEach(tip => {
96
+ helpContent += chalk.yellow(`๐Ÿ’ก Tip: ${tip}`) + '\n';
97
+ });
98
+ helpContent += '\n';
99
+ }
100
+ // Footer
101
+ helpContent += chalk.dim(`โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”`) + '\n';
102
+ helpContent += chalk.hex('#636e72')(`๐Ÿ–ผ๏ธ MediaProc Image Plugin โ€ข Powered by Sharp โ€ข High Performance`);
103
+ console.log(createBox(helpContent, 'cyan'));
104
+ }
105
+ /**
106
+ * Quick help display for commands with minimal options
107
+ */
108
+ export function createQuickHelp(commandName, emoji, description, usage, options) {
109
+ let helpContent = '';
110
+ helpContent += createGradientText(`${emoji} ${commandName.toUpperCase()} COMMAND`, '#4facfe') + '\n\n';
111
+ helpContent += chalk.white(description) + '\n\n';
112
+ helpContent += chalk.cyan.bold('Usage:') + '\n';
113
+ helpContent += chalk.white(` ${chalk.magenta('mediaproc')} ${chalk.cyan('image')} ${usage}`) + '\n\n';
114
+ if (options.length > 0) {
115
+ helpContent += chalk.cyan.bold('Options:') + '\n';
116
+ options.forEach(option => {
117
+ helpContent += chalk.gray(` ${option}`) + '\n';
118
+ });
119
+ }
120
+ console.log(createBox(helpContent, 'cyan'));
121
+ }
122
+ /**
123
+ * Create error help display
124
+ */
125
+ export function createErrorHelp(commandName, error, suggestion) {
126
+ let helpContent = '';
127
+ helpContent += chalk.red.bold(`โŒ ${commandName.toUpperCase()} ERROR`) + '\n\n';
128
+ helpContent += chalk.white(error) + '\n';
129
+ if (suggestion) {
130
+ helpContent += '\n' + chalk.yellow(`๐Ÿ’ก Suggestion: ${suggestion}`) + '\n';
131
+ }
132
+ helpContent += '\n' + chalk.gray(`Run: `) + chalk.cyan(`mediaproc image ${commandName} --help`) + chalk.gray(` for more information`);
133
+ console.log(createBox(helpContent, 'red'));
134
+ }
135
+ /**
136
+ * Create success message display
137
+ */
138
+ export function createSuccessMessage(message, details) {
139
+ let content = chalk.green.bold('โœ“ ' + message) + '\n';
140
+ if (details && details.length > 0) {
141
+ content += '\n';
142
+ details.forEach(detail => {
143
+ content += chalk.dim(` ${detail}`) + '\n';
144
+ });
145
+ }
146
+ console.log(content);
147
+ }
148
+ /**
149
+ * Create info message display
150
+ */
151
+ export function createInfoMessage(title, items) {
152
+ let content = chalk.blue.bold('โ„น ' + title) + '\n';
153
+ items.forEach(item => {
154
+ content += chalk.gray(` โ€ข ${item}`) + '\n';
155
+ });
156
+ console.log(content);
157
+ }
158
+ /**
159
+ * Create warning message display
160
+ */
161
+ export function createWarningMessage(message, details) {
162
+ let content = chalk.yellow.bold('โš  ' + message) + '\n';
163
+ if (details && details.length > 0) {
164
+ content += '\n';
165
+ details.forEach(detail => {
166
+ content += chalk.dim(` ${detail}`) + '\n';
167
+ });
168
+ }
169
+ console.log(content);
170
+ }
171
+ //# sourceMappingURL=helpFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpFormatter.js","sourceRoot":"","sources":["../src/helpFormatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAwC1B;;GAEG;AACH,SAAS,kBAAkB,CAAC,IAAY,EAAE,UAAkB;IAC1D,gDAAgD;IAChD,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,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AG,IAAI,CAAC;IACnD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,OAAkB;IACtE,IAAI,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC;IAEvD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,IAAI,CAAC;QAChB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @mediaproc/core - Core utilities for MediaProc CLI and Plugins
3
+ *
4
+ * This package contains shared utilities used across MediaProc CLI and all plugins:
5
+ * - Branding utilities for consistent CLI/plugin footers
6
+ * - Help formatters for standardized command help displays
7
+ * - Path validators for robust file/directory handling
8
+ * - Explain formatters for detailed operation explanations
9
+ * - Supported extensions registry
10
+ */
11
+ export * from './branding.js';
12
+ export * from './helpFormatter.js';
13
+ export * from './pathValidator.js';
14
+ export * from './explainFormatter.js';
15
+ export * from './supportedExtensions.js';
16
+ export type { HelpOption, HelpExample, HelpSection, CommandHelpConfig } from './helpFormatter.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAGzC,YAAY,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EAClB,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @mediaproc/core - Core utilities for MediaProc CLI and Plugins
3
+ *
4
+ * This package contains shared utilities used across MediaProc CLI and all plugins:
5
+ * - Branding utilities for consistent CLI/plugin footers
6
+ * - Help formatters for standardized command help displays
7
+ * - Path validators for robust file/directory handling
8
+ * - Explain formatters for detailed operation explanations
9
+ * - Supported extensions registry
10
+ */
11
+ // Export all utilities
12
+ export * from './branding.js';
13
+ export * from './helpFormatter.js';
14
+ export * from './pathValidator.js';
15
+ export * from './explainFormatter.js';
16
+ export * from './supportedExtensions.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uBAAuB;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Parse input path and return array of files
3
+ * Supports:
4
+ * - Single file: "image.jpg"
5
+ * - Multiple files with commas: "image1.jpg,image2.jpg,image3.jpg"
6
+ * - Directory: "input-images/" (finds all matching files)
7
+ */
8
+ export declare function parseInputPaths(inputPath: string, allowedExtensions?: string[]): string[];
9
+ /**
10
+ * Resolve output paths for input files
11
+ *
12
+ * Logic:
13
+ * 1. Single file + output has extension (e.g., output.jpg) = Use exact file path
14
+ * 2. Multiple files + output has extension = Invalid (error)
15
+ * 3. No output provided = Use current directory
16
+ * 4. Output directory provided = Use that directory
17
+ *
18
+ * @param inputFiles - Array of input file paths
19
+ * @param outputPath - Output path (file or directory, or undefined for current dir)
20
+ * @param suffix - Suffix to add to filenames (default: empty)
21
+ * @param newExtension - New extension for output files (default: same as input)
22
+ */
23
+ export declare function resolveOutputPaths(inputFiles: string[], outputPath: string | undefined, options?: {
24
+ suffix?: string;
25
+ newExtension?: string;
26
+ }): Map<string, string>;
27
+ /**
28
+ * Validate input and output paths
29
+ * Returns validated input files, output directory, and any errors
30
+ */
31
+ export declare function validatePaths(inputPath: string, outputPath: string | undefined, options?: {
32
+ allowedExtensions?: string[];
33
+ suffix?: string;
34
+ newExtension?: string;
35
+ }): {
36
+ inputFiles: string[];
37
+ outputPath: string | undefined;
38
+ errors: string[];
39
+ };
40
+ /**
41
+ * Get file name from path
42
+ */
43
+ export declare function getFileName(filePath: string): string;
44
+ //# sourceMappingURL=pathValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathValidator.d.ts","sourceRoot":"","sources":["../src/pathValidator.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,iBAAiB,GAAE,MAAM,EAA6D,GACrF,MAAM,EAAE,CA8BV;AAkCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAAE,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CAClB,GACL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA6DrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,GAAE;IACP,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CAClB,GACL;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA2BA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,166 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { AUDIO_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS } from './supportedExtensions';
4
+ /**
5
+ * Parse input path and return array of files
6
+ * Supports:
7
+ * - Single file: "image.jpg"
8
+ * - Multiple files with commas: "image1.jpg,image2.jpg,image3.jpg"
9
+ * - Directory: "input-images/" (finds all matching files)
10
+ */
11
+ export function parseInputPaths(inputPath, allowedExtensions = IMAGE_EXTENSIONS || VIDEO_EXTENSIONS || AUDIO_EXTENSIONS) {
12
+ const files = [];
13
+ // Split by comma for multiple files
14
+ const paths = inputPath.split(',').map(p => p.trim());
15
+ for (const p of paths) {
16
+ const resolvedPath = path.resolve(p);
17
+ // Check if path exists
18
+ if (!fs.existsSync(resolvedPath)) {
19
+ continue; // Skip non-existent paths
20
+ }
21
+ const stats = fs.statSync(resolvedPath);
22
+ if (stats.isFile()) {
23
+ // Check if file has allowed extension
24
+ const ext = path.extname(resolvedPath).toLowerCase();
25
+ if (allowedExtensions.includes(ext)) {
26
+ files.push(resolvedPath);
27
+ }
28
+ }
29
+ else if (stats.isDirectory()) {
30
+ // Recursively find all files in directory
31
+ const dirFiles = findFilesInDirectory(resolvedPath, allowedExtensions);
32
+ files.push(...dirFiles);
33
+ }
34
+ }
35
+ return files;
36
+ }
37
+ /**
38
+ * Recursively find all files with allowed extensions in a directory
39
+ */
40
+ function findFilesInDirectory(dir, allowedExtensions) {
41
+ const files = [];
42
+ try {
43
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
44
+ for (const entry of entries) {
45
+ const fullPath = path.join(dir, entry.name);
46
+ if (entry.isDirectory()) {
47
+ // Recursively search subdirectories
48
+ files.push(...findFilesInDirectory(fullPath, allowedExtensions));
49
+ }
50
+ else if (entry.isFile()) {
51
+ const ext = path.extname(fullPath).toLowerCase();
52
+ if (allowedExtensions.includes(ext)) {
53
+ files.push(fullPath);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ catch (error) {
59
+ // Ignore directories that can't be read
60
+ }
61
+ return files;
62
+ }
63
+ /**
64
+ * Resolve output paths for input files
65
+ *
66
+ * Logic:
67
+ * 1. Single file + output has extension (e.g., output.jpg) = Use exact file path
68
+ * 2. Multiple files + output has extension = Invalid (error)
69
+ * 3. No output provided = Use current directory
70
+ * 4. Output directory provided = Use that directory
71
+ *
72
+ * @param inputFiles - Array of input file paths
73
+ * @param outputPath - Output path (file or directory, or undefined for current dir)
74
+ * @param suffix - Suffix to add to filenames (default: empty)
75
+ * @param newExtension - New extension for output files (default: same as input)
76
+ */
77
+ export function resolveOutputPaths(inputFiles, outputPath, options = {}) {
78
+ const { suffix = '', newExtension } = options;
79
+ const outputMap = new Map();
80
+ // No input files - return empty map
81
+ if (inputFiles.length === 0) {
82
+ return outputMap;
83
+ }
84
+ // Determine output directory or file
85
+ let outputDir;
86
+ let isExplicitFile = false;
87
+ if (!outputPath) {
88
+ // No output provided - use current directory
89
+ outputDir = process.cwd();
90
+ }
91
+ else {
92
+ const resolvedOutput = path.resolve(outputPath);
93
+ const outputExt = path.extname(resolvedOutput).toLowerCase();
94
+ if (outputExt) {
95
+ // Output has extension - it's a file path
96
+ if (inputFiles.length > 1) {
97
+ throw new Error('Cannot specify a file output path for multiple input files. Use a directory instead.');
98
+ }
99
+ // Single file with explicit output file
100
+ isExplicitFile = true;
101
+ outputDir = resolvedOutput;
102
+ }
103
+ else {
104
+ // No extension - it's a directory path
105
+ outputDir = resolvedOutput;
106
+ }
107
+ }
108
+ // Case 1: Single file with explicit output file path
109
+ if (isExplicitFile && inputFiles.length === 1) {
110
+ // Create parent directory if needed
111
+ const parentDir = path.dirname(outputDir);
112
+ if (!fs.existsSync(parentDir)) {
113
+ fs.mkdirSync(parentDir, { recursive: true });
114
+ }
115
+ outputMap.set(inputFiles[0], outputDir);
116
+ return outputMap;
117
+ }
118
+ // Case 2: Multiple files or directory output
119
+ // Create output directory if it doesn't exist
120
+ if (!fs.existsSync(outputDir)) {
121
+ fs.mkdirSync(outputDir, { recursive: true });
122
+ }
123
+ // Map each input file to output path
124
+ for (const inputFile of inputFiles) {
125
+ const inputParsed = path.parse(inputFile);
126
+ const ext = newExtension || inputParsed.ext;
127
+ const outputFilename = `${inputParsed.name}${suffix}${ext}`;
128
+ const outputFilePath = path.join(outputDir, outputFilename);
129
+ outputMap.set(inputFile, outputFilePath);
130
+ }
131
+ return outputMap;
132
+ }
133
+ /**
134
+ * Validate input and output paths
135
+ * Returns validated input files, output directory, and any errors
136
+ */
137
+ export function validatePaths(inputPath, outputPath, options = {}) {
138
+ const { allowedExtensions = IMAGE_EXTENSIONS } = options;
139
+ const errors = [];
140
+ // Parse input files
141
+ const inputFiles = parseInputPaths(inputPath, allowedExtensions);
142
+ if (inputFiles.length === 0) {
143
+ errors.push(`No valid files found. Supported extensions: ${allowedExtensions.join(', ')}`);
144
+ }
145
+ // Validate output path if provided
146
+ if (outputPath) {
147
+ const resolvedOutput = path.resolve(outputPath);
148
+ const outputExt = path.extname(resolvedOutput).toLowerCase();
149
+ // If output has extension but multiple input files
150
+ if (outputExt && inputFiles.length > 1) {
151
+ errors.push('Cannot specify a file output path for multiple input files. Use a directory instead.');
152
+ }
153
+ }
154
+ return {
155
+ inputFiles,
156
+ outputPath,
157
+ errors,
158
+ };
159
+ }
160
+ /**
161
+ * Get file name from path
162
+ */
163
+ export function getFileName(filePath) {
164
+ return path.basename(filePath);
165
+ }
166
+ //# sourceMappingURL=pathValidator.js.map
@@ -0,0 +1 @@
1
+ {"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AChD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;QAE7D,mDAAmD;QACnD,IAAI,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;QACtG,CAAC;IACH,CAAC;IAED,OAAO;QACL,UAAU;QACV,UAAU;QACV,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Supported media file extensions
3
+ */
4
+ export declare const IMAGE_EXTENSIONS: string[];
5
+ export declare const VIDEO_EXTENSIONS: string[];
6
+ export declare const AUDIO_EXTENSIONS: string[];
7
+ export declare const DOCUMENT_EXTENSIONS: string[];
8
+ export declare const THREED_EXTENSIONS: string[];
9
+ export declare const ANIMATION_EXTENSIONS: string[];
10
+ //# sourceMappingURL=supportedExtensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportedExtensions.d.ts","sourceRoot":"","sources":["../src/supportedExtensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAc5B,CAAC;AACF,eAAO,MAAM,gBAAgB,UAgB5B,CAAC;AACF,eAAO,MAAM,gBAAgB,UAE5B,CAAC;AACF,eAAO,MAAM,mBAAmB,UAAqG,CAAC;AACtI,eAAO,MAAM,iBAAiB,UAA8E,CAAC;AAC7G,eAAO,MAAM,oBAAoB,UAAqC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Supported media file extensions
3
+ */
4
+ export const IMAGE_EXTENSIONS = [
5
+ '.jpg',
6
+ '.jpeg',
7
+ '.png',
8
+ '.gif',
9
+ '.bmp',
10
+ '.webp',
11
+ '.tiff',
12
+ '.tif',
13
+ '.svg',
14
+ '.ico',
15
+ '.heic',
16
+ '.heif',
17
+ '.avif',
18
+ ];
19
+ export const VIDEO_EXTENSIONS = [
20
+ '.mp4',
21
+ '.avi',
22
+ '.mkv',
23
+ '.mov',
24
+ '.webm',
25
+ '.flv',
26
+ '.wmv',
27
+ '.mpg',
28
+ '.mpeg',
29
+ '.m4v',
30
+ '.3gp',
31
+ '.f4v',
32
+ '.ts',
33
+ '.mts',
34
+ '.m2ts',
35
+ ];
36
+ export const AUDIO_EXTENSIONS = [
37
+ '.mp3', '.wav', '.flac', '.aac', '.ogg', '.m4a', '.wma', '.opus', '.ape', '.alac', '.mov', '.mkv'
38
+ ];
39
+ export const DOCUMENT_EXTENSIONS = ['.pdf', '.doc', '.docx', '.txt', '.rtf', '.odt', '.md', '.html', '.xml', '.tex', '.csv', '.pptx'];
40
+ export const THREED_EXTENSIONS = ['.obj', '.fbx', '.gltf', '.glb', '.stl', '.dae', '.3ds', '.blend', '.ply'];
41
+ export const ANIMATION_EXTENSIONS = ['.gif', '.apng', '.webp', '.mp4'];
42
+ //# sourceMappingURL=supportedExtensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportedExtensions.js","sourceRoot":"","sources":["../src/supportedExtensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;CACV,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;CACV,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;CACpG,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACtI,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7G,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@mediaproc/core",
3
+ "version": "1.0.0",
4
+ "description": "Core utilities for MediaProc CLI and Plugins",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./branding": {
14
+ "import": "./dist/branding.js",
15
+ "types": "./dist/branding.d.ts"
16
+ },
17
+ "./helpFormatter": {
18
+ "import": "./dist/helpFormatter.js",
19
+ "types": "./dist/helpFormatter.d.ts"
20
+ },
21
+ "./pathValidator": {
22
+ "import": "./dist/pathValidator.js",
23
+ "types": "./dist/pathValidator.d.ts"
24
+ },
25
+ "./explainFormatter": {
26
+ "import": "./dist/explainFormatter.js",
27
+ "types": "./dist/explainFormatter.d.ts"
28
+ },
29
+ "./supportedExtensions": {
30
+ "import": "./dist/supportedExtensions.js",
31
+ "types": "./dist/supportedExtensions.d.ts"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "build": "tsc",
40
+ "clean": "rm -rf dist",
41
+ "dev": "tsc --watch",
42
+ "prepublishOnly": "pnpm clean && pnpm build"
43
+ },
44
+ "keywords": [
45
+ "mediaproc",
46
+ "core",
47
+ "utilities",
48
+ "cli",
49
+ "plugins"
50
+ ],
51
+ "author": {
52
+ "name": "0xshariq",
53
+ "url": "https://github.com/0xshariq"
54
+ },
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/0xshariq/mediaproc-cli.git",
59
+ "directory": "core"
60
+ },
61
+ "dependencies": {
62
+ "chalk": "^5.3.0"
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^20.10.0",
66
+ "typescript": "^5.3.3"
67
+ }
68
+ }