next.js/Cargo.toml
Cargo.toml372 lines11.8 KB
[workspace]
resolver = "2"

members = [
  "scripts/send-trace-to-jaeger",
  "crates/next-napi-bindings",
  "crates/wasm",
  "crates/next-api",
  "crates/next-build-test",
  "crates/next-build",
  "crates/next-code-frame",
  "crates/next-core",
  "crates/next-custom-transforms",
  "crates/next-taskless",
  "turbopack/crates/*",
  "turbopack/crates/*/fuzz",
  "turbopack/xtask",
]

exclude = [
  "crates/next-error-code-swc-plugin",
  "rspack/crates/binding"
]

[workspace.lints.clippy]
too_many_arguments = "allow"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
  'cfg(rust_analyzer)',
  'cfg(fuzzing)',
  'cfg(codspeed)',
] }

[profile.dev]
# https://kobzol.github.io/rust/rustc/2025/05/20/disable-debuginfo-to-improve-rust-compile-times.html
debug = "line-tables-only"

# This crate is particularly sensitive to compiler optimizations
[profile.dev.package.turbo-persistence]
opt-level = 1

# Set the options for dependencies (not crates in the workspace), this mostly impacts cold builds
[profile.dev.package."*"]
opt-level = 1

# Set the settings for build scripts and proc-macros.
[profile.dev.build-override]
opt-level = 3

[profile.dev-with-debug]
inherits = "dev"
debug = true

[profile.release]
lto = "thin"
# codegen-units=1 disables intra-crate parallelism so LLVM sees each crate as a
# single module, enabling better inlining and identical-function deduplication
# within each crate. Combined with share-generics (which avoids duplicating
# monomorphized generics across crates) and thin LTO (which deduplicates across
# crate boundaries), this minimizes overall function duplication in the binary.
#
# https://github.com/davidlattimore/duplicate-function-checker suggests that fat LTO +
# share-generics + codegen-units = 1 is the best way to reduce overall function
# duplication in the binary, and by extension, size. We only do thin LTO, but
# this _should_ have similar effect to fat LTO.
codegen-units = 1

# Use a custom profile for CI or local testing where we are somewhat performance
# sensitive but we still want the additional validation of debug-assertions.
#
# This is not suitable for benchmarking, as debug assertions worsen performance
# and we disable LTO.
[profile.release-with-assertions]
inherits = "release"
debug-assertions = true
overflow-checks = true
# Thin-LTO can make the binary ~5-10% faster, but it can make our build take a
# couple more minutes, so it's not worth it for most test scenarios.
lto = false
# More codegen units = faster compilation. Without LTO there's no cross-CGU
# optimization recovery, but this profile prioritizes build speed over perf.
codegen-units = 64

[profile.release-with-debug]
inherits = "release"
debug = true

# Size-optimized crates: determined via `cargo bloat --release --crates -p next-napi-bindings`.
# Wasmtime/cranelift crates are used by the SWC plugin transform system.
[profile.release.package.browserslist-rs]
opt-level = "s"

[profile.release.package.cranelift-codegen]
opt-level = "s"

[profile.release.package.handlebars]
opt-level = "s"

[profile.release.package.lightningcss]
opt-level = "s"

[profile.release.package.lightningcss-napi]
opt-level = "s"

[profile.release.package.markdown]
opt-level = "s"

[profile.release.package.mdxjs]
opt-level = "s"

[profile.release.package.regalloc2]
opt-level = "s"

[profile.release.package.regex-syntax]
opt-level = "s"

[profile.release.package.reqwest]
opt-level = "s"

[profile.release.package.styled_jsx]
opt-level = "s"

[profile.release.package.swc_css_prefixer]
opt-level = "s"

[profile.release.package.swc_ecma_compat_bugfixes]
opt-level = "s"

[profile.release.package.swc_ecma_compat_es2015]
opt-level = "s"

[profile.release.package.swc_ecma_compat_es2022]
opt-level = "s"

[profile.release.package.swc_ecma_preset_env]
opt-level = "s"

[profile.release.package.swc_ecma_transforms_module]
opt-level = "s"

[profile.release.package.swc_ecma_transforms_proposal]
opt-level = "s"

[profile.release.package.swc_plugin_backend_wasmtime]
opt-level = "s"

[profile.release.package.swc_plugin_runner]
opt-level = "s"

[profile.release.package.wasmtime]
opt-level = "s"

[profile.release.package.wasmtime-internal-cranelift]
opt-level = "s"

[workspace.dependencies]
# Workspace crates
next-api = { path = "crates/next-api" }
next-build = { path = "crates/next-build" }
next-code-frame = { path = "crates/next-code-frame" }
next-core = { path = "crates/next-core" }
next-custom-transforms = { path = "crates/next-custom-transforms", default-features = false }
next-taskless = { path = "crates/next-taskless" }

# Turbopack
auto-hash-map = { path = "turbopack/crates/turbo-tasks-auto-hash-map" }
turbo-bincode = { path = "turbopack/crates/turbo-bincode" }
turbo-dyn-eq-hash = { path = "turbopack/crates/turbo-dyn-eq-hash" }
turbo-esregex = { path = "turbopack/crates/turbo-esregex" }
turbo-frozenmap = { path = "turbopack/crates/turbo-frozenmap" }
turbo-persistence = { path = "turbopack/crates/turbo-persistence" }
turbo-prehash = { path = "turbopack/crates/turbo-prehash" }
turbo-rcstr = { path = "turbopack/crates/turbo-rcstr" }
turbo-tasks = { path = "turbopack/crates/turbo-tasks" }
turbo-tasks-backend = { path = "turbopack/crates/turbo-tasks-backend" }
turbo-tasks-bytes = { path = "turbopack/crates/turbo-tasks-bytes" }
turbo-tasks-env = { path = "turbopack/crates/turbo-tasks-env" }
turbo-tasks-fetch = { path = "turbopack/crates/turbo-tasks-fetch" }
turbo-tasks-fs = { path = "turbopack/crates/turbo-tasks-fs" }
turbo-tasks-hash = { path = "turbopack/crates/turbo-tasks-hash" }
turbo-tasks-macros = { path = "turbopack/crates/turbo-tasks-macros" }
turbo-tasks-malloc = { path = "turbopack/crates/turbo-tasks-malloc", default-features = false }
turbo-tasks-testing = { path = "turbopack/crates/turbo-tasks-testing" }
turbo-unix-path = { path = "turbopack/crates/turbo-unix-path" }
turbopack = { path = "turbopack/crates/turbopack" }
turbopack-bench = { path = "turbopack/crates/turbopack-bench" }
turbopack-nodejs = { path = "turbopack/crates/turbopack-nodejs" }
turbopack-cli-utils = { path = "turbopack/crates/turbopack-cli-utils" }
turbopack-core = { path = "turbopack/crates/turbopack-core" }
turbopack-create-test-app = { path = "turbopack/crates/turbopack-create-test-app" }
turbopack-css = { path = "turbopack/crates/turbopack-css" }
turbopack-analyze = { path = "turbopack/crates/turbopack-analyze" }
turbopack-browser = { path = "turbopack/crates/turbopack-browser" }
turbopack-dev-server = { path = "turbopack/crates/turbopack-dev-server" }
turbopack-ecmascript = { path = "turbopack/crates/turbopack-ecmascript" }
turbopack-ecmascript-plugins = { path = "turbopack/crates/turbopack-ecmascript-plugins", default-features = false }
turbopack-ecmascript-runtime = { path = "turbopack/crates/turbopack-ecmascript-runtime" }
turbopack-ecmascript-hmr-protocol = { path = "turbopack/crates/turbopack-ecmascript-hmr-protocol" }
turbopack-env = { path = "turbopack/crates/turbopack-env" }
turbopack-image = { path = "turbopack/crates/turbopack-image" }
turbopack-mdx = { path = "turbopack/crates/turbopack-mdx" }
turbopack-node = { path = "turbopack/crates/turbopack-node", default-features = false }
turbopack-resolve = { path = "turbopack/crates/turbopack-resolve" }
turbopack-static = { path = "turbopack/crates/turbopack-static" }
turbopack-swc-utils = { path = "turbopack/crates/turbopack-swc-utils" }
turbopack-test-utils = { path = "turbopack/crates/turbopack-test-utils" }
turbopack-trace-server = { path = "turbopack/crates/turbopack-trace-server" }
turbopack-trace-utils = { path = "turbopack/crates/turbopack-trace-utils" }
turbopack-wasm = { path = "turbopack/crates/turbopack-wasm" }

# SWC crates
swc_core = { version = "65.0.3", default-features = false, features = [
  "ecma_loader_lru",
  "ecma_loader_parking_lot",
  "parallel_rayon",
] }

swc_plugin_backend_wasmtime = "9.0.0"
testing = "22.0.0"

# Keep consistent with preset_env_base through swc_core
browserslist-rs = "0.19.0"
mdxjs = "1.0.3"
modularize_imports = "4.0.0"
styled_components = "4.0.0"
styled_jsx = "4.0.0"
swc_emotion = "4.0.0"
swc_relay = "4.0.0"
react_remove_properties = "4.0.0"
remove_console = "4.0.0"
preset_env_base = "7.0.0"


# General Deps
chromiumoxide = { version = "0.5.4", features = [
  "tokio-runtime",
], default-features = false }
# For matching on errors from chromiumoxide. Keep in
# sync with chromiumoxide's tungstenite requirement.
tungstenite = "0.20.1"

# flate2_zlib requires zlib, use flate2_rust
allsorts = { version = "0.14.0", default-features = false, features = [
  "flate2_rust",
] }
anyhow = "1.0.100"
async-trait = "0.1.64"
bincode = { version = "2.0.1", features = ["serde"] }
bitfield = "0.19.4"
byteorder = "1.5.0"
bytes = "1.11.1"
bytes-str = "0.2.7"
chrono = "0.4.23"
clap = { version = "4.5.2", features = ["derive"] }
concurrent-queue = "2.5.0"
console-subscriber = "0.4.1"
const_format = "0.2.30"
crc32fast = "1.5.0"
criterion = { package = "codspeed-criterion-compat", version = "4.3.0" }
ctor = "0.10"
crossbeam-channel = "0.5.8"
crossbeam-utils = "0.8"
dashmap = "6.1.0"
data-encoding = "2.3.3"
dhat = { version = "0.3.2" }
dunce = "1.0.3"
either = "1.15.0"
erased-serde = "0.4.5"
flate2 = "1.0.28"
futures = "0.3.31"
futures-retry = "0.6.0"
futures-util = "0.3.31"
hashbrown = "0.14.5"
image = { version = "0.25.8", default-features = false }
indexmap = "2.13.0"
indoc = "2.0.0"
inventory = "0.3.21"
itertools = "0.10.5"
lightningcss = { version = "1.0.0-alpha.70", features = [
  "serde",
  "visitor",
  "into_owned",
  "browserslist",
] }
lightningcss-napi = { version = "0.4.6", default-features = false, features = [
  "visitor",
] }
lzzzz = "2.0.0"
markdown = "1.0.0-alpha.18"
memchr = "2.8.0"
mime = "0.3.16"
napi = { version = "2", default-features = false, features = [
  "napi3",
  "serde-json",
  "tokio_rt",
  "error_anyhow",
  # Lightningcss uses this features
  "napi4",
  "napi5",
  "compat-mode",
] }
napi-derive = "2"
napi-build = "2"
nohash-hasher = "0.2.0"
notify = "8.1.0"
owo-colors = "4.2.2"
parcel_selectors = "0.28.2"
parking_lot = "0.12.1"
pathdiff = "0.2.1"
phf = { version = "0.11", features = ["macros"] }
petgraph = "0.8.3"
pin-project-lite = "0.2.17"
postcard = "1.0.4"
proc-macro2 = "1.0.79"
qstring = "0.7.2"
quick_cache = { version = "0.6.14" }
quote = "1.0.45"
rand = "0.10.1"
rayon = "1.10.0"
regex = "1.12.3"
regress = "0.10.4"
reqwest = { version = "0.13.2", default-features = false }
ringmap = "0.2.5"
roaring = "0.11.4"
rstest = "0.16.0"
rustc-hash = "2.1.1"
semver = "1.0.16"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
serde_path_to_error = "0.1.20"
serde_qs = "1.1.1"
serde_with = "3.18.0"
sha2 = "0.10.2"
smallvec = { version = "1.15.1", features = [
  "serde",
  "const_generics",
  "union",
  "const_new",
  "impl_bincode",
] }
shrink-to-fit = "0.2.10"
strsim = "0.11.1"
swc_sourcemap = "10.0.2"
syn = "2.0.100"
tempfile = "3.20.0"
terminal_size = "0.3.0"
thiserror = "1.0.48"
thread_local = "1.1.8"
tokio = "1.52.1"
tokio-util = { version = "0.7.18", features = ["io", "rt"] }
tracing = "0.1.44"
tracing-subscriber = "0.3.16"
triomphe = { git = "https://github.com/sokra/triomphe", branch = "sokra/unstable" }
xxhash-rust = { version = "0.8.12", features = ["xxh3"] }
unsize = "1.1.0"
unty = "0.0.4"
url = "2.2.2"
urlencoding = "2.1.2"
uuid = "1.18.1"
vergen = { version = "9.0.6", features = ["cargo"] }
vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
webbrowser = "1.0.6"

[patch.crates-io]
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" }
# We have to very frequently bump the swc major version of mdxjs-rs
mdxjs = { git = "https://github.com/vercel-labs/mdxjs-rs-turbopack.git", branch = "turbopack" }
# Doesn't compile on recent nightly versions because of https://github.com/Michael-F-Bryan/include_dir/pull/117
include_dir = { git = "https://github.com/vercel-labs/include_dir", branch = "turbopack" }
Quest for Codev2.0.0
/
SIGN IN