From 11805c83c259258e27dd68cb8883b6691adcb6a4 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 9 May 2024 13:02:29 -0400 Subject: [PATCH] improve: remove needless deep imports into graphql This makes the library better prepared for future versions of `graphql` package. See: https://github.com/graphql/graphql-js/issues/4074 --- src/layers/5_client/client.returnMode.test-d.ts | 2 +- src/legacy/helpers/analyzeDocument.ts | 6 +++--- src/legacy/helpers/types.ts | 4 ++-- src/legacy/lib/graphql.ts | 2 +- src/lib/graphql.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/layers/5_client/client.returnMode.test-d.ts b/src/layers/5_client/client.returnMode.test-d.ts index 4563a9851..45effc644 100644 --- a/src/layers/5_client/client.returnMode.test-d.ts +++ b/src/layers/5_client/client.returnMode.test-d.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import { ExecutionResult } from 'graphql' -import { ObjMap } from 'graphql/jsutils/ObjMap.js' +import { type ObjMap } from 'graphql/jsutils/ObjMap.js' import { describe } from 'node:test' import { expectTypeOf, test } from 'vitest' import { Graffle } from '../../../tests/_/schema/generated/__.js' diff --git a/src/legacy/helpers/analyzeDocument.ts b/src/legacy/helpers/analyzeDocument.ts index 21a515a77..dcbde6ca5 100644 --- a/src/legacy/helpers/analyzeDocument.ts +++ b/src/legacy/helpers/analyzeDocument.ts @@ -6,9 +6,9 @@ import type { RequestDocument } from './types.js' * instead of the entire package (greater than 500KiB) where tree-shaking is not supported. * @see https://github.com/jasonkuhrt/graphql-request/pull/543 */ -import { type DocumentNode, OperationTypeNode } from 'graphql/language/ast.js' -import { parse } from 'graphql/language/parser.js' -import { print } from 'graphql/language/printer.js' +import { type DocumentNode, OperationTypeNode } from 'graphql' +import { parse } from 'graphql' +import { print } from 'graphql' /** * helpers diff --git a/src/legacy/helpers/types.ts b/src/legacy/helpers/types.ts index 44cea36e7..e0082d185 100644 --- a/src/legacy/helpers/types.ts +++ b/src/legacy/helpers/types.ts @@ -1,6 +1,6 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core' -import type { GraphQLError } from 'graphql/error/GraphQLError.js' -import type { DocumentNode } from 'graphql/language/ast.js' +import type { GraphQLError } from 'graphql' +import type { DocumentNode } from 'graphql' import type { MaybeLazy, MaybePromise, RemoveIndex } from '../../lib/prelude.js' import type { ClientError } from '../classes/ClientError.js' diff --git a/src/legacy/lib/graphql.ts b/src/legacy/lib/graphql.ts index 105731d7a..da77491cf 100644 --- a/src/legacy/lib/graphql.ts +++ b/src/legacy/lib/graphql.ts @@ -6,7 +6,7 @@ import { isPlainObject } from '../../lib/prelude.js' * instead of the entire package (greater than 500KiB) where tree-shaking is not supported. * @see https://github.com/jasonkuhrt/graphql-request/pull/543 */ -import type { OperationDefinitionNode } from 'graphql/language/ast.js' +import type { OperationDefinitionNode } from 'graphql' /** * Clean a GraphQL document to send it via a GET query diff --git a/src/lib/graphql.ts b/src/lib/graphql.ts index b6ff397aa..f612979bd 100644 --- a/src/lib/graphql.ts +++ b/src/lib/graphql.ts @@ -11,7 +11,7 @@ import { isListType, isNonNullType, } from 'graphql' -import type { ObjMap } from 'graphql/jsutils/ObjMap.js' +import type { ObjMap } from 'graphql' import type { Errors } from './errors/__.js' export type TypeMapByKind =