@waku/core 0.0.34-b6339f7.0 → 0.0.34-c41b319.0
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/bundle/base_protocol-CCK9RCtH.js +152 -0
- package/bundle/{index-BIW3qNYx.js → index-Db7LxDrL.js} +78 -159
- package/bundle/index.js +1882 -158
- package/bundle/lib/base_protocol.js +2 -2
- package/bundle/lib/message/version_0.js +2 -2
- package/bundle/{version_0-CdmZMfkQ.js → version_0-ANFNAdFD.js} +283 -45
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/base_protocol.d.ts +4 -25
- package/dist/lib/base_protocol.js +3 -55
- package/dist/lib/base_protocol.js.map +1 -1
- package/dist/lib/connection_manager/connection_manager.d.ts +118 -0
- package/dist/lib/{connection_manager.js → connection_manager/connection_manager.js} +136 -36
- package/dist/lib/connection_manager/connection_manager.js.map +1 -0
- package/dist/lib/connection_manager/index.d.ts +1 -0
- package/dist/lib/connection_manager/index.js +2 -0
- package/dist/lib/connection_manager/index.js.map +1 -0
- package/dist/lib/{keep_alive_manager.d.ts → connection_manager/keep_alive_manager.d.ts} +4 -2
- package/dist/lib/{keep_alive_manager.js → connection_manager/keep_alive_manager.js} +2 -2
- package/dist/lib/connection_manager/keep_alive_manager.js.map +1 -0
- package/dist/lib/connection_manager/utils.d.ts +7 -0
- package/dist/lib/connection_manager/utils.js +22 -0
- package/dist/lib/connection_manager/utils.js.map +1 -0
- package/dist/lib/filter/filter.d.ts +18 -0
- package/dist/lib/filter/filter.js +209 -0
- package/dist/lib/filter/filter.js.map +1 -0
- package/dist/lib/filter/index.d.ts +1 -18
- package/dist/lib/filter/index.js +1 -208
- package/dist/lib/filter/index.js.map +1 -1
- package/dist/lib/light_push/index.d.ts +1 -15
- package/dist/lib/light_push/index.js +1 -143
- package/dist/lib/light_push/index.js.map +1 -1
- package/dist/lib/light_push/light_push.d.ts +15 -0
- package/dist/lib/light_push/light_push.js +144 -0
- package/dist/lib/light_push/light_push.js.map +1 -0
- package/dist/lib/metadata/index.d.ts +1 -3
- package/dist/lib/metadata/index.js +1 -118
- package/dist/lib/metadata/index.js.map +1 -1
- package/dist/lib/metadata/metadata.d.ts +3 -0
- package/dist/lib/metadata/metadata.js +119 -0
- package/dist/lib/metadata/metadata.js.map +1 -0
- package/dist/lib/store/index.d.ts +1 -9
- package/dist/lib/store/index.js +1 -82
- package/dist/lib/store/index.js.map +1 -1
- package/dist/lib/store/store.d.ts +9 -0
- package/dist/lib/store/store.js +83 -0
- package/dist/lib/store/store.js.map +1 -0
- package/dist/lib/stream_manager/stream_manager.d.ts +2 -2
- package/dist/lib/stream_manager/stream_manager.js +16 -17
- package/dist/lib/stream_manager/stream_manager.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -4
- package/src/lib/base_protocol.ts +3 -92
- package/src/lib/{connection_manager.ts → connection_manager/connection_manager.ts} +168 -63
- package/src/lib/connection_manager/index.ts +1 -0
- package/src/lib/{keep_alive_manager.ts → connection_manager/keep_alive_manager.ts} +7 -3
- package/src/lib/connection_manager/utils.ts +25 -0
- package/src/lib/filter/filter.ts +315 -0
- package/src/lib/filter/index.ts +1 -315
- package/src/lib/light_push/index.ts +1 -188
- package/src/lib/light_push/light_push.ts +188 -0
- package/src/lib/metadata/index.ts +1 -182
- package/src/lib/metadata/metadata.ts +182 -0
- package/src/lib/store/index.ts +1 -136
- package/src/lib/store/store.ts +136 -0
- package/src/lib/stream_manager/stream_manager.ts +16 -18
- package/bundle/base_protocol-sjpC9_Fu.js +0 -283
- package/dist/lib/connection_manager.d.ts +0 -62
- package/dist/lib/connection_manager.js.map +0 -1
- package/dist/lib/filterPeers.d.ts +0 -13
- package/dist/lib/filterPeers.js +0 -38
- package/dist/lib/filterPeers.js.map +0 -1
- package/dist/lib/health_manager.d.ts +0 -14
- package/dist/lib/health_manager.js +0 -70
- package/dist/lib/health_manager.js.map +0 -1
- package/dist/lib/keep_alive_manager.js.map +0 -1
- package/src/lib/filterPeers.ts +0 -51
- package/src/lib/health_manager.ts +0 -90
@@ -0,0 +1,152 @@
|
|
1
|
+
import { L as Logger } from './index-Db7LxDrL.js';
|
2
|
+
|
3
|
+
function selectOpenConnection(connections) {
|
4
|
+
return connections
|
5
|
+
.filter((c) => c.status === "open")
|
6
|
+
.sort((left, right) => right.timeline.open - left.timeline.open)
|
7
|
+
.at(0);
|
8
|
+
}
|
9
|
+
|
10
|
+
const STREAM_LOCK_KEY = "consumed";
|
11
|
+
class StreamManager {
|
12
|
+
multicodec;
|
13
|
+
getConnections;
|
14
|
+
addEventListener;
|
15
|
+
log;
|
16
|
+
ongoingCreation = new Set();
|
17
|
+
streamPool = new Map();
|
18
|
+
constructor(multicodec, getConnections, addEventListener) {
|
19
|
+
this.multicodec = multicodec;
|
20
|
+
this.getConnections = getConnections;
|
21
|
+
this.addEventListener = addEventListener;
|
22
|
+
this.log = new Logger(`stream-manager:${multicodec}`);
|
23
|
+
this.addEventListener("peer:update", this.handlePeerUpdateStreamPool);
|
24
|
+
}
|
25
|
+
async getStream(peerId) {
|
26
|
+
const peerIdStr = peerId.toString();
|
27
|
+
const scheduledStream = this.streamPool.get(peerIdStr);
|
28
|
+
if (scheduledStream) {
|
29
|
+
this.streamPool.delete(peerIdStr);
|
30
|
+
await scheduledStream;
|
31
|
+
}
|
32
|
+
let stream = this.getOpenStreamForCodec(peerId);
|
33
|
+
if (stream) {
|
34
|
+
this.log.info(`Found existing stream peerId=${peerIdStr} multicodec=${this.multicodec}`);
|
35
|
+
this.lockStream(peerIdStr, stream);
|
36
|
+
return stream;
|
37
|
+
}
|
38
|
+
stream = await this.createStream(peerId);
|
39
|
+
this.lockStream(peerIdStr, stream);
|
40
|
+
return stream;
|
41
|
+
}
|
42
|
+
async createStream(peerId, retries = 0) {
|
43
|
+
const connections = this.getConnections(peerId);
|
44
|
+
const connection = selectOpenConnection(connections);
|
45
|
+
if (!connection) {
|
46
|
+
throw new Error(`Failed to get a connection to the peer peerId=${peerId.toString()} multicodec=${this.multicodec}`);
|
47
|
+
}
|
48
|
+
let lastError;
|
49
|
+
let stream;
|
50
|
+
for (let i = 0; i < retries + 1; i++) {
|
51
|
+
try {
|
52
|
+
this.log.info(`Attempting to create a stream for peerId=${peerId.toString()} multicodec=${this.multicodec}`);
|
53
|
+
stream = await connection.newStream(this.multicodec);
|
54
|
+
this.log.info(`Created stream for peerId=${peerId.toString()} multicodec=${this.multicodec}`);
|
55
|
+
break;
|
56
|
+
}
|
57
|
+
catch (error) {
|
58
|
+
lastError = error;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
if (!stream) {
|
62
|
+
throw new Error(`Failed to create a new stream for ${peerId.toString()} -- ` + lastError);
|
63
|
+
}
|
64
|
+
return stream;
|
65
|
+
}
|
66
|
+
async createStreamWithLock(peer) {
|
67
|
+
const peerId = peer.id.toString();
|
68
|
+
if (this.ongoingCreation.has(peerId)) {
|
69
|
+
this.log.info(`Skipping creation of a stream due to lock for peerId=${peerId} multicodec=${this.multicodec}`);
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
try {
|
73
|
+
this.ongoingCreation.add(peerId);
|
74
|
+
await this.createStream(peer.id);
|
75
|
+
}
|
76
|
+
catch (error) {
|
77
|
+
this.log.error(`Failed to createStreamWithLock:`, error);
|
78
|
+
}
|
79
|
+
finally {
|
80
|
+
this.ongoingCreation.delete(peerId);
|
81
|
+
}
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
handlePeerUpdateStreamPool = (evt) => {
|
85
|
+
const { peer } = evt.detail;
|
86
|
+
if (!peer.protocols.includes(this.multicodec)) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
const stream = this.getOpenStreamForCodec(peer.id);
|
90
|
+
if (stream) {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
this.scheduleNewStream(peer);
|
94
|
+
};
|
95
|
+
scheduleNewStream(peer) {
|
96
|
+
this.log.info(`Scheduling creation of a stream for peerId=${peer.id.toString()} multicodec=${this.multicodec}`);
|
97
|
+
// abandon previous attempt
|
98
|
+
if (this.streamPool.has(peer.id.toString())) {
|
99
|
+
this.streamPool.delete(peer.id.toString());
|
100
|
+
}
|
101
|
+
this.streamPool.set(peer.id.toString(), this.createStreamWithLock(peer));
|
102
|
+
}
|
103
|
+
getOpenStreamForCodec(peerId) {
|
104
|
+
const connections = this.getConnections(peerId);
|
105
|
+
const connection = selectOpenConnection(connections);
|
106
|
+
if (!connection) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
const stream = connection.streams.find((s) => s.protocol === this.multicodec);
|
110
|
+
if (!stream) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
const isStreamUnusable = ["done", "closed", "closing"].includes(stream.writeStatus || "");
|
114
|
+
if (isStreamUnusable || this.isStreamLocked(stream)) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
return stream;
|
118
|
+
}
|
119
|
+
lockStream(peerId, stream) {
|
120
|
+
this.log.info(`Locking stream for peerId:${peerId}\tstreamId:${stream.id}`);
|
121
|
+
stream.metadata[STREAM_LOCK_KEY] = true;
|
122
|
+
}
|
123
|
+
isStreamLocked(stream) {
|
124
|
+
return !!stream.metadata[STREAM_LOCK_KEY];
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* A class with predefined helpers, to be used as a base to implement Waku
|
130
|
+
* Protocols.
|
131
|
+
*/
|
132
|
+
class BaseProtocol {
|
133
|
+
multicodec;
|
134
|
+
components;
|
135
|
+
pubsubTopics;
|
136
|
+
addLibp2pEventListener;
|
137
|
+
removeLibp2pEventListener;
|
138
|
+
streamManager;
|
139
|
+
constructor(multicodec, components, pubsubTopics) {
|
140
|
+
this.multicodec = multicodec;
|
141
|
+
this.components = components;
|
142
|
+
this.pubsubTopics = pubsubTopics;
|
143
|
+
this.addLibp2pEventListener = components.events.addEventListener.bind(components.events);
|
144
|
+
this.removeLibp2pEventListener = components.events.removeEventListener.bind(components.events);
|
145
|
+
this.streamManager = new StreamManager(multicodec, components.connectionManager.getConnections.bind(components.connectionManager), this.addLibp2pEventListener);
|
146
|
+
}
|
147
|
+
async getStream(peerId) {
|
148
|
+
return this.streamManager.getStream(peerId);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
export { BaseProtocol as B, StreamManager as S };
|
@@ -1,19 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
function allocUnsafe(size = 0) {
|
14
|
-
return new Uint8Array(size);
|
1
|
+
function equals(aa, bb) {
|
2
|
+
if (aa === bb)
|
3
|
+
return true;
|
4
|
+
if (aa.byteLength !== bb.byteLength) {
|
5
|
+
return false;
|
6
|
+
}
|
7
|
+
for (let ii = 0; ii < aa.byteLength; ii++) {
|
8
|
+
if (aa[ii] !== bb[ii]) {
|
9
|
+
return false;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
return true;
|
15
13
|
}
|
16
|
-
|
17
14
|
function coerce(o) {
|
18
15
|
if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')
|
19
16
|
return o;
|
@@ -24,10 +21,10 @@ function coerce(o) {
|
|
24
21
|
}
|
25
22
|
throw new Error('Unknown type, must be binary type');
|
26
23
|
}
|
27
|
-
function fromString
|
24
|
+
function fromString(str) {
|
28
25
|
return new TextEncoder().encode(str);
|
29
26
|
}
|
30
|
-
function toString
|
27
|
+
function toString(b) {
|
31
28
|
return new TextDecoder().decode(b);
|
32
29
|
}
|
33
30
|
|
@@ -636,8 +633,8 @@ var base8$1 = /*#__PURE__*/Object.freeze({
|
|
636
633
|
const identity = from({
|
637
634
|
prefix: '\x00',
|
638
635
|
name: 'identity',
|
639
|
-
encode: (buf) => toString
|
640
|
-
decode: (str) => fromString
|
636
|
+
encode: (buf) => toString(buf),
|
637
|
+
decode: (str) => fromString(str)
|
641
638
|
});
|
642
639
|
|
643
640
|
var identityBase = /*#__PURE__*/Object.freeze({
|
@@ -648,69 +645,6 @@ var identityBase = /*#__PURE__*/Object.freeze({
|
|
648
645
|
new TextEncoder();
|
649
646
|
new TextDecoder();
|
650
647
|
|
651
|
-
const bases = { ...identityBase, ...base2$1, ...base8$1, ...base10$1, ...base16$1, ...base32$1, ...base36$1, ...base58, ...base64$1, ...base256emoji$1 };
|
652
|
-
|
653
|
-
function createCodec(name, prefix, encode, decode) {
|
654
|
-
return {
|
655
|
-
name,
|
656
|
-
prefix,
|
657
|
-
encoder: {
|
658
|
-
name,
|
659
|
-
prefix,
|
660
|
-
encode
|
661
|
-
},
|
662
|
-
decoder: {
|
663
|
-
decode
|
664
|
-
}
|
665
|
-
};
|
666
|
-
}
|
667
|
-
const string = createCodec('utf8', 'u', (buf) => {
|
668
|
-
const decoder = new TextDecoder('utf8');
|
669
|
-
return 'u' + decoder.decode(buf);
|
670
|
-
}, (str) => {
|
671
|
-
const encoder = new TextEncoder();
|
672
|
-
return encoder.encode(str.substring(1));
|
673
|
-
});
|
674
|
-
const ascii = createCodec('ascii', 'a', (buf) => {
|
675
|
-
let string = 'a';
|
676
|
-
for (let i = 0; i < buf.length; i++) {
|
677
|
-
string += String.fromCharCode(buf[i]);
|
678
|
-
}
|
679
|
-
return string;
|
680
|
-
}, (str) => {
|
681
|
-
str = str.substring(1);
|
682
|
-
const buf = allocUnsafe(str.length);
|
683
|
-
for (let i = 0; i < str.length; i++) {
|
684
|
-
buf[i] = str.charCodeAt(i);
|
685
|
-
}
|
686
|
-
return buf;
|
687
|
-
});
|
688
|
-
const BASES = {
|
689
|
-
utf8: string,
|
690
|
-
'utf-8': string,
|
691
|
-
hex: bases.base16,
|
692
|
-
latin1: ascii,
|
693
|
-
ascii,
|
694
|
-
binary: ascii,
|
695
|
-
...bases
|
696
|
-
};
|
697
|
-
|
698
|
-
/**
|
699
|
-
* Create a `Uint8Array` from the passed string
|
700
|
-
*
|
701
|
-
* Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.
|
702
|
-
*
|
703
|
-
* Also `ascii` which is similar to node's 'binary' encoding.
|
704
|
-
*/
|
705
|
-
function fromString(string, encoding = 'utf8') {
|
706
|
-
const base = BASES[encoding];
|
707
|
-
if (base == null) {
|
708
|
-
throw new Error(`Unsupported encoding "${encoding}"`);
|
709
|
-
}
|
710
|
-
// add multibase prefix
|
711
|
-
return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions
|
712
|
-
}
|
713
|
-
|
714
648
|
var Protocols;
|
715
649
|
(function (Protocols) {
|
716
650
|
Protocols["Relay"] = "relay";
|
@@ -825,6 +759,10 @@ var EConnectionStateEvents;
|
|
825
759
|
EConnectionStateEvents["CONNECTION_STATUS"] = "waku:connection";
|
826
760
|
})(EConnectionStateEvents || (EConnectionStateEvents = {}));
|
827
761
|
|
762
|
+
var HealthStatusChangeEvents;
|
763
|
+
(function (HealthStatusChangeEvents) {
|
764
|
+
HealthStatusChangeEvents["StatusChange"] = "health:change";
|
765
|
+
})(HealthStatusChangeEvents || (HealthStatusChangeEvents = {}));
|
828
766
|
var HealthStatus;
|
829
767
|
(function (HealthStatus) {
|
830
768
|
HealthStatus["Unhealthy"] = "Unhealthy";
|
@@ -832,44 +770,6 @@ var HealthStatus;
|
|
832
770
|
HealthStatus["SufficientlyHealthy"] = "SufficientlyHealthy";
|
833
771
|
})(HealthStatus || (HealthStatus = {}));
|
834
772
|
|
835
|
-
/**
|
836
|
-
* Turns a `Uint8Array` into a string.
|
837
|
-
*
|
838
|
-
* Supports `utf8`, `utf-8` and any encoding supported by the multibase module.
|
839
|
-
*
|
840
|
-
* Also `ascii` which is similar to node's 'binary' encoding.
|
841
|
-
*/
|
842
|
-
function toString(array, encoding = 'utf8') {
|
843
|
-
const base = BASES[encoding];
|
844
|
-
if (base == null) {
|
845
|
-
throw new Error(`Unsupported encoding "${encoding}"`);
|
846
|
-
}
|
847
|
-
// strip multibase prefix
|
848
|
-
return base.encoder.encode(array).substring(1);
|
849
|
-
}
|
850
|
-
|
851
|
-
/**
|
852
|
-
* Decode byte array to utf-8 string.
|
853
|
-
*/
|
854
|
-
const bytesToUtf8 = (b) => toString(b, "utf8");
|
855
|
-
/**
|
856
|
-
* Encode utf-8 string to byte array.
|
857
|
-
*/
|
858
|
-
const utf8ToBytes = (s) => fromString(s, "utf8");
|
859
|
-
/**
|
860
|
-
* Concatenate using Uint8Arrays as `Buffer` has a different behavior with `DataView`
|
861
|
-
*/
|
862
|
-
function concat(byteArrays, totalLength) {
|
863
|
-
const len = byteArrays.reduce((acc, curr) => acc + curr.length, 0);
|
864
|
-
const res = new Uint8Array(len);
|
865
|
-
let offset = 0;
|
866
|
-
for (const bytes of byteArrays) {
|
867
|
-
res.set(bytes, offset);
|
868
|
-
offset += bytes.length;
|
869
|
-
}
|
870
|
-
return res;
|
871
|
-
}
|
872
|
-
|
873
773
|
function getDefaultExportFromCjs (x) {
|
874
774
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
875
775
|
}
|
@@ -1214,24 +1114,62 @@ function setup(env) {
|
|
1214
1114
|
createDebug.names = [];
|
1215
1115
|
createDebug.skips = [];
|
1216
1116
|
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1117
|
+
const split = (typeof namespaces === 'string' ? namespaces : '')
|
1118
|
+
.trim()
|
1119
|
+
.replace(' ', ',')
|
1120
|
+
.split(',')
|
1121
|
+
.filter(Boolean);
|
1220
1122
|
|
1221
|
-
for (
|
1222
|
-
if (
|
1223
|
-
|
1224
|
-
|
1123
|
+
for (const ns of split) {
|
1124
|
+
if (ns[0] === '-') {
|
1125
|
+
createDebug.skips.push(ns.slice(1));
|
1126
|
+
} else {
|
1127
|
+
createDebug.names.push(ns);
|
1225
1128
|
}
|
1129
|
+
}
|
1130
|
+
}
|
1226
1131
|
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1132
|
+
/**
|
1133
|
+
* Checks if the given string matches a namespace template, honoring
|
1134
|
+
* asterisks as wildcards.
|
1135
|
+
*
|
1136
|
+
* @param {String} search
|
1137
|
+
* @param {String} template
|
1138
|
+
* @return {Boolean}
|
1139
|
+
*/
|
1140
|
+
function matchesTemplate(search, template) {
|
1141
|
+
let searchIndex = 0;
|
1142
|
+
let templateIndex = 0;
|
1143
|
+
let starIndex = -1;
|
1144
|
+
let matchIndex = 0;
|
1145
|
+
|
1146
|
+
while (searchIndex < search.length) {
|
1147
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
1148
|
+
// Match character or proceed with wildcard
|
1149
|
+
if (template[templateIndex] === '*') {
|
1150
|
+
starIndex = templateIndex;
|
1151
|
+
matchIndex = searchIndex;
|
1152
|
+
templateIndex++; // Skip the '*'
|
1153
|
+
} else {
|
1154
|
+
searchIndex++;
|
1155
|
+
templateIndex++;
|
1156
|
+
}
|
1157
|
+
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
1158
|
+
// Backtrack to the last '*' and try to match more characters
|
1159
|
+
templateIndex = starIndex + 1;
|
1160
|
+
matchIndex++;
|
1161
|
+
searchIndex = matchIndex;
|
1231
1162
|
} else {
|
1232
|
-
|
1163
|
+
return false; // No match
|
1233
1164
|
}
|
1234
1165
|
}
|
1166
|
+
|
1167
|
+
// Handle trailing '*' in template
|
1168
|
+
while (templateIndex < template.length && template[templateIndex] === '*') {
|
1169
|
+
templateIndex++;
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
return templateIndex === template.length;
|
1235
1173
|
}
|
1236
1174
|
|
1237
1175
|
/**
|
@@ -1242,8 +1180,8 @@ function setup(env) {
|
|
1242
1180
|
*/
|
1243
1181
|
function disable() {
|
1244
1182
|
const namespaces = [
|
1245
|
-
...createDebug.names
|
1246
|
-
...createDebug.skips.map(
|
1183
|
+
...createDebug.names,
|
1184
|
+
...createDebug.skips.map(namespace => '-' + namespace)
|
1247
1185
|
].join(',');
|
1248
1186
|
createDebug.enable('');
|
1249
1187
|
return namespaces;
|
@@ -1257,21 +1195,14 @@ function setup(env) {
|
|
1257
1195
|
* @api public
|
1258
1196
|
*/
|
1259
1197
|
function enabled(name) {
|
1260
|
-
|
1261
|
-
|
1262
|
-
}
|
1263
|
-
|
1264
|
-
let i;
|
1265
|
-
let len;
|
1266
|
-
|
1267
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
1268
|
-
if (createDebug.skips[i].test(name)) {
|
1198
|
+
for (const skip of createDebug.skips) {
|
1199
|
+
if (matchesTemplate(name, skip)) {
|
1269
1200
|
return false;
|
1270
1201
|
}
|
1271
1202
|
}
|
1272
1203
|
|
1273
|
-
for (
|
1274
|
-
if (
|
1204
|
+
for (const ns of createDebug.names) {
|
1205
|
+
if (matchesTemplate(name, ns)) {
|
1275
1206
|
return true;
|
1276
1207
|
}
|
1277
1208
|
}
|
@@ -1279,19 +1210,6 @@ function setup(env) {
|
|
1279
1210
|
return false;
|
1280
1211
|
}
|
1281
1212
|
|
1282
|
-
/**
|
1283
|
-
* Convert regexp to namespace
|
1284
|
-
*
|
1285
|
-
* @param {RegExp} regxep
|
1286
|
-
* @return {String} namespace
|
1287
|
-
* @api private
|
1288
|
-
*/
|
1289
|
-
function toNamespace(regexp) {
|
1290
|
-
return regexp.toString()
|
1291
|
-
.substring(2, regexp.toString().length - 2)
|
1292
|
-
.replace(/\.\*\?$/, '*');
|
1293
|
-
}
|
1294
|
-
|
1295
1213
|
/**
|
1296
1214
|
* Coerce `val`.
|
1297
1215
|
*
|
@@ -1453,6 +1371,7 @@ var common = setup;
|
|
1453
1371
|
|
1454
1372
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
1455
1373
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
1374
|
+
// eslint-disable-next-line no-return-assign
|
1456
1375
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
1457
1376
|
// Is firebug? http://stackoverflow.com/a/398120/376773
|
1458
1377
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
@@ -1626,4 +1545,4 @@ class Logger {
|
|
1626
1545
|
}
|
1627
1546
|
}
|
1628
1547
|
|
1629
|
-
export { EPeersByDiscoveryEvents as E,
|
1548
|
+
export { EPeersByDiscoveryEvents as E, Logger as L, ProtocolError as P, Tags as T, base32 as a, base36 as b, coerce as c, base58btc as d, equals as e, EConnectionStateEvents as f, base2$1 as g, base8$1 as h, identityBase as i, base10$1 as j, base16$1 as k, base32$1 as l, base36$1 as m, base58 as n, base64$1 as o, base256emoji$1 as p };
|