create-waku 0.5.3 → 0.6.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 (179) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +118 -7731
  4. package/package.json +5 -6
  5. package/src/cli.ts +3 -7
  6. package/template/01_counter/dist/components/App.js +6 -0
  7. package/template/01_counter/dist/components/Counter.js +7 -0
  8. package/template/01_counter/dist/entries.js +31 -0
  9. package/template/01_counter/dist/main.js +6 -0
  10. package/template/01_counter/node_modules/.bin/tsc +2 -2
  11. package/template/01_counter/node_modules/.bin/tsserver +2 -2
  12. package/template/01_counter/node_modules/.bin/waku +2 -2
  13. package/template/01_counter/package.json +6 -6
  14. package/template/01_counter/src/entries.tsx +2 -2
  15. package/template/01_counter/tsconfig.json +3 -1
  16. package/template/02_async/dist/.tsbuildinfo +1 -0
  17. package/template/02_async/dist/node/.tsbuildinfo +1 -0
  18. package/template/02_async/dist/node/vite.config.d.ts +2 -0
  19. package/template/02_async/dist/node/vite.config.js +14 -0
  20. package/template/02_async/dist/src/components/App.d.ts +4 -0
  21. package/template/02_async/dist/src/components/App.js +16 -0
  22. package/template/02_async/dist/src/components/Counter.d.ts +1 -0
  23. package/template/02_async/dist/src/components/Counter.js +7 -0
  24. package/template/02_async/dist/src/entries.d.ts +6 -0
  25. package/template/02_async/dist/src/entries.js +31 -0
  26. package/template/02_async/dist/src/main.d.ts +1 -0
  27. package/template/02_async/dist/src/main.js +15 -0
  28. package/template/02_async/node_modules/.bin/tsc +2 -2
  29. package/template/02_async/node_modules/.bin/tsserver +2 -2
  30. package/template/02_async/node_modules/.bin/waku +2 -2
  31. package/template/02_async/package.json +6 -6
  32. package/template/02_async/src/components/App.tsx +2 -0
  33. package/template/02_async/src/entries.tsx +2 -2
  34. package/template/02_async/tsconfig.json +11 -2
  35. package/template/02_async/tsconfig.node.json +9 -0
  36. package/template/03_promise/dist/components/App.js +9 -0
  37. package/template/03_promise/dist/components/Counter.js +8 -0
  38. package/template/03_promise/dist/entries.js +32 -0
  39. package/template/03_promise/dist/main.js +6 -0
  40. package/template/03_promise/node_modules/.bin/tsc +2 -2
  41. package/template/03_promise/node_modules/.bin/tsserver +2 -2
  42. package/template/03_promise/node_modules/.bin/waku +2 -2
  43. package/template/03_promise/package.json +6 -6
  44. package/template/03_promise/src/entries.tsx +2 -2
  45. package/template/03_promise/tsconfig.json +3 -1
  46. package/template/04_callserver/dist/components/App.js +7 -0
  47. package/template/04_callserver/dist/components/Counter.js +14 -0
  48. package/template/04_callserver/dist/components/funcs.js +2 -0
  49. package/template/04_callserver/dist/entries.js +31 -0
  50. package/template/04_callserver/dist/main.js +6 -0
  51. package/template/04_callserver/node_modules/.bin/tsc +2 -2
  52. package/template/04_callserver/node_modules/.bin/tsserver +2 -2
  53. package/template/04_callserver/node_modules/.bin/waku +2 -2
  54. package/template/04_callserver/package.json +6 -6
  55. package/template/04_callserver/src/entries.tsx +2 -2
  56. package/template/04_callserver/tsconfig.json +3 -1
  57. package/template/05_mutation/dist/components/App.js +7 -0
  58. package/template/05_mutation/dist/components/Counter.js +13 -0
  59. package/template/05_mutation/dist/components/funcs.js +9 -0
  60. package/template/05_mutation/dist/entries.js +31 -0
  61. package/template/05_mutation/dist/main.js +6 -0
  62. package/template/05_mutation/node_modules/.bin/tsc +2 -2
  63. package/template/05_mutation/node_modules/.bin/tsserver +2 -2
  64. package/template/05_mutation/node_modules/.bin/waku +2 -2
  65. package/template/05_mutation/package.json +6 -6
  66. package/template/05_mutation/src/entries.tsx +2 -2
  67. package/template/05_mutation/tsconfig.json +3 -1
  68. package/template/06_nesting/dist/components/App.js +6 -0
  69. package/template/06_nesting/dist/components/Counter.js +24 -0
  70. package/template/06_nesting/dist/components/InnerApp.js +6 -0
  71. package/template/06_nesting/dist/entries.js +45 -0
  72. package/template/06_nesting/dist/main.js +6 -0
  73. package/template/06_nesting/node_modules/.bin/tsc +2 -2
  74. package/template/06_nesting/node_modules/.bin/tsserver +2 -2
  75. package/template/06_nesting/node_modules/.bin/waku +2 -2
  76. package/template/06_nesting/package.json +6 -6
  77. package/template/06_nesting/src/entries.tsx +2 -2
  78. package/template/06_nesting/tsconfig.json +3 -1
  79. package/template/07_router/dist/.tsbuildinfo +1 -0
  80. package/template/07_router/dist/node/.tsbuildinfo +1 -0
  81. package/template/07_router/dist/node/vite.config.d.ts +2 -0
  82. package/template/07_router/dist/node/vite.config.js +16 -0
  83. package/template/07_router/dist/src/components/Counter.d.ts +1 -0
  84. package/template/07_router/dist/src/components/Counter.js +8 -0
  85. package/template/07_router/dist/src/components/ErrorBoundary.d.ts +7 -0
  86. package/template/07_router/dist/src/components/ErrorBoundary.js +17 -0
  87. package/template/07_router/dist/src/entries.d.ts +6 -0
  88. package/template/07_router/dist/src/entries.js +29 -0
  89. package/template/07_router/dist/src/main.d.ts +1 -0
  90. package/template/07_router/dist/src/main.js +7 -0
  91. package/template/07_router/dist/src/routes/bar/page.d.ts +2 -0
  92. package/template/07_router/dist/src/routes/bar/page.js +4 -0
  93. package/template/07_router/dist/src/routes/foo/page.d.ts +2 -0
  94. package/template/07_router/dist/src/routes/foo/page.js +4 -0
  95. package/template/07_router/dist/src/routes/layout.d.ts +5 -0
  96. package/template/07_router/dist/src/routes/layout.js +9 -0
  97. package/template/07_router/dist/src/routes/nested/baz/page.d.ts +2 -0
  98. package/template/07_router/dist/src/routes/nested/baz/page.js +3 -0
  99. package/template/07_router/dist/src/routes/nested/layout.d.ts +5 -0
  100. package/template/07_router/dist/src/routes/nested/layout.js +4 -0
  101. package/template/07_router/dist/src/routes/nested/qux/page.d.ts +2 -0
  102. package/template/07_router/dist/src/routes/nested/qux/page.js +3 -0
  103. package/template/07_router/dist/src/routes/page.d.ts +2 -0
  104. package/template/07_router/dist/src/routes/page.js +3 -0
  105. package/template/07_router/node_modules/.bin/glob +4 -4
  106. package/template/07_router/node_modules/.bin/tsc +2 -2
  107. package/template/07_router/node_modules/.bin/tsserver +2 -2
  108. package/template/07_router/node_modules/.bin/waku +2 -2
  109. package/template/07_router/package.json +7 -7
  110. package/template/07_router/src/entries.tsx +1 -1
  111. package/template/07_router/tsconfig.json +11 -2
  112. package/template/07_router/tsconfig.node.json +9 -0
  113. package/template/08_cookies/dev.js +1 -1
  114. package/template/08_cookies/dist/components/App.js +8 -0
  115. package/template/08_cookies/dist/components/Counter.js +7 -0
  116. package/template/08_cookies/dist/entries.js +22 -0
  117. package/template/08_cookies/dist/main.js +6 -0
  118. package/template/08_cookies/node_modules/.bin/tsc +2 -2
  119. package/template/08_cookies/node_modules/.bin/tsserver +2 -2
  120. package/template/08_cookies/node_modules/.bin/waku +2 -2
  121. package/template/08_cookies/package.json +6 -6
  122. package/template/08_cookies/src/entries.tsx +2 -2
  123. package/template/08_cookies/tsconfig.json +3 -1
  124. package/template/09_cssmodules/dist/components/App.js +8 -0
  125. package/template/09_cssmodules/dist/components/Counter.js +7 -0
  126. package/template/09_cssmodules/dist/entries.js +31 -0
  127. package/template/09_cssmodules/dist/main.js +6 -0
  128. package/template/09_cssmodules/node_modules/.bin/tsc +2 -2
  129. package/template/09_cssmodules/node_modules/.bin/tsserver +2 -2
  130. package/template/09_cssmodules/node_modules/.bin/waku +2 -2
  131. package/template/09_cssmodules/package.json +6 -6
  132. package/template/09_cssmodules/src/entries.tsx +2 -2
  133. package/template/09_cssmodules/tsconfig.json +3 -1
  134. package/template/10_dynamicroute/dist/.tsbuildinfo +1 -0
  135. package/template/10_dynamicroute/dist/node/.tsbuildinfo +1 -0
  136. package/template/10_dynamicroute/dist/node/vite.config.d.ts +2 -0
  137. package/template/10_dynamicroute/dist/node/vite.config.js +16 -0
  138. package/template/10_dynamicroute/dist/src/entries.d.ts +6 -0
  139. package/template/10_dynamicroute/dist/src/entries.js +61 -0
  140. package/template/10_dynamicroute/dist/src/main.d.ts +1 -0
  141. package/template/10_dynamicroute/dist/src/main.js +6 -0
  142. package/template/10_dynamicroute/dist/src/routes/[name]/page.d.ts +4 -0
  143. package/template/10_dynamicroute/dist/src/routes/[name]/page.js +3 -0
  144. package/template/10_dynamicroute/dist/src/routes/layout.d.ts +5 -0
  145. package/template/10_dynamicroute/dist/src/routes/layout.js +4 -0
  146. package/template/10_dynamicroute/dist/src/routes/page.d.ts +2 -0
  147. package/template/10_dynamicroute/dist/src/routes/page.js +3 -0
  148. package/template/10_dynamicroute/node_modules/.bin/glob +17 -0
  149. package/template/10_dynamicroute/node_modules/.bin/tsc +17 -0
  150. package/template/10_dynamicroute/node_modules/.bin/tsserver +17 -0
  151. package/template/10_dynamicroute/node_modules/.bin/waku +17 -0
  152. package/template/10_dynamicroute/package.json +24 -0
  153. package/template/10_dynamicroute/src/entries.tsx +75 -0
  154. package/template/10_dynamicroute/src/index.html +36 -0
  155. package/template/10_dynamicroute/src/main.tsx +11 -0
  156. package/template/10_dynamicroute/src/routes/[name]/page.tsx +7 -0
  157. package/template/10_dynamicroute/src/routes/layout.tsx +25 -0
  158. package/template/10_dynamicroute/src/routes/page.tsx +7 -0
  159. package/template/10_dynamicroute/tsconfig.json +22 -0
  160. package/template/10_dynamicroute/tsconfig.node.json +9 -0
  161. package/template/10_dynamicroute/vite.config.ts +22 -0
  162. package/template/11_form/dist/components/App.js +8 -0
  163. package/template/11_form/dist/components/Counter.js +13 -0
  164. package/template/11_form/dist/components/Form.js +10 -0
  165. package/template/11_form/dist/components/funcs.js +10 -0
  166. package/template/11_form/dist/entries.js +31 -0
  167. package/template/11_form/dist/main.js +6 -0
  168. package/template/11_form/node_modules/.bin/tsc +17 -0
  169. package/template/11_form/node_modules/.bin/tsserver +17 -0
  170. package/template/11_form/node_modules/.bin/waku +17 -0
  171. package/template/11_form/package.json +23 -0
  172. package/template/11_form/src/components/App.tsx +25 -0
  173. package/template/11_form/src/components/Counter.tsx +29 -0
  174. package/template/11_form/src/components/Form.tsx +35 -0
  175. package/template/11_form/src/components/funcs.ts +15 -0
  176. package/template/11_form/src/entries.tsx +34 -0
  177. package/template/11_form/src/index.html +36 -0
  178. package/template/11_form/src/main.tsx +13 -0
  179. package/template/11_form/tsconfig.json +15 -0
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.18.2",
13
- "react": "18.3.0-canary-7118f5dd7-20230705",
14
- "react-dom": "18.3.0-canary-7118f5dd7-20230705",
15
- "react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
16
- "waku": "0.15.1"
13
+ "react": "18.3.0-canary-a41957507-20231017",
14
+ "react-dom": "18.3.0-canary-a41957507-20231017",
15
+ "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
16
+ "waku": "0.16.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.21",
20
- "@types/react-dom": "^18.2.7",
19
+ "@types/react": "^18.2.31",
20
+ "@types/react-dom": "^18.2.14",
21
21
  "typescript": "^5.2.2"
22
22
  }
23
23
  }
@@ -1,3 +1,5 @@
1
+ /// Async Server Component
2
+ /// <reference types="react/experimental" />
1
3
  import { Suspense } from "react";
2
4
 
3
5
  import { Counter } from "./Counter.js";
@@ -20,8 +20,8 @@ export default defineEntries(
20
20
  };
21
21
  },
22
22
  // getSsrConfig
23
- async () => ({
24
- getInput: (pathStr) => {
23
+ () => ({
24
+ getInput: async (pathStr) => {
25
25
  switch (pathStr) {
26
26
  case "/":
27
27
  return "";
@@ -8,6 +8,15 @@
8
8
  "skipLibCheck": true,
9
9
  "noUncheckedIndexedAccess": true,
10
10
  "exactOptionalPropertyTypes": true,
11
- "jsx": "react-jsx"
12
- }
11
+ "jsx": "react-jsx",
12
+ "outDir": "./dist",
13
+ "tsBuildInfoFile": "./dist/.tsbuildinfo",
14
+ "composite": true
15
+ },
16
+ "include": ["./src"],
17
+ "references": [
18
+ {
19
+ "path": "./tsconfig.node.json"
20
+ }
21
+ ]
13
22
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/node",
5
+ "tsBuildInfoFile": "./dist/node/.tsbuildinfo",
6
+ "types": ["node"]
7
+ },
8
+ "include": ["vite.config.ts"]
9
+ }
@@ -0,0 +1,9 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Counter } from "./Counter.js";
3
+ const App = ({ name, children }) => {
4
+ const delayedMessage = new Promise((resolve) => {
5
+ setTimeout(() => resolve("Hello from server!"), 2000);
6
+ });
7
+ return (_jsxs("div", { style: { border: "3px red dashed", margin: "1em", padding: "1em" }, children: [_jsxs("h1", { children: ["Hello ", name, "!!"] }), _jsx("h3", { children: "This is a server component." }), _jsx(Counter, { delayedMessage: delayedMessage }), children] }));
8
+ };
9
+ export default App;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { Suspense, useState } from "react";
4
+ export const Counter = ({ delayedMessage, }) => {
5
+ const [count, setCount] = useState(0);
6
+ return (_jsxs("div", { style: { border: "3px blue dashed", margin: "1em", padding: "1em" }, children: [_jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: () => setCount((c) => c + 1), children: "Increment" }), _jsx("h3", { children: "This is a client component." }), _jsx(Suspense, { fallback: "Pending...", children: _jsx(Message, { count: count, delayedMessage: delayedMessage }) })] }));
7
+ };
8
+ const Message = ({ count, delayedMessage, }) => (_jsxs("ul", { children: [_jsxs("li", { children: ["count: ", count] }), _jsxs("li", { children: ["delayedMessage: ", delayedMessage] })] }));
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy } from "react";
3
+ import { defineEntries } from "waku/server";
4
+ import { Children } from "waku/client";
5
+ const App = lazy(() => import("./components/App.js"));
6
+ export default defineEntries(
7
+ // renderEntries
8
+ async (input) => {
9
+ return {
10
+ App: (_jsx(App, { name: input || "Waku", children: _jsx(Children, {}) })),
11
+ };
12
+ },
13
+ // getBuildConfig
14
+ async () => {
15
+ return {
16
+ "/": {
17
+ entries: [[""]],
18
+ },
19
+ };
20
+ },
21
+ // getSsrConfig
22
+ () => ({
23
+ getInput: async (pathStr) => {
24
+ switch (pathStr) {
25
+ case "/":
26
+ return "";
27
+ default:
28
+ return null;
29
+ }
30
+ },
31
+ filter: (elements) => elements.App,
32
+ }));
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StrictMode } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { Root, Slot } from "waku/client";
5
+ const rootElement = (_jsx(StrictMode, { children: _jsx(Root, { children: _jsx(Slot, { id: "App", children: _jsx("h3", { children: "A client element" }) }) }) }));
6
+ createRoot(document.getElementById("root")).render(rootElement);
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
16
+ exec node "$basedir/../typescript/bin/tsc" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
16
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/packages/waku/dist/node_modules:/home/runner/work/waku/waku/packages/waku/node_modules:/home/runner/work/waku/waku/packages/node_modules:/home/runner/work/waku/waku/node_modules:/home/runner/work/waku/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../packages/waku/dist/cli.js" "$@"
14
+ exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../packages/waku/dist/cli.js" "$@"
16
+ exec node "$basedir/../waku/dist/cli.js" "$@"
17
17
  fi
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.18.2",
13
- "react": "18.3.0-canary-7118f5dd7-20230705",
14
- "react-dom": "18.3.0-canary-7118f5dd7-20230705",
15
- "react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
16
- "waku": "0.15.1"
13
+ "react": "18.3.0-canary-a41957507-20231017",
14
+ "react-dom": "18.3.0-canary-a41957507-20231017",
15
+ "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
16
+ "waku": "0.16.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.21",
20
- "@types/react-dom": "^18.2.7",
19
+ "@types/react": "^18.2.31",
20
+ "@types/react-dom": "^18.2.14",
21
21
  "typescript": "^5.2.2"
22
22
  }
23
23
  }
@@ -25,8 +25,8 @@ export default defineEntries(
25
25
  };
26
26
  },
27
27
  // getSsrConfig
28
- async () => ({
29
- getInput: (pathStr) => {
28
+ () => ({
29
+ getInput: async (pathStr) => {
30
30
  switch (pathStr) {
31
31
  case "/":
32
32
  return "";
@@ -8,6 +8,8 @@
8
8
  "skipLibCheck": true,
9
9
  "noUncheckedIndexedAccess": true,
10
10
  "exactOptionalPropertyTypes": true,
11
- "jsx": "react-jsx"
11
+ "jsx": "react-jsx",
12
+ "outDir": "./dist",
13
+ "rootDir": "./src"
12
14
  }
13
15
  }
@@ -0,0 +1,7 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Counter } from "./Counter.js";
3
+ import { greet } from "./funcs.js";
4
+ const App = ({ name }) => {
5
+ return (_jsxs("div", { style: { border: "3px red dashed", margin: "1em", padding: "1em" }, children: [_jsxs("h1", { children: ["Hello ", name, "!!"] }), _jsx("h3", { children: "This is a server component." }), _jsx(Counter, { greet: greet })] }));
6
+ };
7
+ export default App;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState, useTransition } from "react";
4
+ export const Counter = ({ greet, }) => {
5
+ const [count, setCount] = useState(0);
6
+ const [text, setText] = useState("");
7
+ const [isPending, startTransition] = useTransition();
8
+ const handleClick = () => {
9
+ startTransition(() => {
10
+ setText(greet("c=" + count));
11
+ });
12
+ };
13
+ return (_jsxs("div", { style: { border: "3px blue dashed", margin: "1em", padding: "1em" }, children: [_jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: () => setCount((c) => c + 1), children: "Increment" }), _jsxs("p", { children: [_jsxs("button", { onClick: handleClick, children: ["greet(\"c=\" + count) = ", text] }), " ", isPending ? "Pending..." : ""] }), _jsx("h3", { children: "This is a client component." })] }));
14
+ };
@@ -0,0 +1,2 @@
1
+ "use server";
2
+ export const greet = (name) => `Hello ${name} from server!`;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy } from "react";
3
+ import { defineEntries } from "waku/server";
4
+ const App = lazy(() => import("./components/App.js"));
5
+ export default defineEntries(
6
+ // renderEntries
7
+ async (input) => {
8
+ return {
9
+ App: _jsx(App, { name: input || "Waku" }),
10
+ };
11
+ },
12
+ // getBuildConfig
13
+ async () => {
14
+ return {
15
+ "/": {
16
+ entries: [[""]],
17
+ },
18
+ };
19
+ },
20
+ // getSsrConfig
21
+ () => ({
22
+ getInput: async (pathStr) => {
23
+ switch (pathStr) {
24
+ case "/":
25
+ return "";
26
+ default:
27
+ return null;
28
+ }
29
+ },
30
+ filter: (elements) => elements.App,
31
+ }));
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StrictMode } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { Root, Slot } from "waku/client";
5
+ const rootElement = (_jsx(StrictMode, { children: _jsx(Root, { children: _jsx(Slot, { id: "App" }) }) }));
6
+ createRoot(document.getElementById("root")).render(rootElement);
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
16
+ exec node "$basedir/../typescript/bin/tsc" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
16
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/packages/waku/dist/node_modules:/home/runner/work/waku/waku/packages/waku/node_modules:/home/runner/work/waku/waku/packages/node_modules:/home/runner/work/waku/waku/node_modules:/home/runner/work/waku/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../packages/waku/dist/cli.js" "$@"
14
+ exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../packages/waku/dist/cli.js" "$@"
16
+ exec node "$basedir/../waku/dist/cli.js" "$@"
17
17
  fi
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.18.2",
13
- "react": "18.3.0-canary-7118f5dd7-20230705",
14
- "react-dom": "18.3.0-canary-7118f5dd7-20230705",
15
- "react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
16
- "waku": "0.15.1"
13
+ "react": "18.3.0-canary-a41957507-20231017",
14
+ "react-dom": "18.3.0-canary-a41957507-20231017",
15
+ "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
16
+ "waku": "0.16.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.21",
20
- "@types/react-dom": "^18.2.7",
19
+ "@types/react": "^18.2.31",
20
+ "@types/react-dom": "^18.2.14",
21
21
  "typescript": "^5.2.2"
22
22
  }
23
23
  }
@@ -20,8 +20,8 @@ export default defineEntries(
20
20
  };
21
21
  },
22
22
  // getSsrConfig
23
- async () => ({
24
- getInput: (pathStr) => {
23
+ () => ({
24
+ getInput: async (pathStr) => {
25
25
  switch (pathStr) {
26
26
  case "/":
27
27
  return "";
@@ -8,6 +8,8 @@
8
8
  "skipLibCheck": true,
9
9
  "noUncheckedIndexedAccess": true,
10
10
  "exactOptionalPropertyTypes": true,
11
- "jsx": "react-jsx"
11
+ "jsx": "react-jsx",
12
+ "outDir": "./dist",
13
+ "rootDir": "./src"
12
14
  }
13
15
  }
@@ -0,0 +1,7 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Counter } from "./Counter.js";
3
+ import { getCounter, increment } from "./funcs.js";
4
+ const App = ({ name }) => {
5
+ return (_jsxs("div", { style: { border: "3px red dashed", margin: "1em", padding: "1em" }, children: [_jsxs("h1", { children: ["Hello ", name, "!!"] }), _jsx("h3", { children: "This is a server component." }), _jsxs("p", { children: ["Server counter: ", getCounter()] }), _jsx(Counter, { increment: increment })] }));
6
+ };
7
+ export default App;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState, useTransition } from "react";
4
+ export const Counter = ({ increment }) => {
5
+ const [count, setCount] = useState(0);
6
+ const [isPending, startTransition] = useTransition();
7
+ const handleClick = () => {
8
+ startTransition(() => {
9
+ increment();
10
+ });
11
+ };
12
+ return (_jsxs("div", { style: { border: "3px blue dashed", margin: "1em", padding: "1em" }, children: [_jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: () => setCount((c) => c + 1), children: "Increment" }), _jsxs("p", { children: [_jsx("button", { onClick: handleClick, children: "Increment server counter" }), " ", isPending ? "Pending..." : ""] }), _jsx("h3", { children: "This is a client component." })] }));
13
+ };
@@ -0,0 +1,9 @@
1
+ "use server";
2
+ import { rerender } from "waku/server";
3
+ // module state on server
4
+ let counter = 0;
5
+ export const getCounter = () => counter;
6
+ export const increment = () => {
7
+ counter += 1;
8
+ rerender("Waku");
9
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy } from "react";
3
+ import { defineEntries } from "waku/server";
4
+ const App = lazy(() => import("./components/App.js"));
5
+ export default defineEntries(
6
+ // renderEntries
7
+ async (input) => {
8
+ return {
9
+ App: _jsx(App, { name: input || "Waku" }),
10
+ };
11
+ },
12
+ // getBuildConfig
13
+ async () => {
14
+ return {
15
+ "/": {
16
+ entries: [[""]],
17
+ },
18
+ };
19
+ },
20
+ // getSsrConfig
21
+ () => ({
22
+ getInput: async (pathStr) => {
23
+ switch (pathStr) {
24
+ case "/":
25
+ return "";
26
+ default:
27
+ return null;
28
+ }
29
+ },
30
+ filter: (elements) => elements.App,
31
+ }));
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StrictMode } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { Root, Slot } from "waku/client";
5
+ const rootElement = (_jsx(StrictMode, { children: _jsx(Root, { children: _jsx(Slot, { id: "App" }) }) }));
6
+ createRoot(document.getElementById("root")).render(rootElement);
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsc" "$@"
16
+ exec node "$basedir/../typescript/bin/tsc" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/typescript@5.2.2/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
14
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/bin/tsserver" "$@"
16
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
17
17
  fi
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="/home/runner/work/waku/waku/packages/waku/dist/node_modules:/home/runner/work/waku/waku/packages/waku/node_modules:/home/runner/work/waku/waku/packages/node_modules:/home/runner/work/waku/waku/node_modules:/home/runner/work/waku/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/waku/waku/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../packages/waku/dist/cli.js" "$@"
14
+ exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../packages/waku/dist/cli.js" "$@"
16
+ exec node "$basedir/../waku/dist/cli.js" "$@"
17
17
  fi
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.18.2",
13
- "react": "18.3.0-canary-7118f5dd7-20230705",
14
- "react-dom": "18.3.0-canary-7118f5dd7-20230705",
15
- "react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
16
- "waku": "0.15.1"
13
+ "react": "18.3.0-canary-a41957507-20231017",
14
+ "react-dom": "18.3.0-canary-a41957507-20231017",
15
+ "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
16
+ "waku": "0.16.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.21",
20
- "@types/react-dom": "^18.2.7",
19
+ "@types/react": "^18.2.31",
20
+ "@types/react-dom": "^18.2.14",
21
21
  "typescript": "^5.2.2"
22
22
  }
23
23
  }
@@ -20,8 +20,8 @@ export default defineEntries(
20
20
  };
21
21
  },
22
22
  // getSsrConfig
23
- async () => ({
24
- getInput: (pathStr) => {
23
+ () => ({
24
+ getInput: async (pathStr) => {
25
25
  switch (pathStr) {
26
26
  case "/":
27
27
  return "";
@@ -8,6 +8,8 @@
8
8
  "skipLibCheck": true,
9
9
  "noUncheckedIndexedAccess": true,
10
10
  "exactOptionalPropertyTypes": true,
11
- "jsx": "react-jsx"
11
+ "jsx": "react-jsx",
12
+ "outDir": "./dist",
13
+ "rootDir": "./src"
12
14
  }
13
15
  }
@@ -0,0 +1,6 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Counter } from "./Counter.js";
3
+ const App = ({ name }) => {
4
+ return (_jsxs("div", { style: { border: "3px red dashed", margin: "1em", padding: "1em" }, children: [_jsxs("h1", { children: ["Hello ", name, "!!"] }), _jsx("h3", { children: "This is a server component." }), _jsx(Counter, { enableInnerApp: true })] }));
5
+ };
6
+ export default App;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState, useTransition } from "react";
4
+ import { Slot, useRefetch } from "waku/client";
5
+ export const Counter = ({ enableInnerApp = false }) => {
6
+ const [count, setCount] = useState(0);
7
+ const [isPending, startTransition] = useTransition();
8
+ const refetch = useRefetch();
9
+ const handleClick = () => {
10
+ if (enableInnerApp) {
11
+ startTransition(() => {
12
+ const nextCount = count + 1;
13
+ setCount(nextCount);
14
+ if (enableInnerApp) {
15
+ refetch("InnerApp=" + nextCount);
16
+ }
17
+ });
18
+ }
19
+ else {
20
+ setCount((c) => c + 1);
21
+ }
22
+ };
23
+ return (_jsxs("div", { style: { border: "3px blue dashed", margin: "1em", padding: "1em" }, children: [_jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: handleClick, children: "Increment" }), " ", isPending && "Pending...", _jsx("h3", { children: "This is a client component." }), enableInnerApp && _jsx(Slot, { id: "InnerApp" })] }));
24
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Counter } from "./Counter.js";
3
+ const InnerApp = ({ count = -1 }) => {
4
+ return (_jsxs("div", { style: { border: "3px red dashed", margin: "1em", padding: "1em" }, children: [_jsx("h3", { children: "This is another server component." }), _jsxs("p", { children: ["The outer count is ", count, "."] }), _jsx(Counter, {})] }));
5
+ };
6
+ export default InnerApp;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy } from "react";
3
+ import { defineEntries } from "waku/server";
4
+ const App = lazy(() => import("./components/App.js"));
5
+ const InnerApp = lazy(() => import("./components/InnerApp.js"));
6
+ export default defineEntries(
7
+ // renderEntries
8
+ async (input) => {
9
+ const params = new URLSearchParams(input || "App=Waku&InnerApp=0");
10
+ const result = {};
11
+ if (params.has("App")) {
12
+ result.App = _jsx(App, { name: params.get("App") });
13
+ }
14
+ if (params.has("InnerApp")) {
15
+ result.InnerApp = _jsx(InnerApp, { count: Number(params.get("InnerApp")) });
16
+ }
17
+ return result;
18
+ },
19
+ // getBuildConfig
20
+ async () => {
21
+ return {
22
+ "/": {
23
+ entries: [
24
+ [""],
25
+ ["InnerApp=1", true],
26
+ ["InnerApp=2", true],
27
+ ["InnerApp=3", true],
28
+ ["InnerApp=4", true],
29
+ ["InnerApp=5", true],
30
+ ],
31
+ },
32
+ };
33
+ },
34
+ // getSsrConfig
35
+ () => ({
36
+ getInput: async (pathStr) => {
37
+ switch (pathStr) {
38
+ case "/":
39
+ return "App=Waku";
40
+ default:
41
+ return null;
42
+ }
43
+ },
44
+ filter: (elements) => elements.App,
45
+ }));
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StrictMode } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { Root, Slot } from "waku/client";
5
+ const rootElement = (_jsx(StrictMode, { children: _jsx(Root, { children: _jsx(Slot, { id: "App" }) }) }));
6
+ createRoot(document.getElementById("root")).render(rootElement);