Use sorcery to merge sourcemaps between browserify and gulp-typescript (#9439)

* Use sorcery to merge sourcemaps between browserify and gulp-typescript

* Use shorthand

* Fix nit

* move comments, change loop into map

* Ahahaha, we should run code before pushing it

* Move conditional into call
This commit is contained in:
Wesley Wigham
2016-07-15 16:55:16 -07:00
committed by GitHub
parent 859bd1b823
commit 761482cf5e
5 changed files with 40 additions and 6 deletions

View File

@@ -614,7 +614,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
const sourceMappingURL = sourceMap.getSourceMappingURL();
if (sourceMappingURL) {
write(`//# sourceMappingURL=${sourceMappingURL}`);
write(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Sometimes tools can sometimes see this line as a source mapping url comment
}
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);

View File

@@ -328,7 +328,7 @@ class ProjectRunner extends RunnerBase {
if (Harness.Compiler.isJS(fileName)) {
// Make sure if there is URl we have it cleaned up
const indexOfSourceMapUrl = data.lastIndexOf("//# sourceMappingURL=");
const indexOfSourceMapUrl = data.lastIndexOf(`//# ${"sourceMappingURL"}=`); // This line can be seen as a sourceMappingURL comment
if (indexOfSourceMapUrl !== -1) {
data = data.substring(0, indexOfSourceMapUrl + 21) + cleanProjectUrl(data.substring(indexOfSourceMapUrl + 21));
}