@@ -24,7 +24,6 @@ public class DocumentationWebHost
2424{
2525 private readonly WebApplication _webApplication ;
2626
27- private readonly BuildContext _context ;
2827 private readonly IHostedService _hostedService ;
2928 private readonly IFileSystem _writeFileSystem ;
3029
@@ -44,18 +43,18 @@ public DocumentationWebHost(string? path, int port, ILoggerFactory logger, IFile
4443 var hostUrl = $ "http://localhost:{ port } ";
4544
4645 _hostedService = collector ;
47- _context = new BuildContext ( collector , readFs , writeFs , path , null )
46+ Context = new BuildContext ( collector , readFs , writeFs , path , null )
4847 {
4948 CanonicalBaseUrl = new Uri ( hostUrl ) ,
5049 } ;
51- var generatorState = new ReloadableGeneratorState ( _context . DocumentationSourceDirectory , _context . DocumentationOutputDirectory , _context , logger ) ;
50+ GeneratorState = new ReloadableGeneratorState ( Context . DocumentationSourceDirectory , Context . DocumentationOutputDirectory , Context , logger ) ;
5251 _ = builder . Services
5352 . AddAotLiveReload ( s =>
5453 {
55- s . FolderToMonitor = _context . DocumentationSourceDirectory . FullName ;
54+ s . FolderToMonitor = Context . DocumentationSourceDirectory . FullName ;
5655 s . ClientFileExtensions = ".md,.yml" ;
5756 } )
58- . AddSingleton < ReloadableGeneratorState > ( _ => generatorState )
57+ . AddSingleton < ReloadableGeneratorState > ( _ => GeneratorState )
5958 . AddHostedService < ReloadGeneratorService > ( ) ;
6059
6160 if ( IsDotNetWatchBuild ( ) )
@@ -67,6 +66,10 @@ public DocumentationWebHost(string? path, int port, ILoggerFactory logger, IFile
6766 SetUpRoutes ( ) ;
6867 }
6968
69+ public ReloadableGeneratorState GeneratorState { get ; }
70+
71+ public BuildContext Context { get ; }
72+
7073 private static bool IsDotNetWatchBuild ( ) => Environment . GetEnvironmentVariable ( "DOTNET_WATCH" ) is not null ;
7174
7275 public async Task RunAsync ( Cancel ctx )
@@ -141,7 +144,7 @@ await context.Response.WriteAsync(@"
141144 . UseStaticFiles (
142145 new StaticFileOptions
143146 {
144- FileProvider = new EmbeddedOrPhysicalFileProvider ( _context ) ,
147+ FileProvider = new EmbeddedOrPhysicalFileProvider ( Context ) ,
145148 RequestPath = "/_static"
146149 } )
147150 . UseRouting ( ) ;
0 commit comments