core: Move speedscope into a trace app. Isolate all the things.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m11s

This commit is contained in:
2025-11-23 20:08:51 -05:00
parent 716bce2bb0
commit 7c7857a6cd
23 changed files with 40 additions and 6 deletions

View File

@@ -959,8 +959,7 @@ PACKAGE_DIRS := \
core \ core \
deps/codemirror \ deps/codemirror \
deps/prettier \ deps/prettier \
deps/lit \ deps/lit
deps/speedscope
RAW_FILES := $(sort $(filter-out apps/blog% apps/issues% apps/welcome% apps/journal% %.map, $(shell find $(PACKAGE_DIRS) -type f -not -name '.*'))) RAW_FILES := $(sort $(filter-out apps/blog% apps/issues% apps/welcome% apps/journal% %.map, $(shell find $(PACKAGE_DIRS) -type f -not -name '.*')))
@@ -1260,7 +1259,6 @@ tarball: ## Build an all-inclusive source tarball (.tar.xz).
--exclude=deps/libsodium/test \ --exclude=deps/libsodium/test \
--exclude=deps/libuv/docs \ --exclude=deps/libuv/docs \
--exclude=deps/libuv/test \ --exclude=deps/libuv/test \
--exclude=deps/speedscope/*.map \
--exclude=deps/sqlite/shell.c \ --exclude=deps/sqlite/shell.c \
--exclude=deps/zlib/contrib/vstudio \ --exclude=deps/zlib/contrib/vstudio \
--exclude=deps/zlib/doc \ --exclude=deps/zlib/doc \

5
apps/trace.json Normal file
View File

@@ -0,0 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "📦",
"previous": "&mhBOscDHiJ4VNnod27NOdRVC+4cXYZXIdYjsQBfmTYg=.sha256"
}

25
apps/trace/app.js Normal file
View File

@@ -0,0 +1,25 @@
async function main() {
let speedscope_js = await utf8Decode(getFile('speedscope/speedscope-432XE7GS.js'));
speedscope_js = speedscope_js.replace(/alert\(`Cannot load.*?return/, '');
app.setDocument(`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>speedscope</title>
<link rel="stylesheet" href="speedscope/speedscope-GHPHNKXC.css">
</head>
<body>
<script>
delete window.localStorage;
window.location.hash = '#profileURL=${core.url}../../trace';
</script>
<script>${speedscope_js}</script>
</body>
</html>
`);
}
main();

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -912,7 +912,7 @@ async function edit() {
* Open a performance trace. * Open a performance trace.
*/ */
function trace() { function trace() {
window.open(`/speedscope/#profileURL=${encodeURIComponent('/trace')}`); window.open(`/~core/trace/`);
} }
/** /**

View File

@@ -965,7 +965,6 @@ tf_http_t* tf_httpd_create(JSContext* context)
tf_http_add_handler(http, "/codemirror/*", tf_httpd_endpoint_static, NULL, task); tf_http_add_handler(http, "/codemirror/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/lit/*", tf_httpd_endpoint_static, NULL, task); tf_http_add_handler(http, "/lit/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/prettier/*", tf_httpd_endpoint_static, NULL, task); tf_http_add_handler(http, "/prettier/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/speedscope/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/static/*", tf_httpd_endpoint_static, NULL, task); tf_http_add_handler(http, "/static/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/.well-known/*", tf_httpd_endpoint_static, NULL, task); tf_http_add_handler(http, "/.well-known/*", tf_httpd_endpoint_static, NULL, task);
tf_http_add_handler(http, "/&*.sha256", _httpd_endpoint_add_slash, NULL, task); tf_http_add_handler(http, "/&*.sha256", _httpd_endpoint_add_slash, NULL, task);

View File

@@ -138,7 +138,6 @@ void tf_httpd_endpoint_static(tf_http_request_t* request)
{ "/lit/", "deps/lit/" }, { "/lit/", "deps/lit/" },
{ "/codemirror/", "deps/codemirror/" }, { "/codemirror/", "deps/codemirror/" },
{ "/prettier/", "deps/prettier/" }, { "/prettier/", "deps/prettier/" },
{ "/speedscope/", "deps/speedscope/" },
{ "/.well-known/", "data/global/.well-known/" }, { "/.well-known/", "data/global/.well-known/" },
}; };

View File

@@ -151,6 +151,14 @@ static void _tf_ssb_import_recursive_add_files(tf_ssb_t* ssb, uv_loop_t* loop, J
tf_free(blob); tf_free(blob);
tf_free(full_path); tf_free(full_path);
} }
else if (ent.type == UV_DIRENT_DIR)
{
size_t len = strlen(path) + strlen(ent.name) + 2;
char* full_path = tf_malloc(len);
snprintf(full_path, len, "%s/%s", path, ent.name);
_tf_ssb_import_recursive_add_files(ssb, loop, context, files, root, full_path);
tf_free(full_path);
}
} }
} }
else else