diff --git a/.changeset/pre.json b/.changeset/pre.json
index a08df62b1c..fa0e79b5c0 100644
--- a/.changeset/pre.json
+++ b/.changeset/pre.json
@@ -34,12 +34,15 @@
"afraid-apricots-buy",
"blue-boats-relax",
"blue-sloths-stare",
+ "blue-socks-doubt",
"brave-elephants-fly",
"breezy-colts-promise",
+ "brown-bulldogs-share",
"chatty-teachers-sit",
"chilly-terms-know",
"clean-camels-drive",
"clean-donuts-walk",
+ "clean-moles-rest",
"cold-bananas-hear",
"cool-mangos-shop",
"cuddly-shoes-press",
@@ -61,6 +64,7 @@
"funny-wolves-dream",
"fuzzy-pugs-live",
"gentle-scissors-bow",
+ "giant-ravens-look",
"giant-rocks-thank",
"gorgeous-foxes-divide",
"healthy-ads-scream",
@@ -95,6 +99,7 @@
"poor-seals-clap",
"pretty-walls-camp",
"proud-games-repair",
+ "proud-terms-swim",
"quick-ads-exercise",
"quick-onions-leave",
"rotten-phones-scream",
@@ -110,12 +115,14 @@
"spotty-garlics-cheat",
"strange-sheep-film",
"strong-months-grab",
+ "strong-stingrays-provide",
"sweet-timers-smash",
"tall-waves-impress",
"tame-pumpkins-swim",
"tame-rats-cross",
"ten-students-repair",
"ten-walls-tap",
+ "thirty-clocks-jump",
"three-days-cough",
"three-olives-reflect",
"tough-planets-dress",
diff --git a/examples/basics/package.json b/examples/basics/package.json
index 7073ff822a..dbedbb0e99 100644
--- a/examples/basics/package.json
+++ b/examples/basics/package.json
@@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/blog/package.json b/examples/blog/package.json
index 0e13ddef6d..0ae87a1117 100644
--- a/examples/blog/package.json
+++ b/examples/blog/package.json
@@ -13,6 +13,6 @@
"@astrojs/mdx": "^4.0.0-beta.3",
"@astrojs/rss": "^4.0.9",
"@astrojs/sitemap": "^3.2.1",
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/component/package.json b/examples/component/package.json
index 27c20d0592..df329888a1 100644
--- a/examples/component/package.json
+++ b/examples/component/package.json
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
},
"peerDependencies": {
"astro": "^4.0.0 || ^5.0.0"
diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json
index 5cb0084ac1..40a5ad19e7 100644
--- a/examples/container-with-vitest/package.json
+++ b/examples/container-with-vitest/package.json
@@ -11,8 +11,8 @@
"test": "vitest run"
},
"dependencies": {
- "astro": "^5.0.0-beta.8",
- "@astrojs/react": "^3.6.2",
+ "astro": "^5.0.0-beta.9",
+ "@astrojs/react": "^3.6.3-beta.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vitest": "^2.1.4"
diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json
index 698088fcfe..82296fd493 100644
--- a/examples/framework-alpine/package.json
+++ b/examples/framework-alpine/package.json
@@ -13,6 +13,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.3",
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json
index bca3430009..8756e8786f 100644
--- a/examples/framework-multiple/package.json
+++ b/examples/framework-multiple/package.json
@@ -10,14 +10,14 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/preact": "^3.5.3",
- "@astrojs/react": "^3.6.2",
- "@astrojs/solid-js": "^4.4.3",
- "@astrojs/svelte": "^6.0.0-beta.2",
- "@astrojs/vue": "^5.0.0-beta.1",
+ "@astrojs/preact": "^3.5.4-beta.0",
+ "@astrojs/react": "^3.6.3-beta.0",
+ "@astrojs/solid-js": "^4.4.4-beta.0",
+ "@astrojs/svelte": "^6.0.2-beta.0",
+ "@astrojs/vue": "^5.0.0-beta.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"preact": "^10.24.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json
index 445c836fcf..6d0e701040 100644
--- a/examples/framework-preact/package.json
+++ b/examples/framework-preact/package.json
@@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/preact": "^3.5.3",
+ "@astrojs/preact": "^3.5.4-beta.0",
"@preact/signals": "^1.3.0",
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"preact": "^10.24.3"
}
}
diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json
index b0541cba7c..da22ea8806 100644
--- a/examples/framework-react/package.json
+++ b/examples/framework-react/package.json
@@ -10,10 +10,10 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/react": "^3.6.2",
+ "@astrojs/react": "^3.6.3-beta.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json
index da283570d9..6eef341613 100644
--- a/examples/framework-solid/package.json
+++ b/examples/framework-solid/package.json
@@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/solid-js": "^4.4.3",
- "astro": "^5.0.0-beta.8",
+ "@astrojs/solid-js": "^4.4.4-beta.0",
+ "astro": "^5.0.0-beta.9",
"solid-js": "^1.9.2"
}
}
diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json
index 56e22f6be5..22c8b22ba3 100644
--- a/examples/framework-svelte/package.json
+++ b/examples/framework-svelte/package.json
@@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/svelte": "^6.0.0",
- "astro": "^5.0.0-beta.8",
+ "@astrojs/svelte": "^6.0.2-beta.0",
+ "astro": "^5.0.0-beta.9",
"svelte": "^5.1.16"
}
}
diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json
index ae8a1403f3..d552611897 100644
--- a/examples/framework-vue/package.json
+++ b/examples/framework-vue/package.json
@@ -10,8 +10,8 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/vue": "^5.0.0-beta.1",
- "astro": "^5.0.0-beta.8",
+ "@astrojs/vue": "^5.0.0-beta.2",
+ "astro": "^5.0.0-beta.9",
"vue": "^3.5.12"
}
}
diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json
index 71bdd46ea7..04330f9699 100644
--- a/examples/hackernews/package.json
+++ b/examples/hackernews/package.json
@@ -11,6 +11,6 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/integration/package.json b/examples/integration/package.json
index b591fedb58..e2c6d1b827 100644
--- a/examples/integration/package.json
+++ b/examples/integration/package.json
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
},
"peerDependencies": {
"astro": "^4.0.0"
diff --git a/examples/minimal/package.json b/examples/minimal/package.json
index f792c9b96a..2fa61a582e 100644
--- a/examples/minimal/package.json
+++ b/examples/minimal/package.json
@@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json
index fe41095bdd..54426be0e3 100644
--- a/examples/portfolio/package.json
+++ b/examples/portfolio/package.json
@@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/ssr/package.json b/examples/ssr/package.json
index 1a468ec123..8d70ee57ce 100644
--- a/examples/ssr/package.json
+++ b/examples/ssr/package.json
@@ -12,8 +12,8 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
- "@astrojs/svelte": "^6.0.0",
- "astro": "^5.0.0-beta.8",
+ "@astrojs/svelte": "^6.0.2-beta.0",
+ "astro": "^5.0.0-beta.9",
"svelte": "^5.1.16"
}
}
diff --git a/examples/starlog/package.json b/examples/starlog/package.json
index ffcae20cca..4c45287840 100644
--- a/examples/starlog/package.json
+++ b/examples/starlog/package.json
@@ -9,7 +9,7 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"sass": "^1.80.6",
"sharp": "^0.33.3"
}
diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json
index 5b03d6f85e..f2b13f2874 100644
--- a/examples/toolbar-app/package.json
+++ b/examples/toolbar-app/package.json
@@ -15,6 +15,6 @@
"./app": "./dist/app.js"
},
"devDependencies": {
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json
index 9916a48510..2cc4378a65 100644
--- a/examples/with-markdoc/package.json
+++ b/examples/with-markdoc/package.json
@@ -11,6 +11,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.12.0-beta.0",
- "astro": "^5.0.0-beta.8"
+ "astro": "^5.0.0-beta.9"
}
}
diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json
index 4642aa9ef4..ab172bc1ee 100644
--- a/examples/with-mdx/package.json
+++ b/examples/with-mdx/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@astrojs/mdx": "^4.0.0-beta.3",
- "@astrojs/preact": "^3.5.3",
- "astro": "^5.0.0-beta.8",
+ "@astrojs/preact": "^3.5.4-beta.0",
+ "astro": "^5.0.0-beta.9",
"preact": "^10.24.3"
}
}
diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json
index 19cd884f95..7ad15fd506 100644
--- a/examples/with-nanostores/package.json
+++ b/examples/with-nanostores/package.json
@@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/preact": "^3.5.3",
+ "@astrojs/preact": "^3.5.4-beta.0",
"@nanostores/preact": "^0.5.2",
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"nanostores": "^0.11.3",
"preact": "^10.24.3"
}
diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json
index fcfe676f17..dbc2816093 100644
--- a/examples/with-tailwindcss/package.json
+++ b/examples/with-tailwindcss/package.json
@@ -13,7 +13,7 @@
"@astrojs/mdx": "^4.0.0-beta.3",
"@astrojs/tailwind": "^5.1.2",
"@types/canvas-confetti": "^1.6.4",
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.47",
diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json
index 24c9cb1b02..c5d1d95295 100644
--- a/examples/with-vitest/package.json
+++ b/examples/with-vitest/package.json
@@ -11,7 +11,7 @@
"test": "vitest"
},
"dependencies": {
- "astro": "^5.0.0-beta.8",
+ "astro": "^5.0.0-beta.9",
"vitest": "^2.1.4"
}
}
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md
index 178d2d9c1b..c943918115 100644
--- a/packages/astro/CHANGELOG.md
+++ b/packages/astro/CHANGELOG.md
@@ -1,5 +1,195 @@
# astro
+## 5.0.0-beta.9
+
+### Minor Changes
+
+- [#12067](https://github.com/withastro/astro/pull/12067) [`c48916c`](https://github.com/withastro/astro/commit/c48916cc4e6f7c31e3563d04b68a8698d8775b65) Thanks [@stramel](https://github.com/stramel)! - Adds experimental support for built-in SVG components.
+
+ This feature allows you to import SVG files directly into your Astro project as components. By default, Astro will inline the SVG content into your HTML output.
+
+ To enable this feature, set `experimental.svg` to `true` in your Astro config:
+
+ ```js
+ {
+ experimental: {
+ svg: true,
+ },
+ }
+ ```
+
+ To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. Astro also provides a `size` attribute to set equal `height` and `width` properties:
+
+ ```astro
+ ---
+ import Logo from './path/to/svg/file.svg';
+ ---
+
+
+ ```
+
+ For a complete overview, and to give feedback on this experimental API, see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035).
+
+- [#12329](https://github.com/withastro/astro/pull/12329) [`8309c61`](https://github.com/withastro/astro/commit/8309c61f0dfa5991d3f6c5c5fca4403794d6fda2) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `astro:routes:resolved` hook to the Integration API. Also update the `astro:build:done` hook by deprecating `routes` and adding a new `assets` map.
+
+ When building an integration, you can now get access to routes inside the `astro:routes:resolved` hook:
+
+ ```js
+ const integration = () => {
+ return {
+ name: 'my-integration',
+ hooks: {
+ 'astro:routes:resolved': ({ routes }) => {
+ console.log(routes);
+ },
+ },
+ };
+ };
+ ```
+
+ This hook runs before `astro:config:done`, and whenever a route changes in development.
+
+ The `routes` array from `astro:build:done` is now deprecated, and exposed properties are now available on `astro:routes:resolved`, except for `distURL`. For this, you can use the newly exposed `assets` map:
+
+ ```diff
+ const integration = () => {
+ + let routes
+ return {
+ name: 'my-integration',
+ hooks: {
+ + 'astro:routes:resolved': (params) => {
+ + routes = params.routes
+ + },
+ 'astro:build:done': ({
+ - routes
+ + assets
+ }) => {
+ + for (const route of routes) {
+ + const distURL = assets.get(route.pattern)
+ + if (distURL) {
+ + Object.assign(route, { distURL })
+ + }
+ + }
+ console.log(routes)
+ }
+ }
+ }
+ }
+ ```
+
+- [#12377](https://github.com/withastro/astro/pull/12377) [`af867f3`](https://github.com/withastro/astro/commit/af867f3910ecd8fc04a5337f591d84f03192e3fa) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds experimental support for automatic responsive images
+
+ This feature is experimental and may change in future versions. To enable it, set `experimental.responsiveImages` to `true` in your `astro.config.mjs` file.
+
+ ```js title=astro.config.mjs
+ {
+ experimental: {
+ responsiveImages: true,
+ },
+ }
+ ```
+
+ When this flag is enabled, you can pass a `layout` prop to any `` or `` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `responsive` and `full-width` layouts will have styles applied to ensure they resize according to their container.
+
+ ```astro
+ ---
+ import { Image, Picture } from 'astro:assets';
+ import myImage from '../assets/my_image.png';
+ ---
+
+
+
+ ```
+
+ This `` component will generate the following HTML output:
+
+ ```html title=Output
+
+ ```
+
+ #### Responsive image properties
+
+ These are additional properties available to the `` and `` components when responsive images are enabled:
+
+ - `layout`: The layout type for the image. Can be `responsive`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`.
+ - `fit`: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS `object-fit`. Defaults to `cover`, or the value of `image.experimentalObjectFit` if set.
+ - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set.
+ - `priority`: If set, eagerly loads the image. Otherwise images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`.
+
+ #### Default responsive image settings
+
+ You can enable responsive images for all `` and `` components by setting `image.experimentalLayout` with a default value. This can be overridden by the `layout` prop on each component.
+
+ **Example:**
+
+ ```js title=astro.config.mjs
+ {
+ image: {
+ // Used for all `` and `` components unless overridden
+ experimentalLayout: 'responsive',
+ },
+ experimental: {
+ responsiveImages: true,
+ },
+ }
+ ```
+
+ ```astro
+ ---
+ import { Image } from 'astro:assets';
+ import myImage from '../assets/my_image.png';
+ ---
+
+
+
+
+
+
+ ```
+
+ For a complete overview, and to give feedback on this experimental API, see the [Responsive Images RFC](https://github.com/withastro/roadmap/blob/responsive-images/proposals/0053-responsive-images.md).
+
+- [#12475](https://github.com/withastro/astro/pull/12475) [`3f02d5f`](https://github.com/withastro/astro/commit/3f02d5f12b167514fff6eb9693b4e25c668e7a31) Thanks [@ascorbic](https://github.com/ascorbic)! - Changes the default content config location from `src/content/config.*` to `src/content.config.*`.
+
+ The previous location is still supported, and is required if the `legacy.collections` flag is enabled.
+
+### Patch Changes
+
+- [#12424](https://github.com/withastro/astro/pull/12424) [`4364bff`](https://github.com/withastro/astro/commit/4364bff27332e52f92da72392620a36110daee42) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where an incorrect usage of Astro actions was lost when porting the fix from v4 to v5
+
+- [#12438](https://github.com/withastro/astro/pull/12438) [`c8f877c`](https://github.com/withastro/astro/commit/c8f877cad2d8f1780f70045413872d5b9d32ebed) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug where legacy content types were generated for content layer collections if they were in the content directory
+
## 5.0.0-beta.8
### Minor Changes
diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts
index f9badff245..0832344b4f 100644
--- a/packages/astro/client.d.ts
+++ b/packages/astro/client.d.ts
@@ -111,7 +111,7 @@ declare module '*.svg' {
type Props = {
/**
* Accesible, short-text description
- *
+ *
* {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title|MDN Reference}
*/
title?: string;
@@ -122,9 +122,9 @@ declare module '*.svg' {
/**
* Override the default rendering mode for SVGs
*/
- mode?: import('./dist/assets/utils/svg.js').SvgRenderMode
- } & astroHTML.JSX.SVGAttributes
-
+ mode?: import('./dist/assets/utils/svg.js').SvgRenderMode;
+ } & astroHTML.JSX.SVGAttributes;
+
const Component: ((_props: Props) => any) & ImageMetadata;
export default Component;
}
diff --git a/packages/astro/package.json b/packages/astro/package.json
index 3ca98a18a5..67c68dab2c 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -1,6 +1,6 @@
{
"name": "astro",
- "version": "5.0.0-beta.8",
+ "version": "5.0.0-beta.9",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
diff --git a/packages/astro/src/assets/utils/index.ts b/packages/astro/src/assets/utils/index.ts
index 98044ac9fa..3fae182000 100644
--- a/packages/astro/src/assets/utils/index.ts
+++ b/packages/astro/src/assets/utils/index.ts
@@ -13,4 +13,4 @@ export {
} from './remotePattern.js';
export { hashTransform, propsToFilename } from './transformToPath.js';
export { inferRemoteSize } from './remoteProbe.js';
-export { makeSvgComponent } from './svg.js'
+export { makeSvgComponent } from './svg.js';
diff --git a/packages/astro/src/assets/utils/svg.ts b/packages/astro/src/assets/utils/svg.ts
index 70088ba64a..6f9c54381c 100644
--- a/packages/astro/src/assets/utils/svg.ts
+++ b/packages/astro/src/assets/utils/svg.ts
@@ -1,7 +1,7 @@
import { parse, renderSync } from 'ultrahtml';
-import type { ImageMetadata } from '../types.js';
import type { SvgComponentProps } from '../runtime.js';
import { dropAttributes } from '../runtime.js';
+import type { ImageMetadata } from '../types.js';
function parseSvg(contents: string) {
const root = parse(contents);
@@ -13,7 +13,11 @@ function parseSvg(contents: string) {
export type SvgRenderMode = 'inline' | 'sprite';
-export function makeSvgComponent(meta: ImageMetadata, contents: Buffer | string, options?: { mode?: SvgRenderMode }) {
+export function makeSvgComponent(
+ meta: ImageMetadata,
+ contents: Buffer | string,
+ options?: { mode?: SvgRenderMode },
+) {
const file = typeof contents === 'string' ? contents : contents.toString('utf-8');
const { attributes, body: children } = parseSvg(file);
const props: SvgComponentProps = {
diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts
index 7cb04c1bde..e09fc15975 100644
--- a/packages/astro/src/assets/vite-plugin-assets.ts
+++ b/packages/astro/src/assets/vite-plugin-assets.ts
@@ -17,8 +17,8 @@ import { getAssetsPrefix } from './utils/getAssetsPrefix.js';
import { isESMImportedImage } from './utils/imageKind.js';
import { emitESMImage } from './utils/node/emitAsset.js';
import { getProxyCode } from './utils/proxy.js';
-import { hashTransform, propsToFilename } from './utils/transformToPath.js';
import { makeSvgComponent } from './utils/svg.js';
+import { hashTransform, propsToFilename } from './utils/transformToPath.js';
const resolvedVirtualModuleId = '\0' + VIRTUAL_MODULE_ID;
@@ -217,7 +217,9 @@ export default function assets({ settings }: { settings: AstroSettings }): vite.
if (settings.config.experimental.svg && /\.svg$/.test(id)) {
const { contents, ...metadata } = imageMetadata;
// We know that the contents are present, as we only emit this property for SVG files
- return makeSvgComponent(metadata, contents!, { mode: settings.config.experimental.svg.mode });
+ return makeSvgComponent(metadata, contents!, {
+ mode: settings.config.experimental.svg.mode,
+ });
}
// We can only reliably determine if an image is used on the server, as we need to track its usage throughout the entire build.
diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts
index af3dd82ea4..3ddaf3e0c2 100644
--- a/packages/astro/src/core/config/schema.ts
+++ b/packages/astro/src/core/config/schema.ts
@@ -537,16 +537,16 @@ export const AstroConfigSchema = z.object({
.boolean()
.optional()
.default(ASTRO_CONFIG_DEFAULTS.experimental.responsiveImages),
- svg: z.union([
- z.boolean(),
- z
- .object({
- mode: z
- .union([z.literal('inline'), z.literal('sprite')])
- .optional()
- .default(ASTRO_CONFIG_DEFAULTS.experimental.svg.mode),
- })
- ])
+ svg: z
+ .union([
+ z.boolean(),
+ z.object({
+ mode: z
+ .union([z.literal('inline'), z.literal('sprite')])
+ .optional()
+ .default(ASTRO_CONFIG_DEFAULTS.experimental.svg.mode),
+ }),
+ ])
.optional()
.transform((svgConfig) => {
// Handle normalization of `experimental.svg` config boolean values
diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts
index 621164084e..6dbcf18aee 100644
--- a/packages/astro/src/core/routing/manifest/create.ts
+++ b/packages/astro/src/core/routing/manifest/create.ts
@@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url';
import { bold } from 'kleur/colors';
import pLimit from 'p-limit';
import { toRoutingStrategy } from '../../../i18n/utils.js';
+import { runHookRoutesResolved } from '../../../integrations/hooks.js';
import { getPrerenderDefault } from '../../../prerender/utils.js';
import type { AstroConfig } from '../../../types/public/config.js';
import type { RouteData, RoutePart } from '../../../types/public/internal.js';
@@ -20,7 +21,6 @@ import { routeComparator } from '../priority.js';
import { getRouteGenerator } from './generator.js';
import { getPattern } from './pattern.js';
import { getRoutePrerenderOption } from './prerender.js';
-import { runHookRoutesResolved } from '../../../integrations/hooks.js';
const require = createRequire(import.meta.url);
interface Item {
diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts
index 832a55b282..67fdccc543 100644
--- a/packages/astro/src/core/sync/index.ts
+++ b/packages/astro/src/core/sync/index.ts
@@ -253,20 +253,22 @@ async function syncContentCollections(
if (isAstroError(e)) {
throw e;
}
- let configFile
+ let configFile;
try {
const contentPaths = getContentPaths(settings.config, fs);
- if(contentPaths.config.exists) {
+ if (contentPaths.config.exists) {
const matches = /\/(src\/.+)/.exec(contentPaths.config.url.href);
if (matches) {
- configFile = matches[1]
+ configFile = matches[1];
}
}
} catch {
// ignore
}
- const hint = AstroUserError.is(e) ? e.hint : AstroErrorData.GenerateContentTypesError.hint(configFile);
+ const hint = AstroUserError.is(e)
+ ? e.hint
+ : AstroErrorData.GenerateContentTypesError.hint(configFile);
throw new AstroError(
{
...AstroErrorData.GenerateContentTypesError,
diff --git a/packages/astro/src/types/astro.ts b/packages/astro/src/types/astro.ts
index 654652c422..1227ed381a 100644
--- a/packages/astro/src/types/astro.ts
+++ b/packages/astro/src/types/astro.ts
@@ -13,7 +13,7 @@ import type {
InjectedScriptStage,
InjectedType,
} from './public/integrations.js';
-import type { InternalInjectedRoute, RouteData, ResolvedInjectedRoute } from './public/internal.js';
+import type { InternalInjectedRoute, ResolvedInjectedRoute, RouteData } from './public/internal.js';
import type { DevToolbarAppEntry } from './public/toolbar.js';
export type SerializedRouteData = Omit<
diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts
index a01dc42cd7..16261cd759 100644
--- a/packages/astro/src/types/public/config.ts
+++ b/packages/astro/src/types/public/config.ts
@@ -1130,11 +1130,11 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* @name markdown.shikiConfig
* @typeraw {Partial}
* @description
- *
- * Shiki is our default syntax highlighter. You can configure all options via the `markdown.shikiConfig` object:
- *
- * ```js title="astro.config.mjs"
- * import { defineConfig } from 'astro/config';
+ *
+ * Shiki is our default syntax highlighter. You can configure all options via the `markdown.shikiConfig` object:
+ *
+ * ```js title="astro.config.mjs"
+ * import { defineConfig } from 'astro/config';
*
* export default defineConfig({
* markdown: {
@@ -1146,7 +1146,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* // See note below for using dual light/dark themes
* themes: {
* light: 'github-light',
- * dark: 'github-dark',
+ * dark: 'github-dark',
* },
* // Disable the default colors
* // https://shiki.style/guide/dual-themes#without-default-color
@@ -1770,7 +1770,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* @name experimental.contentIntellisense
* @type {boolean}
* @default `false`
- * @version 5.x
+ * @version 5.x
* @description
*
* Enables Intellisense features (e.g. code completion, quick hints) for your content collection entries in compatible editors.
@@ -1901,7 +1901,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
*
* The `widths` and `sizes` attributes are automatically generated based on the image's dimensions and the layout type, and in most cases should not be set manually. The generated `sizes` attribute for `responsive` and `full-width` images
* is based on the assumption that the image is displayed at close to the full width of the screen when the viewport is smaller than the image's width. If it is significantly different (e.g. if it's in a multi-column layout on small screens) you may need to adjust the `sizes` attribute manually for best results.
- *
+ *
* The `densities` attribute is not compatible with responsive images and will be ignored if set.
*/
@@ -1912,13 +1912,13 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* @name experimental.svg
* @type {boolean|object}
* @default `undefined`
- * @version 5.x
+ * @version 5.x
* @description
- *
+ *
* This feature allows you to import SVG files directly into your Astro project. By default, Astro will inline the SVG content into your HTML output.
- *
+ *
* To enable this feature, set `experimental.svg` to `true` in your Astro config:
- *
+ *
* ```js
* {
* experimental: {
@@ -1926,20 +1926,20 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* },
* }
* ```
- *
+ *
* To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component.
* Astro also provides a `size` attribute to set equal `height` and `width` properties:
- *
+ *
* ```astro
* ---
* import Logo from './path/to/svg/file.svg';
* ---
- *
+ *
*
* ```
- *
+ *
* For a complete overview, and to give feedback on this experimental API,
- * see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035).
+ * see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035).
*/
svg?: {
/**
@@ -1947,17 +1947,17 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* @name experimental.svg.mode
* @type {string}
* @default 'inline'
- *
+ *
* The default technique for handling imported SVG files. Astro will inline the SVG content into your HTML output if not specified.
- *
+ *
* - `inline`: Astro will inline the SVG content into your HTML output.
* - `sprite`: Astro will generate a sprite sheet with all imported SVG files.
- *
+ *
* ```astro
* ---
* import Logo from './path/to/svg/file.svg';
* ---
- *
+ *
*
* ```
*/
diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts
index 642565161b..ab90021b32 100644
--- a/packages/astro/src/vite-plugin-astro-server/plugin.ts
+++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts
@@ -1,6 +1,7 @@
import { AsyncLocalStorage } from 'node:async_hooks';
import type fs from 'node:fs';
import { IncomingMessage } from 'node:http';
+import { fileURLToPath } from 'node:url';
import type * as vite from 'vite';
import { normalizePath } from 'vite';
import type { SSRManifest, SSRManifestI18n } from '../core/app/types.js';
@@ -14,7 +15,9 @@ import { NOOP_MIDDLEWARE_FN } from '../core/middleware/noop-middleware.js';
import { createViteLoader } from '../core/module-loader/index.js';
import { injectDefaultDevRoutes } from '../core/routing/dev-default.js';
import { createRouteManifest } from '../core/routing/index.js';
+import { getRoutePrerenderOption } from '../core/routing/manifest/prerender.js';
import { toFallbackType, toRoutingStrategy } from '../i18n/utils.js';
+import { runHookRoutesResolved } from '../integrations/hooks.js';
import type { AstroSettings, ManifestData } from '../types/astro.js';
import { baseMiddleware } from './base.js';
import { createController } from './controller.js';
@@ -22,9 +25,6 @@ import { recordServerError } from './error.js';
import { DevPipeline } from './pipeline.js';
import { handleRequest } from './request.js';
import { setRouteError } from './server-state.js';
-import { fileURLToPath } from 'node:url';
-import { getRoutePrerenderOption } from '../core/routing/manifest/prerender.js';
-import { runHookRoutesResolved } from '../integrations/hooks.js';
export interface AstroPluginOptions {
settings: AstroSettings;
diff --git a/packages/astro/test/core-image-svg.test.js b/packages/astro/test/core-image-svg.test.js
index d6134aaf77..e346cb6a72 100644
--- a/packages/astro/test/core-image-svg.test.js
+++ b/packages/astro/test/core-image-svg.test.js
@@ -53,7 +53,7 @@ describe('astro:assets - SVG Components', () => {
assert.equal(!!$(this).attr('mode'), false);
const $use = $(this).children('use');
assert.equal($use.length, 0);
- })
+ });
});
it('Adds the