mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
31 lines
754 B
JavaScript
31 lines
754 B
JavaScript
// Mock for ESM-only mime package — Jest's module loader doesn't support require(esm)
|
|
const types = {
|
|
".png": "image/png",
|
|
".jpg": "image/jpeg",
|
|
".jpeg": "image/jpeg",
|
|
".gif": "image/gif",
|
|
".svg": "image/svg+xml",
|
|
".webp": "image/webp",
|
|
".ico": "image/x-icon",
|
|
".json": "application/json",
|
|
".js": "application/javascript",
|
|
".html": "text/html",
|
|
".css": "text/css",
|
|
".txt": "text/plain",
|
|
".md": "text/markdown",
|
|
}
|
|
|
|
module.exports = {
|
|
default: {
|
|
getType(path) {
|
|
const ext = "." + path.split(".").pop()
|
|
return types[ext] || null
|
|
},
|
|
getExtension(type) {
|
|
const entry = Object.entries(types).find(([, v]) => v === type)
|
|
return entry ? entry[0].slice(1) : null
|
|
},
|
|
},
|
|
__esModule: true,
|
|
}
|