Skip to content

Commit

Permalink
fix: should keep mappings field (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Aug 5, 2024
1 parent a8d6635 commit 80bbde0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ struct RawSourceMap {
pub sources_content: Option<Vec<Option<Cow<'static, str>>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub names: Option<Vec<Option<Cow<'static, str>>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mappings: Option<String>,
pub mappings: String,
}

impl RawSourceMap {
Expand Down Expand Up @@ -424,7 +423,7 @@ impl TryFrom<RawSourceMap> for SourceMap {
.collect();
Ok(Self {
file: raw.file,
mappings: raw.mappings.unwrap_or_default(),
mappings: raw.mappings,
sources,
sources_content,
names,
Expand Down Expand Up @@ -462,7 +461,7 @@ impl From<SourceMap> for RawSourceMap {
.map(|s| (!s.is_empty()).then_some(s))
.collect(),
),
mappings: (!map.mappings.is_empty()).then_some(map.mappings),
mappings: map.mappings,
}
}
}
Expand Down

0 comments on commit 80bbde0

Please sign in to comment.