fsevents 1.2.7 → 1.2.10
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.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/.travis.yml +1 -2
- package/fsevents.cc +8 -11
- package/node_modules/abbrev/package.json +2 -3
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/aproba/package.json +1 -1
- package/node_modules/are-we-there-yet/package.json +1 -1
- package/node_modules/balanced-match/package.json +1 -1
- package/node_modules/brace-expansion/package.json +1 -1
- package/node_modules/chownr/chownr.js +47 -10
- package/node_modules/chownr/package.json +7 -7
- package/node_modules/code-point-at/package.json +1 -1
- package/node_modules/concat-map/package.json +1 -1
- package/node_modules/console-control-strings/package.json +1 -1
- package/node_modules/core-util-is/package.json +1 -1
- package/node_modules/debug/CHANGELOG.md +34 -1
- package/node_modules/debug/README.md +188 -63
- package/node_modules/debug/dist/debug.js +886 -0
- package/node_modules/debug/package.json +28 -26
- package/node_modules/debug/src/browser.js +77 -82
- package/node_modules/debug/src/common.js +249 -0
- package/node_modules/debug/src/index.js +5 -3
- package/node_modules/debug/src/node.js +72 -146
- package/node_modules/deep-extend/package.json +1 -1
- package/node_modules/delegates/package.json +1 -1
- package/node_modules/detect-libc/package.json +1 -1
- package/node_modules/fs-minipass/index.js +2 -1
- package/node_modules/fs-minipass/package.json +13 -10
- package/node_modules/fs.realpath/package.json +1 -1
- package/node_modules/gauge/package.json +1 -1
- package/node_modules/glob/LICENSE +6 -0
- package/node_modules/glob/README.md +8 -1
- package/node_modules/glob/package.json +9 -6
- package/node_modules/has-unicode/package.json +1 -1
- package/node_modules/iconv-lite/package.json +1 -1
- package/node_modules/ignore-walk/README.md +1 -1
- package/node_modules/ignore-walk/index.js +9 -5
- package/node_modules/ignore-walk/package.json +11 -8
- package/node_modules/inflight/package.json +1 -1
- package/node_modules/inherits/inherits.js +2 -0
- package/node_modules/inherits/inherits_browser.js +18 -14
- package/node_modules/inherits/package.json +9 -11
- package/node_modules/ini/package.json +1 -1
- package/node_modules/is-fullwidth-code-point/package.json +1 -1
- package/node_modules/isarray/package.json +1 -1
- package/node_modules/minimatch/package.json +1 -1
- package/node_modules/minimist/package.json +1 -1
- package/node_modules/minipass/README.md +486 -4
- package/node_modules/minipass/index.js +190 -28
- package/node_modules/minipass/package.json +17 -14
- package/node_modules/minizlib/README.md +36 -27
- package/node_modules/minizlib/constants.js +73 -4
- package/node_modules/minizlib/index.js +137 -152
- package/node_modules/minizlib/package.json +12 -12
- package/node_modules/mkdirp/package.json +1 -2
- package/node_modules/ms/index.js +29 -19
- package/node_modules/ms/package.json +17 -17
- package/node_modules/ms/readme.md +18 -9
- package/node_modules/needle/README.md +1 -2
- package/node_modules/needle/examples/multipart-stream.js +1 -1
- package/node_modules/needle/lib/auth.js +1 -1
- package/node_modules/needle/lib/multipart.js +1 -1
- package/node_modules/needle/lib/needle.js +4 -2
- package/node_modules/needle/package.json +13 -13
- package/node_modules/needle/test/basic_auth_spec.js +1 -1
- package/node_modules/needle/test/cookies_spec.js +2 -2
- package/node_modules/needle/test/headers_spec.js +1 -1
- package/node_modules/needle/test/output_spec.js +1 -1
- package/node_modules/needle/test/post_data_spec.js +20 -20
- package/node_modules/needle/test/proxy_spec.js +1 -1
- package/node_modules/needle/test/utils/test.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +10 -0
- package/node_modules/node-pre-gyp/README.md +41 -6
- package/node_modules/node-pre-gyp/lib/build.js +1 -1
- package/node_modules/node-pre-gyp/lib/install.js +20 -8
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
- package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
- package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +48 -0
- package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
- package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
- package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
- package/node_modules/node-pre-gyp/package.json +11 -11
- package/node_modules/nopt/package.json +1 -1
- package/node_modules/npm-bundled/index.js +26 -6
- package/node_modules/npm-bundled/package.json +9 -6
- package/node_modules/npm-normalize-package-bin/.github/settings.yml +2 -0
- package/node_modules/npm-normalize-package-bin/.npmignore +24 -0
- package/node_modules/npm-normalize-package-bin/LICENSE +15 -0
- package/node_modules/npm-normalize-package-bin/README.md +14 -0
- package/node_modules/npm-normalize-package-bin/index.js +60 -0
- package/node_modules/npm-normalize-package-bin/package-lock.json +3529 -0
- package/node_modules/npm-normalize-package-bin/package.json +57 -0
- package/node_modules/npm-normalize-package-bin/test/array.js +37 -0
- package/node_modules/npm-normalize-package-bin/test/nobin.js +35 -0
- package/node_modules/npm-normalize-package-bin/test/object.js +141 -0
- package/node_modules/npm-normalize-package-bin/test/string.js +37 -0
- package/node_modules/npm-packlist/index.js +76 -16
- package/node_modules/npm-packlist/package.json +16 -9
- package/node_modules/npmlog/package.json +1 -1
- package/node_modules/number-is-nan/package.json +1 -1
- package/node_modules/object-assign/package.json +1 -1
- package/node_modules/once/package.json +1 -1
- package/node_modules/os-homedir/package.json +1 -1
- package/node_modules/os-tmpdir/package.json +1 -1
- package/node_modules/osenv/package.json +1 -1
- package/node_modules/path-is-absolute/package.json +1 -1
- package/node_modules/process-nextick-args/index.js +2 -1
- package/node_modules/process-nextick-args/package.json +6 -6
- package/node_modules/rc/node_modules/minimist/package.json +1 -1
- package/node_modules/rc/package.json +1 -1
- package/node_modules/readable-stream/package.json +1 -1
- package/node_modules/rimraf/package.json +6 -6
- package/node_modules/rimraf/rimraf.js +9 -1
- package/node_modules/safe-buffer/package.json +1 -1
- package/node_modules/safer-buffer/package.json +1 -1
- package/node_modules/sax/package.json +1 -1
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/README.md +26 -13
- package/node_modules/semver/bin/semver +84 -77
- package/node_modules/semver/package.json +14 -8
- package/node_modules/semver/semver.js +906 -775
- package/node_modules/set-blocking/package.json +1 -1
- package/node_modules/signal-exit/package.json +1 -1
- package/node_modules/string-width/package.json +1 -1
- package/node_modules/string_decoder/package.json +1 -1
- package/node_modules/strip-ansi/package.json +1 -1
- package/node_modules/strip-json-comments/package.json +1 -1
- package/node_modules/tar/lib/large-numbers.js +32 -27
- package/node_modules/tar/lib/mkdir.js +2 -2
- package/node_modules/tar/lib/parse.js +6 -1
- package/node_modules/tar/lib/read-entry.js +4 -0
- package/node_modules/tar/lib/write-entry.js +2 -2
- package/node_modules/tar/package.json +17 -13
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/wide-align/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/node_modules/yallist/package.json +11 -11
- package/node_modules/yallist/yallist.js +50 -0
- package/package.json +5 -8
- package/src/constants.cc +20 -20
- package/node_modules/debug/.coveralls.yml +0 -1
- package/node_modules/debug/.eslintrc +0 -11
- package/node_modules/debug/.npmignore +0 -9
- package/node_modules/debug/.travis.yml +0 -14
- package/node_modules/debug/Makefile +0 -50
- package/node_modules/debug/component.json +0 -19
- package/node_modules/debug/karma.conf.js +0 -70
- package/node_modules/debug/src/debug.js +0 -202
- package/node_modules/debug/src/inspector-log.js +0 -15
- package/node_modules/needle/note.xml +0 -7
- package/node_modules/needle/note.xml.1 +0 -7
@@ -1,39 +1,62 @@
|
|
1
1
|
'use strict'
|
2
2
|
const EE = require('events')
|
3
3
|
const Yallist = require('yallist')
|
4
|
+
const SD = require('string_decoder').StringDecoder
|
5
|
+
|
4
6
|
const EOF = Symbol('EOF')
|
5
7
|
const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
|
6
8
|
const EMITTED_END = Symbol('emittedEnd')
|
9
|
+
const EMITTING_END = Symbol('emittingEnd')
|
7
10
|
const CLOSED = Symbol('closed')
|
8
11
|
const READ = Symbol('read')
|
9
12
|
const FLUSH = Symbol('flush')
|
10
|
-
const doIter = process.env._MP_NO_ITERATOR_SYMBOLS_ !== '1'
|
11
|
-
const ASYNCITERATOR = doIter && Symbol.asyncIterator || Symbol('asyncIterator not implemented')
|
12
|
-
const ITERATOR = doIter && Symbol.iterator || Symbol('iterator not implemented')
|
13
13
|
const FLUSHCHUNK = Symbol('flushChunk')
|
14
|
-
const SD = require('string_decoder').StringDecoder
|
15
14
|
const ENCODING = Symbol('encoding')
|
16
15
|
const DECODER = Symbol('decoder')
|
17
16
|
const FLOWING = Symbol('flowing')
|
17
|
+
const PAUSED = Symbol('paused')
|
18
18
|
const RESUME = Symbol('resume')
|
19
19
|
const BUFFERLENGTH = Symbol('bufferLength')
|
20
20
|
const BUFFERPUSH = Symbol('bufferPush')
|
21
21
|
const BUFFERSHIFT = Symbol('bufferShift')
|
22
22
|
const OBJECTMODE = Symbol('objectMode')
|
23
|
+
const DESTROYED = Symbol('destroyed')
|
24
|
+
|
25
|
+
// TODO remove when Node v8 support drops
|
26
|
+
const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
|
27
|
+
const ASYNCITERATOR = doIter && Symbol.asyncIterator
|
28
|
+
|| Symbol('asyncIterator not implemented')
|
29
|
+
const ITERATOR = doIter && Symbol.iterator
|
30
|
+
|| Symbol('iterator not implemented')
|
23
31
|
|
24
32
|
// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from
|
25
33
|
// or Buffer.alloc, and Buffer in node 10 deprecated the ctor.
|
26
34
|
// .M, this is fine .\^/M..
|
27
|
-
|
28
|
-
/* istanbul ignore next */
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
const B = Buffer.alloc ? Buffer
|
36
|
+
: /* istanbul ignore next */ require('safe-buffer').Buffer
|
37
|
+
|
38
|
+
// events that mean 'the stream is over'
|
39
|
+
// these are treated specially, and re-emitted
|
40
|
+
// if they are listened for after emitting.
|
41
|
+
const isEndish = ev =>
|
42
|
+
ev === 'end' ||
|
43
|
+
ev === 'finish' ||
|
44
|
+
ev === 'prefinish'
|
45
|
+
|
46
|
+
const isArrayBuffer = b => b instanceof ArrayBuffer ||
|
47
|
+
typeof b === 'object' &&
|
48
|
+
b.constructor &&
|
49
|
+
b.constructor.name === 'ArrayBuffer' &&
|
50
|
+
b.byteLength >= 0
|
51
|
+
|
52
|
+
const isArrayBufferView = b => !B.isBuffer(b) && ArrayBuffer.isView(b)
|
53
|
+
|
54
|
+
module.exports = class Minipass extends EE {
|
34
55
|
constructor (options) {
|
35
56
|
super()
|
36
57
|
this[FLOWING] = false
|
58
|
+
// whether we're explicitly paused
|
59
|
+
this[PAUSED] = false
|
37
60
|
this.pipes = new Yallist()
|
38
61
|
this.buffer = new Yallist()
|
39
62
|
this[OBJECTMODE] = options && options.objectMode || false
|
@@ -46,10 +69,12 @@ module.exports = class MiniPass extends EE {
|
|
46
69
|
this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
|
47
70
|
this[EOF] = false
|
48
71
|
this[EMITTED_END] = false
|
72
|
+
this[EMITTING_END] = false
|
49
73
|
this[CLOSED] = false
|
50
74
|
this.writable = true
|
51
75
|
this.readable = true
|
52
76
|
this[BUFFERLENGTH] = 0
|
77
|
+
this[DESTROYED] = false
|
53
78
|
}
|
54
79
|
|
55
80
|
get bufferLength () { return this[BUFFERLENGTH] }
|
@@ -76,16 +101,52 @@ module.exports = class MiniPass extends EE {
|
|
76
101
|
this.encoding = enc
|
77
102
|
}
|
78
103
|
|
104
|
+
get objectMode () { return this[OBJECTMODE] }
|
105
|
+
set objectMode (ॐ ) { this[OBJECTMODE] = this[OBJECTMODE] || !!ॐ }
|
106
|
+
|
79
107
|
write (chunk, encoding, cb) {
|
80
108
|
if (this[EOF])
|
81
109
|
throw new Error('write after end')
|
82
110
|
|
111
|
+
if (this[DESTROYED]) {
|
112
|
+
this.emit('error', Object.assign(
|
113
|
+
new Error('Cannot call write after a stream was destroyed'),
|
114
|
+
{ code: 'ERR_STREAM_DESTROYED' }
|
115
|
+
))
|
116
|
+
return true
|
117
|
+
}
|
118
|
+
|
83
119
|
if (typeof encoding === 'function')
|
84
120
|
cb = encoding, encoding = 'utf8'
|
85
121
|
|
86
122
|
if (!encoding)
|
87
123
|
encoding = 'utf8'
|
88
124
|
|
125
|
+
// convert array buffers and typed array views into buffers
|
126
|
+
// at some point in the future, we may want to do the opposite!
|
127
|
+
// leave strings and buffers as-is
|
128
|
+
// anything else switches us into object mode
|
129
|
+
if (!this[OBJECTMODE] && !B.isBuffer(chunk)) {
|
130
|
+
if (isArrayBufferView(chunk))
|
131
|
+
chunk = B.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
|
132
|
+
else if (isArrayBuffer(chunk))
|
133
|
+
chunk = B.from(chunk)
|
134
|
+
else if (typeof chunk !== 'string')
|
135
|
+
// use the setter so we throw if we have encoding set
|
136
|
+
this.objectMode = true
|
137
|
+
}
|
138
|
+
|
139
|
+
// this ensures at this point that the chunk is a buffer or string
|
140
|
+
// don't buffer it up or send it to the decoder
|
141
|
+
if (!this.objectMode && !chunk.length) {
|
142
|
+
const ret = this.flowing
|
143
|
+
if (this[BUFFERLENGTH] !== 0)
|
144
|
+
this.emit('readable')
|
145
|
+
if (cb)
|
146
|
+
cb()
|
147
|
+
return ret
|
148
|
+
}
|
149
|
+
|
89
150
|
// fast-path writing strings of same encoding to a stream with
|
90
151
|
// an empty buffer, skipping the buffer/decoder dance
|
91
152
|
if (typeof chunk === 'string' && !this[OBJECTMODE] &&
|
@@ -102,13 +163,17 @@ module.exports = class MiniPass extends EE {
|
|
102
163
|
? (this.emit('data', chunk), this.flowing)
|
103
164
|
: (this[BUFFERPUSH](chunk), false)
|
104
165
|
} finally {
|
105
|
-
this
|
166
|
+
if (this[BUFFERLENGTH] !== 0)
|
167
|
+
this.emit('readable')
|
106
168
|
if (cb)
|
107
169
|
cb()
|
108
170
|
}
|
109
171
|
}
|
110
172
|
|
111
173
|
read (n) {
|
174
|
+
if (this[DESTROYED])
|
175
|
+
return null
|
176
|
+
|
112
177
|
try {
|
113
178
|
if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
|
114
179
|
return null
|
@@ -161,12 +226,22 @@ module.exports = class MiniPass extends EE {
|
|
161
226
|
this.once('end', cb)
|
162
227
|
this[EOF] = true
|
163
228
|
this.writable = false
|
164
|
-
|
229
|
+
|
230
|
+
// if we haven't written anything, then go ahead and emit,
|
231
|
+
// even if we're not reading.
|
232
|
+
// we'll re-emit if a new 'end' listener is added anyway.
|
233
|
+
// This makes MP more suitable to write-only use cases.
|
234
|
+
if (this.flowing || !this[PAUSED])
|
165
235
|
this[MAYBE_EMIT_END]()
|
236
|
+
return this
|
166
237
|
}
|
167
238
|
|
168
239
|
// don't let the internal resume be overwritten
|
169
240
|
[RESUME] () {
|
241
|
+
if (this[DESTROYED])
|
242
|
+
return
|
243
|
+
|
244
|
+
this[PAUSED] = false
|
170
245
|
this[FLOWING] = true
|
171
246
|
this.emit('resume')
|
172
247
|
if (this.buffer.length)
|
@@ -183,12 +258,21 @@ module.exports = class MiniPass extends EE {
|
|
183
258
|
|
184
259
|
pause () {
|
185
260
|
this[FLOWING] = false
|
261
|
+
this[PAUSED] = true
|
262
|
+
}
|
263
|
+
|
264
|
+
get destroyed () {
|
265
|
+
return this[DESTROYED]
|
186
266
|
}
|
187
267
|
|
188
268
|
get flowing () {
|
189
269
|
return this[FLOWING]
|
190
270
|
}
|
191
271
|
|
272
|
+
get paused () {
|
273
|
+
return this[PAUSED]
|
274
|
+
}
|
275
|
+
|
192
276
|
[BUFFERPUSH] (chunk) {
|
193
277
|
if (this[OBJECTMODE])
|
194
278
|
this[BUFFERLENGTH] += 1
|
@@ -219,13 +303,24 @@ module.exports = class MiniPass extends EE {
|
|
219
303
|
}
|
220
304
|
|
221
305
|
pipe (dest, opts) {
|
306
|
+
if (this[DESTROYED])
|
307
|
+
return
|
308
|
+
|
309
|
+
const ended = this[EMITTED_END]
|
310
|
+
opts = opts || {}
|
222
311
|
if (dest === process.stdout || dest === process.stderr)
|
223
|
-
|
312
|
+
opts.end = false
|
313
|
+
else
|
314
|
+
opts.end = opts.end !== false
|
315
|
+
|
224
316
|
const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
|
225
317
|
this.pipes.push(p)
|
226
318
|
|
227
319
|
dest.on('drain', p.ondrain)
|
228
320
|
this[RESUME]()
|
321
|
+
// piping an ended stream ends immediately
|
322
|
+
if (ended && p.opts.end)
|
323
|
+
p.dest.end()
|
229
324
|
return dest
|
230
325
|
}
|
231
326
|
|
@@ -239,9 +334,9 @@ module.exports = class MiniPass extends EE {
|
|
239
334
|
} finally {
|
240
335
|
if (ev === 'data' && !this.pipes.length && !this.flowing)
|
241
336
|
this[RESUME]()
|
242
|
-
else if (ev
|
243
|
-
super.emit(
|
244
|
-
this.removeAllListeners(
|
337
|
+
else if (isEndish(ev) && this[EMITTED_END]) {
|
338
|
+
super.emit(ev)
|
339
|
+
this.removeAllListeners(ev)
|
245
340
|
}
|
246
341
|
}
|
247
342
|
}
|
@@ -251,23 +346,34 @@ module.exports = class MiniPass extends EE {
|
|
251
346
|
}
|
252
347
|
|
253
348
|
[MAYBE_EMIT_END] () {
|
254
|
-
if (!this[
|
349
|
+
if (!this[EMITTING_END] &&
|
350
|
+
!this[EMITTED_END] &&
|
351
|
+
!this[DESTROYED] &&
|
352
|
+
this.buffer.length === 0 &&
|
353
|
+
this[EOF]) {
|
354
|
+
this[EMITTING_END] = true
|
255
355
|
this.emit('end')
|
256
356
|
this.emit('prefinish')
|
257
357
|
this.emit('finish')
|
258
358
|
if (this[CLOSED])
|
259
359
|
this.emit('close')
|
360
|
+
this[EMITTING_END] = false
|
260
361
|
}
|
261
362
|
}
|
262
363
|
|
263
364
|
emit (ev, data) {
|
264
|
-
|
365
|
+
// error and close are only events allowed after calling destroy()
|
366
|
+
if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
|
367
|
+
return
|
368
|
+
else if (ev === 'data') {
|
265
369
|
if (!data)
|
266
370
|
return
|
267
371
|
|
268
372
|
if (this.pipes.length)
|
269
|
-
this.pipes.forEach(p =>
|
373
|
+
this.pipes.forEach(p =>
|
374
|
+
p.dest.write(data) === false && this.pause())
|
270
375
|
} else if (ev === 'end') {
|
376
|
+
// only actual end gets this treatment
|
271
377
|
if (this[EMITTED_END] === true)
|
272
378
|
return
|
273
379
|
|
@@ -284,16 +390,17 @@ module.exports = class MiniPass extends EE {
|
|
284
390
|
|
285
391
|
this.pipes.forEach(p => {
|
286
392
|
p.dest.removeListener('drain', p.ondrain)
|
287
|
-
if (
|
393
|
+
if (p.opts.end)
|
288
394
|
p.dest.end()
|
289
395
|
})
|
290
396
|
} else if (ev === 'close') {
|
291
397
|
this[CLOSED] = true
|
292
398
|
// don't emit close before 'end' and 'finish'
|
293
|
-
if (!this[EMITTED_END])
|
399
|
+
if (!this[EMITTED_END] && !this[DESTROYED])
|
294
400
|
return
|
295
401
|
}
|
296
402
|
|
403
|
+
// TODO: replace with a spread operator when Node v4 support drops
|
297
404
|
const args = new Array(arguments.length)
|
298
405
|
args[0] = ev
|
299
406
|
args[1] = data
|
@@ -306,20 +413,40 @@ module.exports = class MiniPass extends EE {
|
|
306
413
|
try {
|
307
414
|
return super.emit.apply(this, args)
|
308
415
|
} finally {
|
309
|
-
if (ev
|
416
|
+
if (!isEndish(ev))
|
310
417
|
this[MAYBE_EMIT_END]()
|
311
418
|
else
|
312
|
-
this.removeAllListeners(
|
419
|
+
this.removeAllListeners(ev)
|
313
420
|
}
|
314
421
|
}
|
315
422
|
|
316
423
|
// const all = await stream.collect()
|
317
424
|
collect () {
|
425
|
+
const buf = []
|
426
|
+
buf.dataLength = 0
|
427
|
+
this.on('data', c => {
|
428
|
+
buf.push(c)
|
429
|
+
buf.dataLength += c.length
|
430
|
+
})
|
431
|
+
return this.promise().then(() => buf)
|
432
|
+
}
|
433
|
+
|
434
|
+
// const data = await stream.concat()
|
435
|
+
concat () {
|
436
|
+
return this[OBJECTMODE]
|
437
|
+
? Promise.reject(new Error('cannot concat in objectMode'))
|
438
|
+
: this.collect().then(buf =>
|
439
|
+
this[OBJECTMODE]
|
440
|
+
? Promise.reject(new Error('cannot concat in objectMode'))
|
441
|
+
: this[ENCODING] ? buf.join('') : B.concat(buf, buf.dataLength))
|
442
|
+
}
|
443
|
+
|
444
|
+
// stream.promise().then(() => done, er => emitted error)
|
445
|
+
promise () {
|
318
446
|
return new Promise((resolve, reject) => {
|
319
|
-
|
320
|
-
this.on('
|
321
|
-
this.on('
|
322
|
-
this.on('error', reject)
|
447
|
+
this.on(DESTROYED, () => reject(new Error('stream destroyed')))
|
448
|
+
this.on('end', () => resolve())
|
449
|
+
this.on('error', er => reject(er))
|
323
450
|
})
|
324
451
|
}
|
325
452
|
|
@@ -351,9 +478,11 @@ module.exports = class MiniPass extends EE {
|
|
351
478
|
this.removeListener('data', ondata)
|
352
479
|
resolve({ done: true })
|
353
480
|
}
|
481
|
+
const ondestroy = () => onerr(new Error('stream destroyed'))
|
354
482
|
return new Promise((res, rej) => {
|
355
483
|
reject = rej
|
356
484
|
resolve = res
|
485
|
+
this.once(DESTROYED, ondestroy)
|
357
486
|
this.once('error', onerr)
|
358
487
|
this.once('end', onend)
|
359
488
|
this.once('data', ondata)
|
@@ -372,4 +501,37 @@ module.exports = class MiniPass extends EE {
|
|
372
501
|
}
|
373
502
|
return { next }
|
374
503
|
}
|
504
|
+
|
505
|
+
destroy (er) {
|
506
|
+
if (this[DESTROYED]) {
|
507
|
+
if (er)
|
508
|
+
this.emit('error', er)
|
509
|
+
else
|
510
|
+
this.emit(DESTROYED)
|
511
|
+
return this
|
512
|
+
}
|
513
|
+
|
514
|
+
this[DESTROYED] = true
|
515
|
+
|
516
|
+
// throw away all buffered data, it's never coming out
|
517
|
+
this.buffer = new Yallist()
|
518
|
+
this[BUFFERLENGTH] = 0
|
519
|
+
|
520
|
+
if (typeof this.close === 'function' && !this[CLOSED])
|
521
|
+
this.close()
|
522
|
+
|
523
|
+
if (er)
|
524
|
+
this.emit('error', er)
|
525
|
+
else // if no error to emit, still reject pending promises
|
526
|
+
this.emit(DESTROYED)
|
527
|
+
|
528
|
+
return this
|
529
|
+
}
|
530
|
+
|
531
|
+
static isStream (s) {
|
532
|
+
return !!s && (s instanceof Minipass || s instanceof EE && (
|
533
|
+
typeof s.pipe === 'function' || // readable
|
534
|
+
(typeof s.write === 'function' && typeof s.end === 'function') // writable
|
535
|
+
))
|
536
|
+
}
|
375
537
|
}
|
@@ -1,29 +1,29 @@
|
|
1
1
|
{
|
2
|
-
"_from": "minipass@^2.
|
3
|
-
"_id": "minipass@2.
|
2
|
+
"_from": "minipass@^2.8.6",
|
3
|
+
"_id": "minipass@2.9.0",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "sha512-
|
5
|
+
"_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
|
6
6
|
"_location": "/minipass",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
9
9
|
"type": "range",
|
10
10
|
"registry": true,
|
11
|
-
"raw": "minipass@^2.
|
11
|
+
"raw": "minipass@^2.8.6",
|
12
12
|
"name": "minipass",
|
13
13
|
"escapedName": "minipass",
|
14
|
-
"rawSpec": "^2.
|
14
|
+
"rawSpec": "^2.8.6",
|
15
15
|
"saveSpec": null,
|
16
|
-
"fetchSpec": "^2.
|
16
|
+
"fetchSpec": "^2.8.6"
|
17
17
|
},
|
18
18
|
"_requiredBy": [
|
19
19
|
"/fs-minipass",
|
20
20
|
"/minizlib",
|
21
21
|
"/tar"
|
22
22
|
],
|
23
|
-
"_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.
|
24
|
-
"_shasum": "
|
25
|
-
"_spec": "minipass@^2.
|
26
|
-
"_where": "/Users/
|
23
|
+
"_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
|
24
|
+
"_shasum": "e713762e7d3e32fed803115cf93e04bca9fcc9a6",
|
25
|
+
"_spec": "minipass@^2.8.6",
|
26
|
+
"_where": "/Users/pipobscure/fsevents/node_modules/tar",
|
27
27
|
"author": {
|
28
28
|
"name": "Isaac Z. Schlueter",
|
29
29
|
"email": "i@izs.me",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"description": "minimal implementation of a PassThrough stream",
|
42
42
|
"devDependencies": {
|
43
43
|
"end-of-stream": "^1.4.0",
|
44
|
-
"tap": "^
|
44
|
+
"tap": "^14.6.5",
|
45
45
|
"through2": "^2.0.3"
|
46
46
|
},
|
47
47
|
"files": [
|
@@ -60,10 +60,13 @@
|
|
60
60
|
"url": "git+https://github.com/isaacs/minipass.git"
|
61
61
|
},
|
62
62
|
"scripts": {
|
63
|
-
"postpublish": "git push origin --
|
63
|
+
"postpublish": "git push origin --follow-tags",
|
64
64
|
"postversion": "npm publish",
|
65
65
|
"preversion": "npm test",
|
66
|
-
"test": "tap
|
66
|
+
"test": "tap"
|
67
67
|
},
|
68
|
-
"
|
68
|
+
"tap": {
|
69
|
+
"check-coverage": true
|
70
|
+
},
|
71
|
+
"version": "2.9.0"
|
69
72
|
}
|
@@ -1,44 +1,53 @@
|
|
1
1
|
# minizlib
|
2
2
|
|
3
|
-
A
|
4
|
-
|
3
|
+
A fast zlib stream built on [minipass](http://npm.im/minipass) and
|
4
|
+
Node.js's zlib binding.
|
5
5
|
|
6
6
|
This module was created to serve the needs of
|
7
|
-
[node-tar](http://npm.im/tar)
|
8
|
-
|
7
|
+
[node-tar](http://npm.im/tar) and
|
8
|
+
[minipass-fetch](http://npm.im/minipass-fetch).
|
9
|
+
|
10
|
+
Brotli is supported in versions of node with a Brotli binding.
|
9
11
|
|
10
12
|
## How does this differ from the streams in `require('zlib')`?
|
11
13
|
|
12
14
|
First, there are no convenience methods to compress or decompress a
|
13
15
|
buffer. If you want those, use the built-in `zlib` module. This is
|
14
|
-
only streams.
|
16
|
+
only streams. That being said, Minipass streams to make it fairly easy to
|
17
|
+
use as one-liners: `new zlib.Deflate().end(data).read()` will return the
|
18
|
+
deflate compressed result.
|
15
19
|
|
16
20
|
This module compresses and decompresses the data as fast as you feed
|
17
21
|
it in. It is synchronous, and runs on the main process thread. Zlib
|
18
|
-
operations can be high CPU, but they're very fast, and doing it
|
19
|
-
way means much less bookkeeping and artificial deferral.
|
22
|
+
and Brotli operations can be high CPU, but they're very fast, and doing it
|
23
|
+
this way means much less bookkeeping and artificial deferral.
|
20
24
|
|
21
25
|
Node's built in zlib streams are built on top of `stream.Transform`.
|
22
26
|
They do the maximally safe thing with respect to consistent
|
23
27
|
asynchrony, buffering, and backpressure.
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
29
|
+
See [Minipass](http://npm.im/minipass) for more on the differences between
|
30
|
+
Node.js core streams and Minipass streams, and the convenience methods
|
31
|
+
provided by that class.
|
32
|
+
|
33
|
+
## Classes
|
34
|
+
|
35
|
+
- Deflate
|
36
|
+
- Inflate
|
37
|
+
- Gzip
|
38
|
+
- Gunzip
|
39
|
+
- DeflateRaw
|
40
|
+
- InflateRaw
|
41
|
+
- Unzip
|
42
|
+
- BrotliCompress (Node v10 and higher)
|
43
|
+
- BrotliDecompress (Node v10 and higher)
|
44
|
+
|
45
|
+
## USAGE
|
46
|
+
|
47
|
+
```js
|
48
|
+
const zlib = require('minizlib')
|
49
|
+
const input = sourceOfCompressedData()
|
50
|
+
const decode = new zlib.BrotliDecompress()
|
51
|
+
const output = whereToWriteTheDecodedData()
|
52
|
+
input.pipe(decode).pipe(output)
|
53
|
+
```
|
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
// Update with any zlib constants that are added or changed in the future.
|
2
|
+
// Node v6 didn't export this, so we just hard code the version and rely
|
3
|
+
// on all the other hard-coded values from zlib v4736. When node v6
|
4
|
+
// support drops, we can just export the realZlibConstants object.
|
5
|
+
const realZlibConstants = require('zlib').constants ||
|
6
|
+
/* istanbul ignore next */ { ZLIB_VERNUM: 4736 }
|
7
|
+
|
8
|
+
module.exports = Object.freeze(Object.assign(Object.create(null), {
|
2
9
|
Z_NO_FLUSH: 0,
|
3
10
|
Z_PARTIAL_FLUSH: 1,
|
4
11
|
Z_SYNC_FLUSH: 2,
|
@@ -23,7 +30,6 @@ module.exports = Object.freeze({
|
|
23
30
|
Z_RLE: 3,
|
24
31
|
Z_FIXED: 4,
|
25
32
|
Z_DEFAULT_STRATEGY: 0,
|
26
|
-
ZLIB_VERNUM: 4736,
|
27
33
|
DEFLATE: 1,
|
28
34
|
INFLATE: 2,
|
29
35
|
GZIP: 3,
|
@@ -31,6 +37,8 @@ module.exports = Object.freeze({
|
|
31
37
|
DEFLATERAW: 5,
|
32
38
|
INFLATERAW: 6,
|
33
39
|
UNZIP: 7,
|
40
|
+
BROTLI_DECODE: 8,
|
41
|
+
BROTLI_ENCODE: 9,
|
34
42
|
Z_MIN_WINDOWBITS: 8,
|
35
43
|
Z_MAX_WINDOWBITS: 15,
|
36
44
|
Z_DEFAULT_WINDOWBITS: 15,
|
@@ -42,5 +50,66 @@ module.exports = Object.freeze({
|
|
42
50
|
Z_DEFAULT_MEMLEVEL: 8,
|
43
51
|
Z_MIN_LEVEL: -1,
|
44
52
|
Z_MAX_LEVEL: 9,
|
45
|
-
Z_DEFAULT_LEVEL: -1
|
46
|
-
|
53
|
+
Z_DEFAULT_LEVEL: -1,
|
54
|
+
BROTLI_OPERATION_PROCESS: 0,
|
55
|
+
BROTLI_OPERATION_FLUSH: 1,
|
56
|
+
BROTLI_OPERATION_FINISH: 2,
|
57
|
+
BROTLI_OPERATION_EMIT_METADATA: 3,
|
58
|
+
BROTLI_MODE_GENERIC: 0,
|
59
|
+
BROTLI_MODE_TEXT: 1,
|
60
|
+
BROTLI_MODE_FONT: 2,
|
61
|
+
BROTLI_DEFAULT_MODE: 0,
|
62
|
+
BROTLI_MIN_QUALITY: 0,
|
63
|
+
BROTLI_MAX_QUALITY: 11,
|
64
|
+
BROTLI_DEFAULT_QUALITY: 11,
|
65
|
+
BROTLI_MIN_WINDOW_BITS: 10,
|
66
|
+
BROTLI_MAX_WINDOW_BITS: 24,
|
67
|
+
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
68
|
+
BROTLI_DEFAULT_WINDOW: 22,
|
69
|
+
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
70
|
+
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
71
|
+
BROTLI_PARAM_MODE: 0,
|
72
|
+
BROTLI_PARAM_QUALITY: 1,
|
73
|
+
BROTLI_PARAM_LGWIN: 2,
|
74
|
+
BROTLI_PARAM_LGBLOCK: 3,
|
75
|
+
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
76
|
+
BROTLI_PARAM_SIZE_HINT: 5,
|
77
|
+
BROTLI_PARAM_LARGE_WINDOW: 6,
|
78
|
+
BROTLI_PARAM_NPOSTFIX: 7,
|
79
|
+
BROTLI_PARAM_NDIRECT: 8,
|
80
|
+
BROTLI_DECODER_RESULT_ERROR: 0,
|
81
|
+
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
82
|
+
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
83
|
+
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
84
|
+
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
85
|
+
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
86
|
+
BROTLI_DECODER_NO_ERROR: 0,
|
87
|
+
BROTLI_DECODER_SUCCESS: 1,
|
88
|
+
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
89
|
+
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
90
|
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
91
|
+
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
92
|
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
93
|
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
94
|
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
95
|
+
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
96
|
+
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
97
|
+
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
98
|
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
99
|
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
100
|
+
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
101
|
+
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
102
|
+
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
103
|
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
104
|
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
105
|
+
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
106
|
+
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
107
|
+
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
108
|
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
109
|
+
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
110
|
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
111
|
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
112
|
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
113
|
+
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
114
|
+
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
|
115
|
+
}, realZlibConstants))
|