[Pkg-javascript-commits] [node-module-deps] 301/444: apply global transforms to builtins but not local modules

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:07 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 8af90b1851b46255aeb319a9dbe2f668beb2b484
Author: James Halliday <mail at substack.net>
Date:   Tue Jul 29 07:25:35 2014 +1200

    apply global transforms to builtins but not local modules
---
 index.js | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/index.js b/index.js
index 6720d6c..b2e854d 100644
--- a/index.js
+++ b/index.js
@@ -142,9 +142,13 @@ Deps.prototype.readFile = function (file, id, pkg) {
     return rs;
 };
 
-Deps.prototype.getTransforms = function (file, pkg) {
+Deps.prototype.getTransforms = function (file, pkg, opts) {
+    if (!opts) opts = {};
     var self = this;
-    var isTopLevel = this.entries.some(function (main) {
+    
+    var isTopLevel;
+    if (opts.builtin) isTopLevel = false;
+    else isTopLevel = this.entries.some(function (main) {
         var m = path.relative(path.dirname(main), file);
         return m.split(/[\\\/]/).indexOf('node_modules') < 0;
     });
@@ -287,11 +291,9 @@ Deps.prototype.walk = function (id, parent, cb) {
         if (c) return fromDeps(file, c.source, c.package, Object.keys(c.deps));
         
         self.readFile(file, id, pkg)
-            .pipe(
-                has(parent.modules, id)
-                ? through()
-                : self.getTransforms(file, pkg)
-            )
+            .pipe(self.getTransforms(file, pkg, {
+                builtin: has(parent.modules, id)
+            }))
             .pipe(concat(function (body) {
                 fromSource(body.toString('utf8'));
             }))

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