Add support for catalog references in peer dependencies
What's the problem this PR addresses?
Fixes: https://github.com/yarnpkg/berry/issues/6925
Adds support for catalog: protocol in peerDependencies. Previously, catalog references in peer dependencies were incorrectly reported. This change allows catalog references to be used in peer
dependencies, consistent with their support in other dependency types.
...
How did you fix it?
Updated the dependency range validation logic in Manifest.ts to treat catalog: protocol as a valid range format. This prevents catalog references from being
flagged as errors when used in peer dependencies.
...
Checklist
- [x] I have read the Contributing Guide.
- [x] I have set the packages that need to be released for my changes to be effective.
- [x] I will check that all automated PR checks pass before the PR gets reviewed.
Hi, any update on this one would be nice to use also catalog references inside the peerDeps. 🙏🏻
I'm not certain that's correct - afaik the reduceDependency hook we use to apply catalog updates doesn't iterate over peerDependencies, so we'd always keep the catalog: range in the peerDependencies field rather than replacing it.
I'm not certain that's correct - afaik the reduceDependency hook we use to apply catalog updates doesn't iterate over peerDependencies, so we'd always keep the catalog: range in the peerDependencies field rather than replacing it.
I'm not very familiar with reduceDependency, do you think the fundamental solution would be to fix reduceDependency so that it iterates over peerDependencies as well?
That would be a breaking change, as 3rd-party plugins would have their behavior changed in hard-to-predict ways.
Probably the safest is to introduce a reducePeerDependency hook here and here. I'm a little worried about the potential perf impact but it's worth a shot.
Hey, still looking forward to get catalog ranges enabled for peerDependencies. @WooWan please let me know if you can finished it otherwise I would offer some help.
I've been busy and haven't been able to get to the PR. I'll work on it by next weekend! @MKruschke