pub fn mark_optional_packages(graph: &mut LockfileGraph)Expand description
Set each package’s optional flag the way pnpm marks the
snapshots: section: a package is optional: true when it is
reachable only through optional dependency edges (the classic case
is every @esbuild/* platform native sitting under esbuild’s
optionalDependencies). pnpm derives this during resolution; aube
recomputes it as a post-resolve pass so freshly resolved lockfiles
carry the same markers pnpm writes instead of an empty {} snapshot.
Algorithm: seed a required set from every non-optional direct
dependency of every importer, then walk each required package’s
non-optional edges. A package’s non-optional edges are its
dependencies minus its optional_dependencies, because the pnpm
parser mirrors active optional edges into dependencies. Any package
not reached this way is optional. A single fully-required path keeps a
package required even when other paths to it are optional, matching
pnpm.