Features
-
action,benchmark,cli,utils(#2966): Removed compressors (such asyui) now fail the same way everywhere, includingresolveCompressor, with one message naming the replacement. The benchmark now reports the resolver's actual error for a compressor it cannot load instead of "Compressor not found or not installed".@node-minify/utilsalso exports aCompressorNametype, andCOMPRESSOR_REGISTRYis now the single list of compressors, including the removed ones and their replacements:resolveCompressor(used by the CLI, the Action and the benchmark), the CLI's compressor list anddoctorall read it. -
esbuild,imagemin,lightningcss,sharp,svgo,swc,terser,uglify-js,utils(#2967): Every built-in compressor now reports a minification failure as<compressor> minification failed: <original message>, with the original error as itscause. Input checks that run before minifying keep their own messages, such as esbuild'sYou must specify a type: js or cssand sharp's and imagemin'srequires Buffer content.terser,esbuild,swc,lightningcss,uglify-js,svgo,sharpandimageminused to throw the library's error as it was or with their own wording (SVGO optimization failed:,Sharp conversion to webp failed:,Imagemin returned no output), so code that matched on that text or on the error's class (for exampleinstanceof SyntaxErrorfor lightningcss) should readerror.causeinstead.@node-minify/utilsalso exportsFileOperationErrorandValidationError, andwrapMinificationErrortakes an optionalcontextstring. -
cli,utils(#2968):csso,imageminanduglify-jsmove from the supported tier to the legacy tier, because they are removed in v12.node-minify doctornow warns that each is removed in v12 and names its replacement (lightningcssorcssnano,sharporsvgofor SVG, andterser), and the compressor list innode-minify --helpsays the same.jsonminifymoves from the legacy tier back to the supported tier, sodoctorno longer warns about it. All four keep working in v11, and nothing extra is printed when you run them. In@node-minify/utils,getCompressorsByStatusandCOMPRESSOR_REGISTRYreturn the new tiers, and a legacy entry with areplacementis removed in the next major version. -
sharp(#2969): Addgifas an output format, asformat: "gif"or insideformats. This gives@node-minify/imageminusers, which is removed in v12, a GIF path in v11. sharp re-encodes the image with libvips instead of optimizing the GIF losslessly like gifsicle, so output sizes differ from imagemin's. Animated GIFs keep all their frames.effort(1-10, default 7) is the only option that applies to GIF. Other output formats are unchanged. -
types,utils(#2970): Every export that v12 removes is now marked@deprecated, and editors show it struck through. All of them keep working exactly as in 11.0.x through v11, and none of them emits a new deprecation warning at runtime.Package Deprecated export Use instead @node-minify/utilsreadFile(every overload)readFileAsync@node-minify/utilswriteFilewriteFileAsync@node-minify/utilsgetContentFromFilesgetContentFromFilesAsync@node-minify/utilsisValidFileisValidFileAsync@node-minify/utilsdeleteFilefs.promises.unlink@node-minify/utilsgetSourceMapBooleanextractSourceMapOption@node-minify/utilstryResolveBuiltIn,tryResolveNpmPackage,tryResolveLocalFileresolveCompressor@node-minify/utilsgetKnownExportNamegetCompressorEntry(name)?.exportName, with the canonical name:getCompressorEntrydoes not resolve aliases, so"gcc"returnsundefinedand needs"google-closure-compiler"@node-minify/utilsisLocalPathnone ( resolveCompressoraccepts local paths)@node-minify/utilsvalidateMinifyResultnone ( runalready validates every compressor's result)@node-minify/utilsbuildArgs,toBuildArgsOptions,BuildArgsOptionsnone @node-minify/utilswarnDeprecation,resetDeprecationWarningsnone @node-minify/utilsWildcardOptions(the type of the object form of thewildcardssecond argument)none (pass the public folder as a string) @node-minify/utilsWildcardOptions.publicFolderpass the public folder as a string: wildcards(input, publicFolder)@node-minify/utilsWildcardOptions.ignorenone @node-minify/typesImageFormatnone @node-minify/typesSettings.option(the CLI's raw-Ostring)options(v12 moves the field to the CLI's own type)wildcardsitself is not deprecated, only its object form. These exports are removed in v12.
Fixes and internal changes
-
benchmark,cli,utils(#2965): Drop thegzip-sizeandchalkdependencies in favor of Node built-ins. Reported gzip and brotli sizes are unchanged (gzip still uses level 9, asgzip-sizedid), and so is terminal output, with two exceptions: the CLI now honorsNO_COLOR, and on Node 22.0–22.7 redirected CLI output can contain color codes (benchmark files written with--outputare still stripped). -
cssnano,minify-html,no-compress,oxc,utils(#2971): Internal cleanup with no change to output or reported sizes.cssnano,oxcandminify-htmlno longer runvalidateMinifyResulton their own result, becauserunalready validates it and the libraries always return a string.no-compressusesensureStringContent. Array content (several image files) now throwsno-compress compressor does not support array contentinstead ofno-compress failed: content must be a string or Buffer but received object.@node-minify/utilsbuilds only itsindexentry, because the package exports map only exposes.. The exported names are unchanged.- The gzip and brotli size helpers check the file with
isValidFileAsyncinstead of the deprecatedisValidFile.
-
benchmark,cli,core,sharp(#2972): Internal cleanup, no change to output.benchmarkmeasures each gzip and brotli size once instead of twice. The reported sizes are unchanged.cliprints the three compressor tiers in--helpfrom one loop. The text is unchanged from before this cleanup.corevalidates the entries of an arrayinputonce, insetup, instead of a second time before compressing.sharpno longer caches the lazily importedsharpmodule itself, because Node already does.
-
action(#2973): Internal cleanup, no change to behavior.- The explicit and auto modes share one per-file minify-and-measure step and one reporting sequence.
- The Action uses
DEFAULT_IGNORESfrom@node-minify/utilsinstead of its own copy. benchmark-compressorsis parsed with the same helper as the other comma-separated inputs.
-
benchmark,cli(#2974):benchmarkdetects the file type from each input file's extension whentypeis not given, sonode-minify benchmark src/app.js -c terser,esbuildno longer reports esbuild as failed withYou must specify a type: js or css..js .mjs .cjs .jsxgivejs,.cssgivescss,.html .htmgivehtml. An explicittypestill wins, and other extensions pass no type as before. Thebenchmark -thelp text says so.
All @node-minify/* packages are published at 11.1.0. Each package's CHANGELOG.md has its own entries.