chore(oxc): add features for semantic, formatter and minifier

This commit is contained in:
Boshen 2023-09-03 11:28:20 +08:00
parent 6f270f1198
commit 7bcf2d7c43
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
2 changed files with 15 additions and 15 deletions

View file

@ -15,13 +15,18 @@ categories.workspace = true
[dependencies]
oxc_allocator = { workspace = true }
oxc_ast = { workspace = true }
oxc_ast_lower = { workspace = true }
oxc_diagnostics = { workspace = true }
oxc_formatter = { workspace = true }
oxc_hir = { workspace = true }
oxc_index = { workspace = true }
oxc_minifier = { workspace = true }
oxc_parser = { workspace = true }
oxc_semantic = { workspace = true }
oxc_span = { workspace = true }
oxc_syntax = { workspace = true }
oxc_semantic = { workspace = true, optional = true }
oxc_formatter = { workspace = true, optional = true }
oxc_ast_lower = { workspace = true, optional = true }
oxc_hir = { workspace = true, optional = true }
oxc_minifier = { workspace = true, optional = true }
[features]
formatter = ["oxc_formatter"]
semantic = ["oxc_semantic"]
minifier = ["oxc_hir", "oxc_ast_lower", "oxc_minifier"]

View file

@ -12,6 +12,7 @@ pub mod ast {
pub use oxc_ast::*;
}
#[cfg(feature = "minifier")]
pub mod ast_lower {
#[doc(inline)]
pub use oxc_ast_lower::*;
@ -22,11 +23,13 @@ pub mod diagnostics {
pub use oxc_diagnostics::*;
}
#[cfg(feature = "formatter")]
pub mod formatter {
#[doc(inline)]
pub use oxc_formatter::*;
}
#[cfg(feature = "minifier")]
pub mod hir {
#[doc(inline)]
pub use oxc_hir::*;
@ -37,6 +40,7 @@ pub mod index {
pub use oxc_index::*;
}
#[cfg(feature = "minifier")]
pub mod minifier {
#[doc(inline)]
pub use oxc_minifier::*;
@ -47,6 +51,7 @@ pub mod parser {
pub use oxc_parser::*;
}
#[cfg(feature = "semantic")]
pub mod semantic {
#[doc(inline)]
pub use oxc_semantic::*;
@ -61,13 +66,3 @@ pub mod syntax {
#[doc(inline)]
pub use oxc_syntax::*;
}
#[allow(unused_imports)]
#[test]
fn import_smoke_test() {
use crate::{
allocator::Allocator, ast::ast::Program as AstProgram, ast_lower::AstLower,
diagnostics::Error, formatter::Formatter, hir::hir::Program as HirProgram, index::IndexVec,
minifier::Minifier, parser::Parser, semantic::Semantic, span::Span, syntax::NumberBase,
};
}