6885a217cd
Adversarial review with per-package counts and 13 reintroduced bugs, all caught. Fixes from the review: the trace geocell is capped at 6 characters (~1 km; 16 allowed centimetres), one forbidden-word hit per place, and an e2e guard that meta charset stays within the first 1024 bytes. CLAUDE.md §6.2 no longer contradicts itself about care acts; §2 and §3 say what Phase 0 actually built.
43 lines
2.1 KiB
Markdown
43 lines
2.1 KiB
Markdown
# Technical
|
|
|
|
## A Vite config cannot import a workspace package's TypeScript source
|
|
|
|
**What happened.** `apps/rosea/vite.config.ts` imported the name constants from
|
|
`@rosea/schema`, whose `main` is `src/index.ts`. `vite build` failed with
|
|
`ERR_UNKNOWN_FILE_EXTENSION ".ts"`. `--configLoader runner` fixed the build. But
|
|
`svelte-check` loads the same config on its own, still failed, and printed
|
|
*failed to load config* while reporting 0 errors.
|
|
|
|
**Why it bit.** Vite bundles a config's relative imports but externalises anything
|
|
resolved through `node_modules`. Workspace packages are symlinks there, so Node
|
|
loads them natively, and Node 22.11 does not strip types. A tool that reads the config
|
|
for you has its own loader.
|
|
|
|
**How to apply it.** In a Vite config, import workspace code by **relative path**
|
|
to a dependency-free module. Treat a failure message inside a green run as a
|
|
failure: find which tool printed it.
|
|
|
|
## Vite escapes the quotes in an injected `<meta>` CSP
|
|
|
|
**What happened.** The built `index.html` carries `content="default-src 'self'…"`.
|
|
A regex over the raw HTML looking for `'self'` would never match it.
|
|
|
|
**Why it bit.** The HTML is valid and the browser decodes the entities. Only a test
|
|
that reads the bytes sees the difference.
|
|
|
|
**How to apply it.** Read attributes from the DOM:
|
|
`page.locator('meta[http-equiv=…]').getAttribute('content')`. Keep raw-HTML checks for
|
|
byte-level questions, such as whether there is an inline `<script>` or where `<meta charset>` sits.
|
|
|
|
## Svelte 5 needs no preprocessor for `lang="ts"`
|
|
|
|
**What happened.** With `vitePreprocess()` in `svelte.config.js`, `svelte-check` tried
|
|
to load `vite.config.ts` to preprocess styles, and hit the error above. Removing the
|
|
preprocessor removed the problem, and every component still typechecks.
|
|
|
|
**Why it bit.** Svelte 5 strips type annotations natively. A preprocessor is only
|
|
needed for non-CSS style languages or TS features that emit code (enums, decorators).
|
|
|
|
**How to apply it.** Leave `svelte.config.js` as `export default {}` until a component
|
|
needs SCSS or emitted TS. Add the preprocessor in the same commit as that need.
|