From 41a75fe1f563470fe2bfd6b2e5ff2d0c8d8ee19a Mon Sep 17 00:00:00 2001 From: Geoff Flarity Date: Sat, 27 May 2023 03:44:35 -0400 Subject: [PATCH] chore: remove stale workaround in `collect()` (#1078) The issue in question, https://github.com/denoland/deno_std/issues/1310, has been marked complete. Looks like the underlying issue has been fixed. So this just removes the comment/unnecessary code. --------- Co-authored-by: Asher Gomez --- src/dev/mod.ts | 7 +------ src/server/context.ts | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/dev/mod.ts b/src/dev/mod.ts index 37bf5aaa..f9329dc5 100644 --- a/src/dev/mod.ts +++ b/src/dev/mod.ts @@ -40,11 +40,6 @@ export async function collect(directory: string): Promise { const routes = []; try { const routesUrl = toFileUrl(routesDir); - // TODO(lucacasonato): remove the extranious Deno.readDir when - // https://github.com/denoland/deno_std/issues/1310 is fixed. - for await (const _ of Deno.readDir(routesDir)) { - // do nothing - } const routesFolder = walk(routesDir, { includeDirs: false, includeFiles: true, @@ -59,7 +54,7 @@ export async function collect(directory: string): Promise { } } } catch (err) { - if (err instanceof Deno.errors.NotFound) { + if (err.cause instanceof Deno.errors.NotFound) { // Do nothing. } else { throw err; diff --git a/src/server/context.ts b/src/server/context.ts index 78301886..e2ca2d7d 100644 --- a/src/server/context.ts +++ b/src/server/context.ts @@ -249,11 +249,6 @@ export class ServerContext { opts.staticDir ?? "./static", manifest.baseUrl, ); - // TODO(lucacasonato): remove the extranious Deno.readDir when - // https://github.com/denoland/deno_std/issues/1310 is fixed. - for await (const _ of Deno.readDir(fromFileUrl(staticFolder))) { - // do nothing - } const entires = walk(fromFileUrl(staticFolder), { includeFiles: true, includeDirs: false, @@ -284,7 +279,7 @@ export class ServerContext { staticFiles.push(staticFile); } } catch (err) { - if (err instanceof Deno.errors.NotFound) { + if (err.cause instanceof Deno.errors.NotFound) { // Do nothing. } else { throw err;