| 664 | /* ── Public: manifest detection + parsing ──────────────────────── */ |
| 665 | |
| 666 | bool cbm_pkgmap_try_parse(const char *basename, const char *rel_path, const char *source, |
| 667 | int source_len, cbm_pkg_entries_t *entries) { |
| 668 | if (!basename || !source || source_len <= 0) { |
| 669 | return false; |
| 670 | } |
| 671 | |
| 672 | if (strcmp(basename, "package.json") == 0) { |
| 673 | parse_package_json(source, source_len, rel_path, entries); |
| 674 | return true; |
| 675 | } |
| 676 | if (strcmp(basename, "go.mod") == 0) { |
| 677 | parse_go_mod(source, source_len, rel_path, entries); |
| 678 | return true; |
| 679 | } |
| 680 | if (strcmp(basename, "Cargo.toml") == 0) { |
| 681 | parse_cargo_toml(source, source_len, rel_path, entries); |
| 682 | return true; |
| 683 | } |
| 684 | if (strcmp(basename, "pyproject.toml") == 0) { |
| 685 | parse_pyproject_toml(source, source_len, rel_path, entries); |
| 686 | return true; |
| 687 | } |
| 688 | if (strcmp(basename, "composer.json") == 0) { |
| 689 | parse_composer_json(source, source_len, rel_path, entries); |
| 690 | return true; |
| 691 | } |
| 692 | if (strcmp(basename, "pubspec.yaml") == 0) { |
| 693 | parse_pubspec_yaml(source, source_len, rel_path, entries); |
| 694 | return true; |
| 695 | } |
| 696 | if (strcmp(basename, "pom.xml") == 0) { |
| 697 | parse_pom_xml(source, source_len, rel_path, entries); |
| 698 | return true; |
| 699 | } |
| 700 | if (strcmp(basename, "build.gradle") == 0 || strcmp(basename, "build.gradle.kts") == 0) { |
| 701 | parse_build_gradle(source, source_len, rel_path, entries); |
| 702 | return true; |
| 703 | } |
| 704 | if (strcmp(basename, "mix.exs") == 0) { |
| 705 | parse_mix_exs(source, source_len, rel_path, entries); |
| 706 | return true; |
| 707 | } |
| 708 | if (ends_with(basename, ".gemspec")) { |
| 709 | parse_gemspec(source, source_len, rel_path, entries); |
| 710 | return true; |
| 711 | } |
| 712 | return false; |
| 713 | } |
| 714 | |
| 715 | /* ── Merge: per-worker entries → hash table ────────────────────── */ |
| 716 |
no test coverage detected