@graphql-tools/load-files
Advanced tools
Comparing version 6.4.0 to 6.5.0
15
index.js
@@ -31,2 +31,3 @@ 'use strict'; | ||
const fs = require('fs'); | ||
const graphql = require('graphql'); | ||
@@ -133,3 +134,4 @@ const { readFile, stat } = fs.promises; | ||
else { | ||
return fs.readFileSync(path$1, { encoding: 'utf-8' }); | ||
const maybeSDL = fs.readFileSync(path$1, { encoding: 'utf-8' }); | ||
return tryToParse(maybeSDL); | ||
} | ||
@@ -193,3 +195,4 @@ }) | ||
else { | ||
return readFile(path$1, { encoding: 'utf-8' }); | ||
const maybeSDL = await readFile(path$1, { encoding: 'utf-8' }); | ||
return tryToParse(maybeSDL); | ||
} | ||
@@ -202,4 +205,12 @@ })); | ||
} | ||
function tryToParse(maybeSDL) { | ||
try { | ||
return graphql.parse(maybeSDL); | ||
} | ||
catch (e) { | ||
return maybeSDL; | ||
} | ||
} | ||
exports.loadFiles = loadFiles; | ||
exports.loadFilesSync = loadFilesSync; |
{ | ||
"name": "@graphql-tools/load-files", | ||
"version": "6.4.0", | ||
"version": "6.5.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
16916
5
416