@graphql-codegen/client-preset 6.0.0-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5 → 6.0.0-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.plugin = void 0;
4
+ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
4
5
  const fragmentTypeHelper = `
5
6
  export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
6
7
  infer TType,
@@ -111,9 +112,13 @@ export function isFragmentReady<TQuery, TFrag>(
111
112
  /**
112
113
  * Plugin for generating fragment masking helper functions.
113
114
  */
114
- const plugin = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, isStringDocumentMode }, _info) => {
115
+ const plugin = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, importExtension, isStringDocumentMode, }, _info) => {
116
+ const appendedImportExtension = (0, plugin_helpers_1.normalizeImportExtension)({
117
+ emitLegacyCommonJSImports,
118
+ importExtension,
119
+ });
115
120
  const documentNodeImport = `${useTypeImports ? 'import type' : 'import'} { ResultOf, DocumentTypeDecoration${isStringDocumentMode ? '' : ', TypedDocumentNode'} } from '@graphql-typed-document-node/core';\n`;
116
- const deferFragmentHelperImports = `${useTypeImports ? 'import type' : 'import'} { Incremental${isStringDocumentMode ? ', TypedDocumentString' : ''} } from './graphql${emitLegacyCommonJSImports ? '' : '.js'}';\n`;
121
+ const deferFragmentHelperImports = `${useTypeImports ? 'import type' : 'import'} { Incremental${isStringDocumentMode ? ', TypedDocumentString' : ''} } from './graphql${appendedImportExtension}';\n`;
117
122
  const fragmentDefinitionNodeImport = isStringDocumentMode
118
123
  ? ''
119
124
  : `${useTypeImports ? 'import type' : 'import'} { FragmentDefinitionNode } from 'graphql';\n`;
package/cjs/index.js CHANGED
@@ -4,6 +4,7 @@ exports.addTypenameSelectionDocumentTransform = exports.preset = exports.babelOp
4
4
  const tslib_1 = require("tslib");
5
5
  const addPlugin = tslib_1.__importStar(require("@graphql-codegen/add"));
6
6
  const gqlTagPlugin = tslib_1.__importStar(require("@graphql-codegen/gql-tag-operations"));
7
+ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
7
8
  const typedDocumentNodePlugin = tslib_1.__importStar(require("@graphql-codegen/typed-document-node"));
8
9
  const typescriptOperationPlugin = tslib_1.__importStar(require("@graphql-codegen/typescript-operations"));
9
10
  const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
@@ -131,6 +132,10 @@ exports.preset = {
131
132
  inlineFragmentTypes: isMaskingFragments ? 'mask' : options.config['inlineFragmentTypes'],
132
133
  };
133
134
  let fragmentMaskingFileGenerateConfig = null;
135
+ const importExtension = (0, plugin_helpers_1.normalizeImportExtension)({
136
+ emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
137
+ importExtension: options.config.importExtension,
138
+ });
134
139
  if (isMaskingFragments === true) {
135
140
  const fragmentMaskingArtifactFileExtension = '.ts';
136
141
  reexports.push('fragment-masking');
@@ -151,6 +156,7 @@ exports.preset = {
151
156
  useTypeImports: options.config.useTypeImports,
152
157
  unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName,
153
158
  emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
159
+ importExtension,
154
160
  isStringDocumentMode: options.config.documentMode === visitor_plugin_common_1.DocumentMode.string,
155
161
  },
156
162
  documents: [],
@@ -158,7 +164,6 @@ exports.preset = {
158
164
  };
159
165
  }
160
166
  let indexFileGenerateConfig = null;
161
- const reexportsExtension = options.config.emitLegacyCommonJSImports ? '' : '.js';
162
167
  if (reexports.length) {
163
168
  indexFileGenerateConfig = {
164
169
  filename: `${options.baseOutputDir}index.ts`,
@@ -170,7 +175,7 @@ exports.preset = {
170
175
  [`add`]: {
171
176
  content: reexports
172
177
  .sort()
173
- .map(moduleName => `export * from "./${moduleName}${reexportsExtension}";`)
178
+ .map(moduleName => `export * from "./${moduleName}${importExtension}";`)
174
179
  .join('\n'),
175
180
  },
176
181
  },
@@ -1,3 +1,4 @@
1
+ import { normalizeImportExtension } from '@graphql-codegen/plugin-helpers';
1
2
  const fragmentTypeHelper = `
2
3
  export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
3
4
  infer TType,
@@ -108,9 +109,13 @@ export function isFragmentReady<TQuery, TFrag>(
108
109
  /**
109
110
  * Plugin for generating fragment masking helper functions.
110
111
  */
111
- export const plugin = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, isStringDocumentMode }, _info) => {
112
+ export const plugin = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, importExtension, isStringDocumentMode, }, _info) => {
113
+ const appendedImportExtension = normalizeImportExtension({
114
+ emitLegacyCommonJSImports,
115
+ importExtension,
116
+ });
112
117
  const documentNodeImport = `${useTypeImports ? 'import type' : 'import'} { ResultOf, DocumentTypeDecoration${isStringDocumentMode ? '' : ', TypedDocumentNode'} } from '@graphql-typed-document-node/core';\n`;
113
- const deferFragmentHelperImports = `${useTypeImports ? 'import type' : 'import'} { Incremental${isStringDocumentMode ? ', TypedDocumentString' : ''} } from './graphql${emitLegacyCommonJSImports ? '' : '.js'}';\n`;
118
+ const deferFragmentHelperImports = `${useTypeImports ? 'import type' : 'import'} { Incremental${isStringDocumentMode ? ', TypedDocumentString' : ''} } from './graphql${appendedImportExtension}';\n`;
114
119
  const fragmentDefinitionNodeImport = isStringDocumentMode
115
120
  ? ''
116
121
  : `${useTypeImports ? 'import type' : 'import'} { FragmentDefinitionNode } from 'graphql';\n`;
package/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as addPlugin from '@graphql-codegen/add';
2
2
  import * as gqlTagPlugin from '@graphql-codegen/gql-tag-operations';
3
+ import { normalizeImportExtension } from '@graphql-codegen/plugin-helpers';
3
4
  import * as typedDocumentNodePlugin from '@graphql-codegen/typed-document-node';
4
5
  import * as typescriptOperationPlugin from '@graphql-codegen/typescript-operations';
5
6
  import { ClientSideBaseVisitor, DocumentMode } from '@graphql-codegen/visitor-plugin-common';
@@ -126,6 +127,10 @@ export const preset = {
126
127
  inlineFragmentTypes: isMaskingFragments ? 'mask' : options.config['inlineFragmentTypes'],
127
128
  };
128
129
  let fragmentMaskingFileGenerateConfig = null;
130
+ const importExtension = normalizeImportExtension({
131
+ emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
132
+ importExtension: options.config.importExtension,
133
+ });
129
134
  if (isMaskingFragments === true) {
130
135
  const fragmentMaskingArtifactFileExtension = '.ts';
131
136
  reexports.push('fragment-masking');
@@ -146,6 +151,7 @@ export const preset = {
146
151
  useTypeImports: options.config.useTypeImports,
147
152
  unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName,
148
153
  emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
154
+ importExtension,
149
155
  isStringDocumentMode: options.config.documentMode === DocumentMode.string,
150
156
  },
151
157
  documents: [],
@@ -153,7 +159,6 @@ export const preset = {
153
159
  };
154
160
  }
155
161
  let indexFileGenerateConfig = null;
156
- const reexportsExtension = options.config.emitLegacyCommonJSImports ? '' : '.js';
157
162
  if (reexports.length) {
158
163
  indexFileGenerateConfig = {
159
164
  filename: `${options.baseOutputDir}index.ts`,
@@ -165,7 +170,7 @@ export const preset = {
165
170
  [`add`]: {
166
171
  content: reexports
167
172
  .sort()
168
- .map(moduleName => `export * from "./${moduleName}${reexportsExtension}";`)
173
+ .map(moduleName => `export * from "./${moduleName}${importExtension}";`)
169
174
  .join('\n'),
170
175
  },
171
176
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/client-preset",
3
- "version": "6.0.0-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
3
+ "version": "6.0.0-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
4
4
  "description": "GraphQL Code Generator preset for client.",
5
5
  "peerDependenciesMeta": {
6
6
  "graphql-sock": {
@@ -15,12 +15,12 @@
15
15
  "@babel/helper-plugin-utils": "^7.20.2",
16
16
  "@babel/template": "^7.20.7",
17
17
  "@graphql-codegen/add": "^6.0.0",
18
- "@graphql-codegen/typed-document-node": "6.1.3-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
19
- "@graphql-codegen/typescript": "6.0.0-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
20
- "@graphql-codegen/typescript-operations": "6.0.0-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
21
- "@graphql-codegen/gql-tag-operations": "5.0.6-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
22
- "@graphql-codegen/plugin-helpers": "^6.0.0",
23
- "@graphql-codegen/visitor-plugin-common": "7.0.0-alpha-20260105125118-f6dd8aad76b522a60a52fee9cc56d3e46fc3c9a5",
18
+ "@graphql-codegen/typed-document-node": "6.1.6-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
19
+ "@graphql-codegen/typescript": "6.0.0-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
20
+ "@graphql-codegen/typescript-operations": "6.0.0-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
21
+ "@graphql-codegen/gql-tag-operations": "5.1.3-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
22
+ "@graphql-codegen/plugin-helpers": "^6.1.0",
23
+ "@graphql-codegen/visitor-plugin-common": "7.0.0-alpha-20260106134001-96cfbeda34da3ef03f382f529dae5d10a950b657",
24
24
  "@graphql-typed-document-node/core": "3.2.0",
25
25
  "@graphql-tools/documents": "^1.0.0",
26
26
  "@graphql-tools/utils": "^10.0.0",
@@ -1,4 +1,4 @@
1
- import type { PluginFunction } from '@graphql-codegen/plugin-helpers';
1
+ import { type PluginFunction } from '@graphql-codegen/plugin-helpers';
2
2
  /**
3
3
  * Plugin for generating fragment masking helper functions.
4
4
  */
@@ -7,5 +7,6 @@ export declare const plugin: PluginFunction<{
7
7
  augmentedModuleName?: string;
8
8
  unmaskFunctionName?: string;
9
9
  emitLegacyCommonJSImports?: boolean;
10
+ importExtension?: '' | `.${string}`;
10
11
  isStringDocumentMode?: boolean;
11
12
  }>;
@@ -1,4 +1,4 @@
1
- import type { PluginFunction } from '@graphql-codegen/plugin-helpers';
1
+ import { type PluginFunction } from '@graphql-codegen/plugin-helpers';
2
2
  /**
3
3
  * Plugin for generating fragment masking helper functions.
4
4
  */
@@ -7,5 +7,6 @@ export declare const plugin: PluginFunction<{
7
7
  augmentedModuleName?: string;
8
8
  unmaskFunctionName?: string;
9
9
  emitLegacyCommonJSImports?: boolean;
10
+ importExtension?: '' | `.${string}`;
10
11
  isStringDocumentMode?: boolean;
11
12
  }>;
@@ -1,4 +1,4 @@
1
- import type { Types } from '@graphql-codegen/plugin-helpers';
1
+ import { type Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { type DocumentNode } from 'graphql';
3
3
  export { default as babelOptimizerPlugin } from './babel.cjs';
4
4
  export type FragmentMaskingConfig = {
@@ -1,4 +1,4 @@
1
- import type { Types } from '@graphql-codegen/plugin-helpers';
1
+ import { type Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { type DocumentNode } from 'graphql';
3
3
  export { default as babelOptimizerPlugin } from './babel.js';
4
4
  export type FragmentMaskingConfig = {