Allow .sourcePath of NodeModulesDirectory to be absolute.

This commit is contained in:
Ben Newman
2016-03-17 19:54:13 -04:00
parent 6985c47ea7
commit 9021ba8756

View File

@@ -328,9 +328,16 @@ export class NodeModulesDirectory {
const nodeModulesDirectories = Object.create(null);
function add(moreInfo, relPath) {
rejectBadPath(relPath);
const sourcePath = files.pathJoin(callerInfo.sourceRoot, relPath);
function add(moreInfo, path) {
let sourcePath;
if (files.pathIsAbsolute(path)) {
sourcePath = path;
} else {
rejectBadPath(path);
sourcePath = files.pathJoin(callerInfo.sourceRoot, path);
}
nodeModulesDirectories[sourcePath] = new NodeModulesDirectory({
...callerInfo,
...moreInfo,