Comparing version 1.9.0 to 1.10.0
@@ -24,3 +24,3 @@ 'use strict'; | ||
function createTypeScriptBuilder(config) { | ||
var compilerOptions = createCompilerOptions(config), host = new LanguageServiceHost(compilerOptions), service = ts.createLanguageService(host, ts.createDocumentRegistry()), lastBuildVersion = Object.create(null), lastDtsHash = Object.create(null), userWantsDeclarations = compilerOptions.declaration, oldErrors = Object.create(null), headUsed = process.memoryUsage().heapUsed, emitSourceMapsInStream = true; | ||
var compilerOptions = createCompilerOptions(config), host = new LanguageServiceHost(compilerOptions, config.noFilesystemLookup || false), service = ts.createLanguageService(host, ts.createDocumentRegistry()), lastBuildVersion = Object.create(null), lastDtsHash = Object.create(null), userWantsDeclarations = compilerOptions.declaration, oldErrors = Object.create(null), headUsed = process.memoryUsage().heapUsed, emitSourceMapsInStream = true; | ||
// always emit declaraction files | ||
@@ -76,5 +76,5 @@ host.getCompilationSettings().declaration = true; | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
process.nextTick(function () { | ||
resolve(service.getSyntacticDiagnostics(fileName)); | ||
}, 0); | ||
}); | ||
}); | ||
@@ -84,5 +84,5 @@ } | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
process.nextTick(function () { | ||
resolve(service.getSemanticDiagnostics(fileName)); | ||
}, 0); | ||
}); | ||
}); | ||
@@ -92,3 +92,3 @@ } | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
process.nextTick(function () { | ||
if (/\.d\.ts$/.test(fileName)) { | ||
@@ -147,3 +147,3 @@ // if it's already a d.ts file just emit it signature | ||
}); | ||
}, 0); | ||
}); | ||
}); | ||
@@ -270,3 +270,3 @@ } | ||
// change to change | ||
setTimeout(workOnNext, 0); | ||
process.nextTick(workOnNext); | ||
}).catch(function (err) { | ||
@@ -365,5 +365,7 @@ console.error(err); | ||
var LanguageServiceHost = (function () { | ||
function LanguageServiceHost(settings) { | ||
function LanguageServiceHost(settings, noFilesystemLookup) { | ||
this._settings = settings; | ||
this._noFilesystemLookup = noFilesystemLookup; | ||
this._snapshots = Object.create(null); | ||
this._projectVersion = 1; | ||
this._dependencies = new utils.graph.Graph(function (s) { return s; }); | ||
@@ -385,2 +387,5 @@ this._dependenciesRecomputeList = []; | ||
}; | ||
LanguageServiceHost.prototype.getProjectVersion = function () { | ||
return String(this._projectVersion); | ||
}; | ||
LanguageServiceHost.prototype.getScriptFileNames = function () { | ||
@@ -396,3 +401,3 @@ return Object.keys(this._snapshots).filter(function (filename) { return /\.tsx?/i.test(path.extname(filename)); }); | ||
var result = this._snapshots[filename]; | ||
if (!result) { | ||
if (!result && !this._noFilesystemLookup) { | ||
try { | ||
@@ -413,2 +418,3 @@ result = new VinylScriptSnapshot(new Vinyl({ | ||
LanguageServiceHost.prototype.addScriptSnapshot = function (filename, snapshot) { | ||
this._projectVersion++; | ||
filename = normalize(filename); | ||
@@ -437,2 +443,3 @@ var old = this._snapshots[filename]; | ||
LanguageServiceHost.prototype.removeScriptSnapshot = function (filename) { | ||
this._projectVersion++; | ||
filename = normalize(filename); | ||
@@ -439,0 +446,0 @@ delete this._fileNameToDeclaredModule[filename]; |
{ | ||
"name": "gulp-tsb", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"author": "Johannes Rieken <johannes.rieken@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "A gulp plugin for very fast TypeScript compilation.", |
34494
742