github withastro/astro astro@7.3.0

latest releases: astro@7.3.1, @astrojs/cloudflare@14.3.0
5 hours ago

Minor Changes

  • #17767 ce7c91f Thanks @astro-factory! - Adds --ignore-lock flag to astro preview, allowing multiple preview servers to run simultaneously on different ports. This is useful for E2E testing workflows (e.g., Playwright) that need to run several preview servers at once.

  • #17818 c0b6581 Thanks @florian-lefebvre! - Adds a logger parameter to image services hooks

    Custom image services now receive Astro's runtime logger as an extra argument. Messages logged with it are routed through the destination configured in logger and respect your log level, instead of being written straight to the console:

    import type { LocalImageService } from 'astro';
    
    const service: LocalImageService = {
      // ...
      async transform(inputBuffer, transform, imageConfig, logger) {
        logger.warn(`Could not optimize "${transform.src}". Passing it through unchanged.`);
        return { data: inputBuffer, format: 'png' };
      },
    };

    Astro's built-in Sharp service now uses this logger for the warnings it emits when it encounters an unexpected or unsupported source format.

  • #17818 c0b6581 Thanks @florian-lefebvre! - Adds logger to the context object passed to cache providers

    Custom cache providers now receive Astro's runtime logger on the context passed to onRequest(). Messages logged with it are routed through the destination configured in logger and respect your log level, instead of being written straight to the console:

    import type { CacheProvider } from 'astro';
    
    const provider: CacheProvider = {
      name: 'my-cache',
      async onRequest({ request, url, logger }, next) {
        logger.warn(`Skipping cache for ${url.pathname} because the response sets a cookie.`);
        return next();
      },
      // ...
    };

    Astro's built-in memoryCache() provider now uses this logger for the warnings it emits when it skips caching a response that sets cookies, and when a background revalidation fails.

Patch Changes

  • #17818 c0b6581 Thanks @florian-lefebvre! - Updates Astro's remaining internal warnings and errors to be written through the configured logger instead of directly to the console, when possible

  • #17886 e747cba Thanks @matthewp! - Fixes the memory cache provider to skip responses with Vary: Cookie or Vary: *

  • #17885 916b738 Thanks @Princesseuh! - Improves build performance for sites with a large number of pages coming from a large amount of different modules.

  • #17795 15e2deb Thanks @matthewp! - Adds concurrent rendering support for experimental.incrementalBuild, including when using @astrojs/cloudflare

    Incremental builds no longer disable caching when build.concurrency is greater than 1. Projects that set build.concurrency: 1 to keep the cache enabled can remove that workaround. Cloudflare builds also reduce serialization overhead for large prerendered pages.

  • #17879 21c34a6 Thanks @matthewp! - Fixes missing styles, links, and scripts from content collection entries rendered inside server islands

  • #17861 3193988 Thanks @ethanstoner! - Fixes i18n fallback routes being generated with a corrupted path when the locale code also appears at the start of a later path segment. A page such as src/pages/en/enterprise.astro with fallback: { es: 'en' } produced the route /es/esterprise instead of /es/enterprise, so the fallback never matched the intended URL. Only the leading locale segment is rewritten now.

Don't miss a new astro release

NewReleases is sending notifications on new releases.