nativeview-cli 0.1.0-rc.1

Developer CLI (`nv`) for Native View Engine: dev hot-reload, builds, pairing, SDK management, app scaffolding, and docs.
Documentation
//! Workspace root discovery and canonical workspace-relative path normalization shared by
//! `WatchCache`, `hot_diff`, and `view_diff`.
//!
//! Single-sourced directly from [`nativeview_view_syntax::resolve_workspace_rel_file`] so
//! `AnchorKey` hashes match `view-macros` 1-to-1 across crates, standalone examples, and OSes.

use std::path::Path;

/// Normalizes `path` to a workspace-relative (or standalone crate-relative) POSIX path matching
/// `file!()` / `Span::call_site().file()` so `AnchorKey`s hash
/// identically in `nv dev` (absolute paths from `notify`) and the compiled app.
pub fn workspace_relative_path(path: &Path) -> String {
    nativeview_view_syntax::resolve_workspace_rel_file(path, None)
}

/// Normalizes `path` relative to `explicit_root` (when `path` lies inside it) or falls back to
/// Cargo manifest `[workspace]` / crate-root discovery.
pub fn workspace_relative_path_in(path: &Path, explicit_root: Option<&Path>) -> String {
    nativeview_view_syntax::resolve_workspace_rel_file(path, explicit_root)
}