https://github.com/leegeunhyeok/swc-react-native
Collection of SWC(Rust) implementations for React Native
https://github.com/leegeunhyeok/swc-react-native
react-native swc
Last synced: about 1 month ago
JSON representation
Collection of SWC(Rust) implementations for React Native
- Host: GitHub
- URL: https://github.com/leegeunhyeok/swc-react-native
- Owner: leegeunhyeok
- License: mit
- Created: 2024-12-17T19:20:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-22T00:00:09.000Z (about 2 months ago)
- Last Synced: 2026-05-22T01:48:45.875Z (about 2 months ago)
- Topics: react-native, swc
- Language: Rust
- Homepage:
- Size: 366 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swc-react-native
Collection of SWC(Rust) implementations for React Native.
| Feature flag | Sub-crate | Upstream package |
| ------------ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `codegen` | `swc_react_native_codegen` | [`@react-native/babel-plugin-codegen`](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen) |
| `worklets` | `swc_react_native_worklets` | [`react-native-worklets/plugin`](https://github.com/software-mansion/react-native-reanimated/tree/main/packages/react-native-worklets) |
`swc_react_native` is the umbrella crate. No features are enabled by default — pick what you need
(`features = ["codegen"]`) or turn on `all` for everything. Each sub-crate can also be depended on
directly.
## Prerequisites
- [mise](https://mise.jdx.dev/) for environment management
## Setup
```sh
mise install
```
This installs the Rust toolchain and [just](https://github.com/casey/just) task runner as defined in `mise.toml`.
## Development
All tasks are available via `just`:
```sh
just # List all available recipes
```
### Build
```sh
just build # Debug build
just build-release # Release build
```
### Lint & Format
```sh
just lint # Run clippy with strict warnings
just fmt # Apply rustfmt
just fmt-check # Check formatting without applying
```
### Test
```sh
just test # Run all tests
just snapshot-review # Interactively review snapshot diffs (cargo insta review)
```
### All-in-one
```sh
just roll # lint + fmt-check + test
```
## Benchmark
Measured on Apple M1 Pro, 200 iterations over the per-target fixtures in
`bench//fixtures/`.
| Target | Babel total | Babel avg / op | SWC total | SWC avg / op | Speedup |
| ---------- | ----------: | -------------: | --------: | -----------: | -------: |
| `codegen` | 944.9ms | 4.724ms | 13.1ms | 0.066ms | **~72x** |
| `worklets` | 4554.4ms | 22.772ms | 61.3ms | 0.307ms | **~74x** |
Run with `just bench [n]` (after `just setup-bench ` once).
## Project Structure
```
crates/
swc-react-native/ # Umbrella crate — feature-gated re-exports of each transform
swc-react-native-codegen/ # SWC visitor for the codegen transform
swc-react-native-worklets/ # SWC visitor for the worklets transform
```
| Upstream package | Rust location |
| ------------------------------------ | --------------------------------- |
| `@react-native/babel-plugin-codegen` | crate `swc_react_native_codegen` |
| `react-native-worklets` Babel plugin | crate `swc_react_native_worklets` |
## LICENSE
[MIT](./LICENSE)