[Transforms] Fix other sourcemaps (#8721)

* Update correct sourcemaps

* Fix emit BOM in sourcemap

* Stop emit .js.map when no .js is emitted

* verify and update sourcemaps and sourcemap.txt

* Verify and update systemjs sourcemaps
This commit is contained in:
Yui
2016-05-24 08:52:15 -07:00
parent 9cd96e6929
commit 65a641f33a
20 changed files with 80 additions and 191 deletions

View File

@@ -218,7 +218,7 @@ const _super = (function (geti, seti) {
// Write the source map
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), compilerOptions.emitBOM);
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
}
// Record source map data for the test harness.

View File

@@ -156,7 +156,7 @@ class CompilerBaselineRunner extends RunnerBase {
if (options.sourceMap || options.inlineSourceMap) {
Harness.Baseline.runBaseline("Correct sourcemap content for " + fileName, justName.replace(/\.tsx?$/, ".sourcemap.txt"), () => {
const record = result.getSourceMapRecord();
if (options.noEmitOnError && result.errors.length !== 0 && record === undefined) {
if ((options.noEmitOnError && result.errors.length !== 0) || record === undefined) {
// Because of the noEmitOnError option no files are created. We need to return null because baselining isn"t required.
return null;
}
@@ -232,7 +232,7 @@ class CompilerBaselineRunner extends RunnerBase {
}
Harness.Baseline.runBaseline("Correct Sourcemap output for " + fileName, justName.replace(/\.tsx?/, ".js.map"), () => {
if (options.noEmitOnError && result.errors.length !== 0 && result.sourceMaps.length === 0) {
if ((options.noEmitOnError && result.errors.length !== 0) || result.sourceMaps.length === 0) {
// We need to return null here or the runBaseLine will actually create a empty file.
// Baselining isn't required here because there is no output.
return null;

View File

@@ -1432,7 +1432,7 @@ namespace Harness {
}
public getSourceMapRecord() {
if (this.sourceMapData) {
if (this.sourceMapData.length > 0) {
return Harness.SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
}
}