I have been charged with the task of writing a webpack loader for the CompilerCLI's offline compilation a code generation feature.
Because the compiler-cli was written as a one off 'build step', it implements ts.CompilerHost. This however poses a problem for Lifetime transpilation tools like a webpack loader. If you look at the source code in both ts-loader and awesome-typescript-loader you'll notice that both of these implement ts.LanguageServiceHost. Although these two interfaces overlap, piping a ts.LanguageServiceHost is not a plug-and-play solution: TheLarkInn/awesome-typescript-loader@7b21b13
Proposal
- Expose any of the functionality required in the compiler-cli (codegen, annotation conversions) so that the those steps can be performed on a per-file basis. Since webpack already handles finding the correct .ts files via loaders any of that boilerplate code that is used thanks to
ts.CompilerHost to assist in finding and reading files is obsolete/not needed.
- Allow any of the currently exposed classes from the compiler-cli (
TsickleHost, Codegenerator, ReflectionHost, MetadataHost) to accept and incorporate ts.LanguageServiceHost.
I have been charged with the task of writing a webpack loader for the CompilerCLI's offline compilation a code generation feature.
Because the compiler-cli was written as a one off 'build step', it implements
ts.CompilerHost. This however poses a problem for Lifetime transpilation tools like a webpack loader. If you look at the source code in bothts-loaderandawesome-typescript-loaderyou'll notice that both of these implementts.LanguageServiceHost. Although these two interfaces overlap, piping ats.LanguageServiceHostis not a plug-and-play solution: TheLarkInn/awesome-typescript-loader@7b21b13Proposal
ts.CompilerHostto assist in finding and reading files is obsolete/not needed.TsickleHost,Codegenerator,ReflectionHost,MetadataHost) to accept and incorporatets.LanguageServiceHost.