Jonas Gloning 1 рік тому
батько
коміт
51baaffaca

+ 1 - 1
__test__/faker.ts

@@ -4,7 +4,7 @@ import "webrtc-adapter";
 const fakeGlobals = {
 	WebSocket,
 	MediaStream: class MediaStream {
-		private _tracks: MediaStreamTrack[] = [];
+		private readonly _tracks: MediaStreamTrack[] = [];
 
 		constructor(tracks?: MediaStreamTrack[]) {
 			if (tracks) {

+ 1 - 1
e2e/datachannel/serialization_cbor.spec.ts

@@ -1,6 +1,6 @@
 import P from "./serialization.page.js";
 import { serializationTest } from "./serializationTest.js";
-import { browser, $, $$, expect } from "@wdio/globals";
+import { browser } from "@wdio/globals";
 
 describe("DataChannel:CBOR", function () {
 	beforeAll(async function () {

+ 1 - 1
lib/baseconnection.ts

@@ -51,7 +51,7 @@ export abstract class BaseConnection<
 		return this._open;
 	}
 
-	constructor(
+	protected constructor(
 		/**
 		 * The ID of the peer on the other end of this connection.
 		 */

+ 1 - 1
lib/dataconnection/StreamConnection/Cbor.ts

@@ -56,7 +56,7 @@ export class Cbor extends StreamConnection {
 	constructor(peerId: string, provider: Peer, options: any) {
 		super(peerId, provider, { ...options, reliable: true });
 
-		this._rawReadStream.pipeTo(this._decoderStream.writable);
+		void this._rawReadStream.pipeTo(this._decoderStream.writable);
 
 		(async () => {
 			for await (const msg of iterateOver(this._decoderStream.readable)) {

+ 1 - 7
lib/dataconnection/StreamConnection/StreamConnection.ts

@@ -40,12 +40,6 @@ export abstract class StreamConnection extends DataConnection {
 		start: (controller) => {
 			this.once("open", () => {
 				this.dataChannel.addEventListener("message", (e) => {
-					// if(e.data?.__peerData?.type === "close")
-					// {
-					// 	controller.close()
-					// 	this.close()
-					// 	return
-					// }
 					controller.enqueue(e.data);
 				});
 			});
@@ -55,7 +49,7 @@ export abstract class StreamConnection extends DataConnection {
 	protected constructor(peerId: string, provider: Peer, options: any) {
 		super(peerId, provider, { ...options, reliable: true });
 
-		this._splitStream.readable.pipeTo(this._rawSendStream);
+		void this._splitStream.readable.pipeTo(this._rawSendStream);
 	}
 
 	public override _initializeDataChannel(dc) {

+ 2 - 2
lib/mediaconnection.ts

@@ -100,11 +100,11 @@ export class MediaConnection extends BaseConnection<MediaConnectionEvents> {
 		switch (message.type) {
 			case ServerMessageType.Answer:
 				// Forward to negotiator
-				this._negotiator.handleSDP(type, payload.sdp);
+				void this._negotiator.handleSDP(type, payload.sdp);
 				this._open = true;
 				break;
 			case ServerMessageType.Candidate:
-				this._negotiator.handleCandidate(payload.candidate);
+				void this._negotiator.handleCandidate(payload.candidate);
 				break;
 			default:
 				logger.warn(`Unrecognized message type:${type} from peer:${this.peer}`);

+ 2 - 2
lib/negotiator.ts

@@ -37,9 +37,9 @@ export class Negotiator<
 			);
 			dataConnection._initializeDataChannel(dataChannel);
 
-			this._makeOffer();
+			void this._makeOffer();
 		} else {
-			this.handleSDP("OFFER", options.sdp);
+			void this.handleSDP("OFFER", options.sdp);
 		}
 	}
 

+ 1 - 3
package.json

@@ -151,9 +151,8 @@
 			"source": "lib/global.ts"
 		},
 		"browser-minified-cbor": {
-			"context": "node",
+			"context": "browser",
 			"outputFormat": "esmodule",
-			"includeNodeModules": true,
 			"isLibrary": true,
 			"optimize": true,
 			"engines": {
@@ -164,7 +163,6 @@
 		"browser-minified-msgpack": {
 			"context": "browser",
 			"outputFormat": "esmodule",
-			"includeNodeModules": true,
 			"isLibrary": true,
 			"optimize": true,
 			"engines": {