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