pub fn minimize_exports(
    module: &mut Module,
    is_root: impl Fn(&ExportKey) -> bool
)
Expand description

Remove exports which aren’t “roots” (is_root(export_key) returns false), and which aren’t otherwise kept alive by a “root” (through Import::LinkName declarations, with name matching ExportKey::LinkName), either directly or transitively (including through any number of imports).

In essence, other than the “root” exports, minimize_exports only keeps the exports that resolve_imports would use, and is recommended to first call minimize_exports before using resolve_imports, to reduce work.

Note that the “dead” definitions are not removed from the module, and any external references to them could still be used (e.g. from a clone of the module.exports map, before calling minimize_exports).