Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for packages entry point strategy #24

Merged
merged 4 commits into from
Jan 5, 2024
Merged

Add support for packages entry point strategy #24

merged 4 commits into from
Jan 5, 2024

Conversation

HiDeoo
Copy link
Owner

@HiDeoo HiDeoo commented Jan 3, 2024

No description provided.

Copy link

vercel bot commented Jan 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starlight-typedoc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 4, 2024 3:51pm
starlight-typedoc-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 4, 2024 3:51pm

Copy link

@boneskull boneskull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This builds successfully for me. I haven't tried to customize the sidebar yet.

I do see some unstyled invalid markdown (extra whitespace) coming through, but I'm not sure if that's typedoc-plugin-markdown's fault or no.

image

@boneskull
Copy link

boneskull commented Jan 3, 2024

Also I'm seeing an empty "References" section.

image

UPDATE: This weirdness is because there exists phony properties in strict-event-emitter-types which begin with empty spaces:

export interface TypeRecord<T, U, V> {
    ' _emitterType'?: T;
    ' _eventsType'?: U;
    ' _emitType'?: V;
}

Gotta figure out how to ignore this stuff 😄

@boneskull
Copy link

Note: StarlightTypeDocOptions.watch should be broken with the packages strategy if you are using TypeDoc's own "watch" facilities (looks like this is the case).

@boneskull
Copy link

boneskull commented Jan 4, 2024

The reflections generated by outputFileStrategy: 'modules' don't seem to be well-understood by the sidebar-generation code. From what I can tell, there's no such ReflectionGroup where .title = 'Modules', so the recursion in getSidebarGroupFromReflections() isn't occurring.

I'm going to guess that'd probably require a fair bit of work to sort out, since sidebar items won't be added for each member.

The dir structure looks like this:

└─ api
   ├─ @midnight-smoker
   │  ├─ plugin-default
   │  │  ├─ exports.md
   │  │  └─ index.md
   │  └─ test-util
   │     ├─ exports.md
   │     └─ index.md
   ├─ index.md
   └─ midnight-smoker
      ├─ index.md
      ├─ midnight-smoker.md
      ├─ modules.md
      └─ plugin
         ├─ index.md
         └─ namespaces
            ├─ Blessed.md
            ├─ Errors.md
            ├─ Event.md
            ├─ Executor.md
            ├─ Helpers.md
            ├─ PkgManager.md
            ├─ Plugin.md
            ├─ PluginMetadata.md
            ├─ Reporter.md
            ├─ Rule.md
            ├─ RuleRunner.md
            ├─ SchemaUtils.md
            └─ ScriptRunner.md

I wonder if that isn't just plain broken in typedoc-plugin-markdown, though. Why does a namespace get treated like a module? Anyway, maybe best to avoid until it hits v4.0.0

@HiDeoo
Copy link
Owner Author

HiDeoo commented Jan 4, 2024

Thanks for the valuable feedback. To address the various points:

I do see some unstyled invalid markdown (extra whitespace) coming through, but I'm not sure if that's typedoc-plugin-markdown's fault or no.

As you pointed out, this is indeed due to the extra spaces and this is the expected behavior according to the spec regarding delimiter run:

A left-flanking delimiter run is a delimiter run that is (1) not followed by Unicode whitespace


Also I'm seeing an empty "References" section.

This should now be fixed:

SCR-20240104-ocuh

Note: StarlightTypeDocOptions.watch should be broken with the packages strategy if you are using TypeDoc's own "watch" facilities (looks like this is the case).

There is an issue for this in the TypeDoc repository so not much I can do about it from my side.

Maybe I should add a note about this in the documentation?


The reflections generated by outputFileStrategy: 'modules' don't seem to be well-understood by the sidebar-generation code.

Yeah, this is one entry in my notes regarding that plugin which is not properly handled yet and may require some thinking to get it right. This is not a strategy I use myself but last time I encountered it, I was having issue with the markdown plugin like you mentioned. Once fixed, I think an approach could be in this specific case to no longer rely on Starlight autogenerate and manually constructing the sidebar but that's only my first thought 🤔

@boneskull
Copy link

re: watch mode, seems like it might be possible get the list of source files out of TypeDoc, then use addWatchFile on each. I don't think TypeDoc has any sort of incremental build, so you'll have to restart it from scratch every time anyway. in theory, a viable workaround, but idk if there are any unintended consequences...

@boneskull
Copy link

Anyway, thanks for your work on this!

@HiDeoo HiDeoo marked this pull request as ready for review January 5, 2024 08:34
@HiDeoo HiDeoo merged commit 82cdbf1 into main Jan 5, 2024
4 checks passed
@HiDeoo HiDeoo deleted the hd-packages branch January 5, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants