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, project scaffolding, shell completions, and live/artifact inspection.
7
8mod args;
9mod blender;
10mod builder;
11mod command;
12mod config;
13mod dx;
14mod fmt;
15mod hot;
16mod platform;
17mod update_server;
18
19#[cfg(test)]
20#[path = "../tests/mod.rs"]
21mod tests;
22
23pub use {
24    args::*, blender::*, builder::*, command::*, config::*, dx::*, fmt::*, hot::*, platform::*,
25    update_server::*,
26};
27
28#[cfg(feature = "update-server")]
29use std::collections::HashMap;
30#[cfg(unix)]
31use std::fs::Permissions;
32#[cfg(feature = "update-server")]
33use std::net::AddrParseError;
34#[cfg(unix)]
35use std::os::unix::fs::PermissionsExt;
36#[cfg(feature = "update-server")]
37use std::sync::{OnceLock, RwLock, RwLockReadGuard};
38use std::{
39    borrow::Cow,
40    cmp,
41    collections::{
42        BTreeMap, BTreeSet, btree_map,
43        hash_map::{DefaultHasher, RandomState},
44    },
45    env::{self, VarError, consts},
46    ffi::{OsStr, OsString},
47    fs::{self, DirEntry, File, Metadata, OpenOptions},
48    hash::{BuildHasher, Hasher},
49    io::{self, BufRead, BufReader, Error, ErrorKind, Read, Write},
50    iter::Peekable,
51    mem::take,
52    net::{IpAddr, SocketAddr, TcpListener, TcpStream, UdpSocket},
53    num::{NonZeroUsize, TryFromIntError},
54    path::{Component, Path, PathBuf, StripPrefixError},
55    process::{self, Child, Command, ExitStatus, Output, Stdio},
56    str::{Chars, SplitWhitespace, Utf8Error, from_utf8},
57    string::FromUtf8Error,
58    sync::{
59        Arc, Mutex, MutexGuard,
60        atomic::{AtomicBool, AtomicU64, Ordering},
61    },
62    thread::{self, JoinHandle, Scope, ScopedJoinHandle},
63    time::{self, Duration, Instant, SystemTime, UNIX_EPOCH},
64};
65
66use {
67    clap::{ArgAction, Args, Parser, Subcommand, ValueEnum},
68    crate_cli::{UnifiedFmtReport, execute_unified_fmt, format_workspace_text_files},
69    euv_core::{
70        ArtifactKind, BLEND_MAGIC, BakedAssetBundle3D, BlendCompression, BlendInspectionReport,
71        BlobArtifact, ClientNegotiation, CollectionEntry3D, DEFAULT_MAX_ARTIFACT_BYTES,
72        DYNAMIC_EVENT_SCHEMA_V1, DYNAMIC_HOST_ABI_V1, DYNAMIC_MANIFEST_SCHEMA_V1,
73        DYNAMIC_PROTOCOL_VERSION_V1, DeliveryChannelMode, DirectoryGltfResolver, DynamicNodeSpec,
74        DynamicReleaseError, DynamicStyleSpec, ENV_EUV_UPDATE_CACHE_DIR, ENV_EUV_UPDATE_CHANNEL,
75        ENV_EUV_UPDATE_URL, EUV3D_DEFAULT_LOD_LEVELS, EUV3D_MAGIC, EUV3D_SECTION_ALIGNMENT,
76        Euv3dBakeConfig, Euv3dHeader, Euv3dPackage, Euv3dPackageView, Euv3dSectionEntry,
77        Euv3dSectionKind, GraphicsBackend, ImportedAnimationClip3D, ImportedModel3D,
78        ImportedScene3D, Mesh3D, MeshLodChain, ModelImporter3D, PbrMaterial, PlatformCapabilities,
79        PlatformKind, PrincipledMaterial3D, ReleaseActivatedEvent, ReleaseManifest, RenderConfig,
80        RenderMode, Renderer, RouteManifest, SSE_EVENT_RELEASE_ACTIVATED, SceneGraph3D,
81        SceneNode3D, WASM_EXPORT_ABI, WASM_EXPORT_RENDER, WasmDynamicError, WasmExecutionOutput,
82        WasmParsedModule, WasmSandboxConfig, build_partial_widget_wasm, compute_wasm_checksum,
83        compute_wasm_signature, constant_time_eq, default_track_for, execute_wasm_export,
84        inspect_blend_bytes, is_valid_sha256_hex, parse_gltf_or_glb_bytes, parse_wasm_binary,
85        sha256_bytes, sha256_hex,
86    },
87    euv_docs::{
88        DocSiteConfig, DocsBuildOptions, GeneratedSiteReport, build_docs_bundle,
89        build_multilocale_wasm_site, load_site_config,
90    },
91    lombok_macros::{Data, Getter, New},
92    serde::{Deserialize, Serialize},
93    serde_json::{self, Map, Value, from_str, to_string, to_string_pretty},
94    tokio::runtime::{Builder, Runtime},
95};
96#[cfg(feature = "update-server")]
97use {
98    hyperlane::{
99        CACHE_CONTROL, CONTENT_TYPE, Context, Method, Response, ResponseData, ResponseError,
100        Server, ServerConfig, ServerControlHook, ServerHook, Status, Stream,
101        tokio::{
102            runtime, select, task,
103            time::{Interval, MissedTickBehavior, interval},
104        },
105    },
106    hyperlane_plugin_sse::{SseConfig, SseError, SseEvent, SseHub, SseStream, SseSubscription},
107    lombok_macros::CustomDebug,
108    serde_json::to_vec,
109};