mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
[ci] release (#11578)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
6aaeec5034
commit
4474887937
36 changed files with 169 additions and 180 deletions
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
'astro': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds color-coding to the console output during the build to highlight slow pages.
|
|
||||||
|
|
||||||
Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention.
|
|
|
@ -1,48 +0,0 @@
|
||||||
---
|
|
||||||
'astro': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
The `experimental.contentCollectionJsonSchema` feature introduced behind a flag in [v4.5.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#450) is no longer experimental and is available for general use.
|
|
||||||
|
|
||||||
If you are working with collections of type `data`, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined in `src/content/config.ts` using a library called [`zod-to-json-schema`](https://github.com/StefanTerdell/zod-to-json-schema).
|
|
||||||
|
|
||||||
This feature requires you to manually set your schema's file path as the value for `$schema` in each data entry file of the collection:
|
|
||||||
|
|
||||||
```json title="src/content/authors/armand.json" ins={2}
|
|
||||||
{
|
|
||||||
"$schema": "../../../.astro/collections/authors.schema.json",
|
|
||||||
"name": "Armand",
|
|
||||||
"skills": ["Astro", "Starlight"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can set this value in your editor settings. For example, to set this value in [VSCode's `json.schemas` setting](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings), provide the path of files to match and the location of your JSON schema:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"json.schemas": [
|
|
||||||
{
|
|
||||||
"fileMatch": [
|
|
||||||
"/src/content/authors/**"
|
|
||||||
],
|
|
||||||
"url": "./.astro/collections/authors.schema.json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If you were previously using this feature, please remove the experimental flag from your Astro config:
|
|
||||||
|
|
||||||
```diff
|
|
||||||
import { defineConfig } from 'astro'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
- experimental: {
|
|
||||||
- contentCollectionJsonSchema: true
|
|
||||||
- }
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so.
|
|
||||||
|
|
||||||
Please see [the content collections guide](https://docs.astro.build/en/guides/content-collections/#enabling-json-schema-generation) for more about this feature.
|
|
|
@ -1,63 +0,0 @@
|
||||||
---
|
|
||||||
'astro': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
The `experimental.rewriting` feature introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use.
|
|
||||||
|
|
||||||
`Astro.rewrite()` and `context.rewrite()` allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited.
|
|
||||||
|
|
||||||
Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files.
|
|
||||||
|
|
||||||
Rewrites are supported in Astro pages, endpoints, and middleware.
|
|
||||||
|
|
||||||
Return `Astro.rewrite()` in the frontmatter of a `.astro` page component to display a different page's content, such as fallback localized content:
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
---
|
|
||||||
// src/pages/es-cu/articles/introduction.astro
|
|
||||||
return Astro.rewrite("/es/articles/introduction")
|
|
||||||
---
|
|
||||||
}
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `context.rewrite()` in endpoints, for example to reroute to a different page:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// src/pages/api.js
|
|
||||||
export function GET(context) {
|
|
||||||
if (!context.locals.allowed) {
|
|
||||||
return context.rewrite('/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The middleware `next()` function now accepts a parameter with the same type as the `rewrite()` function. For example, with `next("/")`, you can call the next middleware function with a new `Request`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// src/middleware.js
|
|
||||||
export function onRequest(context, next) {
|
|
||||||
if (!context.cookies.get('allowed')) {
|
|
||||||
return next('/'); // new signature
|
|
||||||
}
|
|
||||||
return next();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If you were previously using this feature, please remove the experimental flag from your Astro config:
|
|
||||||
|
|
||||||
```diff
|
|
||||||
// astro.config.mjs
|
|
||||||
export default defineConfig({
|
|
||||||
- experimental: {
|
|
||||||
- rewriting: true
|
|
||||||
- }
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
If you have been waiting for stabilization before using rewrites in Astro, you can now do so.
|
|
||||||
|
|
||||||
Please see [the routing guide in docs](https://docs.astro.build/en/guides/routing/#rewrites) for more about using this feature.
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
"@astrojs/mdx": "^3.1.3",
|
"@astrojs/mdx": "^3.1.3",
|
||||||
"@astrojs/rss": "^4.0.7",
|
"@astrojs/rss": "^4.0.7",
|
||||||
"@astrojs/sitemap": "^3.1.6",
|
"@astrojs/sitemap": "^3.1.6",
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^4.0.0"
|
"astro": "^4.0.0"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"test": "vitest run"
|
"test": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"@astrojs/react": "^3.6.1",
|
"@astrojs/react": "^3.6.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
"@astrojs/alpinejs": "^0.4.0",
|
"@astrojs/alpinejs": "^0.4.0",
|
||||||
"@types/alpinejs": "^3.13.10",
|
"@types/alpinejs": "^3.13.10",
|
||||||
"alpinejs": "^3.14.1",
|
"alpinejs": "^3.14.1",
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/lit": "^4.3.0",
|
"@astrojs/lit": "^4.3.0",
|
||||||
"@webcomponents/template-shadowroot": "^0.2.1",
|
"@webcomponents/template-shadowroot": "^0.2.1",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"lit": "^3.1.4"
|
"lit": "^3.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"@astrojs/vue": "^4.5.0",
|
"@astrojs/vue": "^4.5.0",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"preact": "^10.23.1",
|
"preact": "^10.23.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.5.1",
|
"@astrojs/preact": "^3.5.1",
|
||||||
"@preact/signals": "^1.3.0",
|
"@preact/signals": "^1.3.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"preact": "^10.23.1"
|
"preact": "^10.23.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"@astrojs/react": "^3.6.1",
|
"@astrojs/react": "^3.6.1",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1"
|
"react-dom": "^18.3.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/solid-js": "^4.4.0",
|
"@astrojs/solid-js": "^4.4.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"solid-js": "^1.8.19"
|
"solid-js": "^1.8.19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/svelte": "^5.7.0",
|
"@astrojs/svelte": "^5.7.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"svelte": "^4.2.18"
|
"svelte": "^4.2.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/vue": "^4.5.0",
|
"@astrojs/vue": "^4.5.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"vue": "^3.4.35"
|
"vue": "^3.4.35"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^8.3.2",
|
"@astrojs/node": "^8.3.2",
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^4.0.0"
|
"astro": "^4.0.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^8.3.2",
|
"@astrojs/node": "^8.3.2",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"html-minifier": "^4.0.0"
|
"html-minifier": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"@tailwindcss/forms": "^0.5.7",
|
"@tailwindcss/forms": "^0.5.7",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"postcss": "^8.4.40",
|
"postcss": "^8.4.40",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^8.3.2",
|
"@astrojs/node": "^8.3.2",
|
||||||
"@astrojs/svelte": "^5.7.0",
|
"@astrojs/svelte": "^5.7.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"svelte": "^4.2.18"
|
"svelte": "^4.2.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"sharp": "^0.33.3"
|
"sharp": "^0.33.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
"./app": "./dist/app.js"
|
"./app": "./dist/app.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@astrojs/node": "^8.3.2",
|
"@astrojs/node": "^8.3.2",
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdoc": "^0.11.3",
|
"@astrojs/markdoc": "^0.11.3",
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdown-remark": "^5.2.0",
|
"@astrojs/markdown-remark": "^5.2.0",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"hast-util-select": "^6.0.2",
|
"hast-util-select": "^6.0.2",
|
||||||
"rehype-autolink-headings": "^7.1.0",
|
"rehype-autolink-headings": "^7.1.0",
|
||||||
"rehype-slug": "^6.0.0",
|
"rehype-slug": "^6.0.0",
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3"
|
"astro": "^4.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^3.1.3",
|
"@astrojs/mdx": "^3.1.3",
|
||||||
"@astrojs/preact": "^3.5.1",
|
"@astrojs/preact": "^3.5.1",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"preact": "^10.23.1"
|
"preact": "^10.23.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.5.1",
|
"@astrojs/preact": "^3.5.1",
|
||||||
"@nanostores/preact": "^0.5.1",
|
"@nanostores/preact": "^0.5.1",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"nanostores": "^0.10.3",
|
"nanostores": "^0.10.3",
|
||||||
"preact": "^10.23.1"
|
"preact": "^10.23.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"@astrojs/mdx": "^3.1.3",
|
"@astrojs/mdx": "^3.1.3",
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@types/canvas-confetti": "^1.6.4",
|
"@types/canvas-confetti": "^1.6.4",
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.19",
|
||||||
"canvas-confetti": "^1.9.3",
|
"canvas-confetti": "^1.9.3",
|
||||||
"postcss": "^8.4.40",
|
"postcss": "^8.4.40",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.12.3",
|
"astro": "^4.13.0",
|
||||||
"vitest": "^2.0.5"
|
"vitest": "^2.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,113 @@
|
||||||
# astro
|
# astro
|
||||||
|
|
||||||
|
## 4.13.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#11507](https://github.com/withastro/astro/pull/11507) [`a62345f`](https://github.com/withastro/astro/commit/a62345fd182ae4886d586c8406ed8f3e5f942730) Thanks [@ematipico](https://github.com/ematipico)! - Adds color-coding to the console output during the build to highlight slow pages.
|
||||||
|
|
||||||
|
Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention.
|
||||||
|
|
||||||
|
- [#11379](https://github.com/withastro/astro/pull/11379) [`e5e2d3e`](https://github.com/withastro/astro/commit/e5e2d3ed3076f10b4645f011b13888d5fa16e92e) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - The `experimental.contentCollectionJsonSchema` feature introduced behind a flag in [v4.5.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#450) is no longer experimental and is available for general use.
|
||||||
|
|
||||||
|
If you are working with collections of type `data`, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined in `src/content/config.ts` using a library called [`zod-to-json-schema`](https://github.com/StefanTerdell/zod-to-json-schema).
|
||||||
|
|
||||||
|
This feature requires you to manually set your schema's file path as the value for `$schema` in each data entry file of the collection:
|
||||||
|
|
||||||
|
```json title="src/content/authors/armand.json" ins={2}
|
||||||
|
{
|
||||||
|
"$schema": "../../../.astro/collections/authors.schema.json",
|
||||||
|
"name": "Armand",
|
||||||
|
"skills": ["Astro", "Starlight"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can set this value in your editor settings. For example, to set this value in [VSCode's `json.schemas` setting](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings), provide the path of files to match and the location of your JSON schema:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/src/content/authors/**"],
|
||||||
|
"url": "./.astro/collections/authors.schema.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you were previously using this feature, please remove the experimental flag from your Astro config:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
import { defineConfig } from 'astro'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
- experimental: {
|
||||||
|
- contentCollectionJsonSchema: true
|
||||||
|
- }
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so.
|
||||||
|
|
||||||
|
Please see [the content collections guide](https://docs.astro.build/en/guides/content-collections/#enabling-json-schema-generation) for more about this feature.
|
||||||
|
|
||||||
|
- [#11542](https://github.com/withastro/astro/pull/11542) [`45ad326`](https://github.com/withastro/astro/commit/45ad326932971b44630a32d9092c9505f24f42f8) Thanks [@ematipico](https://github.com/ematipico)! - The `experimental.rewriting` feature introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use.
|
||||||
|
|
||||||
|
`Astro.rewrite()` and `context.rewrite()` allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited.
|
||||||
|
|
||||||
|
Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files.
|
||||||
|
|
||||||
|
Rewrites are supported in Astro pages, endpoints, and middleware.
|
||||||
|
|
||||||
|
Return `Astro.rewrite()` in the frontmatter of a `.astro` page component to display a different page's content, such as fallback localized content:
|
||||||
|
|
||||||
|
```astro
|
||||||
|
---
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
// src/pages/es-cu/articles/introduction.astro return Astro.rewrite("/es/articles/introduction")
|
||||||
|
--- } ---
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `context.rewrite()` in endpoints, for example to reroute to a different page:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// src/pages/api.js
|
||||||
|
export function GET(context) {
|
||||||
|
if (!context.locals.allowed) {
|
||||||
|
return context.rewrite('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The middleware `next()` function now accepts a parameter with the same type as the `rewrite()` function. For example, with `next("/")`, you can call the next middleware function with a new `Request`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// src/middleware.js
|
||||||
|
export function onRequest(context, next) {
|
||||||
|
if (!context.cookies.get('allowed')) {
|
||||||
|
return next('/'); // new signature
|
||||||
|
}
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you were previously using this feature, please remove the experimental flag from your Astro config:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
// astro.config.mjs
|
||||||
|
export default defineConfig({
|
||||||
|
- experimental: {
|
||||||
|
- rewriting: true
|
||||||
|
- }
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have been waiting for stabilization before using rewrites in Astro, you can now do so.
|
||||||
|
|
||||||
|
Please see [the routing guide in docs](https://docs.astro.build/en/guides/routing/#rewrites) for more about using this feature.
|
||||||
|
|
||||||
## 4.12.3
|
## 4.12.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "astro",
|
"name": "astro",
|
||||||
"version": "4.12.3",
|
"version": "4.13.0",
|
||||||
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
|
|
@ -128,7 +128,7 @@ importers:
|
||||||
examples/basics:
|
examples/basics:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/blog:
|
examples/blog:
|
||||||
|
@ -143,13 +143,13 @@ importers:
|
||||||
specifier: ^3.1.6
|
specifier: ^3.1.6
|
||||||
version: link:../../packages/integrations/sitemap
|
version: link:../../packages/integrations/sitemap
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/component:
|
examples/component:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/container-with-vitest:
|
examples/container-with-vitest:
|
||||||
|
@ -158,7 +158,7 @@ importers:
|
||||||
specifier: ^3.6.1
|
specifier: ^3.6.1
|
||||||
version: link:../../packages/integrations/react
|
version: link:../../packages/integrations/react
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
react:
|
react:
|
||||||
specifier: ^18.3.1
|
specifier: ^18.3.1
|
||||||
|
@ -189,7 +189,7 @@ importers:
|
||||||
specifier: ^3.14.1
|
specifier: ^3.14.1
|
||||||
version: 3.14.1
|
version: 3.14.1
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/framework-lit:
|
examples/framework-lit:
|
||||||
|
@ -201,7 +201,7 @@ importers:
|
||||||
specifier: ^0.2.1
|
specifier: ^0.2.1
|
||||||
version: 0.2.1
|
version: 0.2.1
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
lit:
|
lit:
|
||||||
specifier: ^3.1.4
|
specifier: ^3.1.4
|
||||||
|
@ -231,7 +231,7 @@ importers:
|
||||||
specifier: ^18.3.0
|
specifier: ^18.3.0
|
||||||
version: 18.3.0
|
version: 18.3.0
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
preact:
|
preact:
|
||||||
specifier: ^10.23.1
|
specifier: ^10.23.1
|
||||||
|
@ -261,7 +261,7 @@ importers:
|
||||||
specifier: ^1.3.0
|
specifier: ^1.3.0
|
||||||
version: 1.3.0(preact@10.23.1)
|
version: 1.3.0(preact@10.23.1)
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
preact:
|
preact:
|
||||||
specifier: ^10.23.1
|
specifier: ^10.23.1
|
||||||
|
@ -279,7 +279,7 @@ importers:
|
||||||
specifier: ^18.3.0
|
specifier: ^18.3.0
|
||||||
version: 18.3.0
|
version: 18.3.0
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
react:
|
react:
|
||||||
specifier: ^18.3.1
|
specifier: ^18.3.1
|
||||||
|
@ -294,7 +294,7 @@ importers:
|
||||||
specifier: ^4.4.0
|
specifier: ^4.4.0
|
||||||
version: link:../../packages/integrations/solid
|
version: link:../../packages/integrations/solid
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
solid-js:
|
solid-js:
|
||||||
specifier: ^1.8.19
|
specifier: ^1.8.19
|
||||||
|
@ -306,7 +306,7 @@ importers:
|
||||||
specifier: ^5.7.0
|
specifier: ^5.7.0
|
||||||
version: link:../../packages/integrations/svelte
|
version: link:../../packages/integrations/svelte
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
svelte:
|
svelte:
|
||||||
specifier: ^4.2.18
|
specifier: ^4.2.18
|
||||||
|
@ -318,7 +318,7 @@ importers:
|
||||||
specifier: ^4.5.0
|
specifier: ^4.5.0
|
||||||
version: link:../../packages/integrations/vue
|
version: link:../../packages/integrations/vue
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
vue:
|
vue:
|
||||||
specifier: ^3.4.35
|
specifier: ^3.4.35
|
||||||
|
@ -330,13 +330,13 @@ importers:
|
||||||
specifier: ^8.3.2
|
specifier: ^8.3.2
|
||||||
version: link:../../packages/integrations/node
|
version: link:../../packages/integrations/node
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/integration:
|
examples/integration:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/middleware:
|
examples/middleware:
|
||||||
|
@ -345,7 +345,7 @@ importers:
|
||||||
specifier: ^8.3.2
|
specifier: ^8.3.2
|
||||||
version: link:../../packages/integrations/node
|
version: link:../../packages/integrations/node
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
html-minifier:
|
html-minifier:
|
||||||
specifier: ^4.0.0
|
specifier: ^4.0.0
|
||||||
|
@ -358,19 +358,19 @@ importers:
|
||||||
examples/minimal:
|
examples/minimal:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/non-html-pages:
|
examples/non-html-pages:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/portfolio:
|
examples/portfolio:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/server-islands:
|
examples/server-islands:
|
||||||
|
@ -397,7 +397,7 @@ importers:
|
||||||
specifier: ^18.3.0
|
specifier: ^18.3.0
|
||||||
version: 18.3.0
|
version: 18.3.0
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
postcss:
|
postcss:
|
||||||
specifier: ^8.4.40
|
specifier: ^8.4.40
|
||||||
|
@ -421,7 +421,7 @@ importers:
|
||||||
specifier: ^5.7.0
|
specifier: ^5.7.0
|
||||||
version: link:../../packages/integrations/svelte
|
version: link:../../packages/integrations/svelte
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
svelte:
|
svelte:
|
||||||
specifier: ^4.2.18
|
specifier: ^4.2.18
|
||||||
|
@ -430,7 +430,7 @@ importers:
|
||||||
examples/starlog:
|
examples/starlog:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
sass:
|
sass:
|
||||||
specifier: ^1.77.8
|
specifier: ^1.77.8
|
||||||
|
@ -442,7 +442,7 @@ importers:
|
||||||
examples/toolbar-app:
|
examples/toolbar-app:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/view-transitions:
|
examples/view-transitions:
|
||||||
|
@ -454,7 +454,7 @@ importers:
|
||||||
specifier: ^5.1.0
|
specifier: ^5.1.0
|
||||||
version: link:../../packages/integrations/tailwind
|
version: link:../../packages/integrations/tailwind
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/with-markdoc:
|
examples/with-markdoc:
|
||||||
|
@ -463,7 +463,7 @@ importers:
|
||||||
specifier: ^0.11.3
|
specifier: ^0.11.3
|
||||||
version: link:../../packages/integrations/markdoc
|
version: link:../../packages/integrations/markdoc
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/with-markdown-plugins:
|
examples/with-markdown-plugins:
|
||||||
|
@ -472,7 +472,7 @@ importers:
|
||||||
specifier: ^5.2.0
|
specifier: ^5.2.0
|
||||||
version: link:../../packages/markdown/remark
|
version: link:../../packages/markdown/remark
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
hast-util-select:
|
hast-util-select:
|
||||||
specifier: ^6.0.2
|
specifier: ^6.0.2
|
||||||
|
@ -493,7 +493,7 @@ importers:
|
||||||
examples/with-markdown-shiki:
|
examples/with-markdown-shiki:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
|
|
||||||
examples/with-mdx:
|
examples/with-mdx:
|
||||||
|
@ -505,7 +505,7 @@ importers:
|
||||||
specifier: ^3.5.1
|
specifier: ^3.5.1
|
||||||
version: link:../../packages/integrations/preact
|
version: link:../../packages/integrations/preact
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
preact:
|
preact:
|
||||||
specifier: ^10.23.1
|
specifier: ^10.23.1
|
||||||
|
@ -520,7 +520,7 @@ importers:
|
||||||
specifier: ^0.5.1
|
specifier: ^0.5.1
|
||||||
version: 0.5.1(nanostores@0.10.3)(preact@10.23.1)
|
version: 0.5.1(nanostores@0.10.3)(preact@10.23.1)
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
nanostores:
|
nanostores:
|
||||||
specifier: ^0.10.3
|
specifier: ^0.10.3
|
||||||
|
@ -541,7 +541,7 @@ importers:
|
||||||
specifier: ^1.6.4
|
specifier: ^1.6.4
|
||||||
version: 1.6.4
|
version: 1.6.4
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
autoprefixer:
|
autoprefixer:
|
||||||
specifier: ^10.4.19
|
specifier: ^10.4.19
|
||||||
|
@ -559,7 +559,7 @@ importers:
|
||||||
examples/with-vitest:
|
examples/with-vitest:
|
||||||
dependencies:
|
dependencies:
|
||||||
astro:
|
astro:
|
||||||
specifier: ^4.12.3
|
specifier: ^4.13.0
|
||||||
version: link:../../packages/astro
|
version: link:../../packages/astro
|
||||||
vitest:
|
vitest:
|
||||||
specifier: ^2.0.5
|
specifier: ^2.0.5
|
||||||
|
@ -9419,7 +9419,6 @@ packages:
|
||||||
|
|
||||||
libsql@0.3.12:
|
libsql@0.3.12:
|
||||||
resolution: {integrity: sha512-to30hj8O3DjS97wpbKN6ERZ8k66MN1IaOfFLR6oHqd25GMiPJ/ZX0VaZ7w+TsPmxcFS3p71qArj/hiedCyvXCg==}
|
resolution: {integrity: sha512-to30hj8O3DjS97wpbKN6ERZ8k66MN1IaOfFLR6oHqd25GMiPJ/ZX0VaZ7w+TsPmxcFS3p71qArj/hiedCyvXCg==}
|
||||||
cpu: [x64, arm64, wasm32]
|
|
||||||
os: [darwin, linux, win32]
|
os: [darwin, linux, win32]
|
||||||
|
|
||||||
lilconfig@2.1.0:
|
lilconfig@2.1.0:
|
||||||
|
|
Loading…
Reference in a new issue