示例#1
0
 public IObservable <CoalesceEntry> CreateMessages(FileDataWithMetadata <T> file)
 {
     try
     {
         return(_statementToExecute(file)
                .Select(s => new[] { s }.MakeExecute())
                .ToCoalesceEntry(file.Metadata.ToString(), addFirst: true));
     }
     catch (Exception)
     {
         return(Observable.Return(new BytecodeUpdated(new Lambda(Signature.Action(), Enumerable.Empty <BindVariable>(), Enumerable.Empty <Statement>())))
                .ToCoalesceEntry("invalid-file-dependency"));
     }
 }
示例#2
0
        Optional <FileDataWithMetadata <AbsoluteFilePath> > TranspileJs(FileDataWithMetadata <AbsoluteFilePath> jsFile)
        {
            string output;

            if (_fuseJs.Value.TryTranspile(jsFile.Metadata.NativePath, Encoding.UTF8.GetString(jsFile.Data), out output))
            {
                // Bundle transpiled code with the original source file metadata
                return(FileDataWithMetadata.Create(jsFile.Metadata, Encoding.UTF8.GetBytes(output)));
            }
            else
            {
                _logAdapter.Error(jsFile.Metadata);

                // Don't propagate result
                return(Optional.None());
            }
        }