import { GENEROUTED_ROOT, ROUTES_ROOT } from "@/routing/constants"; /** * Generouted's `generateRegularRoutes` / `generatePreservedRoutes` strip `/src/pages/` * when building URL segments. Our views live under `/src/app/` (architecture convention), * so we remap glob keys before passing them to the core. * * Ref: https://github.com/oedotme/generouted/tree/main/examples/react-router-custom-path */ export function remapAppToPages(files: Record): Record { return Object.fromEntries( Object.entries(files).map(([key, value]) => [ key.replace(`${ROUTES_ROOT}/`, `${GENEROUTED_ROOT}/`), value, ]), ); }