patch: Mark @urql/core
as a peer as well as a regular dependency
#3579
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Originally (I reckon during the introduction of
@urql/core
), we decided to only include@urql/core
as a dependency, since it never is a direct dependency. This allowed it to install automatically and deduplicate as long as all ranges match.This wasn't ever a problem assuming deduplication was working (which it sometimes isn't in Yarn Legacy). However,
@urql/core
is only actively instantiated once in any given app. This means that for all exchanges it's only used to share types.Problems with this is though,
@urql/core
's types contain instances that TypeScript will always consider as incompatible if they're duplicated. This means that this approach stopped working for TypeScript.Summary
While we could provide shared global namespace types in
@urql/core
, which is my alternative proposal to solve this, we can also mark all dependencies on@urql/core
as peer dependencies now.Generally, peer dependencies install automatically with all package managers these days. But to keep backwards compatibility we can also keep
@urql/core
independencies
at the same time. This should simply prompt package managers to always deduplicate it.This PR also removes the
>=
range on it (although it's perfectly safe, this allows us to revamp some APIs in the next major of@urql/core
), and updates thegraphql
peer dependencySet of changes
@urql/core
dependencies to also be accompanied by a peer dependency@urql/core
ranges to^5.0.0
graphql
ranges to^15.0.0 || ^16.0.0 || ^17.0.0
(dropping0.x
ranges for peers)