Skip to content

Commit 375edcc

Browse files
feat: improve components exports with wildcard (#3704)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
1 parent 047dd32 commit 375edcc

22 files changed

Lines changed: 26 additions & 154 deletions

File tree

.changeset/beige-ties-scream.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astrojs/starlight': minor
3+
---
4+
5+
Fixes autocomplete for components exported from `@astrojs/starlight/components/*`
6+
7+
**⚠️ Potentially breaking change:** This change moves some files used in Starlight’s component internals out of the `components/` directory. Direct use of these files was not and is not officially supported. If you previously imported `TableOfContents/starlight-toc.ts`, `TableOfContents/TableOfContentsList.astro`, `Icons.ts`, or `SidebarPersistState.ts`, please review your code when updating.

docs/src/components/icons-list.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import { Icon } from '@astrojs/starlight/components';
3-
import { Icons, type StarlightIcon } from '../../../packages/starlight/components/Icons';
3+
import { Icons, type StarlightIcon } from '../../../packages/starlight/components-internals/Icons';
44
55
interface Props {
66
labels?: {

packages/starlight/__tests__/remark-rehype/rehype-file-tree.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test } from 'vitest';
22
import { processFileTree } from '../../user-components/rehype-file-tree';
3-
import { Icons, type StarlightIcon } from '../../components/Icons';
3+
import { Icons, type StarlightIcon } from '../../components-internals/Icons';
44

55
describe('validation', () => {
66
test('throws an error with no content', () => {
File renamed without changes.

packages/starlight/components/SidebarPersistState.ts renamed to packages/starlight/components-internals/SidebarPersistState.ts

File renamed without changes.

packages/starlight/components/TableOfContents/TableOfContentsList.astro renamed to packages/starlight/components-internals/TableOfContents/TableOfContentsList.astro

File renamed without changes.

packages/starlight/components/TableOfContents/starlight-toc.ts renamed to packages/starlight/components-internals/TableOfContents/starlight-toc.ts

File renamed without changes.

packages/starlight/components/ContentNotice.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import type { StarlightIcon } from '../components/Icons';
2+
import type { StarlightIcon } from '../components-internals/Icons';
33
import Icon from '../user-components/Icon.astro';
44
55
interface Props {

packages/starlight/components/MobileTableOfContents.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import Icon from '../user-components/Icon.astro';
3-
import TableOfContentsList from './TableOfContents/TableOfContentsList.astro';
3+
import TableOfContentsList from '../components-internals/TableOfContents/TableOfContentsList.astro';
44
55
const { toc } = Astro.locals.starlightRoute;
66
---
@@ -109,7 +109,7 @@ const { toc } = Astro.locals.starlightRoute;
109109
</style>
110110

111111
<script>
112-
import { StarlightTOC } from './TableOfContents/starlight-toc';
112+
import { StarlightTOC } from '../components-internals/TableOfContents/starlight-toc';
113113

114114
class MobileStarlightTOC extends StarlightTOC {
115115
override set current(link: HTMLAnchorElement) {

packages/starlight/components/Page.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if (pagefindEnabled) mainDataAttributes['data-pagefind-body'] = '';
8484
<PageFrame>
8585
<Header slot="header" />
8686
{starlightRoute.hasSidebar && <Sidebar slot="sidebar" />}
87-
<script src="./SidebarPersistState"></script>
87+
<script src="../components-internals/SidebarPersistState"></script>
8888
<TwoColumnContent>
8989
<PageSidebar slot="right-sidebar" />
9090
<main

0 commit comments

Comments
 (0)