From 9e838baff4d1e4c6bc4e4a60e9027de49de66372 Mon Sep 17 00:00:00 2001 From: Shimpei Otsubo Date: Sat, 12 Nov 2022 18:34:28 +0900 Subject: [PATCH] Not to bind core for connectionPlugin --- src/plugins/connectionPlugin.ts | 2 +- src/typegenPrinter.ts | 6 ++---- tests/integrations/kitchenSink/__typegen.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/connectionPlugin.ts b/src/plugins/connectionPlugin.ts index d642c06b..400b6690 100644 --- a/src/plugins/connectionPlugin.ts +++ b/src/plugins/connectionPlugin.ts @@ -408,7 +408,7 @@ export const connectionPlugin = (connectionPluginConfig?: ConnectionPluginConfig fieldDefTypes: [ printedGenTypingImport({ module: connectionPluginConfig?.nexusSchemaImportId ?? getOwnPackage().name, - bindings: ['core', 'connectionPluginCore'], + bindings: ['connectionPluginCore'], }), ], // Defines the field added to the definition block: diff --git a/src/typegenPrinter.ts b/src/typegenPrinter.ts index b71b52f6..54197728 100644 --- a/src/typegenPrinter.ts +++ b/src/typegenPrinter.ts @@ -255,11 +255,8 @@ export class TypegenPrinter { const imports: string[] = [] const importMap: Record> = {} const outputPath = this.typegenInfo.typegenPath - const nexusSchemaImportId = this.typegenInfo.nexusSchemaImportId ?? getOwnPackage().name - if (!this.printImports[nexusSchemaImportId]) { - this.maybeAddCoreImport(forGlobal) - } + this.maybeAddCoreImport(forGlobal) if (!forGlobal) { if (contextTypeImport) { @@ -320,6 +317,7 @@ export class TypegenPrinter { if (shouldAdd) { this.printImports[nexusSchemaImportId] = { + ...this.printImports[nexusSchemaImportId], core: true, } } diff --git a/tests/integrations/kitchenSink/__typegen.ts b/tests/integrations/kitchenSink/__typegen.ts index b4b63d5d..301da34f 100644 --- a/tests/integrations/kitchenSink/__typegen.ts +++ b/tests/integrations/kitchenSink/__typegen.ts @@ -3,7 +3,7 @@ * Do not make changes to this file directly */ -import type { core, connectionPluginCore } from '../../../src' +import type { connectionPluginCore, core } from '../../../src' declare global { interface NexusGenCustomInputMethods { /**