UNPKG

746 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var graphql_codegen_core_1 = require("graphql-codegen-core");
4var graphql_tag_pluck_1 = require("graphql-tag-pluck");
5function extractDocumentStringFromCodeFile(source) {
6 try {
7 var parsed = graphql_codegen_core_1.parse(source.body);
8 if (parsed) {
9 return source.body;
10 }
11 }
12 catch (e) {
13 try {
14 return graphql_tag_pluck_1.default.fromFile.sync(source.name) || null;
15 }
16 catch (e) {
17 throw new e.constructor(e.message + " at " + source.name);
18 }
19 }
20}
21exports.extractDocumentStringFromCodeFile = extractDocumentStringFromCodeFile;
22//# sourceMappingURL=document-finder.js.map
\No newline at end of file