From 778ace10c0b702197eb06a3a1dc3b62b46eb5ceb Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 25 Apr 2020 14:19:49 +0200 Subject: [PATCH] Strip sourceMappingURL directives --- scripts/importTypescript.js | 8 ++++++-- src/lib/typescriptServices-amd.js | 2 +- src/lib/typescriptServices.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/importTypescript.js b/scripts/importTypescript.js index 88f22e08..c89a99b3 100644 --- a/scripts/importTypescript.js +++ b/scripts/importTypescript.js @@ -71,7 +71,7 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` define("vs/language/typescript/lib/typescriptServices", [], function() { return ts; }); // END MONACOCHANGE `; - fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices-amd.js'), tsServices_amd); + fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices-amd.js'), stripSourceMaps(tsServices_amd)); var tsServices_esm = generatedNote + tsServices + ` @@ -87,7 +87,7 @@ export var ScriptTarget = ts.ScriptTarget; export var TokenClass = ts.TokenClass; // END MONACOCHANGE `; - fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.js'), tsServices_esm); + fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.js'), stripSourceMaps(tsServices_esm)); var dtsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.d.ts')).toString(); dtsServices += @@ -265,3 +265,7 @@ function escapeText(text) { resultPieces.push(text.substring(startPos, len)); return resultPieces.join(''); } + +function stripSourceMaps(str) { + return str.replace(/\/\/# sourceMappingURL[^\n]+/gm, ''); +} diff --git a/src/lib/typescriptServices-amd.js b/src/lib/typescriptServices-amd.js index 2a8578b1..eb80cbe7 100644 --- a/src/lib/typescriptServices-amd.js +++ b/src/lib/typescriptServices-amd.js @@ -137510,7 +137510,7 @@ if (typeof module !== "undefined" && module.exports) { module.exports = ts; } -//# sourceMappingURL=typescriptServices.js.map + // MONACOCHANGE // Defining the entire module name because r.js has an issue and cannot bundle this file diff --git a/src/lib/typescriptServices.js b/src/lib/typescriptServices.js index 4fde536e..a6f065d5 100644 --- a/src/lib/typescriptServices.js +++ b/src/lib/typescriptServices.js @@ -137510,7 +137510,7 @@ if (typeof module !== "undefined" && module.exports) { module.exports = ts; } -//# sourceMappingURL=typescriptServices.js.map + // MONACOCHANGE export var createClassifier = ts.createClassifier;