-
-
Notifications
You must be signed in to change notification settings - Fork 833
Astro 5 + collection loaders + legacy collections support #2612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
12fa163
2dffec2
9bb4f5c
f84465a
6714593
db6affc
d7e5dd0
f1ab9e1
b6907d3
aa6c6be
e2b5173
806ee64
a6fe0ae
48191a2
f066341
574ead1
7fcc338
19cf56d
d8b0bba
a78d975
5c758c0
a51ff9a
234c01d
5aa97a5
c6d4a9c
b47c07f
798bf84
6041985
b178bf9
4d09de5
c225761
bc6819a
b77bd88
10574aa
d7a6b47
30a2e3f
96a088b
4b45a9f
a689a34
8acd505
2c57f2f
6583163
214d8b4
d2e5e3d
3bae9e3
073cfcb
9c5dcc3
1e8edf1
a74c1d1
1c5bdb6
b56de15
344878b
bf69ba5
97a78a6
f22913c
6c4df31
b14aca5
73d6e69
4d119e6
8aa6621
57c925e
71109b8
5380aba
ecd3116
0e23e3a
28ca09c
eb8022c
3b88a9b
9f75b18
f446092
2af3ed4
ba7d275
e07dd93
fc99611
0521ba2
000efa1
3f41484
803f8a6
d73e820
40469ed
f9b9731
dcb6095
43e5447
755a6d3
13c8796
39d6f3b
08a74c5
a2c7bb3
444d9cf
0b9a91c
fd04220
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| "@astrojs/starlight": minor | ||
| --- | ||
|
|
||
| Adds support for Astro v5, drops support for Astro v4. | ||
|
|
||
| #### Upgrade Astro and dependencies | ||
|
|
||
| ⚠️ **BREAKING CHANGE:** Astro v4 is no longer supported. Make sure you [update Astro](https://docs.astro.build/en/guides/upgrade-to/v5/) and any other official integrations at the same time as updating Starlight: | ||
|
|
||
| ```sh | ||
| npx @astrojs/upgrade | ||
| ``` | ||
|
|
||
| _Community Starlight plugins and Astro integrations may also need to be manually updated to work with Astro v5. If you encounter any issues, please reach out to the plugin or integration author to see if it is a known issue or if an updated version is being worked on._ | ||
|
|
||
| #### Update your collections | ||
|
|
||
| ⚠️ **BREAKING CHANGE:** Starlight's internal [content collections](https://docs.astro.build/en/guides/content-collections/), which organize, validate, and render your content, have been updated to use Astro's new Content Layer API and require configuration changes in your project. | ||
|
|
||
| 1. **Move the content config file.** This file no longer lives within the `src/content/config.ts` folder and should now exist at `src/content.config.ts`. | ||
|
|
||
|
|
||
| 1. **Edit the collection definition(s).** To update the `docs` collection, a `loader` is now required: | ||
|
|
||
| ```diff | ||
| // src/content.config.ts | ||
| import { defineCollection } from "astro:content"; | ||
| +import { docsLoader } from "@astrojs/starlight/loaders"; | ||
| import { docsSchema } from "@astrojs/starlight/schema"; | ||
|
|
||
| export const collections = { | ||
| - docs: defineCollection({ schema: docsSchema() }), | ||
| + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), | ||
| }; | ||
| ``` | ||
|
|
||
| If you are using the [`i18n` collection](https://starlight.astro.build/guides/i18n/#translate-starlights-ui) to provide translations for additional languages you support or override our default labels, you will need to update the collection definition in a similar way and remove the collection `type` which is no longer available: | ||
|
|
||
| ```diff | ||
| // src/content.config.ts | ||
| import { defineCollection } from "astro:content"; | ||
| +import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders"; | ||
| import { docsSchema, i18nSchema } from "@astrojs/starlight/schema"; | ||
|
|
||
| export const collections = { | ||
| - docs: defineCollection({ schema: docsSchema() }), | ||
| + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), | ||
| - i18n: defineCollection({ type: 'data', schema: i18nSchema() }), | ||
| + i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }), | ||
| }; | ||
| ``` | ||
|
|
||
| 1. **Update other collections.** To update any other collections you may have, follow the [“Updating existing collections”](https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections) section in the Astro 5 upgrade guide. | ||
|
|
||
| If you are unable to make any changes to your collections at this time, including Starlight's default `docs` and `i18n` collections, you can enable the [`legacy.collections` flag](https://docs.astro.build/en/reference/legacy-flags/) to upgrade to v5 without updating your collections. This legacy flag exists to provide temporary backwards compatibility, and will allow you to keep your collections in their current state until the legacy flag is no longer supported. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| '@astrojs/starlight-docsearch': minor | ||
| '@astrojs/starlight-tailwind': major | ||
| '@astrojs/starlight-markdoc': minor | ||
| --- | ||
|
|
||
| ⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now 0.30.0 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tentatively assuming that this PR will be shipped in the next minor version ( |
||
|
|
||
| Please use the `@astrojs/upgrade` command to upgrade your project: | ||
|
|
||
| ```sh | ||
| npx @astrojs/upgrade | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,3 @@ test-results/ | |
|
|
||
| # Vercel output | ||
| .vercel | ||
|
|
||
| # Created by @astrojs/check | ||
| /src/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,14 +85,14 @@ You can then pass this imported string to the `<Code>` component to include it o | |
| # src/content/docs/example.mdx | ||
|
|
||
| import { Code } from '@astrojs/starlight/components'; | ||
| import importedCode from '/src/env.d.ts?raw'; | ||
| import importedCode from '/tsconfig.json?raw'; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the changes to the TypeScript configuration, I removed all |
||
|
|
||
| <Code code={importedCode} lang="ts" title="src/env.d.ts" /> | ||
| <Code code={importedCode} lang="json" title="tsconfig.json" /> | ||
| ``` | ||
|
|
||
| import importedCode from '/src/env.d.ts?raw'; | ||
| import importedCode from '../../../../../examples/basics/tsconfig.json?raw'; | ||
|
|
||
| <Code slot="preview" code={importedCode} lang="ts" title="src/env.d.ts" /> | ||
| <Code slot="preview" code={importedCode} lang="json" title="tsconfig.json" /> | ||
|
|
||
| </Preview> | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.