feat(theme): site-wide Node.js | Bun runtime switcher#65
Merged
Conversation
Adds a runtime switcher to the navigation bar (desktop and mobile nav screen) and a `::: runtime` markdown container, so pages can carry runtime-specific commands without splitting into separate Node.js and Bun pages. Mechanism: - Every variant is server-rendered into the static HTML and only hidden with CSS, driven by `data-runtime` on `<html>`. Crawlers, the local search index and `llms.txt` therefore see both runtimes, and readers without JavaScript get the Node.js page. - The stored choice is applied by an inline `<head>` script before first paint (the technique VitePress uses for dark mode), so there is no flash of the wrong runtime and no hydration mismatch: server and client markup are identical, and every active state is pure CSS. - `?runtime=bun` shares the choice through a link and wins over localStorage; a second browser tab follows through the `storage` event. - The build fails on a heading inside a block, on a duplicate runtime section and on an unknown runtime name -- headings inside a block would duplicate the page outline and produce suffixed anchors. Content: - Quickstart, TypeScript patterns, Docker and the 15 package pages now show runtime-specific prerequisites, install commands, scripts and run commands. - Testing snippets note the `bun:test` import; `node:assert` and the Connectum mock helpers work unchanged under Bun. Corrections found while verifying Bun content against real runs (Bun 1.1.38, 1.2.0, 1.2.5, 1.2.6, 1.2.21, 1.3.0, 1.3.13 x @connectrpc/connect-node 2.0.0 and 2.1.2, @connectum/core 1.2.0): - HTTP/2 client transports do not throw a `TypeError` on Bun; on Bun <= 1.2.5 the first RPC hangs. Bun 1.2.6 fixed the `node:http2` client, and unary, server-streaming and bidi calls all work from that version on. - Streaming over `createConnectTransport()` on HTTP/1.1 works on every Bun version tested; the `node:http` claim was wrong. - The documented `createTransport` + `createFetchClient(globalThis.fetch)` workaround is removed: it does not compile as printed, relies on an API ConnectRPC marks internal, and silently drops the request body on Bun 1.1.x. - Connectum servers serve native gRPC on Bun -- `createServer()` uses `node:http2`, not `Bun.serve`; the transport matrix said otherwise. - `@connectum/cli` is Partial on Bun (exercised on Node.js only); `@connectum/testing` is Partial only because of the `/parity` subpath. - `createMockNext()` does not return a `node:test` spy. Authoring rules for the new container are documented in the documentation style guide.
The quickstart linked `#opentelemetry`, but the heading anchor is `#otel` -- VitePress dead-link checking only validates pages, not fragments. The navbar note said CI coverage is Node.js only, which understates the Bun job that runs `test:bun` on every pull request; only cli, otel and interceptors skip it.
The heading said `node:25-slim` while the Bun branch below it recommends `oven/bun:1-slim`.
The default theme only offers `nav-bar-content-after`, so the control is reordered with flex `order`; the search box gives up its `flex-grow` above 960px so the pair stays on the left instead of drifting towards the menu, and the dropdown opens left-aligned to match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A site-wide Node.js | Bun runtime switcher: a control in the navigation bar (and in the mobile nav screen), plus a
::: runtimemarkdown container so a page can carry runtime-specific commands instead of splitting into parallel Node.js and Bun pages.== bun
:::