use std::path::{Path, PathBuf};
pub fn resolve_relative_import(current_file: &Path, import_src: &str) -> Option<PathBuf> {
let parent = current_file.parent().unwrap_or(Path::new("."));
let base_path = parent.join(import_src);
if base_path.exists() && base_path.is_file() { return Some(base_path); }
for ext in &["js", "ts", "jsx", "tsx", "mjs", "cjs"] {
let p = base_path.with_extension(ext);
if p.exists() { return Some(p); }
}
let index_path = base_path.join("index");
for ext in &["js", "ts", "jsx", "tsx", "mjs", "cjs"] {
let p = index_path.with_extension(ext);
if p.exists() { return Some(p); }
}
None
}