-
Notifications
You must be signed in to change notification settings - Fork 352
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: add hook modifyRoutes
#3459
Conversation
🦋 Changeset detectedLatest commit: d1fa3b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 213 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3459 +/- ##
==========================================
+ Coverage 57.59% 57.97% +0.37%
==========================================
Files 672 669 -3
Lines 17794 17735 -59
Branches 3876 3859 -17
==========================================
+ Hits 10249 10282 +33
+ Misses 6934 6846 -88
+ Partials 611 607 -4
... and 78 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
5fa56f9
to
579ca19
Compare
579ca19
to
d6699ce
Compare
Summary
🤖 Generated by Copilot at a3090c0
This pull request adds a new hook
modifyRoutes
to the router plugin of@modern-js/runtime
, which allows modifying the routes array before rendering on both the server and the client side. It also updates the changeset file and the Chinese translation accordingly.Details
🤖 Generated by Copilot at a3090c0
modifyRoutes
hook to@modern-js/runtime
package to allow modifying the routes array before rendering (link, link, link, link, link, link, link, link)modifyRoutes
hook inhooks.ts
usingcreateWaterfall
utility from@modern-js/plugin
(link)modifyRoutes
hook inplugin.node.tsx
andplugin.tsx
, which are the entry points for the server-side and client-side rendering of the router plugin, respectively (link, link)modifyRoutes
hook with the plugin API using theregisterHook
property of therouterPlugin
object in both files (link, link)useHookRunners
method from the plugin API to create arunner
object that can execute the registered hooks in both files (link, link)runner.modifyRoutes
method to apply the hook to theroutes
array before passing it to therenderRoutes
function fromreact-router-config
inplugin.node.tsx
, or to theRouter
component fromreact-router-dom
inplugin.tsx
(link, link)modifyRoutes
hook feature in changeset file (link)Related Issue
Checklist
pnpm run change
.