UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

67 lines (66 loc) 2.63 kB
import { COMPONENT_ORIGINS } from '../../constants'; import { PathOsBasedRelative, PathLinux, PathOsBased, PathLinuxRelative } from '../../utils/path'; import Consumer from '../consumer'; import { BitId } from '../../bit-id'; export declare type ComponentOrigin = keyof typeof COMPONENT_ORIGINS; export declare type ComponentMapFile = { name: string; relativePath: PathLinux; test: boolean; }; export declare type ComponentMapData = { id: BitId; files: ComponentMapFile[]; mainFile: PathLinux; rootDir?: PathLinux; trackDir?: PathLinux; origin: ComponentOrigin; originallySharedDir?: PathLinux; wrapDir?: PathLinux; exported?: boolean; }; export declare type PathChange = { from: PathLinux; to: PathLinux; }; export default class ComponentMap { id: BitId; files: ComponentMapFile[]; mainFile: PathLinux; rootDir?: PathLinux; trackDir: PathLinux | undefined; origin: ComponentOrigin; originallySharedDir: PathLinux | undefined; wrapDir: PathLinux | undefined; markBitMapChangedCb: Function; exported: boolean | undefined; constructor({ id, files, mainFile, rootDir, trackDir, origin, originallySharedDir, wrapDir }: ComponentMapData); static fromJson(componentMapObj: ComponentMapData): ComponentMap; toPlainObject(): Record<string, any>; static getPathWithoutRootDir(rootDir: PathLinux, filePath: PathLinux): PathLinux; static changeFilesPathAccordingToItsRootDir(existingRootDir: PathLinux, files: ComponentMapFile[]): PathChange[]; setMarkAsChangedCb(markAsChangedBinded: Function): void; _findFile(fileName: PathLinux): ComponentMapFile | undefined; changeRootDirAndUpdateFilesAccordingly(newRootDir: PathLinuxRelative): void; addRootDirToDistributedFiles(rootDir: PathOsBased): void; updateFileLocation(fileFrom: PathOsBased, fileTo: PathOsBased): PathChange[]; updateDirLocation(dirFrom: PathOsBasedRelative, dirTo: PathOsBasedRelative): PathChange[]; getFilesRelativeToConsumer(): PathLinux[]; getAllFilesPaths(): PathLinux[]; getFilesGroupedByBeingTests(): { allFiles: string[]; nonTestsFiles: string[]; testsFiles: string[]; }; removeTrackDirIfNeeded(): void; getTrackDir(): PathLinux | undefined; getRootDir(): PathLinuxRelative; hasRootDir(): boolean; getComponentDir(): PathLinux | undefined; doesAuthorHaveRootDir(): boolean; trackDirectoryChanges(consumer: Consumer, id: BitId): Promise<void>; removeFiles(files: ComponentMapFile[]): void; sort(): void; clone(): ComponentMap; validate(): void; }