From fef43b17dbb4d49a9c9cdbe79a4e708a55eb28b2 Mon Sep 17 00:00:00 2001 From: Romuald Brillout Date: Wed, 12 Jun 2024 10:06:33 +0200 Subject: [PATCH] fix: fix config inheritance of parentheses directories (fix #1690) --- .../v1-design/getVikeConfig/filesystemRouting.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts index c4f53fd17f..a28f2ef59c 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts @@ -57,7 +57,7 @@ function getLocationId( } /** Filesystem Routing: get the URL */ function getFilesystemRouteString(locationId: LocationId): string { - return getLogicalPath(locationId, ['renderer', 'pages', 'src', 'index']) + return getLogicalPath(locationId, ['renderer', 'pages', 'src', 'index'], true) } /** Filesystem Inheritance: get the apply root */ function getInheritanceRoot(locationId: LocationId): string { @@ -66,8 +66,8 @@ function getInheritanceRoot(locationId: LocationId): string { /** * getLogicalPath('/pages/some-page', ['pages']) => '/some-page' */ -function getLogicalPath(locationId: LocationId, ignoredDirs: string[]): string { - let logicalPath = removeIgnoredDirectories(locationId, ignoredDirs) +function getLogicalPath(locationId: LocationId, ignoredDirs: string[], removeParenthesesDirs?: true): string { + let logicalPath = removeIgnoredDirectories(locationId, ignoredDirs, removeParenthesesDirs) assertIsPath(logicalPath) return logicalPath } @@ -131,7 +131,7 @@ function isInherited(locationId1: LocationId, locationId2: LocationId): boolean return startsWith(inheritanceRoot2, inheritanceRoot1) } -function removeIgnoredDirectories(somePath: string, ignoredDirs: string[]): string { +function removeIgnoredDirectories(somePath: string, ignoredDirs: string[], removeParenthesesDirs?: true): string { assertPosixPath(somePath) somePath = somePath .split('/') @@ -139,7 +139,7 @@ function removeIgnoredDirectories(somePath: string, ignoredDirs: string[]): stri if (ignoredDirs.includes(dir)) { return false } - if (dir.startsWith('(') && dir.endsWith(')')) { + if (removeParenthesesDirs && dir.startsWith('(') && dir.endsWith(')')) { const dirname = dir.slice(1, -1) if (ignoredDirs.includes(dirname)) { const dirnameActual = dir