@graphql-codegen/cli 7.4.3 → 7.4.4-alpha-20261001151715-e566a642e4f4d42e92ff305632d2928e6dd47854
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/codegen.js +1 -2
- package/cjs/config.js +7 -2
- package/cjs/init/questions.js +1 -1
- package/cjs/utils/patterns.js +2 -4
- package/cjs/version.js +1 -1
- package/esm/codegen.js +1 -2
- package/esm/config.js +7 -2
- package/esm/init/questions.js +1 -1
- package/esm/utils/patterns.js +2 -4
- package/esm/version.js +1 -1
- package/package.json +4 -4
- package/typings/config.d.cts +10 -6
- package/typings/config.d.ts +10 -6
- package/typings/utils/file-system.d.cts +1 -1
- package/typings/utils/file-system.d.ts +1 -1
package/cjs/codegen.js
CHANGED
|
@@ -167,7 +167,6 @@ async function executeCodegen(input) {
|
|
|
167
167
|
task: (ctx, task) => {
|
|
168
168
|
const generateTasks = Object.keys(generates).map(filename => {
|
|
169
169
|
const outputConfig = generates[filename];
|
|
170
|
-
const hasPreset = !!outputConfig.preset;
|
|
171
170
|
const title = `Generate to ${filename}`;
|
|
172
171
|
return {
|
|
173
172
|
title,
|
|
@@ -181,7 +180,7 @@ async function executeCodegen(input) {
|
|
|
181
180
|
let outputSpecificExternalDocuments = (0, plugin_helpers_1.normalizeInstanceOrArray)(outputConfig.externalDocuments);
|
|
182
181
|
let preset;
|
|
183
182
|
try {
|
|
184
|
-
preset =
|
|
183
|
+
preset = outputConfig.preset
|
|
185
184
|
? typeof outputConfig.preset === 'string'
|
|
186
185
|
? await (0, presets_js_1.getPresetByName)(outputConfig.preset, makeDefaultLoader(context.cwd))
|
|
187
186
|
: outputConfig.preset
|
package/cjs/config.js
CHANGED
|
@@ -116,7 +116,7 @@ async function loadContext(configFilePath) {
|
|
|
116
116
|
}
|
|
117
117
|
function getCustomConfigPath(cliFlags) {
|
|
118
118
|
const configFile = cliFlags.config;
|
|
119
|
-
return configFile ? (0, path_1.resolve)(process.cwd(), configFile) :
|
|
119
|
+
return configFile ? (0, path_1.resolve)(process.cwd(), configFile) : undefined;
|
|
120
120
|
}
|
|
121
121
|
function buildOptions() {
|
|
122
122
|
return {
|
|
@@ -290,7 +290,12 @@ class CodegenContext {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
else {
|
|
293
|
-
this.config = {
|
|
293
|
+
this.config = {
|
|
294
|
+
// This `generates: {}` is only to satisfy type safety: a context created without `config` still fails with codegen's missing "generates" error
|
|
295
|
+
generates: {},
|
|
296
|
+
...this._config,
|
|
297
|
+
pluginContext: this._pluginContext,
|
|
298
|
+
};
|
|
294
299
|
}
|
|
295
300
|
}
|
|
296
301
|
const config = {
|
package/cjs/init/questions.js
CHANGED
|
@@ -29,7 +29,7 @@ async function getAnswers(possibleTargets) {
|
|
|
29
29
|
default: getDocumentsDefaultValue(targets),
|
|
30
30
|
validate: str => str.length > 0,
|
|
31
31
|
});
|
|
32
|
-
let plugins;
|
|
32
|
+
let plugins = [];
|
|
33
33
|
if (!targets.includes(types_js_1.Tags.client)) {
|
|
34
34
|
plugins = await (0, prompts_1.checkbox)({
|
|
35
35
|
message: 'Pick plugins:',
|
package/cjs/utils/patterns.js
CHANGED
|
@@ -109,10 +109,8 @@ const makeGlobalPatternSet = (initialContext) => {
|
|
|
109
109
|
const config = initialContext.getConfig();
|
|
110
110
|
return {
|
|
111
111
|
watch: (0, exports.sortPatterns)([
|
|
112
|
-
...(typeof config.watch === 'boolean'
|
|
113
|
-
|
|
114
|
-
: (0, plugin_helpers_1.normalizeInstanceOrArray)(config.watch ?? [])),
|
|
115
|
-
(0, path_1.relative)(process.cwd(), initialContext.filepath),
|
|
112
|
+
...(typeof config.watch === 'boolean' ? [] : (0, plugin_helpers_1.normalizeInstanceOrArray)(config.watch)),
|
|
113
|
+
...(initialContext.filepath ? [(0, path_1.relative)(process.cwd(), initialContext.filepath)] : []),
|
|
116
114
|
]),
|
|
117
115
|
schemas: (0, exports.sortPatterns)(makePatternsFromSchemas((0, plugin_helpers_1.normalizeInstanceOrArray)(config.schema))),
|
|
118
116
|
documents: (0, exports.sortPatterns)(makePatternsFromDocuments((0, plugin_helpers_1.normalizeInstanceOrArray)(config.documents))),
|
package/cjs/version.js
CHANGED
package/esm/codegen.js
CHANGED
|
@@ -163,7 +163,6 @@ export async function executeCodegen(input) {
|
|
|
163
163
|
task: (ctx, task) => {
|
|
164
164
|
const generateTasks = Object.keys(generates).map(filename => {
|
|
165
165
|
const outputConfig = generates[filename];
|
|
166
|
-
const hasPreset = !!outputConfig.preset;
|
|
167
166
|
const title = `Generate to ${filename}`;
|
|
168
167
|
return {
|
|
169
168
|
title,
|
|
@@ -177,7 +176,7 @@ export async function executeCodegen(input) {
|
|
|
177
176
|
let outputSpecificExternalDocuments = normalizeInstanceOrArray(outputConfig.externalDocuments);
|
|
178
177
|
let preset;
|
|
179
178
|
try {
|
|
180
|
-
preset =
|
|
179
|
+
preset = outputConfig.preset
|
|
181
180
|
? typeof outputConfig.preset === 'string'
|
|
182
181
|
? await getPresetByName(outputConfig.preset, makeDefaultLoader(context.cwd))
|
|
183
182
|
: outputConfig.preset
|
package/esm/config.js
CHANGED
|
@@ -104,7 +104,7 @@ export async function loadContext(configFilePath) {
|
|
|
104
104
|
}
|
|
105
105
|
function getCustomConfigPath(cliFlags) {
|
|
106
106
|
const configFile = cliFlags.config;
|
|
107
|
-
return configFile ? resolve(process.cwd(), configFile) :
|
|
107
|
+
return configFile ? resolve(process.cwd(), configFile) : undefined;
|
|
108
108
|
}
|
|
109
109
|
export function buildOptions() {
|
|
110
110
|
return {
|
|
@@ -278,7 +278,12 @@ export class CodegenContext {
|
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
else {
|
|
281
|
-
this.config = {
|
|
281
|
+
this.config = {
|
|
282
|
+
// This `generates: {}` is only to satisfy type safety: a context created without `config` still fails with codegen's missing "generates" error
|
|
283
|
+
generates: {},
|
|
284
|
+
...this._config,
|
|
285
|
+
pluginContext: this._pluginContext,
|
|
286
|
+
};
|
|
282
287
|
}
|
|
283
288
|
}
|
|
284
289
|
const config = {
|
package/esm/init/questions.js
CHANGED
|
@@ -24,7 +24,7 @@ export async function getAnswers(possibleTargets) {
|
|
|
24
24
|
default: getDocumentsDefaultValue(targets),
|
|
25
25
|
validate: str => str.length > 0,
|
|
26
26
|
});
|
|
27
|
-
let plugins;
|
|
27
|
+
let plugins = [];
|
|
28
28
|
if (!targets.includes(Tags.client)) {
|
|
29
29
|
plugins = await checkbox({
|
|
30
30
|
message: 'Pick plugins:',
|
package/esm/utils/patterns.js
CHANGED
|
@@ -103,10 +103,8 @@ export const makeGlobalPatternSet = (initialContext) => {
|
|
|
103
103
|
const config = initialContext.getConfig();
|
|
104
104
|
return {
|
|
105
105
|
watch: sortPatterns([
|
|
106
|
-
...(typeof config.watch === 'boolean'
|
|
107
|
-
|
|
108
|
-
: normalizeInstanceOrArray(config.watch ?? [])),
|
|
109
|
-
relative(process.cwd(), initialContext.filepath),
|
|
106
|
+
...(typeof config.watch === 'boolean' ? [] : normalizeInstanceOrArray(config.watch)),
|
|
107
|
+
...(initialContext.filepath ? [relative(process.cwd(), initialContext.filepath)] : []),
|
|
110
108
|
]),
|
|
111
109
|
schemas: sortPatterns(makePatternsFromSchemas(normalizeInstanceOrArray(config.schema))),
|
|
112
110
|
documents: sortPatterns(makePatternsFromDocuments(normalizeInstanceOrArray(config.documents))),
|
package/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '7.4.
|
|
1
|
+
export const version = '7.4.4-alpha-20261001151715-e566a642e4f4d42e92ff305632d2928e6dd47854';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.4-alpha-20261001151715-e566a642e4f4d42e92ff305632d2928e6dd47854",
|
|
4
4
|
"peerDependenciesMeta": {
|
|
5
5
|
"@parcel/watcher": {
|
|
6
6
|
"optional": true
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"@babel/generator": "^7.18.13",
|
|
15
15
|
"@babel/template": "^7.18.10",
|
|
16
16
|
"@babel/types": "^7.18.13",
|
|
17
|
-
"@graphql-codegen/client-preset": "^6.2.
|
|
18
|
-
"@graphql-codegen/core": "^6.2.
|
|
19
|
-
"@graphql-codegen/plugin-helpers": "^7.
|
|
17
|
+
"@graphql-codegen/client-preset": "^6.2.1-alpha-20261001151715-e566a642e4f4d42e92ff305632d2928e6dd47854",
|
|
18
|
+
"@graphql-codegen/core": "^6.2.1",
|
|
19
|
+
"@graphql-codegen/plugin-helpers": "^7.4.1-alpha-20261001151715-e566a642e4f4d42e92ff305632d2928e6dd47854",
|
|
20
20
|
"@graphql-tools/apollo-engine-loader": "^8.0.28",
|
|
21
21
|
"@graphql-tools/code-file-loader": "^8.1.39",
|
|
22
22
|
"@graphql-tools/git-loader": "^8.0.32",
|
package/typings/config.d.cts
CHANGED
|
@@ -18,6 +18,9 @@ export type YamlCliFlags = {
|
|
|
18
18
|
ignoreNoDocuments?: boolean;
|
|
19
19
|
emitLegacyCommonJSImports?: boolean;
|
|
20
20
|
importExtension?: '' | `.${string}`;
|
|
21
|
+
'ignore-no-documents'?: boolean;
|
|
22
|
+
'emit-legacy-common-js-imports'?: boolean;
|
|
23
|
+
'import-extension'?: '' | `.${string}`;
|
|
21
24
|
};
|
|
22
25
|
export declare function generateSearchPlaces(moduleName: string): string[];
|
|
23
26
|
export type CodegenConfigLoader = (filepath: string, content: string) => Promise<Types.Config> | Types.Config;
|
|
@@ -50,7 +53,7 @@ export interface LoadCodegenConfigResult {
|
|
|
50
53
|
config: Types.Config;
|
|
51
54
|
isEmpty?: boolean;
|
|
52
55
|
}
|
|
53
|
-
export declare function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }: LoadCodegenConfigOptions): Promise<LoadCodegenConfigResult>;
|
|
56
|
+
export declare function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }: LoadCodegenConfigOptions): Promise<LoadCodegenConfigResult | null>;
|
|
54
57
|
export declare function loadContext(configFilePath?: string): Promise<CodegenContext> | never;
|
|
55
58
|
export declare function buildOptions(): {
|
|
56
59
|
c: {
|
|
@@ -126,23 +129,24 @@ export declare function parseArgv(argv?: string[]): YamlCliFlags;
|
|
|
126
129
|
export declare function createContext(cliFlags?: YamlCliFlags): Promise<CodegenContext>;
|
|
127
130
|
export declare function updateContextWithCliFlags(context: CodegenContext, cliFlags: YamlCliFlags): void;
|
|
128
131
|
export declare class CodegenContext {
|
|
129
|
-
private _config
|
|
132
|
+
private _config?;
|
|
130
133
|
private _graphqlConfig?;
|
|
131
|
-
private config
|
|
134
|
+
private config?;
|
|
132
135
|
private _project?;
|
|
133
136
|
private _checkMode;
|
|
134
137
|
private _pluginContext;
|
|
135
138
|
cwd: string;
|
|
136
|
-
filepath
|
|
139
|
+
filepath?: string;
|
|
137
140
|
profiler: Profiler;
|
|
138
|
-
checkModeStaleFiles:
|
|
141
|
+
checkModeStaleFiles: string[];
|
|
139
142
|
constructor({ config, graphqlConfig, filepath, }: {
|
|
140
143
|
config?: Types.Config;
|
|
141
144
|
graphqlConfig?: GraphQLConfig;
|
|
142
145
|
filepath?: string;
|
|
143
146
|
});
|
|
144
147
|
useProject(name?: string): void;
|
|
145
|
-
getConfig
|
|
148
|
+
getConfig(): Types.Config;
|
|
149
|
+
getConfig<T>(extraConfig: T): T & Types.Config;
|
|
146
150
|
updateConfig(config: Partial<Types.Config>): void;
|
|
147
151
|
enableCheckMode(): void;
|
|
148
152
|
get checkMode(): boolean;
|
package/typings/config.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export type YamlCliFlags = {
|
|
|
18
18
|
ignoreNoDocuments?: boolean;
|
|
19
19
|
emitLegacyCommonJSImports?: boolean;
|
|
20
20
|
importExtension?: '' | `.${string}`;
|
|
21
|
+
'ignore-no-documents'?: boolean;
|
|
22
|
+
'emit-legacy-common-js-imports'?: boolean;
|
|
23
|
+
'import-extension'?: '' | `.${string}`;
|
|
21
24
|
};
|
|
22
25
|
export declare function generateSearchPlaces(moduleName: string): string[];
|
|
23
26
|
export type CodegenConfigLoader = (filepath: string, content: string) => Promise<Types.Config> | Types.Config;
|
|
@@ -50,7 +53,7 @@ export interface LoadCodegenConfigResult {
|
|
|
50
53
|
config: Types.Config;
|
|
51
54
|
isEmpty?: boolean;
|
|
52
55
|
}
|
|
53
|
-
export declare function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }: LoadCodegenConfigOptions): Promise<LoadCodegenConfigResult>;
|
|
56
|
+
export declare function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }: LoadCodegenConfigOptions): Promise<LoadCodegenConfigResult | null>;
|
|
54
57
|
export declare function loadContext(configFilePath?: string): Promise<CodegenContext> | never;
|
|
55
58
|
export declare function buildOptions(): {
|
|
56
59
|
c: {
|
|
@@ -126,23 +129,24 @@ export declare function parseArgv(argv?: string[]): YamlCliFlags;
|
|
|
126
129
|
export declare function createContext(cliFlags?: YamlCliFlags): Promise<CodegenContext>;
|
|
127
130
|
export declare function updateContextWithCliFlags(context: CodegenContext, cliFlags: YamlCliFlags): void;
|
|
128
131
|
export declare class CodegenContext {
|
|
129
|
-
private _config
|
|
132
|
+
private _config?;
|
|
130
133
|
private _graphqlConfig?;
|
|
131
|
-
private config
|
|
134
|
+
private config?;
|
|
132
135
|
private _project?;
|
|
133
136
|
private _checkMode;
|
|
134
137
|
private _pluginContext;
|
|
135
138
|
cwd: string;
|
|
136
|
-
filepath
|
|
139
|
+
filepath?: string;
|
|
137
140
|
profiler: Profiler;
|
|
138
|
-
checkModeStaleFiles:
|
|
141
|
+
checkModeStaleFiles: string[];
|
|
139
142
|
constructor({ config, graphqlConfig, filepath, }: {
|
|
140
143
|
config?: Types.Config;
|
|
141
144
|
graphqlConfig?: GraphQLConfig;
|
|
142
145
|
filepath?: string;
|
|
143
146
|
});
|
|
144
147
|
useProject(name?: string): void;
|
|
145
|
-
getConfig
|
|
148
|
+
getConfig(): Types.Config;
|
|
149
|
+
getConfig<T>(extraConfig: T): T & Types.Config;
|
|
146
150
|
updateConfig(config: Partial<Types.Config>): void;
|
|
147
151
|
enableCheckMode(): void;
|
|
148
152
|
get checkMode(): boolean;
|
|
@@ -3,6 +3,6 @@ declare const fsAccess: typeof promises.access;
|
|
|
3
3
|
export declare function access(...args: Parameters<typeof fsAccess>): Promise<void>;
|
|
4
4
|
export declare function writeFile(filepath: string, content: string): Promise<void>;
|
|
5
5
|
export declare function readFile(filepath: string): Promise<string>;
|
|
6
|
-
export declare function unlinkFile(filePath: string, cb
|
|
6
|
+
export declare function unlinkFile(filePath: string, cb: (err: Error | null) => void): void;
|
|
7
7
|
export declare function mkdirp(filePath: string): Promise<string>;
|
|
8
8
|
export {};
|
|
@@ -3,6 +3,6 @@ declare const fsAccess: typeof promises.access;
|
|
|
3
3
|
export declare function access(...args: Parameters<typeof fsAccess>): Promise<void>;
|
|
4
4
|
export declare function writeFile(filepath: string, content: string): Promise<void>;
|
|
5
5
|
export declare function readFile(filepath: string): Promise<string>;
|
|
6
|
-
export declare function unlinkFile(filePath: string, cb
|
|
6
|
+
export declare function unlinkFile(filePath: string, cb: (err: Error | null) => void): void;
|
|
7
7
|
export declare function mkdirp(filePath: string): Promise<string>;
|
|
8
8
|
export {};
|