Skip to content

BareJS v0.2.12

Latest

Choose a tag to compare

@xarhang xarhang released this 03 Dec 09:38
· 5 commits to main since this release

What's New in BareJS v0.2.12

Core Type Safety, Client Disconnect & Streaming RPC

  • Compile-Time Route Params & Return Inference: Added ExtractRouteParams<P> and typed (path, handler) overloads on BareJS and BareRouter so schema-less routes infer ctx.params and bareTreaty return types without TS7006 implicit any.
  • Client Disconnect AbortSignal (ctx.signal & ctx.onAbort()): Lazy, zero-overhead disconnect signal on Context and EdgeContext.
  • Compile-Time Typed SSE Streaming & Rich Type Transformer: ctx.sse<T>() returns SseResponse<T>, automatically unwrapped to AsyncIterable<T> in bareTreaty / bareClient with options.signal cancellation, plus opt-in bareTransformer (Date, Map, Set, BigInt, RegExp, URL; superjson-compatible).

3 New Zero-Dependency Optional Subpaths (0 bytes in core/edge)

  • barejs/otel (3.5 KB): OpenTelemetry OTLP/HTTP JSON (v1/traces) batch exporter (otel(), createOtlpExporter()) for Grafana Tempo, Datadog, Honeycomb, and Jaeger.
  • barejs/store (5.4 KB): Unified BareStore adapters (memoryStore, sqliteStore, upstashStore, kvStore) + middleware bridges (toRateLimitStore, toCacheStore, toIdempotencyStore) for distributed rateLimit(), cache(), idempotency(), and workflows.
  • barejs/workflow (5.0 KB): Durable, crash-resumable multi-step workflows (defineWorkflow, step.run, step.sleep, step.waitForEvent, sendEvent, resume) backed by BareStore.

Performance, Reliability & Docs

  • Single-Handler Async Fast-Path (Bun.peek): Eliminated redundant async wrapper Promises on single-handler routes (~25% faster Async Handler + Query Parsing, ~31% fewer allocations; BareJS now leads all 4 core benchmark scenarios by >10%).
  • Deno 2.x barejs/queue Fix & Multi-Runtime Release Gate: Fixed queue.drain() timer ref on Deno 2.x and gated publish.yml on full Bun + Node.js (22 & 24) + Deno (2.x) verification before OIDC npm publishing.
  • Expanded Docs & Examples: Doubled docs/reference.md, added docs/migration.md, docs/cookbook.md, 4 new runnable examples, and expanded llms-full.txt to 104 KB (537 tests / 7,097 assertions across 43 files).