Skip to content

Fixes use of combination of options sourceRoot and mapRoot with inlineSourceMap and inlineSources #5620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,16 +990,15 @@ namespace ts {
if (options.mapRoot) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
}
if (options.sourceRoot) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
}
}


if (options.inlineSources) {
if (!options.sourceMap && !options.inlineSourceMap) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
}
if (options.sourceRoot) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources"));
}
}

if (options.out && options.outFile) {
Expand All @@ -1011,10 +1010,9 @@ namespace ts {
if (options.mapRoot) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
}
if (options.sourceRoot) {
if (options.sourceRoot && !options.inlineSourceMap) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
}
return;
}

const languageVersion = options.target || ScriptTarget.ES3;
Expand Down
2 changes: 0 additions & 2 deletions tests/baselines/reference/inlineSourceMap2.errors.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'.


!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ====

// configuration errors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.


!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
==== tests/cases/compiler/optionsInlineSourceMapMapRoot.ts (0 errors) ====

var a = 10;
7 changes: 7 additions & 0 deletions tests/baselines/reference/optionsInlineSourceMapMapRoot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
===================================================================
JsFile: optionsInlineSourceMapMapRoot.js
mapUrl: local/optionsInlineSourceMapMapRoot.js.map
sourceRoot:
sources: ../optionsInlineSourceMapMapRoot.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsInlineSourceMapMapRoot.js
sourceFile:../optionsInlineSourceMapMapRoot.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9uc0lubGluZVNvdXJjZU1hcE1hcFJvb3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9vcHRpb25zSW5saW5lU291cmNlTWFwTWFwUm9vdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
7 changes: 7 additions & 0 deletions tests/baselines/reference/optionsInlineSourceMapSourceRoot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
===================================================================
JsFile: optionsInlineSourceMapSourceRoot.js
mapUrl: optionsInlineSourceMapSourceRoot.js.map
sourceRoot: local/
sources: optionsInlineSourceMapSourceRoot.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsInlineSourceMapSourceRoot.js
sourceFile:optionsInlineSourceMapSourceRoot.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9uc0lubGluZVNvdXJjZU1hcFNvdXJjZVJvb3QuanMiLCJzb3VyY2VSb290IjoibG9jYWwvIiwic291cmNlcyI6WyJvcHRpb25zSW5saW5lU291cmNlTWFwU291cmNlUm9vdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=== tests/cases/compiler/optionsInlineSourceMapSourceRoot.ts ===

var a = 10;
>a : Symbol(a, Decl(optionsInlineSourceMapSourceRoot.ts, 1, 3))

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/optionsInlineSourceMapSourceRoot.ts ===

var a = 10;
>a : number
>10 : number

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.


!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
==== tests/cases/compiler/optionsInlineSourceMapSourcemap.ts (0 errors) ====

var a = 10;
7 changes: 7 additions & 0 deletions tests/baselines/reference/optionsInlineSourceMapSourcemap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
===================================================================
JsFile: optionsInlineSourceMapSourcemap.js
mapUrl: optionsInlineSourceMapSourcemap.js.map
sourceRoot:
sources: optionsInlineSourceMapSourcemap.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsInlineSourceMapSourcemap.js
sourceFile:optionsInlineSourceMapSourcemap.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9uc0lubGluZVNvdXJjZU1hcFNvdXJjZW1hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm9wdGlvbnNJbmxpbmVTb3VyY2VNYXBTb3VyY2VtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDIn0=
7 changes: 7 additions & 0 deletions tests/baselines/reference/optionsSourcemapInlineSources.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
===================================================================
JsFile: optionsSourcemapInlineSources.js
mapUrl: optionsSourcemapInlineSources.js.map
sourceRoot:
sources: optionsSourcemapInlineSources.ts
sourcesContent: ["\nvar a = 10;"]
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsSourcemapInlineSources.js
sourceFile:optionsSourcemapInlineSources.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=optionsSourcemapInlineSources.js.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=== tests/cases/compiler/optionsSourcemapInlineSources.ts ===

var a = 10;
>a : Symbol(a, Decl(optionsSourcemapInlineSources.ts, 1, 3))

6 changes: 6 additions & 0 deletions tests/baselines/reference/optionsSourcemapInlineSources.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/optionsSourcemapInlineSources.ts ===

var a = 10;
>a : number
>10 : number

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
===================================================================
JsFile: optionsSourcemapInlineSourcesMapRoot.js
mapUrl: local/optionsSourcemapInlineSourcesMapRoot.js.map
sourceRoot:
sources: ../optionsSourcemapInlineSourcesMapRoot.ts
sourcesContent: ["\nvar a = 10;"]
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsSourcemapInlineSourcesMapRoot.js
sourceFile:../optionsSourcemapInlineSourcesMapRoot.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=local/optionsSourcemapInlineSourcesMapRoot.js.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=== tests/cases/compiler/optionsSourcemapInlineSourcesMapRoot.ts ===

var a = 10;
>a : Symbol(a, Decl(optionsSourcemapInlineSourcesMapRoot.ts, 1, 3))

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/optionsSourcemapInlineSourcesMapRoot.ts ===

var a = 10;
>a : number
>10 : number

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSources'.


!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSources'.
==== tests/cases/compiler/optionsSourcemapInlineSourcesSourceRoot.ts (0 errors) ====

var a = 10;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
===================================================================
JsFile: optionsSourcemapInlineSourcesSourceRoot.js
mapUrl: optionsSourcemapInlineSourcesSourceRoot.js.map
sourceRoot: local/
sources: optionsSourcemapInlineSourcesSourceRoot.ts
sourcesContent: ["\nvar a = 10;"]
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/optionsSourcemapInlineSourcesSourceRoot.js
sourceFile:optionsSourcemapInlineSourcesSourceRoot.ts
-------------------------------------------------------------------
>>>var a = 10;
1 >
2 >^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >var
3 > a
4 > =
5 > 10
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, 11) Source(2, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
---
>>>//# sourceMappingURL=optionsSourcemapInlineSourcesSourceRoot.js.map
4 changes: 4 additions & 0 deletions tests/cases/compiler/optionsInlineSourceMapMapRoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @mapRoot: local
// @inlineSourceMap: true

var a = 10;
Loading