aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/import.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/import.ts b/source/import.ts
index 41786b9..f934ef8 100644
--- a/source/import.ts
+++ b/source/import.ts
@@ -7,13 +7,14 @@ import { dirname, resolve } from "@std/path";
/*** UTILITY ------------------------------------------ ***/
-const { readFileSync } = Deno;
const DYNAMIC_IMPORT_MARKER = "# DYNAMIC_IMPORTS";
const DYNAMIC_IMPORT_REGEX = /^#\s(DYNAMIC_IMPORTS)/gm;
const ENCODING = "utf-8";
const IMPORT_PATH_REGEX = /"([^"]+\.graphql)"/;
const IMPORT_REGEX = /^#\s(import)\s.*(.graphql")/gm;
+const { readFileSync } = Deno;
+
/*** EXPORT ------------------------------------------- ***/
/**
@@ -70,9 +71,14 @@ export async function importQL(path: string): Promise<string> {
const graphqlFiles: string[] = [];
for await (const dirEntry of Deno.readDir(entryDir)) {
+ /*** Process root-level files first... ***/
+ if (dirEntry.isFile && dirEntry.name.endsWith(".graphql") && entryPath !== resolve(entryDir, dirEntry.name))
+ graphqlFiles.push(resolve(entryDir, dirEntry.name));
+
if (!dirEntry.isDirectory)
continue;
+ /*** ...then handle subdirectory files ***/
const subDir = resolve(entryDir, dirEntry.name);
for await (const sub of Deno.readDir(subDir)) {