Crates
Layers
We can split the crates into the following layers:
graph TB cli_utils[CLI Utils] Tools --> Facade CLI --> Facade & cli_utils Facade --> Output & Modules & Utils & Core Modules & Output --> Core & Utils Utils --> Core
Core
There crates are the core of turbopack, providing the basic traits and types. This e. g. handles issue reporting, resolving and environments.
turbopack-core
: Core types and traitsturbopack-resolve
: Specific resolving implementations
Utils
These crates provide utility functions and types that are used throughout the project.
turbopack-swc-utils
: SWC helpers that are shared between ecmascript and cssturbopack-node
: Node.js pool processing, webpack loaders, postcss transformturbopack-env
: .env file loading
Modules
These crates provide implementations of various module types.
turbopack-ecmascript
: The ecmascript module type (JavaScript, TypeScript, JSX), Tree Shakingturbopack-ecmascript-plugins
: Common ecmascript transforms (styled-components, styled-jsx, relay, emotion, etc.)turbopack-css
: The CSS module type (CSS, CSS Modules, SWC, lightningcss)turbopack-json
: The JSON module typeturbopack-static
: The static module type (images, fonts, etc.)turbopack-image
: Image processing (metadata, optimization, blur placeholder)turbopack-wasm
: The WebAssembly module typeturbopack-mdx
: The mdx module type
Output
These crates provide implementations of various output formats.
turbopack-browser
: Output format for the browser target, HMRturbopack-nodejs
: Output format for the Node.js targetturbopack-ecmascript-runtime
: The runtime code for bundlesturbopack-ecmascript-hmr-protocol
: The Rust side of the HMR protocol
Facade
These crates provide the facade to use Turbopack. They combine the different modules and output formats into presets and handle the default module rules.
turbopack-binding
: A crate reexporting all Turbopack crates for consumption in other projectsturbopack
: The main facade bundling all module types and rules when to apply them, presets for resolving and module processing
CLI
These crates provide the standalong CLI and the dev server.
turbopack-cli
: The Turbopack CLIturbopack-dev-server
: The on demand dev server implementation
CLI Utils
These crates provide utility functions for the CLI.
turbopack-cli-utils
: Helper functions for CLI toolingturbopack-trace-utils
: Helper function for tracing
Tools
These crates provide tools to test, benchmark and trace Turbopack.
turbopack-bench
: The Turbopack benchmarkturbopack-tests
: Integration tests for Turbopackturbopack-create-test-app
: A CLI to create a test application with configurable number of modulesturbopack-swc-ast-explorer
: A CLI tool to explore the SWC ASTturbopack-test-utils
: Helpers for testingturbopack-trace-server
: A CLI to open a trace file and serve it in the browser