diff options
Diffstat (limited to '')
| -rw-r--r-- | deno.json | 2 | ||||
| -rw-r--r-- | source/import.ts | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -8,5 +8,5 @@ }, "license": "MIT", "name": "@eol/gq", - "version": "0.2.0" + "version": "0.3.0" } 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)) { |