@@ -137,6 +137,7 @@ impl<'a> From<JsModuleDescriptor<'a>> for JsModuleDescriptorWrapper<'a> {
137137
138138#[ napi( object, object_from_js = false ) ]
139139pub struct JsStatsError < ' a > {
140+ pub name : Option < String > ,
140141 #[ napi( ts_type = "JsModuleDescriptor" ) ]
141142 pub module_descriptor : Option < JsModuleDescriptorWrapper < ' a > > ,
142143 pub message : String ,
@@ -155,6 +156,7 @@ pub struct JsStatsError<'a> {
155156impl < ' a > From < rspack_core:: StatsError < ' a > > for JsStatsError < ' a > {
156157 fn from ( stats : rspack_core:: StatsError < ' a > ) -> Self {
157158 Self {
159+ name : stats. name ,
158160 module_descriptor : stats. module_identifier . map ( |identifier| {
159161 JsModuleDescriptor {
160162 identifier : identifier. into ( ) ,
@@ -182,53 +184,6 @@ impl<'a> From<rspack_core::StatsError<'a>> for JsStatsError<'a> {
182184 }
183185}
184186
185- #[ napi( object, object_from_js = false ) ]
186- pub struct JsStatsWarning < ' a > {
187- #[ napi( ts_type = "JsModuleDescriptor" ) ]
188- pub module_descriptor : Option < JsModuleDescriptorWrapper < ' a > > ,
189- pub name : Option < String > ,
190- pub message : String ,
191- pub chunk_name : Option < & ' a str > ,
192- pub code : Option < String > ,
193- pub chunk_entry : Option < bool > ,
194- pub chunk_initial : Option < bool > ,
195- pub file : Option < & ' a str > ,
196- pub chunk_id : Option < & ' a str > ,
197- pub details : Option < String > ,
198- pub stack : Option < String > ,
199- pub module_trace : Vec < JsStatsModuleTrace < ' a > > ,
200- }
201-
202- impl < ' a > From < rspack_core:: StatsWarning < ' a > > for JsStatsWarning < ' a > {
203- fn from ( stats : rspack_core:: StatsWarning < ' a > ) -> Self {
204- Self {
205- module_descriptor : stats. module_identifier . map ( |identifier| {
206- JsModuleDescriptor {
207- identifier : identifier. into ( ) ,
208- name : CowStrWrapper :: new ( stats. module_name . unwrap_or_default ( ) ) ,
209- id : stats. module_id . map ( |s| to_js_module_id ( & s) ) ,
210- }
211- . into ( )
212- } ) ,
213- name : stats. name ,
214- message : stats. message ,
215- file : stats. file . map ( |f| f. as_str ( ) ) ,
216- code : stats. code ,
217- chunk_name : stats. chunk_name ,
218- chunk_entry : stats. chunk_entry ,
219- chunk_initial : stats. chunk_initial ,
220- chunk_id : stats. chunk_id ,
221- details : stats. details ,
222- stack : stats. stack ,
223- module_trace : stats
224- . module_trace
225- . into_iter ( )
226- . map ( Into :: into)
227- . collect :: < Vec < _ > > ( ) ,
228- }
229- }
230- }
231-
232187#[ napi( object, object_from_js = false ) ]
233188pub struct JsStatsModuleTrace < ' a > {
234189 pub origin : JsStatsModuleTraceModule < ' a > ,
@@ -1078,7 +1033,7 @@ pub struct JsStatsCompilation<'a> {
10781033 #[ napi( ts_type = "Array<JsStatsModule>" ) ]
10791034 pub modules : Option < napi_value > ,
10801035 pub named_chunk_groups : Option < Vec < JsStatsChunkGroup < ' a > > > ,
1081- #[ napi( ts_type = "Array<JsStatsWarning >" ) ]
1036+ #[ napi( ts_type = "Array<JsStatsError >" ) ]
10821037 pub warnings : napi_value ,
10831038}
10841039
@@ -1250,7 +1205,7 @@ impl JsStats {
12501205 self . inner . get_warnings ( |warnings| {
12511206 let val = warnings
12521207 . into_iter ( )
1253- . map ( JsStatsWarning :: from)
1208+ . map ( JsStatsError :: from)
12541209 . collect :: < Vec < _ > > ( ) ;
12551210 unsafe { ToNapiValue :: to_napi_value ( env. raw ( ) , val) }
12561211 } )
0 commit comments