bertui 1.2.8 → 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 (182) hide show
  1. package/README.md +45 -196
  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 -151
  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 -12
  25. package/src/build.js +0 -266
  26. package/src/cli.js +0 -131
  27. package/src/client/compiler.js +0 -522
  28. package/src/client/fast-refresh.js +0 -72
  29. package/src/client/hmr-runtime.js +0 -59
  30. package/src/compiler/index.js +0 -25
  31. package/src/compiler/router-generator-pure.js +0 -104
  32. package/src/compiler/transform.js +0 -149
  33. package/src/config/defaultConfig.js +0 -37
  34. package/src/config/index.js +0 -2
  35. package/src/config/loadConfig.js +0 -64
  36. package/src/config/og-image.png +0 -0
  37. package/src/css/index.js +0 -46
  38. package/src/css/processor.js +0 -172
  39. package/src/dev.js +0 -68
  40. package/src/hydration/index.js +0 -151
  41. package/src/image-optimizer/index.js +0 -103
  42. package/src/images/index.js +0 -102
  43. package/src/images/processor.js +0 -169
  44. package/src/layouts/index.js +0 -165
  45. package/src/loading/index.js +0 -210
  46. package/src/logger/logger.js +0 -320
  47. package/src/logger/notes.md +0 -20
  48. package/src/middleware/index.js +0 -182
  49. package/src/router/Router.js +0 -150
  50. package/src/router/SSRRouter.js +0 -156
  51. package/src/router/index.js +0 -3
  52. package/src/scaffolder/index.js +0 -310
  53. package/src/serve.js +0 -193
  54. package/src/server/dev-handler.js +0 -195
  55. package/src/server/dev-server-utils.js +0 -406
  56. package/src/server/dev-server.js +0 -15
  57. package/src/server/hmr-handler.js +0 -148
  58. package/src/server/index.js +0 -3
  59. package/src/server/notes.md +0 -1
  60. package/src/server/request-handler.js +0 -36
  61. package/src/server-islands/extractor.js +0 -198
  62. package/src/server-islands/index.js +0 -59
  63. package/src/styles/bertui.css +0 -210
  64. package/src/utils/cache.js +0 -297
  65. package/src/utils/env.js +0 -87
  66. package/src/utils/importhow.js +0 -52
  67. package/src/utils/index.js +0 -11
  68. package/src/utils/meta-extractor.js +0 -127
  69. package/types/bin/bertui.d.ts +0 -3
  70. package/types/bin/bertui.d.ts.map +0 -1
  71. package/types/error-overlay.d.ts +0 -2
  72. package/types/error-overlay.d.ts.map +0 -1
  73. package/types/index.d.ts +0 -26
  74. package/types/index.d.ts.map +0 -1
  75. package/types/scripts/fix-wasm-exports.d.ts +0 -2
  76. package/types/scripts/fix-wasm-exports.d.ts.map +0 -1
  77. package/types/src/analyzer/index.d.ts +0 -8
  78. package/types/src/analyzer/index.d.ts.map +0 -1
  79. package/types/src/build/compiler/file-transpiler.d.ts +0 -5
  80. package/types/src/build/compiler/file-transpiler.d.ts.map +0 -1
  81. package/types/src/build/compiler/index.d.ts +0 -12
  82. package/types/src/build/compiler/index.d.ts.map +0 -1
  83. package/types/src/build/compiler/route-discoverer.d.ts +0 -2
  84. package/types/src/build/compiler/route-discoverer.d.ts.map +0 -1
  85. package/types/src/build/compiler/router-generator.d.ts +0 -2
  86. package/types/src/build/compiler/router-generator.d.ts.map +0 -1
  87. package/types/src/build/css-builder.d.ts +0 -18
  88. package/types/src/build/css-builder.d.ts.map +0 -1
  89. package/types/src/build/generators/html-generator.d.ts +0 -2
  90. package/types/src/build/generators/html-generator.d.ts.map +0 -1
  91. package/types/src/build/generators/robots-generator.d.ts +0 -11
  92. package/types/src/build/generators/robots-generator.d.ts.map +0 -1
  93. package/types/src/build/generators/sitemap-generator.d.ts +0 -5
  94. package/types/src/build/generators/sitemap-generator.d.ts.map +0 -1
  95. package/types/src/build/image-optimizer.d.ts +0 -11
  96. package/types/src/build/image-optimizer.d.ts.map +0 -1
  97. package/types/src/build/processors/asset-processor.d.ts +0 -2
  98. package/types/src/build/processors/asset-processor.d.ts.map +0 -1
  99. package/types/src/build/processors/css-builder.d.ts +0 -2
  100. package/types/src/build/processors/css-builder.d.ts.map +0 -1
  101. package/types/src/build/server-island-validator.d.ts +0 -27
  102. package/types/src/build/server-island-validator.d.ts.map +0 -1
  103. package/types/src/build.d.ts +0 -5
  104. package/types/src/build.d.ts.map +0 -1
  105. package/types/src/cli.d.ts +0 -2
  106. package/types/src/cli.d.ts.map +0 -1
  107. package/types/src/client/compiler.d.ts +0 -16
  108. package/types/src/client/compiler.d.ts.map +0 -1
  109. package/types/src/client/fast-refresh.d.ts +0 -3
  110. package/types/src/client/fast-refresh.d.ts.map +0 -1
  111. package/types/src/client/hmr-runtime.d.ts +0 -4
  112. package/types/src/client/hmr-runtime.d.ts.map +0 -1
  113. package/types/src/compiler/index.d.ts +0 -8
  114. package/types/src/compiler/index.d.ts.map +0 -1
  115. package/types/src/compiler/router-generator-pure.d.ts +0 -2
  116. package/types/src/compiler/router-generator-pure.d.ts.map +0 -1
  117. package/types/src/compiler/transform.d.ts +0 -36
  118. package/types/src/compiler/transform.d.ts.map +0 -1
  119. package/types/src/config/defaultConfig.d.ts +0 -26
  120. package/types/src/config/defaultConfig.d.ts.map +0 -1
  121. package/types/src/config/index.d.ts +0 -3
  122. package/types/src/config/index.d.ts.map +0 -1
  123. package/types/src/config/loadConfig.d.ts +0 -2
  124. package/types/src/config/loadConfig.d.ts.map +0 -1
  125. package/types/src/css/index.d.ts +0 -6
  126. package/types/src/css/index.d.ts.map +0 -1
  127. package/types/src/css/processor.d.ts +0 -23
  128. package/types/src/css/processor.d.ts.map +0 -1
  129. package/types/src/dev.d.ts +0 -2
  130. package/types/src/dev.d.ts.map +0 -1
  131. package/types/src/hydration/index.d.ts +0 -33
  132. package/types/src/hydration/index.d.ts.map +0 -1
  133. package/types/src/image-optimizer/index.d.ts +0 -24
  134. package/types/src/image-optimizer/index.d.ts.map +0 -1
  135. package/types/src/images/index.d.ts +0 -12
  136. package/types/src/images/index.d.ts.map +0 -1
  137. package/types/src/images/processor.d.ts +0 -30
  138. package/types/src/images/processor.d.ts.map +0 -1
  139. package/types/src/layouts/index.d.ts +0 -28
  140. package/types/src/layouts/index.d.ts.map +0 -1
  141. package/types/src/loading/index.d.ts +0 -28
  142. package/types/src/loading/index.d.ts.map +0 -1
  143. package/types/src/logger/logger.d.ts +0 -30
  144. package/types/src/logger/logger.d.ts.map +0 -1
  145. package/types/src/middleware/index.d.ts +0 -61
  146. package/types/src/middleware/index.d.ts.map +0 -1
  147. package/types/src/router/Router.d.ts +0 -16
  148. package/types/src/router/Router.d.ts.map +0 -1
  149. package/types/src/router/SSRRouter.d.ts +0 -20
  150. package/types/src/router/SSRRouter.d.ts.map +0 -1
  151. package/types/src/router/index.d.ts +0 -3
  152. package/types/src/router/index.d.ts.map +0 -1
  153. package/types/src/scaffolder/index.d.ts +0 -14
  154. package/types/src/scaffolder/index.d.ts.map +0 -1
  155. package/types/src/serve.d.ts +0 -3
  156. package/types/src/serve.d.ts.map +0 -1
  157. package/types/src/server/dev-handler.d.ts +0 -13
  158. package/types/src/server/dev-handler.d.ts.map +0 -1
  159. package/types/src/server/dev-server-utils.d.ts +0 -6
  160. package/types/src/server/dev-server-utils.d.ts.map +0 -1
  161. package/types/src/server/dev-server.d.ts +0 -18
  162. package/types/src/server/dev-server.d.ts.map +0 -1
  163. package/types/src/server/hmr-handler.d.ts +0 -19
  164. package/types/src/server/hmr-handler.d.ts.map +0 -1
  165. package/types/src/server/index.d.ts +0 -4
  166. package/types/src/server/index.d.ts.map +0 -1
  167. package/types/src/server/request-handler.d.ts +0 -19
  168. package/types/src/server/request-handler.d.ts.map +0 -1
  169. package/types/src/server-islands/extractor.d.ts +0 -16
  170. package/types/src/server-islands/extractor.d.ts.map +0 -1
  171. package/types/src/server-islands/index.d.ts +0 -3
  172. package/types/src/server-islands/index.d.ts.map +0 -1
  173. package/types/src/utils/cache.d.ts +0 -52
  174. package/types/src/utils/cache.d.ts.map +0 -1
  175. package/types/src/utils/env.d.ts +0 -20
  176. package/types/src/utils/env.d.ts.map +0 -1
  177. package/types/src/utils/importhow.d.ts +0 -15
  178. package/types/src/utils/importhow.d.ts.map +0 -1
  179. package/types/src/utils/index.d.ts +0 -3
  180. package/types/src/utils/index.d.ts.map +0 -1
  181. package/types/src/utils/meta-extractor.d.ts +0 -13
  182. package/types/src/utils/meta-extractor.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,222 +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.2-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)
8
-
9
- ---
10
-
11
- ## Quick Start
5
+ ## Install
12
6
 
13
7
  ```bash
14
- bunx create-bertui my-app
15
- cd my-app
16
- bun run dev
17
- ```
18
-
19
- ---
20
-
21
- ## What's New in v1.2.2
22
-
23
- ### Import Aliases (`importhow`)
24
- No more `../../../` chains. Define aliases in your config and import cleanly from anywhere.
25
-
26
- ```javascript
27
- // bertui.config.js
28
- export default {
29
- importhow: {
30
- amani: '../components',
31
- ui: '../components/ui',
32
- }
33
- }
34
- ```
35
-
36
- ```javascript
37
- // anywhere in your project
38
- import Button from 'amani/button';
39
- import Card from 'ui/card';
40
- ```
41
-
42
- Aliases are resolved at compile time — zero runtime overhead.
43
-
44
- ### Node Modules — Just Work
45
- Install a package, import it. That's it.
46
-
47
- ```javascript
48
- import { format } from 'date-fns';
49
- import confetti from 'canvas-confetti';
50
- ```
51
-
52
- 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.
53
-
54
- ### CLI — New Look
55
- The build and dev output is now compact and step-based instead of verbose line-by-line logs.
56
-
57
- ```
58
- ██████╗ ███████╗██████╗ ████████╗██╗ ██╗██╗
59
- ██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██║ ██║██║
60
- ██████╔╝█████╗ ██████╔╝ ██║ ██║ ██║██║
61
- ██╔══██╗██╔══╝ ██╔══██╗ ██║ ██║ ██║██║
62
- ██████╔╝███████╗██║ ██║ ██║ ╚██████╔╝██║
63
- ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
64
- by Pease Ernest · BUILD
65
-
66
- [ 1/10] ✓ Loading env
67
- [ 2/10] ✓ Compiling 5 routes · 1 islands
68
- [ 3/10] ⠸ Layouts ...
69
- ...
70
- ✓ Done 0.54s
71
- JS bundle 32.6 KB
72
- Output dist/
73
- ```
74
-
75
- Debug logs are written silently to `.bertui/dev.log`.
76
-
77
- ### Dev Server — No More Restarts
78
- Run `bun add some-package` and the dev server picks it up automatically. The import map rebuilds and the browser reloads — no restart needed.
79
-
80
- ---
81
-
82
- ## Features
83
-
84
- ### File-Based Routing
85
-
8
+ bun add bertui
86
9
  ```
87
- src/pages/index.jsx → /
88
- src/pages/about.jsx → /about
89
- src/pages/blog/index.jsx → /blog
90
- src/pages/blog/[slug].jsx → /blog/:slug
91
- ```
92
-
93
- ### Server Islands
94
-
95
- Add one line to opt a page into static generation at build time.
96
-
97
- ```jsx
98
- // src/pages/about.jsx
99
- export const render = "server";
100
- export const title = "About Us";
101
-
102
- export default function About() {
103
- return (
104
- <div>
105
- <h1>About Us</h1>
106
- <p>Pre-rendered as static HTML at build time.</p>
107
- </div>
108
- );
109
- }
110
- ```
111
-
112
- - Static HTML embedded in the output for instant load and perfect SEO
113
- - Pages with hooks or event handlers are rejected at build time with a clear error
114
- - All other pages are client-only by default
115
10
 
116
- ### TypeScript
11
+ That's it. React + file-based routing + SSG + HMR + LightningCSS. No forms, no animations, no icons pulled in unless you ask for them.
117
12
 
118
- `.tsx` and `.ts` files work with no setup. Mix them freely with `.jsx`.
13
+ ## Optional packages
119
14
 
120
- ```typescript
121
- // src/pages/blog/[slug].tsx
122
- import { useRouter } from 'bertui/router';
15
+ Install only what you need:
123
16
 
124
- export default function BlogPost() {
125
- const { params } = useRouter();
126
- return <h1>Post: {params.slug}</h1>;
127
- }
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)
128
22
  ```
129
23
 
130
- ### SEO
24
+ Then enable in `bertui.config.js`:
131
25
 
132
- `sitemap.xml` and `robots.txt` are generated automatically from your routes. Requires `baseUrl` in config.
133
-
134
- ```javascript
26
+ ```js
135
27
  export default {
136
- baseUrl: 'https://example.com',
137
- robots: {
138
- disallow: ['/admin'],
139
- crawlDelay: 1,
140
- }
28
+ siteName: 'My App',
29
+ elysia: true, // requires bun add @bertui/elysia
30
+ forms: true, // requires bun add @bertui/forms
141
31
  }
142
32
  ```
143
33
 
144
- ### CSS
145
-
146
- Put your styles in `src/styles/`. They are combined and minified with LightningCSS into a single `bertui.min.css`.
147
-
148
- ---
149
-
150
- ## Project Structure
151
-
152
- ```
153
- my-app/
154
- ├── src/
155
- │ ├── pages/ # File-based routing
156
- │ ├── components/ # Your components
157
- │ └── styles/ # Global CSS
158
- ├── public/ # Static assets
159
- ├── dist/ # Production output
160
- │ ├── sitemap.xml
161
- │ ├── robots.txt
162
- │ └── assets/
163
- └── bertui.config.js
164
- ```
165
-
166
- ---
34
+ If you enable a feature without installing its package, BertUI throws a clear error telling you exactly what to run.
167
35
 
168
- ## Configuration
36
+ ## Quick start
169
37
 
170
- ```javascript
171
- // bertui.config.js
172
- export default {
173
- siteName: 'My Site',
174
- baseUrl: 'https://example.com',
175
-
176
- importhow: {
177
- ui: '../components/ui',
178
- },
179
-
180
- robots: {
181
- disallow: ['/admin'],
182
- crawlDelay: 1,
183
- },
184
-
185
- meta: {
186
- title: 'My Site',
187
- description: 'Built with BertUI',
188
- themeColor: '#000000',
189
- },
190
- }
38
+ ```bash
39
+ bunx create-bertui my-app
40
+ cd my-app
41
+ bun install
42
+ bun run dev
191
43
  ```
192
44
 
193
- ---
194
-
195
- ## Performance
196
-
197
- Benchmarks on an Intel i3-2348M, 7.6GB RAM.
198
-
199
- | Metric | BertUI | Vite | Next.js |
200
- |--------------|---------|---------|---------|
201
- | Dev start | 494ms | 713ms | 2,100ms |
202
- | Prod build | 265ms | 4,700ms | 8,400ms |
203
- | Bundle size | ~32KB | 220KB | 280KB |
204
- | HMR | 30ms | 85ms | 120ms |
45
+ ## What's in the core
205
46
 
206
- ---
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 |
207
57
 
208
- ## Coming Soon
58
+ ## Imports
209
59
 
210
- - `bertui-elysia` — API routes, auth, database
211
- - `bertui-animate` — GPU-accelerated animations
60
+ ```ts
61
+ // Core
62
+ import { loadConfig, formatBytes } from 'bertui'
212
63
 
213
- ---
64
+ // Router (client-side)
65
+ import { Router, Link, useRouter } from 'bertui/router'
214
66
 
215
- ## Credits
216
-
217
- - Runtime: [Bun](https://bun.sh)
218
- - CSS: [LightningCSS](https://lightningcss.dev)
219
-
220
- ---
67
+ // Config types
68
+ import type { BertuiConfig } from 'bertui/config'
69
+ ```
221
70
 
222
- 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.8",
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.