Hook up prettier in the editor.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4854 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-17 18:53:21 +00:00
parent a12f2fec5a
commit 498d8b6520
8 changed files with 139 additions and 9 deletions

View File

@ -533,7 +533,8 @@ static const char* _ext_to_content_type(const char* ext)
{
if (ext)
{
if (strcmp(ext, ".js") == 0)
if (strcmp(ext, ".js") == 0 ||
strcmp(ext, ".mjs") == 0)
{
return "text/javascript; charset=UTF-8";
}
@ -640,6 +641,7 @@ static void _httpd_endpoint_static(tf_http_request_t* request)
{ "/static/", "core/" },
{ "/lit/", "deps/lit/" },
{ "/codemirror/", "deps/codemirror/" },
{ "/prettier/", "deps/prettier/" },
{ "/speedscope/", "deps/speedscope/" },
{ "/.well-known/", "data/global/.well-known/" },
};
@ -752,6 +754,7 @@ void tf_httpd_register(JSContext* context)
tf_http_add_handler(http, "/codemirror/", _httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/lit/", _httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/prettier/", _httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/speedscope/", _httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/static/", _httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/.well-known/", _httpd_endpoint_static, NULL, task);