github withastro/astro @astrojs/vercel@8.2.0

Minor Changes

  • #13965 95ece06 Thanks @ematipico! - Adds support for the experimental static headers Astro feature.

    When the feature is enabled via option experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generate Response headers for static pages, which allows support for CSP directives that are not supported inside a <meta> tag (e.g. frame-ancestors).

    import { defineConfig } from 'astro/config';
    import vercel from '@astrojs/vercel';
    
    export default defineConfig({
      adapter: vercel({
        experimentalStaticHeaders: true,
      }),
      experimental: {
        cps: true,
      },
    });

Patch Changes

  • #13917 e615216 Thanks @ascorbic! - The responsive images feature introduced behind a flag in v5.0.0 is no longer experimental and is available for general use.

    The new responsive images feature in Astro automatically generates optimized images for different screen sizes and resolutions, and applies the correct attributes to ensure that images are displayed correctly on all devices.

    Enable the image.responsiveStyles option in your Astro config. Then, set a layout attribute on any or component, or configure a default image.layout, for instantly responsive images with automatically generated srcset and sizes attributes based on the image's dimensions and the layout type.

    Displaying images correctly on the web can be challenging, and is one of the most common performance issues seen in sites. This new feature simplifies the most challenging part of the process: serving your site visitor an image optimized for their viewing experience, and for your website's performance.

    For full details, see the updated Image guide.

    Migration from Experimental Responsive Images

    The experimental.responsiveImages flag has been removed, and all experimental image configuration options have been renamed to their final names.

    If you were using the experimental responsive images feature, you'll need to update your configuration:

    Remove the experimental flag

    export default defineConfig({
       experimental: {
    -    responsiveImages: true,
       },
    });

    Update image configuration options

    During the experimental phase, default styles were applied automatically to responsive images. Now, you need to explicitly set the responsiveStyles option to true if you want these styles applied.

    export default defineConfig({
      image: {
    +    responsiveStyles: true,
      },
    });

    The experimental image configuration options have been renamed:

    Before:

    export default defineConfig({
      image: {
        experimentalLayout: 'constrained',
        experimentalObjectFit: 'cover',
        experimentalObjectPosition: 'center',
        experimentalBreakpoints: [640, 750, 828, 1080, 1280],
        experimentalDefaultStyles: true,
      },
      experimental: {
        responsiveImages: true,
      },
    });

    After:

    export default defineConfig({
      image: {
        layout: 'constrained',
        objectFit: 'cover',
        objectPosition: 'center',
        breakpoints: [640, 750, 828, 1080, 1280],
        responsiveStyles: true, // This is now *false* by default
      },
    });

    Component usage remains the same

    The layout, fit, and position props on <Image> and <Picture> components work exactly the same as before:

    <Image
      src={myImage}
      alt="A responsive image"
      layout="constrained"
      fit="cover"
      position="center"
    />

    If you weren't using the experimental responsive images feature, no changes are required.

    Please see the Image guide for more information on using responsive images in Astro.

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

Don't miss a new astro release

NewReleases is sending notifications on new releases.