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.
- package/README.md +45 -196
- 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 -151
- 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 -12
- package/src/build.js +0 -266
- 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,222 +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)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
5
|
+
## Install
|
|
12
6
|
|
|
13
7
|
```bash
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
## Optional packages
|
|
119
14
|
|
|
120
|
-
|
|
121
|
-
// src/pages/blog/[slug].tsx
|
|
122
|
-
import { useRouter } from 'bertui/router';
|
|
15
|
+
Install only what you need:
|
|
123
16
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
24
|
+
Then enable in `bertui.config.js`:
|
|
131
25
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
```javascript
|
|
26
|
+
```js
|
|
135
27
|
export default {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
36
|
+
## Quick start
|
|
169
37
|
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
##
|
|
58
|
+
## Imports
|
|
209
59
|
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
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.
|