npm @node-minify/cssnano 11.1.0
v11.1.0

2 hours ago

Features

  • action, benchmark, cli, utils (#2966): Removed compressors (such as yui) now fail the same way everywhere, including resolveCompressor, 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/utils also exports a CompressorName type, and COMPRESSOR_REGISTRY is 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 and doctor all 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 its cause. Input checks that run before minifying keep their own messages, such as esbuild's You must specify a type: js or css and sharp's and imagemin's requires Buffer content. terser, esbuild, swc, lightningcss, uglify-js, svgo, sharp and imagemin used 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 example instanceof SyntaxError for lightningcss) should read error.cause instead. @node-minify/utils also exports FileOperationError and ValidationError, and wrapMinificationError takes an optional context string.

  • cli, utils (#2968): csso, imagemin and uglify-js move from the supported tier to the legacy tier, because they are removed in v12. node-minify doctor now warns that each is removed in v12 and names its replacement (lightningcss or cssnano, sharp or svgo for SVG, and terser), and the compressor list in node-minify --help says the same. jsonminify moves from the legacy tier back to the supported tier, so doctor no longer warns about it. All four keep working in v11, and nothing extra is printed when you run them. In @node-minify/utils, getCompressorsByStatus and COMPRESSOR_REGISTRY return the new tiers, and a legacy entry with a replacement is removed in the next major version.

  • sharp (#2969): Add gif as an output format, as format: "gif" or inside formats. This gives @node-minify/imagemin users, 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/utils readFile (every overload) readFileAsync
    @node-minify/utils writeFile writeFileAsync
    @node-minify/utils getContentFromFiles getContentFromFilesAsync
    @node-minify/utils isValidFile isValidFileAsync
    @node-minify/utils deleteFile fs.promises.unlink
    @node-minify/utils getSourceMapBoolean extractSourceMapOption
    @node-minify/utils tryResolveBuiltIn, tryResolveNpmPackage, tryResolveLocalFile resolveCompressor
    @node-minify/utils getKnownExportName getCompressorEntry(name)?.exportName, with the canonical name: getCompressorEntry does not resolve aliases, so "gcc" returns undefined and needs "google-closure-compiler"
    @node-minify/utils isLocalPath none (resolveCompressor accepts local paths)
    @node-minify/utils validateMinifyResult none (run already validates every compressor's result)
    @node-minify/utils buildArgs, toBuildArgsOptions, BuildArgsOptions none
    @node-minify/utils warnDeprecation, resetDeprecationWarnings none
    @node-minify/utils WildcardOptions (the type of the object form of the wildcards second argument) none (pass the public folder as a string)
    @node-minify/utils WildcardOptions.publicFolder pass the public folder as a string: wildcards(input, publicFolder)
    @node-minify/utils WildcardOptions.ignore none
    @node-minify/types ImageFormat none
    @node-minify/types Settings.option (the CLI's raw -O string) options (v12 moves the field to the CLI's own type)

    wildcards itself is not deprecated, only its object form. These exports are removed in v12.

Fixes and internal changes

  • benchmark, cli, utils (#2965): Drop the gzip-size and chalk dependencies in favor of Node built-ins. Reported gzip and brotli sizes are unchanged (gzip still uses level 9, as gzip-size did), and so is terminal output, with two exceptions: the CLI now honors NO_COLOR, and on Node 22.0–22.7 redirected CLI output can contain color codes (benchmark files written with --output are still stripped).

  • cssnano, minify-html, no-compress, oxc, utils (#2971): Internal cleanup with no change to output or reported sizes.

    • cssnano, oxc and minify-html no longer run validateMinifyResult on their own result, because run already validates it and the libraries always return a string.
    • no-compress uses ensureStringContent. Array content (several image files) now throws no-compress compressor does not support array content instead of no-compress failed: content must be a string or Buffer but received object.
    • @node-minify/utils builds only its index entry, because the package exports map only exposes .. The exported names are unchanged.
    • The gzip and brotli size helpers check the file with isValidFileAsync instead of the deprecated isValidFile.
  • benchmark, cli, core, sharp (#2972): Internal cleanup, no change to output.

    • benchmark measures each gzip and brotli size once instead of twice. The reported sizes are unchanged.
    • cli prints the three compressor tiers in --help from one loop. The text is unchanged from before this cleanup.
    • core validates the entries of an array input once, in setup, instead of a second time before compressing.
    • sharp no longer caches the lazily imported sharp module 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_IGNORES from @node-minify/utils instead of its own copy.
    • benchmark-compressors is parsed with the same helper as the other comma-separated inputs.
  • benchmark, cli (#2974): benchmark detects the file type from each input file's extension when type is not given, so node-minify benchmark src/app.js -c terser,esbuild no longer reports esbuild as failed with You must specify a type: js or css. .js .mjs .cjs .jsx give js, .css gives css, .html .htm give html. An explicit type still wins, and other extensions pass no type as before. The benchmark -t help text says so.


All @node-minify/* npm packages are published at 11.1.0, and the GitHub Action is released as v11.1.0. Each package's CHANGELOG.md has its own entries.

Don't miss a new cssnano release

NewReleases is sending notifications on new releases.