Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade webR to version 0.4.2 #177

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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