zebflow 0.10.3

Reactive web automation platform — pipelines, templates, and real-time collaboration in a single binary.
Documentation
use serde::{Deserialize, Serialize};
use serde_json::Value;

use super::config::{CompileOptions, RuntimeMode};

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "kebab-case")]
pub enum HydrateMode {
    Off,
    Onload,
    Onview,
    Oninteract,
}

impl Default for HydrateMode {
    fn default() -> Self {
        Self::Onload
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct ImportEdge {
    pub source: String,
    pub resolved: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct Diagnostic {
    pub code: String,
    pub message: String,
    pub line: Option<u32>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompiledTemplate {
    pub engine: String,
    pub source_path: Option<String>,
    pub runtime_mode: RuntimeMode,
    pub deno_timeout_ms: u64,
    pub server_module_source: String,
    pub client_module_source: String,
    pub imports: Vec<ImportEdge>,
    pub diagnostics: Vec<Diagnostic>,
    pub hydrate_mode: HydrateMode,
    pub compile_options: CompileOptions,
    /// All `zeb/*` library specifiers found across the page and all inlined components.
    #[serde(default)]
    pub detected_zeb_libs: Vec<String>,
    /// Inline stylesheet contents collected from side-effect CSS imports such as
    /// `import "@/styles/editor.css"`.
    #[serde(default)]
    pub inline_styles: Vec<String>,
    /// Absolute filesystem paths of all component files inlined during compilation
    /// (from `collect_inlined_module` `visited` set).
    /// Used for dependency-aware cache eviction: when any of these files change,
    /// cache entries that depend on them are evicted.
    #[serde(default)]
    pub dependency_paths: std::collections::HashSet<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct RenderMeta {
    pub html_bytes: usize,
    pub js_bytes: usize,
    pub css_bytes: usize,
    pub ssr_ms: u128,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RenderOutput {
    pub html: String,
    pub js: String,
    pub css: String,
    pub hydration_payload: Value,
    pub meta: RenderMeta,
}