s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

Support for additional plugins to be added/tied for code-gen, framework compilation #145

Open TheLarkInn opened 8 years ago

TheLarkInn commented 8 years ago

Currently frameworks are starting to extract their runtime compilation code and extracting it out to be ran as a build step. Angulars Compiler-CLI is an example. It would be awesome to have exposure to different add, remove, read, write, lifecycle hooks inside of awesome-typescript-loader's implementation of 'ts.LanguageService'.

The Angular compiler CLI as an example does the following: • access to changed file • create, mutate, and add additional files based on that file

The angular team will hopefully expose their code-gen API in the near future, this can be something tackled either in parallel or after it is finished.

https://github.com/angular/angular/issues/8759

TheLarkInn commented 8 years ago

@s-panferov

The Offline Template compiler for angular is using ts.CompilerHost which implements slightly different implementation than ts.LanguageServiceHost. Do you think this plugin can expose an API that would allow one to provide Host as a ts.CompilerHost also? Or at the least expose, Program, Host, and State.

s-panferov commented 8 years ago

@TheLarkInn I think that I will have some time tomorrow to finally implement this. I'll try to share as fast as possible.

TheLarkInn commented 8 years ago

No worries!! I suppose also this can help with https://github.com/s-panferov/awesome-typescript-loader/issues/153 if you didn't want to implement it out if the box.

Being able to 'decorate' the LanguageServiceHost with a CompilerHost well be really awesome.

Thank you for all the hard work.

TheLarkInn commented 8 years ago

Have you had much thought of this as of late @s-panferov. I know you've been busy like the rest of us. Timing would be stellar if theres something not documented thats already possible for @hansl and I to implement.