What’s New

Astro

Frameworks & Libraries

The web framework for content-driven websites.

Latest @astrojs/netlify@8.1.3 · by AstroWebsitewithastro/astro

Changelog

astro@7.1.5

Changed
  • Update dependency js-yaml to v4.3.0
Fixed
  • Fix a bug where an error while finalizing a request could prevent a response from being sent
  • Fix a case where a custom logger.entrypoint failed to load at runtime in a built server bundle
  • Fix action path resolution so that properties of a resolved action function are not treated as routable path segments
  • Fix a bug where the custom 404 or 500 page was not rendered when a middleware rewrite targeted a route that returned an empty 404/500 response
Patch Changes
  • #17524 7613030 Thanks @matthewp! - Fixes a bug where an error while finalizing a request could prevent a response from being sent

  • #17480 f61ba9c Thanks @florian-lefebvre! - Fixes a case where a custom logger.entrypoint failed to load at runtime in a built server bundle.

  • #17525 e614b7b Thanks @matthewp! - Fixes action path resolution so that properties of a resolved action function are not treated as routable path segments

  • #17284 c775c1f Thanks @matthewp! - Fixes a bug where the custom 404 (or 500) page was not rendered when a middleware rewrite targeted a route that returned an empty 404/500 response, and a blank page was returned instead

  • #17474 c895b12 Thanks @nicksnyder! - Updates dependency js-yaml to v4.3.0

  • Updated dependencies [c895b12]:

    • @astrojs/internal-helpers@0.10.2
    • @astrojs/markdown-remark@7.2.2
    • @astrojs/markdown-satteri@0.3.5

@astrojs/cloudflare@14.1.5

Fixed
  • Fix a bug where an explicit `cache: { enabled: false }` in your wrangler config was overridden and forced to `true` when a Workers cache provider was configured
Patch Changes
  • #17376 0216368 Thanks @astrobot-houston! - Fixes a bug where an explicit cache: { enabled: false } in your wrangler config was overridden and forced to true when a Workers cache provider was configured

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.3

astro@7.1.4

Added
  • Add the missing `background` prop to the `<Image />` and `<Picture />` component types
Fixed
  • Fix duplicate CSS files being emitted in server output when a prerendered page and a server-rendered page share the same styles by reusing the CSS asset filename from the prerender build
  • Fix missing scoped styles for child components inside `client:only` islands in production builds
  • Fix session runtime errors being silently swallowed by `console.error` instead of routing through Astro's logger
  • Fix a session being left in a partial state after a storage failure during `session.regenerate()`
  • Prevent a visible terminal window from popping up on Windows when the dev server runs in background mode
  • Fix the `glob()` loader watcher so negation patterns like `!docs/drafts/**` correctly exclude files during development
  • Fix TypeScript path aliases from `tsconfig.json` not resolving in `astro.config.ts`
Patch Changes
  • #17488 d4f266d Thanks @emerson-d-lopes! - Fixes duplicate CSS files being emitted in server output when a prerendered page and a server-rendered page share the same styles (e.g. a shared layout importing Tailwind). The prerender and SSR environments each emitted their own copy of the same stylesheet (index.X.css and _..Y.css); the SSR build now reuses the CSS asset filename from the prerender build when the stylesheet is backed by the same CSS source modules, so only a single file is emitted.

  • #17472 4dc590c Thanks @astrobot-houston! - Adds the missing background prop to the <Image /> and <Picture /> component types. The prop already worked at runtime, but was absent from the types, causing astro check to report that background does not exist on the component props

  • #17292 0fc519d Thanks @astrobot-houston! - Fixes missing scoped styles for child components inside client:only islands in production builds

  • #17421 f1448de Thanks @iamkaleemsajjad-hue! - Fixes session runtime errors being silently swallowed by console.error instead of routing through Astro's logger

  • #17421 f1448de Thanks @iamkaleemsajjad-hue! - Fixes a session being left in a partial state after a storage failure during session.regenerate(), preventing unnecessary storage reads on subsequent operations

  • #17517 82bf7e2 Thanks @Hashim1999164! - Prevents a visible terminal window from popping up on Windows when the dev server runs in background mode. The detached child process is now spawned with windowsHide: true, so console-subsystem grandchildren (such as workerd.exe) no longer get a new focus-stealing window allocated by Windows Terminal.

  • #17510 eaa1fb0 Thanks @astrobot-houston! - Fixes the glob() loader watcher so negation patterns like !docs/drafts/** correctly exclude files during development, matching the behavior of the initial scan. Previously, negations were treated as independent matchers, causing unrelated files (including .astro/data-store.json) to be ingested as collection entries

  • #17511 704e570 Thanks @astrobot-houston! - Fixes TypeScript path aliases from tsconfig.json not resolving in astro.config.ts

create-astro@5.2.3

Fixed
  • Fix create-astro silently writing template files to the wrong directory on Linux when the path contains non-ASCII characters
Patch Changes
  • #17423 08e8adb Thanks @astrobot-houston! - Fixes create-astro silently writing template files to the wrong directory on Linux when the path contains non-ASCII characters.

@astrojs/markdoc@2.0.5

Fixed
  • Custom transform functions are no longer dropped when a tag or node also specifies a custom render component; user-written transforms are always preserved while only Markdoc's built-in transforms are removed
  • Custom transform functions are no longer incorrectly dropped for tags and nodes whose names require bracket access like side-note; the check now recognizes bracket notation, optional chaining, and whitespace in addition to dot notation
Patch Changes
  • #17460 3b93a1a Thanks @astrobot-houston! - Fixes custom transform functions being dropped when a tag or node also specifies a custom render component. User-written transforms are now always preserved; only Markdoc's built-in transforms are removed so the custom component wins.

  • #17191 fc3fb2b Thanks @eldardada! - Fixes custom transform functions being incorrectly dropped for tags and nodes whose names require bracket access (e.g. side-note). The check that detects whether a transform respects a custom render component now recognizes bracket notation, optional chaining and whitespace, not only dot notation.

astro@7.1.3

Fixed
  • Image optimization during astro build now respects the container's CPU limit, reducing peak memory usage and avoiding out-of-memory crashes in CPU-limited containers
Patch Changes
  • #17427 630b382 Thanks @astrobot-houston! - Fixes image optimization during astro build using too many parallel processes in CPU-limited containers. Builds now respect the container's CPU limit, reducing peak memory usage and avoiding out-of-memory crashes.

astro@7.1.2

Changed
  • Update dependency cookie to v2, where cookie values made entirely of URL-safe characters are no longer percent-encoded in Set-Cookie headers
Fixed
  • Fix a bug where mutated Astro.locals during the request lifecycle are lost and not passed to custom error pages (404.astro/500.astro)
  • Prevent an unhandled promise rejection from the prefetch fetch fallback by swallowing failures with .catch()
Patch Changes
  • #17445 a5f7230 Thanks @ocavue! - Updates dependency cookie to v2. Cookie values made entirely of URL-safe characters are no longer percent-encoded in Set-Cookie headers; encoded values round-trip exactly as before.

  • #17402 a89c137 Thanks @farrosfr! - Fixes a bug where mutated Astro.locals during the request lifecycle are lost and not passed to custom error pages (404.astro/500.astro)

  • #17405 91992ef Thanks @Araluma! - Prevents an unhandled promise rejection from the prefetch fetch fallback. In WebKit (Safari), <link rel="prefetch"> is unsupported, so prefetch uses the fetch() fallback; on a flaky connection that fetch rejects with TypeError: Load failed, and because the promise was not awaited or caught, it surfaced as an unhandled rejection to the page's global error handlers. The best-effort prefetch now swallows the failure with .catch().

astro@7.1.1

Fixed
  • Encoded request paths being routed incorrectly when using domain-based i18n
Patch Changes
  • #17399 4b03702 Thanks @matthewp! - Fixes encoded request paths being routed incorrectly when using domain-based i18n

astro@7.1.0

Added
  • Add a new `deferRender` option to the `glob()` content loader that defers rendering of Markdown and other renderable entries until they are actually rendered in a page, reducing memory usage during `astro build` for large collections
  • Add a new experimental `collectionStorage` option for controlling how the content layer persists its data store, allowing it to be split across many smaller content-addressed files instead of a single file
  • Add support for more specific CSP directives `script-src-elem`, `script-src-attr`, `style-src-elem`, and `style-src-attr` through a new `kind` option in both config and runtime CSP API
  • Add a new `format()` option to the `paginate` utility that accepts a function to transform the current URL of the page
  • Add a `--ignore-lock` flag to `astro dev` for starting a dev server without checking or writing the lock file
Minor Changes
  • #17302 5f4dc03 Thanks @astrobot-houston! - Adds a new deferRender option to the glob() content loader

    When set to true, renderable entries (such as Markdown) are not rendered during content sync. Instead, rendering is deferred until the entry is actually rendered in a page, using the same on-demand path that .mdx files already use.

    This reduces memory usage during astro build for large collections whose rendered output is much larger than the source — for example, Markdown that uses heavy rehype plugins like rehype-katex. Such builds could previously run out of memory while storing the eagerly-rendered HTML for every entry.

    // src/content.config.ts
    import { defineCollection } from 'astro:content';
    import { glob } from 'astro/loaders';
    
    const docs = defineCollection({
      loader: glob({ pattern: '**/*.md', base: 'src/content/docs', deferRender: true }),
    });
    

    By default deferRender is false, preserving the existing behavior of rendering entries eagerly during sync so their rendered HTML can be cached across builds.

  • #17296 30698a2 Thanks @ematipico! - Adds a new experimental collectionStorage option for controlling how the content layer persists its data store

    By default, Astro serializes the entire content layer data store to a single file (.astro/data-store.json). For very large content collections, this file can grow large enough to hit platform file-size limits.

    Set experimental.collectionStorage: 'chunked' to instead split the data store across many smaller, content-addressed files inside a .astro/data-store/ directory, described by a manifest:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        collectionStorage: 'chunked',
      },
    });
    

    Because each part file is named by a hash of its contents, unchanged parts keep the same name across builds and are not rewritten, and identical parts are deduplicated. The default value is 'single-file', which preserves the current behavior.

  • #17214 44c4989 Thanks @ematipico! - Adds support for the more specific CSP directives script-src-elem, script-src-attr, style-src-elem, and style-src-attr through a new kind option.

    Previously, CSP was only scoped to generic script-src/style-src directives. Now each source or hash can be scoped to a narrower directive — for example, to allow inline style attributes (such as those from define:vars or Shiki) without loosening the policy for your <style> and <link> elements.

    Scoping sources and hashes in your config

    Each entry in resources and hashes can be an object with a kind property. Depending on whether you use scriptDirective or styleDirective, "element" targets script-src-elem or style-src-elem, "attribute" targets script-src-attr or style-src-attr, and "default" (the same as a bare string or hash) targets script-src or style-src.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      security: {
        csp: {
          scriptDirective: {
            resources: [{ resource: 'https://cdn.example.com', kind: 'element' }],
          },
          styleDirective: {
            resources: [{ resource: "'unsafe-inline'", kind: 'attribute' }],
          },
        },
      },
    });
    
    Scoping at runtime

    The same kind option is available on the runtime CSP API, where the existing methods now also accept an object:

    ctx.csp.insertScriptResource({ resource: 'https://cdn.example.com', kind: 'element' });
    ctx.csp.insertStyleResource({ resource: "'unsafe-inline'", kind: 'attribute' });
    
  • #17258 84814d4 Thanks @astrobot-houston! - Adds a new format() option to the paginate utility. The format() option is a function that accepts the current URL of the page, and returns a new URL.

    For example, when your host only supports URLs using the .html extension, you can use format() to add it to the generated URLs:

    ---
    export async function getStaticPaths({ paginate }) {
      // Load your data with fetch(), getCollection(), etc.
      const response = await fetch(`https://pokeapi.co/api/v2/pokemon?limit=150`);
      const result = await response.json();
      const allPokemon = result.results;
    
      // Return a paginated collection of paths for all items
      return paginate(allPokemon, {
        pageSize: 10,
        format: (url) => `${url}.html`,
      });
    }
    
    const { page } = Astro.props;
    ---
    
  • #17331 7db6420 Thanks @matthewp! - Adds a --ignore-lock flag to astro dev for starting a dev server without checking or writing the lock file, so it can run alongside an already-running dev server for the same project.

    The new instance is not tracked by astro dev stop, astro dev status, or astro dev logs. --ignore-lock cannot be combined with --background (or an auto-detected AI agent environment, which runs dev servers in the background automatically) or --force, since those rely on the lock file.

    astro dev --ignore-lock
    
  • #17389 16de021 Thanks @florian-lefebvre! - Allows passing URL entrypoints when configuring the logger

    Matching other APIs like session drivers or font providers, the logger entrypoint can now be a URL:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      logger: {
        entrypoint: new URL('./logger.js', import.meta.url),
      },
    });
    
Patch Changes
  • #17332 4407483 Thanks @astrobot-houston! - Fixes the JSON logger crashing with process is not defined in non-Node runtimes like Cloudflare's workerd. The JSON logger now uses console.log/console.error instead of process.stdout/process.stderr, matching the pattern already used by the console logger.

  • #17391 186a1e7 Thanks @florian-lefebvre! - Fixes a case where an integration could not update the logger with updateConfig()

  • #17394 d9f99e1 Thanks @matthewp! - Fixes element-specific CSP directives to preserve the existing behavior of configured script and style resources

  • #17374 b2d1b3e Thanks @astrobot-houston! - Fixes dev server returning 404 for ?url imported assets when accessed via browser navigation

  • #17390 ed71eaf Thanks @florian-lefebvre! - Removes an unused and undocumented generic from the AstroLoggerDestination type

  • #17393 092da56 Thanks @matthewp! - Hardens generated transition styles, development metadata, and server island URLs when embedding dynamic values

astro@7.0.9

Fixed
  • Fix the first browser visit after astro dev starts triggering an immediate full page reload
  • Fix an issue where a client island could permanently fail to hydrate if the first attempt to load its component failed, ensuring islands now reliably recover from transient import failures
Patch Changes
  • #17286 a249317 Thanks @astrobot-houston! - Fixes the first browser visit after astro dev starts triggering an immediate full page reload

  • #17369 a94d4a5 Thanks @adamchal! - Fixes an issue where a client island could permanently fail to hydrate if the first attempt to load its component failed. Islands now reliably recover from transient import failures, which previously did not work for React components during astro dev.

astro@7.0.8

Added
  • Expose the `AstroRuntimeLogger` interface to allow users to properly type the logger functions at runtime
Changed
  • Update the Astro compiler to the latest version, which fixes many regressions
  • Improve rendering performance for pages with many component instances, such as repeated MDX `<Content />` components
Fixed
  • Fix `astro preview --open` not opening a browser when using an adapter with a custom preview entrypoint, such as `@astrojs/cloudflare`
  • Fix `astro dev --force` not replacing an already-running dev server
Patch Changes
  • #17363 3f4efc5 Thanks @astrobot-houston! - Fixes astro preview --open not opening a browser when using an adapter with a custom preview entrypoint, such as @astrojs/cloudflare

  • #17313 e2e319d Thanks @ronits2407! - Exposes the AstroRuntimeLogger interface to allow users to properly type the logger functions at runtime.

  • #17328 025cc74 Thanks @matthewp! - Fixes astro dev --force not replacing an already-running dev server

  • #17353 2bba277 Thanks @ematipico! - Updates the Astro compiler to the latest version, which fixes many regressions. Refer to the changelog for more details.

  • #17344 79a41e0 Thanks @adamchal! - Improves rendering performance for pages with many component instances, such as repeated MDX <Content /> components.

  • Updated dependencies [64b0d66]:

    • @astrojs/markdown-satteri@0.3.4