-
Notifications
You must be signed in to change notification settings - Fork 18
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
Export R shinylive apps with Wasm package binaries included in static assets #72
Conversation
f0e197c
to
77decbc
Compare
7e4de44
to
29f29fe
Compare
Note: I think the "integration" test fails because From what I can tell, it looks like the file |
Even with some missing dependencies, an app may work correctly. For example, the `curl` package could be a dependency of a used Wasm package, but if network functionality is avoided never actually used at runtime. So for missing packages installed locally from a CRAN-like repo, we issue a warning and only include the package without any Wasm assets. For GitHub packages we are still strict and require that the package exists.
@georgestagg Thanks for pointing out the issue with |
Co-authored-by: Barret Schloerke <[email protected]>
Co-authored-by: Barret Schloerke <[email protected]>
Fixes #65
A first-pass implementation of #63.
Exports shinylive apps with Wasm R binary packages downloaded and included in
.../shinylive/webr/packages
. Metadata is stored in.../shinylive/webr/packages/metadata.rds
and loaded at runtime.For
shinylive::export()
, you can disable Wasm package bundling withwasm_packages = FALSE
. And disable using the cache withpackage_cache = FALSE
. Both areTRUE
by default, meaning Wasm packages will be downloaded and bundled.For Quarto documents with embedded R Shinylive apps,
quarto_ext.R
is updated so thatapp.json
bundles passed to theshinylive
R package are decoded onto disk, and then R Wasm binaries are downloaded using the same tools as created forshinylive::export()
. Finally the resulting list of binaries are passed back to Quarto as HTML dependencies.Metadata is merged over subsequent runs since (in e.g. Quarto docs) we can have multiple
app.json
bundles, and we want all referenced packages to be available in the static assets.Recursive dependencies are resolved using the
pkgdepends
package. This can get slow for large local package libraries (My R library has all of CRAN installed, for unrelated reasons, and so it takes a few seconds to resolve). We might want to think about how we could make use ofr-lib/pkgcache
in future. This should be "fine" for the moment, though.Note: Requires the
shinylive
assets bundle from posit-dev/shinylive#121