From ae5936edc115917347c62941af1c04b35960bdc2 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Wed, 6 Nov 2024 16:12:08 +0100 Subject: [PATCH 1/2] feat: Read debug IDs from debugId field --- src/jsontypes.rs | 2 +- src/types.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/jsontypes.rs b/src/jsontypes.rs index 59d893b9..5b9a8f92 100644 --- a/src/jsontypes.rs +++ b/src/jsontypes.rs @@ -52,7 +52,7 @@ pub struct RawSourceMap { pub x_metro_module_paths: Option>, #[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, } diff --git a/src/types.rs b/src/types.rs index a2afdc36..bda1b38a 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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. From 7597958328480ce8701fdfb0027cc7278ddf4fd0 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Wed, 6 Nov 2024 16:15:39 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c91bd5..423cd4b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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