Skip to content

Commit

Permalink
refactor: 🎨 use take over clone
Browse files Browse the repository at this point in the history
  • Loading branch information
stormslowly committed Jan 2, 2024
1 parent 07e25a2 commit 8adfa7b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/mako/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ fn transform_js(

// preset-env and other folders must be after plugin transform
// because plugin transform may inject some code that may need syntax transform
ast.body = folders.fold_module(ast.clone()).body;

mako_core::mako_profile_scope!("take module");
let body = ast.body.take();
let module = Module {
span: ast.span,
shebang: ast.shebang.clone(),
body,
};
ast.body = folders.fold_module(module).body;

// inject helpers must after decorators
// since decorators will use helpers
Expand Down

0 comments on commit 8adfa7b

Please sign in to comment.