diff --git a/internal/diagnostics/diagnostics_generated.go b/internal/diagnostics/diagnostics_generated.go
index bb25f204aa..1c9410eeac 100644
--- a/internal/diagnostics/diagnostics_generated.go
+++ b/internal/diagnostics/diagnostics_generated.go
@@ -2276,7 +2276,7 @@ var Unknown_build_option_0 = &Message{code: 5072, category: CategoryError, key:
var Build_option_0_requires_a_value_of_type_1 = &Message{code: 5073, category: CategoryError, key: "Build_option_0_requires_a_value_of_type_1_5073", text: "Build option '{0}' requires a value of type {1}."}
-var Failed_to_update_timestamp_of_file_0 = &Message{code: 5074, category: CategoryMessage, key: "Failed_to_update_timestamp_of_file_0_5074", text: "Failed to update timestamp of file '{0}'."}
+var Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified = &Message{code: 5074, category: CategoryError, key: "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", text: "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."}
var X_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2 = &Message{code: 5075, category: CategoryError, key: "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", text: "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."}
diff --git a/internal/diagnostics/extraDiagnosticMessages.json b/internal/diagnostics/extraDiagnosticMessages.json
index 209b72db4b..b735a67695 100644
--- a/internal/diagnostics/extraDiagnosticMessages.json
+++ b/internal/diagnostics/extraDiagnosticMessages.json
@@ -35,10 +35,6 @@
"category": "Message",
"code": 6420
},
- "Failed to update timestamp of file '{0}'.": {
- "category": "Message",
- "code": 5074
- },
"Project '{0}' is out of date because it has errors.": {
"category": "Message",
"code": 6423
diff --git a/internal/execute/build/buildtask.go b/internal/execute/build/buildtask.go
index 5ee2c54593..846dc97120 100644
--- a/internal/execute/build/buildtask.go
+++ b/internal/execute/build/buildtask.go
@@ -661,16 +661,16 @@ func (t *buildTask) updateTimeStamps(orchestrator *Orchestrator, emittedFiles []
verboseMessageReported = true
}
err := orchestrator.host.SetMTime(file, now)
- if err != nil {
- t.reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Failed_to_update_timestamp_of_file_0, file))
- } else if file == buildInfoName {
- t.buildInfoEntryMu.Lock()
- if t.buildInfoEntry != nil {
- t.buildInfoEntry.mTime = now
+ if err == nil {
+ if file == buildInfoName {
+ t.buildInfoEntryMu.Lock()
+ if t.buildInfoEntry != nil {
+ t.buildInfoEntry.mTime = now
+ }
+ t.buildInfoEntryMu.Unlock()
+ } else if t.storeOutputTimeStamp(orchestrator) {
+ orchestrator.host.storeMTime(file, now)
}
- t.buildInfoEntryMu.Unlock()
- } else if t.storeOutputTimeStamp(orchestrator) {
- orchestrator.host.storeMTime(file, now)
}
}
diff --git a/internal/execute/tsctests/tscbuild_test.go b/internal/execute/tsctests/tscbuild_test.go
index 42e8251457..5c7a91b293 100644
--- a/internal/execute/tsctests/tscbuild_test.go
+++ b/internal/execute/tsctests/tscbuild_test.go
@@ -2062,6 +2062,65 @@ func TestBuildProgramUpdates(t *testing.T) {
cwd: "/user/username/projects/project",
commandLineArgs: []string{"--b", "-i", "-w"},
},
+ {
+ subScenario: "when root is source from project reference",
+ files: FileMap{
+ "/home/src/workspaces/project/lib/tsconfig.json": stringtestutil.Dedent(`
+ {
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./dist"
+ }
+ }`),
+ "/home/src/workspaces/project/lib/foo.ts": `export const FOO: string = 'THEFOOEXPORT';`,
+ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(`
+ {
+ "references": [ { "path": "./lib" } ]
+ }`),
+ "/home/src/workspaces/project/index.ts": `import { FOO } from "./lib/foo";`,
+ },
+ commandLineArgs: []string{"--b"},
+ edits: []*tscEdit{
+ {
+ caption: "dts doesnt change",
+ edit: func(sys *testSys) {
+ sys.appendFile("/home/src/workspaces/project/lib/foo.ts", "const Bar = 10;")
+ },
+ },
+ },
+ cwd: "/home/src/workspaces/project",
+ },
+ {
+ subScenario: "when root is source from project reference with composite",
+ files: FileMap{
+ "/home/src/workspaces/project/lib/tsconfig.json": stringtestutil.Dedent(`
+ {
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./dist"
+ }
+ }`),
+ "/home/src/workspaces/project/lib/foo.ts": `export const FOO: string = 'THEFOOEXPORT';`,
+ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(`
+ {
+ "compilerOptions": {
+ "composite": true,
+ },
+ "references": [ { "path": "./lib" } ]
+ }`),
+ "/home/src/workspaces/project/index.ts": `import { FOO } from "./lib/foo";`,
+ },
+ commandLineArgs: []string{"--b"},
+ edits: []*tscEdit{
+ {
+ caption: "dts doesnt change",
+ edit: func(sys *testSys) {
+ sys.appendFile("/home/src/workspaces/project/lib/foo.ts", "const Bar = 10;")
+ },
+ },
+ },
+ cwd: "/home/src/workspaces/project",
+ },
}
for _, test := range testCases {
test.run(t, "programUpdates")
diff --git a/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference-with-composite.js b/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference-with-composite.js
new file mode 100644
index 0000000000..63a099b0cb
--- /dev/null
+++ b/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference-with-composite.js
@@ -0,0 +1,276 @@
+currentDirectory::/home/src/workspaces/project
+useCaseSensitiveFileNames::true
+Input::
+//// [/home/src/workspaces/project/index.ts] *new*
+import { FOO } from "./lib/foo";
+//// [/home/src/workspaces/project/lib/foo.ts] *new*
+export const FOO: string = 'THEFOOEXPORT';
+//// [/home/src/workspaces/project/lib/tsconfig.json] *new*
+{
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./dist"
+ }
+}
+//// [/home/src/workspaces/project/tsconfig.json] *new*
+{
+ "compilerOptions": {
+ "composite": true,
+ },
+ "references": [ { "path": "./lib" } ]
+}
+
+tsgo --b
+ExitStatus:: Success
+Output::
+//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+interface ReadonlyArray {}
+interface SymbolConstructor {
+ (desc?: string | number): symbol;
+ for(name: string): symbol;
+ readonly toStringTag: symbol;
+}
+declare var Symbol: SymbolConstructor;
+interface Symbol {
+ readonly [Symbol.toStringTag]: string;
+}
+declare const console: { log(msg: any): void; };
+//// [/home/src/workspaces/project/index.d.ts] *new*
+export {};
+
+//// [/home/src/workspaces/project/index.js] *new*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+
+//// [/home/src/workspaces/project/lib/dist/foo.d.ts] *new*
+export declare const FOO: string;
+
+//// [/home/src/workspaces/project/lib/dist/foo.js] *new*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FOO = void 0;
+exports.FOO = 'THEFOOEXPORT';
+
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo] *new*
+{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../foo.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';","signature":"4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./foo.d.ts"}
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "../foo.ts"
+ ],
+ "original": 2
+ }
+ ],
+ "fileNames": [
+ "lib.d.ts",
+ "../foo.ts"
+ ],
+ "fileInfos": [
+ {
+ "fileName": "lib.d.ts",
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": 1
+ }
+ },
+ {
+ "fileName": "../foo.ts",
+ "version": "7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": 1
+ }
+ }
+ ],
+ "options": {
+ "composite": true,
+ "outDir": "./"
+ },
+ "latestChangedDtsFile": "./foo.d.ts",
+ "size": 1133
+}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new*
+{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.d.ts","./lib/dist/foo.d.ts","./index.ts","./lib/foo.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",{"version":"e7dbb9e054d23568235510c49ab58ce3-import { FOO } from \"./lib/foo\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"composite":true},"referencedMap":[[3,1]],"latestChangedDtsFile":"./index.d.ts","resolvedRoot":[[2,4]]}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "./lib/dist/foo.d.ts",
+ "./index.ts"
+ ],
+ "original": [
+ 2,
+ 3
+ ]
+ }
+ ],
+ "fileNames": [
+ "lib.d.ts",
+ "./lib/dist/foo.d.ts",
+ "./index.ts",
+ "./lib/foo.ts"
+ ],
+ "fileInfos": [
+ {
+ "fileName": "lib.d.ts",
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": 1
+ }
+ },
+ {
+ "fileName": "./lib/dist/foo.d.ts",
+ "version": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": "CommonJS"
+ },
+ {
+ "fileName": "./index.ts",
+ "version": "e7dbb9e054d23568235510c49ab58ce3-import { FOO } from \"./lib/foo\";",
+ "signature": "abe7d9981d6018efb6b2b794f40a1607-export {};\n",
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "e7dbb9e054d23568235510c49ab58ce3-import { FOO } from \"./lib/foo\";",
+ "signature": "abe7d9981d6018efb6b2b794f40a1607-export {};\n",
+ "impliedNodeFormat": 1
+ }
+ }
+ ],
+ "fileIdsList": [
+ [
+ "./lib/dist/foo.d.ts"
+ ]
+ ],
+ "options": {
+ "composite": true
+ },
+ "referencedMap": {
+ "./index.ts": [
+ "./lib/dist/foo.d.ts"
+ ]
+ },
+ "latestChangedDtsFile": "./index.d.ts",
+ "resolvedRoot": [
+ [
+ "./lib/dist/foo.d.ts",
+ "./lib/foo.ts"
+ ]
+ ],
+ "size": 1270
+}
+
+lib/tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
+*refresh* /home/src/workspaces/project/lib/foo.ts
+Signatures::
+(stored at emit) /home/src/workspaces/project/lib/foo.ts
+
+tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
+*refresh* /home/src/workspaces/project/lib/dist/foo.d.ts
+*refresh* /home/src/workspaces/project/index.ts
+Signatures::
+(stored at emit) /home/src/workspaces/project/index.ts
+
+
+Edit [0]:: dts doesnt change
+//// [/home/src/workspaces/project/lib/foo.ts] *modified*
+export const FOO: string = 'THEFOOEXPORT';const Bar = 10;
+
+tsgo --b
+ExitStatus:: Success
+Output::
+//// [/home/src/workspaces/project/lib/dist/foo.js] *modified*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FOO = void 0;
+exports.FOO = 'THEFOOEXPORT';
+const Bar = 10;
+
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo] *modified*
+{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../foo.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;","signature":"4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./foo.d.ts"}
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *modified*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "../foo.ts"
+ ],
+ "original": 2
+ }
+ ],
+ "fileNames": [
+ "lib.d.ts",
+ "../foo.ts"
+ ],
+ "fileInfos": [
+ {
+ "fileName": "lib.d.ts",
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": 1
+ }
+ },
+ {
+ "fileName": "../foo.ts",
+ "version": "e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": 1
+ }
+ }
+ ],
+ "options": {
+ "composite": true,
+ "outDir": "./"
+ },
+ "latestChangedDtsFile": "./foo.d.ts",
+ "size": 1148
+}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *mTime changed*
+
+lib/tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/workspaces/project/lib/foo.ts
+Signatures::
+(computed .d.ts) /home/src/workspaces/project/lib/foo.ts
diff --git a/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference.js b/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference.js
new file mode 100644
index 0000000000..76ae0088b6
--- /dev/null
+++ b/testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference.js
@@ -0,0 +1,248 @@
+currentDirectory::/home/src/workspaces/project
+useCaseSensitiveFileNames::true
+Input::
+//// [/home/src/workspaces/project/index.ts] *new*
+import { FOO } from "./lib/foo";
+//// [/home/src/workspaces/project/lib/foo.ts] *new*
+export const FOO: string = 'THEFOOEXPORT';
+//// [/home/src/workspaces/project/lib/tsconfig.json] *new*
+{
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./dist"
+ }
+}
+//// [/home/src/workspaces/project/tsconfig.json] *new*
+{
+ "references": [ { "path": "./lib" } ]
+}
+
+tsgo --b
+ExitStatus:: Success
+Output::
+//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+interface ReadonlyArray {}
+interface SymbolConstructor {
+ (desc?: string | number): symbol;
+ for(name: string): symbol;
+ readonly toStringTag: symbol;
+}
+declare var Symbol: SymbolConstructor;
+interface Symbol {
+ readonly [Symbol.toStringTag]: string;
+}
+declare const console: { log(msg: any): void; };
+//// [/home/src/workspaces/project/index.js] *new*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+
+//// [/home/src/workspaces/project/lib/dist/foo.d.ts] *new*
+export declare const FOO: string;
+
+//// [/home/src/workspaces/project/lib/dist/foo.js] *new*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FOO = void 0;
+exports.FOO = 'THEFOOEXPORT';
+
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo] *new*
+{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../foo.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';","signature":"4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./foo.d.ts"}
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "../foo.ts"
+ ],
+ "original": 2
+ }
+ ],
+ "fileNames": [
+ "lib.d.ts",
+ "../foo.ts"
+ ],
+ "fileInfos": [
+ {
+ "fileName": "lib.d.ts",
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": 1
+ }
+ },
+ {
+ "fileName": "../foo.ts",
+ "version": "7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "7f94c001790f66ce6f219bcc674cfb1b-export const FOO: string = 'THEFOOEXPORT';",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": 1
+ }
+ }
+ ],
+ "options": {
+ "composite": true,
+ "outDir": "./"
+ },
+ "latestChangedDtsFile": "./foo.d.ts",
+ "size": 1133
+}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new*
+{"version":"FakeTSVersion","root":["./index.ts","./lib/foo.ts"]}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "./index.ts"
+ ],
+ "original": "./index.ts"
+ },
+ {
+ "files": [
+ "./lib/foo.ts"
+ ],
+ "original": "./lib/foo.ts"
+ }
+ ],
+ "size": 64
+}
+
+lib/tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
+*refresh* /home/src/workspaces/project/lib/foo.ts
+Signatures::
+(stored at emit) /home/src/workspaces/project/lib/foo.ts
+
+tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
+*refresh* /home/src/workspaces/project/lib/dist/foo.d.ts
+*refresh* /home/src/workspaces/project/index.ts
+Signatures::
+
+
+Edit [0]:: dts doesnt change
+//// [/home/src/workspaces/project/lib/foo.ts] *modified*
+export const FOO: string = 'THEFOOEXPORT';const Bar = 10;
+
+tsgo --b
+ExitStatus:: Success
+Output::
+//// [/home/src/workspaces/project/index.js] *rewrite with same content*
+//// [/home/src/workspaces/project/lib/dist/foo.js] *modified*
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FOO = void 0;
+exports.FOO = 'THEFOOEXPORT';
+const Bar = 10;
+
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo] *modified*
+{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../foo.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;","signature":"4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./foo.d.ts"}
+//// [/home/src/workspaces/project/lib/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *modified*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "../foo.ts"
+ ],
+ "original": 2
+ }
+ ],
+ "fileNames": [
+ "lib.d.ts",
+ "../foo.ts"
+ ],
+ "fileInfos": [
+ {
+ "fileName": "lib.d.ts",
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedNodeFormat": 1
+ }
+ },
+ {
+ "fileName": "../foo.ts",
+ "version": "e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": "CommonJS",
+ "original": {
+ "version": "e604530e5ce616e2409bd4c7aa5fd3ff-export const FOO: string = 'THEFOOEXPORT';const Bar = 10;",
+ "signature": "4ea8c248dd335c2208c4fdcf4812cc6f-export declare const FOO: string;\n",
+ "impliedNodeFormat": 1
+ }
+ }
+ ],
+ "options": {
+ "composite": true,
+ "outDir": "./"
+ },
+ "latestChangedDtsFile": "./foo.d.ts",
+ "size": 1148
+}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified*
+{"version":"FakeTSVersion","root":["./index.ts","./lib/foo.ts","./lib/dist/foo.d.ts"]}
+//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified*
+{
+ "version": "FakeTSVersion",
+ "root": [
+ {
+ "files": [
+ "./index.ts"
+ ],
+ "original": "./index.ts"
+ },
+ {
+ "files": [
+ "./lib/foo.ts"
+ ],
+ "original": "./lib/foo.ts"
+ },
+ {
+ "files": [
+ "./lib/dist/foo.d.ts"
+ ],
+ "original": "./lib/dist/foo.d.ts"
+ }
+ ],
+ "size": 86
+}
+
+lib/tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/workspaces/project/lib/foo.ts
+Signatures::
+(computed .d.ts) /home/src/workspaces/project/lib/foo.ts
+
+tsconfig.json::
+SemanticDiagnostics::
+*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
+*refresh* /home/src/workspaces/project/lib/dist/foo.d.ts
+*refresh* /home/src/workspaces/project/index.ts
+Signatures::
diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-without-rootDir-but-outside-configDirectory-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-without-rootDir-but-outside-configDirectory-non-composite.js
index 0be2c66141..a872caddc9 100644
--- a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-without-rootDir-but-outside-configDirectory-non-composite.js
+++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-without-rootDir-but-outside-configDirectory-non-composite.js
@@ -45,7 +45,6 @@ project/src/index.ts
Matched by include pattern 'src/**/*' in 'project/tsconfig.json'
[[90mHH:MM:SS AM[0m] Updating unchanged output timestamps of project 'project/tsconfig.json'...
-[94mmessage[0m[90m TS5074: [0mFailed to update timestamp of file '/home/src/workspaces/solution/project/dist/index.js'.
//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
///
interface Boolean {}