mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-19 12:45:58 -05:00
[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:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user