rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.35k stars 1.87k forks source link

Stop using Babel; compile JS to ES2020 #4066

Open wch opened 4 months ago

wch commented 4 months ago

I think it's time that we move on from using Babel and start using modern browser features natively.

My understanding is that Babel is for compiling code to ES2015, which is now 9 years old. This PR changes it to ES2020, which is 4 years old, but still has a lot of useful features that are expected these days, like async.

The use of more modern generated code also will make debugging much easier, especially with async code.

As a result of these changes, the generated code will shrunk quite a bit. Notably, shiny.min.js goes from 438201 to 125209 bytes.

❯ git diff --stat
 inst/www/shared/busy-indicators/busy-indicators.css                     |   2 +-
 inst/www/shared/datepicker/js/bootstrap-datepicker.min.js               | Bin 106348 -> 105799 bytes
 inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js                | Bin 41631 -> 41610 bytes
 inst/www/shared/selectize/accessibility/js/selectize-plugin-a11y.min.js | Bin 2512 -> 2503 bytes
 inst/www/shared/shiny-autoreload.js                                     | Bin 59336 -> 891 bytes
 inst/www/shared/shiny-autoreload.js.map                                 | Bin 314216 -> 3824 bytes
 inst/www/shared/shiny-showcase.css                                      | Bin 1044 -> 1042 bytes
 inst/www/shared/shiny-showcase.js                                       | Bin 24731 -> 3479 bytes
 inst/www/shared/shiny-showcase.js.map                                   | Bin 126645 -> 14761 bytes
 inst/www/shared/shiny-testmode.js                                       | Bin 250 -> 242 bytes
 inst/www/shared/shiny-testmode.js.map                                   | Bin 1498 -> 1539 bytes
 inst/www/shared/shiny.js                                                | Bin 1045360 -> 245709 bytes
 inst/www/shared/shiny.js.map                                            | Bin 1788617 -> 701144 bytes
 inst/www/shared/shiny.min.css                                           | Bin 6311 -> 6309 bytes
 inst/www/shared/shiny.min.js                                            | Bin 438201 -> 125209 bytes
 inst/www/shared/shiny.min.js.map                                        | Bin 1828489 -> 703574 bytes
 yarn.lock                                                               |   2 +-
 17 files changed, 2 insertions(+), 2 deletions(-)
wch commented 4 months ago

@schloerke can we get rid of this directory now? https://github.com/rstudio/shiny/blob/9fdc76d5af84504601fd485bb42656d9e0ec3ac0/srcts/patch/