Skip to content

Commit

Permalink
chore: 🤖 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Aug 19, 2024
1 parent 0b69dfd commit ebd34df
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crates/oxc_minifier/src/plugins/replace_global_defines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl ReplaceGlobalDefinesConfig {
identifier_defines.push((CompactStr::new(key), CompactStr::new(value)));
}
IdentifierType::DotDefines { parts, postfix_wildcard } => {
dbg!(&parts, postfix_wildcard);
dot_defines.push(DotDefine::new(
parts,
CompactStr::new(value),
Expand All @@ -77,7 +76,7 @@ impl ReplaceGlobalDefinesConfig {
dot_defines.sort_by(|a, b| {
if !a.postfix_wildcard && b.postfix_wildcard {
Ordering::Less
} else if (a.postfix_wildcard && b.postfix_wildcard) {
} else if a.postfix_wildcard && b.postfix_wildcard {
Ordering::Greater
} else {
Ordering::Equal
Expand Down Expand Up @@ -173,9 +172,7 @@ impl<'a> ReplaceGlobalDefines<'a> {
fn replace_dot_defines(&mut self, expr: &mut Expression<'a>) {
if let Expression::StaticMemberExpression(member) = expr {
for dot_define in &self.config.0.dot_defines {
let ret = Self::is_dot_define(dot_define, member);
println!("-----------------");
if ret {
if Self::is_dot_define(dot_define, member) {
let value = self.parse_value(&dot_define.value);
*expr = value;
break;
Expand All @@ -194,7 +191,6 @@ impl<'a> ReplaceGlobalDefines<'a> {
loop {
let part = &dot_define.parts[i];
let matched = cur_part_name.as_str() == part;
dbg!(&cur_part_name, part, i, matched);
if !matched {
// Considering import.meta.env.*
// ```js
Expand All @@ -218,11 +214,11 @@ impl<'a> ReplaceGlobalDefines<'a> {
match &member.object {
Expression::StaticMemberExpression(member) => {
cur_part_name = &member.property.name;
Some(StaticMemberExpressionOrMeta::StaticMemberExpression(&member))
Some(StaticMemberExpressionOrMeta::StaticMemberExpression(member))
}
Expression::MetaProperty(member) => {
cur_part_name = &member.property.name;
Some(StaticMemberExpressionOrMeta::MetaProperty(&member))
Some(StaticMemberExpressionOrMeta::MetaProperty(member))
}
Expression::Identifier(ident) => {
cur_part_name = &ident.name;
Expand Down

0 comments on commit ebd34df

Please sign in to comment.