create-waku 0.7.2 → 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 +6 -6
- package/template/02_demo/package.json +6 -6
- package/template/02_demo/private/pokemon.json +2586 -0
- package/template/02_demo/src/components/footer.tsx +1 -1
- package/template/02_demo/src/components/header.tsx +9 -1
- package/template/02_demo/src/components/reload.tsx +16 -0
- package/template/02_demo/src/lib/pokemon.ts +5 -2586
- package/template/02_demo/src/templates/home-page.tsx +37 -23
- package/template/02_demo/src/templates/pokemon-page.tsx +46 -44
- package/template/02_demo/src/templates/root-layout.tsx +1 -1
- package/template/03_minimal/package.json +6 -6
- package/template/03_minimal/public/404.html +1 -0
- package/template/04_promise/package.json +6 -6
- package/template/04_promise/src/components/Counter.tsx +3 -0
- package/template/04_promise/src/components/Hello.tsx +7 -0
- package/template/05_actions/package.json +6 -6
- package/template/06_nesting/package.json +6 -6
- package/template/07_router/package.json +6 -6
- package/template/07_router/src/components/Counter.tsx +3 -1
- package/template/07_router/src/components/HomeLayout.tsx +2 -0
- package/template/07_router/src/entries.tsx +8 -1
- package/template/07_router/src/styles.css +3 -0
- package/template/08_cookies/package.json +7 -7
- package/template/08_cookies/src/entries.tsx +1 -1
- package/template/09_cssmodules/package.json +6 -6
- package/template/{10_dynamicroute → 10_fs-router}/package.json +6 -6
- package/template/11_form/package.json +6 -6
- package/template/12_css/package.json +7 -7
- package/template/13_path-alias/package.json +7 -7
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Link } from 'waku';
|
|
2
2
|
|
|
3
|
+
import { Reload } from '../components/reload.js';
|
|
3
4
|
import { sql } from '../lib/index.js';
|
|
4
5
|
|
|
5
6
|
export const HomePage = async () => {
|
|
@@ -7,29 +8,42 @@ export const HomePage = async () => {
|
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<>
|
|
10
|
-
<title>Waku
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
<title>Waku pokemon</title>
|
|
12
|
+
<div className="flex h-full w-full flex-col items-center justify-center p-6">
|
|
13
|
+
<div className="px-6">
|
|
14
|
+
<a
|
|
15
|
+
href="https://github.com/dai-shi/waku/tree/main/examples/02_demo/src"
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noreferrer"
|
|
18
|
+
className="whitespace-nowrap text-xs font-bold hover:underline sm:text-base"
|
|
19
|
+
>{`SELECT * FROM pokemon ORDER BY RANDOM() LIMIT 9`}</a>
|
|
20
|
+
</div>
|
|
21
|
+
<ul className="relative mt-6 grid h-full w-full max-w-xl flex-shrink-0 grid-cols-2 gap-6 leading-none md:grid-cols-3 md:px-0">
|
|
22
|
+
{rows.map((row) => (
|
|
23
|
+
<li key={row.id}>
|
|
24
|
+
<Link
|
|
25
|
+
to={`/${row.slug}`}
|
|
26
|
+
className="flex aspect-square w-full flex-shrink-0 flex-col items-center justify-center rounded-xl bg-gray-50 p-3 text-gray-950 transition-colors duration-500 ease-in-out hover:bg-gray-200"
|
|
27
|
+
>
|
|
28
|
+
<img
|
|
29
|
+
src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${row.id}.png`}
|
|
30
|
+
alt={row.slug}
|
|
31
|
+
className="size-[96px]"
|
|
32
|
+
/>
|
|
33
|
+
<div className="flex flex-col items-center justify-center gap-1 font-bold">
|
|
34
|
+
<span className="font-bold">{row.name.english}</span>
|
|
35
|
+
<span className="font-zen-maru-gothic text-[0.875em] font-bold opacity-40">
|
|
36
|
+
{row.name.japanese}
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
</Link>
|
|
40
|
+
</li>
|
|
41
|
+
))}
|
|
42
|
+
<div className="absolute bottom-0 right-0 md:translate-x-full md:translate-y-full md:p-3">
|
|
43
|
+
<Reload />
|
|
44
|
+
</div>
|
|
45
|
+
</ul>
|
|
46
|
+
</div>
|
|
33
47
|
</>
|
|
34
48
|
);
|
|
35
49
|
};
|
|
@@ -13,51 +13,53 @@ export const PokemonPage = async ({ slug }: PokemonPageProps) => {
|
|
|
13
13
|
return (
|
|
14
14
|
<>
|
|
15
15
|
<title>{`Waku ${pokemon.name.english}`}</title>
|
|
16
|
-
<div className="
|
|
17
|
-
<div>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
<div className="w-full p-6">
|
|
17
|
+
<div className="mx-auto flex w-full flex-shrink-0 flex-col items-center justify-center gap-6 rounded-xl bg-gray-50 p-12 leading-none md:w-full md:max-w-xl">
|
|
18
|
+
<div>
|
|
19
|
+
<ul className="flex items-center justify-center gap-1.5">
|
|
20
|
+
{pokemon.type.map((type) => (
|
|
21
|
+
<div
|
|
22
|
+
key={type}
|
|
23
|
+
className="rounded-full bg-gray-200 px-3 py-1 text-xs font-bold uppercase leading-none tracking-wide text-black/60"
|
|
24
|
+
>
|
|
25
|
+
{type}
|
|
26
|
+
</div>
|
|
27
|
+
))}
|
|
28
|
+
</ul>
|
|
29
|
+
</div>
|
|
30
|
+
<div className="inline-flex aspect-square flex-col items-center justify-center">
|
|
31
|
+
<img
|
|
32
|
+
src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${pokemon.id}.png`}
|
|
33
|
+
alt={pokemon.slug}
|
|
34
|
+
className="block size-[144px] flex-shrink-0"
|
|
35
|
+
/>
|
|
36
|
+
<div className="flex flex-col items-center justify-center gap-1 text-2xl leading-none">
|
|
37
|
+
<span className="font-bold">{pokemon.name.english}</span>
|
|
38
|
+
<span className="font-zen-maru-gothic text-[0.875em] font-bold opacity-40">
|
|
39
|
+
{pokemon.name.japanese}
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="hidden lg:block">
|
|
44
|
+
<ul className="mx-auto flex w-32 flex-col flex-wrap justify-center gap-1.5">
|
|
45
|
+
{stats.map(([stat, value]: any) => (
|
|
46
|
+
<li
|
|
47
|
+
key={stat}
|
|
48
|
+
className="inline-block rounded-sm bg-black px-1.5 py-1 text-[0.5rem] font-bold uppercase tracking-wider text-white"
|
|
49
|
+
>
|
|
50
|
+
{stat}: {value}
|
|
51
|
+
</li>
|
|
52
|
+
))}
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
<div className="mt-12">
|
|
56
|
+
<Link
|
|
57
|
+
to="/"
|
|
58
|
+
className="inline-flex aspect-square size-16 items-center justify-center rounded-full bg-black text-sm font-bold text-white"
|
|
59
|
+
>
|
|
60
|
+
<span>back</span>
|
|
61
|
+
</Link>
|
|
40
62
|
</div>
|
|
41
|
-
</div>
|
|
42
|
-
<div>
|
|
43
|
-
<ul className="mx-auto flex w-32 flex-col flex-wrap justify-center gap-1.5">
|
|
44
|
-
{stats.map(([stat, value]: any) => (
|
|
45
|
-
<li
|
|
46
|
-
key={stat}
|
|
47
|
-
className="inline-block rounded-sm bg-black px-1.5 py-1 text-[0.5rem] font-bold uppercase tracking-wider text-white"
|
|
48
|
-
>
|
|
49
|
-
{stat}: {value}
|
|
50
|
-
</li>
|
|
51
|
-
))}
|
|
52
|
-
</ul>
|
|
53
|
-
</div>
|
|
54
|
-
<div className="mt-12">
|
|
55
|
-
<Link
|
|
56
|
-
to="/"
|
|
57
|
-
className="inline-block rounded-xl bg-gray-100 px-6 py-4 font-bold transition-colors duration-500 ease-in-out hover:bg-gray-200"
|
|
58
|
-
>
|
|
59
|
-
back
|
|
60
|
-
</Link>
|
|
61
63
|
</div>
|
|
62
64
|
</div>
|
|
63
65
|
</>
|
|
@@ -15,7 +15,7 @@ export const RootLayout = async ({ children }: RootLayoutProps) => {
|
|
|
15
15
|
<meta property="description" content={data.description} />
|
|
16
16
|
<link rel="icon" type="image/png" href={data.icon} />
|
|
17
17
|
<Header />
|
|
18
|
-
<main className="flex
|
|
18
|
+
<main className="flex items-center justify-center lg:min-h-svh">
|
|
19
19
|
{children}
|
|
20
20
|
</main>
|
|
21
21
|
<Footer />
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Custom Not Found Page</h1>
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
import { Suspense, useState, use } from 'react';
|
|
5
5
|
|
|
6
|
+
import { Hello } from './Hello.js';
|
|
7
|
+
|
|
6
8
|
export const Counter = ({
|
|
7
9
|
delayedMessage,
|
|
8
10
|
}: {
|
|
@@ -17,6 +19,7 @@ export const Counter = ({
|
|
|
17
19
|
<Suspense fallback="Pending...">
|
|
18
20
|
<Message count={count} delayedMessage={delayedMessage} />
|
|
19
21
|
</Suspense>
|
|
22
|
+
<Hello />
|
|
20
23
|
</div>
|
|
21
24
|
);
|
|
22
25
|
};
|
|
@@ -9,15 +9,15 @@
|
|
|
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.
|
|
20
|
-
"@types/react-dom": "18.2.
|
|
19
|
+
"@types/react": "18.2.59",
|
|
20
|
+
"@types/react-dom": "18.2.19",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"server-only": "0.0.1",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
@@ -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,15 +11,15 @@
|
|
|
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.
|
|
22
|
-
"@types/react-dom": "18.2.
|
|
20
|
+
"@types/node": "20.11.20",
|
|
21
|
+
"@types/react": "18.2.59",
|
|
22
|
+
"@types/react-dom": "18.2.19",
|
|
23
23
|
"typescript": "5.3.3"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
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.
|
|
20
|
-
"@types/react-dom": "18.2.
|
|
19
|
+
"@types/react": "18.2.59",
|
|
20
|
+
"@types/react-dom": "18.2.19",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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-
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
19
|
+
"@types/react-dom": "18.2.19",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -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.
|
|
22
|
-
"@types/react-dom": "18.2.
|
|
21
|
+
"@types/react": "18.2.59",
|
|
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.
|
|
19
|
-
"@types/react-dom": "18.2.
|
|
18
|
+
"@types/react": "18.2.59",
|
|
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>;
|