diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 48817798d81..af4a44204e3 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -30,6 +30,10 @@ module ts { type: "boolean", description: Diagnostics.Print_this_message, }, + { + name: "inlineSourceMap", + type: "boolean", + }, { name: "listFiles", type: "boolean", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index b4380f4d2de..380cd7378f8 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -445,6 +445,10 @@ module ts { Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, + Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, + Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_out_cannot_be_specified_with_option_inlineSourceMap: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'inlineSourceMap'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fe349b78343..65382ab7f04 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -661,7 +661,7 @@ }, "Invalid use of '{0}'. Class definitions are automatically in strict mode.": { "category": "Error", - "code": 1210 + "code": 1210 }, "A class declaration without the 'default' modifier must have a name": { "category": "Error", @@ -1772,6 +1772,23 @@ "category": "Error", "code": 5047 }, + "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": { + "category": "Error", + "code": 5048 + }, + "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": { + "category": "Error", + "code": 5049 + }, + "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": { + "category": "Error", + "code": 5050 + }, + "Option 'out' cannot be specified with option 'inlineSourceMap'.": { + "category": "Error", + "code": 5051 + }, + "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 43db3e69cd7..28848a1af78 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -52,7 +52,7 @@ var __param = this.__param || function(index, decorator) { return function (targ let compilerOptions = host.getCompilerOptions(); let languageVersion = compilerOptions.target || ScriptTarget.ES3; - let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; + let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; let diagnostics: Diagnostic[] = []; let newLine = host.getNewLine(); @@ -169,7 +169,7 @@ var __param = this.__param || function(index, decorator) { return function (targ /** Sourcemap data that will get encoded */ let sourceMapData: SourceMapData; - if (compilerOptions.sourceMap) { + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -564,19 +564,25 @@ var __param = this.__param || function(index, decorator) { return function (targ recordSourceMapSpan(comment.end); } - function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string) { + function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string, sourcesContent?: string[]) { if (typeof JSON !== "undefined") { - return JSON.stringify({ - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }); + let map: any = { + version, + file, + sourceRoot, + sources, + names, + mappings + }; + + if (sourcesContent !== undefined) { + map.sourcesContent = sourcesContent; + } + + return JSON.stringify(map); } - return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}"; + return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; function serializeStringArray(list: string[]): string { let output = ""; @@ -591,19 +597,34 @@ var __param = this.__param || function(index, decorator) { return function (targ } function writeJavaScriptAndSourceMapFile(emitOutput: string, writeByteOrderMark: boolean) { - // Write source map file encodeLastRecordedSourceMapSpan(); - writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents( + + let fileContents = compilerOptions.inlineSourceMap ? [currentSourceFile.text] : undefined; + let sourceMapText = serializeSourceMapContents( 3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, - sourceMapData.sourceMapMappings), /*writeByteOrderMark*/ false); + sourceMapData.sourceMapMappings, + fileContents); + sourceMapDataList.push(sourceMapData); + let sourceMapUrl: string; + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + let base64SourceMapText = convertToBase64(sourceMapText); + sourceMapUrl = `//# sourceMappingURL=data:application/json;base64,${base64SourceMapText}`; + } + else { + // Write source map file + writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); + sourceMapUrl = `//# sourceMappingURL=${sourceMapData.jsSourceMappingURL}`; + } + // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); } // Initialize source map data @@ -861,7 +882,7 @@ var __param = this.__param || function(index, decorator) { return function (targ function emitLiteral(node: LiteralExpression) { let text = getLiteralText(node); - if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } // For versions below ES6, emit binary & octal literals in their canonical decimal form. diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 69faeda2db0..8bf9d049b8d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -472,6 +472,21 @@ module ts { } } + if (options.inlineSourceMap) { + if (options.sourceMap) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.mapRoot) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.sourceRoot) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.out) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_inlineSourceMap)); + } + } + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 74777057963..8bddb943892 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1587,6 +1587,7 @@ module ts { diagnostics?: boolean; emitBOM?: boolean; help?: boolean; + inlineSourceMap?: boolean; listFiles?: boolean; locale?: string; mapRoot?: string; diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index d4dd8e31258..8b4e60f8f60 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -159,7 +159,7 @@ class CompilerBaselineRunner extends RunnerBase { // Source maps? it('Correct sourcemap content for ' + fileName, () => { - if (options.sourceMap) { + if (options.sourceMap || options.inlineSourceMap) { Harness.Baseline.runBaseline('Correct sourcemap content for ' + fileName, justName.replace(/\.ts$/, '.sourcemap.txt'), () => { var record = result.getSourceMapRecord(); if (options.noEmitOnError && result.errors.length !== 0 && record === undefined) { @@ -228,11 +228,14 @@ class CompilerBaselineRunner extends RunnerBase { }); it('Correct Sourcemap output for ' + fileName, () => { - if (options.sourceMap) { - if (result.sourceMaps.length !== result.files.length) { - throw new Error('Number of sourcemap files should be same as js files.'); - } + if (options.sourceMap && result.sourceMaps.length !== result.files.length) { + throw new Error('Number of sourcemap files should be same as js files.'); + } + else if (options.inlineSourceMap && result.sourceMaps.length > 0) { + throw new Error('No sourcemap files should be generated if inlineSourceMaps was set.'); + } + if (options.sourceMap) { Harness.Baseline.runBaseline('Correct Sourcemap output for ' + fileName, justName.replace(/\.ts/, '.js.map'), () => { 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. diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 784d8312d69..bef3c38cc01 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1016,6 +1016,10 @@ module Harness { options.sourceRoot = setting.value; break; + case 'maproot': + options.mapRoot = setting.value; + break; + case 'sourcemap': options.sourceMap = !!setting.value; break; @@ -1069,6 +1073,10 @@ module Harness { includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) }); break; + case 'inlinesourcemap': + options.inlineSourceMap = setting.value === 'true'; + break; + default: throw new Error('Unsupported compiler setting ' + setting.flag); } @@ -1465,7 +1473,7 @@ module Harness { "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal", - "separatecompilation"]; + "separatecompilation", "inlinesourcemap", "maproot", "sourceroot"]; function extractCompilerSettings(content: string): CompilerSetting[] { diff --git a/tests/baselines/reference/inlineSourceMap.errors.txt b/tests/baselines/reference/inlineSourceMap.errors.txt new file mode 100644 index 00000000000..8d92d6a161d --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/inlineSourceMap.ts(3,1): error TS2304: Cannot find name 'console'. + + +==== tests/cases/compiler/inlineSourceMap.ts (1 errors) ==== + + var x = 0; + console.log(x); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/inlineSourceMap.js b/tests/baselines/reference/inlineSourceMap.js new file mode 100644 index 00000000000..da0f6de96d3 --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap.js @@ -0,0 +1,9 @@ +//// [inlineSourceMap.ts] + +var x = 0; +console.log(x); + +//// [inlineSourceMap.js] +var x = 0; +console.log(x); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lU291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5saW5lU291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ== \ No newline at end of file diff --git a/tests/baselines/reference/inlineSourceMap.sourcemap.txt b/tests/baselines/reference/inlineSourceMap.sourcemap.txt new file mode 100644 index 00000000000..e344ecc43ab --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap.sourcemap.txt @@ -0,0 +1,61 @@ +=================================================================== +JsFile: inlineSourceMap.js +mapUrl: inlineSourceMap.js.map +sourceRoot: +sources: inlineSourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/inlineSourceMap.js +sourceFile:inlineSourceMap.ts +------------------------------------------------------------------- +>>>var x = 0; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^^^^-> +1 > + > +2 >var +3 > x +4 > = +5 > 0 +6 > ; +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(2, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(2, 9) + SourceIndex(0) +5 >Emitted(1, 10) Source(2, 10) + SourceIndex(0) +6 >Emitted(1, 11) Source(2, 11) + SourceIndex(0) +--- +>>>console.log(x); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >console +3 > . +4 > log +5 > ( +6 > x +7 > ) +8 > ; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(3, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(3, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(3, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(3, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(3, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(3, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(3, 16) + SourceIndex(0) +--- +>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lU291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5saW5lU291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ== \ No newline at end of file diff --git a/tests/baselines/reference/inlineSourceMap2.errors.txt b/tests/baselines/reference/inlineSourceMap2.errors.txt new file mode 100644 index 00000000000..f35aabd8fa6 --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap2.errors.txt @@ -0,0 +1,19 @@ +error TS5051: Option 'out' cannot be specified with option 'inlineSourceMap'. +error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. +error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'. + + +!!! error TS5051: Option 'out' cannot be specified with option 'inlineSourceMap'. +!!! error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ==== + + // configuration errors + + var x = 0; + console.log(x); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/inlineSourceMap2.js b/tests/baselines/reference/inlineSourceMap2.js new file mode 100644 index 00000000000..679b480af3e --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap2.js @@ -0,0 +1,12 @@ +//// [inlineSourceMap2.ts] + +// configuration errors + +var x = 0; +console.log(x); + +//// [outfile.js] +// configuration errors +var x = 0; +console.log(x); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsdUJBQXVCO0FBRXZCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbi8vIGNvbmZpZ3VyYXRpb24gZXJyb3JzXG5cbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ== \ No newline at end of file diff --git a/tests/baselines/reference/inlineSourceMap2.sourcemap.txt b/tests/baselines/reference/inlineSourceMap2.sourcemap.txt new file mode 100644 index 00000000000..3994efe82bf --- /dev/null +++ b/tests/baselines/reference/inlineSourceMap2.sourcemap.txt @@ -0,0 +1,71 @@ +=================================================================== +JsFile: outfile.js +mapUrl: file:///folder/outfile.js.map +sourceRoot: file:///folder/ +sources: inlineSourceMap2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outfile.js +sourceFile:inlineSourceMap2.ts +------------------------------------------------------------------- +>>>// configuration errors +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 >// configuration errors +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 24) Source(2, 24) + SourceIndex(0) +--- +>>>var x = 0; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^^^^-> +1 > + > + > +2 >var +3 > x +4 > = +5 > 0 +6 > ; +1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(4, 5) + SourceIndex(0) +3 >Emitted(2, 6) Source(4, 6) + SourceIndex(0) +4 >Emitted(2, 9) Source(4, 9) + SourceIndex(0) +5 >Emitted(2, 10) Source(4, 10) + SourceIndex(0) +6 >Emitted(2, 11) Source(4, 11) + SourceIndex(0) +--- +>>>console.log(x); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >console +3 > . +4 > log +5 > ( +6 > x +7 > ) +8 > ; +1->Emitted(3, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(3, 8) Source(5, 8) + SourceIndex(0) +3 >Emitted(3, 9) Source(5, 9) + SourceIndex(0) +4 >Emitted(3, 12) Source(5, 12) + SourceIndex(0) +5 >Emitted(3, 13) Source(5, 13) + SourceIndex(0) +6 >Emitted(3, 14) Source(5, 14) + SourceIndex(0) +7 >Emitted(3, 15) Source(5, 15) + SourceIndex(0) +8 >Emitted(3, 16) Source(5, 16) + SourceIndex(0) +--- +>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsdUJBQXVCO0FBRXZCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbi8vIGNvbmZpZ3VyYXRpb24gZXJyb3JzXG5cbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ== \ No newline at end of file diff --git a/tests/cases/compiler/inlineSourceMap.ts b/tests/cases/compiler/inlineSourceMap.ts new file mode 100644 index 00000000000..35e9845ba58 --- /dev/null +++ b/tests/cases/compiler/inlineSourceMap.ts @@ -0,0 +1,5 @@ +// @target: ES3 +// @inlinesourcemap: true + +var x = 0; +console.log(x); \ No newline at end of file diff --git a/tests/cases/compiler/inlineSourceMap2.ts b/tests/cases/compiler/inlineSourceMap2.ts new file mode 100644 index 00000000000..1d426f17736 --- /dev/null +++ b/tests/cases/compiler/inlineSourceMap2.ts @@ -0,0 +1,11 @@ +// @target: ES3 +// @sourcemap: true +// @maproot: file:///folder +// @sourceroot: file:///folder +// @out: outfile.js +// @inlinesourcemap: true + +// configuration errors + +var x = 0; +console.log(x); \ No newline at end of file