-
Notifications
You must be signed in to change notification settings - Fork 140
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: use internal trees for prettyPrint #321
Conversation
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.
LGTM.
Just some advice on document changes.
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.
lgtm
Co-authored-by: KaKa <kaka@kakawebsitedemo.com>
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.
Could you open a PR against fastify linking this branch to see the changes?
test/pretty-print.test.js
Outdated
└── /:hello (GET) | ||
/:hello (PUT) |
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.
Wasn't the GET,PUT collapse good?
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.
It's doable, but Idk if it's a good idea. For me, it's more clear when each line/branch represents each node. But I'm the wrong person to ask as I don't use pretty print at all.
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.
done
@Eomm related PR in the Fastify: fastify/fastify#4618 |
This fixes tests related to a recent `find-my-way` release. The relevant change is: delvedor/find-my-way#321
This fixes tests related to a recent `find-my-way` release. The relevant change is: delvedor/find-my-way#321
Fix: #315, #316, #271, #82
Problem:
prettyPrint
builds trees from scratch with a different algorithm. You can't use it for debugging and you always need to keep real trees and printed trees synced. It's literally another small router nested into the big one.Solution: don't emulate the trees. I added a new option to the
prettyPrint
function:method
. If you pass it, fmw will print you an internal tree. If you don't pass it, fmw will create a new router, merge all trees with a constraint hack, and will print the merged tree.The logic of
commonPrefix: false
will be a little bit different.+ a lot of bug fixing, refactoring
❗ It will require regenerating prettyPrint tests in Fastify. Mostly because of bug fixing.
cc @climba03003 @Eomm @mcollina