@laplace.live/ws 7.1.6 → 7.1.8
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/browser.d.ts +2 -2
- package/dist/browser.js +3 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -7
- package/dist/{ws-Cy_gJKLl.d.ts → ws-mjTot1Nb.d.ts} +3 -1
- package/package.json +3 -3
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-
|
|
2
|
-
export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap, a as LiveOptions } from './ws-
|
|
1
|
+
import { K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-mjTot1Nb.js';
|
|
2
|
+
export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap, a as LiveOptions } from './ws-mjTot1Nb.js';
|
|
3
3
|
import '@laplace.live/internal';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/browser.js
CHANGED
|
@@ -2049,11 +2049,7 @@ var Live = class extends LaplaceEventTarget {
|
|
|
2049
2049
|
this.dispatchEvent(new LaplaceRawEvent("msg", data));
|
|
2050
2050
|
const cmd = data.cmd || data.msg?.cmd;
|
|
2051
2051
|
if (cmd) {
|
|
2052
|
-
|
|
2053
|
-
this.dispatchEvent(new LaplaceRawEvent("DANMU_MSG", data));
|
|
2054
|
-
} else {
|
|
2055
|
-
this.dispatchEvent(new LaplaceRawEvent(cmd, data));
|
|
2056
|
-
}
|
|
2052
|
+
this.dispatchEvent(new LaplaceRawEvent(cmd, data));
|
|
2057
2053
|
}
|
|
2058
2054
|
}
|
|
2059
2055
|
});
|
|
@@ -2100,8 +2096,8 @@ var Live = class extends LaplaceEventTarget {
|
|
|
2100
2096
|
var LiveWSBase = class extends Live {
|
|
2101
2097
|
/** The underlying native WebSocket instance. */
|
|
2102
2098
|
ws;
|
|
2103
|
-
constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", ...options } = {}) {
|
|
2104
|
-
const ws = new WebSocket(address);
|
|
2099
|
+
constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", createWebSocket, ...options } = {}) {
|
|
2100
|
+
const ws = createWebSocket ? createWebSocket(address) : new WebSocket(address);
|
|
2105
2101
|
const send = (data) => {
|
|
2106
2102
|
if (ws.readyState === 1) {
|
|
2107
2103
|
ws.send(data);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as Live, I as Inflates, a as LiveOptions, K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-
|
|
2
|
-
export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap } from './ws-
|
|
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
3
|
import { Socket } from 'node:net';
|
|
4
4
|
import { BilibiliInternal } from '@laplace.live/internal';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -269,11 +269,7 @@ var Live = class extends LaplaceEventTarget {
|
|
|
269
269
|
this.dispatchEvent(new LaplaceRawEvent("msg", data));
|
|
270
270
|
const cmd = data.cmd || data.msg?.cmd;
|
|
271
271
|
if (cmd) {
|
|
272
|
-
|
|
273
|
-
this.dispatchEvent(new LaplaceRawEvent("DANMU_MSG", data));
|
|
274
|
-
} else {
|
|
275
|
-
this.dispatchEvent(new LaplaceRawEvent(cmd, data));
|
|
276
|
-
}
|
|
272
|
+
this.dispatchEvent(new LaplaceRawEvent(cmd, data));
|
|
277
273
|
}
|
|
278
274
|
}
|
|
279
275
|
});
|
|
@@ -367,8 +363,8 @@ var LiveTCPBase = class extends Live {
|
|
|
367
363
|
var LiveWSBase = class extends Live {
|
|
368
364
|
/** The underlying native WebSocket instance. */
|
|
369
365
|
ws;
|
|
370
|
-
constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", ...options } = {}) {
|
|
371
|
-
const ws = new WebSocket(address);
|
|
366
|
+
constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", createWebSocket, ...options } = {}) {
|
|
367
|
+
const ws = createWebSocket ? createWebSocket(address) : new WebSocket(address);
|
|
372
368
|
const send = (data) => {
|
|
373
369
|
if (ws.readyState === 1) {
|
|
374
370
|
ws.send(data);
|
|
@@ -274,6 +274,8 @@ declare class KeepLive<T extends Live> extends LaplaceEventTarget {
|
|
|
274
274
|
type WSOptions = LiveOptions & {
|
|
275
275
|
/** WebSocket server URL. Defaults to `wss://broadcastlv.chat.bilibili.com/sub`. */
|
|
276
276
|
address?: string;
|
|
277
|
+
/** Factory to create the WebSocket (e.g. for runtime-specific options like Bun's proxy). */
|
|
278
|
+
createWebSocket?: (address: string) => WebSocket;
|
|
277
279
|
};
|
|
278
280
|
/**
|
|
279
281
|
* WebSocket transport for Bilibili live room connections.
|
|
@@ -293,7 +295,7 @@ type WSOptions = LiveOptions & {
|
|
|
293
295
|
declare class LiveWSBase extends Live {
|
|
294
296
|
/** The underlying native WebSocket instance. */
|
|
295
297
|
ws: WebSocket;
|
|
296
|
-
constructor(inflates: Inflates, roomid: number, { address, ...options }?: WSOptions);
|
|
298
|
+
constructor(inflates: Inflates, roomid: number, { address, createWebSocket, ...options }?: WSOptions);
|
|
297
299
|
}
|
|
298
300
|
|
|
299
301
|
export { type Inflates as I, KeepLive as K, Live as L, type WSOptions as W, type LiveOptions as a, LiveWSBase as b, LaplaceEventTarget as c, LaplaceRawEvent as d, type LiveEventMap as e };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laplace.live/ws",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.8",
|
|
4
4
|
"description": "LAPLACE Live! flavored bilibili live WebSocket/TCP API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"@laplace.live/internal": "^1.3.4"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@biomejs/biome": "^2.4.
|
|
68
|
+
"@biomejs/biome": "^2.4.8",
|
|
69
69
|
"@changesets/cli": "^2.30.0",
|
|
70
|
-
"@types/bun": "^1.3.
|
|
70
|
+
"@types/bun": "^1.3.11",
|
|
71
71
|
"playwright": "^1.58.2",
|
|
72
72
|
"tsup": "^8.5.1",
|
|
73
73
|
"typescript": "^5.9.3"
|