Change8

astro@6.0.0-beta.10

📦 astroView on GitHub →
4 features🐛 4 fixes🔧 11 symbols

Summary

This release introduces significant enhancements for integration authors, including custom prerendering logic via the Integration API and new utilities for handling remote image sizing and client assets during SSR. It also includes several bug fixes related to redirects, asset handling in SSR, and security improvements to the 'add' command.

Migration Steps

  1. If implementing a custom Image Service, consider implementing getRemoteSize() to optimize metadata retrieval.
  2. If developing an adapter, utilize setPrerenderer() in the astro:build:start hook to customize prerendering behavior.
  3. If developing an adapter that needs to collect static paths in a non-Node environment, use the StaticPaths class exported from astro:static-paths.
  4. Integration authors using SSR builds can use emitClientAsset from astro/assets/utils to ensure necessary assets are correctly placed for client-side availability.

✨ New Features

  • Adds an optional getRemoteSize() method to the Image Service API, allowing custom logic for retrieving remote image metadata, useful for caching or using provider APIs.
  • Updates the Integration API to add setPrerenderer() to the astro:build:start hook, enabling adapters to provide custom prerendering logic via an AstroPrerenderer object or factory function.
  • Adds the astro:static-paths virtual module, exporting a StaticPaths class for adapters to collect all prerenderable paths from within their target runtime.
  • Adds a new emitClientAsset function to astro/assets/utils for integration authors to emit assets that should be moved to the client directory during SSR builds.

🐛 Bug Fixes

  • Improves error message when a dynamic redirect destination does not match any existing route in static output mode, providing a clear error instead of a misleading "getStaticPaths required" error.
  • Fixes Astro.rewrite returning 404 when rewriting to a URL with non-ASCII characters by comparing encoded pathnames instead of mixing encoded and decoded paths.
  • Fixes an issue where the 'add' command could accept arbitrary values, leading to potential command injections; now restricts accepted values to valid npmjs.org names.
  • Fixes an issue where .sql files (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing runtime errors; ssrMoveAssets now checks the Vite manifest to only move actual client assets.

Affected Symbols