-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: rewrite library #107
Merged
Merged
Conversation
This file contains 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
This was referenced Jul 4, 2024
1 task
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.
This PR rewrites (almost) whole lib from scratch to resolve fundamental issues from the previous/initial version.
Note: As part of this migration, library is being renamed to
rou3
. (#108)New tree implementation
A new trie (which is not radix!) is used solve complex scenarios such as #96 and #103 and also allows proper tree DFS search.
New param matching
Previously we were matching params during tree-traverse which was wrong! Because we were not accounting for difference placeholder names from overlapping patterns. This is now done in last step.
Composable utils
The
createRouter
utility now returns a context instead of object with bound params. The benefit is that we can highly treeshake and optimize final bundle and only import what is needed.Small behavior changes
Small behavior changes happened particularly for matchAll util.
Native method matching
In radix3, we were using an object in payload to handle methods. This mainly lacks supporting overlaping routes and in h3 we had to workaround using a second matcher! Native method support allow tree searching with fallback.
Benchmarks added
Added new benchmarks that compares to other routers more fairly. Mainly this benchmark makes such to combine all different patterns and also make sure all implementations involve param matching!
~> https://github.com/unjs/rou3/tree/main/benchmark#results