Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(css/compat): Add Compiler #6626

Merged
merged 9 commits into from Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/swc_css_compat/Cargo.toml
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions crates/swc_css_compat/src/compiler/custom_media.rs
@@ -0,0 +1 @@

26 changes: 26 additions & 0 deletions 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 {}
7 changes: 7 additions & 0 deletions crates/swc_css_compat/src/feature.rs
@@ -0,0 +1,7 @@
use bitflags::bitflags;

bitflags! {
pub struct Features: u64 {
const NESTING = 0b00000001;
}
}
2 changes: 2 additions & 0 deletions 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;