MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / parse_repl_exports

Function parse_repl_exports

xtask/src/extension_catalog.rs:919–941  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

917}
918
919fn 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
943fn parse_docs_catalog(path: &Path) -> Result<BTreeMap<String, DocsCatalogEntry>> {
944 let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?;

Callers 1

discover_catalogFunction · 0.85

Calls 2

strip_quotedFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected