github withastro/astro astro@5.4.1

4 hours ago

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.

Don't miss a new astro release

NewReleases is sending notifications on new releases.