taro-bluetooth-print 2.8.4 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/core/BluetoothPrinter.d.ts +21 -4
- package/dist/types/errors/CommandBuildError.d.ts +40 -0
- package/dist/types/errors/ConnectionError.d.ts +45 -0
- package/dist/types/errors/PrintJobError.d.ts +42 -0
- package/dist/types/errors/index.d.ts +9 -0
- package/dist/types/factory/PrinterFactory.d.ts +108 -0
- package/dist/types/factory/index.d.ts +6 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/services/interfaces/ICommandBuilder.d.ts +123 -0
- package/dist/types/services/interfaces/IConnectionManager.d.ts +49 -0
- package/dist/types/services/interfaces/IPrintJobManager.d.ts +67 -0
- package/dist/types/services/interfaces/index.d.ts +6 -233
- package/package.json +1 -1
- package/src/core/BluetoothPrinter.ts +47 -50
- package/src/errors/CommandBuildError.ts +72 -0
- package/src/errors/ConnectionError.ts +78 -0
- package/src/errors/PrintJobError.ts +75 -0
- package/src/errors/index.ts +10 -0
- package/src/factory/PrinterFactory.ts +139 -0
- package/src/factory/index.ts +12 -0
- package/src/index.ts +11 -0
- package/src/services/interfaces/ICommandBuilder.ts +145 -0
- package/src/services/interfaces/IConnectionManager.ts +58 -0
- package/src/services/interfaces/IPrintJobManager.ts +83 -0
- package/src/services/interfaces/index.ts +5 -265
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.9.0] - 2026-04-07
|
|
9
|
+
|
|
10
|
+
### 架构升级
|
|
11
|
+
|
|
12
|
+
- **新增 PrinterFactory**: 工厂模式创建 `BluetoothPrinter` 实例,推荐使用 `createBluetoothPrinter({ adapter })` 替代直接构造函数
|
|
13
|
+
- **接口分离**: 将 `services/interfaces/index.ts` 拆分为独立文件 (`IConnectionManager.ts`, `IPrintJobManager.ts`, `ICommandBuilder.ts`),改善依赖管理
|
|
14
|
+
- **错误类层次**: 新增 `ConnectionError` / `PrintJobError` / `CommandBuildError` 专用错误类,继承自 `BluetoothPrintError`
|
|
15
|
+
- **BluetoothPrinter 简化**: 移除构造函数向后兼容逻辑,使用清晰的依赖注入模式
|
|
16
|
+
|
|
17
|
+
### 导出新增
|
|
18
|
+
|
|
19
|
+
- `createBluetoothPrinter()` - 工厂函数(推荐)
|
|
20
|
+
- `createWebBluetoothPrinter()` - Web Bluetooth 专用工厂
|
|
21
|
+
- `PrinterFactory` - 工厂对象(向后兼容)
|
|
22
|
+
- `ConnectionError`, `ConnectionErrorCode` - 连接错误
|
|
23
|
+
- `PrintJobError`, `PrintJobErrorCode` - 打印任务错误
|
|
24
|
+
- `CommandBuildError`, `CommandBuildErrorCode` - 命令构建错误
|
|
25
|
+
|
|
8
26
|
## [2.8.4] - 2026-04-05
|
|
9
27
|
|
|
10
28
|
### 修复
|