@astrojs/starlight 0.24.1 → 0.24.2
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 +45 -33
- package/__e2e__/fixtures/basics/node_modules/.bin/astro +2 -2
- package/__e2e__/fixtures/basics/package.json +1 -1
- package/integrations/expressive-code/themes/night-owl-dark.jsonc +413 -413
- package/integrations/expressive-code/themes/night-owl-light.jsonc +405 -405
- package/integrations/virtual-user-config.ts +2 -2
- package/package.json +10 -14
- package/schema.ts +2 -2
- package/translations/index.ts +2 -0
- package/translations/sk.json +29 -0
- package/user-components/Tabs.astro +6 -6
- package/utils/error-map.ts +1 -1
- package/utils/i18n.ts +7 -7
- package/utils/navigation.ts +1 -1
- package/utils/route-data.ts +2 -2
- package/utils/slugs.ts +2 -2
- package/utils/starlight-page.ts +4 -4
- package/utils/user-config.ts +5 -1
|
@@ -43,10 +43,10 @@ export function vitePluginStarlightUserConfig(
|
|
|
43
43
|
? 'src' in opts.logo
|
|
44
44
|
? `import src from ${resolveId(
|
|
45
45
|
opts.logo.src
|
|
46
|
-
|
|
46
|
+
)}; export const logos = { dark: src, light: src };`
|
|
47
47
|
: `import dark from ${resolveId(opts.logo.dark)}; import light from ${resolveId(
|
|
48
48
|
opts.logo.light
|
|
49
|
-
|
|
49
|
+
)}; export const logos = { dark, light };`
|
|
50
50
|
: 'export const logos = {};',
|
|
51
51
|
'virtual:starlight/collection-config': `let userCollections;
|
|
52
52
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": "./index.ts",
|
|
24
24
|
"./components": "./components.ts",
|
|
25
|
-
"./components/Badge.astro": {
|
|
26
|
-
"types": "./components/Badge.astro.tsx",
|
|
27
|
-
"import": "./components/Badge.astro"
|
|
28
|
-
},
|
|
29
25
|
"./components/LanguageSelect.astro": {
|
|
30
26
|
"types": "./components/LanguageSelect.astro.tsx",
|
|
31
27
|
"import": "./components/LanguageSelect.astro"
|
|
@@ -178,25 +174,25 @@
|
|
|
178
174
|
"astro": "^4.8.6"
|
|
179
175
|
},
|
|
180
176
|
"devDependencies": {
|
|
181
|
-
"@astrojs/markdown-remark": "^
|
|
182
|
-
"@playwright/test": "^1.
|
|
177
|
+
"@astrojs/markdown-remark": "^5.1.0",
|
|
178
|
+
"@playwright/test": "^1.44.1",
|
|
183
179
|
"@types/node": "^18.16.19",
|
|
184
180
|
"@vitest/coverage-v8": "^1.6.0",
|
|
185
|
-
"astro": "^4.
|
|
181
|
+
"astro": "^4.10.2",
|
|
186
182
|
"vitest": "^1.6.0"
|
|
187
183
|
},
|
|
188
184
|
"dependencies": {
|
|
189
|
-
"@astrojs/mdx": "^3.
|
|
190
|
-
"@astrojs/sitemap": "^3.
|
|
185
|
+
"@astrojs/mdx": "^3.1.0",
|
|
186
|
+
"@astrojs/sitemap": "^3.1.5",
|
|
191
187
|
"@pagefind/default-ui": "^1.0.3",
|
|
192
|
-
"@types/hast": "^3.0.
|
|
193
|
-
"@types/mdast": "^4.0.
|
|
194
|
-
"astro-expressive-code": "^0.35.
|
|
188
|
+
"@types/hast": "^3.0.4",
|
|
189
|
+
"@types/mdast": "^4.0.4",
|
|
190
|
+
"astro-expressive-code": "^0.35.3",
|
|
195
191
|
"bcp-47": "^2.1.0",
|
|
196
192
|
"hast-util-from-html": "^2.0.1",
|
|
197
193
|
"hast-util-select": "^6.0.2",
|
|
198
194
|
"hast-util-to-string": "^3.0.0",
|
|
199
|
-
"hastscript": "^
|
|
195
|
+
"hastscript": "^9.0.0",
|
|
200
196
|
"mdast-util-directive": "^3.0.0",
|
|
201
197
|
"mdast-util-to-markdown": "^2.1.0",
|
|
202
198
|
"pagefind": "^1.0.3",
|
package/schema.ts
CHANGED
|
@@ -126,8 +126,8 @@ type BaseSchema = BaseSchemaWithoutEffects | z.ZodEffects<BaseSchemaWithoutEffec
|
|
|
126
126
|
type ExtendedSchema<T extends BaseSchema | never = never> = [T] extends [never]
|
|
127
127
|
? DefaultSchema
|
|
128
128
|
: T extends BaseSchema
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
? z.ZodIntersection<DefaultSchema, T>
|
|
130
|
+
: DefaultSchema;
|
|
131
131
|
|
|
132
132
|
interface DocsSchemaOpts<T extends BaseSchema> {
|
|
133
133
|
/**
|
package/translations/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import uk from './uk.json';
|
|
|
26
26
|
import hi from './hi.json';
|
|
27
27
|
import zhTW from './zh-TW.json';
|
|
28
28
|
import pl from './pl.json';
|
|
29
|
+
import sk from './sk.json';
|
|
29
30
|
|
|
30
31
|
const { parse } = builtinI18nSchema();
|
|
31
32
|
|
|
@@ -58,5 +59,6 @@ export default Object.fromEntries(
|
|
|
58
59
|
hi,
|
|
59
60
|
'zh-TW': zhTW,
|
|
60
61
|
pl,
|
|
62
|
+
sk,
|
|
61
63
|
}).map(([key, dict]) => [key, parse(dict)])
|
|
62
64
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skipLink.label": "Preskočiť na obsah",
|
|
3
|
+
"search.label": "Hľadať",
|
|
4
|
+
"search.shortcutLabel": "(Stlačením / hľadajte)",
|
|
5
|
+
"search.cancelLabel": "Zrušiť",
|
|
6
|
+
"search.devWarning": "Vyhľadávanie je dostupné len v produkčných zostaveniach. \nSkúste vytvoriť a zobraziť náhľad stránky lokálne.",
|
|
7
|
+
"themeSelect.accessibleLabel": "Vyberte tému",
|
|
8
|
+
"themeSelect.dark": "Tmavý",
|
|
9
|
+
"themeSelect.light": "Svetlý",
|
|
10
|
+
"themeSelect.auto": "Auto",
|
|
11
|
+
"languageSelect.accessibleLabel": "Vyberte jazyk",
|
|
12
|
+
"menuButton.accessibleLabel": "Menu",
|
|
13
|
+
"sidebarNav.accessibleLabel": "Hlavný",
|
|
14
|
+
"tableOfContents.onThisPage": "Na tejto stránke",
|
|
15
|
+
"tableOfContents.overview": "Prehľad",
|
|
16
|
+
"i18n.untranslatedContent": "Tento obsah zatiaľ nie je dostupný vo vašom jazyku.",
|
|
17
|
+
"page.editLink": "Upraviť stránku",
|
|
18
|
+
"page.lastUpdated": "Posledná aktualizácia:",
|
|
19
|
+
"page.previousLink": "Predchádzajúce",
|
|
20
|
+
"page.nextLink": "Nasledujúce",
|
|
21
|
+
"page.draft": "Tento obsah je koncept a nebude zahrnutý do produkčných zostavení.",
|
|
22
|
+
"404.text": "Stránka nenájdená. Skontrolujte URL alebo skúste použiť vyhľadávacie pole.",
|
|
23
|
+
"aside.note": "Poznámka",
|
|
24
|
+
"aside.tip": "Tip",
|
|
25
|
+
"aside.caution": "Upozornenie",
|
|
26
|
+
"aside.danger": "Nebezpečenstvo",
|
|
27
|
+
"fileTree.directory": "Adresár",
|
|
28
|
+
"builtWithStarlight.label": "Postavené so Starlight"
|
|
29
|
+
}
|
|
@@ -119,12 +119,12 @@ const { html, panels } = processPanels(panelHtml);
|
|
|
119
119
|
e.key === 'ArrowLeft'
|
|
120
120
|
? index - 1
|
|
121
121
|
: e.key === 'ArrowRight'
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
? index + 1
|
|
123
|
+
: e.key === 'Home'
|
|
124
|
+
? 0
|
|
125
|
+
: e.key === 'End'
|
|
126
|
+
? this.tabs.length - 1
|
|
127
|
+
: null;
|
|
128
128
|
if (nextIndex === null) return;
|
|
129
129
|
if (this.tabs[nextIndex]) {
|
|
130
130
|
e.preventDefault();
|
package/utils/error-map.ts
CHANGED
|
@@ -63,7 +63,7 @@ const errorMap: z.ZodErrorMap = (baseError, ctx) => {
|
|
|
63
63
|
.map(([key, error]) =>
|
|
64
64
|
key === baseErrorPath
|
|
65
65
|
? // Avoid printing the key again if it's a base error
|
|
66
|
-
|
|
66
|
+
`> ${getTypeOrLiteralMsg(error)}`
|
|
67
67
|
: `> ${prefix(key, getTypeOrLiteralMsg(error))}`
|
|
68
68
|
);
|
|
69
69
|
|
package/utils/i18n.ts
CHANGED
|
@@ -61,8 +61,8 @@ function getAstroI18nConfig(config: StarlightConfig): NonNullable<AstroConfig['i
|
|
|
61
61
|
codes: [localeConfig?.lang ?? locale],
|
|
62
62
|
path: locale === 'root' ? localeConfig?.lang ?? BuiltInDefaultLocale.lang : locale,
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
: [
|
|
64
|
+
})
|
|
65
|
+
: [config.defaultLocale.lang],
|
|
66
66
|
routing: {
|
|
67
67
|
prefixDefaultLocale:
|
|
68
68
|
// Sites with multiple languages without a root locale.
|
|
@@ -95,11 +95,11 @@ function getStarlightI18nConfig(
|
|
|
95
95
|
isDefaultAstroLocale(astroI18nConfig, locale) && !prefixDefaultLocale
|
|
96
96
|
? 'root'
|
|
97
97
|
: isAstroLocaleExtendedConfig(locale)
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
? locale.path
|
|
99
|
+
: locale,
|
|
100
100
|
inferStarlightLocaleFromAstroLocale(locale),
|
|
101
101
|
])
|
|
102
|
-
|
|
102
|
+
);
|
|
103
103
|
|
|
104
104
|
const defaultAstroLocale = astroI18nConfig.locales.find((locale) =>
|
|
105
105
|
isDefaultAstroLocale(astroI18nConfig, locale)
|
|
@@ -121,8 +121,8 @@ function getStarlightI18nConfig(
|
|
|
121
121
|
locale: isMonolingualWithRootLocale
|
|
122
122
|
? undefined
|
|
123
123
|
: isAstroLocaleExtendedConfig(defaultAstroLocale)
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
? defaultAstroLocale.codes[0]
|
|
125
|
+
: defaultAstroLocale,
|
|
126
126
|
},
|
|
127
127
|
};
|
|
128
128
|
}
|
package/utils/navigation.ts
CHANGED
|
@@ -223,7 +223,7 @@ function getOrder(routeOrDir: Route | Dir): number {
|
|
|
223
223
|
return isDir(routeOrDir)
|
|
224
224
|
? Math.min(...Object.values(routeOrDir).flatMap(getOrder))
|
|
225
225
|
: // If no order value is found, set it to the largest number possible.
|
|
226
|
-
|
|
226
|
+
routeOrDir.entry.data.sidebar.order ?? Number.MAX_VALUE;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/** Sort a directory’s entries by user-specified order or alphabetically if no order specified. */
|
package/utils/route-data.ts
CHANGED
|
@@ -67,8 +67,8 @@ export function getToC({ entry, locale, headings }: PageProps) {
|
|
|
67
67
|
entry.data.template === 'splash'
|
|
68
68
|
? false
|
|
69
69
|
: entry.data.tableOfContents !== undefined
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
? entry.data.tableOfContents
|
|
71
|
+
: config.tableOfContents;
|
|
72
72
|
if (!tocConfig) return;
|
|
73
73
|
const t = useTranslations(locale);
|
|
74
74
|
return {
|
package/utils/slugs.ts
CHANGED
|
@@ -52,8 +52,8 @@ export function slugToParam(slug: string): string | undefined {
|
|
|
52
52
|
return slug === 'index' || slug === ''
|
|
53
53
|
? undefined
|
|
54
54
|
: slug.endsWith('/index')
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
? slug.replace(/\/index$/, '')
|
|
56
|
+
: slug;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function slugToPathname(slug: string): string {
|
package/utils/starlight-page.ts
CHANGED
|
@@ -292,10 +292,10 @@ type RemoveIndexSignature<T> = {
|
|
|
292
292
|
[K in keyof T as string extends K
|
|
293
293
|
? never
|
|
294
294
|
: number extends K
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
? never
|
|
296
|
+
: symbol extends K
|
|
297
|
+
? never
|
|
298
|
+
: K]: T[K];
|
|
299
299
|
};
|
|
300
300
|
|
|
301
301
|
// https://www.totaltypescript.com/concepts/the-prettify-helper
|
package/utils/user-config.ts
CHANGED
|
@@ -225,7 +225,11 @@ export const StarlightConfigSchema = UserConfigSchema.strict().transform(
|
|
|
225
225
|
// Monolingual sites with only one non-root locale needs their configuration to be defined in
|
|
226
226
|
// `config.locales` so that slugs can be correctly generated by taking into consideration the
|
|
227
227
|
// base path at which a language is served which is the key of the `config.locales` object.
|
|
228
|
-
if (
|
|
228
|
+
if (
|
|
229
|
+
locales !== undefined &&
|
|
230
|
+
(configuredLocales.length > 1 ||
|
|
231
|
+
(configuredLocales.length === 1 && locales.root === undefined))
|
|
232
|
+
) {
|
|
229
233
|
// Make sure we can find the default locale and if not, help the user set it.
|
|
230
234
|
// We treat the root locale as the default if present and no explicit default is set.
|
|
231
235
|
const defaultLocaleConfig = locales[defaultLocale || 'root'];
|