[Pkg-javascript-commits] [node-browser-pack] 60/141: get rid of duplexer, issues with .pause()

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:23:25 UTC 2017


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

rouca pushed a commit to branch master
in repository node-browser-pack.

commit 35e34267b84442ce9ee8acb36b16885bffbd27e5
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 8 17:24:10 2013 -0700

    get rid of duplexer, issues with .pause()
---
 index.js     | 24 +++++++++++++-----------
 package.json |  5 ++---
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/index.js b/index.js
index 79fdfab..9f41392 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,4 @@
 var JSONStream = require('JSONStream');
-var duplexer = require('duplexer');
 var through = require('through');
 
 var fs = require('fs');
@@ -19,19 +18,22 @@ function newlinesIn(src) {
 module.exports = function (opts) {
     if (!opts) opts = {};
     var parser = opts.raw ? through() : JSONStream.parse([ true ]);
-    var output = through(write, end);
-    parser.pipe(output);
+    var stream = through(
+        function (buf) { parser.write(buf) },
+        function () { parser.end() }
+    );
+    parser.pipe(through(write, end));
     
     var first = true;
     var entries = [];
     
     var lineno = 1 + newlinesIn(prelude);
     var sourcemap;
-
-    return duplexer(parser, output);
+    
+    return stream;
     
     function write (row) {
-        if (first) this.queue((opts.prelude || prelude) + '({');
+        if (first) stream.queue((opts.prelude || prelude) + '({');
         
         if (row.sourceFile) { 
             sourcemap = sourcemap || combineSourceMap.create();
@@ -56,7 +58,7 @@ module.exports = function (opts) {
             ']'
         ].join('');
 
-        this.queue(wrappedSource);
+        stream.queue(wrappedSource);
         lineno += newlinesIn(wrappedSource);
         
         first = false;
@@ -67,12 +69,12 @@ module.exports = function (opts) {
     }
     
     function end () {
-        if (first) this.queue(prelude + '({');
+        if (first) stream.queue(prelude + '({');
         entries = entries.filter(function (x) { return x !== undefined });
         
-        this.queue('},{},' + JSON.stringify(entries) + ')');
-        if (sourcemap) this.queue('\n' + sourcemap.comment());
+        stream.queue('},{},' + JSON.stringify(entries) + ')');
+        if (sourcemap) stream.queue('\n' + sourcemap.comment());
 
-        this.queue(null);
+        stream.queue(null);
     }
 };
diff --git a/package.json b/package.json
index 455d5ad..c9519b2 100644
--- a/package.json
+++ b/package.json
@@ -7,9 +7,8 @@
         "browser-pack": "bin/cmd.js"
     },
     "dependencies": {
-        "JSONStream": "~0.4.3",
-        "duplexer": "~0.0.3",
-        "through": "~2.2.0",
+        "JSONStream": "~0.6.4",
+        "through": "~2.3.4",
         "combine-source-map": "~0.1.1"
 
     },

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



More information about the Pkg-javascript-commits mailing list