[Pkg-javascript-commits] [node-module-deps] 343/444: dirname fixes

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:11 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 44ce0a64f4e0f0384267b5a2c3d7c2ae5bda1d37
Author: James Halliday <mail at substack.net>
Date:   Tue Feb 17 11:40:07 2015 -0800

    dirname fixes
---
 index.js     | 8 ++++++--
 package.json | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 71a2c38..baa744b 100644
--- a/index.js
+++ b/index.js
@@ -30,6 +30,7 @@ function Deps (opts) {
     this.pkgCache = opts.packageCache || {};
     this.pkgFileCache = {};
     this.pkgFileCachePending = {};
+    this._emittedPkg = {};
     this.visited = {};
     this.walking = {};
     this.entries = [];
@@ -139,7 +140,7 @@ Deps.prototype.resolve = function (id, parent, cb) {
     
     var pkgdir;
     parent.packageFilter = function (p, x) {
-        pkgdir = x;
+        pkgdir = path.dirname(x);
         if (opts.packageFilter) return opts.packageFilter(p, x);
         else return p;
     };
@@ -304,7 +305,10 @@ Deps.prototype.walk = function (id, parent, cb) {
             self.options.expose[rec.expose] =
                 self.options.modules[rec.expose] = file;
         }
-        if (pkg) self.emit('package', pkg);
+        if (pkg && !self._emittedPkg[pkg.__dirname]) {
+            self._emittedPkg[pkg.__dirname] = true;
+            self.emit('package', pkg);
+        }
         
         if (opts.postFilter && !opts.postFilter(id, file, pkg)) {
             if (--self.pending === 0) self.push(null);
diff --git a/package.json b/package.json
index 2f10302..e8992d8 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
     "minimist": "~0.2.0",
     "parents": "^1.0.0",
     "readable-stream": "^1.0.27-1",
-    "resolve": "^1.1.2",
+    "resolve": "^1.1.3",
     "shallow-copy": "0.0.1",
     "stream-combiner2": "~1.0.0",
     "subarg": "0.0.1",

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