From d3726fc3a27d5956ea1f14f6424cc747087e98a0 Mon Sep 17 00:00:00 2001
From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Date: Fri, 31 Jan 2025 17:42:52 +1300
Subject: [PATCH 1/5] test(router-generator): failing test case
---
.../routes/(group-a)/_layout-a.tsx | 9 +++++++++
.../routes/(group-a)/_layout-a/login.tsx | 9 +++++++++
.../routes/(group-a)/_layout-a/signup.tsx | 9 +++++++++
.../routes/(group-b)/_layout-b.tsx | 9 +++++++++
.../routes/(group-b)/_layout-b/dashboard.tsx | 9 +++++++++
.../routes/(group-c)/_layout-c.tsx | 9 +++++++++
.../routes/(group-c)/_layout-c/index.tsx | 9 +++++++++
.../routes/__root.tsx | 15 +++++++++++++++
8 files changed, 78 insertions(+)
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/login.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/signup.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b/dashboard.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c/index.tsx
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/__root.tsx
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a.tsx
new file mode 100644
index 0000000000..e41597bd14
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-a)/_layout-a')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return
Hello "/(group-a)/_layout-a"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/login.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/login.tsx
new file mode 100644
index 0000000000..100a98b815
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/login.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-a)/_layout-a/login')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-a)/_layout-a/login"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/signup.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/signup.tsx
new file mode 100644
index 0000000000..2214d268e7
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/signup.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-a)/_layout-a/signup')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-a)/_layout-a/signup"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b.tsx
new file mode 100644
index 0000000000..9dc9043617
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-b)/_layout-b')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-b)/_layout-b"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b/dashboard.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b/dashboard.tsx
new file mode 100644
index 0000000000..c265a00158
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b/dashboard.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-b)/_layout-b/dashboard')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-b)/_layout/dashboard"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c.tsx
new file mode 100644
index 0000000000..37483d2b5d
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-c)/_layout-c')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-c)/_layout-c"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c/index.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c/index.tsx
new file mode 100644
index 0000000000..31a16f0515
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c/index.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group-c)/_layout-c/')({
+ component: RouteComponent,
+})
+
+function RouteComponent() {
+ return Hello "/(group-c)/_layout-c/"!
+}
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/__root.tsx b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/__root.tsx
new file mode 100644
index 0000000000..3797d7bf8c
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/__root.tsx
@@ -0,0 +1,15 @@
+import * as React from 'react'
+import { Outlet, createRootRoute } from '@tanstack/react-router'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+})
+
+function RootComponent() {
+ return (
+
+ Hello "__root"!
+
+
+ )
+}
From 8edd32fb0c460ea0630f76f6291d7a34f30ac316 Mon Sep 17 00:00:00 2001
From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Date: Fri, 31 Jan 2025 17:43:30 +1300
Subject: [PATCH 2/5] fix(router-generator): reset regex state on each call of
`handleNode`
---
packages/router-generator/src/generator.ts | 29 +++++++++++++++++++++-
packages/router-generator/src/utils.ts | 13 ++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index c714e3f896..8ca6df77f1 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -10,6 +10,7 @@ import {
removeTrailingSlash,
removeUnderscores,
replaceBackslash,
+ resetRegex,
routePathToVariable,
trimPathLeft,
writeIfDifferent,
@@ -158,6 +159,11 @@ export async function generator(config: Config, root: string) {
await handleRootNode(rootRouteNode)
const handleNode = async (node: RouteNode) => {
+ // Do not remove this as we need to set the lastIndex to 0 as it
+ // is necessary to reset the regex's index when using the global flag
+ // otherwise it might not match the next time it's used
+ resetRegex(routeGroupPatternRegex)
+
let parentRoute = hasParentRoute(routeNodes, node, node.routePath)
// if the parent route is a virtual parent route, we need to find the real parent route
@@ -358,6 +364,25 @@ export async function generator(config: Config, root: string) {
),
config,
)
+ // console.debug('preRouteNodes', preRouteNodes)
+ // console.debug(
+ // 'routeNodes - group-b',
+ // [...routeNodes]
+ // .filter((r) => r.filePath.startsWith('(group-b)'))
+ // .map((r) => {
+ // r.parent = undefined
+ // return r
+ // }),
+ // )
+ // console.debug(
+ // 'routeNodes - group-c',
+ // [...routeNodes]
+ // .filter((r) => r.filePath.startsWith('(group-c)'))
+ // .map((r) => {
+ // r.parent = undefined
+ // return r
+ // }),
+ // )
const startAPIRouteNodes: Array = checkStartAPIRoutes(
preRouteNodes.filter((d) => d.isAPIRoute),
@@ -524,7 +549,9 @@ export async function generator(config: Config, root: string) {
`const ${node.variableName}Route = ${node.variableName}Import.update({
${[
`id: '${node.path}'`,
- !node.isNonPath ? `path: '${node.cleanedPath}'` : undefined,
+ node.isNonPath === false
+ ? `path: '${node.cleanedPath}'`
+ : undefined,
`getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`,
]
.filter(Boolean)
diff --git a/packages/router-generator/src/utils.ts b/packages/router-generator/src/utils.ts
index 01051f8c20..1ff4f83832 100644
--- a/packages/router-generator/src/utils.ts
+++ b/packages/router-generator/src/utils.ts
@@ -150,3 +150,16 @@ export async function writeIfDifferent(
return false
}
+
+/**
+ * This function resets the regex index to 0 so that it can be reused
+ * without having to create a new regex object or worry about the last
+ * state when using the global flag.
+ *
+ * @param regex The regex object to reset
+ * @returns
+ */
+export function resetRegex(regex: RegExp) {
+ regex.lastIndex = 0
+ return
+}
From e62be5edb5b78fbd1630ab2095c6567857c05a92 Mon Sep 17 00:00:00 2001
From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Date: Fri, 31 Jan 2025 17:43:43 +1300
Subject: [PATCH 3/5] test(router-generator): checkin snapshot
---
.../routeTree.snapshot.ts | 369 ++++++++++++++++++
1 file changed, 369 insertions(+)
create mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts
diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts
new file mode 100644
index 0000000000..9a8c43334d
--- /dev/null
+++ b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts
@@ -0,0 +1,369 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
+
+import { createFileRoute } from '@tanstack/react-router'
+
+// Import Routes
+
+import { Route as rootRoute } from './routes/__root'
+import { Route as groupCLayoutCImport } from './routes/(group-c)/_layout-c'
+import { Route as groupBLayoutBImport } from './routes/(group-b)/_layout-b'
+import { Route as groupALayoutAImport } from './routes/(group-a)/_layout-a'
+import { Route as groupCLayoutCIndexImport } from './routes/(group-c)/_layout-c/index'
+import { Route as groupBLayoutBDashboardImport } from './routes/(group-b)/_layout-b/dashboard'
+import { Route as groupALayoutASignupImport } from './routes/(group-a)/_layout-a/signup'
+import { Route as groupALayoutALoginImport } from './routes/(group-a)/_layout-a/login'
+
+// Create Virtual Routes
+
+const groupCImport = createFileRoute('/(group-c)')()
+const groupBImport = createFileRoute('/(group-b)')()
+const groupAImport = createFileRoute('/(group-a)')()
+
+// Create/Update Routes
+
+const groupCRoute = groupCImport.update({
+ id: '/(group-c)',
+ getParentRoute: () => rootRoute,
+} as any)
+
+const groupBRoute = groupBImport.update({
+ id: '/(group-b)',
+ getParentRoute: () => rootRoute,
+} as any)
+
+const groupARoute = groupAImport.update({
+ id: '/(group-a)',
+ getParentRoute: () => rootRoute,
+} as any)
+
+const groupCLayoutCRoute = groupCLayoutCImport.update({
+ id: '/_layout-c',
+ getParentRoute: () => groupCRoute,
+} as any)
+
+const groupBLayoutBRoute = groupBLayoutBImport.update({
+ id: '/_layout-b',
+ getParentRoute: () => groupBRoute,
+} as any)
+
+const groupALayoutARoute = groupALayoutAImport.update({
+ id: '/_layout-a',
+ getParentRoute: () => groupARoute,
+} as any)
+
+const groupCLayoutCIndexRoute = groupCLayoutCIndexImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => groupCLayoutCRoute,
+} as any)
+
+const groupBLayoutBDashboardRoute = groupBLayoutBDashboardImport.update({
+ id: '/dashboard',
+ path: '/dashboard',
+ getParentRoute: () => groupBLayoutBRoute,
+} as any)
+
+const groupALayoutASignupRoute = groupALayoutASignupImport.update({
+ id: '/signup',
+ path: '/signup',
+ getParentRoute: () => groupALayoutARoute,
+} as any)
+
+const groupALayoutALoginRoute = groupALayoutALoginImport.update({
+ id: '/login',
+ path: '/login',
+ getParentRoute: () => groupALayoutARoute,
+} as any)
+
+// Populate the FileRoutesByPath interface
+
+declare module '@tanstack/react-router' {
+ interface FileRoutesByPath {
+ '/(group-a)': {
+ id: '/(group-a)'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupAImport
+ parentRoute: typeof rootRoute
+ }
+ '/(group-a)/_layout-a': {
+ id: '/(group-a)/_layout-a'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupALayoutAImport
+ parentRoute: typeof groupARoute
+ }
+ '/(group-b)': {
+ id: '/(group-b)'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupBImport
+ parentRoute: typeof rootRoute
+ }
+ '/(group-b)/_layout-b': {
+ id: '/(group-b)/_layout-b'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupBLayoutBImport
+ parentRoute: typeof groupBRoute
+ }
+ '/(group-c)': {
+ id: '/(group-c)'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupCImport
+ parentRoute: typeof rootRoute
+ }
+ '/(group-c)/_layout-c': {
+ id: '/(group-c)/_layout-c'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupCLayoutCImport
+ parentRoute: typeof groupCRoute
+ }
+ '/(group-a)/_layout-a/login': {
+ id: '/(group-a)/_layout-a/login'
+ path: '/login'
+ fullPath: '/login'
+ preLoaderRoute: typeof groupALayoutALoginImport
+ parentRoute: typeof groupALayoutAImport
+ }
+ '/(group-a)/_layout-a/signup': {
+ id: '/(group-a)/_layout-a/signup'
+ path: '/signup'
+ fullPath: '/signup'
+ preLoaderRoute: typeof groupALayoutASignupImport
+ parentRoute: typeof groupALayoutAImport
+ }
+ '/(group-b)/_layout-b/dashboard': {
+ id: '/(group-b)/_layout-b/dashboard'
+ path: '/dashboard'
+ fullPath: '/dashboard'
+ preLoaderRoute: typeof groupBLayoutBDashboardImport
+ parentRoute: typeof groupBLayoutBImport
+ }
+ '/(group-c)/_layout-c/': {
+ id: '/(group-c)/_layout-c/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof groupCLayoutCIndexImport
+ parentRoute: typeof groupCLayoutCImport
+ }
+ }
+}
+
+// Create and export the route tree
+
+interface groupALayoutARouteChildren {
+ groupALayoutALoginRoute: typeof groupALayoutALoginRoute
+ groupALayoutASignupRoute: typeof groupALayoutASignupRoute
+}
+
+const groupALayoutARouteChildren: groupALayoutARouteChildren = {
+ groupALayoutALoginRoute: groupALayoutALoginRoute,
+ groupALayoutASignupRoute: groupALayoutASignupRoute,
+}
+
+const groupALayoutARouteWithChildren = groupALayoutARoute._addFileChildren(
+ groupALayoutARouteChildren,
+)
+
+interface groupARouteChildren {
+ groupALayoutARoute: typeof groupALayoutARouteWithChildren
+}
+
+const groupARouteChildren: groupARouteChildren = {
+ groupALayoutARoute: groupALayoutARouteWithChildren,
+}
+
+const groupARouteWithChildren =
+ groupARoute._addFileChildren(groupARouteChildren)
+
+interface groupBLayoutBRouteChildren {
+ groupBLayoutBDashboardRoute: typeof groupBLayoutBDashboardRoute
+}
+
+const groupBLayoutBRouteChildren: groupBLayoutBRouteChildren = {
+ groupBLayoutBDashboardRoute: groupBLayoutBDashboardRoute,
+}
+
+const groupBLayoutBRouteWithChildren = groupBLayoutBRoute._addFileChildren(
+ groupBLayoutBRouteChildren,
+)
+
+interface groupBRouteChildren {
+ groupBLayoutBRoute: typeof groupBLayoutBRouteWithChildren
+}
+
+const groupBRouteChildren: groupBRouteChildren = {
+ groupBLayoutBRoute: groupBLayoutBRouteWithChildren,
+}
+
+const groupBRouteWithChildren =
+ groupBRoute._addFileChildren(groupBRouteChildren)
+
+interface groupCLayoutCRouteChildren {
+ groupCLayoutCIndexRoute: typeof groupCLayoutCIndexRoute
+}
+
+const groupCLayoutCRouteChildren: groupCLayoutCRouteChildren = {
+ groupCLayoutCIndexRoute: groupCLayoutCIndexRoute,
+}
+
+const groupCLayoutCRouteWithChildren = groupCLayoutCRoute._addFileChildren(
+ groupCLayoutCRouteChildren,
+)
+
+interface groupCRouteChildren {
+ groupCLayoutCRoute: typeof groupCLayoutCRouteWithChildren
+}
+
+const groupCRouteChildren: groupCRouteChildren = {
+ groupCLayoutCRoute: groupCLayoutCRouteWithChildren,
+}
+
+const groupCRouteWithChildren =
+ groupCRoute._addFileChildren(groupCRouteChildren)
+
+export interface FileRoutesByFullPath {
+ '/': typeof groupCLayoutCIndexRoute
+ '/login': typeof groupALayoutALoginRoute
+ '/signup': typeof groupALayoutASignupRoute
+ '/dashboard': typeof groupBLayoutBDashboardRoute
+}
+
+export interface FileRoutesByTo {
+ '/': typeof groupCLayoutCIndexRoute
+ '/login': typeof groupALayoutALoginRoute
+ '/signup': typeof groupALayoutASignupRoute
+ '/dashboard': typeof groupBLayoutBDashboardRoute
+}
+
+export interface FileRoutesById {
+ __root__: typeof rootRoute
+ '/(group-a)': typeof groupARouteWithChildren
+ '/(group-a)/_layout-a': typeof groupALayoutARouteWithChildren
+ '/(group-b)': typeof groupBRouteWithChildren
+ '/(group-b)/_layout-b': typeof groupBLayoutBRouteWithChildren
+ '/(group-c)': typeof groupCRouteWithChildren
+ '/(group-c)/_layout-c': typeof groupCLayoutCRouteWithChildren
+ '/(group-a)/_layout-a/login': typeof groupALayoutALoginRoute
+ '/(group-a)/_layout-a/signup': typeof groupALayoutASignupRoute
+ '/(group-b)/_layout-b/dashboard': typeof groupBLayoutBDashboardRoute
+ '/(group-c)/_layout-c/': typeof groupCLayoutCIndexRoute
+}
+
+export interface FileRouteTypes {
+ fileRoutesByFullPath: FileRoutesByFullPath
+ fullPaths: '/' | '/login' | '/signup' | '/dashboard'
+ fileRoutesByTo: FileRoutesByTo
+ to: '/' | '/login' | '/signup' | '/dashboard'
+ id:
+ | '__root__'
+ | '/(group-a)'
+ | '/(group-a)/_layout-a'
+ | '/(group-b)'
+ | '/(group-b)/_layout-b'
+ | '/(group-c)'
+ | '/(group-c)/_layout-c'
+ | '/(group-a)/_layout-a/login'
+ | '/(group-a)/_layout-a/signup'
+ | '/(group-b)/_layout-b/dashboard'
+ | '/(group-c)/_layout-c/'
+ fileRoutesById: FileRoutesById
+}
+
+export interface RootRouteChildren {
+ groupARoute: typeof groupARouteWithChildren
+ groupBRoute: typeof groupBRouteWithChildren
+ groupCRoute: typeof groupCRouteWithChildren
+}
+
+const rootRouteChildren: RootRouteChildren = {
+ groupARoute: groupARouteWithChildren,
+ groupBRoute: groupBRouteWithChildren,
+ groupCRoute: groupCRouteWithChildren,
+}
+
+export const routeTree = rootRoute
+ ._addFileChildren(rootRouteChildren)
+ ._addFileTypes()
+
+/* ROUTE_MANIFEST_START
+{
+ "routes": {
+ "__root__": {
+ "filePath": "__root.tsx",
+ "children": [
+ "/(group-a)",
+ "/(group-b)",
+ "/(group-c)"
+ ]
+ },
+ "/(group-a)": {
+ "filePath": "(group-a)",
+ "children": [
+ "/(group-a)/_layout-a"
+ ]
+ },
+ "/(group-a)/_layout-a": {
+ "filePath": "(group-a)/_layout-a.tsx",
+ "parent": "/(group-a)",
+ "children": [
+ "/(group-a)/_layout-a/login",
+ "/(group-a)/_layout-a/signup"
+ ]
+ },
+ "/(group-b)": {
+ "filePath": "(group-b)",
+ "children": [
+ "/(group-b)/_layout-b"
+ ]
+ },
+ "/(group-b)/_layout-b": {
+ "filePath": "(group-b)/_layout-b.tsx",
+ "parent": "/(group-b)",
+ "children": [
+ "/(group-b)/_layout-b/dashboard"
+ ]
+ },
+ "/(group-c)": {
+ "filePath": "(group-c)",
+ "children": [
+ "/(group-c)/_layout-c"
+ ]
+ },
+ "/(group-c)/_layout-c": {
+ "filePath": "(group-c)/_layout-c.tsx",
+ "parent": "/(group-c)",
+ "children": [
+ "/(group-c)/_layout-c/"
+ ]
+ },
+ "/(group-a)/_layout-a/login": {
+ "filePath": "(group-a)/_layout-a/login.tsx",
+ "parent": "/(group-a)/_layout-a"
+ },
+ "/(group-a)/_layout-a/signup": {
+ "filePath": "(group-a)/_layout-a/signup.tsx",
+ "parent": "/(group-a)/_layout-a"
+ },
+ "/(group-b)/_layout-b/dashboard": {
+ "filePath": "(group-b)/_layout-b/dashboard.tsx",
+ "parent": "/(group-b)/_layout-b"
+ },
+ "/(group-c)/_layout-c/": {
+ "filePath": "(group-c)/_layout-c/index.tsx",
+ "parent": "/(group-c)/_layout-c"
+ }
+ }
+}
+ROUTE_MANIFEST_END */
From c2739e889fe88f7cc5ede2eb62e9b57acb335f88 Mon Sep 17 00:00:00 2001
From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Date: Fri, 31 Jan 2025 17:45:58 +1300
Subject: [PATCH 4/5] chore(router-generator): remove debug log statements
---
packages/router-generator/src/generator.ts | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index 8ca6df77f1..9d5f73919a 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -364,25 +364,6 @@ export async function generator(config: Config, root: string) {
),
config,
)
- // console.debug('preRouteNodes', preRouteNodes)
- // console.debug(
- // 'routeNodes - group-b',
- // [...routeNodes]
- // .filter((r) => r.filePath.startsWith('(group-b)'))
- // .map((r) => {
- // r.parent = undefined
- // return r
- // }),
- // )
- // console.debug(
- // 'routeNodes - group-c',
- // [...routeNodes]
- // .filter((r) => r.filePath.startsWith('(group-c)'))
- // .map((r) => {
- // r.parent = undefined
- // return r
- // }),
- // )
const startAPIRouteNodes: Array = checkStartAPIRoutes(
preRouteNodes.filter((d) => d.isAPIRoute),
From 5a8b7e6b77568fe639e90f22ec159bcec9f5e7c3 Mon Sep 17 00:00:00 2001
From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Date: Fri, 31 Jan 2025 17:46:47 +1300
Subject: [PATCH 5/5] chore(router-generator): undo changes to the printing of
the `path`
---
packages/router-generator/src/generator.ts | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index 9d5f73919a..b0de40905e 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -530,9 +530,7 @@ export async function generator(config: Config, root: string) {
`const ${node.variableName}Route = ${node.variableName}Import.update({
${[
`id: '${node.path}'`,
- node.isNonPath === false
- ? `path: '${node.cleanedPath}'`
- : undefined,
+ !node.isNonPath ? `path: '${node.cleanedPath}'` : undefined,
`getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`,
]
.filter(Boolean)