@graphql-codegen/cli 2.6.2-alpha-714e0efe9.0 → 2.6.3-alpha-af9e4731c.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/bin.js +16 -15
- package/index.js +16 -15
- package/index.mjs +16 -15
- package/package.json +3 -9
package/bin.js
CHANGED
|
@@ -109,7 +109,7 @@ const DEFAULT_HOOKS = {
|
|
|
109
109
|
function normalizeHooks(_hooks) {
|
|
110
110
|
const keys = Object.keys({
|
|
111
111
|
...DEFAULT_HOOKS,
|
|
112
|
-
...
|
|
112
|
+
..._hooks,
|
|
113
113
|
});
|
|
114
114
|
return keys.reduce((prev, hookName) => {
|
|
115
115
|
if (typeof _hooks[hookName] === 'string') {
|
|
@@ -118,21 +118,19 @@ function normalizeHooks(_hooks) {
|
|
|
118
118
|
[hookName]: [_hooks[hookName]],
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
if (typeof _hooks[hookName] === 'function') {
|
|
122
122
|
return {
|
|
123
123
|
...prev,
|
|
124
124
|
[hookName]: [_hooks[hookName]],
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
if (Array.isArray(_hooks[hookName])) {
|
|
128
128
|
return {
|
|
129
129
|
...prev,
|
|
130
130
|
[hookName]: _hooks[hookName],
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
return prev;
|
|
135
|
-
}
|
|
133
|
+
return prev;
|
|
136
134
|
}, {});
|
|
137
135
|
}
|
|
138
136
|
function execShellCommand(cmd) {
|
|
@@ -376,14 +374,19 @@ async function getPluginByName(name, pluginLoader) {
|
|
|
376
374
|
}
|
|
377
375
|
|
|
378
376
|
async function getPresetByName(name, loader) {
|
|
379
|
-
const possibleNames = [
|
|
377
|
+
const possibleNames = [
|
|
378
|
+
`@graphql-codegen/${name}`,
|
|
379
|
+
`@graphql-codegen/${name}-preset`,
|
|
380
|
+
name,
|
|
381
|
+
path.resolve(process.cwd(), name),
|
|
382
|
+
];
|
|
380
383
|
for (const moduleName of possibleNames) {
|
|
381
384
|
try {
|
|
382
385
|
const loaded = await loader(moduleName);
|
|
383
386
|
if (loaded && loaded.preset) {
|
|
384
387
|
return loaded.preset;
|
|
385
388
|
}
|
|
386
|
-
|
|
389
|
+
if (loaded && loaded.default) {
|
|
387
390
|
return loaded.default;
|
|
388
391
|
}
|
|
389
392
|
return loaded;
|
|
@@ -1034,8 +1037,8 @@ async function executeCodegen(input) {
|
|
|
1034
1037
|
const outputSchemaAst = await context.loadSchema(schemaPointerMap);
|
|
1035
1038
|
const outputSchema = pluginHelpers.getCachedDocumentNodeFromSchema(outputSchemaAst);
|
|
1036
1039
|
return {
|
|
1037
|
-
outputSchemaAst
|
|
1038
|
-
outputSchema
|
|
1040
|
+
outputSchemaAst,
|
|
1041
|
+
outputSchema,
|
|
1039
1042
|
};
|
|
1040
1043
|
});
|
|
1041
1044
|
outputSchemaAst = await result.outputSchemaAst;
|
|
@@ -1052,7 +1055,7 @@ async function executeCodegen(input) {
|
|
|
1052
1055
|
return cache('documents', hash, async () => {
|
|
1053
1056
|
const documents = await context.loadDocuments(docs);
|
|
1054
1057
|
return {
|
|
1055
|
-
documents
|
|
1058
|
+
documents,
|
|
1056
1059
|
};
|
|
1057
1060
|
});
|
|
1058
1061
|
}));
|
|
@@ -1757,12 +1760,10 @@ function getOutputDefaultValue(answers) {
|
|
|
1757
1760
|
if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) {
|
|
1758
1761
|
return 'src/generated/graphql.tsx';
|
|
1759
1762
|
}
|
|
1760
|
-
|
|
1763
|
+
if (answers.plugins.some(plugin => plugin.defaultExtension === '.ts')) {
|
|
1761
1764
|
return 'src/generated/graphql.ts';
|
|
1762
1765
|
}
|
|
1763
|
-
|
|
1764
|
-
return 'src/generated/graphql.js';
|
|
1765
|
-
}
|
|
1766
|
+
return 'src/generated/graphql.js';
|
|
1766
1767
|
}
|
|
1767
1768
|
|
|
1768
1769
|
async function guessTargets() {
|
package/index.js
CHANGED
|
@@ -294,14 +294,19 @@ async function getPluginByName(name, pluginLoader) {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
async function getPresetByName(name, loader) {
|
|
297
|
-
const possibleNames = [
|
|
297
|
+
const possibleNames = [
|
|
298
|
+
`@graphql-codegen/${name}`,
|
|
299
|
+
`@graphql-codegen/${name}-preset`,
|
|
300
|
+
name,
|
|
301
|
+
path.resolve(process.cwd(), name),
|
|
302
|
+
];
|
|
298
303
|
for (const moduleName of possibleNames) {
|
|
299
304
|
try {
|
|
300
305
|
const loaded = await loader(moduleName);
|
|
301
306
|
if (loaded && loaded.preset) {
|
|
302
307
|
return loaded.preset;
|
|
303
308
|
}
|
|
304
|
-
|
|
309
|
+
if (loaded && loaded.default) {
|
|
305
310
|
return loaded.default;
|
|
306
311
|
}
|
|
307
312
|
return loaded;
|
|
@@ -952,8 +957,8 @@ async function executeCodegen(input) {
|
|
|
952
957
|
const outputSchemaAst = await context.loadSchema(schemaPointerMap);
|
|
953
958
|
const outputSchema = pluginHelpers.getCachedDocumentNodeFromSchema(outputSchemaAst);
|
|
954
959
|
return {
|
|
955
|
-
outputSchemaAst
|
|
956
|
-
outputSchema
|
|
960
|
+
outputSchemaAst,
|
|
961
|
+
outputSchema,
|
|
957
962
|
};
|
|
958
963
|
});
|
|
959
964
|
outputSchemaAst = await result.outputSchemaAst;
|
|
@@ -970,7 +975,7 @@ async function executeCodegen(input) {
|
|
|
970
975
|
return cache('documents', hash, async () => {
|
|
971
976
|
const documents = await context.loadDocuments(docs);
|
|
972
977
|
return {
|
|
973
|
-
documents
|
|
978
|
+
documents,
|
|
974
979
|
};
|
|
975
980
|
});
|
|
976
981
|
}));
|
|
@@ -1093,7 +1098,7 @@ const DEFAULT_HOOKS = {
|
|
|
1093
1098
|
function normalizeHooks(_hooks) {
|
|
1094
1099
|
const keys = Object.keys({
|
|
1095
1100
|
...DEFAULT_HOOKS,
|
|
1096
|
-
...
|
|
1101
|
+
..._hooks,
|
|
1097
1102
|
});
|
|
1098
1103
|
return keys.reduce((prev, hookName) => {
|
|
1099
1104
|
if (typeof _hooks[hookName] === 'string') {
|
|
@@ -1102,21 +1107,19 @@ function normalizeHooks(_hooks) {
|
|
|
1102
1107
|
[hookName]: [_hooks[hookName]],
|
|
1103
1108
|
};
|
|
1104
1109
|
}
|
|
1105
|
-
|
|
1110
|
+
if (typeof _hooks[hookName] === 'function') {
|
|
1106
1111
|
return {
|
|
1107
1112
|
...prev,
|
|
1108
1113
|
[hookName]: [_hooks[hookName]],
|
|
1109
1114
|
};
|
|
1110
1115
|
}
|
|
1111
|
-
|
|
1116
|
+
if (Array.isArray(_hooks[hookName])) {
|
|
1112
1117
|
return {
|
|
1113
1118
|
...prev,
|
|
1114
1119
|
[hookName]: _hooks[hookName],
|
|
1115
1120
|
};
|
|
1116
1121
|
}
|
|
1117
|
-
|
|
1118
|
-
return prev;
|
|
1119
|
-
}
|
|
1122
|
+
return prev;
|
|
1120
1123
|
}, {});
|
|
1121
1124
|
}
|
|
1122
1125
|
function execShellCommand(cmd) {
|
|
@@ -1758,12 +1761,10 @@ function getOutputDefaultValue(answers) {
|
|
|
1758
1761
|
if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) {
|
|
1759
1762
|
return 'src/generated/graphql.tsx';
|
|
1760
1763
|
}
|
|
1761
|
-
|
|
1764
|
+
if (answers.plugins.some(plugin => plugin.defaultExtension === '.ts')) {
|
|
1762
1765
|
return 'src/generated/graphql.ts';
|
|
1763
1766
|
}
|
|
1764
|
-
|
|
1765
|
-
return 'src/generated/graphql.js';
|
|
1766
|
-
}
|
|
1767
|
+
return 'src/generated/graphql.js';
|
|
1767
1768
|
}
|
|
1768
1769
|
|
|
1769
1770
|
async function guessTargets() {
|
package/index.mjs
CHANGED
|
@@ -267,14 +267,19 @@ async function getPluginByName(name, pluginLoader) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
async function getPresetByName(name, loader) {
|
|
270
|
-
const possibleNames = [
|
|
270
|
+
const possibleNames = [
|
|
271
|
+
`@graphql-codegen/${name}`,
|
|
272
|
+
`@graphql-codegen/${name}-preset`,
|
|
273
|
+
name,
|
|
274
|
+
resolve(process.cwd(), name),
|
|
275
|
+
];
|
|
271
276
|
for (const moduleName of possibleNames) {
|
|
272
277
|
try {
|
|
273
278
|
const loaded = await loader(moduleName);
|
|
274
279
|
if (loaded && loaded.preset) {
|
|
275
280
|
return loaded.preset;
|
|
276
281
|
}
|
|
277
|
-
|
|
282
|
+
if (loaded && loaded.default) {
|
|
278
283
|
return loaded.default;
|
|
279
284
|
}
|
|
280
285
|
return loaded;
|
|
@@ -925,8 +930,8 @@ async function executeCodegen(input) {
|
|
|
925
930
|
const outputSchemaAst = await context.loadSchema(schemaPointerMap);
|
|
926
931
|
const outputSchema = getCachedDocumentNodeFromSchema(outputSchemaAst);
|
|
927
932
|
return {
|
|
928
|
-
outputSchemaAst
|
|
929
|
-
outputSchema
|
|
933
|
+
outputSchemaAst,
|
|
934
|
+
outputSchema,
|
|
930
935
|
};
|
|
931
936
|
});
|
|
932
937
|
outputSchemaAst = await result.outputSchemaAst;
|
|
@@ -943,7 +948,7 @@ async function executeCodegen(input) {
|
|
|
943
948
|
return cache('documents', hash, async () => {
|
|
944
949
|
const documents = await context.loadDocuments(docs);
|
|
945
950
|
return {
|
|
946
|
-
documents
|
|
951
|
+
documents,
|
|
947
952
|
};
|
|
948
953
|
});
|
|
949
954
|
}));
|
|
@@ -1066,7 +1071,7 @@ const DEFAULT_HOOKS = {
|
|
|
1066
1071
|
function normalizeHooks(_hooks) {
|
|
1067
1072
|
const keys = Object.keys({
|
|
1068
1073
|
...DEFAULT_HOOKS,
|
|
1069
|
-
...
|
|
1074
|
+
..._hooks,
|
|
1070
1075
|
});
|
|
1071
1076
|
return keys.reduce((prev, hookName) => {
|
|
1072
1077
|
if (typeof _hooks[hookName] === 'string') {
|
|
@@ -1075,21 +1080,19 @@ function normalizeHooks(_hooks) {
|
|
|
1075
1080
|
[hookName]: [_hooks[hookName]],
|
|
1076
1081
|
};
|
|
1077
1082
|
}
|
|
1078
|
-
|
|
1083
|
+
if (typeof _hooks[hookName] === 'function') {
|
|
1079
1084
|
return {
|
|
1080
1085
|
...prev,
|
|
1081
1086
|
[hookName]: [_hooks[hookName]],
|
|
1082
1087
|
};
|
|
1083
1088
|
}
|
|
1084
|
-
|
|
1089
|
+
if (Array.isArray(_hooks[hookName])) {
|
|
1085
1090
|
return {
|
|
1086
1091
|
...prev,
|
|
1087
1092
|
[hookName]: _hooks[hookName],
|
|
1088
1093
|
};
|
|
1089
1094
|
}
|
|
1090
|
-
|
|
1091
|
-
return prev;
|
|
1092
|
-
}
|
|
1095
|
+
return prev;
|
|
1093
1096
|
}, {});
|
|
1094
1097
|
}
|
|
1095
1098
|
function execShellCommand(cmd) {
|
|
@@ -1731,12 +1734,10 @@ function getOutputDefaultValue(answers) {
|
|
|
1731
1734
|
if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) {
|
|
1732
1735
|
return 'src/generated/graphql.tsx';
|
|
1733
1736
|
}
|
|
1734
|
-
|
|
1737
|
+
if (answers.plugins.some(plugin => plugin.defaultExtension === '.ts')) {
|
|
1735
1738
|
return 'src/generated/graphql.ts';
|
|
1736
1739
|
}
|
|
1737
|
-
|
|
1738
|
-
return 'src/generated/graphql.js';
|
|
1739
|
-
}
|
|
1740
|
+
return 'src/generated/graphql.js';
|
|
1740
1741
|
}
|
|
1741
1742
|
|
|
1742
1743
|
async function guessTargets() {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3-alpha-af9e4731c.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@graphql-codegen/core": "2.5.
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "2.4.
|
|
8
|
+
"@graphql-codegen/core": "2.5.1",
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^2.4.1",
|
|
10
10
|
"@graphql-tools/apollo-engine-loader": "^7.0.5",
|
|
11
11
|
"@graphql-tools/code-file-loader": "^7.0.6",
|
|
12
12
|
"@graphql-tools/git-loader": "^7.0.5",
|
|
@@ -24,10 +24,7 @@
|
|
|
24
24
|
"common-tags": "^1.8.0",
|
|
25
25
|
"cosmiconfig": "^7.0.0",
|
|
26
26
|
"debounce": "^1.2.0",
|
|
27
|
-
"dependency-graph": "^0.11.0",
|
|
28
27
|
"detect-indent": "^6.0.0",
|
|
29
|
-
"glob": "^7.1.6",
|
|
30
|
-
"globby": "^11.0.4",
|
|
31
28
|
"graphql-config": "^4.1.0",
|
|
32
29
|
"inquirer": "^8.0.0",
|
|
33
30
|
"is-glob": "^4.0.1",
|
|
@@ -36,12 +33,9 @@
|
|
|
36
33
|
"listr": "^0.14.3",
|
|
37
34
|
"listr-update-renderer": "^0.5.0",
|
|
38
35
|
"log-symbols": "^4.0.0",
|
|
39
|
-
"minimatch": "^4.0.0",
|
|
40
36
|
"mkdirp": "^1.0.4",
|
|
41
37
|
"string-env-interpolation": "^1.0.1",
|
|
42
38
|
"ts-log": "^2.2.3",
|
|
43
|
-
"tslib": "~2.3.0",
|
|
44
|
-
"valid-url": "^1.0.9",
|
|
45
39
|
"wrap-ansi": "^7.0.0",
|
|
46
40
|
"yaml": "^1.10.0",
|
|
47
41
|
"yargs": "^17.0.0"
|