fsevents 1.2.3 → 1.2.8

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.

Files changed (186) hide show
  1. package/.travis.yml +1 -3
  2. package/fsevents.cc +6 -15
  3. package/node_modules/abbrev/package.json +13 -14
  4. package/node_modules/ansi-regex/package.json +13 -14
  5. package/node_modules/aproba/package.json +13 -14
  6. package/node_modules/are-we-there-yet/CHANGES.md +6 -0
  7. package/node_modules/are-we-there-yet/package.json +19 -20
  8. package/node_modules/are-we-there-yet/tracker-stream.js +1 -0
  9. package/node_modules/balanced-match/package.json +13 -14
  10. package/node_modules/brace-expansion/package.json +13 -14
  11. package/node_modules/chownr/chownr.js +74 -38
  12. package/node_modules/chownr/package.json +22 -20
  13. package/node_modules/code-point-at/package.json +13 -14
  14. package/node_modules/concat-map/package.json +8 -9
  15. package/node_modules/console-control-strings/package.json +14 -14
  16. package/node_modules/core-util-is/package.json +13 -14
  17. package/node_modules/debug/CHANGELOG.md +34 -1
  18. package/node_modules/debug/README.md +206 -63
  19. package/node_modules/debug/dist/debug.js +912 -0
  20. package/node_modules/debug/package.json +46 -33
  21. package/node_modules/debug/src/browser.js +185 -106
  22. package/node_modules/debug/src/common.js +266 -0
  23. package/node_modules/debug/src/index.js +4 -4
  24. package/node_modules/debug/src/node.js +174 -165
  25. package/node_modules/deep-extend/CHANGELOG.md +28 -3
  26. package/node_modules/deep-extend/LICENSE +1 -1
  27. package/node_modules/deep-extend/README.md +2 -1
  28. package/node_modules/deep-extend/lib/deep-extend.js +11 -5
  29. package/node_modules/deep-extend/package.json +26 -28
  30. package/node_modules/delegates/package.json +13 -14
  31. package/node_modules/detect-libc/package.json +13 -14
  32. package/node_modules/fs-minipass/package.json +13 -14
  33. package/node_modules/fs.realpath/package.json +13 -14
  34. package/node_modules/gauge/package.json +13 -14
  35. package/node_modules/glob/package.json +18 -19
  36. package/node_modules/has-unicode/package.json +13 -14
  37. package/node_modules/iconv-lite/Changelog.md +16 -0
  38. package/node_modules/iconv-lite/encodings/sbcs-codec.js +2 -2
  39. package/node_modules/iconv-lite/encodings/sbcs-data.js +5 -0
  40. package/node_modules/iconv-lite/lib/extend-node.js +1 -1
  41. package/node_modules/iconv-lite/lib/index.d.ts +2 -2
  42. package/node_modules/iconv-lite/package.json +19 -20
  43. package/node_modules/ignore-walk/package.json +13 -14
  44. package/node_modules/inflight/package.json +13 -14
  45. package/node_modules/inherits/package.json +14 -14
  46. package/node_modules/ini/package.json +13 -14
  47. package/node_modules/is-fullwidth-code-point/package.json +13 -14
  48. package/node_modules/isarray/package.json +13 -14
  49. package/node_modules/minimatch/package.json +14 -14
  50. package/node_modules/minimist/package.json +8 -9
  51. package/node_modules/minipass/LICENSE +15 -0
  52. package/node_modules/minipass/README.md +81 -3
  53. package/node_modules/minipass/index.js +77 -6
  54. package/node_modules/minipass/package.json +21 -20
  55. package/node_modules/minizlib/index.js +66 -95
  56. package/node_modules/minizlib/package.json +18 -19
  57. package/node_modules/mkdirp/package.json +14 -14
  58. package/node_modules/ms/index.js +28 -18
  59. package/node_modules/ms/package.json +22 -23
  60. package/node_modules/ms/readme.md +17 -8
  61. package/node_modules/needle/.npmignore +6 -0
  62. package/node_modules/needle/README.md +3 -3
  63. package/node_modules/needle/examples/multipart-stream.js +1 -1
  64. package/node_modules/needle/lib/auth.js +1 -1
  65. package/node_modules/needle/lib/cookies.js +12 -10
  66. package/node_modules/needle/lib/multipart.js +1 -1
  67. package/node_modules/needle/lib/needle.js +18 -6
  68. package/node_modules/needle/package-lock.json +395 -0
  69. package/node_modules/needle/package.json +26 -27
  70. package/node_modules/needle/test/basic_auth_spec.js +1 -1
  71. package/node_modules/needle/test/cookies_spec.js +2 -2
  72. package/node_modules/needle/test/errors_spec.js +4 -4
  73. package/node_modules/needle/test/keys/ssl.cert +21 -0
  74. package/node_modules/needle/test/keys/ssl.key +27 -0
  75. package/node_modules/needle/test/long_string_spec.js +1 -1
  76. package/node_modules/needle/test/output_spec.js +1 -1
  77. package/node_modules/needle/test/post_data_spec.js +20 -20
  78. package/node_modules/needle/test/proxy_spec.js +1 -1
  79. package/node_modules/needle/test/url_spec.js +11 -3
  80. package/node_modules/needle/test/utils/test.js +1 -1
  81. package/node_modules/node-pre-gyp/CHANGELOG.md +34 -3
  82. package/node_modules/node-pre-gyp/README.md +53 -21
  83. package/node_modules/node-pre-gyp/appveyor.yml +2 -9
  84. package/node_modules/node-pre-gyp/contributing.md +2 -2
  85. package/node_modules/node-pre-gyp/lib/build.js +1 -1
  86. package/node_modules/node-pre-gyp/lib/install.js +46 -12
  87. package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
  88. package/node_modules/node-pre-gyp/lib/package.js +5 -2
  89. package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
  90. package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
  91. package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
  92. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +148 -0
  93. package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
  94. package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
  95. package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
  96. package/node_modules/node-pre-gyp/package.json +16 -19
  97. package/node_modules/nopt/package.json +13 -14
  98. package/node_modules/npm-bundled/LICENSE +15 -0
  99. package/node_modules/npm-bundled/README.md +2 -0
  100. package/node_modules/npm-bundled/index.js +16 -2
  101. package/node_modules/npm-bundled/package.json +18 -19
  102. package/node_modules/npm-packlist/index.js +43 -13
  103. package/node_modules/npm-packlist/package.json +18 -19
  104. package/node_modules/npmlog/package.json +13 -14
  105. package/node_modules/number-is-nan/package.json +13 -14
  106. package/node_modules/object-assign/package.json +13 -14
  107. package/node_modules/once/package.json +14 -14
  108. package/node_modules/os-homedir/package.json +13 -14
  109. package/node_modules/os-tmpdir/package.json +13 -14
  110. package/node_modules/osenv/package.json +13 -14
  111. package/node_modules/path-is-absolute/package.json +13 -14
  112. package/node_modules/process-nextick-args/package.json +13 -14
  113. package/node_modules/rc/node_modules/minimist/package.json +13 -14
  114. package/node_modules/rc/package.json +18 -19
  115. package/node_modules/readable-stream/package.json +13 -14
  116. package/node_modules/rimraf/package.json +22 -20
  117. package/node_modules/safe-buffer/index.d.ts +187 -0
  118. package/node_modules/safe-buffer/package.json +23 -21
  119. package/node_modules/safer-buffer/package.json +13 -14
  120. package/node_modules/sax/package.json +13 -14
  121. package/node_modules/semver/CHANGELOG.md +39 -0
  122. package/node_modules/semver/README.md +31 -8
  123. package/node_modules/semver/bin/semver +92 -75
  124. package/node_modules/semver/package.json +25 -20
  125. package/node_modules/semver/semver.js +922 -763
  126. package/node_modules/set-blocking/package.json +13 -14
  127. package/node_modules/signal-exit/package.json +13 -14
  128. package/node_modules/string-width/package.json +14 -14
  129. package/node_modules/string_decoder/package.json +13 -14
  130. package/node_modules/strip-ansi/package.json +14 -14
  131. package/node_modules/strip-json-comments/package.json +13 -14
  132. package/node_modules/tar/README.md +7 -2
  133. package/node_modules/tar/lib/header.js +20 -4
  134. package/node_modules/tar/lib/mode-fix.js +14 -0
  135. package/node_modules/tar/lib/pack.js +1 -0
  136. package/node_modules/tar/lib/parse.js +2 -1
  137. package/node_modules/tar/lib/unpack.js +67 -6
  138. package/node_modules/tar/lib/write-entry.js +25 -6
  139. package/node_modules/tar/package.json +25 -26
  140. package/node_modules/util-deprecate/package.json +13 -14
  141. package/node_modules/wide-align/package.json +19 -20
  142. package/node_modules/wrappy/package.json +14 -14
  143. package/node_modules/yallist/iterator.js +5 -5
  144. package/node_modules/yallist/package.json +19 -19
  145. package/node_modules/yallist/yallist.js +2 -2
  146. package/package.json +6 -9
  147. package/src/async.cc +2 -2
  148. package/src/thread.cc +5 -6
  149. package/.npmignore +0 -1
  150. package/build/.target.mk +0 -53
  151. package/build/Makefile +0 -352
  152. package/build/Release/.deps/Release/.node.d +0 -1
  153. package/build/Release/.deps/Release/fse.node.d +0 -1
  154. package/build/Release/.deps/Release/obj.target/action_after_build.stamp.d +0 -1
  155. package/build/Release/.deps/Release/obj.target/fse/fsevents.o.d +0 -65
  156. package/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d +0 -1
  157. package/build/Release/.node +0 -0
  158. package/build/Release/fse.node +0 -0
  159. package/build/Release/obj.target/action_after_build.stamp +0 -0
  160. package/build/Release/obj.target/fse/fsevents.o +0 -0
  161. package/build/action_after_build.target.mk +0 -32
  162. package/build/binding.Makefile +0 -6
  163. package/build/fse.target.mk +0 -179
  164. package/build/gyp-mac-tool +0 -611
  165. package/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz +0 -0
  166. package/lib/binding/Release/node-v11-darwin-x64/fse.node +0 -0
  167. package/lib/binding/Release/node-v46-darwin-x64/fse.node +0 -0
  168. package/lib/binding/Release/node-v47-darwin-x64/fse.node +0 -0
  169. package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
  170. package/lib/binding/Release/node-v57-darwin-x64/fse.node +0 -0
  171. package/node_modules/are-we-there-yet/CHANGES.md~ +0 -27
  172. package/node_modules/debug/.coveralls.yml +0 -1
  173. package/node_modules/debug/.eslintrc +0 -11
  174. package/node_modules/debug/.npmignore +0 -9
  175. package/node_modules/debug/.travis.yml +0 -14
  176. package/node_modules/debug/Makefile +0 -50
  177. package/node_modules/debug/component.json +0 -19
  178. package/node_modules/debug/karma.conf.js +0 -70
  179. package/node_modules/debug/node.js +0 -1
  180. package/node_modules/debug/src/debug.js +0 -202
  181. package/node_modules/debug/src/inspector-log.js +0 -15
  182. package/node_modules/iconv-lite/.travis.yml +0 -23
  183. package/node_modules/rc/.npmignore +0 -3
  184. package/node_modules/safe-buffer/.travis.yml +0 -7
  185. package/node_modules/safe-buffer/test.js +0 -101
  186. package/src/locking.cc +0 -27
@@ -7,6 +7,9 @@ const EMITTED_END = Symbol('emittedEnd')
7
7
  const CLOSED = Symbol('closed')
8
8
  const READ = Symbol('read')
9
9
  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')
10
13
  const FLUSHCHUNK = Symbol('flushChunk')
11
14
  const SD = require('string_decoder').StringDecoder
12
15
  const ENCODING = Symbol('encoding')
@@ -27,7 +30,7 @@ if (!B.alloc) {
27
30
  B = require('safe-buffer').Buffer
28
31
  }
29
32
 
30
- class MiniPass extends EE {
33
+ module.exports = class MiniPass extends EE {
31
34
  constructor (options) {
32
35
  super()
33
36
  this[FLOWING] = false
@@ -234,8 +237,11 @@ class MiniPass extends EE {
234
237
  try {
235
238
  return super.on(ev, fn)
236
239
  } finally {
237
- if (ev === 'data' && !this.pipes.length && !this.flowing) {
240
+ if (ev === 'data' && !this.pipes.length && !this.flowing)
238
241
  this[RESUME]()
242
+ else if (ev === 'end' && this[EMITTED_END]) {
243
+ super.emit('end')
244
+ this.removeAllListeners('end')
239
245
  }
240
246
  }
241
247
  }
@@ -262,6 +268,12 @@ class MiniPass extends EE {
262
268
  if (this.pipes.length)
263
269
  this.pipes.forEach(p => p.dest.write(data) || this.pause())
264
270
  } else if (ev === 'end') {
271
+ if (this[EMITTED_END] === true)
272
+ return
273
+
274
+ this[EMITTED_END] = true
275
+ this.readable = false
276
+
265
277
  if (this[DECODER]) {
266
278
  data = this[DECODER].end()
267
279
  if (data) {
@@ -269,13 +281,12 @@ class MiniPass extends EE {
269
281
  super.emit('data', data)
270
282
  }
271
283
  }
284
+
272
285
  this.pipes.forEach(p => {
273
286
  p.dest.removeListener('drain', p.ondrain)
274
287
  if (!p.opts || p.opts.end !== false)
275
288
  p.dest.end()
276
289
  })
277
- this[EMITTED_END] = true
278
- this.readable = false
279
290
  } else if (ev === 'close') {
280
291
  this[CLOSED] = true
281
292
  // don't emit close before 'end' and 'finish'
@@ -297,8 +308,68 @@ class MiniPass extends EE {
297
308
  } finally {
298
309
  if (ev !== 'end')
299
310
  this[MAYBE_EMIT_END]()
311
+ else
312
+ this.removeAllListeners('end')
300
313
  }
301
314
  }
302
- }
303
315
 
304
- module.exports = MiniPass
316
+ // const all = await stream.collect()
317
+ collect () {
318
+ return new Promise((resolve, reject) => {
319
+ const buf = []
320
+ this.on('data', c => buf.push(c))
321
+ this.on('end', () => resolve(buf))
322
+ this.on('error', reject)
323
+ })
324
+ }
325
+
326
+ // for await (let chunk of stream)
327
+ [ASYNCITERATOR] () {
328
+ const next = () => {
329
+ const res = this.read()
330
+ if (res !== null)
331
+ return Promise.resolve({ done: false, value: res })
332
+
333
+ if (this[EOF])
334
+ return Promise.resolve({ done: true })
335
+
336
+ let resolve = null
337
+ let reject = null
338
+ const onerr = er => {
339
+ this.removeListener('data', ondata)
340
+ this.removeListener('end', onend)
341
+ reject(er)
342
+ }
343
+ const ondata = value => {
344
+ this.removeListener('error', onerr)
345
+ this.removeListener('end', onend)
346
+ this.pause()
347
+ resolve({ value: value, done: !!this[EOF] })
348
+ }
349
+ const onend = () => {
350
+ this.removeListener('error', onerr)
351
+ this.removeListener('data', ondata)
352
+ resolve({ done: true })
353
+ }
354
+ return new Promise((res, rej) => {
355
+ reject = rej
356
+ resolve = res
357
+ this.once('error', onerr)
358
+ this.once('end', onend)
359
+ this.once('data', ondata)
360
+ })
361
+ }
362
+
363
+ return { next }
364
+ }
365
+
366
+ // for (let chunk of stream)
367
+ [ITERATOR] () {
368
+ const next = () => {
369
+ const value = this.read()
370
+ const done = value === null
371
+ return { value, done }
372
+ }
373
+ return { next }
374
+ }
375
+ }
@@ -1,30 +1,29 @@
1
1
  {
2
- "_args": [
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.3.4",
3
+ "_id": "minipass@2.3.5",
10
4
  "_inBundle": false,
11
- "_integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
5
+ "_integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
12
6
  "_location": "/minipass",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
15
- "type": "version",
9
+ "type": "range",
16
10
  "registry": true,
17
- "raw": "minipass@2.2.4",
11
+ "raw": "minipass@^2.3.4",
18
12
  "name": "minipass",
19
13
  "escapedName": "minipass",
20
- "rawSpec": "2.2.4",
14
+ "rawSpec": "^2.3.4",
21
15
  "saveSpec": null,
22
- "fetchSpec": "2.2.4"
16
+ "fetchSpec": "^2.3.4"
23
17
  },
24
- "_requiredBy": [],
25
- "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
26
- "_spec": "2.2.4",
27
- "_where": "/Users/eshanker/Code/fsevents",
18
+ "_requiredBy": [
19
+ "/fs-minipass",
20
+ "/minizlib",
21
+ "/tar"
22
+ ],
23
+ "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
24
+ "_shasum": "cacebe492022497f656b0f0f51e2682a9ed2d848",
25
+ "_spec": "minipass@^2.3.4",
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.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": "^10.7.0",
44
+ "tap": "^12.0.1",
44
45
  "through2": "^2.0.3"
45
46
  },
46
47
  "files": [
@@ -64,5 +65,5 @@
64
65
  "preversion": "npm test",
65
66
  "test": "tap test/*.js --100"
66
67
  },
67
- "version": "2.2.4"
68
+ "version": "2.3.5"
68
69
  }
@@ -2,11 +2,13 @@
2
2
 
3
3
  const assert = require('assert')
4
4
  const Buffer = require('buffer').Buffer
5
- const binding = process.binding('zlib')
5
+ const realZlib = require('zlib')
6
6
 
7
7
  const constants = exports.constants = require('./constants.js')
8
8
  const MiniPass = require('minipass')
9
9
 
10
+ const OriginalBufferConcat = Buffer.concat
11
+
10
12
  class ZlibError extends Error {
11
13
  constructor (msg, errno) {
12
14
  super('zlib: ' + msg)
@@ -54,24 +56,19 @@ const strategies = new Set([
54
56
  // true or false if there is anything in the queue when
55
57
  // you call the .write() method.
56
58
  const _opts = Symbol('opts')
57
- const _chunkSize = Symbol('chunkSize')
58
59
  const _flushFlag = Symbol('flushFlag')
59
60
  const _finishFlush = Symbol('finishFlush')
60
61
  const _handle = Symbol('handle')
61
- const _hadError = Symbol('hadError')
62
- const _buffer = Symbol('buffer')
63
- const _offset = Symbol('offset')
62
+ const _onError = Symbol('onError')
64
63
  const _level = Symbol('level')
65
64
  const _strategy = Symbol('strategy')
66
65
  const _ended = Symbol('ended')
67
- const _writeState = Symbol('writeState')
68
66
 
69
67
  class Zlib extends MiniPass {
70
68
  constructor (opts, mode) {
71
69
  super(opts)
72
70
  this[_ended] = false
73
71
  this[_opts] = opts = opts || {}
74
- this[_chunkSize] = opts.chunkSize || constants.Z_DEFAULT_CHUNK
75
72
  if (opts.flush && !validFlushFlags.has(opts.flush)) {
76
73
  throw new TypeError('Invalid flush flag: ' + opts.flush)
77
74
  }
@@ -119,18 +116,17 @@ class Zlib extends MiniPass {
119
116
  }
120
117
  }
121
118
 
122
- this[_handle] = new binding.Zlib(mode)
119
+ this[_handle] = new realZlib[mode](opts)
123
120
 
124
- this[_hadError] = false
125
- this[_handle].onerror = (message, errno) => {
121
+ this[_onError] = (err) => {
126
122
  // there is no way to cleanly recover.
127
123
  // continuing only obscures problems.
128
124
  this.close()
129
- this[_hadError] = true
130
125
 
131
- const error = new ZlibError(message, errno)
126
+ const error = new ZlibError(err.message, err.errno)
132
127
  this.emit('error', error)
133
128
  }
129
+ this[_handle].on('error', this[_onError])
134
130
 
135
131
  const level = typeof opts.level === 'number' ? opts.level
136
132
  : constants.Z_DEFAULT_COMPRESSION
@@ -138,30 +134,9 @@ class Zlib extends MiniPass {
138
134
  var strategy = typeof opts.strategy === 'number' ? opts.strategy
139
135
  : constants.Z_DEFAULT_STRATEGY
140
136
 
141
- this[_writeState] = new Uint32Array(2);
142
- const window = opts.windowBits || constants.Z_DEFAULT_WINDOWBITS
143
- const memLevel = opts.memLevel || constants.Z_DEFAULT_MEMLEVEL
144
-
145
137
  // API changed in node v9
146
138
  /* istanbul ignore next */
147
- if (/^v[0-8]\./.test(process.version)) {
148
- this[_handle].init(window,
149
- level,
150
- memLevel,
151
- strategy,
152
- opts.dictionary)
153
- } else {
154
- this[_handle].init(window,
155
- level,
156
- memLevel,
157
- strategy,
158
- this[_writeState],
159
- () => {},
160
- opts.dictionary)
161
- }
162
139
 
163
- this[_buffer] = Buffer.allocUnsafe(this[_chunkSize])
164
- this[_offset] = 0
165
140
  this[_level] = level
166
141
  this[_strategy] = strategy
167
142
 
@@ -196,9 +171,18 @@ class Zlib extends MiniPass {
196
171
  if (this[_level] !== level || this[_strategy] !== strategy) {
197
172
  this.flush(constants.Z_SYNC_FLUSH)
198
173
  assert(this[_handle], 'zlib binding closed')
174
+ // .params() calls .flush(), but the latter is always async in the
175
+ // core zlib. We override .flush() temporarily to intercept that and
176
+ // flush synchronously.
177
+ const origFlush = this[_handle].flush
178
+ this[_handle].flush = (flushFlag, cb) => {
179
+ this[_handle].flush = origFlush
180
+ this.flush(flushFlag)
181
+ cb()
182
+ }
199
183
  this[_handle].params(level, strategy)
200
184
  /* istanbul ignore else */
201
- if (!this[_hadError]) {
185
+ if (this[_handle]) {
202
186
  this[_level] = level
203
187
  this[_strategy] = strategy
204
188
  }
@@ -242,66 +226,53 @@ class Zlib extends MiniPass {
242
226
  cb = encoding, encoding = 'utf8'
243
227
 
244
228
  if (typeof chunk === 'string')
245
- chunk = new Buffer(chunk, encoding)
246
-
247
- let availInBefore = chunk && chunk.length
248
- let availOutBefore = this[_chunkSize] - this[_offset]
249
- let inOff = 0 // the offset of the input buffer
250
- const flushFlag = this[_flushFlag]
251
- let writeReturn = true
229
+ chunk = Buffer.from(chunk, encoding)
252
230
 
253
231
  assert(this[_handle], 'zlib binding closed')
254
- do {
255
- let res = this[_handle].writeSync(
256
- flushFlag,
257
- chunk, // in
258
- inOff, // in_off
259
- availInBefore, // in_len
260
- this[_buffer], // out
261
- this[_offset], //out_off
262
- availOutBefore // out_len
263
- )
264
-
265
- if (this[_hadError])
266
- break
267
-
268
- // API changed in v9
269
- /* istanbul ignore next */
270
- let availInAfter = res ? res[0] : this[_writeState][1]
271
- /* istanbul ignore next */
272
- let availOutAfter = res ? res[1] : this[_writeState][0]
273
-
274
- const have = availOutBefore - availOutAfter
275
- assert(have >= 0, 'have should not go down')
276
-
277
- if (have > 0) {
278
- const out = this[_buffer].slice(
279
- this[_offset], this[_offset] + have
280
- )
281
-
282
- this[_offset] += have
283
- // serve some output to the consumer.
284
- writeReturn = super.write(out) && writeReturn
285
- }
286
232
 
287
- // exhausted the output buffer, or used all the input create a new one.
288
- if (availOutAfter === 0 || this[_offset] >= this[_chunkSize]) {
289
- availOutBefore = this[_chunkSize]
290
- this[_offset] = 0
291
- this[_buffer] = Buffer.allocUnsafe(this[_chunkSize])
233
+ // _processChunk tries to .close() the native handle after it's done, so we
234
+ // intercept that by temporarily making it a no-op.
235
+ const nativeHandle = this[_handle]._handle
236
+ const originalNativeClose = nativeHandle.close
237
+ nativeHandle.close = () => {}
238
+ const originalClose = this[_handle].close
239
+ this[_handle].close = () => {}
240
+ // It also calls `Buffer.concat()` at the end, which may be convenient
241
+ // for some, but which we are not interested in as it slows us down.
242
+ Buffer.concat = (args) => args
243
+ let result
244
+ try {
245
+ result = this[_handle]._processChunk(chunk, this[_flushFlag])
246
+ } catch (err) {
247
+ this[_onError](err)
248
+ } finally {
249
+ Buffer.concat = OriginalBufferConcat
250
+ if (this[_handle]) {
251
+ // Core zlib resets `_handle` to null after attempting to close the
252
+ // native handle. Our no-op handler prevented actual closure, but we
253
+ // need to restore the `._handle` property.
254
+ this[_handle]._handle = nativeHandle
255
+ nativeHandle.close = originalNativeClose
256
+ this[_handle].close = originalClose
257
+ // `_processChunk()` adds an 'error' listener. If we don't remove it
258
+ // after each call, these handlers start piling up.
259
+ this[_handle].removeAllListeners('error')
292
260
  }
261
+ }
293
262
 
294
- if (availOutAfter === 0) {
295
- // Not actually done. Need to reprocess.
296
- // Also, update the availInBefore to the availInAfter value,
297
- // so that if we have to hit it a third (fourth, etc.) time,
298
- // it'll have the correct byte counts.
299
- inOff += (availInBefore - availInAfter)
300
- availInBefore = availInAfter
301
- continue
263
+ let writeReturn
264
+ if (result) {
265
+ if (Array.isArray(result) && result.length > 0) {
266
+ // The first buffer is always `handle._outBuffer`, which would be
267
+ // re-used for later invocations; so, we always have to copy that one.
268
+ writeReturn = super.write(Buffer.from(result[0]))
269
+ for (let i = 1; i < result.length; i++) {
270
+ writeReturn = super.write(result[i])
271
+ }
272
+ } else {
273
+ writeReturn = super.write(Buffer.from(result))
302
274
  }
303
- break
304
- } while (!this[_hadError])
275
+ }
305
276
 
306
277
  if (cb)
307
278
  cb()
@@ -312,46 +283,46 @@ class Zlib extends MiniPass {
312
283
  // minimal 2-byte header
313
284
  class Deflate extends Zlib {
314
285
  constructor (opts) {
315
- super(opts, constants.DEFLATE)
286
+ super(opts, 'Deflate')
316
287
  }
317
288
  }
318
289
 
319
290
  class Inflate extends Zlib {
320
291
  constructor (opts) {
321
- super(opts, constants.INFLATE)
292
+ super(opts, 'Inflate')
322
293
  }
323
294
  }
324
295
 
325
296
  // gzip - bigger header, same deflate compression
326
297
  class Gzip extends Zlib {
327
298
  constructor (opts) {
328
- super(opts, constants.GZIP)
299
+ super(opts, 'Gzip')
329
300
  }
330
301
  }
331
302
 
332
303
  class Gunzip extends Zlib {
333
304
  constructor (opts) {
334
- super(opts, constants.GUNZIP)
305
+ super(opts, 'Gunzip')
335
306
  }
336
307
  }
337
308
 
338
309
  // raw - no header
339
310
  class DeflateRaw extends Zlib {
340
311
  constructor (opts) {
341
- super(opts, constants.DEFLATERAW)
312
+ super(opts, 'DeflateRaw')
342
313
  }
343
314
  }
344
315
 
345
316
  class InflateRaw extends Zlib {
346
317
  constructor (opts) {
347
- super(opts, constants.INFLATERAW)
318
+ super(opts, 'InflateRaw')
348
319
  }
349
320
  }
350
321
 
351
322
  // auto-detect header.
352
323
  class Unzip extends Zlib {
353
324
  constructor (opts) {
354
- super(opts, constants.UNZIP)
325
+ super(opts, 'Unzip')
355
326
  }
356
327
  }
357
328
 
@@ -1,30 +1,27 @@
1
1
  {
2
- "_args": [
3
- [
4
- "minizlib@1.1.0",
5
- "/Users/eshanker/Code/fsevents"
6
- ]
7
- ],
8
- "_from": "minizlib@1.1.0",
9
- "_id": "minizlib@1.1.0",
2
+ "_from": "minizlib@^1.1.1",
3
+ "_id": "minizlib@1.2.1",
10
4
  "_inBundle": false,
11
- "_integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
5
+ "_integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
12
6
  "_location": "/minizlib",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
15
- "type": "version",
9
+ "type": "range",
16
10
  "registry": true,
17
- "raw": "minizlib@1.1.0",
11
+ "raw": "minizlib@^1.1.1",
18
12
  "name": "minizlib",
19
13
  "escapedName": "minizlib",
20
- "rawSpec": "1.1.0",
14
+ "rawSpec": "^1.1.1",
21
15
  "saveSpec": null,
22
- "fetchSpec": "1.1.0"
16
+ "fetchSpec": "^1.1.1"
23
17
  },
24
- "_requiredBy": [],
25
- "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz",
26
- "_spec": "1.1.0",
27
- "_where": "/Users/eshanker/Code/fsevents",
18
+ "_requiredBy": [
19
+ "/tar"
20
+ ],
21
+ "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
22
+ "_shasum": "dd27ea6136243c7c880684e8672bb3a45fd9b614",
23
+ "_spec": "minizlib@^1.1.1",
24
+ "_where": "/Users/pipobscure/fsevents/node_modules/tar",
28
25
  "author": {
29
26
  "name": "Isaac Z. Schlueter",
30
27
  "email": "i@izs.me",
@@ -33,12 +30,14 @@
33
30
  "bugs": {
34
31
  "url": "https://github.com/isaacs/minizlib/issues"
35
32
  },
33
+ "bundleDependencies": false,
36
34
  "dependencies": {
37
35
  "minipass": "^2.2.1"
38
36
  },
37
+ "deprecated": false,
39
38
  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
40
39
  "devDependencies": {
41
- "tap": "^10.7.2"
40
+ "tap": "^12.0.1"
42
41
  },
43
42
  "files": [
44
43
  "index.js",
@@ -68,5 +67,5 @@
68
67
  "preversion": "npm test",
69
68
  "test": "tap test/*.js --100 -J"
70
69
  },
71
- "version": "1.1.0"
70
+ "version": "1.2.1"
72
71
  }
@@ -1,30 +1,28 @@
1
1
  {
2
- "_args": [
3
- [
4
- "mkdirp@0.5.1",
5
- "/Users/eshanker/Code/fsevents"
6
- ]
7
- ],
8
- "_from": "mkdirp@0.5.1",
2
+ "_from": "mkdirp@^0.5.1",
9
3
  "_id": "mkdirp@0.5.1",
10
4
  "_inBundle": false,
11
5
  "_integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
12
6
  "_location": "/mkdirp",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
15
- "type": "version",
9
+ "type": "range",
16
10
  "registry": true,
17
- "raw": "mkdirp@0.5.1",
11
+ "raw": "mkdirp@^0.5.1",
18
12
  "name": "mkdirp",
19
13
  "escapedName": "mkdirp",
20
- "rawSpec": "0.5.1",
14
+ "rawSpec": "^0.5.1",
21
15
  "saveSpec": null,
22
- "fetchSpec": "0.5.1"
16
+ "fetchSpec": "^0.5.1"
23
17
  },
24
- "_requiredBy": [],
18
+ "_requiredBy": [
19
+ "/node-pre-gyp",
20
+ "/tar"
21
+ ],
25
22
  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
26
- "_spec": "0.5.1",
27
- "_where": "/Users/eshanker/Code/fsevents",
23
+ "_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
24
+ "_spec": "mkdirp@^0.5.1",
25
+ "_where": "/Users/pipobscure/fsevents/node_modules/node-pre-gyp",
28
26
  "author": {
29
27
  "name": "James Halliday",
30
28
  "email": "mail@substack.net",
@@ -36,9 +34,11 @@
36
34
  "bugs": {
37
35
  "url": "https://github.com/substack/node-mkdirp/issues"
38
36
  },
37
+ "bundleDependencies": false,
39
38
  "dependencies": {
40
39
  "minimist": "0.0.8"
41
40
  },
41
+ "deprecated": false,
42
42
  "description": "Recursively mkdir, like `mkdir -p`",
43
43
  "devDependencies": {
44
44
  "mock-fs": "2 >=2.7.0",