diff --git a/.changeset/big-buttons-shop.md b/.changeset/big-buttons-shop.md new file mode 100644 index 00000000000..ea6ed5e18db --- /dev/null +++ b/.changeset/big-buttons-shop.md @@ -0,0 +1,7 @@ +--- +'@astrojs/starlight': minor +--- + +Removes the `/` search shortcut for [accessibility reasons](https://www.w3.org/WAI/WCAG21/Understanding/character-key-shortcuts.html). + +⚠️ **Potentially breaking change:** The `search.shortcutLabel` UI string has been removed. If you were using this string in your custom UI, you will need to update your code. diff --git a/.changeset/great-plums-study.md b/.changeset/great-plums-study.md new file mode 100644 index 00000000000..17765e18097 --- /dev/null +++ b/.changeset/great-plums-study.md @@ -0,0 +1,9 @@ +--- +'@astrojs/starlight': minor +--- + +Makes sidebar entry parsing stricter in Starlight config + +**⚠️ Potentially breaking change:** Previously Starlight would accept a sidebar entry that matched one of its expected shapes, even if it included additional properties. For example, including both `link` and `items` was considered valid, with `items` being ignored. Now, it is an error to include more than one of `link`, `items`, or `autogenerate` in a sidebar entry. + +If you see errors after updating, look for sidebar entries in the Starlight configuration in `astro.config.mjs` that include too many keys and remove the one that was previously ignored. diff --git a/.changeset/new-trains-complain.md b/.changeset/new-trains-complain.md new file mode 100644 index 00000000000..cf35248953f --- /dev/null +++ b/.changeset/new-trains-complain.md @@ -0,0 +1,5 @@ +--- +"@astrojs/starlight": patch +--- + +Updates the Ukrainian UI translations diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7a5b947d9..90a1474ded9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,11 +14,32 @@ concurrency: env: NODE_VERSION: 18 + ASTRO_TELEMETRY_DISABLED: true jobs: + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + outputs: + docs: ${{ steps.filter.outputs.docs }} + packages: ${{ steps.filter.outputs.packages }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docs: + - 'docs/**' + packages: + - 'packages/**' + unit-test: name: Run unit tests - runs-on: ubuntu-20.04 + needs: changes + if: ${{ needs.changes.outputs.packages == 'true' }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 @@ -31,8 +52,14 @@ jobs: run: pnpm -r test:coverage e2e-test: - name: Run E2E tests - runs-on: ubuntu-20.04 + name: 'Run E2E tests (${{ matrix.os }})' + needs: changes + if: ${{ needs.changes.outputs.packages == 'true' }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 @@ -46,7 +73,7 @@ jobs: type-check: name: Run type checks - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 @@ -63,7 +90,7 @@ jobs: pa11y: name: Check for accessibility issues - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -107,7 +134,9 @@ jobs: links: name: Check for broken links - runs-on: ubuntu-20.04 + needs: changes + if: ${{ needs.changes.outputs.docs == 'true' }} + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/docs/src/assets/showcase/docs.orama.com.png b/docs/src/assets/showcase/docs.orama.com.png new file mode 100644 index 00000000000..e4fe6374617 Binary files /dev/null and b/docs/src/assets/showcase/docs.orama.com.png differ diff --git a/docs/src/assets/showcase/tutorialkit.dev.png b/docs/src/assets/showcase/tutorialkit.dev.png new file mode 100644 index 00000000000..a69751b3ed1 Binary files /dev/null and b/docs/src/assets/showcase/tutorialkit.dev.png differ diff --git a/docs/src/assets/showcase/www.devhealthos.com.png b/docs/src/assets/showcase/www.devhealthos.com.png new file mode 100644 index 00000000000..d9318fab008 Binary files /dev/null and b/docs/src/assets/showcase/www.devhealthos.com.png differ diff --git a/docs/src/components/showcase-sites.astro b/docs/src/components/showcase-sites.astro index bea2ee7e348..a6e82032619 100644 --- a/docs/src/components/showcase-sites.astro +++ b/docs/src/components/showcase-sites.astro @@ -126,4 +126,11 @@ import FluidGrid from './fluid-grid.astro'; + + + diff --git a/docs/src/content/docs/fr/resources/community-content.mdx b/docs/src/content/docs/fr/resources/community-content.mdx index 59bff3f0c2a..37d0de9ad7c 100644 --- a/docs/src/content/docs/fr/resources/community-content.mdx +++ b/docs/src/content/docs/fr/resources/community-content.mdx @@ -146,5 +146,11 @@ import YouTubeGrid from '~/components/youtube-grid.astro'; description: "Dans cette vidéo, je passe en revue ce qui rend Starlight si cool et pourquoi vous voudriez l'essayer avec votre prochain projet.", }, + { + href: 'https://www.youtube.com/watch?v=Q1E4Gkt63ko', + title: 'Astro Starlight et emoji-blast avec Chris Swithinbank', + description: + "Chris, le créateur du thème de documentation Starlight pour Astro, m'aide à le configurer pour le nouveau site web d'emoji-blast. 🌟 🎇", + }, ]} /> diff --git a/docs/src/content/docs/ru/resources/community-content.mdx b/docs/src/content/docs/ru/resources/community-content.mdx index 8091227f6c6..a0aa2cb83e3 100644 --- a/docs/src/content/docs/ru/resources/community-content.mdx +++ b/docs/src/content/docs/ru/resources/community-content.mdx @@ -138,5 +138,18 @@ import YouTubeGrid from '~/components/youtube-grid.astro'; description: 'Установите Starlight в подкаталоге проекта сайта на Next.js', }, + { + href: 'https://www.youtube.com/watch?v=5pq80drDrNs', + title: + 'Я воссоздал документы Shadcn за 30 минут с помощью этого удивительного инструмента', + description: + 'В этом видео я рассказываю о том, что делает Starlight таким крутым и почему вы можете попробовать его в своем следующем проекте.', + }, + { + href: 'https://www.youtube.com/watch?v=Q1E4Gkt63ko', + title: 'Astro Starlight и взрыв эмоций с Крисом Свитинбанком', + description: + 'В этой статье Крис, создатель Starlight, рассказывает о том, как настроить этот фреймворк для нового сайта, посвящённого эмодзи. 🌟 🎇', + }, ]} /> diff --git a/docs/src/content/docs/zh-cn/resources/community-content.mdx b/docs/src/content/docs/zh-cn/resources/community-content.mdx index 7e09c5e87d6..d931f9b5d5e 100644 --- a/docs/src/content/docs/zh-cn/resources/community-content.mdx +++ b/docs/src/content/docs/zh-cn/resources/community-content.mdx @@ -140,5 +140,12 @@ import YouTubeGrid from '~/components/youtube-grid.astro'; description: '在这个视频中,我将介绍 Starlight 的酷炫之处以及为什么你可能想在下一个项目中尝试它。', }, + { + href: 'https://www.youtube.com/watch?v=Q1E4Gkt63ko', + title: + '与 Chris Swithinbank 一起试试联动 Astro Starlight 和 emoji-blast ', + description: + 'Astro Starlight 框架的开发者 Chris 引导我完成了一个全新的 emoji-blast 网站。 🌟 🎇', + }, ]} /> diff --git a/package.json b/package.json index 443204802e8..db0e25204da 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "size": "size-limit", "version": "pnpm changeset version && pnpm i --no-frozen-lockfile", "format": "prettier -w --cache --plugin prettier-plugin-astro .", - "typecheck": "astro check" + "typecheck": "astro check --minimumSeverity warning" }, "license": "MIT", "devDependencies": { diff --git a/packages/starlight/__e2e__/fixtures/basics/astro.config.mjs b/packages/starlight/__e2e__/fixtures/basics/astro.config.mjs index 9e96cbad3d1..1279050de74 100644 --- a/packages/starlight/__e2e__/fixtures/basics/astro.config.mjs +++ b/packages/starlight/__e2e__/fixtures/basics/astro.config.mjs @@ -5,6 +5,7 @@ export default defineConfig({ integrations: [ starlight({ title: 'Basics', + pagefind: false, }), ], }); diff --git a/packages/starlight/__e2e__/fixtures/custom-src-dir/astro.config.mjs b/packages/starlight/__e2e__/fixtures/custom-src-dir/astro.config.mjs index de22ac3953b..9e759d9ebc9 100644 --- a/packages/starlight/__e2e__/fixtures/custom-src-dir/astro.config.mjs +++ b/packages/starlight/__e2e__/fixtures/custom-src-dir/astro.config.mjs @@ -6,6 +6,7 @@ export default defineConfig({ integrations: [ starlight({ title: 'Custom src directory', + pagefind: false, }), ], }); diff --git a/packages/starlight/__e2e__/test-utils.ts b/packages/starlight/__e2e__/test-utils.ts index e604732357d..bde93502c42 100644 --- a/packages/starlight/__e2e__/test-utils.ts +++ b/packages/starlight/__e2e__/test-utils.ts @@ -4,6 +4,8 @@ import { build, preview } from 'astro'; export { expect, type Locator } from '@playwright/test'; +process.env.ASTRO_TELEMETRY_DISABLED = 'true'; + // Setup a test environment that will build and start a preview server for a given fixture path and // provide a Starlight Playwright fixture accessible from within all tests. export async function testFactory(fixturePath: string) { diff --git a/packages/starlight/__tests__/basics/config-errors.test.ts b/packages/starlight/__tests__/basics/config-errors.test.ts index e48ea1a74e1..1639bd72e94 100644 --- a/packages/starlight/__tests__/basics/config-errors.test.ts +++ b/packages/starlight/__tests__/basics/config-errors.test.ts @@ -165,7 +165,7 @@ test('errors with bad sidebar config', () => { Invalid config passed to starlight integration Hint: **sidebar.0**: Did not match union. - > Expected type \`{ link: string } | { items: array } | { autogenerate: object }\` + > Expected type \`{ link: string; } | { items: array; } | { autogenerate: object; }\` > Received \`{ "label": "Example", "href": "/" }\`" ` ); @@ -190,7 +190,57 @@ test('errors with bad nested sidebar config', () => { Invalid config passed to starlight integration Hint: **sidebar.0.items.1**: Did not match union. - > Expected type \`{ link: string } | { items: array } | { autogenerate: object }\` + > Expected type \`{ link: string } | { items: array; } | { autogenerate: object; }\` > Received \`{ "label": "Example", "items": [ { "label": "Nested Example 1", "link": "/" }, { "label": "Nested Example 2", "link": true } ] }\`" `); }); + +test('errors with sidebar entry that includes `link` and `items`', () => { + expect(() => + parseStarlightConfigWithFriendlyErrors({ + title: 'Test', + sidebar: [ + { label: 'Parent', link: '/parent', items: [{ label: 'Child', link: '/parent/child' }] }, + ], + }) + ).toThrowErrorMatchingInlineSnapshot(` + "[AstroUserError]: + Invalid config passed to starlight integration + Hint: + **sidebar.0**: Unrecognized key(s) in object: 'items'" + `); +}); + +test('errors with sidebar entry that includes `link` and `autogenerate`', () => { + expect(() => + parseStarlightConfigWithFriendlyErrors({ + title: 'Test', + sidebar: [{ label: 'Parent', link: '/parent', autogenerate: { directory: 'test' } }], + }) + ).toThrowErrorMatchingInlineSnapshot(` + "[AstroUserError]: + Invalid config passed to starlight integration + Hint: + **sidebar.0**: Unrecognized key(s) in object: 'autogenerate'" + `); +}); + +test('errors with sidebar entry that includes `items` and `autogenerate`', () => { + expect(() => + parseStarlightConfigWithFriendlyErrors({ + title: 'Test', + sidebar: [ + { + label: 'Parent', + items: [{ label: 'Child', link: '/parent/child' }], + autogenerate: { directory: 'test' }, + }, + ], + }) + ).toThrowErrorMatchingInlineSnapshot(` + "[AstroUserError]: + Invalid config passed to starlight integration + Hint: + **sidebar.0**: Unrecognized key(s) in object: 'autogenerate'" + `); +}); diff --git a/packages/starlight/components/Search.astro b/packages/starlight/components/Search.astro index 926583eb906..713e9415136 100644 --- a/packages/starlight/components/Search.astro +++ b/packages/starlight/components/Search.astro @@ -20,17 +20,17 @@ const pagefindTranslations = { data-translations={JSON.stringify(pagefindTranslations)} data-strip-trailing-slash={project.trailingSlash === 'never'} > - @@ -56,6 +56,27 @@ const pagefindTranslations = { +{ + /** + * This is intentionally inlined to avoid briefly showing an invalid shortcut. + * Purposely using the deprecated `navigator.platform` property to detect Apple devices, as the + * user agent is spoofed by some browsers when opening the devtools. + */ +} + +