import type { CLIMain } from '@teambit/cli'; import type { ComponentMain, Component } from '@teambit/component'; import { ComponentID } from '@teambit/component'; import type { ScopeMain } from '@teambit/scope'; import type { Workspace } from '@teambit/workspace'; import type { GraphqlMain } from '@teambit/graphql'; import type { ComponentIdObj } from '@teambit/component-id'; import type { IssuesMain } from '@teambit/issues'; import type { DependencyResolverMain } from '@teambit/dependency-resolver'; export type DeprecationInfo = { isDeprecate: boolean; newId?: string; range?: string; }; export type DeprecateByPatternResult = { /** * components that were deprecated as a result of this operation. */ deprecated: ComponentID[]; /** * components that matched the pattern but were already deprecated (no changes made). */ alreadyDeprecated: ComponentID[]; }; export type UnDeprecateByPatternResult = { /** * components whose deprecation status was removed as a result of this operation. */ undeprecated: ComponentID[]; /** * components that matched the pattern but were not deprecated (no changes made). */ notDeprecated: ComponentID[]; }; export type DeprecationMetadata = { /** * whether the head is deprecated */ deprecate?: boolean; /** * the new id to use instead of the current one */ newId?: ComponentIdObj; /** * Semver range to deprecate previous versions */ range?: string; }; export declare class DeprecationMain { private scope; private workspace; private depsResolver; constructor(scope: ScopeMain, workspace: Workspace, depsResolver: DependencyResolverMain); getDeprecationInfo(component: Component): Promise; private getHeadComponent; /** * mark a component as deprecated. after this change, the component will be modified. * tag and export the component to have it deprecated on the remote. * * @param componentId * @param newId * @returns boolean whether or not the component has been deprecated */ deprecate(componentId: ComponentID, newId?: ComponentID, range?: string): Promise; deprecateByCLIValues(id: string, newId?: string, range?: string): Promise; /** * deprecate all components matching the given pattern. the pattern can match multiple components. * see `COMPONENT_PATTERN_HELP` for the supported pattern syntax. */ deprecateByPattern(pattern: string, newId?: string, range?: string): Promise; unDeprecateByCLIValues(id: string): Promise; unDeprecate(componentId: ComponentID): Promise; /** * remove the deprecation status from all components matching the given pattern. * the pattern can match multiple components. see `COMPONENT_PATTERN_HELP` for the supported pattern syntax. */ unDeprecateByPattern(pattern: string): Promise; /** * whether the component is currently deprecated, considering both the pending local .bitmap config * (authoritative when present) and the persisted model/scope state. */ private isDeprecated; /** * whether the component has any deprecation that an undeprecate should clear. unlike isDeprecated(), * this also treats a range-deprecation as clearable (whether it lives in the local .bitmap or is * already baked into the model), so "bit undeprecate" can revert a prior "bit deprecate --range" even * when the head version is outside the range and thus not "currently" deprecated. */ private hasDeprecationToClear; private setDeprecateConfig; private setUnDeprecateConfig; addDeprecatedDependenciesIssues(components: Component[]): Promise; private addDeprecatedDepIssue; private isComponentDeprecated; /** * performant version of isDeprecated() in case the component object is not available and loading it is expensive. */ private isDeprecatedByIdWithoutLoadingComponent; static runtime: import("@teambit/harmony").RuntimeDefinition; static dependencies: import("@teambit/harmony").Aspect[]; static provider([graphql, scope, componentAspect, workspace, cli, depsResolver, issues]: [ GraphqlMain, ScopeMain, ComponentMain, Workspace, CLIMain, DependencyResolverMain, IssuesMain ]): Promise; }