Skip to main content

remove

Function remove 

Source
pub fn remove(
    dir: &Path,
    names: &[String],
    detail: PackumentDetail,
) -> Result<(Vec<String>, Vec<Resolved>)>
Expand description

Remove dependencies (= npm remove): drop each named dependency from package.json, rewrite the lock, and reinstall the resolved tree. Returns the names actually removed (a name absent from dependencies is skipped) and the reinstalled tree.

Pruning is sync’s job: it rewrites node_modules/ to exactly the new lockfile, so a package no longer in the tree is dropped, while one still required transitively by another dependency is kept. A removed direct dependency that remains a transitive dependency therefore stays installed, with its .bin links intact.