fsevents 1.2.7 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fsevents might be problematic. Click here for more details.

Files changed (152) hide show
  1. package/.travis.yml +1 -2
  2. package/fsevents.cc +8 -11
  3. package/node_modules/abbrev/package.json +2 -3
  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/package.json +1 -1
  7. package/node_modules/balanced-match/package.json +1 -1
  8. package/node_modules/brace-expansion/package.json +1 -1
  9. package/node_modules/chownr/chownr.js +47 -10
  10. package/node_modules/chownr/package.json +7 -7
  11. package/node_modules/code-point-at/package.json +1 -1
  12. package/node_modules/concat-map/package.json +1 -1
  13. package/node_modules/console-control-strings/package.json +1 -1
  14. package/node_modules/core-util-is/package.json +1 -1
  15. package/node_modules/debug/CHANGELOG.md +34 -1
  16. package/node_modules/debug/README.md +188 -63
  17. package/node_modules/debug/dist/debug.js +886 -0
  18. package/node_modules/debug/package.json +28 -26
  19. package/node_modules/debug/src/browser.js +77 -82
  20. package/node_modules/debug/src/common.js +249 -0
  21. package/node_modules/debug/src/index.js +5 -3
  22. package/node_modules/debug/src/node.js +72 -146
  23. package/node_modules/deep-extend/package.json +1 -1
  24. package/node_modules/delegates/package.json +1 -1
  25. package/node_modules/detect-libc/package.json +1 -1
  26. package/node_modules/fs-minipass/index.js +2 -1
  27. package/node_modules/fs-minipass/package.json +13 -10
  28. package/node_modules/fs.realpath/package.json +1 -1
  29. package/node_modules/gauge/package.json +1 -1
  30. package/node_modules/glob/LICENSE +6 -0
  31. package/node_modules/glob/README.md +8 -1
  32. package/node_modules/glob/package.json +9 -6
  33. package/node_modules/has-unicode/package.json +1 -1
  34. package/node_modules/iconv-lite/package.json +1 -1
  35. package/node_modules/ignore-walk/README.md +1 -1
  36. package/node_modules/ignore-walk/index.js +9 -5
  37. package/node_modules/ignore-walk/package.json +11 -8
  38. package/node_modules/inflight/package.json +1 -1
  39. package/node_modules/inherits/inherits.js +2 -0
  40. package/node_modules/inherits/inherits_browser.js +18 -14
  41. package/node_modules/inherits/package.json +9 -11
  42. package/node_modules/ini/package.json +1 -1
  43. package/node_modules/is-fullwidth-code-point/package.json +1 -1
  44. package/node_modules/isarray/package.json +1 -1
  45. package/node_modules/minimatch/package.json +1 -1
  46. package/node_modules/minimist/package.json +1 -1
  47. package/node_modules/minipass/README.md +486 -4
  48. package/node_modules/minipass/index.js +190 -28
  49. package/node_modules/minipass/package.json +17 -14
  50. package/node_modules/minizlib/README.md +36 -27
  51. package/node_modules/minizlib/constants.js +73 -4
  52. package/node_modules/minizlib/index.js +137 -152
  53. package/node_modules/minizlib/package.json +12 -12
  54. package/node_modules/mkdirp/package.json +1 -2
  55. package/node_modules/ms/index.js +29 -19
  56. package/node_modules/ms/package.json +17 -17
  57. package/node_modules/ms/readme.md +18 -9
  58. package/node_modules/needle/README.md +1 -2
  59. package/node_modules/needle/examples/multipart-stream.js +1 -1
  60. package/node_modules/needle/lib/auth.js +1 -1
  61. package/node_modules/needle/lib/multipart.js +1 -1
  62. package/node_modules/needle/lib/needle.js +4 -2
  63. package/node_modules/needle/package.json +13 -13
  64. package/node_modules/needle/test/basic_auth_spec.js +1 -1
  65. package/node_modules/needle/test/cookies_spec.js +2 -2
  66. package/node_modules/needle/test/headers_spec.js +1 -1
  67. package/node_modules/needle/test/output_spec.js +1 -1
  68. package/node_modules/needle/test/post_data_spec.js +20 -20
  69. package/node_modules/needle/test/proxy_spec.js +1 -1
  70. package/node_modules/needle/test/utils/test.js +1 -1
  71. package/node_modules/node-pre-gyp/CHANGELOG.md +10 -0
  72. package/node_modules/node-pre-gyp/README.md +41 -6
  73. package/node_modules/node-pre-gyp/lib/build.js +1 -1
  74. package/node_modules/node-pre-gyp/lib/install.js +20 -8
  75. package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
  76. package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
  77. package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
  78. package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
  79. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +48 -0
  80. package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
  81. package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
  82. package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
  83. package/node_modules/node-pre-gyp/package.json +11 -11
  84. package/node_modules/nopt/package.json +1 -1
  85. package/node_modules/npm-bundled/index.js +26 -6
  86. package/node_modules/npm-bundled/package.json +9 -6
  87. package/node_modules/npm-normalize-package-bin/.github/settings.yml +2 -0
  88. package/node_modules/npm-normalize-package-bin/.npmignore +24 -0
  89. package/node_modules/npm-normalize-package-bin/LICENSE +15 -0
  90. package/node_modules/npm-normalize-package-bin/README.md +14 -0
  91. package/node_modules/npm-normalize-package-bin/index.js +60 -0
  92. package/node_modules/npm-normalize-package-bin/package-lock.json +3529 -0
  93. package/node_modules/npm-normalize-package-bin/package.json +57 -0
  94. package/node_modules/npm-normalize-package-bin/test/array.js +37 -0
  95. package/node_modules/npm-normalize-package-bin/test/nobin.js +35 -0
  96. package/node_modules/npm-normalize-package-bin/test/object.js +141 -0
  97. package/node_modules/npm-normalize-package-bin/test/string.js +37 -0
  98. package/node_modules/npm-packlist/index.js +76 -16
  99. package/node_modules/npm-packlist/package.json +16 -9
  100. package/node_modules/npmlog/package.json +1 -1
  101. package/node_modules/number-is-nan/package.json +1 -1
  102. package/node_modules/object-assign/package.json +1 -1
  103. package/node_modules/once/package.json +1 -1
  104. package/node_modules/os-homedir/package.json +1 -1
  105. package/node_modules/os-tmpdir/package.json +1 -1
  106. package/node_modules/osenv/package.json +1 -1
  107. package/node_modules/path-is-absolute/package.json +1 -1
  108. package/node_modules/process-nextick-args/index.js +2 -1
  109. package/node_modules/process-nextick-args/package.json +6 -6
  110. package/node_modules/rc/node_modules/minimist/package.json +1 -1
  111. package/node_modules/rc/package.json +1 -1
  112. package/node_modules/readable-stream/package.json +1 -1
  113. package/node_modules/rimraf/package.json +6 -6
  114. package/node_modules/rimraf/rimraf.js +9 -1
  115. package/node_modules/safe-buffer/package.json +1 -1
  116. package/node_modules/safer-buffer/package.json +1 -1
  117. package/node_modules/sax/package.json +1 -1
  118. package/node_modules/semver/CHANGELOG.md +39 -0
  119. package/node_modules/semver/README.md +26 -13
  120. package/node_modules/semver/bin/semver +84 -77
  121. package/node_modules/semver/package.json +14 -8
  122. package/node_modules/semver/semver.js +906 -775
  123. package/node_modules/set-blocking/package.json +1 -1
  124. package/node_modules/signal-exit/package.json +1 -1
  125. package/node_modules/string-width/package.json +1 -1
  126. package/node_modules/string_decoder/package.json +1 -1
  127. package/node_modules/strip-ansi/package.json +1 -1
  128. package/node_modules/strip-json-comments/package.json +1 -1
  129. package/node_modules/tar/lib/large-numbers.js +32 -27
  130. package/node_modules/tar/lib/mkdir.js +2 -2
  131. package/node_modules/tar/lib/parse.js +6 -1
  132. package/node_modules/tar/lib/read-entry.js +4 -0
  133. package/node_modules/tar/lib/write-entry.js +2 -2
  134. package/node_modules/tar/package.json +17 -13
  135. package/node_modules/util-deprecate/package.json +1 -1
  136. package/node_modules/wide-align/package.json +1 -1
  137. package/node_modules/wrappy/package.json +1 -1
  138. package/node_modules/yallist/package.json +11 -11
  139. package/node_modules/yallist/yallist.js +50 -0
  140. package/package.json +5 -8
  141. package/src/constants.cc +20 -20
  142. package/node_modules/debug/.coveralls.yml +0 -1
  143. package/node_modules/debug/.eslintrc +0 -11
  144. package/node_modules/debug/.npmignore +0 -9
  145. package/node_modules/debug/.travis.yml +0 -14
  146. package/node_modules/debug/Makefile +0 -50
  147. package/node_modules/debug/component.json +0 -19
  148. package/node_modules/debug/karma.conf.js +0 -70
  149. package/node_modules/debug/src/debug.js +0 -202
  150. package/node_modules/debug/src/inspector-log.js +0 -15
  151. package/node_modules/needle/note.xml +0 -7
  152. package/node_modules/needle/note.xml.1 +0 -7
@@ -78,8 +78,7 @@ needle('get', 'https://server.com/posts/12')
78
78
  })
79
79
  .catch(function(err) {
80
80
  // ...
81
- })
82
- });
81
+ });
83
82
 
84
83
  // with callback
85
84
  needle.get('ifconfig.me/all.json', function(error, response, body) {
@@ -2,7 +2,7 @@ var needle = require('./../');
2
2
 
3
3
  var url = 'http://posttestserver.com/post.php?dir=needle';
4
4
 
5
- var black_pixel = new Buffer("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64');
5
+ var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64');
6
6
 
7
7
  var data = {
8
8
  foo: 'bar',
@@ -21,7 +21,7 @@ function md5(string) {
21
21
 
22
22
  function basic(user, pass) {
23
23
  var str = typeof pass == 'undefined' ? user : [user, pass].join(':');
24
- return 'Basic ' + new Buffer(str).toString('base64');
24
+ return 'Basic ' + Buffer.from(str).toString('base64');
25
25
  }
26
26
 
27
27
  ////////////////////
@@ -73,7 +73,7 @@ function generate_part(name, part, boundary, callback) {
73
73
  }
74
74
 
75
75
  return_part += '\r\n\r\n';
76
- return_part += new Buffer(String(part.value), 'utf8').toString('binary');
76
+ return_part += Buffer.from(String(part.value), 'utf8').toString('binary');
77
77
  append();
78
78
 
79
79
  }
@@ -347,7 +347,7 @@ Needle.prototype.start = function() {
347
347
  : json ? JSON.stringify(data) : stringify(data);
348
348
 
349
349
  // ensure we have a buffer so bytecount is correct.
350
- body = new Buffer(body, config.encoding);
350
+ body = Buffer.from(body, config.encoding);
351
351
  }
352
352
 
353
353
  }
@@ -641,7 +641,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
641
641
  var chunk;
642
642
  while ((chunk = this.read()) !== null) {
643
643
  // We're either pushing buffers or objects, never strings.
644
- if (typeof chunk == 'string') chunk = new Buffer(chunk);
644
+ if (typeof chunk == 'string') chunk = Buffer.from(chunk);
645
645
 
646
646
  // Push all chunks to resp.body. We'll bind them in resp.end().
647
647
  resp.body.push(chunk);
@@ -772,6 +772,8 @@ module.exports.defaults = function(obj) {
772
772
  throw new TypeError('Invalid type for ' + key + ', should be ' + valid_type);
773
773
  }
774
774
  defaults[target_key] = obj[key];
775
+ } else {
776
+ throw new Error('Invalid property for defaults:' + target_key);
775
777
  }
776
778
  }
777
779
 
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "needle@^2.2.1",
3
- "_id": "needle@2.2.4",
3
+ "_id": "needle@2.4.0",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==",
5
+ "_integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==",
6
6
  "_location": "/needle",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -18,10 +18,10 @@
18
18
  "_requiredBy": [
19
19
  "/node-pre-gyp"
20
20
  ],
21
- "_resolved": "https://registry.npmjs.org/needle/-/needle-2.2.4.tgz",
22
- "_shasum": "51931bff82533b1928b7d1d69e01f1b00ffd2a4e",
21
+ "_resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz",
22
+ "_shasum": "6833e74975c444642590e15a750288c5f939b57c",
23
23
  "_spec": "needle@^2.2.1",
24
- "_where": "/Users/pdunkel1/Office/fsevents/fsevents/node_modules/node-pre-gyp",
24
+ "_where": "/Users/pipobscure/fsevents/node_modules/node-pre-gyp",
25
25
  "author": {
26
26
  "name": "Tomás Pollak",
27
27
  "email": "tomas@forkhq.com"
@@ -34,26 +34,26 @@
34
34
  },
35
35
  "bundleDependencies": false,
36
36
  "dependencies": {
37
- "debug": "^2.1.2",
37
+ "debug": "^3.2.6",
38
38
  "iconv-lite": "^0.4.4",
39
39
  "sax": "^1.2.4"
40
40
  },
41
41
  "deprecated": false,
42
42
  "description": "The leanest and most handsome HTTP client in the Nodelands.",
43
43
  "devDependencies": {
44
- "JSONStream": "",
45
- "jschardet": "",
46
- "mocha": "",
47
- "q": "",
44
+ "JSONStream": "^1.3.5",
45
+ "jschardet": "^1.6.0",
46
+ "mocha": "^5.2.0",
47
+ "q": "^1.5.1",
48
48
  "should": "^13.2.3",
49
49
  "sinon": "^2.3.0",
50
- "xml2js": ""
50
+ "xml2js": "^0.4.19"
51
51
  },
52
52
  "directories": {
53
53
  "lib": "./lib"
54
54
  },
55
55
  "engines": {
56
- "node": ">= 0.10.x"
56
+ "node": ">= 4.4.x"
57
57
  },
58
58
  "homepage": "https://github.com/tomas/needle#readme",
59
59
  "keywords": [
@@ -98,5 +98,5 @@
98
98
  "cookie",
99
99
  "redirect"
100
100
  ],
101
- "version": "2.2.4"
101
+ "version": "2.4.0"
102
102
  }
@@ -19,7 +19,7 @@ describe('Basic Auth', function() {
19
19
 
20
20
  var get_auth = function(header) {
21
21
  var token = header.split(/\s+/).pop();
22
- return token && new Buffer(token, 'base64').toString().split(':');
22
+ return token && Buffer.from(token, 'base64').toString().split(':');
23
23
  }
24
24
 
25
25
  describe('when neither username or password are passed', function() {
@@ -129,7 +129,7 @@ describe('cookies', function() {
129
129
  needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) {
130
130
  should.not.exist(error)
131
131
  var whatever = 'efbfbdefbfbdefbfbdefbfbdefbfbd2defbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbd';
132
- new Buffer(response.cookies.geo_city).toString('hex').should.eql(whatever)
132
+ Buffer.from(response.cookies.geo_city).toString('hex').should.eql(whatever)
133
133
  done();
134
134
  });
135
135
  })
@@ -302,4 +302,4 @@ describe('cookies', function() {
302
302
  });
303
303
  });
304
304
  });
305
- });
305
+ });
@@ -2,7 +2,7 @@ var http = require('http'),
2
2
  helpers = require('./helpers'),
3
3
  should = require('should');
4
4
 
5
- var port = 5432;
5
+ var port = 54321;
6
6
 
7
7
  describe('request headers', function() {
8
8
 
@@ -180,7 +180,7 @@ describe('with output option', function() {
180
180
 
181
181
  describe('for a binary file', function() {
182
182
 
183
- var pixel = new Buffer("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64");
183
+ var pixel = Buffer.from("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64");
184
184
 
185
185
  before(function() {
186
186
  handler = function(req, res) {
@@ -10,7 +10,7 @@ multiparts.push(['Content-Disposition: form-data; name=\"foo\"'])
10
10
  multiparts.push(['\r\nbar\r\n----------------------NODENEEDLEHTTPCLIENT--'])
11
11
  // multiparts.push(['Content-Disposition: form-data; name=\"test\"'])
12
12
  // multiparts.push(['\r\næµè¯\r\n----------------------NODENEEDLEHTTPCLIENT--'])
13
- // multiparts.push(['\r\n' + new Buffer('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--'])
13
+ // multiparts.push(['\r\n' + Buffer.from('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--'])
14
14
 
15
15
 
16
16
  describe('post data (e.g. request body)', function() {
@@ -150,7 +150,7 @@ describe('post data (e.g. request body)', function() {
150
150
  spy.called.should.be.true;
151
151
 
152
152
  spy.args[0][0].should.be.an.instanceof(String);
153
- new Buffer(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
153
+ Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
154
154
  done();
155
155
  })
156
156
  })
@@ -187,7 +187,7 @@ describe('post data (e.g. request body)', function() {
187
187
  post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
188
188
  spy.called.should.be.true;
189
189
  spy.args[0][0].should.be.an.instanceof(String);
190
- new Buffer(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
190
+ Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
191
191
  done();
192
192
  })
193
193
  })
@@ -761,14 +761,14 @@ describe('post data (e.g. request body)', function() {
761
761
  it('sends request', function(done) {
762
762
  spystub_request();
763
763
 
764
- get(new Buffer('foobar'), { json: false }, function(err, resp) {
764
+ get(Buffer.from('foobar'), { json: false }, function(err, resp) {
765
765
  check_request('get');
766
766
  done();
767
767
  })
768
768
  })
769
769
 
770
770
  it('sets Content-Type header', function(done) {
771
- get(new Buffer('foobar'), { json: false }, function(err, resp) {
771
+ get(Buffer.from('foobar'), { json: false }, function(err, resp) {
772
772
  // should.not.exist(resp.body.headers['content-type']);
773
773
  resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
774
774
 
@@ -777,7 +777,7 @@ describe('post data (e.g. request body)', function() {
777
777
  })
778
778
 
779
779
  it('doesnt change default Accept header', function(done) {
780
- get(new Buffer('foobar'), { json: false }, function(err, resp) {
780
+ get(Buffer.from('foobar'), { json: false }, function(err, resp) {
781
781
  // resp.body contains 'header' and 'body', mirroring what we sent
782
782
  resp.body.headers['accept'].should.equal('*/*');
783
783
  done();
@@ -785,7 +785,7 @@ describe('post data (e.g. request body)', function() {
785
785
  })
786
786
 
787
787
  it('writes as buffer', function(done) {
788
- get(new Buffer('foobar'), { json: false }, function(err, resp) {
788
+ get(Buffer.from('foobar'), { json: false }, function(err, resp) {
789
789
  spy.called.should.be.true;
790
790
  spy.args[0][0].should.be.an.instanceof(Buffer);
791
791
  spy.args[0][0].toString().should.equal('foobar');
@@ -801,28 +801,28 @@ describe('post data (e.g. request body)', function() {
801
801
  it('sends request, without setting a querystring', function(done) {
802
802
  spystub_request();
803
803
 
804
- get(new Buffer('foobar'), { json: true }, function(err, resp) {
804
+ get(Buffer.from('foobar'), { json: true }, function(err, resp) {
805
805
  check_request('get');
806
806
  done();
807
807
  })
808
808
  })
809
809
 
810
810
  it('sets Content-Type header', function(done) {
811
- get(new Buffer('foobar'), { json: true }, function(err, resp) {
811
+ get(Buffer.from('foobar'), { json: true }, function(err, resp) {
812
812
  resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
813
813
  done();
814
814
  })
815
815
  })
816
816
 
817
817
  it('set Accept header to application/json', function(done) {
818
- get(new Buffer('foobar'), { json: true }, function(err, resp) {
818
+ get(Buffer.from('foobar'), { json: true }, function(err, resp) {
819
819
  resp.body.headers['accept'].should.equal('application/json');
820
820
  done();
821
821
  })
822
822
  })
823
823
 
824
824
  it('writes JSON.stringify version of object', function(done) {
825
- get(new Buffer('foobar'), { json: true }, function(err, resp) {
825
+ get(Buffer.from('foobar'), { json: true }, function(err, resp) {
826
826
  spy.called.should.be.true;
827
827
  spy.args[0][0].toString().should.eql('foobar')
828
828
  resp.body.body.should.eql('foobar');
@@ -841,21 +841,21 @@ describe('post data (e.g. request body)', function() {
841
841
  it('sends request', function(done) {
842
842
  spystub_request();
843
843
 
844
- post(new Buffer('foobar'), { json: false }, function(err, resp) {
844
+ post(Buffer.from('foobar'), { json: false }, function(err, resp) {
845
845
  check_request('post');
846
846
  done();
847
847
  })
848
848
  })
849
849
 
850
850
  it('sets Content-Type header to www-form-urlencoded', function(done) {
851
- post(new Buffer('foobar'), { json: false }, function(err, resp) {
851
+ post(Buffer.from('foobar'), { json: false }, function(err, resp) {
852
852
  resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
853
853
  done();
854
854
  })
855
855
  })
856
856
 
857
857
  it('doesnt change default Accept header', function(done) {
858
- post(new Buffer('foobar'), { json: false }, function(err, resp) {
858
+ post(Buffer.from('foobar'), { json: false }, function(err, resp) {
859
859
  // resp.body contains 'header' and 'body', mirroring what we sent
860
860
  resp.body.headers['accept'].should.equal('*/*');
861
861
  done();
@@ -863,7 +863,7 @@ describe('post data (e.g. request body)', function() {
863
863
  })
864
864
 
865
865
  it('writes as buffer', function(done) {
866
- post(new Buffer('foobar'), { json: false }, function(err, resp) {
866
+ post(Buffer.from('foobar'), { json: false }, function(err, resp) {
867
867
  spy.called.should.be.true;
868
868
  spy.args[0][0].should.be.an.instanceof(Buffer);
869
869
  spy.args[0][0].toString().should.equal('foobar');
@@ -879,28 +879,28 @@ describe('post data (e.g. request body)', function() {
879
879
  it('sends request', function(done) {
880
880
  spystub_request();
881
881
 
882
- post(new Buffer('foobar'), { json: true }, function(err, resp) {
882
+ post(Buffer.from('foobar'), { json: true }, function(err, resp) {
883
883
  check_request('post');
884
884
  done();
885
885
  })
886
886
  })
887
887
 
888
888
  it('sets Content-Type header', function(done) {
889
- post(new Buffer('foobar'), { json: true }, function(err, resp) {
889
+ post(Buffer.from('foobar'), { json: true }, function(err, resp) {
890
890
  resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
891
891
  done();
892
892
  })
893
893
  })
894
894
 
895
895
  it('set Accept header to application/json', function(done) {
896
- post(new Buffer('foobar'), { json: true }, function(err, resp) {
896
+ post(Buffer.from('foobar'), { json: true }, function(err, resp) {
897
897
  resp.body.headers['accept'].should.equal('application/json');
898
898
  done();
899
899
  })
900
900
  })
901
901
 
902
902
  it('passes raw buffer (assuming its a JSON string beneath)', function(done) {
903
- post(new Buffer('foobar'), { json: true }, function(err, resp) {
903
+ post(Buffer.from('foobar'), { json: true }, function(err, resp) {
904
904
  spy.called.should.be.true;
905
905
  spy.args[0][0].toString().should.eql('foobar')
906
906
  resp.body.body.should.eql('foobar');
@@ -1018,4 +1018,4 @@ describe('post data (e.g. request body)', function() {
1018
1018
 
1019
1019
  })
1020
1020
 
1021
- })
1021
+ })
@@ -51,7 +51,7 @@ describe('proxy option', function() {
51
51
 
52
52
  function get_auth(header) {
53
53
  var token = header.split(/\s+/).pop();
54
- return token && new Buffer(token, 'base64').toString().split(':');
54
+ return token && Buffer.from(token, 'base64').toString().split(':');
55
55
  }
56
56
 
57
57
  function no_proxy_auth(done) {
@@ -46,7 +46,7 @@ function multipart_post(url){
46
46
  var data = 'Plain text data.\nLorem ipsum dolor sit amet.\nBla bla bla.\n';
47
47
  fs.writeFileSync(filename, data);
48
48
 
49
- var black_pixel = new Buffer("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64");
49
+ var black_pixel = Buffer.from("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64");
50
50
 
51
51
  var data = {
52
52
  foo: 'bar',
@@ -1,5 +1,15 @@
1
1
  # node-pre-gyp changelog
2
2
 
3
+ ## 0.12.0
4
+
5
+ - Fixed double-build problem with node v10 (https://github.com/mapbox/node-pre-gyp/pull/428)
6
+ - Added node 11 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/422)
7
+
8
+ ## 0.11.0
9
+
10
+ - Fixed double-install problem with node v10
11
+ - Significant N-API improvements (https://github.com/mapbox/node-pre-gyp/pull/405)
12
+
3
13
  ## 0.10.3
4
14
 
5
15
  - 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
@@ -125,7 +125,7 @@ Let's break this down:
125
125
  - Your `scripts` section should override the `install` target with `"install": "node-pre-gyp install --fallback-to-build"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly.
126
126
  - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below.
127
127
 
128
- NOte: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.
128
+ Note: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.
129
129
 
130
130
  ##### The `binary` object has three required properties
131
131
 
@@ -316,23 +316,25 @@ This value is of importance in two areas:
316
316
  1. The C/C++ code which needs to know against which N-API version it should compile.
317
317
  2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions.
318
318
 
319
- ### Defining `NAPI_BUILD_VERSION` for the C/C++ code
319
+ ### Defining `NAPI_VERSION` for the C/C++ code
320
320
 
321
321
  The `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file:
322
322
 
323
323
  ```
324
324
  "defines": [
325
- "NAPI_BUILD_VERSION=<(napi_build_version)",
325
+ "NAPI_VERSION=<(napi_build_version)",
326
326
  ]
327
327
  ```
328
328
 
329
- This ensures that `NAPI_BUILD_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.
329
+ This ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.
330
+
331
+ > Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested.
330
332
 
331
333
  ### Path and file naming requirements in `package.json`
332
334
 
333
335
  Since `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements.
334
336
 
335
- Specifically, when performing N-API builds, the `{napi_build_version}` text substitution string *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text substitution string *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)
337
+ Specifically, when performing N-API builds, the `{napi_build_version}` text configuration value *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)
336
338
 
337
339
  Here's an example:
338
340
 
@@ -347,9 +349,42 @@ Here's an example:
347
349
  }
348
350
  ```
349
351
 
352
+ ## Supporting both N-API and NAN builds
353
+
354
+ You may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property.
355
+
356
+ Placing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build.
357
+
358
+ The configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`.
359
+
360
+ Here's how the `binary` configuration above might be changed to support both N-API and NAN builds:
361
+
362
+ ```js
363
+ "binary": {
364
+ "module_name": "your_module",
365
+ "module_path": "./lib/binding/{node_napi_label}",
366
+ "remote_path": "./{module_name}/v{version}/{configuration}/",
367
+ "package_name": "{platform}-{arch}-{node_napi_label}.tar.gz",
368
+ "host": "https://your_bucket.s3-us-west-1.amazonaws.com",
369
+ "napi_versions": [1,3]
370
+ }
371
+ ```
372
+
373
+ The C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds.
374
+
375
+ For example:
376
+
377
+ ```C
378
+ #if NAPI_VERSION
379
+ // N-API code goes here
380
+ #else
381
+ // NAN code goes here
382
+ #endif
383
+ ```
384
+
350
385
  ### Two additional configuration values
351
386
 
352
- For those who need them in legacy projects, two additional configuration values are available for all builds.
387
+ The following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above.
353
388
 
354
389
  1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string.
355
390
 
@@ -21,7 +21,7 @@ function do_build(gyp,argv,callback) {
21
21
  napi.swap_build_dir_in(result.opts.napi_build_version);
22
22
  }
23
23
  compile.run_gyp(final_args,result.opts,function(err) {
24
- if (!err && result.opts.napi_build_version) {
24
+ if (result.opts.napi_build_version) {
25
25
  napi.swap_build_dir_out(result.opts.napi_build_version);
26
26
  }
27
27
  return callback(err);
@@ -92,6 +92,7 @@ function place_binary(from,to,opts,callback) {
92
92
  if (!req) return callback(new Error("empty req"));
93
93
  var badDownload = false;
94
94
  var extractCount = 0;
95
+ var hasResponse = false;
95
96
  var tar = require('tar');
96
97
 
97
98
  function afterTarball(err) {
@@ -112,27 +113,38 @@ function place_binary(from,to,opts,callback) {
112
113
  // for request compatibility
113
114
  req.on('error', function(err) {
114
115
  badDownload = true;
115
- return callback(err);
116
+ if (!hasResponse) {
117
+ hasResponse = true;
118
+ return callback(err);
119
+ }
116
120
  });
117
121
 
118
122
  // for needle compatibility
119
123
  req.on('err', function(err) {
120
124
  badDownload = true;
121
- return callback(err);
125
+ if (!hasResponse) {
126
+ hasResponse = true;
127
+ return callback(err);
128
+ }
122
129
  });
123
130
 
124
131
  req.on('close', function () {
125
- if (extractCount === 0) {
132
+ if (!hasResponse) {
133
+ hasResponse = true;
126
134
  return callback(new Error('Connection closed while downloading tarball file'));
127
135
  }
128
136
  });
129
137
 
130
138
  req.on('response', function(res) {
131
- // ignore redirects, needle handles these automatically.
132
- if (http_get.type === 'needle' && res.headers.hasOwnProperty('location') && res.headers.location !== '') {
133
- return;
134
- }
135
- if (res.statusCode !== 200) {
139
+ // ignore redirects, needle handles these automatically.
140
+ if (http_get.type === 'needle' && res.headers.hasOwnProperty('location') && res.headers.location !== '') {
141
+ return;
142
+ }
143
+ if (hasResponse) {
144
+ return;
145
+ }
146
+ hasResponse = true;
147
+ if (res.statusCode !== 200) {
136
148
  badDownload = true;
137
149
  var err = new Error(res.statusCode + ' status code downloading tarball ' + from);
138
150
  err.statusCode = res.statusCode;
@@ -135,7 +135,7 @@ proto.parseArgv = function parseOpts (argv) {
135
135
  if (dir == null) dir = process.cwd();
136
136
  var package_json = JSON.parse(fs.readFileSync(path.join(dir,'package.json')));
137
137
 
138
- this.todo = napi.expand_commands (package_json, commands);
138
+ this.todo = napi.expand_commands (package_json, this.opts, commands);
139
139
 
140
140
  // support for inheriting config env variables from npm
141
141
  var npm_config_prefix = 'npm_config_';
@@ -9,8 +9,8 @@ module.exports = exports;
9
9
 
10
10
  exports.usage = 'Finds the require path for the node-pre-gyp installed module';
11
11
 
12
- exports.validate = function(package_json) {
13
- versioning.validate_config(package_json);
12
+ exports.validate = function(package_json,opts) {
13
+ versioning.validate_config(package_json,opts);
14
14
  };
15
15
 
16
16
  exports.find = function(package_json_path,opts) {
@@ -18,10 +18,10 @@ exports.find = function(package_json_path,opts) {
18
18
  throw new Error("package.json does not exist at " + package_json_path);
19
19
  }
20
20
  var package_json = require(package_json_path);
21
- versioning.validate_config(package_json);
21
+ versioning.validate_config(package_json,opts);
22
22
  var napi_build_version;
23
- if (napi.get_napi_build_versions (package_json)) {
24
- napi_build_version = napi.get_best_napi_build_version(package_json);
23
+ if (napi.get_napi_build_versions (package_json, opts)) {
24
+ napi_build_version = napi.get_best_napi_build_version(package_json, opts);
25
25
  }
26
26
  opts = opts || {};
27
27
  if (!opts.module_root) opts.module_root = path.dirname(package_json_path);
@@ -13,7 +13,7 @@ function rebuild (gyp, argv, callback) {
13
13
  { name: 'clean', args: [] },
14
14
  { name: 'build', args: ['rebuild'] }
15
15
  ];
16
- commands = napi.expand_commands(package_json, commands);
16
+ commands = napi.expand_commands(package_json, gyp.opts, commands);
17
17
  for (var i = commands.length; i !== 0; i--) {
18
18
  gyp.todo.unshift(commands[i-1]);
19
19
  }
@@ -10,7 +10,7 @@ var napi = require('./util/napi.js');
10
10
  function rebuild (gyp, argv, callback) {
11
11
  var package_json = JSON.parse(fs.readFileSync('./package.json'));
12
12
  var installArgs = [];
13
- var napi_build_version = napi.get_best_napi_build_version(package_json);
13
+ var napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts);
14
14
  if (napi_build_version != null) installArgs = [ napi.get_command_arg (napi_build_version) ];
15
15
  gyp.todo.unshift(
16
16
  { name: 'clean', args: [] },