(path: &Path)
| 917 | } |
| 918 | |
| 919 | fn parse_repl_exports(path: &Path) -> Result<BTreeMap<String, ReplExport>> { |
| 920 | let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?; |
| 921 | let mut exports = BTreeMap::new(); |
| 922 | for line in text.lines() { |
| 923 | let line = line.trim(); |
| 924 | let Some(rest) = line.strip_prefix("export { ") else { |
| 925 | continue; |
| 926 | }; |
| 927 | let Some((name, module_part)) = rest.split_once(" } from ") else { |
| 928 | continue; |
| 929 | }; |
| 930 | let import_path = strip_quoted(module_part.trim()) |
| 931 | .ok_or_else(|| anyhow!("could not parse export module from {line:?}"))?; |
| 932 | exports.insert( |
| 933 | name.to_owned(), |
| 934 | ReplExport { |
| 935 | import_name: name.to_owned(), |
| 936 | import_path: import_path.to_owned(), |
| 937 | }, |
| 938 | ); |
| 939 | } |
| 940 | Ok(exports) |
| 941 | } |
| 942 | |
| 943 | fn parse_docs_catalog(path: &Path) -> Result<BTreeMap<String, DocsCatalogEntry>> { |
| 944 | let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?; |
no test coverage detected