@astrojs/starlight 0.10.2 → 0.10.4

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.10.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#752](https://github.com/withastro/starlight/pull/752) [`6833ee1`](https://github.com/withastro/starlight/commit/6833ee12159ea5be23885c41da80569a89aafa33) Thanks [@apinet](https://github.com/apinet)! - Add X social link logo
8
+
9
+ - [#789](https://github.com/withastro/starlight/pull/789) [`2528fb0`](https://github.com/withastro/starlight/commit/2528fb011a388f3920af9994012bd7db2b1654c3) Thanks [@delucis](https://github.com/delucis)! - Update bundled version of `@astrojs/mdx` to v1.1.0
10
+
11
+ - [#794](https://github.com/withastro/starlight/pull/794) [`a0de12d`](https://github.com/withastro/starlight/commit/a0de12d596ab2b1c0d79d6d63d2d6cb9fe6d2644) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add Telegram icon
12
+
13
+ - [#792](https://github.com/withastro/starlight/pull/792) [`a8358df`](https://github.com/withastro/starlight/commit/a8358df7849b342de342a4a2e88e019c39d5bbe8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add RSS icon
14
+
15
+ - [#778](https://github.com/withastro/starlight/pull/778) [`957d2c3`](https://github.com/withastro/starlight/commit/957d2c32123ab0c223fcef03f91ce3ad7be7aa21) Thanks [@jermanuts](https://github.com/jermanuts)! - Improve Arabic UI translations
16
+
17
+ ## 0.10.3
18
+
19
+ ### Patch Changes
20
+
21
+ - [#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
22
+
23
+ - [#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.
24
+
25
+ - [#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
26
+
27
+ - [#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
28
+
29
+ - [#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
30
+
3
31
  ## 0.10.2
4
32
 
5
33
  ### Patch Changes
@@ -4,7 +4,7 @@ interface Props {
4
4
  }
5
5
  ---
6
6
 
7
- <div class="sl-banner" role="banner" set:html={Astro.props.content} />
7
+ <div class="sl-banner" set:html={Astro.props.content} />
8
8
 
9
9
  <style>
10
10
  .sl-banner {
@@ -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 + 'src/content/docs/' + Astro.props.id
25
+ ? baseUrl + srcPath + 'content/docs/' + Astro.props.id
24
26
  : undefined;
25
27
  ---
26
28
 
@@ -68,6 +68,8 @@ export const Icons = {
68
68
  '<path d="M6.11 15.12H3.75V0h2.36v15.12zm4.71-11.55H8.46V24h2.36V3.57zm4.72 0h-2.36V24h2.36V3.57zm4.71 0h-2.36v11.57h2.36V3.56z"/>',
69
69
  twitter:
70
70
  '<path d="M24 4.4a10 10 0 0 1-2.83.78 5.05 5.05 0 0 0 2.17-2.79 9.7 9.7 0 0 1-3.13 1.23 4.89 4.89 0 0 0-5.94-1.03 5 5 0 0 0-2.17 2.38 5.15 5.15 0 0 0-.3 3.25c-1.95-.1-3.86-.63-5.61-1.53a14.04 14.04 0 0 1-4.52-3.74 5.2 5.2 0 0 0-.09 4.91c.39.74.94 1.35 1.61 1.82a4.77 4.77 0 0 1-2.23-.63v.06c0 1.16.4 2.29 1.12 3.18a4.9 4.9 0 0 0 2.84 1.74c-.73.22-1.5.26-2.24.12a4.89 4.89 0 0 0 4.59 3.49A9.78 9.78 0 0 1 0 19.73 13.65 13.65 0 0 0 7.55 22a13.63 13.63 0 0 0 9.96-4.16A14.26 14.26 0 0 0 21.6 7.65V7c.94-.72 1.75-1.6 2.4-2.6Z"/>',
71
+ 'x.com':
72
+ '<path d="M 18.242188 2.25 L 21.554688 2.25 L 14.324219 10.507812 L 22.828125 21.75 L 16.171875 21.75 L 10.953125 14.933594 L 4.992188 21.75 L 1.679688 21.75 L 9.40625 12.914062 L 1.257812 2.25 L 8.082031 2.25 L 12.792969 8.480469 Z M 17.082031 19.773438 L 18.914062 19.773438 L 7.082031 4.125 L 5.113281 4.125 Z M 17.082031 19.773438 "/>',
71
73
  mastodon:
72
74
  '<path d="M16.45 17.77c2.77-.33 5.18-2.03 5.49-3.58.47-2.45.44-5.97.44-5.97 0-4.77-3.15-6.17-3.15-6.17-1.58-.72-4.3-1.03-7.13-1.05h-.07c-2.83.02-5.55.33-7.13 1.05 0 0-3.14 1.4-3.14 6.17v.91c-.01.88-.02 1.86 0 2.88.12 4.67.87 9.27 5.2 10.4 2 .53 3.72.64 5.1.57 2.51-.14 3.92-.9 3.92-.9l-.08-1.8s-1.8.56-3.8.5c-2-.08-4.1-.22-4.43-2.66a4.97 4.97 0 0 1-.04-.68s1.96.48 4.44.59c1.51.07 2.94-.09 4.38-.26Zm2.22-3.4h-2.3v-5.6c0-1.19-.5-1.79-1.5-1.79-1.1 0-1.66.71-1.66 2.12v3.07h-2.3V9.1c0-1.4-.55-2.12-1.65-2.12-1 0-1.5.6-1.5 1.78v5.61h-2.3V8.6c0-1.18.3-2.12.9-2.81a3.17 3.17 0 0 1 2.47-1.05c1.18 0 2.07.45 2.66 1.35l.57.96.58-.96a2.97 2.97 0 0 1 2.66-1.35c1.01 0 1.83.36 2.46 1.05.6.7.9 1.63.9 2.81v5.78Z"/>',
73
75
  codeberg:
@@ -86,4 +88,7 @@ export const Icons = {
86
88
  '<path d="M17.3 5.5a1.2 1.2 0 1 0 1.2 1.2 1.2 1.2 0 0 0-1.2-1.2ZM22 7.9a7.6 7.6 0 0 0-.4-2.5 5 5 0 0 0-1.2-1.7 4.7 4.7 0 0 0-1.8-1.2 7.3 7.3 0 0 0-2.4-.4L12 2H7.9a7.3 7.3 0 0 0-2.5.5 4.8 4.8 0 0 0-1.7 1.2 4.7 4.7 0 0 0-1.2 1.8 7.3 7.3 0 0 0-.4 2.4L2 12v4.1a7.3 7.3 0 0 0 .5 2.4 4.7 4.7 0 0 0 1.2 1.8 4.8 4.8 0 0 0 1.8 1.2 7.3 7.3 0 0 0 2.4.4l4.1.1h4.1a7.3 7.3 0 0 0 2.4-.5 4.7 4.7 0 0 0 1.8-1.2 4.8 4.8 0 0 0 1.2-1.7 7.6 7.6 0 0 0 .4-2.5L22 12V7.9ZM20.1 16a5.6 5.6 0 0 1-.3 1.9A3 3 0 0 1 19 19a3.2 3.2 0 0 1-1.1.8 5.6 5.6 0 0 1-1.9.3H8a5.7 5.7 0 0 1-1.9-.3A3.3 3.3 0 0 1 5 19a3 3 0 0 1-.7-1.1 5.5 5.5 0 0 1-.4-1.9l-.1-4V8a5.5 5.5 0 0 1 .4-1.9A3 3 0 0 1 5 5a3.1 3.1 0 0 1 1.1-.8A5.7 5.7 0 0 1 8 3.9l4-.1h4a5.6 5.6 0 0 1 1.9.4A3 3 0 0 1 19 5a3 3 0 0 1 .7 1.1A5.6 5.6 0 0 1 20 8l.1 4v4ZM12 6.9a5.1 5.1 0 1 0 5.1 5.1A5.1 5.1 0 0 0 12 6.9Zm0 8.4a3.3 3.3 0 1 1 3.3-3.3 3.3 3.3 0 0 1-3.3 3.3Z"/>',
87
89
  stackOverflow:
88
90
  '<path d="M15.72 0 14 1.28l6.4 8.58 1.7-1.26L15.73 0zm-3.94 3.42-1.36 1.64 8.22 6.85 1.37-1.64-8.23-6.85zM8.64 7.88l-.91 1.94 9.7 4.52.9-1.94-9.7-4.52zm-1.86 4.86-.44 2.1 10.48 2.2.44-2.1-10.47-2.2zM1.9 15.47V24h19.19v-8.53h-2.13v6.4H4.02v-6.4H1.9zm4.26 2.13v2.13h10.66V17.6H6.15Z"/>',
91
+ telegram:
92
+ '<path d="M22.26465,2.42773a2.04837,2.04837,0,0,0-2.07813-.32421L2.26562,9.33887a2.043,2.043,0,0,0,.1045,3.81836l3.625,1.26074,2.0205,6.68164A.998.998,0,0,0,8.134,21.352c.00775.012.01868.02093.02692.03259a.98844.98844,0,0,0,.21143.21576c.02307.01758.04516.03406.06982.04968a.98592.98592,0,0,0,.31073.13611l.01184.001.00671.00287a1.02183,1.02183,0,0,0,.20215.02051c.00653,0,.01233-.00312.0188-.00324a.99255.99255,0,0,0,.30109-.05231c.02258-.00769.04193-.02056.06384-.02984a.9931.9931,0,0,0,.20429-.11456,250.75993,250.75993,0,0,1,.15222-.12818L12.416,18.499l4.03027,3.12207a2.02322,2.02322,0,0,0,1.24121.42676A2.05413,2.05413,0,0,0,19.69531,20.415L22.958,4.39844A2.02966,2.02966,0,0,0,22.26465,2.42773ZM9.37012,14.73633a.99357.99357,0,0,0-.27246.50586l-.30951,1.504-.78406-2.59307,4.06525-2.11695ZM17.67188,20.04l-4.7627-3.68945a1.00134,1.00134,0,0,0-1.35352.11914l-.86541.9552.30584-1.48645,7.083-7.083a.99975.99975,0,0,0-1.16894-1.59375L6.74487,12.55432,3.02051,11.19141,20.999,3.999Z"/>',
93
+ rss: '<path d="M2.88,16.88a3,3,0,0,0,0,4.24,3,3,0,0,0,4.24,0,3,3,0,0,0-4.24-4.24Zm2.83,2.83a1,1,0,0,1-1.42-1.42,1,1,0,0,1,1.42,0A1,1,0,0,1,5.71,19.71ZM5,12a1,1,0,0,0,0,2,5,5,0,0,1,5,5,1,1,0,0,0,2,0,7,7,0,0,0-7-7ZM5,8a1,1,0,0,0,0,2,9,9,0,0,1,9,9,1,1,0,0,0,2,0,11.08,11.08,0,0,0-3.22-7.78A11.08,11.08,0,0,0,5,8Zm10.61.39A15.11,15.11,0,0,0,5,4,1,1,0,0,0,5,6,13,13,0,0,1,18,19a1,1,0,0,0,2,0A15.11,15.11,0,0,0,15.61,8.39Z"/>',
89
94
  };
@@ -21,6 +21,9 @@ const labels: Record<Platform, string> = {
21
21
  microsoftTeams: 'Microsoft Teams',
22
22
  instagram: 'Instagram',
23
23
  stackOverflow: 'Stack Overflow',
24
+ 'x.com': 'X',
25
+ telegram: 'Telegram',
26
+ rss: 'RSS',
24
27
  };
25
28
 
26
29
  const links = Object.entries(config.social || {}).filter(([, url]) => Boolean(url)) as [
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -33,11 +33,11 @@
33
33
  "devDependencies": {
34
34
  "@types/node": "^18.16.19",
35
35
  "@vitest/coverage-v8": "^0.33.0",
36
- "astro": "^3.0.6",
36
+ "astro": "^3.2.1",
37
37
  "vitest": "^0.33.0"
38
38
  },
39
39
  "dependencies": {
40
- "@astrojs/mdx": "^1.0.0",
40
+ "@astrojs/mdx": "^1.1.0",
41
41
  "@astrojs/sitemap": "^3.0.0",
42
42
  "@pagefind/default-ui": "^1.0.3",
43
43
  "@types/mdast": "^3.0.11",
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 }: { image: ImageFunction }) =>
14
+ return ({ image }: SchemaContext) =>
31
15
  z.object({
32
16
  /** The title of the current page. Required. */
33
17
  title: z.string(),
@@ -1,18 +1,18 @@
1
1
  {
2
- "skipLink.label": "الذهاب للمحتوى",
3
- "search.label": "البحث",
2
+ "skipLink.label": "تخطَّ إلى المحتوى",
3
+ "search.label": "ابحث",
4
4
  "search.shortcutLabel": "(إضغط / للبحث)",
5
5
  "search.cancelLabel": "إلغاء",
6
- "search.devWarning": "البحث متوفر فقط في نسخ الاطلاق. \n جرب بناء المشروع ومعاينته على جهازك",
7
- "themeSelect.accessibleLabel": "إختر ثيم",
8
- "themeSelect.dark": "ليلي",
9
- "themeSelect.light": "نهاري",
6
+ "search.devWarning": "البحث متوفر فقط في بنيات اﻹنتاج. \n جرب بناء المشروع ومعاينته على جهازك",
7
+ "themeSelect.accessibleLabel": "اختر سمة",
8
+ "themeSelect.dark": "داكن",
9
+ "themeSelect.light": "فاتح",
10
10
  "themeSelect.auto": "تلقائي",
11
- "languageSelect.accessibleLabel": "إختر لغة",
11
+ "languageSelect.accessibleLabel": "اختر لغة",
12
12
  "menuButton.accessibleLabel": "القائمة",
13
13
  "sidebarNav.accessibleLabel": "الرئيسية",
14
14
  "tableOfContents.onThisPage": "على هذه الصفحة",
15
- "tableOfContents.overview": "ملخص",
15
+ "tableOfContents.overview": "نظرة عامة",
16
16
  "i18n.untranslatedContent": "هذا المحتوى لا يتوفر بلغتك بعد.",
17
17
  "page.editLink": "عدل الصفحة",
18
18
  "page.lastUpdated": "اخر تحديث:",
@@ -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": "Laatste",
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')).map(({ slug, ...entry }) => ({
39
- ...entry,
40
- slug: normalizeIndexSlug(slug),
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) => ({
@@ -152,6 +152,9 @@ const UserConfigSchema = z.object({
152
152
  'microsoftTeams',
153
153
  'instagram',
154
154
  'stackOverflow',
155
+ 'x.com',
156
+ 'telegram',
157
+ 'rss',
155
158
  ]),
156
159
  // Link to the respective social profile for this site
157
160
  z.string().url()
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' {}