Releases: withastro/astro
astro@5.17.2
@astrojs/node@9.5.3
astro@6.0.0-beta.11
Major Changes
- #15180
8780ff2Thanks @Princesseuh! - Adds support for converting SVGs to raster images (PNGs, WebP, etc) to the default Sharp image service - (v6 upgrade guidance)
Minor Changes
-
#15460
ee7e53fThanks @florian-lefebvre! - Updates the Adapter API to allow providing aserverEntrypointwhen usingentryType: 'self'Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call
setAdapter()with theentryType: 'self'option and specify your customserverEntrypoint: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
serverEntrypointand instead specify your custom server entrypoint withvite.build.rollupOptions.input.
Patch Changes
-
#15454
b47a4e1Thanks @Fryuni! - Fixes a race condition in the content layer which could result in dropped content collection entries. -
#15450
50c9129Thanks @florian-lefebvre! - Fixes a case wherebuild.serverEntrywould not be respected when using the new Adapter API -
#15473
d653b86Thanks @matthewp! - Improves Host header handling for SSR deployments behind proxies
@astrojs/vercel@10.0.0-beta.4
Patch Changes
-
#15460
ee7e53fThanks @florian-lefebvre! - Updates to use the new Adapter API -
#15450
50c9129Thanks @florian-lefebvre! - Fixes a case wherebuild.serverEntrywould not be respected when using the new Adapter API
@astrojs/node@10.0.0-beta.4
@astrojs/netlify@7.0.0-beta.9
Patch Changes
-
#15460
ee7e53fThanks @florian-lefebvre! - Updates to use the new Adapter API -
#15450
50c9129Thanks @florian-lefebvre! - Fixes a case wherebuild.serverEntrywould not be respected when using the new Adapter API -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
@astrojs/mdx@5.0.0-beta.7
@astrojs/cloudflare@13.0.0-beta.7
Patch Changes
-
#15452
e1aa3f3Thanks @matthewp! - Fixes server-side dependencies not being discovered ahead of time during developmentPreviously, imports in
.astrofile frontmatter were not scanned by Vite's dependency optimizer, causing a "new dependencies optimized" message and page reload when the dependency was first encountered. Astro is now able to scan these dependencies ahead of time. -
#15450
50c9129Thanks @florian-lefebvre! - Fixes a case wherebuild.serverEntrywould not be respected when using the new Adapter API -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
create-astro@5.0.0-beta.4
Patch Changes
-
#15419
a18d727Thanks @ematipico! - Fixes an issue where--addcould accept any kind of string, leading to different errors. Now--addaccepts only values of valid integrations and adapters. -
#15419
a18d727Thanks @ematipico! - Fixes an issue where theaddcommand could accept any arbitrary value, leading the possible command injections. Nowaddand--addaccepts
values that are only acceptable npmjs.org names.
astro@6.0.0-beta.10
Minor Changes
-
#15231
3928b87Thanks @rururux! - Adds a new optionalgetRemoteSize()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 extendsinferRemoteSize(), 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
a164c77Thanks @matthewp! - Updates the Integration API to addsetPrerenderer()to theastro:build:starthook, allowing adapters to provide custom prerendering logic.The new API accepts either an
AstroPrerendererobject 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-pathsvirtual module, which exports aStaticPathsclass 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
840fbf9Thanks @matthewp! - Adds a newemitClientAssetfunction toastro/assets/utilsfor 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, });
Patch Changes
-
#15423
c5ea720Thanks @matthewp! - Improves error message when a dynamic redirect destination does not match any existing route.Previously, configuring a redirect like
/categories/[category]→/categories/[category]/1in 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. -
#15444
10b0422Thanks @AhmadYasser1! - FixesAstro.rewritereturning 404 when rewriting to a URL with non-ASCII charactersWhen rewriting to a path containing non-ASCII characters (e.g.,
/redirected/héllo), the route lookup compared encodeddistURLhrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead. -
#15419
a18d727Thanks @ematipico! - Fixes an issue where theaddcommand could accept any arbitrary value, leading the possible command injections. Nowaddand--addaccepts
values that are only acceptable npmjs.org names. -
#15345
840fbf9Thanks @matthewp! - Fixes an issue where.sqlfiles (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
ssrMoveAssetsfunction 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. -
#15422
68770efThanks @matthewp! - Upgrade to @astrojs/compiler@3.0.0-beta -
Updated dependencies [
a164c77,a18d727]:- @astrojs/internal-helpers@0.8.0-beta.1
- @astrojs/markdown-remark@7.0.0-beta.6