@teambit/merging 1.0.982 → 1.0.984

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.
@@ -271,7 +271,11 @@ other: ${otherLaneHead.toString()}`);
271
271
  ignoreVersion: true
272
272
  });
273
273
  const componentOnOther = await modelComponent.loadVersion(version, this.scope.legacyScope.objects);
274
- const idOnCurrentLane = this.currentLane?.getComponent(id);
274
+ // include hidden lane.updateDependents — when merging main into a lane, a hidden cascade
275
+ // entry is the lane-side baseline for the 3-way merge. Without this the merge engine treats
276
+ // the comp as "not on the lane" and produces a snap with parents=[mainHead], losing the
277
+ // ancestral link to the lane's hidden head.
278
+ const idOnCurrentLane = this.currentLane?.getComponent(id) || this.currentLane?.getUpdateDependentAsLaneComponent(id);
275
279
  if (componentOnOther.isRemoved()) {
276
280
  // if exist in current lane, we want the current lane to get the soft-remove update.
277
281
  // or if it was removed with --update-main, we want to merge it so then main will get the update.
@@ -1 +1 @@
1
- {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_componentModules","_dependencyResolver","_builder","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","compIsAlreadyMergedMsg","exports","compHasBeenRemovedMsg","MergeStatusProvider","constructor","scope","logger","importer","options","workspace","currentLane","otherLane","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","legacyScope","scopeImporter","importWithoutDeps","ComponentIdList","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","currentComponent","Error","otherLaneHead","currentId","modelComponent","repo","objects","baseSnap","debug","toStringWithoutVersion","version","baseComponent","loadVersion","otherComponent","currentLaneName","toLaneId","otherLaneName","DEFAULT_LANE","currentLabel","otherLabel","workspaceIds","listIds","toComponentIds","configMerger","ComponentConfigMerger","extensions","mergeStrategy","configMergeResult","merge","dataMergeResult","mergeExtensionsData","mergeResults","threeWayMerge","currentExtensions","baseExtensions","otherExtensions","shouldMergeAspectsData","conflictedAspects","aspectsToSkip","DependencyResolverAspect","BuilderAspect","currentExtension","includes","stringId","baseExtension","findExtension","idWithoutVersion","otherExtension","extensionId","isEqual","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","consumer","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","head","shouldBeRemoved","getCurrentId","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","componentMap","getComponentIfExist","isLocallyRemoved","getCurrentComponent","loadComponent","getConsumerComponent","isRemovedOnMain","findCoreExtension","config","removeOnMain","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","undefined","componentModificationStatus","getComponentStatusById","modified","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","sourceHead","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","detachHead","commonSnapId","commonSnapComp","isDiverged","isSourceAhead","handleTargetAheadAsDiverged","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane"],"sources":["merge-status-provider.ts"],"sourcesContent":["import type { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport type { Lane, ModelComponent, Version, Ref } from '@teambit/objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEqual } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { threeWayMerge } from '@teambit/component.modules.merge-helper';\nimport type { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { BuilderAspect } from '@teambit/builder';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\n shouldMergeAspectsData?: boolean;\n};\n\ntype ConflictedDataAspects = { [extId: string]: string }; // extId => reason\n\nexport type DataMergeResult = {\n conflictedAspects?: ConflictedDataAspects;\n};\n\nexport const compIsAlreadyMergedMsg = 'component is already merged';\nexport const compHasBeenRemovedMsg = 'component has been removed';\nexport class MergeStatusProvider {\n constructor(\n private scope: ScopeMain,\n private logger: Logger,\n private importer: ImporterMain,\n private options: MergeStatusProviderOptions,\n private workspace?: Workspace,\n private currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.\n private otherLane?: Lane // the lane we want to merged to our lane. (undefined if it's \"main\").\n ) {}\n\n async getStatus(\n bitIds: ComponentID[] // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatus[]> {\n if (!this.currentLane && this.otherLane) {\n await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());\n }\n const componentStatusBeforeMergeAttempt = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id)\n );\n // whether or not we need to import the gap between the common-snap and the other lane.\n // the common-snap itself we need anyway in order to get the files hash/content for checking conflicts.\n const shouldImportHistoryOfOtherLane =\n !this.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\n (!this.currentLane || // on main. we need all history in order to push each component to its remote\n this.currentLane.scope !== this.otherLane?.scope); // on lane, but the other lane is from a different scope. we need all history in order to push to the current lane's scope\n const toImport = componentStatusBeforeMergeAttempt\n .map((compStatus) => {\n if (!compStatus.divergeData) return [];\n const versionsToImport = [compStatus.divergeData.commonSnapBeforeDiverge];\n if (shouldImportHistoryOfOtherLane) {\n versionsToImport.push(...compStatus.divergeData.snapsOnTargetOnly);\n }\n return compact(versionsToImport).map((v) => compStatus.id.changeVersion(v.toString()));\n })\n .flat();\n const reason = shouldImportHistoryOfOtherLane\n ? `for filling the gap between the common-snap and the head of ${this.otherLane?.id() || 'main'}`\n : `for getting the common-snap between ${this.currentLane?.id() || 'main'} and ${this.otherLane?.id() || 'main'}`;\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n lane: this.otherLane,\n cache: true,\n includeVersionHistory: false,\n reason,\n });\n\n const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(\n (c) => !c.mergeProps\n ) as ComponentMergeStatus[];\n const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter((c) => c.mergeProps);\n\n const getComponentsStatusNeedMerge = async (): Promise<ComponentMergeStatus[]> => {\n const tmp = new Tmp(this.scope.legacyScope);\n try {\n const componentsStatus = await Promise.all(\n compStatusNeedMerge.map((compStatus) => this.getComponentMergeStatus(compStatus))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n const results = await getComponentsStatusNeedMerge();\n\n results.push(...compStatusNotNeedMerge);\n return results;\n }\n\n private async getComponentMergeStatus(\n componentMergeStatusBeforeMergeAttempt: ComponentMergeStatusBeforeMergeAttempt\n ) {\n const { id, divergeData, currentComponent, mergeProps } = componentMergeStatusBeforeMergeAttempt;\n if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);\n const { otherLaneHead, currentId, modelComponent } = mergeProps;\n const repo = this.scope.legacyScope.objects;\n if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);\n if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);\n\n const baseSnap = divergeData.commonSnapBeforeDiverge as unknown as Ref; // must be set when isTrueMerge\n this.logger.debug(`merging snaps details:\nid: ${id.toStringWithoutVersion()}\nbase: ${baseSnap.toString()}\ncurrent: ${currentId.version}\nother: ${otherLaneHead.toString()}`);\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n\n const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';\n const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : DEFAULT_LANE;\n const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;\n const otherLabel = `${otherLaneHead.toString()} (${\n otherLaneName === currentLaneName ? 'incoming' : otherLaneName\n })`;\n const workspaceIds = this.workspace?.listIds() || this.currentLane?.toComponentIds() || [];\n const configMerger = new ComponentConfigMerger(\n id.toStringWithoutVersion(),\n workspaceIds,\n this.otherLane,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n otherLabel,\n this.logger,\n this.options.mergeStrategy\n );\n const configMergeResult = configMerger.merge();\n\n const dataMergeResult = this.mergeExtensionsData(\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions\n );\n\n const mergeResults = await threeWayMerge({\n scope: this.scope.legacyScope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return {\n currentComponent,\n id,\n mergeResults,\n divergeData,\n configMergeResult,\n dataMergeResult,\n };\n }\n\n private mergeExtensionsData(\n currentExtensions: ExtensionDataList,\n baseExtensions: ExtensionDataList,\n otherExtensions: ExtensionDataList\n ): DataMergeResult {\n if (!this.options.shouldMergeAspectsData) {\n return {};\n }\n const conflictedAspects: { [extId: string]: string } = {}; // extId => reason\n // these aspects handled separately\n const aspectsToSkip = [DependencyResolverAspect.id, BuilderAspect.id];\n currentExtensions.forEach((currentExtension) => {\n if (aspectsToSkip.includes(currentExtension.stringId)) {\n return;\n }\n const baseExtension = baseExtensions.findExtension(currentExtension.idWithoutVersion, true);\n const otherExtension = otherExtensions.findExtension(currentExtension.idWithoutVersion, true);\n if (!otherExtension) {\n conflictedAspects[currentExtension.stringId] = 'missing in other';\n return;\n }\n // check whether the version is different.\n if (currentExtension.extensionId?.version !== otherExtension.extensionId?.version) {\n if (baseExtension?.extensionId?.version === otherExtension.extensionId?.version) {\n // ext version has changed in current. we're good.\n return;\n }\n conflictedAspects[currentExtension.stringId] =\n `version changed. base: ${baseExtension?.extensionId?.version}, other: ${otherExtension.extensionId?.version}`;\n return;\n }\n if (isEqual(currentExtension.data, otherExtension.data)) return;\n if (!baseExtension) {\n conflictedAspects[currentExtension.stringId] = 'no base-version. conflicted in data';\n return;\n }\n if (isEqual(baseExtension.data, otherExtension.data)) {\n return; // changed in current. leave it.\n }\n if (isEqual(baseExtension.data, currentExtension.data)) {\n // changed in other. copy it.\n currentExtension.data = otherExtension.data;\n return;\n }\n // changed in both. conflict.\n conflictedAspects[currentExtension.stringId] = 'conflicted in data since base-version';\n });\n otherExtensions.forEach((otherExtension) => {\n if (!currentExtensions.findExtension(otherExtension.idWithoutVersion, true)) {\n conflictedAspects[otherExtension.stringId] = 'missing in current';\n }\n });\n\n return { conflictedAspects };\n }\n\n private returnUnmerged(\n id: ComponentID,\n msg: string,\n unmergedLegitimately = false\n ): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const consumer = this.workspace?.consumer;\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n const modelComponent = await this.scope.legacyScope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return this.returnUnmerged(\n id,\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(id);\n if (unmerged) {\n return this.returnUnmerged(\n id,\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`\n );\n }\n const repo = this.scope.legacyScope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer?.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const componentOnOther: Version = await modelComponent.loadVersion(version, this.scope.legacyScope.objects);\n const idOnCurrentLane = this.currentLane?.getComponent(id);\n\n if (componentOnOther.isRemoved()) {\n // if exist in current lane, we want the current lane to get the soft-remove update.\n // or if it was removed with --update-main, we want to merge it so then main will get the update.\n // (unless this component does not exist on main, in which case, we don't want to merge it).\n const shouldMerge = idOnCurrentLane || (componentOnOther.shouldRemoveFromMain() && modelComponent.head);\n if (shouldMerge) {\n // remove the component from the workspace if exist.\n componentStatus.shouldBeRemoved = true;\n } else {\n // on main, don't merge soft-removed components unless it's marked with removeOnMain.\n // on lane, if it's not part of the current lane, don't merge it.\n return this.returnUnmerged(id, compHasBeenRemovedMsg, true);\n }\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (this.currentLane) {\n if (!idOnCurrentLane) return null;\n return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n return { ...componentStatus, componentFromModel: componentOnOther, divergeData };\n }\n const componentMap = consumer?.bitMap.getComponentIfExist(currentId, { ignoreVersion: true });\n const isLocallyRemoved = componentMap?.isRemoved();\n if (isLocallyRemoved) {\n return this.returnUnmerged(\n id,\n `component is locally deleted, please snap and export first or undo by bit recover`\n );\n }\n const getCurrentComponent = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (existingBitMapId) return consumer!.loadComponent(existingBitMapId);\n return this.scope.legacyScope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. \"other\" is main.\n // 1.a. it was deleted on the lane with --update-main. in this case, we need to merge because eventually we need this component\n // to be merged to main with the \"removed: true\".\n // 1.b. it was deleted on the lane without --update-main. in this case, we don't care what happens on main,\n // we want the component to stay deleted on this lane. (even when main is ahead, we don't want to merge it).\n // 2. other is ahead. in this case, other recovered the component. so we can continue with the merge.\n // it is possible that it is diverged, in which case, still continue with the merge, and later on, the\n // merge-config will show a config conflict of the remove aspect.\n // 3. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\n const isRemovedOnMain =\n currentComponent.extensions.findCoreExtension('teambit.component/remove')?.config?.removeOnMain;\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n const isTargetNotAhead = !divergeData.err && !divergeData.isTargetAhead();\n const shouldIgnore = this.otherLane\n ? isTargetNotAhead // option #2 and #3 above\n : !isRemovedOnMain; // it's main. option #1 above.\n if (shouldIgnore) {\n return this.returnUnmerged(id, compHasBeenRemovedMsg, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\n if (!consumer || !this.workspace) return undefined;\n const componentModificationStatus = await this.workspace.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return undefined;\n if (!existingBitMapId) return undefined;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);\n if (isSourceCodeModified) return 'code';\n return 'config';\n };\n\n const modifiedType = await isModified();\n if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {\n return this.returnUnmerged(\n id,\n `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`\n );\n }\n if (modifiedType === 'code') {\n return this.returnUnmerged(id, `component is modified, please snap/tag it first`);\n }\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: this.workspace ? undefined : modelComponent.getRef(currentId.version as string), // not sure if needs to check for this.workspace\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(id, `unable to traverse history. error: ${divergeData.err.message}`);\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (this.options.detachHead && divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n const commonSnapId = id.changeVersion(divergeData.commonSnapBeforeDiverge.toString());\n const commonSnapComp = await this.scope.legacyScope.getConsumerComponent(commonSnapId);\n return {\n ...componentStatus,\n currentComponent: commonSnapComp,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // component is ahead nothing to merge.\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n if (!divergeData.isTargetAhead()) {\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n // target is ahead.\n if (!this.options.handleTargetAheadAsDiverged || !divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // target is ahead and we want to treat it as diverged, continue.\n }\n\n // it's diverged and needs merge operation\n const mergeProps = {\n otherLaneHead,\n currentId,\n modelComponent,\n };\n\n return { ...componentStatus, currentComponent, mergeProps, divergeData };\n }\n\n private async handleNoCommonSnap(\n modelComponent: ModelComponent,\n id: ComponentID,\n otherLaneHead: Ref,\n currentComponent: ConsumerComponent,\n componentOnOther?: Version,\n divergeData?: SnapsDistance\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n let { resolveUnrelated } = this.options || {};\n if (currentComponent.isRemoved()) {\n resolveUnrelated = 'theirs';\n }\n if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);\n const repo = this.scope.legacyScope.objects;\n const mainHead = modelComponent.head;\n\n const returnAccordingToOurs = (\n headToSaveInLane: Ref,\n unrelatedHead: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n return {\n currentComponent,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'ours',\n headOnCurrentLane: headToSaveInLane,\n unrelatedHead,\n unrelatedLaneId,\n },\n };\n };\n const returnAccordingToTheirs = (\n resolvedRef: Ref,\n unrelatedHeadRef: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnOther,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'theirs',\n headOnCurrentLane: resolvedRef,\n unrelatedHead: unrelatedHeadRef,\n unrelatedLaneId,\n },\n };\n };\n\n const currentVersionRef = modelComponent.getRef(currentComponent.id.version as string);\n if (!currentVersionRef)\n throw new Error(\n `handleNoCommonSnap, unable to get ref of current version \"${\n currentComponent.id.version\n }\" for \"${id.toString()}\"`\n );\n const otherVersionRef = modelComponent.getRef(id.version as string);\n if (!otherVersionRef)\n throw new Error(`handleNoCommonSnap, unable to get ref of other version \"${id.version}\" for \"${id.toString()}\"`);\n\n if (mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: hashToCompare,\n targetHead: mainHead,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.\nit was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`\n );\n }\n const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n\n const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OA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,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAIyF,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAAC5K,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBuG,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAClK,OAAA,CAAAE,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_componentModules","_dependencyResolver","_builder","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","compIsAlreadyMergedMsg","exports","compHasBeenRemovedMsg","MergeStatusProvider","constructor","scope","logger","importer","options","workspace","currentLane","otherLane","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","legacyScope","scopeImporter","importWithoutDeps","ComponentIdList","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","currentComponent","Error","otherLaneHead","currentId","modelComponent","repo","objects","baseSnap","debug","toStringWithoutVersion","version","baseComponent","loadVersion","otherComponent","currentLaneName","toLaneId","otherLaneName","DEFAULT_LANE","currentLabel","otherLabel","workspaceIds","listIds","toComponentIds","configMerger","ComponentConfigMerger","extensions","mergeStrategy","configMergeResult","merge","dataMergeResult","mergeExtensionsData","mergeResults","threeWayMerge","currentExtensions","baseExtensions","otherExtensions","shouldMergeAspectsData","conflictedAspects","aspectsToSkip","DependencyResolverAspect","BuilderAspect","currentExtension","includes","stringId","baseExtension","findExtension","idWithoutVersion","otherExtension","extensionId","isEqual","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","consumer","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","getUpdateDependentAsLaneComponent","isRemoved","shouldMerge","shouldRemoveFromMain","head","shouldBeRemoved","getCurrentId","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","componentMap","getComponentIfExist","isLocallyRemoved","getCurrentComponent","loadComponent","getConsumerComponent","isRemovedOnMain","findCoreExtension","config","removeOnMain","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","undefined","componentModificationStatus","getComponentStatusById","modified","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","sourceHead","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","detachHead","commonSnapId","commonSnapComp","isDiverged","isSourceAhead","handleTargetAheadAsDiverged","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane"],"sources":["merge-status-provider.ts"],"sourcesContent":["import type { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport type { Lane, ModelComponent, Ref, Version } from '@teambit/objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEqual } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { threeWayMerge } from '@teambit/component.modules.merge-helper';\nimport type { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { BuilderAspect } from '@teambit/builder';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\n shouldMergeAspectsData?: boolean;\n};\n\ntype ConflictedDataAspects = { [extId: string]: string }; // extId => reason\n\nexport type DataMergeResult = {\n conflictedAspects?: ConflictedDataAspects;\n};\n\nexport const compIsAlreadyMergedMsg = 'component is already merged';\nexport const compHasBeenRemovedMsg = 'component has been removed';\nexport class MergeStatusProvider {\n constructor(\n private scope: ScopeMain,\n private logger: Logger,\n private importer: ImporterMain,\n private options: MergeStatusProviderOptions,\n private workspace?: Workspace,\n private currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.\n private otherLane?: Lane // the lane we want to merged to our lane. (undefined if it's \"main\").\n ) {}\n\n async getStatus(\n bitIds: ComponentID[] // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatus[]> {\n if (!this.currentLane && this.otherLane) {\n await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());\n }\n const componentStatusBeforeMergeAttempt = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id)\n );\n // whether or not we need to import the gap between the common-snap and the other lane.\n // the common-snap itself we need anyway in order to get the files hash/content for checking conflicts.\n const shouldImportHistoryOfOtherLane =\n !this.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\n (!this.currentLane || // on main. we need all history in order to push each component to its remote\n this.currentLane.scope !== this.otherLane?.scope); // on lane, but the other lane is from a different scope. we need all history in order to push to the current lane's scope\n const toImport = componentStatusBeforeMergeAttempt\n .map((compStatus) => {\n if (!compStatus.divergeData) return [];\n const versionsToImport = [compStatus.divergeData.commonSnapBeforeDiverge];\n if (shouldImportHistoryOfOtherLane) {\n versionsToImport.push(...compStatus.divergeData.snapsOnTargetOnly);\n }\n return compact(versionsToImport).map((v) => compStatus.id.changeVersion(v.toString()));\n })\n .flat();\n const reason = shouldImportHistoryOfOtherLane\n ? `for filling the gap between the common-snap and the head of ${this.otherLane?.id() || 'main'}`\n : `for getting the common-snap between ${this.currentLane?.id() || 'main'} and ${this.otherLane?.id() || 'main'}`;\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n lane: this.otherLane,\n cache: true,\n includeVersionHistory: false,\n reason,\n });\n\n const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(\n (c) => !c.mergeProps\n ) as ComponentMergeStatus[];\n const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter((c) => c.mergeProps);\n\n const getComponentsStatusNeedMerge = async (): Promise<ComponentMergeStatus[]> => {\n const tmp = new Tmp(this.scope.legacyScope);\n try {\n const componentsStatus = await Promise.all(\n compStatusNeedMerge.map((compStatus) => this.getComponentMergeStatus(compStatus))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n const results = await getComponentsStatusNeedMerge();\n\n results.push(...compStatusNotNeedMerge);\n return results;\n }\n\n private async getComponentMergeStatus(\n componentMergeStatusBeforeMergeAttempt: ComponentMergeStatusBeforeMergeAttempt\n ) {\n const { id, divergeData, currentComponent, mergeProps } = componentMergeStatusBeforeMergeAttempt;\n if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);\n const { otherLaneHead, currentId, modelComponent } = mergeProps;\n const repo = this.scope.legacyScope.objects;\n if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);\n if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);\n\n const baseSnap = divergeData.commonSnapBeforeDiverge as unknown as Ref; // must be set when isTrueMerge\n this.logger.debug(`merging snaps details:\nid: ${id.toStringWithoutVersion()}\nbase: ${baseSnap.toString()}\ncurrent: ${currentId.version}\nother: ${otherLaneHead.toString()}`);\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n\n const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';\n const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : DEFAULT_LANE;\n const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;\n const otherLabel = `${otherLaneHead.toString()} (${\n otherLaneName === currentLaneName ? 'incoming' : otherLaneName\n })`;\n const workspaceIds = this.workspace?.listIds() || this.currentLane?.toComponentIds() || [];\n const configMerger = new ComponentConfigMerger(\n id.toStringWithoutVersion(),\n workspaceIds,\n this.otherLane,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n otherLabel,\n this.logger,\n this.options.mergeStrategy\n );\n const configMergeResult = configMerger.merge();\n\n const dataMergeResult = this.mergeExtensionsData(\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions\n );\n\n const mergeResults = await threeWayMerge({\n scope: this.scope.legacyScope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return {\n currentComponent,\n id,\n mergeResults,\n divergeData,\n configMergeResult,\n dataMergeResult,\n };\n }\n\n private mergeExtensionsData(\n currentExtensions: ExtensionDataList,\n baseExtensions: ExtensionDataList,\n otherExtensions: ExtensionDataList\n ): DataMergeResult {\n if (!this.options.shouldMergeAspectsData) {\n return {};\n }\n const conflictedAspects: { [extId: string]: string } = {}; // extId => reason\n // these aspects handled separately\n const aspectsToSkip = [DependencyResolverAspect.id, BuilderAspect.id];\n currentExtensions.forEach((currentExtension) => {\n if (aspectsToSkip.includes(currentExtension.stringId)) {\n return;\n }\n const baseExtension = baseExtensions.findExtension(currentExtension.idWithoutVersion, true);\n const otherExtension = otherExtensions.findExtension(currentExtension.idWithoutVersion, true);\n if (!otherExtension) {\n conflictedAspects[currentExtension.stringId] = 'missing in other';\n return;\n }\n // check whether the version is different.\n if (currentExtension.extensionId?.version !== otherExtension.extensionId?.version) {\n if (baseExtension?.extensionId?.version === otherExtension.extensionId?.version) {\n // ext version has changed in current. we're good.\n return;\n }\n conflictedAspects[currentExtension.stringId] =\n `version changed. base: ${baseExtension?.extensionId?.version}, other: ${otherExtension.extensionId?.version}`;\n return;\n }\n if (isEqual(currentExtension.data, otherExtension.data)) return;\n if (!baseExtension) {\n conflictedAspects[currentExtension.stringId] = 'no base-version. conflicted in data';\n return;\n }\n if (isEqual(baseExtension.data, otherExtension.data)) {\n return; // changed in current. leave it.\n }\n if (isEqual(baseExtension.data, currentExtension.data)) {\n // changed in other. copy it.\n currentExtension.data = otherExtension.data;\n return;\n }\n // changed in both. conflict.\n conflictedAspects[currentExtension.stringId] = 'conflicted in data since base-version';\n });\n otherExtensions.forEach((otherExtension) => {\n if (!currentExtensions.findExtension(otherExtension.idWithoutVersion, true)) {\n conflictedAspects[otherExtension.stringId] = 'missing in current';\n }\n });\n\n return { conflictedAspects };\n }\n\n private returnUnmerged(\n id: ComponentID,\n msg: string,\n unmergedLegitimately = false\n ): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const consumer = this.workspace?.consumer;\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n const modelComponent = await this.scope.legacyScope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return this.returnUnmerged(\n id,\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(id);\n if (unmerged) {\n return this.returnUnmerged(\n id,\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`\n );\n }\n const repo = this.scope.legacyScope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer?.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const componentOnOther: Version = await modelComponent.loadVersion(version, this.scope.legacyScope.objects);\n // include hidden lane.updateDependents — when merging main into a lane, a hidden cascade\n // entry is the lane-side baseline for the 3-way merge. Without this the merge engine treats\n // the comp as \"not on the lane\" and produces a snap with parents=[mainHead], losing the\n // ancestral link to the lane's hidden head.\n const idOnCurrentLane =\n this.currentLane?.getComponent(id) || this.currentLane?.getUpdateDependentAsLaneComponent(id);\n\n if (componentOnOther.isRemoved()) {\n // if exist in current lane, we want the current lane to get the soft-remove update.\n // or if it was removed with --update-main, we want to merge it so then main will get the update.\n // (unless this component does not exist on main, in which case, we don't want to merge it).\n const shouldMerge = idOnCurrentLane || (componentOnOther.shouldRemoveFromMain() && modelComponent.head);\n if (shouldMerge) {\n // remove the component from the workspace if exist.\n componentStatus.shouldBeRemoved = true;\n } else {\n // on main, don't merge soft-removed components unless it's marked with removeOnMain.\n // on lane, if it's not part of the current lane, don't merge it.\n return this.returnUnmerged(id, compHasBeenRemovedMsg, true);\n }\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (this.currentLane) {\n if (!idOnCurrentLane) return null;\n return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n return { ...componentStatus, componentFromModel: componentOnOther, divergeData };\n }\n const componentMap = consumer?.bitMap.getComponentIfExist(currentId, { ignoreVersion: true });\n const isLocallyRemoved = componentMap?.isRemoved();\n if (isLocallyRemoved) {\n return this.returnUnmerged(\n id,\n `component is locally deleted, please snap and export first or undo by bit recover`\n );\n }\n const getCurrentComponent = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (existingBitMapId) return consumer!.loadComponent(existingBitMapId);\n return this.scope.legacyScope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. \"other\" is main.\n // 1.a. it was deleted on the lane with --update-main. in this case, we need to merge because eventually we need this component\n // to be merged to main with the \"removed: true\".\n // 1.b. it was deleted on the lane without --update-main. in this case, we don't care what happens on main,\n // we want the component to stay deleted on this lane. (even when main is ahead, we don't want to merge it).\n // 2. other is ahead. in this case, other recovered the component. so we can continue with the merge.\n // it is possible that it is diverged, in which case, still continue with the merge, and later on, the\n // merge-config will show a config conflict of the remove aspect.\n // 3. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\n const isRemovedOnMain =\n currentComponent.extensions.findCoreExtension('teambit.component/remove')?.config?.removeOnMain;\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n const isTargetNotAhead = !divergeData.err && !divergeData.isTargetAhead();\n const shouldIgnore = this.otherLane\n ? isTargetNotAhead // option #2 and #3 above\n : !isRemovedOnMain; // it's main. option #1 above.\n if (shouldIgnore) {\n return this.returnUnmerged(id, compHasBeenRemovedMsg, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\n if (!consumer || !this.workspace) return undefined;\n const componentModificationStatus = await this.workspace.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return undefined;\n if (!existingBitMapId) return undefined;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);\n if (isSourceCodeModified) return 'code';\n return 'config';\n };\n\n const modifiedType = await isModified();\n if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {\n return this.returnUnmerged(\n id,\n `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`\n );\n }\n if (modifiedType === 'code') {\n return this.returnUnmerged(id, `component is modified, please snap/tag it first`);\n }\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: this.workspace ? undefined : modelComponent.getRef(currentId.version as string), // not sure if needs to check for this.workspace\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(id, `unable to traverse history. error: ${divergeData.err.message}`);\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (this.options.detachHead && divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n const commonSnapId = id.changeVersion(divergeData.commonSnapBeforeDiverge.toString());\n const commonSnapComp = await this.scope.legacyScope.getConsumerComponent(commonSnapId);\n return {\n ...componentStatus,\n currentComponent: commonSnapComp,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // component is ahead nothing to merge.\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n if (!divergeData.isTargetAhead()) {\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n // target is ahead.\n if (!this.options.handleTargetAheadAsDiverged || !divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // target is ahead and we want to treat it as diverged, continue.\n }\n\n // it's diverged and needs merge operation\n const mergeProps = {\n otherLaneHead,\n currentId,\n modelComponent,\n };\n\n return { ...componentStatus, currentComponent, mergeProps, divergeData };\n }\n\n private async handleNoCommonSnap(\n modelComponent: ModelComponent,\n id: ComponentID,\n otherLaneHead: Ref,\n currentComponent: ConsumerComponent,\n componentOnOther?: Version,\n divergeData?: SnapsDistance\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n let { resolveUnrelated } = this.options || {};\n if (currentComponent.isRemoved()) {\n resolveUnrelated = 'theirs';\n }\n if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);\n const repo = this.scope.legacyScope.objects;\n const mainHead = modelComponent.head;\n\n const returnAccordingToOurs = (\n headToSaveInLane: Ref,\n unrelatedHead: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n return {\n currentComponent,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'ours',\n headOnCurrentLane: headToSaveInLane,\n unrelatedHead,\n unrelatedLaneId,\n },\n };\n };\n const returnAccordingToTheirs = (\n resolvedRef: Ref,\n unrelatedHeadRef: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnOther,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'theirs',\n headOnCurrentLane: resolvedRef,\n unrelatedHead: unrelatedHeadRef,\n unrelatedLaneId,\n },\n };\n };\n\n const currentVersionRef = modelComponent.getRef(currentComponent.id.version as string);\n if (!currentVersionRef)\n throw new Error(\n `handleNoCommonSnap, unable to get ref of current version \"${\n currentComponent.id.version\n }\" for \"${id.toString()}\"`\n );\n const otherVersionRef = modelComponent.getRef(id.version as string);\n if (!otherVersionRef)\n throw new Error(`handleNoCommonSnap, unable to get ref of other version \"${id.version}\" for \"${id.toString()}\"`);\n\n if (mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: hashToCompare,\n targetHead: mainHead,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.\nit was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`\n );\n }\n const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n\n const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,cAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,aAAA,YAAAA,CAAA;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AAW,CAAC;IACvG;IACA,IAAI0F,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAAC7K,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBwG,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAACnK,OAAA,CAAAE,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -448,7 +448,13 @@ class MergingMain {
448
448
  });
449
449
  });
450
450
  if (this.workspace) {
451
- const compsToWrite = (0, _lodash().compact)(componentsResults.map(c => c.legacyCompToWrite));
451
+ // Hidden lane updateDependents live only on the lane and in the scope. Writing them to
452
+ // the workspace would (a) leak internal lane plumbing into bitmap/files, and (b) confuse
453
+ // downstream classifiers that key off bitmap-presence (the cascade-on-snap detector in
454
+ // version-maker treats "in bitmap" as "workspace tracked"). Filter them out here.
455
+ const hiddenIds = currentLane?.updateDependents || [];
456
+ const visibleResults = componentsResults.filter(c => !hiddenIds.find(id => id.isEqualWithoutVersion(c.applyVersionResult.id)));
457
+ const compsToWrite = (0, _lodash().compact)(visibleResults.map(c => c.legacyCompToWrite));
452
458
  const manyComponentsWriterOpts = {
453
459
  consumer: this.workspace.consumer,
454
460
  components: compsToWrite,
@@ -487,14 +493,19 @@ class MergingMain {
487
493
  const modelComponent = await legacyScope.getModelComponent(id);
488
494
  const addToCurrentLane = head => {
489
495
  if (!currentLane) throw new Error('currentLane must be defined when adding to the lane');
490
- if (otherLaneId.isDefault()) {
491
- const isPartOfLane = currentLane.components.find(c => c.id.isEqualWithoutVersion(id));
492
- if (!isPartOfLane) return;
496
+ const existingOnLane = currentLane.getComponent(id);
497
+ const existingInUpdateDependents = currentLane.findUpdateDependent(id);
498
+ if (otherLaneId.isDefault() && !existingOnLane && !existingInUpdateDependents) return;
499
+ // preserve the existing entry's bucket so a merge refreshing a hidden updateDependent
500
+ // doesn't accidentally promote it into the workspace-tracked bucket (and vice versa).
501
+ if (existingInUpdateDependents && !existingOnLane) {
502
+ currentLane.addComponentToUpdateDependents(id.changeVersion(head.toString()));
503
+ } else {
504
+ currentLane.addComponent({
505
+ id,
506
+ head
507
+ });
493
508
  }
494
- currentLane.addComponent({
495
- id,
496
- head
497
- });
498
509
  };
499
510
  const convertHashToTagIfPossible = componentId => {
500
511
  if (!componentId.version) return componentId;
@@ -692,10 +703,22 @@ class MergingMain {
692
703
  });
693
704
  return results;
694
705
  }
695
- return this.snapping.snap({
696
- legacyBitIds: ids,
697
- build,
706
+ // Hidden lane updateDependents ride the same `makeVersion` batch as visible workspace
707
+ // components. version-maker's `isHiddenLaneEntry` detection (workspace flow: not-in-bitmap)
708
+ // routes each entry correctly. workspace.getMany picks up disk-merged files for visible; the
709
+ // in-memory merged ConsumerComponents from `applyVersion` are passed through for hidden
710
+ // (which have no disk state). Single pipeline → consistent log/buildStatus/
711
+ // flattenedDependencies/lane-history/stagedSnaps for all merge-cascade snaps.
712
+ const lane = await this.scope.legacyScope.getCurrentLaneObject();
713
+ const updateDependentsIds = lane?.updateDependents || [];
714
+ const hiddenIds = _componentId().ComponentIdList.fromArray(ids.filter(id => updateDependentsIds.find(u => u.isEqualWithoutVersion(id))));
715
+ const visibleIds = _componentId().ComponentIdList.fromArray(ids.filter(id => !hiddenIds.find(h => h.isEqualWithoutVersion(id))));
716
+ const hiddenLegacyComponents = updatedComponents.filter(c => hiddenIds.find(h => h.isEqualWithoutVersion(c.componentId)));
717
+ return this.snapping.snapForMerge({
718
+ visibleIds,
719
+ hiddenLegacyComponents,
698
720
  message: snapMessage,
721
+ build,
699
722
  loose
700
723
  });
701
724
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_workspace","_legacy","_snapping","_pMapSeries","_interopRequireDefault","_componentId","_bitError","_laneId","_chalk","_config","_remove","_toolboxPath","_pkgModules","_componentWriter","_importer","_logger","_lodash","_checkout","_configMerger","_dependencyResolver","_install","_scope","_mergeCmd","_merging","_mergeStatusProvider","_componentModules","_configStore","_application","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergingMain","constructor","workspace","scope","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","depResolver","application","merge","pattern","mergeStrategy","abort","resolve","noAutoSnap","message","build","skipDependencyInstallation","OutsideWorkspaceError","consumer","mergeResults","resolveMerge","abortMerge","bitIds","getComponentsToMerge","mergeComponentsFromRemote","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","otherLaneId","currentLane","noSnap","tag","detachHead","loose","legacyScope","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","currentLaneIdsBeforeMerge","toComponentIds","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","workspaceDepsUnchanged","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","laneHistoryMsg","laneHistory","lanes","updateLaneHistory","objects","add","persist","unmergedComponents","write","writeBitMap","removeFromWsJsonPolicyIfExists","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","loadAllAppsAsAspects","dedupe","updateExisting","import","err","error","consoleFailure","updatedComponents","legacyCompToWrite","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","laneId","toLaneId","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","newlyIntroducedIds","hasWithoutVersion","newlyIntroducedComponentIds","packages","componentIdToPackageName","isRemoved","removeFromRootPolicy","persistConfig","getMergeStatus","options","otherLane","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","compsToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","addToCurrentLane","Error","isPartOfLane","isEqualWithoutVersion","addComponent","convertHashToTagIfPossible","componentId","getTag","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","idForOutput","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","getConsumerComponent","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergeScopeSpecificDepsPolicy","extensions","filterDeletedDependenciesFromConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","detachedHeads","setHead","markVersionAsLocal","ids","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","getLoadAspectOnlyForIds","dataMergeResult","dataConflictedIds","conflictedAspects","aspectIds","aspectId","snapFromScope","aspects","getEntry","lane","updatedLegacyComponents","loadAspectOnlyForIds","tagMessage","unmodified","componentIds","idsByPattern","entry","unresolvedComponents","u","mergePending","listMergePendingComponents","componentsList","ComponentsList","allIds","getAllIdsAvailableOnLaneIncludeRemoved","componentsFromModel","getModelComponents","duringMergeComps","listDuringMergeStateComponents","mergePendingComponents","toComponentId","divergedData","getDivergeDataForMergePending","isDiverged","diverge","scopeExtensions","mergeConfig","mergeConfigPolicy","DependencyResolverAspect","policy","depsResolver","findCoreExtension","scopePolicy","depType","scopeDepsForType","depId","force","addScopePolicyToMergedArray","policyArray","existingDep","dep","depValue","filtered","provider","cli","loggerMain","compWriter","configStore","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","ScopeAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","ConfigStoreAspect","ConfigMergerAspect","ApplicationAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport type { SnappingMain, TagResults } from '@teambit/snapping';\nimport { SnappingAspect } from '@teambit/snapping';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport type { UnmergedComponent } from '@teambit/legacy.scope';\nimport type { Ref, Lane, ModelComponent } from '@teambit/objects';\nimport chalk from 'chalk';\nimport type { ConfigMain } from '@teambit/config';\nimport { ConfigAspect } from '@teambit/config';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect, deleteComponentsFiles } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport type { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';\nimport { CheckoutAspect, removeFilesIfNeeded, updateFileStatus } from '@teambit/checkout';\nimport type { ConfigMergerMain, ConfigMergeResult, PolicyDependency } from '@teambit/config-merger';\nimport { ConfigMergerAspect } from '@teambit/config-merger';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport type { InstallMain } from '@teambit/install';\nimport { InstallAspect } from '@teambit/install';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';\nimport { MergeStatusProvider } from './merge-status-provider';\nimport type {\n MergeStrategy,\n MergeResultsThreeWay,\n ApplyVersionResults,\n FailedComponents,\n MergeSnapResults,\n} from '@teambit/component.modules.merge-helper';\nimport {\n applyModifiedVersion,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/component.modules.merge-helper';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } from '@teambit/config-store';\nimport type { ApplicationMain } from '@teambit/application';\nimport { ApplicationAspect } from '@teambit/application';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type DivergedComponent = { id: ComponentID; diverge: SnapsDistance };\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n dataMergeResult?: DataMergeResult;\n};\n\nexport type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n mergeProps?: {\n otherLaneHead: Ref;\n currentId: ComponentID;\n modelComponent: ModelComponent;\n };\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private config: ConfigMain,\n private remove: RemoveMain,\n private configMerger: ConfigMergerMain,\n private depResolver: DependencyResolverMain,\n private application: ApplicationMain\n ) {}\n\n async merge(\n pattern: string,\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noAutoSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n if (resolve) {\n mergeResults = await this.resolveMerge(pattern, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(pattern);\n } else {\n const bitIds = await this.getComponentsToMerge(pattern);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noAutoSnap,\n message,\n build,\n skipDependencyInstallation\n );\n }\n await consumer.onDestroy('merge');\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: ComponentID[],\n mergeStrategy: MergeStrategy,\n noAutoSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(\n bitIds,\n currentLaneId,\n currentLaneObject,\n mergeStrategy\n );\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId: currentLaneId,\n currentLane: currentLaneObject,\n noAutoSnap: noAutoSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId,\n currentLane,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n detachHead,\n loose,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane?: Lane;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n tag?: boolean;\n snapMessage?: string;\n build?: boolean;\n skipDependencyInstallation?: boolean;\n detachHead?: boolean;\n loose?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace?.consumer;\n const legacyScope = this.scope.legacyScope;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n\n const currentLaneIdsBeforeMerge = currentLane?.toComponentIds();\n\n const componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane,\n detachHead\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts, workspaceDepsUnchanged } = this.workspace\n ? await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge)\n : { workspaceDepsUpdates: undefined, workspaceDepsConflicts: undefined, workspaceDepsUnchanged: undefined };\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError =\n await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(workspaceDepsConflicts);\n }\n if (this.workspace) await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) {\n const laneHistoryMsg = `merge from \"${otherLaneId.toString()}\"`;\n const laneHistory = await legacyScope.lanes.updateLaneHistory(currentLane, laneHistoryMsg);\n legacyScope.objects.add(laneHistory);\n legacyScope.objects.add(currentLane);\n }\n\n await legacyScope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await legacyScope.objects.unmergedComponents.write();\n\n if (this.workspace) {\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n await this.removeFromWsJsonPolicyIfExists(componentsResults, currentLane, currentLaneIdsBeforeMerge);\n }\n\n if (componentIdsToRemove.length && this.workspace) {\n const compBitIdsToRemove = ComponentIdList.fromArray(componentIdsToRemove);\n await deleteComponentsFiles(consumer, compBitIdsToRemove);\n await consumer.cleanFromBitMap(compBitIdsToRemove);\n }\n\n const componentsHasConfigMergeConflicts = allComponentsStatus.some((c) => c.configMergeResult?.hasConflicts());\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\n // this is a workaround.\n // keep this here. although it gets called before snapping.\n // the reason is that when the installation is running, for some reason, some apps are unable to load in the same process.\n // they throw an error \"Cannot find module\" during the aspect loading.\n await this.application.loadAllAppsAsAspects();\n\n try {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n } catch (err: any) {\n this.logger.error(`failed installing packages`, err);\n this.logger.consoleFailure(\n `failed installing packages, see the log for full stacktrace. error: ${err.message}`\n );\n }\n }\n\n const updatedComponents = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\n const getSnapOrTagResults = async (): Promise<MergeSnapResults> => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noAutoSnap || noSnap || leftUnresolvedConflicts || componentsHasConfigMergeConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults, removedComponents } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults, removedComponents };\n }\n return this.snapResolvedComponents(allComponentsStatus, updatedComponents, {\n snapMessage,\n build,\n laneId: currentLane?.toLaneId(),\n loose,\n });\n };\n let mergeSnapResults: MergeSnapResults = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace ? this.workspace.bitMap.takeSnapshot() : null;\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n this.logger.error('failed running snap. mergeSnapError:', err);\n mergeSnapError = err;\n if (bitMapSnapshot) this.workspace.bitMap.restoreFromSnapshot(bitMapSnapshot);\n }\n\n return {\n components: componentsResults.map((c) => c.applyVersionResult),\n failedComponents,\n removedComponents: [...componentIdsToRemove, ...(mergeSnapResults?.removedComponents || [])],\n mergeSnapResults,\n mergeSnapError,\n workspaceConfigUpdateResult: {\n workspaceDepsUpdates,\n workspaceDepsConflicts,\n workspaceDepsUnchanged,\n workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\n }\n\n async removeFromWsJsonPolicyIfExists(\n componentsResults: ApplyVersionWithComps[],\n currentLane?: Lane,\n currentLaneIdsBeforeMerge?: ComponentIdList\n ) {\n const newlyIntroducedIds = currentLane\n ?.toComponentIds()\n .filter((id) => !currentLaneIdsBeforeMerge?.hasWithoutVersion(id));\n const newlyIntroducedComponentIds = ComponentIdList.fromArray(newlyIntroducedIds || []);\n const components = compact(\n componentsResults\n .map((c) => c.legacyCompToWrite)\n .filter((c) => c && newlyIntroducedComponentIds.hasWithoutVersion(c.id))\n );\n const packages = components.map((c) => componentIdToPackageName(c));\n const isRemoved = this.depResolver.removeFromRootPolicy(packages);\n if (isRemoved) await this.depResolver.persistConfig('merge (remove packages)');\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n */\n async getMergeStatus(\n bitIds: ComponentID[], // the id.version is the version we want to merge to the current component\n options: MergeStatusProviderOptions,\n currentLane?: Lane, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane // the lane we want to merged to our lane. (null if it's \"main\").\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.scope,\n this.logger,\n this.importer,\n options,\n this.workspace,\n currentLane,\n otherLane\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane?: Lane,\n detachHead?: boolean\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const updatedLaneId = otherLaneId.isDefault() ? LaneId.from(otherLaneId.name, id.scope as string) : otherLaneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n otherLaneId: updatedLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n });\n }\n );\n\n if (this.workspace) {\n const compsToWrite = compact(componentsResults.map((c) => c.legacyCompToWrite));\n const manyComponentsWriterOpts = {\n consumer: this.workspace.consumer,\n components: compsToWrite,\n skipDependencyInstallation: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n reasonForBitmapChange: 'merge',\n };\n await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n return componentsResults;\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n otherLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: ComponentID;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n otherLaneId: LaneId;\n currentLane?: Lane;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n detachHead?: boolean;\n }): Promise<ApplyVersionWithComps> {\n const legacyScope = this.scope.legacyScope;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n id: { name: id.fullName, scope: id.scope },\n head: remoteHead,\n laneId: otherLaneId,\n };\n id = currentComponent ? currentComponent.id : id;\n const modelComponent = await legacyScope.getModelComponent(id);\n\n const addToCurrentLane = (head: Ref) => {\n if (!currentLane) throw new Error('currentLane must be defined when adding to the lane');\n if (otherLaneId.isDefault()) {\n const isPartOfLane = currentLane.components.find((c) => c.id.isEqualWithoutVersion(id));\n if (!isPartOfLane) return;\n }\n currentLane.addComponent({ id, head });\n };\n\n const convertHashToTagIfPossible = (componentId: ComponentID): ComponentID => {\n if (!componentId.version) return componentId;\n const tag = modelComponent.getTag(componentId.version);\n return tag ? componentId.changeVersion(tag) : componentId;\n };\n\n const handleResolveUnrelated = (legacyCompToWrite?: ConsumerComponent) => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n // because when on a main, we don't allow merging lanes with unrelated. we asks users to switch to the lane\n // first and then merge with --resolve-unrelated\n if (!currentLane) throw new Error('currentLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated) throw new Error('resolvedUnrelated must be populated');\n addToCurrentLane(resolvedUnrelated.headOnCurrentLane);\n unmergedComponent.unrelated = {\n unrelatedHead: resolvedUnrelated.unrelatedHead,\n headOnCurrentLane: resolvedUnrelated.headOnCurrentLane,\n unrelatedLaneId: resolvedUnrelated.unrelatedLaneId,\n };\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n const idForOutput = convertHashToTagIfPossible(id);\n return { applyVersionResult: { id: idForOutput, filesStatus }, component: currentComponent, legacyCompToWrite };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n const idForOutput = convertHashToTagIfPossible(id);\n return { applyVersionResult: { id: idForOutput, filesStatus }, component: currentComponent || undefined };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const legacyComponent = this.workspace\n ? await this.workspace.consumer.loadComponentFromModelImportIfNeeded(idToLoad)\n : await legacyScope.getConsumerComponent(idToLoad); // when loading from the scope, we import all needed components first, so it should be fine. otherwise, change the code to import it here\n if (mergeResults && mergeStrategy === MergeOptions.theirs) {\n // in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version\n legacyComponent.version = id.version;\n }\n const files = legacyComponent.files;\n updateFileStatus(files, filesStatus, currentComponent || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n legacyComponent.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n if (this.workspace) await removeFilesIfNeeded(filesStatus, this.workspace.consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\n // Process mergedConfig to merge scope-specific policy and filter deletion markers\n // This happens ONCE here, so both workspace and bare-scope merges use the same processed config\n this.mergeScopeSpecificDepsPolicy(legacyComponent.extensions, successfullyMergedConfig);\n this.filterDeletedDependenciesFromConfig(successfullyMergedConfig);\n\n unmergedComponent.mergedConfig = successfullyMergedConfig;\n // no need to `unmergedComponents.addEntry` here. it'll be added in the next lines inside `if (mergeResults)`.\n // because if `configMergeResult` is set, `mergeResults` must be set as well. both happen on diverge.\n }\n }\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (currentLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated(legacyComponent);\n }\n addToCurrentLane(remoteHead);\n } else {\n // this is main\n if (detachHead) {\n modelComponent.detachedHeads.setHead(remoteHead);\n } else {\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n }\n legacyScope.objects.add(modelComponent);\n }\n\n const idForOutput = convertHashToTagIfPossible(idToLoad);\n return {\n applyVersionResult: { id: idForOutput, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(pattern: string): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(pattern);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(pattern: string, snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(pattern);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: ComponentIdList.fromArray(ids.map((id) => id)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: ComponentID[],\n laneId: LaneId,\n localLaneObject: Lane | undefined,\n mergeStrategy: MergeStrategy\n ): Promise<ComponentMergeStatus[]> {\n const ids = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.workspace.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead) {\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n }\n return bitId.changeVersion(remoteHead.toString());\n })\n );\n\n return this.getMergeStatus(ids, { shouldSquash: false, mergeStrategy }, localLaneObject, localLaneObject);\n }\n\n private async snapResolvedComponents(\n allComponentsStatus: ComponentMergeStatus[],\n updatedComponents: ConsumerComponent[],\n {\n snapMessage,\n build,\n laneId,\n loose,\n }: {\n snapMessage?: string;\n build?: boolean;\n laneId?: LaneId;\n loose?: boolean;\n }\n ): Promise<MergeSnapResults> {\n const unmergedComponents = this.scope.legacyScope.objects.unmergedComponents.getComponents();\n this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = ComponentIdList.fromArray(unmergedComponents.map((r) => ComponentID.fromObject(r.id)));\n if (!this.workspace) {\n const getLoadAspectOnlyForIds = (): ComponentIdList | undefined => {\n if (!allComponentsStatus.length || !allComponentsStatus[0].dataMergeResult) return undefined;\n const dataConflictedIds = allComponentsStatus\n .filter((c) => {\n const conflictedAspects = c.dataMergeResult?.conflictedAspects || {};\n const aspectIds = Object.keys(conflictedAspects);\n aspectIds.forEach((aspectId) =>\n this.logger.debug(\n `conflicted-data for \"${c.id.toString()}\". aspectId: ${aspectId}. reason: ${conflictedAspects[aspectId]}`\n )\n );\n return aspectIds.length;\n })\n .map((c) => c.id);\n return ComponentIdList.fromArray(dataConflictedIds);\n };\n\n // mergedConfig has already been processed in applyVersion() with scope-specific policy merged\n // and deletion markers filtered, so we can use it directly\n const results = await this.snapping.snapFromScope(\n ids.map((id) => ({\n componentId: id.toString(),\n aspects: this.scope.legacyScope.objects.unmergedComponents.getEntry(id)?.mergedConfig,\n })),\n {\n message: snapMessage,\n build,\n lane: laneId?.toString(),\n updatedLegacyComponents: updatedComponents,\n loadAspectOnlyForIds: getLoadAspectOnlyForIds(),\n loose,\n }\n );\n return results;\n }\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n loose,\n });\n }\n\n private async tagAllLaneComponent(\n idsToTag: ComponentID[],\n tagMessage?: string,\n build?: boolean\n ): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new BitError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new BitError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n return this.workspace.idsByPattern(pattern);\n }\n const mergePending = await this.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n\n async listMergePendingComponents(componentsList?: ComponentsList): Promise<DivergedComponent[]> {\n const consumer = this.workspace.consumer;\n componentsList = componentsList || new ComponentsList(this.workspace);\n const allIds = consumer.bitMap.getAllIdsAvailableOnLaneIncludeRemoved();\n const componentsFromModel = await componentsList.getModelComponents();\n const duringMergeComps = componentsList.listDuringMergeStateComponents();\n const mergePendingComponents = await Promise.all(\n allIds.map(async (componentId: ComponentID) => {\n const modelComponent = componentsFromModel.find((c) => c.toComponentId().isEqualWithoutVersion(componentId));\n if (!modelComponent || duringMergeComps.hasWithoutVersion(componentId)) return null;\n const divergedData = await modelComponent.getDivergeDataForMergePending(consumer.scope.objects);\n if (!divergedData.isDiverged()) return null;\n return { id: modelComponent.toComponentId(), diverge: divergedData };\n })\n );\n return compact(mergePendingComponents);\n }\n\n /**\n * Merges scope dependency policy into the merged config.\n * This handles dependencies with force:true from the scope, regardless of whether they're\n * set via \"bit dependencies set\" (__specific: true) or workspace variants.\n *\n * This is needed because if the mergeConfig has a policy, it will be used, and any other policy along the line will be ignored.\n * In case the model has some dependencies that were set explicitly they're gonna be ignored.\n * This makes sure to add them to the policy of the mergeConfig.\n * In a way, this is similar to what we do when a user is running `bit deps set` and the component had previous dependencies set,\n * we copy those dependencies along with the current one to the .bitmap file, so they won't get lost.\n */\n private mergeScopeSpecificDepsPolicy(scopeExtensions: ExtensionDataList, mergeConfig?: Record<string, any>): void {\n const mergeConfigPolicy: Record<string, PolicyDependency[]> | undefined =\n mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!mergeConfigPolicy) return;\n\n const depsResolver = scopeExtensions.findCoreExtension(DependencyResolverAspect.id);\n const scopePolicy = depsResolver?.config.policy;\n if (!scopePolicy) return;\n\n Object.keys(scopePolicy).forEach((depType) => {\n const scopeDepsForType = scopePolicy[depType];\n if (!mergeConfigPolicy[depType]) {\n // mergeConfigPolicy doesn't have this depType yet.\n // Convert scope policy (object format) to array format before adding\n mergeConfigPolicy[depType] = Object.keys(scopeDepsForType).map((depId) => ({\n name: depId,\n version: scopeDepsForType[depId],\n force: true,\n }));\n return;\n }\n\n // mergeConfigPolicy is always in array format (from config merger)\n this.addScopePolicyToMergedArray(mergeConfigPolicy[depType], scopeDepsForType);\n });\n }\n\n private addScopePolicyToMergedArray(policyArray: PolicyDependency[], scopeDepsForType: Record<string, string>): void {\n Object.keys(scopeDepsForType).forEach((depId) => {\n const version = scopeDepsForType[depId];\n const existingDep = policyArray.find((dep) => dep.name === depId);\n\n if (existingDep) {\n // If merge config has version: '-', it means the dependency was explicitly deleted.\n // Keep the '-' marker and don't override with scope policy.\n if (existingDep.version === '-') {\n return;\n }\n // Otherwise, dependency exists in merge config - keep merge config version (it's stronger)\n } else {\n // Dependency only exists in scope policy - add it to merge config\n policyArray.push({ name: depId, version, force: true });\n }\n });\n }\n\n private filterDeletedDependenciesFromConfig(mergeConfig?: Record<string, any>): void {\n const policy: Record<string, PolicyDependency[]> | undefined = mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!policy) return;\n\n Object.keys(policy).forEach((depType) => {\n const depValue = policy[depType];\n // Filter out entries with version: '-' (deletion markers)\n const filtered = depValue.filter((dep) => dep.version !== '-');\n // If array is now empty, delete the key to avoid issues with downstream code\n if (filtered.length === 0) {\n delete policy[depType];\n } else {\n policy[depType] = filtered;\n }\n });\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n ConfigStoreAspect,\n ConfigMergerAspect,\n DependencyResolverAspect,\n ApplicationAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n scope,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n configStore,\n configMerger,\n depResolver,\n application,\n ]: [\n CLIMain,\n Workspace,\n ScopeMain,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n ConfigStoreMain,\n ConfigMergerMain,\n DependencyResolverMain,\n ApplicationMain,\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n scope,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger,\n depResolver,\n application\n );\n cli.register(new MergeCmd(merging, configStore));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;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gQ,OAAO,GAAG,IAAIjT,WAAW,CAC7BE,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNsS,UAAU,EACVpS,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,YAAY,EACZC,WAAW,EACXC,WACF,CAAC;IACD6R,GAAG,CAACO,QAAQ,CAAC,KAAIC,oBAAQ,EAACF,OAAO,EAAEH,WAAW,CAAC,CAAC;IAChD,OAAOG,OAAO;EAChB;AACF;AAACG,OAAA,CAAApT,WAAA,GAAAA,WAAA;AAAAhB,eAAA,CAxyBYgB,WAAW,WAiuBP,EAAE;AAAAhB,eAAA,CAjuBNgB,WAAW,kBAkuBA,CACpBqT,gBAAS,EACTC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,0BAAc,EACdC,wBAAa,EACbC,sBAAY,EACZC,wCAAqB,EACrBC,0BAAc,EACdC,sBAAY,EACZC,sBAAY,EACZC,gCAAiB,EACjBC,kCAAkB,EAClBtC,8CAAwB,EACxBuC,gCAAiB,CAClB;AAAAlV,eAAA,CAlvBUgB,WAAW,aAmvBLmU,kBAAW;AAuD9BnB,wBAAa,CAACoB,UAAU,CAACpU,WAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_workspace","_legacy","_snapping","_pMapSeries","_interopRequireDefault","_componentId","_bitError","_laneId","_chalk","_config","_remove","_toolboxPath","_pkgModules","_componentWriter","_importer","_logger","_lodash","_checkout","_configMerger","_dependencyResolver","_install","_scope","_mergeCmd","_merging","_mergeStatusProvider","_componentModules","_configStore","_application","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergingMain","constructor","workspace","scope","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","depResolver","application","merge","pattern","mergeStrategy","abort","resolve","noAutoSnap","message","build","skipDependencyInstallation","OutsideWorkspaceError","consumer","mergeResults","resolveMerge","abortMerge","bitIds","getComponentsToMerge","mergeComponentsFromRemote","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","otherLaneId","currentLane","noSnap","tag","detachHead","loose","legacyScope","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","currentLaneIdsBeforeMerge","toComponentIds","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","workspaceDepsUnchanged","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","laneHistoryMsg","laneHistory","lanes","updateLaneHistory","objects","add","persist","unmergedComponents","write","writeBitMap","removeFromWsJsonPolicyIfExists","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","loadAllAppsAsAspects","dedupe","updateExisting","import","err","error","consoleFailure","updatedComponents","legacyCompToWrite","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","laneId","toLaneId","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","newlyIntroducedIds","hasWithoutVersion","newlyIntroducedComponentIds","packages","componentIdToPackageName","isRemoved","removeFromRootPolicy","persistConfig","getMergeStatus","options","otherLane","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","hiddenIds","updateDependents","visibleResults","isEqualWithoutVersion","compsToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","addToCurrentLane","Error","existingOnLane","getComponent","existingInUpdateDependents","findUpdateDependent","addComponentToUpdateDependents","addComponent","convertHashToTagIfPossible","componentId","getTag","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","idForOutput","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","getConsumerComponent","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergeScopeSpecificDepsPolicy","extensions","filterDeletedDependenciesFromConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","detachedHeads","setHead","markVersionAsLocal","ids","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","getLoadAspectOnlyForIds","dataMergeResult","dataConflictedIds","conflictedAspects","aspectIds","aspectId","snapFromScope","aspects","getEntry","lane","updatedLegacyComponents","loadAspectOnlyForIds","updateDependentsIds","u","visibleIds","h","hiddenLegacyComponents","snapForMerge","tagMessage","unmodified","componentIds","idsByPattern","entry","unresolvedComponents","mergePending","listMergePendingComponents","componentsList","ComponentsList","allIds","getAllIdsAvailableOnLaneIncludeRemoved","componentsFromModel","getModelComponents","duringMergeComps","listDuringMergeStateComponents","mergePendingComponents","toComponentId","divergedData","getDivergeDataForMergePending","isDiverged","diverge","scopeExtensions","mergeConfig","mergeConfigPolicy","DependencyResolverAspect","policy","depsResolver","findCoreExtension","scopePolicy","depType","scopeDepsForType","depId","force","addScopePolicyToMergedArray","policyArray","existingDep","dep","depValue","filtered","provider","cli","loggerMain","compWriter","configStore","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","ScopeAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","ConfigStoreAspect","ConfigMergerAspect","ApplicationAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport type { SnappingMain, TagResults } from '@teambit/snapping';\nimport { SnappingAspect } from '@teambit/snapping';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport type { UnmergedComponent } from '@teambit/legacy.scope';\nimport type { Ref, Lane, ModelComponent } from '@teambit/objects';\nimport chalk from 'chalk';\nimport type { ConfigMain } from '@teambit/config';\nimport { ConfigAspect } from '@teambit/config';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect, deleteComponentsFiles } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport type { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';\nimport { CheckoutAspect, removeFilesIfNeeded, updateFileStatus } from '@teambit/checkout';\nimport type { ConfigMergerMain, ConfigMergeResult, PolicyDependency } from '@teambit/config-merger';\nimport { ConfigMergerAspect } from '@teambit/config-merger';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport type { InstallMain } from '@teambit/install';\nimport { InstallAspect } from '@teambit/install';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';\nimport { MergeStatusProvider } from './merge-status-provider';\nimport type {\n MergeStrategy,\n MergeResultsThreeWay,\n ApplyVersionResults,\n FailedComponents,\n MergeSnapResults,\n} from '@teambit/component.modules.merge-helper';\nimport {\n applyModifiedVersion,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/component.modules.merge-helper';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } from '@teambit/config-store';\nimport type { ApplicationMain } from '@teambit/application';\nimport { ApplicationAspect } from '@teambit/application';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type DivergedComponent = { id: ComponentID; diverge: SnapsDistance };\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n dataMergeResult?: DataMergeResult;\n};\n\nexport type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n mergeProps?: {\n otherLaneHead: Ref;\n currentId: ComponentID;\n modelComponent: ModelComponent;\n };\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private config: ConfigMain,\n private remove: RemoveMain,\n private configMerger: ConfigMergerMain,\n private depResolver: DependencyResolverMain,\n private application: ApplicationMain\n ) {}\n\n async merge(\n pattern: string,\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noAutoSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n if (resolve) {\n mergeResults = await this.resolveMerge(pattern, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(pattern);\n } else {\n const bitIds = await this.getComponentsToMerge(pattern);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noAutoSnap,\n message,\n build,\n skipDependencyInstallation\n );\n }\n await consumer.onDestroy('merge');\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: ComponentID[],\n mergeStrategy: MergeStrategy,\n noAutoSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(\n bitIds,\n currentLaneId,\n currentLaneObject,\n mergeStrategy\n );\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId: currentLaneId,\n currentLane: currentLaneObject,\n noAutoSnap: noAutoSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId,\n currentLane,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n detachHead,\n loose,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane?: Lane;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n tag?: boolean;\n snapMessage?: string;\n build?: boolean;\n skipDependencyInstallation?: boolean;\n detachHead?: boolean;\n loose?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace?.consumer;\n const legacyScope = this.scope.legacyScope;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n\n const currentLaneIdsBeforeMerge = currentLane?.toComponentIds();\n\n const componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane,\n detachHead\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts, workspaceDepsUnchanged } = this.workspace\n ? await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge)\n : { workspaceDepsUpdates: undefined, workspaceDepsConflicts: undefined, workspaceDepsUnchanged: undefined };\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError =\n await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(workspaceDepsConflicts);\n }\n if (this.workspace) await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) {\n const laneHistoryMsg = `merge from \"${otherLaneId.toString()}\"`;\n const laneHistory = await legacyScope.lanes.updateLaneHistory(currentLane, laneHistoryMsg);\n legacyScope.objects.add(laneHistory);\n legacyScope.objects.add(currentLane);\n }\n\n await legacyScope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await legacyScope.objects.unmergedComponents.write();\n\n if (this.workspace) {\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n await this.removeFromWsJsonPolicyIfExists(componentsResults, currentLane, currentLaneIdsBeforeMerge);\n }\n\n if (componentIdsToRemove.length && this.workspace) {\n const compBitIdsToRemove = ComponentIdList.fromArray(componentIdsToRemove);\n await deleteComponentsFiles(consumer, compBitIdsToRemove);\n await consumer.cleanFromBitMap(compBitIdsToRemove);\n }\n\n const componentsHasConfigMergeConflicts = allComponentsStatus.some((c) => c.configMergeResult?.hasConflicts());\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\n // this is a workaround.\n // keep this here. although it gets called before snapping.\n // the reason is that when the installation is running, for some reason, some apps are unable to load in the same process.\n // they throw an error \"Cannot find module\" during the aspect loading.\n await this.application.loadAllAppsAsAspects();\n\n try {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n } catch (err: any) {\n this.logger.error(`failed installing packages`, err);\n this.logger.consoleFailure(\n `failed installing packages, see the log for full stacktrace. error: ${err.message}`\n );\n }\n }\n\n const updatedComponents = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\n const getSnapOrTagResults = async (): Promise<MergeSnapResults> => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noAutoSnap || noSnap || leftUnresolvedConflicts || componentsHasConfigMergeConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults, removedComponents } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults, removedComponents };\n }\n return this.snapResolvedComponents(allComponentsStatus, updatedComponents, {\n snapMessage,\n build,\n laneId: currentLane?.toLaneId(),\n loose,\n });\n };\n let mergeSnapResults: MergeSnapResults = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace ? this.workspace.bitMap.takeSnapshot() : null;\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n this.logger.error('failed running snap. mergeSnapError:', err);\n mergeSnapError = err;\n if (bitMapSnapshot) this.workspace.bitMap.restoreFromSnapshot(bitMapSnapshot);\n }\n\n return {\n components: componentsResults.map((c) => c.applyVersionResult),\n failedComponents,\n removedComponents: [...componentIdsToRemove, ...(mergeSnapResults?.removedComponents || [])],\n mergeSnapResults,\n mergeSnapError,\n workspaceConfigUpdateResult: {\n workspaceDepsUpdates,\n workspaceDepsConflicts,\n workspaceDepsUnchanged,\n workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\n }\n\n async removeFromWsJsonPolicyIfExists(\n componentsResults: ApplyVersionWithComps[],\n currentLane?: Lane,\n currentLaneIdsBeforeMerge?: ComponentIdList\n ) {\n const newlyIntroducedIds = currentLane\n ?.toComponentIds()\n .filter((id) => !currentLaneIdsBeforeMerge?.hasWithoutVersion(id));\n const newlyIntroducedComponentIds = ComponentIdList.fromArray(newlyIntroducedIds || []);\n const components = compact(\n componentsResults\n .map((c) => c.legacyCompToWrite)\n .filter((c) => c && newlyIntroducedComponentIds.hasWithoutVersion(c.id))\n );\n const packages = components.map((c) => componentIdToPackageName(c));\n const isRemoved = this.depResolver.removeFromRootPolicy(packages);\n if (isRemoved) await this.depResolver.persistConfig('merge (remove packages)');\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n */\n async getMergeStatus(\n bitIds: ComponentID[], // the id.version is the version we want to merge to the current component\n options: MergeStatusProviderOptions,\n currentLane?: Lane, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane // the lane we want to merged to our lane. (null if it's \"main\").\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.scope,\n this.logger,\n this.importer,\n options,\n this.workspace,\n currentLane,\n otherLane\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane?: Lane,\n detachHead?: boolean\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const updatedLaneId = otherLaneId.isDefault() ? LaneId.from(otherLaneId.name, id.scope as string) : otherLaneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n otherLaneId: updatedLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n });\n }\n );\n\n if (this.workspace) {\n // Hidden lane updateDependents live only on the lane and in the scope. Writing them to\n // the workspace would (a) leak internal lane plumbing into bitmap/files, and (b) confuse\n // downstream classifiers that key off bitmap-presence (the cascade-on-snap detector in\n // version-maker treats \"in bitmap\" as \"workspace tracked\"). Filter them out here.\n const hiddenIds = currentLane?.updateDependents || [];\n const visibleResults = componentsResults.filter(\n (c) => !hiddenIds.find((id) => id.isEqualWithoutVersion(c.applyVersionResult.id))\n );\n const compsToWrite = compact(visibleResults.map((c) => c.legacyCompToWrite));\n const manyComponentsWriterOpts = {\n consumer: this.workspace.consumer,\n components: compsToWrite,\n skipDependencyInstallation: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n reasonForBitmapChange: 'merge',\n };\n await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n return componentsResults;\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n otherLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: ComponentID;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n otherLaneId: LaneId;\n currentLane?: Lane;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n detachHead?: boolean;\n }): Promise<ApplyVersionWithComps> {\n const legacyScope = this.scope.legacyScope;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n id: { name: id.fullName, scope: id.scope },\n head: remoteHead,\n laneId: otherLaneId,\n };\n id = currentComponent ? currentComponent.id : id;\n const modelComponent = await legacyScope.getModelComponent(id);\n\n const addToCurrentLane = (head: Ref) => {\n if (!currentLane) throw new Error('currentLane must be defined when adding to the lane');\n const existingOnLane = currentLane.getComponent(id);\n const existingInUpdateDependents = currentLane.findUpdateDependent(id);\n if (otherLaneId.isDefault() && !existingOnLane && !existingInUpdateDependents) return;\n // preserve the existing entry's bucket so a merge refreshing a hidden updateDependent\n // doesn't accidentally promote it into the workspace-tracked bucket (and vice versa).\n if (existingInUpdateDependents && !existingOnLane) {\n currentLane.addComponentToUpdateDependents(id.changeVersion(head.toString()));\n } else {\n currentLane.addComponent({ id, head });\n }\n };\n\n const convertHashToTagIfPossible = (componentId: ComponentID): ComponentID => {\n if (!componentId.version) return componentId;\n const tag = modelComponent.getTag(componentId.version);\n return tag ? componentId.changeVersion(tag) : componentId;\n };\n\n const handleResolveUnrelated = (legacyCompToWrite?: ConsumerComponent) => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n // because when on a main, we don't allow merging lanes with unrelated. we asks users to switch to the lane\n // first and then merge with --resolve-unrelated\n if (!currentLane) throw new Error('currentLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated) throw new Error('resolvedUnrelated must be populated');\n addToCurrentLane(resolvedUnrelated.headOnCurrentLane);\n unmergedComponent.unrelated = {\n unrelatedHead: resolvedUnrelated.unrelatedHead,\n headOnCurrentLane: resolvedUnrelated.headOnCurrentLane,\n unrelatedLaneId: resolvedUnrelated.unrelatedLaneId,\n };\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n const idForOutput = convertHashToTagIfPossible(id);\n return { applyVersionResult: { id: idForOutput, filesStatus }, component: currentComponent, legacyCompToWrite };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n const idForOutput = convertHashToTagIfPossible(id);\n return { applyVersionResult: { id: idForOutput, filesStatus }, component: currentComponent || undefined };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const legacyComponent = this.workspace\n ? await this.workspace.consumer.loadComponentFromModelImportIfNeeded(idToLoad)\n : await legacyScope.getConsumerComponent(idToLoad); // when loading from the scope, we import all needed components first, so it should be fine. otherwise, change the code to import it here\n if (mergeResults && mergeStrategy === MergeOptions.theirs) {\n // in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version\n legacyComponent.version = id.version;\n }\n const files = legacyComponent.files;\n updateFileStatus(files, filesStatus, currentComponent || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n legacyComponent.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n if (this.workspace) await removeFilesIfNeeded(filesStatus, this.workspace.consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\n // Process mergedConfig to merge scope-specific policy and filter deletion markers\n // This happens ONCE here, so both workspace and bare-scope merges use the same processed config\n this.mergeScopeSpecificDepsPolicy(legacyComponent.extensions, successfullyMergedConfig);\n this.filterDeletedDependenciesFromConfig(successfullyMergedConfig);\n\n unmergedComponent.mergedConfig = successfullyMergedConfig;\n // no need to `unmergedComponents.addEntry` here. it'll be added in the next lines inside `if (mergeResults)`.\n // because if `configMergeResult` is set, `mergeResults` must be set as well. both happen on diverge.\n }\n }\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (currentLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated(legacyComponent);\n }\n addToCurrentLane(remoteHead);\n } else {\n // this is main\n if (detachHead) {\n modelComponent.detachedHeads.setHead(remoteHead);\n } else {\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n }\n legacyScope.objects.add(modelComponent);\n }\n\n const idForOutput = convertHashToTagIfPossible(idToLoad);\n return {\n applyVersionResult: { id: idForOutput, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(pattern: string): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(pattern);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(pattern: string, snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(pattern);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: ComponentIdList.fromArray(ids.map((id) => id)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: ComponentID[],\n laneId: LaneId,\n localLaneObject: Lane | undefined,\n mergeStrategy: MergeStrategy\n ): Promise<ComponentMergeStatus[]> {\n const ids = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.workspace.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead) {\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n }\n return bitId.changeVersion(remoteHead.toString());\n })\n );\n\n return this.getMergeStatus(ids, { shouldSquash: false, mergeStrategy }, localLaneObject, localLaneObject);\n }\n\n private async snapResolvedComponents(\n allComponentsStatus: ComponentMergeStatus[],\n updatedComponents: ConsumerComponent[],\n {\n snapMessage,\n build,\n laneId,\n loose,\n }: {\n snapMessage?: string;\n build?: boolean;\n laneId?: LaneId;\n loose?: boolean;\n }\n ): Promise<MergeSnapResults> {\n const unmergedComponents = this.scope.legacyScope.objects.unmergedComponents.getComponents();\n this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = ComponentIdList.fromArray(unmergedComponents.map((r) => ComponentID.fromObject(r.id)));\n if (!this.workspace) {\n const getLoadAspectOnlyForIds = (): ComponentIdList | undefined => {\n if (!allComponentsStatus.length || !allComponentsStatus[0].dataMergeResult) return undefined;\n const dataConflictedIds = allComponentsStatus\n .filter((c) => {\n const conflictedAspects = c.dataMergeResult?.conflictedAspects || {};\n const aspectIds = Object.keys(conflictedAspects);\n aspectIds.forEach((aspectId) =>\n this.logger.debug(\n `conflicted-data for \"${c.id.toString()}\". aspectId: ${aspectId}. reason: ${conflictedAspects[aspectId]}`\n )\n );\n return aspectIds.length;\n })\n .map((c) => c.id);\n return ComponentIdList.fromArray(dataConflictedIds);\n };\n\n // mergedConfig has already been processed in applyVersion() with scope-specific policy merged\n // and deletion markers filtered, so we can use it directly\n const results = await this.snapping.snapFromScope(\n ids.map((id) => ({\n componentId: id.toString(),\n aspects: this.scope.legacyScope.objects.unmergedComponents.getEntry(id)?.mergedConfig,\n })),\n {\n message: snapMessage,\n build,\n lane: laneId?.toString(),\n updatedLegacyComponents: updatedComponents,\n loadAspectOnlyForIds: getLoadAspectOnlyForIds(),\n loose,\n }\n );\n return results;\n }\n // Hidden lane updateDependents ride the same `makeVersion` batch as visible workspace\n // components. version-maker's `isHiddenLaneEntry` detection (workspace flow: not-in-bitmap)\n // routes each entry correctly. workspace.getMany picks up disk-merged files for visible; the\n // in-memory merged ConsumerComponents from `applyVersion` are passed through for hidden\n // (which have no disk state). Single pipeline → consistent log/buildStatus/\n // flattenedDependencies/lane-history/stagedSnaps for all merge-cascade snaps.\n const lane = await this.scope.legacyScope.getCurrentLaneObject();\n const updateDependentsIds = lane?.updateDependents || [];\n const hiddenIds = ComponentIdList.fromArray(\n ids.filter((id) => updateDependentsIds.find((u) => u.isEqualWithoutVersion(id)))\n );\n const visibleIds = ComponentIdList.fromArray(\n ids.filter((id) => !hiddenIds.find((h) => h.isEqualWithoutVersion(id)))\n );\n const hiddenLegacyComponents = updatedComponents.filter((c) =>\n hiddenIds.find((h) => h.isEqualWithoutVersion(c.componentId))\n );\n return this.snapping.snapForMerge({\n visibleIds,\n hiddenLegacyComponents,\n message: snapMessage,\n build,\n loose,\n });\n }\n\n private async tagAllLaneComponent(\n idsToTag: ComponentID[],\n tagMessage?: string,\n build?: boolean\n ): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new BitError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new BitError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n return this.workspace.idsByPattern(pattern);\n }\n const mergePending = await this.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n\n async listMergePendingComponents(componentsList?: ComponentsList): Promise<DivergedComponent[]> {\n const consumer = this.workspace.consumer;\n componentsList = componentsList || new ComponentsList(this.workspace);\n const allIds = consumer.bitMap.getAllIdsAvailableOnLaneIncludeRemoved();\n const componentsFromModel = await componentsList.getModelComponents();\n const duringMergeComps = componentsList.listDuringMergeStateComponents();\n const mergePendingComponents = await Promise.all(\n allIds.map(async (componentId: ComponentID) => {\n const modelComponent = componentsFromModel.find((c) => c.toComponentId().isEqualWithoutVersion(componentId));\n if (!modelComponent || duringMergeComps.hasWithoutVersion(componentId)) return null;\n const divergedData = await modelComponent.getDivergeDataForMergePending(consumer.scope.objects);\n if (!divergedData.isDiverged()) return null;\n return { id: modelComponent.toComponentId(), diverge: divergedData };\n })\n );\n return compact(mergePendingComponents);\n }\n\n /**\n * Merges scope dependency policy into the merged config.\n * This handles dependencies with force:true from the scope, regardless of whether they're\n * set via \"bit dependencies set\" (__specific: true) or workspace variants.\n *\n * This is needed because if the mergeConfig has a policy, it will be used, and any other policy along the line will be ignored.\n * In case the model has some dependencies that were set explicitly they're gonna be ignored.\n * This makes sure to add them to the policy of the mergeConfig.\n * In a way, this is similar to what we do when a user is running `bit deps set` and the component had previous dependencies set,\n * we copy those dependencies along with the current one to the .bitmap file, so they won't get lost.\n */\n private mergeScopeSpecificDepsPolicy(scopeExtensions: ExtensionDataList, mergeConfig?: Record<string, any>): void {\n const mergeConfigPolicy: Record<string, PolicyDependency[]> | undefined =\n mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!mergeConfigPolicy) return;\n\n const depsResolver = scopeExtensions.findCoreExtension(DependencyResolverAspect.id);\n const scopePolicy = depsResolver?.config.policy;\n if (!scopePolicy) return;\n\n Object.keys(scopePolicy).forEach((depType) => {\n const scopeDepsForType = scopePolicy[depType];\n if (!mergeConfigPolicy[depType]) {\n // mergeConfigPolicy doesn't have this depType yet.\n // Convert scope policy (object format) to array format before adding\n mergeConfigPolicy[depType] = Object.keys(scopeDepsForType).map((depId) => ({\n name: depId,\n version: scopeDepsForType[depId],\n force: true,\n }));\n return;\n }\n\n // mergeConfigPolicy is always in array format (from config merger)\n this.addScopePolicyToMergedArray(mergeConfigPolicy[depType], scopeDepsForType);\n });\n }\n\n private addScopePolicyToMergedArray(policyArray: PolicyDependency[], scopeDepsForType: Record<string, string>): void {\n Object.keys(scopeDepsForType).forEach((depId) => {\n const version = scopeDepsForType[depId];\n const existingDep = policyArray.find((dep) => dep.name === depId);\n\n if (existingDep) {\n // If merge config has version: '-', it means the dependency was explicitly deleted.\n // Keep the '-' marker and don't override with scope policy.\n if (existingDep.version === '-') {\n return;\n }\n // Otherwise, dependency exists in merge config - keep merge config version (it's stronger)\n } else {\n // Dependency only exists in scope policy - add it to merge config\n policyArray.push({ name: depId, version, force: true });\n }\n });\n }\n\n private filterDeletedDependenciesFromConfig(mergeConfig?: Record<string, any>): void {\n const policy: Record<string, PolicyDependency[]> | undefined = mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!policy) return;\n\n Object.keys(policy).forEach((depType) => {\n const depValue = policy[depType];\n // Filter out entries with version: '-' (deletion markers)\n const filtered = depValue.filter((dep) => dep.version !== '-');\n // If array is now empty, delete the key to avoid issues with downstream code\n if (filtered.length === 0) {\n delete policy[depType];\n } else {\n policy[depType] = filtered;\n }\n });\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n ConfigStoreAspect,\n ConfigMergerAspect,\n DependencyResolverAspect,\n ApplicationAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n scope,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n configStore,\n configMerger,\n depResolver,\n application,\n ]: [\n CLIMain,\n Workspace,\n ScopeMain,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n ConfigStoreMain,\n ConfigMergerMain,\n DependencyResolverMain,\n ApplicationMain,\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n scope,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger,\n depResolver,\n application\n );\n cli.register(new MergeCmd(merging, configStore));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,S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WAgwBP,EAAE;AAAAhB,eAAA,CAhwBNgB,WAAW,kBAiwBA,CACpBiU,gBAAS,EACTC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,0BAAc,EACdC,wBAAa,EACbC,sBAAY,EACZC,wCAAqB,EACrBC,0BAAc,EACdC,sBAAY,EACZC,sBAAY,EACZC,gCAAiB,EACjBC,kCAAkB,EAClBtC,8CAAwB,EACxBuC,gCAAiB,CAClB;AAAA9V,eAAA,CAjxBUgB,WAAW,aAkxBL+U,kBAAW;AAuD9BnB,wBAAa,CAACoB,UAAU,CAAChV,WAAW,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
2
  "name": "@teambit/merging",
3
- "version": "1.0.982",
3
+ "version": "1.0.984",
4
4
  "homepage": "https://bit.cloud/teambit/component/merging",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "merging",
9
- "version": "1.0.982"
9
+ "version": "1.0.984"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
13
13
  "lodash": "4.17.21",
14
14
  "p-map-series": "2.1.0",
15
- "@teambit/component.modules.merge-helper": "0.0.55",
16
15
  "@teambit/bit-error": "0.0.404",
17
- "@teambit/cli": "0.0.1321",
18
- "@teambit/config-store": "0.0.202",
19
16
  "@teambit/legacy.constants": "0.0.26",
20
17
  "@teambit/component-id": "1.2.4",
21
- "@teambit/component.snap-distance": "0.0.113",
22
18
  "@teambit/lane-id": "0.0.312",
23
- "@teambit/legacy.consumer-component": "0.0.113",
24
- "@teambit/legacy.extension-data": "0.0.114",
25
- "@teambit/legacy.scope": "0.0.112",
26
- "@teambit/logger": "0.0.1414",
27
19
  "@teambit/harmony": "0.4.7",
28
- "@teambit/config": "0.0.1496",
29
- "@teambit/legacy.component-list": "0.0.166",
30
- "@teambit/legacy.consumer": "0.0.112",
31
- "@teambit/pkg.modules.component-package-name": "0.0.119",
32
20
  "@teambit/toolbox.path.path": "0.0.16",
33
- "@teambit/config-merger": "0.0.847",
34
- "@teambit/builder": "1.0.980",
35
- "@teambit/dependency-resolver": "1.0.980",
36
- "@teambit/importer": "1.0.980",
37
- "@teambit/objects": "0.0.487",
38
- "@teambit/scope": "1.0.980",
39
- "@teambit/workspace": "1.0.980",
40
- "@teambit/application": "1.0.980",
41
- "@teambit/checkout": "1.0.981",
42
- "@teambit/component-writer": "1.0.980",
43
- "@teambit/install": "1.0.980",
44
- "@teambit/remove": "1.0.980",
45
- "@teambit/snapping": "1.0.980"
21
+ "@teambit/component.modules.merge-helper": "0.0.57",
22
+ "@teambit/cli": "0.0.1323",
23
+ "@teambit/config-merger": "0.0.849",
24
+ "@teambit/config-store": "0.0.204",
25
+ "@teambit/builder": "1.0.982",
26
+ "@teambit/component.snap-distance": "0.0.115",
27
+ "@teambit/dependency-resolver": "1.0.982",
28
+ "@teambit/importer": "1.0.982",
29
+ "@teambit/legacy.consumer-component": "0.0.115",
30
+ "@teambit/legacy.extension-data": "0.0.116",
31
+ "@teambit/legacy.scope": "0.0.114",
32
+ "@teambit/logger": "0.0.1416",
33
+ "@teambit/objects": "0.0.489",
34
+ "@teambit/scope": "1.0.982",
35
+ "@teambit/workspace": "1.0.982",
36
+ "@teambit/application": "1.0.982",
37
+ "@teambit/checkout": "1.0.983",
38
+ "@teambit/component-writer": "1.0.982",
39
+ "@teambit/config": "0.0.1498",
40
+ "@teambit/install": "1.0.982",
41
+ "@teambit/legacy.component-list": "0.0.168",
42
+ "@teambit/legacy.consumer": "0.0.114",
43
+ "@teambit/pkg.modules.component-package-name": "0.0.121",
44
+ "@teambit/remove": "1.0.982",
45
+ "@teambit/snapping": "1.0.982"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/lodash": "4.14.165",