@graphql-codegen/cli 2.7.0-alpha-929a21bcb.0 → 2.7.0-alpha-8c5d97899.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 +11 -15
- package/bin.mjs +1869 -0
- package/index.js +11 -15
- package/index.mjs +11 -15
- package/package.json +6 -5
package/index.js
CHANGED
|
@@ -306,7 +306,7 @@ async function getPresetByName(name, loader) {
|
|
|
306
306
|
if (loaded && loaded.preset) {
|
|
307
307
|
return loaded.preset;
|
|
308
308
|
}
|
|
309
|
-
|
|
309
|
+
if (loaded && loaded.default) {
|
|
310
310
|
return loaded.default;
|
|
311
311
|
}
|
|
312
312
|
return loaded;
|
|
@@ -612,7 +612,7 @@ function buildOptions() {
|
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
614
|
function parseArgv(argv = process.argv) {
|
|
615
|
-
return yargs.options(buildOptions()).parse(
|
|
615
|
+
return yargs(argv).options(buildOptions()).parse();
|
|
616
616
|
}
|
|
617
617
|
async function createContext(cliFlags = parseArgv(process.argv)) {
|
|
618
618
|
if (cliFlags.require && cliFlags.require.length > 0) {
|
|
@@ -957,8 +957,8 @@ async function executeCodegen(input) {
|
|
|
957
957
|
const outputSchemaAst = await context.loadSchema(schemaPointerMap);
|
|
958
958
|
const outputSchema = pluginHelpers.getCachedDocumentNodeFromSchema(outputSchemaAst);
|
|
959
959
|
return {
|
|
960
|
-
outputSchemaAst
|
|
961
|
-
outputSchema
|
|
960
|
+
outputSchemaAst,
|
|
961
|
+
outputSchema,
|
|
962
962
|
};
|
|
963
963
|
});
|
|
964
964
|
outputSchemaAst = await result.outputSchemaAst;
|
|
@@ -975,7 +975,7 @@ async function executeCodegen(input) {
|
|
|
975
975
|
return cache('documents', hash, async () => {
|
|
976
976
|
const documents = await context.loadDocuments(docs);
|
|
977
977
|
return {
|
|
978
|
-
documents
|
|
978
|
+
documents,
|
|
979
979
|
};
|
|
980
980
|
});
|
|
981
981
|
}));
|
|
@@ -1098,7 +1098,7 @@ const DEFAULT_HOOKS = {
|
|
|
1098
1098
|
function normalizeHooks(_hooks) {
|
|
1099
1099
|
const keys = Object.keys({
|
|
1100
1100
|
...DEFAULT_HOOKS,
|
|
1101
|
-
...
|
|
1101
|
+
..._hooks,
|
|
1102
1102
|
});
|
|
1103
1103
|
return keys.reduce((prev, hookName) => {
|
|
1104
1104
|
if (typeof _hooks[hookName] === 'string') {
|
|
@@ -1107,21 +1107,19 @@ function normalizeHooks(_hooks) {
|
|
|
1107
1107
|
[hookName]: [_hooks[hookName]],
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
1110
|
-
|
|
1110
|
+
if (typeof _hooks[hookName] === 'function') {
|
|
1111
1111
|
return {
|
|
1112
1112
|
...prev,
|
|
1113
1113
|
[hookName]: [_hooks[hookName]],
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
|
-
|
|
1116
|
+
if (Array.isArray(_hooks[hookName])) {
|
|
1117
1117
|
return {
|
|
1118
1118
|
...prev,
|
|
1119
1119
|
[hookName]: _hooks[hookName],
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
-
|
|
1123
|
-
return prev;
|
|
1124
|
-
}
|
|
1122
|
+
return prev;
|
|
1125
1123
|
}, {});
|
|
1126
1124
|
}
|
|
1127
1125
|
function execShellCommand(cmd) {
|
|
@@ -1763,12 +1761,10 @@ function getOutputDefaultValue(answers) {
|
|
|
1763
1761
|
if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) {
|
|
1764
1762
|
return 'src/generated/graphql.tsx';
|
|
1765
1763
|
}
|
|
1766
|
-
|
|
1764
|
+
if (answers.plugins.some(plugin => plugin.defaultExtension === '.ts')) {
|
|
1767
1765
|
return 'src/generated/graphql.ts';
|
|
1768
1766
|
}
|
|
1769
|
-
|
|
1770
|
-
return 'src/generated/graphql.js';
|
|
1771
|
-
}
|
|
1767
|
+
return 'src/generated/graphql.js';
|
|
1772
1768
|
}
|
|
1773
1769
|
|
|
1774
1770
|
async function guessTargets() {
|
package/index.mjs
CHANGED
|
@@ -279,7 +279,7 @@ async function getPresetByName(name, loader) {
|
|
|
279
279
|
if (loaded && loaded.preset) {
|
|
280
280
|
return loaded.preset;
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
if (loaded && loaded.default) {
|
|
283
283
|
return loaded.default;
|
|
284
284
|
}
|
|
285
285
|
return loaded;
|
|
@@ -585,7 +585,7 @@ function buildOptions() {
|
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
587
|
function parseArgv(argv = process.argv) {
|
|
588
|
-
return yargs.options(buildOptions()).parse(
|
|
588
|
+
return yargs(argv).options(buildOptions()).parse();
|
|
589
589
|
}
|
|
590
590
|
async function createContext(cliFlags = parseArgv(process.argv)) {
|
|
591
591
|
if (cliFlags.require && cliFlags.require.length > 0) {
|
|
@@ -930,8 +930,8 @@ async function executeCodegen(input) {
|
|
|
930
930
|
const outputSchemaAst = await context.loadSchema(schemaPointerMap);
|
|
931
931
|
const outputSchema = getCachedDocumentNodeFromSchema(outputSchemaAst);
|
|
932
932
|
return {
|
|
933
|
-
outputSchemaAst
|
|
934
|
-
outputSchema
|
|
933
|
+
outputSchemaAst,
|
|
934
|
+
outputSchema,
|
|
935
935
|
};
|
|
936
936
|
});
|
|
937
937
|
outputSchemaAst = await result.outputSchemaAst;
|
|
@@ -948,7 +948,7 @@ async function executeCodegen(input) {
|
|
|
948
948
|
return cache('documents', hash, async () => {
|
|
949
949
|
const documents = await context.loadDocuments(docs);
|
|
950
950
|
return {
|
|
951
|
-
documents
|
|
951
|
+
documents,
|
|
952
952
|
};
|
|
953
953
|
});
|
|
954
954
|
}));
|
|
@@ -1071,7 +1071,7 @@ const DEFAULT_HOOKS = {
|
|
|
1071
1071
|
function normalizeHooks(_hooks) {
|
|
1072
1072
|
const keys = Object.keys({
|
|
1073
1073
|
...DEFAULT_HOOKS,
|
|
1074
|
-
...
|
|
1074
|
+
..._hooks,
|
|
1075
1075
|
});
|
|
1076
1076
|
return keys.reduce((prev, hookName) => {
|
|
1077
1077
|
if (typeof _hooks[hookName] === 'string') {
|
|
@@ -1080,21 +1080,19 @@ function normalizeHooks(_hooks) {
|
|
|
1080
1080
|
[hookName]: [_hooks[hookName]],
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
|
-
|
|
1083
|
+
if (typeof _hooks[hookName] === 'function') {
|
|
1084
1084
|
return {
|
|
1085
1085
|
...prev,
|
|
1086
1086
|
[hookName]: [_hooks[hookName]],
|
|
1087
1087
|
};
|
|
1088
1088
|
}
|
|
1089
|
-
|
|
1089
|
+
if (Array.isArray(_hooks[hookName])) {
|
|
1090
1090
|
return {
|
|
1091
1091
|
...prev,
|
|
1092
1092
|
[hookName]: _hooks[hookName],
|
|
1093
1093
|
};
|
|
1094
1094
|
}
|
|
1095
|
-
|
|
1096
|
-
return prev;
|
|
1097
|
-
}
|
|
1095
|
+
return prev;
|
|
1098
1096
|
}, {});
|
|
1099
1097
|
}
|
|
1100
1098
|
function execShellCommand(cmd) {
|
|
@@ -1736,12 +1734,10 @@ function getOutputDefaultValue(answers) {
|
|
|
1736
1734
|
if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) {
|
|
1737
1735
|
return 'src/generated/graphql.tsx';
|
|
1738
1736
|
}
|
|
1739
|
-
|
|
1737
|
+
if (answers.plugins.some(plugin => plugin.defaultExtension === '.ts')) {
|
|
1740
1738
|
return 'src/generated/graphql.ts';
|
|
1741
1739
|
}
|
|
1742
|
-
|
|
1743
|
-
return 'src/generated/graphql.js';
|
|
1744
|
-
}
|
|
1740
|
+
return 'src/generated/graphql.js';
|
|
1745
1741
|
}
|
|
1746
1742
|
|
|
1747
1743
|
async function guessTargets() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "2.7.0-alpha-
|
|
3
|
+
"version": "2.7.0-alpha-8c5d97899.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
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@graphql-codegen/core": "2.5.1",
|
|
9
9
|
"@graphql-codegen/plugin-helpers": "^2.4.1",
|
|
10
10
|
"@graphql-tools/apollo-engine-loader": "^7.0.5",
|
|
11
|
-
"@graphql-tools/code-file-loader": "^7.2.
|
|
11
|
+
"@graphql-tools/code-file-loader": "^7.2.17",
|
|
12
12
|
"@graphql-tools/git-loader": "^7.0.5",
|
|
13
13
|
"@graphql-tools/github-loader": "^7.0.5",
|
|
14
14
|
"@graphql-tools/graphql-file-loader": "^7.0.5",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"debounce": "^1.2.0",
|
|
27
27
|
"dependency-graph": "^0.11.0",
|
|
28
28
|
"detect-indent": "^6.0.0",
|
|
29
|
-
"glob": "^
|
|
29
|
+
"glob": "^8.0.0",
|
|
30
30
|
"globby": "^11.0.4",
|
|
31
31
|
"graphql-config": "^4.1.0",
|
|
32
32
|
"inquirer": "^8.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"mkdirp": "^1.0.4",
|
|
41
41
|
"string-env-interpolation": "^1.0.1",
|
|
42
42
|
"ts-log": "^2.2.3",
|
|
43
|
-
"tslib": "~2.
|
|
43
|
+
"tslib": "~2.4.0",
|
|
44
44
|
"valid-url": "^1.0.9",
|
|
45
45
|
"wrap-ansi": "^7.0.0",
|
|
46
46
|
"yaml": "^1.10.0",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"bin": {
|
|
92
92
|
"gql-gen": "bin.js",
|
|
93
93
|
"graphql-codegen": "bin.js",
|
|
94
|
-
"graphql-code-generator": "bin.js"
|
|
94
|
+
"graphql-code-generator": "bin.js",
|
|
95
|
+
"graphql-codegen-esm": "bin.mjs"
|
|
95
96
|
}
|
|
96
97
|
}
|