feat(router): prototype declarative multi-container routing - #20
Conversation
Add a TanStack-compatible MPA history, a neutral route manifest runtime, and file-route compilation for both TanStack and Next-style conventions. Include a ReactLynx demo, generated multi-entry bundles, tests, and prototype findings. Co-authored-by: TRAE CLI <noreply@bytedance.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…oundary checks Release-hardening pass (M0 + M2 of the release plan): - Manifest schema v1: adds 'version' and 'scheme.base' (the JS<->native contract is now versioned, serializable data) and per-page 'presentation: push | modal' — resolved through PageTarget and encoded into the sparkling scheme (native support pending; push fallback). Design points adopted from the PR #20 prototype, with credit. - Per-page pruned route trees: each bundle now boots pages.gen/<id>/routeTree.ts — own routes with full options, foreign routes as path-only href stubs; the full routeTree.gen.ts stays the type-level source of truth. The runtime no longer imports default artifacts (a static default dragged every page's components into every bundle — bundles now differ per page, framework baseline is the remaining shared-chunk work). - AST-based marker extraction (TypeScript API) replaces regex+eval: satisfies-wrapped literals supported, re-exports/dynamic values fail the build with precise errors. - Directory boundaries via '-container.ts' (the '-' prefix is excluded by the official generator; '_container' would create a pathless layout route and corrupt the tree). In-file 'page' export overrides. - Boundary containment check (subset rule R3, static approximation): an unmarked route under another page's declared prefix fails the build. - Next-style frontend explicitly marked experimental (not v1 API). - Tests: demo 22 -> 35 (pruned-trees, codegen-boundaries suites), history 39 -> 40 (presentation scheme encoding); all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wEPNgmHbba2Bgkr1KcDYa
|
Closing this prototype in favor of the #1 + #19 stack, after adopting its three strongest design points there (commit
Directory-level boundaries were also adopted, with one correction: the boundary file is named Not carried over: the Thanks — the schema and boundary ideas made v1 better. Generated by Claude Code |
Summary
sparkling-history, a TanStackRouterHistory-compatible MPA history that keeps in-container navigation local and forwards cross-container navigation tosparkling-navigationsparkling-router, which owns the serializable multi-container manifest and resolves hard vs. soft navigation while continuing to use the official TanStack React bindingsparkling-router-plugin, with TypeScript-AST-based scanners for both TanStack file routes and Next-style app directories, emitting the same neutral manifest schemaFindings
@tanstack/router-corecontains the reusable routing machinery, but does not expose complete framework-neutralcreateRouter/createRoutefactories. For ReactLynx, using the official@tanstack/react-routerbinding over a Sparkling history adapter is lower risk than maintaining another framework subclass layer.Validation
pnpm --filter sparkling-history buildpnpm --filter sparkling-router buildpnpm --filter sparkling-router-plugin buildpnpm --filter sparkling-history test— 29 testspnpm --filter sparkling-router test— 3 testspnpm --filter sparkling-router-plugin test— 3 testspnpm --filter tanstack-router-demo test— 16 testspnpm --filter tanstack-router-demo build— generatedspike,home,detail, andsettingsLynx bundlesgit diff --check huxpro/main...HEADOut of scope
This prototype does not implement or freeze the native stack protocol. The next gate is an iOS implementation plus conformance tests for stack state/versioning, gesture-driven changes, reset/getState, syncOwnLocation, prefetch, and result delivery.