aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authornetop://ウィビ <paul@webb.page>2026-04-24 13:22:36 -0700
committernetop://ウィビ <paul@webb.page>2026-04-24 13:22:36 -0700
commit84e0d5ad8ebb8e933823d9dabc8060294a4780dc (patch)
tree7b6ef23f4284c140dcb33235e4fdf609dc658952 /source
parent5edb72ac0dfa94dc6184cc694e63c35fb373f317 (diff)
downloadgq-84e0d5ad8ebb8e933823d9dabc8060294a4780dc.tar.gz
gq-84e0d5ad8ebb8e933823d9dabc8060294a4780dc.zip
ensures dynamic imports are processed in the root directoryHEADprimary
Diffstat (limited to '')
-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)) {