Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@kentcdodds/package-app-kit

Design tokens, PWA install/update, About/version, cache helpers, and optional realtime notes sync for Kody package apps.

src/router.ts

20 lines · 793 B · TypeScript
/**
 * Navigation API SPA router for package-app HTML pages.
 * Browser source of truth: `src/client/router.ts` (bundled into kody.app.client).
 * Prefetches `/` ↔ `/about`, swaps `[data-app-main]` only, View Transitions when available.
 * Fallback without Navigation API: preventDefault + history.pushState + same swap.
 */

export type NavigationRouterOptions = {
	/** App-relative routes to intercept (default `/` and `/about`). Config also via data-pak-config. */
	routes?: string[]
}

/** @deprecated Prefer the bundled client entry; path kept for older callers. */
export function clientRouterModulePath(_options: NavigationRouterOptions = {}): string {
	void _options
	return '/client/boot.js'
}

/** Primary callable export for this subpath. */
export default clientRouterModulePath