@teambit/tracker 1.0.26 → 1.0.28
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.
- package/dist/add-components.d.ts +10 -12
- package/dist/add-components.js +48 -39
- package/dist/add-components.js.map +1 -1
- package/dist/tracker.main.runtime.js +1 -1
- package/dist/tracker.main.runtime.js.map +1 -1
- package/package.json +11 -9
- /package/dist/{preview-1697599041985.js → preview-1697836073970.js} +0 -0
package/dist/add-components.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BitIdStr } from '@teambit/legacy/dist/bit-id/bit-id';
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
3
2
|
import BitMap from '@teambit/legacy/dist/consumer/bit-map';
|
|
4
3
|
import Consumer from '@teambit/legacy/dist/consumer/consumer';
|
|
5
|
-
import { ModelComponent } from '@teambit/legacy/dist/scope/models';
|
|
6
4
|
import { PathLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';
|
|
7
5
|
import ComponentMap, { ComponentMapFile, Config } from '@teambit/legacy/dist/consumer/bit-map/component-map';
|
|
8
6
|
import { Workspace } from '@teambit/workspace';
|
|
9
7
|
export declare type AddResult = {
|
|
10
|
-
id:
|
|
8
|
+
id: ComponentID;
|
|
11
9
|
files: ComponentMapFile[];
|
|
12
10
|
};
|
|
13
11
|
export declare type Warnings = {
|
|
14
12
|
alreadyUsed: Record<string, any>;
|
|
15
13
|
emptyDirectory: string[];
|
|
16
|
-
existInScope:
|
|
14
|
+
existInScope: ComponentID[];
|
|
17
15
|
};
|
|
18
16
|
export declare type AddActionResults = {
|
|
19
17
|
addedComponents: AddResult[];
|
|
@@ -22,10 +20,10 @@ export declare type AddActionResults = {
|
|
|
22
20
|
export declare type PathOrDSL = PathOsBased | string;
|
|
23
21
|
declare type PathsStats = {};
|
|
24
22
|
export declare type AddedComponent = {
|
|
25
|
-
componentId:
|
|
23
|
+
componentId: ComponentID;
|
|
26
24
|
files: ComponentMapFile[];
|
|
27
25
|
mainFile?: PathOsBased | null | undefined;
|
|
28
|
-
trackDir
|
|
26
|
+
trackDir: PathOsBased;
|
|
29
27
|
idFromPath: {
|
|
30
28
|
name: string;
|
|
31
29
|
namespace: string;
|
|
@@ -110,18 +108,18 @@ export default class AddComponents {
|
|
|
110
108
|
* in case a file has replaced and it is also a mainFile, replace the mainFile as well
|
|
111
109
|
*/
|
|
112
110
|
_updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]): void;
|
|
113
|
-
_getComponentFromScopeIfExist(id: BitId): Promise<ModelComponent | null | undefined>;
|
|
114
111
|
/**
|
|
115
112
|
* if the id is already saved in bitmap file, it might have more data (such as scope, version)
|
|
116
113
|
* use that id instead.
|
|
117
114
|
*/
|
|
118
|
-
_getIdAccordingToExistingComponent
|
|
119
|
-
_getIdAccordingToTrackDir(dir: PathOsBased):
|
|
115
|
+
private _getIdAccordingToExistingComponent;
|
|
116
|
+
_getIdAccordingToTrackDir(dir: PathOsBased): ComponentID | null | undefined;
|
|
120
117
|
/**
|
|
121
118
|
* used for updating main file if exists or doesn't exists
|
|
122
119
|
*/
|
|
123
120
|
_addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined;
|
|
124
121
|
_findMainFileInFiles(mainFile: string, files: ComponentMapFile[]): ComponentMapFile | undefined;
|
|
122
|
+
private getDefaultScope;
|
|
125
123
|
/**
|
|
126
124
|
* given the component paths, prepare the id, mainFile and files to be added later on to bitmap
|
|
127
125
|
* the id of the component is either entered by the user or, if not entered, concluded by the path.
|
|
@@ -131,7 +129,7 @@ export default class AddComponents {
|
|
|
131
129
|
addOneComponent(componentPath: PathOsBased): Promise<AddedComponent>;
|
|
132
130
|
getIgnoreList(): string[];
|
|
133
131
|
add(): Promise<AddActionResults>;
|
|
134
|
-
linkComponents(ids:
|
|
132
|
+
linkComponents(ids: ComponentID[]): Promise<void>;
|
|
135
133
|
addMultipleComponents(componentPathsStats: PathsStats): Promise<void>;
|
|
136
134
|
/**
|
|
137
135
|
* some uses of wildcards might add directories and their files at the same time, in such cases
|
|
@@ -140,7 +138,7 @@ export default class AddComponents {
|
|
|
140
138
|
*/
|
|
141
139
|
_removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats): void;
|
|
142
140
|
_addMultipleToBitMap(added: AddedComponent[]): Promise<void>;
|
|
143
|
-
_removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]): void
|
|
141
|
+
_removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]): Promise<void>;
|
|
144
142
|
_tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]>;
|
|
145
143
|
_throwForOutsideConsumer(relativeToConsumerPath: PathOsBased): void;
|
|
146
144
|
private throwForExistingParentDir;
|
package/dist/add-components.js
CHANGED
|
@@ -60,9 +60,16 @@ function _analytics() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const data = require("@teambit/
|
|
65
|
-
|
|
63
|
+
function _componentId() {
|
|
64
|
+
const data = require("@teambit/component-id");
|
|
65
|
+
_componentId = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
function _legacyBitId() {
|
|
71
|
+
const data = require("@teambit/legacy-bit-id");
|
|
72
|
+
_legacyBitId = function () {
|
|
66
73
|
return data;
|
|
67
74
|
};
|
|
68
75
|
return data;
|
|
@@ -312,7 +319,7 @@ class AddComponents {
|
|
|
312
319
|
async addOrUpdateComponentInBitMap(component) {
|
|
313
320
|
const consumerPath = this.consumer.getPath();
|
|
314
321
|
const parsedBitId = component.componentId;
|
|
315
|
-
const componentFromScope = await this.
|
|
322
|
+
const componentFromScope = await this.consumer.scope.getModelComponentIfExist(parsedBitId);
|
|
316
323
|
const files = component.files;
|
|
317
324
|
const foundComponentFromBitMap = this.bitMap.getComponentIfExist(component.componentId, {
|
|
318
325
|
ignoreVersion: true
|
|
@@ -340,7 +347,7 @@ class AddComponents {
|
|
|
340
347
|
return null;
|
|
341
348
|
}
|
|
342
349
|
if (!foundComponentFromBitMap && componentFromScope && this.shouldHandleOutOfSync) {
|
|
343
|
-
const newId = componentFromScope.
|
|
350
|
+
const newId = componentFromScope.toComponentIdWithLatestVersion();
|
|
344
351
|
if (!this.defaultScope || this.defaultScope === newId.scope) {
|
|
345
352
|
// otherwise, if defaultScope !== newId.scope, they're different components,
|
|
346
353
|
// and no need to change the id.
|
|
@@ -399,12 +406,12 @@ class AddComponents {
|
|
|
399
406
|
}
|
|
400
407
|
const rootDir = getRootDir();
|
|
401
408
|
const getDefaultScope = async () => {
|
|
402
|
-
if (componentId.
|
|
403
|
-
return this.
|
|
409
|
+
if (componentId.hasScope()) return undefined;
|
|
410
|
+
return this.getDefaultScope(rootDir, componentId.fullName);
|
|
404
411
|
};
|
|
405
412
|
const defaultScope = await getDefaultScope();
|
|
406
413
|
const componentMap = this.bitMap.addComponent({
|
|
407
|
-
componentId,
|
|
414
|
+
componentId: new (_componentId().ComponentID)(componentId._legacy, defaultScope),
|
|
408
415
|
files: component.files,
|
|
409
416
|
defaultScope,
|
|
410
417
|
config: this.config,
|
|
@@ -476,35 +483,25 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
476
483
|
}
|
|
477
484
|
});
|
|
478
485
|
}
|
|
479
|
-
async _getComponentFromScopeIfExist(id) {
|
|
480
|
-
try {
|
|
481
|
-
return await this.consumer.scope.getModelComponentIgnoreScope(id);
|
|
482
|
-
} catch (err) {
|
|
483
|
-
return null;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
486
|
|
|
487
487
|
/**
|
|
488
488
|
* if the id is already saved in bitmap file, it might have more data (such as scope, version)
|
|
489
489
|
* use that id instead.
|
|
490
490
|
*/
|
|
491
491
|
_getIdAccordingToExistingComponent(currentId) {
|
|
492
|
-
const
|
|
492
|
+
const idWithScope = this.defaultScope ? `${this.defaultScope}/${currentId}` : currentId;
|
|
493
|
+
const existingComponentId = this.bitMap.getExistingBitId(idWithScope, false);
|
|
493
494
|
if (currentId.includes(_constants().VERSION_DELIMITER)) {
|
|
494
495
|
if (!existingComponentId ||
|
|
495
496
|
// this id is new, it shouldn't have a version
|
|
496
497
|
!existingComponentId.hasVersion() ||
|
|
497
498
|
// this component is new, it shouldn't have a version
|
|
498
499
|
// user shouldn't add files to a an existing component with different version
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
existingComponentId.version !== _bitId().BitId.getVersionOnlyFromString(this.id)) {
|
|
502
|
-
// $FlowFixMe this.id is defined here
|
|
503
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
504
|
-
throw new (_versionShouldBeRemoved().default)(this.id);
|
|
500
|
+
existingComponentId.version !== _componentId().ComponentID.getVersionFromString(currentId)) {
|
|
501
|
+
throw new (_versionShouldBeRemoved().default)(currentId);
|
|
505
502
|
}
|
|
506
503
|
}
|
|
507
|
-
return existingComponentId
|
|
504
|
+
return existingComponentId;
|
|
508
505
|
}
|
|
509
506
|
_getIdAccordingToTrackDir(dir) {
|
|
510
507
|
const dirNormalizedToLinux = (0, _utils().pathNormalizeToLinux)(dir);
|
|
@@ -571,6 +568,9 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
571
568
|
const normalizedMainFile = (0, _utils().pathNormalizeToLinux)(mainFile).toLowerCase();
|
|
572
569
|
return files.find(file => file.relativePath.toLowerCase() === normalizedMainFile);
|
|
573
570
|
}
|
|
571
|
+
async getDefaultScope(rootDir, componentName) {
|
|
572
|
+
return this.defaultScope || (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentName));
|
|
573
|
+
}
|
|
574
574
|
|
|
575
575
|
/**
|
|
576
576
|
* given the component paths, prepare the id, mainFile and files to be added later on to bitmap
|
|
@@ -607,19 +607,25 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
607
607
|
const absoluteComponentPath = path().resolve(componentPath);
|
|
608
608
|
const splitPath = absoluteComponentPath.split(path().sep);
|
|
609
609
|
const lastDir = splitPath[splitPath.length - 1];
|
|
610
|
+
const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);
|
|
610
611
|
if (!finalBitId) {
|
|
611
|
-
|
|
612
|
-
|
|
612
|
+
if (this.id) {
|
|
613
|
+
const bitId = _legacyBitId().BitId.parse(this.id, false);
|
|
614
|
+
const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);
|
|
615
|
+
finalBitId = new (_componentId().ComponentID)(bitId, defaultScope);
|
|
616
|
+
} else if (idOfTrackDir) {
|
|
613
617
|
finalBitId = idOfTrackDir;
|
|
614
618
|
} else {
|
|
615
619
|
const nameSpaceOrDir = this.namespace || splitPath[splitPath.length - 2];
|
|
616
620
|
if (!this.namespace) {
|
|
617
621
|
idFromPath = {
|
|
618
|
-
namespace:
|
|
619
|
-
name:
|
|
622
|
+
namespace: _legacyBitId().BitId.getValidIdChunk(nameSpaceOrDir),
|
|
623
|
+
name: _legacyBitId().BitId.getValidIdChunk(lastDir)
|
|
620
624
|
};
|
|
621
625
|
}
|
|
622
|
-
|
|
626
|
+
const bitId = _legacyBitId().BitId.getValidBitId(nameSpaceOrDir, lastDir);
|
|
627
|
+
const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);
|
|
628
|
+
finalBitId = new (_componentId().ComponentID)(bitId, defaultScope);
|
|
623
629
|
}
|
|
624
630
|
}
|
|
625
631
|
const trackDir = relativeComponentPath;
|
|
@@ -674,7 +680,7 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
674
680
|
// when a user enters more than one directory, he would like to keep the directories names
|
|
675
681
|
// so then when a component is imported, it will write the files into the original directories
|
|
676
682
|
const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);
|
|
677
|
-
this._removeNamespaceIfNotNeeded([addedOne]);
|
|
683
|
+
await this._removeNamespaceIfNotNeeded([addedOne]);
|
|
678
684
|
if (!_ramda().default.isEmpty(addedOne.files)) {
|
|
679
685
|
const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);
|
|
680
686
|
if (addedResult) this.addedComponents.push(addedResult);
|
|
@@ -700,7 +706,7 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
700
706
|
this._removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats);
|
|
701
707
|
const added = await this._tryAddingMultiple(componentPathsStats);
|
|
702
708
|
validateNoDuplicateIds(added);
|
|
703
|
-
this._removeNamespaceIfNotNeeded(added);
|
|
709
|
+
await this._removeNamespaceIfNotNeeded(added);
|
|
704
710
|
await this._addMultipleToBitMap(added);
|
|
705
711
|
}
|
|
706
712
|
|
|
@@ -738,21 +744,24 @@ you can add the directory these files are located at and it'll change the root d
|
|
|
738
744
|
throw new (_missingMainFileMultipleComponents().default)(missingMainFiles.map(err => err.componentId).sort());
|
|
739
745
|
}
|
|
740
746
|
}
|
|
741
|
-
_removeNamespaceIfNotNeeded(addedComponents) {
|
|
747
|
+
async _removeNamespaceIfNotNeeded(addedComponents) {
|
|
742
748
|
const allIds = this.bitMap.getAllBitIdsFromAllLanes();
|
|
743
|
-
addedComponents.
|
|
749
|
+
await Promise.all(addedComponents.map(async addedComponent => {
|
|
744
750
|
if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.
|
|
745
|
-
const componentsWithSameName = addedComponents
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
751
|
+
const componentsWithSameName = addedComponents.filter(a => {
|
|
752
|
+
var _addedComponent$idFro;
|
|
753
|
+
return a.idFromPath && a.idFromPath.name === ((_addedComponent$idFro = addedComponent.idFromPath) === null || _addedComponent$idFro === void 0 ? void 0 : _addedComponent$idFro.name);
|
|
754
|
+
});
|
|
755
|
+
const bitIdFromNameOnly = new (_legacyBitId().BitId)({
|
|
749
756
|
name: addedComponent.idFromPath.name
|
|
750
757
|
});
|
|
751
|
-
const
|
|
758
|
+
const defaultScope = await this.getDefaultScope(addedComponent.trackDir, bitIdFromNameOnly.name);
|
|
759
|
+
const componentIdFromNameOnly = new (_componentId().ComponentID)(bitIdFromNameOnly, defaultScope);
|
|
760
|
+
const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(componentIdFromNameOnly);
|
|
752
761
|
if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {
|
|
753
|
-
addedComponent.componentId =
|
|
762
|
+
addedComponent.componentId = componentIdFromNameOnly;
|
|
754
763
|
}
|
|
755
|
-
});
|
|
764
|
+
}));
|
|
756
765
|
}
|
|
757
766
|
async _tryAddingMultiple(componentPathsStats) {
|
|
758
767
|
const addedP = Object.keys(componentPathsStats).map(async onePath => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_arrayDifference","data","_interopRequireDefault","require","_fsExtra","_ignore","_lodash","path","_interopRequireWildcard","_ramda","_stringFormat","_analytics","_bitId","_constants","_generalError","_logger","_utils","_bitError","_path2","_componentMap","_missingMainFile","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_workspaceModules","_determineMainFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","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","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","_getComponentFromScopeIfExist","foundComponentFromBitMap","getComponentIfExist","ignoreVersion","componentFilesP","filePath","relativePath","isAutoGenerated","isAutoGeneratedFile","caseSensitive","existingIdOfFile","getComponentIdByPath","idOfFileIsDifferent","isEqual","push","newId","toBitIdWithLatestVersion","scope","componentFiles","_updateFilesAccordingToExistingRootDir","_areFilesArraysEqual","_updateFilesWithCurrentLetterCases","_mergeFilesWithExistingComponentMapFiles","trackDir","mainFile","determineMainFile","getRootDir","fileNotInsideTrackDir","AddingIndividualFiles","getComponentMap","addFilesToComponent","getDefaultScope","componentDefaultScopeFromComponentDirAndName","name","addComponent","changeRootDirAndUpdateFilesAccordingly","existingRootDir","areFilesInsideExistingRootDir","every","ComponentMap","changeFilesPathAccordingToItsRootDir","currentlyAddedDir","currentlyAddedDirParentOfRootDir","GeneralError","existingComponentMapFile","unionWith","eqBy","prop","currentComponentMap","newFiles","currentFiles","forEach","currentFile","sameFile","newFile","getModelComponentIgnoreScope","err","_getIdAccordingToExistingComponent","currentId","existingComponentId","getExistingBitId","includes","VERSION_DELIMITER","hasVersion","version","BitId","getVersionOnlyFromString","VersionShouldBeRemoved","parse","_getIdAccordingToTrackDir","dir","dirNormalizedToLinux","trackDirs","getAllTrackDirs","_addMainFileToFiles","foundFile","_findMainFileInFiles","shouldIgnore","ignores","ExcludedMainFile","test","basename","mainFileRelativeToConsumer","mainPath","toAbsolutePath","isDir","MainFileIsDir","normalizedMainFile","addOneComponent","componentPath","finalBitId","idFromPath","relativeComponentPath","_throwForOutsideConsumer","throwForExistingParentDir","cwd","nodir","EmptyDirectory","filteredMatches","NoFiles","filteredMatchedFiles","resolvedMainFile","absoluteComponentPath","resolve","splitPath","split","sep","lastDir","idOfTrackDir","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","MissingMainFile","MissingMainFileMultipleComponents","sort","allIds","getAllBitIdsFromAllLanes","componentsWithSameName","a","bitIdFromNameOnly","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 { BitId } from '@teambit/legacy/dist/bit-id';\nimport { BitIdStr } from '@teambit/legacy/dist/bit-id/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 { ModelComponent } from '@teambit/legacy/dist/scope/models';\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: BitId; files: ComponentMapFile[] };\nexport type Warnings = {\n alreadyUsed: Record<string, any>;\n emptyDirectory: string[];\n existInScope: BitId[];\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: BitId;\n files: ComponentMapFile[];\n mainFile?: PathOsBased | null | undefined;\n trackDir?: PathOsBased; // set only when one directory is added by author\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._getComponentFromScopeIfExist(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.toBitIdWithLatestVersion();\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.scope) return undefined;\n return (\n this.defaultScope ||\n (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentId.name))\n );\n };\n const defaultScope = await getDefaultScope();\n const componentMap = this.bitMap.addComponent({\n componentId,\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 async _getComponentFromScopeIfExist(id: BitId): Promise<ModelComponent | null | undefined> {\n try {\n return await this.consumer.scope.getModelComponentIgnoreScope(id);\n } catch (err: any) {\n return null;\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 _getIdAccordingToExistingComponent(currentId: BitIdStr): BitId {\n const existingComponentId = this.bitMap.getExistingBitId(currentId, 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 // $FlowFixMe this function gets called only when this.id is set\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n existingComponentId.version !== BitId.getVersionOnlyFromString(this.id)\n ) {\n // $FlowFixMe this.id is defined here\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n throw new VersionShouldBeRemoved(this.id);\n }\n }\n return existingComponentId || BitId.parse(currentId, false);\n }\n\n _getIdAccordingToTrackDir(dir: PathOsBased): BitId | 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 /**\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: BitId | 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 if (!finalBitId) {\n const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);\n 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 finalBitId = BitId.getValidBitId(nameSpaceOrDir, lastDir);\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 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: BitId[]) {\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 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 _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]): void {\n const allIds = this.bitMap.getAllBitIdsFromAllLanes();\n addedComponents.forEach((addedComponent) => {\n if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.\n const componentsWithSameName = addedComponents // $FlowFixMe\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .filter((a) => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath.name);\n const bitIdFromNameOnly = new BitId({ name: addedComponent.idFromPath.name });\n const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(bitIdFromNameOnly);\n if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {\n addedComponent.componentId = bitIdFromNameOnly;\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,SAAA;EAAA,MAA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AmB;AAC5B;;AAEA;AACA;AACA;AACA,SAAS2B,sBAAsBA,CAACkC,aAAoC,EAAE;EACpE,MAAMC,YAAY,GAAG,CAAC,CAAC;EACvB,MAAMC,oBAAoB,GAAG,IAAAC,iBAAO,EAACH,aAAa,EAAE,aAAa,CAAC;EAClEhS,MAAM,CAAC2O,IAAI,CAACuD,oBAAoB,CAAC,CAACnI,OAAO,CAAE5J,GAAG,IAAK;IACjD,IAAI+R,oBAAoB,CAAC/R,GAAG,CAAC,CAACiD,MAAM,GAAG,CAAC,EAAE6O,YAAY,CAAC9R,GAAG,CAAC,GAAG+R,oBAAoB,CAAC/R,GAAG,CAAC;EACzF,CAAC,CAAC;EACF,IAAI,CAAC2E,gBAAC,CAAC0J,OAAO,CAACyD,YAAY,CAAC,IAAI,CAACnN,gBAAC,CAACsM,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","_path2","_componentMap","_missingMainFile","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_workspaceModules","_determineMainFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","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","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","a","_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,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAO,uBAAA,CAAAL,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,aAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,WAAA;EAAA,MAAAV,IAAA,GAAAE,OAAA;EAAAQ,UAAA,YAAAA,CAAA;IAAA,OAAAV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AAa;IAC5B,CAAC;EACH,CAAC,CAAC;EACF,OAAOiC,mBAAmB;AAC5B;;AAEA;AACA;AACA;AACA,SAAS2B,sBAAsBA,CAACqC,aAAoC,EAAE;EACpE,MAAMC,YAAY,GAAG,CAAC,CAAC;EACvB,MAAMC,oBAAoB,GAAG,IAAAC,iBAAO,EAACH,aAAa,EAAE,aAAa,CAAC;EAClExS,MAAM,CAACgP,IAAI,CAAC0D,oBAAoB,CAAC,CAACzI,OAAO,CAAE9J,GAAG,IAAK;IACjD,IAAIuS,oBAAoB,CAACvS,GAAG,CAAC,CAACiD,MAAM,GAAG,CAAC,EAAEqP,YAAY,CAACtS,GAAG,CAAC,GAAGuS,oBAAoB,CAACvS,GAAG,CAAC;EACzF,CAAC,CAAC;EACF,IAAI,CAAC2E,gBAAC,CAAC+J,OAAO,CAAC4D,YAAY,CAAC,IAAI,CAAC3N,gBAAC,CAAC8M,KAAK,CAACa,YAAY,CAAC,EAAE,MAAM,KAAIG,0BAAY,EAACH,YAAY,CAAC;AAC9F"}
|
|
@@ -84,7 +84,7 @@ 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.
|
|
87
|
+
const componentName = (addedComponent === null || addedComponent === void 0 ? void 0 : addedComponent.id.fullName) || trackData.componentName;
|
|
88
88
|
const files = (addedComponent === null || addedComponent === void 0 ? void 0 : addedComponent.files.map(f => f.relativePath)) || [];
|
|
89
89
|
return {
|
|
90
90
|
componentName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_envs","_interopRequireDefault","_workspace","_interopRequireWildcard","_logger","_addCmd","_addComponents","_tracker","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","TrackerMain","constructor","workspace","logger","track","trackData","defaultScope","addOwnerToScopeName","addComponent","AddComponents","componentPaths","rootDir","id","componentName","main","mainFile","override","config","result","add","addedComponent","addedComponents","name","files","map","f","relativePath","warnings","addForCLI","addProps","OutsideWorkspaceError","addContext","shouldHandleOutOfSync","env","addEnvToConfig","addComponents","addResults","consumer","onDestroy","userEnvId","resolveComponentId","userEnvIdWithPotentialVersion","resolveEnvIdWithPotentialVersionForConfig","err","toStringWithoutVersion","EnvsAspect","scopeName","includes","isSelfHosted","isHostedByBit","wsDefaultScope","warn","owner","split","remotes","scope","_legacyRemotes","isHub","provider","cli","loggerMain","createLogger","TrackerAspect","trackerMain","register","AddCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["tracker.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport EnvsAspect from '@teambit/envs';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { AddCmd } from './add-cmd';\nimport AddComponents, { AddActionResults, AddContext, AddProps, Warnings } from './add-components';\nimport { TrackerAspect } from './tracker.aspect';\n\nexport type TrackResult = { componentName: string; files: string[]; warnings: Warnings };\n\nexport type TrackData = {\n rootDir: PathOsBasedRelative; // path relative to the workspace\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport class TrackerMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const addComponent = new AddComponents(\n { workspace: this.workspace },\n {\n componentPaths: [trackData.rootDir],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const componentName = addedComponent?.id.name || (trackData.componentName as string);\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { componentName, files, warnings: result.warnings };\n }\n\n async addForCLI(addProps: AddProps): Promise<AddActionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const addContext: AddContext = { workspace: this.workspace };\n addProps.shouldHandleOutOfSync = true;\n if (addProps.env) {\n const config = {};\n await this.addEnvToConfig(addProps.env, config);\n addProps.config = config;\n }\n const addComponents = new AddComponents(addContext, addProps);\n const addResults = await addComponents.add();\n await this.workspace.consumer.onDestroy();\n\n return addResults;\n }\n\n async addEnvToConfig(env: string, config: { [aspectName: string]: any }) {\n const userEnvId = await this.workspace.resolveComponentId(env);\n let userEnvIdWithPotentialVersion: string;\n try {\n userEnvIdWithPotentialVersion = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(userEnvId);\n } catch (err) {\n // the env needs to be without version\n userEnvIdWithPotentialVersion = userEnvId.toStringWithoutVersion();\n }\n config[userEnvIdWithPotentialVersion] = {};\n config[EnvsAspect.id] = config[EnvsAspect.id] || {};\n config[EnvsAspect.id].env = userEnvId.toStringWithoutVersion();\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.workspace.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n this.logger.warn(`the entered scope ${scopeName} has no owner nor the defaultScope in workspace.jsonc`);\n // it's possible that the user entered a non-exist scope just to test the command and will change it later.\n return scopeName;\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n // TODO: once scope create a new API for this, replace it with the new one\n const remotes = await this.workspace.scope._legacyRemotes();\n return remotes.isHub(scopeName);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(TrackerAspect.id);\n const trackerMain = new TrackerMain(workspace, logger);\n cli.register(new AddCmd(trackerMain));\n return trackerMain;\n }\n}\n\nTrackerAspect.addRuntime(TrackerMain);\n\nexport default TrackerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAK,uBAAA,CAAAJ,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAA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BA2FA,CAACmE,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAAvF,eAAA,CA3FrDkB,WAAW,aA4FLsE,kBAAW;AAS9BR,wBAAa,CAACS,UAAU,CAACvE,WAAW,CAAC;AAAC,IAAAwE,QAAA,GAEvBxE,WAAW;AAAAkE,OAAA,CAAAnG,OAAA,GAAAyG,QAAA"}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_envs","_interopRequireDefault","_workspace","_interopRequireWildcard","_logger","_addCmd","_addComponents","_tracker","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","TrackerMain","constructor","workspace","logger","track","trackData","defaultScope","addOwnerToScopeName","addComponent","AddComponents","componentPaths","rootDir","id","componentName","main","mainFile","override","config","result","add","addedComponent","addedComponents","fullName","files","map","f","relativePath","warnings","addForCLI","addProps","OutsideWorkspaceError","addContext","shouldHandleOutOfSync","env","addEnvToConfig","addComponents","addResults","consumer","onDestroy","userEnvId","resolveComponentId","userEnvIdWithPotentialVersion","resolveEnvIdWithPotentialVersionForConfig","err","toStringWithoutVersion","EnvsAspect","scopeName","includes","isSelfHosted","isHostedByBit","wsDefaultScope","warn","owner","split","remotes","scope","_legacyRemotes","isHub","provider","cli","loggerMain","createLogger","TrackerAspect","trackerMain","register","AddCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["tracker.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport EnvsAspect from '@teambit/envs';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { AddCmd } from './add-cmd';\nimport AddComponents, { AddActionResults, AddContext, AddProps, Warnings } from './add-components';\nimport { TrackerAspect } from './tracker.aspect';\n\nexport type TrackResult = { componentName: string; files: string[]; warnings: Warnings };\n\nexport type TrackData = {\n rootDir: PathOsBasedRelative; // path relative to the workspace\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport class TrackerMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const addComponent = new AddComponents(\n { workspace: this.workspace },\n {\n componentPaths: [trackData.rootDir],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const componentName = addedComponent?.id.fullName || (trackData.componentName as string);\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { componentName, files, warnings: result.warnings };\n }\n\n async addForCLI(addProps: AddProps): Promise<AddActionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const addContext: AddContext = { workspace: this.workspace };\n addProps.shouldHandleOutOfSync = true;\n if (addProps.env) {\n const config = {};\n await this.addEnvToConfig(addProps.env, config);\n addProps.config = config;\n }\n const addComponents = new AddComponents(addContext, addProps);\n const addResults = await addComponents.add();\n await this.workspace.consumer.onDestroy();\n\n return addResults;\n }\n\n async addEnvToConfig(env: string, config: { [aspectName: string]: any }) {\n const userEnvId = await this.workspace.resolveComponentId(env);\n let userEnvIdWithPotentialVersion: string;\n try {\n userEnvIdWithPotentialVersion = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(userEnvId);\n } catch (err) {\n // the env needs to be without version\n userEnvIdWithPotentialVersion = userEnvId.toStringWithoutVersion();\n }\n config[userEnvIdWithPotentialVersion] = {};\n config[EnvsAspect.id] = config[EnvsAspect.id] || {};\n config[EnvsAspect.id].env = userEnvId.toStringWithoutVersion();\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.workspace.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n this.logger.warn(`the entered scope ${scopeName} has no owner nor the defaultScope in workspace.jsonc`);\n // it's possible that the user entered a non-exist scope just to test the command and will change it later.\n return scopeName;\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n // TODO: once scope create a new API for this, replace it with the new one\n const remotes = await this.workspace.scope._legacyRemotes();\n return remotes.isHub(scopeName);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(TrackerAspect.id);\n const trackerMain = new TrackerMain(workspace, logger);\n cli.register(new AddCmd(trackerMain));\n return trackerMain;\n }\n}\n\nTrackerAspect.addRuntime(TrackerMain);\n\nexport default TrackerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EA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C;EAKA,aAAaY,QAAQA,CAAC,CAACC,GAAG,EAAEzD,SAAS,EAAE0D,UAAU,CAAmC,EAAE;IACpF,MAAMzD,MAAM,GAAGyD,UAAU,CAACC,YAAY,CAACC,wBAAa,CAAClD,EAAE,CAAC;IACxD,MAAMmD,WAAW,GAAG,IAAI/D,WAAW,CAACE,SAAS,EAAEC,MAAM,CAAC;IACtDwD,GAAG,CAACK,QAAQ,CAAC,KAAIC,gBAAM,EAACF,WAAW,CAAC,CAAC;IACrC,OAAOA,WAAW;EACpB;AACF;AAACG,OAAA,CAAAlE,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CAnGYkB,WAAW,WA0FP,EAAE;AAAAlB,eAAA,CA1FNkB,WAAW,kBA2FA,CAACmE,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAAvF,eAAA,CA3FrDkB,WAAW,aA4FLsE,kBAAW;AAS9BR,wBAAa,CAACS,UAAU,CAACvE,WAAW,CAAC;AAAC,IAAAwE,QAAA,GAEvBxE,WAAW;AAAAkE,OAAA,CAAAnG,OAAA,GAAAyG,QAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/tracker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/tracker",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "tracker",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.28"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -18,13 +18,15 @@
|
|
|
18
18
|
"string-format": "0.5.0",
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@babel/runtime": "7.20.0",
|
|
21
|
-
"@teambit/harmony": "0.4.6",
|
|
22
21
|
"@teambit/bit-error": "0.0.404",
|
|
23
|
-
"@teambit/
|
|
24
|
-
"@teambit/
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/
|
|
27
|
-
"@teambit/
|
|
22
|
+
"@teambit/component-id": "1.1.0",
|
|
23
|
+
"@teambit/legacy-bit-id": "1.0.3",
|
|
24
|
+
"@teambit/harmony": "0.4.6",
|
|
25
|
+
"@teambit/cli": "0.0.800",
|
|
26
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.141",
|
|
27
|
+
"@teambit/workspace": "1.0.28",
|
|
28
|
+
"@teambit/envs": "1.0.28",
|
|
29
|
+
"@teambit/logger": "0.0.893"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@types/fs-extra": "9.0.7",
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
39
|
-
"@teambit/legacy": "1.0.
|
|
41
|
+
"@teambit/legacy": "1.0.580",
|
|
40
42
|
"react": "^16.8.0 || ^17.0.0",
|
|
41
43
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
42
44
|
},
|
|
File without changes
|