Add API for incremental compilation followed by watching changes and updating buildinfo #41611
Description
Search Terms
incremental watch compiler api
Suggestion
Support incremental + watch compilation in the compiler API
Use Cases
When using the compiler API to build a typescript compiler plugin for a build system that supports "developer mode" (a mode where changes are made incrementally and expected to quickly turn around with transpiled files for changes) it becomes necessary to support both incremental compilation (loading buildinfo from disk at startup and writing changes back) and watch mode (to not rescan the entire source tree for every change since this takes tens of seconds or even minutes).
It does not seem to be possible using the existing compiler API when I study it, and a request to show an example of this has gone unanswered (microsoft/TypeScript-wiki#260).
Examples
This would be used by me in my typescript compiler for meteorjs to keep a watching build instance around for a directory for subsequent compilations:
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Activity