Skip to content

Commit

Permalink
refactor(transformer): improve encapsulation of transforms (#7888)
Browse files Browse the repository at this point in the history
Modules in `oxc_transformer` only export the minimum required, to make the transforms less tightly coupled to each other.
  • Loading branch information
overlookmotel committed Dec 14, 2024
1 parent 98d7946 commit 2c94236
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/common/arrow_function_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ impl<'a> ArrowFunctionConverter<'a> {

/// Transforms a `MemberExpression` whose object is a `super` expression.
///
/// In the [`AsyncToGenerator`](crate::es2017::async_to_generator::AsyncToGenerator) and
/// [`AsyncGeneratorFunctions`](crate::es2018::async_generator_functions::AsyncGeneratorFunctions) plugins,
/// In the [`AsyncToGenerator`](crate::es2017::AsyncToGenerator) and
/// [`AsyncGeneratorFunctions`](crate::es2018::AsyncGeneratorFunctions) plugins,
/// we move the body of an async method to a new generator function. This can cause
/// `super` expressions to appear in unexpected places, leading to syntax errors.
///
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_transformer/src/es2017/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pub(crate) mod async_to_generator;
mod async_to_generator;
mod options;

pub use async_to_generator::AsyncGeneratorExecutor;
pub use async_to_generator::{AsyncGeneratorExecutor, AsyncToGenerator};
pub use options::ES2017Options;
use oxc_ast::ast::{Expression, Function, Statement};
use oxc_traverse::{Traverse, TraverseCtx};

use crate::{es2017::async_to_generator::AsyncToGenerator, TransformCtx};
use crate::TransformCtx;

#[allow(dead_code)]
pub struct ES2017<'a, 'ctx> {
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/es2018/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub(crate) mod async_generator_functions;
mod async_generator_functions;
mod object_rest_spread;
mod options;

use async_generator_functions::AsyncGeneratorFunctions;
pub use async_generator_functions::AsyncGeneratorFunctions;
pub use object_rest_spread::{ObjectRestSpread, ObjectRestSpreadOptions};
pub use options::ES2018Options;
use oxc_ast::ast::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/es2020/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod nullish_coalescing_operator;
mod optional_chaining;
mod options;

pub use nullish_coalescing_operator::NullishCoalescingOperator;
use nullish_coalescing_operator::NullishCoalescingOperator;
pub use optional_chaining::OptionalChaining;
pub use options::ES2020Options;
use oxc_ast::ast::*;
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/jsx/jsx_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ use oxc_syntax::{
};
use oxc_traverse::{BoundIdentifier, Traverse, TraverseCtx};

use super::diagnostics;
pub use super::{
use super::{
diagnostics,
jsx_self::JsxSelf,
jsx_source::JsxSource,
options::{JsxOptions, JsxRuntime},
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/jsx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ mod jsx_source;
mod options;
mod refresh;
pub(crate) use comments::update_options_with_comments;
pub use display_name::ReactDisplayName;
pub use jsx_impl::JsxImpl;
use display_name::ReactDisplayName;
use jsx_impl::JsxImpl;
use jsx_self::JsxSelf;
pub use options::{JsxOptions, JsxRuntime, ReactRefreshOptions};
use refresh::ReactRefresh;
Expand Down

0 comments on commit 2c94236

Please sign in to comment.