rust_source_bundler/
lib.rs1mod bundler;
2
3use bundler::Bundler;
4
5use std::path::PathBuf;
6
7use quote::ToTokens;
8
9use rust_format::{
10 Formatter,
11 RustFmt,
12};
13
14use anyhow::Result;
15
16pub fn bundle_source(root_dir: impl Into<PathBuf>, filename: impl Into<String>) -> Result<String> {
17 let ast = Bundler::new(root_dir.into()).bundle_to_ast(filename.into())?;
18
19 let token_stream = ast.into_token_stream();
20
21 let generated_code = RustFmt::default().format_tokens(token_stream)?;
22
23 return Ok(generated_code);
24}
25