← Back to all sparks
X

xfun

DEVOPS
Velocity0.0

Collection of miscellaneous helper functions used across R packages

Yihui's utility grab-bag is quietly growing a web server and a headless browser.

utilitiespublishingheadless-browserlitedownknitrlocal-server
Current state
xfun is the shared utility layer under knitr, rmarkdown, bookdown and litedown, and its recent releases cluster in three places: the record() function that captures code output for litedown, a local app-serving stack built on R's internal httpd, and a headless-browser toolkit. Version 0.58 replaced direct httpd routing with a proxy and added serve_dir() and random_port(); 0.55 added browser_print() and 0.60 added browser_dom(), which runs JavaScript on a page and returns the rendered DOM.
Where it's heading
The package is accreting the infrastructure Yihui's publishing tools need rather than staying a pile of small helpers. Serving directories, allocating ports, proxying the help server, driving a headless browser and printing to PDF are all pieces of one pipeline: render R output to HTML, then get it onto a screen or into a static file without a heavyweight dependency. The rest of the release stream is release-automation tooling for the author's own CRAN workflow and a long tail of parser bug fixes in taml_load().
Prediction
Expect the browser functions to consolidate into a documented interface used directly by litedown, and expect cache_rds() to be fully retired in favour of cache_exec() now that it is no longer recommended.

Recent moves

  1. 1mo ago

    browser_dom() added; Windows silently truncated self-contained HTML

    Adds browser_dom() to run JavaScript on a page and return the rendered DOM, and fixes a Windows bug where read_utf8() silently truncated any file containing a Ctrl+Z byte — which includes self-contained HTML embedding a PNG signature. The truncation fix matters more than it reads: bookdown output was losing content without an error.

    View source ↗
  2. 1mo ago

    post_release() automates post-CRAN chores; nested math fixed

    Adds post_release() to automate tagging, version bumping and GitHub release creation after a CRAN submission, fixes nested LaTeX environment handling in protect_math(), and makes system3() error on non-zero exit codes. The release-automation half is tooling for the maintainer's own workflow rather than for users of the package.

    View source ↗
  3. 2mo ago

    new_app() moves to a proxy; serve_dir() and random_port() added

    ⚡ SPARK

    Rearchitects new_app() around a lightweight proxy in front of R's internal httpd and adds serve_dir() and random_port(). This is the release where xfun's local-serving story stops being an accident of the help server and becomes deliberate infrastructure.

    View source ↗
  4. 4mo ago

    Literal JavaScript in tojson(); record() bottleneck fixed

    Adds js() to mark strings as literal JavaScript so tojson() leaves them unquoted, tab_content() for building tabset panels, and a sync argument to submit_cran(). Also fixes a record() bottleneck on very large output, reported from the Quarto side.

    View source ↗
  5. 6mo ago

    Deprecated attr() and qs support removed; parallel rev_check

    Removes the deprecated xfun::attr() and drops qs support across the caching functions because qs was removed from CRAN, while adding parallel downloads to rev_check(). A cleanup release whose agenda was set by CRAN, not by the package.

    View source ↗
  6. 8mo ago

    browser_print() opens the headless-browser path

    Adds browser_print() to drive a headless browser and print a page to PDF, PNG or JPEG — the first piece of what becomes the browser toolkit — plus qs2 caching support and cleaner error capture in record().

    View source ↗