Ask questionsRestore runtime lib generation capability

With the recent changes to the build system, we removed the ability to generate the runtime type library based on the runtime code from Deno. We should restore this, so that we can automatically keep our type library in sync with the code.

This is something I am working on, but essentially we need to create a module that can be transpiled and injected into V8 at buildtime which sort of mirrors the process of the previous library builder which ran under Node.js. Because at the moment, there is no easy way to describe exactly what we do at the runtime (creating a window object that equals the global scope and injecting a namespace of Deno into the runtime) we have to do some TypeScript AST manipulation in order to get output that is valid. Previously we had used a library (ts-morph) to accomplish this, but that at this stage it is a bit too difficult to get running under the "bare" V8 we have at build time (or Deno for that matter) so we need to replicate the logic of the old builder but manipulate the TypeScript AST directly.


Answer questions kitsonk

In a conversation with Ryan C at TSConf, I opened up microsoft/TypeScript#34531 which is trying to find a way to emit a single file flattened type definition for a given module. This would allow us to do 90% of the work of the generation of the runtime type library just with the TypeScript compiler.

Kitson Kelly kitsonk @denoland Melbourne, Australia Doing stuff @denoland, author of @oakserver, @denoify, and @h-o-t
Github User Rank List