Change8

astro@6.2.0

📦 astroView on GitHub →
4 features🐛 1 fixes1 deprecations🔧 18 symbols

Summary

This release introduces experimental features for configurable logging and SVG optimization, alongside improvements for adapter compatibility and HTML compression options. A new helper function was added for resolving font file URLs in advanced asset usage scenarios.

Migration Steps

  1. If you were using the `svgo` experimental flag, remove it and enable `svgOptimizer` using `svgoOptimizer()` in `astro.config.mjs`:
  2. If using the Fonts API for resolving font file URLs (e.g., with Satori), replace logic that fetches font data based on `fontData` paths with the new `experimental_getFontFileURL(fontPath, context.url)` helper function.

✨ New Features

  • Added a `waitUntil` option to `RenderOptions` allowing adapters to forward runtime background-task hooks to Astro, enabling background cache work like stale-while-revalidate.
  • Added support for a new 'jsx' value for the `compressHTML` option, which strips whitespace using JSX rules instead of default HTML compression.
  • Added experimental support for configurable log handlers, allowing users to replace the default console output with custom implementations (e.g., JSON logging).
  • Added experimental support for `svgOptimizer` flag to enable automatic optimization of SVG components using a provided optimizer (like SVGO).

🐛 Bug Fixes

  • Ensured that `server.allowedHosts` (and `vite.preview.allowedHosts`) configuration is respected when using `astro preview` with the `@astrojs/cloudflare` adapter to prevent DNS rebinding attacks during local preview.

Affected Symbols

⚡ Deprecations

  • The `svgo` experimental flag is removed and superseded by `svgOptimizer`.