Skip to content

Trim dependencies: drop glue, uuid, and brew - #167

Merged
LittleBeannie merged 1 commit into
mainfrom
trim-dependencies
Sep 25, 2026
Merged

LittleBeannie merged 1 commit into
mainfrom
trim-dependencies

Conversation

@yihui

@yihui yihui commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reduces the package's transitive dependency footprint by dropping three Imports that each had only one or two call sites. No behavior change — interactive plots render identically and all tests pass.

Package Sites Replacement
glue 1 sprintf()
uuid 1 basename(tempfile(""))
brew 2 small base-R brew() helper in R/utils.R

Details

  • glue — the single glue::glue() in format_ae_forestly() becomes an equivalent sprintf().
  • uuid — the crosstalk filter id in ae_forestly() now uses basename(tempfile("")) (still unique per session; only needs to be unique for the [id*="filter_ae_"] JS matcher).
  • brew — new R/utils.R adds a minimal brew(file, envir) that substitutes <%=var%> placeholders with variables looked up in the caller's environment (single-pass via regmatches<- + mget()), used to render inst/js/sparkline.js. The var-less filter-crosstalk.js template needed no rendering at all, so html_dependency_filter_crosstalk() now sources it directly from the installed js/ dir instead of copying to tempdir().

Imports goes from 10 → 7.

Not in scope

reactable + reactR + crosstalk (~35 transitive deps) are the next lever, pending the lightweight lt render migration. ggplot2 left as-is.

🤖 Generated with Claude Code

Remove three Imports that each had only one or two call sites, reducing the
package's transitive dependency footprint:

- glue: the single `glue::glue()` call in `format_ae_forestly()` is replaced
  with an equivalent `sprintf()`.
- uuid: the crosstalk filter id in `ae_forestly()` now uses
  `basename(tempfile(""))` instead of `uuid::UUIDgenerate()`.
- brew: add a small base-R `brew()` helper in `R/utils.R` that substitutes
  `<%=var%>` placeholders with variables looked up in the caller's
  environment, and use it to render `inst/js/sparkline.js`. The var-less
  `filter-crosstalk.js` template no longer needs rendering at all, so its
  html dependency is now sourced directly from the installed `js/` directory
  instead of being copied to `tempdir()`.

No behavior change; interactive plots render identically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yihui
yihui requested a review from LittleBeannie September 24, 2026 21:44
@LittleBeannie
LittleBeannie merged commit e6e38a2 into main Sep 25, 2026
10 checks passed
@LittleBeannie
LittleBeannie deleted the trim-dependencies branch September 25, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants