@astrojs/starlight 0.34.6 → 0.34.8
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 +12 -0
- package/integrations/shared/absolutePathToLang.ts +3 -2
- package/package.json +1 -1
- package/utils/i18n.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.34.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3306](https://github.com/withastro/starlight/pull/3306) [`21fcd94`](https://github.com/withastro/starlight/commit/21fcd944d528557b89fc8b351579beabdcc06ff6) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a regression in Starlight version `0.34.5` that caused multilingual sites with a default locale explicitly set to `root` to report a configuration error.
|
|
8
|
+
|
|
9
|
+
## 0.34.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3298](https://github.com/withastro/starlight/pull/3298) [`7bd02e3`](https://github.com/withastro/starlight/commit/7bd02e37650da59ed6cdfe275473ae2dac6a2d48) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a potential issue with [`absolutePathToLang()`](https://starlight.astro.build/reference/plugins/#absolutepathtolang) plugin API not handling paths with spaces correctly.
|
|
14
|
+
|
|
3
15
|
## 0.34.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url';
|
|
1
2
|
import type { AstroConfig } from 'astro';
|
|
2
3
|
import type { StarlightConfig } from '../../types';
|
|
3
4
|
import { localeToLang } from './localeToLang';
|
|
@@ -16,8 +17,8 @@ export function absolutePathToLang(
|
|
|
16
17
|
}
|
|
17
18
|
): string {
|
|
18
19
|
const docsPath = getCollectionPath('docs', astroConfig.srcDir);
|
|
19
|
-
// Format path to
|
|
20
|
-
path = path
|
|
20
|
+
// Format path to URL-encoded path.
|
|
21
|
+
path = pathToFileURL(path).pathname;
|
|
21
22
|
// Ensure that the page path starts with a slash if the docs directory also does,
|
|
22
23
|
// which makes stripping the docs path in the next step work on Windows, too.
|
|
23
24
|
if (path && !path.startsWith('/') && docsPath.startsWith('/')) path = '/' + path;
|
package/package.json
CHANGED
package/utils/i18n.ts
CHANGED
|
@@ -57,7 +57,10 @@ function getAstroI18nConfig(config: StarlightConfig): NonNullable<AstroConfig['i
|
|
|
57
57
|
// In Starlight, this matches the `locale` property if defined, and we fallback to the `lang`
|
|
58
58
|
// property if not (which would be set to the language’s directory name by default).
|
|
59
59
|
defaultLocale:
|
|
60
|
-
|
|
60
|
+
// If the default locale is explicitly set to `root`, we use the `lang` property instead.
|
|
61
|
+
(config.defaultLocale.locale === 'root'
|
|
62
|
+
? config.defaultLocale.lang
|
|
63
|
+
: (config.defaultLocale.locale ?? config.defaultLocale.lang)) ?? BuiltInDefaultLocale.lang,
|
|
61
64
|
locales: config.locales
|
|
62
65
|
? Object.entries(config.locales).map(([locale, localeConfig]) => {
|
|
63
66
|
return {
|