astro
7.4.13 · 18 Nov 2026MIT12.5M / weekRepositoryHomepagenpmAtom feed
7.4.13 is the newest release of 7.x.
In short
8 breaking1 removed6 new13 fixed1 internal
- Breaking
Upgrade to Vite v8
- Breaking
Makes
'jsx'the default value forcompressHTML - Breaking
Adds background dev server management for AI coding agents.
- Breaking
Removes the
@astrojs/dbpackage as it is no longer maintained. - Breaking
Replaces the Go compiler with a Rust-based version.
- Breaking
Makes Sätteri the default Markdown processor
- Breaking
Enables advanced routing by default.
- Breaking
Removes deprecated APIs exported from
astro:transitions.
Security
9 advisories affect 7.0.0; 7.4.7 fixes them
- CriticalAstro: Remote code execution through AVIF image optimizationGHSA-26w7-cxv4-gfx2 · 8 Sep 2026Fixed in 7.2.8
- ModerateAstro: Image endpoint in @astrojs/node can read files from a case-variant sibling of the output directory on case-sensitive filesystemsGHSA-r3h5-4585-7x3w · 13 Nov 2026Fixed in 7.4.7
- ModerateAstro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX renderingGHSA-98hj-9722-w3j8 · 22 Oct 2026Fixed in 7.3.2
- ModerateAstro: Authorization bypass from missing path-segment boundary check when stripping the configured baseGHSA-376h-93r7-7g6f · 8 Sep 2026Fixed in 7.2.4
- ModerateAstro: composable `astro/hono` pipeline bypasses `security.checkOrigin` when `middleware()` is absent or misorderedGHSA-8mv7-9c27-98vc · 20 Jul 2026Fixed in 7.0.6
4 more
- ModerateAstro: XSS via unescaped spread attribute names in renderHTMLElement (incomplete fix for CVE-2026-54298)GHSA-f48w-9m4c-m7f5 · 20 Jul 2026Fixed in 7.0.6
- ModerateAstro: Reflected XSS via unescaped View Transition animation propertiesGHSA-4g3v-8h47-v7g6 · 20 Jul 2026Fixed in 7.1.0
- LowAstro: XSS via attribute injection in dynamic tag namesGHSA-mh32-jxcr-mh9f · 13 Nov 2026Fixed in 7.4.5
- LowAstro: Cross-site scripting via unescaped transition:* directive values on hydrated islandsGHSA-7pw4-f3q4-r2p2 · 20 Jul 2026Fixed in 7.0.4
Release note
Major Changes
- Breaking
Upgrade to Vite v8
- Breaking
Makes
'jsx'the default value forcompressHTMLAstro now strips whitespace from your HTML using JSX rules by default, the same way frameworks like React do. Whitespace and line breaks around elements are removed, but meaningful whitespace within a single line — like a space between two inline elements — is preserved. To keep a space that would otherwise be removed, write it explicitly in your source, for example with
{" "}.This can change rendered output where whitespace between inline elements was previously meaningful. To keep Astro's earlier behavior, set
compressHTML: truefor HTML-aware compression, orcompressHTML: falseto preserve all whitespace. - Breaking
Adds background dev server management for AI coding agents.
When an AI coding agent is detected,
astro devnow automatically starts the dev server as a detached background process. This prevents the dev server from blocking the agent's terminal and allows it to continue working while the server runs.A lock file (
.astro/dev.json) is written when the dev server starts, recording the server's URL, port, and PID. This prevents duplicate servers from being started for the same project.
New flag and subcommands
- `astro dev --background` — Start the dev server as a background process (this is what runs automatically when an agent is detected). - `astro dev stop` — Stop a running background dev server. - `astro dev status` — Check if a dev server is running and display its URL, PID, and uptime. - `astro dev logs` — View logs from a background dev server. Use `--follow` (`-f`) to stream new output as it's written. These allow you to start and manage dev servers programmatically and were designed with AI coding agents in mind.
What should I do?
No action is required. If you are not using an AI coding agent, `astro dev` behaves exactly as before. If you are using an agent, background mode is enabled automatically — the agent will receive the server URL and PID, and can use `astro dev stop` to shut it down. To opt out of automatic background mode when an agent is detected, set the environment variable `ASTRO_DEV_BACKGROUND=0` before running `astro dev`.
- Breaking
Removes the
@astrojs/dbpackage as it is no longer maintained.The
@astrojs/dbpackage were deprecated in v6.4.5 and is now removed. This means theastro db,astro login,astro logout,astro link, andastro initCLI commands have also been removed.If you were using Astro DB in your project, remove
@astrojs/dbfrom your project's dependencies and replace it with one of the following alternatives:Node.js built-in SQLite: Node.js now includes a built-in
node:sqlitemodule (available since Node.js v22.5.0). This is a good option if you are using the Node.js adapter and were using@astrojs/dbfor local SQLite storage.Drizzle ORM: If you were using
@astrojs/dbfor its Drizzle-based schema and query API, you can use Drizzle directly with any supported database.Other database libraries: Use any database library that suits your deployment platform (e.g. Turso, PlanetScale, Neon).
- Breaking
Replaces the Go compiler with a Rust-based version.
The Rust-based Astro compiler (
@astrojs/compiler-rs) is now the default compiler. This new compiler is faster and more reliable, leading to faster build times and iteration cycles during development.This new compiler is more strict regarding invalid syntax. For example, unclosed HTML tags will now throw an error instead of being ignored. It also does not attempt to correct semantically invalid HTML anymore, instead leaving it to the browser to handle, similar to other tools or
document.write()in JavaScript.The previous Go-based compiler has been removed, along with the
experimental.rustCompilerflag used to opt into the Rust compiler. If you were settingexperimental.rustCompilerin yourastro.config.mjs, you can now remove it. No other action is required. - Breaking
Makes Sätteri the default Markdown processor
Astro now renders
.mdfiles withsatteri()from@astrojs/markdown-satteri, its native Markdown pipeline, instead of the remark/rehype pipeline.@astrojs/markdown-remarkis no longer installed by default.To keep using the remark/rehype pipeline, install
@astrojs/markdown-remarkand set it as your processor:// astro.config.mjs import { defineConfig } from 'astro/config'; import { unified } from '@astrojs/markdown-remark'; export default defineConfig({ markdown: { processor: unified(), }, });The deprecated
markdown.remarkPlugins,markdown.rehypePlugins, andmarkdown.remarkRehypeoptions still work, but now require@astrojs/markdown-remarkto be used. - Breaking
Enables advanced routing by default.
The advanced routing feature introduced behind a flag in v6.3.0 is no longer experimental and is now enabled by default.
This gives full control over how requests flow through your application, with first-class support for frameworks like Hono.
Advanced routing now uses
src/fetch.tsas default entrypoint instead ofsrc/app.ts.If you were previously using this feature without a custom entrypoint, please configure
fetchFileor rename your entrypoint tosrc/fetch.ts, and then remove the experimental flag from your Astro config:import { defineConfig } from 'astro/config'; export default defineConfig({ experimental { - advancedRouting: true, }, + fetchFile: 'app.ts' // optional, you only need this if you cannot rename your entrypoint. });fetchFileis now a top-level config option instead of being nested underexperimental.advancedRouting. If you were using a custom entrypoint, please update your Astro config to move its configuration:// astro.config.mjs export default defineConfig({ - experimental: { - advancedRouting: { - fetchFile: 'my-custom-entrypoint.ts', - }, - }, + fetchFile: 'my-custom-entrypoint.ts', })You can also set
fetchFile: nullto disable the entrypoint if you are usingsrc/fetch.tsfor another purpose, or don’t need advanced routing features.If you have been waiting for stabilization before using advanced routing, you can now do so.
Please see the advanced routing guide in docs for more about this feature.
- Breaking
Removes deprecated APIs exported from
astro:transitions.In Astro 6.x, some helpers available in
astro:transitionsandastro:transitions/clientwere deprecated.In Astro 7.0, the following APIs can no longer be used in your project:
TRANSITION_BEFORE_PREPARATIONTRANSITION_AFTER_PREPARATIONTRANSITION_BEFORE_SWAPTRANSITION_AFTER_SWAPTRANSITION_PAGE_LOADisTransitionBeforePreparationEvent()isTransitionBeforeSwapEvent()createAnimationScope()
What should I do?
Remove any occurrence of `createAnimationScope()`:
```diff
-import { createAnimationScope } from 'astro:transitions';
```
Replace any occurrence of the other APIs using the lifecycle event names directly:
```diff
-import {
- TRANSITION_AFTER_SWAP,
- isTransitionBeforePreparationEvent,
-} from 'astro:transitions/client';
-console.log(isTransitionBeforePreparationEvent(event));
+console.log(event.type === 'astro:before-preparation');
-console.log(TRANSITION_AFTER_SWAP);
+console.log('astro:after-swap');
```
Learn more about all utilities available in the [View Transitions Router API Reference](https://docs.astro.build/en/reference/modules/astro-transitions/).Minor Changes
Exposes
getFetchState()fromastro/honoas a public APIThe
getFetchState()function retrieves or lazily creates aFetchStatefrom a Hono context object. This allows third-party packages to build Hono middleware that interacts with Astro's per-request state, giving theastro/honoAPI the same extensibility asastro/fetch.import { Hono } from 'hono'; import { getFetchState, pages } from 'astro/hono'; const app = new Hono(); app.use(async (context, next) => { const state = getFetchState(context); state.locals.message = 'Hello from custom middleware'; await next(); }); app.use(pages()); export default app;Adds a
subsetfield to theFontDatatype exposed viafontDatafromastro:assets. When using multiple font subsets (e.g.,subsets: ["latin", "korean"]), each font data entry now includes the subset name, making it possible to distinguish between font entries for different subsets that share the same weight and style.The custom logger feature introduced behind a flag in v6.2.0 is no longer experimental and is available for general use.
This feature provides better control over Astro's logging infrastructure by allowing you to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for on-demand rendering when connecting to log aggregation services such as Kibana, Logstash, CloudWatch, Grafana, or Loki.
Astro provides three built-in log handlers (
json,node, andconsole), and you can also create your own.
JSON logging
```js
import { defineConfig, logHandlers } from 'astro/config';
export default defineConfig({
logger: logHandlers.json({
pretty: true,
level: 'warn',
}),
});
```Custom logger
```js
import { defineConfig } from 'astro/config';
export default defineConfig({
logger: {
entrypoint: '@org/custom-logger',
},
});
```
Additionally, `context.logger` is now always available in API routes and middleware, even without a custom logger configured.
If you were previously using this feature, please remove the experimental flag from your Astro config:
```diff
import { defineConfig } from 'astro/config';
export default defineConfig({
- experimental: {
- logger: {
- entrypoint: '@org/custom-logger',
- },
- },
+ logger: {
+ entrypoint: '@org/custom-logger',
+ },
});
```
If you have been waiting for stabilization before using custom loggers, you can now do so.
Please see the [Logger docs](https://docs.astro.build/en/reference/configuration-reference/#logger) for more about this feature.Removes the setting
experimental.queuedRendering. The new rendering engine is now stable and replaces the old one.As part of the stabilization, the queued rendering has been improved, and some features have been removed:
The construction of the queue has been removed, instead now Astro uses a streaming approach where components are rendered and flushed as they are encountered.
The node polling feature has been removed because it doesn't yield concrete savings.
The content cache has been descoped, and how only tag names are cached.
If you were previously using this experimental feature, you must remove this experimental flag from your configuration as it no longer exists:
// astro.config.mjs import { defineConfig } from "astro/config"; export default defineConfig({ experimental: { - queuedRendering: {} } });Stabilizes route caching, removing the
experimental.cacheandexperimental.routeRulesflags and replacing them with the top-levelcacheandrouteRulesconfiguration options.Route caching, introduced experimentally in v6.0.0, is now stable. It gives you a platform-agnostic way to cache responses from on-demand rendered pages and endpoints, based on standard HTTP caching semantics.
Update your config to move
cacheandrouteRulesout of theexperimentalblock:// astro.config.mjs import { defineConfig, memoryCache } from 'astro/config'; export default defineConfig({ - experimental: { - cache: { - provider: memoryCache(), - }, - routeRules: { - '/blog/[...path]': { maxAge: 300, swr: 60 }, - }, - }, + cache: { + provider: memoryCache(), + }, + routeRules: { + '/blog/[...path]': { maxAge: 300, swr: 60 }, + }, });Set caching directives in your routes with
Astro.cache(in.astropages) orcontext.cache(in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your configured cache provider. You can also define cache rules for routes declaratively in your config usingrouteRules, without modifying route code.See the route caching guide for more information.
Patch Changes
- Removed
Removes
state.provide(),state.resolve(),state.finalizeAll(), andApp.Providersfrom the public advanced routing API. These context provider extension points are now internal-only. If you were using them in an integration, uselocalsto share per-request state instead. Harden the limits on the number of decoding on the URL.
Improves the warning when accessing
Astro.sessionwithout session storage configured. Thesessionproperty is now always defined on the context object, and accessing it without configuration logs a helpful message instead of silently returningundefined.Adds shared helper utilities for CDN cache provider authors for route caching
Exports
astro/cache/provider-utilswith helpers for building platform-specific cache-control headers, generating path-based invalidation tags, and normalizing invalidation options. These are used internally by the first-party Netlify, Vercel, and Cloudflare cache providers.Improves build performance by removing an unfiltered transform hook from the
astro:head-metadata-buildplugin. Head propagation modules are now identified by their module ID (?astroPropagatedAssets) instead of scanning every module's source code.Fixes a bug where the advanced routing
astro/hono/astro/fetchpages()handler returned the host framework's defaultInternal Server Errorresponse instead of rendering the custom500.astropage when a page threw during render. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way.Fixes a bug where the advanced routing
astro/hono/astro/fetchmiddleware()handler returned the host framework's defaultInternal Server Errorresponse instead of rendering the custom500.astropage when middleware threw. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way. Errors surfaced throughnext(the host framework's downstream chain) still propagate to the host's own error handler.Fixes
--portflag being ignored after a Vite-triggered server restart (e.g. when a.envfile changes)Fixes the custom
500.astropage receiving an emptyerrorprop when the error originated in middleware.Fixes a spurious
Astro.request.headerswarning on prerendered pages whensecurity.allowedDomainsis configured. The internalallowedDomainsheader validation now skips prerendered routes, since they use synthetic requests with no real headers.Removes the warning that Astro does not support vite v8, since Astro v7 does support vite v8
Passes the
Requestobject toCacheProvider.setHeaders()for route cachingCache providers now receive the incoming
Requestas a second argument tosetHeaders(options, request). This allows CDN providers to read the request URL, headers, and other properties when generating cache response headers, for example to auto-tag responses with their pathname for path-based invalidation.Fixes internal Astro headers leaking from direct
pages()handler responsesFixes Vite and Rolldown build warnings
Fixes an issue where i18n domains would return 404 when
trailingSlashis set tonever.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.