4 ms·
>I hope that they implement in-memory compilation, so that the compiler can work properly with Gulp In-memory compilation already exists. I wrote a Gulp wrappe
by Arnavion 12y ago
>I hope that they implement in-memory compilation, so that the compiler can work properly with Gulp
In-memory compilation already exists. I wrote a Gulp wrapper for TS for my own project [0] that supports both normal compilation and incremental compilation (i.e., watch functionality).
The real issue with TS is that it doesn't export a programmable compiler API by default, necessitating either a process.exec to the shell script or adding an export statement using the vm module. I gather that was a low priority for the devs because they wanted to get the compiler API in shape first.
[0] https://github.com/Arnavion/libjass/blob/master/gulplib/typescript.js https://github.com/Arnavion/libjass/blob/master/gulplib/type...
- nawitus 12y ago>In-memory compilation already exists. Well, it seems that it requires quite a lot of code. Perhaps you should publish the gulp wrapper as a Gulp plugin. By the way, does your Gulp wrapper load files from the disk, or are the files given to it as in-memory streams? That's what I mean by "in-memory compilation".
- Arnavion 12y ago>does your Gulp wrapper load files from the disk, or are the files given to it as in-memory streams The latter. The TS compiler (TypeScriptCompiler) internally works with string sources and outputs strings. The official sources use a wrapper around it (BatchCompiler) that converts input file names to input file contents and output JS+sourcemaps to files. My wrapper uses file contents from gulp.src for the same. >Well, it seems that it requires quite a lot of code Yes. The first part of my code is basically a reimplementation of BatchCompiler. But my code also does other things - for example I fiddle with the AST to generate automatic JSDocs, etc.