Skip to content

Commit 7a98124

Browse files
author
James Halliday
committed
Merge branch 'fix-1365' of https://github.com/chrisirhc/module-deps into streams3
2 parents 2014f51 + fc7695a commit 7a98124

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Deps.prototype.resolve = function (id, parent, cb) {
157157
if (opts.extensions) parent.extensions = opts.extensions;
158158
if (opts.modules) parent.modules = opts.modules;
159159

160-
self.resolver(id, parent, function onresolve (err, file, pkg) {
160+
self.resolver(id, parent, function onresolve (err, file, pkg, fakePath) {
161161
if (err) return cb(err);
162162
if (!file) return cb(new Error(
163163
'module not found: "' + id + '" from file '
@@ -171,11 +171,12 @@ Deps.prototype.resolve = function (id, parent, cb) {
171171
if (!p.__dirname) p.__dirname = path.dirname(file);
172172
self.pkgCache[file] = p;
173173
onresolve(err, file, opts.packageFilter
174-
? opts.packageFilter(p, p.__dirname) : p
174+
? opts.packageFilter(p, p.__dirname) : p,
175+
fakePath
175176
);
176177
});
177178
}
178-
else cb(err, file, pkg);
179+
else cb(err, file, pkg, fakePath);
179180
});
180181
};
181182

@@ -194,6 +195,7 @@ Deps.prototype.readFile = function (file, id, pkg) {
194195
};
195196

196197
Deps.prototype.getTransforms = function (file, pkg, opts) {
198+
// TODO: Needs FAKE path here.
197199
if (!opts) opts = {};
198200
var self = this;
199201

@@ -308,7 +310,7 @@ Deps.prototype.walk = function (id, parent, cb) {
308310
this.inputPending ++;
309311
}
310312

311-
self.resolve(id, parent, function (err, file, pkg) {
313+
self.resolve(id, parent, function (err, file, pkg, fakePath) {
312314
if (rec.expose) {
313315
// Set options.expose to make the resolved pathname available to the
314316
// caller. They may or may not have requested it, but it's harmless
@@ -363,7 +365,7 @@ Deps.prototype.walk = function (id, parent, cb) {
363365
if (c) return fromDeps(file, c.source, c.package, Object.keys(c.deps));
364366

365367
self.readFile(file, id, pkg)
366-
.pipe(self.getTransforms(file, pkg, {
368+
.pipe(self.getTransforms(fakePath || file, pkg, {
367369
builtin: has(parent.modules, id)
368370
}))
369371
.pipe(concat(function (body) {

0 commit comments

Comments
 (0)