| 1 |
package media |
| 2 |
|
| 3 |
type BuiltinTypes struct { |
| 4 |
CalendarType Type |
| 5 |
CSSType Type |
| 6 |
SCSSType Type |
| 7 |
SASSType Type |
| 8 |
GotmplType Type |
| 9 |
CSVType Type |
| 10 |
HTMLType Type |
| 11 |
JavascriptType Type |
| 12 |
TypeScriptType Type |
| 13 |
TSXType Type |
| 14 |
JSXType Type |
| 15 |
|
| 16 |
JSONType Type |
| 17 |
WebAppManifestType Type |
| 18 |
RSSType Type |
| 19 |
XMLType Type |
| 20 |
SVGType Type |
| 21 |
TextType Type |
| 22 |
TOMLType Type |
| 23 |
YAMLType Type |
| 24 |
SourceMapType Type |
| 25 |
|
| 26 |
// Common image types |
| 27 |
PNGType Type |
| 28 |
JPEGType Type |
| 29 |
GIFType Type |
| 30 |
TIFFType Type |
| 31 |
BMPType Type |
| 32 |
WEBPType Type |
| 33 |
AVIFType Type |
| 34 |
HEIFType Type |
| 35 |
HEICType Type |
| 36 |
|
| 37 |
// Common font types |
| 38 |
TrueTypeFontType Type |
| 39 |
OpenTypeFontType Type |
| 40 |
WOFFFontType Type |
| 41 |
WOFF2FontType Type |
| 42 |
|
| 43 |
// Common document types |
| 44 |
PDFType Type |
| 45 |
MarkdownType Type |
| 46 |
EmacsOrgModeType Type |
| 47 |
AsciiDocType Type |
| 48 |
PandocType Type |
| 49 |
ReStructuredTextType Type |
| 50 |
|
| 51 |
// Common video types |
| 52 |
AVIType Type |
| 53 |
MPEGType Type |
| 54 |
MP4Type Type |
| 55 |
OGGType Type |
| 56 |
WEBMType Type |
| 57 |
GPPType Type |
| 58 |
|
| 59 |
// wasm |
| 60 |
WasmType Type |
| 61 |
|
| 62 |
OctetType Type |
| 63 |
} |
| 64 |
|
| 65 |
var Builtin = BuiltinTypes{ |
| 66 |
CalendarType: Type{Type: "text/calendar"}, |
| 67 |
CSSType: Type{Type: "text/css"}, |
| 68 |
SCSSType: Type{Type: "text/x-scss"}, |
| 69 |
SASSType: Type{Type: "text/x-sass"}, |
| 70 |
GotmplType: Type{Type: "text/x-gotmpl"}, |
| 71 |
CSVType: Type{Type: "text/csv"}, |
| 72 |
HTMLType: Type{Type: "text/html"}, |
| 73 |
JavascriptType: Type{Type: "text/javascript"}, |
| 74 |
TypeScriptType: Type{Type: "text/typescript"}, |
| 75 |
TSXType: Type{Type: "text/tsx"}, |
| 76 |
JSXType: Type{Type: "text/jsx"}, |
| 77 |
|
| 78 |
JSONType: Type{Type: "application/json"}, |
| 79 |
WebAppManifestType: Type{Type: "application/manifest+json"}, |
| 80 |
RSSType: Type{Type: "application/rss+xml"}, |
| 81 |
XMLType: Type{Type: "application/xml"}, |
| 82 |
SVGType: Type{Type: "image/svg+xml"}, |
| 83 |
TextType: Type{Type: "text/plain"}, |
| 84 |
TOMLType: Type{Type: "application/toml"}, |
| 85 |
YAMLType: Type{Type: "application/yaml"}, |
| 86 |
SourceMapType: Type{Type: "application/source-map"}, |
| 87 |
|
| 88 |
// Common image types |
| 89 |
PNGType: Type{Type: "image/png"}, |
| 90 |
JPEGType: Type{Type: "image/jpeg"}, |
| 91 |
GIFType: Type{Type: "image/gif"}, |
| 92 |
TIFFType: Type{Type: "image/tiff"}, |
| 93 |
BMPType: Type{Type: "image/bmp"}, |
| 94 |
WEBPType: Type{Type: "image/webp"}, |
| 95 |
AVIFType: Type{Type: "image/avif"}, |
| 96 |
HEIFType: Type{Type: "image/heif"}, |
| 97 |
HEICType: Type{Type: "image/heic"}, |
| 98 |
|
| 99 |
// Common font types |
| 100 |
TrueTypeFontType: Type{Type: "font/ttf"}, |
| 101 |
OpenTypeFontType: Type{Type: "font/otf"}, |
| 102 |
WOFFFontType: Type{Type: "font/woff"}, |
| 103 |
WOFF2FontType: Type{Type: "font/woff2"}, |
| 104 |
|
| 105 |
// Common document types |
| 106 |
PDFType: Type{Type: "application/pdf"}, |
| 107 |
MarkdownType: Type{Type: "text/markdown"}, |
| 108 |
AsciiDocType: Type{Type: "text/asciidoc"}, // https://github.com/asciidoctor/asciidoctor/issues/2502 |
| 109 |
PandocType: Type{Type: "text/pandoc"}, |
| 110 |
ReStructuredTextType: Type{Type: "text/rst"}, // https://docutils.sourceforge.io/FAQ.html#what-s-the-official-mime-type-for-restructuredtext-data |
| 111 |
EmacsOrgModeType: Type{Type: "text/org"}, |
| 112 |
|
| 113 |
// Common video types |
| 114 |
AVIType: Type{Type: "video/x-msvideo"}, |
| 115 |
MPEGType: Type{Type: "video/mpeg"}, |
| 116 |
MP4Type: Type{Type: "video/mp4"}, |
| 117 |
OGGType: Type{Type: "video/ogg"}, |
| 118 |
WEBMType: Type{Type: "video/webm"}, |
| 119 |
GPPType: Type{Type: "video/3gpp"}, |
| 120 |
|
| 121 |
// Web assembly. |
| 122 |
WasmType: Type{Type: "application/wasm"}, |
| 123 |
|
| 124 |
OctetType: Type{Type: "application/octet-stream"}, |
| 125 |
} |
| 126 |
|
| 127 |
var defaultMediaTypesConfig = map[string]any{ |
| 128 |
"text/calendar": map[string]any{"suffixes": []string{"ics"}}, |
| 129 |
"text/css": map[string]any{"suffixes": []string{"css"}}, |
| 130 |
"text/x-scss": map[string]any{"suffixes": []string{"scss"}}, |
| 131 |
"text/x-sass": map[string]any{"suffixes": []string{"sass"}}, |
| 132 |
"text/csv": map[string]any{"suffixes": []string{"csv"}}, |
| 133 |
"text/html": map[string]any{"suffixes": []string{"html", "htm"}}, |
| 134 |
"text/javascript": map[string]any{"suffixes": []string{"js", "jsm", "mjs"}}, |
| 135 |
"text/typescript": map[string]any{"suffixes": []string{"ts"}}, |
| 136 |
"text/tsx": map[string]any{"suffixes": []string{"tsx"}}, |
| 137 |
"text/jsx": map[string]any{"suffixes": []string{"jsx"}}, |
| 138 |
"text/x-gotmpl": map[string]any{"suffixes": []string{"gotmpl"}}, |
| 139 |
|
| 140 |
"application/json": map[string]any{"suffixes": []string{"json"}}, |
| 141 |
"application/manifest+json": map[string]any{"suffixes": []string{"webmanifest"}}, |
| 142 |
"application/rss+xml": map[string]any{"suffixes": []string{"xml", "rss"}}, |
| 143 |
"application/xml": map[string]any{"suffixes": []string{"xml"}}, |
| 144 |
"image/svg+xml": map[string]any{"suffixes": []string{"svg"}}, |
| 145 |
"text/plain": map[string]any{"suffixes": []string{"txt"}}, |
| 146 |
"application/toml": map[string]any{"suffixes": []string{"toml"}}, |
| 147 |
"application/yaml": map[string]any{"suffixes": []string{"yaml", "yml"}}, |
| 148 |
"application/source-map": map[string]any{"suffixes": []string{"map"}}, |
| 149 |
|
| 150 |
// Common image types |
| 151 |
"image/png": map[string]any{"suffixes": []string{"png"}}, |
| 152 |
"image/jpeg": map[string]any{"suffixes": []string{"jpg", "jpeg", "jpe", "jif", "jfif"}}, |
| 153 |
"image/gif": map[string]any{"suffixes": []string{"gif"}}, |
| 154 |
"image/tiff": map[string]any{"suffixes": []string{"tif", "tiff"}}, |
| 155 |
"image/bmp": map[string]any{"suffixes": []string{"bmp"}}, |
| 156 |
"image/webp": map[string]any{"suffixes": []string{"webp"}}, |
| 157 |
"image/avif": map[string]any{"suffixes": []string{"avif"}}, |
| 158 |
"image/heif": map[string]any{"suffixes": []string{"heif"}}, |
| 159 |
"image/heic": map[string]any{"suffixes": []string{"heic"}}, |
| 160 |
|
| 161 |
// Common font types |
| 162 |
"font/ttf": map[string]any{"suffixes": []string{"ttf"}}, |
| 163 |
"font/otf": map[string]any{"suffixes": []string{"otf"}}, |
| 164 |
"font/woff": map[string]any{"suffixes": []string{"woff"}}, |
| 165 |
"font/woff2": map[string]any{"suffixes": []string{"woff2"}}, |
| 166 |
|
| 167 |
// Common document types |
| 168 |
"application/pdf": map[string]any{"suffixes": []string{"pdf"}}, |
| 169 |
"text/markdown": map[string]any{"suffixes": []string{"md", "mdown", "markdown"}}, |
| 170 |
"text/asciidoc": map[string]any{"suffixes": []string{"adoc", "asciidoc", "ad"}}, |
| 171 |
"text/pandoc": map[string]any{"suffixes": []string{"pandoc", "pdc"}}, |
| 172 |
"text/rst": map[string]any{"suffixes": []string{"rst"}}, |
| 173 |
"text/org": map[string]any{"suffixes": []string{"org"}}, |
| 174 |
|
| 175 |
// Common video types |
| 176 |
"video/x-msvideo": map[string]any{"suffixes": []string{"avi"}}, |
| 177 |
"video/mpeg": map[string]any{"suffixes": []string{"mpg", "mpeg"}}, |
| 178 |
"video/mp4": map[string]any{"suffixes": []string{"mp4"}}, |
| 179 |
"video/ogg": map[string]any{"suffixes": []string{"ogv"}}, |
| 180 |
"video/webm": map[string]any{"suffixes": []string{"webm"}}, |
| 181 |
"video/3gpp": map[string]any{"suffixes": []string{"3gpp", "3gp"}}, |
| 182 |
|
| 183 |
// wasm |
| 184 |
"application/wasm": map[string]any{"suffixes": []string{"wasm"}}, |
| 185 |
|
| 186 |
"application/octet-stream": map[string]any{}, |
| 187 |
} |