Skip to content

Commit 6a183d8

Browse files
committed
Add ability to pass declaration, declarationMap, emitDeclarationOnly, sourceMap and inlineSourceMap on commandline of --build
1 parent aada342 commit 6a183d8

File tree

48 files changed

+12920
-1194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+12920
-1194
lines changed

src/compiler/commandLineParser.ts

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,59 @@ namespace ts {
300300
transpileOptionValue: undefined,
301301
defaultValueDescription: Diagnostics.false_unless_composite_is_set
302302
},
303+
{
304+
name: "declaration",
305+
shortName: "d",
306+
type: "boolean",
307+
affectsEmit: true,
308+
affectsMultiFileEmitBuildInfo: true,
309+
showInSimplifiedHelpView: true,
310+
category: Diagnostics.Emit,
311+
transpileOptionValue: undefined,
312+
description: Diagnostics.Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project,
313+
defaultValueDescription: Diagnostics.false_unless_composite_is_set,
314+
},
315+
{
316+
name: "declarationMap",
317+
type: "boolean",
318+
affectsEmit: true,
319+
affectsMultiFileEmitBuildInfo: true,
320+
showInSimplifiedHelpView: true,
321+
category: Diagnostics.Emit,
322+
transpileOptionValue: undefined,
323+
defaultValueDescription: false,
324+
description: Diagnostics.Create_sourcemaps_for_d_ts_files
325+
},
326+
{
327+
name: "emitDeclarationOnly",
328+
type: "boolean",
329+
affectsEmit: true,
330+
affectsMultiFileEmitBuildInfo: true,
331+
showInSimplifiedHelpView: true,
332+
category: Diagnostics.Emit,
333+
description: Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
334+
transpileOptionValue: undefined,
335+
defaultValueDescription: false,
336+
},
337+
{
338+
name: "sourceMap",
339+
type: "boolean",
340+
affectsEmit: true,
341+
affectsMultiFileEmitBuildInfo: true,
342+
showInSimplifiedHelpView: true,
343+
category: Diagnostics.Emit,
344+
defaultValueDescription: false,
345+
description: Diagnostics.Create_source_map_files_for_emitted_JavaScript_files,
346+
},
347+
{
348+
name: "inlineSourceMap",
349+
type: "boolean",
350+
affectsEmit: true,
351+
affectsMultiFileEmitBuildInfo: true,
352+
category: Diagnostics.Emit,
353+
description: Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
354+
defaultValueDescription: false,
355+
},
303356
{
304357
name: "assumeChangesOnlyAffectDirectDependencies",
305358
type: "boolean",
@@ -488,51 +541,6 @@ namespace ts {
488541
description: Diagnostics.Specify_what_JSX_code_is_generated,
489542
defaultValueDescription: undefined,
490543
},
491-
{
492-
name: "declaration",
493-
shortName: "d",
494-
type: "boolean",
495-
affectsEmit: true,
496-
affectsMultiFileEmitBuildInfo: true,
497-
showInSimplifiedHelpView: true,
498-
category: Diagnostics.Emit,
499-
transpileOptionValue: undefined,
500-
description: Diagnostics.Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project,
501-
defaultValueDescription: Diagnostics.false_unless_composite_is_set,
502-
},
503-
{
504-
name: "declarationMap",
505-
type: "boolean",
506-
affectsEmit: true,
507-
affectsMultiFileEmitBuildInfo: true,
508-
showInSimplifiedHelpView: true,
509-
category: Diagnostics.Emit,
510-
transpileOptionValue: undefined,
511-
defaultValueDescription: false,
512-
description: Diagnostics.Create_sourcemaps_for_d_ts_files
513-
},
514-
{
515-
name: "emitDeclarationOnly",
516-
type: "boolean",
517-
affectsEmit: true,
518-
affectsMultiFileEmitBuildInfo: true,
519-
showInSimplifiedHelpView: true,
520-
521-
category: Diagnostics.Emit,
522-
description: Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
523-
transpileOptionValue: undefined,
524-
defaultValueDescription: false,
525-
},
526-
{
527-
name: "sourceMap",
528-
type: "boolean",
529-
affectsEmit: true,
530-
affectsMultiFileEmitBuildInfo: true,
531-
showInSimplifiedHelpView: true,
532-
category: Diagnostics.Emit,
533-
defaultValueDescription: false,
534-
description: Diagnostics.Create_source_map_files_for_emitted_JavaScript_files,
535-
},
536544
{
537545
name: "outFile",
538546
type: "string",
@@ -972,15 +980,6 @@ namespace ts {
972980
category: Diagnostics.Emit,
973981
description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
974982
},
975-
{
976-
name: "inlineSourceMap",
977-
type: "boolean",
978-
affectsEmit: true,
979-
affectsMultiFileEmitBuildInfo: true,
980-
category: Diagnostics.Emit,
981-
description: Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
982-
defaultValueDescription: false,
983-
},
984983
{
985984
name: "inlineSources",
986985
type: "boolean",

src/compiler/tsbuildPublic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ namespace ts {
1818
/*@internal*/ pretty?: boolean;
1919
incremental?: boolean;
2020
assumeChangesOnlyAffectDirectDependencies?: boolean;
21+
declaration?: boolean;
22+
declarationMap?: boolean;
23+
emitDeclarationOnly?: boolean;
24+
sourceMap?: boolean;
25+
inlineSourceMap?: boolean;
2126

2227
traceResolution?: boolean;
2328
/* @internal */ diagnostics?: boolean;

src/testRunner/unittests/config/commandLineParsing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ namespace ts {
220220
assertParseResult("parse build with --incremental", ["--incremental", "tests"]);
221221
assertParseResult("parse build with --locale en-us", ["--locale", "en-us", "src"]);
222222
assertParseResult("parse build with --tsBuildInfoFile", ["--tsBuildInfoFile", "build.tsbuildinfo", "tests"]);
223-
assertParseResult("reports other common may not be used with --build flags", ["--declaration", "--strict"]);
223+
assertParseResult("reports other common may not be used with --build flags", ["--strict"]);
224224

225225
describe("Combining options that make no sense together", () => {
226226
function verifyInvalidCombination(flag1: keyof BuildOptions, flag2: keyof BuildOptions) {

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5526,6 +5526,11 @@ declare namespace ts {
55265526
verbose?: boolean;
55275527
incremental?: boolean;
55285528
assumeChangesOnlyAffectDirectDependencies?: boolean;
5529+
declaration?: boolean;
5530+
declarationMap?: boolean;
5531+
emitDeclarationOnly?: boolean;
5532+
sourceMap?: boolean;
5533+
inlineSourceMap?: boolean;
55295534
traceResolution?: boolean;
55305535
[option: string]: CompilerOptionsValue | undefined;
55315536
}

tests/baselines/reference/api/typescript.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5526,6 +5526,11 @@ declare namespace ts {
55265526
verbose?: boolean;
55275527
incremental?: boolean;
55285528
assumeChangesOnlyAffectDirectDependencies?: boolean;
5529+
declaration?: boolean;
5530+
declarationMap?: boolean;
5531+
emitDeclarationOnly?: boolean;
5532+
sourceMap?: boolean;
5533+
inlineSourceMap?: boolean;
55295534
traceResolution?: boolean;
55305535
[option: string]: CompilerOptionsValue | undefined;
55315536
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
--declaration --strict
1+
--strict
22
buildOptions::
33
{}
44
WatchOptions::
55

66
Projects::
77
.
88
Errors::
9-
error TS5094: Compiler option '--declaration' may not be used with '--build'.
109
error TS5094: Compiler option '--strict' may not be used with '--build'.

tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5152
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5253
// "outDir": "./", /* Specify an output folder for all emitted files. */
5354
// "removeComments": true, /* Disable emitting comments. */
@@ -57,7 +58,6 @@
5758
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
5859
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
5960
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
6161
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
6262
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
6363
// "newLine": "crlf", /* Set the newline character for emitting files. */

tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5152
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5253
// "outDir": "./", /* Specify an output folder for all emitted files. */
5354
// "removeComments": true, /* Disable emitting comments. */
@@ -57,7 +58,6 @@
5758
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
5859
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
5960
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
6161
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
6262
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
6363
// "newLine": "crlf", /* Set the newline character for emitting files. */

tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5152
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5253
// "outDir": "./", /* Specify an output folder for all emitted files. */
5354
// "removeComments": true, /* Disable emitting comments. */
@@ -57,7 +58,6 @@
5758
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
5859
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
5960
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
6161
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
6262
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
6363
// "newLine": "crlf", /* Set the newline character for emitting files. */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5152
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5253
// "outDir": "./", /* Specify an output folder for all emitted files. */
5354
// "removeComments": true, /* Disable emitting comments. */
@@ -57,7 +58,6 @@
5758
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
5859
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
5960
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
6161
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
6262
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
6363
// "newLine": "crlf", /* Set the newline character for emitting files. */

0 commit comments

Comments
 (0)