Skip to content

Releases: kriasoft/bun-ws-router

v0.2.0

07 Jul 22:35
Compare
Choose a tag to compare

🚀 Major Features

Valibot Integration - The biggest addition in this release is full Valibot support as an alternative to Zod for message
validation. You can now choose between:

  • Zod (recommended for beginners, familiar API)
  • Valibot (90% smaller bundles, better performance)

🔧 Architecture Improvements

Modular Design - Complete restructuring of the codebase with:

  • Adapter Pattern: Core logic separated into shared/ directory with thin Zod/Valibot adapters
  • Cleaner Exports: Both validation libraries now have dedicated entry points (/zod and /valibot)
  • Better Type Safety: Enhanced TypeScript support with full type inference from schema to handler

📦 New Structure

  ├── shared/         # Core router logic
  ├── zod/            # Zod adapter and utilities
  ├── valibot/        # Valibot adapter and utilities
  └── test/           # Comprehensive test suite

🎯 Key Improvements

  • Backward Compatibility: Existing Zod-based code continues to work unchanged
  • Enhanced Testing: Added comprehensive test coverage for both validation libraries
  • Better Documentation: Updated README with clear examples for both Zod and Valibot
  • Type Safety: Improved TypeScript definitions and error handling

🔄 Breaking Changes

  • None - This is a fully backward-compatible release
  • Existing Zod-based implementations will continue to work as before
  • Default export remains the Zod adapter for compatibility

📝 Usage Examples

// With Zod (existing approach):
import { messageSchema, WebSocketRouter } from "bun-ws-router";

// With Valibot (new option):
import { messageSchema, WebSocketRouter } from "bun-ws-router/valibot";

PRs

  • feat: integrate Valibot by @koistya in #2
  • feat: publish() function with schema validation by @koistya in #1

Full Changelog: v0.0.3...v0.2.0

v0.1.0

03 May 21:09
Compare
Choose a tag to compare
  • feat: publish(ws, topic, schema, message) function with schema validation (#1)

v0.0.3

30 Apr 10:39
Compare
Choose a tag to compare
  • Add unit and end-to-end tests
  • Update README.md

v0.0.2

28 Apr 11:25
Compare
Choose a tag to compare

v0.0.1

28 Apr 02:11
Compare
Choose a tag to compare

Initial release