diff --git a/Cargo.lock b/Cargo.lock index eaab1cd4bf5a..f3aca0a54539 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3372,6 +3372,7 @@ dependencies = [ name = "swc_css_compat" version = "0.16.0" dependencies = [ + "bitflags", "once_cell", "serde", "serde_json", diff --git a/crates/swc_css_compat/Cargo.toml b/crates/swc_css_compat/Cargo.toml index 3f77dd721d87..1fe0b755d070 100644 --- a/crates/swc_css_compat/Cargo.toml +++ b/crates/swc_css_compat/Cargo.toml @@ -13,6 +13,7 @@ version = "0.16.0" bench = false [dependencies] +bitflags = "1.3.2" once_cell = "1.10.0" serde = {version = "1.0.118", features = ["derive"]} serde_json = "1.0.61" diff --git a/crates/swc_css_compat/src/compiler/custom_media.rs b/crates/swc_css_compat/src/compiler/custom_media.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/crates/swc_css_compat/src/compiler/custom_media.rs @@ -0,0 +1 @@ + diff --git a/crates/swc_css_compat/src/compiler/mod.rs b/crates/swc_css_compat/src/compiler/mod.rs new file mode 100644 index 000000000000..407da9976532 --- /dev/null +++ b/crates/swc_css_compat/src/compiler/mod.rs @@ -0,0 +1,26 @@ +use swc_css_visit::VisitMut; + +use crate::feature::Features; + +mod custom_media; + +/// Compiles a modern CSS file to a CSS file which works with old browsers. +#[derive(Debug)] +pub struct Compiler { + #[allow(unused)] + c: Config, +} + +#[derive(Debug)] +pub struct Config { + /// The list of features to **process**. + pub process: Features, +} + +impl Compiler { + pub fn new(config: Config) -> Self { + Self { c: config } + } +} + +impl VisitMut for Compiler {} diff --git a/crates/swc_css_compat/src/feature.rs b/crates/swc_css_compat/src/feature.rs new file mode 100644 index 000000000000..0d108a34f2b2 --- /dev/null +++ b/crates/swc_css_compat/src/feature.rs @@ -0,0 +1,7 @@ +use bitflags::bitflags; + +bitflags! { + pub struct Features: u64 { + const NESTING = 0b00000001; + } +} diff --git a/crates/swc_css_compat/src/lib.rs b/crates/swc_css_compat/src/lib.rs index 485214058c30..d990d98d57af 100644 --- a/crates/swc_css_compat/src/lib.rs +++ b/crates/swc_css_compat/src/lib.rs @@ -1,4 +1,6 @@ #![feature(box_patterns)] #![allow(clippy::vec_box)] +pub mod compiler; +pub mod feature; pub mod nesting;