create-waku 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/template/01_template/gitignore +7 -0
- package/template/01_template/package.json +5 -5
- package/template/02_demo/package.json +5 -5
- package/template/02_demo/private/pokemon.json +2586 -0
- package/template/02_demo/src/lib/pokemon.ts +5 -2586
- package/template/03_minimal/package.json +5 -5
- package/template/03_minimal/public/404.html +1 -0
- package/template/04_promise/package.json +5 -5
- package/template/05_actions/package.json +5 -5
- package/template/06_nesting/package.json +5 -5
- package/template/07_router/package.json +5 -5
- package/template/07_router/src/components/Counter.tsx +3 -1
- package/template/07_router/src/entries.tsx +8 -1
- package/template/08_cookies/package.json +6 -6
- package/template/08_cookies/src/entries.tsx +1 -1
- package/template/09_cssmodules/package.json +5 -5
- package/template/{10_dynamicroute → 10_fs-router}/package.json +5 -5
- package/template/11_form/package.json +5 -5
- package/template/12_css/package.json +6 -6
- package/template/13_path-alias/package.json +6 -6
- package/template/13_path-alias/src/components/App.tsx +4 -1
- package/template/13_path-alias/src/components/Counter.tsx +5 -1
- package/template/13_path-alias/src/components/MyFragment.tsx +5 -0
- package/template/14_react-tweet/package.json +25 -0
- package/template/14_react-tweet/postcss.config.js +7 -0
- package/template/14_react-tweet/public/images/favicon.png +0 -0
- package/template/14_react-tweet/src/components/error-boundary.tsx +28 -0
- package/template/14_react-tweet/src/components/footer.tsx +18 -0
- package/template/14_react-tweet/src/components/header.tsx +7 -0
- package/template/14_react-tweet/src/entries.tsx +18 -0
- package/template/14_react-tweet/src/main.tsx +19 -0
- package/template/14_react-tweet/src/styles.css +4 -0
- package/template/14_react-tweet/src/templates/home-page.tsx +22 -0
- package/template/14_react-tweet/src/templates/root-layout.tsx +33 -0
- package/template/14_react-tweet/tailwind.config.js +4 -0
- package/template/14_react-tweet/tsconfig.json +17 -0
- package/template/14_react-tweet/vite.config.ts +15 -0
- package/template/10_dynamicroute/vite.config.ts +0 -20
- /package/template/08_cookies/{db → private}/items.json +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/components/Counter.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/components/ErrorBoundary.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/entries.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/main.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/bar/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/foo/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/layout.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/nested/[name]/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/tsconfig.json +0 -0
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Custom Not Found Page</h1>
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
15
|
"react-wrap-balancer": "1.1.0",
|
|
16
|
-
"waku": "0.19.
|
|
16
|
+
"waku": "0.19.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "18.2.
|
|
19
|
+
"@types/react": "18.2.59",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"server-only": "0.0.1",
|
|
21
21
|
"typescript": "5.3.3"
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import { Link } from 'waku/router/client';
|
|
5
|
+
import { Link, useLocation } from 'waku/router/client';
|
|
6
6
|
|
|
7
7
|
export const Counter = () => {
|
|
8
|
+
const { path } = useLocation();
|
|
8
9
|
const [count, setCount] = useState(0);
|
|
9
10
|
return (
|
|
10
11
|
<div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}>
|
|
11
12
|
<p>Count: {count}</p>
|
|
12
13
|
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
|
|
13
14
|
<h3>This is a client component.</h3>
|
|
15
|
+
<span>path: {path}</span>
|
|
14
16
|
<Link to="/">Go to Home</Link>
|
|
15
17
|
</div>
|
|
16
18
|
);
|
|
@@ -81,9 +81,16 @@ export default createPages(async ({ createPage, createLayout }) => {
|
|
|
81
81
|
|
|
82
82
|
createPage({
|
|
83
83
|
render: 'dynamic',
|
|
84
|
-
path: '/any/[...all]',
|
|
84
|
+
path: '/any/[...all]',
|
|
85
85
|
component: ({ all }: { all: string[] }) => (
|
|
86
86
|
<h2>Catch-all: {all.join('/')}</h2>
|
|
87
87
|
),
|
|
88
88
|
});
|
|
89
|
+
|
|
90
|
+
// Custom Not Found page
|
|
91
|
+
createPage({
|
|
92
|
+
render: 'static',
|
|
93
|
+
path: '/404',
|
|
94
|
+
component: () => <h2>Not Found</h2>,
|
|
95
|
+
});
|
|
89
96
|
});
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cookie-parser": "1.4.6",
|
|
13
13
|
"express": "4.18.2",
|
|
14
|
-
"react": "18.3.0-canary-
|
|
15
|
-
"react-dom": "18.3.0-canary-
|
|
16
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
17
|
-
"waku": "0.19.
|
|
14
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
16
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
17
|
+
"waku": "0.19.4"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "20.11.
|
|
21
|
-
"@types/react": "18.2.
|
|
20
|
+
"@types/node": "20.11.20",
|
|
21
|
+
"@types/react": "18.2.59",
|
|
22
22
|
"@types/react-dom": "18.2.19",
|
|
23
23
|
"typescript": "5.3.3"
|
|
24
24
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"glob": "10.3.10",
|
|
13
|
-
"react": "18.3.0-canary-
|
|
14
|
-
"react-dom": "18.3.0-canary-
|
|
15
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
16
|
-
"waku": "0.19.
|
|
13
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
16
|
+
"waku": "0.19.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "18.2.
|
|
19
|
+
"@types/react": "18.2.59",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"@stylexjs/stylex": "0.5.1",
|
|
13
13
|
"@vanilla-extract/css": "1.14.1",
|
|
14
14
|
"classnames": "2.3.2",
|
|
15
|
-
"react": "18.3.0-canary-
|
|
16
|
-
"react-dom": "18.3.0-canary-
|
|
17
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
18
|
-
"waku": "0.19.
|
|
15
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
16
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
17
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
18
|
+
"waku": "0.19.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/react": "18.2.
|
|
21
|
+
"@types/react": "18.2.59",
|
|
22
22
|
"@types/react-dom": "18.2.19",
|
|
23
23
|
"@vanilla-extract/vite-plugin": "3.9.5",
|
|
24
24
|
"typescript": "5.3.3",
|
|
25
|
-
"vite": "5.
|
|
25
|
+
"vite": "5.1.4",
|
|
26
26
|
"vite-plugin-stylex-dev": "0.3.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"start": "waku start --with-ssr"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"react": "18.3.0-canary-
|
|
13
|
-
"react-dom": "18.3.0-canary-
|
|
14
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
15
|
-
"waku": "0.19.
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"waku": "0.19.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
19
|
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3",
|
|
21
|
-
"vite": "5.
|
|
21
|
+
"vite": "5.1.4",
|
|
22
22
|
"vite-tsconfig-paths": "4.3.1"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Counter } from '@/components/Counter.js';
|
|
2
|
+
import { MyFragment } from '@/components/MyFragment.js';
|
|
2
3
|
|
|
3
4
|
const App = ({ name }: { name: string }) => {
|
|
4
5
|
return (
|
|
5
6
|
<div style={{ border: '3px red dashed', margin: '1em', padding: '1em' }}>
|
|
6
7
|
<title>Waku</title>
|
|
7
|
-
<
|
|
8
|
+
<MyFragment>
|
|
9
|
+
<h1>Hello {name}!!</h1>
|
|
10
|
+
</MyFragment>
|
|
8
11
|
<h3>This is a server component.</h3>
|
|
9
12
|
<Counter />
|
|
10
13
|
<div>{new Date().toISOString()}</div>
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
+
import { MyFragment } from '@/components/MyFragment.js';
|
|
6
|
+
|
|
5
7
|
export const Counter = () => {
|
|
6
8
|
const [count, setCount] = useState(0);
|
|
7
9
|
return (
|
|
8
10
|
<div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}>
|
|
9
|
-
<
|
|
11
|
+
<MyFragment>
|
|
12
|
+
<p>Count: {count}</p>
|
|
13
|
+
</MyFragment>
|
|
10
14
|
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
|
|
11
15
|
<h3>This is a client component.</h3>
|
|
12
16
|
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "waku-starter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "waku dev --with-ssr",
|
|
8
|
+
"build": "waku build --with-ssr",
|
|
9
|
+
"start": "waku start --with-ssr"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
13
|
+
"react-dom": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
|
|
15
|
+
"react-tweet": "^3.2.0",
|
|
16
|
+
"waku": "0.19.4"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "18.2.59",
|
|
20
|
+
"@types/react-dom": "18.2.19",
|
|
21
|
+
"autoprefixer": "10.4.17",
|
|
22
|
+
"tailwindcss": "3.4.1",
|
|
23
|
+
"typescript": "5.3.3"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import type { ReactNode, FunctionComponent } from 'react';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
fallback: (error: unknown) => ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class ErrorBoundaryClass extends Component<Props, { error?: unknown }> {
|
|
10
|
+
constructor(props: Props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static getDerivedStateFromError(error: unknown) {
|
|
16
|
+
return { error };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
if ('error' in this.state) {
|
|
21
|
+
return this.props.fallback(this.state.error);
|
|
22
|
+
}
|
|
23
|
+
return this.props.children;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ErrorBoundary =
|
|
28
|
+
ErrorBoundaryClass as unknown as FunctionComponent<Props>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const Footer = () => {
|
|
2
|
+
return (
|
|
3
|
+
<footer className="fixed bottom-0 left-0 p-6">
|
|
4
|
+
<div>
|
|
5
|
+
visit{' '}
|
|
6
|
+
<a
|
|
7
|
+
href="https://waku.gg/"
|
|
8
|
+
target="_blank"
|
|
9
|
+
rel="noreferrer"
|
|
10
|
+
className="mt-4 inline-block underline"
|
|
11
|
+
>
|
|
12
|
+
waku.gg
|
|
13
|
+
</a>{' '}
|
|
14
|
+
to learn more
|
|
15
|
+
</div>
|
|
16
|
+
</footer>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createPages } from 'waku';
|
|
2
|
+
|
|
3
|
+
import { RootLayout } from './templates/root-layout.js';
|
|
4
|
+
import { HomePage } from './templates/home-page.js';
|
|
5
|
+
|
|
6
|
+
export default createPages(async ({ createPage, createLayout }) => {
|
|
7
|
+
createLayout({
|
|
8
|
+
render: 'static',
|
|
9
|
+
path: '/',
|
|
10
|
+
component: RootLayout,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
createPage({
|
|
14
|
+
render: 'static',
|
|
15
|
+
path: '/',
|
|
16
|
+
component: HomePage,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
3
|
+
import { Router } from 'waku/router/client';
|
|
4
|
+
|
|
5
|
+
import { ErrorBoundary } from './components/error-boundary.js';
|
|
6
|
+
|
|
7
|
+
const rootElement = (
|
|
8
|
+
<StrictMode>
|
|
9
|
+
<ErrorBoundary fallback={(error) => <h1>{String(error)}</h1>}>
|
|
10
|
+
<Router />
|
|
11
|
+
</ErrorBoundary>
|
|
12
|
+
</StrictMode>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (import.meta.env.WAKU_HYDRATE) {
|
|
16
|
+
hydrateRoot(document.body, rootElement);
|
|
17
|
+
} else {
|
|
18
|
+
createRoot(document.body).render(rootElement);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tweet } from 'react-tweet';
|
|
2
|
+
|
|
3
|
+
export const HomePage = async () => {
|
|
4
|
+
const data = await getData();
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<title>{data.title}</title>
|
|
9
|
+
<h1 className="text-4xl font-bold tracking-tight">{data.headline}</h1>
|
|
10
|
+
<Tweet id="1735308967880823082" />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getData = async () => {
|
|
16
|
+
const data = {
|
|
17
|
+
title: 'Waku',
|
|
18
|
+
headline: 'Waku',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../styles.css';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Header } from '../components/header.js';
|
|
6
|
+
import { Footer } from '../components/footer.js';
|
|
7
|
+
|
|
8
|
+
type RootLayoutProps = { children: ReactNode };
|
|
9
|
+
|
|
10
|
+
export const RootLayout = async ({ children }: RootLayoutProps) => {
|
|
11
|
+
const data = await getData();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div id="__waku" className="font-['Nunito']">
|
|
15
|
+
<meta property="description" content={data.description} />
|
|
16
|
+
<link rel="icon" type="image/png" href={data.icon} />
|
|
17
|
+
<Header />
|
|
18
|
+
<main className="flex min-h-svh items-center justify-center *:min-h-64 *:min-w-64">
|
|
19
|
+
{children}
|
|
20
|
+
</main>
|
|
21
|
+
<Footer />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getData = async () => {
|
|
27
|
+
const data = {
|
|
28
|
+
description: 'An internet website!',
|
|
29
|
+
icon: '/images/favicon.png',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"downlevelIteration": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"module": "nodenext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"noUncheckedIndexedAccess": true,
|
|
10
|
+
"exactOptionalPropertyTypes": true,
|
|
11
|
+
"types": ["react/experimental"],
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"paths": {
|
|
14
|
+
"~/*": ["./src/*"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @type {import('vite').UserConfig} */
|
|
2
|
+
export default ({ mode }: { mode: string }) => ({
|
|
3
|
+
...(mode === 'development' && {
|
|
4
|
+
optimizeDeps: {
|
|
5
|
+
include: [
|
|
6
|
+
'react-dom/client',
|
|
7
|
+
'react-tweet > use-sync-external-store/shim/index.js',
|
|
8
|
+
'react-tweet > date-fns/format/index.js',
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
ssr: {
|
|
12
|
+
noExternal: ['react-tweet'],
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { glob } from 'glob';
|
|
4
|
-
|
|
5
|
-
const rootDir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'src');
|
|
6
|
-
const routeFiles = glob.sync('routes/**/*.{tsx,js}', { cwd: rootDir });
|
|
7
|
-
|
|
8
|
-
/** @type {import('vite').UserConfig} */
|
|
9
|
-
export default {
|
|
10
|
-
build: {
|
|
11
|
-
rollupOptions: {
|
|
12
|
-
input: Object.fromEntries(
|
|
13
|
-
routeFiles.map((fname) => [
|
|
14
|
-
fname.replace(/\.\w+$/, ''),
|
|
15
|
-
path.join(rootDir, fname),
|
|
16
|
-
]),
|
|
17
|
-
),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|