@@ -598,8 +598,26 @@ fn url_to_local_sub_path<'a>(
598598 }
599599
600600 fn get_extension ( url : & Url , content_type : Option < & str > ) -> & ' static str {
601- MediaType :: from_specifier_and_content_type ( url, content_type)
602- . as_ts_extension ( )
601+ let media_type =
602+ MediaType :: from_specifier_and_content_type ( url, content_type) ;
603+ match media_type {
604+ MediaType :: JavaScript => ".js" ,
605+ MediaType :: Jsx => ".jsx" ,
606+ MediaType :: Mjs => ".mjs" ,
607+ MediaType :: Cjs => ".cjs" ,
608+ MediaType :: TypeScript => ".ts" ,
609+ MediaType :: Mts => ".mts" ,
610+ MediaType :: Cts => ".cts" ,
611+ MediaType :: Dts => ".d.ts" ,
612+ MediaType :: Dmts => ".d.mts" ,
613+ MediaType :: Dcts => ".d.cts" ,
614+ MediaType :: Tsx => ".tsx" ,
615+ MediaType :: Css => ".css" ,
616+ MediaType :: Json => ".json" ,
617+ MediaType :: Wasm => ".wasm" ,
618+ MediaType :: SourceMap => ".js" ,
619+ MediaType :: Unknown => ".js" ,
620+ }
603621 }
604622
605623 fn short_hash ( data : & str , last_ext : Option < & str > ) -> String {
@@ -1194,6 +1212,7 @@ mod test {
11941212 & [ ] ,
11951213 "deno.land/x/#test._4ee3d/main.ts" ,
11961214 ) ;
1215+ run_test ( "https://deno.land/x/mod.wasm" , & [ ] , "deno.land/x/mod.wasm" ) ;
11971216
11981217 #[ track_caller]
11991218 fn run_test ( url : & str , headers : & [ ( & str , & str ) ] , expected : & str ) {
0 commit comments