Skip to content

fix: derive route resources from route localization - #4047

Merged
BobbieGoede merged 3 commits into
mainfrom
refactor/route-resources-collection
Jul 19, 2026
Merged

fix: derive route resources from route localization#4047
BobbieGoede merged 3 commits into
mainfrom
refactor/route-resources-collection

Conversation

@BobbieGoede

@BobbieGoede BobbieGoede commented Jul 19, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

This cleans up the i18n route resources generation, it was built separate from the route localization which duplicated logic, while refactoring I ran into some unreported issues that were fixed along the way. The issues were only present for language detection on the nitro/server side.

  • localized routes without a page file were missing from the generated resources and were used for language detection and redirection
  • route localization did not default to the default locale's localization (so server redirection may have pointed to a bad localized route)

The generated route resources have also been restructured to reduce repetition.

Summary by CodeRabbit

  • New Features

    • Added route localization resource tracking for localized, disabled, and custom paths.
    • Added hooks for observing route localization and supporting nested path composition.
    • Improved handling of missing or fallback locale mappings.
  • Refactor

    • Simplified route analysis and removed obsolete route-resolution utilities.
    • Updated routing consumers to use the new localization resources.
  • Tests

    • Expanded coverage for custom paths, disabled routes, redirects, nested routes, and compacted route handling.

@BobbieGoede BobbieGoede self-assigned this Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5472cfac-d5e9-47f4-a63d-439d25498dcf

📥 Commits

Reviewing files that changed from the base of the PR and between 617c824 and 7266e76.

📒 Files selected for processing (10)
  • internals.d.ts
  • src/kit/gen.ts
  • src/pages.ts
  • src/routing.ts
  • src/runtime/shared/matching.ts
  • test/pages/custom_route.test.ts
  • test/pages/ignore_route/disable.test.ts
  • test/pages/ignore_route/pick.test.ts
  • test/pages/meta_unification.test.ts
  • test/pages/route_localization.test.ts

Walkthrough

Localization now exposes route traversal through an onLocalize callback. A route resource collector converts those observations into localized paths, locale mappings, reverse mappings, and disabled paths. Page generation emits the new resource shape, runtime matching consumes the new path sets, and obsolete route-analysis post-processing exports and srcPaths data are removed. Tests switch to the pure resolver and add coverage for resource collection scenarios.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main refactor: deriving route resources during route localization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/route-resources-collection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BobbieGoede
BobbieGoede merged commit 1d37825 into main Jul 19, 2026
11 checks passed
@BobbieGoede
BobbieGoede deleted the refactor/route-resources-collection branch July 19, 2026 14:56
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.

1 participant