Refactor route imports and update route definitions in routeTree.gen.ts

- Changed import statements to use consistent naming conventions for route imports.
- Updated route definitions to reference the new import names.
- Removed redundant code related to the FileRoutesByPath interface and route children.
- Simplified the route tree structure by directly exporting the root route with children.
This commit is contained in:
2026-05-14 07:05:53 +08:00
parent fdc6ee44f8
commit 9c3a7339ad
2 changed files with 1856 additions and 1770 deletions
+1732 -1563
View File
File diff suppressed because it is too large Load Diff
+124 -207
View File
@@ -8,181 +8,70 @@
// 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 Routes
import { Route as rootRouteImport } from './routes/__root'
import { Route as SignupRouteImport } from './routes/signup'
import { Route as ResetPasswordRouteImport } from './routes/reset-password'
import { Route as RecoverPasswordRouteImport } from './routes/recover-password'
import { Route as LoginRouteImport } from './routes/login'
import { Route as LayoutRouteImport } from './routes/_layout'
import { Route as LayoutIndexRouteImport } from './routes/_layout/index'
import { Route as LayoutWeatherHubRouteImport } from './routes/_layout/weather-hub'
import { Route as LayoutSettingsRouteImport } from './routes/_layout/settings'
import { Route as LayoutItemsRouteImport } from './routes/_layout/items'
import { Route as LayoutAdminRouteImport } from './routes/_layout/admin'
import { Route as rootRoute } from './routes/__root'
import { Route as SignupImport } from './routes/signup'
import { Route as ResetPasswordImport } from './routes/reset-password'
import { Route as RecoverPasswordImport } from './routes/recover-password'
import { Route as LoginImport } from './routes/login'
import { Route as LayoutImport } from './routes/_layout'
import { Route as LayoutIndexImport } from './routes/_layout/index'
import { Route as LayoutWeatherHubImport } from './routes/_layout/weather-hub'
import { Route as LayoutSettingsImport } from './routes/_layout/settings'
import { Route as LayoutItemsImport } from './routes/_layout/items'
import { Route as LayoutAdminImport } from './routes/_layout/admin'
// Create/Update Routes
const SignupRoute = SignupImport.update({
const SignupRoute = SignupRouteImport.update({
id: '/signup',
path: '/signup',
getParentRoute: () => rootRoute,
getParentRoute: () => rootRouteImport,
} as any)
const ResetPasswordRoute = ResetPasswordImport.update({
const ResetPasswordRoute = ResetPasswordRouteImport.update({
id: '/reset-password',
path: '/reset-password',
getParentRoute: () => rootRoute,
getParentRoute: () => rootRouteImport,
} as any)
const RecoverPasswordRoute = RecoverPasswordImport.update({
const RecoverPasswordRoute = RecoverPasswordRouteImport.update({
id: '/recover-password',
path: '/recover-password',
getParentRoute: () => rootRoute,
getParentRoute: () => rootRouteImport,
} as any)
const LoginRoute = LoginImport.update({
const LoginRoute = LoginRouteImport.update({
id: '/login',
path: '/login',
getParentRoute: () => rootRoute,
getParentRoute: () => rootRouteImport,
} as any)
const LayoutRoute = LayoutImport.update({
const LayoutRoute = LayoutRouteImport.update({
id: '/_layout',
getParentRoute: () => rootRoute,
getParentRoute: () => rootRouteImport,
} as any)
const LayoutIndexRoute = LayoutIndexImport.update({
const LayoutIndexRoute = LayoutIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutWeatherHubRoute = LayoutWeatherHubImport.update({
const LayoutWeatherHubRoute = LayoutWeatherHubRouteImport.update({
id: '/weather-hub',
path: '/weather-hub',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutSettingsRoute = LayoutSettingsImport.update({
const LayoutSettingsRoute = LayoutSettingsRouteImport.update({
id: '/settings',
path: '/settings',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutItemsRoute = LayoutItemsImport.update({
const LayoutItemsRoute = LayoutItemsRouteImport.update({
id: '/items',
path: '/items',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutAdminRoute = LayoutAdminImport.update({
const LayoutAdminRoute = LayoutAdminRouteImport.update({
id: '/admin',
path: '/admin',
getParentRoute: () => LayoutRoute,
} as any)
// Populate the FileRoutesByPath interface
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/_layout': {
id: '/_layout'
path: ''
fullPath: ''
preLoaderRoute: typeof LayoutImport
parentRoute: typeof rootRoute
}
'/login': {
id: '/login'
path: '/login'
fullPath: '/login'
preLoaderRoute: typeof LoginImport
parentRoute: typeof rootRoute
}
'/recover-password': {
id: '/recover-password'
path: '/recover-password'
fullPath: '/recover-password'
preLoaderRoute: typeof RecoverPasswordImport
parentRoute: typeof rootRoute
}
'/reset-password': {
id: '/reset-password'
path: '/reset-password'
fullPath: '/reset-password'
preLoaderRoute: typeof ResetPasswordImport
parentRoute: typeof rootRoute
}
'/signup': {
id: '/signup'
path: '/signup'
fullPath: '/signup'
preLoaderRoute: typeof SignupImport
parentRoute: typeof rootRoute
}
'/_layout/admin': {
id: '/_layout/admin'
path: '/admin'
fullPath: '/admin'
preLoaderRoute: typeof LayoutAdminImport
parentRoute: typeof LayoutImport
}
'/_layout/items': {
id: '/_layout/items'
path: '/items'
fullPath: '/items'
preLoaderRoute: typeof LayoutItemsImport
parentRoute: typeof LayoutImport
}
'/_layout/settings': {
id: '/_layout/settings'
path: '/settings'
fullPath: '/settings'
preLoaderRoute: typeof LayoutSettingsImport
parentRoute: typeof LayoutImport
}
'/_layout/weather-hub': {
id: '/_layout/weather-hub'
path: '/weather-hub'
fullPath: '/weather-hub'
preLoaderRoute: typeof LayoutWeatherHubImport
parentRoute: typeof LayoutImport
}
'/_layout/': {
id: '/_layout/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof LayoutIndexImport
parentRoute: typeof LayoutImport
}
}
}
// Create and export the route tree
interface LayoutRouteChildren {
LayoutAdminRoute: typeof LayoutAdminRoute
LayoutItemsRoute: typeof LayoutItemsRoute
LayoutSettingsRoute: typeof LayoutSettingsRoute
LayoutWeatherHubRoute: typeof LayoutWeatherHubRoute
LayoutIndexRoute: typeof LayoutIndexRoute
}
const LayoutRouteChildren: LayoutRouteChildren = {
LayoutAdminRoute: LayoutAdminRoute,
LayoutItemsRoute: LayoutItemsRoute,
LayoutSettingsRoute: LayoutSettingsRoute,
LayoutWeatherHubRoute: LayoutWeatherHubRoute,
LayoutIndexRoute: LayoutIndexRoute,
}
const LayoutRouteWithChildren =
LayoutRoute._addFileChildren(LayoutRouteChildren)
export interface FileRoutesByFullPath {
'': typeof LayoutRouteWithChildren
'/': typeof LayoutIndexRoute
'/login': typeof LoginRoute
'/recover-password': typeof RecoverPasswordRoute
'/reset-password': typeof ResetPasswordRoute
@@ -191,9 +80,7 @@ export interface FileRoutesByFullPath {
'/items': typeof LayoutItemsRoute
'/settings': typeof LayoutSettingsRoute
'/weather-hub': typeof LayoutWeatherHubRoute
'/': typeof LayoutIndexRoute
}
export interface FileRoutesByTo {
'/login': typeof LoginRoute
'/recover-password': typeof RecoverPasswordRoute
@@ -205,9 +92,8 @@ export interface FileRoutesByTo {
'/weather-hub': typeof LayoutWeatherHubRoute
'/': typeof LayoutIndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRoute
__root__: typeof rootRouteImport
'/_layout': typeof LayoutRouteWithChildren
'/login': typeof LoginRoute
'/recover-password': typeof RecoverPasswordRoute
@@ -219,11 +105,10 @@ export interface FileRoutesById {
'/_layout/weather-hub': typeof LayoutWeatherHubRoute
'/_layout/': typeof LayoutIndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths:
| ''
| '/'
| '/login'
| '/recover-password'
| '/reset-password'
@@ -232,7 +117,6 @@ export interface FileRouteTypes {
| '/items'
| '/settings'
| '/weather-hub'
| '/'
fileRoutesByTo: FileRoutesByTo
to:
| '/login'
@@ -258,7 +142,6 @@ export interface FileRouteTypes {
| '/_layout/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
LayoutRoute: typeof LayoutRouteWithChildren
LoginRoute: typeof LoginRoute
@@ -267,6 +150,100 @@ export interface RootRouteChildren {
SignupRoute: typeof SignupRoute
}
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/signup': {
id: '/signup'
path: '/signup'
fullPath: '/signup'
preLoaderRoute: typeof SignupRouteImport
parentRoute: typeof rootRouteImport
}
'/reset-password': {
id: '/reset-password'
path: '/reset-password'
fullPath: '/reset-password'
preLoaderRoute: typeof ResetPasswordRouteImport
parentRoute: typeof rootRouteImport
}
'/recover-password': {
id: '/recover-password'
path: '/recover-password'
fullPath: '/recover-password'
preLoaderRoute: typeof RecoverPasswordRouteImport
parentRoute: typeof rootRouteImport
}
'/login': {
id: '/login'
path: '/login'
fullPath: '/login'
preLoaderRoute: typeof LoginRouteImport
parentRoute: typeof rootRouteImport
}
'/_layout': {
id: '/_layout'
path: ''
fullPath: '/'
preLoaderRoute: typeof LayoutRouteImport
parentRoute: typeof rootRouteImport
}
'/_layout/': {
id: '/_layout/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof LayoutIndexRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/weather-hub': {
id: '/_layout/weather-hub'
path: '/weather-hub'
fullPath: '/weather-hub'
preLoaderRoute: typeof LayoutWeatherHubRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/settings': {
id: '/_layout/settings'
path: '/settings'
fullPath: '/settings'
preLoaderRoute: typeof LayoutSettingsRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/items': {
id: '/_layout/items'
path: '/items'
fullPath: '/items'
preLoaderRoute: typeof LayoutItemsRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/admin': {
id: '/_layout/admin'
path: '/admin'
fullPath: '/admin'
preLoaderRoute: typeof LayoutAdminRouteImport
parentRoute: typeof LayoutRoute
}
}
}
interface LayoutRouteChildren {
LayoutAdminRoute: typeof LayoutAdminRoute
LayoutItemsRoute: typeof LayoutItemsRoute
LayoutSettingsRoute: typeof LayoutSettingsRoute
LayoutWeatherHubRoute: typeof LayoutWeatherHubRoute
LayoutIndexRoute: typeof LayoutIndexRoute
}
const LayoutRouteChildren: LayoutRouteChildren = {
LayoutAdminRoute: LayoutAdminRoute,
LayoutItemsRoute: LayoutItemsRoute,
LayoutSettingsRoute: LayoutSettingsRoute,
LayoutWeatherHubRoute: LayoutWeatherHubRoute,
LayoutIndexRoute: LayoutIndexRoute,
}
const LayoutRouteWithChildren =
LayoutRoute._addFileChildren(LayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
LayoutRoute: LayoutRouteWithChildren,
LoginRoute: LoginRoute,
@@ -274,66 +251,6 @@ const rootRouteChildren: RootRouteChildren = {
ResetPasswordRoute: ResetPasswordRoute,
SignupRoute: SignupRoute,
}
export const routeTree = rootRoute
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
/* ROUTE_MANIFEST_START
{
"routes": {
"__root__": {
"filePath": "__root.tsx",
"children": [
"/_layout",
"/login",
"/recover-password",
"/reset-password",
"/signup"
]
},
"/_layout": {
"filePath": "_layout.tsx",
"children": [
"/_layout/admin",
"/_layout/items",
"/_layout/settings",
"/_layout/weather-hub",
"/_layout/"
]
},
"/login": {
"filePath": "login.tsx"
},
"/recover-password": {
"filePath": "recover-password.tsx"
},
"/reset-password": {
"filePath": "reset-password.tsx"
},
"/signup": {
"filePath": "signup.tsx"
},
"/_layout/admin": {
"filePath": "_layout/admin.tsx",
"parent": "/_layout"
},
"/_layout/items": {
"filePath": "_layout/items.tsx",
"parent": "/_layout"
},
"/_layout/settings": {
"filePath": "_layout/settings.tsx",
"parent": "/_layout"
},
"/_layout/weather-hub": {
"filePath": "_layout/weather-hub.tsx",
"parent": "/_layout"
},
"/_layout/": {
"filePath": "_layout/index.tsx",
"parent": "/_layout"
}
}
}
ROUTE_MANIFEST_END */