Skip to content

Commit aa16117

Browse files
authored
Introduce "bundler" feature flag (parcel-bundler#358)
This commit adds a "bundler" feature flag to the lightningcss crate. We put the "dashmap" and "rayon" dependencies behind this new flag. Users that do not need the bundler can now disable the feature to save on compile time. Related: parcel-bundler#357
1 parent 33febb4 commit aa16117

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Cargo.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ name = "lightningcss"
2626
path = "src/lib.rs"
2727
crate-type = ["rlib"]
2828

29+
[features]
30+
default = ["bundler", "grid"]
31+
browserslist = ["browserslist-rs"]
32+
bundler = ["dashmap", "rayon"]
33+
cli = ["clap", "serde_json", "browserslist", "jemallocator"]
34+
grid = []
35+
serde = ["smallvec/serde", "cssparser/serde"]
36+
2937
[dependencies]
3038
serde = { version = "1.0.123", features = ["derive"] }
3139
cssparser = "0.29.1"
@@ -41,8 +49,8 @@ pathdiff = "0.2.1"
4149
# CLI deps
4250
clap = { version = "3.0.6", features = ["derive"], optional = true }
4351
browserslist-rs = { version = "0.7.0", optional = true }
44-
rayon = "1.5.1"
45-
dashmap = "5.0.0"
52+
rayon = { version = "1.5.1", optional = true }
53+
dashmap = { version = "5.0.0", optional = true }
4654
serde_json = { version = "1.0.78", optional = true }
4755
lightningcss-derive = { version = "1.0.0-alpha.35", path = "./derive" }
4856

@@ -56,13 +64,6 @@ assert_fs = "1.0"
5664
predicates = "2.1"
5765
serde_json = "1"
5866

59-
[features]
60-
default = ["grid"]
61-
browserslist = ["browserslist-rs"]
62-
cli = ["clap", "serde_json", "browserslist", "jemallocator"]
63-
grid = []
64-
serde = ["smallvec/serde", "cssparser/serde"]
65-
6667
[[test]]
6768
name = "cli_integration_tests"
6869
path = "tests/cli_integration_tests.rs"

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#![deny(missing_docs)]
1818

19+
#[cfg(feature = "bundler")]
1920
pub mod bundler;
2021
mod compat;
2122
mod context;

0 commit comments

Comments
 (0)