@graphql-codegen/cli 3.2.2-alpha-20230306154040-95172f49a → 3.2.2-alpha-20230306155406-7cc6595e7
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/config.js +1 -21
- package/esm/config.js +1 -21
- package/package.json +1 -2
package/cjs/config.js
CHANGED
|
@@ -8,7 +8,6 @@ const module_1 = require("module");
|
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
10
10
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
11
|
-
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
|
|
12
11
|
const graphql_1 = require("graphql");
|
|
13
12
|
const string_env_interpolation_1 = require("string-env-interpolation");
|
|
14
13
|
const yaml_1 = tslib_1.__importDefault(require("yaml"));
|
|
@@ -46,28 +45,12 @@ function customLoader(ext) {
|
|
|
46
45
|
if (ext === 'js') {
|
|
47
46
|
return cosmiconfig_1.defaultLoaders['.js'](filepath, content);
|
|
48
47
|
}
|
|
49
|
-
if (ext === '
|
|
48
|
+
if (ext === 'ts') {
|
|
50
49
|
const jiti = require('jiti')(__filename, {
|
|
51
50
|
interopDefault: true,
|
|
52
51
|
});
|
|
53
52
|
return jiti(filepath);
|
|
54
53
|
}
|
|
55
|
-
if (ext === 'ts') {
|
|
56
|
-
try {
|
|
57
|
-
// #8437: conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register.
|
|
58
|
-
const tsLoader = (0, cosmiconfig_typescript_loader_1.TypeScriptLoader)({ transpileOnly: true });
|
|
59
|
-
return tsLoader(filepath, content);
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
if (isRequireESMError(err)) {
|
|
63
|
-
const jiti = require('jiti')(__filename, {
|
|
64
|
-
interopDefault: true,
|
|
65
|
-
});
|
|
66
|
-
return jiti(filepath);
|
|
67
|
-
}
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
54
|
};
|
|
72
55
|
}
|
|
73
56
|
async function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }) {
|
|
@@ -374,6 +357,3 @@ function shouldEmitLegacyCommonJSImports(config) {
|
|
|
374
357
|
return globalValue;
|
|
375
358
|
}
|
|
376
359
|
exports.shouldEmitLegacyCommonJSImports = shouldEmitLegacyCommonJSImports;
|
|
377
|
-
function isRequireESMError(err) {
|
|
378
|
-
return typeof err.stack === 'string' && err.stack.startsWith('Error [ERR_REQUIRE_ESM]:');
|
|
379
|
-
}
|
package/esm/config.js
CHANGED
|
@@ -4,7 +4,6 @@ import { createRequire } from 'module';
|
|
|
4
4
|
import { resolve } from 'path';
|
|
5
5
|
import { createNoopProfiler, createProfiler, getCachedDocumentNodeFromSchema, } from '@graphql-codegen/plugin-helpers';
|
|
6
6
|
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
|
|
7
|
-
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader';
|
|
8
7
|
import { print } from 'graphql';
|
|
9
8
|
import { env } from 'string-env-interpolation';
|
|
10
9
|
import yaml from 'yaml';
|
|
@@ -41,28 +40,12 @@ function customLoader(ext) {
|
|
|
41
40
|
if (ext === 'js') {
|
|
42
41
|
return defaultLoaders['.js'](filepath, content);
|
|
43
42
|
}
|
|
44
|
-
if (ext === '
|
|
43
|
+
if (ext === 'ts') {
|
|
45
44
|
const jiti = require('jiti')(__filename, {
|
|
46
45
|
interopDefault: true,
|
|
47
46
|
});
|
|
48
47
|
return jiti(filepath);
|
|
49
48
|
}
|
|
50
|
-
if (ext === 'ts') {
|
|
51
|
-
try {
|
|
52
|
-
// #8437: conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register.
|
|
53
|
-
const tsLoader = TypeScriptLoader({ transpileOnly: true });
|
|
54
|
-
return tsLoader(filepath, content);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
if (isRequireESMError(err)) {
|
|
58
|
-
const jiti = require('jiti')(__filename, {
|
|
59
|
-
interopDefault: true,
|
|
60
|
-
});
|
|
61
|
-
return jiti(filepath);
|
|
62
|
-
}
|
|
63
|
-
throw err;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
49
|
};
|
|
67
50
|
}
|
|
68
51
|
export async function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }) {
|
|
@@ -360,6 +343,3 @@ export function shouldEmitLegacyCommonJSImports(config) {
|
|
|
360
343
|
// }
|
|
361
344
|
return globalValue;
|
|
362
345
|
}
|
|
363
|
-
function isRequireESMError(err) {
|
|
364
|
-
return typeof err.stack === 'string' && err.stack.startsWith('Error [ERR_REQUIRE_ESM]:');
|
|
365
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "3.2.2-alpha-
|
|
3
|
+
"version": "3.2.2-alpha-20230306155406-7cc6595e7",
|
|
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
|
"typescript": ">=3.0"
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"@whatwg-node/fetch": "^0.8.0",
|
|
26
26
|
"chalk": "^4.1.0",
|
|
27
27
|
"cosmiconfig": "^7.0.0",
|
|
28
|
-
"cosmiconfig-typescript-loader": "^4.3.0",
|
|
29
28
|
"debounce": "^1.2.0",
|
|
30
29
|
"detect-indent": "^6.0.0",
|
|
31
30
|
"graphql-config": "^4.5.0",
|