@graphql-tools/graphql-file-loader 7.1.1-alpha-e2ab84c8.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
@@ -7,6 +7,10 @@ export interface GraphQLFileLoaderOptions extends BaseLoaderOptions {
7
7
  * Set to `true` to disable handling `#import` syntax
8
8
  */
9
9
  skipGraphQLImport?: boolean;
10
+ /**
11
+ * Set to `true` to raise errors if any matched files are not valid GraphQL
12
+ */
13
+ noSilentErrors?: boolean;
10
14
  }
11
15
  /**
12
16
  * This loader loads documents and type definitions from `.graphql` files.
package/index.js CHANGED
@@ -76,11 +76,21 @@ class GraphQLFileLoader {
76
76
  return globs;
77
77
  }
78
78
  async resolveGlobs(glob, options) {
79
+ if (!glob.includes('*') &&
80
+ (await this.canLoad(glob, options)) &&
81
+ !utils.asArray(options.ignore || []).length &&
82
+ !options['includeSources'])
83
+ return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
79
84
  const globs = this._buildGlobs(glob, options);
80
85
  const result = await globby(globs, createGlobbyOptions(options));
81
86
  return result;
82
87
  }
83
88
  resolveGlobsSync(glob, options) {
89
+ if (!glob.includes('*') &&
90
+ this.canLoadSync(glob, options) &&
91
+ !utils.asArray(options.ignore || []).length &&
92
+ !options['includeSources'])
93
+ return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
84
94
  const globs = this._buildGlobs(glob, options);
85
95
  const result = globby.sync(globs, createGlobbyOptions(options));
86
96
  return result;
@@ -104,7 +114,7 @@ class GraphQLFileLoader {
104
114
  }
105
115
  }
106
116
  }));
107
- if (finalResult.length === 0 && errors.length > 0) {
117
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
108
118
  if (errors.length === 1) {
109
119
  throw errors[0];
110
120
  }
@@ -131,7 +141,7 @@ class GraphQLFileLoader {
131
141
  }
132
142
  }
133
143
  }
134
- if (finalResult.length === 0 && errors.length > 0) {
144
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
135
145
  if (errors.length === 1) {
136
146
  throw errors[0];
137
147
  }
package/index.mjs CHANGED
@@ -70,11 +70,21 @@ class GraphQLFileLoader {
70
70
  return globs;
71
71
  }
72
72
  async resolveGlobs(glob, options) {
73
+ if (!glob.includes('*') &&
74
+ (await this.canLoad(glob, options)) &&
75
+ !asArray(options.ignore || []).length &&
76
+ !options['includeSources'])
77
+ return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
73
78
  const globs = this._buildGlobs(glob, options);
74
79
  const result = await globby(globs, createGlobbyOptions(options));
75
80
  return result;
76
81
  }
77
82
  resolveGlobsSync(glob, options) {
83
+ if (!glob.includes('*') &&
84
+ this.canLoadSync(glob, options) &&
85
+ !asArray(options.ignore || []).length &&
86
+ !options['includeSources'])
87
+ return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
78
88
  const globs = this._buildGlobs(glob, options);
79
89
  const result = globby.sync(globs, createGlobbyOptions(options));
80
90
  return result;
@@ -98,7 +108,7 @@ class GraphQLFileLoader {
98
108
  }
99
109
  }
100
110
  }));
101
- if (finalResult.length === 0 && errors.length > 0) {
111
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
102
112
  if (errors.length === 1) {
103
113
  throw errors[0];
104
114
  }
@@ -125,7 +135,7 @@ class GraphQLFileLoader {
125
135
  }
126
136
  }
127
137
  }
128
- if (finalResult.length === 0 && errors.length > 0) {
138
+ if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {
129
139
  if (errors.length === 1) {
130
140
  throw errors[0];
131
141
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-tools/graphql-file-loader",
3
- "version": "7.1.1-alpha-e2ab84c8.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/import": "^6.4.0",
11
- "@graphql-tools/utils": "9.0.0-alpha-e2ab84c8.0",
10
+ "@graphql-tools/import": "^6.5.0",
11
+ "@graphql-tools/utils": "^8.2.0",
12
12
  "globby": "^11.0.3",
13
13
  "tslib": "~2.3.0",
14
14
  "unixify": "^1.0.0"