targeted-mutation 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +21 -0
  3. package/README.md +111 -2
  4. package/bin/tmt-compile.mjs +46 -0
  5. package/bin/tmt.mjs +117 -0
  6. package/build/typescript-syntax/LICENSE.txt +55 -0
  7. package/build/typescript-syntax/ThirdPartyNoticeText.txt +193 -0
  8. package/build/typescript-syntax/typescript-syntax.cjs +43 -0
  9. package/docs/analysis.md +218 -0
  10. package/docs/compiler.md +462 -0
  11. package/docs/development.md +61 -0
  12. package/docs/how-it-works.svg +188 -0
  13. package/docs/l1.md +94 -0
  14. package/docs/performance.md +647 -0
  15. package/docs/releasing.md +48 -0
  16. package/package.json +49 -4
  17. package/src/analysis.mjs +689 -0
  18. package/src/assertion-session.mjs +93 -0
  19. package/src/assertion-strength.mjs +795 -0
  20. package/src/builtin-mutations.mjs +755 -0
  21. package/src/builtin-switches.mjs +642 -0
  22. package/src/change-undone.mjs +524 -0
  23. package/src/cli-output.mjs +166 -0
  24. package/src/compiler-compat.cjs +108 -0
  25. package/src/compiler-maps.cjs +60 -0
  26. package/src/compiler-routes.cjs +391 -0
  27. package/src/compiler.cjs +98 -0
  28. package/src/compiler.mjs +1 -0
  29. package/src/conventional.mjs +172 -0
  30. package/src/displacement.mjs +19 -0
  31. package/src/extract.mjs +135 -0
  32. package/src/fallback-process.mjs +14 -0
  33. package/src/in-parallel.mjs +20 -0
  34. package/src/lean-replay.mjs +39 -0
  35. package/src/operator-analysis.mjs +123 -0
  36. package/src/playwright.mjs +139 -0
  37. package/src/probe-runtime.mjs +50 -0
  38. package/src/probe.mjs +170 -0
  39. package/src/prototype.mjs +230 -0
  40. package/src/regex-mutations.mjs +102 -0
  41. package/src/runner-process.mjs +59 -0
  42. package/src/runtime-binaries.mjs +50 -0
  43. package/src/scope.mjs +202 -0
  44. package/src/source-text.mjs +49 -0
  45. package/src/standard-plan.mjs +308 -0
  46. package/src/standard-runner.mjs +185 -0
  47. package/src/standard-session.mjs +362 -0
  48. package/src/standard-setup.mjs +20 -0
  49. package/src/targeted-gaps.mjs +85 -0
  50. package/src/threshold.mjs +185 -0
  51. package/src/trace-buffer.mjs +126 -0
  52. package/src/typescript-bindings.mjs +243 -0
  53. package/src/typescript-compiler.mjs +59 -0
  54. package/src/typescript-extraction.mjs +354 -0
  55. package/src/typescript-grammar.mjs +923 -0
  56. package/src/vitest-reporter.mjs +64 -0
  57. package/src/vitest.mjs +262 -0
  58. package/src/witness-analysis.mjs +234 -0
  59. package/src/witness-contracts.mjs +110 -0
  60. package/src/witness-discovery.mjs +239 -0
  61. package/src/witness-fixtures.mjs +149 -0
  62. package/src/witness-order.mjs +83 -0
  63. package/src/witness-rules.mjs +254 -0
@@ -0,0 +1,462 @@
1
+ # Standalone JavaScript and TypeScript compiler experiment
2
+
3
+ The compiler emits one JavaScript file at a time. The API accepts JavaScript, TypeScript, JSX, and TSX, selects an ECMAScript target and a module format, and can emit a source map. It can lower runtime TypeScript forms such as enums, transform JSX, and preserve JSX when requested. Type checking, declaration generation, module resolution, and bundling are outside the isolated-file API.
4
+
5
+ ```sh
6
+ npm ci --ignore-scripts
7
+ npm run build:compiler
8
+ node bin/tmt-compile.mjs --target es2018 --module cjs --source-map input.tsx > output.cjs
9
+ node bin/tmt-compile.mjs --strip input.ts > output.js
10
+ ```
11
+
12
+ The CLI writes an inline map when requested. The library returns `{ backend, code, sourceMap, diagnostics }`. It reports diagnostic ranges in UTF-16 code units. An error sets both output fields to `null`. The default target is `esnext` and the default module mode is `preserve`. The `.mts` and `.mjs` extensions imply ESM, and the `.cts` and `.cjs` extensions imply CommonJS. Explicit `esm` and `cjs` settings override that default. CommonJS validation checks the generated JavaScript as a Node module wrapper. `--jsx preserve` returns JSX syntax for a later stage.
13
+
14
+ ```js
15
+ import { compile } from './src/compiler.mjs';
16
+
17
+ const result = compile('export const eligible = (age: number) => age >= 18;', {
18
+ file: 'eligibility.ts',
19
+ });
20
+ ```
21
+
22
+ CommonJS callers can load the same implementation from `src/compiler.cjs`. Strip mode implements the position-preserving contract for TypeScript files without JSX. It rejects syntax that needs runtime lowering and the compiler reports a diagnostic. Transform mode selects the native emitter, Node type erasure, or the isolated TypeScript emitter according to the input and output options.
23
+
24
+ ## Native path and proof
25
+
26
+ The `pulse` backend handles bounded exported constants, simple typed arrows, complete type-only modules, and runtime JSX and enum forms. Explicitly separated sequences of eligible constants share the direct path. The emitter checks duplicate bindings before publishing JavaScript. Type-only modules with comments or a hashbang use Pulse's initialized statement ranges to preserve the surrounding source. The native JSX emitter handles automatic and classic runtimes, elements and fragments, nested children, multiline text, typical attributes and object spreads. Its entry points include direct and parenthesized initializers, arrow expressions, and simple exported function components. The enum emitter handles numeric and string literal members, signed values, implicit numbering, reverse maps, and literal `const enum` declarations under isolated emission semantics.
27
+
28
+ The direct Node addon includes only the necessary Pulse entry points and the runtime emitter. The full-module addon records JSX element and expression spans during the validated Pulse parse. It publishes initialized records only after reaching EOF. The emitter visits the captured spans, reuses expression boundaries, and copies the surrounding source. This supports JSX in function bodies, nested callback expressions, attributes, conditionals, and scripts. ESNext JavaScript scripts use V8 syntax validation and preserve the original source and strictness whenever possible.
29
+
30
+ The full-module parse can also publish erasure ranges for annotations, type parameters and arguments, delimited assertions, optional and non-null markers, type-only declarations, overload signatures, and inline type imports. The emitter retains value imports and explicit module settings. Runtime enum emission visits the committed declaration ranges. JSX uses the same source offsets after masking the type ranges. Lean checks length preservation, bytes outside a mask, and LF and CR preservation. A projection is published when the parse certifies it, as described under Certified emission and native entries. The audit build still passes every projection to V8.
31
+
32
+ The `pulse+node-strip` route passes the remaining erasable syntax through Node. The `node-strip` route covers validated TypeScript modules and ordinary scripts. The Node 24 compatibility path also lowers constructor parameter properties. ESNext compilation can use the native paths without the full TypeScript compiler or the optional TypeScript syntax projection.
33
+
34
+ The Pulse span writer proves that a successful replacement changes only the requested bytes and that invalid spans leave the buffer untouched. The extracted parser preserves its input borrow. Syntax-only validation counts comparisons without reserving candidate slots. The NEON and SSE2 builds also skip ordinary 16-byte JSX runs. Lean proves that these skips preserve the scalar cursor state, and the native test checks the matching predicates for every byte in every lane. The extraction check regenerates and compares both variants of the generated C and headers.
35
+
36
+ Computed enum initializers, runtime namespaces, object-literal JSX spreads, CommonJS, and downlevel targets can still require the TypeScript emitter. Source maps for ESNext module output come from the native emitter (see "Native source maps"). Output formatting can differ across the supported backends.
37
+
38
+ ```sh
39
+ FSTAR_EXE=/path/to/fstar.exe KARAMEL_EXE=/path/to/krml npm run verify:compiler
40
+ node --test test/compiler*.test.mjs
41
+ ```
42
+
43
+ ## Fixed-corpus coverage
44
+
45
+ All 537 TypeScript and 116 TSX files in the pinned Vite, mreact and tachyon-dom cohorts emitted valid JavaScript in Node 24.14.0. The audit blocked resolution of both the TypeScript package and its syntax projection in the compilation subprocess. A separate copy containing the compiler's JavaScript entrypoints and native binaries also passed all 653 files with no installed dependencies. All 116 TSX outputs matched the reference's normalized JavaScript syntax and static dependency order. Five of the 537 TypeScript outputs differed in constructor statement grouping or optional-chain parentheses. The gate accepts only the reviewed AST pairs tied to those exact source bytes.
46
+
47
+ An additional four-project probe produced valid JavaScript for 1,406 of 1,426 TypeScript and TSX inputs without TypeScript. Seventeen inputs still required the compatibility emitter, and three Hono inputs received an unbound runtime export diagnostic. Those files referenced type-only names in ordinary local export lists.
48
+
49
+ TypeScript is the external conformance source. The audit reads Git blobs from the pinned TypeScript revision and extracts single-file JavaScript baselines and the corresponding source, with harness directives treated as compile options. Two of the eight sampled fixtures match without TypeScript. The six other cases include CommonJS, global enums, and JSX syntax outside the supported profile.
50
+
51
+ ```sh
52
+ node --experimental-vm-modules scripts/audit-compiler-coverage.mjs /inputs/vite.json /inputs/mreact.json /inputs/tachyon-dom.json /inputs/mreact.tsx.json /inputs/tachyon-dom.tsx.json --upstream-ts /path/to/TypeScript
53
+ ```
54
+
55
+ ## Performance comparison
56
+
57
+ The timed operation emits complete ESNext JavaScript from in-memory source. First-process measurements include backend loading and exclude Node startup and corpus reading. The guarded comparator uses Oxc 0.159.0, SWC Next 0.7.0 through its native transform adapter, and both the split Yuku 0.19.0 and unified Yuku 0.28.1. Yuku participates where its strip and print API emits the required JavaScript.
58
+
59
+ The performance inputs include Oxc's four published transformer fixtures, SWC Next's App.tsx, and the large JavaScript inputs shared by the public parser benchmarks. These are the pinned source bytes. Timing the JavaScript inputs for emission measures a different operation from their official AST parser timing. Cal.com's repeated default exports and the declaration-library fixture remain parser inputs. The compiler API has no general AST output benchmark.
60
+
61
+ The benchmark ran with verified input hashes and no network in a memory-bounded, rootless Linux arm64 Podman container. It parses real-project outputs without executing them. The generated JSX and enum fixtures execute against self-contained expected results.
62
+
63
+ Medians are in milliseconds. The timing snapshot is commit `d434e54`. The subsequent diagnostic and accessor fixes retain the verified project coverage. Warm official samples use five synchronous calls per engine, followed by a fresh-process sample. Large cold startup values depend on backend initialization and host load.
64
+
65
+ | Workload | Files timed | TMT warm | Fastest reference warm | TMT first | Fastest reference first |
66
+ | --- | ---: | ---: | ---: | ---: | ---: |
67
+ | synthetic | 256 | 0.16 | 0.64 (swc-next) | 2.16 | 1.26 (swc-next) |
68
+ | jsx | 256 | 0.36 | 1.33 (swc-next) | 2.49 | 2.14 (swc-next) |
69
+ | enum | 256 | 0.29 | 0.85 (swc-next) | 2.17 | 1.50 (swc-next) |
70
+ | vite | 113 | 51.28 | 14.19 (oxc) | 93.98 | 14.85 (swc-next) |
71
+ | mreact | 315 | 622.31 | 121.61 (swc-next) | 739.74 | 123.47 (swc-next) |
72
+ | tachyon-dom | 94 | 225.34 | 42.74 (yuku-current) | 571.40 | 66.09 (swc-next) |
73
+ | mreact.tsx | 84 | 92.40 | 14.88 (oxc) | 308.93 | 26.69 (swc-next) |
74
+ | tachyon-dom.tsx | 32 | 5.66 | 1.81 (swc-next) | 173.77 | 3.91 (swc-next) |
75
+ | oxc-transform-parser.ts | 0 | — | — | — | — |
76
+ | oxc-transform-renderer.ts | 1 | 17.60 | 2.71 (swc-next) | 208.17 | 5.33 (swc-next) |
77
+ | oxc-transform-UserSettings.tsx | 1 | 0.70 | 0.24 (swc-next) | 164.46 | 2.42 (swc-next) |
78
+ | oxc-transform-table.tsx | 1 | 9.06 | 1.36 (oxc) | 158.60 | 4.61 (swc-next) |
79
+ | swc-next-App.tsx | 1 | 44.69 | 12.16 (oxc) | 171.85 | 20.85 (swc-next) |
80
+ | yuku-checker.ts | 0 | — | — | — | — |
81
+ | oxc-parser-typescript.js | 1 | 67.00 | 331.79 (oxc) | 240.26 | 362.37 (oxc) |
82
+ | yuku-react.js | 1 | 0.06 | 0.83 (yuku-current) | 4.38 | 2.19 (swc-next) |
83
+
84
+ The four supported official TypeScript and TSX transform inputs also matched the normalized TypeScript reference. The Oxc transformer `parser.ts` fixture contains a runtime namespace outside the native grammar. The Yuku `checker.ts` parser fixture did not have a common valid JavaScript emission in the measured engines. These two cases have no TMT timing. The reference engines retain a lead on real TypeScript and TSX emission. A retest on `830b5de` measured the 8.2 MB JavaScript bundle at 96.92 ms warm, compared with Oxc at 262.80 ms, SWC Next at 381.17 ms and unified Yuku at 428.02 ms. The same retest measured App.tsx at 57.76 ms warm, compared with Oxc at 14.15 ms and SWC Next at 19.77 ms. The bottleneck remains the type-erasure pass and initialization for inputs that cannot be emitted by the direct Pulse route. A separate macOS profile of App.tsx measured 9.12 ms for Pulse parsing and JSX rewriting, followed by 39.84 ms for Node type erasure.
85
+
86
+ The [raw timing and coverage evidence](../evidence/compiler/complete-corpus.json) includes engine declines, input hashes, and separate first-process samples. The [earlier runtime-lowering benchmark](../evidence/compiler/runtime-lowering.json) records the previous 532/537 TypeScript and 39/116 TSX coverage.
87
+
88
+ ### Retest with direct declaration sequences
89
+
90
+ The [optimization retest](../evidence/compiler/optimized-compiler.json) includes the same pinned inputs and a 256-declaration module. The new direct path leads that module's warm comparison. SWC Next still leads its first-process comparison. Both retests put the large JavaScript bundle ahead of the three engines in warm complete emission, and its first-process ranking reversed between runs. Host load varies between container runs. Each row compares engines measured in the same run.
91
+
92
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
93
+ | --- | ---: | ---: | ---: | ---: |
94
+ | 256 declarations in one module | 0.06 | 0.23 (Oxc) | 4.24 | 1.85 (SWC Next) |
95
+ | TypeScript JavaScript bundle | 96.06 | 219.68 (SWC Next) | 299.67 | 220.06 (SWC Next) |
96
+ | React JavaScript bundle | 0.086 | 2.05 (Yuku) | 7.23 | 4.64 (SWC Next) |
97
+ | App.tsx | 50.85 | 14.51 (Oxc) | 216.04 | 24.09 (SWC Next) |
98
+ | renderer.ts | 9.40 | 2.25 (Oxc) | 99.84 | 4.87 (SWC Next) |
99
+
100
+ The paired macOS run reduced warm emission of a 64 KiB JSX text fixture from 0.97 ms to 0.42 ms with identical output. The first-process result moved from 7.89 ms to 8.70 ms. Whole-corpus mreact comparisons changed direction between runs, and the retest establishes no reproducible throughput gain for it.
101
+
102
+ An AST-guided measurement erased 342 ordinary annotations before passing App.tsx to Node. Node's warm erasure time moved from 29.97 ms to 28.03 ms and produced identical bytes. This measurement excludes the cost of finding and erasing the ranges. The production compiler keeps one Node erasure pass for that file. The remaining cost is the complete second parse across the emitted module.
103
+
104
+ ### Native type-range projection
105
+
106
+ In an alternating macOS arm64 comparison with seven samples per revision, all three rows retained byte-identical output between `6f98caa` and `0d5b16f`. These medians compare two TMT revisions in the same run.
107
+
108
+ | Workload | Previous warm (ms) | Projected warm (ms) | Previous first (ms) | Projected first (ms) |
109
+ | --- | ---: | ---: | ---: | ---: |
110
+ | renderer.ts | 19.29 | 10.86 | 265.12 | 238.94 |
111
+ | UserSettings.tsx | 0.61 | 0.14 | 230.21 | 7.17 |
112
+ | tachyon-dom TSX, 32 files | 8.41 | 1.24 | 202.74 | 30.56 |
113
+
114
+ The same source set contains 293 fully projected outputs at this checkpoint, compared with 20 before the type-range changes. All 653 inputs still emit valid JavaScript with the TypeScript package unavailable. The real-project probe also compares newly native outputs on Astro, Hono, React Router, Vitest, and Vue. Svelte's 376 JavaScript modules pass the JavaScript emission path.
115
+
116
+ The [type projection evidence](../evidence/compiler/native-type-projection.json) includes the isolated compiler comparisons and the paired measurements. Warm runs showed a lead for the small declarations workload. The real-project and first-process rankings did not converge across runs. SWC Next retained the first-process lead for the official TS and TSX transform inputs that the compared compilers emitted. A combined native addon and a Clang profile-guided build showed no consistent gain in the paired experiments and were excluded from the release build.
117
+
118
+ Class modifier projection made the published `table.tsx` fixture fully native at `2434866`. In the isolated retest it took 2.11 ms warm and 22.11 ms on the first process. Oxc took 1.36 ms warm, and SWC Next took 8.21 ms on the first process. The full compiler remains behind on this fixture.
119
+
120
+ The multiline type masker uses NEON or SSE2 on complete 16-byte ASCII blocks, then a scalar loop for the tail. The block preserves LF and CR and rejects bytes with the high bit set. Lean checks the composition of block results. Both native implementations match the scalar contract for every byte value and lane. The paired whole-compiler test retained identical output. Its per-thread CPU medians moved by less than 2% in either direction on the four tested upstream sources.
121
+
122
+ At the `88f665b` checkpoint, 309 of the 653 core inputs used the full native path. The additional framework probe covered 2,036 TypeScript and JavaScript modules. Of these, 2,011 emitted JavaScript with TypeScript unavailable. It compared 664 newly native outputs with the previous compiler or the TypeScript reference and found no new structural difference.
123
+
124
+ ### Reviewed projection benchmark
125
+
126
+ At `1d0c208`, all 653 core inputs emitted valid JavaScript in a temporary directory with no TypeScript package installed. The Pulse emitter handled 311 inputs without Node's type eraser. The expanded framework probe emitted 2,138 of 2,165 inputs with TypeScript unavailable. It includes 25 of 26 Solid modules and 102 of 103 TanStack Query modules. The probe reads source blobs from fixed revisions and verifies output without running those modules.
127
+
128
+ The isolated Linux arm64 run had 17 comparable emission rows. TMT led 8 warm comparisons and 1 first-process comparison. The official transformer `parser.ts` and the Yuku `checker.ts` input had no common eligible emission row.
129
+
130
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
131
+ | --- | ---: | ---: | ---: | ---: |
132
+ | 256 declarations in one module | 0.014 | 0.058 (Oxc) | 0.900 | 0.452 (SWC Next) |
133
+ | tachyon-dom TSX, 32 files | 0.480 | 0.515 (SWC Next) | 1.874 | 0.800 (SWC Next) |
134
+ | UserSettings.tsx | 0.051 | 0.069 (Oxc) | 1.081 | 0.469 (SWC Next) |
135
+ | table.tsx | 0.375 | 0.292 (Oxc) | 1.819 | 0.981 (SWC Next) |
136
+ | App.tsx | 11.958 | 3.343 (Oxc) | 44.251 | 5.908 (SWC Next) |
137
+ | renderer.ts | 2.005 | 0.542 (Oxc) | 28.480 | 1.316 (SWC Next) |
138
+ | TypeScript JavaScript bundle | 20.020 | 62.753 (Oxc) | 54.479 | 79.350 (Oxc) |
139
+
140
+ The review regressions exercise runtime behavior for multiline generic arrows in return and yield positions. They also check the exported object from a namespace that contains a standalone empty statement. The latter continues through the runtime lowering route. All 2,960 tests passed on this revision.
141
+
142
+ ### Committed lexical regions and one-pass validation
143
+
144
+ At `d28736a`, the Pulse emitter handles 438 of the same 653 core inputs without Node's type eraser. All 653 still emit with the TypeScript module blocked. The output audit identifies only the previously reviewed reference normalization differences. The official `App.tsx` and `renderer.ts` fixtures now use the Pulse emitter and match the normalized TypeScript reference. Pulse records inert JSX, template, and regex spans alongside type spans, so validation can inspect embedded expressions without interpreting the surrounding text as TypeScript. The final emitted JavaScript still undergoes V8 syntax validation.
145
+
146
+ Seven alternating macOS samples measure `App.tsx` at 23.03 → 6.83 ms warm and 86.35 → 16.78 ms on first emission from `1d0c208`. The `renderer.ts` medians are 3.48 → 0.90 ms warm and 46.84 → 4.18 ms on first emission. Isolating the shared guard from the preceding change gives 8.14 → 6.80 ms for `App.tsx` and 1.31 → 1.11 ms for `renderer.ts` warm, with byte-identical output. An additional SIMD experiment inside the guard gave mixed results and was discarded. SIMD still masks erased ASCII type ranges.
147
+
148
+ The isolated Linux arm64 retest uses in-memory inputs and includes module loading in the first emission measurement. TMT led eight of 17 comparable warm emission workloads and one first emission workload. The following rows show total milliseconds per input or corpus. Yuku contributes timings only where it emits the same kind of JavaScript, which excludes the TSX rows.
149
+
150
+ | Workload | TMT warm | Fastest reference warm | TMT first | Fastest reference first |
151
+ | --- | ---: | ---: | ---: | ---: |
152
+ | Vite, 113 common .ts files | 57.51 | 20.96 (Oxc) | 130.92 | 21.95 (SWC Next) |
153
+ | mreact, 315 common .ts files | 287.79 | 79.68 (Oxc) | 361.87 | 87.02 (SWC Next) |
154
+ | tachyon-dom, 94 common .ts files | 77.59 | 24.00 (Oxc) | 175.67 | 26.91 (SWC Next) |
155
+ | mreact TSX, 84 files | 14.13 | 6.85 (Oxc) | 81.24 | 8.44 (SWC Next) |
156
+ | tachyon-dom TSX, 32 files | 0.96 | 1.10 (SWC Next) | 4.47 | 1.89 (SWC Next) |
157
+ | renderer.ts | 1.51 | 1.32 (Oxc) | 6.02 | 3.22 (SWC Next) |
158
+ | table.tsx | 0.75 | 0.72 (Oxc) | 3.88 | 2.25 (SWC Next) |
159
+ | App.tsx | 8.07 | 7.25 (Oxc) | 16.47 | 11.71 (SWC Next) |
160
+ | TypeScript JavaScript bundle | 43.54 | 143.28 (Oxc) | 130.31 | 152.94 (Oxc) |
161
+
162
+ The [raw samples, coverage, and framework differential](../evidence/compiler/native-type-projection.json) record all engines and workload hashes. The framework differential against `6f98caa` covered 2,165 source inputs on `99a2a8b`. The 974 newly native outputs retained normalized output and dependency equivalence.
163
+
164
+ ### Re-exports and consecutive assertions
165
+
166
+ Pulse projects whole type re-exports and the type members of a mixed export list. A runtime re-export remains in the output even when its list becomes empty, preserving the dependency's side effects. Runtime aliases can retain contextual names such as `type`. The guard accepts a chain such as `value as unknown as T` when the next committed assertion starts at the next token on the same line. The final assertion still needs a supported boundary.
167
+
168
+ These changes increased Pulse-only coverage from 438 to 510 of the 653 core inputs. The compiler emitted all 653 in an isolated directory with no TypeScript package installed. Seven alternating samples measure mreact's 321 TypeScript files at 158.09 → 131.71 ms warm and 293.22 → 267.32 ms on first emission for the consecutive-assertion change. The output audit found no new differences within the core inputs. The isolated competitor retest at `6add454` led nine of 17 comparable warm workloads. SWC Next led all 17 first-emission workloads. For `App.tsx`, the same-run medians were 7.33 ms warm and 13.82 ms first for TMT, 6.80 ms warm for Oxc, and 10.79 ms first for SWC Next.
169
+
170
+ ### Complete native emission on the fixed TSX inputs
171
+
172
+ The shared Pulse journal reserves slots only for compiler spans during type capture. The mutation extractor keeps its comparison slot behavior. JSX and enum lowering share one writer and one runtime import insertion point. Certified lexical exports can precede erased type declarations, and an assertion can end before a separate identifier-led line. These changes reach all 116 fixed TSX inputs and 417 of 537 TypeScript inputs without Node type erasure on `74093b7`. The core audit reports no new normalized output or dependency differences.
173
+
174
+ Seven alternating macOS samples against `6add454` measure mreact TSX at 3.66 → 2.25 ms warm and 25.09 → 5.41 ms for first emission. The isolated measurements on `8147cba` led eight of 17 comparable warm workloads and none of the first-emission workloads. The three rows labeled Pulse-only are subsets selected by the backend on that revision and then intersected with the reference engines' accepted inputs.
175
+
176
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
177
+ | --- | ---: | ---: | ---: | ---: |
178
+ | mreact TSX, 84 files | 7.48 | 5.97 (Oxc) | 12.54 | 7.84 (SWC Next) |
179
+ | tachyon-dom TSX, 32 files | 0.94 | 1.09 (SWC Next) | 4.34 | 2.25 (SWC Next) |
180
+ | App.tsx | 5.89 | 5.03 (Oxc) | 11.61 | 8.60 (SWC Next) |
181
+ | Vite TS Pulse-only, 79 common files | 5.00 | 4.15 (Oxc) | 9.12 | 4.78 (SWC Next) |
182
+ | mreact TS Pulse-only, 256 common files | 32.04 | 23.38 (Oxc) | 50.09 | 25.11 (SWC Next) |
183
+ | tachyon-dom TS Pulse-only, 69 common files | 7.19 | 5.63 (Oxc) | 12.56 | 6.36 (SWC Next) |
184
+ | mreact TS, 315 common files | 236.63 | 100.65 (Oxc) | 422.95 | 107.81 (SWC Next) |
185
+
186
+ The macOS profile of mreact's Pulse-only inputs attributes about 49% of process CPU time to the Pulse module parse, 19% to the ambiguity guard, and 12% to V8 validation. The length-based guard keyword dispatch experiment produced byte-identical output and changed warm medians by at most 2%, with mixed first-emission results. The implementation retains the original guard dispatch.
187
+
188
+ The upstream source sample uses a fixed TypeScript revision and reads test blobs as data. It selected 503 single-source candidates and found 126 module inputs with valid reference ESNext emission. With TypeScript loading blocked, TMT emitted 66 of those inputs, including 32 through Pulse alone. This sample reports input and emission coverage. All 3,036 repository tests passed. The [raw profiles and comparison samples](../evidence/compiler/native-type-projection.json) record the measured paths and source hashes.
189
+
190
+ ### JavaScript JSX modules and local type declarations
191
+
192
+ The JavaScript JSX emitter handles multiple exports and preserves directive placement. It validates the rendered module with V8 before publishing. JSX-extension modules without markup can preserve their original JavaScript bytes after validation. JSX and TSX share the F★ reader for namespace-qualified attribute names such as `prop:id`. The fixed JSX audit compiled 50 valid SolidJS modules and the tachyon-dom Solid benchmark without TypeScript. The 48 newly supported outputs matched the normalized TypeScript reference.
193
+
194
+ At `c8b62a3`, all 653 fixed inputs emit without loading TypeScript. The Pulse path handles 553, including all 116 TSX files. The upstream sample contains 126 modules with valid TypeScript reference output. Of those, 69 emit without TypeScript, including 40 through Pulse. The other 57 exercise remaining compatibility work.
195
+
196
+ On macOS, the six highest file medians account for 0.592 ms of the 2.009 ms sum of mreact's 84 TSX file medians. `api-reference-data.tsx` spends about 103 µs in the Pulse parse and 4 µs sorting JSX and lexical spans. In the six-file profile, only the Hacker News `render.tsx` needed a second parse. Extra inline workspace reduced that file from 0.089 to 0.068 ms and changed the full TSX corpus from 2.381 to 2.362 ms. The wider-workspace, sorted-range check, trivia-prefix, and borrowed-tape experiments delivered mixed results across workloads.
197
+
198
+ The local type declaration change moves mreact's 267,218-byte router `build.ts` to Pulse. Seven alternating samples measured 6.53 → 1.59 ms warm and 29.18 → 4.11 ms on first emission. The 321-file mreact TypeScript corpus fell from 52.41 to 47.43 ms warm. The corpus audit reports the same normalized output and dependencies.
199
+
200
+ The Linux arm64 comparison at `c8b62a3` led eight of 17 comparable warm workloads and one first-emission workload. The table times complete ESNext JavaScript emission from source prepared in each engine's accepted representation. Each row compares engines within the same run.
201
+
202
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
203
+ | --- | ---: | ---: | ---: | ---: |
204
+ | mreact TSX, 84 files | 3.00 | 2.46 (Oxc) | 5.52 | 3.07 (SWC Next) |
205
+ | tachyon-dom TSX, 32 files | 0.43 | 0.44 (SWC Next) | 1.74 | 0.71 (SWC Next) |
206
+ | App.tsx | 3.55 | 3.02 (Oxc) | 7.05 | 5.08 (SWC Next) |
207
+ | Vite TS, 113 common files | 22.68 | 8.70 (Oxc) | 50.39 | 9.54 (SWC Next) |
208
+ | mreact TS, 315 common files | 61.01 | 31.05 (Oxc) | 104.99 | 33.34 (SWC Next) |
209
+ | tachyon-dom TS, 94 common files | 22.22 | 9.26 (Oxc) | 53.76 | 10.33 (SWC Next) |
210
+ | TypeScript JavaScript bundle | 19.96 | 54.75 (Oxc) | 50.37 | 63.66 (Oxc) |
211
+
212
+ All 3,080 repository tests passed. The [raw benchmarks, phase samples, and coverage results](../evidence/compiler/native-type-projection.json) record the current workloads and source hashes.
213
+
214
+ ### Cache-disabled emission and native coverage
215
+
216
+ The benchmark tracks V8 compilation caching and source preparation as independent settings. Use `node --no-compilation-cache scripts/bench-compiler.mjs` for the cache-disabled condition. The first-emission workers receive the same V8 setting. The default `prepared` input mode supplies each engine its accepted representation. TMT, SWC Next, and unified Yuku receive UTF-8 buffers. Oxc, legacy Yuku, and Node's type stripper receive prepared strings. Set `TMT_BENCH_INPUT=bytes` to include UTF-8 decoding in the timed path for the string-only APIs.
217
+
218
+ The paired baseline at `c8b62a3` led eight of 17 comparable warm workloads with repeated-source caching and six with the V8 cache disabled. It led one first-emission workload in both modes. The harness also reports a separate TMT/Oxc/SWC Next row when the common cohort across all available engines excludes additional inputs. The official Oxc runtime namespace fixture and the Yuku checker fixture still have no common emitted JavaScript result.
219
+
220
+ The audit build preserves V8's decision and correlates each validation with its input and emission phase. Use `npm run build:compiler -- --audit-v8`, then pass JSON corpora to `scripts/audit-compiler-v8.mjs`. The audit independently checks that the ordinary and instrumented binaries return the same output hash, backend and diagnostics. `scripts/generate-compiler-validation-cases.mjs` produces the bounded generated and corpus-mutated input used for the validation audit.
221
+
222
+ The native emitter now handles typed and bare receiver parameters, multiline arrow return types, standalone instantiation expressions, and matching overload groups. Unicode masking inside erased declarations preserves UTF-8 and UTF-16 offsets and line terminators. The emitter preserves implicit class field boundaries even when erasure exposes a contextual keyword such as `static`. This distinction matters independently of syntax validity. V8 accepts `static next = 42` as a static field when the original typed source declares two instance fields. The class field event retains the separator in the removed type span. Vue's constant enum shifts use unsigned C operations with signed shift and value reconstruction checked in Lean.
223
+
224
+ An experimental build omitted only V8 module parsing. On the macOS inputs with identical emitted bytes, App.tsx moved from 4.34 ms to 2.48 ms warm and the 84-file mreact TSX cohort moved from 3.20 ms to 1.82 ms. The shipped emitter retains V8 validation. The packed-state experiment improved several macOS medians and regressed all seven Linux arm64 medians in an alternating run. The wide-keyword load and guard whitespace experiments delivered mixed results. These experiments are excluded from the normal build.
225
+
226
+ The following Linux arm64 run at `f6c1831` used Node 24.14.0, seven rotating samples, the cache disabled, and byte-input timing. Each row compares engines measured in the same run. On this revision, TMT led six of 20 timed warm rows and one first-emission row. Three native-only subsets extend the original 17-row comparison. The two official fixtures without a common emitted result are excluded from the rank count.
227
+
228
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
229
+ | --- | ---: | ---: | ---: | ---: |
230
+ | Vite TS, 113 common files | 18.33 | 8.73 (Yuku 0.28) | 48.03 | 9.45 (SWC Next) |
231
+ | Vite TS, 122 TMT/Oxc/SWC Next files | 27.65 | 10.51 (Oxc) | 70.52 | 11.52 (SWC Next) |
232
+ | mreact TS, 315 common files | 69.48 | 31.55 (Oxc) | 100.77 | 33.64 (SWC Next) |
233
+ | tachyon-dom TS, 94 files | 18.99 | 9.19 (Oxc) | 20.24 | 10.39 (SWC Next) |
234
+ | mreact TSX, 84 files | 4.18 | 2.61 (Oxc) | 5.31 | 3.14 (SWC Next) |
235
+ | App.tsx | 5.56 | 3.25 (Oxc) | 7.07 | 5.11 (SWC Next) |
236
+ | table.tsx | 0.53 | 0.28 (Oxc) | 1.55 | 0.89 (SWC Next) |
237
+ | TypeScript JavaScript bundle | 46.58 | 54.05 (Oxc) | 49.76 | 63.24 (Oxc) |
238
+
239
+ The same container measured a one-input startup floor using eleven alternating fresh processes. An empty N-API addon took 0.20 ms. The direct Pulse addon emitted the small typed input in 0.20 ms, the public TMT facade in 0.69 ms, and the SWC Next adapter in 0.33 ms. The corresponding values after the small ASCII export path were 0.18, 0.18, 0.64, and 0.29 ms. These experiments isolate initialization from the larger first-emission workloads.
240
+
241
+ The instrumented Pulse parser counted 1.72–2.44 in-bounds logical `peek` reads per input byte across the selected real workloads. The count covers successful whole parses and omits class scan block reads and subsequent JS validation. App.tsx used 1.76 reads per byte. The [raw timing, audit, and coverage evidence](../evidence/compiler/cache-disabled-emission.json) preserves input hashes, individual measurements, and the explicitly labeled architecture experiments.
242
+
243
+
244
+ At this checkpoint, all 653 fixed project inputs emit valid JavaScript with TypeScript loading blocked. Pulse emits 628 directly, including all 94 TypeScript and 32 TSX files from tachyon-dom and all 84 mreact TSX files. The core comparison retains five previously reviewed normalized output differences. Across the broader 2,818-file framework comparison, 358 files moved to Pulse with matching normalized output or dependencies. The additional sources include Astro, Hono, React Router, Solid, Svelte, TanStack Query, Vitest, and Vue.
245
+
246
+ The original 3,321-input audit recorded 77 V8 rejections. At the current revision, the same corpus and 408 generated or mutated inputs produce 2,487 successful V8 validations and zero rejections. An expanded set of 1,709 raw TypeScript compiler and conformance inputs produces 361 successful validations and zero rejections. Its previous 16 rejections were CommonJS export assignments sent to the ESM path. The current parser also checks whether a local export has a runtime binding before emission.
247
+
248
+ All 3,248 repository tests pass. F★/Pulse checked both generated snapshots, Lean built the compiler arithmetic proofs, and TLC explored all 270 reachable publication model states.
249
+
250
+ A final paired Linux experiment isolated V8 module parsing on outputs that were byte-identical with validation enabled and disabled. App.tsx moved from 5.35 to 3.40 ms warm and from 7.04 to 4.77 ms on first emission. The mreact TSX cohort moved from 3.85 to 2.31 ms warm. The 260-file native mreact TypeScript cohort still took 28.72 ms warm in the ablation. The performance comparison above uses the release path with validation enabled.
251
+
252
+ A per-source trivia memo preserved all output hashes and regressed the warm and first-emission medians on all seven tested macOS workloads. The release parser keeps the existing trivia reader.
253
+
254
+ ### Native coverage and projection scanning
255
+
256
+ At `82ab0c5`, Pulse emits all 653 fixed Vite, mreact, and tachyon-dom inputs without either compatibility emitter. The normalized TypeScript audit retains one previously reviewed output difference with identical static dependencies. Committed ranges now cover parameter properties, abstract and declared members, optional method signatures, contextual references, and delimited type annotations. Markerless TypeScript scripts use the same projection with V8 script validation. ESNext .mjs validates once and preserves the input text. The fallback emitter loads on demand.
257
+
258
+ The Arm64 projection scan checks sixteen possible token starts at once. It advances to the first lexical sentinel or contextual-keyword prefix, then applies the ordinary check. Lean verifies the lookup predicates for all byte values. The C checks exercise every byte pair in every lane. A separate scalar-to-NEON comparison matched code, backend, and diagnostics for 2,501 inputs. Native emission continues to call V8 validation.
259
+
260
+ The following Linux arm64 comparison used Node 24.14.0, disabled V8 compilation caching, and supplied UTF-8 bytes. Each row uses seven interleaved samples. The complete common suite still leads in six of 20 warm rows and one first-emission row. The two official fixtures without a common emitted result are excluded. The full Vite and mreact rows compare the three engines that emitted all files. TanStack Query has one more file outside the shared cohort.
261
+
262
+ | Workload | TMT warm before → current (ms) | Fastest reference warm (ms) | TMT first before → current (ms) | Fastest reference first (ms) |
263
+ | --- | ---: | ---: | ---: | ---: |
264
+ | Vite TS, 122 files | 28.32 → 18.91 | 10.97 (Oxc) | 73.98 → 20.50 | 11.83 (SWC Next) |
265
+ | mreact TS, 321 files | 73.69 → 61.44 | 32.12 (Oxc) | 120.50 → 64.25 | 34.84 (SWC Next) |
266
+ | tachyon-dom TS, 94 files | 19.29 → 18.63 | 9.35 (Oxc) | 20.53 → 19.62 | 10.54 (SWC Next) |
267
+ | mreact TSX, 84 files | 4.43 → 4.25 | 2.85 (Oxc) | 5.37 → 5.00 | 3.16 (SWC Next) |
268
+ | TanStack Query TS, 96 files | 12.32 → 8.43 | 4.71 (SWC Next) | 54.58 → 9.67 | 4.39 (SWC Next) |
269
+ | SWC Next App.tsx | 5.84 → 5.39 | 3.38 (Oxc) | 7.27 → 6.75 | 5.26 (SWC Next) |
270
+ | Local .mjs scripts, 10 files | 3.18 → 1.22 | 1.07 (Yuku 0.28) | 33.37 → 1.92 | 1.38 (SWC Next) |
271
+
272
+ The direct Pulse addon emitted one representative small input in 0.21 ms. The public facade took 0.58 ms and the SWC Next adapter took 0.32 ms. The direct addon and the public facade have different option and compatibility responsibilities.
273
+
274
+ A separate validation ablation with the starting implementation reduced warm tachyon-dom from 18.28 to 8.54 ms and App.tsx from 5.53 to 2.50 ms. The 260-file native mreact TS cohort reached 23.22 ms against Oxc's 23.36 ms. These experiments quantify the cost of output validation. The measured release path retains both the ambiguity check and V8 parsing. The [timings and conformance evidence](../evidence/compiler/all-pulse-neon.json) includes each final sample, input hashes, and the separate experiments.
275
+
276
+ ### ECMAScript module strings
277
+
278
+ At `63d064a`, an ESNext `.mjs` transform without a source map passes the decoded JavaScript string directly to V8. The small validator addon avoids loading the full compiler and encoding the string as UTF-8 again. A missing or incompatible validator addon uses the previous module route. Directive handling, invalid encoding and V8's module syntax decision retain their existing behavior.
279
+
280
+ The paired Linux arm64 run used Node 24.14.0 with UTF-8 byte inputs, seven interleaved samples, and V8 compilation caching disabled. On ten local `.mjs` scripts the change moved the warm median from 1.605 to 1.336 ms and the first-process median from 2.936 to 2.441 ms. SWC Next measured 1.340 and 1.888 ms respectively. The warm medians are within 0.004 ms of each other. A separate prototype run measured 1.20 to 1.10 ms warm and 2.05 to 1.95 ms first. The common suite led seven of 21 warm rows and one of 21 first-process rows. The four supplemental cohorts shared by TMT, Oxc and SWC Next remain behind.
281
+
282
+ | Workload | TMT warm (ms) | Fastest reference warm (ms) | TMT first (ms) | Fastest reference first (ms) |
283
+ | --- | ---: | ---: | ---: | ---: |
284
+ | Vite TS, 122 files | 23.84 | 13.15 (Oxc) | 25.68 | 14.71 (SWC Next) |
285
+ | mreact TS, 321 files | 70.21 | 39.50 (Oxc) | 74.36 | 40.54 (SWC Next) |
286
+ | tachyon-dom TS, 94 files | 23.43 | 11.03 (Oxc) | 24.66 | 12.51 (SWC Next) |
287
+ | mreact TSX, 84 files | 4.88 | 3.33 (Oxc) | 5.99 | 3.76 (SWC Next) |
288
+ | SWC Next App.tsx | 5.90 | 3.64 (Oxc) | 7.27 | 5.78 (SWC Next) |
289
+
290
+ The additional NEON byte-class loop, exact binding byte comparison, and binding-presence filter did not consistently improve the Linux warm and first medians. A packed byte-class index and a prototype that delegates lexically simple function bodies to the final V8 parse gave no repeatable gain on macOS. GCC profile-guided optimization trained on the 642 TypeScript inputs in the pinned Astro corpus. It shortened some TypeScript medians by 1–4.5% and increased the mreact TSX warm median by 6.5%. These experiments remain outside the release build.
291
+
292
+ The text validation audit compared ordinary and instrumented results for 671 inputs. The case matrix covers BOM preservation, invalid Unicode, invalid module syntax, unbound exports, and unavailable addons. TLC explored 489 distinct states of the publication model. The [comparison and verification data](../evidence/compiler/mjs-text-validation.json) include sample timings and corpus hashes.
293
+
294
+ ### JavaScript project emission and x86 projection scanning
295
+
296
+ At `4da4552`, JavaScript modules with static import or export declarations can pass their original text directly to V8. Modules beginning with a static declaration use the small validator addon. For later declarations, the Pulse marker reader identifies the module without running Node type erasure. Plain scripts retain their previous strictness handling. Directive diagnostics and Unicode identifier boundaries are part of the module-routing tests.
297
+
298
+ The pinned Svelte workload is 376 JavaScript files. All complete results matched the preceding compiler. The isolated Linux arm64 JavaScript routing experiment moved Svelte from 64.21 to 14.15 ms warm and from 108.71 to 16.51 ms first. SWC Next measured 17.13 and 17.91 ms in that run. Astro's 642-file TypeScript workload increased from 639 to 641 direct Pulse outputs. All 641 matched the normalized TypeScript AST and static dependencies. The remaining file contains a leading triple-slash reference directive and still uses the compatibility emitter.
299
+
300
+ The projection guard retains each SIMD block's candidate mask as it makes scalar syntax decisions. On x86-64 it selects AVX2 when available, SSSE3 otherwise, and scalar on CPUs without either extension. ARM64 uses NEON. Lean proves the packed mask suffix law and the x86 lookup groups. C tests check all 65,536 byte pairs in every SIMD lane, including the byte following the final lane. Both x86 widths also ran on a Ryzen 9 9950X. The 64-lane AVX-512 experiment increased the warm mreact TSX median from 4.01 to 4.21 ms and is excluded from release builds. A narrower Pulse probe handles bare arrow parameters and keeps the existing parser for comment trivia and complex heads.
301
+
302
+ On the Ryzen 9 9950X, the Node 24.22.3 comparison used seven interleaved samples, pinned one CPU, and disabled the V8 cache. The input and full emitted results matched between TMT variants. The table uses the AVX2 build and lists the fastest reference engine for each measurement.
303
+
304
+ | Workload | TMT warm before → current (ms) | Fastest reference warm (ms) | TMT first before → current (ms) | Fastest reference first (ms) |
305
+ | --- | ---: | ---: | ---: | ---: |
306
+ | Vite TS, 122 files | 26.73 → 23.41 | 13.38 (SWC Next) | 28.33 → 25.11 | 13.09 (SWC Next) |
307
+ | mreact TS, 321 files | 76.98 → 64.45 | 39.33 (Oxc) | 83.73 → 71.73 | 38.13 (SWC Next) |
308
+ | tachyon-dom TS, 94 files | 22.68 → 19.42 | 11.29 (Oxc) | 24.60 → 21.35 | 11.43 (SWC Next) |
309
+ | mreact TSX, 84 files | 5.35 → 4.55 | 3.16 (Oxc) | 7.12 → 6.32 | 3.79 (SWC Next) |
310
+ | SWC Next App.tsx | 6.83 → 5.73 | 3.61 (Oxc) | 9.00 → 7.96 | 5.85 (SWC Next) |
311
+ | Svelte JS, 376 files | 15.20 → 16.17 | 18.79 (Yuku 0.28) | 20.27 → 20.23 | 19.25 (SWC Next) |
312
+
313
+ The final arm64 suite led seven of 23 common warm workloads and two first-process workloads. The Ryzen suite led three of 13 common warm workloads and one first-process workload. These totals exclude supplemental cohorts and the two official fixtures without a common supported emission. Runtime namespace and const-enum differences keep Oxc's `parser.ts` outside the dependency-free comparison. Preserving implicit type imports creates a duplicate runtime binding in Yuku's `checker.ts`, so it needs shared import-elision semantics for a valid comparison.
314
+
315
+ A separate prototype mapped function braces through the JSX writer and removed selected bodies only in the validation input. On App.tsx, broad removal of 185 bodies reduced validation input construction plus V8 parsing from 3.87 to 0.83 ms. The small ordinary-function subset gave no gain. The broad measurement leaves the certification of parameter-scope interactions, directives and context-sensitive syntax open. Production still validates the full emitted text. The [comparison and verification evidence](../evidence/compiler/projection-simd-and-ecosystem.json) records each sample, the exact input hashes, and the separate body experiment.
316
+
317
+ The fixed TypeScript upstream sample had 126 inputs with valid reference ESNext module emission. The current compiler emitted 72 through Pulse and one through Pulse plus Node's eraser with TypeScript loading blocked. The emitted AST shapes and dependency lists matched the reference for all 73. The other 53 still require TypeScript, including cases with import-equals declarations.
318
+
319
+ Two extra V8 validation experiments remained outside the release build. The public Node-API string bridge retained the validated string but gave mixed timings across the main TypeScript cohorts. Replacing static intrinsic JSX calls in the validation input increased validation and construction time on all four measured workloads. On the Ryzen 9 9950X, the packed keyword load with type capture shortened tachyon-dom TS from 19.32 to 18.61 ms warm. It also increased mreact TSX first-process time from 6.13 to 6.34 ms. Lean proved the word-fold identity for all eight supported arities. The compiler retains its scalar keyword fold.
320
+
321
+ ### Certified emission and native entries
322
+
323
+ At `1f1bcb7`, a TypeScript or TSX module projection is published without a second parse. The Pulse parse records kind 29 wherever it accepts TypeScript-only syntax that the projection would keep, and the emitter declines those files to the compatibility routes. An enum that the emitter cannot lower is declined the same way. The V8 reparse and the textual projection guard are compiled only into the audit build (`npm run build:compiler -- --audit-v8`). That build validates every projection, reports the certification decision and the guard's verdict, and `scripts/audit-compiler-v8.mjs` fails on a certified projection that V8 rejects or on a guard objection whose output differs from TypeScript's emit.
324
+
325
+ The audit covered 198,020 inputs: the fixed project corpora, 12,357 TypeScript compiler and conformance cases, test262 as TypeScript and JavaScript modules, 4,769 generated ambiguity shapes and 100,000 mutations. V8 accepted all 61,301 certified projections. The guard objected to 601 published projections, and all 601 have the syntax TypeScript emits. `scripts/fuzz-compiler-certification.mjs` compared the audit and ordinary builds on 3.3 million mutated sources without a certified rejection or a difference.
326
+
327
+ A differential against TypeScript's own emit found results that V8 and the guard both accepted. The JSX writer emitted `return_tmtJsx0(...)` for `return<div/>`. A line break after `declare` was read as an ambient module, and `global` before a name was read as an expression where TypeScript reads a declaration. These are fixed, and `test/compiler-typescript-reference.test.mjs` holds the regressions. The remaining differences on 900,000 mutated sources are TypeScript emit details: the `default_1` name for an anonymous default class, a setter return type that TypeScript keeps, and the `export {}` marker under preserved modules.
328
+
329
+ `src/compiler.cjs` is now a small entry. Default-option `.ts`, `.mts` and `.tsx` sources go to `emitTypeScript`, and `.js` and `.mjs` sources to `emitJavaScriptModule` and then `emitJavaScript`. Each native call repeats the steps of the router in `src/compiler-routes.cjs` and returns `undefined` for every input the router must decide. A JavaScript module whose certified parse commits no edit is published as its own bytes, and every other JavaScript source is validated by V8. Scripts are validated inside the addon, because Node 24 aborts the process while decorating some syntax errors from `vm.Script`, for example `await using x = null, [] = null`.
330
+
331
+ Three changes account for most of the time. Skipping the V8 reparse removed about 45% of a warm pass on the TypeScript corpora. The block comment scanner now skips to a star followed by a slash, which cut TanStack Query from 3.53 to 2.61 ms on macOS. Raising the inlining limits for the extracted parser cut a warm mreact pass from 28.0 to 20.0 ms on Linux arm64 and from 29.9 to 24.2 ms on the Ryzen host. `-O2` and `-Os` were 25 to 150% slower than `-O3`. A second, compact addon for cold small inputs was slower on mid-sized cold workloads and is not part of the build.
332
+
333
+ All fixed inputs of Vite, mreact, tachyon-dom, Solid and TanStack Query emit through Pulse, and 641 of 642 Astro files. The normalized TypeScript audit reports 1,417 of 1,418 as equivalent and one reviewed difference. The Oxc `parser.ts` and Yuku `checker.ts` fixtures still have no common emitted result: they need runtime namespace lowering, non-literal const enums and, for `checker.ts`, inputs above the 1 MiB parser limit.
334
+
335
+ The comparison uses Node 24.14.0 on Linux arm64 and Node 24.22.3 on the Ryzen 9 9950X, UTF-8 byte input, the V8 compilation cache disabled, and three suite runs of seven interleaved samples pooled per engine. The first-process child no longer installs the resolve hook that blocks TypeScript and no longer inherits `--experimental-vm-modules`. Both slowed module loading inside the timed region for engines with a JavaScript entry. The child asserts after the timed region that no TypeScript module was loaded. Medians are in milliseconds.
336
+
337
+ | Linux arm64 workload | Files | TMT warm | Fastest reference warm | TMT first | Fastest reference first |
338
+ | --- | ---: | ---: | ---: | ---: | ---: |
339
+ | Vite TS | 113 | 5.86 | 9.61 (Oxc) | 7.21 | 10.30 (SWC Next) |
340
+ | mreact TS | 315 | 21.13 | 37.14 (Yuku 0.28) | 21.94 | 36.79 (SWC Next) |
341
+ | tachyon-dom TS | 94 | 6.17 | 10.35 (Oxc) | 6.71 | 11.13 (SWC Next) |
342
+ | mreact TSX | 84 | 1.80 | 2.86 (Oxc) | 2.03 | 3.32 (SWC Next) |
343
+ | TanStack Query TS | 93 | 2.96 | 4.36 (SWC Next) | 3.49 | 4.32 (SWC Next) |
344
+ | Astro TS | 641 | 11.75 | 21.59 (SWC Next) | 13.08 | 21.36 (SWC Next) |
345
+ | Svelte JS | 376 | 13.44 | 18.09 (Oxc) | 13.56 | 18.66 (SWC Next) |
346
+ | Local .mjs modules | 10 | 0.65 | 1.16 (Oxc) | 1.06 | 1.54 (SWC Next) |
347
+ | SWC Next App.tsx | 1 | 1.84 | 3.59 (Oxc) | 2.73 | 5.48 (SWC Next) |
348
+ | renderer.ts | 1 | 0.33 | 0.50 (Oxc) | 0.93 | 1.33 (SWC Next) |
349
+ | UserSettings.tsx | 1 | 0.03 | 0.07 (SWC Next) | 0.52 | 0.48 (SWC Next) |
350
+ | TypeScript JavaScript bundle | 1 | 51.18 | 59.34 (Oxc) | 53.03 | 70.02 (Oxc) |
351
+
352
+ | Ryzen 9 9950X workload | Files | TMT warm | Fastest reference warm | TMT first | Fastest reference first |
353
+ | --- | ---: | ---: | ---: | ---: | ---: |
354
+ | Vite TS | 113 | 6.78 | 10.13 (SWC Next) | 8.66 | 10.64 (SWC Next) |
355
+ | mreact TS | 315 | 24.48 | 36.36 (SWC Next) | 26.30 | 36.48 (SWC Next) |
356
+ | tachyon-dom TS | 94 | 7.29 | 11.16 (SWC Next) | 7.91 | 11.35 (SWC Next) |
357
+ | mreact TSX | 84 | 1.91 | 3.09 (Oxc) | 2.58 | 3.88 (SWC Next) |
358
+ | TanStack Query TS | 93 | 2.92 | 3.94 (SWC Next) | 3.75 | 4.63 (SWC Next) |
359
+ | Astro TS | 641 | 12.79 | 22.30 (SWC Next) | 14.59 | 22.25 (SWC Next) |
360
+ | Svelte JS | 376 | 12.30 | 18.32 (SWC Next) | 15.80 | 19.37 (SWC Next) |
361
+ | Local .mjs modules | 10 | 0.73 | 1.21 (Yuku 0.28) | 1.86 | 1.82 (SWC Next) |
362
+ | SWC Next App.tsx | 1 | 2.21 | 3.70 (Oxc) | 3.37 | 5.88 (SWC Next) |
363
+ | renderer.ts | 1 | 0.41 | 0.67 (Oxc) | 1.22 | 1.66 (SWC Next) |
364
+ | UserSettings.tsx | 1 | 0.04 | 0.08 (SWC Next) | 0.74 | 0.80 (SWC Next) |
365
+ | TypeScript JavaScript bundle | 1 | 54.58 | 88.64 (Oxc) | 56.10 | 92.73 (Oxc) |
366
+
367
+ TMT leads all 23 common warm rows on Linux arm64 and all 20 on the Ryzen host. It leads 22 of 23 and 19 of 20 first-process rows. The two exceptions are `UserSettings.tsx` on arm64 (0.52 against 0.48 ms) and the ten local modules on the Ryzen host (1.86 against 1.82 ms). Single runs disagree on both, and a direct 41-sample repetition of the Ryzen first-process sample measured 2.04 ms for TMT against 2.38 ms for SWC Next. The [pooled samples, audit totals and experiments](../evidence/compiler/certified-native-emission.json) record every row.
368
+
369
+ ### Record mutation check and sanitizer fuzzing
370
+
371
+ `scripts/mutate-compiler-records.mjs` changes one record call of the generated parser at a time. It drops the record, moves one end of its span by a byte, or keeps the records that a count rewind was meant to replace. Over 59 record calls this gives 305 mutants, run against 18,777 cases. No mutant changed the syntax of a published output without the audit build or the TypeScript comparison noticing. 152 were detected, 105 only moved files to a compatibility route, and 48 had no visible effect. Of those 48, 27 sit on records whose span the ordinary build does not read, 10 change spacing of a whole erased statement, 4 leave an empty statement, and 7 are unexplained.
372
+
373
+ `scripts/fuzz-compiler-native.mjs` builds `native/compiler/fuzz.c` with libFuzzer, AddressSanitizer and UndefinedBehaviorSanitizer and runs every emitter entry on exactly sized inputs. It needs a clang that ships libFuzzer (`TMT_FUZZ_CLANG`). Ten minutes on four workers found no defect.
374
+
375
+ The entry also accepts options spelled out with their default values, so `tmt-compile file.ts` and callers that pass `target: 'esnext'` or `sourceMap: false` take the native call.
376
+
377
+ ### Native source maps
378
+
379
+ With `sourceMap: true` the ESNext module routes for `.ts`, `.mts` and `.tsx` publish the same code as without it, plus a map written by the native emitter. The TypeScript emitter is used only where it already produced the code (scripts, CommonJS, downlevel targets, `jsx: 'preserve'`, a byte order mark, names with unusual extensions).
380
+
381
+ The writer logs every copy of source bytes into the output as a run of output offset, source offset and length. Type erasure is one run that covers the whole file. Parameter properties, enums and JSX produce several runs with generated text between them, and the inserted JSX helper import moves the runs after it. `native/compiler/source-map.h` walks the runs once. Inside a run it checks that the output is a projection of the source (equal bytes, a space, `;`, `(` or `)` written over erased syntax, the eraser's equal-width blanks over erased non-ASCII text, every line terminator kept) and writes a segment where a run of word or punctuation characters starts. Generated text has no segment. Columns are UTF-16 code units and lines end at LF, CRLF, CR, U+2028 and U+2029. If a run fails the check, no native map is published and the TypeScript route produces code and map.
382
+
383
+ `version`, `file`, `sourceRoot`, `sources`, `names` and `sourcesContent` equal what TypeScript writes. `mappings` is finer for copied text and absent for generated text. A module of types alone has empty mappings.
384
+
385
+ Checks: 36 pairwise rows over line endings, non-ASCII placement, edit kind, input form and name; every output token (TypeScript scanner) maps to the same token in the source for position-preserving output, and every segment maps to the same text for lowered output, over the fixtures and 2,400 files of the fixed projects; direct tests of the scan with hand-made runs; 26 mutants of the scan, of which 24 fail the tests, one does not build and one guards a position that cannot occur.
386
+
387
+ On an Apple M-series host under load, the fixed projects with maps take 1.6 to 2.2 times the time without maps and about one twentieth to one thirtieth of the TypeScript emitter's time (Vite 26 ms against 545 ms, mreact 66 ms against 2,370 ms, mreact TSX 3.4 ms against 105 ms). Competitors were not measured with maps.
388
+
389
+ ### Wider corpora, declaration merging and two emission defects
390
+
391
+ Eleven tagged open-source projects (zod, hono, rxjs, trpc, excalidraw, drizzle, vue, typescript-eslint, playwright, effect, prisma; 8,973 `.ts` and `.tsx` files, read as data) were added to the scratch corpora to see where the native routes stop and whether their output is right. Declined files fell from 984 to 640 after the changes below. The remaining causes are listed at the end.
392
+
393
+ Comparing every native output with TypeScript's emit found two defects that were older than this work:
394
+
395
+ - A class member that starts with `[`, `*`, `in` or `instanceof` joined the field initializer on the line before it once an erased modifier or an erased member no longer stood between them (`a = f` / `readonly [k] = 2` became `a = f[k] = 2`). The eraser now writes `;` at the start of an erased leading modifier or an erased signature when the next member starts that way. 57 corpus files change.
396
+ - The two JSX helper imports were printed in the opposite order to TypeScript's when a file used both the runtime and `createElement`. The writer now settles which module was requested first by TypeScript's visiting order (children, attributes, key, then the helper for a runtime call; attributes, the helper, then children for `createElement`).
397
+
398
+ New native coverage:
399
+
400
+ - `yield` as an expression, `return` with a comma expression, `debugger`.
401
+ - Enum initializers fold like TypeScript's constant evaluation (hex, octal and binary literals, parentheses, unary and binary arithmetic and bitwise operators, earlier members). A fraction, a negative zero, a value beyond 2^53 - 1, a member named like a literal and an update operator leave the native route. `test/compiler-enum-constants.test.mjs` generates 6,000 declarations and compares the enum objects that the native output and TypeScript's output build.
402
+ - An interface merges with a class of its name. A namespace of types merges with a type alias, an interface, a value, a function or a class of its name.
403
+ - Parameter properties take `override`, need neither a type nor an initializer, and lower in the same pass as enums.
404
+
405
+ After these changes 14,531 of 14,535 native outputs over all corpora have TypeScript's syntax. The four differences are a kept parenthesis around a callee and two TypeScript quirks (`default_1`, a setter's return annotation). Warm timings of the fixed projects are unchanged within noise.
406
+
407
+ A second round reduced declined files to their cause by deleting statements while the file stayed declined, and added: a heritage clause that is any left-hand-side expression with optional type arguments (`extends S.Class<A>("A")({})`), type arguments before a tagged template and after the result of a call, `x!++`, variance annotations on class and type alias parameters, a local type that shares its name with a value, an exported namespace of types beside an exported value of its name, and quoted enum member names.
408
+
409
+ | Project | Files | Declined before | Declined now |
410
+ | --- | ---: | ---: | ---: |
411
+ | zod | 164 | 42 | 18 |
412
+ | hono | 346 | 37 | 37 |
413
+ | rxjs | 757 | 116 | 115 |
414
+ | trpc | 596 | 43 | 40 |
415
+ | excalidraw | 348 | 5 | 4 |
416
+ | drizzle | 574 | 79 | 22 |
417
+ | vue | 472 | 19 | 12 |
418
+ | typescript-eslint | 1,173 | 35 | 28 |
419
+ | playwright | 1,045 | 58 | 56 |
420
+ | effect | 1,579 | 525 | 31 |
421
+ | prisma | 1,919 | 26 | 23 |
422
+ | Total | 8,973 | 985 | 386 |
423
+
424
+ Over all corpora 14,824 of 14,828 native outputs have TypeScript's syntax. No output that was native before these parser changes differs after them, apart from the two defects above.
425
+
426
+ Still declined, by what the reductions show: decorators (most of rxjs, whose documentation app is Angular), a JSX import-source pragma and a leading triple-slash directive (most of hono), JSX spread of an object literal, a comparison followed by a comma and a literal in an argument list (`skip(v < 104, 'reason')`, which the parser cannot yet tell from type arguments), enums and type declarations in blocks outside a function, runtime namespaces, `export =` and `import =`, ambient classes and modules, angle-bracket assertions, and non-ASCII identifiers.
427
+
428
+ ### Speed after the wider grammar and native maps
429
+
430
+ On the Ryzen 9950X host the build before this work (`de3adb4`) and the current build were measured in alternating runs, three each, 21 samples pooled per row, with the usual isolation (rootless Podman, no network, CPU 13, 9 GiB scope). Warm time is unchanged and the compiler is ahead of every peer on 20 of 20 common rows. First-process time is ahead on 19 of 20, as before. The exception is still the ten local `.mjs` scripts (1.863 against 1.747 ms).
431
+
432
+ The first measurement showed a first-process regression of 0.03 to 0.1 ms on small inputs. The entry's compile function and file had grown with explicit options and maps, and V8 compiles that function on the first call. The default call has its earlier shape again, and `src/compiler-maps.cjs` holds the handling of spelled-out options and maps and loads only when one is given. After that every row is within about one percent of the earlier build. A single first call remains 0.004 to 0.007 ms slower, which matches an addon that is about three percent larger.
433
+
434
+ Peers were not measured with source maps.
435
+
436
+ ### Decorators, JSX import source, triple-slash comments and identity escapes
437
+
438
+ A third round added four things that kept whole files on the TypeScript emitter.
439
+
440
+ - Decorators. TypeScript keeps standard decorators as written at the ESNext target, so the native route only has to parse them: a name, a member chain, or either with arguments, before a class declaration (also behind `export`, `export default` and `abstract`) and before a method, field or accessor. An erased modifier behind a decorator is blanked without a separator. Parameter decorators, a decorator on a constructor or an erased signature, `@(expr)`, type arguments in a decorator, `export @dec class`, class expressions, local classes and `accessor` fields stay with TypeScript. V8 does not parse decorators, so the router's module route asks the certified parse when V8 refuses an `.mjs` source, as the entry does.
441
+ - `@jsxImportSource`. One pragma in a block comment before the first token, with a plain package name, selects that package for the helper imports under the automatic runtime. The reader follows TypeScript's tag matching, in which a tag takes the white space after it and the rest of the following line, so an earlier tag can hide the pragma. Every other `@jsx` text stays with TypeScript.
442
+ - Leading triple-slash comments. Notes without markup and references with `types`, `path` or `lib` and a quoted value are taken by the module emitters, which keep them as comments. A malformed reference keeps TypeScript's diagnostic 1084.
443
+ - Identity escapes. An ordinary string or template takes a backslash before any printable ASCII character other than `x`, `u` and a digit. A regular expression without the `u` flag takes an identity escape of punctuation. Property keys, module specifiers and directives are compared as written and keep the short list. `test/compiler-literal-escapes.test.mjs` generates 11,000 literals and checks that whatever the native lexer accepts, V8 accepts in strict code.
444
+
445
+ | Project | Files | Declined at the start | Declined now |
446
+ | --- | ---: | ---: | ---: |
447
+ | zod | 164 | 42 | 16 |
448
+ | hono | 346 | 37 | 6 |
449
+ | rxjs | 757 | 116 | 47 |
450
+ | trpc | 596 | 43 | 34 |
451
+ | excalidraw | 348 | 5 | 4 |
452
+ | drizzle | 574 | 79 | 17 |
453
+ | vue | 472 | 19 | 11 |
454
+ | typescript-eslint | 1,173 | 35 | 28 |
455
+ | playwright | 1,045 | 58 | 41 |
456
+ | effect | 1,579 | 525 | 29 |
457
+ | prisma | 1,919 | 26 | 19 |
458
+ | Total | 8,973 | 985 | 252 |
459
+
460
+ Over all corpora 15,006 of 15,010 native outputs have TypeScript's syntax, with the same four benign differences. The entry and the router return the same result for 65,756 compile calls. On the Ryzen host the build with decorators and the pragma, measured against the build before them in alternating runs, is unchanged on the project rows and still ahead of every peer on 20 of 20 warm rows and 19 of 20 first-process rows. The triple-slash change was made after that measurement.
461
+
462
+ Still declined: enums and type declarations inside blocks, JSX spread of an object literal, a comparison followed by a comma and a literal in an argument list, angle-bracket assertions, parameter decorators, runtime namespaces, `export =` and `import =`, ambient classes and modules, and non-ASCII identifiers.
@@ -0,0 +1,61 @@
1
+ # Development
2
+
3
+ This page covers building from a checkout, the recorded experiments and the verification toolchain. See the [README](../README.md) for installation and use.
4
+
5
+ ## Shipping threshold experiment
6
+
7
+ Use Node.js 22.18 or later in the 22 line, or 24.11 or later and run `npm ci`, then `npm test` or `npm run evidence:m0`. The experiment runs Vitest against original, instrumented, and actually rewritten source in temporary project copies. It also reproduces the comparison with StrykerJS 10.1.1 and Vitest 4.0.18.
8
+
9
+ ```sh
10
+ node bin/tmt.mjs prototype fixtures/shipping src/shipping.ts --spec spec.json
11
+ npm run evidence:m0
12
+ ```
13
+
14
+ The [recorded runs](../evidence/m0) used Node.js 24.14.0 on macOS arm64. Both StrykerJS reports contain five killed mutants. In both reports the generated replacements are `true`, `false`, `yen > 5000`, `yen < 5000`, and `() => undefined`. TMT observed orders of ¥4,800 and ¥5,000. The existing tests passed against the original and the nearest alternative, `yen >= 4999`. The added ¥4,999 case passed against the original and failed against the alternative. Within the stated whole-yen domain it detects every feasible alternative threshold from ¥4,801 through ¥4,999.
15
+
16
+ The prototype accepts exported unary arrow functions (expression or block body) and exported unary `function` declarations of the form `parameter >= integer` (`analyze` extends threshold analysis to all four operators `<`, `<=`, `>`, and `>=`). A report without a matching specification uses the current implementation as the source of an expected value. The generated witness runs in the project's `test` directory. The report marks its outcome unconfirmed when the runner does not execute that test alongside the original suite. The runner executes the project's test code and configuration locally.
17
+
18
+ ## Extract comparison candidates
19
+
20
+ ```sh
21
+ npm run build:native
22
+ npm run build:typescript-syntax
23
+ node bin/tmt.mjs extract source.tsx
24
+ npm run verify:fstar
25
+ npm run audit:extraction -- /path/to/vite /path/to/preact /path/to/typescript
26
+ ```
27
+
28
+ The native build uses a C compiler, the checked-in KaRaMeL C files, and Node-API headers. Set `TMT_NODE_INCLUDE` if Node's headers are outside the standard paths. The verification command uses F★ 2026.11.15 with Pulse and the KaRaMeL executable from the same release. Set `FSTAR_EXE` and `KARAMEL_EXE` to their paths. It verifies the parser and reference proofs, rejects admitted obligations, regenerates C, and compares both generated files with the checked-in copies. The F* proofs and generated C pull request check runs this command when proof and native extraction files change.
29
+
30
+ The [L1 grammar and trust boundary](l1.md) describe the AST-free Pulse parser and TypeScript compatibility path. `build:typescript-syntax` prepares the smaller compatibility parser for local runs. The [performance measurements](performance.md) cover the prior corpora and nine additional pinned JavaScript and TypeScript projects.
31
+
32
+ To build the standalone comparison extractor, run `npm run build:native -- --low-only` and then `node bin/tmt.mjs extract source.ts`. This build uses Node and a C compiler and writes `build/tmt.node`. Supported files use the generated Pulse parser directly, including typed modules, nested functions, exception handling, switch clauses, generic calls, async callbacks, nested bindings, computed object members, tagged templates, bounded class declarations, and nested TSX. Outside its grammar or resource limits, the standalone CLI exits with a diagnostic and no candidates. Run `npm run build:native` to restore the normal build with TypeScript compatibility parsing.
33
+
34
+ ## Analyze a Vitest project
35
+
36
+ See the [analysis guide](analysis.md) for project scope, Lean-backed replay, and source rewrite auditing.
37
+
38
+ The `--witnesses` profile finds source edits that survive the current suite and verifies a distinguishing test. Run `node bin/tmt.mjs analyze fixtures/witnesses src/queries.ts --witnesses` to see a first-versus-last index gap and the one-literal edit that exposes it.
39
+
40
+ ```sh
41
+ npm run build:lean
42
+ node bin/tmt.mjs analyze fixtures/eligibility src/eligibility.ts --spec spec.json --deterministic --audit
43
+ ```
44
+
45
+ ## Analyze a Playwright project
46
+
47
+ ```sh
48
+ node bin/tmt.mjs analyze . src/button.tsx --runner playwright --project chromium --audit
49
+ ```
50
+
51
+ The [Playwright guide](analysis.md#playwright-projects) describes runner isolation, witness specifications, and Git scope.
52
+
53
+ ## Build the npm packages
54
+
55
+ ```sh
56
+ npm ci
57
+ npm run pack:runtime
58
+ npm run test:package
59
+ ```
60
+
61
+ `pack:runtime` writes two archives to `build/packages/`: the platform-independent `targeted-mutation` package and the optional accelerator `@targeted-mutation/tmt-<os>-<cpu>` for the build machine, which holds the native parser and the Lean decision executable. `--only main` or `--only platform` builds one of them. `test:package` installs both into an empty project to run `targeted`, `full`, and `--witnesses`, and also verifies portable fallback (`targeted-mutation` without any platform package). Building another platform's package requires its C and pinned Lean toolchains. The checkout's `package.json` stays `private`; only the generated manifests are published. See [releasing](releasing.md).