@teambit/tracker 1.0.106 → 1.0.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,140 @@
1
+ import * as path from 'path';
2
+ import R from 'ramda';
3
+
4
+ import {
5
+ ANGULAR_BIT_ENTRY_POINT_FILE,
6
+ DEFAULT_INDEX_EXTS,
7
+ DEFAULT_INDEX_NAME,
8
+ DEFAULT_SEPARATOR,
9
+ } from '@teambit/legacy/dist/constants';
10
+ import { pathJoinLinux, PathLinux, pathNormalizeToLinux } from '@teambit/legacy/dist/utils/path';
11
+ import ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';
12
+ import { MissingMainFile } from '@teambit/legacy/dist/consumer/bit-map/exceptions';
13
+ import { AddedComponent } from './add-components';
14
+
15
+ export default function determineMainFile(
16
+ addedComponent: AddedComponent,
17
+ existingComponentMap: ComponentMap | null | undefined
18
+ ): PathLinux {
19
+ const mainFile = addedComponent.mainFile;
20
+ const componentIdStr = addedComponent.componentId.toString();
21
+ const files = addedComponent.files.filter((file) => !file.test);
22
+ const rootDir = existingComponentMap && existingComponentMap.rootDir;
23
+ const strategies: Function[] = [
24
+ getExistingIfNotChanged,
25
+ getUserSpecifiedMainFile,
26
+ onlyOneFileEnteredUseIt,
27
+ searchForFileNameIndex,
28
+ searchForSameFileNameAsImmediateDir,
29
+ searchForAngularEntryPoint,
30
+ ];
31
+
32
+ for (const strategy of strategies) {
33
+ const foundMainFile = strategy();
34
+ if (foundMainFile) {
35
+ return foundMainFile;
36
+ }
37
+ }
38
+ const mainFileString = `${DEFAULT_INDEX_NAME}.[${DEFAULT_INDEX_EXTS.join(', ')}]`;
39
+ throw new MissingMainFile(
40
+ componentIdStr,
41
+ mainFileString,
42
+ files.map((file) => path.normalize(file.relativePath))
43
+ );
44
+
45
+ /**
46
+ * user didn't enter mainFile but the component already exists with mainFile
47
+ */
48
+ function getExistingIfNotChanged(): PathLinux | null | undefined {
49
+ if (!mainFile && existingComponentMap) {
50
+ return existingComponentMap.mainFile;
51
+ }
52
+ return null;
53
+ }
54
+ /**
55
+ * user entered mainFile => search the mainFile in the files array, throw error if not found
56
+ */
57
+ function getUserSpecifiedMainFile(): PathLinux | null | undefined {
58
+ if (mainFile) {
59
+ const foundMainFile = _searchMainFile(pathNormalizeToLinux(mainFile));
60
+ if (foundMainFile) return foundMainFile;
61
+ throw new MissingMainFile(
62
+ componentIdStr,
63
+ mainFile,
64
+ files.map((file) => path.normalize(file.relativePath))
65
+ );
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * user didn't enter mainFile and the component has only one file, use that file as the main file
71
+ */
72
+ function onlyOneFileEnteredUseIt(): PathLinux | null | undefined {
73
+ if (files.length === 1) {
74
+ return files[0].relativePath;
75
+ }
76
+ return null;
77
+ }
78
+ /**
79
+ * user didn't enter mainFile and the component has multiple files, search for file name "index",
80
+ * e.g. `index.js`, `index.css`, etc.
81
+ */
82
+ function searchForFileNameIndex(): PathLinux | null | undefined {
83
+ for (const ext of DEFAULT_INDEX_EXTS) {
84
+ const mainFileNameToSearch = `${DEFAULT_INDEX_NAME}.${ext}`;
85
+ const searchResult = _searchMainFile(mainFileNameToSearch);
86
+ if (searchResult) {
87
+ return searchResult;
88
+ }
89
+ }
90
+ return null;
91
+ }
92
+ /**
93
+ * user didn't enter mainFile and the component has multiple files, search for file with the same
94
+ * name as the directory (see #1714)
95
+ */
96
+ function searchForSameFileNameAsImmediateDir(): PathLinux | null | undefined {
97
+ if (addedComponent.immediateDir) {
98
+ for (const ext of DEFAULT_INDEX_EXTS) {
99
+ const mainFileNameToSearch = `${addedComponent.immediateDir}.${ext}`;
100
+ const searchResult = _searchMainFile(mainFileNameToSearch);
101
+ if (searchResult) {
102
+ return searchResult;
103
+ }
104
+ }
105
+ }
106
+ return null;
107
+ }
108
+ /**
109
+ * The component is an angular component and uses the angular entry point
110
+ */
111
+ function searchForAngularEntryPoint(): PathLinux | null | undefined {
112
+ for (const entryPoint of ANGULAR_BIT_ENTRY_POINT_FILE) {
113
+ const searchResult = _searchMainFile(entryPoint);
114
+ if (searchResult) {
115
+ return searchResult;
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+
121
+ function _searchMainFile(baseMainFile: PathLinux): PathLinux | null | undefined {
122
+ // search for an exact relative-path
123
+ let mainFileFromFiles = files.find((file) => file.relativePath === baseMainFile);
124
+ if (mainFileFromFiles) return baseMainFile;
125
+ if (rootDir) {
126
+ const mainFileUsingRootDir = files.find((file) => pathJoinLinux(rootDir, file.relativePath) === baseMainFile);
127
+ if (mainFileUsingRootDir) return mainFileUsingRootDir.relativePath;
128
+ }
129
+ // search for a file-name
130
+ const potentialMainFiles = files.filter((file) => file.name === baseMainFile);
131
+ if (!potentialMainFiles.length) return null;
132
+ // when there are several files that met the criteria, choose the closer to the root
133
+ const sortByNumOfDirs = (a, b) =>
134
+ a.relativePath.split(DEFAULT_SEPARATOR).length - b.relativePath.split(DEFAULT_SEPARATOR).length;
135
+ potentialMainFiles.sort(sortByNumOfDirs);
136
+ mainFileFromFiles = R.head(potentialMainFiles);
137
+ // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
138
+ return mainFileFromFiles.relativePath;
139
+ }
140
+ }
package/dist/add-cmd.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Command, CommandOptions } from '@teambit/cli';
2
2
  import { PathLinux } from '@teambit/legacy/dist/utils/path';
3
3
  import { Warnings } from './add-components';
4
4
  import { TrackerMain } from './tracker.main.runtime';
5
- declare type AddFlags = {
5
+ type AddFlags = {
6
6
  id: string | null | undefined;
7
7
  main: string | null | undefined;
8
8
  namespace: string | null | undefined;
@@ -10,7 +10,7 @@ declare type AddFlags = {
10
10
  env?: string;
11
11
  override: boolean;
12
12
  };
13
- declare type AddResults = {
13
+ type AddResults = {
14
14
  addedComponents: Array<{
15
15
  id: string;
16
16
  files: PathLinux[];
@@ -4,22 +4,22 @@ import Consumer from '@teambit/legacy/dist/consumer/consumer';
4
4
  import { PathLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';
5
5
  import ComponentMap, { ComponentMapFile, Config } from '@teambit/legacy/dist/consumer/bit-map/component-map';
6
6
  import { Workspace } from '@teambit/workspace';
7
- export declare type AddResult = {
7
+ export type AddResult = {
8
8
  id: ComponentID;
9
9
  files: ComponentMapFile[];
10
10
  };
11
- export declare type Warnings = {
11
+ export type Warnings = {
12
12
  alreadyUsed: Record<string, any>;
13
13
  emptyDirectory: string[];
14
14
  existInScope: ComponentID[];
15
15
  };
16
- export declare type AddActionResults = {
16
+ export type AddActionResults = {
17
17
  addedComponents: AddResult[];
18
18
  warnings: Warnings;
19
19
  };
20
- export declare type PathOrDSL = PathOsBased | string;
21
- declare type PathsStats = {};
22
- export declare type AddedComponent = {
20
+ export type PathOrDSL = PathOsBased | string;
21
+ type PathsStats = {};
22
+ export type AddedComponent = {
23
23
  componentId: ComponentID;
24
24
  files: ComponentMapFile[];
25
25
  mainFile?: PathOsBased | null | undefined;
@@ -30,7 +30,7 @@ export declare type AddedComponent = {
30
30
  } | null | undefined;
31
31
  immediateDir?: string;
32
32
  };
33
- export declare type AddProps = {
33
+ export type AddProps = {
34
34
  componentPaths: PathOsBased[];
35
35
  id?: string;
36
36
  main?: PathOsBased;
@@ -42,7 +42,7 @@ export declare type AddProps = {
42
42
  shouldHandleOutOfSync?: boolean;
43
43
  env?: string;
44
44
  };
45
- export declare type AddContext = {
45
+ export type AddContext = {
46
46
  workspace: Workspace;
47
47
  alternateCwd?: string;
48
48
  };
@@ -118,7 +118,7 @@ export default class AddComponents {
118
118
  * used for updating main file if exists or doesn't exists
119
119
  */
120
120
  _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined;
121
- _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]): ComponentMapFile | undefined;
121
+ _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]): ComponentMapFile;
122
122
  private getDefaultScope;
123
123
  /**
124
124
  * given the component paths, prepare the id, mainFile and files to be added later on to bitmap
@@ -743,10 +743,7 @@ you can add the directory these files are located at and it'll change the root d
743
743
  const allIds = this.bitMap.getAllBitIdsFromAllLanes();
744
744
  await Promise.all(addedComponents.map(async addedComponent => {
745
745
  if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.
746
- const componentsWithSameName = addedComponents.filter(a => {
747
- var _addedComponent$idFro;
748
- return a.idFromPath && a.idFromPath.name === ((_addedComponent$idFro = addedComponent.idFromPath) === null || _addedComponent$idFro === void 0 ? void 0 : _addedComponent$idFro.name);
749
- });
746
+ const componentsWithSameName = addedComponents.filter(a => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath?.name);
750
747
  const bitIdFromNameOnly = new (_legacyBitId().BitId)({
751
748
  name: addedComponent.idFromPath.name
752
749
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_arrayDifference","data","_interopRequireDefault","require","_fsExtra","_ignore","_lodash","path","_interopRequireWildcard","_ramda","_stringFormat","_analytics","_componentId","_legacyBitId","_constants","_generalError","_logger","_utils","_bitError","_componentMap","_missingMainFile","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_workspaceModules","_determineMainFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","REGEX_DSL_PATTERN","AddComponents","constructor","context","addProps","alternateCwd","workspace","consumer","bitMap","componentPaths","joinConsumerPathIfNeeded","id","main","namespace","override","trackDirFeature","warnings","alreadyUsed","emptyDirectory","existInScope","addedComponents","defaultScope","config","shouldHandleOutOfSync","paths","length","undefined","alternate","map","file","join","getFilesAccordingToDsl","files","filesWithPotentialDsl","filesListAllMatches","dsl","filesListMatch","fileInfo","calculateFileInfo","generatedFile","format","matches","glob","matchesAfterGitIgnore","gitIgnore","filter","match","fs","existsSync","Promise","all","filesListFlatten","R","flatten","filesListUnique","uniq","fileNormalized","pathNormalizeToLinux","fileWithCorrectCase","find","f","toLowerCase","relativeToConsumer","getPathRelativeToConsumer","_isPackageJsonOnRootDir","pathRelativeToConsumerRoot","componentMap","rootDir","Error","PACKAGE_JSON","normalize","_isOutsideOfWrapDir","wrapDir","wrapDirRelativeToConsumerRoot","startsWith","addOrUpdateComponentInBitMap","component","consumerPath","getPath","parsedBitId","componentId","componentFromScope","scope","getModelComponentIfExist","foundComponentFromBitMap","getComponentIfExist","ignoreVersion","componentFilesP","filePath","relativePath","isAutoGenerated","isAutoGeneratedFile","caseSensitive","existingIdOfFile","getComponentIdByPath","idOfFileIsDifferent","isEqual","push","newId","toComponentIdWithLatestVersion","componentFiles","_updateFilesAccordingToExistingRootDir","_areFilesArraysEqual","_updateFilesWithCurrentLetterCases","_mergeFilesWithExistingComponentMapFiles","trackDir","mainFile","determineMainFile","getRootDir","fileNotInsideTrackDir","AddingIndividualFiles","getComponentMap","addFilesToComponent","getDefaultScope","hasScope","fullName","addComponent","ComponentID","_legacy","changeRootDirAndUpdateFilesAccordingly","existingRootDir","areFilesInsideExistingRootDir","every","ComponentMap","changeFilesPathAccordingToItsRootDir","currentlyAddedDir","currentlyAddedDirParentOfRootDir","GeneralError","existingComponentMapFile","unionWith","eqBy","prop","currentComponentMap","newFiles","currentFiles","forEach","currentFile","sameFile","newFile","_getIdAccordingToExistingComponent","currentId","idWithScope","existingComponentId","getExistingBitId","includes","VERSION_DELIMITER","hasVersion","version","getVersionFromString","VersionShouldBeRemoved","_getIdAccordingToTrackDir","dir","dirNormalizedToLinux","trackDirs","getAllTrackDirs","_addMainFileToFiles","foundFile","_findMainFileInFiles","shouldIgnore","ignores","ExcludedMainFile","test","name","basename","mainFileRelativeToConsumer","mainPath","toAbsolutePath","isDir","MainFileIsDir","normalizedMainFile","componentName","componentDefaultScopeFromComponentDirAndName","addOneComponent","componentPath","finalBitId","idFromPath","relativeComponentPath","_throwForOutsideConsumer","throwForExistingParentDir","cwd","nodir","EmptyDirectory","filteredMatches","NoFiles","filteredMatchedFiles","resolvedMainFile","absoluteComponentPath","resolve","splitPath","split","sep","lastDir","idOfTrackDir","bitId","BitId","parse","nameSpaceOrDir","getValidIdChunk","getValidBitId","addedComp","immediateDir","getIgnoreList","getIgnoreListHarmony","add","ignoreList","ignore","componentPathsStats","resolvedComponentPathsWithoutGitIgnore","resolvedComponentPathsWithGitIgnore","diff","arrayDiff","isEmpty","PathsNotExist","validatePaths","keys","compPath","BitError","isMultipleComponents","addMultipleComponents","logger","debugAndAddBreadCrumb","addedOne","_removeNamespaceIfNotNeeded","addedResult","linkComponents","item","Analytics","setExtraData","ids","linkToNodeModulesByIds","_removeDirectoriesWhenTheirFilesAreAdded","added","_tryAddingMultiple","validateNoDuplicateIds","_addMultipleToBitMap","allPaths","foundDir","p","dirname","debug","missingMainFiles","addedComponent","err","MissingMainFile","MissingMainFileMultipleComponents","sort","allIds","getAllBitIdsFromAllLanes","componentsWithSameName","_addedComponent$idFro","bitIdFromNameOnly","componentIdFromNameOnly","existingComponentWithSameName","searchWithoutScopeAndVersion","addedP","onePath","reject","isNil","relativeToConsumerPath","PathOutsideConsumer","isParentDir","parent","relative","isAbsolute","components","ParentDirTracked","toStringWithoutVersion","exports","fileArray","addComponents","duplicateIds","newGroupedComponents","groupby","DuplicateIds"],"sources":["add-components.ts"],"sourcesContent":["import arrayDiff from 'array-difference';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport groupby from 'lodash.groupby';\nimport * as path from 'path';\nimport R from 'ramda';\nimport format from 'string-format';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitIdStr, BitId } from '@teambit/legacy-bit-id';\nimport { PACKAGE_JSON, VERSION_DELIMITER } from '@teambit/legacy/dist/constants';\nimport BitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { calculateFileInfo, glob, isAutoGeneratedFile, isDir, pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathLinuxRelative, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap, {\n ComponentMapFile,\n Config,\n getIgnoreListHarmony,\n} from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport MissingMainFile from '@teambit/legacy/dist/consumer/bit-map/exceptions/missing-main-file';\nimport {\n DuplicateIds,\n EmptyDirectory,\n ExcludedMainFile,\n MainFileIsDir,\n NoFiles,\n PathsNotExist,\n} from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions';\nimport { AddingIndividualFiles } from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/adding-individual-files';\nimport MissingMainFileMultipleComponents from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/missing-main-file-multiple-components';\nimport { ParentDirTracked } from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/parent-dir-tracked';\nimport PathOutsideConsumer from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/path-outside-consumer';\nimport VersionShouldBeRemoved from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/version-should-be-removed';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { Workspace } from '@teambit/workspace';\nimport determineMainFile from './determine-main-file';\n\nexport type AddResult = { id: ComponentID; files: ComponentMapFile[] };\nexport type Warnings = {\n alreadyUsed: Record<string, any>;\n emptyDirectory: string[];\n existInScope: ComponentID[];\n};\nexport type AddActionResults = { addedComponents: AddResult[]; warnings: Warnings };\nexport type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\ntype PathsStats = { [PathOsBased]: { isDir: boolean } };\nexport type AddedComponent = {\n componentId: ComponentID;\n files: ComponentMapFile[];\n mainFile?: PathOsBased | null | undefined;\n trackDir: PathOsBased;\n idFromPath:\n | {\n name: string;\n namespace: string;\n }\n | null\n | undefined;\n immediateDir?: string;\n};\nconst REGEX_DSL_PATTERN = /{([^}]+)}/g;\n\nexport type AddProps = {\n componentPaths: PathOsBased[];\n id?: string;\n main?: PathOsBased;\n namespace?: string;\n override: boolean;\n trackDirFeature?: boolean;\n defaultScope?: string;\n config?: Config;\n shouldHandleOutOfSync?: boolean;\n env?: string;\n};\n// This is the contxt of the add operation. By default, the add is executed in the same folder in which the consumer is located and it is the process.cwd().\n// In that case , give the value false to overridenConsumer .\n// There is a possibility to execute add when the process.cwd() is different from the project directory. In that case , when add is done on a folder wchih is\n// Different from process.cwd(), transfer true.\n// Required for determining if the paths are relative to consumer or to process.cwd().\nexport type AddContext = {\n workspace: Workspace;\n alternateCwd?: string;\n};\n\nexport default class AddComponents {\n workspace: Workspace;\n consumer: Consumer;\n bitMap: BitMap;\n componentPaths: PathOsBased[];\n id: string | null | undefined; // id entered by the user\n main: PathOsBased | null | undefined;\n namespace: string | null | undefined;\n override: boolean; // (default = false) replace the files array or only add files.\n trackDirFeature: boolean | null | undefined;\n warnings: Warnings;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n ignoreList: string[];\n gitIgnore: any;\n alternateCwd: string | null | undefined;\n addedComponents: AddResult[];\n defaultScope?: string; // helpful for out-of-sync\n config?: Config;\n shouldHandleOutOfSync?: boolean; // only bit-add (not bit-create/new) should handle out-of-sync scenario\n constructor(context: AddContext, addProps: AddProps) {\n this.alternateCwd = context.alternateCwd;\n this.workspace = context.workspace;\n this.consumer = context.workspace.consumer;\n this.bitMap = this.consumer.bitMap;\n this.componentPaths = this.joinConsumerPathIfNeeded(addProps.componentPaths);\n this.id = addProps.id;\n this.main = addProps.main;\n this.namespace = addProps.namespace;\n this.override = addProps.override;\n this.trackDirFeature = addProps.trackDirFeature;\n this.warnings = {\n alreadyUsed: {},\n emptyDirectory: [],\n existInScope: [],\n };\n this.addedComponents = [];\n this.defaultScope = addProps.defaultScope;\n this.config = addProps.config;\n this.shouldHandleOutOfSync = addProps.shouldHandleOutOfSync;\n }\n\n joinConsumerPathIfNeeded(paths: PathOrDSL[]): PathOrDSL[] {\n if (paths.length > 0) {\n if (this.alternateCwd !== undefined && this.alternateCwd !== null) {\n const alternate = this.alternateCwd;\n return paths.map((file) => path.join(alternate, file));\n }\n return paths;\n }\n return [];\n }\n\n /**\n * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.\n * @param {*} filesWithPotentialDsl - array of file-path which may have DSL patterns\n *\n * @returns array of file-paths from 'files' parameter that match the patterns from 'filesWithPotentialDsl' parameter\n */\n async getFilesAccordingToDsl(files: PathLinux[], filesWithPotentialDsl: PathOrDSL[]): Promise<PathLinux[]> {\n const filesListAllMatches = filesWithPotentialDsl.map(async (dsl) => {\n const filesListMatch = files.map(async (file) => {\n const fileInfo = calculateFileInfo(file);\n const generatedFile = format(dsl, fileInfo);\n const matches = await glob(generatedFile);\n const matchesAfterGitIgnore = this.gitIgnore.filter(matches);\n return matchesAfterGitIgnore.filter((match) => fs.existsSync(match));\n });\n return Promise.all(filesListMatch);\n });\n\n const filesListFlatten = R.flatten(await Promise.all(filesListAllMatches));\n const filesListUnique = R.uniq(filesListFlatten);\n return filesListUnique.map((file) => {\n // when files array has the test file with different letter case, use the one from the file array\n const fileNormalized = pathNormalizeToLinux(file);\n const fileWithCorrectCase = files.find((f) => f.toLowerCase() === fileNormalized.toLowerCase()) || fileNormalized;\n const relativeToConsumer = this.consumer.getPathRelativeToConsumer(fileWithCorrectCase);\n return pathNormalizeToLinux(relativeToConsumer);\n });\n }\n\n /**\n * for imported component, the package.json in the root directory is a bit-generated file and as\n * such, it should be ignored\n */\n _isPackageJsonOnRootDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isPackageJsonOnRootDir should not get called on non imported components');\n }\n return path.join(componentMap.rootDir, PACKAGE_JSON) === path.normalize(pathRelativeToConsumerRoot);\n }\n\n /**\n * imported components might have wrapDir, when they do, files should not be added outside of\n * that wrapDir\n */\n _isOutsideOfWrapDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isOutsideOfWrapDir should not get called on non imported components');\n }\n if (!componentMap.wrapDir) return false;\n const wrapDirRelativeToConsumerRoot = path.join(componentMap.rootDir, componentMap.wrapDir);\n return !path.normalize(pathRelativeToConsumerRoot).startsWith(wrapDirRelativeToConsumerRoot);\n }\n\n /**\n * Add or update existing (imported and new) component according to bitmap\n * there are 3 options:\n * 1. a user is adding a new component. there is no record for this component in bit.map\n * 2. a user is updating an existing component. there is a record for this component in bit.map\n * 3. some or all the files of this component were previously added as another component-id.\n */\n async addOrUpdateComponentInBitMap(component: AddedComponent): Promise<AddResult | null | undefined> {\n const consumerPath = this.consumer.getPath();\n const parsedBitId = component.componentId;\n const componentFromScope = await this.consumer.scope.getModelComponentIfExist(parsedBitId);\n const files: ComponentMapFile[] = component.files;\n const foundComponentFromBitMap = this.bitMap.getComponentIfExist(component.componentId, {\n ignoreVersion: true,\n });\n const componentFilesP = files.map(async (file: ComponentMapFile) => {\n // $FlowFixMe null is removed later on\n const filePath = path.join(consumerPath, file.relativePath);\n const isAutoGenerated = await isAutoGeneratedFile(filePath);\n if (isAutoGenerated) {\n return null;\n }\n const caseSensitive = false;\n const existingIdOfFile = this.bitMap.getComponentIdByPath(file.relativePath, caseSensitive);\n const idOfFileIsDifferent = existingIdOfFile && !existingIdOfFile.isEqual(parsedBitId);\n if (idOfFileIsDifferent) {\n // not imported component file but exists in bitmap\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.warnings.alreadyUsed[existingIdOfFile]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile].push(file.relativePath);\n } else {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile] = [file.relativePath];\n }\n return null;\n }\n if (!foundComponentFromBitMap && componentFromScope && this.shouldHandleOutOfSync) {\n const newId = componentFromScope.toComponentIdWithLatestVersion();\n if (!this.defaultScope || this.defaultScope === newId.scope) {\n // otherwise, if defaultScope !== newId.scope, they're different components,\n // and no need to change the id.\n // for more details about this scenario, see https://github.com/teambit/bit/issues/1543, last case.\n component.componentId = newId;\n this.warnings.existInScope.push(newId);\n }\n }\n return file;\n });\n // @ts-ignore it can't be null due to the filter function\n const componentFiles: ComponentMapFile[] = (await Promise.all(componentFilesP)).filter((file) => file);\n if (!componentFiles.length) return { id: component.componentId, files: [] };\n if (foundComponentFromBitMap) {\n this._updateFilesAccordingToExistingRootDir(foundComponentFromBitMap, componentFiles, component);\n }\n if (this.trackDirFeature) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.bitMap._areFilesArraysEqual(foundComponentFromBitMap.files, componentFiles)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return foundComponentFromBitMap;\n }\n }\n if (!this.override && foundComponentFromBitMap) {\n this._updateFilesWithCurrentLetterCases(foundComponentFromBitMap, componentFiles);\n component.files = this._mergeFilesWithExistingComponentMapFiles(componentFiles, foundComponentFromBitMap.files);\n } else {\n component.files = componentFiles;\n }\n\n const { componentId, trackDir } = component;\n const mainFile = determineMainFile(component, foundComponentFromBitMap);\n const getRootDir = (): PathLinuxRelative => {\n if (this.trackDirFeature) throw new Error('track dir should not calculate the rootDir');\n if (foundComponentFromBitMap) return foundComponentFromBitMap.rootDir;\n if (!trackDir) throw new Error(`addOrUpdateComponentInBitMap expect to have trackDir for non-legacy workspace`);\n const fileNotInsideTrackDir = componentFiles.find(\n (file) => !pathNormalizeToLinux(file.relativePath).startsWith(`${pathNormalizeToLinux(trackDir)}/`)\n );\n if (fileNotInsideTrackDir) {\n // we check for this error before. however, it's possible that a user have one trackDir\n // and another dir for the tests.\n throw new AddingIndividualFiles(fileNotInsideTrackDir.relativePath);\n }\n return pathNormalizeToLinux(trackDir);\n };\n const getComponentMap = async (): Promise<ComponentMap> => {\n if (this.trackDirFeature) {\n return this.bitMap.addFilesToComponent({ componentId, files: component.files });\n }\n const rootDir = getRootDir();\n const getDefaultScope = async () => {\n if (componentId.hasScope()) return undefined;\n return this.getDefaultScope(rootDir, componentId.fullName);\n };\n const defaultScope = await getDefaultScope();\n const componentMap = this.bitMap.addComponent({\n componentId: new ComponentID(componentId._legacy, defaultScope),\n files: component.files,\n defaultScope,\n config: this.config,\n mainFile,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n override: this.override,\n });\n componentMap.changeRootDirAndUpdateFilesAccordingly(rootDir);\n return componentMap;\n };\n const componentMap = await getComponentMap();\n return { id: componentId, files: componentMap.files };\n }\n\n /**\n * current componentFiles are relative to the workspace. we want them relative to the rootDir.\n */\n _updateFilesAccordingToExistingRootDir(\n foundComponentFromBitMap: ComponentMap,\n componentFiles: ComponentMapFile[],\n component: AddedComponent\n ) {\n const existingRootDir = foundComponentFromBitMap.rootDir;\n if (!existingRootDir) return; // nothing to do.\n const areFilesInsideExistingRootDir = componentFiles.every((file) =>\n pathNormalizeToLinux(file.relativePath).startsWith(`${existingRootDir}/`)\n );\n if (areFilesInsideExistingRootDir) {\n ComponentMap.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);\n return;\n }\n // some (or all) added files are outside the existing rootDir, the rootDir needs to be changed\n // if a directory was added and it's a parent of the existing rootDir, change the rootDir to\n // the currently added rootDir.\n const currentlyAddedDir = pathNormalizeToLinux(component.trackDir);\n const currentlyAddedDirParentOfRootDir = currentlyAddedDir && existingRootDir.startsWith(`${currentlyAddedDir}/`);\n if (currentlyAddedDirParentOfRootDir) {\n foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly(currentlyAddedDir);\n ComponentMap.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);\n return;\n }\n throw new GeneralError(`unable to add individual files outside the root dir (${existingRootDir}) of ${component.componentId}.\nyou can add the directory these files are located at and it'll change the root dir of the component accordingly`);\n // we might want to change the behavior here to not throw an error and only change the rootDir to \".\"\n // foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly('.');\n }\n\n /**\n * the risk with merging the currently added files with the existing bitMap files is overriding\n * the `test` property. e.g. the component directory is re-added without adding the tests flag to\n * track new files in that directory. in this case, we want to preserve the `test` property.\n */\n _mergeFilesWithExistingComponentMapFiles(\n componentFiles: ComponentMapFile[],\n existingComponentMapFile: ComponentMapFile[]\n ) {\n return R.unionWith(R.eqBy(R.prop('relativePath')), existingComponentMapFile, componentFiles);\n }\n\n /**\n * if an existing file is for example uppercase and the new file is lowercase it has different\n * behavior according to the OS. some OS are case sensitive, some are not.\n * it's safer to avoid saving both files and instead, replacing the old file with the new one.\n * in case a file has replaced and it is also a mainFile, replace the mainFile as well\n */\n _updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]) {\n const currentFiles = currentComponentMap.files;\n currentFiles.forEach((currentFile) => {\n const sameFile = newFiles.find(\n (newFile) => newFile.relativePath.toLowerCase() === currentFile.relativePath.toLowerCase()\n );\n if (sameFile && currentFile.relativePath !== sameFile.relativePath) {\n if (currentComponentMap.mainFile === currentFile.relativePath) {\n currentComponentMap.mainFile = sameFile.relativePath;\n }\n currentFile.relativePath = sameFile.relativePath;\n }\n });\n }\n\n /**\n * if the id is already saved in bitmap file, it might have more data (such as scope, version)\n * use that id instead.\n */\n private _getIdAccordingToExistingComponent(currentId: BitIdStr): ComponentID | undefined {\n const idWithScope = this.defaultScope ? `${this.defaultScope}/${currentId}` : currentId;\n const existingComponentId = this.bitMap.getExistingBitId(idWithScope, false);\n if (currentId.includes(VERSION_DELIMITER)) {\n if (\n !existingComponentId || // this id is new, it shouldn't have a version\n !existingComponentId.hasVersion() || // this component is new, it shouldn't have a version\n // user shouldn't add files to a an existing component with different version\n existingComponentId.version !== ComponentID.getVersionFromString(currentId)\n ) {\n throw new VersionShouldBeRemoved(currentId);\n }\n }\n return existingComponentId;\n }\n\n _getIdAccordingToTrackDir(dir: PathOsBased): ComponentID | null | undefined {\n const dirNormalizedToLinux = pathNormalizeToLinux(dir);\n const trackDirs = this.bitMap.getAllTrackDirs();\n if (!trackDirs) return null;\n return trackDirs[dirNormalizedToLinux];\n }\n\n /**\n * used for updating main file if exists or doesn't exists\n */\n _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined {\n let mainFile = this.main;\n if (mainFile && mainFile.match(REGEX_DSL_PATTERN)) {\n // it's a DSL\n files.forEach((file) => {\n const fileInfo = calculateFileInfo(file.relativePath);\n const generatedFile = format(mainFile, fileInfo);\n const foundFile = this._findMainFileInFiles(generatedFile, files);\n if (foundFile) {\n mainFile = foundFile.relativePath;\n }\n if (fs.existsSync(generatedFile) && !foundFile) {\n const shouldIgnore = this.gitIgnore.ignores(generatedFile);\n if (shouldIgnore) {\n // check if file is in exclude list\n throw new ExcludedMainFile(generatedFile);\n }\n files.push({\n relativePath: pathNormalizeToLinux(generatedFile),\n test: false,\n name: path.basename(generatedFile),\n });\n mainFile = generatedFile;\n }\n });\n }\n if (!mainFile) return undefined;\n if (this.alternateCwd) {\n mainFile = path.join(this.alternateCwd, mainFile);\n }\n const mainFileRelativeToConsumer = this.consumer.getPathRelativeToConsumer(mainFile);\n const mainPath = this.consumer.toAbsolutePath(mainFileRelativeToConsumer);\n if (fs.existsSync(mainPath)) {\n const shouldIgnore = this.gitIgnore.ignores(mainFileRelativeToConsumer);\n if (shouldIgnore) throw new ExcludedMainFile(mainFileRelativeToConsumer);\n if (isDir(mainPath)) {\n throw new MainFileIsDir(mainPath);\n }\n const foundFile = this._findMainFileInFiles(mainFileRelativeToConsumer, files);\n if (foundFile) {\n return foundFile.relativePath;\n }\n files.push({\n relativePath: pathNormalizeToLinux(mainFileRelativeToConsumer),\n test: false,\n name: path.basename(mainFileRelativeToConsumer),\n });\n return mainFileRelativeToConsumer;\n }\n return mainFile;\n }\n\n _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]) {\n const normalizedMainFile = pathNormalizeToLinux(mainFile).toLowerCase();\n return files.find((file) => file.relativePath.toLowerCase() === normalizedMainFile);\n }\n\n private async getDefaultScope(rootDir: string, componentName: string): Promise<string> {\n return (this.defaultScope ||\n (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentName))) as string;\n }\n\n /**\n * given the component paths, prepare the id, mainFile and files to be added later on to bitmap\n * the id of the component is either entered by the user or, if not entered, concluded by the path.\n * e.g. bar/foo.js, the id would be bar/foo.\n * in case bitmap has already the same id, the complete id is taken from bitmap (see _getIdAccordingToExistingComponent)\n */\n async addOneComponent(componentPath: PathOsBased): Promise<AddedComponent> {\n let finalBitId: ComponentID | undefined; // final id to use for bitmap file\n let idFromPath;\n if (this.id) {\n finalBitId = this._getIdAccordingToExistingComponent(this.id);\n }\n const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);\n this._throwForOutsideConsumer(relativeComponentPath);\n this.throwForExistingParentDir(relativeComponentPath);\n const matches = await glob(path.join(relativeComponentPath, '**'), {\n cwd: this.consumer.getPath(),\n nodir: true,\n });\n\n if (!matches.length) throw new EmptyDirectory(componentPath);\n\n const filteredMatches = this.gitIgnore.filter(matches);\n\n if (!filteredMatches.length) {\n throw new NoFiles(matches);\n }\n\n const filteredMatchedFiles = filteredMatches.map((match: PathOsBased) => {\n return { relativePath: pathNormalizeToLinux(match), test: false, name: path.basename(match) };\n });\n const resolvedMainFile = this._addMainFileToFiles(filteredMatchedFiles);\n\n const absoluteComponentPath = path.resolve(componentPath);\n const splitPath = absoluteComponentPath.split(path.sep);\n const lastDir = splitPath[splitPath.length - 1];\n const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);\n if (!finalBitId) {\n if (this.id) {\n const bitId = BitId.parse(this.id, false);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n } else if (idOfTrackDir) {\n finalBitId = idOfTrackDir;\n } else {\n const nameSpaceOrDir = this.namespace || splitPath[splitPath.length - 2];\n if (!this.namespace) {\n idFromPath = { namespace: BitId.getValidIdChunk(nameSpaceOrDir), name: BitId.getValidIdChunk(lastDir) };\n }\n const bitId = BitId.getValidBitId(nameSpaceOrDir, lastDir);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n }\n }\n const trackDir = relativeComponentPath;\n const addedComp = {\n componentId: finalBitId,\n files: filteredMatchedFiles,\n mainFile: resolvedMainFile,\n trackDir,\n idFromPath,\n immediateDir: lastDir,\n };\n\n return addedComp;\n }\n\n getIgnoreList(): string[] {\n const consumerPath = this.consumer.getPath();\n return getIgnoreListHarmony(consumerPath);\n }\n\n async add(): Promise<AddActionResults> {\n this.ignoreList = this.getIgnoreList();\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n let componentPathsStats: PathsStats = {};\n\n const resolvedComponentPathsWithoutGitIgnore = R.flatten(\n await Promise.all(this.componentPaths.map((componentPath) => glob(componentPath)))\n );\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);\n // Run diff on both arrays to see what was filtered out because of the gitignore file\n const diff = arrayDiff(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);\n\n if (R.isEmpty(resolvedComponentPathsWithoutGitIgnore)) {\n throw new PathsNotExist(this.componentPaths);\n }\n if (!R.isEmpty(resolvedComponentPathsWithGitIgnore)) {\n componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);\n } else {\n throw new NoFiles(diff);\n }\n Object.keys(componentPathsStats).forEach((compPath) => {\n if (!componentPathsStats[compPath].isDir) {\n throw new AddingIndividualFiles(compPath);\n }\n });\n if (Object.keys(componentPathsStats).length > 1 && this.id) {\n throw new BitError(\n `the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`\n );\n }\n // if a user entered multiple paths and entered an id, he wants all these paths to be one component\n // conversely, if a user entered multiple paths without id, he wants each dir as an individual component\n const isMultipleComponents = Object.keys(componentPathsStats).length > 1;\n if (isMultipleComponents) {\n await this.addMultipleComponents(componentPathsStats);\n } else {\n logger.debugAndAddBreadCrumb('add-components', 'adding one component');\n // when a user enters more than one directory, he would like to keep the directories names\n // so then when a component is imported, it will write the files into the original directories\n const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);\n await this._removeNamespaceIfNotNeeded([addedOne]);\n if (!R.isEmpty(addedOne.files)) {\n const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);\n if (addedResult) this.addedComponents.push(addedResult);\n }\n }\n await this.linkComponents(this.addedComponents.map((item) => item.id));\n Analytics.setExtraData('num_components', this.addedComponents.length);\n return { addedComponents: this.addedComponents, warnings: this.warnings };\n }\n\n async linkComponents(ids: ComponentID[]) {\n if (this.trackDirFeature) {\n // if trackDirFeature is set, it happens during the component-load and because we load the\n // components in the next line, it gets into an infinite loop.\n return;\n }\n await linkToNodeModulesByIds(this.workspace, ids);\n }\n\n async addMultipleComponents(componentPathsStats: PathsStats): Promise<void> {\n logger.debugAndAddBreadCrumb('add-components', 'adding multiple components');\n this._removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats);\n const added = await this._tryAddingMultiple(componentPathsStats);\n validateNoDuplicateIds(added);\n await this._removeNamespaceIfNotNeeded(added);\n await this._addMultipleToBitMap(added);\n }\n\n /**\n * some uses of wildcards might add directories and their files at the same time, in such cases\n * only the files are needed and the directories can be ignored.\n * @see https://github.com/teambit/bit/issues/1406 for more details\n */\n _removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats) {\n const allPaths = Object.keys(componentPathsStats);\n allPaths.forEach((componentPath) => {\n const foundDir = allPaths.find((p) => p === path.dirname(componentPath));\n if (foundDir && componentPathsStats[foundDir]) {\n logger.debug(`add-components._removeDirectoriesWhenTheirFilesAreAdded, ignoring ${foundDir}`);\n delete componentPathsStats[foundDir];\n }\n });\n }\n\n async _addMultipleToBitMap(added: AddedComponent[]): Promise<void> {\n const missingMainFiles = [];\n await Promise.all(\n added.map(async (component) => {\n if (!R.isEmpty(component.files)) {\n try {\n const addedComponent = await this.addOrUpdateComponentInBitMap(component);\n if (addedComponent && addedComponent.files.length) this.addedComponents.push(addedComponent);\n } catch (err: any) {\n if (!(err instanceof MissingMainFile)) throw err;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n missingMainFiles.push(err);\n }\n }\n })\n );\n if (missingMainFiles.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n throw new MissingMainFileMultipleComponents(missingMainFiles.map((err) => err.componentId).sort());\n }\n }\n\n async _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]) {\n const allIds = this.bitMap.getAllBitIdsFromAllLanes();\n await Promise.all(\n addedComponents.map(async (addedComponent) => {\n if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.\n const componentsWithSameName = addedComponents.filter(\n (a) => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath?.name\n );\n const bitIdFromNameOnly = new BitId({ name: addedComponent.idFromPath.name });\n const defaultScope = await this.getDefaultScope(addedComponent.trackDir, bitIdFromNameOnly.name);\n const componentIdFromNameOnly = new ComponentID(bitIdFromNameOnly, defaultScope);\n const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(componentIdFromNameOnly);\n if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {\n addedComponent.componentId = componentIdFromNameOnly;\n }\n })\n );\n }\n\n async _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]> {\n const addedP = Object.keys(componentPathsStats).map(async (onePath) => {\n try {\n const addedComponent = await this.addOneComponent(onePath);\n return addedComponent;\n } catch (err: any) {\n if (!(err instanceof EmptyDirectory)) throw err;\n this.warnings.emptyDirectory.push(onePath);\n return null;\n }\n });\n const added = await Promise.all(addedP);\n return R.reject(R.isNil, added);\n }\n\n _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased) {\n if (relativeToConsumerPath.startsWith('..')) {\n throw new PathOutsideConsumer(relativeToConsumerPath);\n }\n }\n\n private throwForExistingParentDir(relativeToConsumerPath: PathOsBased) {\n const isParentDir = (parent: string) => {\n const relative = path.relative(parent, relativeToConsumerPath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n this.bitMap.components.forEach((componentMap) => {\n if (!componentMap.rootDir) return;\n if (isParentDir(componentMap.rootDir)) {\n throw new ParentDirTracked(\n componentMap.rootDir,\n componentMap.id.toStringWithoutVersion(),\n relativeToConsumerPath\n );\n }\n });\n }\n}\n\n/**\n * validatePaths - validate if paths entered by user exist and if not throw an error\n *\n * @param {string[]} fileArray - array of paths\n * @returns {PathsStats} componentPathsStats\n */\nfunction validatePaths(fileArray: string[]): PathsStats {\n const componentPathsStats = {};\n fileArray.forEach((componentPath) => {\n if (!fs.existsSync(componentPath)) {\n throw new PathsNotExist([componentPath]);\n }\n componentPathsStats[componentPath] = {\n isDir: isDir(componentPath),\n };\n });\n return componentPathsStats;\n}\n\n/**\n * validate that no two files where added with the same id in the same bit add command\n */\nfunction validateNoDuplicateIds(addComponents: Record<string, any>[]) {\n const duplicateIds = {};\n const newGroupedComponents = groupby(addComponents, 'componentId');\n Object.keys(newGroupedComponents).forEach((key) => {\n if (newGroupedComponents[key].length > 1) duplicateIds[key] = newGroupedComponents[key];\n });\n if (!R.isEmpty(duplicateIds) && !R.isNil(duplicateIds)) throw new DuplicateIds(duplicateIds);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,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CAAC,CAACxI,OAAO,CAAEnJ,GAAG,IAAK;IACjD,IAAI2R,oBAAoB,CAAC3R,GAAG,CAAC,CAACqC,MAAM,GAAG,CAAC,EAAEqP,YAAY,CAAC1R,GAAG,CAAC,GAAG2R,oBAAoB,CAAC3R,GAAG,CAAC;EACzF,CAAC,CAAC;EACF,IAAI,CAACgE,gBAAC,CAAC+J,OAAO,CAAC2D,YAAY,CAAC,IAAI,CAAC1N,gBAAC,CAAC6M,KAAK,CAACa,YAAY,CAAC,EAAE,MAAM,KAAIG,0BAAY,EAACH,YAAY,CAAC;AAC9F"}
1
+ {"version":3,"names":["_arrayDifference","data","_interopRequireDefault","require","_fsExtra","_ignore","_lodash","path","_interopRequireWildcard","_ramda","_stringFormat","_analytics","_componentId","_legacyBitId","_constants","_generalError","_logger","_utils","_bitError","_componentMap","_missingMainFile","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_workspaceModules","_determineMainFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","REGEX_DSL_PATTERN","AddComponents","constructor","context","addProps","alternateCwd","workspace","consumer","bitMap","componentPaths","joinConsumerPathIfNeeded","id","main","namespace","override","trackDirFeature","warnings","alreadyUsed","emptyDirectory","existInScope","addedComponents","defaultScope","config","shouldHandleOutOfSync","paths","length","undefined","alternate","map","file","join","getFilesAccordingToDsl","files","filesWithPotentialDsl","filesListAllMatches","dsl","filesListMatch","fileInfo","calculateFileInfo","generatedFile","format","matches","glob","matchesAfterGitIgnore","gitIgnore","filter","match","fs","existsSync","Promise","all","filesListFlatten","R","flatten","filesListUnique","uniq","fileNormalized","pathNormalizeToLinux","fileWithCorrectCase","find","f","toLowerCase","relativeToConsumer","getPathRelativeToConsumer","_isPackageJsonOnRootDir","pathRelativeToConsumerRoot","componentMap","rootDir","Error","PACKAGE_JSON","normalize","_isOutsideOfWrapDir","wrapDir","wrapDirRelativeToConsumerRoot","startsWith","addOrUpdateComponentInBitMap","component","consumerPath","getPath","parsedBitId","componentId","componentFromScope","scope","getModelComponentIfExist","foundComponentFromBitMap","getComponentIfExist","ignoreVersion","componentFilesP","filePath","relativePath","isAutoGenerated","isAutoGeneratedFile","caseSensitive","existingIdOfFile","getComponentIdByPath","idOfFileIsDifferent","isEqual","push","newId","toComponentIdWithLatestVersion","componentFiles","_updateFilesAccordingToExistingRootDir","_areFilesArraysEqual","_updateFilesWithCurrentLetterCases","_mergeFilesWithExistingComponentMapFiles","trackDir","mainFile","determineMainFile","getRootDir","fileNotInsideTrackDir","AddingIndividualFiles","getComponentMap","addFilesToComponent","getDefaultScope","hasScope","fullName","addComponent","ComponentID","_legacy","changeRootDirAndUpdateFilesAccordingly","existingRootDir","areFilesInsideExistingRootDir","every","ComponentMap","changeFilesPathAccordingToItsRootDir","currentlyAddedDir","currentlyAddedDirParentOfRootDir","GeneralError","existingComponentMapFile","unionWith","eqBy","prop","currentComponentMap","newFiles","currentFiles","forEach","currentFile","sameFile","newFile","_getIdAccordingToExistingComponent","currentId","idWithScope","existingComponentId","getExistingBitId","includes","VERSION_DELIMITER","hasVersion","version","getVersionFromString","VersionShouldBeRemoved","_getIdAccordingToTrackDir","dir","dirNormalizedToLinux","trackDirs","getAllTrackDirs","_addMainFileToFiles","foundFile","_findMainFileInFiles","shouldIgnore","ignores","ExcludedMainFile","test","name","basename","mainFileRelativeToConsumer","mainPath","toAbsolutePath","isDir","MainFileIsDir","normalizedMainFile","componentName","componentDefaultScopeFromComponentDirAndName","addOneComponent","componentPath","finalBitId","idFromPath","relativeComponentPath","_throwForOutsideConsumer","throwForExistingParentDir","cwd","nodir","EmptyDirectory","filteredMatches","NoFiles","filteredMatchedFiles","resolvedMainFile","absoluteComponentPath","resolve","splitPath","split","sep","lastDir","idOfTrackDir","bitId","BitId","parse","nameSpaceOrDir","getValidIdChunk","getValidBitId","addedComp","immediateDir","getIgnoreList","getIgnoreListHarmony","add","ignoreList","ignore","componentPathsStats","resolvedComponentPathsWithoutGitIgnore","resolvedComponentPathsWithGitIgnore","diff","arrayDiff","isEmpty","PathsNotExist","validatePaths","keys","compPath","BitError","isMultipleComponents","addMultipleComponents","logger","debugAndAddBreadCrumb","addedOne","_removeNamespaceIfNotNeeded","addedResult","linkComponents","item","Analytics","setExtraData","ids","linkToNodeModulesByIds","_removeDirectoriesWhenTheirFilesAreAdded","added","_tryAddingMultiple","validateNoDuplicateIds","_addMultipleToBitMap","allPaths","foundDir","p","dirname","debug","missingMainFiles","addedComponent","err","MissingMainFile","MissingMainFileMultipleComponents","sort","allIds","getAllBitIdsFromAllLanes","componentsWithSameName","bitIdFromNameOnly","componentIdFromNameOnly","existingComponentWithSameName","searchWithoutScopeAndVersion","addedP","onePath","reject","isNil","relativeToConsumerPath","PathOutsideConsumer","isParentDir","parent","relative","isAbsolute","components","ParentDirTracked","toStringWithoutVersion","exports","fileArray","addComponents","duplicateIds","newGroupedComponents","groupby","DuplicateIds"],"sources":["add-components.ts"],"sourcesContent":["import arrayDiff from 'array-difference';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport groupby from 'lodash.groupby';\nimport * as path from 'path';\nimport R from 'ramda';\nimport format from 'string-format';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitIdStr, BitId } from '@teambit/legacy-bit-id';\nimport { PACKAGE_JSON, VERSION_DELIMITER } from '@teambit/legacy/dist/constants';\nimport BitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { calculateFileInfo, glob, isAutoGeneratedFile, isDir, pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathLinuxRelative, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap, {\n ComponentMapFile,\n Config,\n getIgnoreListHarmony,\n} from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport MissingMainFile from '@teambit/legacy/dist/consumer/bit-map/exceptions/missing-main-file';\nimport {\n DuplicateIds,\n EmptyDirectory,\n ExcludedMainFile,\n MainFileIsDir,\n NoFiles,\n PathsNotExist,\n} from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions';\nimport { AddingIndividualFiles } from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/adding-individual-files';\nimport MissingMainFileMultipleComponents from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/missing-main-file-multiple-components';\nimport { ParentDirTracked } from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/parent-dir-tracked';\nimport PathOutsideConsumer from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/path-outside-consumer';\nimport VersionShouldBeRemoved from '@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/version-should-be-removed';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { Workspace } from '@teambit/workspace';\nimport determineMainFile from './determine-main-file';\n\nexport type AddResult = { id: ComponentID; files: ComponentMapFile[] };\nexport type Warnings = {\n alreadyUsed: Record<string, any>;\n emptyDirectory: string[];\n existInScope: ComponentID[];\n};\nexport type AddActionResults = { addedComponents: AddResult[]; warnings: Warnings };\nexport type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\ntype PathsStats = { [PathOsBased]: { isDir: boolean } };\nexport type AddedComponent = {\n componentId: ComponentID;\n files: ComponentMapFile[];\n mainFile?: PathOsBased | null | undefined;\n trackDir: PathOsBased;\n idFromPath:\n | {\n name: string;\n namespace: string;\n }\n | null\n | undefined;\n immediateDir?: string;\n};\nconst REGEX_DSL_PATTERN = /{([^}]+)}/g;\n\nexport type AddProps = {\n componentPaths: PathOsBased[];\n id?: string;\n main?: PathOsBased;\n namespace?: string;\n override: boolean;\n trackDirFeature?: boolean;\n defaultScope?: string;\n config?: Config;\n shouldHandleOutOfSync?: boolean;\n env?: string;\n};\n// This is the contxt of the add operation. By default, the add is executed in the same folder in which the consumer is located and it is the process.cwd().\n// In that case , give the value false to overridenConsumer .\n// There is a possibility to execute add when the process.cwd() is different from the project directory. In that case , when add is done on a folder wchih is\n// Different from process.cwd(), transfer true.\n// Required for determining if the paths are relative to consumer or to process.cwd().\nexport type AddContext = {\n workspace: Workspace;\n alternateCwd?: string;\n};\n\nexport default class AddComponents {\n workspace: Workspace;\n consumer: Consumer;\n bitMap: BitMap;\n componentPaths: PathOsBased[];\n id: string | null | undefined; // id entered by the user\n main: PathOsBased | null | undefined;\n namespace: string | null | undefined;\n override: boolean; // (default = false) replace the files array or only add files.\n trackDirFeature: boolean | null | undefined;\n warnings: Warnings;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n ignoreList: string[];\n gitIgnore: any;\n alternateCwd: string | null | undefined;\n addedComponents: AddResult[];\n defaultScope?: string; // helpful for out-of-sync\n config?: Config;\n shouldHandleOutOfSync?: boolean; // only bit-add (not bit-create/new) should handle out-of-sync scenario\n constructor(context: AddContext, addProps: AddProps) {\n this.alternateCwd = context.alternateCwd;\n this.workspace = context.workspace;\n this.consumer = context.workspace.consumer;\n this.bitMap = this.consumer.bitMap;\n this.componentPaths = this.joinConsumerPathIfNeeded(addProps.componentPaths);\n this.id = addProps.id;\n this.main = addProps.main;\n this.namespace = addProps.namespace;\n this.override = addProps.override;\n this.trackDirFeature = addProps.trackDirFeature;\n this.warnings = {\n alreadyUsed: {},\n emptyDirectory: [],\n existInScope: [],\n };\n this.addedComponents = [];\n this.defaultScope = addProps.defaultScope;\n this.config = addProps.config;\n this.shouldHandleOutOfSync = addProps.shouldHandleOutOfSync;\n }\n\n joinConsumerPathIfNeeded(paths: PathOrDSL[]): PathOrDSL[] {\n if (paths.length > 0) {\n if (this.alternateCwd !== undefined && this.alternateCwd !== null) {\n const alternate = this.alternateCwd;\n return paths.map((file) => path.join(alternate, file));\n }\n return paths;\n }\n return [];\n }\n\n /**\n * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.\n * @param {*} filesWithPotentialDsl - array of file-path which may have DSL patterns\n *\n * @returns array of file-paths from 'files' parameter that match the patterns from 'filesWithPotentialDsl' parameter\n */\n async getFilesAccordingToDsl(files: PathLinux[], filesWithPotentialDsl: PathOrDSL[]): Promise<PathLinux[]> {\n const filesListAllMatches = filesWithPotentialDsl.map(async (dsl) => {\n const filesListMatch = files.map(async (file) => {\n const fileInfo = calculateFileInfo(file);\n const generatedFile = format(dsl, fileInfo);\n const matches = await glob(generatedFile);\n const matchesAfterGitIgnore = this.gitIgnore.filter(matches);\n return matchesAfterGitIgnore.filter((match) => fs.existsSync(match));\n });\n return Promise.all(filesListMatch);\n });\n\n const filesListFlatten = R.flatten(await Promise.all(filesListAllMatches));\n const filesListUnique = R.uniq(filesListFlatten);\n return filesListUnique.map((file) => {\n // when files array has the test file with different letter case, use the one from the file array\n const fileNormalized = pathNormalizeToLinux(file);\n const fileWithCorrectCase = files.find((f) => f.toLowerCase() === fileNormalized.toLowerCase()) || fileNormalized;\n const relativeToConsumer = this.consumer.getPathRelativeToConsumer(fileWithCorrectCase);\n return pathNormalizeToLinux(relativeToConsumer);\n });\n }\n\n /**\n * for imported component, the package.json in the root directory is a bit-generated file and as\n * such, it should be ignored\n */\n _isPackageJsonOnRootDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isPackageJsonOnRootDir should not get called on non imported components');\n }\n return path.join(componentMap.rootDir, PACKAGE_JSON) === path.normalize(pathRelativeToConsumerRoot);\n }\n\n /**\n * imported components might have wrapDir, when they do, files should not be added outside of\n * that wrapDir\n */\n _isOutsideOfWrapDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isOutsideOfWrapDir should not get called on non imported components');\n }\n if (!componentMap.wrapDir) return false;\n const wrapDirRelativeToConsumerRoot = path.join(componentMap.rootDir, componentMap.wrapDir);\n return !path.normalize(pathRelativeToConsumerRoot).startsWith(wrapDirRelativeToConsumerRoot);\n }\n\n /**\n * Add or update existing (imported and new) component according to bitmap\n * there are 3 options:\n * 1. a user is adding a new component. there is no record for this component in bit.map\n * 2. a user is updating an existing component. there is a record for this component in bit.map\n * 3. some or all the files of this component were previously added as another component-id.\n */\n async addOrUpdateComponentInBitMap(component: AddedComponent): Promise<AddResult | null | undefined> {\n const consumerPath = this.consumer.getPath();\n const parsedBitId = component.componentId;\n const componentFromScope = await this.consumer.scope.getModelComponentIfExist(parsedBitId);\n const files: ComponentMapFile[] = component.files;\n const foundComponentFromBitMap = this.bitMap.getComponentIfExist(component.componentId, {\n ignoreVersion: true,\n });\n const componentFilesP = files.map(async (file: ComponentMapFile) => {\n // $FlowFixMe null is removed later on\n const filePath = path.join(consumerPath, file.relativePath);\n const isAutoGenerated = await isAutoGeneratedFile(filePath);\n if (isAutoGenerated) {\n return null;\n }\n const caseSensitive = false;\n const existingIdOfFile = this.bitMap.getComponentIdByPath(file.relativePath, caseSensitive);\n const idOfFileIsDifferent = existingIdOfFile && !existingIdOfFile.isEqual(parsedBitId);\n if (idOfFileIsDifferent) {\n // not imported component file but exists in bitmap\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.warnings.alreadyUsed[existingIdOfFile]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile].push(file.relativePath);\n } else {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile] = [file.relativePath];\n }\n return null;\n }\n if (!foundComponentFromBitMap && componentFromScope && this.shouldHandleOutOfSync) {\n const newId = componentFromScope.toComponentIdWithLatestVersion();\n if (!this.defaultScope || this.defaultScope === newId.scope) {\n // otherwise, if defaultScope !== newId.scope, they're different components,\n // and no need to change the id.\n // for more details about this scenario, see https://github.com/teambit/bit/issues/1543, last case.\n component.componentId = newId;\n this.warnings.existInScope.push(newId);\n }\n }\n return file;\n });\n // @ts-ignore it can't be null due to the filter function\n const componentFiles: ComponentMapFile[] = (await Promise.all(componentFilesP)).filter((file) => file);\n if (!componentFiles.length) return { id: component.componentId, files: [] };\n if (foundComponentFromBitMap) {\n this._updateFilesAccordingToExistingRootDir(foundComponentFromBitMap, componentFiles, component);\n }\n if (this.trackDirFeature) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.bitMap._areFilesArraysEqual(foundComponentFromBitMap.files, componentFiles)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return foundComponentFromBitMap;\n }\n }\n if (!this.override && foundComponentFromBitMap) {\n this._updateFilesWithCurrentLetterCases(foundComponentFromBitMap, componentFiles);\n component.files = this._mergeFilesWithExistingComponentMapFiles(componentFiles, foundComponentFromBitMap.files);\n } else {\n component.files = componentFiles;\n }\n\n const { componentId, trackDir } = component;\n const mainFile = determineMainFile(component, foundComponentFromBitMap);\n const getRootDir = (): PathLinuxRelative => {\n if (this.trackDirFeature) throw new Error('track dir should not calculate the rootDir');\n if (foundComponentFromBitMap) return foundComponentFromBitMap.rootDir;\n if (!trackDir) throw new Error(`addOrUpdateComponentInBitMap expect to have trackDir for non-legacy workspace`);\n const fileNotInsideTrackDir = componentFiles.find(\n (file) => !pathNormalizeToLinux(file.relativePath).startsWith(`${pathNormalizeToLinux(trackDir)}/`)\n );\n if (fileNotInsideTrackDir) {\n // we check for this error before. however, it's possible that a user have one trackDir\n // and another dir for the tests.\n throw new AddingIndividualFiles(fileNotInsideTrackDir.relativePath);\n }\n return pathNormalizeToLinux(trackDir);\n };\n const getComponentMap = async (): Promise<ComponentMap> => {\n if (this.trackDirFeature) {\n return this.bitMap.addFilesToComponent({ componentId, files: component.files });\n }\n const rootDir = getRootDir();\n const getDefaultScope = async () => {\n if (componentId.hasScope()) return undefined;\n return this.getDefaultScope(rootDir, componentId.fullName);\n };\n const defaultScope = await getDefaultScope();\n const componentMap = this.bitMap.addComponent({\n componentId: new ComponentID(componentId._legacy, defaultScope),\n files: component.files,\n defaultScope,\n config: this.config,\n mainFile,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n override: this.override,\n });\n componentMap.changeRootDirAndUpdateFilesAccordingly(rootDir);\n return componentMap;\n };\n const componentMap = await getComponentMap();\n return { id: componentId, files: componentMap.files };\n }\n\n /**\n * current componentFiles are relative to the workspace. we want them relative to the rootDir.\n */\n _updateFilesAccordingToExistingRootDir(\n foundComponentFromBitMap: ComponentMap,\n componentFiles: ComponentMapFile[],\n component: AddedComponent\n ) {\n const existingRootDir = foundComponentFromBitMap.rootDir;\n if (!existingRootDir) return; // nothing to do.\n const areFilesInsideExistingRootDir = componentFiles.every((file) =>\n pathNormalizeToLinux(file.relativePath).startsWith(`${existingRootDir}/`)\n );\n if (areFilesInsideExistingRootDir) {\n ComponentMap.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);\n return;\n }\n // some (or all) added files are outside the existing rootDir, the rootDir needs to be changed\n // if a directory was added and it's a parent of the existing rootDir, change the rootDir to\n // the currently added rootDir.\n const currentlyAddedDir = pathNormalizeToLinux(component.trackDir);\n const currentlyAddedDirParentOfRootDir = currentlyAddedDir && existingRootDir.startsWith(`${currentlyAddedDir}/`);\n if (currentlyAddedDirParentOfRootDir) {\n foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly(currentlyAddedDir);\n ComponentMap.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);\n return;\n }\n throw new GeneralError(`unable to add individual files outside the root dir (${existingRootDir}) of ${component.componentId}.\nyou can add the directory these files are located at and it'll change the root dir of the component accordingly`);\n // we might want to change the behavior here to not throw an error and only change the rootDir to \".\"\n // foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly('.');\n }\n\n /**\n * the risk with merging the currently added files with the existing bitMap files is overriding\n * the `test` property. e.g. the component directory is re-added without adding the tests flag to\n * track new files in that directory. in this case, we want to preserve the `test` property.\n */\n _mergeFilesWithExistingComponentMapFiles(\n componentFiles: ComponentMapFile[],\n existingComponentMapFile: ComponentMapFile[]\n ) {\n return R.unionWith(R.eqBy(R.prop('relativePath')), existingComponentMapFile, componentFiles);\n }\n\n /**\n * if an existing file is for example uppercase and the new file is lowercase it has different\n * behavior according to the OS. some OS are case sensitive, some are not.\n * it's safer to avoid saving both files and instead, replacing the old file with the new one.\n * in case a file has replaced and it is also a mainFile, replace the mainFile as well\n */\n _updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]) {\n const currentFiles = currentComponentMap.files;\n currentFiles.forEach((currentFile) => {\n const sameFile = newFiles.find(\n (newFile) => newFile.relativePath.toLowerCase() === currentFile.relativePath.toLowerCase()\n );\n if (sameFile && currentFile.relativePath !== sameFile.relativePath) {\n if (currentComponentMap.mainFile === currentFile.relativePath) {\n currentComponentMap.mainFile = sameFile.relativePath;\n }\n currentFile.relativePath = sameFile.relativePath;\n }\n });\n }\n\n /**\n * if the id is already saved in bitmap file, it might have more data (such as scope, version)\n * use that id instead.\n */\n private _getIdAccordingToExistingComponent(currentId: BitIdStr): ComponentID | undefined {\n const idWithScope = this.defaultScope ? `${this.defaultScope}/${currentId}` : currentId;\n const existingComponentId = this.bitMap.getExistingBitId(idWithScope, false);\n if (currentId.includes(VERSION_DELIMITER)) {\n if (\n !existingComponentId || // this id is new, it shouldn't have a version\n !existingComponentId.hasVersion() || // this component is new, it shouldn't have a version\n // user shouldn't add files to a an existing component with different version\n existingComponentId.version !== ComponentID.getVersionFromString(currentId)\n ) {\n throw new VersionShouldBeRemoved(currentId);\n }\n }\n return existingComponentId;\n }\n\n _getIdAccordingToTrackDir(dir: PathOsBased): ComponentID | null | undefined {\n const dirNormalizedToLinux = pathNormalizeToLinux(dir);\n const trackDirs = this.bitMap.getAllTrackDirs();\n if (!trackDirs) return null;\n return trackDirs[dirNormalizedToLinux];\n }\n\n /**\n * used for updating main file if exists or doesn't exists\n */\n _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined {\n let mainFile = this.main;\n if (mainFile && mainFile.match(REGEX_DSL_PATTERN)) {\n // it's a DSL\n files.forEach((file) => {\n const fileInfo = calculateFileInfo(file.relativePath);\n const generatedFile = format(mainFile, fileInfo);\n const foundFile = this._findMainFileInFiles(generatedFile, files);\n if (foundFile) {\n mainFile = foundFile.relativePath;\n }\n if (fs.existsSync(generatedFile) && !foundFile) {\n const shouldIgnore = this.gitIgnore.ignores(generatedFile);\n if (shouldIgnore) {\n // check if file is in exclude list\n throw new ExcludedMainFile(generatedFile);\n }\n files.push({\n relativePath: pathNormalizeToLinux(generatedFile),\n test: false,\n name: path.basename(generatedFile),\n });\n mainFile = generatedFile;\n }\n });\n }\n if (!mainFile) return undefined;\n if (this.alternateCwd) {\n mainFile = path.join(this.alternateCwd, mainFile);\n }\n const mainFileRelativeToConsumer = this.consumer.getPathRelativeToConsumer(mainFile);\n const mainPath = this.consumer.toAbsolutePath(mainFileRelativeToConsumer);\n if (fs.existsSync(mainPath)) {\n const shouldIgnore = this.gitIgnore.ignores(mainFileRelativeToConsumer);\n if (shouldIgnore) throw new ExcludedMainFile(mainFileRelativeToConsumer);\n if (isDir(mainPath)) {\n throw new MainFileIsDir(mainPath);\n }\n const foundFile = this._findMainFileInFiles(mainFileRelativeToConsumer, files);\n if (foundFile) {\n return foundFile.relativePath;\n }\n files.push({\n relativePath: pathNormalizeToLinux(mainFileRelativeToConsumer),\n test: false,\n name: path.basename(mainFileRelativeToConsumer),\n });\n return mainFileRelativeToConsumer;\n }\n return mainFile;\n }\n\n _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]) {\n const normalizedMainFile = pathNormalizeToLinux(mainFile).toLowerCase();\n return files.find((file) => file.relativePath.toLowerCase() === normalizedMainFile);\n }\n\n private async getDefaultScope(rootDir: string, componentName: string): Promise<string> {\n return (this.defaultScope ||\n (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentName))) as string;\n }\n\n /**\n * given the component paths, prepare the id, mainFile and files to be added later on to bitmap\n * the id of the component is either entered by the user or, if not entered, concluded by the path.\n * e.g. bar/foo.js, the id would be bar/foo.\n * in case bitmap has already the same id, the complete id is taken from bitmap (see _getIdAccordingToExistingComponent)\n */\n async addOneComponent(componentPath: PathOsBased): Promise<AddedComponent> {\n let finalBitId: ComponentID | undefined; // final id to use for bitmap file\n let idFromPath;\n if (this.id) {\n finalBitId = this._getIdAccordingToExistingComponent(this.id);\n }\n const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);\n this._throwForOutsideConsumer(relativeComponentPath);\n this.throwForExistingParentDir(relativeComponentPath);\n const matches = await glob(path.join(relativeComponentPath, '**'), {\n cwd: this.consumer.getPath(),\n nodir: true,\n });\n\n if (!matches.length) throw new EmptyDirectory(componentPath);\n\n const filteredMatches = this.gitIgnore.filter(matches);\n\n if (!filteredMatches.length) {\n throw new NoFiles(matches);\n }\n\n const filteredMatchedFiles = filteredMatches.map((match: PathOsBased) => {\n return { relativePath: pathNormalizeToLinux(match), test: false, name: path.basename(match) };\n });\n const resolvedMainFile = this._addMainFileToFiles(filteredMatchedFiles);\n\n const absoluteComponentPath = path.resolve(componentPath);\n const splitPath = absoluteComponentPath.split(path.sep);\n const lastDir = splitPath[splitPath.length - 1];\n const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);\n if (!finalBitId) {\n if (this.id) {\n const bitId = BitId.parse(this.id, false);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n } else if (idOfTrackDir) {\n finalBitId = idOfTrackDir;\n } else {\n const nameSpaceOrDir = this.namespace || splitPath[splitPath.length - 2];\n if (!this.namespace) {\n idFromPath = { namespace: BitId.getValidIdChunk(nameSpaceOrDir), name: BitId.getValidIdChunk(lastDir) };\n }\n const bitId = BitId.getValidBitId(nameSpaceOrDir, lastDir);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n }\n }\n const trackDir = relativeComponentPath;\n const addedComp = {\n componentId: finalBitId,\n files: filteredMatchedFiles,\n mainFile: resolvedMainFile,\n trackDir,\n idFromPath,\n immediateDir: lastDir,\n };\n\n return addedComp;\n }\n\n getIgnoreList(): string[] {\n const consumerPath = this.consumer.getPath();\n return getIgnoreListHarmony(consumerPath);\n }\n\n async add(): Promise<AddActionResults> {\n this.ignoreList = this.getIgnoreList();\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n let componentPathsStats: PathsStats = {};\n\n const resolvedComponentPathsWithoutGitIgnore = R.flatten(\n await Promise.all(this.componentPaths.map((componentPath) => glob(componentPath)))\n );\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);\n // Run diff on both arrays to see what was filtered out because of the gitignore file\n const diff = arrayDiff(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);\n\n if (R.isEmpty(resolvedComponentPathsWithoutGitIgnore)) {\n throw new PathsNotExist(this.componentPaths);\n }\n if (!R.isEmpty(resolvedComponentPathsWithGitIgnore)) {\n componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);\n } else {\n throw new NoFiles(diff);\n }\n Object.keys(componentPathsStats).forEach((compPath) => {\n if (!componentPathsStats[compPath].isDir) {\n throw new AddingIndividualFiles(compPath);\n }\n });\n if (Object.keys(componentPathsStats).length > 1 && this.id) {\n throw new BitError(\n `the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`\n );\n }\n // if a user entered multiple paths and entered an id, he wants all these paths to be one component\n // conversely, if a user entered multiple paths without id, he wants each dir as an individual component\n const isMultipleComponents = Object.keys(componentPathsStats).length > 1;\n if (isMultipleComponents) {\n await this.addMultipleComponents(componentPathsStats);\n } else {\n logger.debugAndAddBreadCrumb('add-components', 'adding one component');\n // when a user enters more than one directory, he would like to keep the directories names\n // so then when a component is imported, it will write the files into the original directories\n const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);\n await this._removeNamespaceIfNotNeeded([addedOne]);\n if (!R.isEmpty(addedOne.files)) {\n const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);\n if (addedResult) this.addedComponents.push(addedResult);\n }\n }\n await this.linkComponents(this.addedComponents.map((item) => item.id));\n Analytics.setExtraData('num_components', this.addedComponents.length);\n return { addedComponents: this.addedComponents, warnings: this.warnings };\n }\n\n async linkComponents(ids: ComponentID[]) {\n if (this.trackDirFeature) {\n // if trackDirFeature is set, it happens during the component-load and because we load the\n // components in the next line, it gets into an infinite loop.\n return;\n }\n await linkToNodeModulesByIds(this.workspace, ids);\n }\n\n async addMultipleComponents(componentPathsStats: PathsStats): Promise<void> {\n logger.debugAndAddBreadCrumb('add-components', 'adding multiple components');\n this._removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats);\n const added = await this._tryAddingMultiple(componentPathsStats);\n validateNoDuplicateIds(added);\n await this._removeNamespaceIfNotNeeded(added);\n await this._addMultipleToBitMap(added);\n }\n\n /**\n * some uses of wildcards might add directories and their files at the same time, in such cases\n * only the files are needed and the directories can be ignored.\n * @see https://github.com/teambit/bit/issues/1406 for more details\n */\n _removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats) {\n const allPaths = Object.keys(componentPathsStats);\n allPaths.forEach((componentPath) => {\n const foundDir = allPaths.find((p) => p === path.dirname(componentPath));\n if (foundDir && componentPathsStats[foundDir]) {\n logger.debug(`add-components._removeDirectoriesWhenTheirFilesAreAdded, ignoring ${foundDir}`);\n delete componentPathsStats[foundDir];\n }\n });\n }\n\n async _addMultipleToBitMap(added: AddedComponent[]): Promise<void> {\n const missingMainFiles = [];\n await Promise.all(\n added.map(async (component) => {\n if (!R.isEmpty(component.files)) {\n try {\n const addedComponent = await this.addOrUpdateComponentInBitMap(component);\n if (addedComponent && addedComponent.files.length) this.addedComponents.push(addedComponent);\n } catch (err: any) {\n if (!(err instanceof MissingMainFile)) throw err;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n missingMainFiles.push(err);\n }\n }\n })\n );\n if (missingMainFiles.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n throw new MissingMainFileMultipleComponents(missingMainFiles.map((err) => err.componentId).sort());\n }\n }\n\n async _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]) {\n const allIds = this.bitMap.getAllBitIdsFromAllLanes();\n await Promise.all(\n addedComponents.map(async (addedComponent) => {\n if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.\n const componentsWithSameName = addedComponents.filter(\n (a) => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath?.name\n );\n const bitIdFromNameOnly = new BitId({ name: addedComponent.idFromPath.name });\n const defaultScope = await this.getDefaultScope(addedComponent.trackDir, bitIdFromNameOnly.name);\n const componentIdFromNameOnly = new ComponentID(bitIdFromNameOnly, defaultScope);\n const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(componentIdFromNameOnly);\n if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {\n addedComponent.componentId = componentIdFromNameOnly;\n }\n })\n );\n }\n\n async _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]> {\n const addedP = Object.keys(componentPathsStats).map(async (onePath) => {\n try {\n const addedComponent = await this.addOneComponent(onePath);\n return addedComponent;\n } catch (err: any) {\n if (!(err instanceof EmptyDirectory)) throw err;\n this.warnings.emptyDirectory.push(onePath);\n return null;\n }\n });\n const added = await Promise.all(addedP);\n return R.reject(R.isNil, added);\n }\n\n _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased) {\n if (relativeToConsumerPath.startsWith('..')) {\n throw new PathOutsideConsumer(relativeToConsumerPath);\n }\n }\n\n private throwForExistingParentDir(relativeToConsumerPath: PathOsBased) {\n const isParentDir = (parent: string) => {\n const relative = path.relative(parent, relativeToConsumerPath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n this.bitMap.components.forEach((componentMap) => {\n if (!componentMap.rootDir) return;\n if (isParentDir(componentMap.rootDir)) {\n throw new ParentDirTracked(\n componentMap.rootDir,\n componentMap.id.toStringWithoutVersion(),\n relativeToConsumerPath\n );\n }\n });\n }\n}\n\n/**\n * validatePaths - validate if paths entered by user exist and if not throw an error\n *\n * @param {string[]} fileArray - array of paths\n * @returns {PathsStats} componentPathsStats\n */\nfunction validatePaths(fileArray: string[]): PathsStats {\n const componentPathsStats = {};\n fileArray.forEach((componentPath) => {\n if (!fs.existsSync(componentPath)) {\n throw new PathsNotExist([componentPath]);\n }\n componentPathsStats[componentPath] = {\n isDir: isDir(componentPath),\n };\n });\n return componentPathsStats;\n}\n\n/**\n * validate that no two files where added with the same id in the same bit add command\n */\nfunction validateNoDuplicateIds(addComponents: Record<string, any>[]) {\n const duplicateIds = {};\n const newGroupedComponents = groupby(addComponents, 'componentId');\n Object.keys(newGroupedComponents).forEach((key) => {\n if (newGroupedComponents[key].length > 1) duplicateIds[key] = newGroupedComponents[key];\n });\n if (!R.isEmpty(duplicateIds) && !R.isNil(duplicateIds)) throw new DuplicateIds(duplicateIds);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAA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OAAO,CAAC0D,YAAY,CAAC,IAAI,CAACzN,gBAAC,CAAC4M,KAAK,CAACa,YAAY,CAAC,EAAE,MAAM,KAAIG,0BAAY,EAACH,YAAY,CAAC;AAC9F"}
@@ -3,12 +3,12 @@ import { Workspace } from '@teambit/workspace';
3
3
  import { Logger, LoggerMain } from '@teambit/logger';
4
4
  import { PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';
5
5
  import { AddActionResults, AddProps, Warnings } from './add-components';
6
- export declare type TrackResult = {
6
+ export type TrackResult = {
7
7
  componentName: string;
8
8
  files: string[];
9
9
  warnings: Warnings;
10
10
  };
11
- export declare type TrackData = {
11
+ export type TrackData = {
12
12
  rootDir: PathOsBasedRelative;
13
13
  componentName?: string;
14
14
  mainFile?: string;
@@ -45,7 +45,7 @@ export declare class TrackerMain {
45
45
  * otherwise, it is self-hosted
46
46
  */
47
47
  private isHostedByBit;
48
- static slots: never[];
48
+ static slots: any[];
49
49
  static dependencies: import("@teambit/harmony").Aspect[];
50
50
  static runtime: import("@teambit/harmony").RuntimeDefinition;
51
51
  static provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]): Promise<TrackerMain>;
@@ -84,8 +84,8 @@ class TrackerMain {
84
84
  });
85
85
  const result = await addComponent.add();
86
86
  const addedComponent = result.addedComponents[0];
87
- const componentName = (addedComponent === null || addedComponent === void 0 ? void 0 : addedComponent.id.fullName) || trackData.componentName;
88
- const files = (addedComponent === null || addedComponent === void 0 ? void 0 : addedComponent.files.map(f => f.relativePath)) || [];
87
+ const componentName = addedComponent?.id.fullName || trackData.componentName;
88
+ const files = addedComponent?.files.map(f => f.relativePath) || [];
89
89
  return {
90
90
  componentName,
91
91
  files,