UNPKG

static-browser-server

Version:

A simple service worker used for the static template in sandpack, allowing users to develop websites like they would locally in the browser.

19 lines (15 loc) 418 B
import mimeDB from "mime-db"; const extensionMap = new Map<string, string>(); const entries = Object.entries(mimeDB); for (const [mimetype, entry] of entries) { if (!entry.extensions) { continue; } const extensions = entry.extensions as string[]; if (extensions.length) { for (const ext of extensions) { extensionMap.set(ext, mimetype); } } } export const EXTENSIONS_MAP = extensionMap;