@node-minify/core 10.4.0 → 10.5.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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  //#region ../types/src/types.d.ts
2
-
3
2
  /**
4
3
  * Output result for multi-format image compression.
5
4
  */
@@ -8,7 +7,6 @@ type CompressorOutput = {
8
7
  * Format of the output (e.g., 'webp', 'avif').
9
8
  */
10
9
  format?: string;
11
-
12
10
  /**
13
11
  * Output content as string or Buffer.
14
12
  */
@@ -22,19 +20,16 @@ type CompressorResult = {
22
20
  * Minified content as string (for text-based formats like JS, CSS, HTML, SVG).
23
21
  */
24
22
  code: string;
25
-
26
23
  /**
27
24
  * Source map (for JS/CSS compressors).
28
25
  */
29
26
  map?: string;
30
-
31
27
  /**
32
28
  * Minified content as Buffer (for binary formats like images).
33
29
  * @example
34
30
  * When using sharp for PNG/WebP compression
35
31
  */
36
32
  buffer?: Buffer;
37
-
38
33
  /**
39
34
  * Multiple outputs for multi-format image compression.
40
35
  * Used when converting to multiple formats simultaneously.
@@ -80,12 +75,10 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
80
75
  * The compressor function to use for minification.
81
76
  */
82
77
  compressor: Compressor<TOptions>;
83
-
84
78
  /**
85
79
  * Optional label for the compressor (used in logging).
86
80
  */
87
81
  compressorLabel?: string;
88
-
89
82
  /**
90
83
  * Content to minify (for in-memory minification).
91
84
  * If provided, input/output are not required.
@@ -93,7 +86,6 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
93
86
  * For binary formats (images): Buffer (handled internally by image compressors)
94
87
  */
95
88
  content?: string | Buffer;
96
-
97
89
  /**
98
90
  * Input file path(s) or glob pattern.
99
91
  * Can be a single file, array of files, or wildcard pattern.
@@ -104,7 +96,6 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
104
96
  * - 'src/**\/*.js'
105
97
  */
106
98
  input?: string | string[];
107
-
108
99
  /**
109
100
  * Output file path.
110
101
  * Use $1 as placeholder for input filename in multi-file scenarios.
@@ -116,43 +107,36 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
116
107
  * - '$1.min.js' (creates app.min.js from app.js)
117
108
  */
118
109
  output?: string | string[];
119
-
120
110
  /**
121
111
  * Compressor-specific options.
122
112
  * See individual compressor documentation for available options.
123
113
  */
124
114
  options?: TOptions;
125
-
126
115
  /**
127
116
  * CLI option string (used by CLI only).
128
117
  * @internal
129
118
  */
130
119
  option?: string;
131
-
132
120
  /**
133
121
  * Buffer size for file operations (in bytes).
134
122
  * @default 1024000 (1MB)
135
123
  */
136
124
  buffer?: number;
137
-
138
125
  /**
139
126
  * Timeout for the compressor process (in milliseconds).
140
127
  * If execution exceeds this limit, the process will be killed.
141
128
  */
142
129
  timeout?: number;
143
-
144
130
  /**
145
131
  * File type for compressors that support multiple types.
146
132
  * Required for YUI compressor.
147
133
  */
148
134
  type?: FileType;
149
-
150
135
  /**
151
136
  * Suppress console output.
152
137
  * @default false
153
138
  */
154
139
  silence?: boolean;
155
-
156
140
  /**
157
141
  * Public folder to prepend to input paths.
158
142
  *
@@ -161,13 +145,11 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
161
145
  * the actual path becomes 'public/js/app.js'
162
146
  */
163
147
  publicFolder?: string;
164
-
165
148
  /**
166
149
  * Replace files in place instead of creating new output files.
167
150
  * @default false
168
151
  */
169
152
  replaceInPlace?: boolean;
170
-
171
153
  /**
172
154
  * Allow empty output without throwing an error.
173
155
  * When true, if minification results in empty content, the output file will not be written.
@@ -185,7 +167,6 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
185
167
  * The full settings object.
186
168
  */
187
169
  settings: Settings<TOptions>;
188
-
189
170
  /**
190
171
  * The content to minify.
191
172
  * For text-based formats (JS, CSS, HTML, SVG): string
@@ -193,7 +174,6 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
193
174
  * For multiple binary files: Buffer[]
194
175
  */
195
176
  content?: string | Buffer | Buffer[];
196
-
197
177
  /**
198
178
  * Index of current file when processing multiple files.
199
179
  */
@@ -1 +1 @@
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/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 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 * Timeout for the compressor process (in milliseconds).\n * If execution exceeds this limit, the process will be killed.\n */\n timeout?: 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 * Allow empty output without throwing an error.\n * When true, if minification results in empty content, the output file will not be written.\n * Useful for CSS files containing only comments that get stripped.\n * @default false\n */\n allowEmptyOutput?: 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":";;;;;AAmOsC,KAtM1BE,gBAAAA,GAsM0B;;;;EC/MhB,MAAA,CAAA,EAAM,MAAA;;EAA+B;;;EAExD,OAAA,EAAA,MAAA,GDgBmBC,MChBnB;CAAO;;;;KDsBEC,gBAAAA;;;;;;;;;;;;;;;;WAgBCD;;;;;;;;YAQCD;;;;;;KAOFG,iBAAAA,GAAoBC;;;;;;KAOpBC,4BAA4BF,oBAAoBA,4BACjDI,gBAAgBD,cAAcE,QAAQN;;;;KAKrCO,QAAAA;;;;;;;;;;;;;;;;;;KAmBAC,0BAA0BP,oBAAoBA;;;;cAI1CE,WAAWC;;;;;;;;;;;;;qBAaJL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BTK;;;;;;;;;;;;;;;;;;;;;;;;SAwBHG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCCF,iCACSJ,oBAAoBA;;;;YAK3BO,SAASJ;;;;;;;;qBAQAL,SAASA;;;;;;;;;;;;AA3IhC;AAmBA;;AAA0DE,iBCvFpC,MDuFoCA,CAAAA,UCvFnB,iBDuFmBA,GCvFC,iBDuFDA,CAAAA,CAAAA,QAAAA,ECtF5C,QDsF4CA,CCtFnC,CDsFmCA,CAAAA,CAAAA,ECrFvD,ODqFuDA,CAAAA,MAAAA,CAAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["CompressorReturnType","ImageFormat","CompressorOutput","Buffer","format","content","CompressorResult","code","map","buffer","outputs","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","args","FileType","Settings","compressor","compressorLabel","input","output","options","option","timeout","type","silence","publicFolder","replaceInPlace","allowEmptyOutput","settings","index","Result","size","sizeGzip","MinifyOptions"],"sources":["../../types/src/types.d.ts","../src/index.ts"],"mappings":";;AAkFA;;KArDYE,gBAAAA;EAqD4BS;;;EAjDpCP,MAAAA;EAkDqCY;;;EA7CrCX,OAAAA,WAAkBF,MAAAA;AAAAA;;;;KAMVG,gBAAAA;EAuCqCA;;;EAnC7CC,IAAAA;;;;EAKAC,GAAAA;EAsDgBM;;;;;EA/ChBL,MAAAA,GAASN,MAAAA;EAqHFe;;;;;;EA7GPR,OAAAA,GAAUR,gBAAAA;AAAAA;;;;;KAOFS,iBAAAA,GAAoBC,MAAAA;;;;;;KAOpBC,UAAAA,kBAA4BF,iBAAAA,GAAoBA,iBAAAA,KACvDM,IAAAA,EAAMF,eAAAA,CAAgBD,QAAAA,MAAcE,OAAAA,CAAQV,gBAAAA;;;;KAKrCY,QAAAA;;;;;;;;;;;;;;;;;;KAmBAC,QAAAA,kBAA0BR,iBAAAA,GAAoBA,iBAAAA;EAwH1BR;;;EApH5BiB,UAAAA,EAAYP,UAAAA,CAAWC,QAAAA;;;AC3F3B;EDgGIO,eAAAA;EChGmC;;;;;;EDwGnChB,OAAAA,YAAmBF,MAAAA;ECxGgB;;;;;;;;;EDmHnCmB,KAAAA;;;;;;;;;;;EAYAC,MAAAA;;;;;EAMAC,OAAAA,GAAUV,QAAAA;;;;;EAMVW,MAAAA;;;;;EAMAhB,MAAAA;;;;;EAMAiB,OAAAA;;;;;EAMAC,IAAAA,GAAOT,QAAAA;;;;;EAMPU,OAAAA;;;;;;;;EASAC,YAAAA;;;;;EAMAC,cAAAA;;;;;;;EAQAC,gBAAAA;AAAAA;;;;;KAOQhB,eAAAA,kBACSJ,iBAAAA,GAAoBA,iBAAAA;;;;EAKrCqB,QAAAA,EAAUb,QAAAA,CAASL,QAAAA;;;;;;;EAQnBT,OAAAA,YAAmBF,MAAAA,GAASA,MAAAA;;;;EAK5B8B,KAAAA;AAAAA;;;;AA5LJ;;;;;iBCxBsB,MAAA,WAAiB,iBAAA,GAAoB,iBAAA,CAAA,CACvD,QAAA,EAAU,QAAA,CAAS,CAAA,IACpB,OAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { compressSingleFile, getContentFromFilesAsync, isImageFile, readFileAsync, run, setFileNameMin, setPublicFolder, wildcards } from "@node-minify/utils";
2
2
  import { mkdir } from "node:fs/promises";
3
+ import path from "node:path";
3
4
 
4
5
  //#region src/compress.ts
5
6
  /*!
@@ -55,14 +56,26 @@ async function createDirectory(filePath) {
55
56
  if (!filePath) return;
56
57
  const paths = Array.isArray(filePath) ? filePath : [filePath];
57
58
  const uniqueDirs = /* @__PURE__ */ new Set();
58
- for (const path of paths) {
59
- if (typeof path !== "string") continue;
60
- const dirPath = path.substring(0, path.lastIndexOf("/"));
59
+ for (const outputPath of paths) {
60
+ if (typeof outputPath !== "string") continue;
61
+ const dirPath = getDirectoryPath(outputPath);
61
62
  if (!dirPath) continue;
62
63
  uniqueDirs.add(dirPath);
63
64
  }
64
65
  await Promise.all(Array.from(uniqueDirs).map((dir) => mkdir(dir, { recursive: true })));
65
66
  }
67
+ /**
68
+ * Resolve the directory path from an output file path.
69
+ * @param outputPath Full path to the output file
70
+ * @returns A directory path when resolvable, or an empty string
71
+ */
72
+ function getDirectoryPath(outputPath) {
73
+ const dirPath = path.dirname(outputPath);
74
+ if (dirPath && dirPath !== ".") return dirPath;
75
+ const windowsDirPath = path.win32.dirname(outputPath);
76
+ if (windowsDirPath && windowsDirPath !== ".") return windowsDirPath;
77
+ return "";
78
+ }
66
79
 
67
80
  //#endregion
68
81
  //#region src/setup.ts
@@ -84,8 +97,8 @@ function setup(inputSettings) {
84
97
  ...structuredClone(defaultSettings),
85
98
  ...inputSettings
86
99
  };
87
- if (settings.content) {
88
- validateMandatoryFields(inputSettings, ["compressor", "content"]);
100
+ if (settings.content !== void 0) {
101
+ validateMandatoryFields(inputSettings, ["compressor"]);
89
102
  return settings;
90
103
  }
91
104
  validateMandatoryFields(inputSettings, [
@@ -115,7 +128,13 @@ function enhanceSettings(settings) {
115
128
  ...enhancedSettings,
116
129
  ...wildcards(enhancedSettings.input, enhancedSettings.publicFolder)
117
130
  };
118
- if (enhancedSettings.input && enhancedSettings.output && !Array.isArray(enhancedSettings.output)) enhancedSettings = {
131
+ const optionsWithFormats = enhancedSettings.options;
132
+ const shouldPreserveBareDollarOneOutput = enhancedSettings.output === "$1" && !enhancedSettings.publicFolder && !enhancedSettings.replaceInPlace && Array.isArray(optionsWithFormats?.formats) && optionsWithFormats.formats.length > 0;
133
+ if (Array.isArray(enhancedSettings.input) && shouldPreserveBareDollarOneOutput) enhancedSettings = {
134
+ ...enhancedSettings,
135
+ output: enhancedSettings.input.map((file) => setFileNameMin(file, "$1", void 0, true))
136
+ };
137
+ else if (enhancedSettings.input && enhancedSettings.output && !Array.isArray(enhancedSettings.output) && !shouldPreserveBareDollarOneOutput) enhancedSettings = {
119
138
  ...enhancedSettings,
120
139
  ...checkOutput(enhancedSettings.input, enhancedSettings.output, enhancedSettings.publicFolder, enhancedSettings.replaceInPlace)
121
140
  };
@@ -172,7 +191,7 @@ function mandatory(setting, settings) {
172
191
  */
173
192
  async function minify(settings) {
174
193
  const compressorSettings = setup(settings);
175
- return await (settings.content ? compressSingleFile : compress)(compressorSettings);
194
+ return await (compressorSettings.content !== void 0 ? compressSingleFile : compress)(compressorSettings);
176
195
  }
177
196
 
178
197
  //#endregion
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/compress.ts","../src/setup.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { mkdir } from \"node:fs/promises\";\n/**\n * Module dependencies.\n */\nimport type {\n CompressorOptions,\n MinifierOptions,\n Settings,\n} from \"@node-minify/types\";\nimport {\n compressSingleFile,\n getContentFromFilesAsync,\n isImageFile,\n readFileAsync,\n run,\n} from \"@node-minify/utils\";\n\n/**\n * Run the compressor using the provided settings.\n *\n * Validates settings when `output` is an array (requires `input` to be an array with the same length) and ensures target output directories exist before processing. Dispatches either multi-file or single-file compression based on `settings.output`.\n *\n * @param settings - Compression settings including `input`, `output`, and compressor-specific options\n * @returns The resulting compressed output string for a single output, or the last result produced when processing multiple outputs (or an empty string if no results were produced)\n * @throws Error - If `output` is an array but `input` is not, or if `input` and `output` arrays have differing lengths\n */\nexport async function compress<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n if (Array.isArray(settings.output)) {\n if (!Array.isArray(settings.input)) {\n throw new Error(\n \"When output is an array, input must also be an array\"\n );\n }\n if (settings.input.length !== settings.output.length) {\n throw new Error(\n `Input and output arrays must have the same length (input: ${settings.input.length}, output: ${settings.output.length})`\n );\n }\n }\n\n if (settings.output) {\n await createDirectory(settings.output);\n }\n\n // Handle array outputs (from user input or created internally by checkOutput when processing $1 pattern)\n if (Array.isArray(settings.output)) {\n return compressArrayOfFiles(settings);\n }\n\n return compressSingleFile(settings as Settings);\n}\n\n/**\n * Compress multiple input files specified in the settings.\n *\n * @param settings - Configuration object where `settings.input` and `settings.output` are arrays of equal length; each `settings.input[i]` is a file path to compress and corresponds to `settings.output[i]`.\n * @returns The result of the last compression task, or an empty string if no tasks ran.\n * @throws Error if any entry in `settings.input` is not a non-empty string.\n */\nasync function compressArrayOfFiles<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>): Promise<string> {\n const inputs = settings.input as string[];\n\n inputs.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\" ? \"empty string\" : typeof input\n }`\n );\n }\n });\n\n const compressionTasks = inputs.map(async (input, index) => {\n const content = isImageFile(input)\n ? await readFileAsync(input, true)\n : await getContentFromFilesAsync(input);\n return run({ settings, content, index } as MinifierOptions<T>);\n });\n\n const results = await Promise.all(compressionTasks);\n return results[results.length - 1] ?? \"\";\n}\n\n/**\n * Create folder of the target file.\n * @param filePath Full path of the file (can be string or array when $1 pattern is used)\n */\nasync function createDirectory(filePath: string | string[]) {\n // Early return if no file path provided\n if (!filePath) {\n return;\n }\n\n // Handle array (created internally by checkOutput when processing $1 pattern)\n const paths = Array.isArray(filePath) ? filePath : [filePath];\n const uniqueDirs = new Set<string>();\n\n for (const path of paths) {\n if (typeof path !== \"string\") {\n continue;\n }\n\n // Extract directory path\n const dirPath = path.substring(0, path.lastIndexOf(\"/\"));\n\n // Early return if no directory path\n if (!dirPath) {\n continue;\n }\n\n uniqueDirs.add(dirPath);\n }\n\n // Create directories in parallel\n await Promise.all(\n Array.from(uniqueDirs).map((dir) => mkdir(dir, { recursive: true }))\n );\n}\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { setFileNameMin, setPublicFolder, wildcards } from \"@node-minify/utils\";\n\n/**\n * Default settings.\n */\nconst defaultSettings: Partial<Settings> = {\n options: {},\n buffer: 1000 * 1024,\n};\n\n/**\n * Builds and validates the final Settings object by merging defaults with user input.\n *\n * @param inputSettings - User-provided settings that override defaults\n * @returns The validated and enhanced Settings object ready for use\n */\nfunction setup<T extends CompressorOptions = CompressorOptions>(\n inputSettings: Settings<T>\n): Settings<T> {\n const settings: Settings<T> = {\n ...structuredClone(defaultSettings),\n ...inputSettings,\n } as Settings<T>;\n\n // In memory\n if (settings.content) {\n validateMandatoryFields(inputSettings, [\"compressor\", \"content\"]);\n return settings;\n }\n\n validateMandatoryFields(inputSettings, [\"compressor\", \"input\", \"output\"]);\n\n if (Array.isArray(settings.input)) {\n settings.input.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\"\n ? \"empty string\"\n : typeof input\n }`\n );\n }\n });\n }\n\n return enhanceSettings(settings);\n}\n\n/**\n * Augments a Settings object with derived values and normalized path outputs.\n *\n * Enhancements performed when applicable:\n * - Expands input patterns into concrete input entries.\n * - Computes output paths when a single output string contains the `$1` placeholder, producing per-input outputs.\n * - Resolves and attaches public-folder-related values derived from input and publicFolder.\n *\n * @param settings - The initial settings to enhance\n * @returns The enhanced Settings object with derived inputs, outputs, and public-folder values applied\n */\nfunction enhanceSettings<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Settings<T> {\n let enhancedSettings = settings;\n\n if (enhancedSettings.input) {\n enhancedSettings = {\n ...enhancedSettings,\n ...wildcards(enhancedSettings.input, enhancedSettings.publicFolder),\n };\n }\n if (\n enhancedSettings.input &&\n enhancedSettings.output &&\n !Array.isArray(enhancedSettings.output)\n ) {\n enhancedSettings = {\n ...enhancedSettings,\n ...checkOutput(\n enhancedSettings.input,\n enhancedSettings.output,\n enhancedSettings.publicFolder,\n enhancedSettings.replaceInPlace\n ),\n };\n }\n if (enhancedSettings.input && enhancedSettings.publicFolder) {\n enhancedSettings = {\n ...enhancedSettings,\n ...setPublicFolder(\n enhancedSettings.input,\n enhancedSettings.publicFolder\n ),\n };\n }\n\n return enhancedSettings;\n}\n\n/**\n * Check the output path, searching for $1\n * if exist, returns the path replacing $1 by file name\n * @param input Path file\n * @param output Path to the output file\n * @param publicFolder Path to the public folder\n * @param replaceInPlace True to replace file in same folder\n * @returns Enhanced settings with processed output, or undefined if no processing needed\n */\nfunction checkOutput(\n input: string | string[],\n output: string | string[],\n publicFolder?: string,\n replaceInPlace?: boolean\n): { output: string | string[] } | undefined {\n // Arrays don't use the $1 placeholder pattern - they're handled directly in compress()\n if (Array.isArray(output)) {\n return undefined;\n }\n\n const PLACEHOLDER_PATTERN = /\\$1/;\n\n if (!PLACEHOLDER_PATTERN.test(output)) {\n return undefined;\n }\n\n const effectivePublicFolder = replaceInPlace ? undefined : publicFolder;\n\n // If array of files\n if (Array.isArray(input)) {\n const outputMin = input.map((file) =>\n setFileNameMin(file, output, effectivePublicFolder, replaceInPlace)\n );\n return { output: outputMin };\n }\n\n // Single file\n return {\n output: setFileNameMin(\n input,\n output,\n effectivePublicFolder,\n replaceInPlace\n ),\n };\n}\n\n/**\n * Ensure required settings are present and that `compressor` is a valid function.\n *\n * @param settings - Settings object to validate\n * @param fields - Names of required fields to check on `settings`\n * @throws Error if a required field is missing\n * @throws Error if `settings.compressor` is not a function\n */\nfunction validateMandatoryFields<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>, fields: string[]) {\n for (const field of fields) {\n mandatory(field, settings);\n }\n\n if (typeof settings.compressor !== \"function\") {\n throw new Error(\n \"compressor should be a function, maybe you forgot to install the compressor\"\n );\n }\n}\n\n/**\n * Check if the setting exists.\n * @param setting - Setting key to check\n * @param settings - Settings object\n */\nfunction mandatory(setting: string, settings: Record<string, unknown>) {\n if (!settings[setting]) {\n throw new Error(`${setting} is mandatory.`);\n }\n}\n\nexport { setup };\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { compressSingleFile } from \"@node-minify/utils\";\nimport { compress } from \"./compress.ts\";\nimport { setup } from \"./setup.ts\";\n\n/**\n * Minifies input according to the provided settings.\n *\n * @param settings - User-provided settings that specify the compressor, input/content, output and related options\n * @returns The minified content as a string\n */\nexport async function minify<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n const compressorSettings = setup(settings);\n const method = settings.content ? compressSingleFile : compress;\n return await method(compressorSettings);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,eAAsB,SAClB,UACe;AACf,KAAI,MAAM,QAAQ,SAAS,OAAO,EAAE;AAChC,MAAI,CAAC,MAAM,QAAQ,SAAS,MAAM,CAC9B,OAAM,IAAI,MACN,uDACH;AAEL,MAAI,SAAS,MAAM,WAAW,SAAS,OAAO,OAC1C,OAAM,IAAI,MACN,6DAA6D,SAAS,MAAM,OAAO,YAAY,SAAS,OAAO,OAAO,GACzH;;AAIT,KAAI,SAAS,OACT,OAAM,gBAAgB,SAAS,OAAO;AAI1C,KAAI,MAAM,QAAQ,SAAS,OAAO,CAC9B,QAAO,qBAAqB,SAAS;AAGzC,QAAO,mBAAmB,SAAqB;;;;;;;;;AAUnD,eAAe,qBAEb,UAAwC;CACtC,MAAM,SAAS,SAAS;AAExB,QAAO,SAAS,OAAO,UAAU;AAC7B,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MACN,0BAA0B,MAAM,mCAC5B,OAAO,UAAU,WAAW,iBAAiB,OAAO,QAE3D;GAEP;CAEF,MAAM,mBAAmB,OAAO,IAAI,OAAO,OAAO,UAAU;AAIxD,SAAO,IAAI;GAAE;GAAU,SAHP,YAAY,MAAM,GAC5B,MAAM,cAAc,OAAO,KAAK,GAChC,MAAM,yBAAyB,MAAM;GACX;GAAO,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BAAiB,SACjB,iBAAiB,UACjB,CAAC,MAAM,QAAQ,iBAAiB,OAAO,CAEvC,oBAAmB;EACf,GAAG;EACH,GAAG,YACC,iBAAiB,OACjB,iBAAiB,QACjB,iBAAiB,cACjB,iBAAiB,eACpB;EACJ;AAEL,KAAI,iBAAiB,SAAS,iBAAiB,aAC3C,oBAAmB;EACf,GAAG;EACH,GAAG,gBACC,iBAAiB,OACjB,iBAAiB,aACpB;EACJ;AAGL,QAAO;;;;;;;;;;;AAYX,SAAS,YACL,OACA,QACA,cACA,gBACyC;AAEzC,KAAI,MAAM,QAAQ,OAAO,CACrB;AAKJ,KAAI,CAFwB,MAEH,KAAK,OAAO,CACjC;CAGJ,MAAM,wBAAwB,iBAAiB,SAAY;AAG3D,KAAI,MAAM,QAAQ,MAAM,CAIpB,QAAO,EAAE,QAHS,MAAM,KAAK,SACzB,eAAe,MAAM,QAAQ,uBAAuB,eAAe,CACtE,EAC2B;AAIhC,QAAO,EACH,QAAQ,eACJ,OACA,QACA,uBACA,eACH,EACJ;;;;;;;;;;AAWL,SAAS,wBAEP,UAAuB,QAAkB;AACvC,MAAK,MAAM,SAAS,OAChB,WAAU,OAAO,SAAS;AAG9B,KAAI,OAAO,SAAS,eAAe,WAC/B,OAAM,IAAI,MACN,8EACH;;;;;;;AAST,SAAS,UAAU,SAAiB,UAAmC;AACnE,KAAI,CAAC,SAAS,SACV,OAAM,IAAI,MAAM,GAAG,QAAQ,gBAAgB;;;;;;;;;;;ACrKnD,eAAsB,OAClB,UACe;CACf,MAAM,qBAAqB,MAAM,SAAS;AAE1C,QAAO,OADQ,SAAS,UAAU,qBAAqB,UACnC,mBAAmB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/compress.ts","../src/setup.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n/**\n * Module dependencies.\n */\nimport type {\n CompressorOptions,\n MinifierOptions,\n Settings,\n} from \"@node-minify/types\";\nimport {\n compressSingleFile,\n getContentFromFilesAsync,\n isImageFile,\n readFileAsync,\n run,\n} from \"@node-minify/utils\";\n\n/**\n * Run the compressor using the provided settings.\n *\n * Validates settings when `output` is an array (requires `input` to be an array with the same length) and ensures target output directories exist before processing. Dispatches either multi-file or single-file compression based on `settings.output`.\n *\n * @param settings - Compression settings including `input`, `output`, and compressor-specific options\n * @returns The resulting compressed output string for a single output, or the last result produced when processing multiple outputs (or an empty string if no results were produced)\n * @throws Error - If `output` is an array but `input` is not, or if `input` and `output` arrays have differing lengths\n */\nexport async function compress<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n if (Array.isArray(settings.output)) {\n if (!Array.isArray(settings.input)) {\n throw new Error(\n \"When output is an array, input must also be an array\"\n );\n }\n if (settings.input.length !== settings.output.length) {\n throw new Error(\n `Input and output arrays must have the same length (input: ${settings.input.length}, output: ${settings.output.length})`\n );\n }\n }\n\n if (settings.output) {\n await createDirectory(settings.output);\n }\n\n // Handle array outputs (from user input or created internally by checkOutput when processing $1 pattern)\n if (Array.isArray(settings.output)) {\n return compressArrayOfFiles(settings);\n }\n\n return compressSingleFile(settings as Settings);\n}\n\n/**\n * Compress multiple input files specified in the settings.\n *\n * @param settings - Configuration object where `settings.input` and `settings.output` are arrays of equal length; each `settings.input[i]` is a file path to compress and corresponds to `settings.output[i]`.\n * @returns The result of the last compression task, or an empty string if no tasks ran.\n * @throws Error if any entry in `settings.input` is not a non-empty string.\n */\nasync function compressArrayOfFiles<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>): Promise<string> {\n const inputs = settings.input as string[];\n\n inputs.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\" ? \"empty string\" : typeof input\n }`\n );\n }\n });\n\n const compressionTasks = inputs.map(async (input, index) => {\n const content = isImageFile(input)\n ? await readFileAsync(input, true)\n : await getContentFromFilesAsync(input);\n return run({ settings, content, index } as MinifierOptions<T>);\n });\n\n const results = await Promise.all(compressionTasks);\n return results[results.length - 1] ?? \"\";\n}\n\n/**\n * Create folder of the target file.\n * @param filePath Full path of the file (can be string or array when $1 pattern is used)\n */\nasync function createDirectory(filePath: string | string[]) {\n // Early return if no file path provided\n if (!filePath) {\n return;\n }\n\n // Handle array (created internally by checkOutput when processing $1 pattern)\n const paths = Array.isArray(filePath) ? filePath : [filePath];\n const uniqueDirs = new Set<string>();\n\n for (const outputPath of paths) {\n if (typeof outputPath !== \"string\") {\n continue;\n }\n\n // Use platform dirname first, then fallback for Windows-style separators on POSIX.\n const dirPath = getDirectoryPath(outputPath);\n\n // Early return if no directory path\n if (!dirPath) {\n continue;\n }\n\n uniqueDirs.add(dirPath);\n }\n\n // Create directories in parallel\n await Promise.all(\n Array.from(uniqueDirs).map((dir) => mkdir(dir, { recursive: true }))\n );\n}\n\n/**\n * Resolve the directory path from an output file path.\n * @param outputPath Full path to the output file\n * @returns A directory path when resolvable, or an empty string\n */\nfunction getDirectoryPath(outputPath: string): string {\n const dirPath = path.dirname(outputPath);\n if (dirPath && dirPath !== \".\") {\n return dirPath;\n }\n\n const windowsDirPath = path.win32.dirname(outputPath);\n if (windowsDirPath && windowsDirPath !== \".\") {\n return windowsDirPath;\n }\n\n return \"\";\n}\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { setFileNameMin, setPublicFolder, wildcards } from \"@node-minify/utils\";\n\n/**\n * Default settings.\n */\nconst defaultSettings: Partial<Settings> = {\n options: {},\n buffer: 1000 * 1024,\n};\n\n/**\n * Builds and validates the final Settings object by merging defaults with user input.\n *\n * @param inputSettings - User-provided settings that override defaults\n * @returns The validated and enhanced Settings object ready for use\n */\nfunction setup<T extends CompressorOptions = CompressorOptions>(\n inputSettings: Settings<T>\n): Settings<T> {\n const settings: Settings<T> = {\n ...structuredClone(defaultSettings),\n ...inputSettings,\n } as Settings<T>;\n\n // In memory\n if (settings.content !== undefined) {\n validateMandatoryFields(inputSettings, [\"compressor\"]);\n return settings;\n }\n\n validateMandatoryFields(inputSettings, [\"compressor\", \"input\", \"output\"]);\n\n if (Array.isArray(settings.input)) {\n settings.input.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\"\n ? \"empty string\"\n : typeof input\n }`\n );\n }\n });\n }\n\n return enhanceSettings(settings);\n}\n\n/**\n * Augments a Settings object with derived values and normalized path outputs.\n *\n * Enhancements performed when applicable:\n * - Expands input patterns into concrete input entries.\n * - Computes output paths when a single output string contains the `$1` placeholder, producing per-input outputs.\n * - Resolves and attaches public-folder-related values derived from input and publicFolder.\n *\n * @param settings - The initial settings to enhance\n * @returns The enhanced Settings object with derived inputs, outputs, and public-folder values applied\n */\nfunction enhanceSettings<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Settings<T> {\n let enhancedSettings = settings;\n\n if (enhancedSettings.input) {\n enhancedSettings = {\n ...enhancedSettings,\n ...wildcards(enhancedSettings.input, enhancedSettings.publicFolder),\n };\n }\n const optionsWithFormats = enhancedSettings.options as\n | { formats?: unknown[] }\n | undefined;\n const shouldPreserveBareDollarOneOutput =\n enhancedSettings.output === \"$1\" &&\n !enhancedSettings.publicFolder &&\n !enhancedSettings.replaceInPlace &&\n Array.isArray(optionsWithFormats?.formats) &&\n optionsWithFormats.formats.length > 0;\n\n if (\n Array.isArray(enhancedSettings.input) &&\n shouldPreserveBareDollarOneOutput\n ) {\n enhancedSettings = {\n ...enhancedSettings,\n output: enhancedSettings.input.map((file) =>\n setFileNameMin(file, \"$1\", undefined, true)\n ),\n };\n } else if (\n enhancedSettings.input &&\n enhancedSettings.output &&\n !Array.isArray(enhancedSettings.output) &&\n !shouldPreserveBareDollarOneOutput\n ) {\n enhancedSettings = {\n ...enhancedSettings,\n ...checkOutput(\n enhancedSettings.input,\n enhancedSettings.output,\n enhancedSettings.publicFolder,\n enhancedSettings.replaceInPlace\n ),\n };\n }\n if (enhancedSettings.input && enhancedSettings.publicFolder) {\n enhancedSettings = {\n ...enhancedSettings,\n ...setPublicFolder(\n enhancedSettings.input,\n enhancedSettings.publicFolder\n ),\n };\n }\n\n return enhancedSettings;\n}\n\n/**\n * Check the output path, searching for $1\n * if exist, returns the path replacing $1 by file name\n * @param input Path file\n * @param output Path to the output file\n * @param publicFolder Path to the public folder\n * @param replaceInPlace True to replace file in same folder\n * @returns Enhanced settings with processed output, or undefined if no processing needed\n */\nfunction checkOutput(\n input: string | string[],\n output: string | string[],\n publicFolder?: string,\n replaceInPlace?: boolean\n): { output: string | string[] } | undefined {\n // Arrays don't use the $1 placeholder pattern - they're handled directly in compress()\n if (Array.isArray(output)) {\n return undefined;\n }\n\n const PLACEHOLDER_PATTERN = /\\$1/;\n\n if (!PLACEHOLDER_PATTERN.test(output)) {\n return undefined;\n }\n\n const effectivePublicFolder = replaceInPlace ? undefined : publicFolder;\n\n // If array of files\n if (Array.isArray(input)) {\n const outputMin = input.map((file) =>\n setFileNameMin(file, output, effectivePublicFolder, replaceInPlace)\n );\n return { output: outputMin };\n }\n\n // Single file\n return {\n output: setFileNameMin(\n input,\n output,\n effectivePublicFolder,\n replaceInPlace\n ),\n };\n}\n\n/**\n * Ensure required settings are present and that `compressor` is a valid function.\n *\n * @param settings - Settings object to validate\n * @param fields - Names of required fields to check on `settings`\n * @throws Error if a required field is missing\n * @throws Error if `settings.compressor` is not a function\n */\nfunction validateMandatoryFields<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>, fields: string[]) {\n for (const field of fields) {\n mandatory(field, settings);\n }\n\n if (typeof settings.compressor !== \"function\") {\n throw new Error(\n \"compressor should be a function, maybe you forgot to install the compressor\"\n );\n }\n}\n\n/**\n * Check if the setting exists.\n * @param setting - Setting key to check\n * @param settings - Settings object\n */\nfunction mandatory(setting: string, settings: Record<string, unknown>) {\n if (!settings[setting]) {\n throw new Error(`${setting} is mandatory.`);\n }\n}\n\nexport { setup };\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { compressSingleFile } from \"@node-minify/utils\";\nimport { compress } from \"./compress.ts\";\nimport { setup } from \"./setup.ts\";\n\n/**\n * Minifies input according to the provided settings.\n *\n * @param settings - User-provided settings that specify the compressor, input/content, output and related options\n * @returns The minified content as a string\n */\nexport async function minify<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n const compressorSettings = setup(settings);\n const method =\n compressorSettings.content !== undefined\n ? compressSingleFile\n : compress;\n return await method(compressorSettings);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,eAAsB,SAClB,UACe;AACf,KAAI,MAAM,QAAQ,SAAS,OAAO,EAAE;AAChC,MAAI,CAAC,MAAM,QAAQ,SAAS,MAAM,CAC9B,OAAM,IAAI,MACN,uDACH;AAEL,MAAI,SAAS,MAAM,WAAW,SAAS,OAAO,OAC1C,OAAM,IAAI,MACN,6DAA6D,SAAS,MAAM,OAAO,YAAY,SAAS,OAAO,OAAO,GACzH;;AAIT,KAAI,SAAS,OACT,OAAM,gBAAgB,SAAS,OAAO;AAI1C,KAAI,MAAM,QAAQ,SAAS,OAAO,CAC9B,QAAO,qBAAqB,SAAS;AAGzC,QAAO,mBAAmB,SAAqB;;;;;;;;;AAUnD,eAAe,qBAEb,UAAwC;CACtC,MAAM,SAAS,SAAS;AAExB,QAAO,SAAS,OAAO,UAAU;AAC7B,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MACN,0BAA0B,MAAM,mCAC5B,OAAO,UAAU,WAAW,iBAAiB,OAAO,QAE3D;GAEP;CAE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AAuB,eAAe,CACtE,EAC2B;AAIhC,QAAO,EACH,QAAQ,eACJ,OACA,QACA,uBACA,eACH,EACJ;;;;;;;;;;AAWL,SAAS,wBAEP,UAAuB,QAAkB;AACvC,MAAK,MAAM,SAAS,OAChB,WAAU,OAAO,SAAS;AAG9B,KAAI,OAAO,SAAS,eAAe,WAC/B,OAAM,IAAI,MACN,8EACH;;;;;;;AAST,SAAS,UAAU,SAAiB,UAAmC;AACnE,KAAI,CAAC,SAAS,SACV,OAAM,IAAI,MAAM,GAAG,QAAQ,gBAAgB;;;;;;;;;;;AC1LnD,eAAsB,OAClB,UACe;CACf,MAAM,qBAAqB,MAAM,SAAS;AAK1C,QAAO,OAHH,mBAAmB,YAAY,SACzB,qBACA,UACU,mBAAmB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/core",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "description": "core of @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -51,9 +51,9 @@
51
51
  "dev": "tsdown src/index.ts --watch"
52
52
  },
53
53
  "dependencies": {
54
- "@node-minify/utils": "10.4.0"
54
+ "@node-minify/utils": "10.5.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@node-minify/types": "10.4.0"
57
+ "@node-minify/types": "10.5.0"
58
58
  }
59
59
  }