@node-minify/cli 10.1.1 → 10.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/README.md CHANGED
@@ -1,13 +1,13 @@
1
- <p align="center"><img src="/static/node-minify.svg" width="348" alt="node-minify"></p>
1
+ <p align="center"><img src="https://raw.githubusercontent.com/srod/node-minify/main/static/node-minify.svg" width="348" alt="node-minify"></p>
2
2
 
3
3
  <p align="center">A very light minifier Node.js module.</p>
4
4
 
5
5
  <p align="center">
6
6
  <br>
7
- <a href="https://npmjs.org/package/@node-minify/cli"><img src="https://img.shields.io/npm/v/@node-minify/cli.svg"></a>
8
- <a href="https://npmjs.org/package/@node-minify/cli"><img src="https://img.shields.io/npm/dm/@node-minify/cli.svg"></a>
7
+ <a href="https://npmjs.org/package/@node-minify/cli"><img src="https://img.shields.io/npm/v/@node-minify/cli.svg" alt="npm version"></a>
8
+ <a href="https://npmjs.org/package/@node-minify/cli"><img src="https://img.shields.io/npm/dm/@node-minify/cli.svg" alt="npm downloads"></a>
9
9
  <a href="https://github.com/srod/node-minify/actions"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fsrod%2Fnode-minify%2Fbadge%3Fref%3Dmain&style=flat" /></a>
10
- <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/main/graph/badge.svg"></a>
10
+ <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/main/graph/badge.svg" alt="code coverage"></a>
11
11
  </p>
12
12
 
13
13
  # CLI
package/dist/bin/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { n as AVAILABLE_MINIFIER, t as run } from "../src-BMvwXoUW.js";
2
+ import { n as AVAILABLE_MINIFIER, t as run } from "../src-CD1D8QZh.js";
3
3
  import { Command } from "commander";
4
4
  import updateNotifier from "update-notifier";
5
5
 
6
6
  //#region package.json
7
- var version = "10.1.1";
7
+ var version = "10.2.0";
8
8
  var package_default = {
9
9
  name: "@node-minify/cli",
10
10
  version,
@@ -18,7 +18,7 @@ var package_default = {
18
18
  homepage: "https://github.com/srod/node-minify/tree/main/packages/cli#readme",
19
19
  license: "MIT",
20
20
  type: "module",
21
- bin: { "node-minify": "dist/cli.js" },
21
+ bin: { "node-minify": "dist/bin/cli.js" },
22
22
  engines: { "node": ">=20.0.0" },
23
23
  directories: {
24
24
  "lib": "dist",
@@ -31,7 +31,7 @@ var package_default = {
31
31
  "default": "./dist/index.js"
32
32
  },
33
33
  sideEffects: false,
34
- files: ["bin", "dist/**/*"],
34
+ files: ["dist/**/*"],
35
35
  publishConfig: { "access": "public" },
36
36
  repository: {
37
37
  "type": "git",
@@ -51,17 +51,27 @@ var package_default = {
51
51
  "dev": "tsdown src/index.ts --watch"
52
52
  },
53
53
  dependencies: {
54
- "@node-minify/core": "10.1.1",
55
- "@node-minify/utils": "10.1.1",
54
+ "@node-minify/core": "10.2.0",
55
+ "@node-minify/utils": "10.2.0",
56
56
  "chalk": "5.6.2",
57
57
  "commander": "14.0.2",
58
58
  "ora": "9.0.0",
59
59
  "update-notifier": "7.3.1"
60
60
  },
61
61
  devDependencies: {
62
- "@node-minify/google-closure-compiler": "10.1.1",
63
- "@node-minify/types": "10.1.1",
64
- "@node-minify/yui": "10.1.1"
62
+ "@node-minify/clean-css": "10.2.0",
63
+ "@node-minify/cssnano": "10.2.0",
64
+ "@node-minify/csso": "10.2.0",
65
+ "@node-minify/esbuild": "10.2.0",
66
+ "@node-minify/google-closure-compiler": "10.2.0",
67
+ "@node-minify/jsonminify": "10.2.0",
68
+ "@node-minify/lightningcss": "10.2.0",
69
+ "@node-minify/oxc": "10.2.0",
70
+ "@node-minify/swc": "10.2.0",
71
+ "@node-minify/terser": "10.2.0",
72
+ "@node-minify/types": "10.2.0",
73
+ "@node-minify/uglify-js": "10.2.0",
74
+ "@node-minify/yui": "10.2.0"
65
75
  }
66
76
  };
67
77
 
@@ -73,9 +83,18 @@ var package_default = {
73
83
  * MIT Licensed
74
84
  */
75
85
  const DEFAULT_COMPRESSOR = "uglify-js";
86
+ /**
87
+ * Create and configure the command-line interface for the node-minify tool.
88
+ *
89
+ * Configures options for selecting a compressor, input and output paths, file
90
+ * type, silence mode, and compressor-specific options; registers a help hook
91
+ * that displays available compressors and sets the CLI version.
92
+ *
93
+ * @returns The configured Command instance ready to parse CLI arguments.
94
+ */
76
95
  function setupProgram() {
77
96
  const program = new Command();
78
- program.storeOptionsAsProperties().version(version, "-v, --version").option("-c, --compressor [compressor]", "use the specified compressor [uglify-js]", DEFAULT_COMPRESSOR).option("-i, --input [file]", "input file path").option("-o, --output [file]", "output file path").option("-s, --silence", "no output will be printed").option("-O, --option [option]", "option for the compressor as JSON object", "");
97
+ program.storeOptionsAsProperties().version(version, "-v, --version").option("-c, --compressor [compressor]", "use the specified compressor [uglify-js]", DEFAULT_COMPRESSOR).option("-i, --input [file]", "input file path").option("-o, --output [file]", "output file path").option("-t, --type [type]", "file type: js or css (required for esbuild, lightningcss, yui)").option("-s, --silence", "no output will be printed").option("-O, --option [option]", "option for the compressor as JSON object", "");
79
98
  program.on("--help", displayCompressorsList);
80
99
  return program;
81
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["packageJson.version","packageJson","options: SettingsWithCompressor"],"sources":["../../package.json","../../src/bin/cli.ts"],"sourcesContent":["","#!/usr/bin/env node\n\n/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { Command } from \"commander\";\nimport updateNotifier from \"update-notifier\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\nimport { AVAILABLE_MINIFIER } from \"../config.ts\";\nimport type { SettingsWithCompressor } from \"../index.ts\";\nimport { run } from \"../index.ts\";\n\nconst DEFAULT_COMPRESSOR = \"uglify-js\";\n\nfunction setupProgram(): Command {\n const program = new Command();\n\n program\n .storeOptionsAsProperties()\n .version(packageJson.version, \"-v, --version\")\n .option(\n \"-c, --compressor [compressor]\",\n \"use the specified compressor [uglify-js]\",\n DEFAULT_COMPRESSOR\n )\n .option(\"-i, --input [file]\", \"input file path\")\n .option(\"-o, --output [file]\", \"output file path\")\n .option(\"-s, --silence\", \"no output will be printed\")\n .option(\n \"-O, --option [option]\",\n \"option for the compressor as JSON object\",\n \"\"\n );\n\n program.on(\"--help\", displayCompressorsList);\n\n return program;\n}\n\nfunction displayCompressorsList() {\n console.log(\" List of compressors:\");\n console.log(\"\");\n AVAILABLE_MINIFIER.forEach((compressor) => {\n console.log(` - ${compressor.name}`);\n });\n console.log(\"\");\n}\n\nfunction validateOptions(options: SettingsWithCompressor, program: Command) {\n if (!options.compressor || !options.input || !options.output) {\n program.help();\n }\n}\n\nasync function main(): Promise<void> {\n updateNotifier({ pkg: packageJson }).notify();\n\n const program = setupProgram();\n program.parse(process.argv);\n\n const options: SettingsWithCompressor = program.opts();\n validateOptions(options, program);\n\n try {\n await run(options);\n process.exit(0);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACeA,MAAM,qBAAqB;AAE3B,SAAS,eAAwB;CAC7B,MAAM,UAAU,IAAI,SAAS;AAE7B,SACK,0BAA0B,CAC1B,QAAQA,SAAqB,gBAAgB,CAC7C,OACG,iCACA,4CACA,mBACH,CACA,OAAO,sBAAsB,kBAAkB,CAC/C,OAAO,uBAAuB,mBAAmB,CACjD,OAAO,iBAAiB,4BAA4B,CACpD,OACG,yBACA,4CACA,GACH;AAEL,SAAQ,GAAG,UAAU,uBAAuB;AAE5C,QAAO;;AAGX,SAAS,yBAAyB;AAC9B,SAAQ,IAAI,yBAAyB;AACrC,SAAQ,IAAI,GAAG;AACf,oBAAmB,SAAS,eAAe;AACvC,UAAQ,IAAI,SAAS,WAAW,OAAO;GACzC;AACF,SAAQ,IAAI,GAAG;;AAGnB,SAAS,gBAAgB,SAAiC,SAAkB;AACxE,KAAI,CAAC,QAAQ,cAAc,CAAC,QAAQ,SAAS,CAAC,QAAQ,OAClD,SAAQ,MAAM;;AAItB,eAAe,OAAsB;AACjC,gBAAe,EAAE,KAAKC,iBAAa,CAAC,CAAC,QAAQ;CAE7C,MAAM,UAAU,cAAc;AAC9B,SAAQ,MAAM,QAAQ,KAAK;CAE3B,MAAMC,UAAkC,QAAQ,MAAM;AACtD,iBAAgB,SAAS,QAAQ;AAEjC,KAAI;AACA,QAAM,IAAI,QAAQ;AAClB,UAAQ,KAAK,EAAE;UACV,OAAO;AACZ,UAAQ,MAAM,MAAM;AACpB,UAAQ,KAAK,EAAE;;;AAIvB,MAAM"}
1
+ {"version":3,"file":"cli.js","names":["packageJson.version","packageJson","options: SettingsWithCompressor"],"sources":["../../package.json","../../src/bin/cli.ts"],"sourcesContent":["","#!/usr/bin/env node\n\n/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { Command } from \"commander\";\nimport updateNotifier from \"update-notifier\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\nimport { AVAILABLE_MINIFIER } from \"../config.ts\";\nimport type { SettingsWithCompressor } from \"../index.ts\";\nimport { run } from \"../index.ts\";\n\nconst DEFAULT_COMPRESSOR = \"uglify-js\";\n\n/**\n * Create and configure the command-line interface for the node-minify tool.\n *\n * Configures options for selecting a compressor, input and output paths, file\n * type, silence mode, and compressor-specific options; registers a help hook\n * that displays available compressors and sets the CLI version.\n *\n * @returns The configured Command instance ready to parse CLI arguments.\n */\nfunction setupProgram(): Command {\n const program = new Command();\n\n program\n .storeOptionsAsProperties()\n .version(packageJson.version, \"-v, --version\")\n .option(\n \"-c, --compressor [compressor]\",\n \"use the specified compressor [uglify-js]\",\n DEFAULT_COMPRESSOR\n )\n .option(\"-i, --input [file]\", \"input file path\")\n .option(\"-o, --output [file]\", \"output file path\")\n .option(\n \"-t, --type [type]\",\n \"file type: js or css (required for esbuild, lightningcss, yui)\"\n )\n .option(\"-s, --silence\", \"no output will be printed\")\n .option(\n \"-O, --option [option]\",\n \"option for the compressor as JSON object\",\n \"\"\n );\n\n program.on(\"--help\", displayCompressorsList);\n\n return program;\n}\n\nfunction displayCompressorsList() {\n console.log(\" List of compressors:\");\n console.log(\"\");\n AVAILABLE_MINIFIER.forEach((compressor) => {\n console.log(` - ${compressor.name}`);\n });\n console.log(\"\");\n}\n\nfunction validateOptions(options: SettingsWithCompressor, program: Command) {\n if (!options.compressor || !options.input || !options.output) {\n program.help();\n }\n}\n\nasync function main(): Promise<void> {\n updateNotifier({ pkg: packageJson }).notify();\n\n const program = setupProgram();\n program.parse(process.argv);\n\n const options: SettingsWithCompressor = program.opts();\n validateOptions(options, program);\n\n try {\n await run(options);\n process.exit(0);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACeA,MAAM,qBAAqB;;;;;;;;;;AAW3B,SAAS,eAAwB;CAC7B,MAAM,UAAU,IAAI,SAAS;AAE7B,SACK,0BAA0B,CAC1B,QAAQA,SAAqB,gBAAgB,CAC7C,OACG,iCACA,4CACA,mBACH,CACA,OAAO,sBAAsB,kBAAkB,CAC/C,OAAO,uBAAuB,mBAAmB,CACjD,OACG,qBACA,iEACH,CACA,OAAO,iBAAiB,4BAA4B,CACpD,OACG,yBACA,4CACA,GACH;AAEL,SAAQ,GAAG,UAAU,uBAAuB;AAE5C,QAAO;;AAGX,SAAS,yBAAyB;AAC9B,SAAQ,IAAI,yBAAyB;AACrC,SAAQ,IAAI,GAAG;AACf,oBAAmB,SAAS,eAAe;AACvC,UAAQ,IAAI,SAAS,WAAW,OAAO;GACzC;AACF,SAAQ,IAAI,GAAG;;AAGnB,SAAS,gBAAgB,SAAiC,SAAkB;AACxE,KAAI,CAAC,QAAQ,cAAc,CAAC,QAAQ,SAAS,CAAC,QAAQ,OAClD,SAAQ,MAAM;;AAItB,eAAe,OAAsB;AACjC,gBAAe,EAAE,KAAKC,iBAAa,CAAC,CAAC,QAAQ;CAE7C,MAAM,UAAU,cAAc;AAC9B,SAAQ,MAAM,QAAQ,KAAK;CAE3B,MAAMC,UAAkC,QAAQ,MAAM;AACtD,iBAAgB,SAAS,QAAQ;AAEjC,KAAI;AACA,QAAM,IAAI,QAAQ;AAClB,UAAQ,KAAK,EAAE;UACV,OAAO;AACZ,UAAQ,MAAM,MAAM;AACpB,UAAQ,KAAK,EAAE;;;AAIvB,MAAM"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,47 @@
1
1
  //#region ../types/src/types.d.ts
2
2
 
3
+ /**
4
+ * Output result for multi-format image compression.
5
+ */
6
+ type CompressorOutput = {
7
+ /**
8
+ * Format of the output (e.g., 'webp', 'avif').
9
+ */
10
+ format?: string;
11
+
12
+ /**
13
+ * Output content as string or Buffer.
14
+ */
15
+ content: string | Buffer;
16
+ };
3
17
  /**
4
18
  * Result returned by a compressor function.
5
19
  */
6
20
  type CompressorResult = {
21
+ /**
22
+ * Minified content as string (for text-based formats like JS, CSS, HTML, SVG).
23
+ */
7
24
  code: string;
25
+
26
+ /**
27
+ * Source map (for JS/CSS compressors).
28
+ */
8
29
  map?: string;
30
+
31
+ /**
32
+ * Minified content as Buffer (for binary formats like images).
33
+ * @example
34
+ * When using sharp for PNG/WebP compression
35
+ */
36
+ buffer?: Buffer;
37
+
38
+ /**
39
+ * Multiple outputs for multi-format image compression.
40
+ * Used when converting to multiple formats simultaneously.
41
+ * @example
42
+ * [{ format: 'webp', content: <Buffer> }, { format: 'avif', content: <Buffer> }]
43
+ */
44
+ outputs?: CompressorOutput[];
9
45
  };
10
46
  /**
11
47
  * Base options that all compressors can accept.
@@ -53,8 +89,10 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
53
89
  /**
54
90
  * Content to minify (for in-memory minification).
55
91
  * If provided, input/output are not required.
92
+ * For text-based formats (JS, CSS, HTML, SVG): string
93
+ * For binary formats (images): Buffer (handled internally by image compressors)
56
94
  */
57
- content?: string;
95
+ content?: string | Buffer;
58
96
 
59
97
  /**
60
98
  * Input file path(s) or glob pattern.
@@ -136,8 +174,11 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
136
174
 
137
175
  /**
138
176
  * The content to minify.
177
+ * For text-based formats (JS, CSS, HTML, SVG): string
178
+ * For binary formats (images): Buffer
179
+ * For multiple binary files: Buffer[]
139
180
  */
140
- content?: string;
181
+ content?: string | Buffer | Buffer[];
141
182
 
142
183
  /**
143
184
  * Index of current file when processing multiple files.
@@ -146,30 +187,71 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
146
187
  };
147
188
  //#endregion
148
189
  //#region src/config.d.ts
190
+ /*!
191
+ * node-minify
192
+ * Copyright(c) 2011-2025 Rodolphe Stoclin
193
+ * MIT Licensed
194
+ */
149
195
  declare const AVAILABLE_MINIFIER: readonly [{
150
- readonly name: "babel-minify";
151
- readonly export: "babelMinify";
152
- }, {
153
- readonly name: "csso";
154
- readonly export: "csso";
196
+ readonly name: "esbuild";
197
+ readonly export: "esbuild";
155
198
  }, {
156
199
  readonly name: "google-closure-compiler";
157
200
  readonly export: "gcc";
158
201
  }, {
159
- readonly name: "html-minifier";
160
- readonly export: "htmlMinifier";
202
+ readonly name: "oxc";
203
+ readonly export: "oxc";
204
+ }, {
205
+ readonly name: "swc";
206
+ readonly export: "swc";
161
207
  }, {
162
208
  readonly name: "terser";
163
209
  readonly export: "terser";
164
210
  }, {
165
211
  readonly name: "uglify-js";
166
212
  readonly export: "uglifyJs";
213
+ }, {
214
+ readonly name: "babel-minify";
215
+ readonly export: "babelMinify";
167
216
  }, {
168
217
  readonly name: "uglify-es";
169
218
  readonly export: "uglifyEs";
170
219
  }, {
171
220
  readonly name: "yui";
172
221
  readonly export: "yui";
222
+ }, {
223
+ readonly name: "clean-css";
224
+ readonly export: "cleanCss";
225
+ readonly cssOnly: true;
226
+ }, {
227
+ readonly name: "cssnano";
228
+ readonly export: "cssnano";
229
+ readonly cssOnly: true;
230
+ }, {
231
+ readonly name: "csso";
232
+ readonly export: "csso";
233
+ readonly cssOnly: true;
234
+ }, {
235
+ readonly name: "lightningcss";
236
+ readonly export: "lightningCss";
237
+ readonly cssOnly: true;
238
+ }, {
239
+ readonly name: "crass";
240
+ readonly export: "crass";
241
+ readonly cssOnly: true;
242
+ }, {
243
+ readonly name: "sqwish";
244
+ readonly export: "sqwish";
245
+ readonly cssOnly: true;
246
+ }, {
247
+ readonly name: "html-minifier";
248
+ readonly export: "htmlMinifier";
249
+ }, {
250
+ readonly name: "jsonminify";
251
+ readonly export: "jsonMinify";
252
+ }, {
253
+ readonly name: "no-compress";
254
+ readonly export: "noCompress";
173
255
  }];
174
256
  //#endregion
175
257
  //#region src/index.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["CompressorReturnType","CompressorResult","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","FileType","Settings","Result","MinifyOptions"],"sources":["../../types/src/types.d.ts","../src/config.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * The return type of a compressor function.\n * @deprecated Use `CompressorResult` instead. Will be removed in v11.\n */\nexport type CompressorReturnType = string;\n\n/**\n * Result returned by a compressor function.\n */\nexport type CompressorResult = {\n code: string;\n map?: string;\n};\n\n/**\n * Base options that all compressors can accept.\n * Specific compressors may extend this with their own options.\n */\nexport type CompressorOptions = Record<string, unknown>;\n\n/**\n * A compressor function that minifies content.\n * @param args - The minifier options including settings and content\n * @returns A promise resolving to the compression result\n */\nexport type Compressor<TOptions extends CompressorOptions = CompressorOptions> =\n (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;\n\n/**\n * File type for compressors that support multiple types (e.g., YUI).\n */\nexport type FileType = \"js\" | \"css\";\n\n/**\n * User-facing settings for the minify function.\n * This is what users pass when calling minify().\n *\n * @example\n * ```ts\n * import { minify } from '@node-minify/core';\n * import { terser } from '@node-minify/terser';\n *\n * await minify({\n * compressor: terser,\n * input: 'src/*.js',\n * output: 'dist/bundle.min.js',\n * options: { mangle: true }\n * });\n * ```\n */\nexport type Settings<TOptions extends CompressorOptions = CompressorOptions> = {\n /**\n * The compressor function to use for minification.\n */\n compressor: Compressor<TOptions>;\n\n /**\n * Optional label for the compressor (used in logging).\n */\n compressorLabel?: string;\n\n /**\n * Content to minify (for in-memory minification).\n * If provided, input/output are not required.\n */\n content?: string;\n\n /**\n * Input file path(s) or glob pattern.\n * Can be a single file, array of files, or wildcard pattern.\n *\n * @example\n * - 'src/app.js'\n * - ['src/a.js', 'src/b.js']\n * - 'src/**\\/*.js'\n */\n input?: string | string[];\n\n /**\n * Output file path.\n * Use $1 as placeholder for input filename in multi-file scenarios.\n * Can be a single file, array of files, or pattern with $1.\n *\n * @example\n * - 'dist/bundle.min.js'\n * - ['file1.min.js', 'file2.min.js']\n * - '$1.min.js' (creates app.min.js from app.js)\n */\n output?: string | string[];\n\n /**\n * Compressor-specific options.\n * See individual compressor documentation for available options.\n */\n options?: TOptions;\n\n /**\n * CLI option string (used by CLI only).\n * @internal\n */\n option?: string;\n\n /**\n * Buffer size for file operations (in bytes).\n * @default 1024000 (1MB)\n */\n buffer?: number;\n\n /**\n * File type for compressors that support multiple types.\n * Required for YUI compressor.\n */\n type?: FileType;\n\n /**\n * Suppress console output.\n * @default false\n */\n silence?: boolean;\n\n /**\n * Public folder to prepend to input paths.\n *\n * @example\n * With publicFolder: 'public/js/' and input: 'app.js',\n * the actual path becomes 'public/js/app.js'\n */\n publicFolder?: string;\n\n /**\n * Replace files in place instead of creating new output files.\n * @default false\n */\n replaceInPlace?: boolean;\n};\n\n/**\n * Options passed to compressor functions internally.\n * This is what compressors receive, not what users pass.\n */\nexport type MinifierOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = {\n /**\n * The full settings object.\n */\n settings: Settings<TOptions>;\n\n /**\n * The content to minify.\n */\n content?: string;\n\n /**\n * Index of current file when processing multiple files.\n */\n index?: number;\n};\n\n/**\n * Result returned after compression (used by CLI).\n */\nexport type Result = {\n /**\n * Label of the compressor used.\n */\n compressorLabel: string;\n\n /**\n * Size of minified content (formatted string, e.g., \"1.5 KB\").\n */\n size: string;\n\n /**\n * Gzipped size of minified content (formatted string).\n */\n sizeGzip: string;\n};\n\n/**\n * Type alias for user convenience.\n * @deprecated Use `Settings` instead. Will be removed in v11.\n */\nexport type MinifyOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = Settings<TOptions>;\n"],"mappings":";;AAwDA;;;AAI2BK,KA7CfJ,gBAAAA,GA6CeI;EAAXD,IAAAA,EAAAA,MAAAA;EAwCFC,GAAAA,CAAAA,EAAAA,MAAAA;CAkBHG;AA4BX;;;;AAMcC,KAhIFP,iBAAAA,GAAoBC,MAgIlBM,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;ACxJd;;KD+BYL,4BAA4BF,oBAAoBA,4BACjDI,gBAAgBD,cAAcE,QAAQN;;;;AEhBP,KFqB9BO,QAAAA,GErB8B,IAAA,GAAA,KAAA;;;;;;;;;;;;;;;;;;KFwC9BC,0BAA0BP,oBAAoBA;;;;cAI1CE,WAAWC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAwCbA;;;;;;;;;;;;;;;;;;SAkBHG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BCF,iCACSJ,oBAAoBA;;;;YAK3BO,SAASJ;;;;;;;;;;;;;;cCxJV;EDeDJ,SAAAA,IAAAA,EAAAA,cAAgB;EAShBC,SAAAA,MAAAA,EAAAA,aAAiB;AAO7B,CAAA,EAAA;EAAwCA,SAAAA,IAAAA,EAAAA,MAAAA;EAAoBA,SAAAA,MAAAA,EAAAA,MAAAA;CACjCG,EAAAA;EAAhBC,SAAAA,IAAAA,EAAAA,yBAAAA;EAAsCL,SAAAA,MAAAA,EAAAA,KAAAA;CAARM,EAAAA;EAAO,SAAA,IAAA,EAAA,eAAA;EAKpCC,SAAAA,MAAQ,EAAA,cAAA;AAmBpB,CAAA,EAAA;EAAsCN,SAAAA,IAAAA,EAAAA,QAAAA;EAAoBA,SAAAA,MAAAA,EAAAA,QAAAA;CAI/BG,EAAAA;EAAXD,SAAAA,IAAAA,EAAAA,WAAAA;EAwCFC,SAAAA,MAAAA,EAAAA,UAAAA;CAkBHG,EAAAA;EAAQ,SAAA,IAAA,EAAA,WAAA;EA4BPF,SAAAA,MAAAA,EAAAA,UAAeD;CACNH,EAAAA;EAAoBA,SAAAA,IAAAA,EAAAA,KAAAA;EAKlBG,SAAAA,MAAAA,EAAAA,KAAAA;CAATI,CAAAA;;;AAxHkC,KEjBpC,sBAAA,GAAyB,IFiBW,CEjBN,QFiBM,EAAA,YAAA,CAAA,GAAA;EAKpCD,UAAAA,EAAQ,CAAA,OErBI,kBFqBJ,CAAA,CAAA,MAAA,CAAA,CAAA,MAAA,CAAA;AAmBpB,CAAA;;;;;AA4CcH,iBEnBQ,GAAA,CFmBRA,GAAAA,EEnBiB,sBFmBjBA,CAAAA,EEnBuC,OFmBvCA,CAAAA,IAAAA,CAAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["CompressorReturnType","ImageFormat","CompressorOutput","Buffer","CompressorResult","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","FileType","Settings","Result","MinifyOptions"],"sources":["../../types/src/types.d.ts","../src/config.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * The return type of a compressor function.\n * @deprecated Use `CompressorResult` instead. Will be removed in v11.\n */\nexport type CompressorReturnType = string;\n\n/**\n * Supported image formats for image compression.\n */\nexport type ImageFormat =\n | \"webp\"\n | \"avif\"\n | \"png\"\n | \"jpeg\"\n | \"jpg\"\n | \"gif\"\n | \"tiff\"\n | \"heif\"\n | \"heic\";\n\n/**\n * Output result for multi-format image compression.\n */\nexport type CompressorOutput = {\n /**\n * Format of the output (e.g., 'webp', 'avif').\n */\n format?: string;\n\n /**\n * Output content as string or Buffer.\n */\n content: string | Buffer;\n};\n\n/**\n * Result returned by a compressor function.\n */\nexport type CompressorResult = {\n /**\n * Minified content as string (for text-based formats like JS, CSS, HTML, SVG).\n */\n code: string;\n\n /**\n * Source map (for JS/CSS compressors).\n */\n map?: string;\n\n /**\n * Minified content as Buffer (for binary formats like images).\n * @example\n * When using sharp for PNG/WebP compression\n */\n buffer?: Buffer;\n\n /**\n * Multiple outputs for multi-format image compression.\n * Used when converting to multiple formats simultaneously.\n * @example\n * [{ format: 'webp', content: <Buffer> }, { format: 'avif', content: <Buffer> }]\n */\n outputs?: CompressorOutput[];\n};\n\n/**\n * Base options that all compressors can accept.\n * Specific compressors may extend this with their own options.\n */\nexport type CompressorOptions = Record<string, unknown>;\n\n/**\n * A compressor function that minifies content.\n * @param args - The minifier options including settings and content\n * @returns A promise resolving to the compression result\n */\nexport type Compressor<TOptions extends CompressorOptions = CompressorOptions> =\n (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;\n\n/**\n * File type for compressors that support multiple types (e.g., YUI).\n */\nexport type FileType = \"js\" | \"css\";\n\n/**\n * User-facing settings for the minify function.\n * This is what users pass when calling minify().\n *\n * @example\n * ```ts\n * import { minify } from '@node-minify/core';\n * import { terser } from '@node-minify/terser';\n *\n * await minify({\n * compressor: terser,\n * input: 'src/*.js',\n * output: 'dist/bundle.min.js',\n * options: { mangle: true }\n * });\n * ```\n */\nexport type Settings<TOptions extends CompressorOptions = CompressorOptions> = {\n /**\n * The compressor function to use for minification.\n */\n compressor: Compressor<TOptions>;\n\n /**\n * Optional label for the compressor (used in logging).\n */\n compressorLabel?: string;\n\n /**\n * Content to minify (for in-memory minification).\n * If provided, input/output are not required.\n * For text-based formats (JS, CSS, HTML, SVG): string\n * For binary formats (images): Buffer (handled internally by image compressors)\n */\n content?: string | Buffer;\n\n /**\n * Input file path(s) or glob pattern.\n * Can be a single file, array of files, or wildcard pattern.\n *\n * @example\n * - 'src/app.js'\n * - ['src/a.js', 'src/b.js']\n * - 'src/**\\/*.js'\n */\n input?: string | string[];\n\n /**\n * Output file path.\n * Use $1 as placeholder for input filename in multi-file scenarios.\n * Can be a single file, array of files, or pattern with $1.\n *\n * @example\n * - 'dist/bundle.min.js'\n * - ['file1.min.js', 'file2.min.js']\n * - '$1.min.js' (creates app.min.js from app.js)\n */\n output?: string | string[];\n\n /**\n * Compressor-specific options.\n * See individual compressor documentation for available options.\n */\n options?: TOptions;\n\n /**\n * CLI option string (used by CLI only).\n * @internal\n */\n option?: string;\n\n /**\n * Buffer size for file operations (in bytes).\n * @default 1024000 (1MB)\n */\n buffer?: number;\n\n /**\n * File type for compressors that support multiple types.\n * Required for YUI compressor.\n */\n type?: FileType;\n\n /**\n * Suppress console output.\n * @default false\n */\n silence?: boolean;\n\n /**\n * Public folder to prepend to input paths.\n *\n * @example\n * With publicFolder: 'public/js/' and input: 'app.js',\n * the actual path becomes 'public/js/app.js'\n */\n publicFolder?: string;\n\n /**\n * Replace files in place instead of creating new output files.\n * @default false\n */\n replaceInPlace?: boolean;\n};\n\n/**\n * Options passed to compressor functions internally.\n * This is what compressors receive, not what users pass.\n */\nexport type MinifierOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = {\n /**\n * The full settings object.\n */\n settings: Settings<TOptions>;\n\n /**\n * The content to minify.\n * For text-based formats (JS, CSS, HTML, SVG): string\n * For binary formats (images): Buffer\n * For multiple binary files: Buffer[]\n */\n content?: string | Buffer | Buffer[];\n\n /**\n * Index of current file when processing multiple files.\n */\n index?: number;\n};\n\n/**\n * Result returned after compression (used by CLI).\n */\nexport type Result = {\n /**\n * Label of the compressor used.\n */\n compressorLabel: string;\n\n /**\n * Size of minified content (formatted string, e.g., \"1.5 KB\").\n */\n size: string;\n\n /**\n * Gzipped size of minified content (formatted string).\n */\n sizeGzip: string;\n};\n\n/**\n * Type alias for user convenience.\n * @deprecated Use `Settings` instead. Will be removed in v11.\n */\nexport type MinifyOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = Settings<TOptions>;\n"],"mappings":";;;;;AAqNsC,KAxL1BE,gBAAAA,GAwL0B;;;;EC/MzB,MAAA,CAAA,EAAA,MAAA;;;;ACSb;EAA0C,OAAA,EAAA,MAAA,GFuBpBC,MEvBoB;CAAL;;AAgFrC;;KFnDYC,gBAAAA;;;;;;;;;;;;;;;;WAgBCD;;;;;;;;YAQCD;;;;;;KAOFG,iBAAAA,GAAoBC;;;;;;KAOpBC,4BAA4BF,oBAAoBA,4BACjDI,gBAAgBD,cAAcE,QAAQN;;;;KAKrCO,QAAAA;;;;;;;;;;;;;;;;;;KAmBAC,0BAA0BP,oBAAoBA;;;;cAI1CE,WAAWC;;;;;;;;;;;;;qBAaJL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BTK;;;;;;;;;;;;;;;;;;SAkBHG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BCF,iCACSJ,oBAAoBA;;;;YAK3BO,SAASJ;;;;;;;;qBAQAL,SAASA;;;;;;;;;;AAxLhC;AAeA;AA+BA;AAOA;AAAwCE,cC5E3B,kBD4E2BA,EAAAA,SAAAA,CAAAA;EAAoBA,SAAAA,IAAAA,EAAAA,SAAAA;EACjCG,SAAAA,MAAAA,EAAAA,SAAAA;CAAhBC,EAAAA;EAAsCL,SAAAA,IAAAA,EAAAA,yBAAAA;EAARM,SAAAA,MAAAA,EAAAA,KAAAA;CAAO,EAAA;EAKpCC,SAAAA,IAAQ,EAAA,KAAA;EAmBRC,SAAAA,MAAQ,EAAAJ,KAAAA;CAAkBH,EAAAA;EAAoBA,SAAAA,IAAAA,EAAAA,KAAAA;EAI/BG,SAAAA,MAAAA,EAAAA,KAAAA;CAAXD,EAAAA;EAaOJ,SAAAA,IAAAA,EAAAA,QAAAA;EA6BTK,SAAAA,MAAAA,EAAAA,QAAAA;CAkBHG,EAAAA;EAAQ,SAAA,IAAA,EAAA,WAAA;EA4BPF,SAAAA,MAAAA,EAAAA,UAAeD;CACNH,EAAAA;EAAoBA,SAAAA,IAAAA,EAAAA,cAAAA;EAKlBG,SAAAA,MAAAA,EAAAA,aAAAA;CAATI,EAAAA;EAQST,SAAAA,IAAAA,EAAAA,WAAAA;EAASA,SAAAA,MAAAA,EAAAA,UAAAA;CAAM,EAAA;;;;EC/MzB,SAAA,IAAA,EAAA,WA0BH;;;;ECjBE,SAAA,IAAA,EAAA,SAAA;EAA8B,SAAA,MAAA,EAAA,SAAA;EAAL,SAAA,OAAA,EAAA,IAAA;CACb,EAAA;EAAkB,SAAA,IAAA,EAAA,MAAA;EA+EpB,SAAG,MAAA,EAAM,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AFZUO,KEpE7B,sBAAA,GAAyB,IFoEIA,CEpEC,QFoEDA,EAAAA,YAAAA,CAAAA,GAAAA;EAAO,UAAA,EAAA,CAAA,OEnExB,kBFmEwB,CAAA,CAAA,MAAA,CAAA,CAAA,MAAA,CAAA;AAKhD,CAAA;AAmBA;;;;AAIgBH,iBEhBM,GAAA,CFgBNA,GAAAA,EEhBe,sBFgBfA,CAAAA,EEhBqC,OFgBrCA,CAAAA,IAAAA,CAAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as run } from "./src-BMvwXoUW.js";
1
+ import { t as run } from "./src-CD1D8QZh.js";
2
2
 
3
3
  export { run };
@@ -13,8 +13,18 @@ import ora from "ora";
13
13
  * Module dependencies.
14
14
  */
15
15
  /**
16
- * Run compression.
17
- * @param options Settings
16
+ * Run the configured compressor and, when possible, report the output file sizes.
17
+ *
18
+ * The function executes compression using the provided settings. If `options.output`
19
+ * is a single file path (not an array and not containing the `$1` pattern), it
20
+ * computes and returns the file size and gzipped file size; otherwise it returns
21
+ * default sizes of `"0"`.
22
+ *
23
+ * @param options - Compression settings; when `options.output` is a single path without the `$1` pattern the returned result will include computed `size` and `sizeGzip`.
24
+ * @returns The compression result containing:
25
+ * - `compressorLabel`: label of the compressor,
26
+ * - `size`: output file size in bytes as a string (or `"0"` if not computed),
27
+ * - `sizeGzip`: gzipped output size in bytes as a string (or `"0"` if not computed).
18
28
  */
19
29
  async function compress(options) {
20
30
  try {
@@ -40,22 +50,27 @@ async function compress(options) {
40
50
 
41
51
  //#endregion
42
52
  //#region src/config.ts
53
+ /*!
54
+ * node-minify
55
+ * Copyright(c) 2011-2025 Rodolphe Stoclin
56
+ * MIT Licensed
57
+ */
43
58
  const AVAILABLE_MINIFIER = [
44
59
  {
45
- name: "babel-minify",
46
- export: "babelMinify"
47
- },
48
- {
49
- name: "csso",
50
- export: "csso"
60
+ name: "esbuild",
61
+ export: "esbuild"
51
62
  },
52
63
  {
53
64
  name: "google-closure-compiler",
54
65
  export: "gcc"
55
66
  },
56
67
  {
57
- name: "html-minifier",
58
- export: "htmlMinifier"
68
+ name: "oxc",
69
+ export: "oxc"
70
+ },
71
+ {
72
+ name: "swc",
73
+ export: "swc"
59
74
  },
60
75
  {
61
76
  name: "terser",
@@ -65,6 +80,10 @@ const AVAILABLE_MINIFIER = [
65
80
  name: "uglify-js",
66
81
  export: "uglifyJs"
67
82
  },
83
+ {
84
+ name: "babel-minify",
85
+ export: "babelMinify"
86
+ },
68
87
  {
69
88
  name: "uglify-es",
70
89
  export: "uglifyEs"
@@ -72,6 +91,48 @@ const AVAILABLE_MINIFIER = [
72
91
  {
73
92
  name: "yui",
74
93
  export: "yui"
94
+ },
95
+ {
96
+ name: "clean-css",
97
+ export: "cleanCss",
98
+ cssOnly: true
99
+ },
100
+ {
101
+ name: "cssnano",
102
+ export: "cssnano",
103
+ cssOnly: true
104
+ },
105
+ {
106
+ name: "csso",
107
+ export: "csso",
108
+ cssOnly: true
109
+ },
110
+ {
111
+ name: "lightningcss",
112
+ export: "lightningCss",
113
+ cssOnly: true
114
+ },
115
+ {
116
+ name: "crass",
117
+ export: "crass",
118
+ cssOnly: true
119
+ },
120
+ {
121
+ name: "sqwish",
122
+ export: "sqwish",
123
+ cssOnly: true
124
+ },
125
+ {
126
+ name: "html-minifier",
127
+ export: "htmlMinifier"
128
+ },
129
+ {
130
+ name: "jsonminify",
131
+ export: "jsonMinify"
132
+ },
133
+ {
134
+ name: "no-compress",
135
+ export: "noCompress"
75
136
  }
76
137
  ];
77
138
 
@@ -118,19 +179,30 @@ function error({ compressorLabel }) {
118
179
  */
119
180
  let silence = false;
120
181
  /**
121
- * Run one compressor.
122
- * @param cli Settings
182
+ * Runs a single compression task using the compressor specified in the CLI settings.
183
+ *
184
+ * Loads and validates the requested compressor, constructs the runtime Settings object
185
+ * (including parsed input, output, type, and options), executes compression, and
186
+ * manages CLI spinner state when not silenced.
187
+ *
188
+ * @param cli - CLI settings identifying the compressor and its runtime options
189
+ * @returns The compression Result produced by the compressor
190
+ * @throws Error if the specified compressor is not found
191
+ * @throws Error if the compressor implementation is missing or not a function
192
+ * @throws Error if the compressor only supports CSS but a non-`css` type is provided
123
193
  */
124
194
  async function runOne(cli) {
125
195
  const minifierDefinition = AVAILABLE_MINIFIER.find((compressor) => compressor.name === cli.compressor);
126
196
  if (!minifierDefinition) throw new Error(`Compressor '${cli.compressor}' not found.`);
127
197
  const minifierImplementation = (await import(`@node-minify/${cli.compressor}`))[minifierDefinition.export];
128
198
  if (!minifierImplementation || typeof minifierImplementation !== "function") throw new Error(`Invalid compressor implementation for '${cli.compressor}'.`);
199
+ if ("cssOnly" in minifierDefinition && cli.type && cli.type !== "css") throw new Error(`${cli.compressor} only supports type 'css'`);
129
200
  const settings = {
130
201
  compressorLabel: cli.compressor,
131
202
  compressor: minifierImplementation,
132
203
  input: typeof cli.input === "string" ? cli.input.split(",") : cli.input,
133
204
  output: cli.output,
205
+ ...cli.type && { type: cli.type },
134
206
  ...cli.option && { options: JSON.parse(cli.option) }
135
207
  };
136
208
  if (!silence) start(settings);
@@ -166,4 +238,4 @@ function logMessage(badge, message, badgeColor, messageColor) {
166
238
 
167
239
  //#endregion
168
240
  export { AVAILABLE_MINIFIER as n, run as t };
169
- //# sourceMappingURL=src-BMvwXoUW.js.map
241
+ //# sourceMappingURL=src-CD1D8QZh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-CD1D8QZh.js","names":["defaultResult: Result","error","settings: Settings","error"],"sources":["../src/compress.ts","../src/config.ts","../src/spinner.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport { minify } from \"@node-minify/core\";\nimport type { CompressorOptions, Result, Settings } from \"@node-minify/types\";\nimport {\n getFilesizeGzippedInBytes,\n getFilesizeInBytes,\n} from \"@node-minify/utils\";\n\n/**\n * Run the configured compressor and, when possible, report the output file sizes.\n *\n * The function executes compression using the provided settings. If `options.output`\n * is a single file path (not an array and not containing the `$1` pattern), it\n * computes and returns the file size and gzipped file size; otherwise it returns\n * default sizes of `\"0\"`.\n *\n * @param options - Compression settings; when `options.output` is a single path without the `$1` pattern the returned result will include computed `size` and `sizeGzip`.\n * @returns The compression result containing:\n * - `compressorLabel`: label of the compressor,\n * - `size`: output file size in bytes as a string (or `\"0\"` if not computed),\n * - `sizeGzip`: gzipped output size in bytes as a string (or `\"0\"` if not computed).\n */\nasync function compress<T extends CompressorOptions = CompressorOptions>(\n options: Settings<T>\n): Promise<Result> {\n try {\n await minify(options);\n\n const defaultResult: Result = {\n compressorLabel: options.compressorLabel ?? \"\",\n size: \"0\",\n sizeGzip: \"0\",\n };\n\n // Return default result if output contains pattern, is an array, or is undefined\n // Arrays and $1 patterns produce multiple files, so we can't calculate a single size\n if (\n !options.output ||\n Array.isArray(options.output) ||\n options.output.includes(\"$1\")\n ) {\n return defaultResult;\n }\n\n // Get file sizes\n const sizeGzip = await getFilesizeGzippedInBytes(options.output);\n const size = getFilesizeInBytes(options.output);\n\n return {\n ...defaultResult,\n size,\n sizeGzip,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new Error(`Compression failed: ${errorMessage}`);\n }\n}\n\nexport { compress };\n","/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nexport const AVAILABLE_MINIFIER = [\n // JavaScript compressors\n { name: \"esbuild\", export: \"esbuild\" },\n { name: \"google-closure-compiler\", export: \"gcc\" },\n { name: \"oxc\", export: \"oxc\" },\n { name: \"swc\", export: \"swc\" },\n { name: \"terser\", export: \"terser\" },\n { name: \"uglify-js\", export: \"uglifyJs\" },\n // Deprecated JS compressors\n { name: \"babel-minify\", export: \"babelMinify\" },\n { name: \"uglify-es\", export: \"uglifyEs\" },\n { name: \"yui\", export: \"yui\" },\n // CSS compressors\n { name: \"clean-css\", export: \"cleanCss\", cssOnly: true },\n { name: \"cssnano\", export: \"cssnano\", cssOnly: true },\n { name: \"csso\", export: \"csso\", cssOnly: true },\n { name: \"lightningcss\", export: \"lightningCss\", cssOnly: true },\n // Deprecated CSS compressors\n { name: \"crass\", export: \"crass\", cssOnly: true },\n { name: \"sqwish\", export: \"sqwish\", cssOnly: true },\n // HTML compressors\n { name: \"html-minifier\", export: \"htmlMinifier\" },\n // JSON compressors\n { name: \"jsonminify\", export: \"jsonMinify\" },\n // Other\n { name: \"no-compress\", export: \"noCompress\" },\n] as const;\n","/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Result, Settings } from \"@node-minify/types\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\n\nconst spinner = ora();\n\n/**\n * Formats a compression message with the compressor label\n */\nfunction formatCompressionMessage(\n status: string,\n compressorLabel?: string\n): string {\n return `${status} with ${chalk.green(compressorLabel)}`;\n}\n\n/**\n * Start spinner for compression process\n */\nfunction start({ compressorLabel }: Settings): void {\n spinner.text = `Compressing file(s) ${formatCompressionMessage(\n \"...\",\n compressorLabel\n )}`;\n spinner.start();\n}\n\n/**\n * Stop spinner with success message\n */\nfunction stop({ compressorLabel, size, sizeGzip }: Result): void {\n spinner.text = [\n \"File(s) compressed successfully\",\n formatCompressionMessage(\"\", compressorLabel),\n `(${chalk.green(size)} minified,`,\n `${chalk.green(sizeGzip)} gzipped)`,\n ].join(\" \");\n spinner.succeed();\n}\n\n/**\n * Stop spinner with error message\n */\nfunction error({ compressorLabel }: Settings): void {\n spinner.text = `Error - file(s) not compressed ${formatCompressionMessage(\n \"\",\n compressorLabel\n )}`;\n spinner.fail();\n}\n\nexport { start as spinnerStart, stop as spinnerStop, error as spinnerError };\n","/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Compressor, Result, Settings } from \"@node-minify/types\";\nimport chalk from \"chalk\";\nimport { compress } from \"./compress.ts\";\nimport { AVAILABLE_MINIFIER } from \"./config.ts\";\nimport { spinnerError, spinnerStart, spinnerStop } from \"./spinner.ts\";\n\nexport type SettingsWithCompressor = Omit<Settings, \"compressor\"> & {\n compressor: (typeof AVAILABLE_MINIFIER)[number][\"name\"];\n};\n\n/**\n * Module variables.\n */\nlet silence = false;\n\n/**\n * Runs a single compression task using the compressor specified in the CLI settings.\n *\n * Loads and validates the requested compressor, constructs the runtime Settings object\n * (including parsed input, output, type, and options), executes compression, and\n * manages CLI spinner state when not silenced.\n *\n * @param cli - CLI settings identifying the compressor and its runtime options\n * @returns The compression Result produced by the compressor\n * @throws Error if the specified compressor is not found\n * @throws Error if the compressor implementation is missing or not a function\n * @throws Error if the compressor only supports CSS but a non-`css` type is provided\n */\nasync function runOne(cli: SettingsWithCompressor): Promise<Result> {\n // Find compressor\n const minifierDefinition = AVAILABLE_MINIFIER.find(\n (compressor) => compressor.name === cli.compressor\n );\n\n if (!minifierDefinition) {\n throw new Error(`Compressor '${cli.compressor}' not found.`);\n }\n\n // Load minifier implementation dynamically\n const minifierPackage = (await import(\n `@node-minify/${cli.compressor}`\n )) as Record<string, Compressor>;\n\n const minifierImplementation = minifierPackage[\n minifierDefinition.export\n ] as Compressor;\n\n if (\n !minifierImplementation ||\n typeof minifierImplementation !== \"function\"\n ) {\n throw new Error(\n `Invalid compressor implementation for '${cli.compressor}'.`\n );\n }\n\n if (\"cssOnly\" in minifierDefinition && cli.type && cli.type !== \"css\") {\n throw new Error(`${cli.compressor} only supports type 'css'`);\n }\n\n // Prepare settings\n const settings: Settings = {\n compressorLabel: cli.compressor,\n compressor: minifierImplementation,\n input: typeof cli.input === \"string\" ? cli.input.split(\",\") : cli.input,\n output: cli.output,\n ...(cli.type && { type: cli.type }),\n ...(cli.option && { options: JSON.parse(cli.option) }),\n };\n\n if (!silence) spinnerStart(settings);\n\n try {\n const result = await compress(settings);\n if (!silence) spinnerStop(result);\n return result;\n } catch (error) {\n if (!silence) spinnerError(settings);\n throw error;\n }\n}\n\n/**\n * Run cli.\n * @param cli Settings\n */\nexport async function run(cli: SettingsWithCompressor) {\n silence = !!cli.silence;\n\n if (!silence) {\n logMessage(\"INFO\", \"Starting compression...\", \"bgBlue\");\n }\n\n try {\n await runOne(cli);\n\n if (!silence) {\n logMessage(\"DONE\", \"Done!\", \"bgGreen\", \"green\");\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new Error(`Compression failed: ${errorMessage}`);\n }\n}\n\n// Helper function to handle consistent logging\nfunction logMessage(\n badge: \"INFO\" | \"DONE\",\n message: string,\n badgeColor: \"bgBlue\" | \"bgGreen\",\n messageColor?: \"green\"\n) {\n console.log(\"\");\n console.log(\n chalk[badgeColor].black(` ${badge} `),\n messageColor ? chalk[messageColor](message) : message\n );\n console.log(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,eAAe,SACX,SACe;AACf,KAAI;AACA,QAAM,OAAO,QAAQ;EAErB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EACxD;AAED,KAAI,CAAC,QAAS,OAAa,SAAS;AAEpC,KAAI;EACA,MAAM,SAAS,MAAM,SAAS,SAAS;AACvC,MAAI,CAAC,QAAS,MAAY,OAAO;AACjC,SAAO;UACFC,SAAO;AACZ,MAAI,CAAC,QAAS,OAAa,SAAS;AACpC,QAAMA;;;;;;;AAQd,eAAsB,IAAI,KAA6B;AACnD,WAAU,CAAC,CAAC,IAAI;AAEhB,KAAI,CAAC,QACD,YAAW,QAAQ,2BAA2B,SAAS;AAG3D,KAAI;AACA,QAAM,OAAO,IAAI;AAEjB,MAAI,CAAC,QACD,YAAW,QAAQ,SAAS,WAAW,QAAQ;UAE9CA,SAAO;EACZ,MAAM,eACFA,mBAAiB,QAAQA,QAAM,UAAU;AAC7C,QAAM,IAAI,MAAM,uBAAuB,eAAe;;;AAK9D,SAAS,WACL,OACA,SACA,YACA,cACF;AACE,SAAQ,IAAI,GAAG;AACf,SAAQ,IACJ,MAAM,YAAY,MAAM,IAAI,MAAM,GAAG,EACrC,eAAe,MAAM,cAAc,QAAQ,GAAG,QACjD;AACD,SAAQ,IAAI,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/cli",
3
- "version": "10.1.1",
3
+ "version": "10.2.0",
4
4
  "description": "CLI - command line interface for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "type": "module",
14
14
  "bin": {
15
- "node-minify": "dist/cli.js"
15
+ "node-minify": "dist/bin/cli.js"
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=20.0.0"
@@ -29,7 +29,6 @@
29
29
  },
30
30
  "sideEffects": false,
31
31
  "files": [
32
- "bin",
33
32
  "dist/**/*"
34
33
  ],
35
34
  "publishConfig": {
@@ -55,16 +54,26 @@
55
54
  "dev": "tsdown src/index.ts --watch"
56
55
  },
57
56
  "dependencies": {
58
- "@node-minify/core": "10.1.1",
59
- "@node-minify/utils": "10.1.1",
57
+ "@node-minify/core": "10.2.0",
58
+ "@node-minify/utils": "10.2.0",
60
59
  "chalk": "5.6.2",
61
60
  "commander": "14.0.2",
62
61
  "ora": "9.0.0",
63
62
  "update-notifier": "7.3.1"
64
63
  },
65
64
  "devDependencies": {
66
- "@node-minify/google-closure-compiler": "10.1.1",
67
- "@node-minify/types": "10.1.1",
68
- "@node-minify/yui": "10.1.1"
65
+ "@node-minify/clean-css": "10.2.0",
66
+ "@node-minify/cssnano": "10.2.0",
67
+ "@node-minify/csso": "10.2.0",
68
+ "@node-minify/esbuild": "10.2.0",
69
+ "@node-minify/google-closure-compiler": "10.2.0",
70
+ "@node-minify/jsonminify": "10.2.0",
71
+ "@node-minify/lightningcss": "10.2.0",
72
+ "@node-minify/oxc": "10.2.0",
73
+ "@node-minify/swc": "10.2.0",
74
+ "@node-minify/terser": "10.2.0",
75
+ "@node-minify/types": "10.2.0",
76
+ "@node-minify/uglify-js": "10.2.0",
77
+ "@node-minify/yui": "10.2.0"
69
78
  }
70
79
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-BMvwXoUW.js","names":["defaultResult: Result","error","settings: Settings","error"],"sources":["../src/compress.ts","../src/config.ts","../src/spinner.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport { minify } from \"@node-minify/core\";\nimport type { Result, Settings } from \"@node-minify/types\";\nimport {\n getFilesizeGzippedInBytes,\n getFilesizeInBytes,\n} from \"@node-minify/utils\";\n\n/**\n * Run compression.\n * @param options Settings\n */\nasync function compress(options: Settings): Promise<Result> {\n try {\n await minify(options);\n\n const defaultResult: Result = {\n compressorLabel: options.compressorLabel ?? \"\",\n size: \"0\",\n sizeGzip: \"0\",\n };\n\n // Return default result if output contains pattern, is an array, or is undefined\n // Arrays and $1 patterns produce multiple files, so we can't calculate a single size\n if (\n !options.output ||\n Array.isArray(options.output) ||\n options.output.includes(\"$1\")\n ) {\n return defaultResult;\n }\n\n // Get file sizes\n const sizeGzip = await getFilesizeGzippedInBytes(options.output);\n const size = getFilesizeInBytes(options.output);\n\n return {\n ...defaultResult,\n size,\n sizeGzip,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new Error(`Compression failed: ${errorMessage}`);\n }\n}\n\nexport { compress };\n","export const AVAILABLE_MINIFIER = [\n { name: \"babel-minify\", export: \"babelMinify\" },\n { name: \"csso\", export: \"csso\" },\n { name: \"google-closure-compiler\", export: \"gcc\" },\n { name: \"html-minifier\", export: \"htmlMinifier\" },\n { name: \"terser\", export: \"terser\" },\n { name: \"uglify-js\", export: \"uglifyJs\" },\n { name: \"uglify-es\", export: \"uglifyEs\" },\n { name: \"yui\", export: \"yui\" },\n] as const;\n","/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Result, Settings } from \"@node-minify/types\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\n\nconst spinner = ora();\n\n/**\n * Formats a compression message with the compressor label\n */\nfunction formatCompressionMessage(\n status: string,\n compressorLabel?: string\n): string {\n return `${status} with ${chalk.green(compressorLabel)}`;\n}\n\n/**\n * Start spinner for compression process\n */\nfunction start({ compressorLabel }: Settings): void {\n spinner.text = `Compressing file(s) ${formatCompressionMessage(\n \"...\",\n compressorLabel\n )}`;\n spinner.start();\n}\n\n/**\n * Stop spinner with success message\n */\nfunction stop({ compressorLabel, size, sizeGzip }: Result): void {\n spinner.text = [\n \"File(s) compressed successfully\",\n formatCompressionMessage(\"\", compressorLabel),\n `(${chalk.green(size)} minified,`,\n `${chalk.green(sizeGzip)} gzipped)`,\n ].join(\" \");\n spinner.succeed();\n}\n\n/**\n * Stop spinner with error message\n */\nfunction error({ compressorLabel }: Settings): void {\n spinner.text = `Error - file(s) not compressed ${formatCompressionMessage(\n \"\",\n compressorLabel\n )}`;\n spinner.fail();\n}\n\nexport { start as spinnerStart, stop as spinnerStop, error as spinnerError };\n","/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Compressor, Result, Settings } from \"@node-minify/types\";\nimport chalk from \"chalk\";\nimport { compress } from \"./compress.ts\";\nimport { AVAILABLE_MINIFIER } from \"./config.ts\";\nimport { spinnerError, spinnerStart, spinnerStop } from \"./spinner.ts\";\n\nexport type SettingsWithCompressor = Omit<Settings, \"compressor\"> & {\n compressor: (typeof AVAILABLE_MINIFIER)[number][\"name\"];\n};\n\n/**\n * Module variables.\n */\nlet silence = false;\n\n/**\n * Run one compressor.\n * @param cli Settings\n */\nasync function runOne(cli: SettingsWithCompressor): Promise<Result> {\n // Find compressor\n const minifierDefinition = AVAILABLE_MINIFIER.find(\n (compressor) => compressor.name === cli.compressor\n );\n\n if (!minifierDefinition) {\n throw new Error(`Compressor '${cli.compressor}' not found.`);\n }\n\n // Load minifier implementation dynamically\n const minifierPackage = (await import(\n `@node-minify/${cli.compressor}`\n )) as Record<string, Compressor>;\n\n const minifierImplementation = minifierPackage[\n minifierDefinition.export\n ] as Compressor;\n\n if (\n !minifierImplementation ||\n typeof minifierImplementation !== \"function\"\n ) {\n throw new Error(\n `Invalid compressor implementation for '${cli.compressor}'.`\n );\n }\n\n // Prepare settings\n const settings: Settings = {\n compressorLabel: cli.compressor,\n compressor: minifierImplementation,\n input: typeof cli.input === \"string\" ? cli.input.split(\",\") : cli.input,\n output: cli.output,\n ...(cli.option && { options: JSON.parse(cli.option) }),\n };\n\n if (!silence) spinnerStart(settings);\n\n try {\n const result = await compress(settings);\n if (!silence) spinnerStop(result);\n return result;\n } catch (error) {\n if (!silence) spinnerError(settings);\n throw error;\n }\n}\n\n/**\n * Run cli.\n * @param cli Settings\n */\nexport async function run(cli: SettingsWithCompressor) {\n silence = !!cli.silence;\n\n if (!silence) {\n logMessage(\"INFO\", \"Starting compression...\", \"bgBlue\");\n }\n\n try {\n await runOne(cli);\n\n if (!silence) {\n logMessage(\"DONE\", \"Done!\", \"bgGreen\", \"green\");\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new Error(`Compression failed: ${errorMessage}`);\n }\n}\n\n// Helper function to handle consistent logging\nfunction logMessage(\n badge: \"INFO\" | \"DONE\",\n message: string,\n badgeColor: \"bgBlue\" | \"bgGreen\",\n messageColor?: \"green\"\n) {\n console.log(\"\");\n console.log(\n chalk[badgeColor].black(` ${badge} `),\n messageColor ? chalk[messageColor](message) : message\n );\n console.log(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,eAAe,SAAS,SAAoC;AACxD,KAAI;AACA,QAAM,OAAO,QAAQ;EAErB,MAAMA,gBAAwB;GAC1B,iBAAiB,QAAQ,mBAAmB;GAC5C,MAAM;GACN,UAAU;GACb;AAID,MACI,CAAC,QAAQ,UACT,MAAM,QAAQ,QAAQ,OAAO,IAC7B,QAAQ,OAAO,SAAS,KAAK,CAE7B,QAAO;EAIX,MAAM,WAAW,MAAM,0BAA0B,QAAQ,OAAO;EAChE,MAAM,OAAO,mBAAmB,QAAQ,OAAO;AAE/C,SAAO;GACH,GAAG;GACH;GACA;GACH;UACIC,SAAO;EACZ,MAAM,eACFA,mBAAiB,QAAQA,QAAM,UAAU;AAC7C,QAAM,IAAI,MAAM,uBAAuB,eAAe;;;;;;ACpD9D,MAAa,qBAAqB;CAC9B;EAAE,MAAM;EAAgB,QAAQ;EAAe;CAC/C;EAAE,MAAM;EAAQ,QAAQ;EAAQ;CAChC;EAAE,MAAM;EAA2B,QAAQ;EAAO;CAClD;EAAE,MAAM;EAAiB,QAAQ;EAAgB;CACjD;EAAE,MAAM;EAAU,QAAQ;EAAU;CACpC;EAAE,MAAM;EAAa,QAAQ;EAAY;CACzC;EAAE,MAAM;EAAa,QAAQ;EAAY;CACzC;EAAE,MAAM;EAAO,QAAQ;EAAO;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