Modules and TSX
Modules and TSX are where a “fast syntax stripper” starts becoming a real compiler. tscc now has dedicated project/runtime differential gates for both surfaces.
Project graph resolution
Relative static imports and re-exports are discovered from the token stream. Cycles are de-duplicated. Runtime-correct .js specifiers can resolve to sibling .ts sources during compilation, and .jsx specifiers can resolve to .tsx.
import {View} from "./ui/View.jsx";
// compiles src/ui/View.tsx
// emitted import still points to ./ui/View.jsx
CommonJS transformation
The CommonJS path covers side-effect/default/named/namespace imports, aliases, mixed type/runtime imports, local exports, re-exports, export *, default declarations/expressions, import = require() and export =.
Live imported reads
Named/default ESM imports are not merely snapshotted. tscc keeps the required module object and rewrites runtime references to module properties, while respecting parameter, block, catch and loop shadowing. Re-export chains are runtime-differential-tested against tsc.
TSX preserve
TSX mode erases TypeScript while retaining JSX. The structural validator distinguishes markup from generic arrows, comparisons and regex literals containing angle brackets.
const view = <Comp<Map<string, number>> value={m} />;
const id = <T,>(x: T): T => x;
Why preserve before transform?
Preserve mode is a useful architectural checkpoint: tscc can prove it understands enough TSX to erase TypeScript safely without prematurely choosing React classic, automatic JSX, Preact or another runtime. A future JSX transform can be added as an explicit layer rather than entangled with TS syntax erasure.
Current edges
Package resolution, node_modules semantics, path mapping, every tsconfig module-resolution option, all ESM/CommonJS interoperability details and every TypeScript emitter compatibility quirk remain broader than the current project surface.