[Pkg-javascript-commits] [node-module-deps] 385/444: Switch everything to through2 (and update it)

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-module-deps.

commit 6e5088c53447ae9baaccd636d8a4f9ce44f7554f
Author: Andres Suarez <zertosh at gmail.com>
Date:   Fri May 22 00:54:58 2015 -0400

    Switch everything to through2 (and update it)
---
 package.json                                                     | 5 ++---
 readme.markdown                                                  | 4 ++--
 .../node_modules/g/node_modules/insert-ggg/index.js              | 7 ++++---
 test/files/tr_2dep_module/node_modules/insert-aaa/index.js       | 7 ++++---
 test/files/tr_2dep_module/node_modules/insert-bbb/index.js       | 7 ++++---
 .../node_modules/m/node_modules/insert-mmm/index.js              | 7 ++++---
 test/files/tr_global/node_modules/tr-a/index.js                  | 7 ++++---
 test/files/tr_global/node_modules/tr-b/index.js                  | 7 ++++---
 test/files/tr_global/node_modules/tr-c/index.js                  | 7 ++++---
 test/files/tr_global/node_modules/tr-d/index.js                  | 7 ++++---
 test/files/tr_global/node_modules/tr-e/index.js                  | 7 ++++---
 test/files/tr_global/node_modules/tr-f/index.js                  | 7 ++++---
 test/files/tr_module/index.js                                    | 7 ++++---
 .../tr_module/node_modules/g/node_modules/insert-ggg/index.js    | 7 ++++---
 test/files/tr_module/node_modules/g/x.js                         | 7 ++++---
 test/files/tr_module/node_modules/insert-aaa/index.js            | 7 ++++---
 test/files/tr_module/node_modules/insert-bbb/index.js            | 7 ++++---
 test/files/tr_module/xxx.js                                      | 7 ++++---
 test/files/tr_rel/xxx.js                                         | 7 ++++---
 test/files/tr_sh/node_modules/g/tr_g.js                          | 7 ++++---
 test/files/tr_sh/tr_a.js                                         | 7 ++++---
 test/files/tr_sh/tr_b.js                                         | 7 ++++---
 .../node_modules/algo/node_modules/insert-ggg/index.js           | 7 ++++---
 test/row_expose.js                                               | 4 ++--
 test/tr_err.js                                                   | 2 +-
 test/tr_fn.js                                                    | 7 ++++---
 test/tr_no_entry.js                                              | 7 ++++---
 test/tr_opts/node_modules/fff/index.js                           | 9 +++++----
 test/tr_opts/node_modules/ggg/index.js                           | 9 +++++----
 29 files changed, 109 insertions(+), 85 deletions(-)

diff --git a/package.json b/package.json
index 7b09eae..3b063a2 100644
--- a/package.json
+++ b/package.json
@@ -15,15 +15,14 @@
     "duplexer2": "0.0.2",
     "inherits": "^2.0.1",
     "parents": "^1.0.0",
-    "readable-stream": "^1.0.27-1",
+    "readable-stream": "^1.1.13",
     "resolve": "^1.1.3",
     "stream-combiner2": "~1.0.0",
     "subarg": "^1.0.0",
-    "through2": "~0.4.1",
+    "through2": "^1.0.0",
     "xtend": "^4.0.0"
   },
   "devDependencies": {
-    "through": "~2.3.4",
     "tape": "~2.12.3",
     "browser-pack": "^4.0.3"
   },
diff --git a/readme.markdown b/readme.markdown
index 7cd280e..f82743e 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -146,12 +146,12 @@ If the transform is a string, it is treated as a module name that will resolve
 to a module that is expected to follow this format:
 
 ``` js
-var through = require('through');
+var through = require('through2');
 module.exports = function (file) { return through() };
 ```
 
 You don't necessarily need to use the
-[through](https://github.com/dominictarr/through) module to create a
+[through2](https://github.com/rvagg/through2) module to create a
 readable/writable filter stream for transforming file contents, but this is an
 easy way to do it.
 
diff --git a/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js b/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js
index d0e4862..f6117a0 100644
--- a/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js
+++ b/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/GGG/g, '111'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/GGG/g, '111'));
+        next();
     });
 };
diff --git a/test/files/tr_2dep_module/node_modules/insert-aaa/index.js b/test/files/tr_2dep_module/node_modules/insert-aaa/index.js
index 0394d4e..fc7b356 100644
--- a/test/files/tr_2dep_module/node_modules/insert-aaa/index.js
+++ b/test/files/tr_2dep_module/node_modules/insert-aaa/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/AAA/g, '5'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/AAA/g, '5'));
+        next();
     });
 };
diff --git a/test/files/tr_2dep_module/node_modules/insert-bbb/index.js b/test/files/tr_2dep_module/node_modules/insert-bbb/index.js
index d48906a..eaa64d8 100644
--- a/test/files/tr_2dep_module/node_modules/insert-bbb/index.js
+++ b/test/files/tr_2dep_module/node_modules/insert-bbb/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/BBB/g, '50'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/BBB/g, '50'));
+        next();
     });
 };
diff --git a/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js b/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js
index e9213ef..074ed1f 100644
--- a/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js
+++ b/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/MMM/g, '222'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/MMM/g, '222'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-a/index.js b/test/files/tr_global/node_modules/tr-a/index.js
index dbe6f79..7f344b2 100644
--- a/test/files/tr_global/node_modules/tr-a/index.js
+++ b/test/files/tr_global/node_modules/tr-a/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/AAA/g, '1'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/AAA/g, '1'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-b/index.js b/test/files/tr_global/node_modules/tr-b/index.js
index 21012c6..d294843 100644
--- a/test/files/tr_global/node_modules/tr-b/index.js
+++ b/test/files/tr_global/node_modules/tr-b/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/BBB/g, '10'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/BBB/g, '10'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-c/index.js b/test/files/tr_global/node_modules/tr-c/index.js
index 320718a..b8eb2ce 100644
--- a/test/files/tr_global/node_modules/tr-c/index.js
+++ b/test/files/tr_global/node_modules/tr-c/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/CCC/g, '100'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/CCC/g, '100'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-d/index.js b/test/files/tr_global/node_modules/tr-d/index.js
index 0054380..0dfcc40 100644
--- a/test/files/tr_global/node_modules/tr-d/index.js
+++ b/test/files/tr_global/node_modules/tr-d/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/DDD/g, '1000'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/DDD/g, '1000'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-e/index.js b/test/files/tr_global/node_modules/tr-e/index.js
index 5f9b778..85075cd 100644
--- a/test/files/tr_global/node_modules/tr-e/index.js
+++ b/test/files/tr_global/node_modules/tr-e/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/EEE/g, '10000'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/EEE/g, '10000'));
+        next();
     });
 };
diff --git a/test/files/tr_global/node_modules/tr-f/index.js b/test/files/tr_global/node_modules/tr-f/index.js
index 0a4a8cd..4b0af61 100644
--- a/test/files/tr_global/node_modules/tr-f/index.js
+++ b/test/files/tr_global/node_modules/tr-f/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(buf.toString().replace(/FFF/g, '100000'));
+    return through(function (buf, enc, next) {
+        this.push(buf.toString().replace(/FFF/g, '100000'));
+        next();
     });
 };
diff --git a/test/files/tr_module/index.js b/test/files/tr_module/index.js
index f655423..b61f675 100644
--- a/test/files/tr_module/index.js
+++ b/test/files/tr_module/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/XXX/g, '123'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/XXX/g, '123'));
+        next();
     });
 };
diff --git a/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js b/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js
index d0e4862..f6117a0 100644
--- a/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js
+++ b/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/GGG/g, '111'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/GGG/g, '111'));
+        next();
     });
 };
diff --git a/test/files/tr_module/node_modules/g/x.js b/test/files/tr_module/node_modules/g/x.js
index c33ec81..2d60c07 100644
--- a/test/files/tr_module/node_modules/g/x.js
+++ b/test/files/tr_module/node_modules/g/x.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/XXX/g, '3'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/XXX/g, '3'));
+        next();
     });
 };
diff --git a/test/files/tr_module/node_modules/insert-aaa/index.js b/test/files/tr_module/node_modules/insert-aaa/index.js
index 0394d4e..fc7b356 100644
--- a/test/files/tr_module/node_modules/insert-aaa/index.js
+++ b/test/files/tr_module/node_modules/insert-aaa/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/AAA/g, '5'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/AAA/g, '5'));
+        next();
     });
 };
diff --git a/test/files/tr_module/node_modules/insert-bbb/index.js b/test/files/tr_module/node_modules/insert-bbb/index.js
index d48906a..eaa64d8 100644
--- a/test/files/tr_module/node_modules/insert-bbb/index.js
+++ b/test/files/tr_module/node_modules/insert-bbb/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/BBB/g, '50'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/BBB/g, '50'));
+        next();
     });
 };
diff --git a/test/files/tr_module/xxx.js b/test/files/tr_module/xxx.js
index f655423..b61f675 100644
--- a/test/files/tr_module/xxx.js
+++ b/test/files/tr_module/xxx.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/XXX/g, '123'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/XXX/g, '123'));
+        next();
     });
 };
diff --git a/test/files/tr_rel/xxx.js b/test/files/tr_rel/xxx.js
index 09a4d06..f8b47b1 100644
--- a/test/files/tr_rel/xxx.js
+++ b/test/files/tr_rel/xxx.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/XXX/g, '111'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/XXX/g, '111'));
+        next();
     });
 };
diff --git a/test/files/tr_sh/node_modules/g/tr_g.js b/test/files/tr_sh/node_modules/g/tr_g.js
index 87b5fa3..8f5d614 100644
--- a/test/files/tr_sh/node_modules/g/tr_g.js
+++ b/test/files/tr_sh/node_modules/g/tr_g.js
@@ -1,6 +1,7 @@
-var through = require('through');
+var through = require('through2');
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/GGG/g, '111'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/GGG/g, '111'));
+        next();
     });
 };
diff --git a/test/files/tr_sh/tr_a.js b/test/files/tr_sh/tr_a.js
index 12306a3..397adcb 100644
--- a/test/files/tr_sh/tr_a.js
+++ b/test/files/tr_sh/tr_a.js
@@ -1,6 +1,7 @@
-var through = require('through');
+var through = require('through2');
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/AAA/g, '5'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/AAA/g, '5'));
+        next();
     });
 };
diff --git a/test/files/tr_sh/tr_b.js b/test/files/tr_sh/tr_b.js
index 7c23d33..6dfcb4e 100644
--- a/test/files/tr_sh/tr_b.js
+++ b/test/files/tr_sh/tr_b.js
@@ -1,6 +1,7 @@
-var through = require('through');
+var through = require('through2');
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/BBB/g, '50'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/BBB/g, '50'));
+        next();
     });
 };
diff --git a/test/files/tr_whole_package/node_modules/algo/node_modules/insert-ggg/index.js b/test/files/tr_whole_package/node_modules/algo/node_modules/insert-ggg/index.js
index 7727f75..3fed9ae 100644
--- a/test/files/tr_whole_package/node_modules/algo/node_modules/insert-ggg/index.js
+++ b/test/files/tr_whole_package/node_modules/algo/node_modules/insert-ggg/index.js
@@ -1,7 +1,8 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file) {
-    return through(function (buf) {
-        this.queue(String(buf).replace(/GGG/g, '1'));
+    return through(function (buf, enc, next) {
+        this.push(String(buf).replace(/GGG/g, '1'));
+        next();
     });
 };
diff --git a/test/row_expose.js b/test/row_expose.js
index a5311ca..ce08ca3 100644
--- a/test/row_expose.js
+++ b/test/row_expose.js
@@ -1,6 +1,6 @@
 var parser = require('../');
 var test = require('tape');
-var stream = require('readable-stream');
+var through = require('through2');
 var path = require('path');
 
 // Test that p.options.expose is defined and that the row is properly exposed
@@ -15,7 +15,7 @@ test('row is exposed', function (t) {
     p.end({ file: common_path, expose: "whatever" });
     p.on('error', t.fail.bind(t));
 
-    p.pipe(new stream.PassThrough({ objectMode: true }));
+    p.pipe(through.obj());
 
     p.on('end', function () {
         // Note pathname with extension.
diff --git a/test/tr_err.js b/test/tr_err.js
index c6dd15d..5b1af60 100644
--- a/test/tr_err.js
+++ b/test/tr_err.js
@@ -2,7 +2,7 @@ var mdeps = require('../');
 var test = require('tape');
 var JSONStream = require('JSONStream');
 var packer = require('browser-pack');
-var through = require('through');
+var through = require('through2');
 var path = require('path');
 
 test('transform', function (t) {
diff --git a/test/tr_fn.js b/test/tr_fn.js
index 68767f8..fc107f3 100644
--- a/test/tr_fn.js
+++ b/test/tr_fn.js
@@ -2,18 +2,19 @@ var mdeps = require('../');
 var test = require('tape');
 var JSONStream = require('JSONStream');
 var packer = require('browser-pack');
-var through = require('through');
+var through = require('through2');
 var path = require('path');
 
 test('transform', function (t) {
     t.plan(3);
     var p = mdeps({
         transform: function (file) {
-            return through(function (buf) {
-                this.queue(String(buf)
+            return through(function (buf, enc, next) {
+                this.push(String(buf)
                     .replace(/AAA/g, '5')
                     .replace(/BBB/g, '50')
                 );
+                next();
             });
         },
         transformKey: [ 'browserify', 'transform' ]
diff --git a/test/tr_no_entry.js b/test/tr_no_entry.js
index 7fe48c9..8f820c0 100644
--- a/test/tr_no_entry.js
+++ b/test/tr_no_entry.js
@@ -2,7 +2,7 @@ var mdeps = require('../');
 var test = require('tape');
 var JSONStream = require('JSONStream');
 var packer = require('browser-pack');
-var through = require('through');
+var through = require('through2');
 var concat = require('concat-stream');
 var path = require('path');
 
@@ -10,8 +10,9 @@ test('transform no entry', function (t) {
     t.plan(1);
     var p = mdeps({
         transform: [ function (file) {
-            return through(function (buf) {
-                this.queue(String(buf).replace(/AAA/g, '"WOW"'));
+            return through(function (buf, enc, next) {
+                this.push(String(buf).replace(/AAA/g, '"WOW"'));
+                next();
             });
         } ]
     });
diff --git a/test/tr_opts/node_modules/fff/index.js b/test/tr_opts/node_modules/fff/index.js
index 5bf591d..4bb4309 100644
--- a/test/tr_opts/node_modules/fff/index.js
+++ b/test/tr_opts/node_modules/fff/index.js
@@ -1,17 +1,18 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file, opts) {
     var bufs = [];
     return through(write, end);
     
-    function write (buf) {
+    function write (buf, enc, next) {
         if (!Buffer.isBuffer(buf)) buf = Buffer(buf);
         bufs.push(buf);
+        next();
     }
     
     function end () {
         var str = Buffer.concat(bufs).toString('utf8');
-        this.queue(str.replace(/FFF/g, opts.x));
-        this.queue(null);
+        this.push(str.replace(/FFF/g, opts.x));
+        this.push(null);
     }
 };
diff --git a/test/tr_opts/node_modules/ggg/index.js b/test/tr_opts/node_modules/ggg/index.js
index f57764a..513ccfb 100644
--- a/test/tr_opts/node_modules/ggg/index.js
+++ b/test/tr_opts/node_modules/ggg/index.js
@@ -1,17 +1,18 @@
-var through = require('through');
+var through = require('through2');
 
 module.exports = function (file, opts) {
     var bufs = [];
     return through(write, end);
     
-    function write (buf) {
+    function write (buf, enc, next) {
         if (!Buffer.isBuffer(buf)) buf = Buffer(buf);
         bufs.push(buf);
+        next();
     }
     
     function end () {
         var str = Buffer.concat(bufs).toString('utf8');
-        this.queue(str.replace(/GGG/g, opts.z));
-        this.queue(null);
+        this.push(str.replace(/GGG/g, opts.z));
+        this.push(null);
     }
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git



More information about the Pkg-javascript-commits mailing list