📐 fix: correct what the adversarial review of the page found
Five auditors read the finished page against the source; a second pass tried to refute each finding. What survived: **The esbuild row was wrong, and dangerously so.** It said esbuild takes "the same settings via tsconfigRaw" as tsc. 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. I ran it — the decorator survives verbatim and the module throws SyntaxError on import, which is the exact silent passthrough the section blames on oxc. The repo's own vite plugin and toolchain test always passed `target` top-level, so the executed matrix never backed the advice the docs gave. Both halves are now asserted in src/toolchain.test.ts. **"This table is executed by a test" did not cover the oxc row** — the only ✗, and the row the whole section is built around. It cannot be: oxc ships as a native binary with no standalone transform API, which the test file already said in a comment. Fixed on the page and in the README. Reference corrections, each verified against the source: - fromRequest has no …Sync twin; the group blurb claimed every entry did - @IsNotIn does not narrow its field, unlike its five neighbours - @MinDate/@MaxDate take a Date as well as a thunk - @Validate has three parameters, not two; defineRule has four - getConfig() and resetConfig() were missing from a group rendered under the heading "Everything cereale exports" And on the page itself: the vite.config.ts snippet never imported defineConfig, so pasting it failed; and the plugin note omitted that .tsx is excluded by default, which would drop a reader straight back into the 0-test hole the section exists to describe. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SAcqrz3FcadkYr3xG32CjK
This commit is contained in:
@@ -105,6 +105,26 @@ describe('compilers that emit standard decorators', () => {
|
||||
const { Probe } = await load(await emit.swc(PROBE, STANDARD));
|
||||
expect(Object.keys(modelOf(Probe))).toEqual(['name']);
|
||||
});
|
||||
|
||||
// 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 the natural-looking "put the tsconfig settings in tsconfigRaw" configuration leaves the
|
||||
// decorator syntax in the output — the same silent passthrough oxc produces. Documented here
|
||||
// because the README and the landing page both tell people how to configure esbuild.
|
||||
it('needs esbuild’s own target, not one inside tsconfigRaw', async () => {
|
||||
const withoutTarget = await transform(PROBE, {
|
||||
loader: 'ts',
|
||||
tsconfigRaw: { compilerOptions: { experimentalDecorators: false, target: 'es2022' } },
|
||||
});
|
||||
expect(withoutTarget.code, 'expected the decorator to survive untransformed').toMatch(/@Rule\(\)/);
|
||||
|
||||
const withTarget = await transform(PROBE, {
|
||||
loader: 'ts',
|
||||
target: 'es2022',
|
||||
tsconfigRaw: { compilerOptions: { experimentalDecorators: false, useDefineForClassFields: true } },
|
||||
});
|
||||
expect(withTarget.code).not.toMatch(/@Rule\(\)/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('compilers configured for legacy decorators', () => {
|
||||
|
||||
Reference in New Issue
Block a user