MCPcopy Create free account
hub / github.com/JasonShin/sqlx-ts / parse_source

Function parse_source

src/parser/mod.rs:15–25  ·  view source on GitHub ↗
(path: &PathBuf)

Source from the content-addressed store, hash-verified

13use swc_common::errors::Handler;
14
15pub fn parse_source(path: &PathBuf) -> Result<(HashMap<PathBuf, Vec<SQL>>, Handler)> {
16 let extension = path.extension().and_then(|s| s.to_str()).unwrap_or("");
17 let result = match extension {
18 "ts" | "js" | "mts" | "cts" | "mjs" | "cjs" => parse_js_file(path),
19 "sql" => parse_sql_file(path),
20 _ => {
21 return Err(color_eyre::eyre::eyre!("Unsupported file extension: {}", extension));
22 }
23 };
24 result
25}

Callers 1

mainFunction · 0.85

Calls 2

parse_js_fileFunction · 0.85
parse_sql_fileFunction · 0.85

Tested by

no test coverage detected