mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(oxc): remove remove_whitespace
This commit is contained in:
parent
1f6b107339
commit
cd9cf5efd8
3 changed files with 4 additions and 11 deletions
|
|
@ -65,10 +65,6 @@ pub trait CompilerInterface {
|
|||
Some(CodegenOptions::default())
|
||||
}
|
||||
|
||||
fn remove_whitespace(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn check_semantic_error(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
|
@ -215,9 +211,8 @@ pub trait CompilerInterface {
|
|||
options: CodegenOptions,
|
||||
) -> String {
|
||||
let comment_options = CommentOptions { preserve_annotate_comments: true };
|
||||
|
||||
CodeGenerator::new()
|
||||
.with_options(CodegenOptions { minify: self.remove_whitespace(), ..options })
|
||||
.with_options(options)
|
||||
.enable_comment(source_text, trivias.clone(), comment_options)
|
||||
.build(program)
|
||||
.source_text
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ pub struct CodegenOptions {
|
|||
/// Use single quotes instead of double quotes.
|
||||
pub single_quote: bool,
|
||||
|
||||
/// Remove whitespace.
|
||||
pub minify: bool,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,8 @@ impl CompilerInterface for Driver {
|
|||
}
|
||||
|
||||
fn codegen_options(&self) -> Option<CodegenOptions> {
|
||||
self.codegen.then(CodegenOptions::default)
|
||||
}
|
||||
|
||||
fn remove_whitespace(&self) -> bool {
|
||||
self.remove_whitespace
|
||||
self.codegen
|
||||
.then(|| CodegenOptions { minify: self.remove_whitespace, ..CodegenOptions::default() })
|
||||
}
|
||||
|
||||
fn handle_errors(&mut self, errors: Vec<OxcDiagnostic>) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue