From 4e1f9e87038387750e15b5f7930a95d4f8bbbe53 Mon Sep 17 00:00:00 2001 From: DavidBabinec Date: Sat, 25 Jul 2026 19:46:42 +0200 Subject: [PATCH] fix(import): scale large CSS catalogue imports --- docs/e2e/README.md | 7 + docs/features/agent.md | 7 +- docs/features/html-import.md | 2 +- docs/features/publisher.md | 12 + docs/features/site-import.md | 24 +- docs/reference/css-class-registry.md | 8 +- scripts/lib/largeBodyDevProxy.ts | 116 +++++++++ src/__tests__/agent/executor.test.ts | 42 ++-- .../canvas/classStyleInjectorMedia.test.tsx | 15 +- src/__tests__/devWorkflow.test.ts | 2 + .../mutateAllPagesAndSite.test.ts | 33 +++ .../editor-store/styleRuleSlice.test.ts | 24 ++ src/__tests__/largeBodyDevProxy.test.ts | 50 ++++ .../page-tree/cssSelectorClasses.test.ts | 80 ++++++ .../panels/useClassPickerSuggestions.test.ts | 39 ++- .../publisher/classStyleInjector.test.ts | 53 ++++ src/__tests__/siteImport/applyImport.test.ts | 51 +++- src/__tests__/siteImport/conflicts.test.ts | 24 ++ .../siteImport/cssToStyleRules.test.ts | 41 ++- .../pages/site/canvas/ClassStyleInjector.tsx | 22 +- .../PropertiesPanel/selectorPickerModel.ts | 46 ++-- .../useClassPickerSuggestions.ts | 15 +- .../pages/site/store/slices/site/helpers.ts | 43 +++- .../site/store/slices/site/importLinking.ts | 37 ++- .../site/store/slices/site/nodeActions.ts | 22 +- src/admin/pages/site/store/styleRuleRename.ts | 7 +- src/core/page-tree/classNames.ts | 5 +- src/core/page-tree/cssSelectorClasses.ts | 224 +++++++++++++++++ src/core/page-tree/index.ts | 7 + src/core/page-tree/styleRule.ts | 17 +- src/core/publisher/cssCollector.ts | 59 +---- src/core/publisher/index.ts | 6 + src/core/publisher/styleRuleTreeShake.ts | 133 ++++++++++ src/core/siteImport/buildPlan.ts | 112 ++++++--- src/core/siteImport/classCascades.ts | 23 +- src/core/siteImport/conflicts.ts | 36 ++- src/core/siteImport/cssToStyleRules.ts | 234 +++++++++--------- src/core/siteImport/fontFaceParser.ts | 75 ++++++ vite.config.ts | 31 +++ 39 files changed, 1436 insertions(+), 348 deletions(-) create mode 100644 scripts/lib/largeBodyDevProxy.ts create mode 100644 src/__tests__/largeBodyDevProxy.test.ts create mode 100644 src/__tests__/page-tree/cssSelectorClasses.test.ts create mode 100644 src/core/page-tree/cssSelectorClasses.ts create mode 100644 src/core/publisher/styleRuleTreeShake.ts create mode 100644 src/core/siteImport/fontFaceParser.ts diff --git a/docs/e2e/README.md b/docs/e2e/README.md index 61e00fba6..21c512ca0 100644 --- a/docs/e2e/README.md +++ b/docs/e2e/README.md @@ -57,6 +57,13 @@ so publishing never reloads the admin app mid-test. The Vite dev proxy follows the configured CMS `PORT`, keeping the Playwright admin UI pointed at the disposable CMS instead of any regular dev server on port 3001. +When Vite itself runs on Bun, its Node-compatible native proxy can stop +draining multi-megabyte request bodies after socket backpressure fills both +sides. `largeBodyDevProxyPlugin` intercepts only known-length CMS API bodies of +at least 1 MiB, buffers them with the same 128 MiB ceiling as `Bun.serve`, and +forwards them with an explicit `Content-Length`. Small requests, non-CMS +traffic, and streaming AI responses remain on Vite's native proxy. + For debugging against a server you started yourself, set `E2E_REUSE_SERVER=1` and override `E2E_ADMIN_BASE_URL` / `E2E_PUBLIC_BASE_URL` as needed. Do not use reuse mode for CI or for diff --git a/docs/features/agent.md b/docs/features/agent.md index 9be3a8fef..da13641c4 100644 --- a/docs/features/agent.md +++ b/docs/features/agent.md @@ -13,7 +13,7 @@ The agent runs on a provider-agnostic AI runtime (`server/ai/`) that can drive a ## TL;DR - **Structure via HTML.** `site_insert_html` and `site_replace_node_html` accept semantic HTML strings; the browser executor calls `importHtml` (the same pipeline as the paste-HTML UI) to convert them into first-class, editable `PageNode`s. -- **Styling via CSS.** The agent emits CSS the same way a human pastes it: a `