blob: 0f43f9e91ef0b0ca052ef892c02c1d7b2e98a2f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
"use strict";
var utils = require('./utils');
var Host = (function () {
function Host(typescript, currentDirectory, input, options) {
var _this = this;
this.getCurrentDirectory = function () {
return _this.currentDirectory;
};
this.writeFile = function (fileName, data, writeByteOrderMark, onError) { };
this.fileExists = function (fileName) {
var sourceFile = _this.input.getFile(fileName);
if (sourceFile)
return true;
return _this.fallback.fileExists(fileName);
};
this.readFile = function (fileName) {
var sourceFile = _this.input.getFile(fileName);
if (sourceFile)
return sourceFile.content;
return _this.fallback.readFile(fileName);
};
this.getSourceFile = function (fileName, languageVersion, onError) {
// TODO: Cache lib.d.ts files between compilations
var sourceFile = _this.input.getFile(fileName);
if (sourceFile)
return sourceFile.ts;
return _this.fallback.getSourceFile(fileName, languageVersion, onError);
};
this.realpath = function (path) { return _this.fallback.realpath(path); };
this.getDirectories = function (path) { return _this.fallback.getDirectories(path); };
this.directoryExists = function (path) { return _this.fallback.directoryExists(path); };
this.typescript = typescript;
this.fallback = typescript.createCompilerHost(options);
this.currentDirectory = currentDirectory;
this.input = input;
}
Host.prototype.getNewLine = function () {
return '\n';
};
Host.prototype.useCaseSensitiveFileNames = function () {
return false;
};
Host.prototype.getCanonicalFileName = function (filename) {
return utils.normalizePath(filename);
};
Host.prototype.getDefaultLibFileName = function (options) {
return this.fallback.getDefaultLibFileName(options);
};
Host.prototype.getDefaultLibLocation = function () {
return this.fallback.getDefaultLibLocation();
};
return Host;
}());
exports.Host = Host;
|