public static async Task <TypeScriptCompilation> CompileAsync(string inputFile, TypeScriptCompilationOptions options, ITypeScriptCompiler compiler = null)
        {
            var compilation = new TypeScriptCompilation(inputFile, options, compiler ?? _defaultCompiler.Value);
            await compilation.CompileAsync();

            return(compilation);
        }
Beispiel #2
0
        public static async Task <TypeScriptCompilation> CompileAsync(string inputFile, TypeScriptCompilationOptions options)
        {
            var compilation = new TypeScriptCompilation(inputFile, options);
            await compilation.CompileAsync();

            return(compilation);
        }
        public async Task Emit_ReturnsExpectedPath()
        {
            var options = new TypeScriptCompilationOptions
            {
                OutDir  = "outdir",
                RootDir = @"c:\root\directory",
                Target  = "test.ts"
            };

            string inputFile   = @"c:\root\directory\functionname\inputfile.ts";
            var    compilation = await TypeScriptCompilation.CompileAsync(inputFile, options, new TestCompiler());

            string result = await compilation.EmitAsync(CancellationToken.None);

            Assert.Equal(@"c:\root\directory\functionname\outdir\functionname\inputfile.js", result);
        }
 public async Task <IJavaScriptCompilation> GetFunctionCompilationAsync(FunctionMetadata functionMetadata)
 {
     return(await TypeScriptCompilation.CompileAsync(functionMetadata.ScriptFile, _compilationOptions));
 }