@teambit/importer 0.0.393 → 0.0.395

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.
@@ -10,6 +10,7 @@ import { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops
10
10
  import VersionDependencies from '@teambit/legacy/dist/scope/version-dependencies';
11
11
  import { GraphMain } from '@teambit/graph';
12
12
  import { Workspace } from '@teambit/workspace';
13
+ import { ComponentWriterMain } from '@teambit/component-writer';
13
14
  export declare type ImportOptions = {
14
15
  ids: string[];
15
16
  verbose?: boolean;
@@ -60,6 +61,7 @@ export declare type ImportResult = {
60
61
  export default class ImportComponents {
61
62
  private workspace;
62
63
  private graph;
64
+ private componentWriter;
63
65
  options: ImportOptions;
64
66
  consumer: Consumer;
65
67
  scope: Scope;
@@ -68,7 +70,7 @@ export default class ImportComponents {
68
70
  };
69
71
  private laneObjects;
70
72
  private divergeData;
71
- constructor(workspace: Workspace, graph: GraphMain, options: ImportOptions);
73
+ constructor(workspace: Workspace, graph: GraphMain, componentWriter: ComponentWriterMain, options: ImportOptions);
72
74
  importComponents(): Promise<ImportResult>;
73
75
  importObjectsOnLane(): Promise<ImportResult>;
74
76
  importSpecificComponents(): Promise<ImportResult>;
@@ -144,13 +144,6 @@ function _componentsPendingMerge() {
144
144
  };
145
145
  return data;
146
146
  }
147
- function _manyComponentsWriter() {
148
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/many-components-writer"));
149
- _manyComponentsWriter = function () {
150
- return data;
151
- };
152
- return data;
153
- }
154
147
  function _scopeComponentsImporter() {
155
148
  const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/component-ops/scope-components-importer"));
156
149
  _scopeComponentsImporter = function () {
@@ -166,9 +159,10 @@ function _versionDependencies() {
166
159
  return data;
167
160
  }
168
161
  class ImportComponents {
169
- constructor(workspace, graph, options) {
162
+ constructor(workspace, graph, componentWriter, options) {
170
163
  this.workspace = workspace;
171
164
  this.graph = graph;
165
+ this.componentWriter = componentWriter;
172
166
  this.options = options;
173
167
  (0, _defineProperty2().default)(this, "consumer", void 0);
174
168
  (0, _defineProperty2().default)(this, "scope", void 0);
@@ -453,8 +447,8 @@ bit import ${idsFromRemote.map(id => id.toStringWithoutVersion()).join(' ')}`);
453
447
  };
454
448
  }
455
449
  getIdsToImportFromBitmap() {
456
- const authoredExportedComponents = this.consumer.bitMap.getExportedComponents();
457
- return _bitId().BitIds.fromArray(authoredExportedComponents);
450
+ const allIds = this.consumer.bitMap.getAllBitIdsFromAllLanes();
451
+ return _bitId().BitIds.fromArray(allIds.filter(id => id.hasScope()));
458
452
  }
459
453
  async _getCurrentVersions(ids) {
460
454
  const versionsP = ids.map(async id => {
@@ -679,16 +673,16 @@ bit import ${idsFromRemote.map(id => id.toStringWithoutVersion()).join(' ')}`);
679
673
  return;
680
674
  }
681
675
  const componentsToWrite = await this.updateAllComponentsAccordingToMergeStrategy(componentsWithDependencies);
682
- const manyComponentsWriter = new (_manyComponentsWriter().default)({
676
+ const manyComponentsWriterOpts = {
683
677
  consumer: this.consumer,
684
678
  componentsWithDependencies: componentsToWrite,
685
679
  writeToPath: this.options.writeToPath,
686
680
  writeConfig: this.options.writeConfig,
687
- installNpmPackages: this.options.installNpmPackages,
681
+ skipDependencyInstallation: !this.options.installNpmPackages,
688
682
  verbose: this.options.verbose,
689
- override: this.options.override
690
- });
691
- await manyComponentsWriter.writeAll();
683
+ throwForExistingDir: !this.options.override
684
+ };
685
+ await this.componentWriter.writeMany(manyComponentsWriterOpts);
692
686
  }
693
687
  }
694
688
  exports.default = ImportComponents;
@@ -1 +1 @@
1
- {"version":3,"names":["ImportComponents","constructor","workspace","graph","options","consumer","scope","laneObjects","lanes","importComponents","loader","start","BEFORE_IMPORT_ACTION","saveDependenciesAsComponents","config","_saveDependenciesAsComponents","ids","length","importObjectsOnLane","importSpecificComponents","importAccordingToBitMap","objectsOnly","Error","lane","undefined","bitIds","getBitIds","logger","debug","id","toString","beforeImportVersions","_getCurrentVersions","versionDependenciesArr","_importComponentsObjects","mainIdsLatest","BitIds","fromArray","toBitIds","map","m","changeVersion","ignoreMissingHead","mergeAllLanesResults","pMapSeries","laneObject","sources","mergeLane","mergedLanes","result","Promise","all","mergedLane","saveLane","importDetails","_getImportDetails","importedIds","v","component","flat","importedDeps","allDependenciesIds","join","_throwForPotentialIssues","writtenComponents","componentsWithDependencies","multipleVersionDependenciesToConsumer","objects","_fetchDivergeData","_throwForDivergedHistory","_writeToFileSystem","_saveLaneDataIfNeeded","c","modelComponent","getModelComponent","setDivergeData","divergeData","push","merge","divergedComponents","filter","getDivergeData","isDiverged","snapsLocal","snapsOnSourceOnly","snapsRemote","snapsOnTargetOnly","ComponentsPendingMerge","fromOriginalScope","scopeComponentsImporter","ScopeComponentsImporter","getInstance","importManyDeltaWithoutDeps","fromHead","allHistory","collectParents","results","importManyFromOriginalScopes","importMany","preferDependencyGraph","fetchDeps","getBitIdsForLanes","bitIdsFromLane","flatMap","mainIds","bitMap","getAuthoredAndImportedBitIdsOfDefaultLane","mainIdsToImport","hasScope","hasWithoutVersion","idsWithWildcard","hasWildcard","idsWithoutWildcard","idsWithoutWildcardPreferFromLane","idStr","BitId","parse","fromLane","searchWithoutVersion","idsFromRemote","getRemoteBitIdsByWildcards","existingOnLanes","BitError","l","name","toStringWithoutVersion","getBitIdsForNonLanes","importDependenciesDirectly","importDependents","graphs","_getComponentsGraphs","dependenciesIds","_getDependenciesFromGraph","getGraphIds","targetCompIds","resolveMultipleComponentIds","sourceIds","listIds","findIdsFromSourcesToTargets","_legacy","uniqFromArray","dependencies","bitId","componentGraph","find","scopeName","dependenciesInfo","getDependenciesInfo","d","R","flatten","_getDependentsFromGraph","dependents","dependentsInfo","getDependentsInfo","remotes","getScopeRemotes","scopeGraphs","override","componentsIdsToImport","getIdsToImportFromBitmap","isEmpty","NothingToImport","_throwForModifiedOrNewComponents","componentWithDependencies","authoredExportedComponents","getExportedComponents","versionsP","getModelComponentIfExist","listVersions","versions","fromPairs","currentVersions","components","detailsP","Object","keys","ShowDoctorError","afterImportVersions","versionDifference","difference","getStatus","filesStatus","mergeStatus","deprecated","isDeprecated","removed","isRemoved","latestVersion","getHeadRegardlessOfLaneAsTagOrHash","includes","status","missingDeps","getMissingDependencies","_throwForDifferentComponentWithSameName","componentsStatuses","getManyComponentsStatuses","modifiedComponents","modified","newlyCreated","GeneralError","chalk","yellow","forEach","existingId","getParsedIdIfExist","_getMergeStatus","componentStatus","getComponentStatusById","mergeResults","componentModel","existingBitMapBitId","getBitId","ignoreVersion","fsComponent","loadComponent","currentlyUsedVersion","version","baseComponent","loadVersion","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","_updateComponentFilesPerMergeStrategy","componentMergeStatus","files","hasConflicts","mergeStrategy","MergeOptions","ours","file","pathNormalizeToLinux","relative","FileStatus","unchanged","updateComponentId","hasChanged","theirs","updated","modifiedFiles","applyModifiedVersion","updateAllComponentsAccordingToMergeStrategy","componentsStatusP","componentsStatus","componentWithConflict","getMergeStrategyInteractive","componentsToWrite","unchangedFiles","removeNulls","reject","isNil","_shouldSaveLaneData","isOnLane","currentLane","getCurrentLaneObject","idsFromRemoteLanes","comp","existOnRemoteLane","has","saveInLane","setComponentProp","ref","getRef","addComponent","head","manyComponentsWriter","ManyComponentsWriter","writeToPath","writeConfig","installNpmPackages","verbose","writeAll"],"sources":["import-components.ts"],"sourcesContent":["import chalk from 'chalk';\nimport R from 'ramda';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport pMapSeries from 'p-map-series';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BEFORE_IMPORT_ACTION } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport ShowDoctorError from '@teambit/legacy/dist/error/show-doctor-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport Remotes from '@teambit/legacy/dist/remotes/remotes';\nimport { ComponentWithDependencies, Scope } from '@teambit/legacy/dist/scope';\nimport DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport Component from '@teambit/legacy/dist/consumer/component';\nimport { NothingToImport } from '@teambit/legacy/dist/consumer/exceptions';\nimport { applyModifiedVersion } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { FilesStatus, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ComponentsPendingMerge from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-merge';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport VersionDependencies, {\n multipleVersionDependenciesToConsumer,\n} from '@teambit/legacy/dist/scope/version-dependencies';\nimport { GraphMain } from '@teambit/graph';\nimport { Workspace } from '@teambit/workspace';\n\nexport type ImportOptions = {\n ids: string[]; // array might be empty\n verbose?: boolean;\n merge?: boolean;\n mergeStrategy?: MergeStrategy;\n writeToPath?: string;\n writeConfig?: boolean;\n override?: boolean;\n installNpmPackages: boolean; // default: true\n objectsOnly?: boolean;\n saveDependenciesAsComponents?: boolean;\n importDependenciesDirectly?: boolean; // default: false, normally it imports them as packages or nested, not as imported\n importDependents?: boolean;\n fromOriginalScope?: boolean; // default: false, otherwise, it fetches flattened dependencies from their dependents\n saveInLane?: boolean; // save the imported component on the current lane (won't be available on main)\n lanes?: {\n laneIds: LaneId[];\n lanes: Lane[]; // it can be an empty array when a lane is a local lane and doesn't exist on the remote\n };\n allHistory?: boolean;\n fetchDeps?: boolean; // by default, if a component was tagged with > 0.0.900, it has the flattened-deps-graph in the object\n};\ntype ComponentMergeStatus = {\n componentWithDependencies: ComponentWithDependencies;\n mergeResults: MergeResultsThreeWay | null | undefined;\n};\ntype ImportedVersions = { [id: string]: string[] };\nexport type ImportStatus = 'added' | 'updated' | 'up to date';\nexport type ImportDetails = {\n id: string;\n versions: string[];\n latestVersion: string | null;\n status: ImportStatus;\n filesStatus: FilesStatus | null | undefined;\n missingDeps: BitId[];\n deprecated: boolean;\n removed?: boolean;\n};\nexport type ImportResult = {\n importedIds: BitId[];\n importedDeps: BitId[];\n writtenComponents?: Component[];\n importDetails: ImportDetails[];\n cancellationMessage?: string;\n};\n\nexport default class ImportComponents {\n consumer: Consumer;\n scope: Scope;\n mergeStatus: { [id: string]: FilesStatus };\n private laneObjects: Lane[];\n private divergeData: Array<ModelComponent> = [];\n constructor(private workspace: Workspace, private graph: GraphMain, public options: ImportOptions) {\n this.consumer = this.workspace.consumer;\n this.scope = this.consumer.scope;\n this.laneObjects = this.options.lanes ? (this.options.lanes.lanes as Lane[]) : [];\n }\n\n importComponents(): Promise<ImportResult> {\n loader.start(BEFORE_IMPORT_ACTION);\n this.options.saveDependenciesAsComponents = this.consumer.config._saveDependenciesAsComponents;\n if (this.options.lanes && !this.options.ids.length) {\n return this.importObjectsOnLane();\n }\n if (this.options.ids.length) {\n return this.importSpecificComponents();\n }\n return this.importAccordingToBitMap();\n }\n\n async importObjectsOnLane(): Promise<ImportResult> {\n if (!this.options.objectsOnly) {\n throw new Error(`importObjectsOnLane should have objectsOnly=true`);\n }\n if (this.laneObjects.length > 1) {\n throw new Error(`importObjectsOnLane does not support more than one lane`);\n }\n const lane = this.laneObjects.length ? this.laneObjects[0] : undefined;\n const bitIds: BitIds = await this.getBitIds();\n lane\n ? logger.debug(`importObjectsOnLane, Lane: ${lane.id()}, Ids: ${bitIds.toString()}`)\n : logger.debug(`importObjectsOnLane, the lane does not exist on the remote. importing only the main components`);\n const beforeImportVersions = await this._getCurrentVersions(bitIds);\n const versionDependenciesArr = await this._importComponentsObjects(bitIds, {\n lane,\n });\n\n // import lane components from their original scope, this way, it's possible to run diff/merge on them.\n // don't use `scope.getDefaultLaneIdsFromLane()`. we need all components, because it's possible that a component\n // does't have \"head\" locally although it exits in the origin-scope. it happens when the component was created on\n // the origin-scope after a component with the same-name was created on the lane\n if (lane) {\n // @todo: optimize this maybe. currently, it imports twice.\n // try to make the previous `importComponentsObjectsHarmony` import the same component once from the original\n // scope and once from the lane-scope.\n const mainIdsLatest = BitIds.fromArray(lane.toBitIds().map((m) => m.changeVersion(undefined)));\n await this._importComponentsObjects(mainIdsLatest, {\n ignoreMissingHead: true,\n });\n }\n\n // merge the lane objects\n const mergeAllLanesResults = await pMapSeries(this.laneObjects, (laneObject) =>\n this.scope.sources.mergeLane(laneObject, true)\n );\n const mergedLanes = mergeAllLanesResults.map((result) => result.mergeLane);\n await Promise.all(mergedLanes.map((mergedLane) => this.scope.lanes.saveLane(mergedLane)));\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n importDetails,\n };\n }\n\n async importSpecificComponents(): Promise<ImportResult> {\n logger.debug(`importSpecificComponents, Ids: ${this.options.ids.join(', ')}`);\n const bitIds: BitIds = await this.getBitIds();\n const beforeImportVersions = await this._getCurrentVersions(bitIds);\n await this._throwForPotentialIssues(bitIds);\n const versionDependenciesArr = await this._importComponentsObjects(bitIds, {\n lane: this.laneObjects?.[0],\n });\n if (this.laneObjects && this.options.objectsOnly) {\n // merge the lane objects\n const mergeAllLanesResults = await pMapSeries(this.laneObjects, (laneObject) =>\n this.scope.sources.mergeLane(laneObject, true)\n );\n const mergedLanes = mergeAllLanesResults.map((result) => result.mergeLane);\n await Promise.all(mergedLanes.map((mergedLane) => this.scope.lanes.saveLane(mergedLane)));\n }\n let writtenComponents: Component[] = [];\n if (!this.options.objectsOnly) {\n const componentsWithDependencies = await multipleVersionDependenciesToConsumer(\n versionDependenciesArr,\n this.scope.objects\n );\n await this._fetchDivergeData(componentsWithDependencies);\n this._throwForDivergedHistory();\n await this._writeToFileSystem(componentsWithDependencies);\n await this._saveLaneDataIfNeeded(componentsWithDependencies);\n writtenComponents = componentsWithDependencies.map((c) => c.component);\n }\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n writtenComponents,\n importDetails,\n };\n }\n\n async _fetchDivergeData(componentsWithDependencies: ComponentWithDependencies[]) {\n if (this.options.objectsOnly) {\n // no need for it when importing objects only. if it's enabled, in case when on a lane and a non-lane\n // component is in bitmap using an older version, it throws \"getDivergeData: unable to find Version X of Y\"\n return;\n }\n await Promise.all(\n componentsWithDependencies.map(async ({ component }) => {\n const modelComponent = await this.scope.getModelComponent(component.id);\n await modelComponent.setDivergeData(this.scope.objects, undefined, false);\n this.divergeData.push(modelComponent);\n })\n );\n }\n\n _throwForDivergedHistory() {\n if (this.options.merge || this.options.objectsOnly) return;\n const divergedComponents = this.divergeData.filter((modelComponent) =>\n modelComponent.getDivergeData().isDiverged()\n );\n if (divergedComponents.length) {\n const divergeData = divergedComponents.map((modelComponent) => ({\n id: modelComponent.id(),\n snapsLocal: modelComponent.getDivergeData().snapsOnSourceOnly.length,\n snapsRemote: modelComponent.getDivergeData().snapsOnTargetOnly.length,\n }));\n throw new ComponentsPendingMerge(divergeData);\n }\n }\n\n private async _importComponentsObjects(\n ids: BitIds,\n {\n fromOriginalScope = false,\n lane,\n ignoreMissingHead = false,\n }: {\n fromOriginalScope?: boolean;\n lane?: Lane;\n ignoreMissingHead?: boolean;\n }\n ): Promise<VersionDependencies[]> {\n const scopeComponentsImporter = ScopeComponentsImporter.getInstance(this.scope);\n await scopeComponentsImporter.importManyDeltaWithoutDeps({\n ids,\n fromHead: this.options.allHistory,\n collectParents: this.options.allHistory,\n lane,\n // in case a user is merging a lane into a new workspace, then, locally main has head, but remotely the head is\n // empty, until it's exported. going to the remote and asking this component will throw an error if ignoreMissingHead is false\n ignoreMissingHead: true,\n });\n loader.start(`import ${ids.length} components with their dependencies (if missing)`);\n const results = fromOriginalScope\n ? await scopeComponentsImporter.importManyFromOriginalScopes(ids)\n : await scopeComponentsImporter.importMany({\n ids,\n ignoreMissingHead,\n lanes: lane ? [lane] : undefined,\n preferDependencyGraph: !this.options.fetchDeps,\n });\n\n return results;\n }\n\n /**\n * consider the following use cases:\n * 1) no ids were provided. it should import all the lanes components objects AND main components objects\n * (otherwise, if main components are not imported and are missing, then bit-status complains about it)\n * 2) ids are provided with wildcards. we assume the user wants only the ids that are available on the lane.\n * because a user may entered \"bit import scope/*\" and this scope has many component on the lane and many not on the lane.\n * we want to bring only the components on the lane.\n * 3) ids are provided without wildcards. here, the user knows exactly what's needed and it's ok to get the ids from\n * main if not found on the lane.\n */\n private async getBitIdsForLanes(): Promise<BitId[]> {\n if (!this.options.lanes) {\n throw new Error(`getBitIdsForLanes: this.options.lanes must be set`);\n }\n const bitIdsFromLane = BitIds.fromArray(this.laneObjects.flatMap((lane) => lane.toBitIds()));\n\n if (!this.options.ids.length) {\n const mainIds = this.consumer.bitMap.getAuthoredAndImportedBitIdsOfDefaultLane();\n const mainIdsToImport = mainIds.filter((id) => id.hasScope() && !bitIdsFromLane.hasWithoutVersion(id));\n bitIdsFromLane.push(...mainIdsToImport);\n return bitIdsFromLane;\n }\n\n const idsWithWildcard = this.options.ids.filter((id) => hasWildcard(id));\n const idsWithoutWildcard = this.options.ids.filter((id) => !hasWildcard(id));\n const idsWithoutWildcardPreferFromLane = idsWithoutWildcard.map((idStr) => {\n const id = BitId.parse(idStr, true);\n const fromLane = bitIdsFromLane.searchWithoutVersion(id);\n return fromLane || id;\n });\n\n const bitIds: BitId[] = [...idsWithoutWildcardPreferFromLane];\n\n if (!idsWithWildcard) {\n return bitIds;\n }\n\n await pMapSeries(idsWithWildcard, async (idStr: string) => {\n const idsFromRemote = await getRemoteBitIdsByWildcards(idStr);\n const existingOnLanes = idsFromRemote.filter((id) => bitIdsFromLane.hasWithoutVersion(id));\n if (!existingOnLanes.length) {\n throw new BitError(`the id with the the wildcard \"${idStr}\" has been parsed to multiple component ids.\nhowever, none of them existing on the lane \"${this.laneObjects.map((l) => l.name).join(', ')}\"\nin case you intend to import these components from main, please run the following:\nbit import ${idsFromRemote.map((id) => id.toStringWithoutVersion()).join(' ')}`);\n }\n bitIds.push(...existingOnLanes);\n });\n\n return bitIds;\n }\n\n private async getBitIdsForNonLanes() {\n const bitIds: BitId[] = [];\n await Promise.all(\n this.options.ids.map(async (idStr: string) => {\n if (hasWildcard(idStr)) {\n const ids = await getRemoteBitIdsByWildcards(idStr);\n loader.start(BEFORE_IMPORT_ACTION); // it stops the previous loader of BEFORE_REMOTE_LIST\n bitIds.push(...ids);\n } else {\n bitIds.push(BitId.parse(idStr, true)); // we don't support importing without a scope name\n }\n })\n );\n\n return bitIds;\n }\n\n private async getBitIds(): Promise<BitIds> {\n const bitIds: BitId[] = this.options.lanes ? await this.getBitIdsForLanes() : await this.getBitIdsForNonLanes();\n if (this.options.importDependenciesDirectly || this.options.importDependents) {\n const graphs = await this._getComponentsGraphs(bitIds);\n if (this.options.importDependenciesDirectly) {\n const dependenciesIds = this._getDependenciesFromGraph(bitIds, graphs);\n bitIds.push(...dependenciesIds);\n }\n if (this.options.importDependents) {\n const graph = await this.graph.getGraphIds();\n const targetCompIds = await this.workspace.resolveMultipleComponentIds(bitIds);\n const sourceIds = await this.workspace.listIds();\n const ids = graph.findIdsFromSourcesToTargets(sourceIds, targetCompIds);\n logger.debug(\n `found ${ids.length} component for --dependents flag`,\n ids.map((id) => id.toString())\n );\n bitIds.push(...ids.map((id) => id._legacy));\n }\n }\n return BitIds.uniqFromArray(bitIds);\n }\n\n _getDependenciesFromGraph(bitIds: BitId[], graphs: DependencyGraph[]): BitId[] {\n const dependencies = bitIds.map((bitId) => {\n const componentGraph = graphs.find((graph) => graph.scopeName === bitId.scope);\n if (!componentGraph) {\n throw new Error(`unable to find a graph for ${bitId.toString()}`);\n }\n const dependenciesInfo = componentGraph.getDependenciesInfo(bitId);\n return dependenciesInfo.map((d) => d.id);\n });\n return R.flatten(dependencies);\n }\n\n _getDependentsFromGraph(bitIds: BitId[], graphs: DependencyGraph[]): BitId[] {\n const dependents = bitIds.map((bitId) => {\n const componentGraph = graphs.find((graph) => graph.scopeName === bitId.scope);\n if (!componentGraph) {\n throw new Error(`unable to find a graph for ${bitId.toString()}`);\n }\n const dependentsInfo = componentGraph.getDependentsInfo(bitId);\n return dependentsInfo.map((d) => d.id);\n });\n return R.flatten(dependents);\n }\n\n async _getComponentsGraphs(bitIds: BitId[]): Promise<DependencyGraph[]> {\n const remotes: Remotes = await getScopeRemotes(this.consumer.scope);\n return remotes.scopeGraphs(bitIds, this.consumer.scope);\n }\n\n async importAccordingToBitMap(): Promise<ImportResult> {\n this.options.objectsOnly = !this.options.merge && !this.options.override;\n const componentsIdsToImport = this.getIdsToImportFromBitmap();\n\n if (R.isEmpty(componentsIdsToImport)) {\n throw new NothingToImport();\n }\n await this._throwForModifiedOrNewComponents(componentsIdsToImport);\n const beforeImportVersions = await this._getCurrentVersions(componentsIdsToImport);\n if (!componentsIdsToImport.length) {\n return {\n importedIds: [],\n importedDeps: [],\n importDetails: [],\n };\n }\n if (!this.options.objectsOnly) {\n throw new Error(`bit import with no ids and --merge flag was not implemented yet`);\n }\n const versionDependenciesArr = await this._importComponentsObjects(componentsIdsToImport, {\n fromOriginalScope: this.options.fromOriginalScope,\n });\n let writtenComponents: Component[] = [];\n if (!this.options.objectsOnly) {\n const componentWithDependencies = await multipleVersionDependenciesToConsumer(\n versionDependenciesArr,\n this.scope.objects\n );\n await this._writeToFileSystem(componentWithDependencies);\n writtenComponents = componentWithDependencies.map((c) => c.component);\n }\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n writtenComponents,\n importDetails,\n };\n }\n\n private getIdsToImportFromBitmap() {\n const authoredExportedComponents = this.consumer.bitMap.getExportedComponents();\n return BitIds.fromArray(authoredExportedComponents);\n }\n\n async _getCurrentVersions(ids: BitIds): Promise<ImportedVersions> {\n const versionsP = ids.map(async (id) => {\n const modelComponent = await this.consumer.scope.getModelComponentIfExist(id.changeVersion(undefined));\n const idStr = id.toStringWithoutVersion();\n if (!modelComponent) return [idStr, []];\n return [idStr, modelComponent.listVersions()];\n });\n const versions = await Promise.all(versionsP);\n return R.fromPairs(versions);\n }\n\n /**\n * get import details, includes the diff between the versions array before import and after import\n */\n async _getImportDetails(\n currentVersions: ImportedVersions,\n components: VersionDependencies[]\n ): Promise<ImportDetails[]> {\n const detailsP = components.map(async (component) => {\n const id = component.component.id;\n const idStr = id.toStringWithoutVersion();\n const beforeImportVersions = currentVersions[idStr];\n if (!beforeImportVersions) {\n throw new Error(\n `_getImportDetails failed finding ${idStr} in currentVersions, which has ${Object.keys(currentVersions).join(\n ', '\n )}`\n );\n }\n const modelComponent = await this.consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) throw new ShowDoctorError(`imported component ${idStr} was not found in the model`);\n const afterImportVersions = modelComponent.listVersions();\n const versionDifference: string[] = R.difference(afterImportVersions, beforeImportVersions);\n const getStatus = (): ImportStatus => {\n if (!versionDifference.length) return 'up to date';\n if (!beforeImportVersions.length) return 'added';\n return 'updated';\n };\n const filesStatus = this.mergeStatus && this.mergeStatus[idStr] ? this.mergeStatus[idStr] : null;\n const deprecated = await modelComponent.isDeprecated(this.scope.objects);\n const removed = await component.component.component.isRemoved(this.scope.objects);\n const latestVersion = modelComponent.getHeadRegardlessOfLaneAsTagOrHash(true);\n return {\n id: idStr,\n versions: versionDifference,\n latestVersion: versionDifference.includes(latestVersion) ? latestVersion : null,\n status: getStatus(),\n filesStatus,\n missingDeps: this.options.fetchDeps ? component.getMissingDependencies() : [],\n deprecated,\n removed,\n };\n });\n return Promise.all(detailsP);\n }\n\n async _throwForPotentialIssues(ids: BitIds): Promise<void> {\n await this._throwForModifiedOrNewComponents(ids);\n this._throwForDifferentComponentWithSameName(ids);\n }\n\n async _throwForModifiedOrNewComponents(ids: BitIds): Promise<void> {\n // the typical objectsOnly option is when a user cloned a project with components tagged to the source code, but\n // doesn't have the model objects. in that case, calling getComponentStatusById() may return an error as it relies\n // on the model objects when there are dependencies\n if (this.options.override || this.options.objectsOnly || this.options.merge) return;\n const componentsStatuses = await this.consumer.getManyComponentsStatuses(ids);\n const modifiedComponents = componentsStatuses\n .filter(({ status }) => status.modified || status.newlyCreated)\n .map((c) => c.id);\n if (modifiedComponents.length) {\n throw new GeneralError(\n chalk.yellow(\n `unable to import the following components due to local changes, use --merge flag to merge your local changes or --override to override them\\n${modifiedComponents.join(\n '\\n'\n )} `\n )\n );\n }\n }\n\n /**\n * Model Component id() calculation uses id.toString() for the hash.\n * If an imported component has scopereadonly name equals to a local name, both will have the exact same\n * hash and they'll override each other.\n */\n _throwForDifferentComponentWithSameName(ids: BitIds): void {\n ids.forEach((id: BitId) => {\n const existingId = this.consumer.getParsedIdIfExist(id.toStringWithoutVersion());\n if (existingId && !existingId.hasScope()) {\n throw new GeneralError(`unable to import ${id.toString()}. the component name conflicted with your local component with the same name.\n it's fine to have components with the same name as long as their scope names are different.\n Make sure to export your component first to get a scope and then try importing again`);\n }\n });\n }\n\n async _getMergeStatus(componentWithDependencies: ComponentWithDependencies): Promise<ComponentMergeStatus> {\n const component = componentWithDependencies.component;\n const componentStatus = await this.consumer.getComponentStatusById(component.id);\n const mergeStatus: ComponentMergeStatus = { componentWithDependencies, mergeResults: null };\n if (!componentStatus.modified) return mergeStatus;\n const componentModel = await this.consumer.scope.getModelComponent(component.id);\n const existingBitMapBitId = this.consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const fsComponent = await this.consumer.loadComponent(existingBitMapBitId);\n const currentlyUsedVersion = existingBitMapBitId.version;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const baseComponent: Version = await componentModel.loadVersion(currentlyUsedVersion, this.consumer.scope.objects);\n const otherComponent: Version = await componentModel.loadVersion(\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n component.id.version,\n this.consumer.scope.objects\n );\n const mergeResults = await threeWayMerge({\n consumer: this.consumer,\n otherComponent,\n otherLabel: component.id.version as string,\n currentComponent: fsComponent,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n mergeStatus.mergeResults = mergeResults;\n return mergeStatus;\n }\n\n /**\n * 1) when there are conflicts and the strategy is \"ours\", don't write the imported component to\n * the filesystem, only update bitmap.\n *\n * 2) when there are conflicts and the strategy is \"theirs\", override the local changes by the\n * imported component. (similar to --override)\n *\n * 3) when there is no conflict or there are conflicts and the strategy is manual, write the files\n * according to the merge result. (done by applyModifiedVersion())\n */\n _updateComponentFilesPerMergeStrategy(componentMergeStatus: ComponentMergeStatus): FilesStatus | null | undefined {\n const mergeResults = componentMergeStatus.mergeResults;\n if (!mergeResults) return null;\n const component = componentMergeStatus.componentWithDependencies.component;\n const files = component.files;\n\n if (mergeResults.hasConflicts && this.options.mergeStrategy === MergeOptions.ours) {\n const filesStatus = {};\n // don't write the files to the filesystem, only bump the bitmap version.\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n this.consumer.bitMap.updateComponentId(component.id);\n this.consumer.bitMap.hasChanged = true;\n return filesStatus;\n }\n if (mergeResults.hasConflicts && this.options.mergeStrategy === MergeOptions.theirs) {\n const filesStatus = {};\n // the local changes will be overridden (as if the user entered --override flag for this component)\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n return filesStatus;\n }\n const { filesStatus, modifiedFiles } = applyModifiedVersion(\n component.files,\n mergeResults,\n this.options.mergeStrategy\n );\n component.files = modifiedFiles;\n\n return filesStatus;\n }\n\n /**\n * update the component files if they are modified and there is a merge strategy.\n * returns only the components that need to be written to the filesystem\n */\n async updateAllComponentsAccordingToMergeStrategy(\n componentsWithDependencies: ComponentWithDependencies[]\n ): Promise<ComponentWithDependencies[]> {\n if (!this.options.merge) return componentsWithDependencies;\n const componentsStatusP = componentsWithDependencies.map((componentWithDependencies: ComponentWithDependencies) => {\n return this._getMergeStatus(componentWithDependencies);\n });\n const componentsStatus = await Promise.all(componentsStatusP);\n const componentWithConflict = componentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !this.options.mergeStrategy) {\n this.options.mergeStrategy = await getMergeStrategyInteractive();\n }\n this.mergeStatus = {};\n\n const componentsToWrite = componentsStatus.map((componentStatus) => {\n const filesStatus: FilesStatus | null | undefined = this._updateComponentFilesPerMergeStrategy(componentStatus);\n const componentWithDependencies = componentStatus.componentWithDependencies;\n if (!filesStatus) return componentWithDependencies;\n this.mergeStatus[componentWithDependencies.component.id.toStringWithoutVersion()] = filesStatus;\n const unchangedFiles = Object.keys(filesStatus).filter((file) => filesStatus[file] === FileStatus.unchanged);\n if (unchangedFiles.length === Object.keys(filesStatus).length) {\n // all files are unchanged\n return null;\n }\n return componentWithDependencies;\n });\n const removeNulls = R.reject(R.isNil);\n return removeNulls(componentsToWrite);\n }\n\n _shouldSaveLaneData(): boolean {\n if (this.options.objectsOnly) {\n return false;\n }\n return this.consumer.isOnLane();\n }\n\n async _saveLaneDataIfNeeded(componentsWithDependencies: ComponentWithDependencies[]): Promise<void> {\n if (!this._shouldSaveLaneData()) {\n return;\n }\n const currentLane = await this.consumer.getCurrentLaneObject();\n if (!currentLane) {\n return; // user on main\n }\n const idsFromRemoteLanes = BitIds.fromArray(this.laneObjects.flatMap((lane) => lane.toBitIds()));\n const components = componentsWithDependencies.map((c) => c.component);\n await Promise.all(\n components.map(async (comp) => {\n const existOnRemoteLane = idsFromRemoteLanes.has(comp.id);\n if (!existOnRemoteLane && !this.options.saveInLane) {\n this.consumer.bitMap.setComponentProp(comp.id, 'onLanesOnly', false);\n return;\n }\n const modelComponent = await this.scope.getModelComponent(comp.id);\n const ref = modelComponent.getRef(comp.id.version as string);\n if (!ref) throw new Error(`_saveLaneDataIfNeeded unable to get ref for ${comp.id.toString()}`);\n currentLane.addComponent({ id: comp.id, head: ref });\n })\n );\n await this.scope.lanes.saveLane(currentLane);\n }\n\n async _writeToFileSystem(componentsWithDependencies: ComponentWithDependencies[]) {\n if (this.options.objectsOnly) {\n return;\n }\n const componentsToWrite = await this.updateAllComponentsAccordingToMergeStrategy(componentsWithDependencies);\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer: this.consumer,\n componentsWithDependencies: componentsToWrite,\n writeToPath: this.options.writeToPath,\n writeConfig: this.options.writeConfig,\n installNpmPackages: this.options.installNpmPackages,\n verbose: this.options.verbose,\n override: this.options.override,\n });\n await manyComponentsWriter.writeAll();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;A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M0O,GAAG,GAAG9L,cAAc,CAAC+L,MAAM,CAACN,IAAI,CAACrO,EAAE,CAAC4L,OAAO,CAAW;MAC5D,IAAI,CAAC8C,GAAG,EAAE,MAAM,IAAIjP,KAAK,CAAE,+CAA8C4O,IAAI,CAACrO,EAAE,CAACC,QAAQ,EAAG,EAAC,CAAC;MAC9FiO,WAAW,CAACU,YAAY,CAAC;QAAE5O,EAAE,EAAEqO,IAAI,CAACrO,EAAE;QAAE6O,IAAI,EAAEH;MAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CACH;IACD,MAAM,IAAI,CAACjQ,KAAK,CAACE,KAAK,CAAC6C,QAAQ,CAAC0M,WAAW,CAAC;EAC9C;EAEA,MAAMzL,kBAAkB,CAACL,0BAAuD,EAAE;IAChF,IAAI,IAAI,CAAC7D,OAAO,CAACiB,WAAW,EAAE;MAC5B;IACF;IACA,MAAMmO,iBAAiB,GAAG,MAAM,IAAI,CAACL,2CAA2C,CAAClL,0BAA0B,CAAC;IAC5G,MAAM0M,oBAAoB,GAAG,KAAIC,+BAAoB,EAAC;MACpDvQ,QAAQ,EAAE,IAAI,CAACA,QAAQ;MACvB4D,0BAA0B,EAAEuL,iBAAiB;MAC7CqB,WAAW,EAAE,IAAI,CAACzQ,OAAO,CAACyQ,WAAW;MACrCC,WAAW,EAAE,IAAI,CAAC1Q,OAAO,CAAC0Q,WAAW;MACrCC,kBAAkB,EAAE,IAAI,CAAC3Q,OAAO,CAAC2Q,kBAAkB;MACnDC,OAAO,EAAE,IAAI,CAAC5Q,OAAO,CAAC4Q,OAAO;MAC7BlH,QAAQ,EAAE,IAAI,CAAC1J,OAAO,CAAC0J;IACzB,CAAC,CAAC;IACF,MAAM6G,oBAAoB,CAACM,QAAQ,EAAE;EACvC;AACF;AAAC"}
1
+ {"version":3,"names":["ImportComponents","constructor","workspace","graph","componentWriter","options","consumer","scope","laneObjects","lanes","importComponents","loader","start","BEFORE_IMPORT_ACTION","saveDependenciesAsComponents","config","_saveDependenciesAsComponents","ids","length","importObjectsOnLane","importSpecificComponents","importAccordingToBitMap","objectsOnly","Error","lane","undefined","bitIds","getBitIds","logger","debug","id","toString","beforeImportVersions","_getCurrentVersions","versionDependenciesArr","_importComponentsObjects","mainIdsLatest","BitIds","fromArray","toBitIds","map","m","changeVersion","ignoreMissingHead","mergeAllLanesResults","pMapSeries","laneObject","sources","mergeLane","mergedLanes","result","Promise","all","mergedLane","saveLane","importDetails","_getImportDetails","importedIds","v","component","flat","importedDeps","allDependenciesIds","join","_throwForPotentialIssues","writtenComponents","componentsWithDependencies","multipleVersionDependenciesToConsumer","objects","_fetchDivergeData","_throwForDivergedHistory","_writeToFileSystem","_saveLaneDataIfNeeded","c","modelComponent","getModelComponent","setDivergeData","divergeData","push","merge","divergedComponents","filter","getDivergeData","isDiverged","snapsLocal","snapsOnSourceOnly","snapsRemote","snapsOnTargetOnly","ComponentsPendingMerge","fromOriginalScope","scopeComponentsImporter","ScopeComponentsImporter","getInstance","importManyDeltaWithoutDeps","fromHead","allHistory","collectParents","results","importManyFromOriginalScopes","importMany","preferDependencyGraph","fetchDeps","getBitIdsForLanes","bitIdsFromLane","flatMap","mainIds","bitMap","getAuthoredAndImportedBitIdsOfDefaultLane","mainIdsToImport","hasScope","hasWithoutVersion","idsWithWildcard","hasWildcard","idsWithoutWildcard","idsWithoutWildcardPreferFromLane","idStr","BitId","parse","fromLane","searchWithoutVersion","idsFromRemote","getRemoteBitIdsByWildcards","existingOnLanes","BitError","l","name","toStringWithoutVersion","getBitIdsForNonLanes","importDependenciesDirectly","importDependents","graphs","_getComponentsGraphs","dependenciesIds","_getDependenciesFromGraph","getGraphIds","targetCompIds","resolveMultipleComponentIds","sourceIds","listIds","findIdsFromSourcesToTargets","_legacy","uniqFromArray","dependencies","bitId","componentGraph","find","scopeName","dependenciesInfo","getDependenciesInfo","d","R","flatten","_getDependentsFromGraph","dependents","dependentsInfo","getDependentsInfo","remotes","getScopeRemotes","scopeGraphs","override","componentsIdsToImport","getIdsToImportFromBitmap","isEmpty","NothingToImport","_throwForModifiedOrNewComponents","componentWithDependencies","allIds","getAllBitIdsFromAllLanes","versionsP","getModelComponentIfExist","listVersions","versions","fromPairs","currentVersions","components","detailsP","Object","keys","ShowDoctorError","afterImportVersions","versionDifference","difference","getStatus","filesStatus","mergeStatus","deprecated","isDeprecated","removed","isRemoved","latestVersion","getHeadRegardlessOfLaneAsTagOrHash","includes","status","missingDeps","getMissingDependencies","_throwForDifferentComponentWithSameName","componentsStatuses","getManyComponentsStatuses","modifiedComponents","modified","newlyCreated","GeneralError","chalk","yellow","forEach","existingId","getParsedIdIfExist","_getMergeStatus","componentStatus","getComponentStatusById","mergeResults","componentModel","existingBitMapBitId","getBitId","ignoreVersion","fsComponent","loadComponent","currentlyUsedVersion","version","baseComponent","loadVersion","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","_updateComponentFilesPerMergeStrategy","componentMergeStatus","files","hasConflicts","mergeStrategy","MergeOptions","ours","file","pathNormalizeToLinux","relative","FileStatus","unchanged","updateComponentId","hasChanged","theirs","updated","modifiedFiles","applyModifiedVersion","updateAllComponentsAccordingToMergeStrategy","componentsStatusP","componentsStatus","componentWithConflict","getMergeStrategyInteractive","componentsToWrite","unchangedFiles","removeNulls","reject","isNil","_shouldSaveLaneData","isOnLane","currentLane","getCurrentLaneObject","idsFromRemoteLanes","comp","existOnRemoteLane","has","saveInLane","setComponentProp","ref","getRef","addComponent","head","manyComponentsWriterOpts","writeToPath","writeConfig","skipDependencyInstallation","installNpmPackages","verbose","throwForExistingDir","writeMany"],"sources":["import-components.ts"],"sourcesContent":["import chalk from 'chalk';\nimport R from 'ramda';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport pMapSeries from 'p-map-series';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BEFORE_IMPORT_ACTION } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport ShowDoctorError from '@teambit/legacy/dist/error/show-doctor-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport Remotes from '@teambit/legacy/dist/remotes/remotes';\nimport { ComponentWithDependencies, Scope } from '@teambit/legacy/dist/scope';\nimport DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport Component from '@teambit/legacy/dist/consumer/component';\nimport { NothingToImport } from '@teambit/legacy/dist/consumer/exceptions';\nimport { applyModifiedVersion } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { FilesStatus, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ComponentsPendingMerge from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-merge';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport VersionDependencies, {\n multipleVersionDependenciesToConsumer,\n} from '@teambit/legacy/dist/scope/version-dependencies';\nimport { GraphMain } from '@teambit/graph';\nimport { Workspace } from '@teambit/workspace';\nimport { ComponentWriterMain } from '@teambit/component-writer';\n\nexport type ImportOptions = {\n ids: string[]; // array might be empty\n verbose?: boolean;\n merge?: boolean;\n mergeStrategy?: MergeStrategy;\n writeToPath?: string;\n writeConfig?: boolean;\n override?: boolean;\n installNpmPackages: boolean; // default: true\n objectsOnly?: boolean;\n saveDependenciesAsComponents?: boolean;\n importDependenciesDirectly?: boolean; // default: false, normally it imports them as packages or nested, not as imported\n importDependents?: boolean;\n fromOriginalScope?: boolean; // default: false, otherwise, it fetches flattened dependencies from their dependents\n saveInLane?: boolean; // save the imported component on the current lane (won't be available on main)\n lanes?: {\n laneIds: LaneId[];\n lanes: Lane[]; // it can be an empty array when a lane is a local lane and doesn't exist on the remote\n };\n allHistory?: boolean;\n fetchDeps?: boolean; // by default, if a component was tagged with > 0.0.900, it has the flattened-deps-graph in the object\n};\ntype ComponentMergeStatus = {\n componentWithDependencies: ComponentWithDependencies;\n mergeResults: MergeResultsThreeWay | null | undefined;\n};\ntype ImportedVersions = { [id: string]: string[] };\nexport type ImportStatus = 'added' | 'updated' | 'up to date';\nexport type ImportDetails = {\n id: string;\n versions: string[];\n latestVersion: string | null;\n status: ImportStatus;\n filesStatus: FilesStatus | null | undefined;\n missingDeps: BitId[];\n deprecated: boolean;\n removed?: boolean;\n};\nexport type ImportResult = {\n importedIds: BitId[];\n importedDeps: BitId[];\n writtenComponents?: Component[];\n importDetails: ImportDetails[];\n cancellationMessage?: string;\n};\n\nexport default class ImportComponents {\n consumer: Consumer;\n scope: Scope;\n mergeStatus: { [id: string]: FilesStatus };\n private laneObjects: Lane[];\n private divergeData: Array<ModelComponent> = [];\n constructor(\n private workspace: Workspace,\n private graph: GraphMain,\n private componentWriter: ComponentWriterMain,\n public options: ImportOptions\n ) {\n this.consumer = this.workspace.consumer;\n this.scope = this.consumer.scope;\n this.laneObjects = this.options.lanes ? (this.options.lanes.lanes as Lane[]) : [];\n }\n\n importComponents(): Promise<ImportResult> {\n loader.start(BEFORE_IMPORT_ACTION);\n this.options.saveDependenciesAsComponents = this.consumer.config._saveDependenciesAsComponents;\n if (this.options.lanes && !this.options.ids.length) {\n return this.importObjectsOnLane();\n }\n if (this.options.ids.length) {\n return this.importSpecificComponents();\n }\n return this.importAccordingToBitMap();\n }\n\n async importObjectsOnLane(): Promise<ImportResult> {\n if (!this.options.objectsOnly) {\n throw new Error(`importObjectsOnLane should have objectsOnly=true`);\n }\n if (this.laneObjects.length > 1) {\n throw new Error(`importObjectsOnLane does not support more than one lane`);\n }\n const lane = this.laneObjects.length ? this.laneObjects[0] : undefined;\n const bitIds: BitIds = await this.getBitIds();\n lane\n ? logger.debug(`importObjectsOnLane, Lane: ${lane.id()}, Ids: ${bitIds.toString()}`)\n : logger.debug(`importObjectsOnLane, the lane does not exist on the remote. importing only the main components`);\n const beforeImportVersions = await this._getCurrentVersions(bitIds);\n const versionDependenciesArr = await this._importComponentsObjects(bitIds, {\n lane,\n });\n\n // import lane components from their original scope, this way, it's possible to run diff/merge on them.\n // don't use `scope.getDefaultLaneIdsFromLane()`. we need all components, because it's possible that a component\n // does't have \"head\" locally although it exits in the origin-scope. it happens when the component was created on\n // the origin-scope after a component with the same-name was created on the lane\n if (lane) {\n // @todo: optimize this maybe. currently, it imports twice.\n // try to make the previous `importComponentsObjectsHarmony` import the same component once from the original\n // scope and once from the lane-scope.\n const mainIdsLatest = BitIds.fromArray(lane.toBitIds().map((m) => m.changeVersion(undefined)));\n await this._importComponentsObjects(mainIdsLatest, {\n ignoreMissingHead: true,\n });\n }\n\n // merge the lane objects\n const mergeAllLanesResults = await pMapSeries(this.laneObjects, (laneObject) =>\n this.scope.sources.mergeLane(laneObject, true)\n );\n const mergedLanes = mergeAllLanesResults.map((result) => result.mergeLane);\n await Promise.all(mergedLanes.map((mergedLane) => this.scope.lanes.saveLane(mergedLane)));\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n importDetails,\n };\n }\n\n async importSpecificComponents(): Promise<ImportResult> {\n logger.debug(`importSpecificComponents, Ids: ${this.options.ids.join(', ')}`);\n const bitIds: BitIds = await this.getBitIds();\n const beforeImportVersions = await this._getCurrentVersions(bitIds);\n await this._throwForPotentialIssues(bitIds);\n const versionDependenciesArr = await this._importComponentsObjects(bitIds, {\n lane: this.laneObjects?.[0],\n });\n if (this.laneObjects && this.options.objectsOnly) {\n // merge the lane objects\n const mergeAllLanesResults = await pMapSeries(this.laneObjects, (laneObject) =>\n this.scope.sources.mergeLane(laneObject, true)\n );\n const mergedLanes = mergeAllLanesResults.map((result) => result.mergeLane);\n await Promise.all(mergedLanes.map((mergedLane) => this.scope.lanes.saveLane(mergedLane)));\n }\n let writtenComponents: Component[] = [];\n if (!this.options.objectsOnly) {\n const componentsWithDependencies = await multipleVersionDependenciesToConsumer(\n versionDependenciesArr,\n this.scope.objects\n );\n await this._fetchDivergeData(componentsWithDependencies);\n this._throwForDivergedHistory();\n await this._writeToFileSystem(componentsWithDependencies);\n await this._saveLaneDataIfNeeded(componentsWithDependencies);\n writtenComponents = componentsWithDependencies.map((c) => c.component);\n }\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n writtenComponents,\n importDetails,\n };\n }\n\n async _fetchDivergeData(componentsWithDependencies: ComponentWithDependencies[]) {\n if (this.options.objectsOnly) {\n // no need for it when importing objects only. if it's enabled, in case when on a lane and a non-lane\n // component is in bitmap using an older version, it throws \"getDivergeData: unable to find Version X of Y\"\n return;\n }\n await Promise.all(\n componentsWithDependencies.map(async ({ component }) => {\n const modelComponent = await this.scope.getModelComponent(component.id);\n await modelComponent.setDivergeData(this.scope.objects, undefined, false);\n this.divergeData.push(modelComponent);\n })\n );\n }\n\n _throwForDivergedHistory() {\n if (this.options.merge || this.options.objectsOnly) return;\n const divergedComponents = this.divergeData.filter((modelComponent) =>\n modelComponent.getDivergeData().isDiverged()\n );\n if (divergedComponents.length) {\n const divergeData = divergedComponents.map((modelComponent) => ({\n id: modelComponent.id(),\n snapsLocal: modelComponent.getDivergeData().snapsOnSourceOnly.length,\n snapsRemote: modelComponent.getDivergeData().snapsOnTargetOnly.length,\n }));\n throw new ComponentsPendingMerge(divergeData);\n }\n }\n\n private async _importComponentsObjects(\n ids: BitIds,\n {\n fromOriginalScope = false,\n lane,\n ignoreMissingHead = false,\n }: {\n fromOriginalScope?: boolean;\n lane?: Lane;\n ignoreMissingHead?: boolean;\n }\n ): Promise<VersionDependencies[]> {\n const scopeComponentsImporter = ScopeComponentsImporter.getInstance(this.scope);\n await scopeComponentsImporter.importManyDeltaWithoutDeps({\n ids,\n fromHead: this.options.allHistory,\n collectParents: this.options.allHistory,\n lane,\n // in case a user is merging a lane into a new workspace, then, locally main has head, but remotely the head is\n // empty, until it's exported. going to the remote and asking this component will throw an error if ignoreMissingHead is false\n ignoreMissingHead: true,\n });\n loader.start(`import ${ids.length} components with their dependencies (if missing)`);\n const results = fromOriginalScope\n ? await scopeComponentsImporter.importManyFromOriginalScopes(ids)\n : await scopeComponentsImporter.importMany({\n ids,\n ignoreMissingHead,\n lanes: lane ? [lane] : undefined,\n preferDependencyGraph: !this.options.fetchDeps,\n });\n\n return results;\n }\n\n /**\n * consider the following use cases:\n * 1) no ids were provided. it should import all the lanes components objects AND main components objects\n * (otherwise, if main components are not imported and are missing, then bit-status complains about it)\n * 2) ids are provided with wildcards. we assume the user wants only the ids that are available on the lane.\n * because a user may entered \"bit import scope/*\" and this scope has many component on the lane and many not on the lane.\n * we want to bring only the components on the lane.\n * 3) ids are provided without wildcards. here, the user knows exactly what's needed and it's ok to get the ids from\n * main if not found on the lane.\n */\n private async getBitIdsForLanes(): Promise<BitId[]> {\n if (!this.options.lanes) {\n throw new Error(`getBitIdsForLanes: this.options.lanes must be set`);\n }\n const bitIdsFromLane = BitIds.fromArray(this.laneObjects.flatMap((lane) => lane.toBitIds()));\n\n if (!this.options.ids.length) {\n const mainIds = this.consumer.bitMap.getAuthoredAndImportedBitIdsOfDefaultLane();\n const mainIdsToImport = mainIds.filter((id) => id.hasScope() && !bitIdsFromLane.hasWithoutVersion(id));\n bitIdsFromLane.push(...mainIdsToImport);\n return bitIdsFromLane;\n }\n\n const idsWithWildcard = this.options.ids.filter((id) => hasWildcard(id));\n const idsWithoutWildcard = this.options.ids.filter((id) => !hasWildcard(id));\n const idsWithoutWildcardPreferFromLane = idsWithoutWildcard.map((idStr) => {\n const id = BitId.parse(idStr, true);\n const fromLane = bitIdsFromLane.searchWithoutVersion(id);\n return fromLane || id;\n });\n\n const bitIds: BitId[] = [...idsWithoutWildcardPreferFromLane];\n\n if (!idsWithWildcard) {\n return bitIds;\n }\n\n await pMapSeries(idsWithWildcard, async (idStr: string) => {\n const idsFromRemote = await getRemoteBitIdsByWildcards(idStr);\n const existingOnLanes = idsFromRemote.filter((id) => bitIdsFromLane.hasWithoutVersion(id));\n if (!existingOnLanes.length) {\n throw new BitError(`the id with the the wildcard \"${idStr}\" has been parsed to multiple component ids.\nhowever, none of them existing on the lane \"${this.laneObjects.map((l) => l.name).join(', ')}\"\nin case you intend to import these components from main, please run the following:\nbit import ${idsFromRemote.map((id) => id.toStringWithoutVersion()).join(' ')}`);\n }\n bitIds.push(...existingOnLanes);\n });\n\n return bitIds;\n }\n\n private async getBitIdsForNonLanes() {\n const bitIds: BitId[] = [];\n await Promise.all(\n this.options.ids.map(async (idStr: string) => {\n if (hasWildcard(idStr)) {\n const ids = await getRemoteBitIdsByWildcards(idStr);\n loader.start(BEFORE_IMPORT_ACTION); // it stops the previous loader of BEFORE_REMOTE_LIST\n bitIds.push(...ids);\n } else {\n bitIds.push(BitId.parse(idStr, true)); // we don't support importing without a scope name\n }\n })\n );\n\n return bitIds;\n }\n\n private async getBitIds(): Promise<BitIds> {\n const bitIds: BitId[] = this.options.lanes ? await this.getBitIdsForLanes() : await this.getBitIdsForNonLanes();\n if (this.options.importDependenciesDirectly || this.options.importDependents) {\n const graphs = await this._getComponentsGraphs(bitIds);\n if (this.options.importDependenciesDirectly) {\n const dependenciesIds = this._getDependenciesFromGraph(bitIds, graphs);\n bitIds.push(...dependenciesIds);\n }\n if (this.options.importDependents) {\n const graph = await this.graph.getGraphIds();\n const targetCompIds = await this.workspace.resolveMultipleComponentIds(bitIds);\n const sourceIds = await this.workspace.listIds();\n const ids = graph.findIdsFromSourcesToTargets(sourceIds, targetCompIds);\n logger.debug(\n `found ${ids.length} component for --dependents flag`,\n ids.map((id) => id.toString())\n );\n bitIds.push(...ids.map((id) => id._legacy));\n }\n }\n return BitIds.uniqFromArray(bitIds);\n }\n\n _getDependenciesFromGraph(bitIds: BitId[], graphs: DependencyGraph[]): BitId[] {\n const dependencies = bitIds.map((bitId) => {\n const componentGraph = graphs.find((graph) => graph.scopeName === bitId.scope);\n if (!componentGraph) {\n throw new Error(`unable to find a graph for ${bitId.toString()}`);\n }\n const dependenciesInfo = componentGraph.getDependenciesInfo(bitId);\n return dependenciesInfo.map((d) => d.id);\n });\n return R.flatten(dependencies);\n }\n\n _getDependentsFromGraph(bitIds: BitId[], graphs: DependencyGraph[]): BitId[] {\n const dependents = bitIds.map((bitId) => {\n const componentGraph = graphs.find((graph) => graph.scopeName === bitId.scope);\n if (!componentGraph) {\n throw new Error(`unable to find a graph for ${bitId.toString()}`);\n }\n const dependentsInfo = componentGraph.getDependentsInfo(bitId);\n return dependentsInfo.map((d) => d.id);\n });\n return R.flatten(dependents);\n }\n\n async _getComponentsGraphs(bitIds: BitId[]): Promise<DependencyGraph[]> {\n const remotes: Remotes = await getScopeRemotes(this.consumer.scope);\n return remotes.scopeGraphs(bitIds, this.consumer.scope);\n }\n\n async importAccordingToBitMap(): Promise<ImportResult> {\n this.options.objectsOnly = !this.options.merge && !this.options.override;\n const componentsIdsToImport = this.getIdsToImportFromBitmap();\n\n if (R.isEmpty(componentsIdsToImport)) {\n throw new NothingToImport();\n }\n await this._throwForModifiedOrNewComponents(componentsIdsToImport);\n const beforeImportVersions = await this._getCurrentVersions(componentsIdsToImport);\n if (!componentsIdsToImport.length) {\n return {\n importedIds: [],\n importedDeps: [],\n importDetails: [],\n };\n }\n if (!this.options.objectsOnly) {\n throw new Error(`bit import with no ids and --merge flag was not implemented yet`);\n }\n const versionDependenciesArr = await this._importComponentsObjects(componentsIdsToImport, {\n fromOriginalScope: this.options.fromOriginalScope,\n });\n let writtenComponents: Component[] = [];\n if (!this.options.objectsOnly) {\n const componentWithDependencies = await multipleVersionDependenciesToConsumer(\n versionDependenciesArr,\n this.scope.objects\n );\n await this._writeToFileSystem(componentWithDependencies);\n writtenComponents = componentWithDependencies.map((c) => c.component);\n }\n\n const importDetails = await this._getImportDetails(beforeImportVersions, versionDependenciesArr);\n\n return {\n importedIds: versionDependenciesArr.map((v) => v.component.id).flat(),\n importedDeps: versionDependenciesArr.map((v) => v.allDependenciesIds).flat(),\n writtenComponents,\n importDetails,\n };\n }\n\n private getIdsToImportFromBitmap() {\n const allIds = this.consumer.bitMap.getAllBitIdsFromAllLanes();\n return BitIds.fromArray(allIds.filter((id) => id.hasScope()));\n }\n\n async _getCurrentVersions(ids: BitIds): Promise<ImportedVersions> {\n const versionsP = ids.map(async (id) => {\n const modelComponent = await this.consumer.scope.getModelComponentIfExist(id.changeVersion(undefined));\n const idStr = id.toStringWithoutVersion();\n if (!modelComponent) return [idStr, []];\n return [idStr, modelComponent.listVersions()];\n });\n const versions = await Promise.all(versionsP);\n return R.fromPairs(versions);\n }\n\n /**\n * get import details, includes the diff between the versions array before import and after import\n */\n async _getImportDetails(\n currentVersions: ImportedVersions,\n components: VersionDependencies[]\n ): Promise<ImportDetails[]> {\n const detailsP = components.map(async (component) => {\n const id = component.component.id;\n const idStr = id.toStringWithoutVersion();\n const beforeImportVersions = currentVersions[idStr];\n if (!beforeImportVersions) {\n throw new Error(\n `_getImportDetails failed finding ${idStr} in currentVersions, which has ${Object.keys(currentVersions).join(\n ', '\n )}`\n );\n }\n const modelComponent = await this.consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) throw new ShowDoctorError(`imported component ${idStr} was not found in the model`);\n const afterImportVersions = modelComponent.listVersions();\n const versionDifference: string[] = R.difference(afterImportVersions, beforeImportVersions);\n const getStatus = (): ImportStatus => {\n if (!versionDifference.length) return 'up to date';\n if (!beforeImportVersions.length) return 'added';\n return 'updated';\n };\n const filesStatus = this.mergeStatus && this.mergeStatus[idStr] ? this.mergeStatus[idStr] : null;\n const deprecated = await modelComponent.isDeprecated(this.scope.objects);\n const removed = await component.component.component.isRemoved(this.scope.objects);\n const latestVersion = modelComponent.getHeadRegardlessOfLaneAsTagOrHash(true);\n return {\n id: idStr,\n versions: versionDifference,\n latestVersion: versionDifference.includes(latestVersion) ? latestVersion : null,\n status: getStatus(),\n filesStatus,\n missingDeps: this.options.fetchDeps ? component.getMissingDependencies() : [],\n deprecated,\n removed,\n };\n });\n return Promise.all(detailsP);\n }\n\n async _throwForPotentialIssues(ids: BitIds): Promise<void> {\n await this._throwForModifiedOrNewComponents(ids);\n this._throwForDifferentComponentWithSameName(ids);\n }\n\n async _throwForModifiedOrNewComponents(ids: BitIds): Promise<void> {\n // the typical objectsOnly option is when a user cloned a project with components tagged to the source code, but\n // doesn't have the model objects. in that case, calling getComponentStatusById() may return an error as it relies\n // on the model objects when there are dependencies\n if (this.options.override || this.options.objectsOnly || this.options.merge) return;\n const componentsStatuses = await this.consumer.getManyComponentsStatuses(ids);\n const modifiedComponents = componentsStatuses\n .filter(({ status }) => status.modified || status.newlyCreated)\n .map((c) => c.id);\n if (modifiedComponents.length) {\n throw new GeneralError(\n chalk.yellow(\n `unable to import the following components due to local changes, use --merge flag to merge your local changes or --override to override them\\n${modifiedComponents.join(\n '\\n'\n )} `\n )\n );\n }\n }\n\n /**\n * Model Component id() calculation uses id.toString() for the hash.\n * If an imported component has scopereadonly name equals to a local name, both will have the exact same\n * hash and they'll override each other.\n */\n _throwForDifferentComponentWithSameName(ids: BitIds): void {\n ids.forEach((id: BitId) => {\n const existingId = this.consumer.getParsedIdIfExist(id.toStringWithoutVersion());\n if (existingId && !existingId.hasScope()) {\n throw new GeneralError(`unable to import ${id.toString()}. the component name conflicted with your local component with the same name.\n it's fine to have components with the same name as long as their scope names are different.\n Make sure to export your component first to get a scope and then try importing again`);\n }\n });\n }\n\n async _getMergeStatus(componentWithDependencies: ComponentWithDependencies): Promise<ComponentMergeStatus> {\n const component = componentWithDependencies.component;\n const componentStatus = await this.consumer.getComponentStatusById(component.id);\n const mergeStatus: ComponentMergeStatus = { componentWithDependencies, mergeResults: null };\n if (!componentStatus.modified) return mergeStatus;\n const componentModel = await this.consumer.scope.getModelComponent(component.id);\n const existingBitMapBitId = this.consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const fsComponent = await this.consumer.loadComponent(existingBitMapBitId);\n const currentlyUsedVersion = existingBitMapBitId.version;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const baseComponent: Version = await componentModel.loadVersion(currentlyUsedVersion, this.consumer.scope.objects);\n const otherComponent: Version = await componentModel.loadVersion(\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n component.id.version,\n this.consumer.scope.objects\n );\n const mergeResults = await threeWayMerge({\n consumer: this.consumer,\n otherComponent,\n otherLabel: component.id.version as string,\n currentComponent: fsComponent,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n mergeStatus.mergeResults = mergeResults;\n return mergeStatus;\n }\n\n /**\n * 1) when there are conflicts and the strategy is \"ours\", don't write the imported component to\n * the filesystem, only update bitmap.\n *\n * 2) when there are conflicts and the strategy is \"theirs\", override the local changes by the\n * imported component. (similar to --override)\n *\n * 3) when there is no conflict or there are conflicts and the strategy is manual, write the files\n * according to the merge result. (done by applyModifiedVersion())\n */\n _updateComponentFilesPerMergeStrategy(componentMergeStatus: ComponentMergeStatus): FilesStatus | null | undefined {\n const mergeResults = componentMergeStatus.mergeResults;\n if (!mergeResults) return null;\n const component = componentMergeStatus.componentWithDependencies.component;\n const files = component.files;\n\n if (mergeResults.hasConflicts && this.options.mergeStrategy === MergeOptions.ours) {\n const filesStatus = {};\n // don't write the files to the filesystem, only bump the bitmap version.\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n this.consumer.bitMap.updateComponentId(component.id);\n this.consumer.bitMap.hasChanged = true;\n return filesStatus;\n }\n if (mergeResults.hasConflicts && this.options.mergeStrategy === MergeOptions.theirs) {\n const filesStatus = {};\n // the local changes will be overridden (as if the user entered --override flag for this component)\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n return filesStatus;\n }\n const { filesStatus, modifiedFiles } = applyModifiedVersion(\n component.files,\n mergeResults,\n this.options.mergeStrategy\n );\n component.files = modifiedFiles;\n\n return filesStatus;\n }\n\n /**\n * update the component files if they are modified and there is a merge strategy.\n * returns only the components that need to be written to the filesystem\n */\n async updateAllComponentsAccordingToMergeStrategy(\n componentsWithDependencies: ComponentWithDependencies[]\n ): Promise<ComponentWithDependencies[]> {\n if (!this.options.merge) return componentsWithDependencies;\n const componentsStatusP = componentsWithDependencies.map((componentWithDependencies: ComponentWithDependencies) => {\n return this._getMergeStatus(componentWithDependencies);\n });\n const componentsStatus = await Promise.all(componentsStatusP);\n const componentWithConflict = componentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !this.options.mergeStrategy) {\n this.options.mergeStrategy = await getMergeStrategyInteractive();\n }\n this.mergeStatus = {};\n\n const componentsToWrite = componentsStatus.map((componentStatus) => {\n const filesStatus: FilesStatus | null | undefined = this._updateComponentFilesPerMergeStrategy(componentStatus);\n const componentWithDependencies = componentStatus.componentWithDependencies;\n if (!filesStatus) return componentWithDependencies;\n this.mergeStatus[componentWithDependencies.component.id.toStringWithoutVersion()] = filesStatus;\n const unchangedFiles = Object.keys(filesStatus).filter((file) => filesStatus[file] === FileStatus.unchanged);\n if (unchangedFiles.length === Object.keys(filesStatus).length) {\n // all files are unchanged\n return null;\n }\n return componentWithDependencies;\n });\n const removeNulls = R.reject(R.isNil);\n return removeNulls(componentsToWrite);\n }\n\n _shouldSaveLaneData(): boolean {\n if (this.options.objectsOnly) {\n return false;\n }\n return this.consumer.isOnLane();\n }\n\n async _saveLaneDataIfNeeded(componentsWithDependencies: ComponentWithDependencies[]): Promise<void> {\n if (!this._shouldSaveLaneData()) {\n return;\n }\n const currentLane = await this.consumer.getCurrentLaneObject();\n if (!currentLane) {\n return; // user on main\n }\n const idsFromRemoteLanes = BitIds.fromArray(this.laneObjects.flatMap((lane) => lane.toBitIds()));\n const components = componentsWithDependencies.map((c) => c.component);\n await Promise.all(\n components.map(async (comp) => {\n const existOnRemoteLane = idsFromRemoteLanes.has(comp.id);\n if (!existOnRemoteLane && !this.options.saveInLane) {\n this.consumer.bitMap.setComponentProp(comp.id, 'onLanesOnly', false);\n return;\n }\n const modelComponent = await this.scope.getModelComponent(comp.id);\n const ref = modelComponent.getRef(comp.id.version as string);\n if (!ref) throw new Error(`_saveLaneDataIfNeeded unable to get ref for ${comp.id.toString()}`);\n currentLane.addComponent({ id: comp.id, head: ref });\n })\n );\n await this.scope.lanes.saveLane(currentLane);\n }\n\n async _writeToFileSystem(componentsWithDependencies: ComponentWithDependencies[]) {\n if (this.options.objectsOnly) {\n return;\n }\n const componentsToWrite = await this.updateAllComponentsAccordingToMergeStrategy(componentsWithDependencies);\n const manyComponentsWriterOpts = {\n consumer: this.consumer,\n componentsWithDependencies: componentsToWrite,\n writeToPath: this.options.writeToPath,\n writeConfig: this.options.writeConfig,\n skipDependencyInstallation: !this.options.installNpmPackages,\n verbose: this.options.verbose,\n throwForExistingDir: !this.options.override,\n };\n await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;E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C7Q,OAAO,CAAC0J;IACrC,CAAC;IACD,MAAM,IAAI,CAAC3J,eAAe,CAAC+Q,SAAS,CAACP,wBAAwB,CAAC;EAChE;AACF;AAAC"}
@@ -2,8 +2,11 @@ import { CLIMain } from '@teambit/cli';
2
2
  import { DependencyResolverMain } from '@teambit/dependency-resolver';
3
3
  import { Workspace } from '@teambit/workspace';
4
4
  import type { CommunityMain } from '@teambit/community';
5
+ import { ComponentWriterMain } from '@teambit/component-writer';
6
+ import { Logger, LoggerMain } from '@teambit/logger';
5
7
  import { ScopeMain } from '@teambit/scope';
6
8
  import { LaneId } from '@teambit/lane-id';
9
+ import { InstallMain } from '@teambit/install';
7
10
  import { Lane } from '@teambit/legacy/dist/scope/models';
8
11
  import { GraphMain } from '@teambit/graph';
9
12
  import { ImportOptions, ImportResult } from './import-components';
@@ -12,16 +15,17 @@ export declare class ImporterMain {
12
15
  private depResolver;
13
16
  private graph;
14
17
  private scope;
15
- constructor(workspace: Workspace, depResolver: DependencyResolverMain, graph: GraphMain, scope: ScopeMain);
18
+ private componentWriter;
19
+ private logger;
20
+ constructor(workspace: Workspace, depResolver: DependencyResolverMain, graph: GraphMain, scope: ScopeMain, componentWriter: ComponentWriterMain, logger: Logger);
16
21
  import(importOptions: ImportOptions, packageManagerArgs: string[]): Promise<ImportResult>;
17
- /**
18
- * @todo: combine with this.import()
19
- */
20
- importWithOptions(importOptions: ImportOptions): Promise<ImportResult>;
21
- fetch(ids: string[], lanes: boolean, components: boolean, fromOriginalScope: boolean): Promise<{
22
+ importObjects(): Promise<void>;
23
+ fetchLaneWithComponents(lane: Lane): Promise<ImportResult>;
24
+ fetch(ids: string[], lanes: boolean, components: boolean, fromOriginalScope: boolean): Promise<ImportResult | {
22
25
  importedIds: import("@teambit/legacy/dist/bit-id").BitId[];
23
26
  importDetails: import("./import-components").ImportDetails[];
24
27
  }>;
28
+ fetchMultipleLanes(lanes: Lane[]): Promise<ImportResult>;
25
29
  /**
26
30
  * get a Lane object from the remote.
27
31
  * `persistIfNotExists` saves the object in the local scope only if the lane is not there yet.
@@ -35,12 +39,15 @@ export declare class ImporterMain {
35
39
  static slots: never[];
36
40
  static dependencies: import("@teambit/harmony").Aspect[];
37
41
  static runtime: import("@teambit/harmony").RuntimeDefinition;
38
- static provider([cli, workspace, depResolver, community, graph, scope]: [
42
+ static provider([cli, workspace, depResolver, community, graph, scope, componentWriter, install, loggerMain]: [
39
43
  CLIMain,
40
44
  Workspace,
41
45
  DependencyResolverMain,
42
46
  CommunityMain,
43
47
  GraphMain,
44
- ScopeMain
48
+ ScopeMain,
49
+ ComponentWriterMain,
50
+ InstallMain,
51
+ LoggerMain
45
52
  ]): Promise<ImporterMain>;
46
53
  }
@@ -63,8 +63,22 @@ function _legacyBitId() {
63
63
  };
64
64
  return data;
65
65
  }
66
+ function _pMapSeries() {
67
+ const data = _interopRequireDefault(require("p-map-series"));
68
+ _pMapSeries = function () {
69
+ return data;
70
+ };
71
+ return data;
72
+ }
73
+ function _componentWriter() {
74
+ const data = _interopRequireDefault(require("@teambit/component-writer"));
75
+ _componentWriter = function () {
76
+ return data;
77
+ };
78
+ return data;
79
+ }
66
80
  function _logger() {
67
- const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
81
+ const data = require("@teambit/logger");
68
82
  _logger = function () {
69
83
  return data;
70
84
  };
@@ -91,6 +105,13 @@ function _scopeComponentsImporter() {
91
105
  };
92
106
  return data;
93
107
  }
108
+ function _install() {
109
+ const data = _interopRequireDefault(require("@teambit/install"));
110
+ _install = function () {
111
+ return data;
112
+ };
113
+ return data;
114
+ }
94
115
  function _loader() {
95
116
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/loader"));
96
117
  _loader = function () {
@@ -98,6 +119,13 @@ function _loader() {
98
119
  };
99
120
  return data;
100
121
  }
122
+ function _exceptions() {
123
+ const data = require("@teambit/legacy/dist/consumer/exceptions");
124
+ _exceptions = function () {
125
+ return data;
126
+ };
127
+ return data;
128
+ }
101
129
  function _scopeNotFoundOrDenied() {
102
130
  const data = require("@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied");
103
131
  _scopeNotFoundOrDenied = function () {
@@ -157,11 +185,13 @@ function _importComponents() {
157
185
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
158
186
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
159
187
  class ImporterMain {
160
- constructor(workspace, depResolver, graph, scope) {
188
+ constructor(workspace, depResolver, graph, scope, componentWriter, logger) {
161
189
  this.workspace = workspace;
162
190
  this.depResolver = depResolver;
163
191
  this.graph = graph;
164
192
  this.scope = scope;
193
+ this.componentWriter = componentWriter;
194
+ this.logger = logger;
165
195
  }
166
196
  async import(importOptions, packageManagerArgs) {
167
197
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
@@ -188,7 +218,7 @@ class ImporterMain {
188
218
  };
189
219
  }
190
220
  }
191
- const importComponents = new (_importComponents().default)(this.workspace, this.graph, importOptions);
221
+ const importComponents = new (_importComponents().default)(this.workspace, this.graph, this.componentWriter, importOptions);
192
222
  const results = await importComponents.importComponents();
193
223
  _analytics().Analytics.setExtraData('num_components', results.importedIds.length);
194
224
  if (results.writtenComponents && results.writtenComponents.length) {
@@ -197,13 +227,36 @@ class ImporterMain {
197
227
  await consumer.onDestroy();
198
228
  return results;
199
229
  }
200
-
201
- /**
202
- * @todo: combine with this.import()
203
- */
204
- async importWithOptions(importOptions) {
205
- if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
206
- const importComponents = new (_importComponents().default)(this.workspace, this.graph, importOptions);
230
+ async importObjects() {
231
+ try {
232
+ await this.import({
233
+ ids: [],
234
+ objectsOnly: true,
235
+ installNpmPackages: false
236
+ }, []);
237
+ } catch (err) {
238
+ // TODO: this is a hack since the legacy throw an error, we should provide a way to not throw this error from the legacy
239
+ if (err instanceof _exceptions().NothingToImport) {
240
+ // Do not write nothing to import warning
241
+ return;
242
+ }
243
+ throw err;
244
+ }
245
+ }
246
+ async fetchLaneWithComponents(lane) {
247
+ const importOptions = {
248
+ ids: [],
249
+ objectsOnly: true,
250
+ verbose: false,
251
+ writeConfig: false,
252
+ override: false,
253
+ installNpmPackages: false,
254
+ lanes: {
255
+ laneIds: [lane.toLaneId()],
256
+ lanes: [lane]
257
+ }
258
+ };
259
+ const importComponents = new (_importComponents().default)(this.workspace, this.graph, this.componentWriter, importOptions);
207
260
  return importComponents.importComponents();
208
261
  }
209
262
  async fetch(ids, lanes, components, fromOriginalScope) {
@@ -223,10 +276,13 @@ class ImporterMain {
223
276
  fromOriginalScope
224
277
  };
225
278
  if (lanes) {
226
- importOptions.lanes = await getLanes();
279
+ importOptions.lanes = await getLanes(this.logger);
227
280
  importOptions.ids = [];
281
+ if (importOptions.lanes.lanes.length > 1) {
282
+ return this.fetchMultipleLanes(importOptions.lanes.lanes);
283
+ }
228
284
  }
229
- const importComponents = new (_importComponents().default)(this.workspace, this.graph, importOptions);
285
+ const importComponents = new (_importComponents().default)(this.workspace, this.graph, this.componentWriter, importOptions);
230
286
  const {
231
287
  importedIds,
232
288
  importDetails
@@ -237,7 +293,7 @@ class ImporterMain {
237
293
  importedIds,
238
294
  importDetails
239
295
  };
240
- async function getLanes() {
296
+ async function getLanes(logger) {
241
297
  const result = {
242
298
  laneIds: [],
243
299
  lanes: []
@@ -261,7 +317,7 @@ class ImporterMain {
261
317
  if (err instanceof _legacyBitId().InvalidScopeName || err instanceof _scopeNotFoundOrDenied().ScopeNotFoundOrDenied || err instanceof _laneNotFound().LaneNotFound || err instanceof _legacyBitId().InvalidScopeNameFromRemote) {
262
318
  // the lane could be a local lane so no need to throw an error in such case
263
319
  _loader().default.stop();
264
- _logger().default.console(`unable to get lane's data from a remote due to an error:\n${err.message}`, 'warn', 'yellow');
320
+ logger.console(`unable to get lane's data from a remote due to an error:\n${err.message}`, 'warn', 'yellow');
265
321
  } else {
266
322
  throw err;
267
323
  }
@@ -269,6 +325,24 @@ class ImporterMain {
269
325
  return result;
270
326
  }
271
327
  }
328
+ async fetchMultipleLanes(lanes) {
329
+ // workaround for an issue where we have the current-lane object at hand but not its components, the sources.get
330
+ // throws an error about missing the Version object in the filesystem. to reproduce, comment the following line and
331
+ // run the e2e-test "import objects for multiple lanes".
332
+ await this.importObjects();
333
+ const resultsPerLane = await (0, _pMapSeries().default)(lanes, async lane => {
334
+ this.logger.setStatusLine(`fetching lane ${lane.name}`);
335
+ const results = await this.fetchLaneWithComponents(lane);
336
+ this.logger.consoleSuccess();
337
+ return results;
338
+ });
339
+ const results = resultsPerLane.reduce((acc, curr) => {
340
+ acc.importedIds.push(...curr.importedIds);
341
+ acc.importDetails.push(...curr.importDetails);
342
+ return acc;
343
+ });
344
+ return results;
345
+ }
272
346
 
273
347
  /**
274
348
  * get a Lane object from the remote.
@@ -298,15 +372,25 @@ class ImporterMain {
298
372
  getImportedPackagesNames(components) {
299
373
  return components.map(component => (0, _componentIdToPackageName().default)(component));
300
374
  }
301
- static async provider([cli, workspace, depResolver, community, graph, scope]) {
302
- const importerMain = new ImporterMain(workspace, depResolver, graph, scope);
375
+ static async provider([cli, workspace, depResolver, community, graph, scope, componentWriter, install, loggerMain]) {
376
+ const logger = loggerMain.createLogger(_importer().ImporterAspect.id);
377
+ const importerMain = new ImporterMain(workspace, depResolver, graph, scope, componentWriter, logger);
378
+ install.registerPreInstall(async opts => {
379
+ if (!(opts !== null && opts !== void 0 && opts.import)) return;
380
+ logger.setStatusLine('importing missing objects');
381
+ await importerMain.importObjects();
382
+ logger.consoleSuccess();
383
+ });
384
+ install.registerPreLink(async opts => {
385
+ if (opts !== null && opts !== void 0 && opts.fetchObject) await importerMain.importObjects();
386
+ });
303
387
  cli.register(new (_import().ImportCmd)(importerMain, community.getDocsDomain()), new (_fetchCmd().FetchCmd)(importerMain));
304
388
  return importerMain;
305
389
  }
306
390
  }
307
391
  exports.ImporterMain = ImporterMain;
308
392
  (0, _defineProperty2().default)(ImporterMain, "slots", []);
309
- (0, _defineProperty2().default)(ImporterMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _community().CommunityAspect, _graph().default, _scope().default]);
393
+ (0, _defineProperty2().default)(ImporterMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _community().CommunityAspect, _graph().default, _scope().default, _componentWriter().default, _install().default, _logger().LoggerAspect]);
310
394
  (0, _defineProperty2().default)(ImporterMain, "runtime", _cli().MainRuntime);
311
395
  _importer().ImporterAspect.addRuntime(ImporterMain);
312
396
 
@@ -1 +1 @@
1
- {"version":3,"names":["ImporterMain","constructor","workspace","depResolver","graph","scope","import","importOptions","packageManagerArgs","OutsideWorkspaceError","consumer","ids","length","objectsOnly","isOnLane","currentRemoteLane","getCurrentRemoteLane","lanes","laneIds","toLaneId","currentLaneId","getCurrentLaneId","importComponents","ImportComponents","results","Analytics","setExtraData","importedIds","writtenComponents","removeFromWorkspaceConfig","onDestroy","importWithOptions","fetch","components","fromOriginalScope","BitError","loader","start","verbose","writeConfig","override","installNpmPackages","getLanes","importDetails","result","remoteLaneIds","map","id","trackLane","getRemoteTrackedDataByLocalLane","LaneId","from","remoteLane","remoteScope","parse","objects","remoteLanes","getAllRemoteLaneIds","scopeComponentImporter","ScopeComponentsImporter","getInstance","importLanes","push","err","InvalidScopeName","ScopeNotFoundOrDenied","LaneNotFound","InvalidScopeNameFromRemote","stop","logger","console","message","importLaneObject","laneId","persistIfNotExists","legacyScope","scopeImporter","laneObject","name","exists","loadLane","saveLane","component","importedPackageNames","getImportedPackagesNames","removeFromRootPolicy","persistConfig","path","componentIdToPackageName","provider","cli","community","importerMain","register","ImportCmd","getDocsDomain","FetchCmd","CLIAspect","WorkspaceAspect","DependencyResolverAspect","CommunityAspect","GraphAspect","ScopeAspect","MainRuntime","ImporterAspect","addRuntime"],"sources":["importer.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { InvalidScopeName, InvalidScopeNameFromRemote } from '@teambit/legacy-bit-id';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport ScopeAspect, { ScopeMain } from '@teambit/scope';\nimport { LaneId } from '@teambit/lane-id';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ScopeNotFoundOrDenied } from '@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied';\nimport GraphAspect, { GraphMain } from '@teambit/graph';\nimport { LaneNotFound } from '@teambit/legacy/dist/api/scope/lib/exceptions/lane-not-found';\nimport { BitError } from '@teambit/bit-error';\nimport { ImportCmd } from './import.cmd';\nimport { ImporterAspect } from './importer.aspect';\nimport { FetchCmd } from './fetch-cmd';\nimport ImportComponents, { ImportOptions, ImportResult } from './import-components';\n\nexport class ImporterMain {\n constructor(\n private workspace: Workspace,\n private depResolver: DependencyResolverMain,\n private graph: GraphMain,\n private scope: ScopeMain\n ) {}\n\n async import(importOptions: ImportOptions, packageManagerArgs: string[]): Promise<ImportResult> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n consumer.packageManagerArgs = packageManagerArgs;\n if (!importOptions.ids.length) {\n importOptions.objectsOnly = true;\n }\n if (this.workspace.consumer.isOnLane()) {\n const currentRemoteLane = await this.workspace.getCurrentRemoteLane();\n if (currentRemoteLane) {\n importOptions.lanes = { laneIds: [currentRemoteLane.toLaneId()], lanes: [currentRemoteLane] };\n } else if (!importOptions.ids.length) {\n // this is probably a local lane that was never exported.\n // although no need to fetch from the lane, still, the import is needed for main (which are available on this\n // local lane)\n const currentLaneId = this.workspace.getCurrentLaneId();\n importOptions.lanes = { laneIds: [currentLaneId], lanes: [] };\n }\n }\n const importComponents = new ImportComponents(this.workspace, this.graph, importOptions);\n const results = await importComponents.importComponents();\n Analytics.setExtraData('num_components', results.importedIds.length);\n if (results.writtenComponents && results.writtenComponents.length) {\n await this.removeFromWorkspaceConfig(results.writtenComponents);\n }\n await consumer.onDestroy();\n return results;\n }\n\n /**\n * @todo: combine with this.import()\n */\n async importWithOptions(importOptions: ImportOptions) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const importComponents = new ImportComponents(this.workspace, this.graph, importOptions);\n return importComponents.importComponents();\n }\n\n async fetch(ids: string[], lanes: boolean, components: boolean, fromOriginalScope: boolean) {\n if (!lanes && !components) {\n throw new BitError(\n `please provide the type of objects you would like to pull, the options are --components and --lanes`\n );\n }\n loader.start('fetching objects...');\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n const importOptions: ImportOptions = {\n ids,\n objectsOnly: true,\n verbose: false,\n writeConfig: false,\n override: false,\n installNpmPackages: false,\n fromOriginalScope,\n };\n if (lanes) {\n importOptions.lanes = await getLanes();\n importOptions.ids = [];\n }\n const importComponents = new ImportComponents(this.workspace, this.graph, importOptions);\n const { importedIds, importDetails } = await importComponents.importComponents();\n Analytics.setExtraData('num_components', importedIds.length);\n await consumer.onDestroy();\n return { importedIds, importDetails };\n\n async function getLanes(): Promise<{ laneIds: LaneId[]; lanes: Lane[] }> {\n const result: { laneIds: LaneId[]; lanes: Lane[] } = { laneIds: [], lanes: [] };\n let remoteLaneIds: LaneId[] = [];\n if (ids.length) {\n remoteLaneIds = ids.map((id) => {\n const trackLane = consumer.scope.lanes.getRemoteTrackedDataByLocalLane(id);\n if (trackLane) return LaneId.from(trackLane.remoteLane, trackLane.remoteScope);\n return LaneId.parse(id);\n });\n } else {\n remoteLaneIds = await consumer.scope.objects.remoteLanes.getAllRemoteLaneIds();\n }\n const scopeComponentImporter = ScopeComponentsImporter.getInstance(consumer.scope);\n try {\n const remoteLanes = await scopeComponentImporter.importLanes(remoteLaneIds);\n result.laneIds.push(...remoteLaneIds);\n result.lanes.push(...remoteLanes);\n } catch (err) {\n if (\n err instanceof InvalidScopeName ||\n err instanceof ScopeNotFoundOrDenied ||\n err instanceof LaneNotFound ||\n err instanceof InvalidScopeNameFromRemote\n ) {\n // the lane could be a local lane so no need to throw an error in such case\n loader.stop();\n logger.console(`unable to get lane's data from a remote due to an error:\\n${err.message}`, 'warn', 'yellow');\n } else {\n throw err;\n }\n }\n\n return result;\n }\n }\n\n /**\n * get a Lane object from the remote.\n * `persistIfNotExists` saves the object in the local scope only if the lane is not there yet.\n * otherwise, it needs some merging mechanism, which is done differently whether it's export or import.\n * see `sources.mergeLane()` for export and `import-components._saveLaneDataIfNeeded()` for import.\n * in this case, because we only bring the lane object and not the components, it's not easy to do the merge.\n */\n async importLaneObject(laneId: LaneId, persistIfNotExists = true): Promise<Lane> {\n const legacyScope = this.scope.legacyScope;\n const results = await legacyScope.scopeImporter.importLanes([laneId]);\n const laneObject = results[0];\n if (!laneObject) throw new LaneNotFound(laneId.scope, laneId.name);\n\n if (persistIfNotExists) {\n const exists = await legacyScope.loadLane(laneId);\n if (!exists) {\n await legacyScope.lanes.saveLane(laneObject);\n }\n }\n\n return laneObject;\n }\n\n private async removeFromWorkspaceConfig(component: ConsumerComponent[]) {\n const importedPackageNames = this.getImportedPackagesNames(component);\n this.depResolver.removeFromRootPolicy(importedPackageNames);\n await this.depResolver.persistConfig(this.workspace.path);\n }\n\n private getImportedPackagesNames(components: ConsumerComponent[]): string[] {\n return components.map((component) => componentIdToPackageName(component));\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DependencyResolverAspect,\n CommunityAspect,\n GraphAspect,\n ScopeAspect,\n ];\n static runtime = MainRuntime;\n static async provider([cli, workspace, depResolver, community, graph, scope]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n CommunityMain,\n GraphMain,\n ScopeMain\n ]) {\n const importerMain = new ImporterMain(workspace, depResolver, graph, scope);\n cli.register(new ImportCmd(importerMain, community.getDocsDomain()), new FetchCmd(importerMain));\n return importerMain;\n }\n}\n\nImporterAspect.addRuntime(ImporterMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA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,EACTC,oBAAe,EACfC,8CAAwB,EACxBC,4BAAe,EACfC,gBAAW,EACXC,gBAAW,CACZ;AAAA,gCAvJUtG,YAAY,aAwJNuG,kBAAW;AAe9BC,0BAAc,CAACC,UAAU,CAACzG,YAAY,CAAC"}
1
+ {"version":3,"names":["ImporterMain","constructor","workspace","depResolver","graph","scope","componentWriter","logger","import","importOptions","packageManagerArgs","OutsideWorkspaceError","consumer","ids","length","objectsOnly","isOnLane","currentRemoteLane","getCurrentRemoteLane","lanes","laneIds","toLaneId","currentLaneId","getCurrentLaneId","importComponents","ImportComponents","results","Analytics","setExtraData","importedIds","writtenComponents","removeFromWorkspaceConfig","onDestroy","importObjects","installNpmPackages","err","NothingToImport","fetchLaneWithComponents","lane","verbose","writeConfig","override","fetch","components","fromOriginalScope","BitError","loader","start","getLanes","fetchMultipleLanes","importDetails","result","remoteLaneIds","map","id","trackLane","getRemoteTrackedDataByLocalLane","LaneId","from","remoteLane","remoteScope","parse","objects","remoteLanes","getAllRemoteLaneIds","scopeComponentImporter","ScopeComponentsImporter","getInstance","importLanes","push","InvalidScopeName","ScopeNotFoundOrDenied","LaneNotFound","InvalidScopeNameFromRemote","stop","console","message","resultsPerLane","pMapSeries","setStatusLine","name","consoleSuccess","reduce","acc","curr","importLaneObject","laneId","persistIfNotExists","legacyScope","scopeImporter","laneObject","exists","loadLane","saveLane","component","importedPackageNames","getImportedPackagesNames","removeFromRootPolicy","persistConfig","path","componentIdToPackageName","provider","cli","community","install","loggerMain","createLogger","ImporterAspect","importerMain","registerPreInstall","opts","registerPreLink","fetchObject","register","ImportCmd","getDocsDomain","FetchCmd","CLIAspect","WorkspaceAspect","DependencyResolverAspect","CommunityAspect","GraphAspect","ScopeAspect","ComponentWriterAspect","InstallAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["importer.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { InvalidScopeName, InvalidScopeNameFromRemote } from '@teambit/legacy-bit-id';\nimport pMapSeries from 'p-map-series';\nimport ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport ScopeAspect, { ScopeMain } from '@teambit/scope';\nimport { LaneId } from '@teambit/lane-id';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport InstallAspect, { InstallMain } from '@teambit/install';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { NothingToImport } from '@teambit/legacy/dist/consumer/exceptions';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ScopeNotFoundOrDenied } from '@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied';\nimport GraphAspect, { GraphMain } from '@teambit/graph';\nimport { LaneNotFound } from '@teambit/legacy/dist/api/scope/lib/exceptions/lane-not-found';\nimport { BitError } from '@teambit/bit-error';\nimport { ImportCmd } from './import.cmd';\nimport { ImporterAspect } from './importer.aspect';\nimport { FetchCmd } from './fetch-cmd';\nimport ImportComponents, { ImportOptions, ImportResult } from './import-components';\n\nexport class ImporterMain {\n constructor(\n private workspace: Workspace,\n private depResolver: DependencyResolverMain,\n private graph: GraphMain,\n private scope: ScopeMain,\n private componentWriter: ComponentWriterMain,\n private logger: Logger\n ) {}\n\n async import(importOptions: ImportOptions, packageManagerArgs: string[]): Promise<ImportResult> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n consumer.packageManagerArgs = packageManagerArgs;\n if (!importOptions.ids.length) {\n importOptions.objectsOnly = true;\n }\n if (this.workspace.consumer.isOnLane()) {\n const currentRemoteLane = await this.workspace.getCurrentRemoteLane();\n if (currentRemoteLane) {\n importOptions.lanes = { laneIds: [currentRemoteLane.toLaneId()], lanes: [currentRemoteLane] };\n } else if (!importOptions.ids.length) {\n // this is probably a local lane that was never exported.\n // although no need to fetch from the lane, still, the import is needed for main (which are available on this\n // local lane)\n const currentLaneId = this.workspace.getCurrentLaneId();\n importOptions.lanes = { laneIds: [currentLaneId], lanes: [] };\n }\n }\n const importComponents = new ImportComponents(this.workspace, this.graph, this.componentWriter, importOptions);\n const results = await importComponents.importComponents();\n Analytics.setExtraData('num_components', results.importedIds.length);\n if (results.writtenComponents && results.writtenComponents.length) {\n await this.removeFromWorkspaceConfig(results.writtenComponents);\n }\n await consumer.onDestroy();\n return results;\n }\n\n async importObjects() {\n try {\n await this.import(\n {\n ids: [],\n objectsOnly: true,\n installNpmPackages: false,\n },\n []\n );\n } catch (err: any) {\n // TODO: this is a hack since the legacy throw an error, we should provide a way to not throw this error from the legacy\n if (err instanceof NothingToImport) {\n // Do not write nothing to import warning\n return;\n }\n throw err;\n }\n }\n\n async fetchLaneWithComponents(lane: Lane): Promise<ImportResult> {\n const importOptions: ImportOptions = {\n ids: [],\n objectsOnly: true,\n verbose: false,\n writeConfig: false,\n override: false,\n installNpmPackages: false,\n lanes: { laneIds: [lane.toLaneId()], lanes: [lane] },\n };\n const importComponents = new ImportComponents(this.workspace, this.graph, this.componentWriter, importOptions);\n return importComponents.importComponents();\n }\n\n async fetch(ids: string[], lanes: boolean, components: boolean, fromOriginalScope: boolean) {\n if (!lanes && !components) {\n throw new BitError(\n `please provide the type of objects you would like to pull, the options are --components and --lanes`\n );\n }\n loader.start('fetching objects...');\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n const importOptions: ImportOptions = {\n ids,\n objectsOnly: true,\n verbose: false,\n writeConfig: false,\n override: false,\n installNpmPackages: false,\n fromOriginalScope,\n };\n if (lanes) {\n importOptions.lanes = await getLanes(this.logger);\n importOptions.ids = [];\n if (importOptions.lanes.lanes.length > 1) {\n return this.fetchMultipleLanes(importOptions.lanes.lanes);\n }\n }\n\n const importComponents = new ImportComponents(this.workspace, this.graph, this.componentWriter, importOptions);\n const { importedIds, importDetails } = await importComponents.importComponents();\n Analytics.setExtraData('num_components', importedIds.length);\n await consumer.onDestroy();\n return { importedIds, importDetails };\n\n async function getLanes(logger: Logger): Promise<{ laneIds: LaneId[]; lanes: Lane[] }> {\n const result: { laneIds: LaneId[]; lanes: Lane[] } = { laneIds: [], lanes: [] };\n let remoteLaneIds: LaneId[] = [];\n if (ids.length) {\n remoteLaneIds = ids.map((id) => {\n const trackLane = consumer.scope.lanes.getRemoteTrackedDataByLocalLane(id);\n if (trackLane) return LaneId.from(trackLane.remoteLane, trackLane.remoteScope);\n return LaneId.parse(id);\n });\n } else {\n remoteLaneIds = await consumer.scope.objects.remoteLanes.getAllRemoteLaneIds();\n }\n const scopeComponentImporter = ScopeComponentsImporter.getInstance(consumer.scope);\n try {\n const remoteLanes = await scopeComponentImporter.importLanes(remoteLaneIds);\n result.laneIds.push(...remoteLaneIds);\n result.lanes.push(...remoteLanes);\n } catch (err) {\n if (\n err instanceof InvalidScopeName ||\n err instanceof ScopeNotFoundOrDenied ||\n err instanceof LaneNotFound ||\n err instanceof InvalidScopeNameFromRemote\n ) {\n // the lane could be a local lane so no need to throw an error in such case\n loader.stop();\n logger.console(`unable to get lane's data from a remote due to an error:\\n${err.message}`, 'warn', 'yellow');\n } else {\n throw err;\n }\n }\n\n return result;\n }\n }\n\n async fetchMultipleLanes(lanes: Lane[]) {\n // workaround for an issue where we have the current-lane object at hand but not its components, the sources.get\n // throws an error about missing the Version object in the filesystem. to reproduce, comment the following line and\n // run the e2e-test \"import objects for multiple lanes\".\n await this.importObjects();\n\n const resultsPerLane = await pMapSeries(lanes, async (lane) => {\n this.logger.setStatusLine(`fetching lane ${lane.name}`);\n const results = await this.fetchLaneWithComponents(lane);\n this.logger.consoleSuccess();\n return results;\n });\n const results = resultsPerLane.reduce((acc, curr) => {\n acc.importedIds.push(...curr.importedIds);\n acc.importDetails.push(...curr.importDetails);\n return acc;\n });\n return results;\n }\n\n /**\n * get a Lane object from the remote.\n * `persistIfNotExists` saves the object in the local scope only if the lane is not there yet.\n * otherwise, it needs some merging mechanism, which is done differently whether it's export or import.\n * see `sources.mergeLane()` for export and `import-components._saveLaneDataIfNeeded()` for import.\n * in this case, because we only bring the lane object and not the components, it's not easy to do the merge.\n */\n async importLaneObject(laneId: LaneId, persistIfNotExists = true): Promise<Lane> {\n const legacyScope = this.scope.legacyScope;\n const results = await legacyScope.scopeImporter.importLanes([laneId]);\n const laneObject = results[0];\n if (!laneObject) throw new LaneNotFound(laneId.scope, laneId.name);\n\n if (persistIfNotExists) {\n const exists = await legacyScope.loadLane(laneId);\n if (!exists) {\n await legacyScope.lanes.saveLane(laneObject);\n }\n }\n\n return laneObject;\n }\n\n private async removeFromWorkspaceConfig(component: ConsumerComponent[]) {\n const importedPackageNames = this.getImportedPackagesNames(component);\n this.depResolver.removeFromRootPolicy(importedPackageNames);\n await this.depResolver.persistConfig(this.workspace.path);\n }\n\n private getImportedPackagesNames(components: ConsumerComponent[]): string[] {\n return components.map((component) => componentIdToPackageName(component));\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DependencyResolverAspect,\n CommunityAspect,\n GraphAspect,\n ScopeAspect,\n ComponentWriterAspect,\n InstallAspect,\n LoggerAspect,\n ];\n static runtime = MainRuntime;\n static async provider([cli, workspace, depResolver, community, graph, scope, componentWriter, install, loggerMain]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n CommunityMain,\n GraphMain,\n ScopeMain,\n ComponentWriterMain,\n InstallMain,\n LoggerMain\n ]) {\n const logger = loggerMain.createLogger(ImporterAspect.id);\n const importerMain = new ImporterMain(workspace, depResolver, graph, scope, componentWriter, logger);\n install.registerPreInstall(async (opts) => {\n if (!opts?.import) return;\n logger.setStatusLine('importing missing objects');\n await importerMain.importObjects();\n logger.consoleSuccess();\n });\n install.registerPreLink(async (opts) => {\n if (opts?.fetchObject) await importerMain.importObjects();\n });\n cli.register(new ImportCmd(importerMain, community.getDocsDomain()), new FetchCmd(importerMain));\n return importerMain;\n }\n}\n\nImporterAspect.addRuntime(ImporterMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA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I,IAAK;MACzC,IAAI,EAACA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEtG,MAAM,GAAE;MACnBD,MAAM,CAACwE,aAAa,CAAC,2BAA2B,CAAC;MACjD,MAAM6B,YAAY,CAAC3E,aAAa,EAAE;MAClC1B,MAAM,CAAC0E,cAAc,EAAE;IACzB,CAAC,CAAC;IACFuB,OAAO,CAACO,eAAe,CAAC,MAAOD,IAAI,IAAK;MACtC,IAAIA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEE,WAAW,EAAE,MAAMJ,YAAY,CAAC3E,aAAa,EAAE;IAC3D,CAAC,CAAC;IACFqE,GAAG,CAACW,QAAQ,CAAC,KAAIC,mBAAS,EAACN,YAAY,EAAEL,SAAS,CAACY,aAAa,EAAE,CAAC,EAAE,KAAIC,oBAAQ,EAACR,YAAY,CAAC,CAAC;IAChG,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAxOY5G,YAAY,WAkMR,EAAE;AAAA,gCAlMNA,YAAY,kBAmMD,CACpBqH,gBAAS,EACTC,oBAAe,EACfC,8CAAwB,EACxBC,4BAAe,EACfC,gBAAW,EACXC,gBAAW,EACXC,0BAAqB,EACrBC,kBAAa,EACbC,sBAAY,CACb;AAAA,gCA7MU7H,YAAY,aA8MN8H,kBAAW;AA4B9BnB,0BAAc,CAACoB,UAAU,CAAC/H,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_importer@0.0.393/dist/importer.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_importer@0.0.393/dist/importer.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_importer@0.0.395/dist/importer.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_importer@0.0.395/dist/importer.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/importer",
3
- "version": "0.0.393",
3
+ "version": "0.0.395",
4
4
  "homepage": "https://bit.dev/teambit/scope/importer",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.scope",
8
8
  "name": "importer",
9
- "version": "0.0.393"
9
+ "version": "0.0.395"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -16,15 +16,18 @@
16
16
  "core-js": "^3.0.0",
17
17
  "@babel/runtime": "7.20.0",
18
18
  "@teambit/harmony": "0.4.6",
19
- "@teambit/cli": "0.0.647",
19
+ "@teambit/cli": "0.0.649",
20
20
  "@teambit/legacy-bit-id": "0.0.421",
21
21
  "@teambit/bit-error": "0.0.402",
22
- "@teambit/graph": "0.0.964",
23
- "@teambit/lane-id": "0.0.164",
24
- "@teambit/workspace": "0.0.964",
25
- "@teambit/community": "0.0.195",
26
- "@teambit/dependency-resolver": "0.0.964",
27
- "@teambit/scope": "0.0.964"
22
+ "@teambit/component-writer": "0.0.2",
23
+ "@teambit/graph": "0.0.966",
24
+ "@teambit/lane-id": "0.0.166",
25
+ "@teambit/workspace": "0.0.966",
26
+ "@teambit/community": "0.0.197",
27
+ "@teambit/dependency-resolver": "0.0.966",
28
+ "@teambit/install": "0.0.96",
29
+ "@teambit/logger": "0.0.742",
30
+ "@teambit/scope": "0.0.966"
28
31
  },
29
32
  "devDependencies": {
30
33
  "@types/lodash": "4.14.165",
@@ -36,7 +39,7 @@
36
39
  "@types/testing-library__jest-dom": "5.9.5"
37
40
  },
38
41
  "peerDependencies": {
39
- "@teambit/legacy": "1.0.427",
42
+ "@teambit/legacy": "1.0.430",
40
43
  "react": "^16.8.0 || ^17.0.0",
41
44
  "react-dom": "^16.8.0 || ^17.0.0"
42
45
  },