Thank you for your interest in contributing to Utoo! This document provides a guide for setting up your development environment and working on the project.
Utoo is a unified toolchain composed of several key layers:
- Core (Rust): The high-performance engine.
crates/pm: Theutoopackage manager (aliasut).crates/pack-core: The bundler core, built on Turbopack.
- Bindings: Bridging Rust to other environments.
crates/pack-napi: Node.js bindings for the bundler.crates/utoo-wasm: WebAssembly bindings for browser usage.
- Packages (TypeScript): User-facing tools and APIs.
@utoo/pack: The main bundler library.@utoo/pack-cli: TheutoopackCLI.@utoo/web: The browser-compatible toolchain.
Before you begin, ensure you have the following installed:
-
Node.js: Version 20 or higher.
-
npm: Version 10 or higher (managed via
packageManagerinpackage.json). -
Rust: We use a specific nightly version defined in rust-toolchain.toml. It will be automatically installed when running Cargo commands.
-
wasm-bindgen-cli: Required for building the web version.
Install:
cargo install [email protected]
-
typos: Spell checker for code and docs, used in pre-push git hook.
Install:
cargo install typos-cli --lockedorbrew install typos-cli. Config: .typos.toml -
LLVM (macOS only): Required to build
utoo-wasmon macOS for@utoo/web. The dependencylibmimalloc-syscompiles C code towasm32-unknown-unknown; Apple Clang does not support that target.Install:
brew install llvm
Then add the following to your shell config (e.g.
~/.zshrcor~/.bash_profile) to ensure the build uses clang from Homebrew:export PATH="$(brew --prefix llvm)/bin:$PATH" export CC="$(brew --prefix llvm)/bin/clang" export AR="$(brew --prefix llvm)/bin/llvm-ar"
Restart the terminal or run
source ~/.zshrc(or your config file) for the changes to take effect.
Utoo leverages a fork of Next.js to access and modify Turbopack crates.
-
Initialize Submodules: If you haven't cloned with
--recursive, run:git submodule update --init --recursive
-
Next.js Integration: The
next.jsfolder is a git submodule pointing toutooland/next.js. Many Rust crates incrates/depend on Turbopack crates located within this submodule (e.g.,next.js/turbopack/crates/turbo-tasks).
Important
When updating dependencies in Cargo.toml that reference the submodule, verify that the specified path remains valid within the submodule.
-
Clone the repository:
git clone https://github.com/utooland/utoo.git cd utoo -
Install dependencies:
npm install
We use Turborepo to manage tasks across the monorepo.
To build all packages and crates:
npm run build
# or
npx turbo run buildTo build a specific package (e.g., @utoo/pack):
npx turbo run build --filter=@utoo/packTo start the development server (primarily for @utoo/web and examples):
npm run devWe have both Rust and JavaScript tests.
# Run all tests
npm run test
# Run Rust tests only
cargo test
# Run PM tests
cargo test -p utoo-pm
# Run Pack tests
cargo test -p pack-tests
# Update Pack tests snapshots
UPDATE=1 cargo test -p pack-tests
# Run PM E2E tests
./e2e/utoo-pm.sh- Create a Branch: Use a descriptive name like
feat/awesome-featureorfix/bug-id. - Commit Messages: Follow Conventional Commits. Use scopes like
pm,pack, orwasm(e.g.,feat(pack): add new loader). - Lint & Format: Run
npm run biomebefore committing. - Open a PR: Provide a clear description of your changes and link any related issues.
crates/: Rust source code for the core logic and native extensions.pack-core: Core bundler logic based on Turbopack.pm: Theutoopackage manager implementation.pack-napi: Node.js bindings via NAPI-RS.utoo-wasm: WebAssembly bindings for web usage.
packages/: Node.js packages.@utoo/pack: The main bundler package, including the Webpack compatibility layer.@utoo/pack-cli: Command-line interface for the bundler.@utoo/pack-shared: Shared utilities and types.@utoo/web: Web-compatible version of the toolchain.
next.js/: Git submodule containing the Turbopack source code used by the core.examples/: Example projects to test and demonstrate features.
Releases are managed via GitHub Actions.
pack-release.yml: Releases@utoo/pack,@utoo/pack-cli, and@utoo/pack-shared.utooweb-release.yml: Releases@utoo/web.
By contributing, you agree that your contributions will be licensed under the MIT License.