perf(build): the stylesheet minifier had never run

It looked for the tag written as `css` immediately followed by a
backtick. The plugin is a Rollup transform, so the module has already
been through TypeScript by the time it arrives, and the TS printer puts
a space there: `css `. The guard therefore returned null for every
stylesheet in the project, and minification never ran once — around
23 KB of explanatory comments went to every user in every release.

Matching the tag as a word with optional whitespace turns it on:

  chunk, raw       1 079 508 -> 1 021 115 B   (-58 393)
  initial view     300 111 -> 287 284 B gzip  (-12 816)
  room to the budget   955 -> 13 782 B

The ceiling moves down with the fact, as the tool asks when a graph
shrinks past the band.

The risk is not the two lines; it is that 23 KB of CSS is minified for
the first time. Two witnesses cover it: a browser smoke that puts the
original and the minified text into separate stylesheets and compares
the serialised rules — 1 049 of them, identical up to the whitespace
policy the minifier declares — and a test that takes real comment text
out of src/styles and requires it to be absent from dist, so a plugin
that silently stops working cannot pass again.

Issue: #526
User-Visible: yes
This commit is contained in:
Codex
2026-09-11 10:12:13 +03:00
parent 7e39c3715c
commit 0a0a9f0f4c
54 changed files with 697 additions and 11698 deletions
+9 -1
View File
@@ -234,8 +234,16 @@ export const LOW_HEADROOM_WARNING_BYTES = 15_000;
* меняется, но зазор между потолком и бюджетом сжался до 366 Б: долг #367
* из предупреждения стал ограничением, следующая правка начального графа
* упрётся в него всерьёз.
*
* 2026-09-11, #526: потолок опущен 300 700 → 288 300. Минификатор шаблонов
* стилей не работал ни разу: его отсев искал `css` вплотную к бэктику, а
* плагин видит вывод TypeScript, где принтер ставит пробел. Включение снимает
* 58 393 Б сырого текста (комментарии и отступы 23 КБ таблиц стилей) и
* 12 816 Б gzip. Измеренный факт 287 284 Б оставляет 1 016 Б сверху и 984 Б до
* нижней границы полосы; общий бюджет 301 066 Б не меняется, запас до него
* вырос с 955 Б до 13 782 Б.
*/
export const INITIAL_VIEW_GZIP_CEILING = 300_700;
export const INITIAL_VIEW_GZIP_CEILING = 288_300;
export const INITIAL_VIEW_CEILING_BAND = 2_000;
/**