Parse ` /composer/autoload_files.php` and return the resolved file paths. This file is generated by `composer install` / `composer dump-autoload` and lists files that should be eagerly loaded — typically containing global function definitions, `define()` calls, and similar bootstrap code. The file contains lines like: ```text 'hash' => $vendorDir . '/org/pkg/src/functions.php', 'hash' =>
(workspace_root: &Path, vendor_dir: &str)
| 284 | /// |
| 285 | /// Returns an empty `Vec` if the file does not exist or cannot be parsed. |
| 286 | pub fn parse_autoload_files(workspace_root: &Path, vendor_dir: &str) -> Vec<PathBuf> { |
| 287 | let autoload_path = workspace_root |
| 288 | .join(vendor_dir) |
| 289 | .join("composer") |
| 290 | .join("autoload_files.php"); |
| 291 | |
| 292 | let content = match fs::read_to_string(&autoload_path) { |
| 293 | Ok(c) => c, |
| 294 | Err(_) => return Vec::new(), |
| 295 | }; |
| 296 | |
| 297 | let mut files = Vec::new(); |
| 298 | |
| 299 | for line in content.lines() { |
| 300 | let trimmed = line.trim(); |
| 301 | |
| 302 | // Match lines of the form: 'hash' => $vendorDir . '/path/to/file.php', |
| 303 | // or: 'hash' => $baseDir . '/path/to/file.php', |
| 304 | // We look for `=> $vendorDir` or `=> $baseDir` after the hash key. |
| 305 | if let Some(arrow_pos) = trimmed.find("=> ") { |
| 306 | let rhs = trimmed[arrow_pos + 3..].trim().trim_end_matches(','); |
| 307 | |
| 308 | if let Some(base_path) = resolve_autoload_path_entry(rhs, vendor_dir) { |
| 309 | let full_path = workspace_root.join(&base_path); |
| 310 | if full_path.is_file() { |
| 311 | files.push(full_path); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | files |
| 318 | } |
| 319 | |
| 320 | // ── PSR-4 path abstraction ───────────────────────────────────────── |
| 321 | // |