[Pkg-javascript-commits] [node-module-deps] 355/444: fix for undef row.file/basedir
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:48:12 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 742de25c369450dd6461e2f5701ad36ee4672940
Author: James Halliday <mail at substack.net>
Date: Wed Apr 1 22:02:56 2015 +1300
fix for undef row.file/basedir
---
index.js | 7 ++++++-
package.json | 1 +
test/undef_file.js | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/index.js b/index.js
index a7a4729..8c49982 100644
--- a/index.js
+++ b/index.js
@@ -11,6 +11,7 @@ var combine = require('stream-combiner2');
var duplexer = require('duplexer2');
var copy = require('shallow-copy');
var xtend = require('xtend');
+var defined = require('defined');
var inherits = require('inherits');
var Transform = require('readable-stream').Transform;
@@ -81,7 +82,11 @@ Deps.prototype._transform = function (row, enc, next) {
}
self.pending ++;
- if (row.entry !== false) self.entries.push(path.resolve(row.basedir, row.file));
+ var basedir = defined(row.basedir, self.basedir);
+
+ if (row.entry !== false) {
+ self.entries.push(path.resolve(basedir, row.file || row.id));
+ }
self.lookupPackage(row.file, function (err, pkg) {
if (err && self.options.ignoreMissing) {
diff --git a/package.json b/package.json
index 1b36c42..0efbbf2 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"JSONStream": "~0.7.1",
"browser-resolve": "^1.7.0",
"concat-stream": "~1.4.5",
+ "defined": "0.0.0",
"detective": "^4.0.0",
"duplexer2": "0.0.2",
"inherits": "^2.0.1",
diff --git a/test/undef_file.js b/test/undef_file.js
index e352f7d..eb3f4cc 100644
--- a/test/undef_file.js
+++ b/test/undef_file.js
@@ -25,6 +25,7 @@ test('undef file', function (t) {
t.same(rows.sort(cmp), [
{
id: files.main,
+ file: files.main,
source: sources.main,
entry: true,
deps: { './foo': files.foo }
--
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