-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor agent code so that it can be shared with dotnet-watch implementation via a shared project. Add new API applyHotReloadDeltas to apply updates.
- Loading branch information
Showing
14 changed files
with
528 additions
and
253 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Components/WebAssembly/WebAssembly/src/HotReload/AgentMessageSeverity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.Extensions.HotReload; | ||
|
||
internal enum AgentMessageSeverity : byte | ||
{ | ||
Verbose = 0, | ||
Warning = 1, | ||
Error = 2, | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Components/WebAssembly/WebAssembly/src/HotReload/AgentReporter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Linq; | ||
|
||
namespace Microsoft.Extensions.HotReload; | ||
|
||
internal sealed class AgentReporter | ||
{ | ||
private readonly List<(string message, AgentMessageSeverity severity)> _log = []; | ||
|
||
public void Report(string message, AgentMessageSeverity severity) | ||
{ | ||
_log.Add((message, severity)); | ||
} | ||
|
||
public IReadOnlyCollection<(string message, AgentMessageSeverity severity)> GetAndClearLogEntries(ResponseLoggingLevel level) | ||
{ | ||
lock (_log) | ||
{ | ||
var filteredLog = (level != ResponseLoggingLevel.Verbose) | ||
? _log.Where(static entry => entry.severity != AgentMessageSeverity.Verbose) | ||
: _log; | ||
|
||
var log = filteredLog.ToArray(); | ||
_log.Clear(); | ||
return log; | ||
} | ||
} | ||
} |
Oops, something went wrong.