-
Notifications
You must be signed in to change notification settings - Fork 13k
Assume rootDir is the current configuration directory #62418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR changes the TypeScript compiler's behavior to assume the configuration file directory as the root directory when rootDir
is not explicitly specified. Instead of requiring composite: true
to enable this behavior, the change makes it apply whenever a configuration file (configFilePath
) is present.
- Removes the requirement for
composite: true
to use the configuration directory as the root - Updates the common source directory resolution logic to use
configFilePath
existence instead ofcomposite && configFilePath
- Affects output path generation, module resolution, and emit behavior
Reviewed Changes
Copilot reviewed 57 out of 59 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/compiler/utilities.ts | Updates condition to use configFilePath instead of composite && configFilePath for root directory determination |
src/compiler/moduleNameResolver.ts | Changes module resolution to assume config directory as root when configFilePath exists |
src/compiler/emitter.ts | Updates emit logic to use config directory as common source directory when configFilePath is present |
src/testRunner/unittests/tsbuild/outputPaths.ts | Updates test expectations and adds test name differentiation |
src/testRunner/unittests/helpers/monorepoSymlinkedSiblingPackages.ts | Adds explicit rootDir to test configurations to maintain expected behavior |
tests/baselines/reference/* | Multiple baseline file updates reflecting the new output path behavior |
Files not reviewed (1)
- tests/baselines/reference/commonSourceDirectory_dts.js.map: Language not supported
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Ouch, looking bad for pyright and mui-docs. |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
@jakebailey Here are some more interesting changes from running the top 400 repos suite Details
|
@jakebailey Here are some more interesting changes from running the top 400 repos suite Details
|
@jakebailey Here are some more interesting changes from running the top 400 repos suite Details
|
This seems correct but the fallout in resolution in these projects seems like a non sequitur. This is because |
For pyright, both baseUrl and rootDir are unset (hence them changing): https://github.com/microsoft/pyright/blob/main/packages/pyright/tsconfig.json Perhaps this just means they could explicitly define rootDir to be a parent dir? IIRC the layout should really have used project references, but instead has every project emit each other's files into their own dist (for better or for worse.... mainly the latter). |
I think its "tryLoadInputFileForPath" where it tries to guess the input path where there is change in behavior of what we do if "rootDir" is known vs computed |
Fixes #62194