Skip to content

Handle package.json for --build consistently#62405

Closed
sheetalkamat wants to merge 3 commits intomainfrom
packageJsonBuildMode
Closed

Handle package.json for --build consistently#62405
sheetalkamat wants to merge 3 commits intomainfrom
packageJsonBuildMode

Conversation

@sheetalkamat
Copy link
Copy Markdown
Member

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

Copilot AI review requested due to automatic review settings September 5, 2025 21:05
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Sep 5, 2025
@typescript-bot
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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

@jakebailey
Copy link
Copy Markdown
Member

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?

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Tsbuild watching packagejson is dependent on whether program was built in the invocation

5 participants