node-datachannel 0.2.3 → 0.2.4
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/.github/workflows/build-linux.yml +2 -0
- package/CMakeLists.txt +2 -2
- package/lib/datachannel-stream.js +86 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +3 -1
- package/node_modules/decompress-response/index.d.ts +14 -21
- package/node_modules/decompress-response/index.js +34 -16
- package/node_modules/decompress-response/license +1 -1
- package/node_modules/decompress-response/package.json +23 -17
- package/node_modules/decompress-response/readme.md +2 -6
- package/node_modules/detect-libc/README.md +124 -42
- package/node_modules/detect-libc/index.d.ts +11 -0
- package/node_modules/detect-libc/lib/detect-libc.js +166 -80
- package/node_modules/detect-libc/lib/process.js +16 -0
- package/node_modules/detect-libc/package.json +20 -20
- package/node_modules/{semver → lru-cache}/LICENSE +0 -0
- package/node_modules/lru-cache/README.md +166 -0
- package/node_modules/lru-cache/index.js +334 -0
- package/node_modules/lru-cache/node_modules/yallist/LICENSE +15 -0
- package/node_modules/lru-cache/node_modules/yallist/README.md +204 -0
- package/node_modules/lru-cache/node_modules/yallist/iterator.js +8 -0
- package/node_modules/lru-cache/node_modules/yallist/package.json +65 -0
- package/node_modules/lru-cache/node_modules/yallist/yallist.js +426 -0
- package/node_modules/lru-cache/package.json +74 -0
- package/node_modules/mimic-response/index.d.ts +2 -2
- package/node_modules/mimic-response/index.js +41 -2
- package/node_modules/mimic-response/package.json +17 -17
- package/node_modules/mimic-response/readme.md +22 -1
- package/node_modules/node-abi/.circleci/config.yml +63 -0
- package/node_modules/node-abi/.releaserc.json +9 -0
- package/node_modules/node-abi/abi_registry.json +45 -3
- package/node_modules/node-abi/index.js +5 -2
- package/node_modules/node-abi/node_modules/semver/CHANGELOG.md +111 -0
- package/node_modules/node-abi/node_modules/semver/LICENSE +15 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/README.md +180 -26
- package/node_modules/node-abi/node_modules/semver/bin/semver.js +173 -0
- package/node_modules/node-abi/node_modules/semver/classes/comparator.js +135 -0
- package/node_modules/node-abi/node_modules/semver/classes/index.js +5 -0
- package/node_modules/node-abi/node_modules/semver/classes/range.js +510 -0
- package/node_modules/node-abi/node_modules/semver/classes/semver.js +287 -0
- package/node_modules/node-abi/node_modules/semver/functions/clean.js +6 -0
- package/node_modules/node-abi/node_modules/semver/functions/cmp.js +48 -0
- package/node_modules/node-abi/node_modules/semver/functions/coerce.js +51 -0
- package/node_modules/node-abi/node_modules/semver/functions/compare-build.js +7 -0
- package/node_modules/node-abi/node_modules/semver/functions/compare-loose.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/compare.js +5 -0
- package/node_modules/node-abi/node_modules/semver/functions/diff.js +23 -0
- package/node_modules/node-abi/node_modules/semver/functions/eq.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/gt.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/gte.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/inc.js +15 -0
- package/node_modules/node-abi/node_modules/semver/functions/lt.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/lte.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/major.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/minor.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/neq.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/parse.js +33 -0
- package/node_modules/node-abi/node_modules/semver/functions/patch.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/prerelease.js +6 -0
- package/node_modules/node-abi/node_modules/semver/functions/rcompare.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/rsort.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/satisfies.js +10 -0
- package/node_modules/node-abi/node_modules/semver/functions/sort.js +3 -0
- package/node_modules/node-abi/node_modules/semver/functions/valid.js +6 -0
- package/node_modules/node-abi/node_modules/semver/index.js +48 -0
- package/node_modules/node-abi/node_modules/semver/internal/constants.js +17 -0
- package/node_modules/node-abi/node_modules/semver/internal/debug.js +9 -0
- package/node_modules/node-abi/node_modules/semver/internal/identifiers.js +23 -0
- package/node_modules/node-abi/node_modules/semver/internal/parse-options.js +11 -0
- package/node_modules/node-abi/node_modules/semver/internal/re.js +182 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/package.json +32 -23
- package/node_modules/node-abi/node_modules/semver/preload.js +2 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/range.bnf +0 -0
- package/node_modules/node-abi/node_modules/semver/ranges/gtr.js +4 -0
- package/node_modules/node-abi/node_modules/semver/ranges/intersects.js +7 -0
- package/node_modules/node-abi/node_modules/semver/ranges/ltr.js +4 -0
- package/node_modules/node-abi/node_modules/semver/ranges/max-satisfying.js +25 -0
- package/node_modules/node-abi/node_modules/semver/ranges/min-satisfying.js +24 -0
- package/node_modules/node-abi/node_modules/semver/ranges/min-version.js +60 -0
- package/node_modules/node-abi/node_modules/semver/ranges/outside.js +80 -0
- package/node_modules/node-abi/node_modules/semver/ranges/simplify.js +44 -0
- package/node_modules/node-abi/node_modules/semver/ranges/subset.js +222 -0
- package/node_modules/node-abi/node_modules/semver/ranges/to-comparators.js +8 -0
- package/node_modules/node-abi/node_modules/semver/ranges/valid.js +11 -0
- package/node_modules/node-abi/package.json +20 -17
- package/node_modules/node-abi/test/index.js +7 -15
- package/node_modules/prebuild-install/CHANGELOG.md +24 -7
- package/node_modules/prebuild-install/README.md +24 -4
- package/node_modules/prebuild-install/asset.js +10 -10
- package/node_modules/prebuild-install/bin.js +13 -13
- package/node_modules/prebuild-install/download.js +22 -22
- package/node_modules/prebuild-install/log.js +4 -4
- package/node_modules/prebuild-install/package.json +18 -19
- package/node_modules/prebuild-install/proxy.js +10 -10
- package/node_modules/prebuild-install/rc.js +12 -12
- package/node_modules/prebuild-install/util.js +14 -14
- package/node_modules/simple-get/.github/dependabot.yml +15 -0
- package/node_modules/simple-get/.github/workflows/ci.yml +23 -0
- package/node_modules/simple-get/README.md +17 -3
- package/node_modules/simple-get/index.js +9 -0
- package/node_modules/simple-get/package.json +27 -13
- package/package.json +6 -5
- package/test/test.js +45 -0
- package/node_modules/detect-libc/.npmignore +0 -7
- package/node_modules/detect-libc/bin/detect-libc.js +0 -18
- package/node_modules/node-abi/.travis.yml +0 -17
- package/node_modules/semver/CHANGELOG.md +0 -39
- package/node_modules/semver/bin/semver +0 -160
- package/node_modules/semver/semver.js +0 -1483
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
module.exports = Yallist
|
|
3
|
+
|
|
4
|
+
Yallist.Node = Node
|
|
5
|
+
Yallist.create = Yallist
|
|
6
|
+
|
|
7
|
+
function Yallist (list) {
|
|
8
|
+
var self = this
|
|
9
|
+
if (!(self instanceof Yallist)) {
|
|
10
|
+
self = new Yallist()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
self.tail = null
|
|
14
|
+
self.head = null
|
|
15
|
+
self.length = 0
|
|
16
|
+
|
|
17
|
+
if (list && typeof list.forEach === 'function') {
|
|
18
|
+
list.forEach(function (item) {
|
|
19
|
+
self.push(item)
|
|
20
|
+
})
|
|
21
|
+
} else if (arguments.length > 0) {
|
|
22
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
23
|
+
self.push(arguments[i])
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return self
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Yallist.prototype.removeNode = function (node) {
|
|
31
|
+
if (node.list !== this) {
|
|
32
|
+
throw new Error('removing node which does not belong to this list')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var next = node.next
|
|
36
|
+
var prev = node.prev
|
|
37
|
+
|
|
38
|
+
if (next) {
|
|
39
|
+
next.prev = prev
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (prev) {
|
|
43
|
+
prev.next = next
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (node === this.head) {
|
|
47
|
+
this.head = next
|
|
48
|
+
}
|
|
49
|
+
if (node === this.tail) {
|
|
50
|
+
this.tail = prev
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
node.list.length--
|
|
54
|
+
node.next = null
|
|
55
|
+
node.prev = null
|
|
56
|
+
node.list = null
|
|
57
|
+
|
|
58
|
+
return next
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Yallist.prototype.unshiftNode = function (node) {
|
|
62
|
+
if (node === this.head) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (node.list) {
|
|
67
|
+
node.list.removeNode(node)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var head = this.head
|
|
71
|
+
node.list = this
|
|
72
|
+
node.next = head
|
|
73
|
+
if (head) {
|
|
74
|
+
head.prev = node
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.head = node
|
|
78
|
+
if (!this.tail) {
|
|
79
|
+
this.tail = node
|
|
80
|
+
}
|
|
81
|
+
this.length++
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Yallist.prototype.pushNode = function (node) {
|
|
85
|
+
if (node === this.tail) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (node.list) {
|
|
90
|
+
node.list.removeNode(node)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var tail = this.tail
|
|
94
|
+
node.list = this
|
|
95
|
+
node.prev = tail
|
|
96
|
+
if (tail) {
|
|
97
|
+
tail.next = node
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.tail = node
|
|
101
|
+
if (!this.head) {
|
|
102
|
+
this.head = node
|
|
103
|
+
}
|
|
104
|
+
this.length++
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Yallist.prototype.push = function () {
|
|
108
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
109
|
+
push(this, arguments[i])
|
|
110
|
+
}
|
|
111
|
+
return this.length
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Yallist.prototype.unshift = function () {
|
|
115
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
116
|
+
unshift(this, arguments[i])
|
|
117
|
+
}
|
|
118
|
+
return this.length
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Yallist.prototype.pop = function () {
|
|
122
|
+
if (!this.tail) {
|
|
123
|
+
return undefined
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var res = this.tail.value
|
|
127
|
+
this.tail = this.tail.prev
|
|
128
|
+
if (this.tail) {
|
|
129
|
+
this.tail.next = null
|
|
130
|
+
} else {
|
|
131
|
+
this.head = null
|
|
132
|
+
}
|
|
133
|
+
this.length--
|
|
134
|
+
return res
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Yallist.prototype.shift = function () {
|
|
138
|
+
if (!this.head) {
|
|
139
|
+
return undefined
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var res = this.head.value
|
|
143
|
+
this.head = this.head.next
|
|
144
|
+
if (this.head) {
|
|
145
|
+
this.head.prev = null
|
|
146
|
+
} else {
|
|
147
|
+
this.tail = null
|
|
148
|
+
}
|
|
149
|
+
this.length--
|
|
150
|
+
return res
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
Yallist.prototype.forEach = function (fn, thisp) {
|
|
154
|
+
thisp = thisp || this
|
|
155
|
+
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
156
|
+
fn.call(thisp, walker.value, i, this)
|
|
157
|
+
walker = walker.next
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
Yallist.prototype.forEachReverse = function (fn, thisp) {
|
|
162
|
+
thisp = thisp || this
|
|
163
|
+
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
164
|
+
fn.call(thisp, walker.value, i, this)
|
|
165
|
+
walker = walker.prev
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Yallist.prototype.get = function (n) {
|
|
170
|
+
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
171
|
+
// abort out of the list early if we hit a cycle
|
|
172
|
+
walker = walker.next
|
|
173
|
+
}
|
|
174
|
+
if (i === n && walker !== null) {
|
|
175
|
+
return walker.value
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Yallist.prototype.getReverse = function (n) {
|
|
180
|
+
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
181
|
+
// abort out of the list early if we hit a cycle
|
|
182
|
+
walker = walker.prev
|
|
183
|
+
}
|
|
184
|
+
if (i === n && walker !== null) {
|
|
185
|
+
return walker.value
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Yallist.prototype.map = function (fn, thisp) {
|
|
190
|
+
thisp = thisp || this
|
|
191
|
+
var res = new Yallist()
|
|
192
|
+
for (var walker = this.head; walker !== null;) {
|
|
193
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
194
|
+
walker = walker.next
|
|
195
|
+
}
|
|
196
|
+
return res
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
Yallist.prototype.mapReverse = function (fn, thisp) {
|
|
200
|
+
thisp = thisp || this
|
|
201
|
+
var res = new Yallist()
|
|
202
|
+
for (var walker = this.tail; walker !== null;) {
|
|
203
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
204
|
+
walker = walker.prev
|
|
205
|
+
}
|
|
206
|
+
return res
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Yallist.prototype.reduce = function (fn, initial) {
|
|
210
|
+
var acc
|
|
211
|
+
var walker = this.head
|
|
212
|
+
if (arguments.length > 1) {
|
|
213
|
+
acc = initial
|
|
214
|
+
} else if (this.head) {
|
|
215
|
+
walker = this.head.next
|
|
216
|
+
acc = this.head.value
|
|
217
|
+
} else {
|
|
218
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
for (var i = 0; walker !== null; i++) {
|
|
222
|
+
acc = fn(acc, walker.value, i)
|
|
223
|
+
walker = walker.next
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return acc
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
Yallist.prototype.reduceReverse = function (fn, initial) {
|
|
230
|
+
var acc
|
|
231
|
+
var walker = this.tail
|
|
232
|
+
if (arguments.length > 1) {
|
|
233
|
+
acc = initial
|
|
234
|
+
} else if (this.tail) {
|
|
235
|
+
walker = this.tail.prev
|
|
236
|
+
acc = this.tail.value
|
|
237
|
+
} else {
|
|
238
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
for (var i = this.length - 1; walker !== null; i--) {
|
|
242
|
+
acc = fn(acc, walker.value, i)
|
|
243
|
+
walker = walker.prev
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return acc
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
Yallist.prototype.toArray = function () {
|
|
250
|
+
var arr = new Array(this.length)
|
|
251
|
+
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
252
|
+
arr[i] = walker.value
|
|
253
|
+
walker = walker.next
|
|
254
|
+
}
|
|
255
|
+
return arr
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
Yallist.prototype.toArrayReverse = function () {
|
|
259
|
+
var arr = new Array(this.length)
|
|
260
|
+
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
261
|
+
arr[i] = walker.value
|
|
262
|
+
walker = walker.prev
|
|
263
|
+
}
|
|
264
|
+
return arr
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
Yallist.prototype.slice = function (from, to) {
|
|
268
|
+
to = to || this.length
|
|
269
|
+
if (to < 0) {
|
|
270
|
+
to += this.length
|
|
271
|
+
}
|
|
272
|
+
from = from || 0
|
|
273
|
+
if (from < 0) {
|
|
274
|
+
from += this.length
|
|
275
|
+
}
|
|
276
|
+
var ret = new Yallist()
|
|
277
|
+
if (to < from || to < 0) {
|
|
278
|
+
return ret
|
|
279
|
+
}
|
|
280
|
+
if (from < 0) {
|
|
281
|
+
from = 0
|
|
282
|
+
}
|
|
283
|
+
if (to > this.length) {
|
|
284
|
+
to = this.length
|
|
285
|
+
}
|
|
286
|
+
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
287
|
+
walker = walker.next
|
|
288
|
+
}
|
|
289
|
+
for (; walker !== null && i < to; i++, walker = walker.next) {
|
|
290
|
+
ret.push(walker.value)
|
|
291
|
+
}
|
|
292
|
+
return ret
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
Yallist.prototype.sliceReverse = function (from, to) {
|
|
296
|
+
to = to || this.length
|
|
297
|
+
if (to < 0) {
|
|
298
|
+
to += this.length
|
|
299
|
+
}
|
|
300
|
+
from = from || 0
|
|
301
|
+
if (from < 0) {
|
|
302
|
+
from += this.length
|
|
303
|
+
}
|
|
304
|
+
var ret = new Yallist()
|
|
305
|
+
if (to < from || to < 0) {
|
|
306
|
+
return ret
|
|
307
|
+
}
|
|
308
|
+
if (from < 0) {
|
|
309
|
+
from = 0
|
|
310
|
+
}
|
|
311
|
+
if (to > this.length) {
|
|
312
|
+
to = this.length
|
|
313
|
+
}
|
|
314
|
+
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
|
315
|
+
walker = walker.prev
|
|
316
|
+
}
|
|
317
|
+
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
|
318
|
+
ret.push(walker.value)
|
|
319
|
+
}
|
|
320
|
+
return ret
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
|
|
324
|
+
if (start > this.length) {
|
|
325
|
+
start = this.length - 1
|
|
326
|
+
}
|
|
327
|
+
if (start < 0) {
|
|
328
|
+
start = this.length + start;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
|
332
|
+
walker = walker.next
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var ret = []
|
|
336
|
+
for (var i = 0; walker && i < deleteCount; i++) {
|
|
337
|
+
ret.push(walker.value)
|
|
338
|
+
walker = this.removeNode(walker)
|
|
339
|
+
}
|
|
340
|
+
if (walker === null) {
|
|
341
|
+
walker = this.tail
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (walker !== this.head && walker !== this.tail) {
|
|
345
|
+
walker = walker.prev
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
349
|
+
walker = insert(this, walker, nodes[i])
|
|
350
|
+
}
|
|
351
|
+
return ret;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Yallist.prototype.reverse = function () {
|
|
355
|
+
var head = this.head
|
|
356
|
+
var tail = this.tail
|
|
357
|
+
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
358
|
+
var p = walker.prev
|
|
359
|
+
walker.prev = walker.next
|
|
360
|
+
walker.next = p
|
|
361
|
+
}
|
|
362
|
+
this.head = tail
|
|
363
|
+
this.tail = head
|
|
364
|
+
return this
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function insert (self, node, value) {
|
|
368
|
+
var inserted = node === self.head ?
|
|
369
|
+
new Node(value, null, node, self) :
|
|
370
|
+
new Node(value, node, node.next, self)
|
|
371
|
+
|
|
372
|
+
if (inserted.next === null) {
|
|
373
|
+
self.tail = inserted
|
|
374
|
+
}
|
|
375
|
+
if (inserted.prev === null) {
|
|
376
|
+
self.head = inserted
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
self.length++
|
|
380
|
+
|
|
381
|
+
return inserted
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function push (self, item) {
|
|
385
|
+
self.tail = new Node(item, self.tail, null, self)
|
|
386
|
+
if (!self.head) {
|
|
387
|
+
self.head = self.tail
|
|
388
|
+
}
|
|
389
|
+
self.length++
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function unshift (self, item) {
|
|
393
|
+
self.head = new Node(item, null, self.head, self)
|
|
394
|
+
if (!self.tail) {
|
|
395
|
+
self.tail = self.head
|
|
396
|
+
}
|
|
397
|
+
self.length++
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function Node (value, prev, next, list) {
|
|
401
|
+
if (!(this instanceof Node)) {
|
|
402
|
+
return new Node(value, prev, next, list)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this.list = list
|
|
406
|
+
this.value = value
|
|
407
|
+
|
|
408
|
+
if (prev) {
|
|
409
|
+
prev.next = this
|
|
410
|
+
this.prev = prev
|
|
411
|
+
} else {
|
|
412
|
+
this.prev = null
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (next) {
|
|
416
|
+
next.prev = this
|
|
417
|
+
this.next = next
|
|
418
|
+
} else {
|
|
419
|
+
this.next = null
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
// add if support for Symbol.iterator is present
|
|
425
|
+
require('./iterator.js')(Yallist)
|
|
426
|
+
} catch (er) {}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
"lru-cache@6.0.0",
|
|
5
|
+
"/home/runner/work/node-datachannel/node-datachannel"
|
|
6
|
+
]
|
|
7
|
+
],
|
|
8
|
+
"_from": "lru-cache@6.0.0",
|
|
9
|
+
"_id": "lru-cache@6.0.0",
|
|
10
|
+
"_inBundle": false,
|
|
11
|
+
"_integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
12
|
+
"_location": "/lru-cache",
|
|
13
|
+
"_phantomChildren": {},
|
|
14
|
+
"_requested": {
|
|
15
|
+
"type": "version",
|
|
16
|
+
"registry": true,
|
|
17
|
+
"raw": "lru-cache@6.0.0",
|
|
18
|
+
"name": "lru-cache",
|
|
19
|
+
"escapedName": "lru-cache",
|
|
20
|
+
"rawSpec": "6.0.0",
|
|
21
|
+
"saveSpec": null,
|
|
22
|
+
"fetchSpec": "6.0.0"
|
|
23
|
+
},
|
|
24
|
+
"_requiredBy": [
|
|
25
|
+
"/jest-snapshot/semver",
|
|
26
|
+
"/node-abi/semver",
|
|
27
|
+
"/prebuild/node-abi/semver"
|
|
28
|
+
],
|
|
29
|
+
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
30
|
+
"_spec": "6.0.0",
|
|
31
|
+
"_where": "/home/runner/work/node-datachannel/node-datachannel",
|
|
32
|
+
"author": {
|
|
33
|
+
"name": "Isaac Z. Schlueter",
|
|
34
|
+
"email": "i@izs.me"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/isaacs/node-lru-cache/issues"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"yallist": "^4.0.0"
|
|
41
|
+
},
|
|
42
|
+
"description": "A cache object that deletes the least-recently-used items.",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"benchmark": "^2.1.4",
|
|
45
|
+
"tap": "^14.10.7"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=10"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"index.js"
|
|
52
|
+
],
|
|
53
|
+
"homepage": "https://github.com/isaacs/node-lru-cache#readme",
|
|
54
|
+
"keywords": [
|
|
55
|
+
"mru",
|
|
56
|
+
"lru",
|
|
57
|
+
"cache"
|
|
58
|
+
],
|
|
59
|
+
"license": "ISC",
|
|
60
|
+
"main": "index.js",
|
|
61
|
+
"name": "lru-cache",
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "git://github.com/isaacs/node-lru-cache.git"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"postversion": "npm publish",
|
|
68
|
+
"prepublishOnly": "git push origin --follow-tags",
|
|
69
|
+
"preversion": "npm test",
|
|
70
|
+
"snap": "tap",
|
|
71
|
+
"test": "tap"
|
|
72
|
+
},
|
|
73
|
+
"version": "6.0.0"
|
|
74
|
+
}
|
|
@@ -10,8 +10,8 @@ Makes `toStream` include the properties from `fromStream`.
|
|
|
10
10
|
@return The same object as `toStream`.
|
|
11
11
|
*/
|
|
12
12
|
declare function mimicResponse<T extends NodeJS.ReadableStream>(
|
|
13
|
-
fromStream: IncomingMessage,
|
|
13
|
+
fromStream: IncomingMessage, // eslint-disable-line @typescript-eslint/prefer-readonly-parameter-types
|
|
14
14
|
toStream: T,
|
|
15
|
-
):
|
|
15
|
+
): T & IncomingMessage;
|
|
16
16
|
|
|
17
17
|
export = mimicResponse;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
const knownProperties = [
|
|
7
7
|
'aborted',
|
|
8
8
|
'complete',
|
|
9
|
-
'destroy',
|
|
10
9
|
'headers',
|
|
11
10
|
'httpVersion',
|
|
12
11
|
'httpVersionMinor',
|
|
@@ -23,16 +22,56 @@ const knownProperties = [
|
|
|
23
22
|
];
|
|
24
23
|
|
|
25
24
|
module.exports = (fromStream, toStream) => {
|
|
25
|
+
if (toStream._readableState.autoDestroy) {
|
|
26
|
+
throw new Error('The second stream must have the `autoDestroy` option set to `false`');
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties));
|
|
27
30
|
|
|
31
|
+
const properties = {};
|
|
32
|
+
|
|
28
33
|
for (const property of fromProperties) {
|
|
29
34
|
// Don't overwrite existing properties.
|
|
30
35
|
if (property in toStream) {
|
|
31
36
|
continue;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
properties[property] = {
|
|
40
|
+
get() {
|
|
41
|
+
const value = fromStream[property];
|
|
42
|
+
const isFunction = typeof value === 'function';
|
|
43
|
+
|
|
44
|
+
return isFunction ? value.bind(fromStream) : value;
|
|
45
|
+
},
|
|
46
|
+
set(value) {
|
|
47
|
+
fromStream[property] = value;
|
|
48
|
+
},
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: false
|
|
51
|
+
};
|
|
35
52
|
}
|
|
36
53
|
|
|
54
|
+
Object.defineProperties(toStream, properties);
|
|
55
|
+
|
|
56
|
+
fromStream.once('aborted', () => {
|
|
57
|
+
toStream.destroy();
|
|
58
|
+
|
|
59
|
+
toStream.emit('aborted');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
fromStream.once('close', () => {
|
|
63
|
+
if (fromStream.complete) {
|
|
64
|
+
if (toStream.readable) {
|
|
65
|
+
toStream.once('end', () => {
|
|
66
|
+
toStream.emit('close');
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
toStream.emit('close');
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
toStream.emit('close');
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
37
76
|
return toStream;
|
|
38
77
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_args": [
|
|
3
3
|
[
|
|
4
|
-
"mimic-response@
|
|
4
|
+
"mimic-response@3.1.0",
|
|
5
5
|
"/home/runner/work/node-datachannel/node-datachannel"
|
|
6
6
|
]
|
|
7
7
|
],
|
|
8
|
-
"_from": "mimic-response@
|
|
9
|
-
"_id": "mimic-response@
|
|
8
|
+
"_from": "mimic-response@3.1.0",
|
|
9
|
+
"_id": "mimic-response@3.1.0",
|
|
10
10
|
"_inBundle": false,
|
|
11
|
-
"_integrity": "sha512-
|
|
11
|
+
"_integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
|
12
12
|
"_location": "/mimic-response",
|
|
13
13
|
"_phantomChildren": {},
|
|
14
14
|
"_requested": {
|
|
15
15
|
"type": "version",
|
|
16
16
|
"registry": true,
|
|
17
|
-
"raw": "mimic-response@
|
|
17
|
+
"raw": "mimic-response@3.1.0",
|
|
18
18
|
"name": "mimic-response",
|
|
19
19
|
"escapedName": "mimic-response",
|
|
20
|
-
"rawSpec": "
|
|
20
|
+
"rawSpec": "3.1.0",
|
|
21
21
|
"saveSpec": null,
|
|
22
|
-
"fetchSpec": "
|
|
22
|
+
"fetchSpec": "3.1.0"
|
|
23
23
|
},
|
|
24
24
|
"_requiredBy": [
|
|
25
25
|
"/decompress-response"
|
|
26
26
|
],
|
|
27
|
-
"_resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-
|
|
28
|
-
"_spec": "
|
|
27
|
+
"_resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
|
28
|
+
"_spec": "3.1.0",
|
|
29
29
|
"_where": "/home/runner/work/node-datachannel/node-datachannel",
|
|
30
30
|
"author": {
|
|
31
31
|
"name": "Sindre Sorhus",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"description": "Mimic a Node.js HTTP response stream",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"ava": "^1.1.0",
|
|
40
|
+
"@types/node": "^14.0.1",
|
|
41
|
+
"ava": "^2.4.0",
|
|
43
42
|
"create-test-server": "^2.4.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
43
|
+
"p-event": "^4.1.0",
|
|
44
|
+
"pify": "^5.0.0",
|
|
45
|
+
"tsd": "^0.11.0",
|
|
46
|
+
"xo": "^0.30.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">=10"
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"index.d.ts",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"scripts": {
|
|
74
74
|
"test": "xo && ava && tsd"
|
|
75
75
|
},
|
|
76
|
-
"version": "
|
|
76
|
+
"version": "3.1.0"
|
|
77
77
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mimic-response [](https://travis-ci.com/sindresorhus/mimic-response)
|
|
2
2
|
|
|
3
3
|
> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
|
4
4
|
|
|
@@ -27,6 +27,27 @@ console.log(myStream.statusCode);
|
|
|
27
27
|
|
|
28
28
|
### mimicResponse(from, to)
|
|
29
29
|
|
|
30
|
+
**Note #1:** The `from.destroy(error)` function is not proxied. You have to call it manually:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
const stream = require('stream');
|
|
34
|
+
const mimicResponse = require('mimic-response');
|
|
35
|
+
|
|
36
|
+
const responseStream = getHttpResponseStream();
|
|
37
|
+
|
|
38
|
+
const myStream = new stream.PassThrough({
|
|
39
|
+
destroy(error, callback) {
|
|
40
|
+
responseStream.destroy();
|
|
41
|
+
|
|
42
|
+
callback(error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
myStream.destroy();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Please note that `myStream` and `responseStream` never throws. The error is passed to the request instead.
|
|
50
|
+
|
|
30
51
|
#### from
|
|
31
52
|
|
|
32
53
|
Type: `Stream`
|