[Pkg-javascript-commits] [node-module-deps] 201/444: fixed the stream test by checking for .path
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:47:55 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 dc7c123748c7c72c8f7e01f28e4a1fdc88a6f240
Author: James Halliday <mail at substack.net>
Date: Fri May 9 00:58:58 2014 -0700
fixed the stream test by checking for .path
---
index.js | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/index.js b/index.js
index 4629927..9ea5930 100644
--- a/index.js
+++ b/index.js
@@ -73,7 +73,7 @@ Deps.prototype._start = function () {
if (!pkg.__dirname) pkg.__dirname = path.dirname(file);
if (typeof main === 'object') {
- self.walk({ stream: main, file: file }, main);
+ self.walk({ stream: main, file: main.path || file }, main);
}
else self.walk(main, self.top);
}
@@ -87,7 +87,9 @@ Deps.prototype.add = function (main) {
var n = Math.floor(Math.pow(16,8) * Math.random()).toString(16);
file = path.join(this.basedir, 'fake_' + n + '.js');
if (typeof main.read !== 'function') {
+ var old = main;
main = Readable().wrap(main);
+ if (old.path) main.path = old.path;
}
}
else file = main;
@@ -100,24 +102,6 @@ Deps.prototype.resolve = function (id, parent, cb) {
var self = this;
var opts = self.options;
- if (typeof id === 'object') {
- id.stream.pipe(concat(function (body) {
- var src = body.toString('utf8');
- var pkgfile = path.join(self.basedir, 'package.json');
- fs.readFile(pkgfile, function (err, pkgsrc) {
- var pkg = {};
- if (!err) {
- try { pkg = JSON.parse(pkgsrc) }
- catch (e) {};
- }
- var trx = getTransform(pkg);
- applyTransforms(id.file, trx, src, pkg);
- });
- }));
- if (cb) cb(false);
- return;
- }
-
var c = this.cache && this.cache[parent.id];
var resolver = c && typeof c === 'object'
&& !Buffer.isBuffer(c) && c.deps[id]
--
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