var ts = require('typescript'); var fs = require('fs'); var path = require('canonical-path'); // We need to provide our own version of CompilerHost because we want to set the // base directory and specify what extensions to consider when trying to load a source // file module.exports = function createCompilerHost(log) { return function createCompilerHost(options, baseDir, extensions) { return { getSourceFile: function(fileName, languageVersion, onError) { var text, resolvedPath, resolvedPathWithExt; // Strip off the extension and resolve relative to the baseDir baseFilePath = fileName.replace(/\.[^.]+$/, ''); resolvedPath = path.resolve(baseDir, baseFilePath); // Iterate through each possible extension and return the first source file that is actually found for(var i=0; i