fsevents 1.2.2 → 1.2.7

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 (149) hide show
  1. package/.travis.yml +2 -1
  2. package/fsevents.cc +9 -22
  3. package/node_modules/abbrev/package.json +1 -1
  4. package/node_modules/ansi-regex/package.json +1 -1
  5. package/node_modules/aproba/package.json +1 -1
  6. package/node_modules/are-we-there-yet/CHANGES.md +6 -0
  7. package/node_modules/are-we-there-yet/package.json +8 -8
  8. package/node_modules/are-we-there-yet/tracker-stream.js +1 -0
  9. package/node_modules/balanced-match/package.json +1 -1
  10. package/node_modules/brace-expansion/package.json +1 -1
  11. package/node_modules/chownr/chownr.js +74 -38
  12. package/node_modules/chownr/package.json +16 -13
  13. package/node_modules/code-point-at/package.json +1 -1
  14. package/node_modules/concat-map/package.json +1 -1
  15. package/node_modules/console-control-strings/package.json +1 -1
  16. package/node_modules/core-util-is/package.json +1 -1
  17. package/node_modules/debug/package.json +1 -1
  18. package/node_modules/deep-extend/CHANGELOG.md +28 -3
  19. package/node_modules/deep-extend/LICENSE +1 -1
  20. package/node_modules/deep-extend/README.md +2 -1
  21. package/node_modules/deep-extend/lib/deep-extend.js +11 -5
  22. package/node_modules/deep-extend/package.json +20 -21
  23. package/node_modules/delegates/package.json +1 -1
  24. package/node_modules/detect-libc/package.json +1 -1
  25. package/node_modules/fs-minipass/package.json +1 -1
  26. package/node_modules/fs.realpath/package.json +1 -1
  27. package/node_modules/gauge/package.json +1 -1
  28. package/node_modules/glob/package.json +12 -12
  29. package/node_modules/has-unicode/package.json +1 -1
  30. package/node_modules/iconv-lite/Changelog.md +16 -0
  31. package/node_modules/iconv-lite/encodings/sbcs-codec.js +2 -2
  32. package/node_modules/iconv-lite/encodings/sbcs-data.js +5 -0
  33. package/node_modules/iconv-lite/lib/extend-node.js +1 -1
  34. package/node_modules/iconv-lite/lib/index.d.ts +2 -2
  35. package/node_modules/iconv-lite/package.json +8 -8
  36. package/node_modules/ignore-walk/package.json +1 -1
  37. package/node_modules/inflight/package.json +1 -1
  38. package/node_modules/inherits/package.json +1 -1
  39. package/node_modules/ini/package.json +1 -1
  40. package/node_modules/is-fullwidth-code-point/package.json +1 -1
  41. package/node_modules/isarray/package.json +1 -1
  42. package/node_modules/minimatch/package.json +1 -1
  43. package/node_modules/minimist/package.json +1 -1
  44. package/node_modules/minipass/LICENSE +15 -0
  45. package/node_modules/minipass/README.md +81 -3
  46. package/node_modules/minipass/index.js +77 -6
  47. package/node_modules/minipass/package.json +13 -13
  48. package/node_modules/minizlib/index.js +66 -95
  49. package/node_modules/minizlib/package.json +12 -12
  50. package/node_modules/mkdirp/package.json +1 -1
  51. package/node_modules/ms/package.json +1 -1
  52. package/node_modules/needle/README.md +2 -1
  53. package/node_modules/needle/lib/cookies.js +12 -10
  54. package/node_modules/needle/lib/needle.js +16 -4
  55. package/node_modules/needle/note.xml +7 -0
  56. package/node_modules/needle/note.xml.1 +7 -0
  57. package/node_modules/needle/package.json +13 -13
  58. package/node_modules/needle/test/errors_spec.js +4 -4
  59. package/node_modules/needle/test/long_string_spec.js +1 -1
  60. package/node_modules/needle/test/url_spec.js +11 -3
  61. package/node_modules/node-pre-gyp/CHANGELOG.md +24 -3
  62. package/node_modules/node-pre-gyp/README.md +15 -18
  63. package/node_modules/node-pre-gyp/appveyor.yml +2 -9
  64. package/node_modules/node-pre-gyp/contributing.md +2 -2
  65. package/node_modules/node-pre-gyp/lib/install.js +29 -7
  66. package/node_modules/node-pre-gyp/lib/package.js +5 -2
  67. package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
  68. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +100 -0
  69. package/node_modules/node-pre-gyp/package.json +13 -14
  70. package/node_modules/nopt/package.json +1 -1
  71. package/node_modules/npm-bundled/LICENSE +15 -0
  72. package/node_modules/npm-bundled/README.md +2 -0
  73. package/node_modules/npm-bundled/index.js +3 -1
  74. package/node_modules/npm-bundled/package.json +7 -7
  75. package/node_modules/npm-packlist/index.js +16 -7
  76. package/node_modules/npm-packlist/package.json +7 -7
  77. package/node_modules/npmlog/package.json +1 -1
  78. package/node_modules/number-is-nan/package.json +1 -1
  79. package/node_modules/object-assign/package.json +1 -1
  80. package/node_modules/once/package.json +1 -1
  81. package/node_modules/os-homedir/package.json +1 -1
  82. package/node_modules/os-tmpdir/package.json +1 -1
  83. package/node_modules/osenv/package.json +1 -1
  84. package/node_modules/path-is-absolute/package.json +1 -1
  85. package/node_modules/process-nextick-args/package.json +1 -1
  86. package/node_modules/rc/node_modules/minimist/package.json +1 -1
  87. package/node_modules/rc/package.json +12 -12
  88. package/node_modules/readable-stream/package.json +1 -1
  89. package/node_modules/rimraf/package.json +11 -8
  90. package/node_modules/safe-buffer/index.d.ts +187 -0
  91. package/node_modules/safe-buffer/package.json +9 -9
  92. package/node_modules/safer-buffer/package.json +6 -6
  93. package/node_modules/sax/package.json +1 -1
  94. package/node_modules/semver/README.md +17 -6
  95. package/node_modules/semver/bin/semver +14 -4
  96. package/node_modules/semver/package.json +7 -7
  97. package/node_modules/semver/semver.js +132 -104
  98. package/node_modules/set-blocking/package.json +1 -1
  99. package/node_modules/signal-exit/package.json +1 -1
  100. package/node_modules/string-width/package.json +1 -1
  101. package/node_modules/string_decoder/package.json +1 -1
  102. package/node_modules/strip-ansi/package.json +1 -1
  103. package/node_modules/strip-json-comments/package.json +1 -1
  104. package/node_modules/tar/README.md +7 -2
  105. package/node_modules/tar/lib/header.js +20 -4
  106. package/node_modules/tar/lib/mode-fix.js +14 -0
  107. package/node_modules/tar/lib/pack.js +1 -0
  108. package/node_modules/tar/lib/parse.js +2 -1
  109. package/node_modules/tar/lib/unpack.js +67 -6
  110. package/node_modules/tar/lib/write-entry.js +25 -6
  111. package/node_modules/tar/package.json +14 -14
  112. package/node_modules/util-deprecate/package.json +1 -1
  113. package/node_modules/wide-align/package.json +8 -8
  114. package/node_modules/wrappy/package.json +1 -1
  115. package/node_modules/yallist/iterator.js +5 -5
  116. package/node_modules/yallist/package.json +7 -7
  117. package/node_modules/yallist/yallist.js +2 -2
  118. package/package.json +3 -3
  119. package/src/async.cc +2 -2
  120. package/src/methods.cc +9 -7
  121. package/src/thread.cc +5 -6
  122. package/.npmignore +0 -1
  123. package/build/.target.mk +0 -53
  124. package/build/Makefile +0 -352
  125. package/build/Release/.deps/Release/.node.d +0 -1
  126. package/build/Release/.deps/Release/fse.node.d +0 -1
  127. package/build/Release/.deps/Release/obj.target/action_after_build.stamp.d +0 -1
  128. package/build/Release/.deps/Release/obj.target/fse/fsevents.o.d +0 -65
  129. package/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d +0 -1
  130. package/build/Release/.node +0 -0
  131. package/build/Release/fse.node +0 -0
  132. package/build/Release/obj.target/action_after_build.stamp +0 -0
  133. package/build/Release/obj.target/fse/fsevents.o +0 -0
  134. package/build/action_after_build.target.mk +0 -32
  135. package/build/binding.Makefile +0 -6
  136. package/build/fse.target.mk +0 -179
  137. package/build/gyp-mac-tool +0 -611
  138. package/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz +0 -0
  139. package/lib/binding/Release/node-v11-darwin-x64/fse.node +0 -0
  140. package/lib/binding/Release/node-v46-darwin-x64/fse.node +0 -0
  141. package/lib/binding/Release/node-v47-darwin-x64/fse.node +0 -0
  142. package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
  143. package/lib/binding/Release/node-v57-darwin-x64/fse.node +0 -0
  144. package/node_modules/are-we-there-yet/CHANGES.md~ +0 -27
  145. package/node_modules/iconv-lite/.travis.yml +0 -23
  146. package/node_modules/rc/.npmignore +0 -3
  147. package/node_modules/safe-buffer/.travis.yml +0 -7
  148. package/node_modules/safe-buffer/test.js +0 -101
  149. package/src/locking.cc +0 -27
@@ -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,27 +1,27 @@
1
1
  {
2
- "_from": "minizlib@^1.1.0",
3
- "_id": "minizlib@1.1.0",
2
+ "_from": "minizlib@^1.1.1",
3
+ "_id": "minizlib@1.2.1",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
5
+ "_integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
6
6
  "_location": "/minizlib",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "range",
10
10
  "registry": true,
11
- "raw": "minizlib@^1.1.0",
11
+ "raw": "minizlib@^1.1.1",
12
12
  "name": "minizlib",
13
13
  "escapedName": "minizlib",
14
- "rawSpec": "^1.1.0",
14
+ "rawSpec": "^1.1.1",
15
15
  "saveSpec": null,
16
- "fetchSpec": "^1.1.0"
16
+ "fetchSpec": "^1.1.1"
17
17
  },
18
18
  "_requiredBy": [
19
19
  "/tar"
20
20
  ],
21
- "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz",
22
- "_shasum": "11e13658ce46bc3a70a267aac58359d1e0c29ceb",
23
- "_spec": "minizlib@^1.1.0",
24
- "_where": "/Users/eshanker/Code/fsevents/node_modules/tar",
21
+ "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
22
+ "_shasum": "dd27ea6136243c7c880684e8672bb3a45fd9b614",
23
+ "_spec": "minizlib@^1.1.1",
24
+ "_where": "/Users/pdunkel1/Office/fsevents/fsevents/node_modules/tar",
25
25
  "author": {
26
26
  "name": "Isaac Z. Schlueter",
27
27
  "email": "i@izs.me",
@@ -37,7 +37,7 @@
37
37
  "deprecated": false,
38
38
  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
39
39
  "devDependencies": {
40
- "tap": "^10.7.2"
40
+ "tap": "^12.0.1"
41
41
  },
42
42
  "files": [
43
43
  "index.js",
@@ -67,5 +67,5 @@
67
67
  "preversion": "npm test",
68
68
  "test": "tap test/*.js --100 -J"
69
69
  },
70
- "version": "1.1.0"
70
+ "version": "1.2.1"
71
71
  }
@@ -23,7 +23,7 @@
23
23
  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
24
24
  "_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
25
25
  "_spec": "mkdirp@^0.5.1",
26
- "_where": "/Users/eshanker/Code/fsevents/node_modules/node-pre-gyp",
26
+ "_where": "/Users/pdunkel1/Office/fsevents/fsevents/node_modules/node-pre-gyp",
27
27
  "author": {
28
28
  "name": "James Halliday",
29
29
  "email": "mail@substack.net",
@@ -21,7 +21,7 @@
21
21
  "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
22
22
  "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8",
23
23
  "_spec": "ms@2.0.0",
24
- "_where": "/Users/eshanker/Code/fsevents/node_modules/debug",
24
+ "_where": "/Users/pdunkel1/Office/fsevents/fsevents/node_modules/debug",
25
25
  "bugs": {
26
26
  "url": "https://github.com/zeit/ms/issues"
27
27
  },
@@ -35,7 +35,7 @@ needle
35
35
  From version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object.
36
36
 
37
37
  ```js
38
- needle('put', 'https://hacking.the.gibson/login', { password: 'god' })
38
+ needle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true })
39
39
  .then(function(response) {
40
40
  return doSomethingWith(response)
41
41
  })
@@ -313,6 +313,7 @@ For information about options that've changed, there's always [the changelog](ht
313
313
  - `headers` : Object containing custom HTTP headers for request. Overrides defaults described below.
314
314
  - `auth` : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers.
315
315
  - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads.
316
+ - `localAddress` : <string>, IP address. Passed to http/https request. Local interface from witch the request should be emitted.
316
317
 
317
318
  Response options
318
319
  ----------------
@@ -1,22 +1,24 @@
1
- //
1
+
2
2
  // Simple cookie handling implementation based on the standard RFC 6265.
3
+ //
3
4
  // This module just has two functionalities:
4
5
  // - Parse a set-cookie-header as a key value object
5
6
  // - Write a cookie-string from a key value object
6
- // All cookie attributes are ignored.
7
7
  //
8
+ // All cookie attributes are ignored.
8
9
 
9
10
  var unescape = require('querystring').unescape;
10
11
 
11
- // RegExps
12
- const COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
13
- const EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g;
14
- const TRAILING_SEMICOLON = /\x3B+$/;
15
- const SEP_SEMICOLON = /\s*\x3B\s*/;
12
+ var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
13
+ var EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g;
14
+ var TRAILING_SEMICOLON = /\x3B+$/;
15
+ var SEP_SEMICOLON = /\s*\x3B\s*/;
16
+
17
+ // i know these should be 'const', but I'd like to keep
18
+ // supporting earlier node.js versions as long as I can. :)
16
19
 
17
- // Constants
18
- const KEY_INDEX = 1; // index of key from COOKIE_PAIR match
19
- const VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
20
+ var KEY_INDEX = 1; // index of key from COOKIE_PAIR match
21
+ var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
20
22
 
21
23
  // Returns a copy str trimmed and without trainling semicolon.
22
24
  function cleanCookieString(str) {
@@ -194,7 +194,9 @@ Needle.prototype.setup = function(uri, options) {
194
194
  // the basics
195
195
 
196
196
  var config = {
197
- http_opts : {}, // passed later to http.request() directly
197
+ http_opts : {
198
+ localAddress: get_option('localAddress', undefined)
199
+ }, // passed later to http.request() directly
198
200
  output : options.output,
199
201
  proxy : get_option('proxy', defaults.proxy),
200
202
  parser : get_option('parse_response', defaults.parse_response),
@@ -695,15 +697,25 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
695
697
  // handle errors on the request object. things might get bumpy.
696
698
  request.on('error', had_error);
697
699
 
700
+ // make sure timer is cleared if request is aborted (issue #257)
701
+ request.once('abort', function() {
702
+ if (timer) clearTimeout(timer);
703
+ })
704
+
698
705
  // handle socket 'end' event to ensure we don't get delayed EPIPE errors.
699
706
  request.once('socket', function(socket) {
700
- socket.once('connect', function() {
707
+ if (socket.connecting) {
708
+ socket.once('connect', function() {
709
+ set_timeout('response', config.response_timeout);
710
+ })
711
+ } else {
701
712
  set_timeout('response', config.response_timeout);
702
- })
713
+ }
703
714
 
715
+ // console.log(socket);
704
716
  if (!socket.on_socket_end) {
705
717
  socket.on_socket_end = on_socket_end;
706
- socket.on('end', socket.on_socket_end);
718
+ socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) });
707
719
  }
708
720
  })
709
721
 
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <note>
3
+ <to>Tove</to>
4
+ <from>Jani</from>
5
+ <heading>Reminder</heading>
6
+ <body>Don't forget me this weekend!</body>
7
+ </note>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <note>
3
+ <to>Tove</to>
4
+ <from>Jani</from>
5
+ <heading>Reminder</heading>
6
+ <body>Don't forget me this weekend!</body>
7
+ </note>
@@ -1,27 +1,27 @@
1
1
  {
2
- "_from": "needle@^2.2.0",
3
- "_id": "needle@2.2.0",
2
+ "_from": "needle@^2.2.1",
3
+ "_id": "needle@2.2.4",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==",
5
+ "_integrity": "sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==",
6
6
  "_location": "/needle",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "range",
10
10
  "registry": true,
11
- "raw": "needle@^2.2.0",
11
+ "raw": "needle@^2.2.1",
12
12
  "name": "needle",
13
13
  "escapedName": "needle",
14
- "rawSpec": "^2.2.0",
14
+ "rawSpec": "^2.2.1",
15
15
  "saveSpec": null,
16
- "fetchSpec": "^2.2.0"
16
+ "fetchSpec": "^2.2.1"
17
17
  },
18
18
  "_requiredBy": [
19
19
  "/node-pre-gyp"
20
20
  ],
21
- "_resolved": "https://registry.npmjs.org/needle/-/needle-2.2.0.tgz",
22
- "_shasum": "f14efc69cee1024b72c8b21c7bdf94a731dc12fa",
23
- "_spec": "needle@^2.2.0",
24
- "_where": "/Users/eshanker/Code/fsevents/node_modules/node-pre-gyp",
21
+ "_resolved": "https://registry.npmjs.org/needle/-/needle-2.2.4.tgz",
22
+ "_shasum": "51931bff82533b1928b7d1d69e01f1b00ffd2a4e",
23
+ "_spec": "needle@^2.2.1",
24
+ "_where": "/Users/pdunkel1/Office/fsevents/fsevents/node_modules/node-pre-gyp",
25
25
  "author": {
26
26
  "name": "Tomás Pollak",
27
27
  "email": "tomas@forkhq.com"
@@ -45,8 +45,8 @@
45
45
  "jschardet": "",
46
46
  "mocha": "",
47
47
  "q": "",
48
- "should": "",
49
- "sinon": "",
48
+ "should": "^13.2.3",
49
+ "sinon": "^2.3.0",
50
50
  "xml2js": ""
51
51
  },
52
52
  "directories": {
@@ -98,5 +98,5 @@
98
98
  "cookie",
99
99
  "redirect"
100
100
  ],
101
- "version": "2.2.0"
101
+ "version": "2.2.4"
102
102
  }
@@ -39,9 +39,9 @@ describe('errors', function() {
39
39
  })
40
40
  })
41
41
 
42
- it('error should be ENOTFOUND', function(done) {
42
+ it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) {
43
43
  needle.get(url, function(err) {
44
- err.code.should.match(/ENOTFOUND|EADDRINFO/)
44
+ err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
45
45
  done();
46
46
  })
47
47
  })
@@ -90,7 +90,7 @@ describe('errors', function() {
90
90
  }, 200)
91
91
  })
92
92
 
93
- it('error should be ENOTFOUND or EADDRINFO', function(done) {
93
+ it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) {
94
94
  var errorific,
95
95
  stream = needle.get(url);
96
96
 
@@ -100,7 +100,7 @@ describe('errors', function() {
100
100
 
101
101
  setTimeout(function() {
102
102
  should.exist(errorific);
103
- errorific.code.should.match(/ENOTFOUND|EADDRINFO/)
103
+ errorific.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
104
104
  done();
105
105
  }, 200)
106
106
  })
@@ -24,7 +24,7 @@ describe('when posting a very long string', function() {
24
24
  }
25
25
 
26
26
  try {
27
- needle.post('http://google.com', { data: get_string(Math.pow(2, 20)) }, finished)
27
+ needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished)
28
28
  } catch(e) {
29
29
  error = e;
30
30
  }
@@ -38,10 +38,18 @@ describe('urls', function() {
38
38
  url = 'foo://google.com/what'
39
39
  })
40
40
 
41
- it('fails', function(done) {
42
- send_request(function(err){
41
+ it('does not throw', function(done) {
42
+ (function() {
43
+ send_request(function(err) {
44
+ done();
45
+ })
46
+ }).should.not.throw()
47
+ })
48
+
49
+ it('returns an error', function(done) {
50
+ send_request(function(err) {
43
51
  err.should.be.an.Error;
44
- err.code.should.eql('ENOTFOUND');
52
+ err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
45
53
  done();
46
54
  })
47
55
  })
@@ -1,5 +1,27 @@
1
1
  # node-pre-gyp changelog
2
2
 
3
+ ## 0.10.3
4
+
5
+ - Now will use `request` over `needle` if request is installed. By default `needle` is used for `https`. This should unbreak proxy support that regressed in v0.9.0
6
+
7
+ ## 0.10.2
8
+
9
+ - Fixed rc/deep-extent security vulnerability
10
+ - Fixed broken reinstall script do to incorrectly named get_best_napi_version
11
+
12
+ ## 0.10.1
13
+
14
+ - Fix needle error event (@medns)
15
+
16
+ ## 0.10.0
17
+
18
+ - Allow for a single-level module path when packing @allenluce (https://github.com/mapbox/node-pre-gyp/pull/371)
19
+ - Log warnings instead of errors when falling back @xzyfer (https://github.com/mapbox/node-pre-gyp/pull/366)
20
+ - Add Node.js v10 support to tests (https://github.com/mapbox/node-pre-gyp/pull/372)
21
+ - Remove retire.js from CI (https://github.com/mapbox/node-pre-gyp/pull/372)
22
+ - Remove support for Node.js v4 due to [EOL on April 30th, 2018](https://github.com/nodejs/Release/blob/7dd52354049cae99eed0e9fe01345b0722a86fde/schedule.json#L14)
23
+ - Update appveyor tests to install default NPM version instead of NPM v2.x for all Windows builds (https://github.com/mapbox/node-pre-gyp/pull/375)
24
+
3
25
  ## 0.9.1
4
26
 
5
27
  - Fixed regression (in v0.9.0) with support for http redirects @allenluce (https://github.com/mapbox/node-pre-gyp/pull/361)
@@ -242,7 +264,7 @@
242
264
 
243
265
  ## 0.5.27
244
266
 
245
- - Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo
267
+ - Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo
246
268
  - Fixed support for installing when path contains a `'` - @halfdan
247
269
  - Ported tests to mocha
248
270
 
@@ -377,7 +399,7 @@
377
399
 
378
400
  ## 0.4.1
379
401
 
380
- - Fixed exception when only stderr is available in binary test (@bendi / #31)
402
+ - Fixed exception when only stderr is available in binary test (@bendi / #31)
381
403
 
382
404
  ## 0.4.0
383
405
 
@@ -398,4 +420,3 @@
398
420
  - Added `testpackage` command.
399
421
  - Changed `clean` command to only delete `.node` not entire `build` directory since node-gyp will handle that.
400
422
  - `.node` modules must be in a folder of there own since tar-pack will remove everything when it unpacks.
401
-