From ac551580e619086d8260c6bc08820f93b6ed92a3 Mon Sep 17 00:00:00 2001 From: Jeremy Kimber Date: Wed, 22 Sep 2021 14:49:36 -0500 Subject: [PATCH] check that module paths are directories before globbing them Signed-off-by: Jeremy Kimber --- src/utils/docsFinder.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/docsFinder.ts b/src/utils/docsFinder.ts index 7c71a413..5ffe9a8f 100644 --- a/src/utils/docsFinder.ts +++ b/src/utils/docsFinder.ts @@ -17,6 +17,9 @@ export async function findDocumentation( | 'builtin_doc_fragment' | 'collection_doc_fragment' ): Promise { + if (!fs.existsSync(dir) || fs.lstatSync(dir).isFile()) { + return []; + } let files; switch (kind) { case 'builtin': @@ -74,6 +77,9 @@ export async function findPluginRouting( kind: 'builtin' | 'collection' ): Promise { const pluginRouting = new Map(); + if (!fs.existsSync(dir) || fs.lstatSync(dir).isFile()) { + return pluginRouting; + } let files; switch (kind) { case 'builtin':