@graphql-codegen/cli 5.0.6-alpha-20250414130746-ce186e8baaf19e3ceeae8f4ea77e326ca9c9ec58 → 5.0.6-alpha-20250414132312-2cacfbb956012f0df94008f4636b6c03ccca15b4

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
@@ -8,7 +8,6 @@ const os_1 = require("os");
8
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
9
  const core_1 = require("@graphql-codegen/core");
10
10
  const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
11
- const load_1 = require("@graphql-tools/load");
12
11
  const graphql_1 = require("graphql");
13
12
  const listr2_1 = require("listr2");
14
13
  const config_js_1 = require("./config.js");
@@ -222,7 +221,7 @@ async function executeCodegen(input) {
222
221
  };
223
222
  }
224
223
  catch (error) {
225
- if (error instanceof load_1.NoTypeDefinitionsFound && config.ignoreNoDocuments) {
224
+ if (config.ignoreNoDocuments) {
226
225
  return {
227
226
  documents: [],
228
227
  };
@@ -124,7 +124,9 @@ function isConfiguredOutput(output) {
124
124
  }
125
125
  async function hashFile(filePath) {
126
126
  try {
127
- return hash(await (0, file_system_js_1.readFile)(filePath));
127
+ const fileContent = await (0, file_system_js_1.readFile)(filePath);
128
+ fileContent.replace(/\r\n/g, '\n');
129
+ return hash(fileContent);
128
130
  }
129
131
  catch (err) {
130
132
  if (err && err.code === 'ENOENT') {
package/cjs/load.js CHANGED
@@ -88,11 +88,8 @@ async function loadDocuments(documentPointers, config) {
88
88
  return loadedFromToolkit;
89
89
  }
90
90
  catch (error) {
91
- // NoTypeDefinitionsFound from `@graphql-tools/load` already has a message with pointer, so we can just rethrow the error
92
- if (error instanceof load_1.NoTypeDefinitionsFound) {
93
- throw error;
94
- }
95
- // For other errors, we need to add an error message with documentPointers, so it's better for DevX
91
+ if (config.ignoreNoDocuments)
92
+ return [];
96
93
  throw new Error([`Failed to load documents from ${Object.keys(documentPointers).join(',')}:`, printError(error)].join('\n'));
97
94
  }
98
95
  }
package/esm/codegen.js CHANGED
@@ -4,7 +4,6 @@ import { cpus } from 'os';
4
4
  import path from 'path';
5
5
  import { codegen } from '@graphql-codegen/core';
6
6
  import { getCachedDocumentNodeFromSchema, normalizeConfig, normalizeInstanceOrArray, normalizeOutputParam, } from '@graphql-codegen/plugin-helpers';
7
- import { NoTypeDefinitionsFound } from '@graphql-tools/load';
8
7
  import { GraphQLError } from 'graphql';
9
8
  import { Listr } from 'listr2';
10
9
  import { ensureContext, shouldEmitLegacyCommonJSImports } from './config.js';
@@ -218,7 +217,7 @@ export async function executeCodegen(input) {
218
217
  };
219
218
  }
220
219
  catch (error) {
221
- if (error instanceof NoTypeDefinitionsFound && config.ignoreNoDocuments) {
220
+ if (config.ignoreNoDocuments) {
222
221
  return {
223
222
  documents: [],
224
223
  };
@@ -121,7 +121,9 @@ function isConfiguredOutput(output) {
121
121
  }
122
122
  async function hashFile(filePath) {
123
123
  try {
124
- return hash(await readFile(filePath));
124
+ const fileContent = await readFile(filePath);
125
+ fileContent.replace(/\r\n/g, '\n');
126
+ return hash(fileContent);
125
127
  }
126
128
  catch (err) {
127
129
  if (err && err.code === 'ENOENT') {
package/esm/load.js CHANGED
@@ -5,7 +5,7 @@ import { GitLoader } from '@graphql-tools/git-loader';
5
5
  import { GithubLoader } from '@graphql-tools/github-loader';
6
6
  import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
7
7
  import { JsonFileLoader } from '@graphql-tools/json-file-loader';
8
- import { loadDocuments as loadDocumentsToolkit, loadSchema as loadSchemaToolkit, NoTypeDefinitionsFound, } from '@graphql-tools/load';
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
11
  import { GraphQLError } from 'graphql';
@@ -83,11 +83,8 @@ export async function loadDocuments(documentPointers, config) {
83
83
  return loadedFromToolkit;
84
84
  }
85
85
  catch (error) {
86
- // NoTypeDefinitionsFound from `@graphql-tools/load` already has a message with pointer, so we can just rethrow the error
87
- if (error instanceof NoTypeDefinitionsFound) {
88
- throw error;
89
- }
90
- // For other errors, we need to add an error message with documentPointers, so it's better for DevX
86
+ if (config.ignoreNoDocuments)
87
+ return [];
91
88
  throw new Error([`Failed to load documents from ${Object.keys(documentPointers).join(',')}:`, printError(error)].join('\n'));
92
89
  }
93
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "5.0.6-alpha-20250414130746-ce186e8baaf19e3ceeae8f4ea77e326ca9c9ec58",
3
+ "version": "5.0.6-alpha-20250414132312-2cacfbb956012f0df94008f4636b6c03ccca15b4",
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.8.1-alpha-20250414130746-ce186e8baaf19e3ceeae8f4ea77e326ca9c9ec58",
17
+ "@graphql-codegen/client-preset": "4.8.1-alpha-20250414132312-2cacfbb956012f0df94008f4636b6c03ccca15b4",
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",
@@ -23,7 +23,7 @@
23
23
  "@graphql-tools/github-loader": "^8.0.0",
24
24
  "@graphql-tools/graphql-file-loader": "^8.0.0",
25
25
  "@graphql-tools/json-file-loader": "^8.0.0",
26
- "@graphql-tools/load": "^8.1.0",
26
+ "@graphql-tools/load": "^8.0.0",
27
27
  "@graphql-tools/prisma-loader": "^8.0.0",
28
28
  "@graphql-tools/url-loader": "^8.0.0",
29
29
  "@graphql-tools/utils": "^10.0.0",
@@ -32,7 +32,7 @@
32
32
  "cosmiconfig": "^8.1.3",
33
33
  "debounce": "^1.2.0",
34
34
  "detect-indent": "^6.0.0",
35
- "graphql-config": "^5.1.4",
35
+ "graphql-config": "^5.1.1",
36
36
  "inquirer": "^8.0.0",
37
37
  "is-glob": "^4.0.1",
38
38
  "jiti": "^1.17.1",