feat: Use lockfiles when determining what packages changed across commits (#3250)
This PR attempts to address #2162
This PR was written to be conservative by nature and it will mark
packages as changed on almost any lockfile change that isn't just a
version bump.
Notable changes:
- Extended SCM interface as we need to be able to reconstruct old
lockfile
- Refactored calculation of the transitive closure of the package graph
so a full `Context` object isn't required
- Merged `TransitiveDeps` and `ExternalDeps` as they contained almost
identical information
I haven't been able to fully test this, but from a quick spot check of
pnpm it seems to behave as expected.
Needed testing:
- [x] Npm
- [x] Yarn
- [x] Yarn2+
- [x] Pnpm