feat: support incremental build when composite is true#416
Merged
Conversation
✅ Deploy Preview for rslib ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
CodSpeed Performance ReportMerging #416 will not alter performanceComparing Summary
|
Contributor
Author
|
Damn! It's really hard to align buildinfo behaviour with tsc command line |
a92a19f to
8b40cb4
Compare
8b40cb4 to
fce4f8e
Compare
fi3ework
approved these changes
Nov 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Our current logic using the Typescript compiler API is:
build mode
dts.build: false: basic compiler withcreateCompilerHostandcreateProgramdts.build: true: incremental build with project references, usingcreateSolutionBuilderHostandcreateSolutionBuilderwatch mode
dts.build: false: incremental program watcher withcreateWatchCompilerHostandcreateWatchProgramdts.build: true: incremental build with project references, usingcreateSolutionBuilderWithWatchHostandcreateSolutionBuilderWithWatchIn this PR, we add
createIncrementalCompilerHostandcreateIncrementalProgramin build mode to support incremental and deal with projects that withcomposite: true(incremental: true) and do not to build references dependencies. The watch mode API originally support incremental, so we do not to deal with it in this scenerio.Our logic is beyond what fork-ts-checker-webpack-plugin do
https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/0fab463b21c6edc4d94834568a3f440241d57887/src/typescript/worker/get-issues-worker.ts#L66-L73
For compiler API that not use
SolutionBuilder, it seems the buildinfo not actually takes effect, it just generate buildinfo files. And for tsbuildinfo, due to various issues caused by buildinfo such as remove distPath and monorepo sceniro, we decide to delete buildinfo before generating dts in the next PR which is aligned with Modern.js Module. And our dts processing behaviour such as redirect alias, modify dts extensions and adding banner/footer are also not compatitle with ts cache.For users who want to keep most align with the default behaviour with
tscin incremetal scenerio, they can enabledts.build: truebut I think there's no need to do this if they do not want to build dependencies.Hopefully there won’t be a day where we switch to using tsc bin files directly, and the ts compiler api will be easier to use with more extensive documentation and able to align related behaviors with tsc more easily.
Related Links
close: #404
Checklist