@graphql-codegen/client-preset 5.1.3 → 5.2.0
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.
- package/cjs/fragment-masking-plugin.js +7 -2
- package/cjs/index.js +7 -2
- package/esm/fragment-masking-plugin.js +7 -2
- package/esm/index.js +7 -2
- package/package.json +7 -7
- package/typings/fragment-masking-plugin.d.cts +2 -1
- package/typings/fragment-masking-plugin.d.ts +2 -1
- package/typings/index.d.cts +1 -1
- package/typings/index.d.ts +1 -1
|
@@ -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${
|
|
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 typescriptPlugin = tslib_1.__importStar(require("@graphql-codegen/typescript"));
|
|
9
10
|
const typescriptOperationPlugin = tslib_1.__importStar(require("@graphql-codegen/typescript-operations"));
|
|
@@ -142,6 +143,10 @@ exports.preset = {
|
|
|
142
143
|
inlineFragmentTypes: isMaskingFragments ? 'mask' : options.config['inlineFragmentTypes'],
|
|
143
144
|
};
|
|
144
145
|
let fragmentMaskingFileGenerateConfig = null;
|
|
146
|
+
const importExtension = (0, plugin_helpers_1.normalizeImportExtension)({
|
|
147
|
+
emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
|
|
148
|
+
importExtension: options.config.importExtension,
|
|
149
|
+
});
|
|
145
150
|
if (isMaskingFragments === true) {
|
|
146
151
|
const fragmentMaskingArtifactFileExtension = '.ts';
|
|
147
152
|
reexports.push('fragment-masking');
|
|
@@ -162,6 +167,7 @@ exports.preset = {
|
|
|
162
167
|
useTypeImports: options.config.useTypeImports,
|
|
163
168
|
unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName,
|
|
164
169
|
emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
|
|
170
|
+
importExtension,
|
|
165
171
|
isStringDocumentMode: options.config.documentMode === visitor_plugin_common_1.DocumentMode.string,
|
|
166
172
|
},
|
|
167
173
|
documents: [],
|
|
@@ -169,7 +175,6 @@ exports.preset = {
|
|
|
169
175
|
};
|
|
170
176
|
}
|
|
171
177
|
let indexFileGenerateConfig = null;
|
|
172
|
-
const reexportsExtension = options.config.emitLegacyCommonJSImports ? '' : '.js';
|
|
173
178
|
if (reexports.length) {
|
|
174
179
|
indexFileGenerateConfig = {
|
|
175
180
|
filename: `${options.baseOutputDir}index.ts`,
|
|
@@ -181,7 +186,7 @@ exports.preset = {
|
|
|
181
186
|
[`add`]: {
|
|
182
187
|
content: reexports
|
|
183
188
|
.sort()
|
|
184
|
-
.map(moduleName => `export * from "./${moduleName}${
|
|
189
|
+
.map(moduleName => `export * from "./${moduleName}${importExtension}";`)
|
|
185
190
|
.join('\n'),
|
|
186
191
|
},
|
|
187
192
|
},
|
|
@@ -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${
|
|
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 typescriptPlugin from '@graphql-codegen/typescript';
|
|
5
6
|
import * as typescriptOperationPlugin from '@graphql-codegen/typescript-operations';
|
|
@@ -137,6 +138,10 @@ export const preset = {
|
|
|
137
138
|
inlineFragmentTypes: isMaskingFragments ? 'mask' : options.config['inlineFragmentTypes'],
|
|
138
139
|
};
|
|
139
140
|
let fragmentMaskingFileGenerateConfig = null;
|
|
141
|
+
const importExtension = normalizeImportExtension({
|
|
142
|
+
emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
|
|
143
|
+
importExtension: options.config.importExtension,
|
|
144
|
+
});
|
|
140
145
|
if (isMaskingFragments === true) {
|
|
141
146
|
const fragmentMaskingArtifactFileExtension = '.ts';
|
|
142
147
|
reexports.push('fragment-masking');
|
|
@@ -157,6 +162,7 @@ export const preset = {
|
|
|
157
162
|
useTypeImports: options.config.useTypeImports,
|
|
158
163
|
unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName,
|
|
159
164
|
emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports,
|
|
165
|
+
importExtension,
|
|
160
166
|
isStringDocumentMode: options.config.documentMode === DocumentMode.string,
|
|
161
167
|
},
|
|
162
168
|
documents: [],
|
|
@@ -164,7 +170,6 @@ export const preset = {
|
|
|
164
170
|
};
|
|
165
171
|
}
|
|
166
172
|
let indexFileGenerateConfig = null;
|
|
167
|
-
const reexportsExtension = options.config.emitLegacyCommonJSImports ? '' : '.js';
|
|
168
173
|
if (reexports.length) {
|
|
169
174
|
indexFileGenerateConfig = {
|
|
170
175
|
filename: `${options.baseOutputDir}index.ts`,
|
|
@@ -176,7 +181,7 @@ export const preset = {
|
|
|
176
181
|
[`add`]: {
|
|
177
182
|
content: reexports
|
|
178
183
|
.sort()
|
|
179
|
-
.map(moduleName => `export * from "./${moduleName}${
|
|
184
|
+
.map(moduleName => `export * from "./${moduleName}${importExtension}";`)
|
|
180
185
|
.join('\n'),
|
|
181
186
|
},
|
|
182
187
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/client-preset",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
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.
|
|
19
|
-
"@graphql-codegen/typescript": "^5.0.
|
|
20
|
-
"@graphql-codegen/typescript-operations": "^5.0.
|
|
21
|
-
"@graphql-codegen/gql-tag-operations": "5.0
|
|
22
|
-
"@graphql-codegen/plugin-helpers": "^6.
|
|
23
|
-
"@graphql-codegen/visitor-plugin-common": "^6.
|
|
18
|
+
"@graphql-codegen/typed-document-node": "^6.1.3",
|
|
19
|
+
"@graphql-codegen/typescript": "^5.0.5",
|
|
20
|
+
"@graphql-codegen/typescript-operations": "^5.0.5",
|
|
21
|
+
"@graphql-codegen/gql-tag-operations": "5.1.0",
|
|
22
|
+
"@graphql-codegen/plugin-helpers": "^6.1.0",
|
|
23
|
+
"@graphql-codegen/visitor-plugin-common": "^6.2.0",
|
|
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
|
|
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
|
|
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
|
}>;
|
package/typings/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
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 = {
|
package/typings/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
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 = {
|