From 3fe4be07ca19b40a2444b714f5927ff155d66fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 24 Sep 2018 21:33:50 +0200 Subject: Add flag --recompile (#801) --- js/compiler.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'js/compiler.ts') diff --git a/js/compiler.ts b/js/compiler.ts index 624aab201..f0f82ffb1 100644 --- a/js/compiler.ts +++ b/js/compiler.ts @@ -169,6 +169,8 @@ export class DenoCompiler // A reference to the global scope so it can be monkey patched during // testing private _window = window; + // Flags forcing recompilation of TS code + public recompile = false; /** * Drain the run queue, retrieving the arguments for the module @@ -412,11 +414,15 @@ export class DenoCompiler /** * Retrieve the output of the TypeScript compiler for a given module and - * cache the result. + * cache the result. Re-compilation can be forced using '--recompile' flag. */ compile(moduleMetaData: ModuleMetaData): OutputCode { - this._log("compiler.compile", moduleMetaData.fileName); - if (moduleMetaData.outputCode) { + const recompile = !!this.recompile; + this._log( + "compiler.compile", + { filename: moduleMetaData.fileName, recompile } + ); + if (!recompile && moduleMetaData.outputCode) { return moduleMetaData.outputCode; } const { fileName, sourceCode } = moduleMetaData; -- cgit v1.2.3