π Patch Changes
- #14612
18552c7Thanks @ematipico! - Fixes a regression introduced in Astro v5.14.7 that caused?urlimports to not work correctly. This release reverts #14142.
18552c7 Thanks @ematipico! - Fixes a regression introduced in Astro v5.14.7 that caused ?url imports to not work correctly. This release reverts #14142.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.#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 non-existent 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()
#14562 722bba0 Thanks @erbierc! - Fixes a bug where the behavior of the βmutedβ HTML attribute was inconsistent with that of other attributes.
#14538 51ebe6a Thanks @florian-lefebvre! - Improves how Actions are implemented
#14548 6cdade4 Thanks @ascorbic! - Removes support for the maxAge property in cacheHint objects returned by live loaders.
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.
#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
7e04caf Thanks @ArmandPhilippot! - Fixes an error in the docs that specified an incorrect version for the security.allowedDomains release.#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
a3e16ab Thanks @florian-lefebvre! - Fixes a case where the URLs generated by the experimental Fonts API would be incorrect in dev
#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.
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 staticpaths 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:
---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.
#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 OpenGraph images:
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.
#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.
1e2499e]:
54dcd04 Thanks @FredKSchott! - Removes warning that caused unexpected console spam when using Bun#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
#14294 e005855 Thanks @martrapp! - Restores the ability to use Google Analytics History change trigger with the <ClientRouter />.
#14326 c24a8f4 Thanks @jsparkdev! - Updates vite version to fix CVE
#14108 218e070 Thanks @JusticeMatthew! - Updates dynamic route split regex to avoid infinite retries/exponential complexity
#14327 c1033be Thanks @ascorbic! - Pins simple-swizzle to avoid compromised version
#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.insertDirectiveAstro.insertStyleResource to Astro.csp.insertStyleResourceAstro.insertStyleHash to Astro.csp.insertStyleHashAstro.insertScriptResource to Astro.csp.insertScriptResourceAstro.insertScriptHash to Astro.csp.insertScriptHashThe following runtime APIs of the APIContext have been renamed:
ctx.insertDirective to ctx.csp.insertDirectivectx.insertStyleResource to ctx.csp.insertStyleResourcectx.insertStyleHash to ctx.csp.insertStyleHashctx.insertScriptResource to ctx.csp.insertScriptResourcectx.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.
#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.
#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)
760acc8 Thanks @ematipico! - Fixes an issue where remote paths werenβt correctly computed when generating assets4d16de7 Thanks @ematipico! - Improves the detection of remote paths in the _image endpoint. Now href parameters that start with // are considered remote paths.
Updated dependencies [4d16de7]: