gulp-typescript
gulp-typescript copied to clipboard
Incremental compilation using new API
This PR introduces incremental compilation using the new API provided by TypeScript. This is still work in progress. TODO:
- [x] Switch to createIncrementalProgram
- [ ] Trigger recompilations in watch mode: currently the compiler does not pick up any changes. I'm not sure how to properly signal the compiler that some files were changed.
- [ ] Handle changes in file names: We may need to recreate the incremental program if this happens. This would trigger a full compilation instead of an incremental one.
- [ ] Handle change in rootDir: similar to the previous issue. It may be less-risky to just force that the
rootDir
option is given - [ ] Parse & emit
.tsbuildinfo
file
Is there any way I could help out with this?
Thanks for asking, it's sadly more complex than I thought. We have to adapt to a new API, and that will require some more changes I'm afraid. You could take a look at microsoft/TypeScript#35159. If you don't want to dive into that you can definitely help testing when I made some more progress, but I'm busy at work currently. I hope I can find a weekend to work on this soon.
Would you consider splitting this into 2 features? one to handle createIncrementalProgram + emitting .tsbuildinfo and a second one to improve watch mode?
Yes I was already thinking to do that, but I was planning to do the second first actually. But given that we have to use a different API for watch mode, it is probably indeed better to do it in your order. We can probably do that without using the watcher API. Do you want to take a look at the first?
It's now August, will this be merged soon?
I find that with incremental enabled, the original incremental compiler of typescript will emit a file that skip my custom transformer(it's not declared in tsconfig but in gulpfile). And after the gulp watcher and task, I get a new file that go through all transformer. Hope this feature be released soon.