Companion packagesv5.1.0
Markdown & source details

5.1.0 · stable release (published on npm) · 86ee0599 snapshot. Reading source: 4e5c36d9e8b19ee4dcab2842e3bca6182be0c5a6. Match APIs to your installed version.

On this page

@mnjs/router: feature-owned routing#

Router is an optional, independently released companion. It is renderer-agnostic: @mnjs/html is the recommended choice for a new application, not a Router requirement. Install compatible Marionette peers according to the Router manifest. Router is a pre-v1 package with its own release cadence; read the installed contract when selecting drivers or upgrading.

Read the installed contract first#

After installation, read node_modules/@mnjs/router/readme.md for setup and capabilities, node_modules/@mnjs/router/DESIGN.md for detailed contracts, and node_modules/@mnjs/router/examples/catalog/ for the larger shipped example. These files belong to the installed Router version, not to core's documentation manifest. When working with HTML, use node_modules/@mnjs/html/guide.md and node_modules/@mnjs/html/LIT_DIFFERENCES.md. Read the package versions first. When installed files are unavailable, select the router-v<installed-version> tag matching the installed release from the repository tags and read its packages/router/ directory. The published example verification links the exact source tag used for this guide's fixture.

Router requires Node 24.15 or newer. Check the routing capability and driver requirements before constructing it. A memory driver makes tests deterministic; it does not exercise browser navigation, focus, scroll or direct-link server behavior.

Conditional History downloads#

When the installed Router exports @mnjs/router/history, applications can import that entry conditionally to defer History downloads. Existing root named exports remain supported. Consult the installed Router changelog before upgrading across minor versions, and its README for bundler, preload and service-worker requirements.

Published example verification#

The runnable routing example is verified with published marionette@5.1.0, @mnjs/router@0.1.1 and @mnjs/html@1.0.0. These identify the reproducible documentation fixture, not a requirement to pin every compatible application to those exact versions. The Router 0.1.1 source belongs to that recorded fixture; consult the installed contract for other versions.

Browser coverage#

Router 0.1.1's runtime has passing Chromium, Firefox and Playwright WebKit coverage for native Navigation API routing and the explicit History driver. The three-engine installed-archive run passed all 162 cases on each engine, with no retries or skips. It verified a Linux-produced archive on macOS arm64; its runtime matches published Router 0.1.1. The published 0.1.1 README predates this expanded coverage.

The validation notes describe the tested engine versions and two native WebKit differences involving fragment removal and overlapping Back calls. In those Back cases, back() can resolve false even after a destination becomes ready. Playwright WebKit coverage does not establish behavior in every shipping Safari or iOS version.

A minimal HTML feature#

The main routing guide contains the copyable Router/RouteApplication HTML example and its startup, navigation, teardown and memory-driver testing instructions. That exact example is executed by the companion documentation check.