create-waku 0.7.0 → 0.7.1
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 +1 -1
- package/template/01_template/package.json +6 -6
- package/template/01_template/src/components/counter.tsx +7 -2
- package/template/01_template/src/components/footer.tsx +6 -1
- package/template/01_template/src/components/header.tsx +1 -1
- package/template/01_template/src/styles.css +1 -13
- package/template/01_template/src/templates/about-page.tsx +6 -3
- package/template/01_template/src/templates/home-page.tsx +5 -2
- package/template/01_template/src/templates/root-layout.tsx +1 -1
- package/template/01_template/tsconfig.json +3 -3
- package/template/{04_callserver → 02_demo}/package.json +8 -6
- package/template/02_demo/postcss.config.js +7 -0
- package/template/02_demo/public/images/favicon.png +0 -0
- package/template/02_demo/src/components/error-boundary.tsx +28 -0
- package/template/02_demo/src/components/footer.tsx +18 -0
- package/template/02_demo/src/components/header.tsx +11 -0
- package/template/02_demo/src/entries.tsx +29 -0
- package/template/02_demo/src/lib/index.ts +26 -0
- package/template/02_demo/src/lib/pokemon.ts +2586 -0
- package/template/{05_mutation → 02_demo}/src/main.tsx +6 -4
- package/template/02_demo/src/styles.css +5 -0
- package/template/02_demo/src/templates/home-page.tsx +35 -0
- package/template/02_demo/src/templates/pokemon-page.tsx +69 -0
- package/template/02_demo/src/templates/root-layout.tsx +33 -0
- package/template/02_demo/tailwind.config.js +10 -0
- package/template/{03_promise → 02_demo}/tsconfig.json +5 -2
- package/template/{02_minimal → 03_minimal}/package.json +5 -5
- package/template/{04_callserver → 03_minimal}/tsconfig.json +2 -2
- package/template/{03_promise → 04_promise}/package.json +5 -5
- package/template/{05_mutation → 04_promise}/tsconfig.json +2 -2
- package/template/{05_mutation → 05_actions}/package.json +5 -5
- package/template/{05_mutation → 05_actions}/src/components/App.tsx +2 -1
- package/template/{04_callserver → 05_actions}/src/components/Counter.tsx +12 -8
- package/template/{05_mutation → 05_actions}/src/components/funcs.ts +2 -0
- package/template/{02_minimal → 05_actions}/tsconfig.json +2 -2
- package/template/06_nesting/package.json +5 -5
- package/template/06_nesting/tsconfig.json +2 -2
- package/template/07_router/package.json +5 -5
- package/template/07_router/tsconfig.json +2 -2
- package/template/08_cookies/dev.js +1 -1
- package/template/08_cookies/package.json +6 -6
- package/template/08_cookies/start.js +3 -4
- package/template/08_cookies/tsconfig.json +2 -2
- package/template/09_cssmodules/package.json +5 -5
- package/template/09_cssmodules/src/components/Layout.tsx +22 -0
- package/template/09_cssmodules/src/components/styles.css +3 -0
- package/template/09_cssmodules/src/entries.tsx +6 -1
- package/template/09_cssmodules/tsconfig.json +2 -2
- package/template/10_dynamicroute/package.json +5 -5
- package/template/10_dynamicroute/tsconfig.json +2 -2
- package/template/11_form/package.json +5 -5
- package/template/11_form/tsconfig.json +2 -2
- package/template/12_css/package.json +8 -8
- package/template/12_css/tsconfig.json +2 -2
- package/template/13_path-alias/package.json +6 -6
- package/template/13_path-alias/tsconfig.json +3 -3
- package/template/04_callserver/src/components/App.tsx +0 -20
- package/template/04_callserver/src/components/funcs.ts +0 -3
- package/template/04_callserver/src/entries.tsx +0 -31
- package/template/05_mutation/src/components/Counter.tsx +0 -24
- /package/template/{02_minimal → 03_minimal}/src/components/App.tsx +0 -0
- /package/template/{02_minimal → 03_minimal}/src/components/Counter.tsx +0 -0
- /package/template/{02_minimal → 03_minimal}/src/entries.tsx +0 -0
- /package/template/{02_minimal → 03_minimal}/src/main.tsx +0 -0
- /package/template/{03_promise → 04_promise}/src/components/App.tsx +0 -0
- /package/template/{03_promise → 04_promise}/src/components/Counter.tsx +0 -0
- /package/template/{03_promise → 04_promise}/src/entries.tsx +0 -0
- /package/template/{03_promise → 04_promise}/src/main.tsx +0 -0
- /package/template/{04_callserver → 05_actions}/src/components/TextBox.tsx +0 -0
- /package/template/{05_mutation → 05_actions}/src/entries.tsx +0 -0
- /package/template/{04_callserver → 05_actions}/src/main.tsx +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { StrictMode } from 'react';
|
|
2
2
|
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
3
|
-
import {
|
|
3
|
+
import { Router } from 'waku/router/client';
|
|
4
|
+
|
|
5
|
+
import { ErrorBoundary } from './components/error-boundary.js';
|
|
4
6
|
|
|
5
7
|
const rootElement = (
|
|
6
8
|
<StrictMode>
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
</
|
|
9
|
+
<ErrorBoundary fallback={(error) => <h1>{String(error)}</h1>}>
|
|
10
|
+
<Router />
|
|
11
|
+
</ErrorBoundary>
|
|
10
12
|
</StrictMode>
|
|
11
13
|
);
|
|
12
14
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap');
|
|
2
|
+
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700&display=swap');
|
|
3
|
+
@tailwind base;
|
|
4
|
+
@tailwind components;
|
|
5
|
+
@tailwind utilities;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Link } from 'waku';
|
|
2
|
+
|
|
3
|
+
import { sql } from '../lib/index.js';
|
|
4
|
+
|
|
5
|
+
export const HomePage = async () => {
|
|
6
|
+
const { rows } = await sql`SELECT * FROM pokemon ORDER BY RANDOM() LIMIT 9`;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<title>Waku Pokemon</title>
|
|
11
|
+
<ul className="grid h-full w-full max-w-xl grid-cols-2 gap-6 px-6 py-20 leading-none md:grid-cols-3 md:px-0">
|
|
12
|
+
{rows.map((row) => (
|
|
13
|
+
<li key={row.id}>
|
|
14
|
+
<Link
|
|
15
|
+
to={`/${row.slug}`}
|
|
16
|
+
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"
|
|
17
|
+
>
|
|
18
|
+
<img
|
|
19
|
+
src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${row.id}.png`}
|
|
20
|
+
alt={row.slug}
|
|
21
|
+
className="size-[96px]"
|
|
22
|
+
/>
|
|
23
|
+
<div className="flex flex-col items-center justify-center gap-1 font-bold">
|
|
24
|
+
<span className="font-bold">{row.name.english}</span>
|
|
25
|
+
<span className="font-zen-maru-gothic text-[0.875em] font-bold opacity-40">
|
|
26
|
+
{row.name.japanese}
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
</Link>
|
|
30
|
+
</li>
|
|
31
|
+
))}
|
|
32
|
+
</ul>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Link } from 'waku';
|
|
2
|
+
import { pokemon } from '../lib/pokemon.js';
|
|
3
|
+
|
|
4
|
+
type PokemonPageProps = { slug: string };
|
|
5
|
+
|
|
6
|
+
export const PokemonPage = async ({ slug }: PokemonPageProps) => {
|
|
7
|
+
const pokemon = await getPokemon(slug);
|
|
8
|
+
|
|
9
|
+
if (!pokemon) return null;
|
|
10
|
+
|
|
11
|
+
const stats = Object.entries(pokemon.base);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<title>{`Waku ${pokemon.name.english}`}</title>
|
|
16
|
+
<div className="mx-auto flex w-1/2 flex-col items-center justify-center gap-6 leading-none md:w-full md:max-w-xl">
|
|
17
|
+
<div>
|
|
18
|
+
<ul className="flex items-center justify-center gap-1.5">
|
|
19
|
+
{pokemon.type.map((type) => (
|
|
20
|
+
<div
|
|
21
|
+
key={type}
|
|
22
|
+
className="rounded-full bg-gray-100 px-3 py-1 text-xs font-bold uppercase leading-none tracking-wide text-black/60"
|
|
23
|
+
>
|
|
24
|
+
{type}
|
|
25
|
+
</div>
|
|
26
|
+
))}
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="inline-flex aspect-square flex-col items-center justify-center">
|
|
30
|
+
<img
|
|
31
|
+
src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${pokemon.id}.png`}
|
|
32
|
+
alt={pokemon.slug}
|
|
33
|
+
className="size-[144px]"
|
|
34
|
+
/>
|
|
35
|
+
<div className="flex flex-col items-center justify-center gap-1 text-2xl leading-none">
|
|
36
|
+
<span className="font-bold">{pokemon.name.english}</span>
|
|
37
|
+
<span className="font-zen-maru-gothic text-[0.875em] font-bold opacity-40">
|
|
38
|
+
{pokemon.name.japanese}
|
|
39
|
+
</span>
|
|
40
|
+
</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
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getPokemon = async (slug: string) => {
|
|
68
|
+
return pokemon.find((row) => row.slug === slug) ?? null;
|
|
69
|
+
};
|
|
@@ -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">
|
|
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
|
+
};
|
|
@@ -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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
15
|
"react-wrap-balancer": "1.1.0",
|
|
16
|
-
"waku": "0.19.
|
|
16
|
+
"waku": "0.19.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "18.2.
|
|
19
|
+
"@types/react": "18.2.48",
|
|
20
20
|
"@types/react-dom": "18.2.18",
|
|
21
21
|
"typescript": "5.3.3"
|
|
22
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Balancer } from 'react-wrap-balancer';
|
|
2
2
|
|
|
3
3
|
import { Counter } from './Counter.js';
|
|
4
|
-
import { getCounter, increment } from './funcs.js';
|
|
4
|
+
import { greet, getCounter, increment } from './funcs.js';
|
|
5
5
|
|
|
6
6
|
type ServerFunction<T> = T extends (...args: infer A) => infer R
|
|
7
7
|
? (...args: A) => Promise<R>
|
|
@@ -15,6 +15,7 @@ const App = ({ name }: { name: string }) => {
|
|
|
15
15
|
<h3>This is a server component.</h3>
|
|
16
16
|
<p>Server counter: {getCounter()}</p>
|
|
17
17
|
<Counter
|
|
18
|
+
greet={greet as unknown as ServerFunction<typeof greet>}
|
|
18
19
|
increment={increment as unknown as ServerFunction<typeof increment>}
|
|
19
20
|
/>
|
|
20
21
|
<Balancer>My Awesome Title</Balancer>
|
|
@@ -6,27 +6,31 @@ import { TextBox } from './TextBox.js';
|
|
|
6
6
|
|
|
7
7
|
export const Counter = ({
|
|
8
8
|
greet,
|
|
9
|
+
increment,
|
|
9
10
|
}: {
|
|
10
11
|
greet: (name: string) => Promise<string>;
|
|
12
|
+
increment: () => void;
|
|
11
13
|
}) => {
|
|
14
|
+
const [isPending, startTransition] = useTransition();
|
|
12
15
|
const [count, setCount] = useState(0);
|
|
13
16
|
const [text, setText] = useState<string | Promise<string>>('');
|
|
14
|
-
const
|
|
15
|
-
const handleClick = () => {
|
|
17
|
+
const handleClick1 = () => {
|
|
16
18
|
startTransition(() => {
|
|
17
19
|
setText(greet('c=' + count));
|
|
18
20
|
});
|
|
19
21
|
};
|
|
22
|
+
const handleClick2 = () => {
|
|
23
|
+
startTransition(() => {
|
|
24
|
+
increment();
|
|
25
|
+
});
|
|
26
|
+
};
|
|
20
27
|
return (
|
|
21
28
|
<div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}>
|
|
29
|
+
{isPending ? 'Pending...' : ''}
|
|
22
30
|
<p>Count: {count}</p>
|
|
23
31
|
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
greet("c=" + count) = {text as string}
|
|
27
|
-
</button>{' '}
|
|
28
|
-
{isPending ? 'Pending...' : ''}
|
|
29
|
-
</p>
|
|
32
|
+
<button onClick={handleClick1}>{text || 'Click to greet'}</button>
|
|
33
|
+
<button onClick={handleClick2}>Increment server counter</button>{' '}
|
|
30
34
|
<h3>This is a client component.</h3>
|
|
31
35
|
<TextBox />
|
|
32
36
|
</div>
|
|
@@ -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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
20
20
|
"server-only": "0.0.1",
|
|
21
21
|
"typescript": "5.3.3"
|
|
@@ -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-b30030471-20240117",
|
|
15
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
16
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
17
|
+
"waku": "0.19.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "
|
|
21
|
-
"@types/react": "18.2.
|
|
20
|
+
"@types/node": "20.11.5",
|
|
21
|
+
"@types/react": "18.2.48",
|
|
22
22
|
"@types/react-dom": "18.2.18",
|
|
23
23
|
"typescript": "5.3.3"
|
|
24
24
|
}
|
|
@@ -2,7 +2,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import cookieParser from 'cookie-parser';
|
|
5
|
-
import { connectMiddleware } from 'waku/prd';
|
|
5
|
+
import { unstable_connectMiddleware as connectMiddleware } from 'waku/prd';
|
|
6
6
|
|
|
7
7
|
const withSsr = process.argv[2] === '--with-ssr';
|
|
8
8
|
|
|
@@ -12,9 +12,8 @@ const app = express();
|
|
|
12
12
|
app.use(cookieParser());
|
|
13
13
|
app.use(
|
|
14
14
|
connectMiddleware({
|
|
15
|
-
|
|
16
|
-
pathToFileURL(path.join(root, 'dist', 'entries.js')).toString()
|
|
17
|
-
),
|
|
15
|
+
loadEntries: () =>
|
|
16
|
+
import(pathToFileURL(path.join(root, 'dist', 'entries.js')).toString()),
|
|
18
17
|
unstable_prehook: (req) => {
|
|
19
18
|
return { count: Number(req.orig.cookies.count) || 0 };
|
|
20
19
|
},
|
|
@@ -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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Suspense } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import './styles.css';
|
|
5
|
+
|
|
6
|
+
const Layout = ({ children }: { children: ReactNode }) => {
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
{children}
|
|
10
|
+
<Suspense fallback="Pending...">
|
|
11
|
+
<ServerMessage />
|
|
12
|
+
</Suspense>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ServerMessage = async () => {
|
|
18
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
19
|
+
return <p>Hello from server!</p>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Layout;
|
|
@@ -2,13 +2,18 @@ import { lazy } from 'react';
|
|
|
2
2
|
import { defineEntries } from 'waku/server';
|
|
3
3
|
import { Slot } from 'waku/client';
|
|
4
4
|
|
|
5
|
+
const Layout = lazy(() => import('./components/Layout.js'));
|
|
5
6
|
const App = lazy(() => import('./components/App.js'));
|
|
6
7
|
|
|
7
8
|
export default defineEntries(
|
|
8
9
|
// renderEntries
|
|
9
10
|
async (input) => {
|
|
10
11
|
return {
|
|
11
|
-
App:
|
|
12
|
+
App: (
|
|
13
|
+
<Layout>
|
|
14
|
+
<App name={input || 'Waku'} />
|
|
15
|
+
</Layout>
|
|
16
|
+
),
|
|
12
17
|
};
|
|
13
18
|
},
|
|
14
19
|
// getBuildConfig
|
|
@@ -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-b30030471-20240117",
|
|
14
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
16
|
+
"waku": "0.19.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "18.2.
|
|
19
|
+
"@types/react": "18.2.48",
|
|
20
20
|
"@types/react-dom": "18.2.18",
|
|
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-b30030471-20240117",
|
|
13
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
14
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
15
|
+
"waku": "0.19.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/react": "18.2.
|
|
18
|
+
"@types/react": "18.2.48",
|
|
19
19
|
"@types/react-dom": "18.2.18",
|
|
20
20
|
"typescript": "5.3.3"
|
|
21
21
|
}
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"@stylexjs/stylex": "0.4.1",
|
|
13
13
|
"@vanilla-extract/css": "1.14.0",
|
|
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-b30030471-20240117",
|
|
16
|
+
"react-dom": "18.3.0-canary-b30030471-20240117",
|
|
17
|
+
"react-server-dom-webpack": "18.3.0-canary-b30030471-20240117",
|
|
18
|
+
"waku": "0.19.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/react": "18.2.
|
|
21
|
+
"@types/react": "18.2.48",
|
|
22
22
|
"@types/react-dom": "18.2.18",
|
|
23
|
-
"@vanilla-extract/vite-plugin": "3.9.
|
|
23
|
+
"@vanilla-extract/vite-plugin": "3.9.4",
|
|
24
24
|
"typescript": "5.3.3",
|
|
25
|
-
"vite": "5.0.
|
|
26
|
-
"vite-plugin-stylex-dev": "0.2.
|
|
25
|
+
"vite": "5.0.12",
|
|
26
|
+
"vite-plugin-stylex-dev": "0.2.4"
|
|
27
27
|
}
|
|
28
28
|
}
|