Typescript Compiler API

// ts-morph
// 浏览器运行时?
The compiler API has a few main components:
  • A `Program` which is the TypeScript terminology for your whole application
  • A `CompilerHost` which represents the users' system, with an API for reading files, checking directories and case sensitivity etc.
  • Many `SourceFiles` which represent each source file in the application, hosting both the text and TypeScript AST

使用工厂函数创建 AST,使用工厂函数从 AST 输出 ts 文件

transpileModule // 直接输出 js