Implements peerDependenciesMeta #224
This diff implements the
What is it?
This field provides a way to package authors to disable the peer dependency warnings for packages that may be needed for some integrations, but only affect a subset of the users and aren't worth printing a warning to all.
Why implement it this way?
The rfc can be read for more details on why this syntax and not another; it's worth noting that both Yarn and pnpm (cc @zkochan) have been supporting this field for about half a year now.
Why is it important?
Why is it broken not to list peer dependencies?
It's convoluted, click to expand
This seems fine to me. In an ideal world, we would've maybe done
I think we can get this into 6.11. There'll probably be at least one or two more bug fix releases on 6.10 before then. If you feel motivated to send a PR to npm-registry-mock to add the optional peer dep fixture, that'd be great, but if not, I'll get to it when it's time to land.
This section of the code is all going away in v7, but I'll make sure to work the peerDependenciesMeta support into arborist. (In npm v7, peerDeps will be installed, and it'll enforce the constraint that they are not allowed nested under the package that peer depends on them, so hopefully we'll see fewer cases where they're unlisted due to the warnings.)
Sounds good - I've opened a PR at npm/npm-registry-mock#34
For the record, we also have a
Do you have an rfc / design document? It sounds like a significant change - many packages have what are essentially optional peer dependencies, and them being automatically installed may have adverse size or behavioural effects. Maybe it would make sense to instead make this opt-in by adding a
Ahhh, duh. I think I know what's happening here. The
I think the cli is doing the right thing, and this is a server-side fix.
Do you have an example handy of a package with this field set, so I can point them to it?