apollo-codegen-core
Advanced tools
Comparing version 0.26.0 to 0.27.0
@@ -58,2 +58,5 @@ "use strict"; | ||
.map(inputPath => { | ||
if (localfs_1.fs.lstatSync(inputPath).isDirectory()) { | ||
return null; | ||
} | ||
const body = localfs_1.fs.readFileSync(inputPath, "utf8"); | ||
@@ -70,6 +73,17 @@ if (!body) { | ||
} | ||
return new graphql_1.Source(body, inputPath); | ||
if (inputPath.endsWith(".graphql") || inputPath.endsWith(".gql")) { | ||
return new graphql_1.Source(body, inputPath); | ||
} | ||
return null; | ||
}) | ||
.filter(source => source); | ||
return sources.map(source => graphql_1.parse(source)); | ||
.filter(source => source) | ||
.map(source => { | ||
try { | ||
return graphql_1.parse(source); | ||
} | ||
catch (_a) { | ||
return null; | ||
} | ||
}).filter(source => source); | ||
return sources; | ||
} | ||
@@ -76,0 +90,0 @@ exports.loadQueryDocuments = loadQueryDocuments; |
{ | ||
"name": "apollo-codegen-core", | ||
"description": "Core generator APIs for Apollo Codegen", | ||
"version": "0.26.0", | ||
"version": "0.27.0", | ||
"main": "./lib/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -87,2 +87,6 @@ import { fs } from "./localfs"; | ||
.map(inputPath => { | ||
if (fs.lstatSync(inputPath).isDirectory()) { | ||
return null; | ||
} | ||
const body = fs.readFileSync(inputPath, "utf8"); | ||
@@ -103,7 +107,18 @@ if (!body) { | ||
return new Source(body, inputPath); | ||
if (inputPath.endsWith(".graphql") || inputPath.endsWith(".gql")) { | ||
return new Source(body, inputPath); | ||
} | ||
return null; | ||
}) | ||
.filter(source => source); | ||
.filter(source => source) | ||
.map(source => { | ||
try { | ||
return parse(source!); | ||
} catch { | ||
return null; | ||
} | ||
}).filter(source => source); | ||
return (sources as Source[]).map(source => parse(source)); | ||
return sources as DocumentNode[]; | ||
} | ||
@@ -110,0 +125,0 @@ |
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
249926
5011