Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(es/minifier): Update examples code #8652

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/swc_ecma_minifier/examples/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ use swc_ecma_minifier::{
option::{ExtraOptions, MinifyOptions},
};
use swc_ecma_parser::parse_file_as_module;
use swc_ecma_transforms_base::{fixer::fixer, resolver};
use swc_ecma_transforms_base::{
fixer::{fixer, paren_remover},
resolver,
};
use swc_ecma_visit::FoldWith;

fn main() {
Expand All @@ -40,6 +43,7 @@ fn main() {
err.into_diagnostic(&handler).emit();
})
.map(|module| module.fold_with(&mut resolver(unresolved_mark, top_level_mark, false)))
.map(|module| module.fold_with(&mut paren_remover(None)))
.unwrap();

let output = optimize(
Expand Down
6 changes: 5 additions & 1 deletion crates/swc_ecma_minifier/examples/minifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use swc_ecma_minifier::{
option::{ExtraOptions, MangleOptions, MinifyOptions},
};
use swc_ecma_parser::parse_file_as_module;
use swc_ecma_transforms_base::{fixer::fixer, resolver};
use swc_ecma_transforms_base::{
fixer::{fixer, paren_remover},
resolver,
};
use swc_ecma_visit::FoldWith;

fn main() {
Expand All @@ -37,6 +40,7 @@ fn main() {
err.into_diagnostic(&handler).emit();
})
.map(|module| module.fold_with(&mut resolver(unresolved_mark, top_level_mark, false)))
.map(|module| module.fold_with(&mut paren_remover(None)))
.unwrap();

let output = optimize(
Expand Down
6 changes: 5 additions & 1 deletion crates/swc_ecma_minifier/examples/minify-all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use swc_ecma_minifier::{
option::{ExtraOptions, MangleOptions, MinifyOptions},
};
use swc_ecma_parser::parse_file_as_module;
use swc_ecma_transforms_base::{fixer::fixer, resolver};
use swc_ecma_transforms_base::{
fixer::{fixer, paren_remover},
resolver,
};
use swc_ecma_visit::FoldWith;
use walkdir::WalkDir;

Expand Down Expand Up @@ -52,6 +55,7 @@ fn main() {
false,
))
})
.map(|module| module.fold_with(&mut paren_remover(None)))
.unwrap();

let output = optimize(
Expand Down