2025-05-11 10:54:15 +03:00
|
|
|
import { LanguageSupport, type StreamParser } from "@codemirror/language"
|
2025-05-10 22:29:32 +03:00
|
|
|
|
2025-05-11 14:05:04 +03:00
|
|
|
async function buildJavaScript() {
|
|
|
|
const { javascript } = await import('@codemirror/lang-javascript');
|
|
|
|
return javascript();
|
|
|
|
}
|
|
|
|
|
2025-05-11 13:09:36 +03:00
|
|
|
const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | LanguageSupport>) | null> = {
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/plain": null,
|
2025-05-11 11:10:24 +03:00
|
|
|
|
|
|
|
"application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart,
|
2025-05-11 12:54:25 +03:00
|
|
|
"application/edn": async () => (await import('@codemirror/legacy-modes/mode/clojure')).clojure,
|
2025-05-11 14:05:04 +03:00
|
|
|
"application/javascript;env=backend": buildJavaScript,
|
|
|
|
"application/javascript;env=frontend": buildJavaScript,
|
2025-05-11 11:10:24 +03:00
|
|
|
"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,
|
2025-05-11 12:54:25 +03:00
|
|
|
"application/pgp": async () => (await import('@codemirror/legacy-modes/mode/asciiarmor')).asciiArmor,
|
2025-05-11 11:10:24 +03:00
|
|
|
"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,
|
2025-05-10 22:29:32 +03:00
|
|
|
"application/x-aspx": null,
|
2025-05-11 10:38:36 +03:00
|
|
|
"application/x-bat": async () => (await import("./languages/batch.js")).batch,
|
2025-05-11 11:10:24 +03:00
|
|
|
"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,
|
2025-05-11 13:56:34 +03:00
|
|
|
"text/css": async () => (await import('@codemirror/lang-css')).css(),
|
2025-05-11 13:50:04 +03:00
|
|
|
"text/html": async () => (await import('@codemirror/lang-html')).html(),
|
2025-05-11 11:10:24 +03:00
|
|
|
"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,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-brainfuck": async () => (await import('@codemirror/legacy-modes/mode/brainfuck')).brainfuck,
|
|
|
|
"text/x-c++src": async () => (await import('@codemirror/legacy-modes/mode/clike')).cpp,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-cassandra": async () => (await import('@codemirror/legacy-modes/mode/sql')).cassandra,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-clojure": async () => (await import('@codemirror/legacy-modes/mode/clojure')).clojure,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-clojurescript": async () => (await import('@codemirror/legacy-modes/mode/clojure')).clojure,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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/x-common-lisp": async () => (await import('@codemirror/legacy-modes/mode/commonlisp')).commonLisp,
|
|
|
|
"text/x-crystal": async () => (await import('@codemirror/legacy-modes/mode/crystal')).crystal,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-csharp": async () => (await import('@codemirror/legacy-modes/mode/clike')).csharp,
|
|
|
|
"text/x-csrc": async () => (await import('@codemirror/legacy-modes/mode/clike')).c,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-cython": async () => (await import('@codemirror/legacy-modes/mode/python')).cython,
|
|
|
|
"text/x-d": async () => (await import('@codemirror/legacy-modes/mode/d')).d,
|
|
|
|
"text/x-diff": async () => (await import('@codemirror/legacy-modes/mode/diff')).diff,
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/x-django": null,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-dockerfile": async () => (await import('@codemirror/legacy-modes/mode/dockerfile')).dockerFile,
|
|
|
|
"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,
|
|
|
|
"text/x-eiffel": async () => (await import('@codemirror/legacy-modes/mode/eiffel')).eiffel,
|
|
|
|
"text/x-elm": async () => (await import('@codemirror/legacy-modes/mode/elm')).elm,
|
|
|
|
"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-factor": async () => (await import('@codemirror/legacy-modes/mode/factor')).factor,
|
|
|
|
"text/x-fcl": async () => (await import('@codemirror/legacy-modes/mode/fcl')).fcl,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-feature": async () => (await import('@codemirror/legacy-modes/mode/gherkin')).gherkin,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-forth": async () => (await import('@codemirror/legacy-modes/mode/forth')).forth,
|
|
|
|
"text/x-fortran": async () => (await import('@codemirror/legacy-modes/mode/fortran')).fortran,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-fsharp": async () => (await import('@codemirror/legacy-modes/mode/mllike')).fSharp,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-gas": async () => (await import('@codemirror/legacy-modes/mode/gas')).gas,
|
2025-05-11 11:18:19 +03:00
|
|
|
"text/x-gdscript": async () => (await import('./languages/gdscript.js')).gdscript,
|
2025-05-11 13:09:36 +03:00
|
|
|
"text/x-gfm": async () => {
|
|
|
|
const { markdown, markdownLanguage } = (await import('@codemirror/lang-markdown'));
|
|
|
|
return markdown({
|
|
|
|
base: markdownLanguage
|
|
|
|
});
|
|
|
|
},
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-go": async () => (await import('@codemirror/legacy-modes/mode/go')).go,
|
|
|
|
"text/x-groovy": async () => (await import('@codemirror/legacy-modes/mode/groovy')).groovy,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-gss": async () => (await import('@codemirror/legacy-modes/mode/css')).gss,
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/x-haml": null,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-haskell": async () => (await import('@codemirror/legacy-modes/mode/haskell')).haskell,
|
|
|
|
"text/x-haxe": async () => (await import('@codemirror/legacy-modes/mode/haxe')).haxe,
|
2025-05-11 13:09:36 +03:00
|
|
|
"text/x-hcl": async () => (await import('codemirror-lang-hcl')).hcl(),
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-hxml": async () => (await import('@codemirror/legacy-modes/mode/haxe')).hxml,
|
|
|
|
"text/x-idl": async () => (await import('@codemirror/legacy-modes/mode/idl')).idl,
|
|
|
|
"text/x-java": async () => (await import('@codemirror/legacy-modes/mode/clike')).java,
|
|
|
|
"text/x-julia": async () => (await import('@codemirror/legacy-modes/mode/julia')).julia,
|
|
|
|
"text/x-kotlin": async () => (await import('@codemirror/legacy-modes/mode/clike')).kotlin,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-latex": async () => (await import('@codemirror/legacy-modes/mode/stex')).stex,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-less": async () => (await import('@codemirror/legacy-modes/mode/css')).less,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-literate-haskell": null,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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,
|
2025-05-11 13:09:36 +03:00
|
|
|
"text/x-markdown": async () => ((await import('@codemirror/lang-markdown')).markdown()),
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-mathematica": async () => (await import('@codemirror/legacy-modes/mode/mathematica')).mathematica,
|
|
|
|
"text/x-modelica": async () => (await import('@codemirror/legacy-modes/mode/modelica')).modelica,
|
|
|
|
"text/x-mscgen": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).mscgen,
|
|
|
|
"text/x-msgenny": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).msgenny,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-mssql": async () => (await import('@codemirror/legacy-modes/mode/sql')).msSQL,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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,
|
|
|
|
"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,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-pgsql": async () => (await import('@codemirror/legacy-modes/mode/sql')).pgSQL,
|
2025-05-11 13:12:52 +03:00
|
|
|
"text/x-php": async () => ((await import('@codemirror/lang-php')).php()),
|
2025-05-10 23:09:59 +03:00
|
|
|
"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-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-rpm-changes": async () => (await import('@codemirror/legacy-modes/mode/rpm')).rpmChanges,
|
|
|
|
"text/x-rpm-spec": async () => (await import('@codemirror/legacy-modes/mode/rpm')).rpmSpec,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-rsrc": async () => (await import('@codemirror/legacy-modes/mode/r')).r,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-rst": null,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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,
|
|
|
|
"text/x-sass": async () => (await import('@codemirror/legacy-modes/mode/sass')).sass,
|
|
|
|
"text/x-scala": async () => (await import('@codemirror/legacy-modes/mode/clike')).scala,
|
|
|
|
"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,
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/x-slim": null,
|
2025-05-11 13:21:57 +03:00
|
|
|
"text/x-smarty": async () => ((await import('@ssddanbrown/codemirror-lang-smarty')).smarty),
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-sml": async () => (await import('@codemirror/legacy-modes/mode/mllike')).sml,
|
|
|
|
"text/x-solr": async () => (await import('@codemirror/legacy-modes/mode/solr')).solr,
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/x-soy": null,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-stsrc": async () => (await import('@codemirror/legacy-modes/mode/smalltalk')).smalltalk,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-styl": async () => (await import('@codemirror/legacy-modes/mode/stylus')).stylus,
|
|
|
|
"text/x-swift": async () => (await import('@codemirror/legacy-modes/mode/swift')).swift,
|
2025-05-11 12:54:25 +03:00
|
|
|
"text/x-systemverilog": async () => (await import('@codemirror/legacy-modes/mode/verilog')).verilog,
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-tcl": async () => (await import('@codemirror/legacy-modes/mode/tcl')).tcl,
|
|
|
|
"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/x-toml": async () => (await import('@codemirror/legacy-modes/mode/toml')).toml,
|
2025-05-10 22:29:32 +03:00
|
|
|
"text/x-tornado": null,
|
2025-05-11 11:10:24 +03:00
|
|
|
"text/x-ttcn-asn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
|
2025-05-10 23:09:59 +03:00
|
|
|
"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,
|
2025-05-11 13:15:39 +03:00
|
|
|
"text/x-twig": async () => ((await import('@ssddanbrown/codemirror-lang-twig')).twig()),
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-vb": async () => (await import('@codemirror/legacy-modes/mode/vb')).vb,
|
|
|
|
"text/x-verilog": async () => (await import('@codemirror/legacy-modes/mode/verilog')).verilog,
|
|
|
|
"text/x-vhdl": async () => (await import('@codemirror/legacy-modes/mode/vhdl')).vhdl,
|
2025-05-11 13:13:47 +03:00
|
|
|
"text/x-vue": async () => ((await import('@codemirror/lang-vue')).vue()),
|
2025-05-10 23:09:59 +03:00
|
|
|
"text/x-webidl": async () => (await import('@codemirror/legacy-modes/mode/webidl')).webIDL,
|
|
|
|
"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,
|
2025-05-11 11:18:19 +03:00
|
|
|
"text/x-z80": async () => (await import('@codemirror/legacy-modes/mode/z80')).z80,
|
2025-05-11 13:52:53 +03:00
|
|
|
"text/xml": async () => (await import('@codemirror/lang-xml')).xml()
|
2025-05-10 22:29:32 +03:00
|
|
|
}
|
|
|
|
|
2025-05-10 23:34:23 +03:00
|
|
|
export default byMimeType;
|