UNPKG

@teambit/export

Version:
116 lines (115 loc) 4.9 kB
import type { CLIMain } from '@teambit/cli'; import type { ScopeMain } from '@teambit/scope'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; import type { Consumer } from '@teambit/legacy.consumer'; import type { RemoveMain } from '@teambit/remove'; import type { Workspace } from '@teambit/workspace'; import type { Logger, LoggerMain } from '@teambit/logger'; import type { Remotes, Remote } from '@teambit/scope.remotes'; import type { EjectMain, EjectResults } from '@teambit/eject'; import type { ExportOrigin } from '@teambit/scope.network'; import type { DependencyResolverMain } from '@teambit/dependency-resolver'; import type { Lane } from '@teambit/objects'; import { ObjectList } from '@teambit/objects'; import { Scope } from '@teambit/legacy.scope'; export type OnExportIdTransformer = (id: ComponentID) => ComponentID; export type ObjectsPerRemote = { remote: Remote; objectList: ObjectList; exportedIds?: string[]; }; export type PushToScopesResult = { exported: ComponentIdList; updatedLocally: ComponentIdList; newIdsOnRemote: ComponentID[]; rippleJobs: string[]; }; export type PushToScopesParams = { scope: Scope; ids: ComponentIdList; laneObject?: Lane; allVersions?: boolean; originDirectly?: boolean; resumeExportId?: string | undefined; throwForMissingArtifacts?: boolean; isOnMain?: boolean; exportHeadsOnly?: boolean; includeParents?: boolean; filterOutExistingVersions?: boolean; exportOrigin?: ExportOrigin; }; type ExportParams = { ids?: string[]; eject?: boolean; allVersions?: boolean; originDirectly?: boolean; includeNonStaged?: boolean; resumeExportId?: string | undefined; headOnly?: boolean; ignoreMissingArtifacts?: boolean; forkLaneNewScope?: boolean; }; export interface ExportResult { nonExistOnBitMap: ComponentID[]; newIdsOnRemote: ComponentID[]; removedIds: ComponentIdList; missingScope: ComponentID[]; componentsIds: ComponentID[]; exportedLanes: Lane[]; rippleJobs: string[]; rippleJobUrls: string[]; ejectResults: EjectResults | undefined; } export declare class ExportMain { private workspace; private remove; private depResolver; private logger; private eject; constructor(workspace: Workspace, remove: RemoveMain, depResolver: DependencyResolverMain, logger: Logger, eject: EjectMain); export(params?: ExportParams): Promise<ExportResult>; private getRippleJobUrls; private exportComponents; /** * @deprecated use `pushToScopes` instead */ exportMany(params: PushToScopesParams): Promise<PushToScopesResult>; /** * the export process uses four steps. read more about it here: https://github.com/teambit/bit/pull/3371 */ pushToScopes({ scope, ids, // when exporting a lane, the ids are the lane component ids laneObject, allVersions, originDirectly, resumeExportId, throwForMissingArtifacts, isOnMain, exportHeadsOnly, // relevant when exporting from bare-scope, especially when re-exporting existing versions, the normal calculation based on getDivergeData won't work includeParents, // relevant when exportHeadsOnly is used. sometimes the parents head are needed as well filterOutExistingVersions, // go to the remote and check whether the version exists there. if so, don't export it exportOrigin, }: PushToScopesParams): Promise<PushToScopesResult>; private transformToOneObjectListWithScopeData; private ejectExportedComponents; pushToRemotesCarefully(manyObjectsPerRemote: ObjectsPerRemote[], resumeExportId?: string): Promise<void>; private pushRemotesPendingDir; shouldPushToCentralHub(manyObjectsPerRemote: ObjectsPerRemote[], scopeRemotes: Remotes, originDirectly?: boolean): boolean; /** * Component and dependencies id changes: * When exporting components with dependencies to a bare-scope, some of the dependencies may be created locally and as * a result their scope-name is null. Before the bare-scope gets the components, convert these scope names * to the bare-scope name. * * This is the Harmony version of "convertToCorrectScope". No more codemod and no more hash changes. */ private convertToCorrectScope; private getComponentsToExport; private getLaneCompIdsToExport; private getRemovedStagedBitIds; static runtime: import("@teambit/harmony").RuntimeDefinition; static dependencies: import("@teambit/harmony").Aspect[]; static provider([cli, scope, workspace, remove, depResolver, loggerMain, eject]: [ CLIMain, ScopeMain, Workspace, RemoveMain, DependencyResolverMain, LoggerMain, EjectMain ]): Promise<ExportMain>; } export declare function isUserTryingToExportLanes(consumer: Consumer): boolean; export default ExportMain;