From 0b964b546639baea4e2f8930bb46aa07c7e79228 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Sat, 31 Oct 2026 18:20:22 +0100 Subject: [PATCH] Adds a preview server that follows the real server rules Lighthouse and the browser tests need a real 404 status, the .html mapping and the production headers, which vite preview does not give. It is not wired into the scripts yet. Co-Authored-By: Claude Opus 5.5 --- .../start-migration-code-generation-plan.md | 37 +- .../start-migration/code/verification-log.md | 4 +- web/config/previewServer.test.ts | 522 ++++++++++++++++++ web/config/previewServer.ts | 233 ++++++++ web/src/test/requestArbitraries.ts | 86 +++ 5 files changed, 863 insertions(+), 19 deletions(-) create mode 100644 web/config/previewServer.test.ts create mode 100644 web/config/previewServer.ts create mode 100644 web/src/test/requestArbitraries.ts diff --git a/aidlc-docs/features/prerendering/construction/plans/start-migration-code-generation-plan.md b/aidlc-docs/features/prerendering/construction/plans/start-migration-code-generation-plan.md index 320c39f..fd000b2 100644 --- a/aidlc-docs/features/prerendering/construction/plans/start-migration-code-generation-plan.md +++ b/aidlc-docs/features/prerendering/construction/plans/start-migration-code-generation-plan.md @@ -224,21 +224,21 @@ The unknowns that can invalidate the design come first. Steps 3 to 6 prove Start Files are new `config/*` files and `src/test/htmlArbitraries.ts`. Config files are Dutch-commented like their neighbours. They run under Node type stripping: relative imports with `.ts`, no aliases. -### Step 7: `config/pageFiles.ts` [ ] +### Step 7: `config/pageFiles.ts` [x] - Executor: Sonnet. - Implements: BR-BLD-02, 03; domain-entities `config/pageFiles.ts`. - Do: create the pure module with `NOT_FOUND_PATH = '/404'`, `NOT_FOUND_FILE = '404.html'`, `pageFile(path: string): string` (`/` gives `index.html`; otherwise the path without its leading slash plus `.html`) and `pagePath(file: string): string | undefined` (inverse; `undefined` for `404.html` and anything that is not a `.html` page file). Comment on why one mapping serves `vite.config.ts`, the runner and the preview server. - Done when: `pnpm exec tsc --noEmit` clean. (Switching `vite.config.ts` to import it happens in Step 24, to keep B2 off B1's files.) -### Step 8: `config/inlineScripts.ts` [ ] +### Step 8: `config/inlineScripts.ts` [x] - Executor: Sonnet. - Implements: BR-SCR-01 to 11, 22 (nothing to build for 22); FR-PR-19, 20; D2, D3. - Do: create the module with the exports of component-methods.md (`MovedScript`, `ExternalizeResult`, `externalizeInlineScripts`, `findExecutableInlineScripts`) and no dependency except `node:crypto` for SHA-256. Implement one internal scanner (BR-SCR-02) that yields script elements with their range, verbatim attribute text and body; the classification of flowchart 1.1 (BR-SCR-04: `src` attribute in any form, empty body, type list, `module`); the unsupported-form checks that throw (BR-SCR-05: `async`/`defer` on a classic script, `