Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ab7cb27
Add compiler option to enable declaration sourcemaps
weswigham Feb 15, 2018
91cc19c
Transparent goto definition for sourcemapped declaration files
weswigham Feb 17, 2018
c291828
Post-rebase touchups
weswigham Mar 16, 2018
2b26a27
Rename API methods
weswigham Mar 16, 2018
ec44da5
Fix lints
weswigham Mar 16, 2018
ffb7f85
Fix typo in name XD
weswigham Mar 16, 2018
589ac28
Log sourcemap decode errors
weswigham Mar 16, 2018
5584a2d
Share the cache more, but also invalidate it more
weswigham Mar 16, 2018
238ba98
Remove todo
weswigham Mar 16, 2018
ff158cf
Enable mapping on go to implementation as well
weswigham Mar 17, 2018
b9f6149
Allow fourslash to test declaration maps mroe easily
weswigham Mar 19, 2018
53f72de
more test
weswigham Mar 19, 2018
29c732e
Merge branch 'master' into decl-maps
weswigham Mar 19, 2018
6070108
Handle sourceRoot
weswigham Mar 19, 2018
0a63553
Add tests documenting current behavior with other sourcemapping flags
weswigham Mar 19, 2018
d8480b2
Ignore inline options for declaration file maps, simplify dispatch in…
weswigham Mar 20, 2018
ca88d5e
Change program diagnostic
weswigham Mar 20, 2018
2b231d7
Fix nit
weswigham Mar 20, 2018
fed6132
Use charCodeAt
weswigham Mar 20, 2018
509e4f3
Rename internal methods + veriables
weswigham Mar 20, 2018
0c44ba1
Avoid filter
weswigham Mar 20, 2018
c8620e3
span -> position
weswigham Mar 20, 2018
5687e10
Use character codes
weswigham Mar 20, 2018
e64e73d
Dont parse our sourcemap names until we need to start using them
weswigham Mar 20, 2018
47e701a
zero-index parsed positions
weswigham Mar 20, 2018
6a467ba
Handle sourceMappingURL comments, including base64 encoded ones
weswigham Mar 20, 2018
f2c8d3f
Unittest b64 decoder, make mroe robust to handle unicode properly
weswigham Mar 20, 2018
bd9cccf
Fix lint
weswigham Mar 20, 2018
c7a5296
declarationMaps -> declarationMap
weswigham Mar 20, 2018
f6e81f2
Merge branch 'master' into decl-maps
weswigham Mar 24, 2018
d0a5e28
Even more feedback
weswigham Mar 24, 2018
943dc12
USE Mroe lenient combined regexp
weswigham Mar 26, 2018
265cc1a
only match base64 characters
weswigham Mar 26, 2018
e34a6bd
Fix nit
weswigham Mar 26, 2018
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
Prev Previous commit
Next Next commit
declarationMaps -> declarationMap
  • Loading branch information
weswigham committed Mar 20, 2018
commit c7a52967e887e9a882c48bcc075d2f3fbb32f164
2 changes: 1 addition & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace ts {
description: Diagnostics.Generates_corresponding_d_ts_file,
},
{
name: "declarationMaps",
name: "declarationMap",
type: "boolean",
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ namespace ts {
}

export function getAreDeclarationMapsEnabled(options: CompilerOptions) {
return !!(options.declaration && options.declarationMaps);
return !!(options.declaration && options.declarationMap);
}

export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace ts {
const writer = createTextWriter(newLine);
const sourceMap = createSourceMapWriter(host, writer);
const declarationSourceMap = createSourceMapWriter(host, writer, {
sourceMap: compilerOptions.declarationMaps,
sourceMap: compilerOptions.declarationMap,
sourceRoot: compilerOptions.sourceRoot,
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,9 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile");
}

if (options.mapRoot && !(options.sourceMap || options.declarationMaps)) {
if (options.mapRoot && !(options.sourceMap || options.declarationMap)) {
// Error to specify --mapRoot without --sourcemap
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMaps");
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap");
}

if (options.declarationDir) {
Expand All @@ -2125,8 +2125,8 @@ namespace ts {
}
}

if (options.declarationMaps && !options.declaration) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationMaps", "declaration");
if (options.declarationMap && !options.declaration) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationMap", "declaration");
}

if (options.lib && options.noLib) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,7 @@ namespace ts {
/** configFile is set as non enumerable property so as to avoid checking of json source files */
/* @internal */ readonly configFile?: JsonSourceFile;
declaration?: boolean;
declarationMaps?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
/* @internal */ diagnostics?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/harness/compilerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CompilerBaselineRunner extends RunnerBase {

// Source maps?
it("Correct sourcemap content for " + fileName, () => {
if (options.sourceMap || options.inlineSourceMap || options.declarationMaps) {
if (options.sourceMap || options.inlineSourceMap || options.declarationMap) {
Harness.Baseline.runBaseline(justName.replace(/\.tsx?$/, ".sourcemap.txt"), () => {
const record = result.getSourceMapRecord();
if ((options.noEmitOnError && result.errors.length !== 0) || record === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
declarationMaps?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
declarationMaps?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error TS5052: Option 'declarationMaps' cannot be specified without specifying option 'declaration'.
error TS5052: Option 'declarationMap' cannot be specified without specifying option 'declaration'.


!!! error TS5052: Option 'declarationMaps' cannot be specified without specifying option 'declaration'.
!!! error TS5052: Option 'declarationMap' cannot be specified without specifying option 'declaration'.
==== tests/cases/compiler/declarationMapsWithoutDeclaration.ts (0 errors) ====
module m2 {
export interface connectModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.


!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.
==== tests/cases/compiler/optionsInlineSourceMapMapRoot.ts (0 errors) ====
var a = 10;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error TS5051: Option 'sourceRoot can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.


!!! error TS5051: Option 'sourceRoot can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error TS5051: Option 'sourceRoot can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.


!!! error TS5051: Option 'sourceRoot can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.


!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.


!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMaps'.
!!! error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMaps": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMaps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
module m2 {
export interface connectModule {
(res, req, next): void;
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMapsMultifile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @filename: a.ts
export class Foo {
doThing(x: {a: number}) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMapsOutFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @module: amd
// @outFile: bundle.js
// @filename: a.ts
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMapsOutFile2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @outFile: bundle.js
// @filename: a.ts
class Foo {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMapsWithSourceMap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @outFile: bundle.js
// @sourceMap: true
// @filename: a.ts
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/declarationMapsWithoutDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @declarationMaps: true
// @declarationMap: true
module m2 {
export interface connectModule {
(res, req, next): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @outDir: ./dist
// @inlineSourceMap: true
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @Filename: index.ts
// @emitThisFile: true
////export class Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @inlineSourceMap: true
// @inlineSources: true
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @Filename: index.ts
// @emitThisFile: true
////export class Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @BaselineFile: declarationMapsGeneratedMapsEnableMapping.baseline
// @outDir: ./dist
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @Filename: index.ts
// @emitThisFile: true
////export class Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @sourceMap: true
// @sourceRoot: /tests/cases/fourslash/
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @Filename: index.ts
// @emitThisFile: true
////export class Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @outDir: ./dist
// @sourceRoot: /tests/cases/fourslash/
// @declaration: true
// @declarationMaps: true
// @declarationMap: true
// @Filename: index.ts
// @emitThisFile: true
////export class Foo {
Expand Down