Sitelet https://github.com/rstudio/httpuv/commit/f1e029caf9071219844459e5e9fd2e691b338f47
Skip to content

Commit f1e029c

Browse files
authored
Add mime type for .wasm files (#407)
* Add mime type for .wasm files * `devtools::document()` (GitHub Actions) * Update NEWS --------- Co-authored-by: wch <wch@users.noreply.github.com>
1 parent ff00e6b commit f1e029c

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ LinkingTo:
7171
Rcpp
7272
Encoding: UTF-8
7373
Roxygen: list(markdown = TRUE)
74-
RoxygenNote: 7.3.1
74+
RoxygenNote: 7.3.2
7575
SystemRequirements: GNU make, zlib
7676
Collate:
7777
'RcppExports.R'

‎NEWS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# httpuv (development version)
22

3+
* Added a mime type entry for `.wasm` files, which should be served as `application/wasm`. (#407)
4+
35
# httpuv 1.6.15
46

57
* `runStaticServer()` no longer fails if `browse = TRUE` but `utils::browseurl()` is unable to open the server. (#395)

‎src/mime.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Do not edit.
2-
// Generated by ../tools/update_mime.R using R package mime 0.6
2+
// Generated by ../tools/update_mime.R using R package mime 0.12
33

44
#include <map>
55
#include <string>
@@ -549,7 +549,8 @@ const std::map<std::string, std::string> mime_map = {
549549
{"mkv", "video/x-matroska"},
550550
{"ice", "x-conference/x-cooltalk"},
551551
{"sisx", "x-epoc/x-sisx-app"},
552-
{"vrm", "x-world/x-vrml"}
552+
{"vrm", "x-world/x-vrml"},
553+
{"wasm", "application/wasm"}
553554
};
554555

555556
std::string find_mime_type(const std::string& ext) {

‎tools/update_mime.R‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,29 @@ library(rprojroot)
33

44
dest_file <- rprojroot::find_package_root_file("src", "mime.cpp")
55

6+
mimemap <- mime::mimemap
7+
8+
# Manually add .wasm -> application/wasm because mime package doesn't know
9+
# about it yet.
10+
if ("wasm" %in% names(mimemap)) {
11+
warning("The mime::mimemap table now contains .wasm -> application/wasm and the workaround in update_mime.R should be removed.")
12+
} else {
13+
mimemap["wasm"] <- "application/wasm"
14+
}
15+
616
mime_map_text <- mapply(
717
function(ext, mime_type) {
818
sprintf(' {"%s", "%s"}', ext, mime_type);
919
},
10-
names(mime::mimemap),
11-
mime::mimemap,
20+
names(mimemap),
21+
mimemap,
1222
SIMPLIFY = TRUE,
1323
USE.NAMES = FALSE
1424
)
1525
mime_map_text <- paste(mime_map_text, collapse = ",\n")
1626

1727

18-
output <- glue(.open = "[", .close = "]", '
28+
output <- glue::glue(.open = "[", .close = "]", '
1929
// Do not edit.
2030
// Generated by ../tools/update_mime.R using R package mime [packageVersion("mime")]
2131

0 commit comments

Comments
 (0)