From 84e0d5ad8ebb8e933823d9dabc8060294a4780dc Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Fri, 24 Apr 2026 13:22:36 -0700 Subject: ensures dynamic imports are processed in the root directory --- deno.json | 2 +- source/import.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deno.json b/deno.json index d876218..baa37cd 100644 --- a/deno.json +++ b/deno.json @@ -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 { 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)) { -- cgit v1.2.3