fsevents 1.2.7 → 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 (122) hide show
  1. package/.travis.yml +0 -2
  2. package/node_modules/abbrev/package.json +2 -3
  3. package/node_modules/ansi-regex/package.json +1 -1
  4. package/node_modules/aproba/package.json +1 -1
  5. package/node_modules/are-we-there-yet/package.json +1 -1
  6. package/node_modules/balanced-match/package.json +1 -1
  7. package/node_modules/brace-expansion/package.json +1 -1
  8. package/node_modules/chownr/package.json +1 -1
  9. package/node_modules/code-point-at/package.json +1 -1
  10. package/node_modules/concat-map/package.json +1 -1
  11. package/node_modules/console-control-strings/package.json +1 -1
  12. package/node_modules/core-util-is/package.json +1 -1
  13. package/node_modules/debug/CHANGELOG.md +34 -1
  14. package/node_modules/debug/README.md +206 -63
  15. package/node_modules/debug/dist/debug.js +912 -0
  16. package/node_modules/debug/package.json +40 -26
  17. package/node_modules/debug/src/browser.js +185 -106
  18. package/node_modules/debug/src/common.js +266 -0
  19. package/node_modules/debug/src/index.js +4 -4
  20. package/node_modules/debug/src/node.js +174 -165
  21. package/node_modules/deep-extend/package.json +1 -1
  22. package/node_modules/delegates/package.json +1 -1
  23. package/node_modules/detect-libc/package.json +1 -1
  24. package/node_modules/fs-minipass/package.json +1 -1
  25. package/node_modules/fs.realpath/package.json +1 -1
  26. package/node_modules/gauge/package.json +1 -1
  27. package/node_modules/glob/package.json +1 -1
  28. package/node_modules/has-unicode/package.json +1 -1
  29. package/node_modules/iconv-lite/package.json +1 -1
  30. package/node_modules/ignore-walk/package.json +1 -1
  31. package/node_modules/inflight/package.json +1 -1
  32. package/node_modules/inherits/package.json +2 -4
  33. package/node_modules/ini/package.json +1 -1
  34. package/node_modules/is-fullwidth-code-point/package.json +1 -1
  35. package/node_modules/isarray/package.json +1 -1
  36. package/node_modules/minimatch/package.json +1 -1
  37. package/node_modules/minimist/package.json +1 -1
  38. package/node_modules/minipass/package.json +1 -1
  39. package/node_modules/minizlib/package.json +1 -1
  40. package/node_modules/mkdirp/package.json +1 -2
  41. package/node_modules/ms/index.js +28 -18
  42. package/node_modules/ms/package.json +17 -17
  43. package/node_modules/ms/readme.md +17 -8
  44. package/node_modules/needle/.npmignore +6 -0
  45. package/node_modules/needle/README.md +1 -2
  46. package/node_modules/needle/examples/multipart-stream.js +1 -1
  47. package/node_modules/needle/lib/auth.js +1 -1
  48. package/node_modules/needle/lib/multipart.js +1 -1
  49. package/node_modules/needle/lib/needle.js +2 -2
  50. package/node_modules/needle/package-lock.json +395 -0
  51. package/node_modules/needle/package.json +13 -13
  52. package/node_modules/needle/test/basic_auth_spec.js +1 -1
  53. package/node_modules/needle/test/cookies_spec.js +2 -2
  54. package/node_modules/needle/test/keys/ssl.cert +21 -0
  55. package/node_modules/needle/test/keys/ssl.key +27 -0
  56. package/node_modules/needle/test/output_spec.js +1 -1
  57. package/node_modules/needle/test/post_data_spec.js +20 -20
  58. package/node_modules/needle/test/proxy_spec.js +1 -1
  59. package/node_modules/needle/test/utils/test.js +1 -1
  60. package/node_modules/node-pre-gyp/CHANGELOG.md +10 -0
  61. package/node_modules/node-pre-gyp/README.md +41 -6
  62. package/node_modules/node-pre-gyp/lib/build.js +1 -1
  63. package/node_modules/node-pre-gyp/lib/install.js +20 -8
  64. package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
  65. package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
  66. package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
  67. package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
  68. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +48 -0
  69. package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
  70. package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
  71. package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
  72. package/node_modules/node-pre-gyp/package.json +13 -12
  73. package/node_modules/nopt/package.json +1 -1
  74. package/node_modules/npm-bundled/index.js +13 -1
  75. package/node_modules/npm-bundled/package.json +6 -6
  76. package/node_modules/npm-packlist/index.js +29 -8
  77. package/node_modules/npm-packlist/package.json +6 -6
  78. package/node_modules/npmlog/package.json +1 -1
  79. package/node_modules/number-is-nan/package.json +1 -1
  80. package/node_modules/object-assign/package.json +1 -1
  81. package/node_modules/once/package.json +1 -1
  82. package/node_modules/os-homedir/package.json +1 -1
  83. package/node_modules/os-tmpdir/package.json +1 -1
  84. package/node_modules/osenv/package.json +1 -1
  85. package/node_modules/path-is-absolute/package.json +1 -1
  86. package/node_modules/process-nextick-args/package.json +1 -1
  87. package/node_modules/rc/node_modules/minimist/package.json +1 -1
  88. package/node_modules/rc/package.json +1 -1
  89. package/node_modules/readable-stream/package.json +1 -1
  90. package/node_modules/rimraf/package.json +1 -1
  91. package/node_modules/safe-buffer/package.json +1 -1
  92. package/node_modules/safer-buffer/package.json +1 -1
  93. package/node_modules/sax/package.json +1 -1
  94. package/node_modules/semver/CHANGELOG.md +39 -0
  95. package/node_modules/semver/README.md +14 -2
  96. package/node_modules/semver/bin/semver +84 -77
  97. package/node_modules/semver/package.json +14 -8
  98. package/node_modules/semver/semver.js +906 -775
  99. package/node_modules/set-blocking/package.json +1 -1
  100. package/node_modules/signal-exit/package.json +1 -1
  101. package/node_modules/string-width/package.json +1 -1
  102. package/node_modules/string_decoder/package.json +1 -1
  103. package/node_modules/strip-ansi/package.json +1 -1
  104. package/node_modules/strip-json-comments/package.json +1 -1
  105. package/node_modules/tar/package.json +1 -1
  106. package/node_modules/util-deprecate/package.json +1 -1
  107. package/node_modules/wide-align/package.json +1 -1
  108. package/node_modules/wrappy/package.json +1 -1
  109. package/node_modules/yallist/package.json +1 -1
  110. package/package.json +5 -8
  111. package/node_modules/debug/.coveralls.yml +0 -1
  112. package/node_modules/debug/.eslintrc +0 -11
  113. package/node_modules/debug/.npmignore +0 -9
  114. package/node_modules/debug/.travis.yml +0 -14
  115. package/node_modules/debug/Makefile +0 -50
  116. package/node_modules/debug/component.json +0 -19
  117. package/node_modules/debug/karma.conf.js +0 -70
  118. package/node_modules/debug/node.js +0 -1
  119. package/node_modules/debug/src/debug.js +0 -202
  120. package/node_modules/debug/src/inspector-log.js +0 -15
  121. package/node_modules/needle/note.xml +0 -7
  122. package/node_modules/needle/note.xml.1 +0 -7
@@ -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: [] },
@@ -1503,6 +1503,10 @@
1503
1503
  "node_abi": 48,
1504
1504
  "v8": "5.1"
1505
1505
  },
1506
+ "6.14.4": {
1507
+ "node_abi": 48,
1508
+ "v8": "5.1"
1509
+ },
1506
1510
  "7.0.0": {
1507
1511
  "node_abi": 51,
1508
1512
  "v8": "5.4"
@@ -1671,6 +1675,14 @@
1671
1675
  "node_abi": 57,
1672
1676
  "v8": "6.2"
1673
1677
  },
1678
+ "8.11.4": {
1679
+ "node_abi": 57,
1680
+ "v8": "6.2"
1681
+ },
1682
+ "8.12.0": {
1683
+ "node_abi": 57,
1684
+ "v8": "6.2"
1685
+ },
1674
1686
  "9.0.0": {
1675
1687
  "node_abi": 59,
1676
1688
  "v8": "6.2"
@@ -1778,5 +1790,41 @@
1778
1790
  "10.6.0": {
1779
1791
  "node_abi": 64,
1780
1792
  "v8": "6.7"
1793
+ },
1794
+ "10.7.0": {
1795
+ "node_abi": 64,
1796
+ "v8": "6.7"
1797
+ },
1798
+ "10.8.0": {
1799
+ "node_abi": 64,
1800
+ "v8": "6.7"
1801
+ },
1802
+ "10.9.0": {
1803
+ "node_abi": 64,
1804
+ "v8": "6.8"
1805
+ },
1806
+ "10.10.0": {
1807
+ "node_abi": 64,
1808
+ "v8": "6.8"
1809
+ },
1810
+ "10.11.0": {
1811
+ "node_abi": 64,
1812
+ "v8": "6.8"
1813
+ },
1814
+ "10.12.0": {
1815
+ "node_abi": 64,
1816
+ "v8": "6.8"
1817
+ },
1818
+ "10.13.0": {
1819
+ "node_abi": 64,
1820
+ "v8": "6.8"
1821
+ },
1822
+ "11.0.0": {
1823
+ "node_abi": 67,
1824
+ "v8": "7.0"
1825
+ },
1826
+ "11.1.0": {
1827
+ "node_abi": 67,
1828
+ "v8": "7.0"
1781
1829
  }
1782
1830
  }
@@ -47,7 +47,8 @@ var share_with_node_gyp = [
47
47
  'module_path',
48
48
  'napi_version',
49
49
  'node_abi_napi',
50
- 'napi_build_version'
50
+ 'napi_build_version',
51
+ 'node_napi_label'
51
52
  ];
52
53
 
53
54
  function handle_gyp_opts(gyp, argv, callback) {
@@ -61,8 +62,10 @@ function handle_gyp_opts(gyp, argv, callback) {
61
62
  var val = opts[key];
62
63
  if (val) {
63
64
  node_pre_gyp_options.push('--' + key + '=' + val);
65
+ } else if (key === 'napi_build_version') {
66
+ node_pre_gyp_options.push('--' + key + '=0');
64
67
  } else {
65
- if (key !== 'napi_version' && key !== 'node_abi_napi' && key !== 'napi_build_version')
68
+ if (key !== 'napi_version' && key !== 'node_abi_napi')
66
69
  return callback(new Error("Option " + key + " required but not found by node-pre-gyp"));
67
70
  }
68
71
  });