react-server675fbba4
react-servercommit280f54ef9eb3

docs: api reference (#405)

Adds an API reference section to the docs, generated on demand from the TypeScript definitions of @lazarv/react-server. Previously the docs only covered concepts and guides; users reaching for "what does this subpath export and how is it typed" had to read the source. This branch walks every public subpath's .d.ts with the TypeScript compiler API, extracts each symbol's signature plus its JSDoc description, @param, @returns, @example, @deprecated, and @see tags, and renders it through the same MDX pipeline the rest of the docs use — so the output picks up rehype-highlight, rehype-mdx-code-props, the mdx-components overrides, and fits the existing visual language without new primitives.

Nothing is generated to disk. The data source lives at docs/src/lib/api-reference.mjs, the dynamic /api/:slug page compiles MDX at request time with @mdx-js/mdx and caches compiled components by (slug, locale, max .d.ts mtime), and a small rehype plugin walks every <code> in the compiled tree to linkify identifiers that match the cross-file symbol registry — so type references inside signatures and inline code spans become clickable anchors on the same page or cross-page links into /api/<target-slug>. SSG enumeration comes from a sibling [slug=apiSlug].static.mjs, and the [slug=apiSlug] filename alias wires a matchers export on the page into the file-router so unknown slugs fall through to the site-wide 404 natively — no validator middleware required. The landing page uses the existing <dl> TOC style with sections grouping subpaths by role.

Around the feature, a handful of housekeeping items: the .md variants served to AI consumers pick up the same API pages via a renderApiReferencePageMarkdown branch in the existing /md/[...slug] handler; api_translation_banner and api_landing_title are added to the paraglide catalog so the "not translated" notice is a single-source-of-truth message instead of a hardcoded string; six malformed JSDoc blocks in the runtime's .d.ts files (missing closing fences on @example code blocks) are fixed, cleaning up editor hover tooltips as a side effect; and a long-standing race in DarkModeSwitch where the mount-time effect overwrote the cookie to dark=0 before the sibling read-effect could call setDark is patched by guarding the writer on the sentinel null initial state, so the theme cookie now actually persists across refreshes.

Author
Viktor Lázár <lazarv1982@gmail.com>
Date
Commit
280f54ef9eb3a78e0eba0e1aa7d93b426eb975c5
26 files changed+1701 -21