barejs 0.2.1 → 0.2.4

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
@@ -40,9 +40,9 @@ app.listen(3000);
40
40
  - **O(1) JIT Router, Bun Native Routes & Pooling:** Compiles static routes into an inline `switch` fast-path and dynamic routes into a radix jump-table (`:params`, `*` wildcards, `BareRouter` sub-app mounting) with a lazy LIFO `Context` pool (`0..65536`) and dev-mode Use-After-Free Proxy guard. On Bun, `app.listen()` also offloads eligible middleware-free routes to `Bun.serve({ routes })` (with pure-static `Response` and `isTrulyZeroArg` fast-paths in `NODE_ENV=production`) while keeping full `fetch()` fallback parity.
41
41
  - **Unified Schema Validation:** Declarative `body`, `query`, `params`, `headers`, and `response` schemas with **TypeBox**, **Zod**, or **Native JSON Schema** — including auto-coercion, `stripUnknown` Mass-Assignment protection, `413` `maxBodySize` guards, and automatic secret-field stripping.
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
- - **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
- - **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** (`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**.
43
+ - **Batteries Included:** Auto-generated **OpenAPI 3.1** (with automatic `bearerAuth`/`basicAuth` security schemes) + 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`/`spa: true`), `app.derive`, `app.cron`, `app.useLog({ format: 'json' })`, `onRequest`/`onResponse` hooks, `app.listenCluster()`, and `healthcheck`.
44
+ - **Zero-Trust Security & Resilience:** Built-in `bareAuth` (HS256/RS256/ES256/JWKS + `revokeToken`), `basicAuth`, `hasRole`, `Hash` (Argon2id/bcrypt/scrypt), HMAC-signed cookies, `trustProxy` CIDR/IP allowlist, `cors`, `csrf`, `rateLimit`, `idempotency`, `circuitBreaker`, `createSingleflight`, `timeout`, `redisStore`, and `app.onDrain`.
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 with streaming backpressure & WS pub/sub), 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,12 +126,12 @@ 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.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> |
129
+ | **1. 100 Routes + Dynamic Params** | **`1.46 µs`**<br><sub>`p99: 8.20 µs`</sub> | `1.87 µs`<br><sub>`p99: 8.44 µs`</sub> | `4.45 µs`<br><sub>`p99: 18.55 µs`</sub> |
130
+ | **2. 10 Middlewares + Deep Path** | **`1.48 µs`**<br><sub>`p99: 8.21 µs`</sub> | `1.89 µs`<br><sub>`p99: 8.90 µs`</sub> | `4.13 µs`<br><sub>`p99: 14.78 µs`</sub> |
131
+ | **3. POST JSON + Schema Validation** | **`4.08 µs`**<br><sub>`p99: 14.60 µs`</sub> | `4.65 µs`<br><sub>`p99: 15.04 µs`</sub> | `5.28 µs`<br><sub>`p99: 18.34 µs`</sub> |
132
+ | **4. Async Handler + Query Parsing** | `2.34 µs`<br><sub>`p99: 10.40 µs`</sub> | `2.30 µs`<br><sub>`p99: 9.53 µs`</sub> | `3.17 µs`<br><sub>`p99: 13.02 µs`</sub> |
133
133
 
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`)
134
+ > Last Updated: 2026-11-26 (github action — `linux`, AMD EPYC 7763 64-Core Processor, Bun `1.4.5`, Elysia `1.4.21`, Hono `4.11.4`)
135
135
 
136
136
  <!-- MARKER: MULTI_BENCH_SUMMARY_END -->
137
137