oxc_plugin_worklets 0.1.0

A Rust port of React Native Reanimated's worklets plugin
Documentation
  • Coverage
  • 60%
    9 out of 15 items documented0 out of 4 items with examples
  • Size
  • Source code size: 174.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.88 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 31s Average build duration of successful builds.
  • all releases: 1m 31s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • leegeunhyeok/oxc-react-native-worklets
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • leegeunhyeok

oxc-plugin-worklets

A Rust port of React Native Reanimated's worklets Babel plugin, built on top of oxc.

Designed to integrate with the Rolldown bundler.

Requirements

  • mise (manages Rust, Node, just)
  • oxc 0.115.0 (pinned for Rolldown compatibility)

Setup

mise install

Development

just          # List available commands
just build    # Build
just test     # Run all tests
just lint     # Check fmt + clippy
just fmt      # Auto-fix formatting
just snapshot # Update insta snapshots

Testing

just test                            # Run all tests

Integration tests live in tests/transform.rs and use insta for snapshot testing. Snapshots are stored in tests/snapshots/.

Release

just release 0.2.0
# → updates Cargo.toml version
# → commits "chore: release crates v0.2.0"
# → push to main triggers cargo publish via CI

Usage

API

use oxc::allocator::Allocator;
use oxc::ast::ast::Program;
use oxc_plugin_worklets::{WorkletsVisitor, PluginOptions};

fn example(allocator: &Allocator, program: &mut Program<'_>) {
    let opts = PluginOptions {
        filename: Some("/path/to/file.js".to_string()),
        is_release: true,
        ..Default::default()
    };

    let mut visitor = WorkletsVisitor::new(allocator, opts);
    visitor.visit_program(program).expect("transform failed");
}

Rolldown Integration

use oxc_plugin_worklets::{WorkletsVisitor, PluginOptions};

ast.with_mut(|fields| {
    let opts = PluginOptions {
        filename: Some(filename.to_string()),
        ..Default::default()
    };
    let mut visitor = WorkletsVisitor::new(fields.allocator, opts);
    visitor.visit_program(fields.program)
        .expect("worklets transform failed");
});

License

MIT