Skip to content

Commit

Permalink
Merge pull request #23989 from a-tarasyuk/bug/23180-generate-source-m…
Browse files Browse the repository at this point in the history
…aps-with-relative-path

#23180 - Generating source maps with relative path in sourceRoot option produces maps with absolute file paths
  • Loading branch information
mhegazy authored Jun 12, 2018
2 parents 5be8f1f + f007c35 commit 7a322d7
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 34 deletions.
2 changes: 0 additions & 2 deletions src/parser/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,13 @@ namespace ts {
{
name: "sourceRoot",
type: "string",
isFilePath: true,
paramType: Diagnostics.LOCATION,
category: Diagnostics.Source_Map_Options,
description: Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
},
{
name: "mapRoot",
type: "string",
isFilePath: true,
paramType: Diagnostics.LOCATION,
category: Diagnostics.Source_Map_Options,
description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/commonSourceDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports.__esModule = true;
var foo_1 = require("foo");
var bar_1 = require("bar");
foo_1.x + bar_1.y;
//# sourceMappingURL=/app/myMapRoot/index.js.map
//# sourceMappingURL=../myMapRoot/index.js.map

//// [/app/bin/index.d.ts]
/// <reference path="../../types/bar.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/commonSourceDirectory.js.map

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

8 changes: 4 additions & 4 deletions tests/baselines/reference/commonSourceDirectory.sourcemap.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
===================================================================
JsFile: index.js
mapUrl: /app/myMapRoot/index.js.map
sourceRoot: /app/mySourceRoot/
mapUrl: ../myMapRoot/index.js.map
sourceRoot: mySourceRoot/
sources: index.ts
===================================================================
-------------------------------------------------------------------
Expand Down Expand Up @@ -43,7 +43,7 @@ sourceFile:index.ts
3 > ^^^
4 > ^^^^^^^
5 > ^
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >x
Expand All @@ -56,4 +56,4 @@ sourceFile:index.ts
4 >Emitted(6, 18) Source(4, 6) + SourceIndex(0)
5 >Emitted(6, 19) Source(4, 7) + SourceIndex(0)
---
>>>//# sourceMappingURL=/app/myMapRoot/index.js.map
>>>//# sourceMappingURL=../myMapRoot/index.js.map
2 changes: 1 addition & 1 deletion tests/baselines/reference/commonSourceDirectory_dts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const x = y;
exports.__esModule = true;
/// <reference path="../lib/bar.d.ts" />
exports.x = y;
//# sourceMappingURL=/app/myMapRoot/index.js.map
//# sourceMappingURL=../src/myMapRoot/index.js.map

//// [/app/bin/index.d.ts]
/// <reference path="../lib/bar.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/commonSourceDirectory_dts.js.map

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
@@ -1,7 +1,7 @@
===================================================================
JsFile: index.js
mapUrl: /app/myMapRoot/index.js.map
sourceRoot: /app/mySourceRoot/
mapUrl: ../src/myMapRoot/index.js.map
sourceRoot: mySourceRoot/
sources: index.ts
===================================================================
-------------------------------------------------------------------
Expand All @@ -25,7 +25,7 @@ sourceFile:index.ts
4 > ^^^
5 > ^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>export const
2 >
Expand All @@ -40,4 +40,4 @@ sourceFile:index.ts
5 >Emitted(4, 14) Source(2, 19) + SourceIndex(0)
6 >Emitted(4, 15) Source(2, 20) + SourceIndex(0)
---
>>>//# sourceMappingURL=/app/myMapRoot/index.js.map
>>>//# sourceMappingURL=../src/myMapRoot/index.js.map
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

Expand Down
2 changes: 0 additions & 2 deletions tests/cases/fourslash/getEditsForFileRename_tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
////{
//// "compilerOptions": {
//// "baseUrl": "./old",
//// "mapRoot": "../src/old",
//// "paths": {
//// "foo": ["old"],
//// },
Expand All @@ -25,7 +24,6 @@ verify.getEditsForFileRename({
`{
"compilerOptions": {
"baseUrl": "new",
"mapRoot": "new",
"paths": {
"foo": ["new"],
},
Expand Down

0 comments on commit 7a322d7

Please sign in to comment.