import type { GenericPackageJson, Package, ProjectMetadata } from '@-xun/project-types'; /** * Synchronously derive a directed graph representing the project's package * dependency topology and return said project's packages in a * topologically-ordered array. The ordering is stable; packages of the same * rank will always be returned in the same order. * * The returned array is 2-dimensional, with each index containing an array of * packages that depend upon those from the previous index. Dependency relations * between packages are determined by the presence of a package's name in the * `package.json` `dependencies` or `peerDependencies` (or, optionally, * `devDependencies`) field of another package. * * Packages that depend on themselves will have that self-referential dependency * ignored. Dependency cycles will cause this function to throw. */ export declare function sortPackagesTopologically(projectMetadata: ProjectMetadata, { includeDevDependencies, allowPrivateDependencies, skipPrivateDependencies }?: { /** * If `true`, each package's `package.json` `devDependencies` will be * included in package dependency calculations. * * @default false */ includeDevDependencies?: boolean; /** * If `false`, a package _without_ a `package.json` `private: true` field * can never depend upon another package with a `package.json` `private: * true` field. If such a relation is encountered, an error will be thrown. * * @default false */ allowPrivateDependencies?: boolean; /** * If `true`, packages with a `package.json` `private: true` field will be * skipped if no other packages in the repository depend on them. * * @default true */ skipPrivateDependencies?: boolean; }): Package[][];