diff --git a/.changeset/cool-dolphins-clean.md b/.changeset/cool-dolphins-clean.md new file mode 100644 index 00000000..32539847 --- /dev/null +++ b/.changeset/cool-dolphins-clean.md @@ -0,0 +1,6 @@ +--- +"gql.tada": patch +"@gql.tada/cli-utils": patch +--- + +Fix `turbo` command reusing previously cached turbo typings. Instead, we now set a flag to disable the cache temporarily inside the command. diff --git a/packages/cli-utils/src/commands/turbo/thread.ts b/packages/cli-utils/src/commands/turbo/thread.ts index 17283aa5..b97a4bc3 100644 --- a/packages/cli-utils/src/commands/turbo/thread.ts +++ b/packages/cli-utils/src/commands/turbo/thread.ts @@ -1,5 +1,5 @@ import * as path from 'node:path'; -import { Project, TypeFormatFlags, TypeFlags, ts } from 'ts-morph'; +import { Project, TypeFormatFlags, TypeFlags, ScriptKind, ts } from 'ts-morph'; import type { GraphQLSPConfig } from '@gql.tada/internal'; import { init } from '@0no-co/graphqlsp/api'; @@ -19,8 +19,19 @@ async function* _runTurbo(params: TurboParams): AsyncIterableIterator { @@ -34,6 +45,7 @@ async function* _runTurbo(params: TurboParams): AsyncIterableIterator = {}; @@ -87,6 +99,15 @@ const BUILDER_FLAGS: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.WriteTypeArgumentsOfSignature; +const DECLARATION_OVERRIDE = ` +import * as _gqlTada from 'gql.tada'; +declare module 'gql.tada' { + interface setupCache { + readonly __cacheDisabled: true; + } +} +`.trim(); + function findAllCallExpressions( sourceFile: ts.SourceFile, config: GraphQLSPConfig diff --git a/src/api.ts b/src/api.ts index 7e459664..bfb21ce5 100644 --- a/src/api.ts +++ b/src/api.ts @@ -85,6 +85,7 @@ interface setupSchema extends AbstractSetupSchema { } interface AbstractSetupCache { + readonly __cacheDisabled: unknown; [key: string]: unknown; } @@ -134,7 +135,14 @@ interface GraphQLTadaAPI, + Schema, + getFragmentsOfDocuments, + Config['isMaskingDisabled'] + > : getDocumentNode< parseDocument, Schema,