Migrating from v1
v2 is a complete rewrite of webserial-core and is not backwards compatible with v1.
Version 2 introduces a new architecture, new adapter system, new folder structure, new build output format, and changes to every public API. There is no incremental upgrade path.
Recommended approach
The cleanest way to migrate is to start fresh with v2:
Uninstall v1 and install v2:
bashnpm remove webserial-core npm install webserial-core@latestDelete any existing extension of the old
SerialDeviceclass.Create a new class extending
AbstractSerialDevice<T>following the Getting started guide.
Why a full rewrite?
Version 1 was a prototype that proved the concept. Version 2 was designed from scratch with the following goals that required breaking changes at every layer:
- Strict TypeScript — no
any, full JSDoc, named interfaces for every option - Modular adapter system — WebUSB, Web Bluetooth, and WebSocket are first-class transports
- Dual ESM + CJS output — proper
.mjs/.cjs/.umd.cjsbuild via Vite - Isolated responsibilities — parsers, queue, events, registry, and adapters are all separate modules that can be tested independently
- English-only source — all source code, JSDoc, and error messages are in English
Reference
Start here
Read the Getting started guide for the full v2 API.