Skip to content

Conversation

@webJose
Copy link
Contributor

@webJose webJose commented Nov 23, 2025

Closes #75.

BREAKING CHANGE
@webJose webJose requested a review from Copilot November 23, 2025 20:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a URL redirection feature to the library, allowing users to route from deprecated URLs to new URLs, including cross-routing-universe redirections. The implementation adds a new Redirector class that leverages the existing routing engine's pattern matching capabilities.

Key Changes:

  • Added Redirector class for reactive URL redirection with support for pattern matching and cross-universe navigation
  • Refactored routing helper functions into a new RouteHelper class to enable code reuse between RouterEngine and Redirector
  • Extended the type system with RedirectedRouteInfo and BuildHrefOptions to support redirection functionality
  • Added utility functions buildHref and calculateMultiHashFragment for constructing complex cross-universe redirect URLs

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib/types.ts Added new types for redirection (RedirectedRouteInfo, BuildHrefOptions) and exposed Location.path property
src/lib/kernel/RouteHelper.svelte.ts Extracted route parsing and testing logic from RouterEngine into reusable RouteHelper class
src/lib/kernel/Redirector.svelte.ts New Redirector class implementing reactive URL redirection with pattern matching
src/lib/kernel/buildHref.ts New utility to combine path and hash pieces from different URLs with query parameter merging
src/lib/kernel/calculateMultiHashFragment.ts New utility to calculate multi-hash fragments while preserving/updating existing paths
src/lib/kernel/preserveQuery.ts Added overload to mergeQueryParams for merging two URLSearchParams directly
src/lib/kernel/LocationLite.svelte.ts Added path property implementation (sanitizes Windows file: URLs)
src/lib/kernel/RouterEngine.svelte.ts Refactored to use RouteHelper class, removed duplicate code
src/lib/index.ts Exported new Redirector class
README.md Added documentation for URL redirection feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@webJose webJose requested a review from Copilot November 23, 2025 21:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@webJose webJose merged commit f5be942 into main Nov 23, 2025
1 check passed
@webJose webJose deleted the JP/redirector branch November 23, 2025 21:26
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.

Add the ability to redirect

2 participants