frontend-hamroun 1.2.83 → 1.2.85
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/bin/cli.js +57 -869
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.cjs.map +1 -1
- package/dist/index.client.js +2 -2
- package/dist/index.client.js.map +1 -1
- package/dist/index.js +116 -136
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/renderer-DaVfBeVi.cjs +2 -0
- package/dist/renderer-DaVfBeVi.cjs.map +1 -0
- package/dist/renderer-nfT7XSpo.js +61 -0
- package/dist/renderer-nfT7XSpo.js.map +1 -0
- package/dist/server-renderer-B5b0Q0ck.cjs +2 -0
- package/dist/server-renderer-B5b0Q0ck.cjs.map +1 -0
- package/dist/{server-renderer-C1WXH-zV.js → server-renderer-C4MB-jAp.js} +6 -39
- package/dist/server-renderer-C4MB-jAp.js.map +1 -0
- package/dist/server-renderer.cjs +1 -1
- package/dist/server-renderer.js +1 -1
- package/package.json +1 -1
- package/templates/basic-app/build.d.ts +2 -0
- package/templates/basic-app/build.d.ts.map +1 -0
- package/templates/basic-app/dev.d.ts +2 -0
- package/templates/basic-app/dev.d.ts.map +1 -0
- package/templates/basic-app/esbuild.config.d.ts +2 -0
- package/templates/basic-app/esbuild.config.d.ts.map +1 -0
- package/templates/basic-app/postcss.config.d.ts +8 -0
- package/templates/basic-app/postcss.config.d.ts.map +1 -0
- package/templates/basic-app/server.d.ts +2 -0
- package/templates/basic-app/server.d.ts.map +1 -0
- package/templates/basic-app/src/App.d.ts +2 -0
- package/templates/basic-app/src/App.d.ts.map +1 -0
- package/templates/basic-app/src/App.js +148 -0
- package/templates/basic-app/src/App.tsx +397 -19
- package/templates/basic-app/src/client.d.ts +2 -0
- package/templates/basic-app/src/client.d.ts.map +1 -0
- package/templates/basic-app/src/client.js +6 -0
- package/templates/basic-app/src/components/Counter.d.ts +4 -0
- package/templates/basic-app/src/components/Counter.d.ts.map +1 -0
- package/templates/basic-app/src/components/Counter.js +9 -0
- package/templates/basic-app/src/jsx-shim.d.ts +8 -0
- package/templates/basic-app/src/jsx-shim.d.ts.map +1 -0
- package/templates/basic-app/src/main.d.ts +2 -0
- package/templates/basic-app/src/main.d.ts.map +1 -0
- package/templates/basic-app/src/main.js +57 -0
- package/templates/basic-app/src/server.d.ts +2 -0
- package/templates/basic-app/src/server.d.ts.map +1 -0
- package/templates/basic-app/tailwind.config.d.ts +9 -0
- package/templates/basic-app/tailwind.config.d.ts.map +1 -0
- package/templates/basic-app/vite.config.d.ts +3 -0
- package/templates/basic-app/vite.config.d.ts.map +1 -0
- package/templates/basic-app/vite.config.js +7 -0
- package/templates/complete-app/api/hello.d.ts +1 -0
- package/templates/complete-app/api/hello.d.ts.map +1 -0
- package/templates/complete-app/client.d.ts +2 -0
- package/templates/complete-app/client.d.ts.map +1 -0
- package/templates/complete-app/lib/frontend-hamroun.d.ts +18 -0
- package/templates/complete-app/lib/frontend-hamroun.d.ts.map +1 -0
- package/templates/complete-app/pages/about.d.ts +7 -0
- package/templates/complete-app/pages/about.d.ts.map +1 -0
- package/templates/complete-app/pages/index.d.ts +7 -0
- package/templates/complete-app/pages/index.d.ts.map +1 -0
- package/templates/complete-app/pages/wasm-demo.d.ts +7 -0
- package/templates/complete-app/pages/wasm-demo.d.ts.map +1 -0
- package/templates/complete-app/public/client.d.ts +17 -0
- package/templates/complete-app/public/client.d.ts.map +1 -0
- package/templates/complete-app/server.d.ts +2 -0
- package/templates/complete-app/server.d.ts.map +1 -0
- package/templates/complete-app/server.js +236 -218
- package/templates/complete-app/src/App.d.ts +2 -0
- package/templates/complete-app/src/App.d.ts.map +1 -0
- package/templates/complete-app/src/App.js +27 -0
- package/templates/complete-app/src/client.d.ts +2 -0
- package/templates/complete-app/src/client.d.ts.map +1 -0
- package/templates/complete-app/src/client.js +52 -0
- package/templates/complete-app/src/pages/index.d.ts +2 -0
- package/templates/complete-app/src/pages/index.d.ts.map +1 -0
- package/templates/complete-app/src/pages/index.js +19 -0
- package/templates/complete-app/src/server.d.ts +2 -0
- package/templates/complete-app/src/server.d.ts.map +1 -0
- package/templates/complete-app/src/server.js +192 -0
- package/templates/complete-app/vite.config.d.ts +3 -0
- package/templates/complete-app/vite.config.d.ts.map +1 -0
- package/templates/complete-app/vite.config.js +29 -57
- package/templates/fullstack-app/api/hello.d.ts +4 -0
- package/templates/fullstack-app/api/hello.d.ts.map +1 -0
- package/templates/fullstack-app/api/hello.js +14 -11
- package/templates/fullstack-app/api/users/[id].d.ts +5 -0
- package/templates/fullstack-app/api/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/api/users/[id].js +52 -0
- package/templates/fullstack-app/api/users/index.d.ts +4 -0
- package/templates/fullstack-app/api/users/index.d.ts.map +1 -0
- package/templates/fullstack-app/api/users/index.js +25 -0
- package/templates/fullstack-app/build/main.d.ts +211 -0
- package/templates/fullstack-app/build/main.d.ts.map +1 -0
- package/templates/fullstack-app/build.d.ts +2 -0
- package/templates/fullstack-app/build.d.ts.map +1 -0
- package/templates/fullstack-app/build.js +190 -0
- package/templates/fullstack-app/postcss.config.d.ts +5 -0
- package/templates/fullstack-app/postcss.config.d.ts.map +1 -0
- package/templates/fullstack-app/process-tailwind.d.ts +2 -0
- package/templates/fullstack-app/process-tailwind.d.ts.map +1 -0
- package/templates/fullstack-app/public/route-handler.d.ts +1 -0
- package/templates/fullstack-app/public/route-handler.d.ts.map +1 -0
- package/templates/fullstack-app/server.d.ts +2 -0
- package/templates/fullstack-app/server.d.ts.map +1 -0
- package/templates/fullstack-app/server.js +428 -266
- package/templates/fullstack-app/src/client.d.ts +2 -0
- package/templates/fullstack-app/src/client.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ClientHome.d.ts +1 -0
- package/templates/fullstack-app/src/components/ClientHome.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ClientHome.js +1 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.d.ts +7 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.js +12 -0
- package/templates/fullstack-app/src/components/Layout.d.ts +7 -0
- package/templates/fullstack-app/src/components/Layout.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/Layout.js +4 -0
- package/templates/fullstack-app/src/components/StateDemo.d.ts +2 -0
- package/templates/fullstack-app/src/components/StateDemo.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/StateDemo.js +86 -0
- package/templates/fullstack-app/src/components/UserList.d.ts +11 -0
- package/templates/fullstack-app/src/components/UserList.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/UserList.js +7 -0
- package/templates/fullstack-app/src/config.d.ts +29 -0
- package/templates/fullstack-app/src/config.d.ts.map +1 -0
- package/templates/fullstack-app/src/config.js +36 -0
- package/templates/fullstack-app/src/data/api.d.ts +35 -0
- package/templates/fullstack-app/src/data/api.d.ts.map +1 -0
- package/templates/fullstack-app/src/data/api.js +173 -0
- package/templates/fullstack-app/src/main.d.ts +7 -0
- package/templates/fullstack-app/src/main.d.ts.map +1 -0
- package/templates/fullstack-app/src/main.js +130 -0
- package/templates/fullstack-app/src/middleware.d.ts +10 -0
- package/templates/fullstack-app/src/middleware.d.ts.map +1 -0
- package/templates/fullstack-app/src/middleware.js +14 -0
- package/templates/fullstack-app/src/pages/404.d.ts +4 -0
- package/templates/fullstack-app/src/pages/404.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/404.js +4 -0
- package/templates/fullstack-app/src/pages/[id].d.ts +1 -0
- package/templates/fullstack-app/src/pages/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/[id].js +1 -0
- package/templates/fullstack-app/src/pages/_app.d.ts +6 -0
- package/templates/fullstack-app/src/pages/_app.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_app.js +6 -0
- package/templates/fullstack-app/src/pages/_document.d.ts +7 -0
- package/templates/fullstack-app/src/pages/_document.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_document.js +4 -0
- package/templates/fullstack-app/src/pages/_error.d.ts +4 -0
- package/templates/fullstack-app/src/pages/_error.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_error.js +8 -0
- package/templates/fullstack-app/src/pages/about/index.d.ts +5 -0
- package/templates/fullstack-app/src/pages/about/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/about/index.js +6 -0
- package/templates/fullstack-app/src/pages/about.d.ts +10 -0
- package/templates/fullstack-app/src/pages/about.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/about.js +21 -0
- package/templates/fullstack-app/src/pages/api/users/[id].d.ts +6 -0
- package/templates/fullstack-app/src/pages/api/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/api/users/[id].js +51 -0
- package/templates/fullstack-app/src/pages/api/users/index.d.ts +4 -0
- package/templates/fullstack-app/src/pages/api/users/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/api/users/index.js +33 -0
- package/templates/fullstack-app/src/pages/index.d.ts +21 -0
- package/templates/fullstack-app/src/pages/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/index.js +66 -0
- package/templates/fullstack-app/src/pages/users/[id].d.ts +38 -0
- package/templates/fullstack-app/src/pages/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/users/[id].js +79 -0
- package/templates/fullstack-app/src/pages/users.d.ts +14 -0
- package/templates/fullstack-app/src/pages/users.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/users.js +14 -0
- package/templates/fullstack-app/src/pages/wasm-demo.d.ts +1 -0
- package/templates/fullstack-app/src/pages/wasm-demo.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/wasm-demo.js +2 -0
- package/templates/fullstack-app/src/router.d.ts +22 -0
- package/templates/fullstack-app/src/router.d.ts.map +1 -0
- package/templates/fullstack-app/src/router.js +210 -0
- package/templates/fullstack-app/tailwind.config.d.ts +3 -0
- package/templates/fullstack-app/tailwind.config.d.ts.map +1 -0
- package/templates/fullstack-app/vite.config.d.ts +3 -0
- package/templates/fullstack-app/vite.config.d.ts.map +1 -0
- package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts +2 -0
- package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts.map +1 -0
- package/templates/ssr-template/dist/client.d.ts +85 -0
- package/templates/ssr-template/dist/client.d.ts.map +1 -0
- package/templates/ssr-template/dist/server.d.ts +2 -0
- package/templates/ssr-template/dist/server.d.ts.map +1 -0
- package/templates/ssr-template/esbuild.config.d.ts +2 -0
- package/templates/ssr-template/esbuild.config.d.ts.map +1 -0
- package/templates/ssr-template/jsx-shim.d.ts +2 -0
- package/templates/ssr-template/jsx-shim.d.ts.map +1 -0
- package/templates/ssr-template/src/App.d.ts +2 -0
- package/templates/ssr-template/src/App.d.ts.map +1 -0
- package/templates/ssr-template/src/App.js +625 -0
- package/templates/ssr-template/src/App.tsx +43 -18
- package/templates/ssr-template/src/client.d.ts +2 -0
- package/templates/ssr-template/src/client.d.ts.map +1 -0
- package/templates/ssr-template/src/client.js +3 -0
- package/templates/ssr-template/src/server.d.ts +2 -0
- package/templates/ssr-template/src/server.d.ts.map +1 -0
- package/templates/ssr-template/src/server.js +29 -0
- package/templates/ssr-template/vite.config.d.ts +3 -0
- package/templates/ssr-template/vite.config.d.ts.map +1 -0
- package/templates/ssr-template/vite.config.js +30 -0
- package/templates/wasm/build-wasm.d.ts +2 -0
- package/templates/wasm/build-wasm.d.ts.map +1 -0
- package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts +30 -0
- package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts.map +1 -0
- package/templates/wasm/dist/wasm_exec.d.ts +1 -0
- package/templates/wasm/dist/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/esbuild.config.d.ts +2 -0
- package/templates/wasm/esbuild.config.d.ts.map +1 -0
- package/templates/wasm/go/wasm_exec.d.ts +1 -0
- package/templates/wasm/go/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/jsx-shim.d.ts +5 -0
- package/templates/wasm/jsx-shim.d.ts.map +1 -0
- package/templates/wasm/public/wasm_exec.d.ts +1 -0
- package/templates/wasm/public/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/src/App.d.ts +2 -0
- package/templates/wasm/src/App.d.ts.map +1 -0
- package/templates/wasm/src/App.js +381 -0
- package/templates/wasm/src/client.d.ts +2 -0
- package/templates/wasm/src/client.d.ts.map +1 -0
- package/templates/wasm/src/client.js +210 -0
- package/templates/wasm/src/index.d.ts +2 -0
- package/templates/wasm/src/index.d.ts.map +1 -0
- package/templates/wasm/src/index.js +20 -0
- package/templates/wasm/src/server.d.ts +2 -0
- package/templates/wasm/src/server.d.ts.map +1 -0
- package/templates/wasm/src/server.js +131 -0
- package/templates/wasm/vite.config.d.ts +3 -0
- package/templates/wasm/vite.config.d.ts.map +1 -0
- package/templates/wasm/vite.config.js +36 -0
- package/templates/wasm/wasm-loader.d.ts +6 -0
- package/templates/wasm/wasm-loader.d.ts.map +1 -0
- package/dist/renderer-BL3gq8cW.cjs +0 -2
- package/dist/renderer-BL3gq8cW.cjs.map +0 -1
- package/dist/renderer-Dyy-o05F.js +0 -52
- package/dist/renderer-Dyy-o05F.js.map +0 -1
- package/dist/server-renderer-C1WXH-zV.js.map +0 -1
- package/dist/server-renderer-Chs-nmJm.cjs +0 -2
- package/dist/server-renderer-Chs-nmJm.cjs.map +0 -1
@@ -6,8 +6,33 @@ import {
|
|
6
6
|
useErrorBoundary
|
7
7
|
} from 'frontend-hamroun';
|
8
8
|
|
9
|
+
// Todo item interface
|
10
|
+
interface Todo {
|
11
|
+
id: number;
|
12
|
+
text: string;
|
13
|
+
completed: boolean;
|
14
|
+
priority: 'high' | 'medium' | 'low';
|
15
|
+
}
|
16
|
+
|
17
|
+
// Component prop interfaces
|
18
|
+
interface TodoItemProps {
|
19
|
+
todo: Todo;
|
20
|
+
onToggle: (id: number) => void;
|
21
|
+
onDelete: (id: number) => void;
|
22
|
+
}
|
23
|
+
|
24
|
+
interface ThemeToggleButtonProps {
|
25
|
+
theme: string;
|
26
|
+
onToggle: () => void;
|
27
|
+
}
|
28
|
+
|
29
|
+
interface AppFooterProps {
|
30
|
+
theme: string;
|
31
|
+
isBrowser: boolean;
|
32
|
+
}
|
33
|
+
|
9
34
|
// Todo Item Component - simple props-based component
|
10
|
-
function TodoItem({ todo, onToggle, onDelete }) {
|
35
|
+
function TodoItem({ todo, onToggle, onDelete }: TodoItemProps) {
|
11
36
|
return (
|
12
37
|
<div className={`todo-item ${todo.completed ? 'completed' : ''}`}>
|
13
38
|
<input
|
@@ -37,7 +62,7 @@ function TodoItem({ todo, onToggle, onDelete }) {
|
|
37
62
|
}
|
38
63
|
|
39
64
|
// Theme Toggle Button Component
|
40
|
-
function ThemeToggleButton({ theme, onToggle }) {
|
65
|
+
function ThemeToggleButton({ theme, onToggle }: ThemeToggleButtonProps) {
|
41
66
|
return (
|
42
67
|
<button
|
43
68
|
onClick={onToggle}
|
@@ -50,7 +75,7 @@ function ThemeToggleButton({ theme, onToggle }) {
|
|
50
75
|
}
|
51
76
|
|
52
77
|
// App Footer Component
|
53
|
-
function AppFooter({ theme, isBrowser }) {
|
78
|
+
function AppFooter({ theme, isBrowser }: AppFooterProps) {
|
54
79
|
return (
|
55
80
|
<footer className="app-footer">
|
56
81
|
<div className="container">
|
@@ -62,17 +87,17 @@ function AppFooter({ theme, isBrowser }) {
|
|
62
87
|
}
|
63
88
|
|
64
89
|
export function App() {
|
65
|
-
// State hooks
|
66
|
-
const [todos, setTodos] = useState([
|
90
|
+
// State hooks with proper typing
|
91
|
+
const [todos, setTodos] = useState<Todo[]>([
|
67
92
|
{ id: 1, text: 'Learn Frontend Hamroun hooks', completed: false, priority: 'high' },
|
68
93
|
{ id: 2, text: 'Build a todo app', completed: false, priority: 'medium' },
|
69
94
|
{ id: 3, text: 'Master SSR concepts', completed: true, priority: 'low' }
|
70
95
|
]);
|
71
|
-
const [newTask, setNewTask] = useState('');
|
72
|
-
const [taskFilter, setTaskFilter] = useState('all');
|
73
|
-
const [taskPriority, setTaskPriority] = useState('medium');
|
74
|
-
const [theme, setTheme] = useState('light');
|
75
|
-
const [isLoading, setIsLoading] = useState(false);
|
96
|
+
const [newTask, setNewTask] = useState<string>('');
|
97
|
+
const [taskFilter, setTaskFilter] = useState<string>('all');
|
98
|
+
const [taskPriority, setTaskPriority] = useState<'high' | 'medium' | 'low'>('medium');
|
99
|
+
const [theme, setTheme] = useState<string>('light');
|
100
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
76
101
|
|
77
102
|
// Error boundary hook
|
78
103
|
const [error, resetError] = useErrorBoundary();
|
@@ -147,22 +172,22 @@ export function App() {
|
|
147
172
|
}, [todos]);
|
148
173
|
|
149
174
|
// Todo action handlers
|
150
|
-
const handleToggleTodo = (id) => {
|
175
|
+
const handleToggleTodo = (id: number) => {
|
151
176
|
console.log('Toggling todo:', id);
|
152
177
|
setTodos(prev => prev.map(todo =>
|
153
178
|
todo.id === id ? { ...todo, completed: !todo.completed } : todo
|
154
179
|
));
|
155
180
|
};
|
156
181
|
|
157
|
-
const handleDeleteTodo = (id) => {
|
182
|
+
const handleDeleteTodo = (id: number) => {
|
158
183
|
console.log('Deleting todo:', id);
|
159
184
|
setTodos(prev => prev.filter(todo => todo.id !== id));
|
160
185
|
};
|
161
186
|
|
162
|
-
const handleAddTodo = (text, priority) => {
|
187
|
+
const handleAddTodo = (text: string, priority: 'high' | 'medium' | 'low') => {
|
163
188
|
if (!text || !text.trim()) return;
|
164
189
|
|
165
|
-
const newTodo = {
|
190
|
+
const newTodo: Todo = {
|
166
191
|
id: Date.now(),
|
167
192
|
text: text.trim(),
|
168
193
|
completed: false,
|
@@ -185,7 +210,7 @@ export function App() {
|
|
185
210
|
}
|
186
211
|
};
|
187
212
|
|
188
|
-
const handleKeyPress = (e) => {
|
213
|
+
const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
189
214
|
if (e.key === 'Enter') {
|
190
215
|
addTask();
|
191
216
|
}
|
@@ -211,7 +236,7 @@ export function App() {
|
|
211
236
|
return (
|
212
237
|
<div className="error-container">
|
213
238
|
<h2>Something went wrong!</h2>
|
214
|
-
<p>{error.message}</p>
|
239
|
+
<p>{(error as Error).message}</p>
|
215
240
|
<button onClick={resetError} className="btn btn-primary">
|
216
241
|
Try Again
|
217
242
|
</button>
|
@@ -267,7 +292,7 @@ export function App() {
|
|
267
292
|
|
268
293
|
<select
|
269
294
|
value={taskPriority}
|
270
|
-
onChange={(e) => setTaskPriority(e.target.value)}
|
295
|
+
onChange={(e) => setTaskPriority(e.target.value as 'high' | 'medium' | 'low')}
|
271
296
|
className="select priority-select"
|
272
297
|
disabled={isLoading}
|
273
298
|
>
|
@@ -291,7 +316,7 @@ export function App() {
|
|
291
316
|
<h2>🔍 Filter Todos</h2>
|
292
317
|
|
293
318
|
<div className="filters">
|
294
|
-
{['all', 'active', 'completed', 'high', 'medium', 'low'].map(filterType => (
|
319
|
+
{(['all', 'active', 'completed', 'high', 'medium', 'low'] as const).map(filterType => (
|
295
320
|
<button
|
296
321
|
key={filterType}
|
297
322
|
onClick={() => setTaskFilter(filterType)}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import express from 'express';
|
2
|
+
import path from 'path';
|
3
|
+
import { fileURLToPath } from 'url';
|
4
|
+
import { renderToString, jsx } from 'frontend-hamroun';
|
5
|
+
import { App } from './App.js';
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
7
|
+
const __dirname = path.dirname(__filename);
|
8
|
+
const app = express();
|
9
|
+
const port = 3000;
|
10
|
+
// Serve static files from dist directory
|
11
|
+
app.use(express.static(path.join(__dirname)));
|
12
|
+
app.get('/', async (req, res) => {
|
13
|
+
const html = await renderToString(jsx(App, {}));
|
14
|
+
res.send(`
|
15
|
+
<!DOCTYPE html>
|
16
|
+
<html>
|
17
|
+
<head>
|
18
|
+
<title>SSR App</title>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<div id="root">${html}</div>
|
22
|
+
<script type="module" src="/client.js"></script>
|
23
|
+
</body>
|
24
|
+
</html>
|
25
|
+
`);
|
26
|
+
});
|
27
|
+
app.listen(port, () => {
|
28
|
+
console.log(`Server running at http://localhost:${port}`);
|
29
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["vite.config.ts"],"names":[],"mappings":";AAGA,wBA4BG"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { defineConfig } from 'vite';
|
2
|
+
export default defineConfig({
|
3
|
+
esbuild: {
|
4
|
+
jsx: 'transform',
|
5
|
+
jsxFactory: 'jsx',
|
6
|
+
jsxFragment: 'Fragment',
|
7
|
+
jsxImportSource: 'frontend-hamroun',
|
8
|
+
},
|
9
|
+
ssr: {
|
10
|
+
noExternal: ['frontend-hamroun']
|
11
|
+
},
|
12
|
+
optimizeDeps: {
|
13
|
+
include: ['frontend-hamroun'],
|
14
|
+
exclude: []
|
15
|
+
},
|
16
|
+
build: {
|
17
|
+
target: 'esnext',
|
18
|
+
rollupOptions: {
|
19
|
+
output: {
|
20
|
+
format: 'es'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
},
|
24
|
+
resolve: {
|
25
|
+
alias: {
|
26
|
+
'frontend-hamroun/jsx-dev-runtime': 'frontend-hamroun',
|
27
|
+
'frontend-hamroun/jsx-runtime': 'frontend-hamroun'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"build-wasm.d.ts","sourceRoot":"","sources":["build-wasm.js"],"names":[],"mappings":""}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
declare function R(t: any): void;
|
2
|
+
declare function L(): number;
|
3
|
+
declare function _(): void;
|
4
|
+
declare function q(t: any, i: any, ...args: any[]): {
|
5
|
+
type: any;
|
6
|
+
props: any;
|
7
|
+
};
|
8
|
+
declare function h(t: any): any;
|
9
|
+
declare function N(t: any, i: any): Promise<void>;
|
10
|
+
declare function d(t: any): void;
|
11
|
+
declare function G(t: any, i: any): void;
|
12
|
+
declare function e(t: any, i: any, ...args: any[]): {
|
13
|
+
type: any;
|
14
|
+
props: any;
|
15
|
+
};
|
16
|
+
declare function j(t: any, ...i: any[]): any;
|
17
|
+
declare function J(): {
|
18
|
+
type: any;
|
19
|
+
props: any;
|
20
|
+
};
|
21
|
+
declare function k(): Promise<any>;
|
22
|
+
declare function Y(): Promise<void>;
|
23
|
+
declare let y: boolean;
|
24
|
+
declare const w: any[];
|
25
|
+
declare let m: number;
|
26
|
+
declare const z: Map<any, any>;
|
27
|
+
declare const T: boolean;
|
28
|
+
declare const H: Map<any, any>;
|
29
|
+
declare let O: boolean;
|
30
|
+
//# sourceMappingURL=index-BNqTDBdE.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index-BNqTDBdE.d.ts","sourceRoot":"","sources":["index-BNqTDBdE.js"],"names":[],"mappings":"AAA0tB,iCAA0G;AAAsD,6BAAqC;AAAA,2BAAgC;AAAA;;;EAA+K;AAAA,gCAAkwC;AAAS,kDAA2J;AAAA,iCAAyE;AAAA,yCAA4E;AAAA;;;EAA+K;AAAA,6CAAiP;AAAgD;;;EAwR/mG;AAAA,mCAAmF;AAAA,oCAclF;AAtS2rB,uBAAS;AAAA,uBAAW;AAA0G,sBAAQ;AAAM,+BAAS;AAAC,yBAAmB;AAAC,+BAAS;AAAu/C,uBAAS"}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=wasm_exec.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wasm_exec.d.ts","sourceRoot":"","sources":["wasm_exec.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"esbuild.config.d.ts","sourceRoot":"","sources":["esbuild.config.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=wasm_exec.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wasm_exec.d.ts","sourceRoot":"","sources":["wasm_exec.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jsx-shim.d.ts","sourceRoot":"","sources":["jsx-shim.js"],"names":[],"mappings":"oBACoC,kBAAkB;qBAAlB,kBAAkB;yBAAlB,kBAAkB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=wasm_exec.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wasm_exec.d.ts","sourceRoot":"","sources":["wasm_exec.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["App.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,GAAG,gBAkiB1B"}
|