Skip to content

Commit 7a322d7

Browse files
authored
Merge pull request microsoft#23989 from a-tarasyuk/bug/23180-generate-source-maps-with-relative-path
microsoft#23180 - Generating source maps with relative path in sourceRoot option produces maps with absolute file paths
2 parents 5be8f1f + f007c35 commit 7a322d7

File tree

17 files changed

+30
-34
lines changed

17 files changed

+30
-34
lines changed

src/parser/commandLineParser.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,15 +475,13 @@ namespace ts {
475475
{
476476
name: "sourceRoot",
477477
type: "string",
478-
isFilePath: true,
479478
paramType: Diagnostics.LOCATION,
480479
category: Diagnostics.Source_Map_Options,
481480
description: Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
482481
},
483482
{
484483
name: "mapRoot",
485484
type: "string",
486-
isFilePath: true,
487485
paramType: Diagnostics.LOCATION,
488486
category: Diagnostics.Source_Map_Options,
489487
description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,

tests/baselines/reference/commonSourceDirectory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports.__esModule = true;
2424
var foo_1 = require("foo");
2525
var bar_1 = require("bar");
2626
foo_1.x + bar_1.y;
27-
//# sourceMappingURL=/app/myMapRoot/index.js.map
27+
//# sourceMappingURL=../myMapRoot/index.js.map
2828

2929
//// [/app/bin/index.d.ts]
3030
/// <reference path="../../types/bar.d.ts" />

tests/baselines/reference/commonSourceDirectory.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/commonSourceDirectory.sourcemap.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
===================================================================
22
JsFile: index.js
3-
mapUrl: /app/myMapRoot/index.js.map
4-
sourceRoot: /app/mySourceRoot/
3+
mapUrl: ../myMapRoot/index.js.map
4+
sourceRoot: mySourceRoot/
55
sources: index.ts
66
===================================================================
77
-------------------------------------------------------------------
@@ -43,7 +43,7 @@ sourceFile:index.ts
4343
3 > ^^^
4444
4 > ^^^^^^^
4545
5 > ^
46-
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
46+
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^->
4747
1 >
4848
>
4949
2 >x
@@ -56,4 +56,4 @@ sourceFile:index.ts
5656
4 >Emitted(6, 18) Source(4, 6) + SourceIndex(0)
5757
5 >Emitted(6, 19) Source(4, 7) + SourceIndex(0)
5858
---
59-
>>>//# sourceMappingURL=/app/myMapRoot/index.js.map
59+
>>>//# sourceMappingURL=../myMapRoot/index.js.map

tests/baselines/reference/commonSourceDirectory_dts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const x = y;
1515
exports.__esModule = true;
1616
/// <reference path="../lib/bar.d.ts" />
1717
exports.x = y;
18-
//# sourceMappingURL=/app/myMapRoot/index.js.map
18+
//# sourceMappingURL=../src/myMapRoot/index.js.map
1919

2020
//// [/app/bin/index.d.ts]
2121
/// <reference path="../lib/bar.d.ts" />

tests/baselines/reference/commonSourceDirectory_dts.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/commonSourceDirectory_dts.sourcemap.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
===================================================================
22
JsFile: index.js
3-
mapUrl: /app/myMapRoot/index.js.map
4-
sourceRoot: /app/mySourceRoot/
3+
mapUrl: ../src/myMapRoot/index.js.map
4+
sourceRoot: mySourceRoot/
55
sources: index.ts
66
===================================================================
77
-------------------------------------------------------------------
@@ -25,7 +25,7 @@ sourceFile:index.ts
2525
4 > ^^^
2626
5 > ^
2727
6 > ^
28-
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
28+
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2929
1 >
3030
>export const
3131
2 >
@@ -40,4 +40,4 @@ sourceFile:index.ts
4040
5 >Emitted(4, 14) Source(2, 19) + SourceIndex(0)
4141
6 >Emitted(4, 15) Source(2, 20) + SourceIndex(0)
4242
---
43-
>>>//# sourceMappingURL=/app/myMapRoot/index.js.map
43+
>>>//# sourceMappingURL=../src/myMapRoot/index.js.map

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4848

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

tests/cases/fourslash/getEditsForFileRename_tsconfig.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
////{
55
//// "compilerOptions": {
66
//// "baseUrl": "./old",
7-
//// "mapRoot": "../src/old",
87
//// "paths": {
98
//// "foo": ["old"],
109
//// },
@@ -25,7 +24,6 @@ verify.getEditsForFileRename({
2524
`{
2625
"compilerOptions": {
2726
"baseUrl": "new",
28-
"mapRoot": "new",
2927
"paths": {
3028
"foo": ["new"],
3129
},

0 commit comments

Comments
 (0)