Comparing version 1.5.1 to 1.5.2
@@ -25,3 +25,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; | ||
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; | ||
// always emit declaraction files | ||
@@ -54,2 +54,6 @@ host.getCompilationSettings().declaration = true; | ||
function file(file) { | ||
// support gulp-sourcemaps | ||
if (file.sourceMap) { | ||
emitSourceMapsInStream = false; | ||
} | ||
if (!file.contents) { | ||
@@ -97,2 +101,5 @@ host.removeScriptSnapshot(file.path); | ||
var file_1 = _a[_i]; | ||
if (!emitSourceMapsInStream && /\.js\.map$/.test(file_1.name)) { | ||
continue; | ||
} | ||
if (/\.d\.ts$/.test(file_1.name)) { | ||
@@ -107,7 +114,20 @@ signature = crypto.createHash('md5') | ||
} | ||
files.push(new Vinyl({ | ||
var vinyl = new Vinyl({ | ||
path: file_1.name, | ||
contents: new Buffer(file_1.text), | ||
base: !config._emitWithoutBasePath && baseFor(host.getScriptSnapshot(fileName)) | ||
})); | ||
}); | ||
if (!emitSourceMapsInStream && /\.js$/.test(file_1.name)) { | ||
var sourcemapFile = output.outputFiles.filter(function (f) { return /\.js\.map$/.test(f.name); })[0]; | ||
if (sourcemapFile) { | ||
var extname = path.extname(vinyl.relative); | ||
var basename = path.basename(vinyl.relative, extname); | ||
var dirname = path.dirname(vinyl.relative); | ||
var tsname = (dirname === '.' ? '' : dirname + '/') + basename + '.ts'; | ||
var sourceMap = JSON.parse(sourcemapFile.text); | ||
sourceMap.sources[0] = tsname; | ||
vinyl.sourceMap = sourceMap; | ||
} | ||
} | ||
files.push(vinyl); | ||
} | ||
@@ -114,0 +134,0 @@ resolve({ |
{ | ||
"name": "gulp-tsb", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"author": "Johannes Rieken <johannes.rieken@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "A gulp plugin for very fast TypeScript compilation.", |
Sorry, the diff of this file is not supported yet
4006013
13
77363