github withastro/astro astro@4.11.0

latest releases: astro@4.11.3, astro@4.11.2, @astrojs/studio@0.1.1...
7 days ago

Minor Changes

  • #11197 4b46bd9 Thanks @braebo! - Adds ShikiTransformer support to the <Code /> component with a new transformers prop.

    Note that transformers only applies classes and you must provide your own CSS rules to target the elements of your code block.

    ---
    import { transformerNotationFocus } from '@shikijs/transformers';
    import { Code } from 'astro:components';
    
    const code = `const foo = 'hello'
    const bar = ' world'
    console.log(foo + bar) // [!code focus]
    `;
    ---
    
    <Code {code} lang="js" transformers={[transformerNotationFocus()]} />
    
    <style is:global>
      pre.has-focused .line:not(.focused) {
        filter: blur(1px);
      }
    </style>
  • #11134 9042be0 Thanks @florian-lefebvre! - Improves the developer experience of the 500.astro file by passing it a new error prop.

    When an error is thrown, the special src/pages/500.astro page now automatically receives the error as a prop. This allows you to display more specific information about the error on a custom 500 page.

    ---
    // src/pages/500.astro
    interface Props {
      error: unknown;
    }
    
    const { error } = Astro.props;
    ---
    
    <div>{error instanceof Error ? error.message : 'Unknown error'}</div>

    If an error occurs rendering this page, your host's default 500 error page will be shown to your visitor in production, and Astro's default error overlay will be shown in development.

Patch Changes

  • #11280 fd3645f Thanks @ascorbic! - Fixes a bug that prevented cookies from being set when using experimental rewrites

  • #11275 bab700d Thanks @syhily! - Drop duplicated brackets in data collections schema generation.

  • #11272 ea987d7 Thanks @ematipico! - Fixes a case where rewriting / would cause an issue, when trailingSlash was set to "never".

  • #11272 ea987d7 Thanks @ematipico! - Reverts a logic where it wasn't possible to rewrite /404 in static mode. It's now possible again

  • #11264 5a9c9a6 Thanks @Fryuni! - Fixes type generation for empty content collections

  • #11279 9a08d74 Thanks @ascorbic! - Improves type-checking and error handling to catch case where an image import is passed directly to getImage()

  • #11292 7f8f347 Thanks @jdtjenkins! - Fixes a case where defineAction autocomplete for the accept prop would not show "form" as a possible value

  • #11273 cb4d078 Thanks @ascorbic! - Corrects an inconsistency in dev where middleware would run for prerendered 404 routes.
    Middleware is not run for prerendered 404 routes in production, so this was incorrect.

  • #11284 f4b029b Thanks @ascorbic! - Fixes an issue that would break Astro.request.url and Astro.request.headers in astro dev if HTTP/2 was enabled.

    HTTP/2 is now enabled by default in astro dev if https is configured in the Vite config.

Don't miss a new astro release

NewReleases is sending notifications on new releases.