refactor: extract the base styles and finish the aggregator (#266 slice 5/5)

52 блока host/переменных/кросс-поверхностных групп → src/styles/base.styles.ts;
styles.ts — 19-строчный сборщик [base, plan, devices, chrome, dialogs] с
задокументированным контрактом порядка каскада. Два оставшихся мутантных
якоря (:host-гейт ховера устройств) переадресованы на base.styles.ts.

Юниты инвариантов (test/styles-split.test.mjs): состав и порядок сборщика;
непересечение (scope+селектор) между файлами — единственное именованное
исключение: кросс-поверхностная группа «:host(...) .dev:hover, .dev:focus-
visible» живёт в base по §1.1; выживание медиа-обёрток — 2 forced-colors и
10 prefers-reduced-motion (в ТЗ и ревью фигурировали 8 — фактический счёт по
исходнику 10, юнит держит точное число). fix-test-build научился точке в
имени модуля (styles/base.styles → .js). ARCHITECTURE.md — раздел Styles.

Refactor-proof diff (scope-ключ) пуст; golden 129/129 без переприёмки; смоки
plan_snap_overlay/preloader OK; npm test 1318/0; бандл 1 291 440 → 1 291 458
(+18 байт).

Issue: #266
User-Visible: no
This commit is contained in:
Codex
2026-08-26 01:34:20 +03:00
parent 55f7126afd
commit 0d9320fe1d
10 changed files with 370 additions and 267 deletions
+4 -1
View File
@@ -15,7 +15,10 @@ const patchImports = (dir) => {
const source = readFileSync(path, 'utf8').replace(
/(from\s+['"]|import\s*\(\s*['"])(\.\.?\/[^'"]+)(['"])/g,
(match, prefix, specifier, suffix) => (
extname(specifier) ? match : `${prefix}${specifier}.js${suffix}`
// A dot inside the module NAME is not an extension: `./styles/base.styles`
// must still get `.js` (#266). Only real loader extensions pass through.
['.js', '.mjs', '.json'].includes(extname(specifier))
? match : `${prefix}${specifier}.js${suffix}`
),
);
writeFileSync(path, source);