import { type ConstraintFactory } from '../utils'; /** * Configuration options for defining constraints on peer dependencies. */ export interface PeerDependenciesConstraintOptions { /** * Indicates whether private workspaces can have peer dependencies. */ readonly allowPrivates?: boolean; /** * Glob patterns of direct dependencies whose `peerDependencies` should be * propagated to the dependant workspace. * * If a workspace (A) depends on a package (B) whose name matches any pattern * in this list, then all peerDependencies declared by B will be ensured on A. * For example, if A depends on `package-B`, B has a peer dependency C, and * `autoImportFrom` is `['package-*']`, then A will be made to declare C as dependency as well. * * Behavior: * - When B is a "dependencies" entry of A, B's peerDependencies are added to * A's "dependencies" (if not already present) and removed from A's * "devDependencies". * - Otherwise (e.g., B is only a devDependency), B's peerDependencies are * added to A's "devDependencies" if missing. * * Patterns use micromatch-style globs. This list augments built-in matchers * used by the constraint (e.g., scoped workspace wildcard, common presets). * * @example * // Propagate peers from any package starting with "package-" * autoImportFrom: ['package-*'] * @example * // Propagate peers from all packages within a scope * autoImportFrom: ['@my-scope/*'] */ readonly autoImportFrom?: string[]; } /** * Factory function to create a peer dependencies constraint for Yarn workspaces. * This constraint ensures proper handling of peer dependencies in relation to other dependency types across workspaces, * while also considering options for private packages and auto-import rules. * * @param options - Configuration options for the constraint. These include: * - `allowPrivates`: A boolean indicating whether private workspaces are allowed to have peer dependencies. Defaults to `false`. * - `autoImportFrom`: An array of glob patterns specifying auto-import rules for peer dependencies. Defaults to an empty array. * @returns A function that defines the peer dependencies constraint logic. This function acts on Yarn dependency graphs to enforce consistency between peer dependencies, workspace-level dependencies, private workspace handling, and automatic peer dependency propagation from specific dependencies. * * ### Behavior: * 1. Ensures that private packages (if `allowPrivates` is `false`) do not have peer dependencies. * 2. Eliminates duplicate dependencies that are redundantly specified in both `dependencies` and `peerDependencies` for the same workspace. * 3. Handles auto-importing of peer dependencies based on the specified `autoImportFrom` patterns and the project's scope. * 4. Automatically ensures that required peer dependencies are included in appropriate workspaces, propagating them as needed to meet constraints. */ export declare const createPeerDependenciesConstraint: ConstraintFactory; //# sourceMappingURL=peer.d.ts.map