@laplace.live/ws 7.1.9 → 8.0.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/README.md +13 -1
- package/dist/browser.d.ts +6 -7
- package/dist/browser.js +2142 -2135
- package/dist/index.d.ts +38 -34
- package/dist/index.js +212 -444
- package/dist/ws-BsvxqaEF.d.ts +312 -0
- package/dist/ws-CyLLjAlr.js +426 -0
- package/package.json +11 -10
- package/dist/ws-mjTot1Nb.d.ts +0 -301
package/README.md
CHANGED
|
@@ -16,6 +16,12 @@ A modern, web-standard rewrite of [bilibili-live-ws](https://github.com/simon300
|
|
|
16
16
|
bun add @laplace.live/ws
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
TypeScript **5.7 or newer**. The binary surface uses the generic typed-array
|
|
22
|
+
types (`Uint8Array<ArrayBuffer>`) introduced in TS 5.7, so older compilers will
|
|
23
|
+
report `Uint8Array is not generic`.
|
|
24
|
+
|
|
19
25
|
## Usage
|
|
20
26
|
|
|
21
27
|
Known Bilibili events are auto-typed via `LiveEventMap` — no manual generics
|
|
@@ -104,13 +110,19 @@ The `relayEvent` symbol is replaced by an `event` meta-event:
|
|
|
104
110
|
### Buffer → Uint8Array
|
|
105
111
|
|
|
106
112
|
Raw data uses `Uint8Array` instead of `Buffer`. If you pass a custom
|
|
107
|
-
`authBody` as binary, use `Uint8Array
|
|
113
|
+
`authBody` as binary, use an `ArrayBuffer`-backed `Uint8Array<ArrayBuffer>`:
|
|
108
114
|
|
|
109
115
|
```diff
|
|
110
116
|
- live = new LiveWS(roomid, { authBody: Buffer.from(...) });
|
|
111
117
|
+ live = new LiveWS(roomid, { authBody: new Uint8Array(...) });
|
|
112
118
|
```
|
|
113
119
|
|
|
120
|
+
`new Uint8Array(...)` already allocates an `ArrayBuffer`-backed view. If you
|
|
121
|
+
hold a value typed as a bare `Uint8Array` (i.e. `Uint8Array<ArrayBufferLike>`,
|
|
122
|
+
whose buffer could be a `SharedArrayBuffer`), narrow it to
|
|
123
|
+
`Uint8Array<ArrayBuffer>` or copy it with `new Uint8Array(data)` before passing
|
|
124
|
+
it to `authBody` or `send`.
|
|
125
|
+
|
|
114
126
|
## License
|
|
115
127
|
|
|
116
128
|
MIT
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap, a as LiveOptions } from './ws-mjTot1Nb.js';
|
|
3
|
-
import '@laplace.live/internal';
|
|
1
|
+
import { a as LiveOptions, c as LiveEventMap, n as WSOptions, o as LaplaceEventTarget, r as KeepLive, s as LaplaceRawEvent, t as LiveWSBase } from "./ws-BsvxqaEF.js";
|
|
4
2
|
|
|
3
|
+
//#region src/browser.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* WebSocket client for a Bilibili live room (browser).
|
|
7
6
|
*
|
|
@@ -21,7 +20,7 @@ import '@laplace.live/internal';
|
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
22
|
declare class LiveWS extends LiveWSBase {
|
|
24
|
-
|
|
23
|
+
constructor(roomid: number, opts?: WSOptions);
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Auto-reconnecting WebSocket client for a Bilibili live room (browser).
|
|
@@ -42,7 +41,7 @@ declare class LiveWS extends LiveWSBase {
|
|
|
42
41
|
* ```
|
|
43
42
|
*/
|
|
44
43
|
declare class KeepLiveWS extends KeepLive<LiveWSBase> {
|
|
45
|
-
|
|
44
|
+
constructor(roomid: number, opts?: WSOptions);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
export { KeepLiveWS, LiveWS, WSOptions };
|
|
46
|
+
//#endregion
|
|
47
|
+
export { KeepLiveWS, LaplaceEventTarget, LaplaceRawEvent, type LiveEventMap, type LiveOptions, LiveWS, type WSOptions };
|