Skip to content

Commit

Permalink
Merge pull request #81 from pnlybubbles/fix/relative-path-problem
Browse files Browse the repository at this point in the history
fix relative path resolve problem
  • Loading branch information
smrq committed Sep 25, 2015
2 parents 316c8c8 + 5dd3e14 commit 60217c7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var _ = require('lodash');
var fs = require('fs');
var through = require('through2');
var path = require('path');

function tsify(b, opts) {
var ts = opts.typescript || require('typescript');
Expand Down Expand Up @@ -45,9 +46,15 @@ function tsify(b, opts) {
function flush(next) {
var self = this;
var entries = rows
.map(function (row) { return row.file || row.id; })
.map(function (row) {
if (row.basedir && (row.file || row.id)) {
return path.resolve(row.basedir, row.file || row.id);
} else {
return row.file || row.id;
}
})
.filter(function (file) { return file; })
.map(function (file) { return fs.realpathSync(file) });
.map(function (file) { return fs.realpathSync(file); });
tsifier.reset();
tsifier.generateCache(entries);
rows.forEach(function (row) { self.push(row); });
Expand Down

0 comments on commit 60217c7

Please sign in to comment.