Recent Releases of webr
webr - webR 0.5.4
New features
- Support sharing URLs and initial editor file population in the webR application. (#554)
Breaking changes
- Updated Fontconfig to version 2.15.0 (#544).
Bug Fixes
- (Regression, again) Fix linking to the FreeType library when building webR (See #504 for details).
Full Changelog: https://github.com/r-wasm/webr/compare/v0.5.3...v0.5.4
- TypeScript
Published by georgestagg 8 months ago
webr - webR 0.5.3
Patch release
Raise initial memory default (#552).
Use the
selfflake input inflake.nix.
Full Changelog: https://github.com/r-wasm/webr/compare/v0.5.2...v0.5.3
- TypeScript
Published by georgestagg 8 months ago
webr - webR 0.4.4
Backports
- Upgrade
@jupyterlite/contentsfor JupyterLite 0.6.0 (#549)
Full Changelog: https://github.com/r-wasm/webr/compare/v0.4.3...v0.4.4
- TypeScript
Published by georgestagg 8 months ago
webr - webR 0.5.2
Patch release
Minor hotfix release to include the correct version of R in the webR Docker image.
No other changes.
Full Changelog: https://github.com/r-wasm/webr/compare/v0.5.1...v0.5.2
- TypeScript
Published by georgestagg 8 months ago
webr - webR 0.5.1
New features
- Updated to R version 4.5.1.
Breaking changes
- Upgraded JupyterLite DriveFS filesystem to v0.6.2, for use with JupyterLite v0.6.0 and later (#549).
Full Changelog: https://github.com/r-wasm/webr/compare/v0.5.0...v0.5.1
- TypeScript
Published by georgestagg 8 months ago
webr - webR 0.5.0
New features
Updated to R version 4.5.0.
Added an async generator function
WebR.stream()to the webR JavaScript API, providing an alternative way to stream output messages from the worker thread (#541).Expose Emscripten's
FS.rename()andFS.analyzePath()functions on theWebR.FSobject in JavaScript (#543).Added libaec 1.1.3 to the WebAssembly system libraries (#491).
Added HDF5 1.12.3 to the WebAssembly system libraries (#540).
Breaking changes
Updated to Emscripten version 4.0.8.
Updated the base LLVM distribution to LLVM 20, rebasing our Fortran for WebAssembly patches on the latest release of LLVM at time of writing (v20.1.4). The LLVM Fortran compiler binary name is now
flangand webR's build scripts have been updated to reflect this.Errors of type
WebRWorkerErrorinitially caused by Emscripten filesystem errors are now raised with message"ErrnoError: n", wherenis the error number, rather than the generic"FS Error"message.
Bug Fixes
Fix linking to the FreeType library when building webR (#531).
Better handle worker loading errors with an error callback in
newCrossOriginWorker(#539).
New Contributors
- @Dual-Ice made their first contribution in https://github.com/r-wasm/webr/pull/539
- @Hasnep made their first contribution in https://github.com/r-wasm/webr/pull/535
Full Changelog: https://github.com/r-wasm/webr/compare/v0.4.3...v0.5.0
- TypeScript
Published by georgestagg 9 months ago
webr - webR 0.4.3
New features
Added support for mounting JupyterLite DriveFS filesystems within the webR JupyterLite kernel (#533).
Updated to R version 4.4.2 (#498).
Breaking changes
The
webr::eval_js()function can now return other types of R object, not just scalar integers. Returned JavaScript objects are converted to R objects using theRObjectgeneric constructor, and specific R object types can be returned by invoking the R object constructor directly in the evaluated JavaScript.When explicitly creating a list using the
RListconstructor, nested JavaScript objects at a deeper level are also converted into R list objects. This does not affect the genericRObjectconstructor, as the default is for JavaScript objects to map to Rdata.frameobjects using theRDataFrameconstructor.
Bug Fixes
Added a workaround for compiling against older FreeType (#485).
(Regression) Mounting filesystem images using the
WORKERFSfilesystem type now works again in the browser using the JavaScript API from the main thread (#488).
Full Changelog: https://github.com/r-wasm/webr/compare/v0.4.2...v0.4.3
- TypeScript
Published by georgestagg 10 months ago
webr - webR 0.4.2
New features
- Added support for directly mounting (optionally compressed)
.tararchives as filesystem images. Archives must be pre-processed using therwasmR package to append filesystem image metadata to.tararchive data.
Breaking changes
- When installing binary R packages, webR will now default to mounting the R package binary
.tgzfile as a filesystem image. If this fails (e.g. the.tgzhas not been processed to add filesystem image metadata) webR will fall back to a traditional install by extracting the contents of the.tgzfile.
Bug Fixes
- Mounting filesystem images using the
WORKERFSfilesystem type now works correctly under Node.js (#328).
New Contributors
- @luisDVA made their first contribution in https://github.com/r-wasm/webr/pull/472
- @thomascwells made their first contribution in https://github.com/r-wasm/webr/pull/473
Full Changelog: https://github.com/r-wasm/webr/compare/v0.4.1...v0.4.2
- TypeScript
Published by georgestagg over 1 year ago
webr - webR 0.4.1
New features
- When mounting Emscripten VFS images, filesystem
.datafiles may be optionallygzipcompressed. Compressed VFS filesystem data must have the file extension.data.gz, and the metadata JSON stored in the.js.metadatafile must include the propertygzip: true(#460).
Breaking changes
R package dependencies listed only in the
LinkingTofield are no longer downloaded bywebr::install(). Such packages are required for building an R package, but not at runtime. This saves time and network resources when installing R packages from a WebAssembly CRAN-like repository (#463).Unrecoverable
WebAssembly.RuntimeErrorerrors are now handled by emitting an error message, closing the communication channel, and terminating the webR worker thread.When the communication channel has been closed, reject any attempts to to write to the channel (e.g.
webR.evalR(),webR.writeConsole()) with a relevant error message, rather than not resolving the returnedPromiseat all.
Bug Fixes
- Partially revert 7c624f7, returning HTML Canvas scaling to the behaviour in webR 0.3.3.
- TypeScript
Published by georgestagg over 1 year ago
webr - webR 0.4.0
New features
Updated to R version 4.4.1.
The capturing mechanism of
captureR()has been updated so that memory reallocation is performed when outputting very long lines. If reallocation is not possible (e.g. the environment does not have enough free memory to hold the entire line), the previous behaviour of truncating the line output is maintained (#434).Enabled the Emscripten IDBFS virtual filesystem driver. This filesystem type can be used to persist data in web browser storage across page reloads. This filesystem type must be used with the
PostMessagecommunication channel (#56, #442).Added resizable panels to the webR application (#396). The
canvas()graphics device is now resized dynamically to fit to the plotting pane.The R
View()command now invokes a simple data grid viewer in the webR application.A function
viewer_install()is added to the webR support package. The function sets up R so as to generate an output message over the webR communication channel when a URL viewer is invoked (#295).Printing a HTML element or HTML widget in the webR application app now shows the HTML content in an embedded viewer
iframe(#384, #431). With thanks to @timelyportfolio for the basic implementation method.The webR application now allows users to download an archive of a directory and its contents from the virtual filesystem (#388).
Breaking changes
The
ServiceWorkercommunication channel has been deprecated. Users should use theSharedArrayBufferchannel where cross-origin isolation is possible, or otherwise use thePostMessagechannel. For the moment theServiceWorkerchannel can still be used, but emits a warning at start up. The channel will be removed entirely in a future version of webR.The R session is now set as non-interactive when capturing output using
captureR()andevalR(). After output capture is complete, the status is restored (#426).
Bug Fixes
Fix generation of R API documentation (#439).
The
rwasmR package is now installed into the system library as part of the webR development Docker container (#443, r-wasm/actions#10).webR.installPackages()now correctly handles bothstringandstring[]arguments for package names and binary repositories (#437).Resolved several syntax highlighting and code completion issues in the webR application.
- TypeScript
Published by georgestagg over 1 year ago
webr - webR 0.3.3
New features
A
webR.versionproperty has been added, containing the current version and build information (#409).An
RObject.class()method has been added, returning anRCharacterobject with the names of the classes from which the given R object inherits. This has been implemented using R'sclass()function, and so the implicit class is similarly returned when the R object has noclassattribute.WebR now sets the environment variable
WEBRequal to"1"andWEBR_VERSIONequal to the webR version string in the WebAssembly environment (#414).Dev tools: Running
make helpnow prints valid targets and their descriptions (#410).
Bug Fixes
Fix installing packages via shim with
character.only = TRUE(#413).WebR will now flush incomplete lines when capturing output streams with
Shelter.captureR()(#412).Fix the
typesspecification inpackage.jsonfor the webR npm package (#404).
- TypeScript
Published by georgestagg almost 2 years ago
webr - webR 0.3.2
New features
The
captureGraphicsoption inEvalROptionsnow allows the caller to set the arguments to be passed to the capturingwebr::canvas()device (#390).A subclass
RDataFrameis now available for explicit construction of an R object with classdata.frame.RDataFrameextends theRListclass, and construction must be with data that can be coerced into an Rdata.frame, otherwise an error is thrown.The
RListconstructor now takes an optional second argument to define names when constructing a list. The argument should be an array of strings, ornullfor an unnamed list (the default).
Breaking changes
- When using the generic
RObjectconstructor, JavaScript objects and object arrays are now reserved for constructing an Rdata.frame. To create a standard R list, use theRListconstructor directly (#398).
Bug Fixes
When capturing graphics with
captureR(), clean-up now occurs even when the evaluated R code throws an error. This avoids leaking graphics devices on the device stack.Use backticks when reporting an R call as part of an error message (#397).
- TypeScript
Published by georgestagg almost 2 years ago
webr - webR 0.3.1
Hotfix release to manage incompatible WebAssembly binary R packages due to ABI changes in Emscripten.
- TypeScript
Published by georgestagg almost 2 years ago
webr - webR 0.3.0
New features
Updated to R version 4.3.3.
Support for building webR and LLVM Flang as Nix packages, using Nix flakes.
WebR's
./configurescript now detects the presence of aEMFCenvironment variable in the user's environment. If this variable points to an existingflang-newbinary, and a Fortran runtime library for WebAssembly can also be found, webR will skip building LLVM flang and instead use the version provided by the environment.Additional optional Wasm system libraries for linking with R packages: libsodium (#333), webp (#334), imagemagick (#336), libarchive; lz4; zstd (#337), gmp; mpfr; glpk (#339), gsl (#340), libgit2 (#342).
The webR development Docker container now contains a Rust toolchain configured to produce binaries for the
wasm32-unknown-emscriptentarget, enabling the building of R packages containing Rust code for webR.The
webr::canvas()graphics device has a new argumentcapture, defaulting toFALSE. WhenTRUE, plots are captured into a canvas cache on the webR worker thread. The cache may be accessed from JavaScript throughModule.webr.canvas. Entries in the canvas cache are destroyed usingwebr::canvas_purge()orwebr::canvas_destroy(id). In this way, thecaptureR()method now captures plots by default (see below).The
RCallandRFunctionclasses now have acapture(options, ...args)method that captures output during evaluation.Errors re-thrown by
evalRnow include information about the source R call, helping to identify the original location of the error.JavaScript objects of type
TypedArray,ArrayBuffer, andArrayBufferView(e.g.Uint8Array) may now be used with theRRawR object constructor. The genericRObjectconstructor now converts objects of this type to R raw atomic vectors by default.Constructing new R objects using
await new RObject(...)now supports input objects of the form:{a: [...], b: [...]}or D3-style data arrays of the form:[{a: ..., b: ...}, {a: ..., b: ...}, {a: ..., b: ...}, ... ]. Where possible, lists are constructed of classdata.frame. Direct construction withRList()does not create adata.frame.R
data.frameobjects may be converted into D3-style data arrays using the new R list object method.toD3().
Breaking changes
The
captureR()method now captures plots generated by the canvas graphics device by default. Captured plots are returned as an array ofImageBitmapobjects in the propertyimages. The previous behaviour may be restored either by manually starting a non-capturingwebr::canvas()device during execution, or by includingcaptureGraphics: falseas part of theoptionsargument. The default options forevalR()are set so that plotting is not captured, retaining the current behaviour.Upgraded the base LLVM distribution from LLVM 14 to LLVM 18, rebasing our Fortran for WebAssembly patches on the latest release of LLVM at time of writing (v18.1.1). The LLVM Fortran compiler binary name is now
flang-newand webR's build scripts have been updated to reflect this. Theemfcwrapper script is no longer required, but for the moment the Make variable pointing to theflang-newcompiler is still namedEMFCfor backwards compatibility.The LLVM flang build scripts are now sourced using a git submodule, to simplify management of CI builds. The build scripts are available at https://github.com/r-wasm/flang-wasm and the patched LLVM source at https://github.com/r-wasm/llvm-project. This allows for an independent build of the patched LLVM flang for WebAssembly, including as a separate Nix package.
shim_install()now shims base Rlibrary()andrequire()commands so that webR packages are downloaded automatically with an optional menu. This extends the functionality of the global package-not-found handler so that the same feature can be used when usingevalR()(#324). The new shims also ensure thatlibrary()andrequire()do not need to be called again once the package is downloaded and available.It is no longer assumed that an interactive R session will be able to show a
menu()when offering to download a missing R package. Instead this now defaults to not showing a menu, withoptions(webr.show_menu = TRUE)enabling the menu feature globally.The
RObject.toObject()methods have been refined for R lists anddata.frameobjects. The.toObject()method no longer uses recursion by default when converting R lists and environments, due to the possibility of unconvertible nested R objects. However, for symbols, atomic vectors, and Rdata.frameobjects.toObject()will convert the object to JavaScript in entirety. For a type-stable conversion, serialise the object with the.toJs()method instead.
Bug Fixes
Fix showing content of lazy loaded files in webR demo app editor component (#320).
Contents of the code editor in the webR REPL application is now sourced as a temporary file, allowing for input longer than the default R console input buffer length (#326).
R error conditions raised during evaluation of an
RCallorRFunctionobject are now re-thrown as JavaScript exceptions.Fixed spelling errors in some JavaScript errors thrown by webR.
Useful POSIX scripts from libraries compiled for Wasm are now copied to
$(HOST)/binso that$(WASM)/bindoes not need to be put on the path when building Wasm R packages (#327).The
symbols.rdsmake target should now work when building R packages usingrwasm(r-wasm/rwasm#13).Rasters with negative width or height are now drawn mirrored or flipped when using the canvas graphics device (#350).
Include
cexparameters when calculating font size in canvas graphics device (#348).
- TypeScript
Published by georgestagg almost 2 years ago
webr - webR 0.2.2
New features
Updated
Dockerfileto build webR with LLVMflangand setup environment in preparation for building Wasm R packages. The Docker container is now built and published by GitHub Actions as part of webR CI deployment from themainbranch.The base R function
install.packages()is has now been shimmed to usewebr::install()in the webR demo app.Expose Emscripten's
FS.mount()onwebr::mountin R, andwebR.FS.mount()in JavaScript. This allows images built using Emscripten'sfile_packagerto be mounted on the virtual filesystem and host directory paths to be mounted when running under Node. See the webR documentation for details.By default,
webr::install()now useswebr::mount()to mount Wasm R packages into the R library, rather than downloading package.tgzarchives and decompressing the contents to the virtual filesystem. This improves the performance of package installation. If the package repository does not provide.dataEmscripten filesystem images,webr::install()will fallback to downloading.tgzpackages, as before.
Breaking changes
When starting webR using the
ChannelType.Automaticchannel (the default), thePostMessagechannel is now used as the fallback when the web page is not Cross-Origin Isolated. ThePostMessagechannel has the widest compatibility, but is unable to use functions that block for input (e.g.readline(),menu(),browser(), etc). If blocking for input is required, theServiceWorkerchannel is still available, but must be requested explicitly.Invoking the
system()function now raises an R error condition.Invoking functions that block for input now raises an R error condition when running under the
PostMessagecommunication channel.Options are now passed to the JavaScript function
webR.installPackages()in the form of anoptionsargument, an object of typeInstallPackagesOptions.
Bug fixes
Certain graphical properties, e.g
lty&lwd, now work correctly in the webRcanvas()graphics device. (#289, #304).Various updates for the webR Demo App to improve accessibility. (#267, #269, #270, #271, #272, #273, #274).
- TypeScript
Published by georgestagg over 2 years ago
webr - webR 0.2.1
New features
- Added a new communication channel based on
postMessage, to be used when both Cross Origin Isolation and Service Workers are unavailable. Nested R REPLs (e.g.readline(),menu(),browser(), etc.) are unsupported when using this channel.
Bug fixes
Fix HTML canvas graphics in
Consoleclass (#256).Fix drawing rasters in HTML canvas graphics device (#251).
Remove no-longer valid references to
repl.mjsinpackage.json(#250).Ensure that the one-time setup required for the
WebRclass occurs only once when callingwebR.init().
- TypeScript
Published by georgestagg over 2 years ago
webr - webR 0.2.0
New features
Improve accessibility of xterm.js in the webR REPL app by enabling
screenReaderMode.Issue an output message of type
'closed'when the webR communication channel closes.Build Cairo graphics library and its prerequisites for Wasm as part of the webR build process. This allows the default Cairo-based graphics devices in R, such as
png(),bmp()andsvg(), to work in webR.Build Pango text layout library and its prerequisites for Wasm. This provides modern text rendering features and better support for internationalisation (e.g. font-fallback and RTL scripts) for the Cairo-based bitmap graphics devices.
Update webR's version of R to 4.3.0.
Include additional type predicate functions for subclasses of
RObject, such asisRDouble(). These can be used by TypeScript applications to narrow the typing of anRObjectwithout assertion using theaskeyword. The new type predicate functions have also been re-exported through the defaultWebRmodule.Introduce lazy virtual filesystem entries. The webR filesystem is populated at initialisation time with only the files required to startup R. Other files made available (e.g. documentation and HTML pages) are downloaded on demand when the files are opened for reading by some process. The optional lazy filesystem entries can be avoided in entirety by setting
createLazyFilesystem: falseinWebROptions.Add a
quietargument towebr::install()andwebR.installPackages()APIs that allows for silencing webR package downloading messages.Add custom
WebRErrorclasses so that errors from webR can be identified by testing thrown exceptions withinstanceof WebRError.Reimplemented the demo webR REPL app using the React framework, allowing us to drop jQuery as a dependency. The reworked app has various new features and improvements: now includes a tabbed CodeMirror editor with R syntax highlighting and autocomplete, support for text document paging and displaying built-in R help/demos/documentation, expanded UI for virtual filesystem management, improved plot handling including paged multiple plots.
Breaking changes
The webR npm package has been renamed from '@r-wasm/webr' to simply 'webr'. An npm depreciation notice will be put in place for the old package name.
Removed the legacy
console.mjsbuild target. TheConsoleclass is re-exported on the defaultWebRentrypoint, and so the extra build target is not required. This is technically a breaking change, but the legacy entrypoint was never documented and so we believe the change has only minor effect.The webR HTML
canvas()graphics device has been moved from the default grDevices package to the webr support package. In addition, it has been reimplemented using theOffscreenCanvasAPI. Users of the Safari web browser will now require at least version 16.4 to use the canvas graphics device. Users with older browsers not supportingOffscreenCanvaswill need to use an alternative plotting method, such as bitmap graphics using thepng()Cairo device.Output messages from the
canvas()graphics device have been restructured so as to handle more event types in addition to transmitting image bitmap data. For example, an output message is now also emitted when the device creates a new empty plot. WebR apps making use of HTML canvas graphics will need to be updated for the new message structure. See the newly added "Plotting" section in the webR documentation for further details.The version of Emscripten used to build the public webR binaries hosted on r-wasm.org and npm has been set to v3.1.37. R packages built for Wasm should be compiled with this same version of Emscripten to ensure Wasm ABI compatibility.
Bug fixes
- The
REnvproperty of a user providedWebROptionsis now merged with the default value, rather than replacing it. With this a user need not explicitly include the defaultR_HOMEvalue when adding new environment variables.
- TypeScript
Published by georgestagg over 2 years ago
webr - webR 0.1.1
Breaking changes
- Rename the properties of
WebROptionsso that they are all in camelCase, consistent with the rest of the webR TypeScript source.
We have made the decision to release the above breaking change quickly while there are still a relatively low number of affected users.
Bug fixes
Improve compatibility when running webR under Node.
Fix
chol()withpivot=TRUEby working around a Fortran library issue.
- TypeScript
Published by georgestagg almost 3 years ago
webr - webR 0.1.0
The initial release of webR, version 0.1.0.
WebR v0.1.0 is documented at https://docs.r-wasm.org/webr/v0.1.0/.
Release packages contain both the webR JavaScript loader and the R WebAssembly binaries, designed to be self-hosted on a web server that you control.
- TypeScript
Published by georgestagg almost 3 years ago