diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a1cfb4..18a1e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,8 +97,22 @@ at runtime so it cannot drift. The hero's compiler error is not typed into the HTML — `scripts/build-docs.mjs` compiles the snippet with the real `tsc` and writes the verbatim diagnostic into `docs/diagnostics.js`, -failing the build if a snippet the page calls a compile error ever compiles. A third snippet -that must compile guards against the harness passing vacuously. +failing the build if a snippet the page calls a compile error ever compiles. Two more snippets +that must compile guard against the harness passing vacuously. + +### Corrected + +The README's toolchain table said esbuild takes "the same settings via `tsconfigRaw`". It does +not: esbuild lowers standard decorators only when its **own top-level `target`** is below +`esnext`. A `target` inside `tsconfigRaw` sets the `useDefineForClassFields` default and +nothing else, so following that advice leaves decorator syntax in the output — the same silent +passthrough the section blames on oxc. Both the table and the landing page now say so, and +`src/toolchain.test.ts` asserts both halves, so the trap is documented by a test rather than by +a sentence. + +Also corrected in the same pass: the toolchain table is described as executed by a test, but +the oxc row — the only ✗ — cannot be, because oxc ships inside a native binary with no +standalone transform API. The claim now covers the three rows it actually covers. ### Positioning diff --git a/README.md b/README.md index 6717f65..855f05b 100644 --- a/README.md +++ b/README.md @@ -95,13 +95,15 @@ than a `TypeError` from somewhere inside the engine. ### Toolchain support -Whether Cereale works at all depends on your compiler emitting standard decorators, so this -table is [checked by a test](src/toolchain.test.ts) rather than asserted here: +Whether Cereale works at all depends on your compiler emitting standard decorators, so the three +✅ rows are [checked by a test](src/toolchain.test.ts) rather than asserted here — each compiles a +decorated class with that tool and asserts the metadata arrived. The ❌ row cannot be: oxc ships +inside a native binary with no standalone transform API. | Transformer | Status | Notes | | --- | --- | --- | | `tsc` | ✅ | With `experimentalDecorators: false` and `target: ES2022`+ | -| esbuild | ✅ | Same settings via `tsconfigRaw` | +| esbuild | ✅ | `experimentalDecorators: false` via `tsconfigRaw`, **plus** esbuild's own top-level `target: es2022`. Its default `esnext` target leaves decorator syntax in the output | | swc | ✅ | `jsc.transform.decoratorVersion: "2022-03"` | | **oxc** | ❌ | Used by **Vite 8** and **Vitest 4** — see below | diff --git a/docs/index.html b/docs/index.html index 1808ef9..e09561e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -650,8 +650,11 @@ Break the cycle with @JsonIgnore() on the back-reference, or supply a
cereale reads the metadata that only a standard decorator transform emits, so - which compiler you use decides whether it works at all. This table is executed by a test on - every CI run, not asserted here. + which compiler you use decides whether it works at all. The three ✓ rows are executed by a + test on every CI run rather than asserted here — each one compiles a decorated class with + that tool and checks the metadata arrived. The ✗ row cannot be: oxc ships inside a native + binary with no standalone transform API, so it was established by hand, and the plugin below + is what came of it.
@@ -663,7 +666,7 @@ Break the cycle with @JsonIgnore() on the back-reference, or supply atscexperimentalDecorators: false, target: ES2022+tsconfigRawexperimentalDecorators: false via tsconfigRaw, plus esbuild's own top-level target: es2022 — its default esnext leaves the decorators in placejsc.transform.decoratorVersion: "2022-03"import { standardDecorators } from 'cereale/vite';
+ import { defineConfig } from 'vite';
+import { standardDecorators } from 'cereale/vite';
export default defineConfig({
plugins: [standardDecorators()],
});
- It transforms with esbuild, falling back to the TypeScript compiler — cereale depends on
- neither. Nothing in it is specific to cereale; it can be deleted once oxc implements the
- transform.
+ It transforms .ts, .mts and
+ .cts outside node_modules with
+ esbuild, falling back to the TypeScript compiler — cereale depends on neither. Decorated
+ classes in .tsx need an include
+ of your own; they are excluded by default because lowering them means also deciding what
+ happens to the JSX. Nothing in the plugin is specific to cereale; it can be deleted once oxc
+ implements the transform.