[Pkg-javascript-commits] [node-module-deps] 368/444: Ensure __dirname is applied to the right package

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:14 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 3ebfa38d6a60432ea580ae1bf9e21f94bd2f0b07
Author: Patrick Mowrer <pmowrer at gmail.com>
Date:   Mon Apr 20 16:40:46 2015 -0400

    Ensure __dirname is applied to the right package
    
    Fixes #73
---
 index.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 307924e..8e88f34 100644
--- a/index.js
+++ b/index.js
@@ -146,11 +146,12 @@ Deps.prototype.resolve = function (id, parent, cb) {
         });
     }
     
-    var pkgdir;
     parent.packageFilter = function (p, x) {
-        pkgdir = path.dirname(x);
-        if (opts.packageFilter) return opts.packageFilter(p, x);
-        else return p;
+        var pkgdir = path.dirname(x);
+        if (opts.packageFilter) p = opts.packageFilter(p, x);
+        p.__dirname = pkgdir;
+
+        return p;
     };
     
     if (opts.extensions) parent.extensions = opts.extensions;
@@ -163,7 +164,6 @@ Deps.prototype.resolve = function (id, parent, cb) {
             + parent.filename
         ));
         
-        if (pkg && pkgdir) pkg.__dirname = pkgdir;
         if (!pkg || !pkg.__dirname) {
             self.lookupPackage(file, function (err, p) {
                 if (err) return cb(err);

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