This commit is contained in:
2026-01-17 01:32:08 +08:00
commit 7706fb2ab2
17 changed files with 1591 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
export function NotFound() {
return <div>Not Found</div>
}

1
src/index.ts Normal file
View File

@@ -0,0 +1 @@
console.log('Hello via Bun!')

68
src/routeTree.gen.ts Normal file
View File

@@ -0,0 +1,68 @@
/* 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 { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/'
fileRoutesByTo: FileRoutesByTo
to: '/'
id: '__root__' | '/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
}
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
}
}
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
import type { getRouter } from './router.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
}

25
src/router.tsx Normal file
View File

@@ -0,0 +1,25 @@
import { QueryClient } from '@tanstack/react-query'
import { createRouter } from '@tanstack/react-router'
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
import { routeTree } from './routeTree.gen'
export const getRouter = () => {
const queryClient = new QueryClient()
const router = createRouter({
routeTree,
context: {
queryClient,
},
scrollRestoration: true,
defaultPreloadStaleTime: 0,
})
setupRouterSsrQueryIntegration({
router,
queryClient,
})
return router
}

61
src/routes/__root.tsx Normal file
View File

@@ -0,0 +1,61 @@
import { TanStackDevtools } from '@tanstack/react-devtools'
import { ReactQueryDevtoolsPanel } from '@tanstack/react-query-devtools'
import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router'
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
import type { ReactNode } from 'react'
import appCss from '@/styles.css?url'
export const Route = createRootRoute({
head: () => ({
meta: [
{
charSet: 'utf-8',
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{
title: 'TanStack Start Starter',
},
],
links: [
{
rel: 'stylesheet',
href: appCss,
},
],
}),
shellComponent: RootDocument,
errorComponent: () => <div>Error</div>,
notFoundComponent: () => <div>404 - Not Found</div>,
})
function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
return (
<html lang="zh-Hans">
<head>
<HeadContent />
</head>
<body>
{children}
<TanStackDevtools
config={{
position: 'bottom-right',
}}
plugins={[
{
name: 'TanStack Router',
render: <TanStackRouterDevtoolsPanel />,
},
{
name: 'TanStack Query',
render: <ReactQueryDevtoolsPanel />,
},
]}
/>
<Scripts />
</body>
</html>
)
}

7
src/routes/index.tsx Normal file
View File

@@ -0,0 +1,7 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({ component: App })
function App() {
return <div>Hello, World!</div>
}

1
src/styles.css Normal file
View File

@@ -0,0 +1 @@
@import "tailwindcss";