pnpm 6.32.21 → 6.32.24
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/dist/node_modules/.modules.yaml +1 -1
- package/dist/node_modules/.pnpm/lock.yaml +15 -15
- package/dist/node_modules/minipass/LICENSE +1 -1
- package/dist/node_modules/minipass/index.js +191 -102
- package/dist/node_modules/minipass/package.json +19 -3
- package/dist/pnpm.cjs +2216 -1292
- package/package.json +19 -19
|
@@ -116,7 +116,7 @@ packages:
|
|
|
116
116
|
glob: 7.2.3
|
|
117
117
|
infer-owner: 1.0.4
|
|
118
118
|
lru-cache: 6.0.0
|
|
119
|
-
minipass: 3.
|
|
119
|
+
minipass: 3.3.3
|
|
120
120
|
minipass-collect: 1.0.2
|
|
121
121
|
minipass-flush: 1.0.5
|
|
122
122
|
minipass-pipeline: 1.2.4
|
|
@@ -210,7 +210,7 @@ packages:
|
|
|
210
210
|
resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==}
|
|
211
211
|
engines: {node: '>= 8'}
|
|
212
212
|
dependencies:
|
|
213
|
-
minipass: 3.
|
|
213
|
+
minipass: 3.3.3
|
|
214
214
|
dev: false
|
|
215
215
|
optional: true
|
|
216
216
|
|
|
@@ -369,7 +369,7 @@ packages:
|
|
|
369
369
|
https-proxy-agent: 5.0.1
|
|
370
370
|
is-lambda: 1.0.1
|
|
371
371
|
lru-cache: 6.0.0
|
|
372
|
-
minipass: 3.
|
|
372
|
+
minipass: 3.3.3
|
|
373
373
|
minipass-collect: 1.0.2
|
|
374
374
|
minipass-fetch: 1.4.1
|
|
375
375
|
minipass-flush: 1.0.5
|
|
@@ -394,7 +394,7 @@ packages:
|
|
|
394
394
|
resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==}
|
|
395
395
|
engines: {node: '>= 8'}
|
|
396
396
|
dependencies:
|
|
397
|
-
minipass: 3.
|
|
397
|
+
minipass: 3.3.3
|
|
398
398
|
dev: false
|
|
399
399
|
optional: true
|
|
400
400
|
|
|
@@ -402,7 +402,7 @@ packages:
|
|
|
402
402
|
resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==}
|
|
403
403
|
engines: {node: '>=8'}
|
|
404
404
|
dependencies:
|
|
405
|
-
minipass: 3.
|
|
405
|
+
minipass: 3.3.3
|
|
406
406
|
minipass-sized: 1.0.3
|
|
407
407
|
minizlib: 2.1.2
|
|
408
408
|
optionalDependencies:
|
|
@@ -414,7 +414,7 @@ packages:
|
|
|
414
414
|
resolution: {integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==}
|
|
415
415
|
engines: {node: '>= 8'}
|
|
416
416
|
dependencies:
|
|
417
|
-
minipass: 3.
|
|
417
|
+
minipass: 3.3.3
|
|
418
418
|
dev: false
|
|
419
419
|
optional: true
|
|
420
420
|
|
|
@@ -422,7 +422,7 @@ packages:
|
|
|
422
422
|
resolution: {integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==}
|
|
423
423
|
engines: {node: '>=8'}
|
|
424
424
|
dependencies:
|
|
425
|
-
minipass: 3.
|
|
425
|
+
minipass: 3.3.3
|
|
426
426
|
dev: false
|
|
427
427
|
optional: true
|
|
428
428
|
|
|
@@ -430,12 +430,12 @@ packages:
|
|
|
430
430
|
resolution: {integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==}
|
|
431
431
|
engines: {node: '>=8'}
|
|
432
432
|
dependencies:
|
|
433
|
-
minipass: 3.
|
|
433
|
+
minipass: 3.3.3
|
|
434
434
|
dev: false
|
|
435
435
|
optional: true
|
|
436
436
|
|
|
437
|
-
/minipass/3.
|
|
438
|
-
resolution: {integrity: sha512-
|
|
437
|
+
/minipass/3.3.3:
|
|
438
|
+
resolution: {integrity: sha512-N0BOsdFAlNRfmwMhjAsLVWOk7Ljmeb39iqFlsV1At+jqRhSUP9yeof8FyJu4imaJiSUp8vQebWD/guZwGQC8iA==}
|
|
439
439
|
engines: {node: '>=8'}
|
|
440
440
|
dependencies:
|
|
441
441
|
yallist: 4.0.0
|
|
@@ -446,7 +446,7 @@ packages:
|
|
|
446
446
|
resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
|
|
447
447
|
engines: {node: '>= 8'}
|
|
448
448
|
dependencies:
|
|
449
|
-
minipass: 3.
|
|
449
|
+
minipass: 3.3.3
|
|
450
450
|
yallist: 4.0.0
|
|
451
451
|
dev: false
|
|
452
452
|
optional: true
|
|
@@ -634,7 +634,7 @@ packages:
|
|
|
634
634
|
resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==}
|
|
635
635
|
engines: {node: '>= 8'}
|
|
636
636
|
dependencies:
|
|
637
|
-
minipass: 3.
|
|
637
|
+
minipass: 3.3.3
|
|
638
638
|
dev: false
|
|
639
639
|
optional: true
|
|
640
640
|
|
|
@@ -669,7 +669,7 @@ packages:
|
|
|
669
669
|
dependencies:
|
|
670
670
|
chownr: 2.0.0
|
|
671
671
|
fs-minipass: 2.1.0
|
|
672
|
-
minipass: 3.
|
|
672
|
+
minipass: 3.3.3
|
|
673
673
|
minizlib: 2.1.2
|
|
674
674
|
mkdirp: 1.0.4
|
|
675
675
|
yallist: 4.0.0
|
|
@@ -691,7 +691,7 @@ packages:
|
|
|
691
691
|
optional: true
|
|
692
692
|
|
|
693
693
|
/util-deprecate/1.0.2:
|
|
694
|
-
resolution: {integrity:
|
|
694
|
+
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
|
695
695
|
dev: false
|
|
696
696
|
optional: true
|
|
697
697
|
|
|
@@ -712,7 +712,7 @@ packages:
|
|
|
712
712
|
optional: true
|
|
713
713
|
|
|
714
714
|
/wrappy/1.0.2:
|
|
715
|
-
resolution: {integrity:
|
|
715
|
+
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
|
716
716
|
dev: false
|
|
717
717
|
optional: true
|
|
718
718
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The ISC License
|
|
2
2
|
|
|
3
|
-
Copyright (c) npm, Inc. and Contributors
|
|
3
|
+
Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors
|
|
4
4
|
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
6
|
purpose with or without fee is hereby granted, provided that the above
|
|
@@ -5,7 +5,6 @@ const proc = typeof process === 'object' && process ? process : {
|
|
|
5
5
|
}
|
|
6
6
|
const EE = require('events')
|
|
7
7
|
const Stream = require('stream')
|
|
8
|
-
const Yallist = require('yallist')
|
|
9
8
|
const SD = require('string_decoder').StringDecoder
|
|
10
9
|
|
|
11
10
|
const EOF = Symbol('EOF')
|
|
@@ -27,6 +26,12 @@ const BUFFERPUSH = Symbol('bufferPush')
|
|
|
27
26
|
const BUFFERSHIFT = Symbol('bufferShift')
|
|
28
27
|
const OBJECTMODE = Symbol('objectMode')
|
|
29
28
|
const DESTROYED = Symbol('destroyed')
|
|
29
|
+
const EMITDATA = Symbol('emitData')
|
|
30
|
+
const EMITEND = Symbol('emitEnd')
|
|
31
|
+
const EMITEND2 = Symbol('emitEnd2')
|
|
32
|
+
const ASYNC = Symbol('async')
|
|
33
|
+
|
|
34
|
+
const defer = fn => Promise.resolve().then(fn)
|
|
30
35
|
|
|
31
36
|
// TODO remove when Node v8 support drops
|
|
32
37
|
const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
|
|
@@ -51,14 +56,46 @@ const isArrayBuffer = b => b instanceof ArrayBuffer ||
|
|
|
51
56
|
|
|
52
57
|
const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
|
|
53
58
|
|
|
59
|
+
class Pipe {
|
|
60
|
+
constructor (src, dest, opts) {
|
|
61
|
+
this.src = src
|
|
62
|
+
this.dest = dest
|
|
63
|
+
this.opts = opts
|
|
64
|
+
this.ondrain = () => src[RESUME]()
|
|
65
|
+
dest.on('drain', this.ondrain)
|
|
66
|
+
}
|
|
67
|
+
unpipe () {
|
|
68
|
+
this.dest.removeListener('drain', this.ondrain)
|
|
69
|
+
}
|
|
70
|
+
// istanbul ignore next - only here for the prototype
|
|
71
|
+
proxyErrors () {}
|
|
72
|
+
end () {
|
|
73
|
+
this.unpipe()
|
|
74
|
+
if (this.opts.end)
|
|
75
|
+
this.dest.end()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class PipeProxyErrors extends Pipe {
|
|
80
|
+
unpipe () {
|
|
81
|
+
this.src.removeListener('error', this.proxyErrors)
|
|
82
|
+
super.unpipe()
|
|
83
|
+
}
|
|
84
|
+
constructor (src, dest, opts) {
|
|
85
|
+
super(src, dest, opts)
|
|
86
|
+
this.proxyErrors = er => dest.emit('error', er)
|
|
87
|
+
src.on('error', this.proxyErrors)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
54
91
|
module.exports = class Minipass extends Stream {
|
|
55
92
|
constructor (options) {
|
|
56
93
|
super()
|
|
57
94
|
this[FLOWING] = false
|
|
58
95
|
// whether we're explicitly paused
|
|
59
96
|
this[PAUSED] = false
|
|
60
|
-
this.pipes =
|
|
61
|
-
this.buffer =
|
|
97
|
+
this.pipes = []
|
|
98
|
+
this.buffer = []
|
|
62
99
|
this[OBJECTMODE] = options && options.objectMode || false
|
|
63
100
|
if (this[OBJECTMODE])
|
|
64
101
|
this[ENCODING] = null
|
|
@@ -66,6 +103,7 @@ module.exports = class Minipass extends Stream {
|
|
|
66
103
|
this[ENCODING] = options && options.encoding || null
|
|
67
104
|
if (this[ENCODING] === 'buffer')
|
|
68
105
|
this[ENCODING] = null
|
|
106
|
+
this[ASYNC] = options && !!options.async || false
|
|
69
107
|
this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
|
|
70
108
|
this[EOF] = false
|
|
71
109
|
this[EMITTED_END] = false
|
|
@@ -105,6 +143,9 @@ module.exports = class Minipass extends Stream {
|
|
|
105
143
|
get objectMode () { return this[OBJECTMODE] }
|
|
106
144
|
set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
|
|
107
145
|
|
|
146
|
+
get ['async'] () { return this[ASYNC] }
|
|
147
|
+
set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a }
|
|
148
|
+
|
|
108
149
|
write (chunk, encoding, cb) {
|
|
109
150
|
if (this[EOF])
|
|
110
151
|
throw new Error('write after end')
|
|
@@ -123,6 +164,8 @@ module.exports = class Minipass extends Stream {
|
|
|
123
164
|
if (!encoding)
|
|
124
165
|
encoding = 'utf8'
|
|
125
166
|
|
|
167
|
+
const fn = this[ASYNC] ? defer : f => f()
|
|
168
|
+
|
|
126
169
|
// convert array buffers and typed array views into buffers
|
|
127
170
|
// at some point in the future, we may want to do the opposite!
|
|
128
171
|
// leave strings and buffers as-is
|
|
@@ -137,19 +180,40 @@ module.exports = class Minipass extends Stream {
|
|
|
137
180
|
this.objectMode = true
|
|
138
181
|
}
|
|
139
182
|
|
|
140
|
-
//
|
|
183
|
+
// handle object mode up front, since it's simpler
|
|
184
|
+
// this yields better performance, fewer checks later.
|
|
185
|
+
if (this[OBJECTMODE]) {
|
|
186
|
+
/* istanbul ignore if - maybe impossible? */
|
|
187
|
+
if (this.flowing && this[BUFFERLENGTH] !== 0)
|
|
188
|
+
this[FLUSH](true)
|
|
189
|
+
|
|
190
|
+
if (this.flowing)
|
|
191
|
+
this.emit('data', chunk)
|
|
192
|
+
else
|
|
193
|
+
this[BUFFERPUSH](chunk)
|
|
194
|
+
|
|
195
|
+
if (this[BUFFERLENGTH] !== 0)
|
|
196
|
+
this.emit('readable')
|
|
197
|
+
|
|
198
|
+
if (cb)
|
|
199
|
+
fn(cb)
|
|
200
|
+
|
|
201
|
+
return this.flowing
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// at this point the chunk is a buffer or string
|
|
141
205
|
// don't buffer it up or send it to the decoder
|
|
142
|
-
if (!
|
|
206
|
+
if (!chunk.length) {
|
|
143
207
|
if (this[BUFFERLENGTH] !== 0)
|
|
144
208
|
this.emit('readable')
|
|
145
209
|
if (cb)
|
|
146
|
-
cb
|
|
210
|
+
fn(cb)
|
|
147
211
|
return this.flowing
|
|
148
212
|
}
|
|
149
213
|
|
|
150
214
|
// fast-path writing strings of same encoding to a stream with
|
|
151
215
|
// an empty buffer, skipping the buffer/decoder dance
|
|
152
|
-
if (typeof chunk === 'string' &&
|
|
216
|
+
if (typeof chunk === 'string' &&
|
|
153
217
|
// unless it is a string already ready for us to use
|
|
154
218
|
!(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
|
|
155
219
|
chunk = Buffer.from(chunk, encoding)
|
|
@@ -158,27 +222,20 @@ module.exports = class Minipass extends Stream {
|
|
|
158
222
|
if (Buffer.isBuffer(chunk) && this[ENCODING])
|
|
159
223
|
chunk = this[DECODER].write(chunk)
|
|
160
224
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
// chunks coming in out of order. Can't emit 'drain' here though,
|
|
165
|
-
// because we're mid-write, so that'd be bad.
|
|
166
|
-
if (this[BUFFERLENGTH] !== 0)
|
|
167
|
-
this[FLUSH](true)
|
|
225
|
+
// Note: flushing CAN potentially switch us into not-flowing mode
|
|
226
|
+
if (this.flowing && this[BUFFERLENGTH] !== 0)
|
|
227
|
+
this[FLUSH](true)
|
|
168
228
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
? this.emit('data', chunk)
|
|
173
|
-
: this[BUFFERPUSH](chunk)
|
|
174
|
-
} else
|
|
229
|
+
if (this.flowing)
|
|
230
|
+
this.emit('data', chunk)
|
|
231
|
+
else
|
|
175
232
|
this[BUFFERPUSH](chunk)
|
|
176
233
|
|
|
177
234
|
if (this[BUFFERLENGTH] !== 0)
|
|
178
235
|
this.emit('readable')
|
|
179
236
|
|
|
180
237
|
if (cb)
|
|
181
|
-
cb
|
|
238
|
+
fn(cb)
|
|
182
239
|
|
|
183
240
|
return this.flowing
|
|
184
241
|
}
|
|
@@ -187,35 +244,31 @@ module.exports = class Minipass extends Stream {
|
|
|
187
244
|
if (this[DESTROYED])
|
|
188
245
|
return null
|
|
189
246
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
247
|
+
if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
|
|
248
|
+
this[MAYBE_EMIT_END]()
|
|
249
|
+
return null
|
|
250
|
+
}
|
|
193
251
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (this.buffer.length > 1 && !this[OBJECTMODE]) {
|
|
198
|
-
if (this.encoding)
|
|
199
|
-
this.buffer = new Yallist([
|
|
200
|
-
Array.from(this.buffer).join('')
|
|
201
|
-
])
|
|
202
|
-
else
|
|
203
|
-
this.buffer = new Yallist([
|
|
204
|
-
Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH])
|
|
205
|
-
])
|
|
206
|
-
}
|
|
252
|
+
if (this[OBJECTMODE])
|
|
253
|
+
n = null
|
|
207
254
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
255
|
+
if (this.buffer.length > 1 && !this[OBJECTMODE]) {
|
|
256
|
+
if (this.encoding)
|
|
257
|
+
this.buffer = [this.buffer.join('')]
|
|
258
|
+
else
|
|
259
|
+
this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])]
|
|
211
260
|
}
|
|
261
|
+
|
|
262
|
+
const ret = this[READ](n || null, this.buffer[0])
|
|
263
|
+
this[MAYBE_EMIT_END]()
|
|
264
|
+
return ret
|
|
212
265
|
}
|
|
213
266
|
|
|
214
267
|
[READ] (n, chunk) {
|
|
215
268
|
if (n === chunk.length || n === null)
|
|
216
269
|
this[BUFFERSHIFT]()
|
|
217
270
|
else {
|
|
218
|
-
this.buffer
|
|
271
|
+
this.buffer[0] = chunk.slice(n)
|
|
219
272
|
chunk = chunk.slice(0, n)
|
|
220
273
|
this[BUFFERLENGTH] -= n
|
|
221
274
|
}
|
|
@@ -291,7 +344,7 @@ module.exports = class Minipass extends Stream {
|
|
|
291
344
|
this[BUFFERLENGTH] += 1
|
|
292
345
|
else
|
|
293
346
|
this[BUFFERLENGTH] += chunk.length
|
|
294
|
-
|
|
347
|
+
this.buffer.push(chunk)
|
|
295
348
|
}
|
|
296
349
|
|
|
297
350
|
[BUFFERSHIFT] () {
|
|
@@ -299,7 +352,7 @@ module.exports = class Minipass extends Stream {
|
|
|
299
352
|
if (this[OBJECTMODE])
|
|
300
353
|
this[BUFFERLENGTH] -= 1
|
|
301
354
|
else
|
|
302
|
-
this[BUFFERLENGTH] -= this.buffer.
|
|
355
|
+
this[BUFFERLENGTH] -= this.buffer[0].length
|
|
303
356
|
}
|
|
304
357
|
return this.buffer.shift()
|
|
305
358
|
}
|
|
@@ -325,35 +378,52 @@ module.exports = class Minipass extends Stream {
|
|
|
325
378
|
opts.end = false
|
|
326
379
|
else
|
|
327
380
|
opts.end = opts.end !== false
|
|
381
|
+
opts.proxyErrors = !!opts.proxyErrors
|
|
328
382
|
|
|
329
|
-
const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
|
|
330
|
-
this.pipes.push(p)
|
|
331
|
-
|
|
332
|
-
dest.on('drain', p.ondrain)
|
|
333
|
-
this[RESUME]()
|
|
334
383
|
// piping an ended stream ends immediately
|
|
335
|
-
if (ended
|
|
336
|
-
|
|
384
|
+
if (ended) {
|
|
385
|
+
if (opts.end)
|
|
386
|
+
dest.end()
|
|
387
|
+
} else {
|
|
388
|
+
this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts)
|
|
389
|
+
: new PipeProxyErrors(this, dest, opts))
|
|
390
|
+
if (this[ASYNC])
|
|
391
|
+
defer(() => this[RESUME]())
|
|
392
|
+
else
|
|
393
|
+
this[RESUME]()
|
|
394
|
+
}
|
|
395
|
+
|
|
337
396
|
return dest
|
|
338
397
|
}
|
|
339
398
|
|
|
399
|
+
unpipe (dest) {
|
|
400
|
+
const p = this.pipes.find(p => p.dest === dest)
|
|
401
|
+
if (p) {
|
|
402
|
+
this.pipes.splice(this.pipes.indexOf(p), 1)
|
|
403
|
+
p.unpipe()
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
340
407
|
addListener (ev, fn) {
|
|
341
408
|
return this.on(ev, fn)
|
|
342
409
|
}
|
|
343
410
|
|
|
344
411
|
on (ev, fn) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
412
|
+
const ret = super.on(ev, fn)
|
|
413
|
+
if (ev === 'data' && !this.pipes.length && !this.flowing)
|
|
414
|
+
this[RESUME]()
|
|
415
|
+
else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
|
|
416
|
+
super.emit('readable')
|
|
417
|
+
else if (isEndish(ev) && this[EMITTED_END]) {
|
|
418
|
+
super.emit(ev)
|
|
419
|
+
this.removeAllListeners(ev)
|
|
420
|
+
} else if (ev === 'error' && this[EMITTED_ERROR]) {
|
|
421
|
+
if (this[ASYNC])
|
|
422
|
+
defer(() => fn.call(this, this[EMITTED_ERROR]))
|
|
423
|
+
else
|
|
354
424
|
fn.call(this, this[EMITTED_ERROR])
|
|
355
|
-
}
|
|
356
425
|
}
|
|
426
|
+
return ret
|
|
357
427
|
}
|
|
358
428
|
|
|
359
429
|
get emittedEnd () {
|
|
@@ -376,65 +446,84 @@ module.exports = class Minipass extends Stream {
|
|
|
376
446
|
}
|
|
377
447
|
}
|
|
378
448
|
|
|
379
|
-
emit (ev, data) {
|
|
449
|
+
emit (ev, data, ...extra) {
|
|
380
450
|
// error and close are only events allowed after calling destroy()
|
|
381
451
|
if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
|
|
382
452
|
return
|
|
383
453
|
else if (ev === 'data') {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (this.pipes.length)
|
|
388
|
-
this.pipes.forEach(p =>
|
|
389
|
-
p.dest.write(data) === false && this.pause())
|
|
454
|
+
return !data ? false
|
|
455
|
+
: this[ASYNC] ? defer(() => this[EMITDATA](data))
|
|
456
|
+
: this[EMITDATA](data)
|
|
390
457
|
} else if (ev === 'end') {
|
|
391
|
-
|
|
392
|
-
if (this[EMITTED_END] === true)
|
|
393
|
-
return
|
|
394
|
-
|
|
395
|
-
this[EMITTED_END] = true
|
|
396
|
-
this.readable = false
|
|
397
|
-
|
|
398
|
-
if (this[DECODER]) {
|
|
399
|
-
data = this[DECODER].end()
|
|
400
|
-
if (data) {
|
|
401
|
-
this.pipes.forEach(p => p.dest.write(data))
|
|
402
|
-
super.emit('data', data)
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
this.pipes.forEach(p => {
|
|
407
|
-
p.dest.removeListener('drain', p.ondrain)
|
|
408
|
-
if (p.opts.end)
|
|
409
|
-
p.dest.end()
|
|
410
|
-
})
|
|
458
|
+
return this[EMITEND]()
|
|
411
459
|
} else if (ev === 'close') {
|
|
412
460
|
this[CLOSED] = true
|
|
413
461
|
// don't emit close before 'end' and 'finish'
|
|
414
462
|
if (!this[EMITTED_END] && !this[DESTROYED])
|
|
415
463
|
return
|
|
464
|
+
const ret = super.emit('close')
|
|
465
|
+
this.removeAllListeners('close')
|
|
466
|
+
return ret
|
|
416
467
|
} else if (ev === 'error') {
|
|
417
468
|
this[EMITTED_ERROR] = data
|
|
469
|
+
const ret = super.emit('error', data)
|
|
470
|
+
this[MAYBE_EMIT_END]()
|
|
471
|
+
return ret
|
|
472
|
+
} else if (ev === 'resume') {
|
|
473
|
+
const ret = super.emit('resume')
|
|
474
|
+
this[MAYBE_EMIT_END]()
|
|
475
|
+
return ret
|
|
476
|
+
} else if (ev === 'finish' || ev === 'prefinish') {
|
|
477
|
+
const ret = super.emit(ev)
|
|
478
|
+
this.removeAllListeners(ev)
|
|
479
|
+
return ret
|
|
418
480
|
}
|
|
419
481
|
|
|
420
|
-
//
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
482
|
+
// Some other unknown event
|
|
483
|
+
const ret = super.emit(ev, data, ...extra)
|
|
484
|
+
this[MAYBE_EMIT_END]()
|
|
485
|
+
return ret
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
[EMITDATA] (data) {
|
|
489
|
+
for (const p of this.pipes) {
|
|
490
|
+
if (p.dest.write(data) === false)
|
|
491
|
+
this.pause()
|
|
492
|
+
}
|
|
493
|
+
const ret = super.emit('data', data)
|
|
494
|
+
this[MAYBE_EMIT_END]()
|
|
495
|
+
return ret
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
[EMITEND] () {
|
|
499
|
+
if (this[EMITTED_END])
|
|
500
|
+
return
|
|
501
|
+
|
|
502
|
+
this[EMITTED_END] = true
|
|
503
|
+
this.readable = false
|
|
504
|
+
if (this[ASYNC])
|
|
505
|
+
defer(() => this[EMITEND2]())
|
|
506
|
+
else
|
|
507
|
+
this[EMITEND2]()
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
[EMITEND2] () {
|
|
511
|
+
if (this[DECODER]) {
|
|
512
|
+
const data = this[DECODER].end()
|
|
513
|
+
if (data) {
|
|
514
|
+
for (const p of this.pipes) {
|
|
515
|
+
p.dest.write(data)
|
|
516
|
+
}
|
|
517
|
+
super.emit('data', data)
|
|
427
518
|
}
|
|
428
519
|
}
|
|
429
520
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
} finally {
|
|
433
|
-
if (!isEndish(ev))
|
|
434
|
-
this[MAYBE_EMIT_END]()
|
|
435
|
-
else
|
|
436
|
-
this.removeAllListeners(ev)
|
|
521
|
+
for (const p of this.pipes) {
|
|
522
|
+
p.end()
|
|
437
523
|
}
|
|
524
|
+
const ret = super.emit('end')
|
|
525
|
+
this.removeAllListeners('end')
|
|
526
|
+
return ret
|
|
438
527
|
}
|
|
439
528
|
|
|
440
529
|
// const all = await stream.collect()
|
|
@@ -536,7 +625,7 @@ module.exports = class Minipass extends Stream {
|
|
|
536
625
|
this[DESTROYED] = true
|
|
537
626
|
|
|
538
627
|
// throw away all buffered data, it's never coming out
|
|
539
|
-
this.buffer =
|
|
628
|
+
this.buffer.length = 0
|
|
540
629
|
this[BUFFERLENGTH] = 0
|
|
541
630
|
|
|
542
631
|
if (typeof this.close === 'function' && !this[CLOSED])
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minipass",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "minimal implementation of a PassThrough stream",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"yallist": "^4.0.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
+
"@types/node": "^17.0.41",
|
|
10
11
|
"end-of-stream": "^1.4.0",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
12
|
+
"prettier": "^2.6.2",
|
|
13
|
+
"tap": "^16.2.0",
|
|
14
|
+
"through2": "^2.0.3",
|
|
15
|
+
"ts-node": "^10.8.1",
|
|
16
|
+
"typescript": "^4.7.3"
|
|
13
17
|
},
|
|
14
18
|
"scripts": {
|
|
15
19
|
"test": "tap",
|
|
@@ -28,6 +32,7 @@
|
|
|
28
32
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
29
33
|
"license": "ISC",
|
|
30
34
|
"files": [
|
|
35
|
+
"index.d.ts",
|
|
31
36
|
"index.js"
|
|
32
37
|
],
|
|
33
38
|
"tap": {
|
|
@@ -35,5 +40,16 @@
|
|
|
35
40
|
},
|
|
36
41
|
"engines": {
|
|
37
42
|
"node": ">=8"
|
|
43
|
+
},
|
|
44
|
+
"prettier": {
|
|
45
|
+
"semi": false,
|
|
46
|
+
"printWidth": 80,
|
|
47
|
+
"tabWidth": 2,
|
|
48
|
+
"useTabs": false,
|
|
49
|
+
"singleQuote": true,
|
|
50
|
+
"jsxSingleQuote": false,
|
|
51
|
+
"bracketSameLine": true,
|
|
52
|
+
"arrowParens": "avoid",
|
|
53
|
+
"endOfLine": "lf"
|
|
38
54
|
}
|
|
39
55
|
}
|