feat: create [...catch_all] route (#210)

This commit is contained in:
Valerio Ageno
2024-12-10 19:30:35 +01:00
committed by GitHub
parent 704255774d
commit 8467506915
12 changed files with 152 additions and 41 deletions
@@ -15,7 +15,6 @@ import {
removeGroups,
removeLastSlash,
removeUnderscores,
removeLayoutSegments,
} from './utils'
import type { Config, RouteNode } from './types'
@@ -61,8 +60,7 @@ async function getRouteNodes(
}
const filePath = replaceBackslash(path.join(dir, dirent.name))
const filePathNoExt = removeExt(filePath)
let routePath =
cleanPath(`/${filePathNoExt.split('.').join('/')}`) || ''
let routePath = cleanPath(`/${filePathNoExt}`) || ''
const variableName = routePathToVariable(routePath)
@@ -139,7 +137,7 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
node.path = determineNodePath(node)
node.cleanedPath = removeLastSlash(
removeGroups(removeUnderscores(removeLayoutSegments(node.path)) ?? ''),
removeGroups(removeUnderscores(node.path) ?? ''),
)
if (node.parent) {