UNPKG

@teambit/renaming

Version:
104 lines (103 loc) 4.21 kB
import type { ConfigMain } from '@teambit/config'; import type { Logger, LoggerMain } from '@teambit/logger'; import type { CLIMain } from '@teambit/cli'; import type { Component, ComponentMain } from '@teambit/component'; import { ComponentID } from '@teambit/component'; import type { DeprecationMain } from '@teambit/deprecation'; import type { GraphqlMain } from '@teambit/graphql'; import type { CompilerMain } from '@teambit/compiler'; import type { EnvsMain } from '@teambit/envs'; import type { NewComponentHelperMain } from '@teambit/new-component-helper'; import type { RemoveMain } from '@teambit/remove'; import type { RefactoringMain } from '@teambit/refactoring'; import type { ComponentWriterMain } from '@teambit/component-writer'; import type { Workspace } from '@teambit/workspace'; import type { InstallMain } from '@teambit/install'; import type { RenameOptions } from './rename.cmd'; type RenameId = { sourceId: ComponentID; targetId: ComponentID; }; type RenameData = RenameId & { sourcePkg: string; isTagged: boolean; targetPkg?: string; targetComp?: Component; compIdsUsingItAsEnv?: ComponentID[]; }; export type RenameResult = { renameData: RenameData[]; refactoredIds: ComponentID[]; }; export declare class RenamingMain { private workspace; private install; private newComponentHelper; private deprecation; private refactoring; private config; private componentWriter; private compiler; private logger; private envs; private remove; constructor(workspace: Workspace, install: InstallMain, newComponentHelper: NewComponentHelperMain, deprecation: DeprecationMain, refactoring: RefactoringMain, config: ConfigMain, componentWriter: ComponentWriterMain, compiler: CompilerMain, logger: Logger, envs: EnvsMain, remove: RemoveMain); rename(sourceIdStr: string, targetName: string, options?: RenameOptions): Promise<RenameDependencyNameResult>; renameMultiple(multipleIds: RenameId[], options: RenameOptions): Promise<RenameResult>; getRenamingInfo(component: Component): RenamingInfo | null; /** * change the default-scope for new components. * for tagged/exported components, delete (or deprecate - depends on the flag) the original ones and create new ones. * optionally (if refactor is true), change the source code to match the new scope-name. */ renameScope(oldScope: string, newScope: string, options?: { refactor?: boolean; deprecate?: boolean; preserve?: boolean; skipDependencyInstallation?: boolean; }): Promise<RenameResult>; /** * change the default-scope for new components. optionally (if refactor is true), change the source code to match the * new scope-name. * keep in mind that this is working for new components only, for tagged/exported it's impossible. See the errors * thrown in such cases in this method. */ renameOwner(oldOwner: string, newOwner: string, options: { refactor?: boolean; ast?: boolean; }): Promise<RenameResult>; private renameAspectIdsInWorkspaceConfig; private changeEnvsAccordingToNewIds; private deleteLinkFromNodeModules; private installDepsGracefully; private compileGracefully; private renameOwnerInScopeName; private getConfig; static slots: never[]; static dependencies: import("@teambit/harmony").Aspect[]; static runtime: import("@teambit/harmony").RuntimeDefinition; static provider([cli, workspace, deprecation, newComponentHelper, componentMain, graphql, refactoring, install, config, componentWriter, compiler, loggerMain, envs, remove,]: [ CLIMain, Workspace, DeprecationMain, NewComponentHelperMain, ComponentMain, GraphqlMain, RefactoringMain, InstallMain, ConfigMain, ComponentWriterMain, CompilerMain, LoggerMain, EnvsMain, RemoveMain ]): Promise<RenamingMain>; } export type RenameDependencyNameResult = { sourceId: ComponentID; targetId: ComponentID; }; export type RenamingInfo = { renamedFrom: ComponentID; }; export default RenamingMain;