Skip to content

Commit d52da06

Browse files
committed
Implement assumeChangesAffectShape which means any change to file can affect the dependencies
This avoids having to generate d.ts files for the sources
1 parent c61bc85 commit d52da06

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

src/compiler/builderState.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ namespace ts {
243243
referencedMap,
244244
exportedModulesMap,
245245
hasCalledUpdateShapeSignature,
246-
useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
246+
useFileVersionAsSignature: (!disableUseFileVersionAsSignature && !useOldState) ||
247+
!!newProgram.getCompilerOptions().assumeChangesAffectShape,
247248
};
248249
}
249250

tests/baselines/reference/tsc/incremental/initial-build/assumeChangesAffectShape.js

+28-15
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ exports.foo = foo;
136136

137137

138138
//// [/src/project/tsconfig.tsbuildinfo]
139-
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;",{"version":"-4300970970-export function foo(): string { return \"hello world\"; }","signature":"-8035635627-export declare function foo(): string;\r\n"},{"version":"-7083766686-import { foo } from \"./module\";foo();","signature":"-4882119183-export {};\r\n"}],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
139+
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;","-4300970970-export function foo(): string { return \"hello world\"; }","-7083766686-import { foo } from \"./module\";foo();"],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
140140

141141
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
142142
{
@@ -164,19 +164,23 @@ exports.foo = foo;
164164
},
165165
"./module.ts": {
166166
"version": "-4300970970-export function foo(): string { return \"hello world\"; }",
167-
"signature": "-8035635627-export declare function foo(): string;\r\n"
167+
"signature": "-4300970970-export function foo(): string { return \"hello world\"; }"
168168
},
169169
"./main.ts": {
170170
"version": "-7083766686-import { foo } from \"./module\";foo();",
171-
"signature": "-4882119183-export {};\r\n"
171+
"signature": "-7083766686-import { foo } from \"./module\";foo();"
172172
}
173173
},
174174
"referencedMap": {
175175
"./main.ts": [
176176
"./module.ts"
177177
]
178178
},
179-
"exportedModulesMap": {},
179+
"exportedModulesMap": {
180+
"./main.ts": [
181+
"./module.ts"
182+
]
183+
},
180184
"semanticDiagnosticsPerFile": [
181185
"../../lib/lib.d.ts",
182186
"./extrafile.ts",
@@ -185,7 +189,7 @@ exports.foo = foo;
185189
]
186190
},
187191
"version": "FakeTSVersion",
188-
"size": 1017
192+
"size": 888
189193
}
190194

191195

@@ -202,6 +206,7 @@ Output::
202206
exitCode:: ExitStatus.Success
203207

204208

209+
//// [/src/project/main.js] file written with same contents
205210
//// [/src/project/module.js]
206211
"use strict";
207212
exports.__esModule = true;
@@ -211,7 +216,7 @@ exports.foo = foo;
211216

212217

213218
//// [/src/project/tsconfig.tsbuildinfo]
214-
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;",{"version":"-3334720882-export function foo(): string { return \"hello world world\"; }","signature":"-8035635627-export declare function foo(): string;\r\n"},{"version":"-7083766686-import { foo } from \"./module\";foo();","signature":"-4882119183-export {};\r\n"}],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
219+
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;","-3334720882-export function foo(): string { return \"hello world world\"; }","-7083766686-import { foo } from \"./module\";foo();"],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
215220

216221
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
217222
{
@@ -239,19 +244,23 @@ exports.foo = foo;
239244
},
240245
"./module.ts": {
241246
"version": "-3334720882-export function foo(): string { return \"hello world world\"; }",
242-
"signature": "-8035635627-export declare function foo(): string;\r\n"
247+
"signature": "-3334720882-export function foo(): string { return \"hello world world\"; }"
243248
},
244249
"./main.ts": {
245250
"version": "-7083766686-import { foo } from \"./module\";foo();",
246-
"signature": "-4882119183-export {};\r\n"
251+
"signature": "-7083766686-import { foo } from \"./module\";foo();"
247252
}
248253
},
249254
"referencedMap": {
250255
"./main.ts": [
251256
"./module.ts"
252257
]
253258
},
254-
"exportedModulesMap": {},
259+
"exportedModulesMap": {
260+
"./main.ts": [
261+
"./module.ts"
262+
]
263+
},
255264
"semanticDiagnosticsPerFile": [
256265
"../../lib/lib.d.ts",
257266
"./extrafile.ts",
@@ -260,7 +269,7 @@ exports.foo = foo;
260269
]
261270
},
262271
"version": "FakeTSVersion",
263-
"size": 1023
272+
"size": 894
264273
}
265274

266275

@@ -288,7 +297,7 @@ exports.foo = foo;
288297

289298

290299
//// [/src/project/tsconfig.tsbuildinfo]
291-
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;",{"version":"-3842804408-export const x = 10;export function foo(): string { return \"hello world world\"; }","signature":"1387636182-export declare const x = 10;\r\nexport declare function foo(): string;\r\n"},{"version":"-7083766686-import { foo } from \"./module\";foo();","signature":"-4882119183-export {};\r\n"}],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
300+
{"program":{"fileNames":["../../lib/lib.d.ts","./extrafile.ts","./module.ts","./main.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},"-13403012629-export const extra = 10;","-3842804408-export const x = 10;export function foo(): string { return \"hello world world\"; }","-7083766686-import { foo } from \"./module\";foo();"],"fileIdsList":[[3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
292301

293302
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
294303
{
@@ -316,19 +325,23 @@ exports.foo = foo;
316325
},
317326
"./module.ts": {
318327
"version": "-3842804408-export const x = 10;export function foo(): string { return \"hello world world\"; }",
319-
"signature": "1387636182-export declare const x = 10;\r\nexport declare function foo(): string;\r\n"
328+
"signature": "-3842804408-export const x = 10;export function foo(): string { return \"hello world world\"; }"
320329
},
321330
"./main.ts": {
322331
"version": "-7083766686-import { foo } from \"./module\";foo();",
323-
"signature": "-4882119183-export {};\r\n"
332+
"signature": "-7083766686-import { foo } from \"./module\";foo();"
324333
}
325334
},
326335
"referencedMap": {
327336
"./main.ts": [
328337
"./module.ts"
329338
]
330339
},
331-
"exportedModulesMap": {},
340+
"exportedModulesMap": {
341+
"./main.ts": [
342+
"./module.ts"
343+
]
344+
},
332345
"semanticDiagnosticsPerFile": [
333346
"../../lib/lib.d.ts",
334347
"./extrafile.ts",
@@ -337,6 +350,6 @@ exports.foo = foo;
337350
]
338351
},
339352
"version": "FakeTSVersion",
340-
"size": 1074
353+
"size": 914
341354
}
342355

0 commit comments

Comments
 (0)