barejs 0.1.35 → 0.1.37
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 +7 -14
- package/dist/index.js +58 -58
- package/dist/types/context.d.ts +1 -0
- package/dist/types/index.d.ts +21 -1
- package/dist/types/router.d.ts +6 -19
- package/dist/types/validators.d.ts +21 -5
- package/package.json +68 -71
- package/src/context.ts +1 -0
- package/src/index.ts +47 -7
- package/src/router.ts +9 -32
- package/src/validators.ts +60 -27
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<br />
|
|
3
|
-
|
|
3
|
+
<h1>Bare<span style="color: #F7DF1E;">JS</span></h1>
|
|
4
4
|
<p><strong>The "Metal" of Web Frameworks</strong></p>
|
|
5
5
|
<p><i>An ultra-high-performance web engine built for Bun, architected strictly for Mechanical Sympathy.</i></p>
|
|
6
6
|
|
|
@@ -39,9 +39,9 @@ BareJS leads in complex, real-world scenarios. We test using a **"Real-World" St
|
|
|
39
39
|
|
|
40
40
|
| Framework | Latency | Speed |
|
|
41
41
|
| :--- | :--- | :--- |
|
|
42
|
-
| **BareJS** | **1.
|
|
43
|
-
| Elysia | 1.
|
|
44
|
-
| Hono | 8.
|
|
42
|
+
| **BareJS** | **1.15 µs** | **Baseline** |
|
|
43
|
+
| Elysia | 1.60 µs | 1.39x slower |
|
|
44
|
+
| Hono | 8.81 µs | 7.63x slower |
|
|
45
45
|
|
|
46
46
|
> Last Updated: 2026-01-09 (BareJS Ultra-Accuracy Suite)
|
|
47
47
|
|
|
@@ -82,16 +82,9 @@ Use `BareRouter` for modularity and nesting.
|
|
|
82
82
|
import { BareJS, BareRouter } from 'barejs';
|
|
83
83
|
|
|
84
84
|
const app = new BareJS();
|
|
85
|
-
const api = new BareRouter("/api");
|
|
85
|
+
const api = new BareRouter("/api/v1");
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
api.group("/v1", (v1) => {
|
|
89
|
-
v1.get("/status", (ctx) => ({ status: "ok" }));
|
|
90
|
-
|
|
91
|
-
v1.group("/auth", (auth) => {
|
|
92
|
-
auth.post("/login", (ctx) => "OK");
|
|
93
|
-
});
|
|
94
|
-
});
|
|
87
|
+
api.get("/status", (ctx) => ({ status: "ok" }));
|
|
95
88
|
|
|
96
89
|
app.use(api); // Result: /api/v1/status
|
|
97
90
|
```
|
|
@@ -100,7 +93,7 @@ app.use(api); // Result: /api/v1/status
|
|
|
100
93
|
Full RFC 7515 compliant JWT support and secure password utilities.
|
|
101
94
|
|
|
102
95
|
```typescript
|
|
103
|
-
import { bareAuth, createToken, Password } from 'barejs';
|
|
96
|
+
import { bareAuth, createToken, Password, type Context } from 'barejs';
|
|
104
97
|
|
|
105
98
|
const SECRET = "your-secret";
|
|
106
99
|
|