diff --git a/internal/compiler/program.go b/internal/compiler/program.go index e01154c7631..91266e18ad2 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -843,6 +843,45 @@ func (p *Program) verifyCompilerOptions() { } } + if !options.NoEmit.IsTrue() && + !options.Composite.IsTrue() && + options.RootDir == "" && + options.ConfigFilePath != "" && + (options.OutDir != "" || + (options.GetEmitDeclarations() && options.DeclarationDir != "") || + options.OutFile != "") { + // Check if rootDir inferred changed and issue diagnostic + dir := p.CommonSourceDirectory() + var emittedFiles []string + for _, file := range p.files { + if !file.IsDeclarationFile && sourceFileMayBeEmitted(file, p, false) { + emittedFiles = append(emittedFiles, file.FileName()) + } + } + dir59 := outputpaths.GetComputedCommonSourceDirectory(emittedFiles, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()) + if dir59 != "" && tspath.GetCanonicalFileName(dir, p.UseCaseSensitiveFileNames()) != tspath.GetCanonicalFileName(dir59, p.UseCaseSensitiveFileNames()) { + option1 := "outDir" + if options.OutFile != "" { + option1 = "outFile" + } else if options.OutDir == "" { + option1 = "declarationDir" + } + option2 := "" + if options.OutFile == "" && options.OutDir != "" { + option2 = "declarationDir" + } + diag := createDiagnosticForOption( + true, /*onKey*/ + option1, + option2, + diagnostics.The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout, + tspath.GetBaseFileName(options.ConfigFilePath), + tspath.GetRelativePathFromFile(options.ConfigFilePath, dir59, tspath.ComparePathsOptions{UseCaseSensitiveFileNames: p.UseCaseSensitiveFileNames()}), + ) + diag.AddMessageChain(ast.NewCompilerDiagnostic(diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information)) + } + } + if options.CheckJs.IsTrue() && !options.GetAllowJS() { createDiagnosticForOptionName(diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs") } diff --git a/internal/execute/tsctests/tsc_test.go b/internal/execute/tsctests/tsc_test.go index 2cb98866231..e2125adec4c 100644 --- a/internal/execute/tsctests/tsc_test.go +++ b/internal/execute/tsctests/tsc_test.go @@ -993,6 +993,52 @@ func TestTscExtends(t *testing.T) { } } +func TestTscOutDirWithParentDirInclude(t *testing.T) { + t.Parallel() + testCases := []*tscInput{ + { + subScenario: "outDir when include references parent directories", + files: FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "target": "ES2024", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "${configDir}/dist/", + "strict": true, + "skipLibCheck": true + }, + "include": ["common/src/**/*"] + }`), + "/home/src/workspaces/project/common/src/greeter.ts": stringtestutil.Dedent(` + export function greet(name: string): string { + return "Hello, " + name + "!"; + } + `), + "/home/src/workspaces/project/sub/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../tsconfig.json", + "include": [ + "src/**/*", + "../common/src/**/*" + ] + }`), + "/home/src/workspaces/project/sub/src/index.ts": stringtestutil.Dedent(` + import { greet } from "../../common/src/greeter.js"; + console.log(greet("world")); + `), + }, + cwd: "/home/src/workspaces/project", + commandLineArgs: []string{"-p", "sub/tsconfig.json", "--explainFiles"}, + }, + } + + for _, test := range testCases { + test.run(t, "outDir") + } +} + func TestForceConsistentCasingInFileNames(t *testing.T) { t.Parallel() testCases := []*tscInput{ diff --git a/internal/outputpaths/commonsourcedirectory.go b/internal/outputpaths/commonsourcedirectory.go index 433f28635db..f19e1477223 100644 --- a/internal/outputpaths/commonsourcedirectory.go +++ b/internal/outputpaths/commonsourcedirectory.go @@ -48,6 +48,14 @@ func computeCommonSourceDirectoryOfFilenames(fileNames []string, currentDirector return tspath.GetPathFromPathComponents(commonPathComponents) } +func GetComputedCommonSourceDirectory(fileNames []string, currentDirectory string, useCaseSensitiveFileNames bool) string { + commonSourceDirectory := computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, useCaseSensitiveFileNames) + if len(commonSourceDirectory) > 0 { + commonSourceDirectory = tspath.EnsureTrailingDirectorySeparator(commonSourceDirectory) + } + return commonSourceDirectory +} + func GetCommonSourceDirectory(options *core.CompilerOptions, files func() []string, currentDirectory string, useCaseSensitiveFileNames bool) string { var commonSourceDirectory string if options.RootDir != "" { diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js index 4d8d4214440..d80a2aaa4b1 100644 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js +++ b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js @@ -25,3 +25,35 @@ x + y; //// [/app/bin/index.d.ts] /// export {}; + + +//// [DtsFileErrors] + + +error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + + +!!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. +!!! error TS5011: Visit https://aka.ms/ts6 for migration information. +==== /app/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "outDir": "bin", + "typeRoots": ["../types"], + "sourceMap": true, + "mapRoot": "myMapRoot", + "sourceRoot": "mySourceRoot", + "declaration": true + } + } + +==== /app/bin/index.d.ts (0 errors) ==== + /// + export {}; + +==== /types/bar.d.ts (0 errors) ==== + declare module "bar" { + export const y = 0; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff index a92adeec86d..69952b25c85 100644 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff +++ b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff @@ -1,39 +1,24 @@ --- old.commonSourceDirectory.js +++ new.commonSourceDirectory.js -@@= skipped -24, +24 lines =@@ - //// [/app/bin/index.d.ts] - /// - export {}; -- -- --//// [DtsFileErrors] -- -- +@@= skipped -29, +29 lines =@@ + //// [DtsFileErrors] + + -/app/tsconfig.json(3,9): error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. -- Visit https://aka.ms/ts6 for migration information. -- -- ++error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + + -==== /app/tsconfig.json (1 errors) ==== -- { -- "compilerOptions": { -- "outDir": "bin", ++!!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. ++!!! error TS5011: Visit https://aka.ms/ts6 for migration information. ++==== /app/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "outDir": "bin", - ~~~~~~~~ -!!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. -!!! error TS5011: Visit https://aka.ms/ts6 for migration information. -- "typeRoots": ["../types"], -- "sourceMap": true, -- "mapRoot": "myMapRoot", -- "sourceRoot": "mySourceRoot", -- "declaration": true -- } -- } -- --==== /app/bin/index.d.ts (0 errors) ==== -- /// -- export {}; -- --==== /types/bar.d.ts (0 errors) ==== -- declare module "bar" { -- export const y = 0; -- } -- \ No newline at end of file + "typeRoots": ["../types"], + "sourceMap": true, + "mapRoot": "myMapRoot", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt new file mode 100644 index 00000000000..39317702628 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt @@ -0,0 +1,25 @@ +/app/tsconfig.json(3,9): error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + + +==== /app/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "outDir": "bin", + ~~~~~~~~ +!!! error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. +!!! error TS5011: Visit https://aka.ms/ts6 for migration information. + "sourceMap": true, + "mapRoot": "myMapRoot", + "sourceRoot": "mySourceRoot", + "declaration": true + } + } + +==== /app/lib/bar.d.ts (0 errors) ==== + declare const y: number; + +==== /app/src/index.ts (0 errors) ==== + /// + export const x = y; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt.diff deleted file mode 100644 index a8dbad91b76..00000000000 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory_dts.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.commonSourceDirectory_dts.errors.txt -+++ new.commonSourceDirectory_dts.errors.txt -@@= skipped -0, +0 lines =@@ --/app/tsconfig.json(3,9): error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. -- Visit https://aka.ms/ts6 for migration information. -- -- --==== /app/tsconfig.json (1 errors) ==== -- { -- "compilerOptions": { -- "outDir": "bin", -- ~~~~~~~~ --!!! error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. --!!! error TS5011: Visit https://aka.ms/ts6 for migration information. -- "sourceMap": true, -- "mapRoot": "myMapRoot", -- "sourceRoot": "mySourceRoot", -- "declaration": true -- } -- } -- --==== /app/lib/bar.d.ts (0 errors) ==== -- declare const y: number; -- --==== /app/src/index.ts (0 errors) ==== -- /// -- export const x = y; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js b/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js index 0a0189ac4c6..06b90908a68 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js @@ -17,3 +17,19 @@ interface Foo { x: number; } export default Foo; + + +//// [DtsFileErrors] + + +error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + + +!!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. +!!! error TS5011: Visit https://aka.ms/ts6 for migration information. +==== /foo/tsconfig.json (0 errors) ==== + { + "compilerOptions": { "declaration": true, "declarationDir": "out", "module": "commonjs", "target": "es2015" } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js.diff index 72969ed0e45..b30c2276e31 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitToDeclarationDirWithDeclarationOption.js.diff @@ -1,23 +1,22 @@ --- old.declarationEmitToDeclarationDirWithDeclarationOption.js +++ new.declarationEmitToDeclarationDirWithDeclarationOption.js -@@= skipped -16, +16 lines =@@ - x: number; - } - export default Foo; -- -- --//// [DtsFileErrors] -- -- +@@= skipped -21, +21 lines =@@ + //// [DtsFileErrors] + + -/foo/tsconfig.json(2,47): error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. -- Visit https://aka.ms/ts6 for migration information. -- -- ++error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + + -==== /foo/tsconfig.json (1 errors) ==== - { - "compilerOptions": { "declaration": true, "declarationDir": "out", "module": "commonjs", "target": "es2015" } - ~~~~~~~~~~~~~~~~ --!!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. --!!! error TS5011: Visit https://aka.ms/ts6 for migration information. -- } -- \ No newline at end of file + !!! error TS5011: The common source directory of 'tsconfig.json' is '../.src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + !!! error TS5011: Visit https://aka.ms/ts6 for migration information. ++==== /foo/tsconfig.json (0 errors) ==== ++ { ++ "compilerOptions": { "declaration": true, "declarationDir": "out", "module": "commonjs", "target": "es2015" } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-not-specified.js b/testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-not-specified.js index 0da686e84f1..502409cd973 100644 --- a/testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-not-specified.js +++ b/testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-not-specified.js @@ -11,7 +11,7 @@ export const x = 10; } tsgo -b -v -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * tsconfig.json @@ -20,6 +20,15 @@ Output:: [HH:MM:SS AM] Building project 'tsconfig.json'... +tsconfig.json:3:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +3 "outDir": "dist", +   ~~~~~~~~ + + +Found 1 error in tsconfig.json:3 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -47,10 +56,11 @@ declare const console: { log(msg: any): void; }; export const x = 10; //// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts"]} //// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -59,33 +69,61 @@ export const x = 10; "original": "../src/index.ts" } ], - "size": 54 + "size": 68 } tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/project/src/index.ts Signatures:: Edit [0]:: no change tsgo -b -v -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * tsconfig.json -[HH:MM:SS AM] Project 'tsconfig.json' is up to date because newest input 'src/index.ts' is older than output 'dist/src/index.js' +[HH:MM:SS AM] Project 'tsconfig.json' is out of date because buildinfo file 'dist/tsconfig.tsbuildinfo' indicates that program needs to report errors. + +[HH:MM:SS AM] Building project 'tsconfig.json'... + +tsconfig.json:3:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +3 "outDir": "dist", +   ~~~~~~~~ + +Found 1 error in tsconfig.json:3 +//// [/home/src/workspaces/project/dist/src/index.js] *rewrite with same content* +//// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo] *rewrite with same content* +//// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *rewrite with same content* + +tsconfig.json:: +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/project/src/index.ts +Signatures:: Edit [1]:: Normal build without change, that does not block emit on error to show files that get emitted tsgo -p /home/src/workspaces/project/tsconfig.json -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: +tsconfig.json:3:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +3 "outDir": "dist", +   ~~~~~~~~ + + +Found 1 error in tsconfig.json:3 + //// [/home/src/workspaces/project/dist/src/index.js] *rewrite with same content* diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/files-containing-json-file-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/files-containing-json-file-non-composite.js index 1d5f93b8418..6142db2cfaf 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/files-containing-json-file-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/files-containing-json-file-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo @@ -44,6 +50,9 @@ project/src/hello.json Part of 'files' list in tsconfig.json project/src/index.ts Part of 'files' list in tsconfig.json + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -82,10 +91,11 @@ const hello_json_1 = __importDefault(require("./hello.json")); exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts","../src/hello.json"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts","../src/hello.json"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -100,12 +110,12 @@ exports.default = hello_json_1.default.hello; "original": "../src/hello.json" } ], - "size": 74 + "size": 88 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-and-files-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-and-files-non-composite.js index 33b296e0e89..107bc5ea040 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-and-files-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-and-files-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo @@ -44,6 +50,9 @@ project/src/hello.json Imported via "./hello.json" from file 'project/src/index.ts' project/src/index.ts Matched by include pattern 'src/**/*' in 'project/tsconfig.json' + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -82,10 +91,11 @@ const hello_json_1 = __importDefault(require("./hello.json")); exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/hello.json","../src/index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/hello.json","../src/index.ts"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -100,12 +110,12 @@ exports.default = hello_json_1.default.hello; "original": "../src/index.ts" } ], - "size": 74 + "size": 88 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-and-file-name-matches-ts-file-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-and-file-name-matches-ts-file-non-composite.js index e71f4741492..d02939d0914 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-and-file-name-matches-ts-file-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-and-file-name-matches-ts-file-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/index.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo @@ -44,6 +50,9 @@ project/src/index.json Matched by include pattern 'src/**/*' in 'project/tsconfig.json' project/src/index.ts Matched by include pattern 'src/**/*' in 'project/tsconfig.json' + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -82,10 +91,11 @@ exports.default = index_json_1.default.hello; } //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts","../src/index.json"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts","../src/index.json"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -100,12 +110,12 @@ exports.default = index_json_1.default.hello; "original": "../src/index.json" } ], - "size": 74 + "size": 88 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/index.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/index.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-non-composite.js index 04bd4fe91a7..b53be071182 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo @@ -44,6 +50,9 @@ project/src/hello.json Matched by include pattern 'src/**/*' in 'project/tsconfig.json' project/src/index.ts Matched by include pattern 'src/**/*' in 'project/tsconfig.json' + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -82,10 +91,11 @@ const hello_json_1 = __importDefault(require("./hello.json")); exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts","../src/hello.json"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts","../src/hello.json"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -100,12 +110,12 @@ exports.default = hello_json_1.default.hello; "original": "../src/hello.json" } ], - "size": 74 + "size": 88 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-non-composite.js index 05bfa7db3b1..9ef31deaedf 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo @@ -43,6 +49,9 @@ project/src/hello.json Imported via "./hello.json" from file 'project/src/index.ts' project/src/index.ts Matched by include pattern 'src/**/*' in 'project/tsconfig.json' + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -81,10 +90,11 @@ const hello_json_1 = __importDefault(require("./hello.json")); exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -93,12 +103,12 @@ exports.default = hello_json_1.default.hello; "original": "../src/index.ts" } ], - "size": 54 + "size": 68 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/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 8c9206c5a2a..8203ace6f83 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 @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/index.js TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo ../../tslibs/TS/Lib/lib.es2024.full.d.ts @@ -42,6 +48,9 @@ hello.json Imported via "../../hello.json" from file 'project/src/index.ts' project/src/index.ts Matched by include pattern 'src/**/*' in 'project/tsconfig.json' + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -75,10 +84,11 @@ const hello_json_1 = __importDefault(require("../../hello.json")); exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -87,12 +97,12 @@ exports.default = hello_json_1.default.hello; "original": "../src/index.ts" } ], - "size": 54 + "size": 68 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: diff --git a/testdata/baselines/reference/tsbuild/resolveJsonModule/sourcemap-non-composite.js b/testdata/baselines/reference/tsbuild/resolveJsonModule/sourcemap-non-composite.js index a0759fde6f6..08191617346 100644 --- a/testdata/baselines/reference/tsbuild/resolveJsonModule/sourcemap-non-composite.js +++ b/testdata/baselines/reference/tsbuild/resolveJsonModule/sourcemap-non-composite.js @@ -25,7 +25,7 @@ export default hello.hello } tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json @@ -34,6 +34,12 @@ Output:: [HH:MM:SS AM] Building project 'project/tsconfig.json'... +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json TSFILE: /home/src/workspaces/solution/project/dist/src/index.js.map TSFILE: /home/src/workspaces/solution/project/dist/src/index.js @@ -45,6 +51,9 @@ project/src/hello.json Part of 'files' list in tsconfig.json project/src/index.ts Part of 'files' list in tsconfig.json + +Found 1 error in project/tsconfig.json:9 + //// [/home/src/tslibs/TS/Lib/lib.es2024.full.d.ts] *Lib* /// interface Boolean {} @@ -85,10 +94,11 @@ exports.default = hello_json_1.default.hello; //// [/home/src/workspaces/solution/project/dist/src/index.js.map] *new* {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;kBACjB,oBAAK,CAAC,KAAK"} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../src/index.ts","../src/hello.json"]} +{"version":"FakeTSVersion","errors":true,"root":["../src/index.ts","../src/hello.json"]} //// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", + "errors": true, "root": [ { "files": [ @@ -103,25 +113,58 @@ exports.default = hello_json_1.default.hello; "original": "../src/hello.json" } ], - "size": 74 + "size": 88 } project/tsconfig.json:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts -*refresh* /home/src/workspaces/solution/project/src/hello.json -*refresh* /home/src/workspaces/solution/project/src/index.ts +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts Signatures:: Edit [0]:: no change tsgo --b project --v --explainFiles --listEmittedFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: [HH:MM:SS AM] Projects in this build: * project/tsconfig.json -[HH:MM:SS AM] Project 'project/tsconfig.json' is up to date because newest input 'project/src/index.ts' is older than output 'project/dist/src/hello.json' +[HH:MM:SS AM] Project 'project/tsconfig.json' is out of date because buildinfo file 'project/dist/tsconfig.tsbuildinfo' indicates that program needs to report errors. + +[HH:MM:SS AM] Building project 'project/tsconfig.json'... + +project/tsconfig.json:9:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +9 "outDir": "dist", +   ~~~~~~~~ + +TSFILE: /home/src/workspaces/solution/project/dist/src/hello.json +TSFILE: /home/src/workspaces/solution/project/dist/src/index.js.map +TSFILE: /home/src/workspaces/solution/project/dist/src/index.js +TSFILE: /home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo +../../tslibs/TS/Lib/lib.es2024.full.d.ts + Default library for target 'ES2024' +project/src/hello.json + Imported via "./hello.json" from file 'project/src/index.ts' + Part of 'files' list in tsconfig.json +project/src/index.ts + Part of 'files' list in tsconfig.json + +Found 1 error in project/tsconfig.json:9 +//// [/home/src/workspaces/solution/project/dist/src/hello.json] *rewrite with same content* +//// [/home/src/workspaces/solution/project/dist/src/index.js] *rewrite with same content* +//// [/home/src/workspaces/solution/project/dist/src/index.js.map] *rewrite with same content* +//// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo] *rewrite with same content* +//// [/home/src/workspaces/solution/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *rewrite with same content* +project/tsconfig.json:: +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.es2024.full.d.ts +*not cached* /home/src/workspaces/solution/project/src/hello.json +*not cached* /home/src/workspaces/solution/project/src/index.ts +Signatures:: diff --git a/testdata/baselines/reference/tsc/declarationEmit/when-using-Windows-paths-and-uppercase-letters.js b/testdata/baselines/reference/tsc/declarationEmit/when-using-Windows-paths-and-uppercase-letters.js index a8da47c2550..30a3742b82a 100644 --- a/testdata/baselines/reference/tsc/declarationEmit/when-using-Windows-paths-and-uppercase-letters.js +++ b/testdata/baselines/reference/tsc/declarationEmit/when-using-Windows-paths-and-uppercase-letters.js @@ -46,16 +46,11 @@ export interface MyType extends Function { tsgo -p D:\Work\pkg1 --explainFiles ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: -src/main.ts:6:5 - error TS2564: Property 'id' has no initializer and is not definitely assigned in the constructor. +tsconfig.json:5:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. -6 id: string; -   ~~ - -src/utils/index.ts:8:12 - error TS2352: Conversion of type 'typeof PartialClassType' to type 'MyReturnType' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - Cannot assign an abstract constructor type to a non-abstract constructor type. - -8 return PartialClassType as MyReturnType; -   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +5 "outDir": "./dist", +   ~~~~~~~~ ../../home/src/tslibs/TS/Lib/lib.es2017.full.d.ts Default library for target 'ES2017' @@ -68,11 +63,7 @@ src/utils/index.ts src/main.ts Matched by include pattern 'src' in 'tsconfig.json' -Found 2 errors in 2 files. - -Errors Files - 1 src/main.ts:6 - 1 src/utils/index.ts:8 +Found 1 error in tsconfig.json:5 //// [D:/Work/pkg1/dist/src/main.d.ts] *new* declare const Sub_base: import("./utils/type-helpers").MyReturnType; diff --git a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js index d7114763646..41ef489d0be 100644 --- a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js +++ b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js @@ -111,7 +111,7 @@ export { Button, createButton } from "@component-type-checker/components"; export const VERSION = "0.0.2"; tsgo --traceResolution --explainFiles -ExitStatus:: Success +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: ======== Resolving module '@component-type-checker/sdk' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ======== Module resolution kind is not specified, using 'Bundler'. @@ -263,6 +263,12 @@ File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-ty 'package.json' does not have a 'peerDependencies' field. Resolving real path for '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts'. ======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button/src/index.ts@0.0.2'. ======== +tsconfig.json:7:9 - error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. + +7 "outDir": "dist", +   ~~~~~~~~ + ../../../../tslibs/TS/Lib/lib.es5.d.ts Library 'lib.es5.d.ts' specified in compilerOptions ../../node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts @@ -278,6 +284,9 @@ Resolving real path for '/home/src/projects/component-type-checker/node_modules/ Imported via "@component-type-checker/components" from file 'src/app.tsx' with packageId '@component-type-checker/components/src/index.ts@0.0.1+@component-type-checker/button@0.0.2' src/app.tsx Matched by include pattern 'src' in 'tsconfig.json' + +Found 1 error in tsconfig.json:7 + //// [/home/src/projects/component-type-checker/packages/app/dist/src/app.js] *new* import { createButton } from "@component-type-checker/button"; const button = createButton(); diff --git a/testdata/baselines/reference/tsc/outDir/outDir-when-include-references-parent-directories.js b/testdata/baselines/reference/tsc/outDir/outDir-when-include-references-parent-directories.js new file mode 100644 index 00000000000..d8891940f0b --- /dev/null +++ b/testdata/baselines/reference/tsc/outDir/outDir-when-include-references-parent-directories.js @@ -0,0 +1,86 @@ +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/common/src/greeter.ts] *new* +export function greet(name: string): string { + return "Hello, " + name + "!"; +} +//// [/home/src/workspaces/project/sub/src/index.ts] *new* +import { greet } from "../../common/src/greeter.js"; +console.log(greet("world")); +//// [/home/src/workspaces/project/sub/tsconfig.json] *new* +{ + "extends": "../tsconfig.json", + "include": [ + "src/**/*", + "../common/src/**/*" + ] +} +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "target": "ES2024", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "${configDir}/dist/", + "strict": true, + "skipLibCheck": true + }, + "include": ["common/src/**/*"] +} + +tsgo -p sub/tsconfig.json --explainFiles +ExitStatus:: DiagnosticsPresent_OutputsGenerated +Output:: +error TS5011: The common source directory of 'tsconfig.json' is '..'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. + Visit https://aka.ms/ts6 for migration information. +../../tslibs/TS/Lib/lib.es2024.full.d.ts + Default library for target 'ES2024' +common/src/greeter.ts + Imported via "../../common/src/greeter.js" from file 'sub/src/index.ts' + Matched by include pattern '../common/src/**/*' in 'sub/tsconfig.json' + File is CommonJS module because 'package.json' was not found +sub/src/index.ts + Matched by include pattern 'src/**/*' in 'sub/tsconfig.json' + File is CommonJS module because 'package.json' was not found + +Found 1 error. + +//// [/home/src/tslibs/TS/Lib/lib.es2024.full.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/common/src/greeter.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.greet = greet; +function greet(name) { + return "Hello, " + name + "!"; +} + +//// [/home/src/workspaces/project/sub/dist/src/index.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const greeter_js_1 = require("../../common/src/greeter.js"); +console.log((0, greeter_js_1.greet)("world")); + +