@@ -225,6 +225,8 @@ pub struct SourceMap {
225225 source_root : Option < Arc < str > > ,
226226 #[ serde( rename = "debugId" , skip_serializing_if = "Option::is_none" ) ]
227227 debug_id : Option < Arc < str > > ,
228+ #[ serde( rename = "ignoreList" , skip_serializing_if = "Option::is_none" ) ]
229+ ignore_list : Option < Vec < u32 > > ,
228230}
229231
230232impl std:: fmt:: Debug for SourceMap {
@@ -252,6 +254,7 @@ impl Hash for SourceMap {
252254 self . sources_content . hash ( state) ;
253255 self . names . hash ( state) ;
254256 self . source_root . hash ( state) ;
257+ self . ignore_list . hash ( state) ;
255258 }
256259}
257260
@@ -278,6 +281,7 @@ impl SourceMap {
278281 names : names. into ( ) ,
279282 source_root : None ,
280283 debug_id : None ,
284+ ignore_list : None ,
281285 }
282286 }
283287
@@ -291,6 +295,16 @@ impl SourceMap {
291295 self . file = file. map ( Into :: into) ;
292296 }
293297
298+ /// Get the ignoreList field in [SourceMap].
299+ pub fn ignore_list ( & self ) -> Option < & [ u32 ] > {
300+ self . ignore_list . as_deref ( )
301+ }
302+
303+ /// Set the ignoreList field in [SourceMap].
304+ pub fn set_ignore_list < T : Into < Vec < u32 > > > ( & mut self , ignore_list : Option < T > ) {
305+ self . ignore_list = ignore_list. map ( Into :: into) ;
306+ }
307+
294308 /// Get the decoded mappings in [SourceMap].
295309 pub fn decoded_mappings ( & self ) -> impl Iterator < Item = Mapping > + ' _ {
296310 decode_mappings ( self )
@@ -415,6 +429,11 @@ impl SourceMap {
415429 . get_str ( "sourceRoot" )
416430 . map ( |v| Arc :: from ( v. to_string ( ) ) ) ,
417431 debug_id : value. get_str ( "debugId" ) . map ( |v| Arc :: from ( v. to_string ( ) ) ) ,
432+ ignore_list : value. get_array ( "ignoreList" ) . map ( |v| {
433+ v. into_iter ( )
434+ . map ( |n| n. as_u32 ( ) . unwrap_or_default ( ) )
435+ . collect :: < Vec < _ > > ( )
436+ } ) ,
418437 } )
419438 }
420439
@@ -426,7 +445,7 @@ impl SourceMap {
426445 }
427446
428447 /// Generate source map to a json string.
429- pub fn to_json ( self ) -> Result < String > {
448+ pub fn to_json ( & self ) -> Result < String > {
430449 let json = simd_json:: to_string ( & self ) ?;
431450 Ok ( json)
432451 }
@@ -539,7 +558,7 @@ mod tests {
539558 RawBufferSource :: from ( "a" . as_bytes ( ) ) . hash ( & mut state) ;
540559 ( & RawSource :: from ( "h" ) as & dyn Source ) . hash ( & mut state) ;
541560 ReplaceSource :: new ( RawSource :: from ( "i" ) . boxed ( ) ) . hash ( & mut state) ;
542- assert_eq ! ( format!( "{:x}" , state. finish( ) ) , "1b50b537fa997c34 " ) ;
561+ assert_eq ! ( format!( "{:x}" , state. finish( ) ) , "6abed98aa11f84e5 " ) ;
543562 }
544563
545564 #[ test]
0 commit comments