UNPKG

952 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var glob = require("glob");
4var graphql_codegen_core_1 = require("graphql-codegen-core");
5exports.documentsFromGlobs = function (documents) {
6 return Promise.all(documents.map(function (documentGlob) {
7 return new Promise(function (resolve, reject) {
8 glob(documentGlob, function (err, files) {
9 if (err) {
10 reject(err);
11 }
12 if (!files || files.length === 0) {
13 graphql_codegen_core_1.getLogger().warn("No files matched for glob expression: " + documentGlob);
14 }
15 resolve(files);
16 });
17 });
18 })).then(function (files) {
19 return files.length === 0
20 ? []
21 : files.reduce(function (a, b) {
22 return a.concat(b);
23 });
24 });
25};
26//# sourceMappingURL=documents-glob.js.map
\No newline at end of file