Skip to content

Next-style authoring frontend on the same MPA core (RFC phase 3, stacked on #1) - #19

Draft
Huxpro wants to merge 2 commits into
claude/tanstack-router-sparkling-vw2vfzfrom
claude/sparkling-navigation-lynx-component-zpycc6
Draft

Next-style authoring frontend on the same MPA core (RFC phase 3, stacked on #1)#19
Huxpro wants to merge 2 commits into
claude/tanstack-router-sparkling-vw2vfzfrom
claude/sparkling-navigation-lynx-component-zpycc6

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #1 (base branch is claude/tanstack-router-sparkling-vw2vfz; merge #1 first, then retarget or merge this).

Two commits:

  1. RFC phase 3 spike — a second authoring frontend (Next-style app directory) compiling to the same artifact pair (route tree + page manifest), consumed by the same runtime with no new runtime logic. Marked experimental: it proves the authoring dimension is pluggable and is not part of the v1 API surface.
  2. Release hardening (7ab4ac7) — the M0+M2 pass toward an alpha:
    • Manifest schema v1: version, scheme.base, per-page presentation: 'push' | 'modal' (encoded into the sparkling scheme; native support pending, push fallback). Schema/presentation/versioning design points adopted from the feat(router): prototype declarative multi-container routing #20 prototype, with credit.
    • Per-page pruned route trees: each bundle boots pages.gen/<id>/routeTree.ts — own routes with full options, foreign routes as path-only href stubs; 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; bundle sizes now diverge per page — the remaining ~330 kB baseline is framework shared-chunk work, out of routing scope).
    • AST-based marker extraction (TypeScript API, replacing regex+eval): satisfies supported; re-exports/dynamic values fail the build with precise errors.
    • Directory boundaries via -container.ts (the - prefix is generator-excluded; _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 sitting under another page's declared prefix fails the build.

The second frontend (phase 3, experimental)

  • src/app/** — the demo app authored Next-style: page.tsx (default-export component), layout.tsx, [id]/ segments; boundaries via export const container, extra options via export const routeOptions.
  • scripts/gen-next.mjs — translator: app dir → bridge route files → official @tanstack/router-generatorrouteTree.next.gen.ts; manifest compiled by the same shared compiler (scripts/lib/page-manifest.mjs) the TanStack frontend uses.
  • tests/next-parity.test.ts: identical route-id sets, deep-equal manifests, same cross-page/in-page behavior over the same runtime.

Verification

  • Demo tests 22 → 35 (new: pruned-trees — stub href building, presentation flow, per-page boot; codegen-boundaries — AST extraction, -container inheritance/override, R3 containment failure). sparkling-history 39 → 40 (presentation scheme encoding). All green.
  • Native build: 7 bundles (home/detail/settings + next-*); pruned bundles now differ per page.

Known limitations

🤖 Generated with Claude Code

https://claude.ai/code/session_016wEPNgmHbba2Bgkr1KcDYa

…hase 3)

Prove the runtime is frontend-agnostic: a second translator (gen-next.mjs)
compiles a Next-style app directory (src/app: page.tsx / layout.tsx / [param],
'container' page-boundary markers) into the same artifact pair the TanStack
convention produces — a route tree via the official @tanstack/router-generator
over generated bridge route files, and a page manifest via a manifest compiler
now shared between both frontends (scripts/lib/page-manifest.mjs).

The runtime gains no logic: mount()/createMpaRouter() just take the artifact
pair explicitly ({ pageId, routeTree, manifest }), defaulting to the TanStack
artifacts. tests/next-parity.test.ts pins the equivalence (identical route-id
sets, deep-equal manifests, same cross-page/in-page behavior); both frontends
build side by side as next-* bundles for the demo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wEPNgmHbba2Bgkr1KcDYa
@vercel

vercel Bot commented Jul 25, 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 26, 2026 8:21am

Request Review

…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
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