[Pkg-javascript-commits] [node-module-deps] 399/444: do not apply root transforms on linked modules
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:48:17 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 fc7695ad0aa1573987752056dc0be0b7cfb92a9c
Author: Chris Chua <chua at uber.com>
Date: Thu Sep 24 13:36:40 2015 -0700
do not apply root transforms on linked modules
resolver now accepts a 4th argument which should be the original
(non-real) file path.
---
index.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/index.js b/index.js
index 923b0b5..ad2c857 100644
--- a/index.js
+++ b/index.js
@@ -157,7 +157,7 @@ Deps.prototype.resolve = function (id, parent, cb) {
if (opts.extensions) parent.extensions = opts.extensions;
if (opts.modules) parent.modules = opts.modules;
- self.resolver(id, parent, function onresolve (err, file, pkg) {
+ self.resolver(id, parent, function onresolve (err, file, pkg, fakePath) {
if (err) return cb(err);
if (!file) return cb(new Error(
'module not found: "' + id + '" from file '
@@ -171,11 +171,12 @@ Deps.prototype.resolve = function (id, parent, cb) {
if (!p.__dirname) p.__dirname = path.dirname(file);
self.pkgCache[file] = p;
onresolve(err, file, opts.packageFilter
- ? opts.packageFilter(p, p.__dirname) : p
+ ? opts.packageFilter(p, p.__dirname) : p,
+ fakePath
);
});
}
- else cb(err, file, pkg);
+ else cb(err, file, pkg, fakePath);
});
};
@@ -194,6 +195,7 @@ Deps.prototype.readFile = function (file, id, pkg) {
};
Deps.prototype.getTransforms = function (file, pkg, opts) {
+ // TODO: Needs FAKE path here.
if (!opts) opts = {};
var self = this;
@@ -308,7 +310,7 @@ Deps.prototype.walk = function (id, parent, cb) {
this.inputPending ++;
}
- self.resolve(id, parent, function (err, file, pkg) {
+ self.resolve(id, parent, function (err, file, pkg, fakePath) {
if (rec.expose) {
// Set options.expose to make the resolved pathname available to the
// caller. They may or may not have requested it, but it's harmless
@@ -363,7 +365,7 @@ 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(self.getTransforms(file, pkg, {
+ .pipe(self.getTransforms(fakePath || file, pkg, {
builtin: has(parent.modules, id)
}))
.pipe(concat(function (body) {
--
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