bertui 1.2.1 → 1.2.3

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 CHANGED
@@ -1,267 +1,222 @@
1
- markdown
1
+ # BertUI ⚡
2
2
 
3
- # BertUI v1.1.7 ⚡🏝️🦀
3
+ **Zero-config React framework powered by Bun. File-based routing, Server Islands, and a build system that gets out of your way.**
4
4
 
5
- **The fastest React frontend framework. Now with Rust-powered image optimization.**
6
-
7
- Zero configuration. 494ms dev server. 265ms builds. Perfect SEO with Server Islands.
8
- **78% smaller images. 20x faster than Sharp. Zero Rust required.**
9
-
10
- [![Production Ready](https://img.shields.io/badge/status-production--ready-brightgreen)](https://github.com/BunElysiaReact/BERTUI)
11
- [![Version](https://img.shields.io/badge/version-1.1.7-blue)](https://www.npmjs.com/package/bertui)
12
- [![Bun Powered](https://img.shields.io/badge/runtime-Bun-f472b6)](https://bun.sh)
13
- [![Rust](https://img.shields.io/badge/optimizer-Rust-WASM-orange)](https://www.rust-lang.org)
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)
14
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
15
8
 
9
+ ---
16
10
 
17
- # One command. Zero config. Instant speed. 78% smaller images.
18
- bunx create-bertui my-app && cd my-app && bun run dev
19
-
20
- 🦀 New in v1.1.7: Rust Image Optimization
21
-
22
- BertUI now ships with a pre-compiled WASM image optimizer written in Rust.
23
- Before (v1.1.6) After (v1.1.7) Gain
24
- ❌ No optimization ✅ PNG: 78% smaller 3.6x smaller
25
- ❌ Just copy ✅ JPEG: 75% smaller 4x smaller
26
- ❌ Large images ✅ WebP: 70% smaller 3.3x smaller
27
- ❌ Slow builds ✅ 20x faster than Sharp 2,000% faster
11
+ ## Quick Start
28
12
 
29
- And the best part? Users don't need Rust installed. The optimizer is pre-compiled to WASM and ships with BertUI.
30
- js
31
-
32
- // This just works. No Rust installation. No configuration.
33
- import { optimizeImage } from 'bertui/image-optimizer';
13
+ ```bash
14
+ bunx create-bertui my-app
15
+ cd my-app
16
+ bun run dev
17
+ ```
34
18
 
35
- const buffer = await Bun.file('image.png').arrayBuffer();
36
- const result = await optimizeImage(buffer, { format: 'png', quality: 80 });
37
- // ✅ 78% smaller image in result.data
19
+ ---
38
20
 
39
- Automatic fallback: If WASM isn't available (edge cases), BertUI silently falls back to copying. Your builds never break.
40
- 🎯 What BertUI Is
21
+ ## What's New in v1.2.2
41
22
 
42
- A frontend framework that gives you everything React should have had from day one:
23
+ ### Import Aliases (`importhow`)
24
+ No more `../../../` chains. Define aliases in your config and import cleanly from anywhere.
43
25
 
44
- ⚡ Sub-500ms dev starts - Faster than Vite, Next.js, and everything else
26
+ ```javascript
27
+ // bertui.config.js
28
+ export default {
29
+ importhow: {
30
+ amani: '../components',
31
+ ui: '../components/ui',
32
+ }
33
+ }
34
+ ```
45
35
 
46
- 🏗️ Sub-300ms builds - Production builds in the time others compile one file
36
+ ```javascript
37
+ // anywhere in your project
38
+ import Button from 'amani/button';
39
+ import Card from 'ui/card';
40
+ ```
47
41
 
48
- 🏝️ Server Islands - Optional SSG for perfect SEO (one line of code)
42
+ Aliases are resolved at compile time zero runtime overhead.
49
43
 
50
- 🦀 Rust image optimization - 78% smaller PNGs, pre-compiled WASM, zero Rust required
44
+ ### Node Modules Just Work
45
+ Install a package, import it. That's it.
51
46
 
52
- 📁 File-based routing - Just create files in pages/, that's it
47
+ ```javascript
48
+ import { format } from 'date-fns';
49
+ import confetti from 'canvas-confetti';
50
+ ```
53
51
 
54
- 🗺️ Auto SEO - Sitemap and robots.txt generated automatically
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.
55
53
 
56
- 📘 TypeScript ready - Full type definitions, zero setup required
54
+ ### CLI New Look
55
+ The build and dev output is now compact and step-based instead of verbose line-by-line logs.
57
56
 
58
- 🎨 CSS built-in - Global styles with LightningCSS optimization
57
+ ```
58
+ ██████╗ ███████╗██████╗ ████████╗██╗ ██╗██╗
59
+ ██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██║ ██║██║
60
+ ██████╔╝█████╗ ██████╔╝ ██║ ██║ ██║██║
61
+ ██╔══██╗██╔══╝ ██╔══██╗ ██║ ██║ ██║██║
62
+ ██████╔╝███████╗██║ ██║ ██║ ╚██████╔╝██║
63
+ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
64
+ by Pease Ernest · BUILD
59
65
 
60
- 🔥 30ms HMR - Instant hot reloading that actually works
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
+ ```
61
74
 
62
- No webpack config. No babel setup. No framework fatigue. Just React, done right.
63
- ⚡ Performance That Matters
75
+ Debug logs are written silently to `.bertui/dev.log`.
64
76
 
65
- Real benchmarks on a 7-year-old laptop (Intel i3-2348M, 7.6GB RAM):
66
- Metric BertUI 1.1.7 Vite Next.js Your Gain
67
- Dev Server 494ms 713ms 2,100ms 1.4-4.3x faster ⚡
68
- Prod Build 265ms 4,700ms 8,400ms 18-32x faster ⚡
69
- Bundle Size 100KB 220KB 280KB 2.2-2.8x smaller ⚡
70
- HMR Speed 30ms 85ms 120ms 2.8-4x faster ⚡
71
- PNG Optimization 78% smaller 0% 0% 78% smaller 🦀
72
- JPEG Optimization 75% smaller 0% 0% 75% smaller 🦀
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.
73
79
 
74
- If BertUI is this fast on old hardware, imagine what it does on yours. 🚀
75
- 🏝️ Server Islands: Perfect SEO, Zero Complexity
80
+ ---
76
81
 
77
- The problem: Every React framework makes you choose:
82
+ ## Features
78
83
 
79
- Vite: Fast dev, ❌ terrible SEO (client-only)
84
+ ### File-Based Routing
80
85
 
81
- ✅ Next.js: Good SEO, ❌ slow builds + server required
86
+ ```
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
+ ```
82
92
 
83
- Gatsby: Perfect SEO, ❌ 45-second builds
93
+ ### Server Islands
84
94
 
85
- BertUI's solution: Server Islands (optional SSG)
86
- jsx
95
+ Add one line to opt a page into static generation at build time.
87
96
 
97
+ ```jsx
88
98
  // src/pages/about.jsx
89
-
90
- // 🏝️ Add ONE line to enable static generation
91
99
  export const render = "server";
92
-
93
- // 🎯 Optional: Add SEO metadata
94
100
  export const title = "About Us";
95
- export const description = "Learn about our team";
96
101
 
97
- // ⚛️ Write normal React (no hooks, no event handlers)
98
102
  export default function About() {
99
103
  return (
100
104
  <div>
101
105
  <h1>About Us</h1>
102
- <p>This page is pre-rendered as static HTML!</p>
106
+ <p>Pre-rendered as static HTML at build time.</p>
103
107
  </div>
104
108
  );
105
109
  }
110
+ ```
106
111
 
107
- At build time:
108
-
109
- Generates static HTML for instant loading
110
-
111
- ✅ Auto-adds to sitemap.xml
112
-
113
- ✅ Perfect SEO without SSR complexity
114
-
115
- ✅ Still builds in 265ms
116
-
117
- 🦀 Image Optimization (Just Works)
118
-
119
- No configuration. No Rust installation. Just smaller images.
120
- bash
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
121
115
 
122
- # BertUI automatically optimizes images in src/images/
123
- bun run build
116
+ ### TypeScript
124
117
 
125
- text
118
+ `.tsx` and `.ts` files work with no setup. Mix them freely with `.jsx`.
126
119
 
127
- 📦 Building with Rust image optimizer...
128
- logo.png: 245KB → 54KB (78% saved)
129
- hero.jpg: 1.2MB 312KB (75% saved)
130
- ✓ icon.webp: 89KB → 26KB (70% saved)
131
- ✅ Optimized 12 images, saved 3.4MB
132
-
133
- Or use the API directly:
134
- js
120
+ ```typescript
121
+ // src/pages/blog/[slug].tsx
122
+ import { useRouter } from 'bertui/router';
135
123
 
136
- import { optimizeImage } from 'bertui/image-optimizer';
124
+ export default function BlogPost() {
125
+ const { params } = useRouter();
126
+ return <h1>Post: {params.slug}</h1>;
127
+ }
128
+ ```
137
129
 
138
- // Single image
139
- const result = await optimizeImage(buffer, {
140
- format: 'png',
141
- quality: 80 // 0-100, default 80
142
- });
130
+ ### SEO
143
131
 
144
- // Batch processing
145
- const results = await optimizeImagesBatch(images, 'webp');
132
+ `sitemap.xml` and `robots.txt` are generated automatically from your routes. Requires `baseUrl` in config.
146
133
 
147
- 📦 Installation
148
- bash
134
+ ```javascript
135
+ export default {
136
+ baseUrl: 'https://example.com',
137
+ robots: {
138
+ disallow: ['/admin'],
139
+ crawlDelay: 1,
140
+ }
141
+ }
142
+ ```
149
143
 
150
- # Create new app
151
- bunx create-bertui my-app
144
+ ### CSS
152
145
 
153
- # Start development
154
- cd my-app
155
- bun run dev
146
+ Put your styles in `src/styles/`. They are combined and minified with LightningCSS into a single `bertui.min.css`.
156
147
 
157
- # Build for production (with image optimization)
158
- bun run build
148
+ ---
159
149
 
160
- 30 seconds from zero to running. No configuration required.
161
- 📁 Project Structure
162
- text
150
+ ## Project Structure
163
151
 
152
+ ```
164
153
  my-app/
165
154
  ├── src/
166
- │ ├── pages/
167
- ├── index.jsx # Route: /
168
- │ ├── about.jsx # Route: /about
169
- │ │ └── blog/[slug].jsx # Route: /blog/:slug
170
- ├── components/ # Your React components
171
- │ ├── styles/
172
- │ └── global.css # Automatically imported
173
- ├── images/ # 🦀 Auto-optimized at build time
174
- │ │ ├── logo.png
175
- │ │ └── hero.jpg
176
- │ └── pages/ # File-based routing
177
- ├── public/ # Static assets
178
- ├── dist/ # Production build
179
- │ ├── sitemap.xml # Auto-generated
180
- │ ├── robots.txt # Auto-generated
181
- │ └── images/ # 🦀 Optimized images
182
- └── package.json
183
-
184
- 🛣️ File-Based Routing
185
-
186
- Just create files. BertUI handles the rest.
187
- text
188
-
189
- src/pages/index.jsx → /
190
- src/pages/about.jsx → /about
191
- src/pages/blog/index.jsx → /blog
192
- src/pages/blog/[slug].jsx → /blog/:slug
193
-
194
- Dynamic routes with TypeScript:
195
- typescript
196
-
197
- // src/pages/blog/[slug].tsx
198
- import { useRouter } from 'bertui/router';
199
-
200
- interface Params {
201
- slug: string;
202
- }
203
-
204
- export default function BlogPost() {
205
- const { params } = useRouter<Params>();
206
- return <h1>Post: {params.slug}</h1>;
207
- }
208
-
209
- ⚙️ Configuration (Optional)
210
- javascript
211
-
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
+ ---
167
+
168
+ ## Configuration
169
+
170
+ ```javascript
212
171
  // bertui.config.js
213
172
  export default {
214
- siteName: "My Site",
215
- baseUrl: "https://example.com", // Required for sitemap
216
-
217
- // Image optimization settings
218
- imageOptimizer: {
219
- quality: 80, // JPEG/PNG quality (0-100)
220
- webpQuality: 75, // WebP quality (0-100)
221
- stripMetadata: true // Remove EXIF data
173
+ siteName: 'My Site',
174
+ baseUrl: 'https://example.com',
175
+
176
+ importhow: {
177
+ ui: '../components/ui',
222
178
  },
223
-
224
- robots: {
225
- disallow: ["/admin", "/api"],
226
- crawlDelay: 1
227
- }
228
- };
229
179
 
230
- 📊 Comparison
231
- Feature BertUI 1.1.7 Next.js Vite Remix
232
- Dev Server 494ms 2.1s 713ms 1.8s
233
- Prod Build 265ms 8.4s 4.7s 6.2s
234
- Bundle Size 100KB 280KB 220KB 250KB
235
- Image Optimization ✅ 78% smaller ❌ No ❌ No ❌ No
236
- Server Islands ✅ Built-in ❌ No ❌ No ❌ No
237
- Auto SEO ✅ Yes ⚠️ Manual ❌ No ⚠️ Manual
238
- TypeScript ✅ No setup ✅ Config needed ✅ Config needed ✅ Config needed
239
- Rust Required ❌ NO N/A N/A N/A
240
- 🚀 Coming Soon
180
+ robots: {
181
+ disallow: ['/admin'],
182
+ crawlDelay: 1,
183
+ },
241
184
 
242
- Future packages (in development):
185
+ meta: {
186
+ title: 'My Site',
187
+ description: 'Built with BertUI',
188
+ themeColor: '#000000',
189
+ },
190
+ }
191
+ ```
243
192
 
244
- 🔄 bertui-elysia - Full-stack addon (API routes, auth, database)
193
+ ---
245
194
 
246
- 🎨 bertui-animation - GPU-accelerated animations (Zig)
195
+ ## Performance
247
196
 
248
- 📊 bertui-charts - High-performance charts (Rust)
197
+ Benchmarks on an Intel i3-2348M, 7.6GB RAM.
249
198
 
250
- 🙏 Credits
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 |
251
205
 
252
- Runtime: Bun - The fastest JavaScript runtime
206
+ ---
253
207
 
254
- Server: Elysia - Fast and elegant web framework
208
+ ## Coming Soon
255
209
 
256
- CSS: LightningCSS - Lightning-fast CSS processing
210
+ - `bertui-elysia` API routes, auth, database
211
+ - `bertui-animate` — GPU-accelerated animations
257
212
 
258
- Image Optimization: oxipng, mozjpeg, webp - Rust libraries compiled to WASM
213
+ ---
259
214
 
260
- <div align="center">
215
+ ## Credits
261
216
 
262
- Made with ⚡🦀🏝️ by the BertUI team
217
+ - Runtime: [Bun](https://bun.sh)
218
+ - CSS: [LightningCSS](https://lightningcss.dev)
263
219
 
264
- v1.1.7 - Rust image optimization, zero Rust required
220
+ ---
265
221
 
266
- Website GitHub • npm
267
- </div> ```
222
+ Made by Pease Ernest
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // bertui/index.js - v1.2.0 with all features
1
+ // bertui/index.js - v1.3.0
2
2
 
3
3
  // Compiler
4
4
  export { compileProject, compileFile } from './src/client/compiler.js';
@@ -33,7 +33,7 @@ export { default as logger } from './src/logger/logger.js';
33
33
  // CLI
34
34
  export { program } from './src/cli.js';
35
35
 
36
- // ✅ NEW: Middleware system
36
+ // ✅ Middleware system
37
37
  export {
38
38
  MiddlewareManager,
39
39
  loadMiddleware,
@@ -41,7 +41,7 @@ export {
41
41
  MiddlewareContext,
42
42
  } from './src/middleware/index.js';
43
43
 
44
- // ✅ NEW: Layout system
44
+ // ✅ Layout system
45
45
  export {
46
46
  discoverLayouts,
47
47
  compileLayouts,
@@ -50,7 +50,7 @@ export {
50
50
  injectLayoutsIntoRouter,
51
51
  } from './src/layouts/index.js';
52
52
 
53
- // ✅ NEW: Loading states
53
+ // ✅ Loading states
54
54
  export {
55
55
  discoverLoadingComponents,
56
56
  compileLoadingComponents,
@@ -59,7 +59,7 @@ export {
59
59
  DEFAULT_LOADING_HTML,
60
60
  } from './src/loading/index.js';
61
61
 
62
- // ✅ NEW: Partial hydration
62
+ // ✅ Partial hydration
63
63
  export {
64
64
  needsHydration,
65
65
  getInteractiveFeatures,
@@ -68,10 +68,10 @@ export {
68
68
  logHydrationReport,
69
69
  } from './src/hydration/index.js';
70
70
 
71
- // ✅ NEW: Bundle analyzer
71
+ // ✅ Bundle analyzer
72
72
  export { analyzeBuild } from './src/analyzer/index.js';
73
73
 
74
- // ✅ NEW: CLI scaffolder
74
+ // ✅ CLI scaffolder
75
75
  export { scaffold, parseCreateArgs } from './src/scaffolder/index.js';
76
76
 
77
77
  // Server
@@ -91,5 +91,13 @@ export {
91
91
  validateServerIsland,
92
92
  } from './src/server-islands/index.js';
93
93
 
94
+ // ✅ NEW: importhow — alias/import resolution system
95
+ // Bunny and external tools can use these to apply the same alias logic
96
+ export {
97
+ buildAliasMap,
98
+ rewriteAliasImports,
99
+ getAliasDirs,
100
+ } from './src/utils/importhow.js';
101
+
94
102
  // Version
95
- export const version = '1.2.0';
103
+ export const version = '1.2.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bertui",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Lightning-fast React dev server powered by Bun - Now with Rust image optimization (WASM, no Rust required for users)",
5
5
  "type": "module",
6
6
  "main": "./index.js",