Community-driven, high-performance StyleX compiler and tooling ecosystem built with Rust
Important
This is a community-written implementation of StyleX tooling. Built with love by the open source community, it aims to provide a high-performance alternative to the official StyleX tooling while not being affiliated with or officially supported by Meta/Facebook.
A comprehensive monorepo providing a community-built napi-rs
compiler, SWC plugin, and complete CSS parser for StyleX. Built from the ground up in Rust for maximum performance and developer experience.
- β‘ Blazing Fast: Significantly faster build times by leveraging NAPI-RS/SWC instead of Babel
- π§ Performance-First Alternative: Built from the ground up in Rust for maximum speed and efficiency
- π¦ Complete Ecosystem: Community-built toolkit covering compilation to CSS parsing
- π Universal Integration: Works seamlessly with Next.js, Webpack, Vite, Rollup, and more
- π‘οΈ Type Safe: Full Rust implementation with comprehensive error handling
- π€ Community Driven: Open source with active community contributions and support
Perfect for developers who want blazing-fast StyleX compilation and are excited about Rust-powered tooling!
# For Next.js projects
npm install --save-dev @toss/stylexswc-nextjs-plugin
# For other build tools
npm install --save-dev @toss/stylexswc-unplugin
// next.config.js
const stylexPlugin = require('@toss/stylexswc-nextjs-plugin');
module.exports = stylexPlugin({
rsOptions: {
dev: process.env.NODE_ENV !== 'production',
},
})();
This monorepo is organized into specialized packages for maximum modularity and reusability:
rs-compiler
- High-performance NAPI-RS compiler for StyleX transformationcss-parser
- Comprehensive CSS value parser with extensive test coverage, supporting colors, lengths, calc expressions, transforms, and media queriesshared
- Shared utilities and configurations for SWC transformations
nextjs-plugin
- Next.js configuration wrapper with seamless SWC integrationunplugin
- Universal plugin supporting Vite, Webpack, Rollup, Rspack, and 8+ build toolsjest
- Jest transformer for StyleX testing workflowspostcss-plugin
- PostCSS integration for existing CSS pipelines
path-resolver
- Advanced path resolution with partialpackage.json
exports supporttest-parser
- Jest test parser for maintaining compatibility with official StyleXdesign-system
- Internal design system for consistent workspace examples
eslint-config
- Shared ESLint configurationtypescript-config
- TypeScript configuration presetsplaywright
- Visual regression testing setup
Tool | Package | Experience |
---|---|---|
Next.js | @toss/stylexswc-nextjs-plugin |
π Native SWC Integration |
Vite | @toss/stylexswc-unplugin |
β‘ Lightning Fast HMR |
Webpack | @toss/stylexswc-unplugin |
π§ Seamless Integration |
Rollup | @toss/stylexswc-unplugin |
π¦ Optimized Bundling |
Jest | @toss/stylexswc-jest |
π§ͺ Reliable Testing |
PostCSS | @toss/stylexswc-postcss-plugin |
π¨ CSS Pipeline Ready |
Rspack | @toss/stylexswc-unplugin |
π Rust-Powered Speed |
Farm, Rsbuild, Solid | @toss/stylexswc-unplugin |
π Modern Build Experience |
# Clone the repository
git clone https://github.com/Dwlad90/stylex-swc-plugin.git
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
This project includes a comprehensive Makefile that provides convenient shortcuts for common development tasks. The Makefile integrates with both the Node.js ecosystem (using pnpm and Turborepo) and Rust toolchain.
# Setup development environment
make setup
# Show all available commands
make help
# Build all packages
make build
# Start development servers
make dev
# Run tests
make test
# Run quality checks
make quick-check
The Makefile organizes commands into several categories:
Setup Commands:
make install
- Install all dependencies (Node.js and Rust)make setup
- Full development environment setupmake prepare
- Prepare hooks and development tools
Build Commands:
make build
- Build all packages (Node.js and Rust)make build-rust
- Build only Rust packagesmake build-node
- Build only Node.js packagesmake clean
- Clean all build artifacts
Development Commands:
make dev
- Start development serversmake watch
- Watch for changes and rebuild
Quality Commands:
make lint
- Run linting on all packagesmake format
- Format all codemake typecheck
- Run TypeScript type checkingmake quick-check
- Quick development check (format, lint, typecheck)make full-check
- Full development check including tests
Test Commands:
make test
- Run all testsmake test-visual
- Run visual regression testsmake bench
- Run benchmarks
App Commands:
make apps-build
- Build all example appsmake apps-dev
- Start development servers for all appsmake apps-clean
- Clean all app build artifactsmake app-nextjs-dev
- Start Next.js example app in development modemake app-nextjs-build
- Build Next.js example appmake app-nextjs-serve
- Serve Next.js example app (requires build first)make app-vite-dev
- Start Vite example app in development modemake app-vite-build
- Build Vite example appmake app-vite-serve
- Serve Vite example app (requires build first)make app-webpack-dev
- Start Webpack example app in development modemake app-webpack-build
- Build Webpack example appmake app-rollup-dev
- Start Rollup example app in development modemake app-rollup-build
- Build Rollup example appmake apps-serve-common
- Serve commonly used example apps simultaneously
Documentation & Release:
make docs
- Generate documentationmake info
- Show project information
Package Commands:
Bulk Package Operations:
make packages-build
- Build all Node.js packagesmake packages-lint
- Lint all Node.js packagesmake packages-test
- Test all Node.js packagesmake packages-typecheck
- Typecheck all Node.js packagesmake packages-clean
- Clean all Node.js packages
Bulk Rust Crate Operations:
make crates-build
- Build all Rust cratesmake crates-format
- Format all Rust cratesmake crates-lint
- Lint all Rust cratesmake crates-clean
- Clean all Rust cratesmake crates-docs
- Generate docs for all Rust crates
Individual Package Commands:
Each package has individual commands available in the format
pkg-{name}-{action}
and crate-{name}-{action}
:
- Node.js packages: unplugin, nextjs, webpack, rollup, postcss, jest, design, playwright, eslint, typescript
- Rust crates: compiler, shared, resolver, parser
- Available actions: build, lint, test, typecheck, clean (for Node.js) / build, format, lint, clean, docs (for Rust)
Examples:
make pkg-unplugin-build
- Build unplugin packagemake pkg-webpack-lint
- Lint webpack plugin packagemake crate-compiler-format
- Format Rust compiler cratemake crate-shared-docs
- Generate docs for shared crate
If you prefer to use the tools directly:
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Run visual regression tests
pnpm test:visual
# Lint code
pnpm lint
# Check lint
pnpm lint:check
# Format code
pnpm format
# Check format
pnpm format:check
# Typecheck code
pnpm typecheck
Contributions are welcome! Please read our contributing guidelines and submit pull requests to the develop
branch.
MIT Licensed. See LICENSE for details.