-
-
Notifications
You must be signed in to change notification settings - Fork 458
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
major(core/graphcache): Remove graphql imports by default #3097
Conversation
return code | ||
.replace(emptyImportRe, '') | ||
.replace(gqlImportRe, x => '/*!@ts-ignore*/\n' + x); |
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.
NOTE: This build change marks graphql
imports in out d.ts
typings files with a /*!@ts-ignore*/
pragma. While imports from graphql
will change to any
when the package isn’t installed, we still need to mark this in case a user has skipLibCheck: false
set in their tsconfig
export type DocumentInput< | ||
Result = { [key: string]: any }, | ||
Variables = { [key: string]: any } | ||
> = string | DocumentNode | TypedDocumentNode<Result, Variables>; |
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.
NOTE: This new type determines what we accept for query language inputs. However, TypedDocumentNode<any, any>
will also work instead of DocumentNode
in packages that depend on @urql/core
. Alternatively, even Exclude<DocumentInput<T, V>, string>
works
54f8df2
to
c8d6e2b
Compare
Resolves #3096
Summary
This removes
graphql
frompeerDependencies
on all packages.@urql/core
and@urql/exchange-graphcache
will now depend on@0no-co/graphql.web
instead and switch tographql
types dynamically where needed, and otherwise either accept@0no-co/graphql.web
’s types (which will also switch tographql
; See: 0no-co/graphql.web#10) or the nativegraphql
types.This effectively replaces all imports we use from
graphql
with smaller alternatives from@0no-co/graphql.web
by default as per the RFC at #3096.Set of changes
graphql
with@0no-co/graphql.web
@urql/core
which is marked with the/*!@ts-ignore*/
pragma in the type outputformatDocument
in@urql/core
with an implementation that avoids usingvisit
graphql
frompeerDependencies
in all packagesgraphql
usage in@urql/exchange-graphcache
and add shim types for schema