Parse a `composer.json` file at the given workspace root and extract all PSR-4 autoload mappings from both `autoload` and `autoload-dev` sections. Only the project's own mappings are returned. Vendor package mappings (from `vendor/composer/autoload_psr4.php`) are deliberately not loaded — the Composer classmap is the sole source of truth for vendor code. If the classmap is missing or stale, ven
(workspace_root: &Path)
| 61 | /// Returns an empty `Vec` and `"vendor"` if the file doesn't exist, can't |
| 62 | /// be read, or contains no PSR-4 mappings. |
| 63 | pub fn parse_composer_json(workspace_root: &Path) -> (Vec<Psr4Mapping>, String) { |
| 64 | let package = match read_composer_package(workspace_root) { |
| 65 | Some(p) => p, |
| 66 | None => return (Vec::new(), "vendor".to_string()), |
| 67 | }; |
| 68 | |
| 69 | let vendor_dir = get_vendor_dir(&package); |
| 70 | let mappings = extract_psr4_mappings_from_package(&package); |
| 71 | |
| 72 | (mappings, vendor_dir) |
| 73 | } |
| 74 | |
| 75 | /// Read and parse the `composer.json` at the given workspace root into a |
| 76 | /// typed [`ComposerPackage`]. |