Skip to main content

euv_cli/
lib.rs

1//! euv-cli
2//!
3//! Cross-platform command-line toolchain for euv providing native run, build,
4//! hot-reload dev server, Hyperlane HTTP/SSE dynamic update server, Markdown
5//! documentation site builder, cross-target check, formatting, environment
6//! diagnostics, and project scaffolding across all supported platforms.
7
8mod args;
9mod command;
10mod fmt;
11mod hot;
12mod platform;
13mod update_server;
14
15#[cfg(test)]
16#[path = "../tests/mod.rs"]
17mod tests;
18
19pub use {args::*, command::*, fmt::*, hot::*, platform::*, update_server::*};
20
21#[cfg(feature = "update-server")]
22use std::collections::HashMap;
23#[cfg(feature = "update-server")]
24use std::net::AddrParseError;
25#[cfg(feature = "update-server")]
26use std::sync::{OnceLock, RwLock, RwLockReadGuard};
27use std::{
28    borrow::Cow,
29    cmp,
30    collections::{BTreeMap, BTreeSet, btree_map},
31    env::{self, VarError},
32    ffi::{OsStr, OsString},
33    fs::{self, DirEntry, File, Metadata, OpenOptions},
34    io::{self, BufRead, BufReader, Error, ErrorKind, Write},
35    iter::Peekable,
36    net::{SocketAddr, TcpListener, TcpStream},
37    num::NonZeroUsize,
38    path::{Path, PathBuf},
39    process::{self, Child, Command, Output, Stdio},
40    str::{SplitWhitespace, from_utf8},
41    sync::{
42        Arc, Mutex, MutexGuard,
43        atomic::{AtomicBool, AtomicU64, Ordering},
44    },
45    thread::{self, JoinHandle, Scope, ScopedJoinHandle},
46    time::{Duration, SystemTime, UNIX_EPOCH},
47};
48
49use {
50    clap::{Args, Parser, Subcommand, ValueEnum},
51    crate_cli::{UnifiedFmtReport, execute_unified_fmt, format_workspace_text_files},
52    euv_core::{
53        ArtifactKind, BlobArtifact, ClientNegotiation, DEFAULT_MAX_ARTIFACT_BYTES,
54        DYNAMIC_EVENT_SCHEMA_V1, DYNAMIC_HOST_ABI_V1, DYNAMIC_MANIFEST_SCHEMA_V1,
55        DYNAMIC_PROTOCOL_VERSION_V1, DeliveryChannelMode, DynamicNodeSpec, DynamicReleaseError,
56        DynamicStyleSpec, GraphicsBackend, PlatformCapabilities, PlatformKind,
57        ReleaseActivatedEvent, ReleaseManifest, RenderConfig, RenderMode, Renderer, RouteManifest,
58        WASM_EXPORT_ABI, WASM_EXPORT_RENDER, WasmDynamicError, WasmExecutionOutput,
59        WasmParsedModule, WasmSandboxConfig, build_partial_widget_wasm, compute_wasm_checksum,
60        compute_wasm_signature, constant_time_eq, default_track_for, execute_wasm_export,
61        is_valid_sha256_hex, parse_wasm_binary, sha256_hex,
62    },
63    euv_docs::{DocsBuildOptions, GeneratedSiteReport, build_docs_bundle},
64    lombok_macros::{Data, Getter, New},
65    serde::{Deserialize, Serialize},
66    serde_json::{from_str, to_string, to_string_pretty},
67    tokio::runtime::{Builder, Runtime},
68};
69#[cfg(feature = "update-server")]
70use {
71    euv_core::SSE_EVENT_RELEASE_ACTIVATED,
72    hyperlane::{
73        CACHE_CONTROL, CONTENT_TYPE, Context, Method, Response, ResponseData, ResponseError,
74        Server, ServerConfig, ServerControlHook, ServerHook, Status, Stream,
75        tokio::{
76            runtime, select, task,
77            time::{Instant, Interval, MissedTickBehavior, interval},
78        },
79    },
80    hyperlane_plugin_sse::{SseConfig, SseError, SseEvent, SseHub, SseStream, SseSubscription},
81    serde_json::to_vec,
82};