@node-minify/uglify-es 10.3.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 +7 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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,12 +145,18 @@ 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;
|
|
153
|
+
/**
|
|
154
|
+
* Allow empty output without throwing an error.
|
|
155
|
+
* When true, if minification results in empty content, the output file will not be written.
|
|
156
|
+
* Useful for CSS files containing only comments that get stripped.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
allowEmptyOutput?: boolean;
|
|
170
160
|
};
|
|
171
161
|
/**
|
|
172
162
|
* Options passed to compressor functions internally.
|
|
@@ -177,7 +167,6 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
177
167
|
* The full settings object.
|
|
178
168
|
*/
|
|
179
169
|
settings: Settings<TOptions>;
|
|
180
|
-
|
|
181
170
|
/**
|
|
182
171
|
* The content to minify.
|
|
183
172
|
* For text-based formats (JS, CSS, HTML, SVG): string
|
|
@@ -185,7 +174,6 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
185
174
|
* For multiple binary files: Buffer[]
|
|
186
175
|
*/
|
|
187
176
|
content?: string | Buffer | Buffer[];
|
|
188
|
-
|
|
189
177
|
/**
|
|
190
178
|
* Index of current file when processing multiple files.
|
|
191
179
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["CompressorReturnType","ImageFormat","CompressorOutput","Buffer","CompressorResult","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","FileType","Settings","
|
|
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;;;AC5F3B;EDiGIO,eAAAA;EChGA;;;;;;EDwGAhB,OAAAA,YAAmBF,MAAAA;ECxGnB;;;;;;;;;EDmHAmB,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;;;;;iBCzBsB,QAAA,CAAA;EAClB,QAAA;EACA;AAAA,GACD,eAAA,GAAkB,OAAA,CAAQ,gBAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport type { CompressorResult, MinifierOptions } from \"@node-minify/types\";\nimport { ensureStringContent, warnDeprecation } from \"@node-minify/utils\";\nimport uglifyES from \"uglify-es\";\n\n/**\n * Minifies JavaScript content using uglify-es.\n *\n * @deprecated uglify-es is no longer maintained. Use @node-minify/terser instead.\n * @param settings - Minifier settings and uglify-es options\n * @param content - Input content to minify\n * @returns The minified code as `code` and the source map as `map` if produced\n * @throws The error produced by uglify-es when minification fails\n */\nexport async function uglifyEs({\n settings,\n content,\n}: MinifierOptions): Promise<CompressorResult> {\n const contentStr = ensureStringContent(content, \"uglify-es\");\n\n warnDeprecation(\n \"uglify-es\",\n \"uglify-es is no longer maintained. \" +\n \"Please migrate to @node-minify/terser for continued support and modern JavaScript features.\"\n );\n\n let inputContent: string | Record<string, string> = contentStr;\n const sourceMapOptions = settings.options?.sourceMap as\n | { filename?: string }\n | undefined;\n\n if (typeof sourceMapOptions === \"object\") {\n inputContent = {\n [sourceMapOptions.filename ?? \"\"]: contentStr,\n };\n }\n\n const result = uglifyES.minify(inputContent, settings.options);\n\n if (result.error) {\n throw result.error;\n }\n\n return {\n code: result.code,\n map: result.map,\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,eAAsB,SAAS,EAC3B,UACA,WAC2C;CAC3C,MAAM,aAAa,oBAAoB,SAAS,YAAY;AAE5D,iBACI,aACA,iIAEH;CAED,IAAI,eAAgD;CACpD,MAAM,mBAAmB,SAAS,SAAS;AAI3C,KAAI,OAAO,qBAAqB,SAC5B,gBAAe,GACV,iBAAiB,YAAY,KAAK,YACtC;CAGL,MAAM,SAAS,SAAS,OAAO,cAAc,SAAS,QAAQ;AAE9D,KAAI,OAAO,MACP,OAAM,OAAO;AAGjB,QAAO;EACH,MAAM,OAAO;EACb,KAAK,OAAO;EACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/uglify-es",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"deprecated": "uglify-es is no longer maintained. Please use @node-minify/terser instead.",
|
|
5
5
|
"description": "uglify-es plugin for @node-minify (DEPRECATED - use @node-minify/terser)",
|
|
6
6
|
"keywords": [
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"dev": "tsdown src/index.ts --watch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@node-minify/utils": "10.
|
|
56
|
+
"@node-minify/utils": "10.5.0",
|
|
57
57
|
"uglify-es": "3.3.9"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@node-minify/types": "10.
|
|
60
|
+
"@node-minify/types": "10.5.0",
|
|
61
61
|
"@types/uglify-es": "^3.0.3"
|
|
62
62
|
}
|
|
63
63
|
}
|