@@ -431,7 +431,8 @@ impl ChunkingContext for BrowserChunkingContext {
431431
432432 let chunk_root = self . chunk_root_path ;
433433
434- let import_name = ident_to_output_filename ( ident, * self . root_path , extension. clone ( ) )
434+ let output_name = ident
435+ . output_name ( * self . root_path , extension. clone ( ) )
435436 . owned ( )
436437 . await ?;
437438
@@ -440,7 +441,7 @@ impl ChunkingContext for BrowserChunkingContext {
440441 let ident = ident. await ?;
441442 let query = QString :: from ( ident. query . await ?. as_str ( ) ) ;
442443
443- let name = query. get ( "name" ) . unwrap_or ( import_name . as_str ( ) ) ;
444+ let name = query. get ( "name" ) . unwrap_or ( output_name . as_str ( ) ) ;
444445
445446 let evaluate = stream:: iter ( & ident. modifiers )
446447 . any ( async |m| m. await . is_ok_and ( |m| m. contains ( "evaluate" ) ) )
@@ -481,7 +482,7 @@ impl ChunkingContext for BrowserChunkingContext {
481482 None => name. to_string ( ) ,
482483 }
483484 }
484- None => import_name . to_string ( ) ,
485+ None => output_name . to_string ( ) ,
485486 } ;
486487
487488 if !filename. ends_with ( extension. as_str ( ) ) {
@@ -767,26 +768,6 @@ impl ChunkingContext for BrowserChunkingContext {
767768 }
768769}
769770
770- #[ turbo_tasks:: function]
771- pub async fn ident_to_output_filename (
772- ident : Vc < AssetIdent > ,
773- context_path : Vc < FileSystemPath > ,
774- expected_extension : RcStr ,
775- ) -> Result < Vc < RcStr > > {
776- let ident = & * ident. await ?;
777- let path = & * ident. path . await ?;
778- let mut name = if let Some ( inner) = context_path. await ?. get_path_to ( path) {
779- clean_separators ( inner)
780- } else {
781- clean_separators ( & ident. path . to_string ( ) . await ?)
782- } ;
783- let removed_extension = name. ends_with ( & * expected_extension) ;
784- if removed_extension {
785- name. truncate ( name. len ( ) - expected_extension. len ( ) ) ;
786- }
787- Ok ( Vc :: cell ( name. into ( ) ) )
788- }
789-
790771pub fn clean_separators ( s : & str ) -> String {
791772 static SEPARATOR_REGEX : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r".*[/#?]" ) . unwrap ( ) ) ;
792773 SEPARATOR_REGEX . replace_all ( s, "" ) . to_string ( )
0 commit comments