fsevents 1.2.3 → 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 +2 -3
- package/fsevents.cc +14 -26
- package/node_modules/abbrev/package.json +13 -14
- package/node_modules/ansi-regex/package.json +13 -14
- package/node_modules/aproba/package.json +13 -14
- package/node_modules/are-we-there-yet/CHANGES.md +6 -0
- package/node_modules/are-we-there-yet/package.json +19 -20
- package/node_modules/are-we-there-yet/tracker-stream.js +1 -0
- package/node_modules/balanced-match/package.json +13 -14
- package/node_modules/brace-expansion/package.json +13 -14
- package/node_modules/chownr/chownr.js +113 -40
- package/node_modules/chownr/package.json +22 -20
- package/node_modules/code-point-at/package.json +13 -14
- package/node_modules/concat-map/package.json +8 -9
- package/node_modules/console-control-strings/package.json +14 -14
- package/node_modules/core-util-is/package.json +13 -14
- 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 +34 -33
- 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/CHANGELOG.md +28 -3
- package/node_modules/deep-extend/LICENSE +1 -1
- package/node_modules/deep-extend/README.md +2 -1
- package/node_modules/deep-extend/lib/deep-extend.js +11 -5
- package/node_modules/deep-extend/package.json +26 -28
- package/node_modules/delegates/package.json +13 -14
- package/node_modules/detect-libc/package.json +13 -14
- package/node_modules/fs-minipass/index.js +2 -1
- package/node_modules/fs-minipass/package.json +24 -22
- package/node_modules/fs.realpath/package.json +13 -14
- package/node_modules/gauge/package.json +13 -14
- package/node_modules/glob/LICENSE +6 -0
- package/node_modules/glob/README.md +8 -1
- package/node_modules/glob/package.json +21 -19
- package/node_modules/has-unicode/package.json +13 -14
- package/node_modules/iconv-lite/Changelog.md +16 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +2 -2
- package/node_modules/iconv-lite/encodings/sbcs-data.js +5 -0
- package/node_modules/iconv-lite/lib/extend-node.js +1 -1
- package/node_modules/iconv-lite/lib/index.d.ts +2 -2
- package/node_modules/iconv-lite/package.json +19 -20
- 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 +22 -20
- package/node_modules/inflight/package.json +13 -14
- package/node_modules/inherits/inherits.js +2 -0
- package/node_modules/inherits/inherits_browser.js +18 -14
- package/node_modules/inherits/package.json +20 -20
- package/node_modules/ini/package.json +13 -14
- package/node_modules/is-fullwidth-code-point/package.json +13 -14
- package/node_modules/isarray/package.json +13 -14
- package/node_modules/minimatch/package.json +14 -14
- package/node_modules/minimist/package.json +8 -9
- package/node_modules/minipass/LICENSE +15 -0
- package/node_modules/minipass/README.md +567 -7
- package/node_modules/minipass/index.js +255 -22
- package/node_modules/minipass/package.json +26 -22
- package/node_modules/minizlib/README.md +36 -27
- package/node_modules/minizlib/constants.js +73 -4
- package/node_modules/minizlib/index.js +188 -232
- package/node_modules/minizlib/package.json +19 -20
- package/node_modules/mkdirp/package.json +14 -14
- package/node_modules/ms/index.js +29 -19
- package/node_modules/ms/package.json +22 -23
- package/node_modules/ms/readme.md +18 -9
- package/node_modules/needle/README.md +3 -3
- package/node_modules/needle/examples/multipart-stream.js +1 -1
- package/node_modules/needle/lib/auth.js +1 -1
- package/node_modules/needle/lib/cookies.js +12 -10
- package/node_modules/needle/lib/multipart.js +1 -1
- package/node_modules/needle/lib/needle.js +20 -6
- package/node_modules/needle/package.json +26 -27
- 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/errors_spec.js +4 -4
- package/node_modules/needle/test/headers_spec.js +1 -1
- package/node_modules/needle/test/long_string_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/url_spec.js +11 -3
- package/node_modules/needle/test/utils/test.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +34 -3
- package/node_modules/node-pre-gyp/README.md +53 -21
- package/node_modules/node-pre-gyp/appveyor.yml +2 -9
- package/node_modules/node-pre-gyp/contributing.md +2 -2
- package/node_modules/node-pre-gyp/lib/build.js +1 -1
- package/node_modules/node-pre-gyp/lib/install.js +46 -12
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/package.js +5 -2
- 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 +148 -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 +16 -20
- package/node_modules/nopt/package.json +13 -14
- package/node_modules/npm-bundled/LICENSE +15 -0
- package/node_modules/npm-bundled/README.md +2 -0
- package/node_modules/npm-bundled/index.js +29 -7
- package/node_modules/npm-bundled/package.json +21 -19
- 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 +90 -21
- package/node_modules/npm-packlist/package.json +27 -21
- package/node_modules/npmlog/package.json +13 -14
- package/node_modules/number-is-nan/package.json +13 -14
- package/node_modules/object-assign/package.json +13 -14
- package/node_modules/once/package.json +14 -14
- package/node_modules/os-homedir/package.json +13 -14
- package/node_modules/os-tmpdir/package.json +13 -14
- package/node_modules/osenv/package.json +13 -14
- package/node_modules/path-is-absolute/package.json +13 -14
- package/node_modules/process-nextick-args/index.js +2 -1
- package/node_modules/process-nextick-args/package.json +17 -18
- package/node_modules/rc/node_modules/minimist/package.json +13 -14
- package/node_modules/rc/package.json +18 -19
- package/node_modules/readable-stream/package.json +13 -14
- package/node_modules/rimraf/package.json +22 -20
- package/node_modules/rimraf/rimraf.js +9 -1
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/package.json +23 -21
- package/node_modules/safer-buffer/package.json +13 -14
- package/node_modules/sax/package.json +13 -14
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/README.md +43 -19
- package/node_modules/semver/bin/semver +92 -75
- package/node_modules/semver/package.json +25 -20
- package/node_modules/semver/semver.js +922 -763
- package/node_modules/set-blocking/package.json +13 -14
- package/node_modules/signal-exit/package.json +13 -14
- package/node_modules/string-width/package.json +14 -14
- package/node_modules/string_decoder/package.json +13 -14
- package/node_modules/strip-ansi/package.json +14 -14
- package/node_modules/strip-json-comments/package.json +13 -14
- package/node_modules/tar/README.md +7 -2
- package/node_modules/tar/lib/header.js +20 -4
- package/node_modules/tar/lib/large-numbers.js +32 -27
- package/node_modules/tar/lib/mkdir.js +2 -2
- package/node_modules/tar/lib/mode-fix.js +14 -0
- package/node_modules/tar/lib/pack.js +1 -0
- package/node_modules/tar/lib/parse.js +7 -1
- package/node_modules/tar/lib/read-entry.js +4 -0
- package/node_modules/tar/lib/unpack.js +67 -6
- package/node_modules/tar/lib/write-entry.js +25 -6
- package/node_modules/tar/package.json +33 -30
- package/node_modules/util-deprecate/package.json +13 -14
- package/node_modules/wide-align/package.json +19 -20
- package/node_modules/wrappy/package.json +14 -14
- package/node_modules/yallist/iterator.js +5 -5
- package/node_modules/yallist/package.json +19 -19
- package/node_modules/yallist/yallist.js +52 -2
- package/package.json +6 -9
- package/src/async.cc +2 -2
- package/src/constants.cc +20 -20
- package/src/thread.cc +5 -6
- package/.npmignore +0 -1
- package/build/.target.mk +0 -53
- package/build/Makefile +0 -352
- package/build/Release/.deps/Release/.node.d +0 -1
- package/build/Release/.deps/Release/fse.node.d +0 -1
- package/build/Release/.deps/Release/obj.target/action_after_build.stamp.d +0 -1
- package/build/Release/.deps/Release/obj.target/fse/fsevents.o.d +0 -65
- package/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d +0 -1
- package/build/Release/.node +0 -0
- package/build/Release/fse.node +0 -0
- package/build/Release/obj.target/action_after_build.stamp +0 -0
- package/build/Release/obj.target/fse/fsevents.o +0 -0
- package/build/action_after_build.target.mk +0 -32
- package/build/binding.Makefile +0 -6
- package/build/fse.target.mk +0 -179
- package/build/gyp-mac-tool +0 -611
- package/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz +0 -0
- package/lib/binding/Release/node-v11-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v46-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v47-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v57-darwin-x64/fse.node +0 -0
- package/node_modules/are-we-there-yet/CHANGES.md~ +0 -27
- 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/iconv-lite/.travis.yml +0 -23
- package/node_modules/rc/.npmignore +0 -3
- package/node_modules/safe-buffer/.travis.yml +0 -7
- package/node_modules/safe-buffer/test.js +0 -101
- package/src/locking.cc +0 -27
@@ -1,36 +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
13
|
const FLUSHCHUNK = Symbol('flushChunk')
|
11
|
-
const SD = require('string_decoder').StringDecoder
|
12
14
|
const ENCODING = Symbol('encoding')
|
13
15
|
const DECODER = Symbol('decoder')
|
14
16
|
const FLOWING = Symbol('flowing')
|
17
|
+
const PAUSED = Symbol('paused')
|
15
18
|
const RESUME = Symbol('resume')
|
16
19
|
const BUFFERLENGTH = Symbol('bufferLength')
|
17
20
|
const BUFFERPUSH = Symbol('bufferPush')
|
18
21
|
const BUFFERSHIFT = Symbol('bufferShift')
|
19
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')
|
20
31
|
|
21
32
|
// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from
|
22
33
|
// or Buffer.alloc, and Buffer in node 10 deprecated the ctor.
|
23
34
|
// .M, this is fine .\^/M..
|
24
|
-
|
25
|
-
/* istanbul ignore next */
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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 {
|
31
55
|
constructor (options) {
|
32
56
|
super()
|
33
57
|
this[FLOWING] = false
|
58
|
+
// whether we're explicitly paused
|
59
|
+
this[PAUSED] = false
|
34
60
|
this.pipes = new Yallist()
|
35
61
|
this.buffer = new Yallist()
|
36
62
|
this[OBJECTMODE] = options && options.objectMode || false
|
@@ -43,10 +69,12 @@ class MiniPass extends EE {
|
|
43
69
|
this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
|
44
70
|
this[EOF] = false
|
45
71
|
this[EMITTED_END] = false
|
72
|
+
this[EMITTING_END] = false
|
46
73
|
this[CLOSED] = false
|
47
74
|
this.writable = true
|
48
75
|
this.readable = true
|
49
76
|
this[BUFFERLENGTH] = 0
|
77
|
+
this[DESTROYED] = false
|
50
78
|
}
|
51
79
|
|
52
80
|
get bufferLength () { return this[BUFFERLENGTH] }
|
@@ -73,16 +101,52 @@ class MiniPass extends EE {
|
|
73
101
|
this.encoding = enc
|
74
102
|
}
|
75
103
|
|
104
|
+
get objectMode () { return this[OBJECTMODE] }
|
105
|
+
set objectMode (ॐ ) { this[OBJECTMODE] = this[OBJECTMODE] || !!ॐ }
|
106
|
+
|
76
107
|
write (chunk, encoding, cb) {
|
77
108
|
if (this[EOF])
|
78
109
|
throw new Error('write after end')
|
79
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
|
+
|
80
119
|
if (typeof encoding === 'function')
|
81
120
|
cb = encoding, encoding = 'utf8'
|
82
121
|
|
83
122
|
if (!encoding)
|
84
123
|
encoding = 'utf8'
|
85
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
|
+
|
86
150
|
// fast-path writing strings of same encoding to a stream with
|
87
151
|
// an empty buffer, skipping the buffer/decoder dance
|
88
152
|
if (typeof chunk === 'string' && !this[OBJECTMODE] &&
|
@@ -99,13 +163,17 @@ class MiniPass extends EE {
|
|
99
163
|
? (this.emit('data', chunk), this.flowing)
|
100
164
|
: (this[BUFFERPUSH](chunk), false)
|
101
165
|
} finally {
|
102
|
-
this
|
166
|
+
if (this[BUFFERLENGTH] !== 0)
|
167
|
+
this.emit('readable')
|
103
168
|
if (cb)
|
104
169
|
cb()
|
105
170
|
}
|
106
171
|
}
|
107
172
|
|
108
173
|
read (n) {
|
174
|
+
if (this[DESTROYED])
|
175
|
+
return null
|
176
|
+
|
109
177
|
try {
|
110
178
|
if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
|
111
179
|
return null
|
@@ -158,12 +226,22 @@ class MiniPass extends EE {
|
|
158
226
|
this.once('end', cb)
|
159
227
|
this[EOF] = true
|
160
228
|
this.writable = false
|
161
|
-
|
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])
|
162
235
|
this[MAYBE_EMIT_END]()
|
236
|
+
return this
|
163
237
|
}
|
164
238
|
|
165
239
|
// don't let the internal resume be overwritten
|
166
240
|
[RESUME] () {
|
241
|
+
if (this[DESTROYED])
|
242
|
+
return
|
243
|
+
|
244
|
+
this[PAUSED] = false
|
167
245
|
this[FLOWING] = true
|
168
246
|
this.emit('resume')
|
169
247
|
if (this.buffer.length)
|
@@ -180,12 +258,21 @@ class MiniPass extends EE {
|
|
180
258
|
|
181
259
|
pause () {
|
182
260
|
this[FLOWING] = false
|
261
|
+
this[PAUSED] = true
|
262
|
+
}
|
263
|
+
|
264
|
+
get destroyed () {
|
265
|
+
return this[DESTROYED]
|
183
266
|
}
|
184
267
|
|
185
268
|
get flowing () {
|
186
269
|
return this[FLOWING]
|
187
270
|
}
|
188
271
|
|
272
|
+
get paused () {
|
273
|
+
return this[PAUSED]
|
274
|
+
}
|
275
|
+
|
189
276
|
[BUFFERPUSH] (chunk) {
|
190
277
|
if (this[OBJECTMODE])
|
191
278
|
this[BUFFERLENGTH] += 1
|
@@ -216,13 +303,24 @@ class MiniPass extends EE {
|
|
216
303
|
}
|
217
304
|
|
218
305
|
pipe (dest, opts) {
|
306
|
+
if (this[DESTROYED])
|
307
|
+
return
|
308
|
+
|
309
|
+
const ended = this[EMITTED_END]
|
310
|
+
opts = opts || {}
|
219
311
|
if (dest === process.stdout || dest === process.stderr)
|
220
|
-
|
312
|
+
opts.end = false
|
313
|
+
else
|
314
|
+
opts.end = opts.end !== false
|
315
|
+
|
221
316
|
const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
|
222
317
|
this.pipes.push(p)
|
223
318
|
|
224
319
|
dest.on('drain', p.ondrain)
|
225
320
|
this[RESUME]()
|
321
|
+
// piping an ended stream ends immediately
|
322
|
+
if (ended && p.opts.end)
|
323
|
+
p.dest.end()
|
226
324
|
return dest
|
227
325
|
}
|
228
326
|
|
@@ -234,8 +332,11 @@ class MiniPass extends EE {
|
|
234
332
|
try {
|
235
333
|
return super.on(ev, fn)
|
236
334
|
} finally {
|
237
|
-
if (ev === 'data' && !this.pipes.length && !this.flowing)
|
335
|
+
if (ev === 'data' && !this.pipes.length && !this.flowing)
|
238
336
|
this[RESUME]()
|
337
|
+
else if (isEndish(ev) && this[EMITTED_END]) {
|
338
|
+
super.emit(ev)
|
339
|
+
this.removeAllListeners(ev)
|
239
340
|
}
|
240
341
|
}
|
241
342
|
}
|
@@ -245,23 +346,40 @@ class MiniPass extends EE {
|
|
245
346
|
}
|
246
347
|
|
247
348
|
[MAYBE_EMIT_END] () {
|
248
|
-
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
|
249
355
|
this.emit('end')
|
250
356
|
this.emit('prefinish')
|
251
357
|
this.emit('finish')
|
252
358
|
if (this[CLOSED])
|
253
359
|
this.emit('close')
|
360
|
+
this[EMITTING_END] = false
|
254
361
|
}
|
255
362
|
}
|
256
363
|
|
257
364
|
emit (ev, data) {
|
258
|
-
|
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') {
|
259
369
|
if (!data)
|
260
370
|
return
|
261
371
|
|
262
372
|
if (this.pipes.length)
|
263
|
-
this.pipes.forEach(p =>
|
373
|
+
this.pipes.forEach(p =>
|
374
|
+
p.dest.write(data) === false && this.pause())
|
264
375
|
} else if (ev === 'end') {
|
376
|
+
// only actual end gets this treatment
|
377
|
+
if (this[EMITTED_END] === true)
|
378
|
+
return
|
379
|
+
|
380
|
+
this[EMITTED_END] = true
|
381
|
+
this.readable = false
|
382
|
+
|
265
383
|
if (this[DECODER]) {
|
266
384
|
data = this[DECODER].end()
|
267
385
|
if (data) {
|
@@ -269,20 +387,20 @@ class MiniPass extends EE {
|
|
269
387
|
super.emit('data', data)
|
270
388
|
}
|
271
389
|
}
|
390
|
+
|
272
391
|
this.pipes.forEach(p => {
|
273
392
|
p.dest.removeListener('drain', p.ondrain)
|
274
|
-
if (
|
393
|
+
if (p.opts.end)
|
275
394
|
p.dest.end()
|
276
395
|
})
|
277
|
-
this[EMITTED_END] = true
|
278
|
-
this.readable = false
|
279
396
|
} else if (ev === 'close') {
|
280
397
|
this[CLOSED] = true
|
281
398
|
// don't emit close before 'end' and 'finish'
|
282
|
-
if (!this[EMITTED_END])
|
399
|
+
if (!this[EMITTED_END] && !this[DESTROYED])
|
283
400
|
return
|
284
401
|
}
|
285
402
|
|
403
|
+
// TODO: replace with a spread operator when Node v4 support drops
|
286
404
|
const args = new Array(arguments.length)
|
287
405
|
args[0] = ev
|
288
406
|
args[1] = data
|
@@ -295,10 +413,125 @@ class MiniPass extends EE {
|
|
295
413
|
try {
|
296
414
|
return super.emit.apply(this, args)
|
297
415
|
} finally {
|
298
|
-
if (ev
|
416
|
+
if (!isEndish(ev))
|
299
417
|
this[MAYBE_EMIT_END]()
|
418
|
+
else
|
419
|
+
this.removeAllListeners(ev)
|
300
420
|
}
|
301
421
|
}
|
302
|
-
}
|
303
422
|
|
304
|
-
|
423
|
+
// const all = await stream.collect()
|
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 () {
|
446
|
+
return new Promise((resolve, reject) => {
|
447
|
+
this.on(DESTROYED, () => reject(new Error('stream destroyed')))
|
448
|
+
this.on('end', () => resolve())
|
449
|
+
this.on('error', er => reject(er))
|
450
|
+
})
|
451
|
+
}
|
452
|
+
|
453
|
+
// for await (let chunk of stream)
|
454
|
+
[ASYNCITERATOR] () {
|
455
|
+
const next = () => {
|
456
|
+
const res = this.read()
|
457
|
+
if (res !== null)
|
458
|
+
return Promise.resolve({ done: false, value: res })
|
459
|
+
|
460
|
+
if (this[EOF])
|
461
|
+
return Promise.resolve({ done: true })
|
462
|
+
|
463
|
+
let resolve = null
|
464
|
+
let reject = null
|
465
|
+
const onerr = er => {
|
466
|
+
this.removeListener('data', ondata)
|
467
|
+
this.removeListener('end', onend)
|
468
|
+
reject(er)
|
469
|
+
}
|
470
|
+
const ondata = value => {
|
471
|
+
this.removeListener('error', onerr)
|
472
|
+
this.removeListener('end', onend)
|
473
|
+
this.pause()
|
474
|
+
resolve({ value: value, done: !!this[EOF] })
|
475
|
+
}
|
476
|
+
const onend = () => {
|
477
|
+
this.removeListener('error', onerr)
|
478
|
+
this.removeListener('data', ondata)
|
479
|
+
resolve({ done: true })
|
480
|
+
}
|
481
|
+
const ondestroy = () => onerr(new Error('stream destroyed'))
|
482
|
+
return new Promise((res, rej) => {
|
483
|
+
reject = rej
|
484
|
+
resolve = res
|
485
|
+
this.once(DESTROYED, ondestroy)
|
486
|
+
this.once('error', onerr)
|
487
|
+
this.once('end', onend)
|
488
|
+
this.once('data', ondata)
|
489
|
+
})
|
490
|
+
}
|
491
|
+
|
492
|
+
return { next }
|
493
|
+
}
|
494
|
+
|
495
|
+
// for (let chunk of stream)
|
496
|
+
[ITERATOR] () {
|
497
|
+
const next = () => {
|
498
|
+
const value = this.read()
|
499
|
+
const done = value === null
|
500
|
+
return { value, done }
|
501
|
+
}
|
502
|
+
return { next }
|
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
|
+
}
|
537
|
+
}
|
@@ -1,30 +1,29 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
"minipass@2.2.4",
|
5
|
-
"/Users/eshanker/Code/fsevents"
|
6
|
-
]
|
7
|
-
],
|
8
|
-
"_from": "minipass@2.2.4",
|
9
|
-
"_id": "minipass@2.2.4",
|
2
|
+
"_from": "minipass@^2.8.6",
|
3
|
+
"_id": "minipass@2.9.0",
|
10
4
|
"_inBundle": false,
|
11
|
-
"_integrity": "sha512-
|
5
|
+
"_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
|
12
6
|
"_location": "/minipass",
|
13
7
|
"_phantomChildren": {},
|
14
8
|
"_requested": {
|
15
|
-
"type": "
|
9
|
+
"type": "range",
|
16
10
|
"registry": true,
|
17
|
-
"raw": "minipass
|
11
|
+
"raw": "minipass@^2.8.6",
|
18
12
|
"name": "minipass",
|
19
13
|
"escapedName": "minipass",
|
20
|
-
"rawSpec": "2.
|
14
|
+
"rawSpec": "^2.8.6",
|
21
15
|
"saveSpec": null,
|
22
|
-
"fetchSpec": "2.
|
16
|
+
"fetchSpec": "^2.8.6"
|
23
17
|
},
|
24
|
-
"_requiredBy": [
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
"_requiredBy": [
|
19
|
+
"/fs-minipass",
|
20
|
+
"/minizlib",
|
21
|
+
"/tar"
|
22
|
+
],
|
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",
|
28
27
|
"author": {
|
29
28
|
"name": "Isaac Z. Schlueter",
|
30
29
|
"email": "i@izs.me",
|
@@ -33,14 +32,16 @@
|
|
33
32
|
"bugs": {
|
34
33
|
"url": "https://github.com/isaacs/minipass/issues"
|
35
34
|
},
|
35
|
+
"bundleDependencies": false,
|
36
36
|
"dependencies": {
|
37
|
-
"safe-buffer": "^5.1.
|
37
|
+
"safe-buffer": "^5.1.2",
|
38
38
|
"yallist": "^3.0.0"
|
39
39
|
},
|
40
|
+
"deprecated": false,
|
40
41
|
"description": "minimal implementation of a PassThrough stream",
|
41
42
|
"devDependencies": {
|
42
43
|
"end-of-stream": "^1.4.0",
|
43
|
-
"tap": "^
|
44
|
+
"tap": "^14.6.5",
|
44
45
|
"through2": "^2.0.3"
|
45
46
|
},
|
46
47
|
"files": [
|
@@ -59,10 +60,13 @@
|
|
59
60
|
"url": "git+https://github.com/isaacs/minipass.git"
|
60
61
|
},
|
61
62
|
"scripts": {
|
62
|
-
"postpublish": "git push origin --
|
63
|
+
"postpublish": "git push origin --follow-tags",
|
63
64
|
"postversion": "npm publish",
|
64
65
|
"preversion": "npm test",
|
65
|
-
"test": "tap
|
66
|
+
"test": "tap"
|
67
|
+
},
|
68
|
+
"tap": {
|
69
|
+
"check-coverage": true
|
66
70
|
},
|
67
|
-
"version": "2.
|
71
|
+
"version": "2.9.0"
|
68
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))
|