[Pkg-javascript-commits] [node-browser-pack] 66/141: Fix prelude overriding

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 bace2d4c3b858d206ae0411d3309de563e3207bf
Author: Andrey Popp <8mayday at gmail.com>
Date:   Sun Sep 15 21:36:35 2013 +0400

    Fix prelude overriding
    
    Previously opts.prelude were not considered when calculating line numbers and
    emitting prelude for empty bundles.
---
 index.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 400a6e3..68bcdee 100644
--- a/index.js
+++ b/index.js
@@ -6,7 +6,8 @@ var path = require('path');
 
 var combineSourceMap = require('combine-source-map');
 
-var prelude = fs.readFileSync(path.join(__dirname, '_prelude.js'), 'utf8');
+var defaultPrelude = fs.readFileSync(
+      path.join(__dirname, '_prelude.js'), 'utf8');
 
 function newlinesIn(src) {
   if (!src) return 0;
@@ -26,6 +27,7 @@ module.exports = function (opts) {
     
     var first = true;
     var entries = [];
+    var prelude = opts.prelude || defaultPrelude;
     
     var lineno = 1 + newlinesIn(prelude);
     var sourcemap;
@@ -34,7 +36,7 @@ module.exports = function (opts) {
     return stream;
     
     function write (row) {
-        if (first) stream.queue((opts.prelude || prelude) + '({');
+        if (first) stream.queue(prelude + '({');
         
         if (row.sourceFile && !seenSourceFiles[row.sourceFile]) { 
 	    seenSourceFiles[row.sourceFile] = true;

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