-
Notifications
You must be signed in to change notification settings - Fork 138
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: new routing system runtime implementation and changes #206
feat: new routing system runtime implementation and changes #206
Conversation
🦋 Changeset detectedLatest commit: ba7a8fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
🧪 A prerelease is available for testing 🧪 You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4873321970/npm-package-next-on-pages-206 Or you can immediately run this with npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4873321970/npm-package-next-on-pages-206 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needless to say, very awesome stuff thanks a lot ❤️
First round of comments 🙏 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second round of comments 😅
@james-elicx I put there some comments regarding checkRouteMatch
and related, but I still need to double check things later and step through the function (just letting you know, the comments should still be valid regardless but I might put new ones if I notice that something isn't working as expected 🙂)
Note that I have just added a commit that fixes an issue where Since we were adding just the file name to the Instead, we need to add the relative path to the This does also have the other benefit of providing users with more useful information about which routes were invalid functions when printing an error about invalid functions. |
Co-authored-by: Dario Piotrowicz <[email protected]>
Co-authored-by: Dario Piotrowicz <[email protected]>
Co-authored-by: Dario Piotrowicz <[email protected]>
Co-authored-by: Dario Piotrowicz <[email protected]>
Fixes invalid routes not getting squashed by route paths. The relative path is needed in the `invalidFunctions` map so that when `tryToFixInvalidFunctions` is called, it is able to match the squashed path, instead of just the file name.
15dfd98
to
198a2eb
Compare
Co-authored-by: Dario Piotrowicz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff 🤩 🤩 🤩
Thanks so very much for this incredible effort/improvement ❤️
This PR does the following:
I know that we previously discussed doing 3 PRs, with the third PR being the one where the redundant build-time logic is removed and the routing system is enabled, however, Dario and I agreed that it would probably be best to do it in this PR instead.
Some of the functionality that this PR also introduces support for is as follows:
Overview of routing
none
phase.src
value for a match, and extracts the dynamic parameters.override
and reset the response status and headers if it existsmiddlewarePath
, calls the middleware function, and processes the response.headers
and adds them to the response.status
and sets the response status.dest
and updates the path for matching with the new destination, applying the dynamic parameters from earlier.check
if the path is not an external URL.miss
.none
phase.continue
to know if routing should continue.hit
phase or for URLs / redirects -> return the match.miss
phase -> update status and enterhit
phase to update headers.error
phase -> enterhit
phase to update headers.none
phase -> enterfilesystem
phase.filesystem
phase -> enterrewrite
phase.rewrite
phase -> enterresource
phase.resource
phase -> entermiss
phase.error
phase to find the custom error page.I have tested this with some of the apps I have, but I warmly welcome others to test the prerelease against their projects.
fixes #185
fixes #177
fixes #163
fixes #21
fixes #70
fixes #129