-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.tsx
More file actions
169 lines (167 loc) · 5.14 KB
/
App.tsx
File metadata and controls
169 lines (167 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { Outlet } from "@funstack/router";
import { route, type RouteDefinition } from "@funstack/router/server";
import { defer } from "@funstack/static/server";
import { Layout } from "./components/Layout/Layout";
import DeferApi from "./pages/api/Defer.mdx";
import FunstackStaticApi from "./pages/api/FunstackStatic.mdx";
import HowItWorks from "./pages/learn/HowItWorks.mdx";
import LazyServerComponents from "./pages/learn/LazyServerComponents.mdx";
import OptimizingPayloads from "./pages/learn/OptimizingPayloads.mdx";
import RSCConcept from "./pages/learn/RSC.mdx";
import DeferAndActivity from "./pages/learn/DeferAndActivity.mdx";
import FileSystemRouting from "./pages/learn/FileSystemRouting.mdx";
import MultipleEntrypoints from "./pages/advanced/MultipleEntrypoints.mdx";
import SSR from "./pages/advanced/SSR.mdx";
import BuildEntryApi from "./pages/api/BuildEntry.mdx";
import EntryDefinitionApi from "./pages/api/EntryDefinition.mdx";
import FAQ from "./pages/FAQ.mdx";
import GettingStarted from "./pages/GettingStarted.mdx";
import MigratingFromViteSPA from "./pages/MigratingFromViteSPA.mdx";
import { Home } from "./pages/Home";
import { NotFound } from "./pages/NotFound";
import { Router } from "./Router";
export const routes: RouteDefinition[] = [
route({
path: import.meta.env.BASE_URL.replace(/\/$/, ""),
component: <Outlet />,
children: [
route({
path: "/",
component: (
<Layout variant="home">
<Home />
</Layout>
),
}),
route({
path: "/getting-started",
component: (
<Layout title="Getting Started">
{defer(<GettingStarted />, { name: "GettingStarted" })}
</Layout>
),
}),
route({
path: "/getting-started/migrating-from-vite-spa",
component: (
<Layout title="Migrating from Vite SPA">
{defer(<MigratingFromViteSPA />, { name: "MigratingFromViteSPA" })}
</Layout>
),
}),
route({
path: "/faq",
component: (
<Layout title="FAQ">{defer(<FAQ />, { name: "FAQ" })}</Layout>
),
}),
route({
path: "/api/funstack-static",
component: (
<Layout title="funstackStatic()">
{defer(<FunstackStaticApi />, { name: "FunstackStaticApi" })}
</Layout>
),
}),
route({
path: "/api/defer",
component: (
<Layout title="defer()">
{defer(<DeferApi />, { name: "DeferApi" })}
</Layout>
),
}),
route({
path: "/api/build-entry",
component: (
<Layout title="BuildEntryFunction">
{defer(<BuildEntryApi />, { name: "BuildEntryApi" })}
</Layout>
),
}),
route({
path: "/api/entry-definition",
component: (
<Layout title="EntryDefinition">
{defer(<EntryDefinitionApi />, { name: "EntryDefinitionApi" })}
</Layout>
),
}),
route({
path: "/learn/how-it-works",
component: (
<Layout title="How It Works">
{defer(<HowItWorks />, { name: "HowItWorks" })}
</Layout>
),
}),
route({
path: "/learn/rsc",
component: (
<Layout title="React Server Components">
{defer(<RSCConcept />, { name: "RSCConcept" })}
</Layout>
),
}),
route({
path: "/learn/optimizing-payloads",
component: (
<Layout title="Optimizing RSC Payloads">
{defer(<OptimizingPayloads />, { name: "OptimizingPayloads" })}
</Layout>
),
}),
route({
path: "/learn/lazy-server-components",
component: (
<Layout title="Using lazy() in Server Components">
{defer(<LazyServerComponents />, { name: "LazyServerComponents" })}
</Layout>
),
}),
route({
path: "/learn/defer-and-activity",
component: (
<Layout title="Prefetching with defer() and Activity">
{defer(<DeferAndActivity />, { name: "DeferAndActivity" })}
</Layout>
),
}),
route({
path: "/learn/file-system-routing",
component: (
<Layout title="File-System Routing">
{defer(<FileSystemRouting />, { name: "FileSystemRouting" })}
</Layout>
),
}),
route({
path: "/advanced/multiple-entrypoints",
component: (
<Layout title="Multiple Entrypoints (SSG)">
{defer(<MultipleEntrypoints />, { name: "MultipleEntrypoints" })}
</Layout>
),
}),
route({
path: "/advanced/ssr",
component: (
<Layout title="Server-Side Rendering">
{defer(<SSR />, { name: "SSR" })}
</Layout>
),
}),
route({
path: "*",
component: (
<Layout title="Not Found">
<NotFound />
</Layout>
),
}),
],
}),
];
export default function App({ ssrPath }: { ssrPath: string }) {
return <Router routes={routes} fallback="static" ssr={{ path: ssrPath }} />;
}