Skip to content

BareJS v0.2.6

Choose a tag to compare

@xarhang xarhang released this 30 Nov 08:40
· 108 commits to main since this release

What's New in v0.2.6

Added

  • Per-Status Response Schemas (response: { 200, 400, 404 }): Per-status secret stripping, full OpenAPI 3.1 multi-status responses, and typed data / error unions in bareClient().safe and bareTreaty().
  • Strict Compile-Time bareTreaty Inference: Pure type-level TreatyTree<Routes> (0 runtime overhead) for bareTreaty(app) and bareTreaty<typeof app>(url).
  • Declarative Route app.macro(): beforeHandle + resolve with per-route TypeScript inference, automatic pool cleanup, and zero overhead on unused routes.
  • Fail-Closed WebSocket Schema Validation: Optional body, query, headers, and response schemas on app.ws() across Bun, Node.js, uWebSockets.js, Deno, and in-memory clients (zero overhead when omitted).
  • Zero-Dep W3C tracing() & serverTiming(): Edge-safe traceparent + Server-Timing middleware with onSpan hook.

Performance

  • 4x Smaller Edge Bundle: dist/edge.js shrunk from 201 KB → 50 KB (zero node:* imports).
  • O(1) Grouped Radix Dispatch: Replaced double switch in RadixNode.jitCompile() with a single Object.create(null) O(1) lookup table.
  • 7/7 Benchmark Sweep: Faster than ElysiaJS & Hono on all 7 CI scenarios (both mean and p99) under NODE_ENV=production.

Tests

  • 489 pass / 0 fail / 6,789 assertions across 35 files.