Skip to content

Releases: withastro/astro

@astrojs/[email protected]

21 Nov 12:47
a9ce785
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #12481 8a46e80 Thanks @marbrex! - Resolve vite peer dependency problem for strict package managers like Yarn in PnP mode.

@astrojs/[email protected]

21 Nov 12:47
a9ce785
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #12481 8a46e80 Thanks @marbrex! - Resolve vite peer dependency problem for strict package managers like Yarn in PnP mode.

@astrojs/[email protected]

21 Nov 12:47
a9ce785
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #12481 8a46e80 Thanks @marbrex! - Resolve vite peer dependency problem for strict package managers like Yarn in PnP mode.

[email protected]

15 Nov 11:28
5509117
Compare
Choose a tag to compare

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

@astrojs/[email protected]

15 Nov 13:00
8e135b6
Compare
Choose a tag to compare

Patch Changes

@astrojs/[email protected]

15 Nov 11:28
5509117
Compare
Choose a tag to compare

Major Changes

  • #12364 9fc2ab8 Thanks @jdtjenkins! - Adds support for Svelte 5. Svelte 3 and 4 are no longer supported.

    The integration will now also no longer add vitePreprocess() by default if a preprocessor is not set up in svelte.config.js. It is recommended to set up the Svelte config manually so that features like IDE completion and syntax highlighting work properly.

    If you're using SCSS, Stylus, etc in your Svelte component style tags, make sure that the preprocessor is also set up in svelte.config.js. For example:

    // svelte.config.js
    import { vitePreprocess } from '@astrojs/svelte';
    
    export default {
      preprocess: vitePreprocess(),
    };

    Refer to the Svelte 5 migration guide and @sveltejs/vite-plugin-svelte changelog for details of their respective breaking changes.

@astrojs/[email protected]

15 Nov 11:28
5509117
Compare
Choose a tag to compare

Patch Changes

  • #12364 9fc2ab8 Thanks @jdtjenkins! - Handles checking Svelte 5 component functions to avoid processing them as Solid components

[email protected]

13 Nov 14:22
3b3bc9b
Compare
Choose a tag to compare

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.

[email protected]

13 Nov 00:02
e723e9e
Compare
Choose a tag to compare

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.

[email protected]

13 Nov 14:33
b745e38
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release

Minor Changes

  • #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.

    Customize form submission behavior

    If you prefer to address the "confirm form resubmission?" dialog on refresh, or to preserve action results across sessions, you can now customize action result handling from middleware.

    We recommend using a session storage provider as described in our Netlify Blob example. However, if you prefer the cookie forwarding behavior from 4.X and accept the 4 KB size limit, you can implement the pattern as shown in this sample snippet:

    // src/middleware.ts
    import { defineMiddleware } from 'astro:middleware';
    import { getActionContext } from 'astro:actions';
    
    export const onRequest = defineMiddleware(async (context, next) => {
      // Skip requests for prerendered pages
      if (context.isPrerendered) return next();
    
      const { action, setActionResult, serializeActionResult } = getActionContext(context);
    
      // If an action result was forwarded as a cookie, set the result
      // to be accessible from `Astro.getActionResult()`
      const payload = context.cookies.get('ACTION_PAYLOAD');
      if (payload) {
        const { actionName, actionResult } = payload.json();
        setActionResult(actionName, actionResult);
        context.cookies.delete('ACTION_PAYLOAD');
        return next();
      }
    
      // If an action was called from an HTML form action,
      // call the action handler and redirect with the result as a cookie.
      if (action?.calledFrom === 'form') {
        const actionResult = await action.handler();
    
        context.cookies.set('ACTION_PAYLOAD', {
          actionName: action.name,
          actionResult: serializeActionResult(actionResult),
        });
    
        if (actionResult.error) {
          // Redirect back to the previous page on error
          const referer = context.request.headers.get('Referer');
          if (!referer) {
            throw new Error('Internal: Referer unexpectedly missing from Action POST request.');
          }
          return context.redirect(referer);
        }
        // Redirect to the destination page on success
        return context.redirect(context.originPathname);
      }
    
      return next();
    });

Patch Changes

  • #12339 bdb75a8 Thanks @ematipico! - Adds an error when Astro.rewrite() is used to rewrite an on-demand route with a static route when using the "server" output.

    This is a forbidden rewrite because Astro can't retrieve the emitted static route at runtime. This route is served by the hosting platform, and not Astro itself.