Skip to content

BareJS v0.2.11

Choose a tag to compare

@xarhang xarhang released this 03 Dec 07:09
· 22 commits to main since this release

What's New in BareJS v0.2.11

Core DX & Reliability

  • Scoped Request Cleanup (ctx.defer() & Symbol.asyncDispose / Symbol.dispose): LIFO, error-isolated cleanup callbacks on Context / EdgeContext (0 ns overhead when unused) + automatic disposal of derive() / macro().resolve() resources.
  • RFC 9457 Problem Details (ctx.problem()): Standard application/problem+json error responses with auto title/instance, extension fields, and CORS/cookie preservation across BareJS and BareEdge.
  • Plugin & Sub-App Deduplication: name + seed deduplication across BareRouter.use(), BareRouter.route(), and BareEdge.use().

6 Zero-Dependency Optional Subpaths (0 bytes in core/edge when unused)

  • barejs/mcp (11 KB): 1-line MCP 2025-03-26 Streamable HTTP server auto-generated from routes & schemas with in-memory app.fetch() execution.
  • barejs/devtools (8.4 KB): Live dark-mode Request Inspector (/__bare) with SSE waterfall, p50/p95/p99 latency profiler, redacted headers, SSRF-safe replay, and auto-disable in production.
  • barejs/queue (2.8 KB): Bounded concurrency, delayed jobs, exponential backoff retries, Dead-Letter Queue, graceful drain()/stop(), and compile-time typed job name & payload inference via chained .process() or createQueue<JobMap>().
  • barejs/webhooks (3.7 KB): Web Crypto HMAC-SHA256 verifyWebhook() with replay protection, key rotation, and retrying sendWebhook().
  • barejs/metrics (3.5 KB): Prometheus /metrics exporter with ID/UUID path normalization and custom counters/gauges.
  • barejs/ai (2.5 KB): Typed LLM SSE streaming (aiStream) with client-disconnect AbortSignal + parseOpenAISSE().

Verification

  • 532 tests / 7,044 assertions across 42 files passing + strict tsc --noEmit + docs drift check + clean-tarball consumer E2E.
  • Auto-published to npm with Sigstore Provenance via GitHub Actions OIDC Trusted Publishing.