Next-style authoring frontend on the same MPA core (RFC phase 3, stacked on #1) - #19
Draft
Huxpro wants to merge 2 commits into
Conversation
…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
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1 (base branch is
claude/tanstack-router-sparkling-vw2vfz; merge #1 first, then retarget or merge this).Two commits:
7ab4ac7) — the M0+M2 pass toward an alpha:version,scheme.base, per-pagepresentation: '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.pages.gen/<id>/routeTree.ts— own routes with full options, foreign routes as path-only href stubs;routeTree.gen.tsstays 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).satisfiessupported; re-exports/dynamic values fail the build with precise errors.-container.ts(the-prefix is generator-excluded;_containerwould create a pathless layout route and corrupt the tree). In-filepageexport overrides.The second frontend (phase 3, experimental)
src/app/**— the demo app authored Next-style:page.tsx(default-export component),layout.tsx,[id]/segments; boundaries viaexport const container, extra options viaexport const routeOptions.scripts/gen-next.mjs— translator: app dir → bridge route files → official@tanstack/router-generator→routeTree.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
pruned-trees— stub href building, presentation flow, per-page boot;codegen-boundaries— AST extraction,-containerinheritance/override, R3 containment failure). sparkling-history 39 → 40 (presentation scheme encoding). All green.home/detail/settings+next-*); pruned bundles now differ per page.Known limitations
🤖 Generated with Claude Code
https://claude.ai/code/session_016wEPNgmHbba2Bgkr1KcDYa