tailwind_rs_postcss/
source_map.rs1use crate::error::Result;
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug)]
10pub struct SourceMapGenerator;
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct SourceMap {
15 pub version: u32,
16 pub sources: Vec<String>,
17 pub names: Vec<String>,
18 pub mappings: String,
19 pub file: Option<String>,
20 pub source_root: Option<String>,
21 pub sources_content: Option<Vec<String>>,
22}
23
24#[derive(Debug, Clone)]
26pub struct SourceMapOptions {
27 pub inline: bool,
28 pub file: Option<String>,
29 pub source_root: Option<String>,
30 pub sources_content: bool,
31}
32
33impl SourceMapGenerator {
34 pub fn new() -> Self {
36 Self
37 }
38
39 pub fn generate(
41 &self,
42 _input: &str,
43 _output: &str,
44 _options: &SourceMapOptions,
45 ) -> Result<SourceMap> {
46 Ok(SourceMap {
48 version: 3,
49 sources: Vec::new(),
50 names: Vec::new(),
51 mappings: String::new(),
52 file: None,
53 source_root: None,
54 sources_content: None,
55 })
56 }
57}
58
59#[cfg(test)]
60mod tests {
61 use super::*;
62
63 #[test]
64 fn test_source_map_generator() {
65 let generator = SourceMapGenerator::new();
66 let options = SourceMapOptions {
67 inline: false,
68 file: None,
69 source_root: None,
70 sources_content: true,
71 };
72
73 let result = generator.generate("input", "output", &options);
74 assert!(result.is_ok());
75 }
76}