refactor(code): sort by mime type

This commit is contained in:
Elian Doran 2025-05-11 11:10:24 +03:00
parent 9f3e990c95
commit 55cf7e0c9b
No known key found for this signature in database

View File

@ -2,112 +2,123 @@ import { LanguageSupport, type StreamParser } from "@codemirror/language"
const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | (() => LanguageSupport)>) | null> = {
"text/plain": null,
"text/apl": async () => (await import('@codemirror/legacy-modes/mode/apl')).apl,
"text/x-ttcn-asn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
"application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart,
"application/edn": null,
"application/javascript;env=backend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
"application/javascript;env=frontend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
"application/json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).json,
"application/ld+json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).jsonld,
"application/mbox": async () => (await import('@codemirror/legacy-modes/mode/mbox')).mbox,
"application/n-triples": async () => (await import('@codemirror/legacy-modes/mode/ntriples')).ntriples,
"application/pgp": null,
"application/sieve": async () => (await import('@codemirror/legacy-modes/mode/sieve')).sieve,
"application/sparql-query": async () => (await import('@codemirror/legacy-modes/mode/sparql')).sparql,
"application/typescript": async () => (await import('@codemirror/legacy-modes/mode/javascript')).typescript,
"application/x-aspx": null,
"text/x-asterisk": async () => (await import('@codemirror/legacy-modes/mode/asterisk')).asterisk,
"application/x-bat": async () => (await import("./languages/batch.js")).batch,
"application/x-cypher-query": async () => (await import('@codemirror/legacy-modes/mode/cypher')).cypher,
"application/x-ejs": null,
"application/x-erb": null,
"application/x-jsp": null,
"application/x-powershell": async () => (await import('@codemirror/legacy-modes/mode/powershell')).powerShell,
"application/xml-dtd": async () => (await import('@codemirror/legacy-modes/mode/xml')).xml,
"application/xquery": async () => (await import('@codemirror/legacy-modes/mode/xquery')).xQuery,
"message/http": async () => (await import('@codemirror/legacy-modes/mode/http')).http,
"text/apl": async () => (await import('@codemirror/legacy-modes/mode/apl')).apl,
"text/coffeescript": async () => (await import('@codemirror/legacy-modes/mode/coffeescript')).coffeeScript,
"text/css": async () => (await import('@codemirror/legacy-modes/mode/css')).css,
"text/html": async () => (await import('@codemirror/legacy-modes/mode/xml')).html,
"text/jinja2": async () => (await import('@codemirror/legacy-modes/mode/jinja2')).jinja2,
"text/jsx": null,
"text/mirc": async () => (await import('@codemirror/legacy-modes/mode/mirc')).mirc,
"text/tiki": async () => (await import('@codemirror/legacy-modes/mode/tiki')).tiki,
"text/troff": async () => (await import('@codemirror/legacy-modes/mode/troff')).troff,
"text/turtle": async () => (await import('@codemirror/legacy-modes/mode/turtle')).turtle,
"text/typescript-jsx": null,
"text/vbscript": async () => (await import('@codemirror/legacy-modes/mode/vbscript')).vbScript,
"text/velocity": async () => (await import('@codemirror/legacy-modes/mode/velocity')).velocity,
"text/x-asm-mips": null,
"text/x-asterisk": async () => (await import('@codemirror/legacy-modes/mode/asterisk')).asterisk,
"text/x-brainfuck": async () => (await import('@codemirror/legacy-modes/mode/brainfuck')).brainfuck,
"text/x-csrc": async () => (await import('@codemirror/legacy-modes/mode/clike')).c,
"text/x-csharp": async () => (await import('@codemirror/legacy-modes/mode/clike')).csharp,
"text/x-c++src": async () => (await import('@codemirror/legacy-modes/mode/clike')).cpp,
"text/x-cassandra": async () => (await import('@codemirror/legacy-modes/mode/sql')).cassandra,
"text/x-clojure": async () => (await import('@codemirror/legacy-modes/mode/clojure')).clojure,
"text/x-clojurescript": null,
"text/x-gss": async () => (await import('@codemirror/legacy-modes/mode/css')).gss,
"text/x-cmake": async () => (await import('@codemirror/legacy-modes/mode/cmake')).cmake,
"text/x-cobol": async () => (await import('@codemirror/legacy-modes/mode/cobol')).cobol,
"text/coffeescript": async () => (await import('@codemirror/legacy-modes/mode/coffeescript')).coffeeScript,
"text/x-common-lisp": async () => (await import('@codemirror/legacy-modes/mode/commonlisp')).commonLisp,
"text/x-cassandra": async () => (await import('@codemirror/legacy-modes/mode/sql')).cassandra,
"text/x-crystal": async () => (await import('@codemirror/legacy-modes/mode/crystal')).crystal,
"text/css": async () => (await import('@codemirror/legacy-modes/mode/css')).css,
"application/x-cypher-query": async () => (await import('@codemirror/legacy-modes/mode/cypher')).cypher,
"text/x-csharp": async () => (await import('@codemirror/legacy-modes/mode/clike')).csharp,
"text/x-csrc": async () => (await import('@codemirror/legacy-modes/mode/clike')).c,
"text/x-cython": async () => (await import('@codemirror/legacy-modes/mode/python')).cython,
"text/x-d": async () => (await import('@codemirror/legacy-modes/mode/d')).d,
"application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart,
"text/x-diff": async () => (await import('@codemirror/legacy-modes/mode/diff')).diff,
"text/x-django": null,
"text/x-dockerfile": async () => (await import('@codemirror/legacy-modes/mode/dockerfile')).dockerFile,
"application/xml-dtd": async () => (await import('@codemirror/legacy-modes/mode/xml')).xml,
"text/x-dylan": async () => (await import('@codemirror/legacy-modes/mode/dylan')).dylan,
"text/x-ebnf": async () => (await import('@codemirror/legacy-modes/mode/ebnf')).ebnf,
"text/x-ecl": async () => (await import('@codemirror/legacy-modes/mode/ecl')).ecl,
"application/edn": null,
"text/x-eiffel": async () => (await import('@codemirror/legacy-modes/mode/eiffel')).eiffel,
"text/x-elm": async () => (await import('@codemirror/legacy-modes/mode/elm')).elm,
"application/x-ejs": null,
"application/x-erb": null,
"text/x-erlang": async () => (await import('@codemirror/legacy-modes/mode/erlang')).erlang,
"text/x-esper": async () => (await import('@codemirror/legacy-modes/mode/sql')).esper,
"text/x-fsharp": async () => (await import('@codemirror/legacy-modes/mode/mllike')).fSharp,
"text/x-factor": async () => (await import('@codemirror/legacy-modes/mode/factor')).factor,
"text/x-fcl": async () => (await import('@codemirror/legacy-modes/mode/fcl')).fcl,
"text/x-feature": null,
"text/x-forth": async () => (await import('@codemirror/legacy-modes/mode/forth')).forth,
"text/x-fortran": async () => (await import('@codemirror/legacy-modes/mode/fortran')).fortran,
"text/x-fsharp": async () => (await import('@codemirror/legacy-modes/mode/mllike')).fSharp,
"text/x-gas": async () => (await import('@codemirror/legacy-modes/mode/gas')).gas,
"text/x-feature": null,
"text/x-gfm": null,
"text/x-go": async () => (await import('@codemirror/legacy-modes/mode/go')).go,
"text/x-groovy": async () => (await import('@codemirror/legacy-modes/mode/groovy')).groovy,
"text/x-gss": async () => (await import('@codemirror/legacy-modes/mode/css')).gss,
"text/x-haml": null,
"text/x-literate-haskell": null,
"text/x-haskell": async () => (await import('@codemirror/legacy-modes/mode/haskell')).haskell,
"text/x-haxe": async () => (await import('@codemirror/legacy-modes/mode/haxe')).haxe,
"text/html": async () => (await import('@codemirror/legacy-modes/mode/xml')).html,
"message/http": async () => (await import('@codemirror/legacy-modes/mode/http')).http,
"text/x-hcl": async () => (await import('codemirror-lang-hcl')).hcl,
"text/x-hxml": async () => (await import('@codemirror/legacy-modes/mode/haxe')).hxml,
"text/x-idl": async () => (await import('@codemirror/legacy-modes/mode/idl')).idl,
"application/x-jsp": null,
"text/x-java": async () => (await import('@codemirror/legacy-modes/mode/clike')).java,
"text/jinja2": async () => (await import('@codemirror/legacy-modes/mode/jinja2')).jinja2,
"application/javascript;env=backend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
"application/javascript;env=frontend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
"application/ld+json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).jsonld,
"application/json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).json,
"text/jsx": null,
"text/x-julia": async () => (await import('@codemirror/legacy-modes/mode/julia')).julia,
"text/x-kotlin": async () => (await import('@codemirror/legacy-modes/mode/clike')).kotlin,
"text/x-latex": null,
"text/x-less": async () => (await import('@codemirror/legacy-modes/mode/css')).less,
"text/x-literate-haskell": null,
"text/x-livescript": async () => (await import('@codemirror/legacy-modes/mode/livescript')).liveScript,
"text/x-lua": async () => (await import('@codemirror/legacy-modes/mode/lua')).lua,
"text/x-mariadb": async () => (await import('@codemirror/legacy-modes/mode/sql')).sqlite,
"text/x-markdown": null,
"text/x-mathematica": async () => (await import('@codemirror/legacy-modes/mode/mathematica')).mathematica,
"application/mbox": async () => (await import('@codemirror/legacy-modes/mode/mbox')).mbox,
"text/x-asm-mips": null,
"text/mirc": async () => (await import('@codemirror/legacy-modes/mode/mirc')).mirc,
"text/x-modelica": async () => (await import('@codemirror/legacy-modes/mode/modelica')).modelica,
"text/x-mssql": async () => (await import('@codemirror/legacy-modes/mode/sql')).msSQL,
"text/x-mscgen": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).mscgen,
"text/x-msgenny": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).msgenny,
"text/x-mssql": async () => (await import('@codemirror/legacy-modes/mode/sql')).msSQL,
"text/x-mumps": async () => (await import('@codemirror/legacy-modes/mode/mumps')).mumps,
"text/x-mysql": async () => (await import('@codemirror/legacy-modes/mode/sql')).mySQL,
"text/x-nginx-conf": async () => (await import('@codemirror/legacy-modes/mode/nginx')).nginx,
"text/x-nsis": async () => (await import('@codemirror/legacy-modes/mode/nsis')).nsis,
"application/n-triples": async () => (await import('@codemirror/legacy-modes/mode/ntriples')).ntriples,
"text/x-objectivec": async () => (await import('@codemirror/legacy-modes/mode/clike')).objectiveC,
"text/x-ocaml": async () => (await import('@codemirror/legacy-modes/mode/mllike')).oCaml,
"text/x-octave": async () => (await import('@codemirror/legacy-modes/mode/octave')).octave,
"text/x-oz": async () => (await import('@codemirror/legacy-modes/mode/oz')).oz,
"text/x-pascal": async () => (await import('@codemirror/legacy-modes/mode/pascal')).pascal,
"text/x-perl": async () => (await import('@codemirror/legacy-modes/mode/perl')).perl,
"application/pgp": null,
"text/x-pgsql": async () => (await import('@codemirror/legacy-modes/mode/sql')).pgSQL,
"text/x-php": null,
"text/x-pig": async () => (await import('@codemirror/legacy-modes/mode/pig')).pig,
"text/x-plsql": async () => (await import('@codemirror/legacy-modes/mode/sql')).plSQL,
"text/x-pgsql": async () => (await import('@codemirror/legacy-modes/mode/sql')).pgSQL,
"application/x-powershell": async () => (await import('@codemirror/legacy-modes/mode/powershell')).powerShell,
"text/x-properties": async () => (await import('@codemirror/legacy-modes/mode/properties')).properties,
"text/x-protobuf": async () => (await import('@codemirror/legacy-modes/mode/protobuf')).protobuf,
"text/x-pug": async () => (await import('@codemirror/legacy-modes/mode/pug')).pug,
"text/x-puppet": async () => (await import('@codemirror/legacy-modes/mode/puppet')).puppet,
"text/x-python": async () => (await import('@codemirror/legacy-modes/mode/python')).python,
"text/x-q": async () => (await import('@codemirror/legacy-modes/mode/q')).q,
"text/x-rsrc": null,
"text/x-rst": null,
"text/x-rpm-changes": async () => (await import('@codemirror/legacy-modes/mode/rpm')).rpmChanges,
"text/x-rpm-spec": async () => (await import('@codemirror/legacy-modes/mode/rpm')).rpmSpec,
"text/x-rsrc": null,
"text/x-rst": null,
"text/x-ruby": async () => (await import('@codemirror/legacy-modes/mode/ruby')).ruby,
"text/x-rustsrc": async () => (await import('@codemirror/legacy-modes/mode/rust')).rust,
"text/x-sas": async () => (await import('@codemirror/legacy-modes/mode/sas')).sas,
@ -116,50 +127,40 @@ const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | (() => L
"text/x-scheme": async () => (await import('@codemirror/legacy-modes/mode/scheme')).scheme,
"text/x-scss": async () => (await import('@codemirror/legacy-modes/mode/css')).sCSS,
"text/x-sh": async () => (await import('@codemirror/legacy-modes/mode/shell')).shell,
"application/sieve": async () => (await import('@codemirror/legacy-modes/mode/sieve')).sieve,
"text/x-slim": null,
"text/x-stsrc": null,
"text/x-smarty": null,
"text/x-sml": async () => (await import('@codemirror/legacy-modes/mode/mllike')).sml,
"text/x-solr": async () => (await import('@codemirror/legacy-modes/mode/solr')).solr,
"text/x-soy": null,
"application/sparql-query": async () => (await import('@codemirror/legacy-modes/mode/sparql')).sparql,
"text/x-spreadsheet": async () => (await import('@codemirror/legacy-modes/mode/spreadsheet')).spreadsheet,
"text/x-sql": async () => (await import('@codemirror/legacy-modes/mode/sql')).mySQL,
"text/x-sqlite;schema=trilium": async () => (await import('@codemirror/legacy-modes/mode/sql')).sqlite,
"text/x-sqlite": async () => (await import('@codemirror/legacy-modes/mode/sql')).sqlite,
"text/x-squirrel": async () => (await import('@codemirror/legacy-modes/mode/clike')).squirrel,
"text/x-stex": async () => (await import('@codemirror/legacy-modes/mode/stex')).stex,
"text/x-stsrc": null,
"text/x-styl": async () => (await import('@codemirror/legacy-modes/mode/stylus')).stylus,
"text/x-swift": async () => (await import('@codemirror/legacy-modes/mode/swift')).swift,
"text/x-systemverilog": null,
"text/x-tcl": async () => (await import('@codemirror/legacy-modes/mode/tcl')).tcl,
"text/x-hcl": async () => (await import('codemirror-lang-hcl')).hcl,
"text/x-textile": async () => (await import('@codemirror/legacy-modes/mode/textile')).textile,
"text/x-tiddlywiki": async () => (await import('@codemirror/legacy-modes/mode/tiddlywiki')).tiddlyWiki,
"text/tiki": async () => (await import('@codemirror/legacy-modes/mode/tiki')).tiki,
"text/x-toml": async () => (await import('@codemirror/legacy-modes/mode/toml')).toml,
"text/x-tornado": null,
"text/troff": async () => (await import('@codemirror/legacy-modes/mode/troff')).troff,
"text/x-ttcn-asn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
"text/x-ttcn-cfg": async () => (await import('@codemirror/legacy-modes/mode/ttcn-cfg')).ttcnCfg,
"text/x-ttcn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
"text/turtle": async () => (await import('@codemirror/legacy-modes/mode/turtle')).turtle,
"text/x-twig": null,
"text/typescript-jsx": null,
"application/typescript": async () => (await import('@codemirror/legacy-modes/mode/javascript')).typescript,
"text/x-vb": async () => (await import('@codemirror/legacy-modes/mode/vb')).vb,
"text/vbscript": async () => (await import('@codemirror/legacy-modes/mode/vbscript')).vbScript,
"text/velocity": async () => (await import('@codemirror/legacy-modes/mode/velocity')).velocity,
"text/x-verilog": async () => (await import('@codemirror/legacy-modes/mode/verilog')).verilog,
"text/x-vhdl": async () => (await import('@codemirror/legacy-modes/mode/vhdl')).vhdl,
"text/x-vue": null,
"text/x-webidl": async () => (await import('@codemirror/legacy-modes/mode/webidl')).webIDL,
"text/xml": async () => (await import('@codemirror/legacy-modes/mode/xml')).xml,
"application/xquery": async () => (await import('@codemirror/legacy-modes/mode/xquery')).xQuery,
"text/x-xu": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).xu,
"text/x-yacas": async () => (await import('@codemirror/legacy-modes/mode/yacas')).yacas,
"text/x-yaml": async () => (await import('@codemirror/legacy-modes/mode/yaml')).yaml,
"text/x-z80": async () => (await import('@codemirror/legacy-modes/mode/z80')).z80
"text/xml": async () => (await import('@codemirror/legacy-modes/mode/xml')).xml,
}
export default byMimeType;