@graphql-tools/json-file-loader 7.2.1-alpha-be1b2ebd.0 → 7.3.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/index.d.ts CHANGED
@@ -3,6 +3,10 @@ import { Source, Loader, BaseLoaderOptions } from '@graphql-tools/utils';
3
3
  * Additional options for loading from a JSON file
4
4
  */
5
5
  export interface JsonFileLoaderOptions extends BaseLoaderOptions {
6
+ /**
7
+ * Set to `true` to raise errors if any matched files are not valid GraphQL
8
+ */
9
+ noSilentErrors?: boolean;
6
10
  }
7
11
  /**
8
12
  * This loader loads documents and type definitions from JSON files.
package/index.js CHANGED
@@ -99,7 +99,7 @@ class JsonFileLoader {
99
99
  }
100
100
  }
101
101
  }));
102
- if (finalResult.length === 0 && errors.length > 0) {
102
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
103
103
  if (errors.length === 1) {
104
104
  throw errors[0];
105
105
  }
@@ -126,7 +126,7 @@ class JsonFileLoader {
126
126
  }
127
127
  }
128
128
  }
129
- if (finalResult.length === 0 && errors.length > 0) {
129
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
130
130
  if (errors.length === 1) {
131
131
  throw errors[0];
132
132
  }
package/index.mjs CHANGED
@@ -93,7 +93,7 @@ class JsonFileLoader {
93
93
  }
94
94
  }
95
95
  }));
96
- if (finalResult.length === 0 && errors.length > 0) {
96
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
97
97
  if (errors.length === 1) {
98
98
  throw errors[0];
99
99
  }
@@ -120,7 +120,7 @@ class JsonFileLoader {
120
120
  }
121
121
  }
122
122
  }
123
- if (finalResult.length === 0 && errors.length > 0) {
123
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
124
124
  if (errors.length === 1) {
125
125
  throw errors[0];
126
126
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-tools/json-file-loader",
3
- "version": "7.2.1-alpha-be1b2ebd.0",
3
+ "version": "7.3.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-tools/utils": "9.0.0-alpha-be1b2ebd.0",
10
+ "@graphql-tools/utils": "^8.2.0",
11
11
  "globby": "^11.0.3",
12
12
  "tslib": "~2.3.0",
13
13
  "unixify": "^1.0.0"