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.
- package/README.md +44 -242
- package/TYPES_PATCH.md +17 -0
- package/bin/bertui.js +2 -7
- package/package.json +32 -98
- package/src/config.ts +4 -0
- package/src/index.ts +32 -0
- package/src/optional.ts +49 -0
- package/src/router.ts +3 -0
- package/tsconfig.json +29 -0
- package/LICENSE +0 -21
- package/index.js +0 -103
- package/src/analyzer/index.js +0 -370
- package/src/build/compiler/file-transpiler.js +0 -216
- package/src/build/compiler/index.js +0 -31
- package/src/build/compiler/route-discoverer.js +0 -49
- package/src/build/compiler/router-generator.js +0 -105
- package/src/build/css-builder.js +0 -81
- package/src/build/generators/html-generator.js +0 -263
- package/src/build/generators/robots-generator.js +0 -58
- package/src/build/generators/sitemap-generator.js +0 -63
- package/src/build/image-optimizer.js +0 -137
- package/src/build/processors/asset-processor.js +0 -19
- package/src/build/processors/css-builder.js +0 -142
- package/src/build/server-island-validator.js +0 -67
- package/src/build/ssr-renderer.js +0 -64
- package/src/build.js +0 -273
- package/src/cli.js +0 -131
- package/src/client/compiler.js +0 -522
- package/src/client/fast-refresh.js +0 -72
- package/src/client/hmr-runtime.js +0 -59
- package/src/compiler/index.js +0 -25
- package/src/compiler/router-generator-pure.js +0 -104
- package/src/compiler/transform.js +0 -149
- package/src/config/defaultConfig.js +0 -37
- package/src/config/index.js +0 -2
- package/src/config/loadConfig.js +0 -64
- package/src/config/og-image.png +0 -0
- package/src/css/index.js +0 -46
- package/src/css/processor.js +0 -172
- package/src/dev.js +0 -68
- package/src/hydration/index.js +0 -151
- package/src/image-optimizer/index.js +0 -103
- package/src/images/index.js +0 -102
- package/src/images/processor.js +0 -169
- package/src/layouts/index.js +0 -165
- package/src/loading/index.js +0 -210
- package/src/logger/logger.js +0 -320
- package/src/logger/notes.md +0 -20
- package/src/middleware/index.js +0 -182
- package/src/router/Router.js +0 -150
- package/src/router/SSRRouter.js +0 -156
- package/src/router/index.js +0 -3
- package/src/scaffolder/index.js +0 -310
- package/src/serve.js +0 -193
- package/src/server/dev-handler.js +0 -195
- package/src/server/dev-server-utils.js +0 -406
- package/src/server/dev-server.js +0 -15
- package/src/server/hmr-handler.js +0 -148
- package/src/server/index.js +0 -3
- package/src/server/notes.md +0 -1
- package/src/server/request-handler.js +0 -36
- package/src/server-islands/extractor.js +0 -198
- package/src/server-islands/index.js +0 -59
- package/src/styles/bertui.css +0 -210
- package/src/utils/cache.js +0 -297
- package/src/utils/env.js +0 -87
- package/src/utils/importhow.js +0 -52
- package/src/utils/index.js +0 -11
- package/src/utils/meta-extractor.js +0 -127
- package/types/bin/bertui.d.ts +0 -3
- package/types/bin/bertui.d.ts.map +0 -1
- package/types/error-overlay.d.ts +0 -2
- package/types/error-overlay.d.ts.map +0 -1
- package/types/index.d.ts +0 -26
- package/types/index.d.ts.map +0 -1
- package/types/scripts/fix-wasm-exports.d.ts +0 -2
- package/types/scripts/fix-wasm-exports.d.ts.map +0 -1
- package/types/src/analyzer/index.d.ts +0 -8
- package/types/src/analyzer/index.d.ts.map +0 -1
- package/types/src/build/compiler/file-transpiler.d.ts +0 -5
- package/types/src/build/compiler/file-transpiler.d.ts.map +0 -1
- package/types/src/build/compiler/index.d.ts +0 -12
- package/types/src/build/compiler/index.d.ts.map +0 -1
- package/types/src/build/compiler/route-discoverer.d.ts +0 -2
- package/types/src/build/compiler/route-discoverer.d.ts.map +0 -1
- package/types/src/build/compiler/router-generator.d.ts +0 -2
- package/types/src/build/compiler/router-generator.d.ts.map +0 -1
- package/types/src/build/css-builder.d.ts +0 -18
- package/types/src/build/css-builder.d.ts.map +0 -1
- package/types/src/build/generators/html-generator.d.ts +0 -2
- package/types/src/build/generators/html-generator.d.ts.map +0 -1
- package/types/src/build/generators/robots-generator.d.ts +0 -11
- package/types/src/build/generators/robots-generator.d.ts.map +0 -1
- package/types/src/build/generators/sitemap-generator.d.ts +0 -5
- package/types/src/build/generators/sitemap-generator.d.ts.map +0 -1
- package/types/src/build/image-optimizer.d.ts +0 -11
- package/types/src/build/image-optimizer.d.ts.map +0 -1
- package/types/src/build/processors/asset-processor.d.ts +0 -2
- package/types/src/build/processors/asset-processor.d.ts.map +0 -1
- package/types/src/build/processors/css-builder.d.ts +0 -2
- package/types/src/build/processors/css-builder.d.ts.map +0 -1
- package/types/src/build/server-island-validator.d.ts +0 -27
- package/types/src/build/server-island-validator.d.ts.map +0 -1
- package/types/src/build.d.ts +0 -5
- package/types/src/build.d.ts.map +0 -1
- package/types/src/cli.d.ts +0 -2
- package/types/src/cli.d.ts.map +0 -1
- package/types/src/client/compiler.d.ts +0 -16
- package/types/src/client/compiler.d.ts.map +0 -1
- package/types/src/client/fast-refresh.d.ts +0 -3
- package/types/src/client/fast-refresh.d.ts.map +0 -1
- package/types/src/client/hmr-runtime.d.ts +0 -4
- package/types/src/client/hmr-runtime.d.ts.map +0 -1
- package/types/src/compiler/index.d.ts +0 -8
- package/types/src/compiler/index.d.ts.map +0 -1
- package/types/src/compiler/router-generator-pure.d.ts +0 -2
- package/types/src/compiler/router-generator-pure.d.ts.map +0 -1
- package/types/src/compiler/transform.d.ts +0 -36
- package/types/src/compiler/transform.d.ts.map +0 -1
- package/types/src/config/defaultConfig.d.ts +0 -26
- package/types/src/config/defaultConfig.d.ts.map +0 -1
- package/types/src/config/index.d.ts +0 -3
- package/types/src/config/index.d.ts.map +0 -1
- package/types/src/config/loadConfig.d.ts +0 -2
- package/types/src/config/loadConfig.d.ts.map +0 -1
- package/types/src/css/index.d.ts +0 -6
- package/types/src/css/index.d.ts.map +0 -1
- package/types/src/css/processor.d.ts +0 -23
- package/types/src/css/processor.d.ts.map +0 -1
- package/types/src/dev.d.ts +0 -2
- package/types/src/dev.d.ts.map +0 -1
- package/types/src/hydration/index.d.ts +0 -33
- package/types/src/hydration/index.d.ts.map +0 -1
- package/types/src/image-optimizer/index.d.ts +0 -24
- package/types/src/image-optimizer/index.d.ts.map +0 -1
- package/types/src/images/index.d.ts +0 -12
- package/types/src/images/index.d.ts.map +0 -1
- package/types/src/images/processor.d.ts +0 -30
- package/types/src/images/processor.d.ts.map +0 -1
- package/types/src/layouts/index.d.ts +0 -28
- package/types/src/layouts/index.d.ts.map +0 -1
- package/types/src/loading/index.d.ts +0 -28
- package/types/src/loading/index.d.ts.map +0 -1
- package/types/src/logger/logger.d.ts +0 -30
- package/types/src/logger/logger.d.ts.map +0 -1
- package/types/src/middleware/index.d.ts +0 -61
- package/types/src/middleware/index.d.ts.map +0 -1
- package/types/src/router/Router.d.ts +0 -16
- package/types/src/router/Router.d.ts.map +0 -1
- package/types/src/router/SSRRouter.d.ts +0 -20
- package/types/src/router/SSRRouter.d.ts.map +0 -1
- package/types/src/router/index.d.ts +0 -3
- package/types/src/router/index.d.ts.map +0 -1
- package/types/src/scaffolder/index.d.ts +0 -14
- package/types/src/scaffolder/index.d.ts.map +0 -1
- package/types/src/serve.d.ts +0 -3
- package/types/src/serve.d.ts.map +0 -1
- package/types/src/server/dev-handler.d.ts +0 -13
- package/types/src/server/dev-handler.d.ts.map +0 -1
- package/types/src/server/dev-server-utils.d.ts +0 -6
- package/types/src/server/dev-server-utils.d.ts.map +0 -1
- package/types/src/server/dev-server.d.ts +0 -18
- package/types/src/server/dev-server.d.ts.map +0 -1
- package/types/src/server/hmr-handler.d.ts +0 -19
- package/types/src/server/hmr-handler.d.ts.map +0 -1
- package/types/src/server/index.d.ts +0 -4
- package/types/src/server/index.d.ts.map +0 -1
- package/types/src/server/request-handler.d.ts +0 -19
- package/types/src/server/request-handler.d.ts.map +0 -1
- package/types/src/server-islands/extractor.d.ts +0 -16
- package/types/src/server-islands/extractor.d.ts.map +0 -1
- package/types/src/server-islands/index.d.ts +0 -3
- package/types/src/server-islands/index.d.ts.map +0 -1
- package/types/src/utils/cache.d.ts +0 -52
- package/types/src/utils/cache.d.ts.map +0 -1
- package/types/src/utils/env.d.ts +0 -20
- package/types/src/utils/env.d.ts.map +0 -1
- package/types/src/utils/importhow.d.ts +0 -15
- package/types/src/utils/importhow.d.ts.map +0 -1
- package/types/src/utils/index.d.ts +0 -3
- package/types/src/utils/index.d.ts.map +0 -1
- package/types/src/utils/meta-extractor.d.ts +0 -13
- package/types/src/utils/meta-extractor.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,269 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bertui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Zero-config React framework powered by Bun. Minimal core, optional everything else.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[](https://bun.sh)
|
|
7
|
-
[](LICENSE)
|
|
5
|
+
## Install
|
|
8
6
|
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
7
|
```bash
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
```jsx
|
|
43
|
-
// Pure HTML — zero JS, zero React in the browser
|
|
44
|
-
export const render = "static"
|
|
13
|
+
## Optional packages
|
|
45
14
|
|
|
46
|
-
|
|
47
|
-
export const render = "server"
|
|
15
|
+
Install only what you need:
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
+
## Quick start
|
|
90
37
|
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
60
|
+
```ts
|
|
61
|
+
// Core
|
|
62
|
+
import { loadConfig, formatBytes } from 'bertui'
|
|
225
63
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
crawlDelay: 1,
|
|
229
|
-
},
|
|
64
|
+
// Router (client-side)
|
|
65
|
+
import { Router, Link, useRouter } from 'bertui/router'
|
|
230
66
|
|
|
231
|
-
|
|
232
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,118 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bertui",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
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.
|
|
7
|
-
"types": "./
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
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
|
-
"
|
|
65
|
-
"
|
|
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
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
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
|
-
"
|
|
81
|
-
"react": "
|
|
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
|
-
"
|
|
86
|
-
"@types/react
|
|
87
|
-
"
|
|
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
|
|
114
|
-
},
|
|
115
|
-
"engines": {
|
|
116
|
-
"bun": ">=1.0.0"
|
|
50
|
+
"url": "https://github.com/BunElysiaReact/BERTUI"
|
|
117
51
|
}
|
|
118
|
-
}
|
|
52
|
+
}
|
package/src/config.ts
ADDED
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'
|
package/src/optional.ts
ADDED
|
@@ -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
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.
|