Transformer
Features
- Transforming TypeScript to ESNext.
- Transforming React JSX to ESNext, with built-in React Refresh.
- TypeScript Isolated Declarations Emit without using the TypeScript compiler.
Installation
Node.js
Use the experimental node binding oxc-transform.
Rust
Use the umbrella crate oxc with the transformer
feature.
Rust usage example can be found here.
API Example
javascript
import { transform } from "oxc-transform";
const transformed = transform(filePath, sourceCode, {
typescript: {
onlyRemoveTypeImports: true,
declaration: { stripInternal: true },
},
});
await fs.writeFile("out.js", transformed.code);
await fs.writeFile("out.d.ts", transformed.declaration);