Ir al contenido
verdict:

Astro 6.0.0-beta.10

preview

note: la síntesis y las notas de la versión están en inglés

note: sin síntesis para esta release más antigua

Sintetizamos las releases recientes. Las notas de la versión originales de esta versión están aquí abajo.

release-notesgithub.com/withastro/astro · 123 líneas
  1. ### Minor Changes
  2. - [#15231](https://github.com/withastro/astro/pull/15231) [`3928b87`](https://github.com/withastro/astro/commit/3928b879dd35fa4ec4dcf545f1610a0f0a55fdae) Thanks [@rururux](https://github.com/rururux)! - Adds a new optional `getRemoteSize()` method to the Image Service API.
  3. Previously, `inferRemoteSize()` had a fixed implementation that fetched the entire image to determine its dimensions.
  4. With this new helper function that extends `inferRemoteSize()`, you can now override or extend how remote image metadata is retrieved.
  5. This enables use cases such as:
  6. - Caching: Storing image dimensions in a database or local cache to avoid redundant network requests.
  7. - Provider APIs: Using a specific image provider's API (like Cloudinary or Vercel) to get dimensions without downloading the file.
  8. For example, you can add a simple cache layer to your existing image service:
  9. ```js
  10. const cache = new Map();
  11. const myService = {
  12. ...baseService,
  13. async getRemoteSize(url, imageConfig) {
  14. if (cache.has(url)) return cache.get(url);
  15. const result = await baseService.getRemoteSize(url, imageConfig);
  16. cache.set(url, result);
  17. return result;
  18. },
  19. };
  20. ```
  21. See the [Image Services API reference documentation](https://v6.docs.astro.build/en/reference/image-service-reference/#getremotesize) for more information.
  22. - [#15077](https://github.com/withastro/astro/pull/15077) [`a164c77`](https://github.com/withastro/astro/commit/a164c77336059f2dc3e7f7fe992aa754ed145ef3) Thanks [@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.
  23. The new API accepts either an `AstroPrerenderer` object directly, or a factory function that receives the default prerenderer:
  24. ```js
  25. 'astro:build:start': ({ setPrerenderer }) => {
  26. setPrerenderer((defaultPrerenderer) => ({
  27. name: 'my-prerenderer',
  28. async setup() {
  29. // Optional: called once before prerendering starts
  30. },
  31. async getStaticPaths() {
  32. // Returns array of { pathname: string, route: RouteData }
  33. return defaultPrerenderer.getStaticPaths();
  34. },
  35. async render(request, { routeData }) {
  36. // request: Request
  37. // routeData: RouteData
  38. // Returns: Response
  39. },
  40. async teardown() {
  41. // Optional: called after all pages are prerendered
  42. }
  43. }));
  44. }
  45. ```
  46. 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:
  47. ```js
  48. // In your adapter's request handler (running in target runtime)
  49. import { App } from 'astro/app';
  50. import { StaticPaths } from 'astro:static-paths';
  51. export function createApp(manifest) {
  52. const app = new App(manifest);
  53. return {
  54. async fetch(request) {
  55. const { pathname } = new URL(request.url);
  56. // Expose endpoint for prerenderer to get static paths
  57. if (pathname === '/__astro_static_paths') {
  58. const staticPaths = new StaticPaths(app);
  59. const paths = await staticPaths.getAll();
  60. return new Response(JSON.stringify({ paths }));
  61. }
  62. // Normal request handling
  63. return app.render(request);
  64. },
  65. };
  66. }
  67. ```
  68. See the [adapter reference](https://v6.docs.astro.build/en/reference/adapter-reference/#custom-prerenderer) for more details on implementing a custom prerenderer.
  69. - [#15345](https://github.com/withastro/astro/pull/15345) [`840fbf9`](https://github.com/withastro/astro/commit/840fbf9e4abc7f847e23da8d67904ffde4d95fff) Thanks [@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.
  70. ```ts
  71. import { emitClientAsset } from 'astro/assets/utils';
  72. // Inside a Vite plugin's transform or load hook
  73. const handle = emitClientAsset(this, {
  74. type: 'asset',
  75. name: 'my-image.png',
  76. source: imageBuffer,
  77. });
  78. ```
  79. ### Patch Changes
  80. - [#15423](https://github.com/withastro/astro/pull/15423) [`c5ea720`](https://github.com/withastro/astro/commit/c5ea720261a35324988147fbf69d8200e496e1d0) Thanks [@matthewp](https://github.com/matthewp)! - Improves error message when a dynamic redirect destination does not match any existing route.
  81. 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.
  82. - [#15444](https://github.com/withastro/astro/pull/15444) [`10b0422`](https://github.com/withastro/astro/commit/10b0422b89d12320da3c026e8a4728ae7265cfb8) Thanks [@AhmadYasser1](https://github.com/AhmadYasser1)! - Fixes `Astro.rewrite` returning 404 when rewriting to a URL with non-ASCII characters
  83. 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.
  84. - [#15419](https://github.com/withastro/astro/pull/15419) [`a18d727`](https://github.com/withastro/astro/commit/a18d727fc717054df85177c8e0c3d38a5252f2da) Thanks [@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
  85. values that are only acceptable npmjs.org names.
  86. - [#15345](https://github.com/withastro/astro/pull/15345) [`840fbf9`](https://github.com/withastro/astro/commit/840fbf9e4abc7f847e23da8d67904ffde4d95fff) Thanks [@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.
  87. 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.
  88. - [#15422](https://github.com/withastro/astro/pull/15422) [`68770ef`](https://github.com/withastro/astro/commit/68770ef9e981f37a0b1b8febf76958010975add9) Thanks [@matthewp](https://github.com/matthewp)! - Upgrade to @astrojs/compiler@3.0.0-beta
  89. - Updated dependencies \[[`a164c77`](https://github.com/withastro/astro/commit/a164c77336059f2dc3e7f7fe992aa754ed145ef3), [`a18d727`](https://github.com/withastro/astro/commit/a18d727fc717054df85177c8e0c3d38a5252f2da)]:
  90. - @astrojs/internal-helpers@0.8.0-beta.1
  91. - @astrojs/markdown-remark@7.0.0-beta.6

ver en githubimported 2026-09-28 vía npm