Skip to content

Commit

Permalink
Added new methods to the Manifest service
Browse files Browse the repository at this point in the history
  • Loading branch information
Eptagone committed Sep 16, 2023
1 parent 96b71ff commit 6f0deb0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
15 changes: 14 additions & 1 deletion src/Vite.AspNetCore.Abstractions/IViteManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,17 @@ public interface IViteManifest : IEnumerable<IViteChunk>
/// <param name="key"></param>
/// <returns>The chunk if it exists, otherwise <see langword="null"/>.</returns>
IViteChunk? this[string key] { get; }
}

/// <summary>
/// Gets an enumerable collection that contains the chunk keys in the manifest.
/// </summary>
/// <returns>An enumerable collection that contains the chunk keys in the manifest.</returns>
IEnumerable<string> Keys { get; }

/// <summary>
/// Determines whether the manifest contains a chunk with the specified key entry.
/// </summary>
/// <param name="key">The eky entry to locate.</param>
/// <returns>true if the manifest contains a chunk with the specified key entry; otherwise, false.</returns>
bool ContainsKey(string key);
}
33 changes: 21 additions & 12 deletions src/Vite.AspNetCore/Services/ViteManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,27 @@ public IViteChunk? this[string key]
}
}

/// <inheritdoc/>
IEnumerator<IViteChunk> IEnumerable<IViteChunk>.GetEnumerator()
{
return this._chunks.Values.GetEnumerator();
}

/// <inheritdoc/>
IEnumerator IEnumerable.GetEnumerator()
{
return this._chunks.Values.GetEnumerator();
}

/// <inheritdoc/>
IEnumerable<string> IViteManifest.Keys => this._chunks.Keys;

/// <inheritdoc/>
bool IViteManifest.ContainsKey(string key)
{
return this._chunks.ContainsKey(key);
}

/// <summary>
/// Combines the specified URI and paths.
/// </summary>
Expand All @@ -154,16 +175,4 @@ private static string CombineUri(string uri, string path)

return uri.EndsWith('/') ? uri + path : uri + "/" + path;
}

/// <inheritdoc/>
IEnumerator<IViteChunk> IEnumerable<IViteChunk>.GetEnumerator()
{
return this._chunks.Values.GetEnumerator();
}

/// <inheritdoc/>
IEnumerator IEnumerable.GetEnumerator()
{
return this._chunks.Values.GetEnumerator();
}
}

0 comments on commit 6f0deb0

Please sign in to comment.