-
Notifications
You must be signed in to change notification settings - Fork 116
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
Proof of concept for removing ConstantResolver and using Zeitwerk for ConstantDiscovery #410
base: main
Are you sure you want to change the base?
Conversation
spec.add_dependency("parallel") | ||
spec.add_dependency("sorbet-runtime", ">= 0.5.9914") | ||
spec.add_dependency("zeitwerk", ">= 2.6.1") | ||
spec.add_dependency("zeitwerk", ">= 2.6.14") |
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.
For usage of Zeitwerk::Loader#all_expected_cpaths
: https://github.com/fxn/zeitwerk/blob/main/CHANGELOG.md#2614-14-may-2024
I have signed the CLA! |
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.
For an easier to understand idea of the zeitwerk implementation, see this commit.
👋 We'd love if this got merged, it would give us a lot more flexibility in how we organize our files. |
What are you trying to accomplish?
I am interested in using Zeitwerk features such as collapsing directories however currently Packwerk doesn't support this.
Based on this comment in a related issue, this PR adds an implementation of
ConstantDiscovery
using Zeitwerk rather thanConstantResolver
as a proof of concept.What approach did you choose and why?
First I refactored to encapsulate
ConstantResolver
so it is easier for me to play with an alternateConstantDiscovery
implementation.Then I implemented a Zeitwerk based
ConstantDiscovery
and copied tests fromConstantDiscovery
and theConstantResolver
gem to make sure it worked ok. Private methods for matching constants from the map of paths was taken from ConstantResolver as well as many tests checking edge cases.Finally I replaced
ConstantDiscovery
with my version and removed the code related to the old implementation. A lot of test helpers needed to be updated here since nowConstantDiscovery
depends on Zeitwerk Loaders 😭What should reviewers focus on?
Type of Change
Checklist