diff --git a/src/dev/dev_command.ts b/src/dev/dev_command.ts index fe190c7c..ec608044 100644 --- a/src/dev/dev_command.ts +++ b/src/dev/dev_command.ts @@ -26,7 +26,7 @@ export async function dev( } else { currentManifest = { islands: [], routes: [] }; } - const newManifest = await collect(dir, options); + const newManifest = await collect(dir, options?.router?.ignoreFilePattern); Deno.env.set("FRSH_DEV_PREVIOUS_MANIFEST", JSON.stringify(newManifest)); const manifestChanged = diff --git a/src/dev/mod.ts b/src/dev/mod.ts index 012707e7..401ec4bd 100644 --- a/src/dev/mod.ts +++ b/src/dev/mod.ts @@ -1,6 +1,5 @@ import { gte, join, posix, relative, walk, WalkEntry } from "./deps.ts"; import { error } from "./error.ts"; -import { FreshOptions } from "../server/mod.ts"; const MIN_DENO_VERSION = "1.31.0"; const TEST_FILE_PATTERN = /[._]test\.(?:[tj]sx?|[mc][tj]s)$/; @@ -24,7 +23,7 @@ export function ensureMinDenoVersion() { async function collectDir( dir: string, callback: (entry: WalkEntry, dir: string) => void, - options: FreshOptions, + ignoreFilePattern = TEST_FILE_PATTERN, ): Promise { // Check if provided path is a directory try { @@ -39,7 +38,7 @@ async function collectDir( includeDirs: false, includeFiles: true, exts: ["tsx", "jsx", "ts", "js"], - skip: [options?.router?.ignoreFilePattern || TEST_FILE_PATTERN], + skip: [ignoreFilePattern], }); for await (const entry of routesFolder) { @@ -55,7 +54,7 @@ export interface Manifest { const GROUP_REG = /[/\\\\]\((_[^/\\\\]+)\)[/\\\\]/; export async function collect( directory: string, - options: FreshOptions = {}, + ignoreFilePattern?: RegExp, ): Promise { const filePaths = new Set(); @@ -84,11 +83,11 @@ export async function collect( } filePaths.add(normalized); routes.push(rel); - }, options), + }, ignoreFilePattern), collectDir(join(directory, "./islands"), (entry, dir) => { const rel = join("islands", relative(dir, entry.path)); islands.push(rel); - }, options), + }, ignoreFilePattern), ]); routes.sort(); diff --git a/src/server/mod.ts b/src/server/mod.ts index dd979c6c..0aef119d 100644 --- a/src/server/mod.ts +++ b/src/server/mod.ts @@ -1,4 +1,3 @@ -import { LayoutConfig } from "$fresh/server.ts"; import { ServerContext } from "./context.ts"; export type { FromManifestOptions } from "./context.ts"; export { Status } from "./deps.ts"; @@ -7,6 +6,7 @@ import { Handler, Handlers, IslandModule, + LayoutConfig, MiddlewareModule, RouteConfig, ServeHandlerInfo, diff --git a/tests/dev_test.ts b/tests/dev_test.ts index e04f085f..0c82e293 100644 --- a/tests/dev_test.ts +++ b/tests/dev_test.ts @@ -6,7 +6,6 @@ Deno.test({ fn: async () => { const { routes } = await collect( join(dirname(fromFileUrl(import.meta.url)), "fixture"), - {}, ); assert( @@ -32,11 +31,7 @@ Deno.test({ dirname(fromFileUrl(import.meta.url)), "fixture_router_ignore_files", ), - { - router: { - ignoreFilePattern: /[\.|_]cy\.[t|j]s(x)?$/, - }, - }, + /[\.|_]cy\.[t|j]s(x)?$/, ); assert(