Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Various fixes and improvements

- Debug IDs can be read from the "debugId" field in addition to "debug_id" (#97) by @loewenheim.

## 9.0.0

### Various fixes and improvements
Expand Down
2 changes: 1 addition & 1 deletion src/jsontypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct RawSourceMap {
pub x_metro_module_paths: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub x_facebook_sources: FacebookSources,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none", alias = "debugId")]
pub debug_id: Option<DebugId>,
}

Expand Down
15 changes: 15 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,21 @@ mod tests {
assert_eq!(new_sm.debug_id, Some(DebugId::default()));
}

#[test]
fn test_debugid_alias() {
let input: &[_] = br#"{
"version":3,
"sources":["coolstuff.js"],
"names":["x","alert"],
"mappings":"AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM",
"debugId":"00000000-0000-0000-0000-000000000000"
}"#;

let sm = SourceMap::from_slice(input).unwrap();

assert_eq!(sm.debug_id, Some(DebugId::default()));
}

#[test]
fn test_adjust_mappings_injection() {
// A test that `adjust_mappings` does what it's supposed to for debug id injection.
Expand Down