You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr: our formatting code + intl-messageformat is relatively small. At the very least we can rearrange it to easily ship with swap-locale (#10148), but we should seriously consider shipping it with the main report as well.
This came up in #10148 (comment) most recently, but also just came up in the context of the flow-report (#13034 (comment)). We've also had a few instances where we've wanted to format strings in the standalone report with replacement values and haven't been able to.
Starting with concrete plans and moving to more fanciful ideas:
move formatting code to a new directory so it can be easily shared by core and report-adjacent code. This solves the tsc issues in report: swap locale, enable in viewer #10148 (comment), and makes the rolluping more straightforward: it's not reaching deep in core for files to bundle and it's clearer from file location that what's imported/required needs to be kept compatible across environments.
where the i18 readme and the supporting scripts should live relative to all this is an open question. It is unfortunate that it gets more spread out
ship report: swap locale, enable in viewer #10148 using the separate directory. Will fix the tsc issues and some of the bundling should be simpler (e.g. no shimming path or lighthouse-logger)
stripping the locale files from the bundle then adding them back on demand via registerLocaleData seems 👍
Shrink the plain format.js bundle. The swap-locale bundle is already down to 34KiB (10KiB after gzip) just dropping path and lighthouse-logger, should be smaller without the extra str_/UIStrings functionality that will be in a different file now, and will be even smaller with no swap-locale (which means no _.get/_.set, another 4+KiB each)
Switching to esmodules means better tree shaking. Wouldn't ditch much code in format.js, but later intl-messageformat versions ship ESM builds. They are bigger overall, but that means they can be tree shaken, so it's possibly a win.
if we do update, will have to deal with Curly braces should be escaped by single quotes formatjs/formatjs#1437. Apparently single quotes are supposed to escape curly braces in the ICU strings. We have two strings that have '{replacement}' and will have to be updated and/or dealt with so old LHRs aren't broken
Ship with flow-report. No reason to artificially limit the text we want to show. Even if we only got it down to 25KiB (w/o gzip) that's tiny compared to a series of LHRs :)
Ship with the standalone report for the same reason.
Next-gen renderFormattedStrings that support replacement.
The text was updated successfully, but these errors were encountered:
tl;dr: our formatting code +
intl-messageformat
is relatively small. At the very least we can rearrange it to easily ship withswap-locale
(#10148), but we should seriously consider shipping it with the main report as well.This came up in #10148 (comment) most recently, but also just came up in the context of the flow-report (#13034 (comment)). We've also had a few instances where we've wanted to format strings in the standalone report with replacement values and haven't been able to.
Starting with concrete plans and moving to more fanciful ideas:
tsc
issues in report: swap locale, enable in viewer #10148 (comment), and makes the rolluping more straightforward: it's not reaching deep in core for files to bundle and it's clearer from file location that what's imported/required needs to be kept compatible across environments.shared/
is a terrible name so would be happy to get suggestions :)shared/
came up before in the context of where thereport-generator
should live. It should probably move toshared/
as well.path
orlighthouse-logger
)registerLocaleData
seems 👍format.js
bundle. The swap-locale bundle is already down to 34KiB (10KiB after gzip) just droppingpath
andlighthouse-logger
, should be smaller without the extrastr_
/UIStrings functionality that will be in a different file now, and will be even smaller with no swap-locale (which means no_.get
/_.set
, another 4+KiB each)format.js
, but laterintl-messageformat
versions ship ESM builds. They are bigger overall, but that means they can be tree shaken, so it's possibly a win.'{replacement}'
and will have to be updated and/or dealt with so old LHRs aren't brokenflow-report
. No reason to artificially limit the text we want to show. Even if we only got it down to 25KiB (w/o gzip) that's tiny compared to a series of LHRs :)The text was updated successfully, but these errors were encountered: