@laplace.live/ws 7.1.8 → 7.1.10

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/dist/index.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import { L as Live, I as Inflates, a as LiveOptions, K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-mjTot1Nb.js';
2
- export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap } from './ws-mjTot1Nb.js';
3
- import { Socket } from 'node:net';
4
- import { BilibiliInternal } from '@laplace.live/internal';
1
+ import { a as LiveOptions, c as LiveEventMap, i as Live, l as Inflates, n as WSOptions, o as LaplaceEventTarget, r as KeepLive, s as LaplaceRawEvent, t as LiveWSBase } from "./ws-DHkTB1_n.js";
2
+ import { Socket } from "node:net";
3
+ import { BilibiliInternal } from "@laplace.live/internal";
5
4
 
5
+ //#region src/tcp.d.ts
6
6
  /**
7
7
  * Configuration options for TCP-based live connections.
8
8
  * Extends {@link LiveOptions} with optional host and port overrides.
9
9
  */
10
10
  type TCPOptions = LiveOptions & {
11
- /** TCP server hostname. Defaults to `broadcastlv.chat.bilibili.com`. */
12
- host?: string;
13
- /** TCP server port. Defaults to `2243`. */
14
- port?: number;
11
+ /** TCP server hostname. Defaults to `broadcastlv.chat.bilibili.com`. */host?: string; /** TCP server port. Defaults to `2243`. */
12
+ port?: number;
15
13
  };
16
14
  /**
17
15
  * TCP transport for Bilibili live room connections.
@@ -27,22 +25,27 @@ type TCPOptions = LiveOptions & {
27
25
  * @param options - TCP host/port and authentication options.
28
26
  */
29
27
  declare class LiveTCPBase extends Live {
30
- /** The underlying Node.js TCP socket. */
31
- socket: Socket;
32
- /** @internal Accumulator for incomplete packets from the TCP stream. */
33
- buf: Buffer;
34
- /** @internal Counter for periodic buffer compaction. */
35
- i: number;
36
- constructor(inflates: Inflates, roomid: number, { host, port, ...options }?: TCPOptions);
37
- /**
38
- * Extract complete packets from the internal buffer and dispatch them
39
- * as `message` events. Compacts the buffer periodically to avoid
40
- * unbounded memory growth from `Buffer.concat` / `slice` chains.
41
- * @internal
42
- */
43
- splitBuffer(): void;
28
+ /** The underlying Node.js TCP socket. */
29
+ socket: Socket;
30
+ /** @internal Accumulator for incomplete packets from the TCP stream. */
31
+ buf: Buffer;
32
+ /** @internal Counter for periodic buffer compaction. */
33
+ i: number;
34
+ constructor(inflates: Inflates, roomid: number, {
35
+ host,
36
+ port,
37
+ ...options
38
+ }?: TCPOptions);
39
+ /**
40
+ * Extract complete packets from the internal buffer and dispatch them
41
+ * as `message` events. Compacts the buffer periodically to avoid
42
+ * unbounded memory growth from `Buffer.concat` / `slice` chains.
43
+ * @internal
44
+ */
45
+ splitBuffer(): void;
44
46
  }
45
-
47
+ //#endregion
48
+ //#region src/extra.d.ts
46
49
  /**
47
50
  * Fetch WebSocket connection configuration for a Bilibili live room directly
48
51
  * from the Bilibili API (`getDanmuInfo`).
@@ -61,10 +64,10 @@ declare class LiveTCPBase extends Live {
61
64
  * @throws {Error} If the API returns no data (e.g. invalid room or risk-control block).
62
65
  */
63
66
  declare const getConf: (roomid: number) => Promise<{
64
- key: string;
65
- host: string;
66
- address: string;
67
- json: BilibiliInternal.HTTPS.Prod.GetDanmuInfo;
67
+ key: string;
68
+ host: string;
69
+ address: string;
70
+ json: BilibiliInternal.HTTPS.Prod.GetDanmuInfo;
68
71
  }>;
69
72
  /**
70
73
  * Resolve a short (vanity) room ID to its real numeric room ID via the
@@ -77,7 +80,8 @@ declare const getConf: (roomid: number) => Promise<{
77
80
  * @returns The canonical numeric room ID.
78
81
  */
79
82
  declare const getRoomid: (short: number) => Promise<any>;
80
-
83
+ //#endregion
84
+ //#region src/index.d.ts
81
85
  /**
82
86
  * WebSocket client for a Bilibili live room (Node.js / Bun).
83
87
  *
@@ -95,7 +99,7 @@ declare const getRoomid: (short: number) => Promise<any>;
95
99
  * ```
96
100
  */
97
101
  declare class LiveWS extends LiveWSBase {
98
- constructor(roomid: number, opts?: WSOptions);
102
+ constructor(roomid: number, opts?: WSOptions);
99
103
  }
100
104
  /**
101
105
  * TCP client for a Bilibili live room (Node.js / Bun only).
@@ -115,7 +119,7 @@ declare class LiveWS extends LiveWSBase {
115
119
  * ```
116
120
  */
117
121
  declare class LiveTCP extends LiveTCPBase {
118
- constructor(roomid: number, opts?: TCPOptions);
122
+ constructor(roomid: number, opts?: TCPOptions);
119
123
  }
120
124
  /**
121
125
  * Auto-reconnecting WebSocket client for a Bilibili live room
@@ -137,7 +141,7 @@ declare class LiveTCP extends LiveTCPBase {
137
141
  * ```
138
142
  */
139
143
  declare class KeepLiveWS extends KeepLive<LiveWSBase> {
140
- constructor(roomid: number, opts?: WSOptions);
144
+ constructor(roomid: number, opts?: WSOptions);
141
145
  }
142
146
  /**
143
147
  * Auto-reconnecting TCP client for a Bilibili live room
@@ -159,7 +163,7 @@ declare class KeepLiveWS extends KeepLive<LiveWSBase> {
159
163
  * ```
160
164
  */
161
165
  declare class KeepLiveTCP extends KeepLive<LiveTCPBase> {
162
- constructor(roomid: number, opts?: TCPOptions);
166
+ constructor(roomid: number, opts?: TCPOptions);
163
167
  }
164
-
165
- export { KeepLiveTCP, KeepLiveWS, LiveOptions, LiveTCP, LiveWS, type TCPOptions, WSOptions, getConf, getRoomid };
168
+ //#endregion
169
+ export { KeepLiveTCP, KeepLiveWS, LaplaceEventTarget, LaplaceRawEvent, type LiveEventMap, type LiveOptions, LiveTCP, LiveWS, type TCPOptions, type WSOptions, getConf, getRoomid };