[Pkg-javascript-commits] [node-browser-pack] 88/141: bufferize that keeps stream on the outside

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:23:27 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 7b593f545a9727abf73e2ca3859e2d47993ab157
Author: James Halliday <mail at substack.net>
Date:   Thu Jul 24 11:30:20 2014 -0700

    bufferize that keeps stream on the outside
---
 index.js | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/index.js b/index.js
index b19a3da..de63898 100644
--- a/index.js
+++ b/index.js
@@ -37,19 +37,18 @@ module.exports = function (opts) {
     var lineno = 1 + newlinesIn(prelude);
     var sourcemap;
     
-    var output = stream.pipe(through());
-    return duplexer(stream, output);
+    return stream;
     
     function write (row, enc, next) {
         if (first && opts.standalone) {
             var pre = umd.prelude(opts.standalone).trim();
-            stream.push(pre + 'return ');
+            stream.push(Buffer(pre + 'return '));
         }
         else if (first && stream.hasExports) {
             var pre = opts.externalRequireName || 'require';
-            stream.push(pre + '=');
+            stream.push(Buffer(pre + '='));
         }
-        if (first) stream.push(prelude + '({');
+        if (first) stream.push(Buffer(prelude + '({'));
         
         if (row.sourceFile && !row.nomap) {
             if (!sourcemap) {
@@ -80,7 +79,7 @@ module.exports = function (opts) {
             ']'
         ].join('');
 
-        stream.push(wrappedSource);
+        stream.push(Buffer(wrappedSource));
         lineno += newlinesIn(wrappedSource);
         
         first = false;
@@ -92,16 +91,16 @@ module.exports = function (opts) {
     }
     
     function end () {
-        if (first) stream.push(prelude + '({');
+        if (first) stream.push(Buffer(prelude + '({'));
         entries = entries.filter(function (x) { return x !== undefined });
         
-        stream.push('},{},' + JSON.stringify(entries) + ')');
+        stream.push(Buffer('},{},' + JSON.stringify(entries) + ')'));
         
         if (opts.standalone) {
-            stream.push(
+            stream.push(Buffer(
                 '(' + JSON.stringify(stream.standaloneModule) + ')'
                 + umd.postlude(opts.standalone)
-            );
+            ));
         }
         
         if (sourcemap) {
@@ -111,9 +110,9 @@ module.exports = function (opts) {
                     /^\/\/#/, function () { return opts.sourceMapPrefix }
                 )
             }
-            stream.push('\n' + comment);
+            stream.push(Buffer('\n' + comment));
         }
-        if (!sourcemap && !opts.standalone) stream.push(';\n');
+        if (!sourcemap && !opts.standalone) stream.push(Buffer(';\n'));
 
         stream.push(null);
     }

-- 
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