/** * a classic use case of eject is when a user imports a component using `bit import` to update it, * but the user has no intention to have the code as part of the project source code. * the eject provides the option to delete the component locally and install it via the NPM client. * * an implementation note, the entire process is done with rollback in mind. * since installing the component via NPM client is an error prone process, we do it first, before * removing the component files, so then it's easier to rollback. */ import type { Workspace } from '@teambit/workspace'; import type { Consumer } from '@teambit/legacy.consumer'; import type { ComponentID } from '@teambit/component-id'; import { ComponentIdList } from '@teambit/component-id'; import type { ConsumerComponent as Component } from '@teambit/legacy.consumer-component'; import type { Logger } from '@teambit/logger'; import type { InstallMain } from '@teambit/install'; export type EjectResults = { ejectedComponents: ComponentIdList; failedComponents: FailedComponents; }; export type EjectOptions = { force?: boolean; keepFiles?: boolean; skipDependencyInstallation?: boolean; }; type FailedComponents = { modifiedComponents: ComponentIdList; stagedComponents: ComponentIdList; notExportedComponents: ComponentIdList; selfHostedExportedComponents: ComponentIdList; }; export declare class ComponentsEjector { private workspace; private install; private logger; private componentsIds; private ejectOptions; consumer: Consumer; idsToEject: ComponentIdList; componentsToEject: Component[]; notEjectedDependents: Array<{ dependent: Component; ejectedDependencies: Component[]; }>; failedComponents: FailedComponents; constructor(workspace: Workspace, install: InstallMain, logger: Logger, componentsIds: ComponentID[], ejectOptions: EjectOptions); eject(): Promise; decideWhichComponentsToEject(): Promise; loadComponentsToEject(): Promise; removeComponentsFromNodeModules(): Promise; installPackages(): Promise; getPackagesToInstall(): string[]; _buildExceptionMessageWithRollbackData(action: string): string; /** * as part of the 'eject' operation, a component is removed locally. as opposed to the remove * command, in this case, no need to remove the objects from the scope, only remove from the * filesystem, which means, delete the component files, untrack from .bitmap and clean * package.json and bit.json traces. */ private removeComponentsFiles; private untrackComponents; throwEjectError(message: string, originalError: Error): void; _validateIdsHaveScopesAndVersions(): void; } export {};