Skip to content

Commit eb5e379

Browse files
authored
Upgrade webR to version 0.4.2 (#177)
* Upgrade webR v0.4.2 * Upgrade R Shiny v1.9.1.8002 * Add .tgz install fallback for traditional archives
1 parent a87fc8b commit eb5e379

File tree

5 files changed

+36
-15
lines changed

5 files changed

+36
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SHINYLIVE_VERSION = $(shell node -p "require('./package.json').version")
2020
PYODIDE_VERSION = 0.26.2
2121
PYODIDE_DIST_FILENAME = pyodide-$(PYODIDE_VERSION).tar.bz2
2222
DOWNLOAD_DIR = ./downloads
23-
R_SHINY_VERSION = 1.9.1.8000
23+
R_SHINY_VERSION = 1.9.1.8002
2424
BUILD_DIR = ./build
2525
PACKAGE_DIR = ./packages
2626
DIST_DIR = ./dist

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tsx": "^4.7.0",
7474
"typescript": "^5.3.3",
7575
"vscode-languageserver-protocol": "^3.17.5",
76-
"webr": "^0.4.1",
76+
"webr": "^0.4.2",
7777
"xterm": "^5.3.0",
7878
"xterm-addon-fit": "^0.7.0",
7979
"xterm-readline": "^1.1.1"

src/hooks/useWebR.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,19 @@ webr::shim_install()
259259
260260
.webr_pkg_cache <- list()
261261
262+
.install_pkg_tgz <- function(path, lib) {
263+
tmp <- tempfile()
264+
on.exit(unlink(tmp, recursive = TRUE))
265+
266+
utils::download.file(path, tmp, quiet = TRUE)
267+
utils::untar(
268+
tmp,
269+
exdir = lib,
270+
tar = "internal",
271+
extras = "--no-same-permissions"
272+
)
273+
}
274+
262275
.mount_vfs_images <- function() {
263276
metadata_url <- glue::glue("{.base_url}packages/metadata.rds")
264277
metadata_path <- glue::glue("/shinylive/webr/packages/metadata.rds")
@@ -285,7 +298,16 @@ webr::shim_install()
285298
try({
286299
# Mount the virtual filesystem image, unless we already have done so
287300
if (available && !file.exists(mountpoint)) {
288-
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
301+
tryCatch({
302+
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
303+
}, error = function(cnd) {
304+
# File extraction fallback for .tgz with no filesystem metadata
305+
if (grepl(".tgz$", path)) {
306+
.install_pkg_tgz(path, "/shinylive/webr/packages/")
307+
} else {
308+
stop(cnd)
309+
}
310+
})
289311
}
290312
291313
# If this is a full library, add it to .libPaths()

src/webr-proxy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Shelter, WebROptions } from "webr";
2-
import { WebR } from "webr";
3-
import type { EvalROptions } from "webr/webr-chan";
2+
import { WebR, EvalROptions } from "webr";
43
import type { ASGIHTTPRequestScope } from "./messageporthttp.js";
54
import { makeHttpuvRequest } from "./messageporthttp.js";
65
import { openChannelHttpuv } from "./messageportwebsocket-channel.js";

0 commit comments

Comments
 (0)