File tree Expand file tree Collapse file tree
rspack_binding_api/src/raw_options/raw_builtins
rspack_plugin_esm_library/src
rspack_plugin_split_chunks/src/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use std:: sync:: Arc ;
2+
13use napi:: bindgen_prelude:: Object ;
24use napi_derive:: napi;
35use rspack_error:: { Error , ToStringResultToRspackResultExt } ;
@@ -36,7 +38,7 @@ impl<'a> TryFrom<RawContextReplacementPluginOptions<'a>> for ContextReplacementP
3638 for key in keys {
3739 let value = raw. get :: < String > ( & key) . to_rspack_result ( ) ?;
3840 if let Some ( value) = value {
39- map. insert ( key, value) ;
41+ map. insert ( Arc :: from ( key) , value) ;
4042 }
4143 }
4244 Some ( map)
Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ async fn visit_dirs(
510510 dependencies. push ( ContextElementDependency {
511511 id : DependencyId :: new ( ) ,
512512 request : Arc :: from ( request) ,
513- user_request : Arc :: from ( r. request ) ,
513+ user_request : r. request . clone ( ) ,
514514 category : options. context_options . category ,
515515 context : options. resource . clone ( ) . into ( ) ,
516516 layer : options. layer . clone ( ) ,
@@ -529,13 +529,16 @@ async fn visit_dirs(
529529
530530#[ derive( Debug , Clone ) ]
531531pub struct AlternativeRequest {
532- pub context : String ,
533- pub request : String ,
532+ pub context : Arc < str > ,
533+ pub request : Arc < str > ,
534534}
535535
536536impl AlternativeRequest {
537- pub fn new ( context : String , request : String ) -> Self {
538- Self { context, request }
537+ pub fn new ( context : impl Into < Arc < str > > , request : impl Into < Arc < str > > ) -> Self {
538+ Self {
539+ context : context. into ( ) ,
540+ request : request. into ( ) ,
541+ }
539542 }
540543}
541544
Original file line number Diff line number Diff line change @@ -601,7 +601,7 @@ pub(crate) fn assign_dyn_import_chunk_short_names(compilation: &mut Compilation)
601601
602602 // Apply assignments
603603 for ( chunk_ukey, name) in assignments {
604- let name_key: Arc < str > = Arc :: from ( name. into_boxed_str ( ) ) ;
604+ let name_key: Arc < str > = Arc :: from ( name) ;
605605 let chunk = compilation
606606 . build_chunk_graph_artifact
607607 . chunk_by_ukey
Original file line number Diff line number Diff line change @@ -707,7 +707,7 @@ async fn render_manifest(
707707 diagnostics. extend ( more_diagnostics) ;
708708 manifest. push ( RenderManifestEntry {
709709 source,
710- filename : Arc :: from ( filename. as_ref ( ) ) ,
710+ filename : Arc :: from ( filename) ,
711711 has_filename : false ,
712712 info : asset_info,
713713 auxiliary : false ,
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ impl HtmlPluginAssets {
6262 . entrypoints
6363 . contains_key ( name. as_str ( ) )
6464 } )
65- . map ( |name| Arc :: from ( name. as_str ( ) ) )
65+ . map ( |name| Arc :: from ( name. clone ( ) ) )
6666 . collect ( )
6767 } else {
6868 compilation
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ fn put_split_chunk_reason(
1616 } ;
1717 if let Some ( chunk_reason) = chunk_reason {
1818 chunk_reason. push ( ',' ) ;
19- chunk_reason. push_str ( & reason) ;
19+ chunk_reason. push_str ( reason) ;
2020 } else {
2121 * chunk_reason = Some ( reason. to_string ( ) ) ;
2222 }
You can’t perform that action at this time.
0 commit comments