euv-cli 0.50.0

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
use super::*;

/// Resolved Cargo package metadata needed for WebAssembly compilation and version verification.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct WebPackageMetadata {
    /// Cargo package name (e.g. `euv-example`).
    pub(crate) package_name: String,
    /// Snake-case compiled Rust library target name (e.g. `euv_example`).
    pub(crate) lib_name: String,
    /// Dynamic semantic version resolved from `Cargo.toml`.
    pub(crate) version: String,
    /// Cargo target directory honoring `CARGO_TARGET_DIR`.
    pub(crate) target_dir: PathBuf,
    /// Exact `wasm-bindgen` crate version resolved in `Cargo.lock`, when present.
    pub(crate) wasm_bindgen_version: Option<String>,
    /// Sorted `theme-*` feature names declared on the package.
    pub(crate) theme_features: Vec<String>,
}

/// Configuration for pure-Rust WebAssembly zero-JS, raw-WASM, and theme-variant builds.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct WebBuildConfig {
    /// Workspace or crate root directory.
    pub(crate) repo_root: PathBuf,
    /// Cargo package to compile for `wasm32-unknown-unknown`.
    pub(crate) package: String,
    /// Destination directory for packaged web artifacts.
    pub(crate) out_dir: PathBuf,
    /// Normalized asset URL base prefix (default `./`).
    pub(crate) base_url: String,
    /// HTML document title written into `index.html` and `404.html`.
    pub(crate) title: String,
    /// Optional explicit version override (resolved dynamically from `Cargo.toml` when `None`).
    pub(crate) version: Option<String>,
    /// Optional custom source PNG icon path.
    pub(crate) icon_path: Option<PathBuf>,
    /// Optional destination archive path (`.tar.gz` or `.zip`).
    pub(crate) archive_path: Option<PathBuf>,
    /// Optional Cargo feature list passed via `--features`.
    pub(crate) features: Vec<String>,
    /// Whether to pass `--no-default-features` to Cargo.
    #[get(type(copy))]
    pub(crate) no_default_features: bool,
    /// Whether to compile with `--release` and `CARGO_PROFILE_RELEASE_PANIC=abort`.
    #[get(type(copy))]
    pub(crate) release: bool,
    /// When `true`, skips the optional binaryen `wasm-opt` optimization pass.
    #[get(type(copy))]
    pub(crate) skip_wasm_opt: bool,
    /// When `true`, emits raw `.wasm` + icons + `build-plan.json` without `wasm-bindgen-cli`.
    #[get(type(copy))]
    pub(crate) raw_wasm: bool,
    /// When `true`, verifies zero `.js`, zero AI schema leaks, preload links, and `euv-release.json`.
    #[get(type(copy))]
    pub(crate) verify: bool,
    /// When `true`, builds `default` plus all `theme-*` variants with SHA-256 fingerprint caching.
    #[get(type(copy))]
    pub(crate) theme_variants: bool,
}

/// Structured summary returned by `build_web_bundle`.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct WebBuildReport {
    /// Built Cargo package name.
    pub(crate) package: String,
    /// Resolved semantic version written into `euv-release.json`.
    pub(crate) version: String,
    /// Output directory containing the packaged bundle.
    pub(crate) out_dir: PathBuf,
    /// Normalized asset URL base prefix used in `index.html`.
    pub(crate) base_url: String,
    /// Primary `.wasm` filename emitted in `out_dir`.
    pub(crate) wasm_file: String,
    /// Final `.wasm` byte size on disk.
    #[get(type(copy))]
    pub(crate) wasm_bytes: u64,
    /// Whether `wasm-opt` optimization succeeded on the `.wasm` binary.
    #[get(type(copy))]
    pub(crate) wasm_opt_applied: bool,
    /// Whether `--raw-wasm` mode was used.
    #[get(type(copy))]
    pub(crate) raw_wasm: bool,
    /// Total file entries recorded in `euv-release.json` (or emitted in `--raw-wasm` mode).
    #[get(type(copy))]
    pub(crate) file_count: usize,
    /// End-to-end build duration in milliseconds.
    #[get(type(copy))]
    pub(crate) elapsed_ms: u64,
    /// Path to `euv-release.json` when generated.
    pub(crate) manifest_path: Option<PathBuf>,
    /// Path to packaged archive when `archive_path` was configured.
    pub(crate) archive_path: Option<PathBuf>,
}

/// Structured summary returned by `build_web_theme_variants`.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ThemeVariantBuildReport {
    /// Output directory root containing `themes/<feature>/` bundles.
    pub(crate) out_dir: PathBuf,
    /// Resolved semantic version.
    pub(crate) version: String,
    /// Variant names freshly compiled during this run.
    pub(crate) built_variants: Vec<String>,
    /// Variant names reused from matching SHA-256 source fingerprints.
    pub(crate) cached_variants: Vec<String>,
    /// Total wall-clock elapsed duration in milliseconds.
    #[get(type(copy))]
    pub(crate) elapsed_ms: u64,
}