frontend-hamroun 1.2.70 → 1.2.72

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.
@@ -3,24 +3,21 @@
3
3
  "version": "1.0.0",
4
4
  "description": "WebAssembly integration with Go for Frontend Hamroun with SSR",
5
5
  "type": "module",
6
- "main": "index.js",
6
+ "main": "server.js",
7
7
  "scripts": {
8
8
  "build:wasm": "node build-wasm.js",
9
- "dev": "npm run build:wasm && concurrently \"node --watch server.js\" \"vite\"",
10
- "build": "npm run build:wasm && vite build && tsc -p tsconfig.server.json",
11
- "serve": "NODE_ENV=production node server.js",
12
- "start": "npm run build && npm run serve",
13
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "prepare": "node -e \"if (!require('fs').existsSync('public/wasm')) { require('fs').mkdirSync('public/wasm', {recursive: true}); }\"",
10
+ "dev": "npm run build:wasm && node --watch server.js",
11
+ "build": "npm run build:wasm && node -e \"require('fs').mkdirSync('dist', {recursive: true}); require('fs-extra').copySync('public', 'dist')\"",
12
+ "start": "cross-env NODE_ENV=production node server.js"
14
13
  },
15
14
  "dependencies": {
16
15
  "express": "^4.18.2",
17
- "frontend-hamroun": "^1.2.69"
16
+ "frontend-hamroun": "^1.2.71",
17
+ "fs-extra": "^10.0.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/express": "^4.17.18",
21
- "@types/node": "^18.16.19",
22
- "concurrently": "^8.2.1",
23
- "typescript": "^5.0.0",
24
- "vite": "^4.4.9"
20
+ "@babel/core": "^7.22.9",
21
+ "cross-env": "^7.0.3"
25
22
  }
26
23
  }
@@ -4,10 +4,125 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Frontend Hamroun + Go WebAssembly</title>
7
- <link rel="stylesheet" href="/styles.css">
7
+ <style>
8
+ :root {
9
+ --primary-color: #0070f3;
10
+ --secondary-color: #0051cc;
11
+ --background: #f9f9f9;
12
+ --text-color: #333;
13
+ --card-background: #fff;
14
+ --border-color: #eaeaea;
15
+ --error-color: #f44336;
16
+ --success-color: #4caf50;
17
+ }
18
+
19
+ * {
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ body {
24
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
25
+ max-width: 800px;
26
+ margin: 0 auto;
27
+ padding: 2rem;
28
+ line-height: 1.6;
29
+ color: #333;
30
+ }
31
+
32
+ .app {
33
+ max-width: 900px;
34
+ margin: 0 auto;
35
+ padding: 20px;
36
+ }
37
+
38
+ header {
39
+ text-align: center;
40
+ margin-bottom: 2rem;
41
+ }
42
+
43
+ header h1 {
44
+ margin-bottom: 0.5rem;
45
+ color: var(--primary-color);
46
+ }
47
+
48
+ header p {
49
+ color: #666;
50
+ }
51
+
52
+ .card {
53
+ background-color: var(--card-background);
54
+ border: 1px solid var(--border-color);
55
+ border-radius: 8px;
56
+ padding: 1.5rem;
57
+ margin-bottom: 2rem;
58
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
59
+ }
60
+
61
+ pre {
62
+ background-color: #f5f5f5;
63
+ padding: 1rem;
64
+ border-radius: 4px;
65
+ overflow-x: auto;
66
+ }
67
+
68
+ footer {
69
+ margin-top: 3rem;
70
+ text-align: center;
71
+ color: #666;
72
+ padding: 1rem 0;
73
+ border-top: 1px solid var(--border-color);
74
+ }
75
+
76
+ .warning {
77
+ display: none;
78
+ background-color: #fff3cd;
79
+ border: 1px solid #ffecb5;
80
+ color: #856404;
81
+ padding: 1rem;
82
+ border-radius: 4px;
83
+ margin-bottom: 1rem;
84
+ }
85
+
86
+ code {
87
+ background-color: #f5f5f5;
88
+ padding: 0.2rem 0.4rem;
89
+ border-radius: 3px;
90
+ }
91
+
92
+ .loading {
93
+ text-align: center;
94
+ padding: 3rem 1rem;
95
+ color: #666;
96
+ }
97
+ </style>
98
+ <script src="/wasm/wasm_exec.js" defer></script>
8
99
  </head>
9
100
  <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.jsx"></script>
101
+ <div id="root">
102
+ <!-- Server-rendered content will be inserted here -->
103
+ <div class="loading">
104
+ <h2>Loading...</h2>
105
+ <p>Please wait while the server starts.</p>
106
+ <p>If this message persists, there might be an issue with the server.</p>
107
+ </div>
108
+ </div>
109
+ <script type="module" src="/src/client.js"></script>
110
+ <script>
111
+ // The server should replace this entire page with server-rendered content
112
+ // If you're seeing this, something is wrong with the server-side rendering
113
+ setTimeout(() => {
114
+ if (document.querySelector('.loading')) {
115
+ document.querySelector('#root').innerHTML = `
116
+ <div class="warning" style="display:block; background-color: #fff3cd; border: 1px solid #ffecb5; color: #856404; padding: 1rem; border-radius: 4px; margin-bottom: 1rem;">
117
+ <h2>Server Not Responding</h2>
118
+ <p>The server is not responding with the expected server-rendered content.</p>
119
+ <p>Please make sure the server is running properly with:</p>
120
+ <code>npm run dev</code>
121
+ <p>This static HTML file should be replaced by server-rendered content.</p>
122
+ </div>
123
+ `;
124
+ }
125
+ }, 2000);
126
+ </script>
12
127
  </body>
13
128
  </html>