Skip to content

Commit

Permalink
Revert "feat(next-swc): Implement CJS optimizer" (vercel#50247)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored May 24, 2023
1 parent fce5fa6 commit 6ebc725
Show file tree
Hide file tree
Showing 24 changed files with 8 additions and 452 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ plugin = ["turbopack-binding/__swc_core_binding_napi_plugin"]

[dependencies]
chrono = "0.4"
convert_case = "0.5.0"
easy-error = "1.0.0"
either = "1"
fxhash = "0.2.1"
Expand All @@ -18,7 +17,6 @@ once_cell = { workspace = true }
next-transform-font = {workspace = true}
pathdiff = "0.2.0"
regex = "1.5"
rustc-hash = "1"
serde = "1"
serde_json = "1"
sha1 = "0.10.1"
Expand Down
279 changes: 0 additions & 279 deletions packages/next-swc/crates/core/src/cjs_optimizer.rs

This file was deleted.

16 changes: 1 addition & 15 deletions packages/next-swc/crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,14 @@ use fxhash::FxHashSet;
use next_transform_font::next_font_loaders;
use serde::Deserialize;
use turbopack_binding::swc::core::{
common::{
chain, comments::Comments, pass::Optional, FileName, Mark, SourceFile, SourceMap,
SyntaxContext,
},
common::{chain, comments::Comments, pass::Optional, FileName, SourceFile, SourceMap},
ecma::{
ast::EsVersion, parser::parse_file_as_module, transforms::base::pass::noop, visit::Fold,
},
};

pub mod amp_attributes;
mod auto_cjs;
pub mod cjs_optimizer;
pub mod disallow_re_export_all_in_page;
pub mod next_dynamic;
pub mod next_ssg;
Expand Down Expand Up @@ -129,9 +125,6 @@ pub struct TransformOptions {

#[serde(default)]
pub server_actions: Option<server_actions::Config>,

#[serde(default)]
pub cjs_require_optimizer: Option<cjs_optimizer::Config>,
}

pub fn custom_before_pass<'a, C: Comments + 'a>(
Expand All @@ -140,7 +133,6 @@ pub fn custom_before_pass<'a, C: Comments + 'a>(
opts: &'a TransformOptions,
comments: C,
eliminated_packages: Rc<RefCell<FxHashSet<String>>>,
unresolved_mark: Mark,
) -> impl Fold + 'a
where
C: Clone,
Expand Down Expand Up @@ -285,12 +277,6 @@ where
)),
None => Either::Right(noop()),
},
match &opts.cjs_require_optimizer {
Some(config) => {
Either::Left(cjs_optimizer::cjs_optimizer(config.clone(), SyntaxContext::empty().apply_mark(unresolved_mark)))
},
None => Either::Right(noop()),
},
)
}

Expand Down
Loading

0 comments on commit 6ebc725

Please sign in to comment.