mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:23:55 -05:00
Add --inlineSources option
This commit is contained in:
@@ -34,6 +34,10 @@ module ts {
|
||||
name: "inlineSourceMap",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "inlineSources",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "listFiles",
|
||||
type: "boolean",
|
||||
|
||||
@@ -455,7 +455,7 @@ module ts {
|
||||
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'." },
|
||||
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
|
||||
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." },
|
||||
|
||||
@@ -1808,7 +1808,7 @@
|
||||
"category": "Error",
|
||||
"code": 5050
|
||||
},
|
||||
"Option 'out' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": {
|
||||
"category": "Error",
|
||||
"code": 5051
|
||||
},
|
||||
|
||||
@@ -493,6 +493,13 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
|
||||
// The one that can be used from program to get the actual source file
|
||||
sourceMapData.inputSourceFileNames.push(node.fileName);
|
||||
|
||||
if (compilerOptions.inlineSources) {
|
||||
if (!sourceMapData.sourceMapSourcesContent) {
|
||||
sourceMapData.sourceMapSourcesContent = [];
|
||||
}
|
||||
sourceMapData.sourceMapSourcesContent.push(node.text);
|
||||
}
|
||||
}
|
||||
|
||||
function recordScopeNameOfNode(node: Node, scopeName?: string) {
|
||||
@@ -599,7 +606,6 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
function writeJavaScriptAndSourceMapFile(emitOutput: string, writeByteOrderMark: boolean) {
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
let fileContents = compilerOptions.inlineSourceMap ? [currentSourceFile.text] : undefined;
|
||||
let sourceMapText = serializeSourceMapContents(
|
||||
3,
|
||||
sourceMapData.sourceMapFile,
|
||||
@@ -607,7 +613,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
sourceMapData.sourceMapSources,
|
||||
sourceMapData.sourceMapNames,
|
||||
sourceMapData.sourceMapMappings,
|
||||
fileContents);
|
||||
sourceMapData.sourceMapSourcesContent);
|
||||
|
||||
sourceMapDataList.push(sourceMapData);
|
||||
|
||||
@@ -638,6 +644,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
inputSourceFileNames: [],
|
||||
sourceMapNames: [],
|
||||
sourceMapMappings: "",
|
||||
sourceMapSourcesContent: undefined,
|
||||
sourceMapDecodedMappings: []
|
||||
};
|
||||
|
||||
|
||||
@@ -484,8 +484,12 @@ module ts {
|
||||
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.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1092,14 +1092,15 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceMapData {
|
||||
sourceMapFilePath: string; // Where the sourcemap file is written
|
||||
jsSourceMappingURL: string; // source map URL written in the .js file
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
sourceMapFilePath: string; // Where the sourcemap file is written
|
||||
jsSourceMappingURL: string; // source map URL written in the .js file
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
sourceMapSourcesContent?: string[]; // Source map's sourcesContent field - list of the sources' text to be embedded in the source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
sourceMapDecodedMappings: SourceMapSpan[]; // Raw source map spans that were encoded into the sourceMapMappings
|
||||
}
|
||||
|
||||
@@ -1640,6 +1641,7 @@ module ts {
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
|
||||
@@ -1076,6 +1076,10 @@ module Harness {
|
||||
case 'inlinesourcemap':
|
||||
options.inlineSourceMap = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'inlinesources':
|
||||
options.inlineSources = setting.value === 'true';
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
@@ -1473,7 +1477,8 @@ module Harness {
|
||||
"noimplicitany", "noresolve", "newline", "newlines", "emitbom",
|
||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
||||
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
|
||||
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot"];
|
||||
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot",
|
||||
"inlinesources"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
|
||||
@@ -237,6 +237,9 @@ module Harness.SourceMapRecoder {
|
||||
sourceMapRecoder.WriteLine("mapUrl: " + sourceMapData.jsSourceMappingURL);
|
||||
sourceMapRecoder.WriteLine("sourceRoot: " + sourceMapData.sourceMapSourceRoot);
|
||||
sourceMapRecoder.WriteLine("sources: " + sourceMapData.sourceMapSources);
|
||||
if (sourceMapData.sourceMapSourcesContent) {
|
||||
sourceMapRecoder.WriteLine("sourcesContent: " + JSON.stringify(sourceMapData.sourceMapSourcesContent));
|
||||
}
|
||||
sourceMapRecoder.WriteLine("===================================================================");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ console.log(x);
|
||||
//// [inlineSourceMap.js]
|
||||
var x = 0;
|
||||
console.log(x);
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJz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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >console
|
||||
@@ -58,4 +58,4 @@ sourceFile:inlineSourceMap.ts
|
||||
7 >Emitted(2, 15) Source(3, 15) + SourceIndex(0)
|
||||
8 >Emitted(2, 16) Source(3, 16) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lU291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5saW5lU291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ==
|
||||
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lU291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5saW5lU291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMifQ==
|
||||
@@ -1,11 +1,9 @@
|
||||
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'.
|
||||
|
||||
@@ -9,4 +9,4 @@ console.log(x);
|
||||
// configuration errors
|
||||
var x = 0;
|
||||
console.log(x);
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsdUJBQXVCO0FBRXZCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbi8vIGNvbmZpZ3VyYXRpb24gZXJyb3JzXG5cbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYX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 15) Source(5, 15) + SourceIndex(0)
|
||||
8 >Emitted(3, 16) Source(5, 16) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsdUJBQXVCO0FBRXZCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbi8vIGNvbmZpZ3VyYXRpb24gZXJyb3JzXG5cbnZhciB4ID0gMDtcbmNvbnNvbGUubG9nKHgpOyJdfQ==
|
||||
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0ZmlsZS5qcyIsInNvdXJjZVJvb3QiOiJmaWxlOi8vL2ZvbGRlci8iLCJzb3VyY2VzIjpbImlubGluZVNvdXJjZU1hcDIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsdUJBQXVCO0FBRXZCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMifQ==
|
||||
16
tests/baselines/reference/inlineSources.errors.txt
Normal file
16
tests/baselines/reference/inlineSources.errors.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/a.ts(3,1): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/b.ts(2,1): error TS2304: Cannot find name 'console'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
|
||||
==== tests/cases/compiler/b.ts (1 errors) ====
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
17
tests/baselines/reference/inlineSources.js
Normal file
17
tests/baselines/reference/inlineSources.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/inlineSources.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
|
||||
//// [b.ts]
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
|
||||
//// [out.js]
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
//# sourceMappingURL=out.js.map
|
||||
2
tests/baselines/reference/inlineSources.js.map
Normal file
2
tests/baselines/reference/inlineSources.js.map
Normal file
@@ -0,0 +1,2 @@
|
||||
//// [out.js.map]
|
||||
{"version":3,"file":"out.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AACA,IAAI,CAAC,GAAG,CAAC,CAAC;AACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACFf,IAAI,CAAC,GAAG,CAAC,CAAC;AACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC","sourcesContent":["\nvar a = 0;\nconsole.log(a);\n","var b = 0;\nconsole.log(b);"]}
|
||||
114
tests/baselines/reference/inlineSources.sourcemap.txt
Normal file
114
tests/baselines/reference/inlineSources.sourcemap.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
===================================================================
|
||||
JsFile: out.js
|
||||
mapUrl: out.js.map
|
||||
sourceRoot:
|
||||
sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts
|
||||
sourcesContent: ["\nvar a = 0;\nconsole.log(a);\n","var b = 0;\nconsole.log(b);"]
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:out.js
|
||||
sourceFile:tests/cases/compiler/a.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var a = 0;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a
|
||||
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(a);
|
||||
1->
|
||||
2 >^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^
|
||||
8 > ^
|
||||
1->
|
||||
>
|
||||
2 >console
|
||||
3 > .
|
||||
4 > log
|
||||
5 > (
|
||||
6 > a
|
||||
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)
|
||||
---
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:out.js
|
||||
sourceFile:tests/cases/compiler/b.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var b = 0;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^^^^^->
|
||||
1 >
|
||||
2 >var
|
||||
3 > b
|
||||
4 > =
|
||||
5 > 0
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(1, 1) + SourceIndex(1)
|
||||
2 >Emitted(3, 5) Source(1, 5) + SourceIndex(1)
|
||||
3 >Emitted(3, 6) Source(1, 6) + SourceIndex(1)
|
||||
4 >Emitted(3, 9) Source(1, 9) + SourceIndex(1)
|
||||
5 >Emitted(3, 10) Source(1, 10) + SourceIndex(1)
|
||||
6 >Emitted(3, 11) Source(1, 11) + SourceIndex(1)
|
||||
---
|
||||
>>>console.log(b);
|
||||
1->
|
||||
2 >^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^
|
||||
8 > ^
|
||||
9 > ^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >console
|
||||
3 > .
|
||||
4 > log
|
||||
5 > (
|
||||
6 > b
|
||||
7 > )
|
||||
8 > ;
|
||||
1->Emitted(4, 1) Source(2, 1) + SourceIndex(1)
|
||||
2 >Emitted(4, 8) Source(2, 8) + SourceIndex(1)
|
||||
3 >Emitted(4, 9) Source(2, 9) + SourceIndex(1)
|
||||
4 >Emitted(4, 12) Source(2, 12) + SourceIndex(1)
|
||||
5 >Emitted(4, 13) Source(2, 13) + SourceIndex(1)
|
||||
6 >Emitted(4, 14) Source(2, 14) + SourceIndex(1)
|
||||
7 >Emitted(4, 15) Source(2, 15) + SourceIndex(1)
|
||||
8 >Emitted(4, 16) Source(2, 16) + SourceIndex(1)
|
||||
---
|
||||
>>>//# sourceMappingURL=out.js.map
|
||||
16
tests/baselines/reference/inlineSources2.errors.txt
Normal file
16
tests/baselines/reference/inlineSources2.errors.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/a.ts(3,1): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/b.ts(2,1): error TS2304: Cannot find name 'console'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
|
||||
==== tests/cases/compiler/b.ts (1 errors) ====
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
17
tests/baselines/reference/inlineSources2.js
Normal file
17
tests/baselines/reference/inlineSources2.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/inlineSources2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
|
||||
//// [b.ts]
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
|
||||
//// [out.js]
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidGVzdHMvY2FzZXMvY29tcGlsZXIvYS50cyIsInRlc3RzL2Nhc2VzL2NvbXBpbGVyL2IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQ0ZmLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbnZhciBhID0gMDtcbmNvbnNvbGUubG9nKGEpO1xuIiwidmFyIGIgPSAwO1xuY29uc29sZS5sb2coYik7Il19
|
||||
114
tests/baselines/reference/inlineSources2.sourcemap.txt
Normal file
114
tests/baselines/reference/inlineSources2.sourcemap.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
===================================================================
|
||||
JsFile: out.js
|
||||
mapUrl: out.js.map
|
||||
sourceRoot:
|
||||
sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts
|
||||
sourcesContent: ["\nvar a = 0;\nconsole.log(a);\n","var b = 0;\nconsole.log(b);"]
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:out.js
|
||||
sourceFile:tests/cases/compiler/a.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var a = 0;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a
|
||||
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(a);
|
||||
1->
|
||||
2 >^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^
|
||||
8 > ^
|
||||
1->
|
||||
>
|
||||
2 >console
|
||||
3 > .
|
||||
4 > log
|
||||
5 > (
|
||||
6 > a
|
||||
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)
|
||||
---
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:out.js
|
||||
sourceFile:tests/cases/compiler/b.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var b = 0;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^^^^^->
|
||||
1 >
|
||||
2 >var
|
||||
3 > b
|
||||
4 > =
|
||||
5 > 0
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(1, 1) + SourceIndex(1)
|
||||
2 >Emitted(3, 5) Source(1, 5) + SourceIndex(1)
|
||||
3 >Emitted(3, 6) Source(1, 6) + SourceIndex(1)
|
||||
4 >Emitted(3, 9) Source(1, 9) + SourceIndex(1)
|
||||
5 >Emitted(3, 10) Source(1, 10) + SourceIndex(1)
|
||||
6 >Emitted(3, 11) Source(1, 11) + SourceIndex(1)
|
||||
---
|
||||
>>>console.log(b);
|
||||
1->
|
||||
2 >^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^
|
||||
8 > ^
|
||||
9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >console
|
||||
3 > .
|
||||
4 > log
|
||||
5 > (
|
||||
6 > b
|
||||
7 > )
|
||||
8 > ;
|
||||
1->Emitted(4, 1) Source(2, 1) + SourceIndex(1)
|
||||
2 >Emitted(4, 8) Source(2, 8) + SourceIndex(1)
|
||||
3 >Emitted(4, 9) Source(2, 9) + SourceIndex(1)
|
||||
4 >Emitted(4, 12) Source(2, 12) + SourceIndex(1)
|
||||
5 >Emitted(4, 13) Source(2, 13) + SourceIndex(1)
|
||||
6 >Emitted(4, 14) Source(2, 14) + SourceIndex(1)
|
||||
7 >Emitted(4, 15) Source(2, 15) + SourceIndex(1)
|
||||
8 >Emitted(4, 16) Source(2, 16) + SourceIndex(1)
|
||||
---
|
||||
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidGVzdHMvY2FzZXMvY29tcGlsZXIvYS50cyIsInRlc3RzL2Nhc2VzL2NvbXBpbGVyL2IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQ0ZmLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbnZhciBhID0gMDtcbmNvbnNvbGUubG9nKGEpO1xuIiwidmFyIGIgPSAwO1xuY29uc29sZS5sb2coYik7Il19
|
||||
12
tests/cases/compiler/inlineSources.ts
Normal file
12
tests/cases/compiler/inlineSources.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @target: ES3
|
||||
// @sourcemap: true
|
||||
// @inlinesources: true
|
||||
// @out: out.js
|
||||
|
||||
// @filename: a.ts
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
|
||||
// @filename: b.ts
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
12
tests/cases/compiler/inlineSources2.ts
Normal file
12
tests/cases/compiler/inlineSources2.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @target: ES3
|
||||
// @inlinesourcemap: true
|
||||
// @inlinesources: true
|
||||
// @out: out.js
|
||||
|
||||
// @filename: a.ts
|
||||
var a = 0;
|
||||
console.log(a);
|
||||
|
||||
// @filename: b.ts
|
||||
var b = 0;
|
||||
console.log(b);
|
||||
Reference in New Issue
Block a user