euv_cli/build/enum.rs
1use crate::*;
2
3/// The action to perform.
4///
5/// - `Run` — build and start the development server with hot-reload
6/// - `Build` — build only, do not start the server
7#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum Action {
9 /// Build and start the server (with file watcher).
10 Run,
11 /// Build only, do not start the server.
12 Build,
13}
14
15/// The build mode for wasm-pack compilation.
16///
17/// - `Dev` — development build with debug info and no optimizations
18/// - `Release` — release build with optimizations and no debug info
19/// - `Profiling` — profiling build with optimizations and debug info
20#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
21pub enum BuildMode {
22 /// Development build (default).
23 #[default]
24 Dev,
25 /// Release build with optimizations.
26 Release,
27 /// Profiling build with optimizations and debug info.
28 Profiling,
29}
30
31/// The action to perform.
32///
33/// - `run` — build and start the development server
34/// - `build` — build only, do not start the server
35/// - `fmt` — format euv macro invocations
36#[derive(Clone, Debug, Parser)]
37pub enum Mode {
38 /// Build and start the server (with file watcher)
39 Run(ModeArgs),
40 /// Build only, do not start the server
41 Build(ModeArgs),
42 /// Format euv macro invocations in source files
43 Fmt(FmtArgs),
44}
45
46/// Represents the type of reload event sent to connected clients.
47///
48/// Used as the message type in the broadcast channel so that the
49/// frontend can distinguish between a successful rebuild and an error.
50#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
51#[serde(tag = "type", content = "message")]
52pub enum ReloadEvent {
53 /// A successful WASM rebuild; the client should reload the page.
54 Reload,
55 /// A rebuild error occurred; the message field contains details.
56 Error(String),
57}