Permalink
Browse files

Make filenames optional

  • Loading branch information...
1 parent 0af97e4 commit de48689023ce9095b53436b509c5b92cf27c3feb @SLaks committed May 9, 2013
Showing with 5 additions and 3 deletions.
  1. +4 −2 index.js
  2. +1 −1 prelude.js
View
@@ -23,6 +23,7 @@ function newlinesIn(src) {
module.exports = function (opts) {
if (!opts) opts = {};
+ if (opts.filenames === undefined) opts.filenames = true;
var parser = opts.raw ? through() : JSONStream.parse([ true ]);
var output = through(write, end);
parser.pipe(output);
@@ -48,7 +49,8 @@ module.exports = function (opts) {
{ line: lineno }
);
}
- allFilepaths.push(filenameMap[row.id] = (row.filename || row.sourceFile || row.id).replace(/\\/g, '/'));
+ if (opts.filenames && (row.filename || row.sourceFile))
+ allFilepaths.push(filenameMap[row.id] = (row.filename || row.sourceFile).replace(/\\/g, '/'));
var wrappedSource = [
(first ? '' : ','),
@@ -76,7 +78,7 @@ module.exports = function (opts) {
entries = entries.filter(function (x) { return x !== undefined });
this.queue('},{},' + JSON.stringify(entries));
- if (!allFilepaths.length) {
+ if (!opts.filenames || !allFilepaths.length) {
this.queue(',{}');
} else {
var basedir = opts.basedir
View
@@ -33,7 +33,7 @@
var id = modules[name][1][x];
return newRequire(id ? id : x, false, m);
},
- filename: filenames[name], // filenames are passed in a separate map so that we can compute LCA after everything is finished
+ filename: filenames[name] || name, // filenames are passed in a separate map so that we can compute LCA after everything is finished
exports: {},
parent: parent || null,
children: [],

0 comments on commit de48689

Please sign in to comment.