Repository navigation
Releases
Releases · xarhang/bareJS
BareJS v0.2.12
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 onBareJSandBareRouterso schema-less routes inferctx.paramsandbareTreatyreturn types withoutTS7006implicitany. - Client Disconnect
AbortSignal(ctx.signal&ctx.onAbort()): Lazy, zero-overhead disconnect signal onContextandEdgeContext. - Compile-Time Typed SSE Streaming & Rich Type Transformer:
ctx.sse<T>()returnsSseResponse<T>, automatically unwrapped toAsyncIterable<T>inbareTreaty/bareClientwithoptions.signalcancellation, plus opt-inbareTransformer(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): UnifiedBareStoreadapters (memoryStore,sqliteStore,upstashStore,kvStore) + middleware bridges (toRateLimitStore,toCacheStore,toIdempotencyStore) for distributedrateLimit(),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 byBareStore.
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/queueFix & Multi-Runtime Release Gate: Fixedqueue.drain()timer ref on Deno 2.x and gatedpublish.ymlon full Bun + Node.js (22 & 24) + Deno (2.x) verification before OIDC npm publishing. - Expanded Docs & Examples: Doubled
docs/reference.md, addeddocs/migration.md,docs/cookbook.md, 4 new runnable examples, and expandedllms-full.txtto104 KB(537 tests / 7,097 assertions across 43 files).
BareJS v0.2.11
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 onContext/EdgeContext(0 ns overhead when unused) + automatic disposal ofderive()/macro().resolve()resources. - RFC 9457 Problem Details (
ctx.problem()): Standardapplication/problem+jsonerror responses with autotitle/instance, extension fields, and CORS/cookie preservation acrossBareJSandBareEdge. - Plugin & Sub-App Deduplication:
name+seeddeduplication acrossBareRouter.use(),BareRouter.route(), andBareEdge.use().
6 Zero-Dependency Optional Subpaths (0 bytes in core/edge when unused)
barejs/mcp(11 KB): 1-line MCP2025-03-26Streamable HTTP server auto-generated from routes & schemas with in-memoryapp.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, gracefuldrain()/stop(), and compile-time typed job name & payload inference via chained.process()orcreateQueue<JobMap>().barejs/webhooks(3.7 KB): Web Crypto HMAC-SHA256verifyWebhook()with replay protection, key rotation, and retryingsendWebhook().barejs/metrics(3.5 KB): Prometheus/metricsexporter with ID/UUID path normalization and custom counters/gauges.barejs/ai(2.5 KB): Typed LLM SSE streaming (aiStream) with client-disconnectAbortSignal+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.
BareJS v0.2.10
Security & Bug Fixes
- Zero-dependency
barejs/edgebundle (~35 KB, zerozod/@sinclair/typeboximports) - P0
cache()prePipeline ordering (never bypassesbareAuth/cors/rateLimit) & skips cachingSet-Cookie/private/no-store - P0 Bun/uWS native route anti-shadowing for auth-protected routes
- P0 uWS Tier 1 abort safety,
Set-Cookiededuplication, and400 Bad Requestguard on malformedHost/URL across Node, uWS, and AWS Lambda - P1/P2 fixes across CSRF CIDR allowlist,
tracing()/serverTiming(),jsxRAW_BRAND& nested<Suspense>,BareEdgeplugins/headers/trailing-slash,compress()binary MIME filter,etag()304 CORS retention,ctx.sse()cleanup,app.docs()prefix,group()WS merge,toSSG()traversal guard, and.d.tsfixes
Performance
- Hot-path optimizations across Core,
BareEdge,bareAuthHS256,rateLimit,cors,validators,etag(Bun.hash),cache,compress, andlogger(+5% to +95% faster across production workloads)
Quality & CI
- Added
typecheck,test:docs,test:consumer(clean tarball + stricttsc --noEmit+ live full-system E2E), upgraded CI to Node 22/24 &actions/*@v7, and enabled npm OIDC Trusted Publishing (520 tests / 6,963 assertions).
BareJS v0.2.9
Highlights
Bug Fixes (P0)
- JIT
app.derive()Multi-Route Cleanup: Fixeddelete ctx[...]→delete rawCtx[...]in generated_rel(rawCtx, _uaf)helper for apps with 20+ routes. app.macro()Insideapp.group(): Fixed_createGroupRouterso grouped & nested routes inherit and enforce all registered macros.- Chainable
app.setNotFound(): Now returnsthisfor fluent chaining.
New Features
- Meta Framework Integrations (
prefix,.basePath(), safeapp.fetch): Directexport const GET = app.fetchsupport for Next.js App Router, Astro, SvelteKit, Nuxt 3, Remix, and TanStack Start on bothBareJSandBareEdge. - Official AI Agent Skill (
skills/barejs/SKILL.md): Install viabunx skills add xarhang/bareJS/npx skills add xarhang/bareJS. - Verified: 511 tests / 6,918 assertions across 38 files passing in CI (Bun, Node.js 20 & 22, Deno 2).
BareJS v0.2.8
Highlights
- Optional & Regex-Constrained Route Parameters: Registration-time expansion for
:param?(0 ns runtime overhead) and inline JIT-compiled:id{[0-9]+}with fall-through to generic params. - Zero-Bloat Optional Subpaths (0 bytes in core/edge):
barejs/html(1.3 KB): XSS-safehtmltagged template +raw()+escapeHtml().barejs/etag(2.4 KB): Edge-safe dynamicetag()middleware (weak FNV-1a / strong SHA-256 +304 Not Modified).barejs/cache(2.2 KB): Edge-safecache()middleware (Cache-Control,Vary, Web Cache API + customCacheLikestore).barejs/jsx&barejs/jsx-runtime(4.5 KB): Zero-dep JSX/TSX SSR with async components & streaming<Suspense>.barejs/ssg(2.1 KB): Build-time Static Site Generator (toSSG).barejs/aws-lambda(3.0 KB),barejs/cloudflare-pages(768 B),barejs/netlify(752 B).
- Examples & AI/SEO Discovery: Added
examples/starters, restructuredREADME.md&llms.txt, auto-generatedllms-full.txt,robots.txt,sitemap.xml, and JSON-LD. - Verified: 502 tests / 6,880 assertions across 37 files passing in CI (Bun, Node.js 20 & 22, Deno 2).
BareJS v0.2.7
What's New in v0.2.7
Added
- Ergonomic
file()1-Liner Helper:app.get('/logo', () => file('public/logo.png'))with zero-copyBun.file/ Node streaming, optionalrootjail (blocks traversal & symlink escapes), null-byte rejection, anddownloadheader. - Generator Streaming (
function*&async function*): Return sync or async generators directly for pull-basedReadableStreambackpressure streaming (text, binary, NDJSON) with automaticgen.return()cleanup on client abort. - Declarative
RouteSchemas.cookiesValidation + OpenAPI 3.1: Fail-closed sync/async cookie validation & coercion within: 'cookie'OpenAPI parameters. - Composable Plugin Macros (
app.use(plugin)): Mounting a modularBareJSplugin inherits bothroutesandmacroswith full TypeScript inference. - Interactive Docs Site: Added cross-doc
Ctrl+K//Instant Search and sticky On This Page TOC on GitHub Pages.
Tests
- 493 tests across 35 files (verified in CI across Bun, Node 20/22, and Deno 2).
BareJS v0.2.6
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 typeddata/errorunions inbareClient().safeandbareTreaty(). - Strict Compile-Time
bareTreatyInference: Pure type-levelTreatyTree<Routes>(0 runtime overhead) forbareTreaty(app)andbareTreaty<typeof app>(url). - Declarative Route
app.macro():beforeHandle+resolvewith per-route TypeScript inference, automatic pool cleanup, and zero overhead on unused routes. - Fail-Closed WebSocket Schema Validation: Optional
body,query,headers, andresponseschemas onapp.ws()across Bun, Node.js,uWebSockets.js, Deno, and in-memory clients (zero overhead when omitted). - Zero-Dep W3C
tracing()&serverTiming(): Edge-safetraceparent+Server-Timingmiddleware withonSpanhook.
Performance
- 4x Smaller Edge Bundle:
dist/edge.jsshrunk from201 KB→50 KB(zeronode:*imports). - O(1) Grouped Radix Dispatch: Replaced double
switchinRadixNode.jitCompile()with a singleObject.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.
BareJS v0.2.5
What's New in v0.2.5
Added
- Native TLS Support: Unified
tls(ServeTlsOptions) inapp.listen()&app.listenCluster()across Bun (Bun.serve({ tls })), Node.js uWebSockets.js (uWS.SSLApp), and Node.js https (node:https). - Zero-Node Edge Runtime (
barejs/edge): Dedicated./edgeentrypoint (~195 KB, zeronode:*imports) for Cloudflare Workers, Vercel Edge, and Deno Deploy. - Universal Standard Schema v1 (
~standard): Native sync & async fail-closed validation for Valibot, ArkType, Zod 4, Effect, etc. acrossparams,query,headers,body, andresponse. - Upgraded
bareClient&bareTreaty: Non-throwingclient.safe.*Result union, chained Proxy RPC (bareTreaty(app | url)), and typed WebSocket client (client.ws()/treaty.subscribe()) supporting bothws://and in-memoryBareJS. - GitHub Pages Documentation Site: Landing page & in-site Markdown docs reader at https://xarhang.github.io/bareJS/.
Security & Fixed
- Stripped CR/LF (
\r/\n) inContext.setHeader(),EdgeContext.setHeader(),EdgeContext.setCookie(), andEdgeContext.redirect()to prevent HTTP response splitting (zero-allocation fast path when clean). EdgeContext.jsonBody()now returns400on malformed JSON instead of500.basicAuth()now sends RFC 7617WWW-Authenticate: Basic realm="Restricted"on401; addedctx.usersetter and updatedhasRole().
Tests
- Added 7 new feature & security audit suites (483 tests / 6,740 assertions across 34 files).
BareJS v0.2.4
Fixed
uWebSockets.jsDriver (src/runtime/uws.ts):- Copy ephemeral
ArrayBufferchunks inres.onData(Buffer.from(new Uint8Array(ab))) instead of creating a zero-copy view, fixing corrupted/empty bodies and crashes on chunked or TCP-fragmentedPOST/PUT/PATCHrequests. - Skip
content-lengthandtransfer-encodinginwriteUwsHeaderssouWebSockets.jsmanages framing headers cleanly when streamingReadableStreamresponses (e.g.staticFile()).
- Copy ephemeral
BareJS v0.2.3
Adds uWS streaming backpressure & native WebSocket pub/sub, trustProxy CIDR allowlist, structured JSON useLog, onRequest/onResponse hooks, app.listenCluster(), staticFile SPA fallback, OpenAPI auto bearerAuth/basicAuth securitySchemes, and friendly EADDRINUSE errors. Verified across Bun, Node.js, and Deno (434 tests / 6,321 assertions).