From bd9561f4de8f940ce6ed8b5eedfa84161a749c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 22 Jan 2020 20:18:01 +0100 Subject: Reland "Create an old program to be used in snapshot." (#3747) * read CLI assets from disk during snapshotting --- cli/js/compiler.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'cli/js/compiler.ts') diff --git a/cli/js/compiler.ts b/cli/js/compiler.ts index 3cebf24b2..54861f713 100644 --- a/cli/js/compiler.ts +++ b/cli/js/compiler.ts @@ -6,6 +6,7 @@ import "./globals.ts"; import "./ts_global.d.ts"; import { TranspileOnlyResult } from "./compiler_api.ts"; +import { oldProgram } from "./compiler_bootstrap.ts"; import { setRootExports } from "./compiler_bundler.ts"; import { defaultBundlerOptions, @@ -142,7 +143,12 @@ self.bootstrapTsCompiler = function tsCompilerMain(): void { // to generate the program and possibly emit it. if (!diagnostics || (diagnostics && diagnostics.length === 0)) { const options = host.getCompilationSettings(); - const program = ts.createProgram(rootNames, options, host); + const program = ts.createProgram({ + rootNames, + options, + host, + oldProgram + }); diagnostics = ts .getPreEmitDiagnostics(program) @@ -220,11 +226,12 @@ self.bootstrapTsCompiler = function tsCompilerMain(): void { } host.mergeOptions(...compilerOptions); - const program = ts.createProgram( + const program = ts.createProgram({ rootNames, - host.getCompilationSettings(), - host - ); + options: host.getCompilationSettings(), + host, + oldProgram + }); if (bundle) { setRootExports(program, rootNames[0]); -- cgit v1.2.3