@laplace.live/ws 7.1.4 → 7.1.5-beta.1
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 +3 -3
- package/dist/browser.d.ts +5 -4
- package/dist/browser.js +7 -4
- package/dist/index.d.ts +2 -2
- package/dist/{ws-Cd0ulctk.d.ts → ws-CAEZj7O-.d.ts} +3 -3
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @laplace.live/ws
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
LAPLACE Live! flavored bilibili live WebSocket/TCP API.
|
|
4
4
|
|
|
5
5
|
This project is based on [bilibili-live-ws](https://github.com/simon300000/bilibili-live-ws) and has the exact same API as the original project, with the following differences:
|
|
6
6
|
|
|
@@ -48,7 +48,7 @@ live.addEventListener<{ custom: string }>("NEW_CMD", ({ data }) =>
|
|
|
48
48
|
### Browser
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
|
-
import { LiveWS, KeepLiveWS } from "@laplace.live/ws/
|
|
51
|
+
import { LiveWS, KeepLiveWS } from "@laplace.live/ws/client";
|
|
52
52
|
|
|
53
53
|
const live = new LiveWS(25034104, { key: "...", address: "wss://..." });
|
|
54
54
|
live.addEventListener("DANMU_MSG", ({ data }) => console.log(data.msg_id));
|
|
@@ -67,7 +67,7 @@ keep.addEventListener("DANMU_MSG", ({ data }) => console.log(data.msg_id));
|
|
|
67
67
|
### TCP (Node.js / Bun only)
|
|
68
68
|
|
|
69
69
|
```typescript
|
|
70
|
-
import { LiveTCP } from "@laplace.live/ws";
|
|
70
|
+
import { LiveTCP } from "@laplace.live/ws/server";
|
|
71
71
|
|
|
72
72
|
const live = new LiveTCP(25034104, { key: "..." });
|
|
73
73
|
live.addEventListener("heartbeat", ({ data }) => console.log("Online:", data));
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-
|
|
2
|
-
export { c as LaplaceRawEvent, d as LiveEventMap, a as LiveOptions } from './ws-
|
|
1
|
+
import { K as KeepLive, b as LiveWSBase, W as WSOptions } from './ws-CAEZj7O-.js';
|
|
2
|
+
export { c as LaplaceRawEvent, d as LiveEventMap, a as LiveOptions } from './ws-CAEZj7O-.js';
|
|
3
3
|
import '@laplace.live/internal';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* WebSocket client for a Bilibili live room (browser).
|
|
7
7
|
*
|
|
8
|
-
* Uses `
|
|
9
|
-
* decompression, requiring no Node.js
|
|
8
|
+
* Uses the native `DecompressionStream` API for zlib inflate and a
|
|
9
|
+
* bundled JS decoder for brotli decompression, requiring no Node.js
|
|
10
|
+
* built-ins or third-party dependencies.
|
|
10
11
|
*
|
|
11
12
|
* @param roomid - Numeric Bilibili live room ID.
|
|
12
13
|
* @param opts - Optional WebSocket address and authentication options.
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// src/inflate/browser.ts
|
|
2
|
-
import { inflate } from "pako";
|
|
3
|
-
|
|
4
1
|
// src/inflate/brotli.ts
|
|
5
2
|
var makeBrotliDecode = () => {
|
|
6
3
|
function InputStream(bytes) {
|
|
@@ -1783,7 +1780,13 @@ var makeBrotliDecode = () => {
|
|
|
1783
1780
|
var BrotliDecode = makeBrotliDecode();
|
|
1784
1781
|
|
|
1785
1782
|
// src/inflate/browser.ts
|
|
1786
|
-
var inflateAsync = (d) =>
|
|
1783
|
+
var inflateAsync = async (d) => {
|
|
1784
|
+
const ds = new DecompressionStream("deflate");
|
|
1785
|
+
const writer = ds.writable.getWriter();
|
|
1786
|
+
await writer.write(d);
|
|
1787
|
+
await writer.close();
|
|
1788
|
+
return new Uint8Array(await new Response(ds.readable).arrayBuffer());
|
|
1789
|
+
};
|
|
1787
1790
|
var brotliDecompressAsync = (d) => Uint8Array.from(BrotliDecode(Int8Array.from(d)));
|
|
1788
1791
|
var inflates = { inflateAsync, brotliDecompressAsync };
|
|
1789
1792
|
|
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 LaplaceRawEvent, d 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-CAEZj7O-.js';
|
|
2
|
+
export { c as LaplaceRawEvent, d as LiveEventMap } from './ws-CAEZj7O-.js';
|
|
3
3
|
import { Socket } from 'node:net';
|
|
4
4
|
import { BilibiliInternal } from '@laplace.live/internal';
|
|
5
5
|
|
|
@@ -5,11 +5,11 @@ import { BilibiliInternal } from '@laplace.live/internal';
|
|
|
5
5
|
* decoder at construction time.
|
|
6
6
|
*
|
|
7
7
|
* - **Node / Bun**: backed by `node:zlib` (`inflate` + `brotliDecompress`).
|
|
8
|
-
* - **Browser**: backed by `
|
|
8
|
+
* - **Browser**: backed by native `DecompressionStream` (inflate) + a bundled JS Brotli decoder.
|
|
9
9
|
*/
|
|
10
10
|
type Inflates = {
|
|
11
|
-
inflateAsync: (b: Uint8Array) => Uint8Array | Promise<Uint8Array>;
|
|
12
|
-
brotliDecompressAsync: (b: Uint8Array) => Uint8Array | Promise<Uint8Array>;
|
|
11
|
+
inflateAsync: (b: Uint8Array<ArrayBuffer>) => Uint8Array | Promise<Uint8Array>;
|
|
12
|
+
brotliDecompressAsync: (b: Uint8Array<ArrayBuffer>) => Uint8Array | Promise<Uint8Array>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laplace.live/ws",
|
|
3
|
-
"version": "7.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.1.5-beta.1",
|
|
4
|
+
"description": "LAPLACE Live! flavored bilibili live WebSocket/TCP API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"browser": "./dist/browser.js",
|
|
@@ -62,14 +62,12 @@
|
|
|
62
62
|
"provenance": true
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@laplace.live/internal": "^1.3.4"
|
|
66
|
-
"pako": "^2.1.0"
|
|
65
|
+
"@laplace.live/internal": "^1.3.4"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@biomejs/biome": "^2.4.6",
|
|
70
69
|
"@changesets/cli": "^2.30.0",
|
|
71
70
|
"@types/bun": "^1.3.10",
|
|
72
|
-
"@types/pako": "^2.0.4",
|
|
73
71
|
"tsup": "^8.5.1",
|
|
74
72
|
"typescript": "^5.9.3"
|
|
75
73
|
}
|