Merge branch 'main' into feat/fonts

This commit is contained in:
Florian Lefebvre 2025-01-17 14:32:53 +01:00 committed by GitHub
commit fdb31411b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
373 changed files with 4847 additions and 3633 deletions

View file

@ -1,5 +0,0 @@
---
'astro': patch
---
Adds types for `?url&inline` and `?url&no-inline` [import queries](https://vite.dev/guide/assets.html#explicit-inline-handling) added in Vite 6

View file

@ -1,5 +0,0 @@
---
'astro': patch
---
Fixed changes to vite configuration made in the astro:build:setup integration hook having no effect when target is "client"

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug that caused references to be incorrectly reported as invalid

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug in dev where files would stop being watched if the Astro config file was edited

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug where the content layer would use an outdated version of the Astro config if it was edited in dev

View file

@ -1,36 +0,0 @@
---
'astro': minor
---
Adds experimental session support
Sessions are used to store user state between requests for server-rendered pages, such as login status, shopping cart contents, or other user-specific data.
```astro
---
export const prerender = false; // Not needed in 'server' mode
const cart = await Astro.session.get('cart');
---
<a href="/checkout">🛒 {cart?.length ?? 0} items</a>
```
Sessions are available in on-demand rendered/SSR pages, API endpoints, actions and middleware. To enable session support, you must configure a storage driver.
If you are using the Node.js adapter, you can use the `fs` driver to store session data on the filesystem:
```js
// astro.config.mjs
{
adapter: node({ mode: 'standalone' }),
experimental: {
session: {
// Required: the name of the Unstorage driver
driver: "fs",
},
},
}
```
If you are deploying to a serverless environment, you can use drivers such as `redis` or `netlifyBlobs` or `cloudflareKV` and optionally pass additional configuration options.
For more information, including using the session API with other adapters and a full list of supported drivers, see [the docs for experimental session support](https://docs.astro.build/en/reference/experimental-flags/sessions/). For even more details, and to leave feedback and participate in the development of this feature, [the Sessions RFC](https://github.com/withastro/roadmap/pull/1055).

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a case where `astro:actions` types would not work when using `src/actions.ts`

View file

@ -1,7 +0,0 @@
---
'astro': minor
---
Improves asset caching of remote images
Astro will now store [entity tags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) and the [Last-Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) date for cached remote images and use them to revalidate the cache when it goes stale.

View file

@ -1,5 +0,0 @@
---
'astro': patch
---
Clears the content layer cache when the Astro config is changed

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug that caused the dev server to return an error if requesting "//"

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug that caused Astro to attempt to inject environment variables into non-source files, causing performance problems and broken builds

View file

@ -1,44 +0,0 @@
---
'astro': minor
---
Adds a new `getActionPath()` helper available from `astro:actions`
Astro 5.1 introduces a new helper function, `getActionPath()` to give you more flexibility when calling your action.
Calling `getActionPath()` with your action returns its URL path so you can make a `fetch()` request with custom headers, or use your action with an API such as `navigator.sendBeacon()`. Then, you can [handle the custom-formatted returned data](https://docs.astro.build/en/guides/actions/#handling-returned-data) as needed, just as if you had called an action directly.
This example shows how to call a defined `like` action passing the `Authorization` header and the [`keepalive`](https://developer.mozilla.org/en-US/docs/Web/API/Request/keepalive) option:
```astro
<script>
// src/components/my-component.astro
import { actions, getActionPath } from 'astro:actions'
await fetch(getActionPath(actions.like), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({ id: 'YOUR_ID' }),
keepalive: true
})
</script>
```
This example shows how to call the same `like` action using the [`sendBeacon`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) API:
```astro
<script>
// src/components/my-component.astro
import { actions, getActionPath } from 'astro:actions'
navigator.sendBeacon(
getActionPath(actions.like),
new Blob([JSON.stringify({ id: 'YOUR_ID' })], {
type: 'application/json'
})
)
</script>
```

View file

@ -3,6 +3,9 @@ name: Sync examples
on:
workflow_dispatch:
inputs:
checkout-ref:
type: string
required: false
skip-unchanged-check:
type: boolean
default: false
@ -31,16 +34,25 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2 # fetch 2 to compare with previous commit for changes
ref: ${{ inputs.checkout-ref }}
- name: Detect changesets
uses: bluwy/detect-changesets-action@v1
id: detect
- name: Get pre mode of changesets
id: pre
run: |
if [ -f ./.changeset/pre.json ]; then
pre_value=$(jq -r '.tag' ./.changeset/pre.json)
echo "value=$pre_value" >> $GITHUB_OUTPUT
fi
# We only do sync if there are no changesets, so we don't accidentally allow users
# to clone examples that may rely on unreleased code
- name: Sync from main branch to latest and examples/* branches
if: steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/main'
- name: Sync stable to latest and examples/* branches
if: steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/main' && steps.pre.outputs.value == ''
uses: bluwy/auto-branch-sync-action@v1
with:
map: |
@ -49,38 +61,24 @@ jobs:
skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
dry-run: ${{ inputs.dry-run == true }}
- name: Check .changeset/pre.json for matching tag
if: steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/next'
id: check-pre-mode
run: |
if [ -f ./.changeset/pre.json ]; then
if grep -q '"tag": "alpha"' ./.changeset/pre.json; then
echo "alpha=true" >> $GITHUB_OUTPUT
elif grep -q '"tag": "beta"' ./.changeset/pre.json; then
echo "beta=true" >> $GITHUB_OUTPUT
elif grep -q '"tag": "rc"' ./.changeset/pre.json; then
echo "rc=true" >> $GITHUB_OUTPUT
fi
fi
- name: Sync from next branch to alpha branch
if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.alpha == 'true'
- name: Sync prerelease to alpha branch
if: steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'alpha'
uses: bluwy/auto-branch-sync-action@v1
with:
map: / -> alpha
skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
dry-run: ${{ inputs.dry-run == true }}
- name: Sync from next branch to beta branch
if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.beta == 'true'
- name: Sync prerelease to beta branch
if: steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'beta'
uses: bluwy/auto-branch-sync-action@v1
with:
map: / -> beta
skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
dry-run: ${{ inputs.dry-run == true }}
- name: Sync from next branch to rc branch
if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.rc == 'true'
- name: Sync prerelease to rc branch
if: steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'rc'
uses: bluwy/auto-branch-sync-action@v1
with:
map: / -> rc

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ dist/
.vercel
.netlify
_site/
.astro/
scripts/smoke/*-main/
scripts/memory/project/src/pages/
benchmark/projects/

View file

@ -3,4 +3,6 @@
* previous artifacts here before generating files.
* @param {URL} projectDir
*/
// biome-ignore lint/correctness/noUnusedVariables: parameters here are template placeholders
// biome-ignore lint/correctness/noUnusedFunctionParameters: (same as above)
export async function run(projectDir) {}

View file

@ -11,7 +11,7 @@
},
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/node": "^8.3.4",
"@astrojs/node": "^9.0.0",
"@benchmark/timer": "workspace:*",
"@benchmark/adapter": "workspace:*",
"astro": "workspace:*",
@ -21,10 +21,10 @@
"port-authority": "^2.0.1",
"pretty-bytes": "^6.1.1",
"sharp": "^0.33.3",
"tinyexec": "^0.3.1"
"tinyexec": "^0.3.2"
},
"devDependencies": {
"@codspeed/vitest-plugin": "3.1.1",
"vitest": "2.1.8"
"@codspeed/vitest-plugin": "4.0.0",
"vitest": "^3.0.0-beta.4"
}
}

View file

@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.9"
"astro": "^5.1.7"
}
}

View file

@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.2",
"@astrojs/rss": "^4.0.10",
"@astrojs/mdx": "^4.0.6",
"@astrojs/rss": "^4.0.11",
"@astrojs/sitemap": "^3.2.1",
"astro": "^5.0.9"
"astro": "^5.1.7"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.9"
"astro": "^5.1.7"
},
"peerDependencies": {
"astro": "^4.0.0 || ^5.0.0"

View file

@ -11,14 +11,14 @@
"test": "vitest run"
},
"dependencies": {
"@astrojs/react": "^4.1.1",
"astro": "^5.0.9",
"@astrojs/react": "^4.1.5",
"astro": "^5.1.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vitest": "^2.1.6"
"vitest": "^3.0.0-beta.4"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1"
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5"
}
}

View file

@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.3",
"astro": "^5.0.9"
"@astrojs/alpinejs": "^0.4.1",
"@types/alpinejs": "^3.13.11",
"alpinejs": "^3.14.8",
"astro": "^5.1.7"
}
}

View file

@ -10,19 +10,19 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^4.0.0",
"@astrojs/react": "^4.1.1",
"@astrojs/solid-js": "^5.0.0",
"@astrojs/svelte": "^7.0.1",
"@astrojs/vue": "^5.0.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^5.0.9",
"preact": "^10.24.3",
"@astrojs/preact": "^4.0.2",
"@astrojs/react": "^4.1.5",
"@astrojs/solid-js": "^5.0.3",
"@astrojs/svelte": "^7.0.3",
"@astrojs/vue": "^5.0.5",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "^5.1.7",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.1.16",
"vue": "^3.5.12"
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^4.0.0",
"@preact/signals": "^1.3.0",
"astro": "^5.0.9",
"preact": "^10.24.3"
"@astrojs/preact": "^4.0.2",
"@preact/signals": "^2.0.1",
"astro": "^5.1.7",
"preact": "^10.25.4"
}
}

View file

@ -10,10 +10,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/react": "^4.1.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^5.0.9",
"@astrojs/react": "^4.1.5",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "^5.1.7",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}

View file

@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/solid-js": "^5.0.0",
"astro": "^5.0.9",
"solid-js": "^1.9.3"
"@astrojs/solid-js": "^5.0.3",
"astro": "^5.1.7",
"solid-js": "^1.9.4"
}
}

View file

@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/svelte": "^7.0.1",
"astro": "^5.0.9",
"svelte": "^5.1.16"
"@astrojs/svelte": "^7.0.3",
"astro": "^5.1.7",
"svelte": "^5.17.3"
}
}

View file

@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/vue": "^5.0.2",
"astro": "^5.0.9",
"vue": "^3.5.12"
"@astrojs/vue": "^5.0.5",
"astro": "^5.1.7",
"vue": "^3.5.13"
}
}

View file

@ -11,6 +11,6 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0",
"astro": "^5.0.9"
"astro": "^5.1.7"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.9"
"astro": "^5.1.7"
},
"peerDependencies": {
"astro": "^4.0.0"

View file

@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.9"
"astro": "^5.1.7"
}
}

View file

@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.9"
"astro": "^5.1.7"
}
}

View file

@ -12,8 +12,8 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0",
"@astrojs/svelte": "^7.0.1",
"astro": "^5.0.9",
"svelte": "^5.1.16"
"@astrojs/svelte": "^7.0.3",
"astro": "^5.1.7",
"svelte": "^5.17.3"
}
}

View file

@ -9,8 +9,8 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.9",
"sass": "^1.80.6",
"astro": "^5.1.7",
"sass": "^1.83.1",
"sharp": "^0.33.3"
}
}

View file

@ -8,6 +8,7 @@ const { title = SiteTitle, name = SiteTitle, description = SiteDescription, ...s
---
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<SEO {title} {description} {name} {...seo} />
<link rel="preconnect" href="https://fonts.googleapis.com" />

View file

@ -15,6 +15,7 @@
"./app": "./dist/app.js"
},
"devDependencies": {
"astro": "^5.0.9"
"@types/node": "^18.17.8",
"astro": "^5.1.7"
}
}

View file

@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/markdoc": "^0.12.3",
"astro": "^5.0.9"
"@astrojs/markdoc": "^0.12.6",
"astro": "^5.1.7"
}
}

View file

@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.2",
"@astrojs/preact": "^4.0.0",
"astro": "^5.0.9",
"preact": "^10.24.3"
"@astrojs/mdx": "^4.0.6",
"@astrojs/preact": "^4.0.2",
"astro": "^5.1.7",
"preact": "^10.25.4"
}
}

View file

@ -10,10 +10,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^4.0.0",
"@astrojs/preact": "^4.0.2",
"@nanostores/preact": "^0.5.2",
"astro": "^5.0.9",
"astro": "^5.1.7",
"nanostores": "^0.11.3",
"preact": "^10.24.3"
"preact": "^10.25.4"
}
}

View file

@ -10,13 +10,13 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.2",
"@astrojs/tailwind": "^5.1.3",
"@types/canvas-confetti": "^1.6.4",
"astro": "^5.0.9",
"@astrojs/mdx": "^4.0.6",
"@astrojs/tailwind": "^5.1.4",
"@types/canvas-confetti": "^1.9.0",
"astro": "^5.1.7",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.14"
"tailwindcss": "^3.4.17"
}
}

View file

@ -11,7 +11,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^5.0.9",
"vitest": "^2.1.6"
"astro": "^5.1.7",
"vitest": "^3.0.0-beta.4"
}
}

View file

@ -57,19 +57,19 @@
"@astrojs/check": "^0.9.4",
"@biomejs/biome": "1.9.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.10",
"@changesets/cli": "^2.27.11",
"@types/node": "^18.17.8",
"esbuild": "^0.21.5",
"eslint": "^9.15.0",
"esbuild": "^0.24.2",
"eslint": "^9.18.0",
"eslint-plugin-regexp": "^2.7.0",
"globby": "^14.0.2",
"only-allow": "^1.2.1",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"publint": "^0.2.12",
"publint": "^0.3.2",
"turbo": "^2.3.3",
"typescript": "~5.7.2",
"typescript-eslint": "^8.16.0"
"typescript": "~5.7.3",
"typescript-eslint": "^8.19.1"
},
"pnpm": {
"peerDependencyRules": {

View file

@ -1,5 +1,11 @@
# @astrojs/rss
## 4.0.11
### Patch Changes
- [#12829](https://github.com/withastro/astro/pull/12829) [`ebe2aa9`](https://github.com/withastro/astro/commit/ebe2aa95c7f4a6559cec8b82d155da34a57bdd53) Thanks [@SapphicMoe](https://github.com/SapphicMoe)! - Revert incorrect Content-Type header applied for RSS XML file
## 4.0.10
### Patch Changes
@ -170,7 +176,7 @@
### Patch Changes
- [#7066](https://github.com/withastro/astro/pull/7066) [`a37e67b52`](https://github.com/withastro/astro/commit/a37e67b520dc35dbf40313c77490a97446de2f74) Thanks [@TheOtterlord](https://github.com/TheOtterlord)! - Fix pubDate schema tranformation
- [#7066](https://github.com/withastro/astro/pull/7066) [`a37e67b52`](https://github.com/withastro/astro/commit/a37e67b520dc35dbf40313c77490a97446de2f74) Thanks [@TheOtterlord](https://github.com/TheOtterlord)! - Fix pubDate schema transformation
- [#7104](https://github.com/withastro/astro/pull/7104) [`826e02890`](https://github.com/withastro/astro/commit/826e0289005f645b902375b98d5549c6a95ccafa) Thanks [@bluwy](https://github.com/bluwy)! - Specify `"files"` field to only publish necessary files

View file

@ -1,7 +1,7 @@
{
"name": "@astrojs/rss",
"description": "Add RSS feeds to your Astro projects",
"version": "4.0.10",
"version": "4.0.11",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
@ -33,7 +33,7 @@
"xml2js": "0.6.2"
},
"dependencies": {
"fast-xml-parser": "^4.5.0",
"fast-xml-parser": "^4.5.1",
"kleur": "^4.1.5"
}
}

View file

@ -89,7 +89,7 @@ export default async function getRssResponse(rssOptions: RSSOptions): Promise<Re
const rssString = await getRssString(rssOptions);
return new Response(rssString, {
headers: {
'Content-Type': 'application/rss+xml; charset=utf-8',
'Content-Type': 'application/xml',
},
});
}

View file

@ -62,7 +62,7 @@ describe('rss', () => {
assertXmlDeepEqual(str, validXmlResult);
const contentType = response.headers.get('Content-Type');
assert.equal(contentType, 'application/rss+xml; charset=utf-8');
assert.equal(contentType, 'application/xml');
});
it('should be the same string as getRssString', async () => {

View file

@ -1,5 +1,227 @@
# astro
## 5.1.7
### Patch Changes
- [#12361](https://github.com/withastro/astro/pull/12361) [`3d89e62`](https://github.com/withastro/astro/commit/3d89e6282235a8da45d9ddfe02bcf7ec78056941) Thanks [@LunaticMuch](https://github.com/LunaticMuch)! - Upgrades the `esbuild` version to match `vite`
- [#12980](https://github.com/withastro/astro/pull/12980) [`1a026af`](https://github.com/withastro/astro/commit/1a026afb427cd4b472c8f1174a08f10086f4fb89) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where setting the status of a page to `404` in development would show the default 404 page (or custom one if provided) instead of using the current page
- [#12182](https://github.com/withastro/astro/pull/12182) [`c30070b`](https://github.com/withastro/astro/commit/c30070b9271e4c494e7cbf3a1c45515782034911) Thanks [@braden-w](https://github.com/braden-w)! - Improves matching of 404 and 500 routes
- Updated dependencies [[`3d89e62`](https://github.com/withastro/astro/commit/3d89e6282235a8da45d9ddfe02bcf7ec78056941)]:
- @astrojs/markdown-remark@6.0.2
## 5.1.6
### Patch Changes
- [#12956](https://github.com/withastro/astro/pull/12956) [`3aff68a`](https://github.com/withastro/astro/commit/3aff68a4195a608e92dc6299610a4b06e7bb96f1) Thanks [@kaytwo](https://github.com/kaytwo)! - Removes encryption of empty props to allow server island cacheability
- [#12977](https://github.com/withastro/astro/pull/12977) [`80067c0`](https://github.com/withastro/astro/commit/80067c032f9ce5852f3315d1046b2d0c220ddcd5) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where accessing `astro:env` APIs or `import.meta.env` inside the content config file would not work
- [#12839](https://github.com/withastro/astro/pull/12839) [`57be349`](https://github.com/withastro/astro/commit/57be3494e2bdc178d073243c8cbfa10edb85b049) Thanks [@mtwilliams-code](https://github.com/mtwilliams-code)! - Fix Astro.currentLocale returning the incorrect locale when using fallback rewrites in SSR mode
- [#12962](https://github.com/withastro/astro/pull/12962) [`4b7a2ce`](https://github.com/withastro/astro/commit/4b7a2ce9e743a5624617563022635678a5ba6051) Thanks [@ascorbic](https://github.com/ascorbic)! - Skips updating content layer files if content is unchanged
- [#12942](https://github.com/withastro/astro/pull/12942) [`f00c2dd`](https://github.com/withastro/astro/commit/f00c2ddc31b5285d14c2f0808c01eafaaf31f5c9) Thanks [@liruifengv](https://github.com/liruifengv)! - Improves the session error messages
- [#12966](https://github.com/withastro/astro/pull/12966) [`d864e09`](https://github.com/withastro/astro/commit/d864e0991e05438d4bdb5e14fab4f7f75efe2a1f) Thanks [@ascorbic](https://github.com/ascorbic)! - Ensures old content collection entry is deleted if a markdown frontmatter slug is changed in dev
## 5.1.5
### Patch Changes
- [#12934](https://github.com/withastro/astro/pull/12934) [`673a518`](https://github.com/withastro/astro/commit/673a518b011e2df35a099f8205611d98a223a92a) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a regression where the Astro Container didn't work during the build, using `pnpm`
- [#12955](https://github.com/withastro/astro/pull/12955) [`db447f2`](https://github.com/withastro/astro/commit/db447f2816836b635355cc2b0a73678facd155a5) Thanks [@martrapp](https://github.com/martrapp)! - Lets TypeScript know about the "blocking" and "disabled" attributes of the `<link>` element.
- [#12922](https://github.com/withastro/astro/pull/12922) [`faf74af`](https://github.com/withastro/astro/commit/faf74af522f4499ab95531b24a0a1c14070abe8b) Thanks [@adamchal](https://github.com/adamchal)! - Improves performance of static asset generation by fixing a bug that caused image transforms to be performed serially. This fix ensures that processing uses all CPUs when running in a multi-core environment.
- [#12947](https://github.com/withastro/astro/pull/12947) [`3c2292f`](https://github.com/withastro/astro/commit/3c2292f2f0accf1974b30dbe32f040c56413e731) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused empty content collections when running dev with NODE_ENV set
## 5.1.4
### Patch Changes
- [#12927](https://github.com/withastro/astro/pull/12927) [`ad2a752`](https://github.com/withastro/astro/commit/ad2a752662946e3a80849605f073812b06adf632) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a bug where Astro attempted to decode a request URL multiple times, resulting in an unexpected behaviour when decoding the character `%`
- [#12912](https://github.com/withastro/astro/pull/12912) [`0c0c66b`](https://github.com/withastro/astro/commit/0c0c66bf0df23ab5a9bd2f147e303d8397d3222e) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Improves the config error for invalid combinations of `context` and `access` properties under `env.schema`
- [#12935](https://github.com/withastro/astro/pull/12935) [`3d47e6b`](https://github.com/withastro/astro/commit/3d47e6baff7a17d3ef09630b0d90362baef41f97) Thanks [@AirBorne04](https://github.com/AirBorne04)! - Fixes an issue where `Astro.locals` coming from an adapter weren't available in the `404.astro`, when using the `astro dev` command,
- [#12925](https://github.com/withastro/astro/pull/12925) [`44841fc`](https://github.com/withastro/astro/commit/44841fc281f8920b32f4b4a94deefeb3ad069cf3) Thanks [@ascorbic](https://github.com/ascorbic)! - Ensures image styles are not imported unless experimental responsive images are enabled
- [#12926](https://github.com/withastro/astro/pull/12926) [`8e64bb7`](https://github.com/withastro/astro/commit/8e64bb727f78f24b26fd1c0b1289ab1ccd611114) Thanks [@oliverlynch](https://github.com/oliverlynch)! - Improves remote image cache efficiency by separating image data and metadata into a binary and sidecar JSON file.
- [#12920](https://github.com/withastro/astro/pull/12920) [`8b9d530`](https://github.com/withastro/astro/commit/8b9d53037879cd7ca7bee4d20b4e6f08e984a7df) Thanks [@bluwy](https://github.com/bluwy)! - Processes markdown with empty body as remark and rehype plugins may add additional content or frontmatter
- [#12918](https://github.com/withastro/astro/pull/12918) [`fd12a26`](https://github.com/withastro/astro/commit/fd12a26ac6012c6b8a26f5a178e1bb46092a1806) Thanks [@lameuler](https://github.com/lameuler)! - Fixes a bug where the logged output path does not match the actual output path when using `build.format: 'preserve'`
- [#12676](https://github.com/withastro/astro/pull/12676) [`2ffc0fc`](https://github.com/withastro/astro/commit/2ffc0fcab78b658a6ee73a8f8b291802093dce5e) Thanks [@koyopro](https://github.com/koyopro)! - Allows configuring Astro modules TypeScript compilation with the `vite.esbuild` config
- [#12938](https://github.com/withastro/astro/pull/12938) [`dbb04f3`](https://github.com/withastro/astro/commit/dbb04f3c04ce868b5c985c848a2c40a3761a6dad) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug where content collections would sometimes appear empty when first running astro dev
- [#12937](https://github.com/withastro/astro/pull/12937) [`30edb6d`](https://github.com/withastro/astro/commit/30edb6d9d0aaf28bea1fec73879f63fe134507d0) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a bug where users could use `Astro.request.headers` during a rewrite inside prerendered routes. This an invalid behaviour, and now Astro will show a warning if this happens.
- [#12937](https://github.com/withastro/astro/pull/12937) [`30edb6d`](https://github.com/withastro/astro/commit/30edb6d9d0aaf28bea1fec73879f63fe134507d0) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the use of `Astro.rewrite` would trigger the invalid use of `Astro.request.headers`
## 5.1.3
### Patch Changes
- [#12877](https://github.com/withastro/astro/pull/12877) [`73a0788`](https://github.com/withastro/astro/commit/73a078835eb92a05c3f681ee025c93d6db85b907) Thanks [@bluwy](https://github.com/bluwy)! - Fixes sourcemap warning generated by the `astro:server-islands` Vite plugin
- [#12906](https://github.com/withastro/astro/pull/12906) [`2d89492`](https://github.com/withastro/astro/commit/2d89492d73142ed5c7cea9448d841a9892e66598) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused pages that return an empty array from getStaticPath to match every path
- [`011fa0f`](https://github.com/withastro/astro/commit/011fa0f00ce457cb6b582d36b6b5b17aa89f0a70) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `astro:content` types would be erased when restarting the dev server
- [#12907](https://github.com/withastro/astro/pull/12907) [`dbf1275`](https://github.com/withastro/astro/commit/dbf1275987d4d9724eab471f1600fba9a50aefb8) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a regression around the server islands route, which was not passed to the adapters `astro:build:done` hook
- [#12818](https://github.com/withastro/astro/pull/12818) [`579bd93`](https://github.com/withastro/astro/commit/579bd93794b787485479aa3b16554409a0504ed2) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes race condition where dev server would attempt to load collections before the content had loaded
- [#12883](https://github.com/withastro/astro/pull/12883) [`fbac92f`](https://github.com/withastro/astro/commit/fbac92f8bdbb5ee1312726b2a535a81271b3f7d6) Thanks [@kaytwo](https://github.com/kaytwo)! - Fixes a bug where responses can be returned before session data is saved
- [#12815](https://github.com/withastro/astro/pull/12815) [`3acc654`](https://github.com/withastro/astro/commit/3acc65444c27d87b6f2d61bdfa7df0e0db4e2686) Thanks [@ericswpark](https://github.com/ericswpark)! - Some non-index files that were incorrectly being treated as index files are now excluded
- [#12884](https://github.com/withastro/astro/pull/12884) [`d7e97a7`](https://github.com/withastro/astro/commit/d7e97a775dda7a851bfc10b06161f9a1d3631ed3) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds `render()` to stub content types
- [#12883](https://github.com/withastro/astro/pull/12883) [`fbac92f`](https://github.com/withastro/astro/commit/fbac92f8bdbb5ee1312726b2a535a81271b3f7d6) Thanks [@kaytwo](https://github.com/kaytwo)! - Fixes a bug where session data could be corrupted if it is changed after calling .set()
- [#12827](https://github.com/withastro/astro/pull/12827) [`7b5dc6f`](https://github.com/withastro/astro/commit/7b5dc6f0f1fbb825f52cd587aa1f7d21d731b3de) Thanks [@sinskiy](https://github.com/sinskiy)! - Fixes an issue when crawlers try to index Server Islands thinking that Server Islands are pages
## 5.1.2
### Patch Changes
- [#12798](https://github.com/withastro/astro/pull/12798) [`7b0cb85`](https://github.com/withastro/astro/commit/7b0cb852f6336c0f9cc65bd044864004e759d810) Thanks [@ascorbic](https://github.com/ascorbic)! - Improves warning logs for invalid content collection configuration
- [#12781](https://github.com/withastro/astro/pull/12781) [`96c4b92`](https://github.com/withastro/astro/commit/96c4b925333fede1a53d19657d15e0052da90780) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a regression that caused `default()` to not work with `reference()`
- [#12820](https://github.com/withastro/astro/pull/12820) [`892dd9f`](https://github.com/withastro/astro/commit/892dd9f6cd3935ce1d4f4dec523b248c2d15da12) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug that caused cookies to not be deleted when destroying a session
- [#12864](https://github.com/withastro/astro/pull/12864) [`440d8a5`](https://github.com/withastro/astro/commit/440d8a54f7b3d75dd16decb7d9d29e3724bff394) Thanks [@kaytwo](https://github.com/kaytwo)! - Fixes a bug where the session ID wasn't correctly regenerated
- [#12768](https://github.com/withastro/astro/pull/12768) [`524c855`](https://github.com/withastro/astro/commit/524c855075bb75696500445fdc31cb2c69b09627) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't print error logs when Astro Islands were used in incorrect cases.
- [#12814](https://github.com/withastro/astro/pull/12814) [`f12f111`](https://github.com/withastro/astro/commit/f12f1118bc4687cc807a4495ffcaafcb0861b7a2) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't log anything in case a file isn't created during the build.
- [#12875](https://github.com/withastro/astro/pull/12875) [`e109002`](https://github.com/withastro/astro/commit/e109002c3d5980362788360211e61f11f4394837) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug in emulated legacy collections where the entry passed to the getCollection filter function did not include the legacy entry fields.
- [#12768](https://github.com/withastro/astro/pull/12768) [`524c855`](https://github.com/withastro/astro/commit/524c855075bb75696500445fdc31cb2c69b09627) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where Astro was printing the incorrect output format when running the `astro build` command
- [#12810](https://github.com/withastro/astro/pull/12810) [`70a9f0b`](https://github.com/withastro/astro/commit/70a9f0b984638c21a4da1d83b7d5a5c9940bb693) Thanks [@louisescher](https://github.com/louisescher)! - Fixes server islands failing to check content-type header under certain circumstances
Sometimes a reverse proxy or similar service might modify the content-type header to include the charset or other parameters in the media type of the response. This previously wasn't handled by the client-side server island script and thus removed the script without actually placing the requested content in the DOM. This fix makes it so the script checks if the header starts with the proper content type instead of exactly matching `text/html`, so the following will still be considered a valid header: `text/html; charset=utf-8`
- [#12816](https://github.com/withastro/astro/pull/12816) [`7fb2184`](https://github.com/withastro/astro/commit/7fb21844dff893c90dc0a07fd13cefdba61d0a45) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where an injected route entrypoint wasn't correctly marked because the resolved file path contained a query parameter.
This fixes some edge case where some injected entrypoint were not resolved when using an adapter.
## 5.1.1
### Patch Changes
- [#12782](https://github.com/withastro/astro/pull/12782) [`f3d8385`](https://github.com/withastro/astro/commit/f3d83854aa671df4db6f95558a7ef5bad4bc64f9) Thanks [@fhiromasa](https://github.com/fhiromasa)! - update comment in packages/astro/src/types/public/common.ts
- [#12789](https://github.com/withastro/astro/pull/12789) [`f632b94`](https://github.com/withastro/astro/commit/f632b945275c2615fc0fdf2abc831c45d0ddebcd) Thanks [@ascorbic](https://github.com/ascorbic)! - Pass raw frontmatter to remark plugins in glob loader
- [#12799](https://github.com/withastro/astro/pull/12799) [`739dbfb`](https://github.com/withastro/astro/commit/739dbfba4214107cf8fc40c702834dad33eed3b0) Thanks [@ascorbic](https://github.com/ascorbic)! - Upgrades Vite to pin esbuild
## 5.1.0
### Minor Changes
- [#12441](https://github.com/withastro/astro/pull/12441) [`b4fec3c`](https://github.com/withastro/astro/commit/b4fec3c7d17ed92dcaaeea5e2545aae6dfd19e53) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds experimental session support
Sessions are used to store user state between requests for server-rendered pages, such as login status, shopping cart contents, or other user-specific data.
```astro
---
export const prerender = false; // Not needed in 'server' mode
const cart = await Astro.session.get('cart');
---
<a href="/checkout">🛒 {cart?.length ?? 0} items</a>
```
Sessions are available in on-demand rendered/SSR pages, API endpoints, actions and middleware. To enable session support, you must configure a storage driver.
If you are using the Node.js adapter, you can use the `fs` driver to store session data on the filesystem:
```js
// astro.config.mjs
{
adapter: node({ mode: 'standalone' }),
experimental: {
session: {
// Required: the name of the unstorage driver
driver: "fs",
},
},
}
```
If you are deploying to a serverless environment, you can use drivers such as `redis`, `netlify-blobs`, `vercel-kv`, or `cloudflare-kv-binding` and optionally pass additional configuration options.
For more information, including using the session API with other adapters and a full list of supported drivers, see [the docs for experimental session support](https://docs.astro.build/en/reference/experimental-flags/sessions/). For even more details, and to leave feedback and participate in the development of this feature, [the Sessions RFC](https://github.com/withastro/roadmap/pull/1055).
- [#12426](https://github.com/withastro/astro/pull/12426) [`3dc02c5`](https://github.com/withastro/astro/commit/3dc02c57e4060cb2bde7c4e05d91841dd5dd8eb7) Thanks [@oliverlynch](https://github.com/oliverlynch)! - Improves asset caching of remote images
Astro will now store [entity tags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) and the [Last-Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) date for cached remote images and use them to revalidate the cache when it goes stale.
- [#12721](https://github.com/withastro/astro/pull/12721) [`c9d5110`](https://github.com/withastro/astro/commit/c9d51107d0a4b58a9ced486b28d09118f3885254) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `getActionPath()` helper available from `astro:actions`
Astro 5.1 introduces a new helper function, `getActionPath()` to give you more flexibility when calling your action.
Calling `getActionPath()` with your action returns its URL path so you can make a `fetch()` request with custom headers, or use your action with an API such as `navigator.sendBeacon()`. Then, you can [handle the custom-formatted returned data](https://docs.astro.build/en/guides/actions/#handling-returned-data) as needed, just as if you had called an action directly.
This example shows how to call a defined `like` action passing the `Authorization` header and the [`keepalive`](https://developer.mozilla.org/en-US/docs/Web/API/Request/keepalive) option:
```astro
<script>
// src/components/my-component.astro
import { actions, getActionPath } from 'astro:actions';
await fetch(getActionPath(actions.like), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer YOUR_TOKEN',
},
body: JSON.stringify({ id: 'YOUR_ID' }),
keepalive: true,
});
</script>
```
This example shows how to call the same `like` action using the [`sendBeacon`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) API:
```astro
<script>
// src/components/my-component.astro
import { actions, getActionPath } from 'astro:actions';
navigator.sendBeacon(
getActionPath(actions.like),
new Blob([JSON.stringify({ id: 'YOUR_ID' })], {
type: 'application/json',
}),
);
</script>
```
### Patch Changes
- [#12786](https://github.com/withastro/astro/pull/12786) [`e56af4a`](https://github.com/withastro/astro/commit/e56af4a3d7039673658e4a014158969ea5076e32) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where Astro i18n didn't properly show the 404 page when using fallback and the option `prefixDefaultLocale` set to `true`.
- [#12758](https://github.com/withastro/astro/pull/12758) [`483da89`](https://github.com/withastro/astro/commit/483da89cf68d68ec792ff8721d469ed10dc14e4a) Thanks [@delucis](https://github.com/delucis)! - Adds types for `?url&inline` and `?url&no-inline` [import queries](https://vite.dev/guide/assets.html#explicit-inline-handling) added in Vite 6
- [#12763](https://github.com/withastro/astro/pull/12763) [`8da2318`](https://github.com/withastro/astro/commit/8da231855162af245f2b3664babb68dff0ba390f) Thanks [@rbsummers](https://github.com/rbsummers)! - Fixed changes to vite configuration made in the astro:build:setup integration hook having no effect when target is "client"
- [#12767](https://github.com/withastro/astro/pull/12767) [`36c1e06`](https://github.com/withastro/astro/commit/36c1e0697da9fdc453a7a9a3c84e0e79cd0cb376) Thanks [@ascorbic](https://github.com/ascorbic)! - Clears the content layer cache when the Astro config is changed
## 5.0.9
### Patch Changes
@ -164,7 +386,7 @@
Both of these options can be overridden by setting your own values to the corresponding settings in your `tsconfig.json` file.
- [#11861](https://github.com/withastro/astro/pull/11861) [`3ab3b4e`](https://github.com/withastro/astro/commit/3ab3b4efbcdd2aabea5f949deedf51a5acefae59) Thanks [@bluwy](https://github.com/bluwy)! - Cleans up Astro-specfic metadata attached to `vfile.data` in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:
- [#11861](https://github.com/withastro/astro/pull/11861) [`3ab3b4e`](https://github.com/withastro/astro/commit/3ab3b4efbcdd2aabea5f949deedf51a5acefae59) Thanks [@bluwy](https://github.com/bluwy)! - Cleans up Astro-specific metadata attached to `vfile.data` in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:
- `vfile.data.__astroHeadings` -> `vfile.data.astro.headings`
- `vfile.data.imagePaths` -> `vfile.data.astro.imagePaths`
@ -884,7 +1106,7 @@
{ "dogs": [{}], "cats": [{}] }
```
You can seperate these collections by passing a custom `parser` to the `file()` loader like so:
You can separate these collections by passing a custom `parser` to the `file()` loader like so:
```typescript
const dogs = defineCollection({
@ -1921,7 +2143,7 @@
{ "dogs": [{}], "cats": [{}] }
```
You can seperate these collections by passing a custom `parser` to the `file()` loader like so:
You can separate these collections by passing a custom `parser` to the `file()` loader like so:
```typescript
const dogs = defineCollection({
@ -2488,7 +2710,7 @@
### Major Changes
- [#11861](https://github.com/withastro/astro/pull/11861) [`3ab3b4e`](https://github.com/withastro/astro/commit/3ab3b4efbcdd2aabea5f949deedf51a5acefae59) Thanks [@bluwy](https://github.com/bluwy)! - Cleans up Astro-specfic metadata attached to `vfile.data` in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:
- [#11861](https://github.com/withastro/astro/pull/11861) [`3ab3b4e`](https://github.com/withastro/astro/commit/3ab3b4efbcdd2aabea5f949deedf51a5acefae59) Thanks [@bluwy](https://github.com/bluwy)! - Cleans up Astro-specific metadata attached to `vfile.data` in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:
- `vfile.data.__astroHeadings` -> `vfile.data.astro.headings`
- `vfile.data.imagePaths` -> `vfile.data.astro.imagePaths`
@ -3055,7 +3277,7 @@
```
````
- [#11984](https://github.com/withastro/astro/pull/11984) [`3ac2263`](https://github.com/withastro/astro/commit/3ac2263ff6070136bec9cffb863c38bcc31ccdfe) Thanks [@chaegumi](https://github.com/chaegumi)! - Adds a new `build.concurreny` configuration option to specify the number of pages to build in parallel
- [#11984](https://github.com/withastro/astro/pull/11984) [`3ac2263`](https://github.com/withastro/astro/commit/3ac2263ff6070136bec9cffb863c38bcc31ccdfe) Thanks [@chaegumi](https://github.com/chaegumi)! - Adds a new `build.concurrency` configuration option to specify the number of pages to build in parallel
**In most cases, you should not change the default value of `1`.**
@ -3634,7 +3856,7 @@
This allows you to provide a value for [Shiki's `meta` attribute](https://shiki.style/guide/transformers#meta) to pass options to transformers.
The following example passes an option to highlight lines 1 and 3 to Shiki's `tranformerMetaHighlight`:
The following example passes an option to highlight lines 1 and 3 to Shiki's `transformerMetaHighlight`:
```astro
---
@ -4261,7 +4483,7 @@
The `server:defer` directive can be used on any Astro component in a project using `hybrid` or `server` mode with an adapter. There are no special APIs needed inside of the island.
Enable server islands by adding the experimental flag to your Astro config with an appropriate `output` mode and adatper:
Enable server islands by adding the experimental flag to your Astro config with an appropriate `output` mode and adapter:
```js
import { defineConfig } from 'astro/config';
@ -7337,7 +7559,7 @@
- [#9179](https://github.com/withastro/astro/pull/9179) [`3f28336d9`](https://github.com/withastro/astro/commit/3f28336d9a52d7e4364d455ee3128d14d10a078a) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where the presence of a slot in a page led to an error.
- [#9219](https://github.com/withastro/astro/pull/9219) [`067a65f5b`](https://github.com/withastro/astro/commit/067a65f5b4d163bf1944cf47e6bf891f0b93553f) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix edge case where `<style>` updates inside of `.astro` files would ocassionally fail to update without reloading the page.
- [#9219](https://github.com/withastro/astro/pull/9219) [`067a65f5b`](https://github.com/withastro/astro/commit/067a65f5b4d163bf1944cf47e6bf891f0b93553f) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix edge case where `<style>` updates inside of `.astro` files would occasionally fail to update without reloading the page.
- [#9236](https://github.com/withastro/astro/pull/9236) [`27d3e86e4`](https://github.com/withastro/astro/commit/27d3e86e4c8d04101113ab7a53477f26a4fb0619) Thanks [@ematipico](https://github.com/ematipico)! - The configuration `i18n.routingStrategy` has been replaced with an object called `routing`.
@ -7387,7 +7609,7 @@
- [#9179](https://github.com/withastro/astro/pull/9179) [`3f28336d9`](https://github.com/withastro/astro/commit/3f28336d9a52d7e4364d455ee3128d14d10a078a) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where the presence of a slot in a page led to an error.
- [#9219](https://github.com/withastro/astro/pull/9219) [`067a65f5b`](https://github.com/withastro/astro/commit/067a65f5b4d163bf1944cf47e6bf891f0b93553f) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix edge case where `<style>` updates inside of `.astro` files would ocassionally fail to update without reloading the page.
- [#9219](https://github.com/withastro/astro/pull/9219) [`067a65f5b`](https://github.com/withastro/astro/commit/067a65f5b4d163bf1944cf47e6bf891f0b93553f) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix edge case where `<style>` updates inside of `.astro` files would occasionally fail to update without reloading the page.
- [#9236](https://github.com/withastro/astro/pull/9236) [`27d3e86e4`](https://github.com/withastro/astro/commit/27d3e86e4c8d04101113ab7a53477f26a4fb0619) Thanks [@ematipico](https://github.com/ematipico)! - The configuration `i18n.routingStrategy` has been replaced with an object called `routing`.
@ -7709,7 +7931,7 @@
<p>Learn more <a href={aboutURL}>About</a> this site!</p>
```
Enabling i18n routing also provides two new properties for browser language detection: `Astro.preferredLocale` and `Astro.preferredLocaleList`. These combine the browser's `Accept-Langauge` header, and your site's list of supported languages and can be used to automatically respect your visitor's preferred languages.
Enabling i18n routing also provides two new properties for browser language detection: `Astro.preferredLocale` and `Astro.preferredLocaleList`. These combine the browser's `Accept-Language` header, and your site's list of supported languages and can be used to automatically respect your visitor's preferred languages.
Read more about Astro's [experimental i18n routing](https://docs.astro.build/en/guides/internationalization/) in our documentation.
@ -8025,7 +8247,7 @@
- [#8729](https://github.com/withastro/astro/pull/8729) [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436) Thanks [@lilnasy](https://github.com/lilnasy)! - Node-based adapters now create less server-side javascript
- [#8730](https://github.com/withastro/astro/pull/8730) [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Improve `astro info` copy to clipboard compatability
- [#8730](https://github.com/withastro/astro/pull/8730) [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Improve `astro info` copy to clipboard compatibility
- Updated dependencies [[`21f482657`](https://github.com/withastro/astro/commit/21f4826576c2c812a1604e18717799da3470decd), [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436)]:
- @astrojs/markdown-remark@3.2.1
@ -8125,7 +8347,7 @@
### Patch Changes
- [#8646](https://github.com/withastro/astro/pull/8646) [`69fbf95b2`](https://github.com/withastro/astro/commit/69fbf95b22c0fb0d8e7e5fef9ec61e26cac9767f) Thanks [@matthewp](https://github.com/matthewp)! - Fix cases of head propagation not occuring in dev server
- [#8646](https://github.com/withastro/astro/pull/8646) [`69fbf95b2`](https://github.com/withastro/astro/commit/69fbf95b22c0fb0d8e7e5fef9ec61e26cac9767f) Thanks [@matthewp](https://github.com/matthewp)! - Fix cases of head propagation not occurring in dev server
## 3.1.3
@ -8330,7 +8552,7 @@
### Patch Changes
- [#8300](https://github.com/withastro/astro/pull/8300) [`d4a6ab733`](https://github.com/withastro/astro/commit/d4a6ab7339043042fd62dffd30ba078edae55f86) Thanks [@ematipico](https://github.com/ematipico)! - Correctly retrive middleware when using it in SSR enviroments.
- [#8300](https://github.com/withastro/astro/pull/8300) [`d4a6ab733`](https://github.com/withastro/astro/commit/d4a6ab7339043042fd62dffd30ba078edae55f86) Thanks [@ematipico](https://github.com/ematipico)! - Correctly retrieve middleware when using it in SSR environments.
## 3.0.2
@ -8370,7 +8592,7 @@
- [#8142](https://github.com/withastro/astro/pull/8142) [`81545197a`](https://github.com/withastro/astro/commit/81545197a32fd015d763fc386c8b67e0e08b7393) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fixes for the `class:list` directive
- Previously, `class:list` would ocassionally not be merged the `class` prop when passed to Astro components. Now, `class:list` is always converted to a `class` prop (as a string value).
- Previously, `class:list` would occasionally not be merged the `class` prop when passed to Astro components. Now, `class:list` is always converted to a `class` prop (as a string value).
- Previously, `class:list` diverged from [`clsx`](https://github.com/lukeed/clsx) in a few edge cases. Now, `class:list` uses [`clsx`](https://github.com/lukeed/clsx) directly.
- `class:list` used to deduplicate matching values, but it no longer does
- `class:list` used to sort individual values, but it no longer does
@ -8984,7 +9206,7 @@
- [#8142](https://github.com/withastro/astro/pull/8142) [`81545197a`](https://github.com/withastro/astro/commit/81545197a32fd015d763fc386c8b67e0e08b7393) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fixes for the `class:list` directive
- Previously, `class:list` would ocassionally not be merged the `class` prop when passed to Astro components. Now, `class:list` is always converted to a `class` prop (as a string value).
- Previously, `class:list` would occasionally not be merged the `class` prop when passed to Astro components. Now, `class:list` is always converted to a `class` prop (as a string value).
- Previously, `class:list` diverged from [`clsx`](https://github.com/lukeed/clsx) in a few edge cases. Now, `class:list` uses [`clsx`](https://github.com/lukeed/clsx) directly.
- `class:list` used to deduplicate matching values, but it no longer does
- `class:list` used to sort individual values, but it no longer does
@ -9859,7 +10081,7 @@
Now, Astro has improved the static analysis to take into account the actual imports used.
For example, Astro would previously bundle the `<script>`s from both the `<Tab>` and `<Accordian>` component for the following library that re-exports multiple components:
For example, Astro would previously bundle the `<script>`s from both the `<Tab>` and `<Accordion>` component for the following library that re-exports multiple components:
**@matthewp/my-astro-lib**
@ -9868,7 +10090,7 @@
export { default as Accordion } from './Accordion.astro';
```
Now, when an Astro page only uses a single component, Astro will send only the necessary script to the page. A page that only imports the `<Accordian>` component will not receive any `<Tab>` component's scripts:
Now, when an Astro page only uses a single component, Astro will send only the necessary script to the page. A page that only imports the `<Accordion>` component will not receive any `<Tab>` component's scripts:
```astro
---
@ -9976,7 +10198,7 @@
- [#7644](https://github.com/withastro/astro/pull/7644) [`213e10991`](https://github.com/withastro/astro/commit/213e10991af337a7c4fd38c39be5c266c16fa600) Thanks [@matthewp](https://github.com/matthewp)! - Fix for allowing the root path / as a redirect
- [#7644](https://github.com/withastro/astro/pull/7644) [`213e10991`](https://github.com/withastro/astro/commit/213e10991af337a7c4fd38c39be5c266c16fa600) Thanks [@matthewp](https://github.com/matthewp)! - Fix static redirects prefered over dynamic regular routes
- [#7644](https://github.com/withastro/astro/pull/7644) [`213e10991`](https://github.com/withastro/astro/commit/213e10991af337a7c4fd38c39be5c266c16fa600) Thanks [@matthewp](https://github.com/matthewp)! - Fix static redirects preferred over dynamic regular routes
- [#7643](https://github.com/withastro/astro/pull/7643) [`4b82e55cf`](https://github.com/withastro/astro/commit/4b82e55cf15899babb61128a7393362e667ff724) Thanks [@alvinometric](https://github.com/alvinometric)! - Add support for using `.svg` files with `astro:assets`'s base services. The SVGs will NOT be processed and will be return as-is, however, proper attributes, alt enforcement etc will all work correctly.
@ -10281,7 +10503,7 @@
- [#7237](https://github.com/withastro/astro/pull/7237) [`414eb19d2`](https://github.com/withastro/astro/commit/414eb19d2fcb55758f9d053076773b11b62f4c97) Thanks [@bluwy](https://github.com/bluwy)! - Remove experimental flag for custom client directives
- [#7274](https://github.com/withastro/astro/pull/7274) [`b5213654b`](https://github.com/withastro/astro/commit/b5213654b1b7f3ba573a48d3be688b2bdde7870f) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Update base `tsconfig.json` template with `allowJs: true` to provide a better relaxed experience for users unfamilliar with TypeScript. `allowJs` is still set to `false` (its default value) when using the `strictest` preset.
- [#7274](https://github.com/withastro/astro/pull/7274) [`b5213654b`](https://github.com/withastro/astro/commit/b5213654b1b7f3ba573a48d3be688b2bdde7870f) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Update base `tsconfig.json` template with `allowJs: true` to provide a better relaxed experience for users unfamiliar with TypeScript. `allowJs` is still set to `false` (its default value) when using the `strictest` preset.
- [#7180](https://github.com/withastro/astro/pull/7180) [`e3b8c6296`](https://github.com/withastro/astro/commit/e3b8c62969d680d1915a122c610d281d6711aa63) Thanks [@lilnasy](https://github.com/lilnasy)! - The Inline Stylesheets RFC is now stable!
@ -10692,7 +10914,7 @@
});
const minify = defineMiddleware(async (context, next) => {
const repsonse = await next();
const response = await next();
const minifiedHtml = await minifyHtml(response.text());
return new Response(minifiedHtml, {
status: 200,
@ -11406,7 +11628,7 @@
The `prerender` feature is now enabled by default when using `output: 'server'`. To prerender a particular page, add `export const prerender = true` to your frontmatter.
> **Warning**
> Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatability.
> Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatibility.
> Users that have configured a custom `vite.build.rollupOptions.output.chunkFileNames` should ensure that their Astro project is configured as an ESM Node project. Either include `"type": "module"` in your root `package.json` file or use the `.mjs` extension for `chunkFileNames`.
- [#5782](https://github.com/withastro/astro/pull/5782) [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0
@ -12039,7 +12261,7 @@
The `prerender` feature is now enabled by default when using `output: 'server'`. To prerender a particular page, add `export const prerender = true` to your frontmatter.
> **Warning**
> Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatability.
> Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatibility.
> Users that have configured a custom `vite.build.rollupOptions.output.chunkFileNames` should ensure that their Astro project is configured as an ESM Node project. Either include `"type": "module"` in your root `package.json` file or use the `.mjs` extension for `chunkFileNames`.
- [#5716](https://github.com/withastro/astro/pull/5716) [`dd56c1941`](https://github.com/withastro/astro/commit/dd56c19411b126439b8bc42d681b6fa8c06e8c61) Thanks [@bluwy](https://github.com/bluwy)! - Remove MDX Fragment hack. This was used by `@astrojs/mdx` to access the `Fragment` component, but isn't require anymore since `@astrojs/mdx` v0.12.1.

View file

@ -837,10 +837,12 @@ declare namespace astroHTML.JSX {
interface LinkHTMLAttributes extends HTMLAttributes {
as?: string | undefined | null;
blocking?: 'render' | undefined | null;
crossorigin?: boolean | string | undefined | null;
disabled?: boolean | undefined | null;
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
href?: string | URL | undefined | null;
hreflang?: string | undefined | null;
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
integrity?: string | undefined | null;
media?: string | undefined | null;
imagesrcset?: string | undefined | null;

View file

@ -110,7 +110,7 @@ declare module '*.avif' {
declare module '*.svg' {
type Props = {
/**
* Accesible, short-text description
* Accessible, short-text description
*
* {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title|MDN Reference}
*/

View file

@ -4,7 +4,6 @@ import type { UnresolvedImageTransform } from '../dist/assets/types';
import { applyResponsiveAttributes } from '../dist/assets/utils/imageAttributes.js';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
import type { HTMLAttributes } from '../types';
import './image.css';
// The TypeScript diagnostic for JSX props uses the last member of the union to suggest props, so it would be better for
// LocalImageProps to be last. Unfortunately, when we do this the error messages that remote images get are complete nonsense

View file

@ -10,9 +10,8 @@ import type {
UnresolvedImageTransform,
} from '../dist/types/public/index.js';
import type { HTMLAttributes } from '../types';
import './image.css';
type Props = (LocalImageProps | RemoteImageProps) & {
export type Props = (LocalImageProps | RemoteImageProps) & {
formats?: ImageOutputFormat[];
fallbackFormat?: ImageOutputFormat;
pictureAttributes?: HTMLAttributes<'picture'>;

View file

@ -0,0 +1,13 @@
---
import type { LocalImageProps, RemoteImageProps } from 'astro:assets';
import Image from './Image.astro';
type Props = LocalImageProps | RemoteImageProps;
const { class: className, ...props } = Astro.props;
import './image.css';
---
{/* Applying class outside of the spread prevents it from applying unnecessary astro-* classes */}
<Image {...props} class={className} />

View file

@ -0,0 +1,11 @@
---
import { default as Picture, type Props as PictureProps } from './Picture.astro';
type Props = PictureProps;
const { class: className, ...props } = Astro.props;
---
{/* Applying class outside of the spread prevents it from applying unnecessary astro-* classes */}
<Picture {...props} class={className} />

View file

@ -15,15 +15,15 @@ test.afterAll(async () => {
test.afterEach(async ({ astro }) => {
// Force database reset between tests
await astro.editFile('./db/seed.ts', (original) => original);
await astro.editFile('./db/seed.ts', (original) => original, false);
});
test.describe('Astro Actions - Blog', () => {
test('Like action', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/blog/first-post/'));
const likeButton = page.getByLabel('Like');
await waitForHydrate(page, likeButton);
await new Promise((resolve) => setTimeout(resolve, 500));
await expect(likeButton, 'like button starts with 10 likes').toContainText('10');
await likeButton.click();
await expect(likeButton, 'like button should increment likes').toContainText('11');
@ -34,7 +34,6 @@ test.describe('Astro Actions - Blog', () => {
const likeButton = page.getByLabel('get-request');
const likeCount = page.getByLabel('Like');
await expect(likeCount, 'like button starts with 10 likes').toContainText('10');
await likeButton.click();
await expect(likeCount, 'like button should increment likes').toContainText('11');

View file

@ -11,7 +11,7 @@ test.beforeAll(async ({ astro }) => {
test.afterEach(async ({ astro }) => {
// Force database reset between tests
await astro.editFile('./db/seed.ts', (original) => original);
await astro.editFile('./db/seed.ts', (original) => original, false);
});
test.afterAll(async () => {
@ -21,9 +21,9 @@ test.afterAll(async () => {
test.describe('Astro Actions - React 19', () => {
test('Like action - client pending state', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/blog/first-post/'));
const likeButton = page.getByLabel('likes-client');
await waitForHydrate(page, likeButton);
await new Promise((resolve) => setTimeout(resolve, 500));
await expect(likeButton).toBeVisible();
await likeButton.click();

View file

@ -12,13 +12,13 @@
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/db": "workspace:*",
"@astrojs/node": "^8.3.4",
"@astrojs/node": "^9.0.0",
"@astrojs/react": "workspace:*",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.7.2"
"typescript": "^5.7.3"
}
}

View file

@ -135,6 +135,6 @@ hr {
clip: rect(1px, 1px, 1px, 1px);
/* modern browsers, clip-path works inwards from each corner */
clip-path: inset(50%);
/* added line to stop words getting smushed together (as they go onto seperate lines and some screen readers do not understand line feeds as a space */
/* added line to stop words getting smushed together (as they go onto separate lines and some screen readers do not understand line feeds as a space */
white-space: nowrap;
}

View file

@ -12,14 +12,14 @@
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/db": "workspace:*",
"@astrojs/node": "^8.3.4",
"@astrojs/node": "^9.0.0",
"@astrojs/react": "workspace:*",
"@types/react": "npm:types-react",
"@types/react-dom": "npm:types-react-dom",
"astro": "workspace:*",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
"typescript": "^5.7.2"
"react": "19.0.0",
"react-dom": "19.0.0",
"typescript": "^5.7.3"
},
"overrides": {
"@types/react": "npm:types-react",

View file

@ -135,6 +135,6 @@ hr {
clip: rect(1px, 1px, 1px, 1px);
/* modern browsers, clip-path works inwards from each corner */
clip-path: inset(50%);
/* added line to stop words getting smushed together (as they go onto seperate lines and some screen readers do not understand line feeds as a space */
/* added line to stop words getting smushed together (as they go onto separate lines and some screen readers do not understand line feeds as a space */
white-space: nowrap;
}

View file

@ -6,6 +6,6 @@
"@astrojs/preact": "workspace:*",
"@e2e/astro-linked-lib": "link:../_deps/astro-linked-lib",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"astro": "workspace:*",
"sass": "^1.81.0"
"sass": "^1.83.1"
}
}

View file

@ -9,12 +9,12 @@
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sass": "^1.81.0",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"sass": "^1.83.1",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -4,6 +4,6 @@
"private": true,
"devDependencies": {
"astro": "workspace:*",
"sass": "^1.81.0"
"sass": "^1.83.1"
}
}

View file

@ -9,6 +9,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"astro": "workspace:*",
"@astrojs/node": "^8.3.4"
"@astrojs/node": "^9.0.0"
}
}

View file

@ -13,11 +13,11 @@
"dependencies": {
"@webcomponents/template-shadowroot": "^0.2.1",
"lit": "^3.2.1",
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -8,6 +8,6 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.25.0",
"preact": "^10.25.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
},
"scripts": {

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -6,6 +6,6 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -6,6 +6,6 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.25.0"
"preact": "^10.25.4"
}
}

View file

@ -7,6 +7,6 @@
},
"dependencies": {
"astro": "workspace:*",
"@astrojs/node": "^8.3.4"
"@astrojs/node": "^9.0.0"
}
}

View file

@ -9,7 +9,7 @@
"@astrojs/react": "workspace:*",
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*",
"@astrojs/node": "^8.3.4",
"@astrojs/node": "^9.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}

View file

@ -0,0 +1,5 @@
---
Astro.response.headers.set('content-type', 'text/html;charset=utf-8');
---
<h2 id="charset-in-content-type">I'm an island with a different content-type response header</h2>

View file

@ -3,6 +3,7 @@ import Island from '../components/Island.astro';
import Self from '../components/Self.astro';
import HTMLError from '../components/HTMLError.astro';
import { generateLongText } from '../lorem';
import MediaTypeInHeader from '../components/MediaTypeInHeader.astro';
const content = generateLongText(5);
@ -22,6 +23,8 @@ export const prerender = false;
<Self server:defer />
<MediaTypeInHeader server:defer />
<div id="big">
<Island server:defer secret="test" content={content} />
</div>

View file

@ -7,6 +7,6 @@
"astro": "workspace:*"
},
"devDependencies": {
"solid-js": "^1.9.3"
"solid-js": "^1.9.4"
}
}

View file

@ -6,6 +6,6 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*",
"solid-js": "^1.9.3"
"solid-js": "^1.9.4"
}
}

View file

@ -7,6 +7,6 @@
"astro": "workspace:*"
},
"devDependencies": {
"solid-js": "^1.9.3"
"solid-js": "^1.9.4"
}
}

View file

@ -6,6 +6,6 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*",
"svelte": "^5.2.9"
"svelte": "^5.17.3"
}
}

View file

@ -7,6 +7,6 @@
"astro": "workspace:*",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.15"
"tailwindcss": "^3.4.17"
}
}

View file

@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/node": "^8.3.4",
"@astrojs/node": "^9.0.0",
"@astrojs/react": "workspace:*",
"@astrojs/solid-js": "workspace:*",
"@astrojs/svelte": "workspace:*",
@ -11,8 +11,8 @@
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.9.3",
"svelte": "^5.2.9",
"solid-js": "^1.9.4",
"svelte": "^5.17.3",
"vue": "^3.5.13"
}
}

View file

@ -44,6 +44,15 @@ test.describe('Server islands', () => {
await expect(el).toHaveText('test');
});
test('content-type header with media type still allows the island to be displayed', async ({
page,
astro,
}) => {
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('#charset-in-content-type');
await expect(el).toHaveCount(1);
});
test('Self imported module can server defer', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('.now');

View file

@ -1,6 +1,6 @@
{
"name": "astro",
"version": "5.0.9",
"version": "5.1.7",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
@ -123,7 +123,7 @@
"@astrojs/markdown-remark": "workspace:*",
"@astrojs/telemetry": "workspace:*",
"@oslojs/encoding": "^1.1.0",
"@rollup/pluginutils": "^5.1.3",
"@rollup/pluginutils": "^5.1.4",
"@types/cookie": "^0.6.0",
"acorn": "^8.14.0",
"aria-query": "^5.3.2",
@ -134,48 +134,48 @@
"common-ancestor-path": "^1.0.1",
"cookie": "^0.7.2",
"cssesc": "^3.0.0",
"debug": "^4.3.7",
"debug": "^4.4.0",
"deterministic-object-hash": "^2.0.2",
"devalue": "^5.1.1",
"diff": "^5.2.0",
"dlv": "^1.1.3",
"dset": "^3.1.4",
"es-module-lexer": "^1.5.4",
"esbuild": "^0.21.5",
"es-module-lexer": "^1.6.0",
"esbuild": "^0.24.2",
"estree-walker": "^3.0.3",
"fast-glob": "^3.3.2",
"fast-glob": "^3.3.3",
"flattie": "^1.1.1",
"github-slugger": "^2.0.0",
"html-escaper": "^3.0.3",
"http-cache-semantics": "^4.1.1",
"js-yaml": "^4.1.0",
"kleur": "^4.1.5",
"magic-string": "^0.30.14",
"magic-string": "^0.30.17",
"magicast": "^0.3.5",
"micromatch": "^4.0.8",
"mrmime": "^2.0.0",
"neotraverse": "^0.6.18",
"p-limit": "^6.1.0",
"p-limit": "^6.2.0",
"p-queue": "^8.0.1",
"preferred-pm": "^4.0.0",
"prompts": "^2.4.2",
"rehype": "^13.0.2",
"semver": "^7.6.3",
"shiki": "^1.23.1",
"tinyexec": "^0.3.1",
"shiki": "^1.26.2",
"tinyexec": "^0.3.2",
"tsconfck": "^3.1.4",
"ultrahtml": "^1.5.3",
"unist-util-visit": "^5.0.0",
"unstorage": "^1.12.0",
"unstorage": "^1.14.4",
"vfile": "^6.0.3",
"vite": "^6.0.1",
"vitefu": "^1.0.4",
"vite": "^6.0.7",
"vitefu": "^1.0.5",
"which-pm": "^3.0.0",
"xxhash-wasm": "^1.1.0",
"yargs-parser": "^21.1.1",
"yocto-spinner": "^0.1.0",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.5",
"yocto-spinner": "^0.1.2",
"zod": "^3.24.1",
"zod-to-json-schema": "^3.24.1",
"zod-to-ts": "^1.2.0"
},
"optionalDependencies": {
@ -183,7 +183,7 @@
},
"devDependencies": {
"@astrojs/check": "^0.9.4",
"@playwright/test": "^1.49.0",
"@playwright/test": "^1.49.1",
"@types/aria-query": "^5.0.4",
"@types/common-ancestor-path": "^1.0.2",
"@types/cssesc": "^3.0.2",
@ -205,18 +205,18 @@
"expect-type": "^1.1.0",
"fs-fixture": "^2.6.0",
"mdast-util-mdx": "^3.0.0",
"mdast-util-mdx-jsx": "^3.1.3",
"node-mocks-http": "^1.16.1",
"mdast-util-mdx-jsx": "^3.2.0",
"node-mocks-http": "^1.16.2",
"parse-srcset": "^1.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2",
"rollup": "^4.27.4",
"sass": "^1.81.0",
"undici": "^6.21.0",
"rollup": "^4.30.1",
"sass": "^1.83.1",
"undici": "^7.2.1",
"unified": "^11.0.5",
"vitest": "^2.1.6"
"vitest": "^3.0.0-beta.4"
},
"engines": {
"node": "^18.17.1 || ^20.3.0 || >=22.0.0",
@ -225,5 +225,9 @@
},
"publishConfig": {
"provenance": true
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/astrodotbuild"
}
}

View file

@ -15,8 +15,8 @@
"dependencies": {
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"

View file

@ -16,8 +16,8 @@
"@astrojs/markdoc": "workspace:*",
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"

View file

@ -16,8 +16,8 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"

View file

@ -38,7 +38,7 @@ export default function astroIntegrationActionsRouteHandler({
}
const stringifiedActionsImport = JSON.stringify(
viteID(new URL('./actions/index.ts', params.config.srcDir)),
viteID(new URL('./actions', params.config.srcDir)),
);
settings.injectedTypes.push({
filename: ACTIONS_TYPES_FILE,

View file

@ -246,7 +246,7 @@ export type ActionMiddlewareContext = {
calledFrom: 'rpc' | 'form';
/** The name of the action. Useful to track the source of an action result during a redirect. */
name: string;
/** Programatically call the action to get the result. */
/** Programmatically call the action to get the result. */
handler: () => Promise<SafeResult<any, any>>;
};
/**

View file

@ -1,7 +1,6 @@
import fs, { readFileSync } from 'node:fs';
import { basename } from 'node:path/posix';
import { dim, green } from 'kleur/colors';
import type PQueue from 'p-queue';
import { getOutDirWithinCwd } from '../../core/build/common.js';
import type { BuildPipeline } from '../../core/build/pipeline.js';
import { getTimeStat } from '../../core/build/util.js';
@ -101,16 +100,11 @@ export async function generateImagesForPath(
originalFilePath: string,
transformsAndPath: MapValue<AssetsGlobalStaticImagesList>,
env: AssetEnv,
queue: PQueue,
) {
let originalImage: ImageData;
for (const [_, transform] of transformsAndPath.transforms) {
await queue
.add(async () => generateImage(transform.finalPath, transform.transform))
.catch((e) => {
throw e;
});
await generateImage(transform.finalPath, transform.transform);
}
// In SSR, we cannot know if an image is referenced in a server-rendered page, so we can't delete anything
@ -164,10 +158,13 @@ export async function generateImagesForPath(
const finalFolderURL = new URL('./', finalFileURL);
await fs.promises.mkdir(finalFolderURL, { recursive: true });
// For remote images, instead of saving the image directly, we save a JSON file with the image data, expiration date, etag and last-modified date from the server
const cacheFile = basename(filepath) + (isLocalImage ? '' : '.json');
const cacheFile = basename(filepath);
const cachedFileURL = new URL(cacheFile, env.assetsCacheDir);
// For remote images, we also save a JSON file with the expiration date, etag and last-modified date from the server
const cacheMetaFile = cacheFile + '.json';
const cachedMetaFileURL = new URL(cacheMetaFile, env.assetsCacheDir);
// Check if we have a cached entry first
try {
if (isLocalImage) {
@ -177,19 +174,34 @@ export async function generateImagesForPath(
cached: 'hit',
};
} else {
const JSONData = JSON.parse(readFileSync(cachedFileURL, 'utf-8')) as RemoteCacheEntry;
const JSONData = JSON.parse(readFileSync(cachedMetaFileURL, 'utf-8')) as RemoteCacheEntry;
if (!JSONData.data || !JSONData.expires) {
await fs.promises.unlink(cachedFileURL);
if (!JSONData.expires) {
try {
await fs.promises.unlink(cachedFileURL);
} catch {
/* Old caches may not have a separate image binary, no-op */
}
await fs.promises.unlink(cachedMetaFileURL);
throw new Error(
`Malformed cache entry for ${filepath}, cache will be regenerated for this file.`,
);
}
// Upgrade old base64 encoded asset cache to the new format
if (JSONData.data) {
const { data, ...meta } = JSONData;
await Promise.all([
fs.promises.writeFile(cachedFileURL, Buffer.from(data, 'base64')),
writeCacheMetaFile(cachedMetaFileURL, meta, env),
]);
}
// If the cache entry is not expired, use it
if (JSONData.expires > Date.now()) {
await fs.promises.writeFile(finalFileURL, Buffer.from(JSONData.data, 'base64'));
await fs.promises.copyFile(cachedFileURL, finalFileURL, fs.constants.COPYFILE_FICLONE);
return {
cached: 'hit',
@ -208,12 +220,14 @@ export async function generateImagesForPath(
// Image cache was stale, update original image to avoid redownload
originalImage = revalidatedData;
} else {
revalidatedData.data = Buffer.from(JSONData.data, 'base64');
// Freshen cache on disk
await writeRemoteCacheFile(cachedFileURL, revalidatedData, env);
await writeCacheMetaFile(cachedMetaFileURL, revalidatedData, env);
await fs.promises.writeFile(finalFileURL, revalidatedData.data);
await fs.promises.copyFile(
cachedFileURL,
finalFileURL,
fs.constants.COPYFILE_FICLONE,
);
return { cached: 'revalidated' };
}
} catch (e) {
@ -223,12 +237,13 @@ export async function generateImagesForPath(
`An error was encountered while revalidating a cached remote asset. Proceeding with stale cache. ${e}`,
);
await fs.promises.writeFile(finalFileURL, Buffer.from(JSONData.data, 'base64'));
await fs.promises.copyFile(cachedFileURL, finalFileURL, fs.constants.COPYFILE_FICLONE);
return { cached: 'hit' };
}
}
await fs.promises.unlink(cachedFileURL);
await fs.promises.unlink(cachedMetaFileURL);
}
} catch (e: any) {
if (e.code !== 'ENOENT') {
@ -281,7 +296,10 @@ export async function generateImagesForPath(
if (isLocalImage) {
await fs.promises.writeFile(cachedFileURL, resultData.data);
} else {
await writeRemoteCacheFile(cachedFileURL, resultData as ImageData, env);
await Promise.all([
fs.promises.writeFile(cachedFileURL, resultData.data),
writeCacheMetaFile(cachedMetaFileURL, resultData as ImageData, env),
]);
}
}
} catch (e) {
@ -305,12 +323,15 @@ export async function generateImagesForPath(
}
}
async function writeRemoteCacheFile(cachedFileURL: URL, resultData: ImageData, env: AssetEnv) {
async function writeCacheMetaFile(
cachedMetaFileURL: URL,
resultData: Omit<ImageData, 'data'>,
env: AssetEnv,
) {
try {
return await fs.promises.writeFile(
cachedFileURL,
cachedMetaFileURL,
JSON.stringify({
data: Buffer.from(resultData.data).toString('base64'),
expires: resultData.expires,
etag: resultData.etag,
lastModified: resultData.lastModified,

View file

@ -1,7 +1,7 @@
import CachePolicy from 'http-cache-semantics';
export type RemoteCacheEntry = {
data: string;
data?: string;
expires: number;
etag?: string;
lastModified?: string;
@ -68,7 +68,7 @@ export async function revalidateRemoteImage(
webToCachePolicyRequest(req),
webToCachePolicyResponse(
res.ok ? res : new Response(null, { status: 200, headers: res.headers }),
), // 304 responses themselves are not cachable, so just pretend to get the refreshed TTL
), // 304 responses themselves are not cacheable, so just pretend to get the refreshed TTL
);
const expires = policy.storable() ? policy.timeToLive() : 0;

View file

@ -1,7 +1,6 @@
import { extname } from 'node:path';
import MagicString from 'magic-string';
import type * as vite from 'vite';
import { normalizePath } from 'vite';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import {
appendForwardSlash,
@ -10,6 +9,7 @@ import {
removeBase,
removeQueryString,
} from '../core/path.js';
import { normalizePath } from '../core/viteUtils.js';
import type { AstroSettings } from '../types/astro.js';
import { VALID_INPUT_FORMATS, VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from './consts.js';
import type { ImageTransform } from './types.js';
@ -99,6 +99,7 @@ export default function assets({ settings }: { settings: AstroSettings }): vite.
referencedImages: new Set(),
};
const imageComponentPrefix = settings.config.experimental.responsiveImages ? 'Responsive' : '';
return [
// Expose the components and different utilities from `astro:assets`
{
@ -119,8 +120,8 @@ export default function assets({ settings }: { settings: AstroSettings }): vite.
return /* ts */ `
export { getConfiguredImageService, isLocalService } from "astro/assets";
import { getImage as getImageInternal } from "astro/assets";
export { default as Image } from "astro/components/Image.astro";
export { default as Picture } from "astro/components/Picture.astro";
export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
export const imageConfig = ${JSON.stringify({ ...settings.config.image, experimentalResponsiveImages: settings.config.experimental.responsiveImages })};

View file

@ -9,8 +9,9 @@ import { nodeLogDestination } from '../core/logger/node.js';
import { NOOP_MIDDLEWARE_FN } from '../core/middleware/noop-middleware.js';
import { removeLeadingForwardSlash } from '../core/path.js';
import { RenderContext } from '../core/render-context.js';
import { getParts, validateSegment } from '../core/routing/manifest/create.js';
import { getParts } from '../core/routing/manifest/parts.js';
import { getPattern } from '../core/routing/manifest/pattern.js';
import { validateSegment } from '../core/routing/manifest/segment.js';
import type { AstroComponentFactory } from '../runtime/server/index.js';
import type { ComponentInstance } from '../types/astro.js';
import type { AstroMiddlewareInstance, MiddlewareHandler, Props } from '../types/public/common.js';

View file

@ -16,11 +16,13 @@ import {
import type { LoaderContext } from './loaders/types.js';
import type { MutableDataStore } from './mutable-data-store.js';
import {
type ContentObservable,
getEntryConfigByExtMap,
getEntryDataAndImages,
globalContentConfigObserver,
safeStringify,
} from './utils.js';
import { type WrappedWatcher, createWatcherWrapper } from './watcher.js';
export interface ContentLayerOptions {
store: MutableDataStore;
@ -33,7 +35,7 @@ export class ContentLayer {
#logger: Logger;
#store: MutableDataStore;
#settings: AstroSettings;
#watcher?: FSWatcher;
#watcher?: WrappedWatcher;
#lastConfigDigest?: string;
#unsubscribe?: () => void;
@ -48,7 +50,9 @@ export class ContentLayer {
this.#logger = logger;
this.#store = store;
this.#settings = settings;
this.#watcher = watcher;
if (watcher) {
this.#watcher = createWatcherWrapper(watcher);
}
this.#queue = new PQueue({ concurrency: 1 });
}
@ -78,6 +82,7 @@ export class ContentLayer {
dispose() {
this.#queue.clear();
this.#unsubscribe?.();
this.#watcher?.removeAllTrackedListeners();
}
async #getGenerateDigest() {
@ -136,10 +141,35 @@ export class ContentLayer {
}
async #doSync(options: RefreshContentOptions) {
const contentConfig = globalContentConfigObserver.get();
let contentConfig = globalContentConfigObserver.get();
const logger = this.#logger.forkIntegrationLogger('content');
if (contentConfig?.status === 'loading') {
contentConfig = await Promise.race<ReturnType<ContentObservable['get']>>([
new Promise((resolve) => {
const unsub = globalContentConfigObserver.subscribe((ctx) => {
unsub();
resolve(ctx);
});
}),
new Promise((resolve) =>
setTimeout(
() =>
resolve({ status: 'error', error: new Error('Content config loading timed out') }),
5000,
),
),
]);
}
if (contentConfig?.status === 'error') {
logger.error(`Error loading content config. Skipping sync.\n${contentConfig.error.message}`);
return;
}
// It shows as loaded with no collections even if there's no config
if (contentConfig?.status !== 'loaded') {
logger.debug('Content config not loaded, skipping sync');
logger.error(`Content config not loaded, skipping sync. Status was ${contentConfig?.status}`);
return;
}
@ -166,11 +196,11 @@ export class ContentLayer {
shouldClear = true;
}
if (currentConfigDigest && previousConfigDigest !== currentConfigDigest) {
if (previousConfigDigest && previousConfigDigest !== currentConfigDigest) {
logger.info('Content config changed');
shouldClear = true;
}
if (process.env.ASTRO_VERSION && previousAstroVersion !== process.env.ASTRO_VERSION) {
if (previousAstroVersion && previousAstroVersion !== process.env.ASTRO_VERSION) {
logger.info('Astro version changed');
shouldClear = true;
}
@ -187,6 +217,12 @@ export class ContentLayer {
if (astroConfigDigest) {
await this.#store.metaStore().set('astro-config-digest', astroConfigDigest);
}
if (!options?.loaders?.length) {
// Remove all listeners before syncing, as they will be re-added by the loaders, but not if this is a selective sync
this.#watcher?.removeAllTrackedListeners();
}
await Promise.all(
Object.entries(contentConfig.config.collections).map(async ([name, collection]) => {
if (collection.type !== CONTENT_LAYER_TYPE) {
@ -252,8 +288,7 @@ export class ContentLayer {
);
await fs.mkdir(this.#settings.config.cacheDir, { recursive: true });
await fs.mkdir(this.#settings.dotAstroDir, { recursive: true });
const cacheFile = getDataStoreFile(this.#settings);
await this.#store.writeToDisk(cacheFile);
await this.#store.writeToDisk();
const assetImportsFile = new URL(ASSET_IMPORTS_FILE, this.#settings.dotAstroDir);
await this.#store.writeAssetImports(assetImportsFile);
const modulesImportsFile = new URL(MODULES_IMPORTS_FILE, this.#settings.dotAstroDir);
@ -353,8 +388,7 @@ export async function simpleLoader<TData extends { id: string }>(
* During development, this is in the `.astro` directory so that the Vite watcher can see it.
* In production, it's in the cache directory so that it's preserved between builds.
*/
export function getDataStoreFile(settings: AstroSettings, isDev?: boolean) {
isDev ??= process?.env.NODE_ENV === 'development';
export function getDataStoreFile(settings: AstroSettings, isDev: boolean) {
return new URL(DATA_STORE_FILE, isDev ? settings.dotAstroDir : settings.config.cacheDir);
}

Some files were not shown because too many files have changed in this diff Show more