Releases: withastro/astro
Release list
astro@7.2.1
Patch Changes
-
#17612
7133730Thanks @thelazylamaGit! - Fixes CSS hot module replacement after navigating between pages withClientRouter -
#17628
4ada248Thanks @astrobot-houston! - Fixes a CSP violation when using bothsecurity.cspandexperimental.clientPrerenderwithdata-astro-prefetchlinks. 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 CSPscript-srcdirective at build time. -
#17605
89e4647Thanks @ashleigh-yeoman! - Fixes middleware HMR not responding to changes in imported modules. Previously, only direct edits to the middleware file would trigger a reload. -
#17582
bd2c1a5Thanks @astrobot-houston! - Fixes a regression where content collectionreference()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. -
#17661
97b0cc7Thanks @ArmandPhilippot! - Improves Markdown options documentation with links to the Markdown guide and official processors. -
#17349
4328c73Thanks @astrobot-houston! - Fixes an issue where requests handled by the dev prerender environment (e.g./_imagewith@astrojs/cloudflare'sprerenderEnvironment: '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 -
#17603
722eed6Thanks @astrobot-houston! - Fixes<video>and<audio>elements being non-functional after navigating via view transitions (<ClientRouter />) -
#17616
3a890d2Thanks @lazerg! - Fixesexperimental.incrementalBuildre-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. -
#17547
fba468cThanks @dmgawel! - ImprovesgetCollection()andgetEntry()performance for entries without local image references -
#17602
16e0d9dThanks @astrobot-houston! - Fixes a build error caused by hash collisions in generated content collection image import identifiers
@astrojs/underscore-redirects@1.0.4
Patch Changes
- #17620
0891ac9Thanks @astrobot-houston! - Fixes dynamic redirect routes to honour user-configured status codes instead of hardcoding 301. Previously, a redirect configured with{ destination: '/new', status: 302 }would be emitted as 301 in the_redirectsfile when the route was dynamic.
@astrojs/node@11.1.1
Patch Changes
- #17658
8b211a5Thanks @astrobot-houston! - Fixes an EventEmitter memory leak when serving static pages over keep-alive connections withstaticHeadersenabled and CSP (security.csp) active
@astrojs/netlify@8.2.1
Patch Changes
- Updated dependencies [
0891ac9]:- @astrojs/underscore-redirects@1.0.4
@astrojs/language-server@2.16.14
@astrojs/cloudflare@14.2.1
Patch Changes
-
#17627
ba6a9f6Thanks @astrobot-houston! - Fixes theastropeer dependency range from^7.0.0to^7.2.0. The adapter imports symbols (beginContentEntryCollection,beginImageCollection,endContentEntryCollection,endImageCollection) fromastro/appthat were added in Astro 7.2.0, so earlier versions fail at build time with aMISSING_EXPORTerror. -
Updated dependencies [
0891ac9]:- @astrojs/underscore-redirects@1.0.4
astro@7.2.0
Minor Changes
-
#17174
0224a3aThanks @matthewp! - Adds theastro preview --backgroundflag to start preview servers as background processes.This makes preview servers easier to manage from scripts and AI coding agents because the command returns after the server is ready instead of keeping the terminal attached to the long-running process.
astro preview --background
When a preview server is running in the background, you can inspect or stop it with new
astro previewsubcommands:astro preview status astro preview logs astro preview logs --follow astro preview stop
If Astro detects that
astro previewis being run by an AI coding agent, background mode is enabled automatically. This matches the existing behavior forastro dev, allowing agents to continue working after the preview server starts while still receiving the server URL and process ID.To opt out of automatic background mode for preview servers, set
ASTRO_PREVIEW_BACKGROUND=0before runningastro preview. -
#17532
7f94895Thanks @florian-lefebvre! - Adds support for paths relative to your project root inlogger.entrypointPreviously, pointing
logger.entrypointat a custom log handler living in your own project required building an absoluteURL. You can now write the path directly:// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ logger: { - entrypoint: new URL('./src/logger.js', import.meta.url), + entrypoint: './src/logger.js', }, });Paths starting with
./or../are resolved against your project root. Package specifiers such as@org/astro-logger, absolute paths, andURLentrypoints keep working as before. -
#17084
961bbe5Thanks @matthewp! - Widens theAstroPrerendererrender()return type so prerenderers can report incremental-build metadataA prerenderer's
render()may now resolve to either aResponse(as before) or aPrerenderResultobject that pairs the response with the content entries and optimized-image transforms the page resolved. This lets prerenderers that render out of process (for example, in an adapter's runtime like workerd) report those dependencies back to the build, so incremental static builds can track and replay them for skipped pages.import type { AstroPrerenderer, PrerenderResult } from 'astro'; const prerenderer: AstroPrerenderer = { name: 'my-adapter:prerenderer', getStaticPaths, async render(request, { routeData }): Promise<PrerenderResult> { const { response, metadata } = await renderInRuntime(request, routeData); return { response, metadata }; }, };
This is a non-breaking widening: prerenderers that return a bare
Responsecontinue to work unchanged, and in-process prerenderers can keep returning aResponsesince the build collects their metadata directly. -
#16871
90c98aeThanks @adamchal! - Addssession: falseinastro.configto opt out of session support. Projects that do not setsession: falsesee no behavior change.import { defineConfig } from 'astro/config'; export default defineConfig({ session: false, });
The session runtime and dependencies (
unstorage) are now tree-shaken out of the SSR bundle for any project where no session driver is wired via:session: false- no
sessionconfig at all - a
sessionconfig without a driver
Useful for serverless/edge runtimes where cold-start parse time is sensitive.
-
#17084
961bbe5Thanks @matthewp! - Adds experimental support for incremental static builds withexperimental.incrementalBuild.When enabled, Astro can skip regenerating static pages from dynamic routes when both the page's module dependencies and its data cache key are unchanged from the previous build. This currently applies to pages returned from
getStaticPaths()that include acacheKey.// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { incrementalBuild: true, }, });
Return a
cacheKeyfor each generated page fromgetStaticPaths():--- export async function getStaticPaths() { const posts = await fetchPosts(); return posts.map((post) => ({ params: { slug: post.slug }, props: { post }, cacheKey: post.digest, })); } ---
For incremental builds to skip rendering in CI, Astro's cache directory must be preserved between builds. Astro empties the output directory on each build and restores skipped pages from the cache directory, so only that directory needs to persist. For the default config, cache and restore
node_modules/.astro/before runningastro build.See the experimental incremental static builds documentation for more information.
-
#17084
961bbe5Thanks @matthewp! - Adds the optionaldigestproperty to content collection entries.Loaders can provide an opaque digest value that changes when an entry changes. This is now reflected in the
CollectionEntrytype returned bygetCollection()andgetEntry(), making it easier to detect content changes without re-hashing large entry bodies.--- import { getCollection } from 'astro:content'; const posts = await getCollection('blog'); for (const post of posts) { console.log(post.digest); } ---
The property is optional because not every loader provides a digest. See incremental static builds for how
digestcan be used as acacheKey.
Patch Changes
-
#17534
5a5337eThanks @florian-lefebvre! - Improveslogger.entrypointreference docs -
#17529
d52a787Thanks @QVinto! - Fixesastro devcrashing withInvalid URLwhen--hostis set to a specific non-loopback addressVite only reports a
localURL for loopback hosts. When the dev server was started with--host <custom-address>bound to a specific non-loopback address (a LAN or Tailscale IP, for example), the URL was reported undernetworkandlocalwas empty, so writing the dev lock file threwInvalid URLand killed a server that had already started successfully.The lock file URL now falls back to the network URL, and a server that exposes no URL at all is left untracked rather than being taken down by lock file bookkeeping.
-
#17566
296248cThanks @astrobot-houston! - FixesfontProviders.googleicons()returning the full icon font (~3.9MB) instead of only the requested glyphs when multipleexperimental.glyphsare specified -
#17560
ef45de1Thanks @astrobot-houston! - FixesAstro.url.pathnamefor non-index pages when usingbuild.format: 'preserve'. Previously, a page likesrc/pages/about-me.astrowould output todist/about-me.htmlbutAstro.url.pathnamewould incorrectly return/about-me/instead of/about-me.html. -
#17573
0089f83Thanks @astrobot-houston! - Fixes a Content Layer build crash that could occur when another dependency causes an older version ofneotraverseto be hoisted to the project root -
#17571
116f700Thanks @astrobot-houston! - Fixes cookies set viaAstro.cookies.set()inside a custom404.astroor500.astroerror page being silently dropped from the final response