Skip to content

v5.0.0

Choose a tag to compare

@Shazwazza Shazwazza released this 22 Sep 19:03
· 5 commits to develop since this release
2a07c0e

Smidge 5 is a major release focused on simplifying the minification pipeline, modernizing the runtime, and hardening bundle handling against a class of intermittent production crashes.

Highlights

  • NUglify is now the only minifier. The hand-rolled JsMinifier/CssMinifier (JSMin/CSSMin) are gone, and the previously-optional Smidge.Nuglify package is folded directly into the core Smidge package. AddSmidge()/UseSmidge() now use NUglify out of the box, including the source-map (nmap) route.
  • Retargeted to .NET 10 and moved from MVC controllers to lightweight ASP.NET Core minimal API endpoints, dropping the MVC dependency entirely.
  • Graceful 404s instead of 500s. The composite-file and source-map endpoints now use a non-throwing file lookup, so missing, stale, or spoofed cache entries return a clean 404 rather than an unhandled exception. This closes a repeatable DoS vector (#199) and also fixes a source-map parsing crash (#176).
  • Merged Smidge.Core into Smidge to simplify the package layout for the major version.

Breaking changes

  • The Smidge.Core assembly no longer exists; its types now live in Smidge.
  • Smidge.Nuglify is obsolete - reference Smidge directly. AddSmidgeNuglify()/UseSmidgeNuglify() are gone.
  • Several previously-public MVC handler/filter types are now internal, since they're no longer part of the supported API surface.
  • Bundle.Files is now IReadOnlyList<IWebFile> instead of a mutable List<IWebFile> (see thread-safety fix below). Use Bundle.AddFile(IWebFile) to add files.

Bug fixes

  • Fixed a NullReferenceException crash in bundle file-set generation (#156, #205) caused by a genuine race condition: concurrent requests registering files into the same bundle could corrupt its backing List<IWebFile>, silently dropping or nulling entries. Bundles now use an immutable, lock-free file list (ImmutableList<IWebFile> + ImmutableInterlocked.Update) so concurrent registration can no longer corrupt a bundle's file list, and a null entry is now defensively skipped with a warning rather than crashing the whole bundle response.
  • Fixed directory bundles pulling in wrong-type files (#225) - a bundle pointed at a bare folder (e.g. ~/Js/Bundle2) no longer accidentally includes generated artifacts like .js.gz or .map files; matching is now constrained to the bundle's file type.
  • Fixed recursive glob patterns (**.ext / **/*.ext) not matching correctly for non-physical file providers, satisfying the long-standing globbing request in #197. (Glob patterns already worked for the common PhysicalFileProvider case via .NET's built-in file globbing; this closes the gap for composite/embedded file providers.)
  • Fixed a source-map request crash (Could not parse ... as a valid smidge path) that surfaced as an unhandled 500 (#176).

Improvements

  • Cache-buster mismatch warnings now include the server's expected value alongside the rejected one, making it much easier to tell a benign stale-cache/post-deploy hiccup apart from an actual spoofing attempt (#219).
  • BundleManager.Create(...) now filters out null file entries at bundle-creation time (with a warning), in addition to the defensive handling already in place during file-set generation.
  • Dependencies bumped to their latest stable versions across the board (Microsoft.Extensions.*, xunit, Moq, Microsoft.NET.Test.Sdk, SourceLink, and the sample project's uglify-js).
  • Switched the build/release versioning from GitVersion to MinVer.

Full Changelog

v4.6.0...v5.0.0