You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0f1fa1a
Browse filesBrowse the repository at this point in the historyBrowse files
0.22.0: dist-web's page is the one distributable, a runner named web serves it, and the engine is told the program it wraps (#54)
* 0.22.0: dist-web's page is the one distributable, and a runner named web serves it
The page's step takes every copied file as an input, so the page is the
format's one distributable and `mcpp run --pkg-format web' is handed it; 0.21.0
declared each copied file a distributable, and the engine refused to choose.
The page's source is written to <out_dir>/.dist-web/<target>-<page>.in, not
beside the build's outputs as <target>-index.html, where it was opened as the
product and loaded nothing. When the directory is declared, a note names it
and says how it is opened: a browser loads the module only over HTTP.
`options::runner' (default true) declares a long-lived runner named `web':
emrun from the resolved Emscripten toolchain (emrun.bat on Windows), given
`--hostname localhost' and the page. `mcpp run --pkg-format web' serves the
directory on this machine with the types a browser requires, opens the page,
and serves until the operator ends it. Another browser, port or address is a
machine's choice, made by replacing the runner in its config.toml.
docs/dist.md states that link arguments are not a function of the package
format: `mcpp pack' stages the program the build linked; a link difference is
a profile's. tests/web-consumer asserts the one distributable, the note, the
runner and what it serves.
* dist-web: state why a web pack is declined as a warning, not on standard error
* 0.22.0: the version in the source and the development guide
* dist-web: state the program it wraps to the engine where the engine reads it
Module `mcpp.dist.web`; engine floor: 2026.9.13.1, the release that carries `${mcpp.self}` and `mcpp stage`'s argument shape as an engine contract (`stage --verify content --output <dst> <src>`) -- what lets this member's copy run on every host mcpp does, Windows included, in place of the `cp` this member used through 0.8.0.
20
20
21
21
**Needs and behaviour.** nothing beyond mcpp: `wasm32-emscripten` only. Copies `${mcpp.stage_dir}/bin/` -- the `.js` launcher, the implicit `.wasm`, the `.data` when present, and every `mcpp::deploy`'d file, all of which #622 A5 and A4 already stage there -- to `<out_dir>/web/`, dropping the `bin/` prefix a browser has no use for, and writes an `index.html` rendered from a project template or a built-in default that loads the script with a plain `<script src>`. Each staged file and the rendered page are copied with `${mcpp.self} stage --verify content --output <dst> <src>`, the same copier every `stage_file` edge in `build.ninja` already runs -- no host-specific copy tool, no plan-time `create_directories` (`stage` creates the destination's parent), and a second `mcpp pack --format web` with nothing changed copies nothing. From 0.12.0 `options::page` names the page (`index.html` by default), for a project whose other build names it after the target; a name that is not a bare `*.html` file name is refused at plan time
22
+
23
+
**The page, the runner and where the directory is (0.22.0).** The page is the format's one distributable: its step takes every copied file as an input, so no copied file is an output nothing consumes, and `mcpp run --pkg-format web` is handed the page (0.21.0 declared each copied file a distributable, and the engine refused to choose among them). The page's source is written to `<out_dir>/.dist-web/<target>-<page>.in`, not beside the build's outputs as `<target>-index.html`, where it was opened as the product and loaded nothing. When `mcpp pack --pkg-format web` declares the directory, a note names it and says how it is opened: a browser loads the module only over HTTP, and a page opened from disk cannot load its `.wasm`. When the member declines a request (another target, no launcher for the program it wraps, a page name it refuses), it states the reason as a warning, which a build program's successful run shows and its standard error does not; mcpp 2026.11.16.1 and later repeat it in the refusal of a pack that produced nothing. With mcpp 2026.11.16.1 and later (protocol 19) it also states the program `options::target` names to the engine (`mcpp::pack_program`), so `mcpp pack --pkg-format web` in a package with several programs packs that one without the program being named; an older engine keeps its own choice.
24
+
25
+
`options::runner` (default true) declares a long-lived runner named `web`: `emrun` from the resolved Emscripten toolchain (`<toolchain_dir>/emscripten/emrun`, `emrun.bat` on Windows), given `--hostname localhost` and the page. `mcpp run --pkg-format web` therefore serves the directory on this machine with the types a browser requires (`application/wasm`), opens the page in the default browser, and serves until the operator ends it. The server listens on `localhost` only; a machine that wants another browser, port or address replaces the runner in its `config.toml` (`[target.wasm32-emscripten.runners] web = ["<emsdk>/emscripten/emrun", "--port", "8080", "{}"]`). Measured on Linux: the module is served as `application/wasm`; on a machine with no browser emrun says so and keeps serving.
26
+
27
+
**Link arguments are not a function of the package format.** A build program that branches on `mcpp::pack_format()` to change link arguments (`-sSINGLE_FILE=1` for one format and not another) changes nothing: `mcpp pack` stages the program the build already linked, and its second pass does not link again. A link difference is a profile's (`[profile.web] ldflags`, selected with `--profile web`), which also names the build directory, so the two links do not overwrite each other.
0 commit comments