barejs 0.1.63 → 0.2.1
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 +5 -5
- package/dist/index.js +147 -147
- package/dist/node.js +149 -149
- package/dist/types/core/bare.d.ts +2 -0
- package/dist/types/runtime/types.d.ts +2 -0
- package/dist/types/runtime/uws.d.ts +13 -0
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/src/core/bare.ts +68 -1
- package/src/runtime/node.ts +10 -0
- package/src/runtime/types.ts +2 -0
- package/src/runtime/uws.ts +554 -0
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ app.listen(3000);
|
|
|
42
42
|
- **End-to-End Type Safety:** `bareClient(app)` provides compile-time route, param, query, body, and response inference over HTTP or zero-network in-memory calls.
|
|
43
43
|
- **Batteries Included:** Auto-generated **OpenAPI 3.1** + Scalar UI (`app.docs`), **JSON-RPC 2.0** (`app.rpc`), **WebSockets** (`app.ws`), **SSE** (`ctx.sse`), **Streaming Uploads** (`ctx.upload` / `ctx.uploadStream`), **Compression** (`compress` — `zstd`/`br`/`gzip`), **Static Files** (`staticFile` with ETag/`304`/Range `206`), `app.derive`, `app.cron`, `logger`, and `healthcheck`.
|
|
44
44
|
- **Zero-Trust Security & Resilience:** Built-in `bareAuth` (HS256/RS256/ES256/JWKS + `revokeToken`), `basicAuth`, `hasRole`, `Hash` (Argon2id/bcrypt/scrypt), HMAC-signed cookies, `cors`, `csrf`, `rateLimit`, `idempotency`, `circuitBreaker`, `createSingleflight`, `timeout`, `redisStore`, and `app.onDrain`.
|
|
45
|
-
- **Multi-Runtime & Web Standard Interop:** Zero-dep native drivers for **Bun
|
|
45
|
+
- **Multi-Runtime & Web Standard Interop:** Zero-dep native drivers for **Bun** (`Bun.serve({ routes })`), **Node.js >= 20** (`barejs/node` with built-in RFC 6455 WebSockets & `scrypt`, plus optional `uWebSockets.js` auto-detection or `{ engine: 'uws' }`), and **Deno >= 2.0** (`Deno.upgradeWebSocket`). Standard `Request`/`Response` (`ctx.req`) works directly with **Better-Auth**, **Auth0**, **Clerk**, **GraphQL Yoga**, **Sentry**, and **OpenTelemetry**.
|
|
46
46
|
|
|
47
47
|
---
|
|
48
48
|
|
|
@@ -126,10 +126,10 @@ Measured in-process on **Bun** with [`mitata`](https://github.com/evanwash/mitat
|
|
|
126
126
|
|
|
127
127
|
| Scenario | **BareJS** | **ElysiaJS** | **Hono** |
|
|
128
128
|
| :--- | :---: | :---: | :---: |
|
|
129
|
-
| **1. 100 Routes + Dynamic Params** | **`1.
|
|
130
|
-
| **2. 10 Middlewares + Deep Path** | **`1.
|
|
131
|
-
| **3. POST JSON + Schema Validation** | `4.
|
|
132
|
-
| **4. Async Handler + Query Parsing** |
|
|
129
|
+
| **1. 100 Routes + Dynamic Params** | **`1.47 µs`**<br><sub>`p99: 8.16 µs`</sub> | `1.94 µs`<br><sub>`p99: 8.89 µs`</sub> | `3.83 µs`<br><sub>`p99: 14.60 µs`</sub> |
|
|
130
|
+
| **2. 10 Middlewares + Deep Path** | **`1.44 µs`**<br><sub>`p99: 7.16 µs`</sub> | `1.98 µs`<br><sub>`p99: 8.89 µs`</sub> | `4.11 µs`<br><sub>`p99: 14.88 µs`</sub> |
|
|
131
|
+
| **3. POST JSON + Schema Validation** | `4.18 µs`<br><sub>`p99: 14.68 µs`</sub> | `4.54 µs`<br><sub>`p99: 14.16 µs`</sub> | `4.58 µs`<br><sub>`p99: 15.66 µs`</sub> |
|
|
132
|
+
| **4. Async Handler + Query Parsing** | **`2.00 µs`**<br><sub>`p99: 8.61 µs`</sub> | `2.30 µs`<br><sub>`p99: 9.53 µs`</sub> | `3.20 µs`<br><sub>`p99: 12.85 µs`</sub> |
|
|
133
133
|
|
|
134
134
|
> Last Updated: 2026-11-25 (github action — `linux`, AMD EPYC 7763 64-Core Processor, Bun `1.4.5`, Elysia `1.4.21`, Hono `4.11.4`)
|
|
135
135
|
|