Skip to content

feat(sparkling-history): router-agnostic navigation shim for MPA on Lynx [stack 1/6] - #8

Open
Huxpro wants to merge 1 commit into
mainfrom
stack/1-sparkling-history
Open

feat(sparkling-history): router-agnostic navigation shim for MPA on Lynx [stack 1/6]#8
Huxpro wants to merge 1 commit into
mainfrom
stack/1-sparkling-history

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Stacked PR 1/6 — base: main. This is the bottom of the stack.
The whole stack splits the Vue-Router-on-Sparkling work into atomic, reviewable pieces. This PR is the router-agnostic shim — deliberately separated from any specific router (the Vue Router adapter is stack 2/6).

Summary

Adds sparkling-history, a framework-agnostic W3C-History-style shim that lets URL routers drive Sparkling's multi-page native navigation (MPA), where each page is a separate Lynx container in its own JS heap, connected only by a build-time route manifest. No router framework dependency — any router that accepts a custom history can sit on top.

Related issues

Foundation shared by the router experiments (#1 TanStack, #2 Nuxt, #3 Vue Router). Standalone: contains no router-specific code.

Changes

  • NavigationHost — platform floor (open/close stacked pages by URL). Ships a Sparkling binding (over sparkling-navigation) and an in-memory simulator.
  • SchemeCodec + RouteManifest — cross-heap contract; route/state/depth ride across the boundary in the URL.
  • HybridRouterHistory — structurally compatible with a RouterHistory; in-heap it behaves like memory history, at the container boundary it delegates to the host.
  • codegen — scans src/pages/* into a manifest module + an rsbuild/rspeedy plugin.

How to test

pnpm --filter sparkling-history build
pnpm --filter sparkling-history test   # 35 tests

Ported vue-router memory-history suite + cross-heap flows via the memory simulator.

Checklist

  • I read CONTRIBUTING.md.
  • I linked a related issue (or explained why this is standalone).
  • I ran relevant checks (build + 35 tests pass).
  • I updated docs/examples (README).
  • I added/updated tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ARyWgB3243gQx1exWK61Qb


Generated by Claude Code

A framework-agnostic W3C-History-style shim that lets URL routers drive
Sparkling's multi-page native navigation, where each page is a separate Lynx
container in its own JS heap connected only by a build-time route manifest.

Layers (each a small, explicit contract):
- NavigationHost: the platform floor — open/close stacked pages by URL. Ships
  a Sparkling binding (over sparkling-navigation) and an in-memory simulator.
- SchemeCodec + RouteManifest: the cross-heap contract. A manifest generated
  from a file-based page convention is embedded in every bundle so isolated
  heaps agree on route -> scheme; route/state/depth ride across the boundary in
  the URL.
- HybridRouterHistory: structurally compatible with a RouterHistory. In-heap it
  behaves like memory history; at the container boundary it delegates to the
  host (pushExternal opens a new container; go(-n) past the queue pops the
  native stack).
- codegen: scans src/pages/* into a manifest module + an rsbuild/rspeedy plugin.

No router framework dependency — any router that accepts a custom history can
sit on top. 35 tests (memory-history suite ported from vue-router + cross-heap
flows via the memory simulator).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARyWgB3243gQx1exWK61Qb
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sparkling Ready Ready Preview, Comment Jul 13, 2026 1:16pm

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.

2 participants