From 3cbd1075c78703b4852760ec5bfa2e4dbb53c737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 24 Jun 2020 16:59:12 +0200 Subject: Incremental compilation for TypeScript (#6428) This commit adds incremental compilation capabilities to internal TS compiler. Instead of using "ts.createProgram()" API for compilation step (during deno startup), "ts.createIncrementalProgram()" API is used instead. Thanks to TS' ".tsbuildinfo" file that already stores all necessary metadata for compilation I was able to remove our own invention that is ".graph" file. ".tsbuildinfo" file is stored alongside compiled source and is used to cache-bust outdated dependencies, facilitated by the "version" field. The value for "version" field is computed in Rust during loading of module graph and is basically a hash of the file contents. Please keep in mind that incremental compilation is only used for initial compilation (or dynamic imports compilation) - bundling and runtime compiler APIs haven't been changed at all. Due to problems with source map I changed compilation settings to inline source map (inlineSourceMap instead of sourceMap). --- cli/tests/single_compile_with_reload_dyn.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 cli/tests/single_compile_with_reload_dyn.ts (limited to 'cli/tests/single_compile_with_reload_dyn.ts') diff --git a/cli/tests/single_compile_with_reload_dyn.ts b/cli/tests/single_compile_with_reload_dyn.ts new file mode 100644 index 000000000..52dd1df7b --- /dev/null +++ b/cli/tests/single_compile_with_reload_dyn.ts @@ -0,0 +1,11 @@ +import { returnsHi, returnsFoo2, printHello3 } from "./subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} -- cgit v1.2.3