-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Normalizes dependencies #4305
Normalizes dependencies #4305
Conversation
What's preventing you from making it a |
Nothing technically speaking, it's more a matter of semantics. Since with this diff the dependencies are "static" for a same resolver, I feel like it makes more sense to use an object and let resolver functions use e.g. destructuring, than having to go through the Using a map would be more backward compatible, but given that I'm changing a few other things in resolvers' interfaces anyway (like |
I think this change has caused some weirdness with peer dependency validation:
The First of all this is clearly incorrect, and also it does not seem to be fully normalized. Shouldn't both be |
Peer dependencies aren't supposed to go through this normalization, because they only support Semver ranges (the define compatible versions, not the source from which those versions must be obtained) 🤔 Do you have a minimal repro I can copy/paste? |
Did some more testing and it appears to be caused by
So these extensions seem to be normalized, when they shouldn't be? |
|
What's the problem this PR addresses?
Dependencies sometimes weren't normalized (with the
npm:
protocol), which made it difficult to know what input to expect in which place.How did you fix it?
All dependencies must now be normalized prior to being returned by resolvers or hooks. The configuration class now provides helpers to this effect.
I changed the dependencies format from a
Map<DescriptorHash, Descriptor>
to aRecord<string, Descriptor>
so that resolvers can modify the descriptor without changing its key in the map, which would prevent followup consumers from accessing the dependencies (an alternative would have been to use an oldDescriptorHash
with a newDescriptor
, but this seemed a confusing and bad idea).A compatibility layer in the lockfile should make the transition fairly painless from an end user point of view.
Checklist