Analyzes and deduplicates npm dependency trees.
Finds packages that appear multiple times in the lockfile (or could
be hoisted) and suggests which duplicates can be removed. This is the
logic behind mix npm.dedupe.
Summary
Functions
Finds the best version of a package that satisfies all dependents.
Finds packages in the lockfile that could potentially be deduped.
Calculates how many bytes could be saved by deduplication.
Returns a summary of the deduplication analysis.
Functions
Finds packages in the lockfile that could potentially be deduped.
Returns a list of {name, versions} where versions is a list of
version strings for packages that appear in multiple forms.
@spec savings_estimate(map()) :: %{ packages: non_neg_integer(), duplicates: non_neg_integer() }
Calculates how many bytes could be saved by deduplication.
This is an estimate based on the number of duplicate package entries.
@spec summary(map()) :: %{ total_packages: non_neg_integer(), unique_packages: non_neg_integer(), duplicate_groups: non_neg_integer(), saveable: non_neg_integer() }
Returns a summary of the deduplication analysis.