Skip to content

Conversation

ascorbic
Copy link
Contributor

Changes

Currently we skip automatic handling of trailing slash redirection for internal paths, including those that start with /_. This logic is used in both dev and prod, and isn't comprehensive. This PR adds a new isInternalPath helper, which is shared by both, and expands the cases that it covers.

Fixes #14102

Testing

Added tests

Docs

Copy link

changeset-bot bot commented Jul 31, 2025

🦋 Changeset detected

Latest commit: 060e13b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 31, 2025
Copy link

codspeed-hq bot commented Jul 31, 2025

CodSpeed Performance Report

Merging #14169 will not alter performance

Comparing trailing-slash-internal (060e13b) with main (62bd071)1

Summary

✅ 6 untouched benchmarks

Footnotes

  1. No successful run was found on main (c86b5bb) during the generation of this report, so 62bd071 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ascorbic ascorbic force-pushed the trailing-slash-internal branch from 8cc790d to f456bad Compare July 31, 2025 10:21
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test?

@ascorbic ascorbic requested a review from ematipico July 31, 2025 11:42
@ascorbic ascorbic merged commit f4e8889 into main Jul 31, 2025
24 of 28 checks passed
@ascorbic ascorbic deleted the trailing-slash-internal branch July 31, 2025 13:53
@astrobot-houston astrobot-houston mentioned this pull request Jul 31, 2025
richardnbanks pushed a commit to richardnbanks/astro-loader-youtube that referenced this pull request Sep 11, 2025
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`5.8.0` -> `5.13.7`](https://renovatebot.com/diffs/npm/astro/5.8.0/5.13.7) | [![age](https://developer.mend.io/api/mc/badges/age/npm/astro/5.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/5.8.0/5.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | [`3.5.3` -> `3.6.2`](https://renovatebot.com/diffs/npm/prettier/3.5.3/3.6.2) | [![age](https://developer.mend.io/api/mc/badges/age/npm/prettier/3.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/prettier/3.5.3/3.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [typescript](https://www.typescriptlang.org/) ([source](https://github.com/microsoft/TypeScript)) | [`5.8.3` -> `5.9.2`](https://renovatebot.com/diffs/npm/typescript/5.8.3/5.9.2) | [![age](https://developer.mend.io/api/mc/badges/age/npm/typescript/5.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/typescript/5.8.3/5.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>withastro/astro (astro)</summary>

### [`v5.13.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5137)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.7)

##### Patch Changes

- [#&#8203;14330](https://github.com/withastro/astro/pull/14330) [`72e14ab`](https://github.com/withastro/astro/commit/72e14abed6e20d31b1cd2caeeaa7e43703bf3aa3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes pinned package that is no longer needed.

- [#&#8203;14335](https://github.com/withastro/astro/pull/14335) [`17c7b03`](https://github.com/withastro/astro/commit/17c7b0395c00a0ea29dad9517b60bad3bd3a87a1) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Bumps `sharp` minimal version to `0.34.0`

### [`v5.13.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5136)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.6)

##### Patch Changes

- [#&#8203;14294](https://github.com/withastro/astro/pull/14294) [`e005855`](https://github.com/withastro/astro/commit/e0058553b2a6bb03fd864d77a1f07c25c60f7d91) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Restores the ability to use Google Analytics `History change trigger` with the `<ClientRouter />`.

- [#&#8203;14326](https://github.com/withastro/astro/pull/14326) [`c24a8f4`](https://github.com/withastro/astro/commit/c24a8f42a17410ea78fc2d68ff0105b931a381eb) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Updates `vite` version to fix CVE

- [#&#8203;14108](https://github.com/withastro/astro/pull/14108) [`218e070`](https://github.com/withastro/astro/commit/218e07054f4fe7a16e13479861dc162f6d886edc) Thanks [@&#8203;JusticeMatthew](https://github.com/JusticeMatthew)! - Updates dynamic route split regex to avoid infinite retries/exponential complexity

- [#&#8203;14327](https://github.com/withastro/astro/pull/14327) [`c1033be`](https://github.com/withastro/astro/commit/c1033beafa331bbd67f0ee76b47303deb3db806f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Pins simple-swizzle to avoid compromised version

### [`v5.13.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5135)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.5)

##### Patch Changes

- [#&#8203;14286](https://github.com/withastro/astro/pull/14286) [`09c5db3`](https://github.com/withastro/astro/commit/09c5db37d12862eef8d4ecf62389e10f30a22de9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGES only to the experimental CSP feature**

  The following runtime APIs of the `Astro` global have been renamed:

  - `Astro.insertDirective` to `Astro.csp.insertDirective`
  - `Astro.insertStyleResource` to `Astro.csp.insertStyleResource`
  - `Astro.insertStyleHash` to `Astro.csp.insertStyleHash`
  - `Astro.insertScriptResource` to `Astro.csp.insertScriptResource`
  - `Astro.insertScriptHash` to `Astro.csp.insertScriptHash`

  The following runtime APIs of the `APIContext` have been renamed:

  - `ctx.insertDirective` to `ctx.csp.insertDirective`
  - `ctx.insertStyleResource` to `ctx.csp.insertStyleResource`
  - `ctx.insertStyleHash` to `ctx.csp.insertStyleHash`
  - `ctx.insertScriptResource` to `ctx.csp.insertScriptResource`
  - `ctx.insertScriptHash` to `ctx.csp.insertScriptHash`

- [#&#8203;14283](https://github.com/withastro/astro/pull/14283) [`3224637`](https://github.com/withastro/astro/commit/3224637eca5c065872d92449216cb33baac2dbfd) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where CSP headers were incorrectly injected in the development server.

- [#&#8203;14275](https://github.com/withastro/astro/pull/14275) [`3e2f20d`](https://github.com/withastro/astro/commit/3e2f20d07e92b1acfadb1357a59b6952e85227f3) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds support for experimental CSP when using experimental fonts

  Experimental fonts now integrate well with experimental CSP by injecting hashes for the styles it generates, as well as `font-src` directives.

  No action is required to benefit from it.

- [#&#8203;14280](https://github.com/withastro/astro/pull/14280) [`4b9fb73`](https://github.com/withastro/astro/commit/4b9fb736dab42b8864012db0a981d3441366c388) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused cookies to not be correctly set when using middleware sequences

- [#&#8203;14276](https://github.com/withastro/astro/pull/14276) [`77281c4`](https://github.com/withastro/astro/commit/77281c4616b65959715dcbac42bf948bebfee755) Thanks [@&#8203;ArmandPhilippot](https://github.com/ArmandPhilippot)! - Adds a missing export for `resolveSrc`, a documented image services utility.

### [`v5.13.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5134)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.4)

##### Patch Changes

- [#&#8203;14260](https://github.com/withastro/astro/pull/14260) [`86a1e40`](https://github.com/withastro/astro/commit/86a1e40ce21b629a956057b059d06ba78bd89402) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes `Astro.url.pathname` to respect `trailingSlash: 'never'` configuration when using a base path. Previously, the root path with a base would incorrectly return `/base/` instead of `/base` when `trailingSlash` was set to 'never'.

- [#&#8203;14248](https://github.com/withastro/astro/pull/14248) [`e81c4bd`](https://github.com/withastro/astro/commit/e81c4bd1cca6739192d33068cbfb2c9e4ced1ffe) Thanks [@&#8203;julesyoungberg](https://github.com/julesyoungberg)! - Fixes a bug where actions named 'apply' do not work due to being a function prototype method.

### [`v5.13.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5133)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.3)

##### Patch Changes

- [#&#8203;14239](https://github.com/withastro/astro/pull/14239) [`d7d93e1`](https://github.com/withastro/astro/commit/d7d93e19fbfa52cf74dee40f5af6b7ea6a7503d2) Thanks [@&#8203;wtchnm](https://github.com/wtchnm)! - Fixes a bug where the types for the live content collections were not being generated correctly in dev mode

- [#&#8203;14221](https://github.com/withastro/astro/pull/14221) [`eadc9dd`](https://github.com/withastro/astro/commit/eadc9dd277d0075d7bff0e33c7a86f3fb97fdd61) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes JSON schema support for content collections using the `file()` loader

- [#&#8203;14229](https://github.com/withastro/astro/pull/14229) [`1a9107a`](https://github.com/withastro/astro/commit/1a9107a4049f43c1e4e9f40e07033f6bfe4398e4) Thanks [@&#8203;jonmichaeldarby](https://github.com/jonmichaeldarby)! - Ensures `Astro.currentLocale` returns the correct locale during SSG for pages that use a locale param (such as `[locale].astro` or `[locale]/index.astro`, which produce `[locale].html`)

### [`v5.13.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5132)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.2)

##### Patch Changes

- [`4d16de7`](https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Improves the detection of remote paths in the `_image` endpoint. Now `href` parameters that start with `//` are considered remote paths.

- Updated dependencies \[[`4d16de7`](https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820)]:
  - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.2
  - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.6

### [`v5.13.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5131)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.1)

##### Patch Changes

- [#&#8203;14225](https://github.com/withastro/astro/pull/14225) [`f2490ab`](https://github.com/withastro/astro/commit/f2490aba420a8999c0e8d12b9e1e69d4e33ae29e) Thanks [@&#8203;delucis](https://github.com/delucis)! - Fixes the `experimental.chromeDevtoolsWorkspace` feature.

### [`v5.13.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5130)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.13.0)

##### Minor Changes

- [#&#8203;14173](https://github.com/withastro/astro/pull/14173) [`39911b8`](https://github.com/withastro/astro/commit/39911b823d4617d99cc95e4b7584e9e4b7b90038) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Adds an experimental flag `staticImportMetaEnv` to disable the replacement of `import.meta.env` values with `process.env` calls and their coercion of environment variable values. This supersedes the `rawEnvValues` experimental flag, which is now removed.

  Astro allows you to configure a [type-safe schema for your environment variables](https://docs.astro.build/en/guides/environment-variables/#type-safe-environment-variables), and converts variables imported via `astro:env` into the expected type. This is the recommended way to use environment variables in Astro, as it allows you to easily see and manage whether your variables are public or secret, available on the client or only on the server at build time, and the data type of your values.

  However, you can still access environment variables through `process.env` and `import.meta.env` directly when needed. This was the only way to use environment variables in Astro before `astro:env` was added in Astro 5.0, and Astro's default handling of `import.meta.env` includes some logic that was only needed for earlier versions of Astro.

  The `experimental.staticImportMetaEnv` flag updates the behavior of `import.meta.env` to align with [Vite's handling of environment variables](https://vite.dev/guide/env-and-mode.html#env-variables) and for better ease of use with Astro's current implementations and features. **This will become the default behavior in Astro 6.0**, and this early preview is introduced as an experimental feature.

  Currently, non-public `import.meta.env` environment variables are replaced by a reference to `process.env`. Additionally, Astro may also convert the value type of your environment variables used through `import.meta.env`, which can prevent access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted to a number).

  The `experimental.staticImportMetaEnv` flag simplifies Astro's default behavior, making it easier to understand and use. Astro will no longer replace any `import.meta.env` environment variables with a `process.env` call, nor will it coerce values.

  To enable this feature, add the experimental flag in your Astro config and remove `rawEnvValues` if it was enabled:

  ```diff
  // astro.config.mjs
  import { defineConfig } from "astro/config";

  export default defineConfig({
  +  experimental: {
  +    staticImportMetaEnv: true
  -    rawEnvValues: false
  +  }
  });
  ```

##### Updating your project

If you were relying on Astro's default coercion, you may need to update your project code to apply it manually:

```diff
// src/components/MyComponent.astro
- const enabled: boolean = import.meta.env.ENABLED;
+ const enabled: boolean = import.meta.env.ENABLED === "true";
```

If you were relying on the transformation into `process.env` calls, you may need to update your project code to apply it manually:

```diff
// src/components/MyComponent.astro
- const enabled: boolean = import.meta.env.DB_PASSWORD;
+ const enabled: boolean = process.env.DB_PASSWORD;
```

You may also need to update types:

```diff
// src/env.d.ts
interface ImportMetaEnv {
  readonly PUBLIC_POKEAPI: string;
-  readonly DB_PASSWORD: string;
-  readonly ENABLED: boolean;
+  readonly ENABLED: string;
}

interface ImportMeta {
  readonly env: ImportMetaEnv;
}

+ namespace NodeJS {
+  interface ProcessEnv {
+    DB_PASSWORD: string;
+  }
+ }
```

See the [experimental static `import.meta.env` documentation](https://docs.astro.build/en/reference/experimental-flags/static-import-meta-env/) for more information about this feature. You can learn more about using environment variables in Astro, including `astro:env`, in the [environment variables documentation](https://docs.astro.build/en/guides/environment-variables/).

- [#&#8203;14122](https://github.com/withastro/astro/pull/14122) [`41ed3ac`](https://github.com/withastro/astro/commit/41ed3ac54adf1025a38031757ee0bfaef8504092) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for automatic [Chrome DevTools workspace folders](https://developer.chrome.com/docs/devtools/workspaces)

  This feature allows you to edit files directly in the browser and have those changes reflected in your local file system via a connected workspace folder. This allows you to apply edits such as CSS tweaks without leaving your browser tab!

  With this feature enabled, the Astro dev server will automatically configure a Chrome DevTools workspace for your project. Your project will then appear as a workspace source, ready to connect. Then, changes that you make in the "Sources" panel are automatically saved to your project source code.

  To enable this feature, add the experimental flag `chromeDevtoolsWorkspace` to your Astro config:

  ```js
  // astro.config.mjs
  import { defineConfig } from 'astro/config';

  export default defineConfig({
    experimental: {
      chromeDevtoolsWorkspace: true,
    },
  });
  ```

  See the [experimental Chrome DevTools workspace feature documentation](https://docs.astro.build/en/reference/experimental-flags/chrome-devtools-workspace/) for more information.

### [`v5.12.9`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5129)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.9)

##### Patch Changes

- [#&#8203;14020](https://github.com/withastro/astro/pull/14020) [`9518975`](https://github.com/withastro/astro/commit/951897553921c1419fb96aef74d42ec99976d8be) Thanks [@&#8203;jp-knj](https://github.com/jp-knj) and [@&#8203;asieradzk](https://github.com/asieradzk)! - Prevent double-prefixed redirect paths when using fallback and redirectToDefaultLocale together

  Fixes an issue where i18n fallback routes would generate double-prefixed paths (e.g., `/es/es/test/item1/`) when `fallback` and `redirectToDefaultLocale` configurations were used together. The fix adds proper checks to prevent double prefixing in route generation.

- [#&#8203;14199](https://github.com/withastro/astro/pull/14199) [`3e4cb8e`](https://github.com/withastro/astro/commit/3e4cb8e52a83974cc2671d13fb1b4595fe65085d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented HMR from working with inline styles

### [`v5.12.8`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5128)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.8)

##### Patch Changes

- [`0567fb7`](https://github.com/withastro/astro/commit/0567fb7b50c0c452be387dd7c7264b96bedab48f) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds `//` to list of internal path prefixes that do not have automated trailing slash handling

- [#&#8203;13894](https://github.com/withastro/astro/pull/13894) [`b36e72f`](https://github.com/withastro/astro/commit/b36e72f11fbcc0f3d5826f2b1939084f1fb1e3a8) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes Astro Studio commands from the CLI help

- Updated dependencies \[[`0567fb7`](https://github.com/withastro/astro/commit/0567fb7b50c0c452be387dd7c7264b96bedab48f)]:
  - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.1
  - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.5

### [`v5.12.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5127)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.7)

##### Patch Changes

- [#&#8203;14169](https://github.com/withastro/astro/pull/14169) [`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Skips trailing slash handling for paths that start with `/.`.

- [#&#8203;14170](https://github.com/withastro/astro/pull/14170) [`34e6b3a`](https://github.com/withastro/astro/commit/34e6b3a87dd3e9be4886059d1c0efee4c5fa3cda) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where static redirects couldn't correctly generate a redirect when the destination is a prerendered route, and the `output` is set to `"server"`.

- [#&#8203;14169](https://github.com/withastro/astro/pull/14169) [`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented images from being displayed in dev when using the Netlify adapter with `trailingSlash` set to `always`

- Updated dependencies \[[`f4e8889`](https://github.com/withastro/astro/commit/f4e8889c10c25aeb7650b389c35a70780d5ed172)]:
  - [@&#8203;astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@&#8203;0.7.0
  - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.4

### [`v5.12.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5126)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.6)

##### Patch Changes

- [#&#8203;14153](https://github.com/withastro/astro/pull/14153) [`29e9283`](https://github.com/withastro/astro/commit/29e928391a90844f8b701a581c4f163e0b6c46db) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Fixes a regression introduced by a recent optimisation of how SVG images are emitted during the build.

- [#&#8203;14156](https://github.com/withastro/astro/pull/14156) [`592f08d`](https://github.com/withastro/astro/commit/592f08d1b4a3e03c61b34344e36cb772bd67709a) Thanks [@&#8203;TheOtterlord](https://github.com/TheOtterlord)! - Fix the client router not submitting forms if the active URL contained a hash

- [#&#8203;14160](https://github.com/withastro/astro/pull/14160) [`d2e25c6`](https://github.com/withastro/astro/commit/d2e25c6e9d52160d4f8d8cbf7bc44e6794483f20) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that meant some remote image URLs could cause invalid filenames to be used for processed images

- [#&#8203;14167](https://github.com/withastro/astro/pull/14167) [`62bd071`](https://github.com/withastro/astro/commit/62bd0717ab810c049ed7f3f63029895dfb402797) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented destroyed sessions from being deleted from storage unless the session had been loaded

### [`v5.12.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5125)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.5)

##### Patch Changes

- [#&#8203;14059](https://github.com/withastro/astro/pull/14059) [`19f53eb`](https://github.com/withastro/astro/commit/19f53eb59dfeeff08078cec0a903c8722b5650ca) Thanks [@&#8203;benosmac](https://github.com/benosmac)! - Fixes a bug in i18n implementation, where Astro didn't emit the correct pages when `fallback` is enabled, and a locale uses a catch-all route, e.g. `src/pages/es/[...catchAll].astro`

- [#&#8203;14155](https://github.com/withastro/astro/pull/14155) [`31822c3`](https://github.com/withastro/astro/commit/31822c3f0c8401e20129d0fc6bf8d1d670249265) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused an error "serverEntrypointModule\[\_start] is not a function" in some adapters

### [`v5.12.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5124)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.4)

##### Patch Changes

- [#&#8203;14031](https://github.com/withastro/astro/pull/14031) [`e9206c1`](https://github.com/withastro/astro/commit/e9206c192fc4a4dbf2d02f921fa540f987ccbe89) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Optimized the build pipeline for SVG images. Now, Astro doesn't reprocess images that have already been processed.

- [#&#8203;14132](https://github.com/withastro/astro/pull/14132) [`976879a`](https://github.com/withastro/astro/commit/976879a400af9f44aee52c9112a7bd9788163588) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the property `Astro.routePattern`/`context.routePattern` wasn't updated when using a rewrite via middleware.

- [#&#8203;14131](https://github.com/withastro/astro/pull/14131) [`aafc4d7`](https://github.com/withastro/astro/commit/aafc4d7f8b3f198ace24a8a7f6cc9298771542da) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where an error occurring in a middleware would show the dev overlay instead of the custom `500.astro` page

- [#&#8203;14127](https://github.com/withastro/astro/pull/14127) [`2309ada`](https://github.com/withastro/astro/commit/2309ada1c6d96c75815eda0760656147de435ba2) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades zod

- [#&#8203;14134](https://github.com/withastro/astro/pull/14134) [`186c201`](https://github.com/withastro/astro/commit/186c201a1bd83593c880ab784d79f69245b445c2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Throws a more helpful error in dev if trying to use a server island without an adapter

- [#&#8203;14129](https://github.com/withastro/astro/pull/14129) [`3572d85`](https://github.com/withastro/astro/commit/3572d85ba89ef9c374f3631654eee704adf00e73) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where the CSP headers was incorrectly added to a page when using an adapter.

### [`v5.12.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5123)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.3)

##### Patch Changes

- [#&#8203;14119](https://github.com/withastro/astro/pull/14119) [`14807a4`](https://github.com/withastro/astro/commit/14807a4581b5ba2e61bc63ef9ef9f14848564edd) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused builds to fail if a client directive was mistakenly added to an Astro component

- [#&#8203;14001](https://github.com/withastro/astro/pull/14001) [`4b03d9c`](https://github.com/withastro/astro/commit/4b03d9c9d9237d9af38425062559eafdfc27f76f) Thanks [@&#8203;dnek](https://github.com/dnek)! - Fixes an issue where `getImage()` assigned the resized base URL to the srcset URL of `ImageTransform`, which matched the width, height, and format of the original image.

### [`v5.12.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5122)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.2)

##### Patch Changes

- [#&#8203;14071](https://github.com/withastro/astro/pull/14071) [`d2cb35d`](https://github.com/withastro/astro/commit/d2cb35d2b7ff999fea8aa39c79f9f048c3500aeb) Thanks [@&#8203;Grisoly](https://github.com/Grisoly)! - Exposes the `Code` component `lang` prop type:

  ```ts
  import type { CodeLanguage } from 'astro';
  ```

- [#&#8203;14111](https://github.com/withastro/astro/pull/14111) [`5452ee6`](https://github.com/withastro/astro/commit/5452ee67f95f51dcfdca8c1988b29f89553efe1c) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that prevented "key" from being used as a prop for Astro components in MDX

- [#&#8203;14106](https://github.com/withastro/astro/pull/14106) [`b5b39e4`](https://github.com/withastro/astro/commit/b5b39e4d4bf5e5816bccf7fbfd9a48e4d8ee302a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Exits with non-zero exit code when config has an error

- [#&#8203;14112](https://github.com/withastro/astro/pull/14112) [`37458b3`](https://github.com/withastro/astro/commit/37458b31aeee23df0b5a8ab9e319a23ee4eddc6d) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that meant that SVG components could no longer be serialized with `JSON.stringify`

- [#&#8203;14061](https://github.com/withastro/astro/pull/14061) [`c7a7dd5`](https://github.com/withastro/astro/commit/c7a7dd5f612b302f02a0ff468beeadd8e142a5ad) Thanks [@&#8203;jonasgeiler](https://github.com/jonasgeiler)! - Add module declaration for `?no-inline` asset imports

- [#&#8203;14109](https://github.com/withastro/astro/pull/14109) [`5a08fa2`](https://github.com/withastro/astro/commit/5a08fa22b4023810fea45876f62152bd196e6062) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Throw a more helpful error if defineLiveCollection is used outside of a live.config file

- [#&#8203;14110](https://github.com/withastro/astro/pull/14110) [`e7dd4e1`](https://github.com/withastro/astro/commit/e7dd4e1116103892ddc6a83052c8f1ba25d8abdc) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Warn if duplicate IDs are found by file loader

### [`v5.12.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5121)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.1)

##### Patch Changes

- [#&#8203;14094](https://github.com/withastro/astro/pull/14094) [`22e9087`](https://github.com/withastro/astro/commit/22e90873f85d7b5b5d556f456362656f04b32341) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Correct types to allow `priority` on all images

- [#&#8203;14091](https://github.com/withastro/astro/pull/14091) [`26c6b6d`](https://github.com/withastro/astro/commit/26c6b6db264f9cbd98ddf97c3f7a34ec7f488095) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused a type error when defining session options without a driver

- [#&#8203;14082](https://github.com/withastro/astro/pull/14082) [`93322cb`](https://github.com/withastro/astro/commit/93322cbe36c40401256eea2a9e34f5fbe13a28ec) Thanks [@&#8203;louisescher](https://github.com/louisescher)! - Fixes an issue where Astro's default 404 route would incorrectly match routes containing "/404" in dev

- [#&#8203;14089](https://github.com/withastro/astro/pull/14089) [`687d253`](https://github.com/withastro/astro/commit/687d25365a41ff8a9e6da155d3527f841abb70dd) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:env` would not load the right environments variables in dev

- [#&#8203;14092](https://github.com/withastro/astro/pull/14092) [`6692c71`](https://github.com/withastro/astro/commit/6692c71ed609690ebf6a697d88582130a5cbfdfb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Improves error handling in live collections

- [#&#8203;14074](https://github.com/withastro/astro/pull/14074) [`144a950`](https://github.com/withastro/astro/commit/144a950b55f22c2beeff710e5672e9fa611520b3) Thanks [@&#8203;abcfy2](https://github.com/abcfy2)! - Fixes a bug that caused some image service builds to fail

- [#&#8203;14092](https://github.com/withastro/astro/pull/14092) [`6692c71`](https://github.com/withastro/astro/commit/6692c71ed609690ebf6a697d88582130a5cbfdfb) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a case where zod could not be imported from `astro:content` virtual module in live collection config

### [`v5.12.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5120)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.12.0)

##### Minor Changes

- [#&#8203;13971](https://github.com/withastro/astro/pull/13971) [`fe35ee2`](https://github.com/withastro/astro/commit/fe35ee2835997e7e6c3e1975dc6dacfa1052a765) Thanks [@&#8203;adamhl8](https://github.com/adamhl8)! - Adds an experimental flag `rawEnvValues` to disable coercion of `import.meta.env` values (e.g. converting strings to other data types) that are populated from `process.env`

  Astro allows you to configure a [type-safe schema for your environment variables](https://docs.astro.build/en/guides/environment-variables/#type-safe-environment-variables), and converts variables imported via `astro:env` into the expected type.

  However, Astro also converts your environment variables used through `import.meta.env` in some cases, and this can prevent access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted to a number).

  The `experimental.rawEnvValues` flag disables coercion of `import.meta.env` values that are populated from `process.env`, allowing you to use the raw value.

  To enable this feature, add the experimental flag in your Astro config:

  ```diff
  import { defineConfig } from "astro/config"

  export default defineConfig({
  +  experimental: {
  +    rawEnvValues: true,
  +  }
  })
  ```

  If you were relying on this coercion, you may need to update your project code to apply it manually:

  ```ts diff
  - const enabled: boolean = import.meta.env.ENABLED
  + const enabled: boolean = import.meta.env.ENABLED === "true"
  ```

  See the [experimental raw environment variables reference docs](https://docs.astro.build/en/reference/experimental-flags/raw-env-values/) for more information.

- [#&#8203;13941](https://github.com/withastro/astro/pull/13941) [`6bd5f75`](https://github.com/withastro/astro/commit/6bd5f75806cb4df39d9e4e9b1f2225dcfdd724b0) Thanks [@&#8203;aditsachde](https://github.com/aditsachde)! - Adds support for TOML files to Astro's built-in `glob()` and `file()` content loaders.

  In Astro 5.2, Astro added support for using TOML frontmatter in Markdown files instead of YAML. However, if you wanted to use TOML files as local content collection entries themselves, you needed to write your own loader.

  Astro 5.12 now directly supports loading data from TOML files in content collections in both the `glob()` and the `file()` loaders.

  If you had added your own TOML content parser for the `file()` loader, you can now remove it as this functionality is now included:

  ```diff
  // src/content.config.ts
  import { defineCollection } from "astro:content";
  import { file } from "astro/loaders";
  - import { parse as parseToml } from "toml";
  const dogs = defineCollection({
  -  loader: file("src/data/dogs.toml", { parser: (text) => parseToml(text) }),
  + loader: file("src/data/dogs.toml")
    schema: /* ... */
  })
  ```

  Note that TOML does not support top-level arrays. Instead, the `file()` loader considers each top-level table to be an independent entry. The table header is populated in the `id` field of the entry object.

  See Astro's [content collections guide](https://docs.astro.build/en/guides/content-collections/#built-in-loaders) for more information on using the built-in content loaders.

##### Patch Changes

- Updated dependencies \[[`6bd5f75`](https://github.com/withastro/astro/commit/6bd5f75806cb4df39d9e4e9b1f2225dcfdd724b0)]:
  - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;6.3.3

### [`v5.11.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5112)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.11.2)

##### Patch Changes

- [#&#8203;14064](https://github.com/withastro/astro/pull/14064) [`2eb77d8`](https://github.com/withastro/astro/commit/2eb77d8f54be3faea38370693d33fb220231ea84) Thanks [@&#8203;jp-knj](https://github.com/jp-knj)! - Allows using `tsconfig` `compilerOptions.paths` without setting `compilerOptions.baseUrl`

- [#&#8203;14068](https://github.com/withastro/astro/pull/14068) [`10189c0`](https://github.com/withastro/astro/commit/10189c0b44881fd22bac69acc182834d597d9603) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Fixes the incorrect CSS import path shown in the terminal message during Tailwind integration setup.

### [`v5.11.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5111)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.11.1)

##### Patch Changes

- [#&#8203;14045](https://github.com/withastro/astro/pull/14045) [`3276b79`](https://github.com/withastro/astro/commit/3276b798d4ecb41c98f97e94d4ddeaa91aa25013) Thanks [@&#8203;ghubo](https://github.com/ghubo)! - Fixes a problem where importing animated `.avif` files returns a `NoImageMetadata` error.

- [#&#8203;14041](https://github.com/withastro/astro/pull/14041) [`0c4d5f8`](https://github.com/withastro/astro/commit/0c4d5f8d57d166fc24d12b37cf208d263f330868) Thanks [@&#8203;dixslyf](https://github.com/dixslyf)! - Fixes a `<ClientRouter />` bug where the fallback view transition animations when exiting a page
  ran too early for browsers that do not support the View Transition API.
  This bug prevented `event.viewTransition?.skipTransition()` from skipping the page exit animation
  when used in an `astro:before-swap` event hook.

### [`v5.11.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5110)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.11.0)

##### Minor Changes

- [#&#8203;13972](https://github.com/withastro/astro/pull/13972) [`db8f8be`](https://github.com/withastro/astro/commit/db8f8becc9508fa4f292d45c14af92ba59c414d1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Updates the `NodeApp.match()` function in the Adapter API to accept a second, optional parameter to allow adapter authors to add headers to static, prerendered pages.

  `NodeApp.match(request)` currently checks whether there is a route that matches the given `Request`. If there is a prerendered route, the function returns `undefined`, because static routes are already rendered and their headers cannot be updated.

  When the new, optional boolean parameter is passed (e.g. `NodeApp.match(request, true)`), Astro will return the first matched route, even when it's a prerendered route. This allows your adapter to now access static routes and provides the opportunity to set headers for these pages, for example, to implement a Content Security Policy (CSP).

##### Patch Changes

- [#&#8203;14029](https://github.com/withastro/astro/pull/14029) [`42562f9`](https://github.com/withastro/astro/commit/42562f9d7b0bef173aca631f9d59e1bf000133c5) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where server islands wouldn't be correctly rendered when they are rendered inside fragments.

  Now the following examples work as expected:

### [`v5.10.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5102)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.10.2)

##### Patch Changes

- [#&#8203;14000](https://github.com/withastro/astro/pull/14000) [`3cbedae`](https://github.com/withastro/astro/commit/3cbedae129579b93f5c18c900ae66c6c11c46da5) Thanks [@&#8203;feelixe](https://github.com/feelixe)! - Fix routePattern JSDoc examples to show correct return values

- [#&#8203;13990](https://github.com/withastro/astro/pull/13990) [`de6cfd6`](https://github.com/withastro/astro/commit/de6cfd6dc8e53911190b2b5788e0508e557f86eb) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes a case where `astro:config/client` and `astro:config/server` virtual modules would not contain config passed to integrations `updateConfig()` during the build

- [#&#8203;14019](https://github.com/withastro/astro/pull/14019) [`a160d1e`](https://github.com/withastro/astro/commit/a160d1e8b711b7a214e54406fdf85be2b7338ed2) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Removes the requirement to set `type: 'live'` when defining experimental live content collections

  Previously, live collections required a `type` and `loader` configured. Now, Astro can determine that your collection is a `live` collection without defining it explicitly.

  This means it is now safe to remove `type: 'live'` from your collections defined in `src/live.config.ts`:

  ```diff
  import { defineLiveCollection } from 'astro:content';
  import { storeLoader } from '@&#8203;mystore/astro-loader';

  const products = defineLiveCollection({
  -  type: 'live',
    loader: storeLoader({
      apiKey: process.env.STORE_API_KEY,
      endpoint: 'https://api.mystore.com/v1',
    }),
  });

  export const collections = { products };
  ```

  This is not a breaking change: your existing live collections will continue to work even if you still include `type: 'live'`. However, we suggest removing this line at your earliest convenience for future compatibility when the feature becomes stable and this config option may be removed entirely.

- [#&#8203;13966](https://github.com/withastro/astro/pull/13966) [`598da21`](https://github.com/withastro/astro/commit/598da21746a6b9cda023c818804b32dc37b9819b) Thanks [@&#8203;msamoylov](https://github.com/msamoylov)! - Fixes a broken link on the default 404 page in development

### [`v5.10.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5101)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.10.1)

##### Patch Changes

- [#&#8203;13988](https://github.com/withastro/astro/pull/13988) [`609044c`](https://github.com/withastro/astro/commit/609044ca6a6254b1db11bb3fc8e0bb54213eab8e) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a bug in live collections that caused it to incorrectly complain about the collection being defined in the wrong file

- [#&#8203;13909](https://github.com/withastro/astro/pull/13909) [`b258d86`](https://github.com/withastro/astro/commit/b258d86d47086d3a17d6d9e6b79ac21f9770f765) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes rendering of special boolean attributes for custom elements

- [#&#8203;13983](https://github.com/withastro/astro/pull/13983) [`e718375`](https://github.com/withastro/astro/commit/e718375c1714a631eba75f70118653cf93a4326d) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the toolbar audit would incorrectly flag images processed by Astro in content collections documents

- [#&#8203;13999](https://github.com/withastro/astro/pull/13999) [`f077b68`](https://github.com/withastro/astro/commit/f077b68f4debe8d716a8610e561b4fe17b1245b3) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds `lastModified` field to experimental live collection cache hints

  Live loaders can now set a `lastModified` field in the cache hints for entries and collections to indicate when the data was last modified. This is then available in the `cacheHint` field returned by `getCollection` and `getEntry`.

- [#&#8203;13987](https://github.com/withastro/astro/pull/13987) [`08f34b1`](https://github.com/withastro/astro/commit/08f34b19c8953426ce35093414a27ecd8d405309) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds an informative message in dev mode when the CSP feature is enabled.

- [#&#8203;14005](https://github.com/withastro/astro/pull/14005) [`82aad62`](https://github.com/withastro/astro/commit/82aad62efd2b817cc9cff46b606fedaa64e0c922) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where inline styles and scripts didn't work when CSP was enabled. Now when adding `<styles>` elements inside an Astro component, their hashes care correctly computed.

- [#&#8203;13985](https://github.com/withastro/astro/pull/13985) [`0b4c641`](https://github.com/withastro/astro/commit/0b4c641b22b31d0dea15911c0daba995a48261a9) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Updates wrong link

### [`v5.10.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5100)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.10.0)

##### Minor Changes

- [#&#8203;13917](https://github.com/withastro/astro/pull/13917) [`e615216`](https://github.com/withastro/astro/commit/e615216c55bca5d61b8c5c1b49d62671f0238509) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds a new `priority` attribute for Astro's image components.

  This change introduces a new `priority` option for the `<Image />` and `<Picture />` components, which automatically sets the `loading`, `decoding`, and `fetchpriority` attributes to their optimal values for above-the-fold images which should be loaded immediately.

  It is a boolean prop, and you can use the shorthand syntax by simply adding `priority` as a prop to the `<Image />` or `<Picture />` component. When set, it will apply the following attributes:

  - `loading="eager"`
  - `decoding="sync"`
  - `fetchpriority="high"`

  The individual attributes can still be set manually if you need to customize your images further.

  By default, the Astro [`<Image />` component](https://docs.astro.build/en/guides/images/#display-optimized-images-with-the-image--component) generates `<img>` tags that lazy-load their content by setting `loading="lazy"` and `decoding="async"`. This improves performance by deferring the loading of images that are not immediately visible in the viewport, and gives the best scores in performance audits like Lighthouse.

  The new `priority` attribute will override those defaults and automatically add the best settings for your high-priority assets.

  This option was previously available for experimental responsive images, but now it is a standard feature for all images.

##### Usage

```astro
<Image src="/path/to/image.jpg" alt="An example image" priority />
```

> \[!Note]
> You should only use the `priority` option for images that are critical to the initial rendering of the page, and ideally only one image per page. This is often an image identified as the [LCP element](https://web.dev/articles/lcp) when running Lighthouse tests. Using it for too many images will lead to performance issues, as it forces the browser to load those images immediately, potentially blocking the rendering of other content.

- [#&#8203;13917](https://github.com/withastro/astro/pull/13917) [`e615216`](https://github.com/withastro/astro/commit/e615216c55bca5d61b8c5c1b49d62671f0238509) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - The responsive images feature introduced behind a flag in [v5.0.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#500) 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 <Image /> or <Picture /> 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](https://docs.astro.build/en/guides/images/#responsive-image-behavior).

##### 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

```diff
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.

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

The experimental image configuration options have been renamed:

**Before:**

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

**After:**

```js
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:

```astro
<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](https://docs.astro.build/en/guides/images/#responsive-image-behavior) for more information on using responsive images in Astro.

- [#&#8203;13685](https://github.com/withastro/astro/pull/13685) [`3c04c1f`](https://github.com/withastro/astro/commit/3c04c1f43027e2f9be0854f65c549fa1832f622a) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Adds experimental support for live content collections

  Live content collections are a new type of [content collection](https://docs.astro.build/en/guides/content-collections/) that fetch their data at runtime rather than build time. This allows you to access frequently-updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.

##### Live collections vs build-time collections

In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via `getEntry()` and `getCollection()`. The data is cached between builds, giving fast access and updates.

However there is no method for updating the data store between builds, meaning any updates to the data need a full site deploy, even if the pages are rendered on-demand. This means that content collections are not suitable for pages that update frequently. Instead, today these pages tend to access the APIs directly in the frontmatter. This works, but leads to a lot of boilerplate, and means users don't benefit from the simple, unified API that content loaders offer. In most cases users tend to individually create loader libraries that they share between pages.

Live content collections solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.

##### How to use

To enable live collections add the `experimental.liveContentCollections` flag to your `astro.config.mjs` file:

```js title="astro.config.mjs"
{
  experimental: {
    liveContentCollections: true,
  },
}
```

Then create a new `src/live.config.ts` file (alongside your `src/content.config.ts` if you have one) to define your live collections with a [live loader](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/#creating-a-live-loader) and optionally a [schema](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/#using-zod-schemas) using the new `defineLiveCollection()` function from the `astro:content` module.

```ts title="src/live.config.ts"
import { defineLiveCollection } from 'astro:content';
import { storeLoader } from '@&#8203;mystore/astro-loader';

const products = defineLiveCollection({
  type: 'live',
  loader: storeLoader({
    apiKey: process.env.STORE_API_KEY,
    endpoint: 'https://api.mystore.com/v1',
  }),
});

export const collections = { products };
```

You can then use the dedicated `getLiveCollection()` and `getLiveEntry()` functions to access your live data:

### [`v5.9.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#594)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.9.4)

##### Patch Changes

- [#&#8203;13951](https://github.com/withastro/astro/pull/13951) [`7eb88f1`](https://github.com/withastro/astro/commit/7eb88f1e9113943b47e35e9f0033ab516f0a4f40) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Fixes a issue that caused errors when using an adapter-provided session driver with custom options

- [#&#8203;13953](https://github.com/withastro/astro/pull/13953) [`448bddc`](https://github.com/withastro/astro/commit/448bddc49492c6a92a23735cd29a93baec0dda48) Thanks [@&#8203;zaitovalisher](https://github.com/zaitovalisher)! - Fixes a bug where quotes were not added to the 'strict-dynamic' CSP directive

### [`v5.9.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#593)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.9.3)

##### Patch Changes

- [#&#8203;13923](https://github.com/withastro/astro/pull/13923) [`a9ac5ed`](https://github.com/withastro/astro/commit/a9ac5ed3ff461d1c8e66fc40df3205df67c63059) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Content Security Policy (CSP) only**

  Changes the behavior of experimental Content Security Policy (CSP) to now serve hashes differently depending on whether or not a page is prerendered:

  - Via the `<meta>` element for static pages.
  - Via the `Response` header `content-security-policy` for on-demand rendered pages.

  This new strategy allows you to add CSP content that is not supported in a `<meta>` element (e.g. `report-uri`, `frame-ancestors`, and sandbox directives) to on-demand rendered pages.

  No change to your project code is required as this is an implementation detail. However, this will result in a different HTML output for pages that are rendered on demand. Please check your production site to verify that CSP is working as intended.

  To keep up to date with this developing feature, or to leave feedback, visit the [CSP Roadmap proposal](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md).

- [#&#8203;13926](https://github.com/withastro/astro/pull/13926) [`953a249`](https://github.com/withastro/astro/commit/953a24924eda1ea564c97d10d68c97cbbc9db7a4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds a new Astro Adapter Feature called `experimentalStaticHeaders` to allow your adapter to receive the `Headers` for rendered static pages.

  Adapters that enable support for this feature can access header values directly, affecting their handling of some Astro features such as Content Security Policy (CSP). For example, Astro will no longer serve the CSP `<meta http-equiv="content-security-policy">` element in static pages to adapters with this support.

  Astro will serve the value of the header inside a map that can be retrieved from the hook `astro:build:generated`. Adapters can read this mapping and use their hosting headers capabilities to create a configuration file.

  A new field called `experimentalRouteToHeaders` will contain a map of `Map<IntegrationResolvedRoute, Headers>` where the `Headers` type contains the headers emitted by the rendered static route.

  To enable support for this experimental Astro Adapter Feature, add it to your `adapterFeatures` in your adapter config:

  ```js
  // my-adapter.mjs
  export default function createIntegration() {
    return {
      name: '@&#8203;example/my-adapter',
      hooks: {
        'astro:config:done': ({ setAdapter }) => {
          setAdapter({
            name: '@&#8203;example/my-adapter',
            serverEntrypoint: '@&#8203;example/my-adapter/server.js',
            adapterFeatures: {
              experimentalStaticHeaders: true,
            },
          });
        },
      },
    };
  }
  ```

  See the [Adapter API docs](https://docs.astro.build/en/reference/adapter-reference/#adapter-features) for more information about providing adapter features.

- [#&#8203;13697](https://github.com/withastro/astro/pull/13697) [`af83b85`](https://github.com/withastro/astro/commit/af83b85d6ea1e2e27ee2b9357f794fee0418f453) Thanks [@&#8203;benosmac](https://github.com/benosmac)! - Fixes issues with fallback route pattern matching when `i18n.routing.fallbackType` is `rewrite`.

  - Adds conditions for route matching in `generatePath` when building fallback routes and checking for existing translated pages

  Now for a route to be matched it needs to be inside a named `[locale]` folder. This fixes an issue where `route.pattern.test()` incorrectly matched dynamic routes, causing the page to be skipped.

  - Adds conditions for route matching in `findRouteToRewrite`

  Now the requested pathname must exist in `route.distURL` for a dynamic route to match. This fixes an issue where `route.pattern.test()` incorrectly matched dynamic routes, causing the build to fail.

- [#&#8203;13924](https://github.com/withastro/astro/pull/13924) [`1cd8c3b`](https://github.com/withastro/astro/commit/1cd8c3bafca39f3cfe2178d5db72480d30ed28c2) Thanks [@&#8203;qw-in](https://github.com/qw-in)! - Fixes an edge case where `isPrerendered` was incorrectly set to `false` for static redirects.

- [#&#8203;13926](https://github.com/withastro/astro/pull/13926) [`953a249`](https://github.com/withastro/astro/commit/953a24924eda1ea564c97d10d68c97cbbc9db7a4) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where the experimental CSP `meta` element wasn't placed in the `<head>` element as early as possible, causing these policies to not apply to styles and scripts that came before the `meta` element.

### [`v5.9.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#592)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.9.2)

##### Patch Changes

- [#&#8203;13919](https://github.com/withastro/astro/pull/13919) [`423fe60`](https://github.com/withastro/astro/commit/423fe6048dfb4c24d198611f60a5815459efacd3) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes a bug where Astro added quotes to the CSP resources.

  Only certain resources require quotes (e.g. `'self'` but not `https://cdn.example.com`), so Astro no longer adds quotes to any resources. You must now provide the quotes yourself for resources such as `'self'` when necessary:

  ```diff
  export default defineConfig({
    experimental: {
      csp: {
        styleDirective: {
          resources: [
  -          "self",
  +          "'self'",
            "https://cdn.example.com"
          ]
        }
      }
    }
  })
  ```

- [#&#8203;13914](https://github.com/withastro/astro/pull/13914) [`76c5480`](https://github.com/withastro/astro/commit/76c5480ac0ab1f64df38c23a848f8d28f7640562) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - **BREAKING CHANGE to the experimental Content Security Policy feature only**

  Removes support for experimental Content Security Policy (CSP) when using the `<ClientRouter />` component for view transitions.

  It is no longer possible to enable experimental CSP while using Astro's view transitions. Support was already unstable with the `<ClientRouter />` because CSP required making its underlying implementation asynchronous. This caused breaking changes for several users and therefore, this PR removes support completely.

  If you are currently using the component for view transitions, please remove the experimental CSP flag as they cannot be used together.

  ```diff
  import { defineConfig } from 'astro/config';

  export default defineConfig({
    experimental: {
  -   csp: true
     }
  });
  ```

  Alternatively, to continue using experimental CSP in your project, you can [consider migrating to the browser native View Transition API](https://events-3bg.pages.dev/jotter/astro-view-transitions/) and remove the `<ClientRouter />` from your project. You may be able to achieve similar results if you are not using Astro's enhancements to the native View Transitions and Navigation APIs.

  Support might be reintroduced in future releases. You can follow this experimental feature's development in [the CSP RFC](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md).

### [`v5.9.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#591)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.9.1)

##### Patch Changes

- [#&#8203;13899](https://github.com/withastro/astro/pull/13899) [`7a1303d`](https://github.com/withastro/astro/commit/7a1303dbcebe0f0b5c8c3278669af5577115c0a3) Thanks [@&#8203;reknih](https://github.com/reknih)! - Fix bug where error pages would return invalid bodies if the upstream response was compressed

- [#&#8203;13902](https://github.com/withastro/astro/pull/13902) [`051bc30`](https://github.com/withastro/astro/commit/051bc3025523756474ff5be350a7680e9fed3384) Thanks [@&#8203;arHSM](https://github.com/arHSM)! - Fixes a bug where vite virtual module ids were incorrectly added in the dev server

- [#&#8203;13905](https://github.com/withastro/astro/pull/13905) [`81f71ca`](https://github.com/withastro/astro/commit/81f71ca6fd8b313b055eb4659c02a8e0e0335204) Thanks [@&#8203;jsparkdev](https://github.com/jsparkdev)! - Fixes wrong contents in CSP meta tag.

- [#&#8203;13907](https://github.com/withastro/astro/pull/13907) [`8246bcc`](https://github.com/withastro/astro/commit/8246bcc0008880a49d9374136ec44488b629a2c3) Thanks [@&#8203;martrapp](https://github.com/martrapp)! - Fixes a bug that caused view transition names to be lost.

- [#&#8203;13901](https://github.com/withastro/astro/pull/13901) [`37fa0a2`](https://github.com/withastro/astro/commit/37fa0a228cdfdaf20dd135835fdc84337f2d9637) Thanks [@&#8203;ansg191](https://github.com/ansg191)! - fix fallback not being removed when server island is rendered

### [`v5.9.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#590)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.9.0)

##### Minor Changes

- [#&#8203;13802](https://github.com/withastro/astro/pull/13802) [`0eafe14`](https://github.com/withastro/astro/commit/0eafe14b08c627b116842ea0a5299a00f9baa3d1) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Adds experimental Content Security Policy (CSP) support

  CSP is an important feature to provide fine-grained control over resources that can or cannot be downloaded and executed by a document. In particular, it can help protect against [cross-site scripting (XSS)](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks.

  Enabling this feature adds additional security to Astro's handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types. This new experimental feature has been designed to work in every Astro rendering environment (static pages, dynamic pages and single page applications), while giving you maximum flexibility and with type-safety in mind.

  It is compatible with most of Astro's features such as client islands, and server islands, although Astro's view transitions using the `<ClientRouter />` are not yet fully supported. Inline scripts are not supported out of the box, but you can provide your own hashes for external and inline scripts.

  To enable this feature, add the experimental flag in your Astro config:

  ```js
  // astro.config.mjs
  import { defineConfig } from 'astro/config';

  export default defineConfig({
    experimental: {
      csp: true,
    },
  });
  ```

  For more information on enabling and using this feature in your project, see the [Experimental CSP docs](https://docs.astro.build/en/reference/experimental-flags/csp/).

  For a complete overview, and to give feedback on this experimental API, see the [Content Security Policy RFC](https://github.com/withastro/roadmap/blob/feat/rfc-csp/proposals/0055-csp.md).

- [#&#8203;13850](https://github.com/withastro/astro/pull/13850) [`1766d22`](https://github.com/withastro/astro/commit/1766d222e7bb4adb6d15090e2d6331a0d8978303) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Provides a Markdown renderer to content loaders

  When creating a content loader, you will now have access to a `renderMarkdown` function that allows you to render Markdown content directly within your loaders. It uses the same settings and plugins as the renderer used for Markdown files in Astro, and follows any Markdown settings you have configured in your Astro project.

  This allows you to render Markdown content from various sources, such as a CMS or other data sources, directly in your loaders without needing to preprocess the Markdown content separately.

  ```ts
  import type { Loader } from 'astro/loaders';
  import { loadFromCMS } from './cms';

  export function myLoader(settings): Loader {
    return {
      name: 'my-loader',
      async load({ renderMarkdown, store }) {
        const entries = await loadFromCMS();

        store.clear();

        for (const entry of entries) {
          // Assume each entry has a 'content' field with markdown content
          store.set({
            id: entry.id,
            data: entry,
            rendered: await renderMarkdown(entry.content),
          });
        }
      },
    };
  }
  ```

  The return value of `renderMarkdown` is an object with two properties: `html` and `metadata`. These match the `rendered` property of content entries in content collections, so you can use them to render the content in your components or pages.

### [`v5.8.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#582)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.8.2)

##### Patch Changes

- [#&#8203;13877](https://github.com/withastro/astro/pull/13877) [`5a7797f`](https://github.com/withastro/astro/commit/5a7797fdd6ad3f1377e2719c79da9486a232dfcd) Thanks [@&#8203;yuhang-dong](https://github.com/yuhang-dong)! - Fixes a bug that caused `Astro.rewrite` to fail when used in `sequence`d middleware

- [#&#8203;13872](https://github.com/withastro/astro/pull/13872) [`442b841`](https://github.com/withastro/astro/commit/442b8413dc9d29892499cfa97e54798a3a6ee136) Thanks [@&#8203;isVivek99](https://github.com/isVivek99)! - Fixes rendering of the `download` attribute when it has a boolean value

### [`v5.8.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#581)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.8.1)

##### Patch Changes

- [#&#8203;13037](https://github.com/withastro/astro/pull/13037) [`de2fc9b`](https://github.com/withastro/astro/commit/de2fc9b3c406c21683b8a692fafa3cbc77ca552b) Thanks [@&#8203;nanarino](https://github.com/nanarino)! - Fixes rendering of the `popover` attribute when it has a boolean value

- [#&#8203;13851](https://github.com/withastro/astro/pull/13851) [`45ae95a`](https://github.com/withastro/astro/commit/45ae95a507d5e83b5e38ce1b338c3202ab7e8d76) Thanks [@&#8203;ascorbic](https://github.com/ascorbic)! - Allows disabling default styles for responsive images

  This change adds a new …
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
…ro#14169)

* fix: skip trailing slash redirection for more internal paths

* Changes from review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[@astrojs/[email protected]] <Image> component fails to load remote images via Netlify CDN during local development
2 participants