github withastro/astro astro@6.4.0

latest releases: @astrojs/markdown-satteri@0.2.1, @astrojs/markdown-satteri@0.2.0, @astrojs/cloudflare@13.6.0...
4 hours ago

Minor Changes

  • #16468 4cff3a1 Thanks @matthewp! - Adds a new preserveBuildServerDir adapter feature

    Adapters can now set preserveBuildServerDir: true in their adapter features to keep the dist/server/ directory structure for static builds, mirroring the existing preserveBuildClientDir option. This is useful for adapters that require a consistent dist/client/ and dist/server/ layout regardless of build output type.

    setAdapter({
      name: 'my-adapter',
      adapterFeatures: {
        buildOutput,
        preserveBuildClientDir: true,
        preserveBuildServerDir: true,
      },
    });
  • #16848 f732f3c Thanks @Princesseuh! - Adds a new markdown.processor configuration option, allowing you to choose an alternative Markdown processor.

    Websites with many Markdown/MDX files tend to be slow to build because the unified ecosystem (e.g., remark, rehype) is slow to process. This feature introduces the ability to replace this part of the build pipeline with another processor.

    The default processor is unified(). This means that existing configurations remain unchanged and your remark/rehype plugins continue to work.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { unified } from '@astrojs/markdown-remark';
    import remarkToc from 'remark-toc';
    
    export default defineConfig({
      markdown: {
        processor: unified({
          remarkPlugins: [remarkToc],
        }),
      },
    });

    In addition to this new configuration option, Astro provides a new alternative processor based on Rust: Sätteri. You can choose to use it now by installing @astrojs/markdown-satteri, importing the satteri() processor, and adapting your existing configuration:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { satteri } from '@astrojs/markdown-satteri';
    
    export default defineConfig({
      markdown: {
        processor: satteri({
          features: { directive: true },
        }),
      },
    });

    This processor does not support the remark and rehype plugins. This means you may need to convert them to MDAST or HAST plugins to retain your current functionality.

    The existing top-level markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm, and markdown.smartypants options still work, but are now deprecated and will be removed in a future major update. The matching remarkPlugins, rehypePlugins, and remarkRehype options on the MDX integration are also deprecated for the same reason. To anticipate their removal, move them onto unified({...}) (or your preferred plugin processor) :

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import remarkToc from 'remark-toc';
    import rehypeSlug from 'rehype-slug';
    + import { unified } from '@astrojs/markdown-remark';
    
    export default defineConfig({
      markdown: {
    +    processor: unified({
    +      remarkPlugins: [remarkToc],
    +      rehypePlugins: [rehypeSlug],
    +      remarkRehype: true,
    +      gfm: true,
    +      smartypants: true,
    +    }),
    -    remarkPlugins: [remarkToc],
    -    rehypePlugins: [rehypeSlug],
    -    remarkRehype: true,
    -    gfm: true,
    -    smartypants: true,
      },
    });

    For more information on enabling and using this feature in your project, see our Markdown guide. To give feedback on this new Rust processor, see the Native Markdown / MDX parsing and processing RFC.

Patch Changes

  • #16468 4cff3a1 Thanks @matthewp! - Skips the static preview server when an adapter provides its own previewEntrypoint, allowing the adapter to handle both static and dynamic routes

  • #16811 e0e26db Thanks @matthewp! - Fixes X-Forwarded-Host and X-Forwarded-Proto headers being ignored when set in a custom src/app.ts fetch handler before creating FetchState

  • #16468 4cff3a1 Thanks @matthewp! - Fixes the static preview server to respect preserveBuildClientDir, serving files from build.client instead of outDir when the adapter requires it

  • #16770 1e2aa11 Thanks @matthewp! - Fixes a race condition where the Vite dep optimizer could lose React dependencies in dev mode when using Astro Actions

  • #16468 4cff3a1 Thanks @matthewp! - Exempts internal routes (e.g. server islands) from getStaticPaths() validation, fixing server island rendering on static sites

  • #16468 4cff3a1 Thanks @matthewp! - Fixes preview for static sites that contain non-prerendered routes. Previously, the preview command ignored SSR routes discovered during route scanning and always used the static preview server.

  • Updated dependencies [f732f3c, f732f3c]:

    • @astrojs/internal-helpers@0.10.0
    • @astrojs/markdown-remark@7.2.0

Don't miss a new astro release

NewReleases is sending notifications on new releases.