profile
viewpoint

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.

denoland/deno

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.

useful!

Related questions

{WSL 2} Permission denied (os error 13) hot 1
gRPC in Deno? hot 1
deno remove/uninstall subcommand hot 1
Insight required: Resource (TCP) errors hot 1
TCP accept loop doesn't use for-await hot 1
Support d.ts files hot 1
disable flaky tests _048_media_types_jsx and _019_media_types hot 1
Typescript Custom Transformers Support hot 1
reorg directory structure hot 1
Centos 7 GLIBC_2.18 not found hot 1
"deno ast script.ts" hot 1
Text decoding performance abysmally slow. hot 1
"deno ast script.ts" hot 1
Can't build master hot 1
Can't build master hot 1
Github User Rank List