create-waku 0.6.5 → 0.6.6-alpha.0

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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli.js +9 -8
  3. package/package.json +13 -10
  4. package/src/cli.ts +11 -10
  5. package/template/01_counter/{src/index.html → index.html} +1 -1
  6. package/template/01_counter/package.json +12 -11
  7. package/template/01_counter/src/entries.tsx +2 -2
  8. package/template/02_async/{src/index.html → index.html} +1 -1
  9. package/template/02_async/package.json +12 -11
  10. package/template/02_async/src/entries.tsx +2 -2
  11. package/template/03_promise/{src/index.html → index.html} +1 -1
  12. package/template/03_promise/package.json +12 -11
  13. package/template/03_promise/src/components/Counter.tsx +11 -7
  14. package/template/03_promise/src/entries.tsx +7 -6
  15. package/template/04_callserver/{src/index.html → index.html} +1 -1
  16. package/template/04_callserver/package.json +11 -11
  17. package/template/04_callserver/src/entries.tsx +2 -2
  18. package/template/05_mutation/index.html +37 -0
  19. package/template/05_mutation/package.json +11 -11
  20. package/template/05_mutation/src/components/funcs.ts +4 -4
  21. package/template/05_mutation/src/entries.tsx +2 -2
  22. package/template/06_nesting/index.html +37 -0
  23. package/template/06_nesting/package.json +11 -11
  24. package/template/06_nesting/src/components/Counter.tsx +3 -1
  25. package/template/06_nesting/src/entries.tsx +2 -2
  26. package/template/07_router/index.html +37 -0
  27. package/template/07_router/package.json +11 -12
  28. package/template/07_router/src/entries.tsx +17 -25
  29. package/template/07_router/tsconfig.json +3 -9
  30. package/template/08_cookies/dev.js +4 -5
  31. package/template/08_cookies/index.html +37 -0
  32. package/template/08_cookies/package.json +9 -9
  33. package/template/08_cookies/src/components/App.tsx +10 -4
  34. package/template/08_cookies/src/entries.tsx +6 -6
  35. package/template/08_cookies/start.js +9 -10
  36. package/template/09_cssmodules/index.html +37 -0
  37. package/template/09_cssmodules/package.json +11 -11
  38. package/template/09_cssmodules/src/entries.tsx +2 -2
  39. package/template/10_dynamicroute/index.html +37 -0
  40. package/template/10_dynamicroute/package.json +11 -11
  41. package/template/10_dynamicroute/src/components/Counter.tsx +17 -0
  42. package/template/10_dynamicroute/src/components/ErrorBoundary.tsx +28 -0
  43. package/template/10_dynamicroute/src/entries.tsx +6 -5
  44. package/template/10_dynamicroute/src/main.tsx +5 -1
  45. package/template/10_dynamicroute/src/routes/bar/page.tsx +10 -0
  46. package/template/10_dynamicroute/src/routes/foo/page.tsx +10 -0
  47. package/template/10_dynamicroute/src/routes/layout.tsx +50 -4
  48. package/template/10_dynamicroute/src/routes/{[name] → nested/[name]}/page.tsx +1 -1
  49. package/template/10_dynamicroute/vite.config.ts +9 -7
  50. package/template/11_form/index.html +37 -0
  51. package/template/11_form/package.json +11 -11
  52. package/template/11_form/src/components/funcs.ts +4 -4
  53. package/template/11_form/src/entries.tsx +2 -2
  54. package/template/05_mutation/src/index.html +0 -37
  55. package/template/06_nesting/src/index.html +0 -37
  56. package/template/07_router/src/index.html +0 -37
  57. package/template/07_router/tsconfig.node.json +0 -8
  58. package/template/07_router/vite.config.ts +0 -24
  59. package/template/08_cookies/src/index.html +0 -37
  60. package/template/09_cssmodules/src/index.html +0 -37
  61. package/template/10_dynamicroute/src/index.html +0 -37
  62. package/template/11_form/src/index.html +0 -37
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Daishi Kato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/dist/cli.js CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import fs from 'node:fs';
2
+ import { existsSync, readdirSync } from 'node:fs';
3
+ import fsPromises from 'node:fs/promises';
3
4
  import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
4
6
  import { default as prompts } from 'prompts';
5
7
  import { red, green, bold } from 'kolorist';
6
8
  import fse from 'fs-extra/esm';
7
- import { fileURLToPath } from 'node:url';
8
9
  function isValidPackageName(projectName) {
9
10
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
10
11
  }
@@ -18,13 +19,13 @@ function toValidPackageName(projectName) {
18
19
  }
19
20
  // if the dir is empty or not exist
20
21
  function canSafelyOverwrite(dir) {
21
- return !fs.existsSync(dir) || fs.readdirSync(dir).length === 0;
22
+ return !existsSync(dir) || readdirSync(dir).length === 0;
22
23
  }
23
24
  async function init() {
24
25
  let targetDir = '';
25
26
  const defaultProjectName = 'waku-project';
26
27
  const templateRoot = fileURLToPath(new URL('../template', import.meta.url));
27
- const CHOICES = fs.readdirSync(templateRoot);
28
+ const CHOICES = await fsPromises.readdir(templateRoot);
28
29
  let result;
29
30
  try {
30
31
  result = await prompts([
@@ -83,8 +84,8 @@ async function init() {
83
84
  if (shouldOverwrite) {
84
85
  fse.emptyDirSync(root);
85
86
  }
86
- else if (!fs.existsSync(root)) {
87
- fs.mkdirSync(root, { recursive: true });
87
+ else if (!existsSync(root)) {
88
+ await fsPromises.mkdir(root, { recursive: true });
88
89
  }
89
90
  const pkg = {
90
91
  name: packageName ?? toValidPackageName(targetDir),
@@ -96,9 +97,9 @@ async function init() {
96
97
  const packageJsonPath = path.join(root, 'package.json');
97
98
  // Read new package.json from the template directory
98
99
  const newPackageJsonPath = path.join(templateDir, 'package.json');
99
- const newPackageJson = JSON.parse(fs.readFileSync(newPackageJsonPath, 'utf-8'));
100
+ const newPackageJson = JSON.parse(await fsPromises.readFile(newPackageJsonPath, 'utf-8'));
100
101
  fse.copySync(templateDir, root);
101
- fs.writeFileSync(packageJsonPath, JSON.stringify({
102
+ await fsPromises.writeFile(packageJsonPath, JSON.stringify({
102
103
  ...newPackageJson,
103
104
  ...pkg,
104
105
  }, null, 2));
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "create-waku",
3
- "version": "0.6.5",
3
+ "version": "0.6.6-alpha.0",
4
+ "publishConfig": {
5
+ "tag": "next"
6
+ },
4
7
  "author": "Daishi Kato",
5
8
  "type": "module",
6
9
  "contributors": [
@@ -18,19 +21,19 @@
18
21
  "dist",
19
22
  "template"
20
23
  ],
21
- "scripts": {
22
- "start": "node dist/cli.js",
23
- "compile": "rm -rf template dist *.tsbuildinfo && pnpm run template && pnpm run build",
24
- "template": "cp -r ../../examples template/ && rm -rf template/*/dist && rm -rf template/*/node_modules",
25
- "build": "tsc -b"
26
- },
27
24
  "dependencies": {
28
- "fs-extra": "^11.1.1",
25
+ "fs-extra": "^11.2.0",
29
26
  "kolorist": "^1.8.0",
30
27
  "prompts": "^2.4.2"
31
28
  },
32
29
  "devDependencies": {
33
30
  "@types/fs-extra": "^11.0.4",
34
- "@types/prompts": "^2.4.8"
31
+ "@types/prompts": "^2.4.9"
32
+ },
33
+ "scripts": {
34
+ "start": "node dist/cli.js",
35
+ "compile": "rm -rf template dist *.tsbuildinfo && pnpm run template && pnpm run build",
36
+ "template": "cp -r ../../examples template/ && rm -rf template/*/dist && rm -rf template/*/node_modules",
37
+ "build": "tsc -b"
35
38
  }
36
- }
39
+ }
package/src/cli.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import fs from 'node:fs';
3
+ import { existsSync, readdirSync } from 'node:fs';
4
+ import fsPromises from 'node:fs/promises';
4
5
  import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
5
7
  import { default as prompts } from 'prompts';
6
8
  import { red, green, bold } from 'kolorist';
7
9
  import fse from 'fs-extra/esm';
8
- import { fileURLToPath } from 'node:url';
9
10
 
10
11
  function isValidPackageName(projectName: string) {
11
12
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
@@ -24,7 +25,7 @@ function toValidPackageName(projectName: string) {
24
25
 
25
26
  // if the dir is empty or not exist
26
27
  function canSafelyOverwrite(dir: string) {
27
- return !fs.existsSync(dir) || fs.readdirSync(dir).length === 0;
28
+ return !existsSync(dir) || readdirSync(dir).length === 0;
28
29
  }
29
30
 
30
31
  async function init() {
@@ -32,7 +33,7 @@ async function init() {
32
33
  const defaultProjectName = 'waku-project';
33
34
 
34
35
  const templateRoot = fileURLToPath(new URL('../template', import.meta.url));
35
- const CHOICES = fs.readdirSync(templateRoot);
36
+ const CHOICES = await fsPromises.readdir(templateRoot);
36
37
  let result: {
37
38
  packageName: string;
38
39
  shouldOverwrite: string;
@@ -102,8 +103,8 @@ async function init() {
102
103
 
103
104
  if (shouldOverwrite) {
104
105
  fse.emptyDirSync(root);
105
- } else if (!fs.existsSync(root)) {
106
- fs.mkdirSync(root, { recursive: true });
106
+ } else if (!existsSync(root)) {
107
+ await fsPromises.mkdir(root, { recursive: true });
107
108
  }
108
109
 
109
110
  const pkg = {
@@ -121,12 +122,12 @@ async function init() {
121
122
  // Read new package.json from the template directory
122
123
  const newPackageJsonPath = path.join(templateDir, 'package.json');
123
124
  const newPackageJson = JSON.parse(
124
- fs.readFileSync(newPackageJsonPath, 'utf-8'),
125
+ await fsPromises.readFile(newPackageJsonPath, 'utf-8'),
125
126
  );
126
127
 
127
128
  fse.copySync(templateDir, root);
128
129
 
129
- fs.writeFileSync(
130
+ await fsPromises.writeFile(
130
131
  packageJsonPath,
131
132
  JSON.stringify(
132
133
  {
@@ -142,8 +143,8 @@ async function init() {
142
143
  const packageManager = /pnpm/.test(manager)
143
144
  ? 'pnpm'
144
145
  : /yarn/.test(manager)
145
- ? 'yarn'
146
- : 'npm';
146
+ ? 'yarn'
147
+ : 'npm';
147
148
 
148
149
  const commandsMap = {
149
150
  install: {
@@ -30,7 +30,7 @@
30
30
  <div class="spinner"></div>
31
31
  </div>
32
32
  <!--/placeholder1-->
33
- <script src="/main.tsx" async type="module"></script>
33
+ <script src="/src/main.tsx" async type="module"></script>
34
34
  <!--placeholder2-->
35
35
  <!--/placeholder2-->
36
36
  </body>
@@ -4,23 +4,24 @@
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "scripts": {
7
- "dev": "waku dev",
7
+ "dev": "waku dev --with-ssr",
8
8
  "build": "waku build --with-ssr",
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "express": "^4.18.2",
13
- "react": "18.3.0-canary-6c7b41da3-20231123",
14
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
16
17
  "waku": "0.17.1"
17
18
  },
18
19
  "devDependencies": {
19
- "@swc/core": "1.3.96",
20
- "@types/react": "^18.2.37",
21
- "@types/react-dom": "^18.2.15",
22
- "@vitejs/plugin-react": "4.1.1",
23
- "typescript": "^5.2.2",
24
- "vite": "4.5.0"
20
+ "@swc/core": "1.3.100",
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@vitejs/plugin-react": "4.2.1",
24
+ "typescript": "^5.3.3",
25
+ "vite": "5.0.7"
25
26
  }
26
27
  }
@@ -1,6 +1,5 @@
1
1
  import { lazy } from 'react';
2
2
  import { defineEntries } from 'waku/server';
3
- import { Slot } from 'waku/client';
4
3
 
5
4
  const App = lazy(() => import('./components/App.js'));
6
5
 
@@ -25,7 +24,8 @@ export default defineEntries(
25
24
  case '/':
26
25
  return {
27
26
  input: '',
28
- unstable_render: () => <Slot id="App" />,
27
+ unstable_render: ({ createElement, Slot }) =>
28
+ createElement(Slot, { id: 'App' }),
29
29
  };
30
30
  default:
31
31
  return null;
@@ -30,7 +30,7 @@
30
30
  <div class="spinner"></div>
31
31
  </div>
32
32
  <!--/placeholder1-->
33
- <script src="/main.tsx" async type="module"></script>
33
+ <script src="/src/main.tsx" async type="module"></script>
34
34
  <!--placeholder2-->
35
35
  <!--/placeholder2-->
36
36
  </body>
@@ -4,23 +4,24 @@
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "scripts": {
7
- "dev": "waku dev",
7
+ "dev": "waku dev --with-ssr",
8
8
  "build": "waku build --with-ssr",
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "express": "^4.18.2",
13
- "react": "18.3.0-canary-6c7b41da3-20231123",
14
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
16
17
  "waku": "0.17.1"
17
18
  },
18
19
  "devDependencies": {
19
- "@swc/core": "1.3.96",
20
- "@types/react": "^18.2.37",
21
- "@types/react-dom": "^18.2.15",
22
- "@vitejs/plugin-react": "4.1.1",
23
- "typescript": "^5.2.2",
24
- "vite": "4.5.0"
20
+ "@swc/core": "1.3.100",
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@vitejs/plugin-react": "4.2.1",
24
+ "typescript": "^5.3.3",
25
+ "vite": "5.0.7"
25
26
  }
26
27
  }
@@ -1,6 +1,5 @@
1
1
  import { lazy } from 'react';
2
2
  import { defineEntries } from 'waku/server';
3
- import { Slot } from 'waku/client';
4
3
 
5
4
  const App = lazy(() => import('./components/App.js'));
6
5
 
@@ -25,7 +24,8 @@ export default defineEntries(
25
24
  case '/':
26
25
  return {
27
26
  input: '',
28
- unstable_render: () => <Slot id="App" />,
27
+ unstable_render: ({ createElement, Slot }) =>
28
+ createElement(Slot, { id: 'App' }),
29
29
  };
30
30
  default:
31
31
  return null;
@@ -30,7 +30,7 @@
30
30
  <div class="spinner"></div>
31
31
  </div>
32
32
  <!--/placeholder1-->
33
- <script src="/main.tsx" async type="module"></script>
33
+ <script src="/src/main.tsx" async type="module"></script>
34
34
  <!--placeholder2-->
35
35
  <!--/placeholder2-->
36
36
  </body>
@@ -4,23 +4,24 @@
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "scripts": {
7
- "dev": "waku dev",
7
+ "dev": "waku dev --with-ssr",
8
8
  "build": "waku build --with-ssr",
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "express": "^4.18.2",
13
- "react": "18.3.0-canary-6c7b41da3-20231123",
14
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
16
17
  "waku": "0.17.1"
17
18
  },
18
19
  "devDependencies": {
19
- "@swc/core": "1.3.96",
20
- "@types/react": "^18.2.37",
21
- "@types/react-dom": "^18.2.15",
22
- "@vitejs/plugin-react": "4.1.1",
23
- "typescript": "^5.2.2",
24
- "vite": "4.5.0"
20
+ "@swc/core": "1.3.100",
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@vitejs/plugin-react": "4.2.1",
24
+ "typescript": "^5.3.3",
25
+ "vite": "5.0.7"
25
26
  }
26
27
  }
@@ -1,6 +1,7 @@
1
+ /// <reference types="react/canary" />
1
2
  'use client';
2
3
 
3
- import { Suspense, useState } from 'react';
4
+ import { Suspense, useState, use } from 'react';
4
5
 
5
6
  export const Counter = ({
6
7
  delayedMessage,
@@ -26,9 +27,12 @@ const Message = ({
26
27
  }: {
27
28
  count: number;
28
29
  delayedMessage: Promise<string>;
29
- }) => (
30
- <ul>
31
- <li>count: {count}</li>
32
- <li>delayedMessage: {delayedMessage as any}</li>
33
- </ul>
34
- );
30
+ }) => {
31
+ return (
32
+ <ul>
33
+ <li>count: {count}</li>
34
+ {/* We want show the usage without `use` but it causes a hydration error. https://github.com/dai-shi/waku/issues/202 */}
35
+ <li>delayedMessage: {use(delayedMessage)}</li>
36
+ </ul>
37
+ );
38
+ };
@@ -1,6 +1,6 @@
1
1
  import { lazy } from 'react';
2
2
  import { defineEntries } from 'waku/server';
3
- import { Children, Slot } from 'waku/client';
3
+ import { Children } from 'waku/client';
4
4
 
5
5
  const App = lazy(() => import('./components/App.js'));
6
6
 
@@ -29,11 +29,12 @@ export default defineEntries(
29
29
  case '/':
30
30
  return {
31
31
  input: '',
32
- unstable_render: () => (
33
- <Slot id="App">
34
- <h3>A client element</h3>
35
- </Slot>
36
- ),
32
+ unstable_render: ({ createElement, Slot }) =>
33
+ createElement(
34
+ Slot,
35
+ { id: 'App' },
36
+ createElement('h3', null, 'A client element'),
37
+ ),
37
38
  };
38
39
  default:
39
40
  return null;
@@ -30,7 +30,7 @@
30
30
  <div class="spinner"></div>
31
31
  </div>
32
32
  <!--/placeholder1-->
33
- <script src="/main.tsx" async type="module"></script>
33
+ <script src="/src/main.tsx" async type="module"></script>
34
34
  <!--placeholder2-->
35
35
  <!--/placeholder2-->
36
36
  </body>
@@ -9,19 +9,19 @@
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "@hono/node-server": "^1.2.2",
13
- "hono": "^3.10.0",
14
- "react": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
16
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
17
17
  "waku": "0.17.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@swc/core": "1.3.96",
21
- "@types/react": "^18.2.37",
22
- "@types/react-dom": "^18.2.15",
23
- "@vitejs/plugin-react": "4.1.1",
24
- "typescript": "^5.2.2",
25
- "vite": "4.5.0"
20
+ "@swc/core": "1.3.100",
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@vitejs/plugin-react": "4.2.1",
24
+ "typescript": "^5.3.3",
25
+ "vite": "5.0.7"
26
26
  }
27
27
  }
@@ -1,6 +1,5 @@
1
1
  import { lazy } from 'react';
2
2
  import { defineEntries } from 'waku/server';
3
- import { Slot } from 'waku/client';
4
3
 
5
4
  const App = lazy(() => import('./components/App.js'));
6
5
 
@@ -25,7 +24,8 @@ export default defineEntries(
25
24
  case '/':
26
25
  return {
27
26
  input: '',
28
- unstable_render: () => <Slot id="App" />,
27
+ unstable_render: ({ createElement, Slot }) =>
28
+ createElement(Slot, { id: 'App' }),
29
29
  };
30
30
  default:
31
31
  return null;
@@ -0,0 +1,37 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Waku example</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <style>
8
+ @keyframes spinner {
9
+ to {
10
+ transform: rotate(360deg);
11
+ }
12
+ }
13
+ .spinner {
14
+ width: 36px;
15
+ height: 36px;
16
+ margin: auto;
17
+ border: 2px solid #ddd;
18
+ border-top-color: #222;
19
+ border-radius: 50%;
20
+ animation: spinner 1s linear infinite;
21
+ }
22
+ #root > .spinner {
23
+ margin-top: calc(50% - 18px);
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <!--placeholder1-->
29
+ <div id="root">
30
+ <div class="spinner"></div>
31
+ </div>
32
+ <!--/placeholder1-->
33
+ <script src="/src/main.tsx" async type="module"></script>
34
+ <!--placeholder2-->
35
+ <!--/placeholder2-->
36
+ </body>
37
+ </html>
@@ -9,20 +9,20 @@
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "@hono/node-server": "^1.2.2",
13
- "hono": "^3.10.0",
14
- "react": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
16
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
17
17
  "react-wrap-balancer": "^1.1.0",
18
18
  "waku": "0.17.1"
19
19
  },
20
20
  "devDependencies": {
21
- "@swc/core": "1.3.96",
22
- "@types/react": "^18.2.37",
23
- "@types/react-dom": "^18.2.15",
24
- "@vitejs/plugin-react": "4.1.1",
25
- "typescript": "^5.2.2",
26
- "vite": "4.5.0"
21
+ "@swc/core": "1.3.100",
22
+ "@types/react": "^18.2.43",
23
+ "@types/react-dom": "^18.2.17",
24
+ "@vitejs/plugin-react": "4.2.1",
25
+ "typescript": "^5.3.3",
26
+ "vite": "5.0.7"
27
27
  }
28
28
  }
@@ -1,13 +1,13 @@
1
1
  'use server';
2
2
 
3
- import { rerender } from 'waku/server';
3
+ import type { RenderContext } from 'waku/server';
4
4
 
5
5
  // module state on server
6
6
  let counter = 0;
7
7
 
8
8
  export const getCounter = () => counter;
9
9
 
10
- export const increment = () => {
10
+ export function increment(this: RenderContext) {
11
11
  counter += 1;
12
- rerender('Waku');
13
- };
12
+ this.rerender('Waku');
13
+ }
@@ -1,6 +1,5 @@
1
1
  import { lazy } from 'react';
2
2
  import { defineEntries } from 'waku/server';
3
- import { Slot } from 'waku/client';
4
3
 
5
4
  const App = lazy(() => import('./components/App.js'));
6
5
 
@@ -25,7 +24,8 @@ export default defineEntries(
25
24
  case '/':
26
25
  return {
27
26
  input: '',
28
- unstable_render: () => <Slot id="App" />,
27
+ unstable_render: ({ createElement, Slot }) =>
28
+ createElement(Slot, { id: 'App' }),
29
29
  };
30
30
  default:
31
31
  return null;
@@ -0,0 +1,37 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Waku example</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <style>
8
+ @keyframes spinner {
9
+ to {
10
+ transform: rotate(360deg);
11
+ }
12
+ }
13
+ .spinner {
14
+ width: 36px;
15
+ height: 36px;
16
+ margin: auto;
17
+ border: 2px solid #ddd;
18
+ border-top-color: #222;
19
+ border-radius: 50%;
20
+ animation: spinner 1s linear infinite;
21
+ }
22
+ #root > .spinner {
23
+ margin-top: calc(50% - 18px);
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <!--placeholder1-->
29
+ <div id="root">
30
+ <div class="spinner"></div>
31
+ </div>
32
+ <!--/placeholder1-->
33
+ <script src="/src/main.tsx" async type="module"></script>
34
+ <!--placeholder2-->
35
+ <!--/placeholder2-->
36
+ </body>
37
+ </html>
@@ -9,19 +9,19 @@
9
9
  "start": "waku start --with-ssr"
10
10
  },
11
11
  "dependencies": {
12
- "@hono/node-server": "^1.2.2",
13
- "hono": "^3.10.0",
14
- "react": "18.3.0-canary-6c7b41da3-20231123",
15
- "react-dom": "18.3.0-canary-6c7b41da3-20231123",
16
- "react-server-dom-webpack": "18.3.0-canary-6c7b41da3-20231123",
12
+ "@hono/node-server": "^1.3.1",
13
+ "hono": "^3.11.4",
14
+ "react": "18.3.0-canary-5bcade5fc-20231208",
15
+ "react-dom": "18.3.0-canary-5bcade5fc-20231208",
16
+ "react-server-dom-webpack": "18.3.0-canary-5bcade5fc-20231208",
17
17
  "waku": "0.17.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@swc/core": "1.3.96",
21
- "@types/react": "^18.2.37",
22
- "@types/react-dom": "^18.2.15",
23
- "@vitejs/plugin-react": "4.1.1",
24
- "typescript": "^5.2.2",
25
- "vite": "4.5.0"
20
+ "@swc/core": "1.3.100",
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@vitejs/plugin-react": "4.2.1",
24
+ "typescript": "^5.3.3",
25
+ "vite": "5.0.7"
26
26
  }
27
27
  }