rusty_source_map/
source_map.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Clone)]
4pub struct SourceMapJson {
5    pub version: i32,
6    #[serde(skip_serializing_if = "Option::is_none")]
7    pub sources: Option<Vec<String>>,
8    #[serde(skip_serializing_if = "Option::is_none")]
9    pub names: Option<Vec<String>>,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub mappings: Option<String>,
12    pub file: Option<String>,
13    #[serde(rename = "sourceRoot")]
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub source_root: Option<String>,
16    #[serde(rename = "sourcesContent")]
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub sources_content: Option<Vec<String>>,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub sections: Option<Vec<Section>>,
21}
22
23#[derive(Serialize, Deserialize, Clone)]
24pub struct Section {
25    pub offset: Position,
26    pub map: Box<SourceMapJson>,
27
28    // ref: https://github.com/mozilla/source-map/issues/437
29    pub url: Option<String>,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize, Default)]
33pub struct Position {
34    pub line: i32,
35    pub column: i32,
36}