bertui 1.2.9 → 2.0.0

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 (183) hide show
  1. package/README.md +44 -242
  2. package/TYPES_PATCH.md +17 -0
  3. package/bin/bertui.js +2 -7
  4. package/package.json +32 -98
  5. package/src/config.ts +4 -0
  6. package/src/index.ts +32 -0
  7. package/src/optional.ts +49 -0
  8. package/src/router.ts +3 -0
  9. package/tsconfig.json +29 -0
  10. package/LICENSE +0 -21
  11. package/index.js +0 -103
  12. package/src/analyzer/index.js +0 -370
  13. package/src/build/compiler/file-transpiler.js +0 -216
  14. package/src/build/compiler/index.js +0 -31
  15. package/src/build/compiler/route-discoverer.js +0 -49
  16. package/src/build/compiler/router-generator.js +0 -105
  17. package/src/build/css-builder.js +0 -81
  18. package/src/build/generators/html-generator.js +0 -263
  19. package/src/build/generators/robots-generator.js +0 -58
  20. package/src/build/generators/sitemap-generator.js +0 -63
  21. package/src/build/image-optimizer.js +0 -137
  22. package/src/build/processors/asset-processor.js +0 -19
  23. package/src/build/processors/css-builder.js +0 -142
  24. package/src/build/server-island-validator.js +0 -67
  25. package/src/build/ssr-renderer.js +0 -64
  26. package/src/build.js +0 -273
  27. package/src/cli.js +0 -131
  28. package/src/client/compiler.js +0 -522
  29. package/src/client/fast-refresh.js +0 -72
  30. package/src/client/hmr-runtime.js +0 -59
  31. package/src/compiler/index.js +0 -25
  32. package/src/compiler/router-generator-pure.js +0 -104
  33. package/src/compiler/transform.js +0 -149
  34. package/src/config/defaultConfig.js +0 -37
  35. package/src/config/index.js +0 -2
  36. package/src/config/loadConfig.js +0 -64
  37. package/src/config/og-image.png +0 -0
  38. package/src/css/index.js +0 -46
  39. package/src/css/processor.js +0 -172
  40. package/src/dev.js +0 -68
  41. package/src/hydration/index.js +0 -151
  42. package/src/image-optimizer/index.js +0 -103
  43. package/src/images/index.js +0 -102
  44. package/src/images/processor.js +0 -169
  45. package/src/layouts/index.js +0 -165
  46. package/src/loading/index.js +0 -210
  47. package/src/logger/logger.js +0 -320
  48. package/src/logger/notes.md +0 -20
  49. package/src/middleware/index.js +0 -182
  50. package/src/router/Router.js +0 -150
  51. package/src/router/SSRRouter.js +0 -156
  52. package/src/router/index.js +0 -3
  53. package/src/scaffolder/index.js +0 -310
  54. package/src/serve.js +0 -193
  55. package/src/server/dev-handler.js +0 -195
  56. package/src/server/dev-server-utils.js +0 -406
  57. package/src/server/dev-server.js +0 -15
  58. package/src/server/hmr-handler.js +0 -148
  59. package/src/server/index.js +0 -3
  60. package/src/server/notes.md +0 -1
  61. package/src/server/request-handler.js +0 -36
  62. package/src/server-islands/extractor.js +0 -198
  63. package/src/server-islands/index.js +0 -59
  64. package/src/styles/bertui.css +0 -210
  65. package/src/utils/cache.js +0 -297
  66. package/src/utils/env.js +0 -87
  67. package/src/utils/importhow.js +0 -52
  68. package/src/utils/index.js +0 -11
  69. package/src/utils/meta-extractor.js +0 -127
  70. package/types/bin/bertui.d.ts +0 -3
  71. package/types/bin/bertui.d.ts.map +0 -1
  72. package/types/error-overlay.d.ts +0 -2
  73. package/types/error-overlay.d.ts.map +0 -1
  74. package/types/index.d.ts +0 -26
  75. package/types/index.d.ts.map +0 -1
  76. package/types/scripts/fix-wasm-exports.d.ts +0 -2
  77. package/types/scripts/fix-wasm-exports.d.ts.map +0 -1
  78. package/types/src/analyzer/index.d.ts +0 -8
  79. package/types/src/analyzer/index.d.ts.map +0 -1
  80. package/types/src/build/compiler/file-transpiler.d.ts +0 -5
  81. package/types/src/build/compiler/file-transpiler.d.ts.map +0 -1
  82. package/types/src/build/compiler/index.d.ts +0 -12
  83. package/types/src/build/compiler/index.d.ts.map +0 -1
  84. package/types/src/build/compiler/route-discoverer.d.ts +0 -2
  85. package/types/src/build/compiler/route-discoverer.d.ts.map +0 -1
  86. package/types/src/build/compiler/router-generator.d.ts +0 -2
  87. package/types/src/build/compiler/router-generator.d.ts.map +0 -1
  88. package/types/src/build/css-builder.d.ts +0 -18
  89. package/types/src/build/css-builder.d.ts.map +0 -1
  90. package/types/src/build/generators/html-generator.d.ts +0 -2
  91. package/types/src/build/generators/html-generator.d.ts.map +0 -1
  92. package/types/src/build/generators/robots-generator.d.ts +0 -11
  93. package/types/src/build/generators/robots-generator.d.ts.map +0 -1
  94. package/types/src/build/generators/sitemap-generator.d.ts +0 -5
  95. package/types/src/build/generators/sitemap-generator.d.ts.map +0 -1
  96. package/types/src/build/image-optimizer.d.ts +0 -11
  97. package/types/src/build/image-optimizer.d.ts.map +0 -1
  98. package/types/src/build/processors/asset-processor.d.ts +0 -2
  99. package/types/src/build/processors/asset-processor.d.ts.map +0 -1
  100. package/types/src/build/processors/css-builder.d.ts +0 -2
  101. package/types/src/build/processors/css-builder.d.ts.map +0 -1
  102. package/types/src/build/server-island-validator.d.ts +0 -27
  103. package/types/src/build/server-island-validator.d.ts.map +0 -1
  104. package/types/src/build.d.ts +0 -5
  105. package/types/src/build.d.ts.map +0 -1
  106. package/types/src/cli.d.ts +0 -2
  107. package/types/src/cli.d.ts.map +0 -1
  108. package/types/src/client/compiler.d.ts +0 -16
  109. package/types/src/client/compiler.d.ts.map +0 -1
  110. package/types/src/client/fast-refresh.d.ts +0 -3
  111. package/types/src/client/fast-refresh.d.ts.map +0 -1
  112. package/types/src/client/hmr-runtime.d.ts +0 -4
  113. package/types/src/client/hmr-runtime.d.ts.map +0 -1
  114. package/types/src/compiler/index.d.ts +0 -8
  115. package/types/src/compiler/index.d.ts.map +0 -1
  116. package/types/src/compiler/router-generator-pure.d.ts +0 -2
  117. package/types/src/compiler/router-generator-pure.d.ts.map +0 -1
  118. package/types/src/compiler/transform.d.ts +0 -36
  119. package/types/src/compiler/transform.d.ts.map +0 -1
  120. package/types/src/config/defaultConfig.d.ts +0 -26
  121. package/types/src/config/defaultConfig.d.ts.map +0 -1
  122. package/types/src/config/index.d.ts +0 -3
  123. package/types/src/config/index.d.ts.map +0 -1
  124. package/types/src/config/loadConfig.d.ts +0 -2
  125. package/types/src/config/loadConfig.d.ts.map +0 -1
  126. package/types/src/css/index.d.ts +0 -6
  127. package/types/src/css/index.d.ts.map +0 -1
  128. package/types/src/css/processor.d.ts +0 -23
  129. package/types/src/css/processor.d.ts.map +0 -1
  130. package/types/src/dev.d.ts +0 -2
  131. package/types/src/dev.d.ts.map +0 -1
  132. package/types/src/hydration/index.d.ts +0 -33
  133. package/types/src/hydration/index.d.ts.map +0 -1
  134. package/types/src/image-optimizer/index.d.ts +0 -24
  135. package/types/src/image-optimizer/index.d.ts.map +0 -1
  136. package/types/src/images/index.d.ts +0 -12
  137. package/types/src/images/index.d.ts.map +0 -1
  138. package/types/src/images/processor.d.ts +0 -30
  139. package/types/src/images/processor.d.ts.map +0 -1
  140. package/types/src/layouts/index.d.ts +0 -28
  141. package/types/src/layouts/index.d.ts.map +0 -1
  142. package/types/src/loading/index.d.ts +0 -28
  143. package/types/src/loading/index.d.ts.map +0 -1
  144. package/types/src/logger/logger.d.ts +0 -30
  145. package/types/src/logger/logger.d.ts.map +0 -1
  146. package/types/src/middleware/index.d.ts +0 -61
  147. package/types/src/middleware/index.d.ts.map +0 -1
  148. package/types/src/router/Router.d.ts +0 -16
  149. package/types/src/router/Router.d.ts.map +0 -1
  150. package/types/src/router/SSRRouter.d.ts +0 -20
  151. package/types/src/router/SSRRouter.d.ts.map +0 -1
  152. package/types/src/router/index.d.ts +0 -3
  153. package/types/src/router/index.d.ts.map +0 -1
  154. package/types/src/scaffolder/index.d.ts +0 -14
  155. package/types/src/scaffolder/index.d.ts.map +0 -1
  156. package/types/src/serve.d.ts +0 -3
  157. package/types/src/serve.d.ts.map +0 -1
  158. package/types/src/server/dev-handler.d.ts +0 -13
  159. package/types/src/server/dev-handler.d.ts.map +0 -1
  160. package/types/src/server/dev-server-utils.d.ts +0 -6
  161. package/types/src/server/dev-server-utils.d.ts.map +0 -1
  162. package/types/src/server/dev-server.d.ts +0 -18
  163. package/types/src/server/dev-server.d.ts.map +0 -1
  164. package/types/src/server/hmr-handler.d.ts +0 -19
  165. package/types/src/server/hmr-handler.d.ts.map +0 -1
  166. package/types/src/server/index.d.ts +0 -4
  167. package/types/src/server/index.d.ts.map +0 -1
  168. package/types/src/server/request-handler.d.ts +0 -19
  169. package/types/src/server/request-handler.d.ts.map +0 -1
  170. package/types/src/server-islands/extractor.d.ts +0 -16
  171. package/types/src/server-islands/extractor.d.ts.map +0 -1
  172. package/types/src/server-islands/index.d.ts +0 -3
  173. package/types/src/server-islands/index.d.ts.map +0 -1
  174. package/types/src/utils/cache.d.ts +0 -52
  175. package/types/src/utils/cache.d.ts.map +0 -1
  176. package/types/src/utils/env.d.ts +0 -20
  177. package/types/src/utils/env.d.ts.map +0 -1
  178. package/types/src/utils/importhow.d.ts +0 -15
  179. package/types/src/utils/importhow.d.ts.map +0 -1
  180. package/types/src/utils/index.d.ts +0 -3
  181. package/types/src/utils/index.d.ts.map +0 -1
  182. package/types/src/utils/meta-extractor.d.ts +0 -13
  183. package/types/src/utils/meta-extractor.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,269 +1,71 @@
1
- # BertUI ⚡
1
+ # bertui
2
2
 
3
- **Zero-config React framework powered by Bun. File-based routing, Server Islands, and a build system that gets out of your way.**
3
+ Zero-config React framework powered by Bun. Minimal core, optional everything else.
4
4
 
5
- [![Version](https://img.shields.io/badge/version-1.2.9-blue)](https://www.npmjs.com/package/bertui)
6
- [![Bun Powered](https://img.shields.io/badge/runtime-Bun-f472b6)](https://bun.sh)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ ## Install
8
6
 
9
- ---
10
-
11
- ## Quick Start
12
7
  ```bash
13
- bunx create-bertui my-app
14
- cd my-app
15
- bun run dev
16
- ```
17
-
18
- ---
19
-
20
- ## What's New in v1.2.9
21
-
22
- ### Server Islands — Rebuilt from the Ground Up
23
-
24
- Server Islands are back and fully working. One export, zero config, pure HTML at build time.
25
- ```jsx
26
- // src/pages/about.jsx
27
- export const render = "static"
28
-
29
- export default function About() {
30
- return (
31
- <div>
32
- <h1>About Us</h1>
33
- <p>Rendered at build time. Zero JS in the browser.</p>
34
- </div>
35
- )
36
- }
8
+ bun add bertui
37
9
  ```
38
10
 
39
- BertUI runs `renderToString` on your page at build time and writes pure HTML to `dist/`. No React runtime ships to the browser. No hydration. Just HTML.
11
+ That's it. React + file-based routing + SSG + HMR + LightningCSS. No forms, no animations, no icons pulled in unless you ask for them.
40
12
 
41
- Three render modes, one export:
42
- ```jsx
43
- // Pure HTML — zero JS, zero React in the browser
44
- export const render = "static"
13
+ ## Optional packages
45
14
 
46
- // SSR HTML + JS bundle — pre-rendered for instant load, hydrated for interactivity
47
- export const render = "server"
15
+ Install only what you need:
48
16
 
49
- // Default — client-only React SPA (no export needed)
50
- export default function Page() {}
17
+ ```bash
18
+ bun add @bertui/elysia # fullstack — Elysia server plugin
19
+ bun add @bertui/forms # forms (coming soon)
20
+ bun add @bertui/animations # animations (coming soon)
21
+ bun add @bertui/icons # icons (coming soon)
51
22
  ```
52
23
 
53
- **Rules for static and server pages:**
54
- - No React hooks (`useState`, `useEffect`, etc.)
55
- - No event handlers (`onClick`, `onChange`, etc.)
56
- - No browser APIs (`window`, `document`, `localStorage`)
57
- - Violations are caught at build time with a clear error
58
-
59
- ---
60
-
61
- ## What's New in v1.2.2
24
+ Then enable in `bertui.config.js`:
62
25
 
63
- ### Import Aliases (`importhow`)
64
- No more `../../../` chains. Define aliases in your config and import cleanly from anywhere.
65
- ```javascript
66
- // bertui.config.js
26
+ ```js
67
27
  export default {
68
- importhow: {
69
- amani: '../components',
70
- ui: '../components/ui',
71
- }
28
+ siteName: 'My App',
29
+ elysia: true, // requires bun add @bertui/elysia
30
+ forms: true, // requires bun add @bertui/forms
72
31
  }
73
32
  ```
74
- ```javascript
75
- // anywhere in your project
76
- import Button from 'amani/button';
77
- import Card from 'ui/card';
78
- ```
79
-
80
- Aliases are resolved at compile time — zero runtime overhead.
81
33
 
82
- ### Node Modules Just Work
83
- Install a package, import it. That's it.
84
- ```javascript
85
- import { format } from 'date-fns';
86
- import confetti from 'canvas-confetti';
87
- ```
34
+ If you enable a feature without installing its package, BertUI throws a clear error telling you exactly what to run.
88
35
 
89
- In dev, packages are served from your local filesystem. In production, only the packages you actually import are bundled and tree-shaken into the output.
36
+ ## Quick start
90
37
 
91
- ### CLI — New Look
92
- The build and dev output is now compact and step-based instead of verbose line-by-line logs.
93
- ```
94
- ██████╗ ███████╗██████╗ ████████╗██╗ ██╗██╗
95
- ██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██║ ██║██║
96
- ██████╔╝█████╗ ██████╔╝ ██║ ██║ ██║██║
97
- ██╔══██╗██╔══╝ ██╔══██╗ ██║ ██║ ██║██║
98
- ██████╔╝███████╗██║ ██║ ██║ ╚██████╔╝██║
99
- ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
100
- by Pease Ernest · BUILD
101
-
102
- [ 1/10] ✓ Loading env
103
- [ 2/10] ✓ Compiling 5 routes
104
- [ 3/10] ⠸ Layouts ...
105
- ...
106
- ✓ Done 0.54s
107
- JS bundle 32.6 KB
108
- Output dist/
109
- ```
110
-
111
- Debug logs are written silently to `.bertui/dev.log`.
112
-
113
- ### Dev Server — No More Restarts
114
- Run `bun add some-package` and the dev server picks it up automatically. The import map rebuilds and the browser reloads — no restart needed.
115
-
116
- ---
117
-
118
- ## Features
119
-
120
- ### File-Based Routing
121
- ```
122
- src/pages/index.jsx → /
123
- src/pages/about.jsx → /about
124
- src/pages/blog/index.jsx → /blog
125
- src/pages/blog/[slug].jsx → /blog/:slug
126
- ```
127
-
128
- ### Server Islands
129
-
130
- Three render modes. One export at the top of your page.
131
- ```jsx
132
- // render = "static" — pure HTML, zero JS
133
- // Perfect for: marketing pages, blog posts, docs, any page without interactivity
134
- export const render = "static"
135
- export const title = "About Us"
136
-
137
- export default function About() {
138
- return (
139
- <div>
140
- <h1>About Us</h1>
141
- <p>Pre-rendered at build time. Instant load, perfect SEO.</p>
142
- </div>
143
- )
144
- }
145
- ```
146
- ```jsx
147
- // render = "server" — SSR HTML in the body + JS bundle attached
148
- // Perfect for: pages that need fast first paint AND interactivity after load
149
- export const render = "server"
150
-
151
- export default function Dashboard() {
152
- return <div><h1>Dashboard</h1></div>
153
- }
154
- ```
155
- ```jsx
156
- // default — client-only React (no export needed)
157
- // Perfect for: highly interactive pages, apps, anything with lots of state
158
- export default function Editor() {
159
- const [value, setValue] = useState('')
160
- return <textarea onChange={e => setValue(e.target.value)} />
161
- }
162
- ```
163
-
164
- BertUI automatically detects the render mode and generates the right HTML for each page. Static pages get zero JS. Server pages get pre-rendered HTML with hydration. Default pages get the full SPA treatment.
165
-
166
- ### TypeScript
167
-
168
- `.tsx` and `.ts` files work with no setup. Mix them freely with `.jsx`.
169
- ```typescript
170
- // src/pages/blog/[slug].tsx
171
- import { useRouter } from 'bertui/router';
172
-
173
- export default function BlogPost() {
174
- const { params } = useRouter();
175
- return <h1>Post: {params.slug}</h1>;
176
- }
177
- ```
178
-
179
- ### SEO
180
-
181
- `sitemap.xml` and `robots.txt` are generated automatically from your routes. Requires `baseUrl` in config.
182
- ```javascript
183
- export default {
184
- baseUrl: 'https://example.com',
185
- robots: {
186
- disallow: ['/admin'],
187
- crawlDelay: 1,
188
- }
189
- }
38
+ ```bash
39
+ bunx create-bertui my-app
40
+ cd my-app
41
+ bun install
42
+ bun run dev
190
43
  ```
191
44
 
192
- ### CSS
193
-
194
- Put your styles in `src/styles/`. They are combined and minified with LightningCSS into a single `bertui.min.css`.
45
+ ## What's in the core
195
46
 
196
- ---
47
+ | Package | What it does |
48
+ |---|---|
49
+ | `@bertui/core` | Types, config, utils, cache |
50
+ | `@bertui/compiler` | JSX/TSX pipeline — dev + build unified |
51
+ | `@bertui/router` | File-based React router, SSR-safe |
52
+ | `@bertui/ssg` | Static/server islands, SSR renderer |
53
+ | `@bertui/css` | LightningCSS — modules, SCSS, minify |
54
+ | `@bertui/images` | Image copy + WASM optimization |
55
+ | `@bertui/dev` | HMR, file watcher, import map |
56
+ | `@bertui/cli` | The `bertui` binary |
197
57
 
198
- ## Project Structure
199
- ```
200
- my-app/
201
- ├── src/
202
- │ ├── pages/ # File-based routing
203
- │ ├── components/ # Your components
204
- │ └── styles/ # Global CSS
205
- ├── public/ # Static assets
206
- ├── dist/ # Production output
207
- │ ├── sitemap.xml
208
- │ ├── robots.txt
209
- │ └── assets/
210
- └── bertui.config.js
211
- ```
212
-
213
- ---
214
-
215
- ## Configuration
216
- ```javascript
217
- // bertui.config.js
218
- export default {
219
- siteName: 'My Site',
220
- baseUrl: 'https://example.com',
58
+ ## Imports
221
59
 
222
- importhow: {
223
- ui: '../components/ui',
224
- },
60
+ ```ts
61
+ // Core
62
+ import { loadConfig, formatBytes } from 'bertui'
225
63
 
226
- robots: {
227
- disallow: ['/admin'],
228
- crawlDelay: 1,
229
- },
64
+ // Router (client-side)
65
+ import { Router, Link, useRouter } from 'bertui/router'
230
66
 
231
- meta: {
232
- title: 'My Site',
233
- description: 'Built with BertUI',
234
- themeColor: '#000000',
235
- },
236
- }
67
+ // Config types
68
+ import type { BertuiConfig } from 'bertui/config'
237
69
  ```
238
70
 
239
- ---
240
-
241
- ## Performance
242
-
243
- Benchmarks on an Intel i3-2348M, 7.6GB RAM.
244
-
245
- | Metric | BertUI | Vite | Next.js |
246
- |--------------|---------|---------|---------|
247
- | Dev start | 494ms | 713ms | 2,100ms |
248
- | Prod build | 265ms | 4,700ms | 8,400ms |
249
- | Bundle size | ~32KB | 220KB | 280KB |
250
- | HMR | 30ms | 85ms | 120ms |
251
-
252
- ---
253
-
254
- ## Coming Soon
255
-
256
- - `bertui-elysia` — API routes, auth, database
257
- - `bertui-animate` — GPU-accelerated animations
258
- - Partial hydration — `<Island>` component for mixed static/interactive pages
259
-
260
- ---
261
-
262
- ## Credits
263
-
264
- - Runtime: [Bun](https://bun.sh)
265
- - CSS: [LightningCSS](https://lightningcss.dev)
266
-
267
- ---
268
-
269
- Made by Pease Ernest
71
+ Made by Pease Ernest
package/TYPES_PATCH.md ADDED
@@ -0,0 +1,17 @@
1
+ // Add these fields to the BertuiConfig interface in packages/core/src/types/index.ts
2
+ // Merge into the existing BertuiConfig — do not replace the whole file, just add the optional block
3
+
4
+ // ─── Optional feature flags ───────────────────────────────────────────────────
5
+ // These are OFF by default. Enabling them requires the matching package to be installed.
6
+ //
7
+ // elysia: true → requires bun add @bertui/elysia
8
+ // forms: true → requires bun add @bertui/forms (coming soon)
9
+ // animations: true → requires bun add @bertui/animations (coming soon)
10
+ // icons: true → requires bun add @bertui/icons (coming soon)
11
+
12
+ // Add to BertuiConfig:
13
+ //
14
+ // elysia?: boolean
15
+ // forms?: boolean
16
+ // animations?: boolean
17
+ // icons?: boolean
package/bin/bertui.js CHANGED
@@ -1,8 +1,3 @@
1
1
  #!/usr/bin/env bun
2
- // bin/bertui.js
3
-
4
- // Import the CLI program from index
5
- import { program } from '../index.js';
6
-
7
- // Run it
8
- program();
2
+ import { program } from '@bertui/cli'
3
+ await program()
package/package.json CHANGED
@@ -1,118 +1,52 @@
1
1
  {
2
2
  "name": "bertui",
3
- "version": "1.2.9",
4
- "description": "Lightning-fast React dev server powered by Bun - Now with Rust image optimization (WASM, no Rust required for users)",
3
+ "version": "2.0.0",
4
+ "description": "Zero-config React framework powered by Bun minimal core, optional everything else",
5
5
  "type": "module",
6
- "main": "./index.js",
7
- "types": "./types/index.d.ts",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts",
8
8
  "bin": {
9
9
  "bertui": "./bin/bertui.js"
10
10
  },
11
- "exports": {
12
- ".": {
13
- "types": "./types/index.d.ts",
14
- "import": "./index.js",
15
- "default": "./index.js"
11
+ "exports": {
12
+ ".": {
13
+ "import": "./src/index.ts"
14
+ },
15
+ "./router": {
16
+ "import": "./src/router.ts"
17
+ },
18
+ "./config": {
19
+ "import": "./src/config.ts"
20
+ }
16
21
  },
17
- "./hmr": {
18
- "import": "./src/client/hmr-runtime.js"
19
- },
20
- "./image-optimizer": {
21
- "import": "./src/image-optimizer/index.js"
22
- },
23
- "./router": {
24
- "types": "./types/router.d.ts",
25
- "import": "./src/router/index.js"
26
- },
27
- "./config": {
28
- "types": "./types/config.d.ts",
29
- "import": "./src/config/index.js"
30
- },
31
- "./logger": {
32
- "import": "./src/logger/logger.js"
33
- },
34
- "./styles": "./src/styles/bertui.css",
35
- "./compiler": {
36
- "import": "./src/client/compiler.js"
37
- },
38
- "./layouts": {
39
- "import": "./src/layouts/index.js"
40
- },
41
- "./loading": {
42
- "import": "./src/loading/index.js"
43
- },
44
- "./hydration": {
45
- "import": "./src/hydration/index.js"
46
- },
47
- "./dev": {
48
- "import": "./src/server/dev-server-utils.js"
49
- },
50
- "./build": {
51
- "import": "./src/build.js"
52
- }
53
- },
54
- "files": [
55
- "bin",
56
- "src",
57
- "dist",
58
- "types",
59
- "index.js",
60
- "README.md",
61
- "LICENSE"
62
- ],
63
22
  "scripts": {
64
- "dev": "bun bin/bertui.js dev",
65
- "build": "bun bin/bertui.js build",
66
- "serve": "bun bin/bertui.js serve",
67
- "preview": "bun bin/bertui.js serve --port 5000",
68
- "build:wasm": "cd src/image-optimizer-rust && wasm-pack build --target web --out-dir ../../dist/image-optimizer/wasm && bun run fix:wasm",
69
- "fix:wasm": "node scripts/fix-wasm-exports.js",
70
- "prepublishOnly": "echo 'Note: Ensure WASM is built via build:wasm before publishing'",
71
- "test": "cd test-app && bun run dev"
23
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun --format esm",
24
+ "typecheck": "tsc --noEmit"
72
25
  },
73
26
  "dependencies": {
74
- "elysia": "^1.0.0",
75
- "ernest-logger": "^2.0.0",
76
- "lightningcss": "^1.30.2",
77
- "react-refresh": "^0.14.0"
27
+ "@bertui/core": "workspace:*",
28
+ "@bertui/compiler": "workspace:*",
29
+ "@bertui/router": "workspace:*",
30
+ "@bertui/ssg": "workspace:*",
31
+ "@bertui/css": "workspace:*",
32
+ "@bertui/cli": "workspace:*",
33
+ "@bertui/dev": "workspace:*",
34
+ "@bertui/images": "workspace:*"
78
35
  },
79
36
  "peerDependencies": {
80
- "bun": ">=1.0.0",
81
- "react": "^18.0.0 || ^19.0.0",
82
- "react-dom": "^18.0.0 || ^19.0.0"
37
+ "react": ">=19.0.0",
38
+ "react-dom": ">=19.0.0"
83
39
  },
84
40
  "devDependencies": {
85
- "@types/react": "^18.2.0",
86
- "@types/react-dom": "^18.2.0",
87
- "oxipng": "^1.0.1",
88
- "wasm-pack": "^0.12.1"
89
- },
90
- "optionalDependencies": {
91
- "@bertui/image-optimizer-wasm": "0.1.0",
92
- "oxipng": "^8.0.0",
93
- "sass": "^1.69.5"
41
+ "typescript": "^6.0.0",
42
+ "@types/react": "^19.0.0",
43
+ "@types/react-dom": "^19.0.0"
94
44
  },
95
- "keywords": [
96
- "react",
97
- "bun",
98
- "elysia",
99
- "hmr",
100
- "fast-refresh",
101
- "image-optimization",
102
- "rust",
103
- "wasm",
104
- "server-islands",
105
- "seo",
106
- "sitemap",
107
- "typescript"
108
- ],
45
+ "keywords": ["react", "bun", "ssr", "ssg", "file-based-routing", "islands", "zero-config"],
109
46
  "author": "Pease Ernest",
110
47
  "license": "MIT",
111
48
  "repository": {
112
49
  "type": "git",
113
- "url": "https://github.com/BunElysiaReact/BERTUI.git"
114
- },
115
- "engines": {
116
- "bun": ">=1.0.0"
50
+ "url": "https://github.com/BunElysiaReact/BERTUI"
117
51
  }
118
- }
52
+ }
package/src/config.ts ADDED
@@ -0,0 +1,4 @@
1
+ // packages/bertui/src/config.ts
2
+ // Allows: import { loadConfig, defaultConfig } from 'bertui/config'
3
+ export { loadConfig, defaultConfig } from '@bertui/core'
4
+ export type { BertuiConfig, MetaConfig, AppShellConfig, RobotsConfig } from '@bertui/core'
package/src/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ // packages/bertui/src/index.ts
2
+ // Main entry point for `bun add bertui`
3
+ // Re-exports everything a user needs from the core packages.
4
+ // Optional packages (@bertui/elysia, @bertui/forms etc) are NOT exported here —
5
+ // users install and import them separately.
6
+
7
+ // Core types + config + utils
8
+ export * from '@bertui/core'
9
+
10
+ // Compiler
11
+ export { transform, compileFile, compileProject } from '@bertui/compiler'
12
+
13
+ // SSG / server islands
14
+ export {
15
+ getRenderMode,
16
+ validateServerIsland,
17
+ isServerIsland,
18
+ renderPageToHTML,
19
+ validateAllServerIslands,
20
+ } from '@bertui/ssg'
21
+
22
+ // CSS
23
+ export { minifyCSS, minifyCSSSync, buildAllCSS, scopeCSSModule } from '@bertui/css'
24
+
25
+ // Images
26
+ export { copyImagesSync, getImageFiles, isImageFile, optimizeImage } from '@bertui/images'
27
+
28
+ // Dev
29
+ export { buildDevImportMap, setupFileWatcher } from '@bertui/dev'
30
+
31
+ // Version
32
+ export const VERSION = '2.0.0'
@@ -0,0 +1,49 @@
1
+ import type { BertuiConfig } from '@bertui/core'
2
+
3
+ export const OPTIONAL_FEATURES = [
4
+ { name: 'SSG / Static Site Generation', pkg: '@bertui/ssg', configKey: 'ssg' },
5
+ { name: 'Elysia Fullstack', pkg: '@bertui/elysia', configKey: 'elysia' },
6
+ { name: 'Animations', pkg: '@bertui/animations', configKey: 'animations' }, // Add this
7
+ ]
8
+
9
+ export async function loadOptional<T = unknown>(pkg: string, configKey: string): Promise<T> {
10
+ try {
11
+ return await import(pkg) as T
12
+ } catch {
13
+ throw new Error(
14
+ `\n\n [@bertui] config.${configKey} is enabled but ${pkg} is not installed.\n` +
15
+ ` Run: bun add ${pkg}\n` +
16
+ ` Then restart the dev server.\n`
17
+ )
18
+ }
19
+ }
20
+
21
+ export async function validateOptionalFeatures(config: BertuiConfig): Promise<void> {
22
+ const missing: Array<{ name: string; pkg: string; configKey: string }> = []
23
+
24
+ for (const feature of OPTIONAL_FEATURES) {
25
+ if (!config[feature.configKey as keyof BertuiConfig]) continue
26
+
27
+ try {
28
+ await import(feature.pkg)
29
+ } catch {
30
+ missing.push({ name: feature.name, pkg: feature.pkg, configKey: feature.configKey })
31
+ }
32
+ }
33
+
34
+ if (missing.length) {
35
+ const installCmd = missing.map(m => m.pkg).join(' ')
36
+ console.error(`
37
+ ╔══════════════════════════════════════════════════╗
38
+ ║ [@bertui] Missing optional packages ║
39
+ ╚══════════════════════════════════════════════════╝
40
+
41
+ ${missing.map(m => ` • ${m.name} (config.${m.configKey} = true)\n → bun add ${m.pkg}`).join('\n\n')}
42
+
43
+ Install them all at once:
44
+
45
+ bun add ${installCmd}
46
+ `)
47
+ process.exit(1)
48
+ }
49
+ }
package/src/router.ts ADDED
@@ -0,0 +1,3 @@
1
+ // packages/bertui/src/router.ts
2
+ // Allows: import { Router, Link, useRouter } from 'bertui/router'
3
+ export * from '@bertui/router'
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./dist",
6
+ "paths": {
7
+ "@bertui/core": ["../core/src/index.ts"],
8
+ "@bertui/compiler": ["../compiler/src/index.ts"],
9
+ "@bertui/router": ["../router/src/index.ts"],
10
+ "@bertui/ssg": ["../ssg/src/index.ts"],
11
+ "@bertui/css": ["../css/src/index.ts"],
12
+ "@bertui/images": ["../images/src/index.ts"],
13
+ "@bertui/dev": ["../dev/src/index.ts"],
14
+ "@bertui/cli": ["../cli/src/index.ts"]
15
+ }
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["dist", "node_modules"],
19
+ "references": [
20
+ { "path": "../core" },
21
+ { "path": "../compiler" },
22
+ { "path": "../router" },
23
+ { "path": "../ssg" },
24
+ { "path": "../css" },
25
+ { "path": "../images" },
26
+ { "path": "../dev" },
27
+ { "path": "../cli" }
28
+ ]
29
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 BunElysiaReact
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.