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