Change8

astro@7.2.1

📦 astroView on GitHub →
🐛 9 fixes🔧 14 symbols

Summary

This patch release addresses several bugs including CSS hot module replacement, CSP violations, middleware HMR issues, and regressions in content collection referencing. It also improves performance for `getCollection()` and `getEntry()` and fixes build errors related to hash collisions.

🐛 Bug Fixes

  • Fixes CSS hot module replacement after navigating between pages with `ClientRouter`.
  • Fixes a CSP violation when using both `security.csp` and `experimental.clientPrerender` with `data-astro-prefetch` links. The dynamically injected `<script type="speculationrules">` now uses a static `"source": "document"` approach with a CSS selector, producing a deterministic payload that is hashed and included in the CSP `script-src` directive at build time.
  • Fixes middleware HMR not responding to changes in imported modules. Previously, only direct edits to the middleware file would trigger a reload.
  • Fixes a regression where content collection `reference()` fields silently accepted entry IDs that don't exist, such as an ID that doesn't match a loader's slugified version of it. Astro now logs an error for references that point to a missing entry after all loaders finish syncing.
  • Fixes an issue where requests handled by the dev prerender environment (e.g. `/_image` with `@astrojs/cloudflare`'s `prerenderEnvironment: 'node'`) returned a 500 when a prerendered catch-all route existed, because non-prerendered route modules were imported in an environment where their runtime-specific APIs are unavailable.
  • Fixes `<video>` and `<audio>` elements being non-functional after navigating via view transitions (`<ClientRouter />`).
  • Fixes `experimental.incrementalBuild` re-rendering unchanged routes that import more than one asset. The route's dependency hash depended on the order the assets finished building, so two builds of identical sources could produce different hashes. The hash is now based on the file name each asset resolves to.
  • Improves `getCollection()` and `getEntry()` performance for entries without local image references.
  • Fixes a build error caused by hash collisions in generated content collection image import identifiers.

Affected Symbols