@graphql-codegen/cli 5.0.6-alpha-20250329081240-1a64f6d2f211bdd3623a04b001a1dab8e0c92d3c → 5.0.6-alpha-20250402151940-923b53c5bfe3b8f8352770396f1a9454840c7b45

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/codegen.js CHANGED
@@ -316,6 +316,8 @@ async function executeCodegen(input) {
316
316
  rendererOptions: {
317
317
  clearOutput: false,
318
318
  collapse: true,
319
+ formatOutput: 'wrap',
320
+ removeEmptyLines: false,
319
321
  },
320
322
  renderer: config.verbose ? 'verbose' : 'default',
321
323
  ctx: { errors: [] },
package/cjs/load.js CHANGED
@@ -13,6 +13,7 @@ const json_file_loader_1 = require("@graphql-tools/json-file-loader");
13
13
  const load_1 = require("@graphql-tools/load");
14
14
  const prisma_loader_1 = require("@graphql-tools/prisma-loader");
15
15
  const url_loader_1 = require("@graphql-tools/url-loader");
16
+ const graphql_1 = require("graphql");
16
17
  exports.defaultSchemaLoadOptions = {
17
18
  assumeValidSDL: true,
18
19
  sort: true,
@@ -44,22 +45,17 @@ async function loadSchema(schemaPointers, config) {
44
45
  return schema;
45
46
  }
46
47
  catch (e) {
47
- throw new Error(`
48
- Failed to load schema from ${Object.keys(schemaPointers).join(',')}:
49
-
50
- ${e.message || e}
51
- ${e.stack || ''}
52
-
53
- GraphQL Code Generator supports:
54
- - ES Modules and CommonJS exports (export as default or named export "schema")
55
- - Introspection JSON File
56
- - URL of GraphQL endpoint
57
- - Multiple files with type definitions (glob expression)
58
- - String in config file
59
-
60
- Try to use one of above options and run codegen again.
61
-
62
- `);
48
+ throw new Error([
49
+ `Failed to load schema from ${Object.keys(schemaPointers).join(',')}:`,
50
+ printError(e),
51
+ '\nGraphQL Code Generator supports:',
52
+ '\n- ES Modules and CommonJS exports (export as default or named export "schema")',
53
+ '- Introspection JSON File',
54
+ '- URL of GraphQL endpoint',
55
+ '- Multiple files with type definitions (glob expression)',
56
+ '- String in config file',
57
+ '\nTry to use one of above options and run codegen again.\n',
58
+ ].join('\n'));
63
59
  }
64
60
  }
65
61
  async function loadDocuments(documentPointers, config) {
@@ -94,6 +90,12 @@ async function loadDocuments(documentPointers, config) {
94
90
  catch (error) {
95
91
  if (config.ignoreNoDocuments)
96
92
  return [];
97
- throw error;
93
+ throw new Error([`Failed to load documents from ${Object.keys(documentPointers).join(',')}:`, printError(error)].join('\n'));
98
94
  }
99
95
  }
96
+ const printError = (error) => {
97
+ if (error instanceof graphql_1.GraphQLError) {
98
+ return String(error);
99
+ }
100
+ return [String(error.message || error), String(error.stack)].join('\n');
101
+ };
package/esm/codegen.js CHANGED
@@ -312,6 +312,8 @@ export async function executeCodegen(input) {
312
312
  rendererOptions: {
313
313
  clearOutput: false,
314
314
  collapse: true,
315
+ formatOutput: 'wrap',
316
+ removeEmptyLines: false,
315
317
  },
316
318
  renderer: config.verbose ? 'verbose' : 'default',
317
319
  ctx: { errors: [] },
package/esm/load.js CHANGED
@@ -8,6 +8,7 @@ import { JsonFileLoader } from '@graphql-tools/json-file-loader';
8
8
  import { loadDocuments as loadDocumentsToolkit, loadSchema as loadSchemaToolkit, } from '@graphql-tools/load';
9
9
  import { PrismaLoader } from '@graphql-tools/prisma-loader';
10
10
  import { UrlLoader } from '@graphql-tools/url-loader';
11
+ import { GraphQLError } from 'graphql';
11
12
  export const defaultSchemaLoadOptions = {
12
13
  assumeValidSDL: true,
13
14
  sort: true,
@@ -39,22 +40,17 @@ export async function loadSchema(schemaPointers, config) {
39
40
  return schema;
40
41
  }
41
42
  catch (e) {
42
- throw new Error(`
43
- Failed to load schema from ${Object.keys(schemaPointers).join(',')}:
44
-
45
- ${e.message || e}
46
- ${e.stack || ''}
47
-
48
- GraphQL Code Generator supports:
49
- - ES Modules and CommonJS exports (export as default or named export "schema")
50
- - Introspection JSON File
51
- - URL of GraphQL endpoint
52
- - Multiple files with type definitions (glob expression)
53
- - String in config file
54
-
55
- Try to use one of above options and run codegen again.
56
-
57
- `);
43
+ throw new Error([
44
+ `Failed to load schema from ${Object.keys(schemaPointers).join(',')}:`,
45
+ printError(e),
46
+ '\nGraphQL Code Generator supports:',
47
+ '\n- ES Modules and CommonJS exports (export as default or named export "schema")',
48
+ '- Introspection JSON File',
49
+ '- URL of GraphQL endpoint',
50
+ '- Multiple files with type definitions (glob expression)',
51
+ '- String in config file',
52
+ '\nTry to use one of above options and run codegen again.\n',
53
+ ].join('\n'));
58
54
  }
59
55
  }
60
56
  export async function loadDocuments(documentPointers, config) {
@@ -89,6 +85,12 @@ export async function loadDocuments(documentPointers, config) {
89
85
  catch (error) {
90
86
  if (config.ignoreNoDocuments)
91
87
  return [];
92
- throw error;
88
+ throw new Error([`Failed to load documents from ${Object.keys(documentPointers).join(',')}:`, printError(error)].join('\n'));
93
89
  }
94
90
  }
91
+ const printError = (error) => {
92
+ if (error instanceof GraphQLError) {
93
+ return String(error);
94
+ }
95
+ return [String(error.message || error), String(error.stack)].join('\n');
96
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "5.0.6-alpha-20250329081240-1a64f6d2f211bdd3623a04b001a1dab8e0c92d3c",
3
+ "version": "5.0.6-alpha-20250402151940-923b53c5bfe3b8f8352770396f1a9454840c7b45",
4
4
  "peerDependenciesMeta": {
5
5
  "@parcel/watcher": {
6
6
  "optional": true
@@ -14,9 +14,9 @@
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.8.1-alpha-20250329081240-1a64f6d2f211bdd3623a04b001a1dab8e0c92d3c",
18
- "@graphql-codegen/core": "4.0.3-alpha-20250329081240-1a64f6d2f211bdd3623a04b001a1dab8e0c92d3c",
19
- "@graphql-codegen/plugin-helpers": "6.0.0-alpha-20250329081240-1a64f6d2f211bdd3623a04b001a1dab8e0c92d3c",
17
+ "@graphql-codegen/client-preset": "^4.6.0",
18
+ "@graphql-codegen/core": "^4.0.2",
19
+ "@graphql-codegen/plugin-helpers": "^5.0.3",
20
20
  "@graphql-tools/apollo-engine-loader": "^8.0.0",
21
21
  "@graphql-tools/code-file-loader": "^8.0.0",
22
22
  "@graphql-tools/git-loader": "^8.0.0",