frontend-hamroun 1.2.84 → 1.2.88

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.
Files changed (310) hide show
  1. package/dist/batch.d.ts +4 -0
  2. package/dist/batch.d.ts.map +1 -0
  3. package/dist/batch.js +22 -0
  4. package/dist/client-router.d.ts +61 -0
  5. package/dist/client-router.d.ts.map +1 -0
  6. package/dist/client-router.js +209 -0
  7. package/dist/component.d.ts +15 -0
  8. package/dist/component.d.ts.map +1 -0
  9. package/dist/component.js +84 -0
  10. package/dist/components/Counter.d.ts +1 -0
  11. package/dist/components/Counter.d.ts.map +1 -0
  12. package/dist/components/Counter.js +2 -0
  13. package/dist/context.d.ts +5 -0
  14. package/dist/context.d.ts.map +1 -0
  15. package/dist/context.js +23 -0
  16. package/dist/event-bus.d.ts +24 -0
  17. package/dist/event-bus.d.ts.map +1 -0
  18. package/dist/event-bus.js +74 -0
  19. package/dist/forms.d.ts +41 -0
  20. package/dist/forms.d.ts.map +1 -0
  21. package/dist/forms.js +147 -0
  22. package/dist/hooks.d.ts +12 -0
  23. package/dist/hooks.d.ts.map +1 -0
  24. package/dist/hooks.js +142 -0
  25. package/dist/index.cjs +1118 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.client.d.ts +13 -0
  28. package/dist/index.client.d.ts.map +1 -0
  29. package/dist/index.client.js +12 -25
  30. package/dist/index.d.ts +65 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +1040 -264
  33. package/dist/index.js.map +1 -1
  34. package/dist/jsx-dev-runtime.cjs +102 -0
  35. package/dist/jsx-dev-runtime.cjs.map +1 -0
  36. package/dist/jsx-dev-runtime.d.ts +3 -0
  37. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  38. package/dist/jsx-dev-runtime.js +96 -0
  39. package/dist/jsx-dev-runtime.js.map +1 -0
  40. package/dist/jsx-runtime/jsx-runtime.d.ts +5 -0
  41. package/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
  42. package/dist/jsx-runtime/jsx-runtime.js +40 -0
  43. package/dist/jsx-runtime.cjs +112 -1
  44. package/dist/jsx-runtime.cjs.map +1 -1
  45. package/dist/jsx-runtime.d.ts +18 -0
  46. package/dist/jsx-runtime.d.ts.map +1 -0
  47. package/dist/jsx-runtime.js +90 -79
  48. package/dist/jsx-runtime.js.map +1 -1
  49. package/dist/lifecycle-events.d.ts +109 -0
  50. package/dist/lifecycle-events.d.ts.map +1 -0
  51. package/dist/lifecycle-events.js +176 -0
  52. package/dist/renderComponent.d.ts +14 -0
  53. package/dist/renderComponent.d.ts.map +1 -0
  54. package/dist/renderComponent.js +29 -0
  55. package/dist/renderer.d.ts +4 -0
  56. package/dist/renderer.d.ts.map +1 -0
  57. package/dist/renderer.js +49 -0
  58. package/dist/router.d.ts +56 -0
  59. package/dist/router.d.ts.map +1 -0
  60. package/dist/router.js +165 -0
  61. package/dist/server-renderer.d.ts +2 -0
  62. package/dist/server-renderer.d.ts.map +1 -0
  63. package/dist/server-renderer.js +111 -5
  64. package/dist/server-types.d.ts +43 -0
  65. package/dist/server-types.d.ts.map +1 -0
  66. package/dist/server-types.js +5 -0
  67. package/dist/store.d.ts +42 -0
  68. package/dist/store.d.ts.map +1 -0
  69. package/dist/store.js +98 -0
  70. package/dist/types.d.ts +272 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +2 -0
  73. package/dist/utils.d.ts +47 -0
  74. package/dist/utils.d.ts.map +1 -0
  75. package/dist/utils.js +143 -0
  76. package/dist/vdom.d.ts +9 -0
  77. package/dist/vdom.d.ts.map +1 -0
  78. package/dist/vdom.js +21 -0
  79. package/dist/wasm.d.ts +37 -0
  80. package/dist/wasm.d.ts.map +1 -0
  81. package/dist/wasm.js +158 -0
  82. package/package.json +54 -83
  83. package/templates/basic-app/build.d.ts +2 -0
  84. package/templates/basic-app/build.d.ts.map +1 -0
  85. package/templates/basic-app/dev.d.ts +2 -0
  86. package/templates/basic-app/dev.d.ts.map +1 -0
  87. package/templates/basic-app/esbuild.config.d.ts +2 -0
  88. package/templates/basic-app/esbuild.config.d.ts.map +1 -0
  89. package/templates/basic-app/postcss.config.d.ts +8 -0
  90. package/templates/basic-app/postcss.config.d.ts.map +1 -0
  91. package/templates/basic-app/server.d.ts +2 -0
  92. package/templates/basic-app/server.d.ts.map +1 -0
  93. package/templates/basic-app/src/App.d.ts +2 -0
  94. package/templates/basic-app/src/App.d.ts.map +1 -0
  95. package/templates/basic-app/src/App.js +148 -0
  96. package/templates/basic-app/src/client.d.ts +2 -0
  97. package/templates/basic-app/src/client.d.ts.map +1 -0
  98. package/templates/basic-app/src/client.js +6 -0
  99. package/templates/basic-app/src/components/Counter.d.ts +4 -0
  100. package/templates/basic-app/src/components/Counter.d.ts.map +1 -0
  101. package/templates/basic-app/src/components/Counter.js +9 -0
  102. package/templates/basic-app/src/jsx-shim.d.ts +8 -0
  103. package/templates/basic-app/src/jsx-shim.d.ts.map +1 -0
  104. package/templates/basic-app/src/main.d.ts +2 -0
  105. package/templates/basic-app/src/main.d.ts.map +1 -0
  106. package/templates/basic-app/src/main.js +57 -0
  107. package/templates/basic-app/src/server.d.ts +2 -0
  108. package/templates/basic-app/src/server.d.ts.map +1 -0
  109. package/templates/basic-app/tailwind.config.d.ts +9 -0
  110. package/templates/basic-app/tailwind.config.d.ts.map +1 -0
  111. package/templates/basic-app/vite.config.d.ts +3 -0
  112. package/templates/basic-app/vite.config.d.ts.map +1 -0
  113. package/templates/basic-app/vite.config.js +7 -0
  114. package/templates/complete-app/api/hello.d.ts +1 -0
  115. package/templates/complete-app/api/hello.d.ts.map +1 -0
  116. package/templates/complete-app/client.d.ts +2 -0
  117. package/templates/complete-app/client.d.ts.map +1 -0
  118. package/templates/complete-app/lib/frontend-hamroun.d.ts +18 -0
  119. package/templates/complete-app/lib/frontend-hamroun.d.ts.map +1 -0
  120. package/templates/complete-app/pages/about.d.ts +7 -0
  121. package/templates/complete-app/pages/about.d.ts.map +1 -0
  122. package/templates/complete-app/pages/index.d.ts +7 -0
  123. package/templates/complete-app/pages/index.d.ts.map +1 -0
  124. package/templates/complete-app/pages/wasm-demo.d.ts +7 -0
  125. package/templates/complete-app/pages/wasm-demo.d.ts.map +1 -0
  126. package/templates/complete-app/public/client.d.ts +17 -0
  127. package/templates/complete-app/public/client.d.ts.map +1 -0
  128. package/templates/complete-app/server.d.ts +2 -0
  129. package/templates/complete-app/server.d.ts.map +1 -0
  130. package/templates/complete-app/server.js +236 -218
  131. package/templates/complete-app/src/App.d.ts +2 -0
  132. package/templates/complete-app/src/App.d.ts.map +1 -0
  133. package/templates/complete-app/src/App.js +27 -0
  134. package/templates/complete-app/src/client.d.ts +2 -0
  135. package/templates/complete-app/src/client.d.ts.map +1 -0
  136. package/templates/complete-app/src/client.js +52 -0
  137. package/templates/complete-app/src/pages/index.d.ts +2 -0
  138. package/templates/complete-app/src/pages/index.d.ts.map +1 -0
  139. package/templates/complete-app/src/pages/index.js +19 -0
  140. package/templates/complete-app/src/server.d.ts +2 -0
  141. package/templates/complete-app/src/server.d.ts.map +1 -0
  142. package/templates/complete-app/src/server.js +192 -0
  143. package/templates/complete-app/vite.config.d.ts +3 -0
  144. package/templates/complete-app/vite.config.d.ts.map +1 -0
  145. package/templates/complete-app/vite.config.js +29 -57
  146. package/templates/fullstack-app/api/hello.d.ts +4 -0
  147. package/templates/fullstack-app/api/hello.d.ts.map +1 -0
  148. package/templates/fullstack-app/api/hello.js +14 -11
  149. package/templates/fullstack-app/api/users/[id].d.ts +5 -0
  150. package/templates/fullstack-app/api/users/[id].d.ts.map +1 -0
  151. package/templates/fullstack-app/api/users/[id].js +52 -0
  152. package/templates/fullstack-app/api/users/index.d.ts +4 -0
  153. package/templates/fullstack-app/api/users/index.d.ts.map +1 -0
  154. package/templates/fullstack-app/api/users/index.js +25 -0
  155. package/templates/fullstack-app/build/main.d.ts +211 -0
  156. package/templates/fullstack-app/build/main.d.ts.map +1 -0
  157. package/templates/fullstack-app/build.d.ts +2 -0
  158. package/templates/fullstack-app/build.d.ts.map +1 -0
  159. package/templates/fullstack-app/build.js +190 -0
  160. package/templates/fullstack-app/postcss.config.d.ts +5 -0
  161. package/templates/fullstack-app/postcss.config.d.ts.map +1 -0
  162. package/templates/fullstack-app/process-tailwind.d.ts +2 -0
  163. package/templates/fullstack-app/process-tailwind.d.ts.map +1 -0
  164. package/templates/fullstack-app/public/route-handler.d.ts +1 -0
  165. package/templates/fullstack-app/public/route-handler.d.ts.map +1 -0
  166. package/templates/fullstack-app/server.d.ts +2 -0
  167. package/templates/fullstack-app/server.d.ts.map +1 -0
  168. package/templates/fullstack-app/server.js +428 -266
  169. package/templates/fullstack-app/src/client.d.ts +2 -0
  170. package/templates/fullstack-app/src/client.d.ts.map +1 -0
  171. package/templates/fullstack-app/src/components/ClientHome.d.ts +1 -0
  172. package/templates/fullstack-app/src/components/ClientHome.d.ts.map +1 -0
  173. package/templates/fullstack-app/src/components/ClientHome.js +1 -0
  174. package/templates/fullstack-app/src/components/ErrorBoundary.d.ts +7 -0
  175. package/templates/fullstack-app/src/components/ErrorBoundary.d.ts.map +1 -0
  176. package/templates/fullstack-app/src/components/ErrorBoundary.js +12 -0
  177. package/templates/fullstack-app/src/components/Layout.d.ts +7 -0
  178. package/templates/fullstack-app/src/components/Layout.d.ts.map +1 -0
  179. package/templates/fullstack-app/src/components/Layout.js +4 -0
  180. package/templates/fullstack-app/src/components/StateDemo.d.ts +2 -0
  181. package/templates/fullstack-app/src/components/StateDemo.d.ts.map +1 -0
  182. package/templates/fullstack-app/src/components/StateDemo.js +86 -0
  183. package/templates/fullstack-app/src/components/UserList.d.ts +11 -0
  184. package/templates/fullstack-app/src/components/UserList.d.ts.map +1 -0
  185. package/templates/fullstack-app/src/components/UserList.js +7 -0
  186. package/templates/fullstack-app/src/config.d.ts +29 -0
  187. package/templates/fullstack-app/src/config.d.ts.map +1 -0
  188. package/templates/fullstack-app/src/config.js +36 -0
  189. package/templates/fullstack-app/src/data/api.d.ts +35 -0
  190. package/templates/fullstack-app/src/data/api.d.ts.map +1 -0
  191. package/templates/fullstack-app/src/data/api.js +173 -0
  192. package/templates/fullstack-app/src/main.d.ts +7 -0
  193. package/templates/fullstack-app/src/main.d.ts.map +1 -0
  194. package/templates/fullstack-app/src/main.js +130 -0
  195. package/templates/fullstack-app/src/middleware.d.ts +10 -0
  196. package/templates/fullstack-app/src/middleware.d.ts.map +1 -0
  197. package/templates/fullstack-app/src/middleware.js +14 -0
  198. package/templates/fullstack-app/src/pages/404.d.ts +4 -0
  199. package/templates/fullstack-app/src/pages/404.d.ts.map +1 -0
  200. package/templates/fullstack-app/src/pages/404.js +4 -0
  201. package/templates/fullstack-app/src/pages/[id].d.ts +1 -0
  202. package/templates/fullstack-app/src/pages/[id].d.ts.map +1 -0
  203. package/templates/fullstack-app/src/pages/[id].js +1 -0
  204. package/templates/fullstack-app/src/pages/_app.d.ts +6 -0
  205. package/templates/fullstack-app/src/pages/_app.d.ts.map +1 -0
  206. package/templates/fullstack-app/src/pages/_app.js +6 -0
  207. package/templates/fullstack-app/src/pages/_document.d.ts +7 -0
  208. package/templates/fullstack-app/src/pages/_document.d.ts.map +1 -0
  209. package/templates/fullstack-app/src/pages/_document.js +4 -0
  210. package/templates/fullstack-app/src/pages/_error.d.ts +4 -0
  211. package/templates/fullstack-app/src/pages/_error.d.ts.map +1 -0
  212. package/templates/fullstack-app/src/pages/_error.js +8 -0
  213. package/templates/fullstack-app/src/pages/about/index.d.ts +5 -0
  214. package/templates/fullstack-app/src/pages/about/index.d.ts.map +1 -0
  215. package/templates/fullstack-app/src/pages/about/index.js +6 -0
  216. package/templates/fullstack-app/src/pages/about.d.ts +10 -0
  217. package/templates/fullstack-app/src/pages/about.d.ts.map +1 -0
  218. package/templates/fullstack-app/src/pages/about.js +21 -0
  219. package/templates/fullstack-app/src/pages/api/users/[id].d.ts +6 -0
  220. package/templates/fullstack-app/src/pages/api/users/[id].d.ts.map +1 -0
  221. package/templates/fullstack-app/src/pages/api/users/[id].js +51 -0
  222. package/templates/fullstack-app/src/pages/api/users/index.d.ts +4 -0
  223. package/templates/fullstack-app/src/pages/api/users/index.d.ts.map +1 -0
  224. package/templates/fullstack-app/src/pages/api/users/index.js +33 -0
  225. package/templates/fullstack-app/src/pages/index.d.ts +21 -0
  226. package/templates/fullstack-app/src/pages/index.d.ts.map +1 -0
  227. package/templates/fullstack-app/src/pages/index.js +66 -0
  228. package/templates/fullstack-app/src/pages/users/[id].d.ts +38 -0
  229. package/templates/fullstack-app/src/pages/users/[id].d.ts.map +1 -0
  230. package/templates/fullstack-app/src/pages/users/[id].js +79 -0
  231. package/templates/fullstack-app/src/pages/users.d.ts +14 -0
  232. package/templates/fullstack-app/src/pages/users.d.ts.map +1 -0
  233. package/templates/fullstack-app/src/pages/users.js +14 -0
  234. package/templates/fullstack-app/src/pages/wasm-demo.d.ts +1 -0
  235. package/templates/fullstack-app/src/pages/wasm-demo.d.ts.map +1 -0
  236. package/templates/fullstack-app/src/pages/wasm-demo.js +2 -0
  237. package/templates/fullstack-app/src/router.d.ts +22 -0
  238. package/templates/fullstack-app/src/router.d.ts.map +1 -0
  239. package/templates/fullstack-app/src/router.js +210 -0
  240. package/templates/fullstack-app/tailwind.config.d.ts +3 -0
  241. package/templates/fullstack-app/tailwind.config.d.ts.map +1 -0
  242. package/templates/fullstack-app/vite.config.d.ts +3 -0
  243. package/templates/fullstack-app/vite.config.d.ts.map +1 -0
  244. package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts +2 -0
  245. package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts.map +1 -0
  246. package/templates/ssr-template/dist/client.d.ts +85 -0
  247. package/templates/ssr-template/dist/client.d.ts.map +1 -0
  248. package/templates/ssr-template/dist/server.d.ts +2 -0
  249. package/templates/ssr-template/dist/server.d.ts.map +1 -0
  250. package/templates/ssr-template/esbuild.config.d.ts +2 -0
  251. package/templates/ssr-template/esbuild.config.d.ts.map +1 -0
  252. package/templates/ssr-template/jsx-shim.d.ts +2 -0
  253. package/templates/ssr-template/jsx-shim.d.ts.map +1 -0
  254. package/templates/ssr-template/src/App.d.ts +2 -0
  255. package/templates/ssr-template/src/App.d.ts.map +1 -0
  256. package/templates/ssr-template/src/App.js +625 -0
  257. package/templates/ssr-template/src/client.d.ts +2 -0
  258. package/templates/ssr-template/src/client.d.ts.map +1 -0
  259. package/templates/ssr-template/src/client.js +3 -0
  260. package/templates/ssr-template/src/server.d.ts +2 -0
  261. package/templates/ssr-template/src/server.d.ts.map +1 -0
  262. package/templates/ssr-template/src/server.js +29 -0
  263. package/templates/ssr-template/vite.config.d.ts +3 -0
  264. package/templates/ssr-template/vite.config.d.ts.map +1 -0
  265. package/templates/ssr-template/vite.config.js +30 -0
  266. package/templates/wasm/build-wasm.d.ts +2 -0
  267. package/templates/wasm/build-wasm.d.ts.map +1 -0
  268. package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts +30 -0
  269. package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts.map +1 -0
  270. package/templates/wasm/dist/wasm_exec.d.ts +1 -0
  271. package/templates/wasm/dist/wasm_exec.d.ts.map +1 -0
  272. package/templates/wasm/esbuild.config.d.ts +2 -0
  273. package/templates/wasm/esbuild.config.d.ts.map +1 -0
  274. package/templates/wasm/go/wasm_exec.d.ts +1 -0
  275. package/templates/wasm/go/wasm_exec.d.ts.map +1 -0
  276. package/templates/wasm/jsx-shim.d.ts +5 -0
  277. package/templates/wasm/jsx-shim.d.ts.map +1 -0
  278. package/templates/wasm/public/wasm_exec.d.ts +1 -0
  279. package/templates/wasm/public/wasm_exec.d.ts.map +1 -0
  280. package/templates/wasm/src/App.d.ts +2 -0
  281. package/templates/wasm/src/App.d.ts.map +1 -0
  282. package/templates/wasm/src/App.js +381 -0
  283. package/templates/wasm/src/client.d.ts +2 -0
  284. package/templates/wasm/src/client.d.ts.map +1 -0
  285. package/templates/wasm/src/client.js +210 -0
  286. package/templates/wasm/src/index.d.ts +2 -0
  287. package/templates/wasm/src/index.d.ts.map +1 -0
  288. package/templates/wasm/src/index.js +20 -0
  289. package/templates/wasm/src/server.d.ts +2 -0
  290. package/templates/wasm/src/server.d.ts.map +1 -0
  291. package/templates/wasm/src/server.js +131 -0
  292. package/templates/wasm/vite.config.d.ts +3 -0
  293. package/templates/wasm/vite.config.d.ts.map +1 -0
  294. package/templates/wasm/vite.config.js +36 -0
  295. package/templates/wasm/wasm-loader.d.ts +6 -0
  296. package/templates/wasm/wasm-loader.d.ts.map +1 -0
  297. package/dist/index.client.cjs +0 -2
  298. package/dist/index.client.cjs.map +0 -1
  299. package/dist/index.client.js.map +0 -1
  300. package/dist/renderer-DaVfBeVi.cjs +0 -2
  301. package/dist/renderer-DaVfBeVi.cjs.map +0 -1
  302. package/dist/renderer-nfT7XSpo.js +0 -61
  303. package/dist/renderer-nfT7XSpo.js.map +0 -1
  304. package/dist/server-renderer-B5b0Q0ck.cjs +0 -2
  305. package/dist/server-renderer-B5b0Q0ck.cjs.map +0 -1
  306. package/dist/server-renderer-C4MB-jAp.js +0 -248
  307. package/dist/server-renderer-C4MB-jAp.js.map +0 -1
  308. package/dist/server-renderer.cjs +0 -2
  309. package/dist/server-renderer.cjs.map +0 -1
  310. package/dist/server-renderer.js.map +0 -1
@@ -0,0 +1,190 @@
1
+ import * as esbuild from 'esbuild';
2
+ import path from 'path';
3
+ import fs from 'fs/promises';
4
+ import { fileURLToPath } from 'url';
5
+ import { existsSync } from 'fs';
6
+ import postcss from 'postcss';
7
+ import tailwindcss from 'tailwindcss';
8
+ import autoprefixer from 'autoprefixer';
9
+ // Get __dirname equivalent in ESM
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ // Build configuration
13
+ const clientEntry = path.join(__dirname, 'src', 'main.tsx');
14
+ const serverEntry = path.join(__dirname, 'server.ts');
15
+ const outdir = path.join(__dirname, 'dist');
16
+ // Ensure output directory exists
17
+ if (!existsSync(outdir)) {
18
+ await fs.mkdir(outdir, { recursive: true });
19
+ }
20
+ // CSS processing plugin for esbuild
21
+ const cssPlugin = {
22
+ name: 'css-processor',
23
+ setup(build) {
24
+ // Handle CSS files
25
+ build.onLoad({ filter: /\.css$/ }, async (args) => {
26
+ // Read the CSS file
27
+ const css = await fs.readFile(args.path, 'utf8');
28
+ // Process with PostCSS (Tailwind + Autoprefixer)
29
+ try {
30
+ const result = await postcss([
31
+ tailwindcss,
32
+ autoprefixer
33
+ ]).process(css, {
34
+ from: args.path,
35
+ to: path.join(outdir, 'build', 'styles.css')
36
+ });
37
+ // Return processed CSS
38
+ return {
39
+ contents: result.css,
40
+ loader: 'css'
41
+ };
42
+ }
43
+ catch (error) {
44
+ console.error('Error processing CSS:', error);
45
+ return {
46
+ errors: [{ text: 'Error processing CSS with PostCSS: ' + error.message }],
47
+ loader: 'css'
48
+ };
49
+ }
50
+ });
51
+ }
52
+ };
53
+ // Copy static files
54
+ async function copyPublicFiles() {
55
+ const publicDir = path.join(__dirname, 'public');
56
+ const publicOutDir = path.join(outdir, 'public');
57
+ if (existsSync(publicDir)) {
58
+ if (!existsSync(publicOutDir)) {
59
+ await fs.mkdir(publicOutDir, { recursive: true });
60
+ }
61
+ // Read all files in public directory
62
+ const files = await fs.readdir(publicDir, { withFileTypes: true });
63
+ // Copy each file
64
+ for (const file of files) {
65
+ const srcPath = path.join(publicDir, file.name);
66
+ const destPath = path.join(publicOutDir, file.name);
67
+ if (file.isDirectory()) {
68
+ // Copy directory recursively
69
+ await fs.cp(srcPath, destPath, { recursive: true });
70
+ }
71
+ else {
72
+ // Copy file
73
+ await fs.copyFile(srcPath, destPath);
74
+ }
75
+ }
76
+ console.log('✓ Public files copied to dist/public');
77
+ }
78
+ // Copy index.html
79
+ const indexPath = path.join(__dirname, 'index.html');
80
+ if (existsSync(indexPath)) {
81
+ await fs.copyFile(indexPath, path.join(outdir, 'index.html'));
82
+ console.log('✓ index.html copied to dist');
83
+ }
84
+ }
85
+ // Build client-side code
86
+ async function buildClient() {
87
+ console.log('Building client...');
88
+ try {
89
+ await esbuild.build({
90
+ entryPoints: [clientEntry],
91
+ bundle: true,
92
+ minify: true,
93
+ format: 'esm',
94
+ outfile: path.join(outdir, 'build', 'main.js'),
95
+ jsx: 'automatic',
96
+ jsxFactory: 'jsx',
97
+ jsxFragment: 'Fragment',
98
+ plugins: [
99
+ {
100
+ name: 'jsx-runtime-import',
101
+ setup(build) {
102
+ build.onLoad({ filter: /\.(tsx|jsx)$/ }, async (args) => {
103
+ const source = await fs.readFile(args.path, 'utf8');
104
+ const content = `import { jsx, Fragment } from 'frontend-hamroun';\n${source}`;
105
+ return { contents: content, loader: args.path.endsWith('tsx') ? 'tsx' : 'jsx' };
106
+ });
107
+ }
108
+ }
109
+ ],
110
+ loader: {
111
+ '.tsx': 'tsx',
112
+ '.ts': 'ts',
113
+ '.jsx': 'jsx',
114
+ '.js': 'js',
115
+ '.css': 'css',
116
+ '.json': 'json',
117
+ '.png': 'file',
118
+ '.jpg': 'file',
119
+ '.svg': 'file'
120
+ },
121
+ define: {
122
+ 'process.env.NODE_ENV': '"production"'
123
+ },
124
+ sourcemap: false,
125
+ metafile: true
126
+ });
127
+ console.log('✓ Client build complete');
128
+ }
129
+ catch (error) {
130
+ console.error('Client build failed:', error);
131
+ process.exit(1);
132
+ }
133
+ }
134
+ // Build server-side code
135
+ async function buildServer() {
136
+ console.log('Building server...');
137
+ try {
138
+ await esbuild.build({
139
+ entryPoints: [serverEntry],
140
+ bundle: true,
141
+ platform: 'node',
142
+ target: ['node16'],
143
+ outfile: path.join(outdir, 'server.js'),
144
+ format: 'esm',
145
+ jsx: 'automatic',
146
+ jsxFactory: 'jsx',
147
+ jsxFragment: 'Fragment',
148
+ plugins: [{
149
+ name: 'external-modules',
150
+ setup(build) {
151
+ // Mark node_modules as external to reduce bundle size
152
+ build.onResolve({ filter: /^[^./]/ }, args => {
153
+ return { external: true };
154
+ });
155
+ }
156
+ }],
157
+ define: {
158
+ 'process.env.NODE_ENV': '"production"'
159
+ },
160
+ sourcemap: false
161
+ });
162
+ console.log('✓ Server build complete');
163
+ }
164
+ catch (error) {
165
+ console.error('Server build failed:', error);
166
+ process.exit(1);
167
+ }
168
+ }
169
+ // Run the build process
170
+ async function build() {
171
+ console.log('🔨 Starting production build...');
172
+ // Create build directory for client assets
173
+ const buildDir = path.join(outdir, 'build');
174
+ if (!existsSync(buildDir)) {
175
+ await fs.mkdir(buildDir, { recursive: true });
176
+ }
177
+ // Run build steps in parallel
178
+ await Promise.all([
179
+ copyPublicFiles(),
180
+ buildClient(),
181
+ buildServer()
182
+ ]);
183
+ console.log('✅ Production build complete!');
184
+ console.log(`Run 'npm run serve' to start the production server.`);
185
+ }
186
+ // Execute the build
187
+ build().catch(error => {
188
+ console.error('Build failed:', error);
189
+ process.exit(1);
190
+ });
@@ -0,0 +1,5 @@
1
+ export namespace plugins {
2
+ let tailwindcss: {};
3
+ let autoprefixer: {};
4
+ }
5
+ //# sourceMappingURL=postcss.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postcss.config.d.ts","sourceRoot":"","sources":["postcss.config.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=process-tailwind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-tailwind.d.ts","sourceRoot":"","sources":["process-tailwind.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=route-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-handler.d.ts","sourceRoot":"","sources":["route-handler.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":""}