Added the MP4 and WOFF2 cases to the AssetExtension enumeration.

This commit is contained in:
2026-08-25 16:06:05 +02:00
parent 1033cab2af
commit 5b2da4eb16
2 changed files with 26 additions and 13 deletions
@@ -10,6 +10,8 @@ public enum AssetExtension: String, CaseIterable, Sendable {
case jpg
/// A JavaScript file.
case js
/// An MPEG-4 video.
case mp4
/// A Portable Network Graphics image.
case png
/// A Scalable Vector Graphics image.
@@ -20,6 +22,8 @@ public enum AssetExtension: String, CaseIterable, Sendable {
case webmanifest
/// A WebP image.
case webp
/// A Web Open Font Format 2 font.
case woff2
/// An Extensible Markup Language file.
case xml
}
@@ -37,11 +41,13 @@ public extension AssetExtension {
case .ico: "image/vnd.microsoft.icon"
case .jpg: "image/jpeg"
case .js: "text/javascript"
case .mp4: "video/mp4"
case .png: "image/png"
case .svg: "image/svg+xml"
case .txt: "text/plain"
case .webmanifest: "application/manifest+json"
case .webp: "image/webp"
case .woff2: "font/woff2"
case .xml: "application/xml"
}
}
@@ -52,8 +58,9 @@ public extension AssetExtension {
case .css: "css"
case .js: "js"
case .jpg,
.mp4,
.webp: "media"
.webp: "img"
case .mp4: "video"
case .woff2: "font"
default: nil
}
}
@@ -53,38 +53,44 @@ private extension AssetExtensionTests {
static let extensions: [AssetExtension] = [
.css,
.js,
.png,
.jpg,
.webp,
.ico,
.jpg,
.js,
.mp4,
.png,
.svg,
.txt,
.webmanifest,
.webp,
.woff2,
.xml
]
static let contentTypes: [String] = [
"text/css",
"text/javascript",
"image/png",
"image/jpeg",
"image/webp",
"image/vnd.microsoft.icon",
"image/jpeg",
"text/javascript",
"video/mp4",
"image/png",
"image/svg+xml",
"text/plain",
"application/manifest+json",
"image/webp",
"font/woff2",
"application/xml"
]
static let folders: [String?] = [
"css",
nil,
"img",
"js",
nil,
"media",
"media",
"video",
nil,
nil,
nil,
nil,
"img",
"font",
nil
]