Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions crates/oxc_mangler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,19 @@ impl<'t> Mangler<'t> {
let root_unresolved_references = scoping.root_unresolved_references();
let root_bindings = scoping.get_bindings(scoping.root_scope_id());

let mut excluded_names: FxHashSet<&str> = FxHashSet::with_capacity_and_hasher(
root_unresolved_references.len() + keep_name_names.len() + root_bindings.len(),
rustc_hash::FxBuildHasher,
);
excluded_names.extend(root_unresolved_references.keys());
excluded_names.extend(keep_name_names.iter().copied());
if self.options.top_level {
excluded_names
.extend(root_bindings.keys().filter(|&name| exported_names.contains::<str>(name)));
} else {
excluded_names.extend(root_bindings.keys());
}

let mut reserved_names = Vec::with_capacity_in(total_number_of_slots, temp_allocator);

let mut count = 0;
Expand All @@ -447,11 +460,7 @@ impl<'t> Mangler<'t> {
let n = name.as_str();
if !oxc_syntax::keyword::is_reserved_keyword(n)
&& !is_special_name(n)
&& !root_unresolved_references.contains_key(n)
&& !(root_bindings.contains_key(n)
&& (!self.options.top_level || exported_names.contains(n)))
// TODO: only skip the names that are kept in the current scope
&& !keep_name_names.contains(n)
&& !excluded_names.contains(n)
{
break name;
}
Expand Down
12 changes: 6 additions & 6 deletions tasks/track_memory_allocations/allocs_minifier.snap
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
File | File size || Sys allocs | Sys reallocs || Arena allocs | Arena reallocs | Arena bytes
-------------------------------------------------------------------------------------------------------------------------------------------
checker.ts | 2.92 MB || 83502 | 14179 || 152592 | 28237
checker.ts | 2.92 MB || 83503 | 14179 || 152592 | 28237

cal.com.tsx | 1.06 MB || 40447 | 3032 || 37138 | 4586
cal.com.tsx | 1.06 MB || 40448 | 3032 || 37138 | 4586

RadixUIAdoptionSection.jsx | 2.52 kB || 85 | 9 || 30 | 6
RadixUIAdoptionSection.jsx | 2.52 kB || 86 | 9 || 30 | 6

pdf.mjs | 567.30 kB || 20193 | 2899 || 47453 | 7730
pdf.mjs | 567.30 kB || 20194 | 2899 || 47453 | 7730

antd.js | 6.69 MB || 99534 | 13524 || 331649 | 69358
antd.js | 6.69 MB || 99535 | 13524 || 331649 | 69358

binder.ts | 193.08 kB || 4759 | 974 || 7075 | 824
binder.ts | 193.08 kB || 4760 | 974 || 7075 | 824

Loading