docs(website): TypeDoc router 'module' — one API page per entry point (#590) - #610
Conversation
|
commit: |
…b-slugger ids; built-link check matches authored API member labels to their headings
…ugger Rspress runs, instead of an inlined approximation
9da096a to
2b1f3ca
Compare
…b-slugger ids; built-link check matches authored API member labels to their headings
…ugger Rspress runs, instead of an inlined approximation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…b-slugger ids; built-link check matches authored API member labels to their headings
…ugger Rspress runs, instead of an inlined approximation
… page (#597 landed after the router change)
…landed after the router change)
…ng, early-continue over one sitePath, collapse nested broken-set if Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
… and prose (#610 deslop)
20d0834 to
fe1e127
Compare
…oc router) into feat/592-authoritative-manifest
Second PR for #590 (the first, #599, merged as cfdaeca). This one flips the TypeDoc reference from
router: 'kind'— one page per exported symbol — torouter: 'module'— one page per public entry point — and follows through on every cost the audit's A/B listed. It is deliberately separate so it can be reverted alone.Why
The audit measured the kind router at 916 API pages per locale (1,832 with the zh mirror), each rendering a 921-item sidebar in SSR: 561 MB of the 602 MB of HTML was sidebar,
doc_buildwas 623 MB, and the entry chunkstatic/js/index.*.jswas 2.23 MB raw / 368 KB gz on every page becausevirtual-page-data/virtual-routesare O(pages).What changed
website/rspress.config.ts:app.options.setValue('router', 'module')in the existing TypeDocsetuphook. The main entry point's page is/api/index-1: TypeDoc names module pages after their entry point andindex.mdis the project index;entryModule: 'index'would replace the project index at/api/(which authored pages and the nav link to), so the suffix stays and the sidebar labels itindex. Themembertitle template is gone because the module router renders no member pages.website/docs/{en,zh}/api/_meta.json: flattened from six kind groups to the project index plus module pages. Explicittype: "file"entries labelled by module name, primary entry points first; nestedroutes/publicandtest/browserare addressed by their slashed names (no nested_meta.jsonneeded). en and zh are identical.#name-1for 33 members (86 links) whose reflection URL collided with a name it had already reserved, while Rspress assigns ids with github-slugger over the rendered headings in document order — so the first### Nameon a page is#nameand those links were dead.alignTypeDocMemberLinksinmirror-api-locale.ts(which already post-processes the generated tree before mirroring it) strips the suffix only when exactly one heading on the target page, at any depth and outside code fences, produces that anchor; anything ambiguous is left as TypeDoc wrote it for the build's anchor check to judge. Result: 1,902 intra-page links, 0 unresolved.reference/configuration.mdx,guide/development/evaluations.mdx,guide/authoring/index.mdx) now targets../api/<module>.md#<member>; anchors computed with github-slugger over the generated headings in document order, which is exactly what Rspress does, and verified against the built HTML byscripts/check-built-links.mjs.reference/api.mdx(en + zh): describes the module-page layout and maps each public import specifier to its module page.Before → after (this machine,
RSPRESS_PERSISTENT_CACHE=false, link checks on)doc_buildapparent sizezh/api/interfaces/serve-app-command.SpawnServeAppOptions)zh/api/serve-app-command)static/js/index.*.jsraw / gzrspress buildwall (load ≈ 8 → ≈ 15)docs:site:buildCI jobMeasured with a Playwright + static-server harness kept outside the repo; the built-link checker's count went from 1,838,131 internal links across 1,950 files to 29,759 across 106.
Deslop
gpt-5.6-sol-medium, 5 edits (fe1e127): three doc comments that restated the helper beneath them (headingText, thePageAnchorsfields,visibleText) and one zh clause in theagent-bundle/approw that duplicated the row's closing sentence. Nothing to trim in_meta.json, the config, Dependabot, or the other pages.Self-review
Reviewer:
gpt-5.6-sol-medium(implementing lanes:gpt-5.6-sol-mediumfor the config/anchor lane,cursor-grok-4.6-high-fastfor the link rewrites,claude-fable-5-1-thinking-maxfor the API overview prose and integration). An earlier pass ongpt-5.6-terra-mediumdid not produce findings (tooling) and is not relied on. Two independent Sol runs on the pre-fix diff (e7450e6) converged on the same two findings:alignTypeDocMemberLinkscould re-point a legitimate link. It approximated the slugger and rewrote any#x-Nfragment when one heading producedx— a real#protocol-v1would have become#protocol-v, with the anchor check still passing. Fixed (d536405): ids are computed with github-slugger's exact algorithm over every heading in document order (the algorithm Rspress bundles), and a fragment is rewritten only when it is actually dead on the target page and its base is a###member id. 1,907 intra-page links, 0 unresolved, 168 legitimately suffixed links untouched.#build-2,#validate-1) would keep resolving to the wrong heading if a same-named heading were added earlier. Fixed:check-built-links.mjsnow compares the visible label of every authored/api/<module>#<member>link with the text of the heading it lands on (90 links matched in the gate). It caught one real case — therunEvalsre-export sentence inreference/api.mdxlabelled the linkapi— corrected in both locales.No findings on
_meta.jsonnested names (Rspress joinsnameonto the directory), en/zh parity, generated-reference accuracy, plugin placement, unmounted modules, or the Pages deploy. Second pass after the fixes: one residual on d536405 — the inlined punctuation set was not github-slugger 2.x's full Unicode regex (a### x😀heading would slug differently), with the fix "depend on the same slugger Rspress uses". Fixed (9da096a): ids now come from@rspress/shared/github-slugger, the module@rspress/coreitself re-exports for its TOC plugin, pinned to the same2.0.21. A third pass confirms: import resolves under pnpm's strict layout,headingTextmatches whattoc.jsfeeds the slugger for TypeDoc's headings, lockfile diff is the three added lines, no leftover symbols; one low finding — Dependabot could bump@rspress/coreand@rspress/sharedseparately — fixed (e9e3e65) with an@rspress/*Dependabot group.After the reviews,
maingained #597 (architecture page) and #578 (composite root): rebased, and the architecture page's twoArtifactManifestlinks (en + zh) were moved to/api/index-1#artifactmanifest(2b1f3ca); the gate is green on the rebased head (0 broken links / 25,864 anchors, 92 member labels matched) and the pages those PRs touched were re-measured at 1440 × 900: no authored fence overflows and the: anyhover count is unchanged at 16. Onemainregression found during that re-check is deliberately not in this PR: #578's home-page artifact tree overflows itsab-comparecolumn at 1440 px — filed as #617.Second rebase after #614 and #601 landed:
reference/api.mdx(en + zh) conflicted with #601's newagent-bundle/approw and "Where to start" bullet — resolved by keeping this PR's three-column table and adding theapprow with its module page, and_meta.json(en + zh) lists the newapppage. The link/anchor gates (check-built-links.mjs, Rspress dead-link/anchor/parity checks) are intact and the fullpnpm docs:site:buildwas re-run on the merged tree.Not in this PR
Final pass on the merged head (fe1e127),
claude-fable-5-1-thinking-high, per the owner's 08:30 note: no blocking findings — rebase content, authored links,_meta.json, gate config and deploy all verified (it also ran raw TypeDoc against the plugin: 106 dead#x-1links before alignment, 0 after, every rewritten label matching its heading). Three hardening items it raised — a constructible three-wayFooCode/fooCode/Foo.codecollision the dead-only rule would mis-point, the case-insensitive label check, and the "source file" wording for*/index.tsentries — landed in #624 since auto-merge had already fired.Refs #590.