[Pkg-javascript-commits] [node-module-deps] 256/444: passing expose test

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:01 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 e1d87333b8e02e77adc283707c60e92d9125b1bd
Author: James Halliday <mail at substack.net>
Date:   Sun Jul 20 03:45:02 2014 -0700

    passing expose test
---
 index.js     | 30 ++++++++++++------------------
 package.json |  7 ++++---
 2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/index.js b/index.js
index 4e860e0..cf59d76 100644
--- a/index.js
+++ b/index.js
@@ -10,6 +10,7 @@ var concat = require('concat-stream');
 var parents = require('parents');
 var combine = require('stream-combiner');
 var duplexer = require('duplexer2');
+var copy = require('shallow-copy');
 
 var inherits = require('inherits');
 var Transform = require('readable-stream').Transform;
@@ -64,7 +65,7 @@ Deps.prototype._transform = function (row, enc, next) {
     function start (pkg) {
         if (!pkg) pkg = {};
         if (!pkg.__dirname) pkg.__dirname = path.dirname(row.file);
-        self.walk(row.file, self.top);
+        self.walk(row, self.top);
     }
 };
 
@@ -221,18 +222,12 @@ Deps.prototype.walk = function (id, parent, cb) {
     var opts = self.options;
     this.pending ++;
     
-    if (id && typeof id === 'object' && id.stream) {
-        self.lookupPackage(id.file, function (err, pkg) {
-            id.stream
-                .pipe(self.getTransforms(id.file, pkg))
-                .pipe(concat(function (body) {
-                    var src = body.toString('utf8');
-                    var deps = self.parseDeps(id.file, src);
-                    if (deps) fromDeps(id.file, src, pkg || {}, deps);
-                }))
-            ;
-        });
-        return;
+    var rec = {};
+    if (typeof id === 'object') {
+        rec = copy(id);
+        if (rec.entry === false) delete rec.entry;
+        id = rec.file;
+        delete rec.file;
     }
     
     self.resolve(id, parent, function (err, file, pkg) {
@@ -277,11 +272,10 @@ Deps.prototype.walk = function (id, parent, cb) {
         if (deps.length === 0) done();
         
         function done () {
-            var rec = {
-                id: file,
-                source: src,
-                deps: resolved
-            };
+            if (!rec.id) rec.id = file;
+            if (!rec.source) rec.source = src;
+            if (!rec.deps) rec.deps = resolved;
+            
             if (self.entries.indexOf(file) >= 0) {
                 rec.entry = true;
             }
diff --git a/package.json b/package.json
index 8c1c19f..45f9a87 100644
--- a/package.json
+++ b/package.json
@@ -15,11 +15,12 @@
     "inherits": "~2.0.1",
     "minimist": "~0.0.9",
     "parents": "0.0.2",
+    "readable-stream": "^1.0.27-1",
     "resolve": "~0.6.3",
+    "shallow-copy": "0.0.1",
     "stream-combiner": "~0.1.0",
-    "through2": "~0.4.1",
-    "readable-stream": "^1.0.27-1",
-    "subarg": "0.0.1"
+    "subarg": "0.0.1",
+    "through2": "~0.4.1"
   },
   "devDependencies": {
     "through": "~2.3.4",

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