Skip to content

Commit

Permalink
fix: fix config inheritance of parentheses directories (fix #1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jun 12, 2024
1 parent 7ee7085 commit fef43b1
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -131,15 +131,15 @@ 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('/')
.filter((dir) => {
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
Expand Down

0 comments on commit fef43b1

Please sign in to comment.