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.
- package/dist/.tsbuildinfo +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +118 -7731
- package/package.json +5 -6
- package/src/cli.ts +3 -7
- package/template/01_counter/dist/components/App.js +6 -0
- package/template/01_counter/dist/components/Counter.js +7 -0
- package/template/01_counter/dist/entries.js +31 -0
- package/template/01_counter/dist/main.js +6 -0
- package/template/01_counter/node_modules/.bin/tsc +2 -2
- package/template/01_counter/node_modules/.bin/tsserver +2 -2
- package/template/01_counter/node_modules/.bin/waku +2 -2
- package/template/01_counter/package.json +6 -6
- package/template/01_counter/src/entries.tsx +2 -2
- package/template/01_counter/tsconfig.json +3 -1
- package/template/02_async/dist/.tsbuildinfo +1 -0
- package/template/02_async/dist/node/.tsbuildinfo +1 -0
- package/template/02_async/dist/node/vite.config.d.ts +2 -0
- package/template/02_async/dist/node/vite.config.js +14 -0
- package/template/02_async/dist/src/components/App.d.ts +4 -0
- package/template/02_async/dist/src/components/App.js +16 -0
- package/template/02_async/dist/src/components/Counter.d.ts +1 -0
- package/template/02_async/dist/src/components/Counter.js +7 -0
- package/template/02_async/dist/src/entries.d.ts +6 -0
- package/template/02_async/dist/src/entries.js +31 -0
- package/template/02_async/dist/src/main.d.ts +1 -0
- package/template/02_async/dist/src/main.js +15 -0
- package/template/02_async/node_modules/.bin/tsc +2 -2
- package/template/02_async/node_modules/.bin/tsserver +2 -2
- package/template/02_async/node_modules/.bin/waku +2 -2
- package/template/02_async/package.json +6 -6
- package/template/02_async/src/components/App.tsx +2 -0
- package/template/02_async/src/entries.tsx +2 -2
- package/template/02_async/tsconfig.json +11 -2
- package/template/02_async/tsconfig.node.json +9 -0
- package/template/03_promise/dist/components/App.js +9 -0
- package/template/03_promise/dist/components/Counter.js +8 -0
- package/template/03_promise/dist/entries.js +32 -0
- package/template/03_promise/dist/main.js +6 -0
- package/template/03_promise/node_modules/.bin/tsc +2 -2
- package/template/03_promise/node_modules/.bin/tsserver +2 -2
- package/template/03_promise/node_modules/.bin/waku +2 -2
- package/template/03_promise/package.json +6 -6
- package/template/03_promise/src/entries.tsx +2 -2
- package/template/03_promise/tsconfig.json +3 -1
- package/template/04_callserver/dist/components/App.js +7 -0
- package/template/04_callserver/dist/components/Counter.js +14 -0
- package/template/04_callserver/dist/components/funcs.js +2 -0
- package/template/04_callserver/dist/entries.js +31 -0
- package/template/04_callserver/dist/main.js +6 -0
- package/template/04_callserver/node_modules/.bin/tsc +2 -2
- package/template/04_callserver/node_modules/.bin/tsserver +2 -2
- package/template/04_callserver/node_modules/.bin/waku +2 -2
- package/template/04_callserver/package.json +6 -6
- package/template/04_callserver/src/entries.tsx +2 -2
- package/template/04_callserver/tsconfig.json +3 -1
- package/template/05_mutation/dist/components/App.js +7 -0
- package/template/05_mutation/dist/components/Counter.js +13 -0
- package/template/05_mutation/dist/components/funcs.js +9 -0
- package/template/05_mutation/dist/entries.js +31 -0
- package/template/05_mutation/dist/main.js +6 -0
- package/template/05_mutation/node_modules/.bin/tsc +2 -2
- package/template/05_mutation/node_modules/.bin/tsserver +2 -2
- package/template/05_mutation/node_modules/.bin/waku +2 -2
- package/template/05_mutation/package.json +6 -6
- package/template/05_mutation/src/entries.tsx +2 -2
- package/template/05_mutation/tsconfig.json +3 -1
- package/template/06_nesting/dist/components/App.js +6 -0
- package/template/06_nesting/dist/components/Counter.js +24 -0
- package/template/06_nesting/dist/components/InnerApp.js +6 -0
- package/template/06_nesting/dist/entries.js +45 -0
- package/template/06_nesting/dist/main.js +6 -0
- package/template/06_nesting/node_modules/.bin/tsc +2 -2
- package/template/06_nesting/node_modules/.bin/tsserver +2 -2
- package/template/06_nesting/node_modules/.bin/waku +2 -2
- package/template/06_nesting/package.json +6 -6
- package/template/06_nesting/src/entries.tsx +2 -2
- package/template/06_nesting/tsconfig.json +3 -1
- package/template/07_router/dist/.tsbuildinfo +1 -0
- package/template/07_router/dist/node/.tsbuildinfo +1 -0
- package/template/07_router/dist/node/vite.config.d.ts +2 -0
- package/template/07_router/dist/node/vite.config.js +16 -0
- package/template/07_router/dist/src/components/Counter.d.ts +1 -0
- package/template/07_router/dist/src/components/Counter.js +8 -0
- package/template/07_router/dist/src/components/ErrorBoundary.d.ts +7 -0
- package/template/07_router/dist/src/components/ErrorBoundary.js +17 -0
- package/template/07_router/dist/src/entries.d.ts +6 -0
- package/template/07_router/dist/src/entries.js +29 -0
- package/template/07_router/dist/src/main.d.ts +1 -0
- package/template/07_router/dist/src/main.js +7 -0
- package/template/07_router/dist/src/routes/bar/page.d.ts +2 -0
- package/template/07_router/dist/src/routes/bar/page.js +4 -0
- package/template/07_router/dist/src/routes/foo/page.d.ts +2 -0
- package/template/07_router/dist/src/routes/foo/page.js +4 -0
- package/template/07_router/dist/src/routes/layout.d.ts +5 -0
- package/template/07_router/dist/src/routes/layout.js +9 -0
- package/template/07_router/dist/src/routes/nested/baz/page.d.ts +2 -0
- package/template/07_router/dist/src/routes/nested/baz/page.js +3 -0
- package/template/07_router/dist/src/routes/nested/layout.d.ts +5 -0
- package/template/07_router/dist/src/routes/nested/layout.js +4 -0
- package/template/07_router/dist/src/routes/nested/qux/page.d.ts +2 -0
- package/template/07_router/dist/src/routes/nested/qux/page.js +3 -0
- package/template/07_router/dist/src/routes/page.d.ts +2 -0
- package/template/07_router/dist/src/routes/page.js +3 -0
- package/template/07_router/node_modules/.bin/glob +4 -4
- package/template/07_router/node_modules/.bin/tsc +2 -2
- package/template/07_router/node_modules/.bin/tsserver +2 -2
- package/template/07_router/node_modules/.bin/waku +2 -2
- package/template/07_router/package.json +7 -7
- package/template/07_router/src/entries.tsx +1 -1
- package/template/07_router/tsconfig.json +11 -2
- package/template/07_router/tsconfig.node.json +9 -0
- package/template/08_cookies/dev.js +1 -1
- package/template/08_cookies/dist/components/App.js +8 -0
- package/template/08_cookies/dist/components/Counter.js +7 -0
- package/template/08_cookies/dist/entries.js +22 -0
- package/template/08_cookies/dist/main.js +6 -0
- package/template/08_cookies/node_modules/.bin/tsc +2 -2
- package/template/08_cookies/node_modules/.bin/tsserver +2 -2
- package/template/08_cookies/node_modules/.bin/waku +2 -2
- package/template/08_cookies/package.json +6 -6
- package/template/08_cookies/src/entries.tsx +2 -2
- package/template/08_cookies/tsconfig.json +3 -1
- package/template/09_cssmodules/dist/components/App.js +8 -0
- package/template/09_cssmodules/dist/components/Counter.js +7 -0
- package/template/09_cssmodules/dist/entries.js +31 -0
- package/template/09_cssmodules/dist/main.js +6 -0
- package/template/09_cssmodules/node_modules/.bin/tsc +2 -2
- package/template/09_cssmodules/node_modules/.bin/tsserver +2 -2
- package/template/09_cssmodules/node_modules/.bin/waku +2 -2
- package/template/09_cssmodules/package.json +6 -6
- package/template/09_cssmodules/src/entries.tsx +2 -2
- package/template/09_cssmodules/tsconfig.json +3 -1
- package/template/10_dynamicroute/dist/.tsbuildinfo +1 -0
- package/template/10_dynamicroute/dist/node/.tsbuildinfo +1 -0
- package/template/10_dynamicroute/dist/node/vite.config.d.ts +2 -0
- package/template/10_dynamicroute/dist/node/vite.config.js +16 -0
- package/template/10_dynamicroute/dist/src/entries.d.ts +6 -0
- package/template/10_dynamicroute/dist/src/entries.js +61 -0
- package/template/10_dynamicroute/dist/src/main.d.ts +1 -0
- package/template/10_dynamicroute/dist/src/main.js +6 -0
- package/template/10_dynamicroute/dist/src/routes/[name]/page.d.ts +4 -0
- package/template/10_dynamicroute/dist/src/routes/[name]/page.js +3 -0
- package/template/10_dynamicroute/dist/src/routes/layout.d.ts +5 -0
- package/template/10_dynamicroute/dist/src/routes/layout.js +4 -0
- package/template/10_dynamicroute/dist/src/routes/page.d.ts +2 -0
- package/template/10_dynamicroute/dist/src/routes/page.js +3 -0
- package/template/10_dynamicroute/node_modules/.bin/glob +17 -0
- package/template/10_dynamicroute/node_modules/.bin/tsc +17 -0
- package/template/10_dynamicroute/node_modules/.bin/tsserver +17 -0
- package/template/10_dynamicroute/node_modules/.bin/waku +17 -0
- package/template/10_dynamicroute/package.json +24 -0
- package/template/10_dynamicroute/src/entries.tsx +75 -0
- package/template/10_dynamicroute/src/index.html +36 -0
- package/template/10_dynamicroute/src/main.tsx +11 -0
- package/template/10_dynamicroute/src/routes/[name]/page.tsx +7 -0
- package/template/10_dynamicroute/src/routes/layout.tsx +25 -0
- package/template/10_dynamicroute/src/routes/page.tsx +7 -0
- package/template/10_dynamicroute/tsconfig.json +22 -0
- package/template/10_dynamicroute/tsconfig.node.json +9 -0
- package/template/10_dynamicroute/vite.config.ts +22 -0
- package/template/11_form/dist/components/App.js +8 -0
- package/template/11_form/dist/components/Counter.js +13 -0
- package/template/11_form/dist/components/Form.js +10 -0
- package/template/11_form/dist/components/funcs.js +10 -0
- package/template/11_form/dist/entries.js +31 -0
- package/template/11_form/dist/main.js +6 -0
- package/template/11_form/node_modules/.bin/tsc +17 -0
- package/template/11_form/node_modules/.bin/tsserver +17 -0
- package/template/11_form/node_modules/.bin/waku +17 -0
- package/template/11_form/package.json +23 -0
- package/template/11_form/src/components/App.tsx +25 -0
- package/template/11_form/src/components/Counter.tsx +29 -0
- package/template/11_form/src/components/Form.tsx +35 -0
- package/template/11_form/src/components/funcs.ts +15 -0
- package/template/11_form/src/entries.tsx +34 -0
- package/template/11_form/src/index.html +36 -0
- package/template/11_form/src/main.tsx +13 -0
- 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-
|
|
14
|
-
"react-dom": "18.3.0-canary-
|
|
15
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
16
|
-
"waku": "0.
|
|
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.
|
|
20
|
-
"@types/react-dom": "^18.2.
|
|
19
|
+
"@types/react": "^18.2.31",
|
|
20
|
+
"@types/react-dom": "^18.2.14",
|
|
21
21
|
"typescript": "^5.2.2"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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
|
+
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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-
|
|
14
|
-
"react-dom": "18.3.0-canary-
|
|
15
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
16
|
-
"waku": "0.
|
|
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.
|
|
20
|
-
"@types/react-dom": "^18.2.
|
|
19
|
+
"@types/react": "^18.2.31",
|
|
20
|
+
"@types/react-dom": "^18.2.14",
|
|
21
21
|
"typescript": "^5.2.2"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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,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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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-
|
|
14
|
-
"react-dom": "18.3.0-canary-
|
|
15
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
16
|
-
"waku": "0.
|
|
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.
|
|
20
|
-
"@types/react-dom": "^18.2.
|
|
19
|
+
"@types/react": "^18.2.31",
|
|
20
|
+
"@types/react-dom": "^18.2.14",
|
|
21
21
|
"typescript": "^5.2.2"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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,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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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
|
|
14
|
+
exec "$basedir/node" "$basedir/../waku/dist/cli.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
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-
|
|
14
|
-
"react-dom": "18.3.0-canary-
|
|
15
|
-
"react-server-dom-webpack": "18.3.0-canary-
|
|
16
|
-
"waku": "0.
|
|
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.
|
|
20
|
-
"@types/react-dom": "^18.2.
|
|
19
|
+
"@types/react": "^18.2.31",
|
|
20
|
+
"@types/react-dom": "^18.2.14",
|
|
21
21
|
"typescript": "^5.2.2"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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);
|