pub mod entry;
pub mod entry_point;
pub mod fallback;
pub mod imports;
pub mod manifest;
pub mod module_graph;
pub mod options;
pub mod python;
pub mod render;
pub mod rust;
pub mod scala;
pub mod typescript;
pub use entry::SurfaceEntry;
pub use entry_point::{discover, EntryPoint};
pub use options::{LangOverride, OutputMode, SurfaceError, SurfaceOptions};
use std::path::Path;
pub fn resolve_surface(
path: &Path,
opts: &SurfaceOptions,
) -> Result<Vec<SurfaceEntry>, SurfaceError> {
let entry = match opts.lang_override {
Some(l) => entry_point::discover_as(path, l)?,
None => discover(path)?,
};
resolve_entry(&entry, opts)
}
pub fn resolve_entry(
entry: &EntryPoint,
opts: &SurfaceOptions,
) -> Result<Vec<SurfaceEntry>, SurfaceError> {
match entry {
EntryPoint::RustCrate { .. } => rust::resolve(entry, opts),
EntryPoint::RustWorkspace { members } => {
let mut all = Vec::new();
for m in members {
all.extend(resolve_entry(m, opts)?);
}
Ok(all)
}
EntryPoint::PythonPackage { .. } => python::resolve(entry, opts),
EntryPoint::TsPackage { .. } => typescript::resolve(entry, opts),
EntryPoint::ScalaPackage { .. } => scala::resolve(entry, opts),
EntryPoint::Fallback { .. } => fallback::resolve(entry, opts),
}
}