0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

refactor(utils/mime): make object and type commonality (#3606)

* refactor(utils/mime): make object and type commonality

* change to <string, BaseMime>
This commit is contained in:
EdamAmex 2024-11-02 19:43:49 +09:00 committed by GitHub
parent f3577a16b0
commit 3aad86c78c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,58 +32,9 @@ export { baseMimes as mimes }
/**
* Union types for BaseMime
*/
export type BaseMime =
| 'audio/aac'
| 'video/x-msvideo'
| 'image/avif'
| 'video/av1'
| 'application/octet-stream'
| 'image/bmp'
| 'text/css'
| 'text/csv'
| 'application/vnd.ms-fontobject'
| 'application/epub+zip'
| 'image/gif'
| 'application/gzip'
| 'text/html'
| 'image/x-icon'
| 'text/calendar'
| 'image/jpeg'
| 'text/javascript'
| 'application/json'
| 'application/ld+json'
| 'audio/x-midi'
| 'audio/mpeg'
| 'video/mp4'
| 'video/mpeg'
| 'audio/ogg'
| 'video/ogg'
| 'application/ogg'
| 'audio/opus'
| 'font/otf'
| 'application/pdf'
| 'image/png'
| 'application/rtf'
| 'image/svg+xml'
| 'image/tiff'
| 'video/mp2t'
| 'font/ttf'
| 'text/plain'
| 'application/wasm'
| 'video/webm'
| 'audio/webm'
| 'image/webp'
| 'font/woff'
| 'font/woff2'
| 'application/xhtml+xml'
| 'application/xml'
| 'application/zip'
| 'video/3gpp'
| 'video/3gpp2'
| 'model/gltf+json'
| 'model/gltf-binary'
export type BaseMime = (typeof _baseMimes)[keyof typeof _baseMimes]
const baseMimes: Record<string, BaseMime> = {
const _baseMimes = {
aac: 'audio/aac',
avi: 'video/x-msvideo',
avif: 'image/avif',
@ -139,4 +90,6 @@ const baseMimes: Record<string, BaseMime> = {
'3g2': 'video/3gpp2',
gltf: 'model/gltf+json',
glb: 'model/gltf-binary',
}
} as const
const baseMimes: Record<string, BaseMime> = _baseMimes