private static string generateInputParams(string fileKey, string filePath, TranspilerParams tparams) { //Explicação dos paths: //[path relativo ao arquivo que está sendo processado, incluindo o caminho de arquivos transitórios. Exemplo: se a URL está em: http://localhost/Web/Teste.jsx, este path deverá ser: /[transitorypath]/Web/] return(JsonConvert.SerializeObject(new { Key = fileKey, File = filePath, UrlRelativePath = string.Concat(TransitoryRepo.TRANSITORYSTARTURL, tparams.UrlRelativePath), ExtractCss = tparams.ExportType != ExportType.AllButScss })); }
private static T watchFile <T>(string file, TranspilerParams tparams, ProcessFiles <T> fnProcessFiles) { var fileKey = getHashedString(file); var watcher = dictWatch.GetOrAdd(fileKey, key => new Watcher { File = file, Process = new ProcessContainerForWatching(generateInputParams(fileKey, file, tparams), files => fnProcessFiles(separateFiles(fileKey, files, tparams.ExportType))) }); watcher.Process.RenewIfNecessary(); var ret = watcher.Process.GetLastOutput(); return(fnProcessFiles(separateFiles(fileKey, ret, tparams.ExportType))); }
public static T CompileFile <T>(string file, TranspilerParams tparams, ProcessFiles <T> fnProcessFiles) => watchFile(file, tparams, fnProcessFiles);