Skip to content

Commit 5596603

Browse files
authored
feat: Read debug IDs from debugId field (#97)
1 parent d13cea7 commit 5596603

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Various fixes and improvements
6+
7+
- Debug IDs can be read from the "debugId" field in addition to "debug_id" (#97) by @loewenheim.
8+
39
## 9.0.0
410

511
### Various fixes and improvements

src/jsontypes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub struct RawSourceMap {
5252
pub x_metro_module_paths: Option<Vec<String>>,
5353
#[serde(skip_serializing_if = "Option::is_none")]
5454
pub x_facebook_sources: FacebookSources,
55-
#[serde(skip_serializing_if = "Option::is_none")]
55+
#[serde(skip_serializing_if = "Option::is_none", alias = "debugId")]
5656
pub debug_id: Option<DebugId>,
5757
}
5858

src/types.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,21 @@ mod tests {
13181318
assert_eq!(new_sm.debug_id, Some(DebugId::default()));
13191319
}
13201320

1321+
#[test]
1322+
fn test_debugid_alias() {
1323+
let input: &[_] = br#"{
1324+
"version":3,
1325+
"sources":["coolstuff.js"],
1326+
"names":["x","alert"],
1327+
"mappings":"AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM",
1328+
"debugId":"00000000-0000-0000-0000-000000000000"
1329+
}"#;
1330+
1331+
let sm = SourceMap::from_slice(input).unwrap();
1332+
1333+
assert_eq!(sm.debug_id, Some(DebugId::default()));
1334+
}
1335+
13211336
#[test]
13221337
fn test_adjust_mappings_injection() {
13231338
// A test that `adjust_mappings` does what it's supposed to for debug id injection.

0 commit comments

Comments
 (0)