From c8043129df8eb31f5229f8234c3a998822104bb3 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Wed, 16 Sep 2026 06:29:58 +0800 Subject: [PATCH 01/10] dist-web: options::page names the page (#649 P2) --- dist/web.cppm | 49 +++++++++++++++++++++++++--- tests/web-consumer/check-web-plan.sh | 29 +++++++++++++++- 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/dist/web.cppm b/dist/web.cppm index 941f38a..0c33e6f 100644 --- a/dist/web.cppm +++ b/dist/web.cppm @@ -1,5 +1,6 @@ // mcpp.dist.web -- the wasm32-emscripten stem family becomes a static -// directory a browser can load, with an `index.html` this member writes. +// directory a browser can load, with a page this member writes (`index.html` +// unless `options::page` names another). // // WHY THIS IS NEITHER A RULE NOR A TOOL, AND WHY IT COMPILES NO TRANSLATION // UNIT. Same shape `dist/appimage.cppm` and `dist/apple.cppm` already state: @@ -117,6 +118,14 @@ struct options { // `{{title}}` in the template. Empty means `[package] name`. std::string title; + // The page's file name inside the produced directory. Empty means + // `index.html`, what a static file server answers for the directory itself. + // A bare `*.html` name with no directory component: an Emscripten build + // through CMake names the page after the target (`.html`), and a + // project that ships such a page keeps its name (#649 P2). A name with a + // separator, or without the `.html` extension, is refused at plan time. + std::string page; + // Where the produced directory lands. Empty means `/web`. std::string output; std::string out_dir = std::string(mcpp::out_dir()); @@ -176,6 +185,25 @@ inline std::string target_for(const options& opt) { return (n && *n) ? std::string(n) : std::string(); } +// The page name `options::page` asks for, or the reason it cannot be used. +// Bare, because the page is written beside the launcher it loads with a +// relative `