From 0d0d2f66eb23cfc8676c95bc9a84f7eb24410740 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Fri, 20 Dec 2024 11:21:57 +0800 Subject: [PATCH] chore: update --- packages/plugin-auto-nav-sidebar/src/utils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/plugin-auto-nav-sidebar/src/utils.ts b/packages/plugin-auto-nav-sidebar/src/utils.ts index b244565c5..987047c71 100644 --- a/packages/plugin-auto-nav-sidebar/src/utils.ts +++ b/packages/plugin-auto-nav-sidebar/src/utils.ts @@ -5,9 +5,8 @@ import { logger } from '@rspress/shared/logger'; import { loadFrontMatter } from '@rspress/shared/node-utils'; /** - * * @param rawPathWithExtension /usr/rspress-demo/docs/api.md - * @param extensions e.g: [".md"] + * @returns /usr/rspress-demo/docs/api.md or undefined */ export async function detectFilePathWithExtension( rawPathWithExtension: string, @@ -17,10 +16,10 @@ export async function detectFilePathWithExtension( return undefined; } const stat = await fs.stat(rawPathWithExtension); - if (stat.isFile()) { - return rawPathWithExtension; + if (!stat.isFile()) { + return undefined; } - return undefined; + return rawPathWithExtension; } /**