diff --git a/.changeset/rude-lemons-battle.md b/.changeset/rude-lemons-battle.md
new file mode 100644
index 0000000..59269d9
--- /dev/null
+++ b/.changeset/rude-lemons-battle.md
@@ -0,0 +1,13 @@
+---
+'starlight-blog': minor
+---
+
+Adds support for Astro v5, drops support for Astro v4.
+
+⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now `0.30.0`.
+
+Please follow the [upgrade guide](https://github.com/withastro/starlight/releases/tag/%40astrojs/starlight%400.30.0) to update your project.
+
+Note that the [`legacy.collections` flag](https://docs.astro.build/en/reference/legacy-flags/#collections) is not supported by this plugin and you should update your collections to use Astro's new Content Layer API.
+
+⚠️ **BREAKING CHANGE:** The generated RSS feed no longer includes content of blog posts due to a [regression](https://github.com/withastro/astro/issues/12669) in Astro v5. The feature will be restored in a future release. If you rely on this feature, please stay on a previous version of Starlight and Astro in the meantime.
diff --git a/.node-version b/.node-version
index 4a97274..860cc50 100644
--- a/.node-version
+++ b/.node-version
@@ -1 +1 @@
-v18.14.1
+v18.17.1
diff --git a/.prettierignore b/.prettierignore
index 4654b26..7e76ec4 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -11,3 +11,4 @@ dist
dist-ssr
out
pnpm-lock.yaml
+test-results
diff --git a/.vscode/settings.json b/.vscode/settings.json
index a64edaa..e4a6ee6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,5 @@
{
- "eslint.experimental.useFlatConfig": true,
+ "eslint.useFlatConfig": true,
"eslint.validate": [
"javascript",
"javascriptreact",
diff --git a/docs/.prettierignore b/docs/.prettierignore
deleted file mode 100644
index 40f1830..0000000
--- a/docs/.prettierignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.astro
-.github/blocks
-.next
-.vercel
-.vscode-test
-.vscode-test-web
-build
-coverage
-dist
-dist-ssr
-out
-pnpm-lock.yaml
diff --git a/docs/package.json b/docs/package.json
index 6186ae8..44bcc2f 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -11,18 +11,17 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
- "lint": "eslint . --cache --max-warnings=0",
- "format": "prettier -w --cache --ignore-unknown ."
+ "lint": "eslint . --cache --max-warnings=0"
},
"dependencies": {
- "@astrojs/starlight": "0.28.3",
- "@hideoo/starlight-plugins-docs-components": "^0.2.2",
- "astro": "4.16.4",
- "sharp": "0.32.5",
+ "@astrojs/starlight": "^0.30.1",
+ "@hideoo/starlight-plugins-docs-components": "^0.3.0",
+ "astro": "^5.0.5",
+ "sharp": "^0.33.5",
"starlight-blog": "workspace:*"
},
"engines": {
- "node": ">=18.14.1"
+ "node": ">=18.17.1"
},
"packageManager": "pnpm@8.6.9",
"private": true,
@@ -37,7 +36,8 @@
"homepage": "https://github.com/HiDeoo/starlight-blog",
"repository": {
"type": "git",
- "url": "https://github.com/HiDeoo/starlight-blog.git"
+ "url": "https://github.com/HiDeoo/starlight-blog.git",
+ "directory": "docs"
},
"bugs": "https://github.com/HiDeoo/starlight-blog/issues"
}
diff --git a/docs/src/content/config.ts b/docs/src/content.config.ts
similarity index 65%
rename from docs/src/content/config.ts
rename to docs/src/content.config.ts
index a6b7eab..db20568 100644
--- a/docs/src/content/config.ts
+++ b/docs/src/content.config.ts
@@ -1,12 +1,14 @@
+import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders'
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'
import { defineCollection } from 'astro:content'
import { blogSchema } from 'starlight-blog/schema'
export const collections = {
docs: defineCollection({
+ loader: docsLoader(),
schema: docsSchema({
extend: (context) => blogSchema(context),
}),
}),
- i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
+ i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),
}
diff --git a/docs/src/content/docs/getting-started.mdx b/docs/src/content/docs/getting-started.mdx
index 7877c84..0faf662 100644
--- a/docs/src/content/docs/getting-started.mdx
+++ b/docs/src/content/docs/getting-started.mdx
@@ -49,18 +49,20 @@ import { PackageManagers } from '@hideoo/starlight-plugins-docs-components'
})
```
-3. Starlight Blog uses Astro’s [content collections](https://docs.astro.build/en/guides/content-collections/), which are configured in the `src/content/config.ts` file.
+3. Starlight Blog uses Astro’s [content collections](https://docs.astro.build/en/guides/content-collections/), which are configured in the `src/content.config.ts` file.
Update the content config file to add support for customizing individual blog posts using their frontmatter:
```diff lang="ts"
- // src/content/config.ts
+ // src/content.config.ts
import { defineCollection } from 'astro:content';
+ import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';
+import { blogSchema } from 'starlight-blog/schema'
export const collections = {
docs: defineCollection({
+ loader: docsLoader(),
schema: docsSchema({
+ extend: (context) => blogSchema(context)
})
diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx
index 1e74076..c37095f 100644
--- a/docs/src/content/docs/index.mdx
+++ b/docs/src/content/docs/index.mdx
@@ -18,7 +18,7 @@ hero:
- text: Demo
link: /blog
variant: minimal
- icon: external
+ icon: right-arrow
---
import { Card, CardGrid } from '@astrojs/starlight/components'
diff --git a/docs/src/env.d.ts b/docs/src/env.d.ts
deleted file mode 100644
index acef35f..0000000
--- a/docs/src/env.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-///
diff --git a/eslint.config.js b/eslint.config.mjs
similarity index 100%
rename from eslint.config.js
rename to eslint.config.mjs
diff --git a/package.json b/package.json
index 805b1ec..6076849 100644
--- a/package.json
+++ b/package.json
@@ -7,24 +7,25 @@
"type": "module",
"scripts": {
"test": "pnpm --stream -r test",
- "lint": "pnpm -r lint",
- "format": "pnpm -r format",
+ "lint": "astro check --noSync && pnpm -r lint",
+ "format": "prettier -w --cache --ignore-unknown .",
"version": "pnpm changeset version && pnpm i --no-frozen-lockfile"
},
"devDependencies": {
- "@changesets/changelog-github": "0.5.0",
- "@changesets/cli": "2.27.10",
- "@hideoo/eslint-config": "3.0.0",
- "@hideoo/prettier-config": "2.0.0",
- "@hideoo/tsconfig": "2.0.1",
- "astro": "4.16.4",
- "eslint": "8.56.0",
- "prettier": "3.0.3",
- "prettier-plugin-astro": "0.12.0",
- "typescript": "5.2.2"
+ "@astrojs/check": "^0.9.4",
+ "@changesets/changelog-github": "^0.5.0",
+ "@changesets/cli": "^2.27.10",
+ "@hideoo/eslint-config": "^4.0.0",
+ "@hideoo/prettier-config": "^2.0.0",
+ "@hideoo/tsconfig": "^2.0.1",
+ "astro": "^5.0.5",
+ "eslint": "^9.17.0",
+ "prettier": "^3.4.2",
+ "prettier-plugin-astro": "^0.14.1",
+ "typescript": "^5.7.2"
},
"engines": {
- "node": ">=18.14.1"
+ "node": ">=18.17.1"
},
"packageManager": "pnpm@8.6.9",
"private": true,
diff --git a/packages/starlight-blog/.gitignore b/packages/starlight-blog/.gitignore
index 85de9cf..b369963 100644
--- a/packages/starlight-blog/.gitignore
+++ b/packages/starlight-blog/.gitignore
@@ -1 +1,2 @@
src
+test-results
diff --git a/packages/starlight-blog/.npmignore b/packages/starlight-blog/.npmignore
index 935297c..e8d3016 100644
--- a/packages/starlight-blog/.npmignore
+++ b/packages/starlight-blog/.npmignore
@@ -1,7 +1,8 @@
.eslintcache
-.prettierignore
+eslint.config.mjs
playwright.config.ts
src
+test-results
tests
-tsconfig.json
-tsconfig.tsbuildinfo
+vitest.config.ts
+vitest.workspace.ts
diff --git a/packages/starlight-blog/.prettierignore b/packages/starlight-blog/.prettierignore
deleted file mode 100644
index 3440d46..0000000
--- a/packages/starlight-blog/.prettierignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.astro
-.github/blocks
-.next
-.vercel
-.vscode-test
-.vscode-test-web
-build
-coverage
-dist
-dist-ssr
-out
-pnpm-lock.yaml
-src
diff --git a/packages/starlight-blog/components/Preview.astro b/packages/starlight-blog/components/Preview.astro
index dcdeab9..e7bfe0b 100644
--- a/packages/starlight-blog/components/Preview.astro
+++ b/packages/starlight-blog/components/Preview.astro
@@ -21,7 +21,7 @@ const Excerpt = await getBlogEntryExcerpt(entry)
diff --git a/packages/starlight-blog/env.d.ts b/packages/starlight-blog/env.d.ts
index 585a587..e28a6be 100644
--- a/packages/starlight-blog/env.d.ts
+++ b/packages/starlight-blog/env.d.ts
@@ -1,29 +1,3 @@
-declare module 'astro:content' {
- export interface AstroCollectionEntry {
- body: string
- collection: string
- data: TData
- id: string
- render: () => Promise<{
- Content: import('astro').MarkdownInstance