Skip to content

reference: add the API doc grouping engine with tests (dormant)#3320

Merged
bartlomieju merged 1 commit into
mainfrom
reference-grouping-engine
Jun 18, 2026
Merged

reference: add the API doc grouping engine with tests (dormant)#3320
bartlomieju merged 1 commit into
mainfrom
reference-grouping-engine

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

This is the first bite-sized slice of the API reference rearchitecture.
The full rearchitecture currently lives as one ~1,000-line branch (#3205)
that regroups @deno/doc's ~11,000 per-symbol pages into ~100 grouped
pages. Rather than land that as one hard-to-review diff, I'm peeling it
into a spine of small PRs. This is step 1.

What this adds

reference/_lib/group.ts — the core grouping engine — plus a unit test
suite. It is wired to nothing: no page generation imports it yet, so
there is zero site impact. This lets the gnarliest logic get reviewed and
verified in isolation before any pages change.

buildReference is a pure function. Given @deno/doc's per-symbol
generateHtmlAsJSON output for the three API kinds, it returns:

  • the grouped pages (one per Deno/Web category and per Node module),
  • the redirect map from every old per-symbol URL to its new anchor,
  • link-rewrite warnings (dead cross-symbol links),
  • a page rewriter for arbitrary ctx subtrees.

Tests

The suite covers the behaviours that are easy to get wrong and that the
later wiring PRs depend on:

  • category grouping and URL/slug/title derivation,
  • redirect collapse of property pages to their parent symbol anchor,
  • in-page anchor namespacing by root symbol,
  • cross-symbol and cross-API-kind link rewriting to the new anchors,
  • Uncategorized sorting last,
  • dead-link reporting.

Note

The file carried five stray NUL bytes and an em-dash from its original
authoring, which made git treat it as binary (unreviewable diffs). Both
are cleaned up, so it now diffs as normal text.

What's next (separate PRs)

Redirect-middleware plumbing, then the page-generation flip, then the
/api/ hub, then small polish follow-ups (category fixes, anchor
precision, search index).

First slice of the reference rearchitecture (currently one ~11k-page
monolith on a single branch), landed in reviewable pieces. This adds the
core grouping engine, buildReference, with a unit test suite, but wires
it to nothing yet, so there is no site impact.

buildReference is a pure function that takes @deno/doc's per-symbol
generateHtmlAsJSON output and returns the grouped pages, the
old-URL -> new-anchor redirect map, link-rewrite warnings, and a page
rewriter. The tests cover the behaviours that are easy to get wrong:
category grouping and URLs, redirect collapse of properties to their
parent symbol, anchor namespacing, cross-symbol and cross-API-kind link
rewriting, Uncategorized ordering, and dead-link reporting.

The file also had five stray NUL bytes and an em-dash from its original
authoring; both are cleaned up so git treats it as text and it diffs
normally.
@bartlomieju bartlomieju merged commit d4243da into main Jun 18, 2026
3 checks passed
bartlomieju added a commit that referenced this pull request Jun 18, 2026
Wires the grouping engine (landed in #3320) into page generation, so the
reference ships ~100 grouped pages instead of ~11,000 per-symbol ones.

- reference.page.ts now builds one page per Deno/Web category and per Node
  module, a dense find-in-page index per API kind at /api/<kind>/, and the
  /api/ tile hub, all from buildReference's output.
- the old hand-written landing guides move to /api/<kind>/about/.
- every old per-symbol URL is emitted into _site/api/_redirects.json; the
  middleware (wired up in the previous commit) now serves those 301s, and
  the hardcoded /api/ -> /api/deno/ redirect is removed so the new hub
  shows.
- the Orama search index points at the new anchored URLs.

Verified: reference build is green (105 pages), the redirect map is
complete and every one of its 11,222 targets resolves to a real page and
anchor, /api/ serves the hub while old symbol URLs 301 to their anchors,
and the about pages build alongside the dense indexes.

Known follow-ups (separate PRs, pre-existing or cosmetic): Temporal
symbols lack category tags so their sidebar entry is orphaned; some
overloaded-method summary anchors use @deno/doc's per-method index rather
than its global one.
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.

1 participant