From 18aff089e82f80b1c9c230848a6a65a69b97f602 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 12 Sep 2025 16:05:45 -0700 Subject: [PATCH 1/2] fix: wasm module should be vendored as .wasm file --- rs_lib/src/local.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/rs_lib/src/local.rs b/rs_lib/src/local.rs index fbd5b04..ee53c2f 100644 --- a/rs_lib/src/local.rs +++ b/rs_lib/src/local.rs @@ -598,8 +598,25 @@ fn url_to_local_sub_path<'a>( } fn get_extension(url: &Url, content_type: Option<&str>) -> &'static str { - MediaType::from_specifier_and_content_type(url, content_type) - .as_ts_extension() + let media_type = MediaType::from_specifier_and_content_type(url, content_type); + match media_type { + MediaType::JavaScript => ".js", + MediaType::Jsx => ".jsx", + MediaType::Mjs => ".mjs", + MediaType::Cjs => ".cjs", + MediaType::TypeScript => ".ts", + MediaType::Mts => ".mts", + MediaType::Cts => ".cts", + MediaType::Dts => ".d.ts", + MediaType::Dmts => ".d.mts", + MediaType::Dcts => ".d.cts", + MediaType::Tsx => ".tsx", + MediaType::Css => ".css", + MediaType::Json => ".json", + MediaType::Wasm => ".wasm", + MediaType::SourceMap => ".js", + MediaType::Unknown => ".js", + } } fn short_hash(data: &str, last_ext: Option<&str>) -> String { @@ -1194,6 +1211,11 @@ mod test { &[], "deno.land/x/#test._4ee3d/main.ts", ); + run_test( + "https://deno.land/x/mod.wasm", + &[], + "deno.land/x/mod.wasm", + ); #[track_caller] fn run_test(url: &str, headers: &[(&str, &str)], expected: &str) { From 21bf97ba4a7f19ce584dccfe81a8a62cbe5998d3 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 12 Sep 2025 16:07:50 -0700 Subject: [PATCH 2/2] format --- rs_lib/src/local.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rs_lib/src/local.rs b/rs_lib/src/local.rs index ee53c2f..3e66f9c 100644 --- a/rs_lib/src/local.rs +++ b/rs_lib/src/local.rs @@ -598,7 +598,8 @@ fn url_to_local_sub_path<'a>( } fn get_extension(url: &Url, content_type: Option<&str>) -> &'static str { - let media_type = MediaType::from_specifier_and_content_type(url, content_type); + let media_type = + MediaType::from_specifier_and_content_type(url, content_type); match media_type { MediaType::JavaScript => ".js", MediaType::Jsx => ".jsx", @@ -1211,11 +1212,7 @@ mod test { &[], "deno.land/x/#test._4ee3d/main.ts", ); - run_test( - "https://deno.land/x/mod.wasm", - &[], - "deno.land/x/mod.wasm", - ); + run_test("https://deno.land/x/mod.wasm", &[], "deno.land/x/mod.wasm"); #[track_caller] fn run_test(url: &str, headers: &[(&str, &str)], expected: &str) {