@astrojs/starlight 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/components/Banner.astro +1 -1
- package/components/EditLink.astro +3 -1
- package/integrations/virtual-user-config.ts +2 -2
- package/package.json +1 -1
- package/schema.ts +2 -18
- package/translations/nl.json +1 -1
- package/utils/routing.ts +6 -4
- package/virtual.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#783](https://github.com/withastro/starlight/pull/783) [`f94727e`](https://github.com/withastro/starlight/commit/f94727e7d286a6910f913a572b27eb17c42f1729) Thanks [@kevinzunigacuellar](https://github.com/kevinzunigacuellar)! - Fix GitHub edit link to include src path from project config
|
|
8
|
+
|
|
9
|
+
- [#781](https://github.com/withastro/starlight/pull/781) [`a293ef9`](https://github.com/withastro/starlight/commit/a293ef9ebb10a07db456156d8bdacc4ff6a2ca38) Thanks [@dreyfus92](https://github.com/dreyfus92)! - Removed role from Banner component to avoid duplication in header.
|
|
10
|
+
|
|
11
|
+
- [#745](https://github.com/withastro/starlight/pull/745) [`006d606`](https://github.com/withastro/starlight/commit/006d60695761ec10e5c4e715ed2212cd1fbedda0) Thanks [@TheOtterlord](https://github.com/TheOtterlord)! - Prevent Starlight crashing when the content folder doesn't exist, or is empty
|
|
12
|
+
|
|
13
|
+
- [#775](https://github.com/withastro/starlight/pull/775) [`2ef3036`](https://github.com/withastro/starlight/commit/2ef303649a0b66a6ec6a216815e05d41bf22b594) Thanks [@delucis](https://github.com/delucis)! - Fix content collection schema compatibility with Astro 3.1 and higher
|
|
14
|
+
|
|
15
|
+
- [#773](https://github.com/withastro/starlight/pull/773) [`423d575`](https://github.com/withastro/starlight/commit/423d575cc8227e4db86a85c70c45c0f3f7a184d2) Thanks [@tlandmangh](https://github.com/tlandmangh)! - Fix Dutch UI translation for “Previous page” links
|
|
16
|
+
|
|
3
17
|
## 0.10.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/components/Banner.astro
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
|
+
import project from 'virtual:starlight/project-context';
|
|
4
5
|
import { useTranslations } from '../utils/translations';
|
|
5
6
|
import Icon from '../user-components/Icon.astro';
|
|
6
7
|
|
|
@@ -12,6 +13,7 @@ interface Props {
|
|
|
12
13
|
|
|
13
14
|
const t = useTranslations(Astro.props.locale);
|
|
14
15
|
const { editUrl } = Astro.props.data;
|
|
16
|
+
const srcPath = project.srcDir.replace(project.root, '');
|
|
15
17
|
|
|
16
18
|
let { baseUrl } = config.editLink;
|
|
17
19
|
if (baseUrl && baseUrl.at(-1) !== '/') baseUrl += '/';
|
|
@@ -20,7 +22,7 @@ const url =
|
|
|
20
22
|
typeof editUrl === 'string'
|
|
21
23
|
? editUrl
|
|
22
24
|
: baseUrl
|
|
23
|
-
? baseUrl + '
|
|
25
|
+
? baseUrl + srcPath + 'content/docs/' + Astro.props.id
|
|
24
26
|
: undefined;
|
|
25
27
|
---
|
|
26
28
|
|
|
@@ -10,7 +10,7 @@ function resolveVirtualModuleId<T extends string>(id: T): `\0${T}` {
|
|
|
10
10
|
/** Vite plugin that exposes Starlight user config and project context via virtual modules. */
|
|
11
11
|
export function vitePluginStarlightUserConfig(
|
|
12
12
|
opts: StarlightConfig,
|
|
13
|
-
{ root }: Pick<AstroConfig, 'root'>
|
|
13
|
+
{ root, srcDir }: Pick<AstroConfig, 'root' | 'srcDir'>
|
|
14
14
|
): NonNullable<ViteUserConfig['plugins']>[number] {
|
|
15
15
|
const resolveId = (id: string) =>
|
|
16
16
|
JSON.stringify(id.startsWith('.') ? resolve(fileURLToPath(root), id) : id);
|
|
@@ -18,7 +18,7 @@ export function vitePluginStarlightUserConfig(
|
|
|
18
18
|
/** Map of virtual module names to their code contents as strings. */
|
|
19
19
|
const modules = {
|
|
20
20
|
'virtual:starlight/user-config': `export default ${JSON.stringify(opts)}`,
|
|
21
|
-
'virtual:starlight/project-context': `export default ${JSON.stringify({ root })}`,
|
|
21
|
+
'virtual:starlight/project-context': `export default ${JSON.stringify({ root, srcDir })}`,
|
|
22
22
|
'virtual:starlight/user-css': opts.customCss.map((id) => `import ${resolveId(id)};`).join(''),
|
|
23
23
|
'virtual:starlight/user-images': opts.logo
|
|
24
24
|
? 'src' in opts.logo
|
package/package.json
CHANGED
package/schema.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
|
+
import type { SchemaContext } from 'astro:content';
|
|
2
3
|
import { HeadConfigSchema } from './schemas/head';
|
|
3
4
|
import { PrevNextLinkConfigSchema } from './schemas/prevNextLink';
|
|
4
5
|
import { TableOfContentsSchema } from './schemas/tableOfContents';
|
|
@@ -9,25 +10,8 @@ export { i18nSchema } from './schemas/i18n';
|
|
|
9
10
|
type IconName = keyof typeof Icons;
|
|
10
11
|
const iconNames = Object.keys(Icons) as [IconName, ...IconName[]];
|
|
11
12
|
|
|
12
|
-
type ImageFunction = () => z.ZodObject<{
|
|
13
|
-
src: z.ZodString;
|
|
14
|
-
width: z.ZodNumber;
|
|
15
|
-
height: z.ZodNumber;
|
|
16
|
-
format: z.ZodUnion<
|
|
17
|
-
[
|
|
18
|
-
z.ZodLiteral<'png'>,
|
|
19
|
-
z.ZodLiteral<'jpg'>,
|
|
20
|
-
z.ZodLiteral<'jpeg'>,
|
|
21
|
-
z.ZodLiteral<'tiff'>,
|
|
22
|
-
z.ZodLiteral<'webp'>,
|
|
23
|
-
z.ZodLiteral<'gif'>,
|
|
24
|
-
z.ZodLiteral<'svg'>,
|
|
25
|
-
]
|
|
26
|
-
>;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
13
|
export function docsSchema() {
|
|
30
|
-
return ({ image }:
|
|
14
|
+
return ({ image }: SchemaContext) =>
|
|
31
15
|
z.object({
|
|
32
16
|
/** The title of the current page. Required. */
|
|
33
17
|
title: z.string(),
|
package/translations/nl.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"i18n.untranslatedContent": "Deze inhoud is nog niet vertaald.",
|
|
17
17
|
"page.editLink": "Bewerk pagina",
|
|
18
18
|
"page.lastUpdated": "Laatst bewerkt:",
|
|
19
|
-
"page.previousLink": "
|
|
19
|
+
"page.previousLink": "Vorige",
|
|
20
20
|
"page.nextLink": "Volgende",
|
|
21
21
|
"404.text": "Pagina niet gevonden. Controleer de URL of probeer de zoekbalk."
|
|
22
22
|
}
|
package/utils/routing.ts
CHANGED
|
@@ -35,10 +35,12 @@ interface Path extends GetStaticPathsItem {
|
|
|
35
35
|
const normalizeIndexSlug = (slug: string) => (slug === 'index' ? '' : slug);
|
|
36
36
|
|
|
37
37
|
/** All entries in the docs content collection. */
|
|
38
|
-
const docs: StarlightDocsEntry[] = (await getCollection('docs'))
|
|
39
|
-
...entry
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const docs: StarlightDocsEntry[] = ((await getCollection('docs')) ?? []).map(
|
|
39
|
+
({ slug, ...entry }) => ({
|
|
40
|
+
...entry,
|
|
41
|
+
slug: normalizeIndexSlug(slug),
|
|
42
|
+
})
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
function getRoutes(): Route[] {
|
|
44
46
|
const routes: Route[] = docs.map((entry) => ({
|
package/virtual.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare module 'virtual:starlight/user-config' {
|
|
|
3
3
|
export default Config;
|
|
4
4
|
}
|
|
5
5
|
declare module 'virtual:starlight/project-context' {
|
|
6
|
-
export default { root: string };
|
|
6
|
+
export default { root: string, srcDir: string };
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare module 'virtual:starlight/user-css' {}
|