-
Notifications
You must be signed in to change notification settings - Fork 13k
Handle package.json for --build consistently #62405
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
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
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 pull request fixes #48314 by ensuring consistent handling of package.json files between regular tsc
and tsc --build
modes. The key change is encoding necessary package.json information into buildInfo files, allowing watch mode and build mode to behave consistently when detecting package.json status changes.
Key changes:
- Adds
packageJsons
field to build info structures to track package.json dependencies - Updates build info generation to include package.json paths that affect module resolution
- Modifies up-to-date checking to consider package.json changes when validating build info
Reviewed Changes
Copilot reviewed 79 out of 80 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/baselines/reference/*.js | Updated test baselines to reflect new packageJsons field in build info |
src/compiler/tsbuildPublic.ts | Modified to track and watch package.json files using build info data |
src/compiler/builderPublic.ts | Added realpath function to BuilderProgramHost interface |
src/compiler/builder.ts | Added packageJsons tracking to build info generation and state management |
tests/baselines/reference/api/typescript.d.ts | Updated API to include realpath in BuilderProgramHost |
Is it likely for this to grow hugely for lots of packages? I guess it doesn't really matter, given it is just one extra string for each package, and each package already has multiple files otherwise we wouldn't have these package.jsons anyway. Do we definitely want this in Strada at this point? |
Fixes #48314
Now that we have buildinfo in --b mode, we can consistently check the package.json status changes in watch or tsc -b invocations to get consistent behaviour by encoding needed package.json into buildInfo