-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
359 additions
and
48 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,7 @@ | ||
node_modules | ||
dist | ||
.env* | ||
*.tsbuildinfo | ||
.cache | ||
.DS_Store | ||
*.pem |
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,26 @@ | ||
{ | ||
"name": "05_compiler", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "waku dev", | ||
"build": "waku build", | ||
"start": "waku start" | ||
}, | ||
"dependencies": { | ||
"react": "19.0.0", | ||
"react-dom": "19.0.0", | ||
"react-server-dom-webpack": "19.0.0", | ||
"waku": "0.21.11" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "19.0.2", | ||
"@types/react-dom": "19.0.2", | ||
"@vitejs/plugin-react": "4.3.4", | ||
"autoprefixer": "10.4.20", | ||
"babel-plugin-react-compiler": "19.0.0-beta-b2e8e9c-20241220", | ||
"tailwindcss": "3.4.17", | ||
"typescript": "5.7.2" | ||
} | ||
} |
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,7 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,26 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
|
||
const Hello = () => { | ||
return <p suppressHydrationWarning>Hello (now={Date.now()})</p>; | ||
}; | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = useState(0); | ||
|
||
const handleIncrement = () => setCount((c) => c + 1); | ||
|
||
return ( | ||
<section className="border-blue-400 -mx-4 mt-4 rounded border border-dashed p-4"> | ||
<div>Count: {count}</div> | ||
<button | ||
onClick={handleIncrement} | ||
className="rounded-sm bg-black px-2 py-0.5 text-sm text-white" | ||
> | ||
Increment | ||
</button> | ||
<Hello /> | ||
</section> | ||
); | ||
}; |
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,18 @@ | ||
export const Footer = () => { | ||
return ( | ||
<footer className="p-6 lg:fixed lg:bottom-0 lg:left-0"> | ||
<div> | ||
visit{' '} | ||
<a | ||
href="https://waku.gg/" | ||
target="_blank" | ||
rel="noreferrer" | ||
className="mt-4 inline-block underline" | ||
> | ||
waku.gg | ||
</a>{' '} | ||
to learn more | ||
</div> | ||
</footer> | ||
); | ||
}; |
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,11 @@ | ||
import { Link } from 'waku'; | ||
|
||
export const Header = () => { | ||
return ( | ||
<header className="flex items-center gap-4 p-6 lg:fixed lg:left-0 lg:top-0"> | ||
<h2 className="text-lg font-bold tracking-tight"> | ||
<Link to="/">Waku starter</Link> | ||
</h2> | ||
</header> | ||
); | ||
}; |
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,39 @@ | ||
import '../styles.css'; | ||
|
||
import type { ReactNode } from 'react'; | ||
|
||
import { Header } from '../components/header'; | ||
import { Footer } from '../components/footer'; | ||
|
||
type RootLayoutProps = { children: ReactNode }; | ||
|
||
export default async function RootLayout({ children }: RootLayoutProps) { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div className="font-['Nunito']"> | ||
<meta name="description" content={data.description} /> | ||
<link rel="icon" type="image/png" href={data.icon} /> | ||
<Header /> | ||
<main className="m-6 flex items-center *:min-h-64 *:min-w-64 lg:m-0 lg:min-h-svh lg:justify-center"> | ||
{children} | ||
</main> | ||
<Footer /> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
description: 'An internet website!', | ||
icon: '/images/favicon.png', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
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,32 @@ | ||
import { Link } from 'waku'; | ||
|
||
export default async function AboutPage() { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div> | ||
<title>{data.title}</title> | ||
<h1 className="text-4xl font-bold tracking-tight">{data.headline}</h1> | ||
<p>{data.body}</p> | ||
<Link to="/" className="mt-4 inline-block underline"> | ||
Return home | ||
</Link> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
title: 'About', | ||
headline: 'About Waku', | ||
body: 'The minimal React framework', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
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,35 @@ | ||
import { Link } from 'waku'; | ||
|
||
import { Counter } from '../components/counter'; | ||
|
||
export default async function HomePage() { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div> | ||
<title>{data.title}</title> | ||
<h1 className="text-4xl font-bold tracking-tight">{data.headline}</h1> | ||
<p>{data.body}</p> | ||
<Counter /> | ||
<Link to="/about" className="mt-4 inline-block underline"> | ||
About page | ||
</Link> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
title: 'Waku', | ||
headline: 'Waku', | ||
body: 'Hello world!', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
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,4 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap'); | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
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,4 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: ['./src/**/*.{js,jsx,ts,tsx}'], | ||
}; |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "esnext", | ||
"downlevelIteration": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"exactOptionalPropertyTypes": true, | ||
"types": ["react/experimental"], | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'waku/config'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
const ReactCompilerConfig = {}; | ||
|
||
const getConfig = () => ({ | ||
plugins: [ | ||
react({ | ||
babel: { | ||
plugins: [['babel-plugin-react-compiler', ReactCompilerConfig]], | ||
}, | ||
}), | ||
], | ||
}); | ||
|
||
export default defineConfig({ | ||
unstable_viteConfigs: { | ||
'dev-main': getConfig, | ||
'build-client': getConfig, | ||
}, | ||
}); |
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
Oops, something went wrong.