From 3193008eb7c27441dce2e3be536ee69d11573c60 Mon Sep 17 00:00:00 2001 From: Savas Vedova Date: Fri, 13 Oct 2023 22:48:34 +0200 Subject: [PATCH] chore: use path.sep instead of forward slash --- src/utils/filesys.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/filesys.ts b/src/utils/filesys.ts index f61ed9f..21bb73c 100644 --- a/src/utils/filesys.ts +++ b/src/utils/filesys.ts @@ -67,7 +67,7 @@ export const parseFileName = ( // /users/[id]/index.js => /users/:id export const fileToRoute = (file: string): string => { - const fileName = file.split("/").pop()?.split(".")[0]; + const fileName = file.split(path.sep).pop()?.split(".")[0]; let normalized = file.replace(/\[([a-zA-Z0-9_\.:-]*)\]/g, ":$1"); if (fileName === "index") { @@ -76,7 +76,7 @@ export const fileToRoute = (file: string): string => { normalized = normalized.split(".")[0]; } - return path.join("/", normalized); + return path.join(path.sep, normalized); }; export const matchPath = ( @@ -89,7 +89,7 @@ export const matchPath = ( for (const file of files) { const parsed = parseFileName(file.name); - if (file.name.startsWith("_") || file.rel.indexOf("/_") > -1) { + if (file.name.startsWith("_") || file.rel.indexOf(`${path.sep}_`) > -1) { continue; }