feat: render docs for multi-entry packages#2964
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughDocumentation generation now resolves package entry points, fetches doc nodes per entry, and renders grouped documentation sections and TOCs with prefix-aware anchors. Shared entry/result types, slugging helpers, and unit tests were updated for the per-entry output shape. ChangesGrouped package docs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello! Thank you for opening your first PR to npmx, @maraisr! 🚀 Here’s what will happen next:
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/pages/package-docs/`[...path].vue:
- Around line 289-295: The grouped TOC targets created by renderGroupedToc() are
missing the sticky-header scroll offset, so clicking a group anchor can hide the
title under the header. Update the docs page styles for the group target
selectors used by docs-group-title / `#group-`* so they receive the same offset
behavior already applied to .docs-symbol:target, while keeping the existing
first-group spacing override intact.
In `@server/utils/docs/client.ts`:
- Around line 29-64: The per-entry work in the docs client is unbounded:
resolveEntryPoints() then Promise.all() over every export can trigger too many
concurrent HEAD/doc() calls. Update client.ts to cap concurrency or process
entryPoints in small batches inside the main mapping flow, keeping the existing
entryPoint/typesUrl/doc() logic but limiting simultaneous upstream requests and
WASM parses. Ensure the final filtering of DocEntry results still behaves the
same.
In `@server/utils/docs/render.ts`:
- Around line 529-558: renderGroupedToc currently wraps each group with
renderToc(), which creates nested <nav> landmarks inside the top-level Table of
contents nav. Update renderGroupedToc and the renderToc helper so the grouped
view uses a non-nav inner list wrapper for entries, while keeping only the outer
renderGroupedToc landmark; use the existing renderToc symbol as the place to
split out a wrapper-free list renderer.
- Around line 74-99: The grouped-doc rendering flow is using a lossy entry
prefix from entrySlug(), which can make different entry points generate the same
ids and broken anchors. Update renderGroupedDocNodes and the downstream grouped
rendering helpers (including renderDocNodes and any section/symbol id generation
they call) to use a collision-safe, injective entry prefix instead of deriving
ids from the raw slug. Prefer computing a unique prefix once per ProcessedEntry
and threading it through the grouped render path so group, section, and symbol
anchors remain distinct.
In `@server/utils/docs/text.ts`:
- Around line 65-71: Wildcard entry points are being normalized by entrySlug()
into the same slug as concrete paths, which can create duplicate group, section,
and anchor IDs for unsupported exports. Update entrySlug() to either reject any
entryPoint containing “*” before slugging or preserve the wildcard in a distinct
slug form so these inputs fail explicitly instead of collapsing to the same
output as a non-wildcard path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7240fd3e-6f8d-41dd-bfcf-0d3a48ffaa31
📒 Files selected for processing (10)
app/pages/package-docs/[...path].vueserver/utils/docs/client.tsserver/utils/docs/index.tsserver/utils/docs/processing.tsserver/utils/docs/render.tsserver/utils/docs/text.tsserver/utils/docs/types.tsshared/types/deno-doc.tstest/unit/server/utils/docs/render.spec.tstest/unit/server/utils/docs/text.spec.ts
|
Hey thanks for taking a look! ✨ I'll have another play, but have you got ideas? I didn't really like what jsr did with indentation, but perhaps simply some top margin there is enough to distinguish? I also trimmed the |
|
What about something like this @danielroe?
Think the text mono on the headings is a little whimsical and fits better with the vibe of the site? Thoughts? Added this too, so that it ellipsis, and on the left. Thinking long submodules like
|
|
yes, I think that looks better ... it doesn't seem to show up in the preview yet though, if you've pushed it |
|
I've definitely pushed. The latest preview deployment shows up for me 😅 |



🔗 Linked issue
None yet, happy to open a tracking issue if that's preferred.
🧭 Context
Some packages don't ship a single root entry. My library
tctxis one of them. It only exposes submodule exports:Because the docs pipeline assumes a single root (
./index) entry, packages like this fall through and render nothing on the Docs tab. You can see it live today on npmx.dev/package-docs/tctx:📚 Description
This PR is really my attempt at enhancing the docs generator to resolve and render multiple entry points instead of assuming one root module.
I can now see my docs rendering correctly! 🎉
With this,
tctxnow has real docs. one group per submodule (traceparent,tracestate):It also handles the common case of a package that exports a root and submodules together, eg
unstorage(.+./server):Scope & follow-ups
I deliberately kept this slice small so it's easy to reason about:
"./foo/*") aren't solved yet. I'd love to iterate toward that, but wanted to land something useful first rather than block on the harder cases.And a small sneak peek of what I've got working locally for a follow-up PR, rendering
@moduledocs too:A note on landing this
I genuinely don't know what the right rollout or shape here is, and I'm very open to feedback on the approach, the entry resolution, and especially the grouped-docs design (headings, ordering, how multi-entry should feel). Happy to chat it through and iterate; please push back wherever it makes sense. 🙏