@graphql-tools/code-file-loader 7.0.0-alpha-fa9b61b3.0 → 7.0.2
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/es5/index.d.ts +1 -0
- package/es5/index.js +32 -40
- package/es5/index.mjs +32 -40
- package/es5/package.json +3 -3
- package/index.d.ts +1 -0
- package/index.js +21 -24
- package/index.mjs +21 -24
- package/package.json +3 -3
package/es5/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare class CodeFileLoader implements Loader<CodeFileLoaderOptions> {
|
|
|
31
31
|
private getMergedOptions;
|
|
32
32
|
canLoad(pointer: string, options: CodeFileLoaderOptions): Promise<boolean>;
|
|
33
33
|
canLoadSync(pointer: string, options: CodeFileLoaderOptions): boolean;
|
|
34
|
+
private _buildGlobs;
|
|
34
35
|
resolveGlobs(glob: string, options: CodeFileLoaderOptions): Promise<string[]>;
|
|
35
36
|
resolveGlobsSync(glob: string, options: CodeFileLoaderOptions): string[];
|
|
36
37
|
load(pointer: string, options: CodeFileLoaderOptions): Promise<Source[]>;
|
package/es5/index.js
CHANGED
|
@@ -28,7 +28,6 @@ const graphql = require('graphql');
|
|
|
28
28
|
const utils = require('@graphql-tools/utils/es5');
|
|
29
29
|
const graphqlTagPluck = require('@graphql-tools/graphql-tag-pluck/es5');
|
|
30
30
|
const globby = _interopDefault(require('globby'));
|
|
31
|
-
const isGlob = _interopDefault(require('is-glob'));
|
|
32
31
|
const unixify = _interopDefault(require('unixify'));
|
|
33
32
|
const path = require('path');
|
|
34
33
|
const process = require('process');
|
|
@@ -219,6 +218,7 @@ var FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.vue'];
|
|
|
219
218
|
function createGlobbyOptions(options) {
|
|
220
219
|
return tslib.__assign(tslib.__assign({ absolute: true }, options), { ignore: [] });
|
|
221
220
|
}
|
|
221
|
+
var buildIgnoreGlob = function (path) { return "!" + path; };
|
|
222
222
|
/**
|
|
223
223
|
* This loader loads GraphQL documents and type definitions from code files
|
|
224
224
|
* using `graphql-tag-pluck`.
|
|
@@ -275,34 +275,38 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
275
275
|
}
|
|
276
276
|
return false;
|
|
277
277
|
};
|
|
278
|
+
CodeFileLoader.prototype._buildGlobs = function (glob, options) {
|
|
279
|
+
var ignores = utils.asArray(options.ignore || []);
|
|
280
|
+
var globs = tslib.__spreadArray([unixify(glob)], tslib.__read(ignores.map(function (v) { return buildIgnoreGlob(unixify(v)); })));
|
|
281
|
+
return globs;
|
|
282
|
+
};
|
|
278
283
|
CodeFileLoader.prototype.resolveGlobs = function (glob, options) {
|
|
279
284
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
280
|
-
var
|
|
285
|
+
var globs;
|
|
281
286
|
return tslib.__generator(this, function (_a) {
|
|
282
287
|
options = this.getMergedOptions(options);
|
|
283
|
-
|
|
284
|
-
return [2 /*return*/, globby(
|
|
288
|
+
globs = this._buildGlobs(glob, options);
|
|
289
|
+
return [2 /*return*/, globby(globs, createGlobbyOptions(options))];
|
|
285
290
|
});
|
|
286
291
|
});
|
|
287
292
|
};
|
|
288
293
|
CodeFileLoader.prototype.resolveGlobsSync = function (glob, options) {
|
|
289
294
|
options = this.getMergedOptions(options);
|
|
290
|
-
var
|
|
291
|
-
return globby.sync(
|
|
295
|
+
var globs = this._buildGlobs(glob, options);
|
|
296
|
+
return globby.sync(globs, createGlobbyOptions(options));
|
|
292
297
|
};
|
|
293
298
|
CodeFileLoader.prototype.load = function (pointer, options) {
|
|
294
299
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
295
|
-
var finalResult, resolvedPaths
|
|
300
|
+
var finalResult, resolvedPaths;
|
|
296
301
|
var _this = this;
|
|
297
|
-
return tslib.__generator(this, function (
|
|
298
|
-
switch (
|
|
302
|
+
return tslib.__generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
299
304
|
case 0:
|
|
300
305
|
options = this.getMergedOptions(options);
|
|
301
306
|
finalResult = [];
|
|
302
|
-
if (!isGlob(pointer)) return [3 /*break*/, 3];
|
|
303
307
|
return [4 /*yield*/, this.resolveGlobs(pointer, options)];
|
|
304
308
|
case 1:
|
|
305
|
-
resolvedPaths =
|
|
309
|
+
resolvedPaths = _a.sent();
|
|
306
310
|
return [4 /*yield*/, Promise.all(resolvedPaths.map(function (path) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
307
311
|
var _a, _b, _c, _d;
|
|
308
312
|
return tslib.__generator(this, function (_e) {
|
|
@@ -319,17 +323,8 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
319
323
|
});
|
|
320
324
|
}); }))];
|
|
321
325
|
case 2:
|
|
322
|
-
|
|
323
|
-
return [
|
|
324
|
-
case 3:
|
|
325
|
-
_b = (_a = finalResult.push).apply;
|
|
326
|
-
_c = [finalResult];
|
|
327
|
-
_d = [[]];
|
|
328
|
-
return [4 /*yield*/, this.handleSinglePath(pointer, options)];
|
|
329
|
-
case 4:
|
|
330
|
-
_b.apply(_a, _c.concat([tslib.__spreadArray.apply(void 0, _d.concat([tslib.__read.apply(void 0, [(_e.sent())])]))]));
|
|
331
|
-
_e.label = 5;
|
|
332
|
-
case 5: return [2 /*return*/, finalResult];
|
|
326
|
+
_a.sent();
|
|
327
|
+
return [2 /*return*/, finalResult];
|
|
333
328
|
}
|
|
334
329
|
});
|
|
335
330
|
});
|
|
@@ -337,28 +332,25 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
337
332
|
CodeFileLoader.prototype.loadSync = function (pointer, options) {
|
|
338
333
|
var e_1, _a;
|
|
339
334
|
options = this.getMergedOptions(options);
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
result === null || result === void 0 ? void 0 : result.forEach(function (result) { return finalResult_1.push(result); });
|
|
349
|
-
}
|
|
335
|
+
var resolvedPaths = this.resolveGlobsSync(pointer, options);
|
|
336
|
+
var finalResult = [];
|
|
337
|
+
try {
|
|
338
|
+
for (var resolvedPaths_1 = tslib.__values(resolvedPaths), resolvedPaths_1_1 = resolvedPaths_1.next(); !resolvedPaths_1_1.done; resolvedPaths_1_1 = resolvedPaths_1.next()) {
|
|
339
|
+
var path = resolvedPaths_1_1.value;
|
|
340
|
+
if (this.canLoadSync(path, options)) {
|
|
341
|
+
var result = this.handleSinglePathSync(path, options);
|
|
342
|
+
result === null || result === void 0 ? void 0 : result.forEach(function (result) { return finalResult.push(result); });
|
|
350
343
|
}
|
|
351
344
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
finally { if (e_1) throw e_1.error; }
|
|
345
|
+
}
|
|
346
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
347
|
+
finally {
|
|
348
|
+
try {
|
|
349
|
+
if (resolvedPaths_1_1 && !resolvedPaths_1_1.done && (_a = resolvedPaths_1.return)) _a.call(resolvedPaths_1);
|
|
358
350
|
}
|
|
359
|
-
|
|
351
|
+
finally { if (e_1) throw e_1.error; }
|
|
360
352
|
}
|
|
361
|
-
return
|
|
353
|
+
return finalResult;
|
|
362
354
|
};
|
|
363
355
|
CodeFileLoader.prototype.handleSinglePath = function (location, options) {
|
|
364
356
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
package/es5/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { isSchema, parse, buildClientSchema } from 'graphql';
|
|
|
3
3
|
import { isValidPath, asArray, parseGraphQLSDL, isDocumentNode } from '@graphql-tools/utils/es5';
|
|
4
4
|
import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync } from '@graphql-tools/graphql-tag-pluck/es5';
|
|
5
5
|
import globby from 'globby';
|
|
6
|
-
import isGlob from 'is-glob';
|
|
7
6
|
import unixify from 'unixify';
|
|
8
7
|
import { isAbsolute, resolve } from 'path';
|
|
9
8
|
import { cwd, env } from 'process';
|
|
@@ -194,6 +193,7 @@ var FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.vue'];
|
|
|
194
193
|
function createGlobbyOptions(options) {
|
|
195
194
|
return __assign(__assign({ absolute: true }, options), { ignore: [] });
|
|
196
195
|
}
|
|
196
|
+
var buildIgnoreGlob = function (path) { return "!" + path; };
|
|
197
197
|
/**
|
|
198
198
|
* This loader loads GraphQL documents and type definitions from code files
|
|
199
199
|
* using `graphql-tag-pluck`.
|
|
@@ -250,34 +250,38 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
250
250
|
}
|
|
251
251
|
return false;
|
|
252
252
|
};
|
|
253
|
+
CodeFileLoader.prototype._buildGlobs = function (glob, options) {
|
|
254
|
+
var ignores = asArray(options.ignore || []);
|
|
255
|
+
var globs = __spreadArray([unixify(glob)], __read(ignores.map(function (v) { return buildIgnoreGlob(unixify(v)); })));
|
|
256
|
+
return globs;
|
|
257
|
+
};
|
|
253
258
|
CodeFileLoader.prototype.resolveGlobs = function (glob, options) {
|
|
254
259
|
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
-
var
|
|
260
|
+
var globs;
|
|
256
261
|
return __generator(this, function (_a) {
|
|
257
262
|
options = this.getMergedOptions(options);
|
|
258
|
-
|
|
259
|
-
return [2 /*return*/, globby(
|
|
263
|
+
globs = this._buildGlobs(glob, options);
|
|
264
|
+
return [2 /*return*/, globby(globs, createGlobbyOptions(options))];
|
|
260
265
|
});
|
|
261
266
|
});
|
|
262
267
|
};
|
|
263
268
|
CodeFileLoader.prototype.resolveGlobsSync = function (glob, options) {
|
|
264
269
|
options = this.getMergedOptions(options);
|
|
265
|
-
var
|
|
266
|
-
return globby.sync(
|
|
270
|
+
var globs = this._buildGlobs(glob, options);
|
|
271
|
+
return globby.sync(globs, createGlobbyOptions(options));
|
|
267
272
|
};
|
|
268
273
|
CodeFileLoader.prototype.load = function (pointer, options) {
|
|
269
274
|
return __awaiter(this, void 0, void 0, function () {
|
|
270
|
-
var finalResult, resolvedPaths
|
|
275
|
+
var finalResult, resolvedPaths;
|
|
271
276
|
var _this = this;
|
|
272
|
-
return __generator(this, function (
|
|
273
|
-
switch (
|
|
277
|
+
return __generator(this, function (_a) {
|
|
278
|
+
switch (_a.label) {
|
|
274
279
|
case 0:
|
|
275
280
|
options = this.getMergedOptions(options);
|
|
276
281
|
finalResult = [];
|
|
277
|
-
if (!isGlob(pointer)) return [3 /*break*/, 3];
|
|
278
282
|
return [4 /*yield*/, this.resolveGlobs(pointer, options)];
|
|
279
283
|
case 1:
|
|
280
|
-
resolvedPaths =
|
|
284
|
+
resolvedPaths = _a.sent();
|
|
281
285
|
return [4 /*yield*/, Promise.all(resolvedPaths.map(function (path) { return __awaiter(_this, void 0, void 0, function () {
|
|
282
286
|
var _a, _b, _c, _d;
|
|
283
287
|
return __generator(this, function (_e) {
|
|
@@ -294,17 +298,8 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
294
298
|
});
|
|
295
299
|
}); }))];
|
|
296
300
|
case 2:
|
|
297
|
-
|
|
298
|
-
return [
|
|
299
|
-
case 3:
|
|
300
|
-
_b = (_a = finalResult.push).apply;
|
|
301
|
-
_c = [finalResult];
|
|
302
|
-
_d = [[]];
|
|
303
|
-
return [4 /*yield*/, this.handleSinglePath(pointer, options)];
|
|
304
|
-
case 4:
|
|
305
|
-
_b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_e.sent())])]))]));
|
|
306
|
-
_e.label = 5;
|
|
307
|
-
case 5: return [2 /*return*/, finalResult];
|
|
301
|
+
_a.sent();
|
|
302
|
+
return [2 /*return*/, finalResult];
|
|
308
303
|
}
|
|
309
304
|
});
|
|
310
305
|
});
|
|
@@ -312,28 +307,25 @@ var CodeFileLoader = /** @class */ (function () {
|
|
|
312
307
|
CodeFileLoader.prototype.loadSync = function (pointer, options) {
|
|
313
308
|
var e_1, _a;
|
|
314
309
|
options = this.getMergedOptions(options);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
result === null || result === void 0 ? void 0 : result.forEach(function (result) { return finalResult_1.push(result); });
|
|
324
|
-
}
|
|
310
|
+
var resolvedPaths = this.resolveGlobsSync(pointer, options);
|
|
311
|
+
var finalResult = [];
|
|
312
|
+
try {
|
|
313
|
+
for (var resolvedPaths_1 = __values(resolvedPaths), resolvedPaths_1_1 = resolvedPaths_1.next(); !resolvedPaths_1_1.done; resolvedPaths_1_1 = resolvedPaths_1.next()) {
|
|
314
|
+
var path = resolvedPaths_1_1.value;
|
|
315
|
+
if (this.canLoadSync(path, options)) {
|
|
316
|
+
var result = this.handleSinglePathSync(path, options);
|
|
317
|
+
result === null || result === void 0 ? void 0 : result.forEach(function (result) { return finalResult.push(result); });
|
|
325
318
|
}
|
|
326
319
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
finally { if (e_1) throw e_1.error; }
|
|
320
|
+
}
|
|
321
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
322
|
+
finally {
|
|
323
|
+
try {
|
|
324
|
+
if (resolvedPaths_1_1 && !resolvedPaths_1_1.done && (_a = resolvedPaths_1.return)) _a.call(resolvedPaths_1);
|
|
333
325
|
}
|
|
334
|
-
|
|
326
|
+
finally { if (e_1) throw e_1.error; }
|
|
335
327
|
}
|
|
336
|
-
return
|
|
328
|
+
return finalResult;
|
|
337
329
|
};
|
|
338
330
|
CodeFileLoader.prototype.handleSinglePath = function (location, options) {
|
|
339
331
|
return __awaiter(this, void 0, void 0, function () {
|
package/es5/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/code-file-loader/es5",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
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"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/graphql-tag-pluck": "7.0.
|
|
11
|
-
"@graphql-tools/utils": "8.0.
|
|
10
|
+
"@graphql-tools/graphql-tag-pluck": "^7.0.2",
|
|
11
|
+
"@graphql-tools/utils": "8.0.2",
|
|
12
12
|
"globby": "^11.0.3",
|
|
13
13
|
"is-glob": "^4.0.1",
|
|
14
14
|
"tslib": "~2.3.0",
|
package/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare class CodeFileLoader implements Loader<CodeFileLoaderOptions> {
|
|
|
31
31
|
private getMergedOptions;
|
|
32
32
|
canLoad(pointer: string, options: CodeFileLoaderOptions): Promise<boolean>;
|
|
33
33
|
canLoadSync(pointer: string, options: CodeFileLoaderOptions): boolean;
|
|
34
|
+
private _buildGlobs;
|
|
34
35
|
resolveGlobs(glob: string, options: CodeFileLoaderOptions): Promise<string[]>;
|
|
35
36
|
resolveGlobsSync(glob: string, options: CodeFileLoaderOptions): string[];
|
|
36
37
|
load(pointer: string, options: CodeFileLoaderOptions): Promise<Source[]>;
|
package/index.js
CHANGED
|
@@ -27,7 +27,6 @@ const graphql = require('graphql');
|
|
|
27
27
|
const utils = require('@graphql-tools/utils');
|
|
28
28
|
const graphqlTagPluck = require('@graphql-tools/graphql-tag-pluck');
|
|
29
29
|
const globby = _interopDefault(require('globby'));
|
|
30
|
-
const isGlob = _interopDefault(require('is-glob'));
|
|
31
30
|
const unixify = _interopDefault(require('unixify'));
|
|
32
31
|
const path = require('path');
|
|
33
32
|
const process = require('process');
|
|
@@ -180,6 +179,7 @@ const FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.vue'];
|
|
|
180
179
|
function createGlobbyOptions(options) {
|
|
181
180
|
return { absolute: true, ...options, ignore: [] };
|
|
182
181
|
}
|
|
182
|
+
const buildIgnoreGlob = (path) => `!${path}`;
|
|
183
183
|
/**
|
|
184
184
|
* This loader loads GraphQL documents and type definitions from code files
|
|
185
185
|
* using `graphql-tag-pluck`.
|
|
@@ -227,44 +227,41 @@ class CodeFileLoader {
|
|
|
227
227
|
}
|
|
228
228
|
return false;
|
|
229
229
|
}
|
|
230
|
+
_buildGlobs(glob, options) {
|
|
231
|
+
const ignores = utils.asArray(options.ignore || []);
|
|
232
|
+
const globs = [unixify(glob), ...ignores.map(v => buildIgnoreGlob(unixify(v)))];
|
|
233
|
+
return globs;
|
|
234
|
+
}
|
|
230
235
|
async resolveGlobs(glob, options) {
|
|
231
236
|
options = this.getMergedOptions(options);
|
|
232
|
-
const
|
|
233
|
-
return globby(
|
|
237
|
+
const globs = this._buildGlobs(glob, options);
|
|
238
|
+
return globby(globs, createGlobbyOptions(options));
|
|
234
239
|
}
|
|
235
240
|
resolveGlobsSync(glob, options) {
|
|
236
241
|
options = this.getMergedOptions(options);
|
|
237
|
-
const
|
|
238
|
-
return globby.sync(
|
|
242
|
+
const globs = this._buildGlobs(glob, options);
|
|
243
|
+
return globby.sync(globs, createGlobbyOptions(options));
|
|
239
244
|
}
|
|
240
245
|
async load(pointer, options) {
|
|
241
246
|
options = this.getMergedOptions(options);
|
|
242
247
|
const finalResult = [];
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}));
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
finalResult.push(...(await this.handleSinglePath(pointer, options)));
|
|
251
|
-
}
|
|
248
|
+
const resolvedPaths = await this.resolveGlobs(pointer, options);
|
|
249
|
+
await Promise.all(resolvedPaths.map(async (path) => {
|
|
250
|
+
finalResult.push(...(await this.handleSinglePath(path, options)));
|
|
251
|
+
}));
|
|
252
252
|
return finalResult;
|
|
253
253
|
}
|
|
254
254
|
loadSync(pointer, options) {
|
|
255
255
|
options = this.getMergedOptions(options);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
result === null || result === void 0 ? void 0 : result.forEach(result => finalResult.push(result));
|
|
263
|
-
}
|
|
256
|
+
const resolvedPaths = this.resolveGlobsSync(pointer, options);
|
|
257
|
+
const finalResult = [];
|
|
258
|
+
for (const path of resolvedPaths) {
|
|
259
|
+
if (this.canLoadSync(path, options)) {
|
|
260
|
+
const result = this.handleSinglePathSync(path, options);
|
|
261
|
+
result === null || result === void 0 ? void 0 : result.forEach(result => finalResult.push(result));
|
|
264
262
|
}
|
|
265
|
-
return finalResult;
|
|
266
263
|
}
|
|
267
|
-
return
|
|
264
|
+
return finalResult;
|
|
268
265
|
}
|
|
269
266
|
async handleSinglePath(location, options) {
|
|
270
267
|
if (!(await this.canLoad(location, options))) {
|
package/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { isSchema, parse, buildClientSchema } from 'graphql';
|
|
|
2
2
|
import { isValidPath, asArray, parseGraphQLSDL, isDocumentNode } from '@graphql-tools/utils';
|
|
3
3
|
import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync } from '@graphql-tools/graphql-tag-pluck';
|
|
4
4
|
import globby from 'globby';
|
|
5
|
-
import isGlob from 'is-glob';
|
|
6
5
|
import unixify from 'unixify';
|
|
7
6
|
import { isAbsolute, resolve } from 'path';
|
|
8
7
|
import { cwd, env } from 'process';
|
|
@@ -155,6 +154,7 @@ const FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.vue'];
|
|
|
155
154
|
function createGlobbyOptions(options) {
|
|
156
155
|
return { absolute: true, ...options, ignore: [] };
|
|
157
156
|
}
|
|
157
|
+
const buildIgnoreGlob = (path) => `!${path}`;
|
|
158
158
|
/**
|
|
159
159
|
* This loader loads GraphQL documents and type definitions from code files
|
|
160
160
|
* using `graphql-tag-pluck`.
|
|
@@ -202,44 +202,41 @@ class CodeFileLoader {
|
|
|
202
202
|
}
|
|
203
203
|
return false;
|
|
204
204
|
}
|
|
205
|
+
_buildGlobs(glob, options) {
|
|
206
|
+
const ignores = asArray(options.ignore || []);
|
|
207
|
+
const globs = [unixify(glob), ...ignores.map(v => buildIgnoreGlob(unixify(v)))];
|
|
208
|
+
return globs;
|
|
209
|
+
}
|
|
205
210
|
async resolveGlobs(glob, options) {
|
|
206
211
|
options = this.getMergedOptions(options);
|
|
207
|
-
const
|
|
208
|
-
return globby(
|
|
212
|
+
const globs = this._buildGlobs(glob, options);
|
|
213
|
+
return globby(globs, createGlobbyOptions(options));
|
|
209
214
|
}
|
|
210
215
|
resolveGlobsSync(glob, options) {
|
|
211
216
|
options = this.getMergedOptions(options);
|
|
212
|
-
const
|
|
213
|
-
return globby.sync(
|
|
217
|
+
const globs = this._buildGlobs(glob, options);
|
|
218
|
+
return globby.sync(globs, createGlobbyOptions(options));
|
|
214
219
|
}
|
|
215
220
|
async load(pointer, options) {
|
|
216
221
|
options = this.getMergedOptions(options);
|
|
217
222
|
const finalResult = [];
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}));
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
finalResult.push(...(await this.handleSinglePath(pointer, options)));
|
|
226
|
-
}
|
|
223
|
+
const resolvedPaths = await this.resolveGlobs(pointer, options);
|
|
224
|
+
await Promise.all(resolvedPaths.map(async (path) => {
|
|
225
|
+
finalResult.push(...(await this.handleSinglePath(path, options)));
|
|
226
|
+
}));
|
|
227
227
|
return finalResult;
|
|
228
228
|
}
|
|
229
229
|
loadSync(pointer, options) {
|
|
230
230
|
options = this.getMergedOptions(options);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
result === null || result === void 0 ? void 0 : result.forEach(result => finalResult.push(result));
|
|
238
|
-
}
|
|
231
|
+
const resolvedPaths = this.resolveGlobsSync(pointer, options);
|
|
232
|
+
const finalResult = [];
|
|
233
|
+
for (const path of resolvedPaths) {
|
|
234
|
+
if (this.canLoadSync(path, options)) {
|
|
235
|
+
const result = this.handleSinglePathSync(path, options);
|
|
236
|
+
result === null || result === void 0 ? void 0 : result.forEach(result => finalResult.push(result));
|
|
239
237
|
}
|
|
240
|
-
return finalResult;
|
|
241
238
|
}
|
|
242
|
-
return
|
|
239
|
+
return finalResult;
|
|
243
240
|
}
|
|
244
241
|
async handleSinglePath(location, options) {
|
|
245
242
|
if (!(await this.canLoad(location, options))) {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/code-file-loader",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
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"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/graphql-tag-pluck": "7.0.
|
|
11
|
-
"@graphql-tools/utils": "8.0.
|
|
10
|
+
"@graphql-tools/graphql-tag-pluck": "^7.0.2",
|
|
11
|
+
"@graphql-tools/utils": "8.0.2",
|
|
12
12
|
"globby": "^11.0.3",
|
|
13
13
|
"is-glob": "^4.0.1",
|
|
14
14
|
"tslib": "~2.3.0",
|