diff options
| author | netop://ウィビ <paul@webb.page> | 2026-04-24 13:22:36 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-04-24 13:22:36 -0700 |
| commit | 84e0d5ad8ebb8e933823d9dabc8060294a4780dc (patch) | |
| tree | 7b6ef23f4284c140dcb33235e4fdf609dc658952 /source/import.ts | |
| parent | 5edb72ac0dfa94dc6184cc694e63c35fb373f317 (diff) | |
| download | gq-84e0d5ad8ebb8e933823d9dabc8060294a4780dc.tar.gz gq-84e0d5ad8ebb8e933823d9dabc8060294a4780dc.zip | |
Diffstat (limited to 'source/import.ts')
| -rw-r--r-- | source/import.ts | 8 |
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)) { |