Skip to content

Commit 437619e

Browse files
committed
BuildInfo options emit as a flag
1 parent a95d3cc commit 437619e

8 files changed

+345
-75
lines changed

Diff for: src/compiler/builder.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -960,15 +960,7 @@ namespace ts {
960960
for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
961961
const optionKey = name.toLowerCase();
962962
const optionInfo = optionsNameMap.get(optionKey);
963-
const emitOption = !isOutFile ?
964-
optionInfo?.affectsEmit || optionInfo?.affectsSemanticDiagnostics ||
965-
// We need to store `strict`, even though it won't be examined directly, so that the
966-
// flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
967-
optionKey === "strict" ||
968-
// We need to store these to determine whether `lib` files need to be rechecked.
969-
optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck" :
970-
optionInfo?.affectsOutFileBuildInfo;
971-
if (emitOption) {
963+
if (isOutFile ? optionInfo?.affectsOutFileBuildInfo : optionInfo?.affectsMultiFileBuildInfo) {
972964
(result ||= {})[name] = convertToReusableCompilerOptionValue(
973965
optionInfo,
974966
options[name] as CompilerOptionsValue,

Diff for: src/compiler/commandLineParser.ts

+73
Large diffs are not rendered by default.

Diff for: src/compiler/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6422,7 +6422,8 @@ namespace ts {
64226422
affectsEmit?: true; // true if the options affects emit
64236423
affectsProgramStructure?: true; // true if program should be reconstructed from root files if option changes and does not affect module resolution as affectsModuleResolution indirectly means program needs to reconstructed
64246424
affectsDeclarationPath?: true; // true if the options affects declaration file path computed
6425-
affectsOutFileBuildInfo?: true; // true if this options should be emitted in buildInfo with --out
6425+
affectsMultiFileBuildInfo?: true; // true if this options should be emitted in buildInfo without --out
6426+
affectsOutFileBuildInfo?: true; // true if this options should be emitted in buildInfo with --out
64266427
transpileOptionValue?: boolean | undefined; // If set this means that the option should be set to this value when transpiling
64276428
extraValidation?: (value: CompilerOptionsValue) => [DiagnosticMessage, ...string[]] | undefined; // Additional validation to be performed for the value to be valid
64286429
}

Diff for: tests/baselines/reference/tsbuild/emitDeclarationOnly/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export { C } from "./c";
120120
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
121121

122122
//// [/src/tsconfig.tsbuildinfo]
123-
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n","signature":"-4206296467-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":9000},"version":"FakeTSVersion"}
123+
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n","signature":"-4206296467-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"alwaysStrict":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":9000},"version":"FakeTSVersion"}
124124

125125
//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt]
126126
{
@@ -172,6 +172,7 @@ export { C } from "./c";
172172
}
173173
},
174174
"options": {
175+
"alwaysStrict": true,
175176
"composite": true,
176177
"declaration": true,
177178
"declarationMap": true,
@@ -226,7 +227,7 @@ export { C } from "./c";
226227
"dtsChangeTime": 9000
227228
},
228229
"version": "FakeTSVersion",
229-
"size": 1811
230+
"size": 1831
230231
}
231232

232233

@@ -273,7 +274,7 @@ export interface A {
273274
//// [/src/lib/index.d.ts] file written with same contents
274275
//// [/src/lib/index.d.ts.map] file written with same contents
275276
//// [/src/tsconfig.tsbuildinfo]
276-
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n","signature":"-7639584379-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":26000},"version":"FakeTSVersion"}
277+
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n","signature":"-7639584379-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"alwaysStrict":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":26000},"version":"FakeTSVersion"}
277278

278279
//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt]
279280
{
@@ -325,6 +326,7 @@ export interface A {
325326
}
326327
},
327328
"options": {
329+
"alwaysStrict": true,
328330
"composite": true,
329331
"declaration": true,
330332
"declarationMap": true,
@@ -379,6 +381,6 @@ export interface A {
379381
"dtsChangeTime": 26000
380382
},
381383
"version": "FakeTSVersion",
382-
"size": 1839
384+
"size": 1859
383385
}
384386

Diff for: tests/baselines/reference/tsbuild/emitDeclarationOnly/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export { C } from "./c";
108108

109109

110110
//// [/src/tsconfig.tsbuildinfo]
111-
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n","signature":"-4206296467-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":10000},"version":"FakeTSVersion"}
111+
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n","signature":"-4206296467-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"alwaysStrict":true,"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":10000},"version":"FakeTSVersion"}
112112

113113
//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt]
114114
{
@@ -160,6 +160,7 @@ export { C } from "./c";
160160
}
161161
},
162162
"options": {
163+
"alwaysStrict": true,
163164
"composite": true,
164165
"declaration": true,
165166
"emitDeclarationOnly": true,
@@ -213,7 +214,7 @@ export { C } from "./c";
213214
"dtsChangeTime": 10000
214215
},
215216
"version": "FakeTSVersion",
216-
"size": 1790
217+
"size": 1810
217218
}
218219

219220

@@ -254,7 +255,7 @@ export interface A {
254255
//// [/src/lib/c.d.ts] file written with same contents
255256
//// [/src/lib/index.d.ts] file written with same contents
256257
//// [/src/tsconfig.tsbuildinfo]
257-
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n","signature":"-7639584379-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":23000},"version":"FakeTSVersion"}
258+
{"program":{"fileNames":["../lib/lib.d.ts","./src/c.ts","./src/b.ts","./src/a.ts","./src/index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"},{"version":"-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n","signature":"-7639584379-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n"},{"version":"1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n","signature":"-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n"}],"options":{"alwaysStrict":true,"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2],[4],[2,3,4]],"referencedMap":[[4,1],[3,2],[2,3],[5,4]],"exportedModulesMap":[[4,1],[3,2],[2,3],[5,4]],"semanticDiagnosticsPerFile":[1,4,3,2,5],"dtsChangeTime":23000},"version":"FakeTSVersion"}
258259

259260
//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt]
260261
{
@@ -306,6 +307,7 @@ export interface A {
306307
}
307308
},
308309
"options": {
310+
"alwaysStrict": true,
309311
"composite": true,
310312
"declaration": true,
311313
"emitDeclarationOnly": true,
@@ -359,6 +361,6 @@ export interface A {
359361
"dtsChangeTime": 23000
360362
},
361363
"version": "FakeTSVersion",
362-
"size": 1817
364+
"size": 1837
363365
}
364366

0 commit comments

Comments
 (0)