Skip to content
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

feat(router): expose event.context.matchedRoute #500

Merged
merged 9 commits into from
Aug 8, 2023

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Aug 8, 2023

πŸ”— Linked issue

#499 499

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds event.context.matchedRoute parameter which provides details of the route that the router matched on.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #500 (89027b9) into main (67055fb) will increase coverage by 0.36%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
+ Coverage   82.38%   82.74%   +0.36%     
==========================================
  Files          31       31              
  Lines        3508     3518      +10     
  Branches      522      528       +6     
==========================================
+ Hits         2890     2911      +21     
+ Misses        618      607      -11     
Files Changed Coverage Ξ”
src/router.ts 96.29% <100.00%> (ΓΈ)
src/types.ts 100.00% <100.00%> (ΓΈ)

... and 3 files with indirect coverage changes

@iainsproat iainsproat marked this pull request as ready for review August 8, 2023 14:21
src/router.ts Outdated Show resolved Hide resolved
src/router.ts Outdated Show resolved Hide resolved
@iainsproat iainsproat changed the title feat(router): add matchedPath parameter feat(router): add matchedPath parameter to event context Aug 8, 2023
@pi0 pi0 changed the title feat(router): add matchedPath parameter to event context feat(router): expose event.context.matchedRoute Aug 8, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks for pr and good explanations.

I have made some refactors to only expose it as event.context.matchedRotue? preserving all route match information including handlers. I hope you like it!

For now using as an advanced/experimental feature since there might be some underlying changes.

@pi0 pi0 merged commit 4fcb9c1 into unjs:main Aug 8, 2023
6 checks passed
@iainsproat iainsproat deleted the iain/pass-matched-path branch August 8, 2023 16:36
@pi0 pi0 mentioned this pull request Aug 14, 2023
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.

2 participants