@teambit/merging 1.0.1238 → 1.0.1240

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.
@@ -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","Boolean","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","currentWorkspaceComp","get","state","_consumer","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 // the gap is needed only when the other side is a lane from a different scope than ours: its snaps\n // exist only on that lane's scope, and once merged they become part of our history, so our export\n // must push them onward (to each component's home scope when merging into main, or to the current\n // lane's scope). when the other side is main, its history is already on every component's home scope\n // and is never pushed by us (lane scopes are lean) — the VersionHistory (imported during the\n // pre-fetch) covers the divergence traversal.\n const shouldImportHistoryOfOtherLane =\n !this.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\n Boolean(this.otherLane) &&\n this.otherLane?.scope !== this.currentLane?.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 = async () => {\n if (existingBitMapId && this.workspace) {\n const currentWorkspaceComp = await this.workspace.get(existingBitMapId);\n return currentWorkspaceComp.state._consumer;\n }\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;IAAA,OA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/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAAChL,SAAS,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI6F,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACjL,WAAW,EAAEiE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyB2G,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAACvK,OAAA,CAAAE,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_componentModules","_dependencyResolver","_builder","_mergeDependencies","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","Boolean","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","getDependenciesMergeResult","undefined","hasConflicts","MergeOptions","theirs","getDependenciesOfVersion","mergeDependencies","toComponentIdsIncludeUpdateDependents","dependenciesMergeResult","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","currentWorkspaceComp","get","state","_consumer","getConsumerComponent","isRemovedOnMain","findCoreExtension","config","removeOnMain","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","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 { MergeOptions, 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';\nimport { getDependenciesOfVersion, mergeDependencies } from './merge-dependencies';\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 // the gap is needed only when the other side is a lane from a different scope than ours: its snaps\n // exist only on that lane's scope, and once merged they become part of our history, so our export\n // must push them onward (to each component's home scope when merging into main, or to the current\n // lane's scope). when the other side is main, its history is already on every component's home scope\n // and is never pushed by us (lane scopes are lean) — the VersionHistory (imported during the\n // pre-fetch) covers the divergence traversal.\n const shouldImportHistoryOfOtherLane =\n !this.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\n Boolean(this.otherLane) &&\n this.otherLane?.scope !== this.currentLane?.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 // a workspace re-detects the dependencies from the merged files. a bare scope can't, it merges the resolved ones.\n const getDependenciesMergeResult = () => {\n if (this.workspace) return undefined;\n // \"theirs\" with a file conflict takes all the files of other (see applyModifiedVersion), so the dependencies too\n if (mergeResults.hasConflicts && this.options.mergeStrategy === MergeOptions.theirs) {\n return getDependenciesOfVersion(otherComponent);\n }\n return mergeDependencies(\n getDependenciesOfVersion(baseComponent),\n currentComponent,\n getDependenciesOfVersion(otherComponent),\n this.options.mergeStrategy,\n this.currentLane?.toComponentIdsIncludeUpdateDependents()\n );\n };\n const dependenciesMergeResult = getDependenciesMergeResult();\n return {\n currentComponent,\n id,\n mergeResults,\n divergeData,\n configMergeResult,\n dataMergeResult,\n dependenciesMergeResult,\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 = async () => {\n if (existingBitMapId && this.workspace) {\n const currentWorkspaceComp = await this.workspace.get(existingBitMapId);\n return currentWorkspaceComp.state._consumer;\n }\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,CAA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C;MAC3G;MACA,MAAM,IAAId,KAAK,CACb,yBAAyBmH,gBAAgB,kEAC3C,CAAC;IACH;IAEA,MAAM4B,eAAe,GAAG5B,gBAAgB,KAAK,MAAM,GAAGoB,iBAAiB,GAAGC,eAAe;IACzF,MAAMF,gBAAgB,GAAGnB,gBAAgB,KAAK,MAAM,GAAGqB,eAAe,GAAGD,iBAAiB;IAC1F,IAAIpB,gBAAgB,KAAK,MAAM,EAAE;MAC/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACxL,SAAS,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAIqG,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACzL,WAAW,EAAEiE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBmH,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAC/K,OAAA,CAAAE,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -18,6 +18,7 @@ import type { DependencyResolverMain } from '@teambit/dependency-resolver';
18
18
  import type { InstallMain } from '@teambit/install';
19
19
  import type { ScopeMain } from '@teambit/scope';
20
20
  import type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';
21
+ import type { DependenciesSnapshot } from './merge-dependencies';
21
22
  import type { MergeStrategy, MergeResultsThreeWay, ApplyVersionResults } from '@teambit/component.modules.merge-helper';
22
23
  import type { ConfigStoreMain } from '@teambit/config-store';
23
24
  import type { ApplicationMain } from '@teambit/application';
@@ -37,6 +38,7 @@ export type ComponentMergeStatus = ComponentStatusBase & {
37
38
  resolvedUnrelated?: ResolveUnrelatedData;
38
39
  configMergeResult?: ConfigMergeResult;
39
40
  dataMergeResult?: DataMergeResult;
41
+ dependenciesMergeResult?: DependenciesSnapshot;
40
42
  };
41
43
  export type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {
42
44
  divergeData?: SnapsDistance;
@@ -98,6 +100,19 @@ export declare class MergingMain {
98
100
  otherLane?: Lane): Promise<ComponentMergeStatus[]>;
99
101
  private applyVersionMultiple;
100
102
  private applyVersion;
103
+ /**
104
+ * a workspace makes the merge snap from the merged files it re-loads, which re-calculates the component.
105
+ * a bare scope makes it from the in-memory component, so bring it to the same state: the merged aspects-data and the
106
+ * merged dependencies. (the dependencies policy and overrides are re-calculated later, during the snap. see
107
+ * snapFromScope's "recalcDependencies").
108
+ */
109
+ private prepareScopeComponentForMergeSnap;
110
+ /**
111
+ * a dependency on a component of the current lane gets the lane's version, same as a workspace gets it from .bitmap
112
+ * (or from the lane's hidden updateDependents, see updateDependenciesVersions).
113
+ * call it once all the components were applied, so the lane has the new heads of the ones the merge updated.
114
+ */
115
+ private setLaneVersionsOfDeps;
101
116
  private abortMerge;
102
117
  private resolveMerge;
103
118
  private getAllComponentsStatus;
@@ -450,7 +450,8 @@ class MergingMain {
450
450
  id,
451
451
  mergeResults,
452
452
  resolvedUnrelated,
453
- configMergeResult
453
+ configMergeResult,
454
+ dependenciesMergeResult
454
455
  }) => {
455
456
  const modelComponent = await this.scope.legacyScope.getModelComponent(id);
456
457
  const updatedLaneId = otherLaneId.isDefault() ? _laneId().LaneId.from(otherLaneId.name, id.scope) : otherLaneId;
@@ -464,10 +465,14 @@ class MergingMain {
464
465
  currentLane,
465
466
  resolvedUnrelated,
466
467
  configMergeResult,
468
+ dependenciesMergeResult,
467
469
  detachHead,
468
470
  shouldSquash
469
471
  });
470
472
  });
473
+ if (!this.workspace && currentLane) {
474
+ await Promise.all((0, _lodash().compact)(succeededComponents.map(c => c.dependenciesMergeResult)).map(dependenciesMergeResult => this.setLaneVersionsOfDeps(dependenciesMergeResult, currentLane)));
475
+ }
471
476
  if (this.workspace) {
472
477
  // Hidden lane updateDependents live only on the lane and in the scope. Writing them to
473
478
  // the workspace would (a) leak internal lane plumbing into bitmap/files, and (b) confuse
@@ -498,6 +503,7 @@ class MergingMain {
498
503
  currentLane,
499
504
  resolvedUnrelated,
500
505
  configMergeResult,
506
+ dependenciesMergeResult,
501
507
  detachHead,
502
508
  shouldSquash
503
509
  }) {
@@ -589,6 +595,12 @@ class MergingMain {
589
595
  // in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version
590
596
  legacyComponent.version = id.version;
591
597
  }
598
+ if (!this.workspace && mergeResults) {
599
+ await this.prepareScopeComponentForMergeSnap(legacyComponent, {
600
+ currentComponent: idToLoad === id ? currentComponent : undefined,
601
+ dependenciesMergeResult
602
+ });
603
+ }
592
604
  const files = legacyComponent.files;
593
605
  (0, _checkout().updateFileStatus)(files, filesStatus, currentComponent || undefined);
594
606
  if (mergeResults) {
@@ -648,6 +660,46 @@ class MergingMain {
648
660
  legacyCompToWrite: legacyComponent
649
661
  };
650
662
  }
663
+
664
+ /**
665
+ * a workspace makes the merge snap from the merged files it re-loads, which re-calculates the component.
666
+ * a bare scope makes it from the in-memory component, so bring it to the same state: the merged aspects-data and the
667
+ * merged dependencies. (the dependencies policy and overrides are re-calculated later, during the snap. see
668
+ * snapFromScope's "recalcDependencies").
669
+ */
670
+ async prepareScopeComponentForMergeSnap(legacyComponent, {
671
+ currentComponent,
672
+ dependenciesMergeResult
673
+ }) {
674
+ if (currentComponent) {
675
+ // MergeStatusProvider.mergeExtensionsData() merged the aspects-data into currentComponent, which is a different
676
+ // instance than legacyComponent (each load from the scope clones the extensions). without this, data that changed
677
+ // on the other side only (e.g. a new test file in dev-files) is lost, and as it's not a conflict, it's not
678
+ // re-calculated either.
679
+ legacyComponent.extensions = currentComponent.extensions.clone();
680
+ }
681
+ if (dependenciesMergeResult) Object.assign(legacyComponent, dependenciesMergeResult);
682
+ }
683
+
684
+ /**
685
+ * a dependency on a component of the current lane gets the lane's version, same as a workspace gets it from .bitmap
686
+ * (or from the lane's hidden updateDependents, see updateDependenciesVersions).
687
+ * call it once all the components were applied, so the lane has the new heads of the ones the merge updated.
688
+ */
689
+ async setLaneVersionsOfDeps(dependenciesMergeResult, currentLane) {
690
+ const {
691
+ dependencies,
692
+ devDependencies,
693
+ peerDependencies
694
+ } = dependenciesMergeResult;
695
+ const compDeps = [...dependencies.get(), ...devDependencies.get(), ...peerDependencies.get()];
696
+ await Promise.all(compDeps.map(async dep => {
697
+ const onLane = currentLane.getComponent(dep.id) || currentLane.getUpdateDependentAsLaneComponent(dep.id);
698
+ if (!onLane) return;
699
+ const modelComponent = await this.scope.legacyScope.getModelComponentIfExist(dep.id.changeVersion(undefined));
700
+ dep.id = dep.id.changeVersion(modelComponent?.getTagOfRefIfExists(onLane.head) || onLane.head.toString());
701
+ }));
702
+ }
651
703
  async abortMerge(pattern) {
652
704
  const consumer = this.workspace.consumer;
653
705
  const ids = await this.getIdsForUnmerged(pattern);
@@ -724,6 +776,8 @@ class MergingMain {
724
776
  lane: laneId?.toString(),
725
777
  updatedLegacyComponents: updatedComponents,
726
778
  loadAspectOnlyForIds: getLoadAspectOnlyForIds(),
779
+ // the config was merged, it may differ from the stored one (e.g. an env or a policy changed on the other side)
780
+ recalcDependencies: true,
727
781
  loose
728
782
  });
729
783
  return results;