TriFrost

TriFrost 0.21.0

|peterver

News

This release brings a set of carefully crafted improvements born directly out of working on the TriFrost documentation.

As we refined the docs, we uncovered small inconsistencies, rough edges, and opportunities to make the developer experience even smoother. This update is the result of that hands-on process — tightening the middleware, expanding ergonomic options, and sharpening semantic clarity across the framework.

Improved

  • feat: Cors middleware now supports passing an array of origin strings (string[]), alongside the existing single string or dynamic function — making origin whitelisting simpler and less verbose.
app.use(Cors({
  origin: ['https://site1.com', 'https://site2.com']
}));
  • feat: The CacheControl middleware and corresponding cacheControl options on context responders now support proxyMaxage (letting you finely control how long shared caches (like CDNs) can store content).
  • feat: The CacheControl middleware and corresponding cacheControl options on context responders now support proxyRevalidate (forces shared caches to revalidate stale responses).
  • feat: The CacheControl middleware and corresponding cacheControl options on context responders now support mustRevalidate (signaling that stale content must be revalidated with the origin).
  • feat: The CacheControl middleware and corresponding cacheControl options on context responders now support immutable (marking responses as never changing — perfect for long-lived static assets).
app.use(CacheControl({
  type: 'public',
  maxage: 60,             // browsers: 1 min
  proxyMaxage: 600,       // CDNs: 10 min
  immutable: true,
  mustRevalidate: true,
  proxyRevalidate: true
}));
  • deps: Upgrade @cloudflare/workers-types to 4.20250531.0
  • deps: Upgrade @types/node to 22.15.29
  • deps: Upgrade eslint to 9.28.0

Breaking

  • The cache option on ctx.html, ctx.file, ctx.text, ctx.json has been renamed to cacheControl for better semantic clarity. Reflecting that it applies HTTP Cache-Control headers, not the internal cache storage system. This improves naming alignment and reduces confusion between storage-level caching and response-level caching.

Loved the read? Share it with others