-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: partially for css modules (#98)
* wip: fix ssr server * add examples/09 * run prettier
- Loading branch information
Showing
11 changed files
with
181 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "waku-example", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "waku dev --with-ssr", | ||
"build": "waku build", | ||
"start": "waku start --with-ssr" | ||
}, | ||
"dependencies": { | ||
"express": "^4.18.2", | ||
"react": "18.3.0-canary-7118f5dd7-20230705", | ||
"react-dom": "18.3.0-canary-7118f5dd7-20230705", | ||
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705", | ||
"waku": "0.13.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.8", | ||
"@types/react-dom": "^18.2.4", | ||
"typescript": "^5.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.title { | ||
background-color: pink; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// @ts-expect-error no types | ||
import styles from "./App.module.css"; | ||
import { Counter } from "./Counter.js"; | ||
|
||
const App = ({ name = "Anonymous" }) => { | ||
return ( | ||
<div style={{ border: "3px red dashed", margin: "1em", padding: "1em" }}> | ||
<h1 className={styles.title}>Hello {name}!!</h1> | ||
<h3>This is a server component.</h3> | ||
<Counter /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<div style={{ border: "3px blue dashed", margin: "1em", padding: "1em" }}> | ||
<p>Count: {count}</p> | ||
<button onClick={() => setCount((c) => c + 1)}>Increment</button> | ||
<h3>This is a client component.</h3> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineEntries } from "waku/server"; | ||
|
||
export default defineEntries( | ||
// getEntry | ||
async (id) => { | ||
switch (id) { | ||
case "App": | ||
return import("./components/App.js"); | ||
default: | ||
return null; | ||
} | ||
}, | ||
// getBuildConfig | ||
async () => { | ||
return { | ||
"/": { | ||
elements: [["App", { name: "Waku" }]], | ||
}, | ||
}; | ||
}, | ||
// getSsrConfig | ||
async (pathStr) => { | ||
switch (pathStr) { | ||
case "/": | ||
return { element: ["App", { name: "Waku" }] }; | ||
default: | ||
return null; | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Waku example</title> | ||
<style> | ||
@keyframes spinner { | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
.spinner { | ||
width: 36px; | ||
height: 36px; | ||
margin: auto; | ||
border: 2px solid #ddd; | ||
border-top-color: #222; | ||
border-radius: 50%; | ||
animation: spinner 1s linear infinite; | ||
} | ||
#root > .spinner { | ||
margin-top: calc(50% - 18px); | ||
} | ||
</style> | ||
<link rel="stylesheet" href="/components/App.module.css" /> | ||
</head> | ||
<body> | ||
<!--placeholder1--> | ||
<div id="root"> | ||
<div class="spinner"></div> | ||
</div> | ||
<!--/placeholder1--> | ||
<script src="/main.tsx" async type="module"></script> | ||
<!--placeholder2--> | ||
<!--/placeholder2--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { StrictMode } from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { serve } from "waku/client"; | ||
|
||
const App = serve<{ name: string }>("App"); | ||
const rootElement = ( | ||
<StrictMode> | ||
<App name="Waku" /> | ||
</StrictMode> | ||
); | ||
|
||
createRoot(document.getElementById("root")!).render(rootElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "esnext", | ||
"downlevelIteration": true, | ||
"esModuleInterop": true, | ||
"module": "nodenext", | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"exactOptionalPropertyTypes": true, | ||
"jsx": "react-jsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5af1c34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
waku – ./
waku-daishi.vercel.app
waku-git-main-daishi.vercel.app
waku.vercel.app
www.waku.gg
waku.gg