File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed
packages/starlight-typedoc/libs Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' starlight-typedoc ' : patch
3+ ---
4+
5+ Fixes a sidebar generation issue when using the [ plugin ` watch ` configuration option] ( https://starlight-typedoc.vercel.app/configuration/#watch ) .
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 ParameterType ,
1313 RendererEvent ,
1414 type PageDefinition ,
15+ type ProjectReflection ,
1516} from 'typedoc'
1617import type { MarkdownPageEvent , PluginOptions } from 'typedoc-plugin-markdown'
1718
@@ -65,20 +66,25 @@ export async function generateTypeDoc(
6566 }
6667 } )
6768
68- const reflections = await app . convert ( )
69-
70- if (
71- ( ! reflections ?. groups || reflections . groups . length === 0 ) &&
72- ! reflections ?. children ?. some ( ( child ) => ( child . groups ?? [ ] ) . length > 0 )
73- ) {
74- throw new NoReflectionsError ( )
75- }
69+ let reflections : ProjectReflection | undefined
7670
7771 if ( options . watch ) {
78- void app . convertAndWatch ( async ( reflections ) => {
79- await app . generateOutputs ( reflections )
72+ reflections = await new Promise < ProjectReflection > ( ( resolve ) => {
73+ void app . convertAndWatch ( async ( reflections ) => {
74+ await app . generateOutputs ( reflections )
75+ resolve ( reflections )
76+ } )
8077 } )
8178 } else {
79+ reflections = await app . convert ( )
80+
81+ if (
82+ ( ! reflections ?. groups || reflections . groups . length === 0 ) &&
83+ ! reflections ?. children ?. some ( ( child ) => ( child . groups ?? [ ] ) . length > 0 )
84+ ) {
85+ throw new NoReflectionsError ( )
86+ }
87+
8288 await app . generateOutputs ( reflections )
8389 }
8490
You can’t perform that action at this time.
0 commit comments