@laplace.live/ws 7.1.6 → 7.1.7

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-Cy_gJKLl.js';
2
- export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap, a as LiveOptions } from './ws-Cy_gJKLl.js';
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
@@ -2100,8 +2100,8 @@ var Live = class extends LaplaceEventTarget {
2100
2100
  var LiveWSBase = class extends Live {
2101
2101
  /** The underlying native WebSocket instance. */
2102
2102
  ws;
2103
- constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", ...options } = {}) {
2104
- const ws = new WebSocket(address);
2103
+ constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", createWebSocket, ...options } = {}) {
2104
+ const ws = createWebSocket ? createWebSocket(address) : new WebSocket(address);
2105
2105
  const send = (data) => {
2106
2106
  if (ws.readyState === 1) {
2107
2107
  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-Cy_gJKLl.js';
2
- export { c as LaplaceEventTarget, d as LaplaceRawEvent, e as LiveEventMap } from './ws-Cy_gJKLl.js';
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
@@ -367,8 +367,8 @@ var LiveTCPBase = class extends Live {
367
367
  var LiveWSBase = class extends Live {
368
368
  /** The underlying native WebSocket instance. */
369
369
  ws;
370
- constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", ...options } = {}) {
371
- const ws = new WebSocket(address);
370
+ constructor(inflates2, roomid, { address = "wss://broadcastlv.chat.bilibili.com/sub", createWebSocket, ...options } = {}) {
371
+ const ws = createWebSocket ? createWebSocket(address) : new WebSocket(address);
372
372
  const send = (data) => {
373
373
  if (ws.readyState === 1) {
374
374
  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.6",
3
+ "version": "7.1.7",
4
4
  "description": "LAPLACE Live! flavored bilibili live WebSocket/TCP API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",