Repository navigation
refactor(router): split 4 god files into focused submodules - #228
Merged
Merged
Conversation
Extract large files (>1000 lines) into subfolder modules with barrel re-exports, following the same pattern as the discovery/ split. - generate-route-types.ts (1,162 → ~25 lines) → route-types/ - segment-resolution.ts (1,781 → ~15 lines) → segment-resolution/ - expose-internal-ids.ts (1,266 → ~371 lines) → expose-ids/ - router.ts (2,102 → ~1,282 lines) → find-match, lazy-includes, prerender-match, preview-match modules Pure refactor — no behavioral changes. All 1,624 unit tests and 64 e2e tests (dev + production) pass.
4 tasks done
This was referenced Jun 13, 2026
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
generate-route-types.ts(1,162 → ~25 lines) →route-types/subfolder (8 modules: AST helpers, param extraction, codegen, scan filter, include resolution, per-module writer, router processing)segment-resolution.ts(1,781 → ~15 lines) →segment-resolution/subfolder (3 modules: static-store, fresh resolution, revalidation)expose-internal-ids.ts(1,266 → ~371 lines) →expose-ids/subfolder (5 modules: types, export analysis, loader/handler/router transforms)router.ts(2,102 → ~1,282 lines) → 4 extracted modules:find-match.ts,lazy-includes.ts,prerender-match.ts,preview-match.tsPure refactor — no behavioral changes. Original files become barrel re-exports (or thin wrappers for
router.ts). Follows the same pattern as thediscovery/split in #226.Test plan
pnpm build-router— esbuild bundles successfullypnpm --filter @rangojs/router exec tsc --noEmit— router typecheck passespnpm typecheck— full monorepo typecheck (9/9 packages)pnpm lint— 0 warnings, 0 errorspnpm --filter @rangojs/router test:unit— 1,624 unit tests passpnpm test— full suite (unit + 64 e2e tests, both dev and production)