@leofcoin/peernet 1.1.84 → 1.1.86
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/exports/browser/browser-Cjcx-T47.js +38 -0
- package/exports/browser/browser-nu3nKt2I.js +132 -0
- package/exports/browser/{client-DD7vhDK_.js → client-Db0RyH-f.js} +11 -11
- package/exports/browser/identity-Cn0iQbY3.js +17199 -0
- package/exports/browser/identity.js +1 -1
- package/exports/browser/{index-Vl0cNziw.js → index-Biyfi3Iw.js} +1 -1
- package/exports/browser/index-CPXJrMI6.js +7580 -0
- package/exports/browser/{messages-CW17jRdc.js → messages-CT983-_h.js} +2 -2
- package/exports/browser/{peernet-CuzuXSJb.js → peernet-CIHG3A1i.js} +3 -3
- package/exports/browser/peernet.js +2 -2
- package/package.json +4 -4
- package/test.js +2 -1
- package/exports/browser/browser-BogfGRzB.js +0 -115
- package/exports/browser/browser-pguCHlVu.js +0 -25
- package/exports/browser/identity--VAIVSMm.js +0 -16707
- package/exports/browser/index-Vgr1JQcP.js +0 -7417
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './identity-Cn0iQbY3.js';
|
|
2
|
+
|
|
3
|
+
var browser$2 = {};
|
|
4
|
+
|
|
5
|
+
var hasRequiredBrowser;
|
|
6
|
+
|
|
7
|
+
function requireBrowser () {
|
|
8
|
+
if (hasRequiredBrowser) return browser$2;
|
|
9
|
+
hasRequiredBrowser = 1;
|
|
10
|
+
|
|
11
|
+
browser$2.MediaStream = window.MediaStream;
|
|
12
|
+
browser$2.MediaStreamTrack = window.MediaStreamTrack;
|
|
13
|
+
browser$2.RTCDataChannel = window.RTCDataChannel;
|
|
14
|
+
browser$2.RTCDataChannelEvent = window.RTCDataChannelEvent;
|
|
15
|
+
browser$2.RTCDtlsTransport = window.RTCDtlsTransport;
|
|
16
|
+
browser$2.RTCIceCandidate = window.RTCIceCandidate;
|
|
17
|
+
browser$2.RTCIceTransport = window.RTCIceTransport;
|
|
18
|
+
browser$2.RTCPeerConnection = window.RTCPeerConnection;
|
|
19
|
+
browser$2.RTCPeerConnectionIceEvent = window.RTCPeerConnectionIceEvent;
|
|
20
|
+
browser$2.RTCRtpReceiver = window.RTCRtpReceiver;
|
|
21
|
+
browser$2.RTCRtpSender = window.RTCRtpSender;
|
|
22
|
+
browser$2.RTCRtpTransceiver = window.RTCRtpTransceiver;
|
|
23
|
+
browser$2.RTCSctpTransport = window.RTCSctpTransport;
|
|
24
|
+
browser$2.RTCSessionDescription = window.RTCSessionDescription;
|
|
25
|
+
browser$2.getUserMedia = window.getUserMedia;
|
|
26
|
+
browser$2.mediaDevices = navigator.mediaDevices;
|
|
27
|
+
return browser$2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var browserExports = requireBrowser();
|
|
31
|
+
var browser = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
32
|
+
|
|
33
|
+
var browser$1 = /*#__PURE__*/Object.freeze({
|
|
34
|
+
__proto__: null,
|
|
35
|
+
default: browser
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { browser$1 as b };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './identity-Cn0iQbY3.js';
|
|
2
|
+
|
|
3
|
+
var global;
|
|
4
|
+
var hasRequiredGlobal;
|
|
5
|
+
|
|
6
|
+
function requireGlobal () {
|
|
7
|
+
if (hasRequiredGlobal) return global;
|
|
8
|
+
hasRequiredGlobal = 1;
|
|
9
|
+
var naiveFallback = function () {
|
|
10
|
+
if (typeof self === "object" && self) return self;
|
|
11
|
+
if (typeof window === "object" && window) return window;
|
|
12
|
+
throw new Error("Unable to resolve global `this`");
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
global = (function () {
|
|
16
|
+
if (this) return this;
|
|
17
|
+
|
|
18
|
+
// Unexpected strict mode (may happen if e.g. bundled into ESM module)
|
|
19
|
+
|
|
20
|
+
// Fallback to standard globalThis if available
|
|
21
|
+
if (typeof globalThis === "object" && globalThis) return globalThis;
|
|
22
|
+
|
|
23
|
+
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
|
24
|
+
// In all ES5+ engines global object inherits from Object.prototype
|
|
25
|
+
// (if you approached one that doesn't please report)
|
|
26
|
+
try {
|
|
27
|
+
Object.defineProperty(Object.prototype, "__global__", {
|
|
28
|
+
get: function () { return this; },
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
31
|
+
} catch (error) {
|
|
32
|
+
// Unfortunate case of updates to Object.prototype being restricted
|
|
33
|
+
// via preventExtensions, seal or freeze
|
|
34
|
+
return naiveFallback();
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
// Safari case (window.__global__ works, but __global__ does not)
|
|
38
|
+
if (!__global__) return naiveFallback();
|
|
39
|
+
return __global__;
|
|
40
|
+
} finally {
|
|
41
|
+
delete Object.prototype.__global__;
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
return global;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var version$1 = "1.0.35";
|
|
48
|
+
var require$$0 = {
|
|
49
|
+
version: version$1};
|
|
50
|
+
|
|
51
|
+
var version;
|
|
52
|
+
var hasRequiredVersion;
|
|
53
|
+
|
|
54
|
+
function requireVersion () {
|
|
55
|
+
if (hasRequiredVersion) return version;
|
|
56
|
+
hasRequiredVersion = 1;
|
|
57
|
+
version = require$$0.version;
|
|
58
|
+
return version;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var browser$2;
|
|
62
|
+
var hasRequiredBrowser;
|
|
63
|
+
|
|
64
|
+
function requireBrowser () {
|
|
65
|
+
if (hasRequiredBrowser) return browser$2;
|
|
66
|
+
hasRequiredBrowser = 1;
|
|
67
|
+
var _globalThis;
|
|
68
|
+
if (typeof globalThis === 'object') {
|
|
69
|
+
_globalThis = globalThis;
|
|
70
|
+
} else {
|
|
71
|
+
try {
|
|
72
|
+
_globalThis = requireGlobal();
|
|
73
|
+
} catch (error) {
|
|
74
|
+
} finally {
|
|
75
|
+
if (!_globalThis && typeof window !== 'undefined') { _globalThis = window; }
|
|
76
|
+
if (!_globalThis) { throw new Error('Could not determine global this'); }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var NativeWebSocket = _globalThis.WebSocket || _globalThis.MozWebSocket;
|
|
81
|
+
var websocket_version = requireVersion();
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Expose a W3C WebSocket class with just one or two arguments.
|
|
86
|
+
*/
|
|
87
|
+
function W3CWebSocket(uri, protocols) {
|
|
88
|
+
var native_instance;
|
|
89
|
+
|
|
90
|
+
if (protocols) {
|
|
91
|
+
native_instance = new NativeWebSocket(uri, protocols);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
native_instance = new NativeWebSocket(uri);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket
|
|
99
|
+
* class). Since it is an Object it will be returned as it is when creating an
|
|
100
|
+
* instance of W3CWebSocket via 'new W3CWebSocket()'.
|
|
101
|
+
*
|
|
102
|
+
* ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2
|
|
103
|
+
*/
|
|
104
|
+
return native_instance;
|
|
105
|
+
}
|
|
106
|
+
if (NativeWebSocket) {
|
|
107
|
+
['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'].forEach(function(prop) {
|
|
108
|
+
Object.defineProperty(W3CWebSocket, prop, {
|
|
109
|
+
get: function() { return NativeWebSocket[prop]; }
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Module exports.
|
|
116
|
+
*/
|
|
117
|
+
browser$2 = {
|
|
118
|
+
'w3cwebsocket' : NativeWebSocket ? W3CWebSocket : null,
|
|
119
|
+
'version' : websocket_version
|
|
120
|
+
};
|
|
121
|
+
return browser$2;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var browserExports = requireBrowser();
|
|
125
|
+
var browser = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
126
|
+
|
|
127
|
+
var browser$1 = /*#__PURE__*/Object.freeze({
|
|
128
|
+
__proto__: null,
|
|
129
|
+
default: browser
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export { browser$1 as b };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LittlePubSub } from './peernet-
|
|
2
|
-
import './identity
|
|
1
|
+
import { L as LittlePubSub } from './peernet-CIHG3A1i.js';
|
|
2
|
+
import './identity-Cn0iQbY3.js';
|
|
3
3
|
import './value-C3vAp-wb.js';
|
|
4
4
|
|
|
5
5
|
class Api {
|
|
@@ -210,7 +210,7 @@ class SocketRequestClient {
|
|
|
210
210
|
const init = async () => {
|
|
211
211
|
// @ts-ignore
|
|
212
212
|
if (!globalThis.WebSocket && !this.#experimentalWebsocket)
|
|
213
|
-
globalThis.WebSocket = (await import('./browser-
|
|
213
|
+
globalThis.WebSocket = (await import('./browser-nu3nKt2I.js').then(function (n) { return n.b; })).default.w3cwebsocket;
|
|
214
214
|
const client = new WebSocket(this.#url, this.#protocol);
|
|
215
215
|
if (this.#experimentalWebsocket) {
|
|
216
216
|
client.addEventListener('error', this.onerror);
|
|
@@ -314,7 +314,7 @@ const iceServers = [
|
|
|
314
314
|
credential: 'openrelayproject'
|
|
315
315
|
}
|
|
316
316
|
];
|
|
317
|
-
const SimplePeer = (await import('./index-
|
|
317
|
+
const SimplePeer = (await import('./index-CPXJrMI6.js').then(function (n) { return n.i; })).default;
|
|
318
318
|
class Peer extends SimplePeer {
|
|
319
319
|
peerId;
|
|
320
320
|
channelName;
|
|
@@ -450,7 +450,7 @@ class Client {
|
|
|
450
450
|
async _init() {
|
|
451
451
|
// reconnectJob()
|
|
452
452
|
if (!globalThis.RTCPeerConnection)
|
|
453
|
-
globalThis.wrtc = (await import('./browser-
|
|
453
|
+
globalThis.wrtc = (await import('./browser-Cjcx-T47.js').then(function (n) { return n.b; })).default;
|
|
454
454
|
for (const star of this.starsConfig) {
|
|
455
455
|
try {
|
|
456
456
|
const client = new SocketRequestClient(star, this.networkVersion);
|
|
@@ -569,13 +569,13 @@ class Client {
|
|
|
569
569
|
return;
|
|
570
570
|
}
|
|
571
571
|
if (String(peer.channelName) !== String(channelName)) {
|
|
572
|
-
console.warn(`channelNames don't match: got ${peer.channelName}, expected: ${channelName}
|
|
572
|
+
console.warn(`channelNames don't match: got ${peer.channelName}, expected: ${channelName}.`);
|
|
573
573
|
// Destroy the existing peer connection
|
|
574
|
-
peer.destroy()
|
|
575
|
-
delete this.#connections[from]
|
|
576
|
-
// Create a new peer connection with the correct configuration
|
|
577
|
-
this.#createRTCPeerConnection(from, star, version, false)
|
|
578
|
-
peer = this.#connections[from]
|
|
574
|
+
// peer.destroy()
|
|
575
|
+
// delete this.#connections[from]
|
|
576
|
+
// // Create a new peer connection with the correct configuration
|
|
577
|
+
// this.#createRTCPeerConnection(from, star, version, false)
|
|
578
|
+
// peer = this.#connections[from]
|
|
579
579
|
}
|
|
580
580
|
peer.signal(signal);
|
|
581
581
|
};
|