@graphql-codegen/cli 5.0.3-alpha-20240819143533-ee49323cbb7d6d54231c6560cd9d3fad36ca721b → 5.0.3-alpha-20240819144031-b973012f36eed0ebc7a1055f1c4c5a91ad7803c3
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/cli.js +3 -2
- package/cjs/codegen.js +2 -1
- package/cjs/config.js +10 -10
- package/cjs/documentTransforms.js +3 -2
- package/cjs/generate-and-save.js +2 -1
- package/cjs/graphql-config.js +2 -2
- package/cjs/init/helpers.js +6 -5
- package/cjs/init/index.js +2 -1
- package/cjs/init/questions.js +7 -6
- package/cjs/init/targets.js +2 -1
- package/cjs/load.js +3 -3
- package/cjs/plugins.js +2 -1
- package/cjs/presets.js +2 -1
- package/cjs/utils/cli-error.js +3 -2
- package/cjs/utils/debugging.js +4 -3
- package/cjs/utils/file-system.js +6 -5
- package/cjs/utils/get-latest-version.js +2 -1
- package/cjs/utils/logger.js +5 -4
- package/esm/init/questions.js +1 -1
- package/package.json +4 -4
- package/typings/utils/file-system.d.cts +1 -0
- package/typings/utils/file-system.d.ts +1 -0
- package/typings/utils/patterns.d.cts +1 -1
- package/typings/utils/patterns.d.ts +1 -1
package/cjs/cli.js
CHANGED
|
@@ -23,8 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.runCli =
|
|
27
|
-
exports.ensureGraphQlPackage = ensureGraphQlPackage;
|
|
26
|
+
exports.ensureGraphQlPackage = exports.runCli = void 0;
|
|
28
27
|
const config_js_1 = require("./config.js");
|
|
29
28
|
const generate_and_save_js_1 = require("./generate-and-save.js");
|
|
30
29
|
const hooks_js_1 = require("./hooks.js");
|
|
@@ -50,6 +49,7 @@ async function runCli(cmd) {
|
|
|
50
49
|
return 1;
|
|
51
50
|
}
|
|
52
51
|
}
|
|
52
|
+
exports.runCli = runCli;
|
|
53
53
|
async function ensureGraphQlPackage() {
|
|
54
54
|
try {
|
|
55
55
|
await Promise.resolve().then(() => __importStar(require('graphql')));
|
|
@@ -62,3 +62,4 @@ async function ensureGraphQlPackage() {
|
|
|
62
62
|
npm install --save graphql`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
exports.ensureGraphQlPackage = ensureGraphQlPackage;
|
package/cjs/codegen.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeCodegen =
|
|
3
|
+
exports.executeCodegen = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const module_1 = require("module");
|
|
@@ -338,3 +338,4 @@ async function executeCodegen(input) {
|
|
|
338
338
|
}
|
|
339
339
|
return result;
|
|
340
340
|
}
|
|
341
|
+
exports.executeCodegen = executeCodegen;
|
package/cjs/config.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodegenContext = void 0;
|
|
4
|
-
exports.generateSearchPlaces = generateSearchPlaces;
|
|
5
|
-
exports.loadCodegenConfig = loadCodegenConfig;
|
|
6
|
-
exports.loadContext = loadContext;
|
|
7
|
-
exports.buildOptions = buildOptions;
|
|
8
|
-
exports.parseArgv = parseArgv;
|
|
9
|
-
exports.createContext = createContext;
|
|
10
|
-
exports.updateContextWithCliFlags = updateContextWithCliFlags;
|
|
11
|
-
exports.ensureContext = ensureContext;
|
|
12
|
-
exports.shouldEmitLegacyCommonJSImports = shouldEmitLegacyCommonJSImports;
|
|
3
|
+
exports.shouldEmitLegacyCommonJSImports = exports.ensureContext = exports.CodegenContext = exports.updateContextWithCliFlags = exports.createContext = exports.parseArgv = exports.buildOptions = exports.loadContext = exports.loadCodegenConfig = exports.generateSearchPlaces = void 0;
|
|
13
4
|
const tslib_1 = require("tslib");
|
|
14
5
|
const crypto_1 = require("crypto");
|
|
15
6
|
const fs_1 = require("fs");
|
|
@@ -33,6 +24,7 @@ function generateSearchPlaces(moduleName) {
|
|
|
33
24
|
const dot = extensions.filter(ext => ext !== 'config.js').map(ext => `.${moduleName}rc.${ext}`);
|
|
34
25
|
return [...regular.concat(dot), 'package.json'];
|
|
35
26
|
}
|
|
27
|
+
exports.generateSearchPlaces = generateSearchPlaces;
|
|
36
28
|
function customLoader(ext) {
|
|
37
29
|
return async function loader(filepath, content) {
|
|
38
30
|
if (typeof process !== 'undefined' && 'env' in process) {
|
|
@@ -82,6 +74,7 @@ async function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: add
|
|
|
82
74
|
const pathStats = await lstat(configFilePath);
|
|
83
75
|
return pathStats.isDirectory() ? cosmi.search(configFilePath) : cosmi.load(configFilePath);
|
|
84
76
|
}
|
|
77
|
+
exports.loadCodegenConfig = loadCodegenConfig;
|
|
85
78
|
async function loadContext(configFilePath) {
|
|
86
79
|
const graphqlConfig = await (0, graphql_config_js_1.findAndLoadGraphQLConfig)(configFilePath);
|
|
87
80
|
if (graphqlConfig) {
|
|
@@ -112,6 +105,7 @@ async function loadContext(configFilePath) {
|
|
|
112
105
|
config: result.config,
|
|
113
106
|
});
|
|
114
107
|
}
|
|
108
|
+
exports.loadContext = loadContext;
|
|
115
109
|
function getCustomConfigPath(cliFlags) {
|
|
116
110
|
const configFile = cliFlags.config;
|
|
117
111
|
return configFile ? (0, path_1.resolve)(process.cwd(), configFile) : null;
|
|
@@ -180,9 +174,11 @@ function buildOptions() {
|
|
|
180
174
|
},
|
|
181
175
|
};
|
|
182
176
|
}
|
|
177
|
+
exports.buildOptions = buildOptions;
|
|
183
178
|
function parseArgv(argv = process.argv) {
|
|
184
179
|
return (0, yargs_1.default)(argv).options(buildOptions()).parse(argv);
|
|
185
180
|
}
|
|
181
|
+
exports.parseArgv = parseArgv;
|
|
186
182
|
async function createContext(cliFlags = parseArgv(process.argv)) {
|
|
187
183
|
if (cliFlags.require && cliFlags.require.length > 0) {
|
|
188
184
|
const relativeRequire = (0, module_1.createRequire)(process.cwd());
|
|
@@ -195,6 +191,7 @@ async function createContext(cliFlags = parseArgv(process.argv)) {
|
|
|
195
191
|
updateContextWithCliFlags(context, cliFlags);
|
|
196
192
|
return context;
|
|
197
193
|
}
|
|
194
|
+
exports.createContext = createContext;
|
|
198
195
|
function updateContextWithCliFlags(context, cliFlags) {
|
|
199
196
|
const config = {
|
|
200
197
|
configFilePath: context.filepath,
|
|
@@ -236,6 +233,7 @@ function updateContextWithCliFlags(context, cliFlags) {
|
|
|
236
233
|
}
|
|
237
234
|
context.updateConfig(config);
|
|
238
235
|
}
|
|
236
|
+
exports.updateContextWithCliFlags = updateContextWithCliFlags;
|
|
239
237
|
class CodegenContext {
|
|
240
238
|
constructor({ config, graphqlConfig, filepath, }) {
|
|
241
239
|
this._checkMode = false;
|
|
@@ -313,6 +311,7 @@ exports.CodegenContext = CodegenContext;
|
|
|
313
311
|
function ensureContext(input) {
|
|
314
312
|
return input instanceof CodegenContext ? input : new CodegenContext({ config: input });
|
|
315
313
|
}
|
|
314
|
+
exports.ensureContext = ensureContext;
|
|
316
315
|
function hashContent(content, encoding = 'hex') {
|
|
317
316
|
return (0, crypto_1.createHash)('sha256').update(content).digest(encoding);
|
|
318
317
|
}
|
|
@@ -356,3 +355,4 @@ function shouldEmitLegacyCommonJSImports(config) {
|
|
|
356
355
|
// }
|
|
357
356
|
return globalValue;
|
|
358
357
|
}
|
|
358
|
+
exports.shouldEmitLegacyCommonJSImports = shouldEmitLegacyCommonJSImports;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDocumentTransform =
|
|
4
|
-
exports.getDocumentTransformByName = getDocumentTransformByName;
|
|
3
|
+
exports.getDocumentTransformByName = exports.getDocumentTransform = void 0;
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
async function getDocumentTransform(documentTransform, loader, defaultName) {
|
|
7
6
|
if (typeof documentTransform === 'string') {
|
|
@@ -20,6 +19,7 @@ async function getDocumentTransform(documentTransform, loader, defaultName) {
|
|
|
20
19
|
An unknown format document transform: '${defaultName}'.
|
|
21
20
|
`);
|
|
22
21
|
}
|
|
22
|
+
exports.getDocumentTransform = getDocumentTransform;
|
|
23
23
|
function isTransformObject(config) {
|
|
24
24
|
return typeof config === 'object' && config.transform && typeof config.transform === 'function';
|
|
25
25
|
}
|
|
@@ -61,3 +61,4 @@ async function getDocumentTransformByName(name, loader) {
|
|
|
61
61
|
${possibleNamesMsg}
|
|
62
62
|
`);
|
|
63
63
|
}
|
|
64
|
+
exports.getDocumentTransformByName = getDocumentTransformByName;
|
package/cjs/generate-and-save.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate =
|
|
3
|
+
exports.generate = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const codegen_js_1 = require("./codegen.js");
|
|
@@ -107,6 +107,7 @@ async function generate(input, saveToFile = true) {
|
|
|
107
107
|
}
|
|
108
108
|
return outputFiles;
|
|
109
109
|
}
|
|
110
|
+
exports.generate = generate;
|
|
110
111
|
function shouldOverwrite(config, outputPath) {
|
|
111
112
|
const globalValue = config.overwrite === undefined ? true : !!config.overwrite;
|
|
112
113
|
const outputConfig = config.generates[outputPath];
|
package/cjs/graphql-config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodegenExtension = void 0;
|
|
4
|
-
exports.findAndLoadGraphQLConfig = findAndLoadGraphQLConfig;
|
|
3
|
+
exports.findAndLoadGraphQLConfig = exports.CodegenExtension = void 0;
|
|
5
4
|
const apollo_engine_loader_1 = require("@graphql-tools/apollo-engine-loader");
|
|
6
5
|
const code_file_loader_1 = require("@graphql-tools/code-file-loader");
|
|
7
6
|
const git_loader_1 = require("@graphql-tools/git-loader");
|
|
@@ -44,6 +43,7 @@ async function findAndLoadGraphQLConfig(filepath) {
|
|
|
44
43
|
return config;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
46
|
+
exports.findAndLoadGraphQLConfig = findAndLoadGraphQLConfig;
|
|
47
47
|
// Kamil: user might load a config that is not GraphQL Config
|
|
48
48
|
// so we need to check if it's a regular config or not
|
|
49
49
|
function isGraphQLConfig(config) {
|
package/cjs/init/helpers.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeConfig =
|
|
4
|
-
exports.writePackage = writePackage;
|
|
5
|
-
exports.bold = bold;
|
|
6
|
-
exports.grey = grey;
|
|
7
|
-
exports.italic = italic;
|
|
3
|
+
exports.italic = exports.grey = exports.bold = exports.writePackage = exports.writeConfig = void 0;
|
|
8
4
|
const tslib_1 = require("tslib");
|
|
9
5
|
const fs_1 = require("fs");
|
|
10
6
|
const path_1 = require("path");
|
|
@@ -56,6 +52,7 @@ export default config;
|
|
|
56
52
|
fullPath,
|
|
57
53
|
};
|
|
58
54
|
}
|
|
55
|
+
exports.writeConfig = writeConfig;
|
|
59
56
|
// Updates package.json (script and plugins as dependencies)
|
|
60
57
|
async function writePackage(answers, configLocation) {
|
|
61
58
|
// script
|
|
@@ -79,12 +76,16 @@ async function writePackage(answers, configLocation) {
|
|
|
79
76
|
}
|
|
80
77
|
(0, fs_1.writeFileSync)(pkgPath, JSON.stringify(pkg, null, indent));
|
|
81
78
|
}
|
|
79
|
+
exports.writePackage = writePackage;
|
|
82
80
|
function bold(str) {
|
|
83
81
|
return chalk_1.default.bold(str);
|
|
84
82
|
}
|
|
83
|
+
exports.bold = bold;
|
|
85
84
|
function grey(str) {
|
|
86
85
|
return chalk_1.default.grey(str);
|
|
87
86
|
}
|
|
87
|
+
exports.grey = grey;
|
|
88
88
|
function italic(str) {
|
|
89
89
|
return chalk_1.default.italic(str);
|
|
90
90
|
}
|
|
91
|
+
exports.italic = italic;
|
package/cjs/init/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.init =
|
|
3
|
+
exports.init = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
6
6
|
const helpers_js_1 = require("./helpers.js");
|
|
@@ -56,6 +56,7 @@ async function init() {
|
|
|
56
56
|
To run GraphQL Code Generator.
|
|
57
57
|
`);
|
|
58
58
|
}
|
|
59
|
+
exports.init = init;
|
|
59
60
|
// adds an introspection to `generates`
|
|
60
61
|
function addIntrospection(config) {
|
|
61
62
|
config.generates['./graphql.schema.json'] = {
|
package/cjs/init/questions.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getQuestions =
|
|
4
|
-
exports.getApplicationTypeChoices = getApplicationTypeChoices;
|
|
5
|
-
exports.getPluginChoices = getPluginChoices;
|
|
6
|
-
exports.getOutputDefaultValue = getOutputDefaultValue;
|
|
7
|
-
exports.getDocumentsDefaultValue = getDocumentsDefaultValue;
|
|
3
|
+
exports.getDocumentsDefaultValue = exports.getOutputDefaultValue = exports.getPluginChoices = exports.getApplicationTypeChoices = exports.getQuestions = void 0;
|
|
8
4
|
const helpers_js_1 = require("./helpers.js");
|
|
9
5
|
const plugins_js_1 = require("./plugins.js");
|
|
10
6
|
const types_js_1 = require("./types.js");
|
|
@@ -23,7 +19,7 @@ function getQuestions(possibleTargets) {
|
|
|
23
19
|
name: 'schema',
|
|
24
20
|
message: 'Where is your schema?:',
|
|
25
21
|
suffix: (0, helpers_js_1.grey)(' (path or url)'),
|
|
26
|
-
default: 'http://localhost:4000',
|
|
22
|
+
default: 'http://localhost:4000',
|
|
27
23
|
validate: (str) => str.length > 0,
|
|
28
24
|
},
|
|
29
25
|
{
|
|
@@ -91,6 +87,7 @@ function getQuestions(possibleTargets) {
|
|
|
91
87
|
},
|
|
92
88
|
];
|
|
93
89
|
}
|
|
90
|
+
exports.getQuestions = getQuestions;
|
|
94
91
|
function getApplicationTypeChoices(possibleTargets) {
|
|
95
92
|
function withFlowOrTypescript(tags) {
|
|
96
93
|
if (possibleTargets.TypeScript) {
|
|
@@ -149,6 +146,7 @@ function getApplicationTypeChoices(possibleTargets) {
|
|
|
149
146
|
},
|
|
150
147
|
];
|
|
151
148
|
}
|
|
149
|
+
exports.getApplicationTypeChoices = getApplicationTypeChoices;
|
|
152
150
|
function getPluginChoices(answers) {
|
|
153
151
|
return plugins_js_1.plugins
|
|
154
152
|
.filter(p => p.available(answers.targets))
|
|
@@ -160,6 +158,7 @@ function getPluginChoices(answers) {
|
|
|
160
158
|
};
|
|
161
159
|
});
|
|
162
160
|
}
|
|
161
|
+
exports.getPluginChoices = getPluginChoices;
|
|
163
162
|
function normalizeTargets(targets) {
|
|
164
163
|
return [].concat(...targets);
|
|
165
164
|
}
|
|
@@ -175,6 +174,7 @@ function getOutputDefaultValue(answers) {
|
|
|
175
174
|
}
|
|
176
175
|
return 'src/generated/graphql.js';
|
|
177
176
|
}
|
|
177
|
+
exports.getOutputDefaultValue = getOutputDefaultValue;
|
|
178
178
|
function getDocumentsDefaultValue(answers) {
|
|
179
179
|
if (answers.targets.includes(types_js_1.Tags.vue)) {
|
|
180
180
|
return 'src/**/*.vue';
|
|
@@ -187,3 +187,4 @@ function getDocumentsDefaultValue(answers) {
|
|
|
187
187
|
}
|
|
188
188
|
return 'src/**/*.graphql';
|
|
189
189
|
}
|
|
190
|
+
exports.getDocumentsDefaultValue = getDocumentsDefaultValue;
|
package/cjs/init/targets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guessTargets =
|
|
3
|
+
exports.guessTargets = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const types_js_1 = require("./types.js");
|
|
@@ -22,6 +22,7 @@ async function guessTargets() {
|
|
|
22
22
|
[types_js_1.Tags.graphqlRequest]: isGraphqlRequest(dependencies),
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
exports.guessTargets = guessTargets;
|
|
25
26
|
function isAngular(dependencies) {
|
|
26
27
|
return dependencies.includes('@angular/core');
|
|
27
28
|
}
|
package/cjs/load.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultDocumentsLoadOptions = exports.defaultSchemaLoadOptions = void 0;
|
|
4
|
-
exports.loadSchema = loadSchema;
|
|
5
|
-
exports.loadDocuments = loadDocuments;
|
|
3
|
+
exports.loadDocuments = exports.loadSchema = exports.defaultDocumentsLoadOptions = exports.defaultSchemaLoadOptions = void 0;
|
|
6
4
|
const path_1 = require("path");
|
|
7
5
|
const apollo_engine_loader_1 = require("@graphql-tools/apollo-engine-loader");
|
|
8
6
|
const code_file_loader_1 = require("@graphql-tools/code-file-loader");
|
|
@@ -62,6 +60,7 @@ async function loadSchema(schemaPointers, config) {
|
|
|
62
60
|
`);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
63
|
+
exports.loadSchema = loadSchema;
|
|
65
64
|
async function loadDocuments(documentPointers, config) {
|
|
66
65
|
const loaders = [
|
|
67
66
|
new code_file_loader_1.CodeFileLoader({
|
|
@@ -97,3 +96,4 @@ async function loadDocuments(documentPointers, config) {
|
|
|
97
96
|
throw error;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
99
|
+
exports.loadDocuments = loadDocuments;
|
package/cjs/plugins.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPluginByName =
|
|
3
|
+
exports.getPluginByName = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
async function getPluginByName(name, pluginLoader) {
|
|
6
6
|
const possibleNames = [
|
|
@@ -41,3 +41,4 @@ async function getPluginByName(name, pluginLoader) {
|
|
|
41
41
|
${possibleNamesMsg}
|
|
42
42
|
`);
|
|
43
43
|
}
|
|
44
|
+
exports.getPluginByName = getPluginByName;
|
package/cjs/presets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPresetByName =
|
|
3
|
+
exports.getPresetByName = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
async function getPresetByName(name, loader) {
|
|
6
6
|
const possibleNames = [
|
|
@@ -48,3 +48,4 @@ async function getPresetByName(name, loader) {
|
|
|
48
48
|
${possibleNamesMsg}
|
|
49
49
|
`);
|
|
50
50
|
}
|
|
51
|
+
exports.getPresetByName = getPresetByName;
|
package/cjs/utils/cli-error.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isListrError =
|
|
4
|
-
exports.cliError = cliError;
|
|
3
|
+
exports.cliError = exports.isListrError = void 0;
|
|
5
4
|
function isListrError(err) {
|
|
6
5
|
return err.name === 'ListrError' && Array.isArray(err.errors) && err.errors.length > 0;
|
|
7
6
|
}
|
|
7
|
+
exports.isListrError = isListrError;
|
|
8
8
|
function cliError(err, exitOnError = true) {
|
|
9
9
|
let msg;
|
|
10
10
|
if (err instanceof Error) {
|
|
@@ -22,3 +22,4 @@ function cliError(err, exitOnError = true) {
|
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
exports.cliError = cliError;
|
package/cjs/utils/debugging.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debugLog =
|
|
4
|
-
exports.printLogs = printLogs;
|
|
5
|
-
exports.resetLogs = resetLogs;
|
|
3
|
+
exports.resetLogs = exports.printLogs = exports.debugLog = void 0;
|
|
6
4
|
const logger_js_1 = require("./logger.js");
|
|
7
5
|
let queue = [];
|
|
8
6
|
function debugLog(message, ...meta) {
|
|
@@ -11,12 +9,15 @@ function debugLog(message, ...meta) {
|
|
|
11
9
|
meta,
|
|
12
10
|
});
|
|
13
11
|
}
|
|
12
|
+
exports.debugLog = debugLog;
|
|
14
13
|
function printLogs() {
|
|
15
14
|
for (const log of queue) {
|
|
16
15
|
(0, logger_js_1.getLogger)().info(log.message, ...log.meta);
|
|
17
16
|
}
|
|
18
17
|
resetLogs();
|
|
19
18
|
}
|
|
19
|
+
exports.printLogs = printLogs;
|
|
20
20
|
function resetLogs() {
|
|
21
21
|
queue = [];
|
|
22
22
|
}
|
|
23
|
+
exports.resetLogs = resetLogs;
|
package/cjs/utils/file-system.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.access =
|
|
4
|
-
exports.writeFile = writeFile;
|
|
5
|
-
exports.readFile = readFile;
|
|
6
|
-
exports.unlinkFile = unlinkFile;
|
|
7
|
-
exports.mkdirp = mkdirp;
|
|
3
|
+
exports.mkdirp = exports.unlinkFile = exports.readFile = exports.writeFile = exports.access = void 0;
|
|
8
4
|
const fs_1 = require("fs");
|
|
9
5
|
const { access: fsAccess, writeFile: fsWriteFile, readFile: fsReadFile, mkdir } = fs_1.promises;
|
|
10
6
|
function access(...args) {
|
|
11
7
|
return fsAccess(...args);
|
|
12
8
|
}
|
|
9
|
+
exports.access = access;
|
|
13
10
|
function writeFile(filepath, content) {
|
|
14
11
|
return fsWriteFile(filepath, content);
|
|
15
12
|
}
|
|
13
|
+
exports.writeFile = writeFile;
|
|
16
14
|
function readFile(filepath) {
|
|
17
15
|
return fsReadFile(filepath, 'utf-8');
|
|
18
16
|
}
|
|
17
|
+
exports.readFile = readFile;
|
|
19
18
|
function unlinkFile(filePath, cb) {
|
|
20
19
|
(0, fs_1.unlink)(filePath, cb);
|
|
21
20
|
}
|
|
21
|
+
exports.unlinkFile = unlinkFile;
|
|
22
22
|
function mkdirp(filePath) {
|
|
23
23
|
return mkdir(filePath, { recursive: true });
|
|
24
24
|
}
|
|
25
|
+
exports.mkdirp = mkdirp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLatestVersion =
|
|
3
|
+
exports.getLatestVersion = void 0;
|
|
4
4
|
const fetch_1 = require("@whatwg-node/fetch");
|
|
5
5
|
/**
|
|
6
6
|
* Fetches the version directly from the registry instead of depending on
|
|
@@ -12,3 +12,4 @@ async function getLatestVersion(packageName) {
|
|
|
12
12
|
.then(res => res.json())
|
|
13
13
|
.then(pkg => pkg.version);
|
|
14
14
|
}
|
|
15
|
+
exports.getLatestVersion = getLatestVersion;
|
package/cjs/utils/logger.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLogger =
|
|
4
|
-
exports.setLogger = setLogger;
|
|
5
|
-
exports.setSilentLogger = setSilentLogger;
|
|
6
|
-
exports.useWinstonLogger = useWinstonLogger;
|
|
3
|
+
exports.useWinstonLogger = exports.setSilentLogger = exports.setLogger = exports.getLogger = void 0;
|
|
7
4
|
const ts_log_1 = require("ts-log");
|
|
8
5
|
let logger;
|
|
9
6
|
function getLogger() {
|
|
10
7
|
return logger || ts_log_1.dummyLogger;
|
|
11
8
|
}
|
|
9
|
+
exports.getLogger = getLogger;
|
|
12
10
|
useWinstonLogger();
|
|
13
11
|
function setLogger(newLogger) {
|
|
14
12
|
logger = newLogger;
|
|
15
13
|
}
|
|
14
|
+
exports.setLogger = setLogger;
|
|
16
15
|
function setSilentLogger() {
|
|
17
16
|
logger = ts_log_1.dummyLogger;
|
|
18
17
|
}
|
|
18
|
+
exports.setSilentLogger = setSilentLogger;
|
|
19
19
|
function useWinstonLogger() {
|
|
20
20
|
if (logger?.levels) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
logger = console;
|
|
24
24
|
}
|
|
25
|
+
exports.useWinstonLogger = useWinstonLogger;
|
package/esm/init/questions.js
CHANGED
|
@@ -16,7 +16,7 @@ export function getQuestions(possibleTargets) {
|
|
|
16
16
|
name: 'schema',
|
|
17
17
|
message: 'Where is your schema?:',
|
|
18
18
|
suffix: grey(' (path or url)'),
|
|
19
|
-
default: 'http://localhost:4000',
|
|
19
|
+
default: 'http://localhost:4000',
|
|
20
20
|
validate: (str) => str.length > 0,
|
|
21
21
|
},
|
|
22
22
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "5.0.3-alpha-
|
|
3
|
+
"version": "5.0.3-alpha-20240819144031-b973012f36eed0ebc7a1055f1c4c5a91ad7803c3",
|
|
4
4
|
"peerDependenciesMeta": {
|
|
5
5
|
"@parcel/watcher": {
|
|
6
6
|
"optional": true
|
|
@@ -14,7 +14,7 @@
|
|
|
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": "4.4.0-alpha-
|
|
17
|
+
"@graphql-codegen/client-preset": "4.4.0-alpha-20240819144031-b973012f36eed0ebc7a1055f1c4c5a91ad7803c3",
|
|
18
18
|
"@graphql-codegen/core": "^4.0.2",
|
|
19
19
|
"@graphql-codegen/plugin-helpers": "^5.0.3",
|
|
20
20
|
"@graphql-tools/apollo-engine-loader": "^8.0.0",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@graphql-tools/prisma-loader": "^8.0.0",
|
|
28
28
|
"@graphql-tools/url-loader": "^8.0.0",
|
|
29
29
|
"@graphql-tools/utils": "^10.0.0",
|
|
30
|
-
"@whatwg-node/fetch": "^0.
|
|
30
|
+
"@whatwg-node/fetch": "^0.9.20",
|
|
31
31
|
"chalk": "^4.1.0",
|
|
32
32
|
"cosmiconfig": "^8.1.3",
|
|
33
33
|
"debounce": "^1.2.0",
|
|
34
34
|
"detect-indent": "^6.0.0",
|
|
35
|
-
"graphql-config": "^5.
|
|
35
|
+
"graphql-config": "^5.1.1",
|
|
36
36
|
"inquirer": "^8.0.0",
|
|
37
37
|
"is-glob": "^4.0.1",
|
|
38
38
|
"jiti": "^1.17.1",
|
|
@@ -63,7 +63,7 @@ export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) => {
|
|
|
63
63
|
*
|
|
64
64
|
* @param patterns List of micromatch patterns
|
|
65
65
|
*/
|
|
66
|
-
export declare const sortPatterns: <P extends string
|
|
66
|
+
export declare const sortPatterns: <P extends string>(patterns: P[]) => SortedPatterns<P>;
|
|
67
67
|
/**
|
|
68
68
|
* A type that "sorts" (or "groups") patterns. For a given list of `patterns`,
|
|
69
69
|
* this type will include the original list in `patterns`, all of its
|
|
@@ -63,7 +63,7 @@ export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) => {
|
|
|
63
63
|
*
|
|
64
64
|
* @param patterns List of micromatch patterns
|
|
65
65
|
*/
|
|
66
|
-
export declare const sortPatterns: <P extends string
|
|
66
|
+
export declare const sortPatterns: <P extends string>(patterns: P[]) => SortedPatterns<P>;
|
|
67
67
|
/**
|
|
68
68
|
* A type that "sorts" (or "groups") patterns. For a given list of `patterns`,
|
|
69
69
|
* this type will include the original list in `patterns`, all of its
|