Skip to content

Commit

Permalink
Upgrade webR to version 0.4.2 (#177)
Browse files Browse the repository at this point in the history
* Upgrade webR v0.4.2

* Upgrade R Shiny v1.9.1.8002

* Add .tgz install fallback for traditional archives
  • Loading branch information
georgestagg authored Sep 19, 2024
1 parent a87fc8b commit eb5e379
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SHINYLIVE_VERSION = $(shell node -p "require('./package.json').version")
PYODIDE_VERSION = 0.26.2
PYODIDE_DIST_FILENAME = pyodide-$(PYODIDE_VERSION).tar.bz2
DOWNLOAD_DIR = ./downloads
R_SHINY_VERSION = 1.9.1.8000
R_SHINY_VERSION = 1.9.1.8002
BUILD_DIR = ./build
PACKAGE_DIR = ./packages
DIST_DIR = ./dist
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"vscode-languageserver-protocol": "^3.17.5",
"webr": "^0.4.1",
"webr": "^0.4.2",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.7.0",
"xterm-readline": "^1.1.1"
Expand Down
24 changes: 23 additions & 1 deletion src/hooks/useWebR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ webr::shim_install()
.webr_pkg_cache <- list()
.install_pkg_tgz <- function(path, lib) {
tmp <- tempfile()
on.exit(unlink(tmp, recursive = TRUE))
utils::download.file(path, tmp, quiet = TRUE)
utils::untar(
tmp,
exdir = lib,
tar = "internal",
extras = "--no-same-permissions"
)
}
.mount_vfs_images <- function() {
metadata_url <- glue::glue("{.base_url}packages/metadata.rds")
metadata_path <- glue::glue("/shinylive/webr/packages/metadata.rds")
Expand All @@ -285,7 +298,16 @@ webr::shim_install()
try({
# Mount the virtual filesystem image, unless we already have done so
if (available && !file.exists(mountpoint)) {
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
tryCatch({
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
}, error = function(cnd) {
# File extraction fallback for .tgz with no filesystem metadata
if (grepl(".tgz$", path)) {
.install_pkg_tgz(path, "/shinylive/webr/packages/")
} else {
stop(cnd)
}
})
}
# If this is a full library, add it to .libPaths()
Expand Down
3 changes: 1 addition & 2 deletions src/webr-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Shelter, WebROptions } from "webr";
import { WebR } from "webr";
import type { EvalROptions } from "webr/webr-chan";
import { WebR, EvalROptions } from "webr";
import type { ASGIHTTPRequestScope } from "./messageporthttp.js";
import { makeHttpuvRequest } from "./messageporthttp.js";
import { openChannelHttpuv } from "./messageportwebsocket-channel.js";
Expand Down

0 comments on commit eb5e379

Please sign in to comment.