@teambit/merging 1.0.140 → 1.0.141

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.
@@ -7,6 +7,7 @@ import { Logger } from '@teambit/logger';
7
7
  import { ComponentMergeStatus } from './merging.main.runtime';
8
8
  export type MergeStatusProviderOptions = {
9
9
  resolveUnrelated?: MergeStrategy;
10
+ mergeStrategy: MergeStrategy;
10
11
  ignoreConfigChanges?: boolean;
11
12
  shouldSquash?: boolean;
12
13
  };
@@ -14,12 +15,11 @@ export declare class MergeStatusProvider {
14
15
  private workspace;
15
16
  private logger;
16
17
  private importer;
18
+ private options;
17
19
  private currentLane?;
18
20
  private otherLane?;
19
- private options?;
20
- constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.
21
- otherLane?: Lane, // the lane we want to merged to our lane. (undefined if it's "main").
22
- options?: MergeStatusProviderOptions);
21
+ constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, options: MergeStatusProviderOptions, currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.
22
+ otherLane?: Lane);
23
23
  getStatus(bitIds: ComponentID[]): Promise<ComponentMergeStatus[]>;
24
24
  private getComponentMergeStatus;
25
25
  private returnUnmerged;
@@ -74,17 +74,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
74
74
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
75
75
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
76
76
  class MergeStatusProvider {
77
- constructor(workspace, logger, importer, currentLane,
77
+ constructor(workspace, logger, importer, options, currentLane,
78
78
  // currently checked out lane. if on main, then it's undefined.
79
- otherLane,
80
- // the lane we want to merged to our lane. (undefined if it's "main").
81
- options) {
79
+ otherLane // the lane we want to merged to our lane. (undefined if it's "main").
80
+ ) {
82
81
  this.workspace = workspace;
83
82
  this.logger = logger;
84
83
  this.importer = importer;
84
+ this.options = options;
85
85
  this.currentLane = currentLane;
86
86
  this.otherLane = otherLane;
87
- this.options = options;
88
87
  }
89
88
  async getStatus(bitIds) {
90
89
  if (!this.currentLane && this.otherLane) {
@@ -159,7 +158,7 @@ other: ${otherLaneHead.toString()}`);
159
158
  const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;
160
159
  const otherLabel = `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`;
161
160
  const workspaceIds = await this.workspace.listIds();
162
- const configMerger = new (_configMerger().ComponentConfigMerger)(id.toStringWithoutVersion(), workspaceIds, this.otherLane, currentComponent.extensions, baseComponent.extensions, otherComponent.extensions, currentLabel, otherLabel, this.logger);
161
+ const configMerger = new (_configMerger().ComponentConfigMerger)(id.toStringWithoutVersion(), workspaceIds, this.otherLane, currentComponent.extensions, baseComponent.extensions, otherComponent.extensions, currentLabel, otherLabel, this.logger, this.options.mergeStrategy);
163
162
  const configMergeResult = configMerger.merge();
164
163
  const mergeResults = await (0, _threeWayMerge().default)({
165
164
  consumer: this.workspace.consumer,
@@ -1 +1 @@
1
- {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","scope","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","consumer","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","configMerger","ComponentConfigMerger","extensions","configMergeResult","merge","mergeResults","threeWayMerge","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","isDiverged","isSourceAhead","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","sourceHead","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane","exports"],"sources":["merge-status-provider.ts"],"sourcesContent":["import { Workspace } from '@teambit/workspace';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport threeWayMerge from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n};\n\nexport class MergeStatusProvider {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private importer: ImporterMain,\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 private options?: MergeStatusProviderOptions\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.workspace.consumer.scope.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.workspace.consumer.scope);\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.workspace.consumer.scope.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 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 = await this.workspace.listIds();\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 );\n const configMergeResult = configMerger.merge();\n\n const mergeResults = await threeWayMerge({\n consumer: this.workspace.consumer,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData, configMergeResult };\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 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 consumer.scope.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 = consumer.scope.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 = consumer.scope.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, consumer.scope.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 const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();\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, `component has been removed`, 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 getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. \"other\" is main. in this case, we don't care what happens on main, we want the component to stay deleted on\n // 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 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 : true; // it's main. option #1 above.\n if (shouldIgnore) {\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\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 targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // do nothing!\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isTargetAhead()) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\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, `component ${currentComponent.id.toString()} is already merged`, true);\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 consumer = this.workspace.consumer;\n const repo = consumer.scope.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":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,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GAAGgB,iBAAiB,GAAGC,eAAe;IACzF,MAAMF,gBAAgB,GAAGf,gBAAgB,KAAK,MAAM,GAAGiB,eAAe,GAAGD,iBAAiB;IAC1F,IAAIhB,gBAAgB,KAAK,MAAM,EAAE;MAC/B,OAAOM,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC3I,SAAS,EAAEiE,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI2D,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOa,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC5I,WAAW,EAAEkE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwByE,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC0B,OAAA,CAAA5J,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeStatusProvider","constructor","workspace","logger","importer","options","currentLane","otherLane","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","scope","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","consumer","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","configMerger","ComponentConfigMerger","extensions","mergeStrategy","configMergeResult","merge","mergeResults","threeWayMerge","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","isDiverged","isSourceAhead","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","sourceHead","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane","exports"],"sources":["merge-status-provider.ts"],"sourcesContent":["import { Workspace } from '@teambit/workspace';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport threeWayMerge from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n};\n\nexport class MergeStatusProvider {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private importer: ImporterMain,\n private options: MergeStatusProviderOptions,\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.workspace.consumer.scope.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.workspace.consumer.scope);\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.workspace.consumer.scope.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 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 = await this.workspace.listIds();\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 mergeResults = await threeWayMerge({\n consumer: this.workspace.consumer,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData, configMergeResult };\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 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 consumer.scope.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 = consumer.scope.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 = consumer.scope.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, consumer.scope.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 const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();\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, `component has been removed`, 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 getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. \"other\" is main. in this case, we don't care what happens on main, we want the component to stay deleted on\n // 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 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 : true; // it's main. option #1 above.\n if (shouldIgnore) {\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\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 targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // do nothing!\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isTargetAhead()) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\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, `component ${currentComponent.id.toString()} is already merged`, true);\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 consumer = this.workspace.consumer;\n const repo = consumer.scope.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":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,aAAA,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,eAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,cAAA;EAAA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AEV,gBAAgB,EAAE,IAAI,CAAC3I,SAAS,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI4D,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOa,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC5I,WAAW,EAAEiE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwB0E,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC0B,OAAA,CAAA7J,mBAAA,GAAAA,mBAAA"}
@@ -115,9 +115,8 @@ export declare class MergingMain {
115
115
  * 2. "bit lane merge", when merging from one lane to another.
116
116
  */
117
117
  getMergeStatus(bitIds: ComponentID[], // the id.version is the version we want to merge to the current component
118
- currentLane: Lane | null, // currently checked out lane. if on main, then it's null.
119
- otherLane?: Lane | null, // the lane we want to merged to our lane. (null if it's "main").
120
- options?: MergeStatusProviderOptions): Promise<ComponentMergeStatus[]>;
118
+ options: MergeStatusProviderOptions, currentLane: Lane | null, // currently checked out lane. if on main, then it's null.
119
+ otherLane?: Lane | null): Promise<ComponentMergeStatus[]>;
121
120
  private applyVersionMultiple;
122
121
  private applyVersion;
123
122
  private abortMerge;
@@ -239,7 +239,7 @@ class MergingMain {
239
239
  async mergeComponentsFromRemote(consumer, bitIds, mergeStrategy, noSnap, snapMessage, build, skipDependencyInstallation) {
240
240
  const currentLaneId = consumer.getCurrentLaneId();
241
241
  const currentLaneObject = await consumer.getCurrentLaneObject();
242
- const allComponentsStatus = await this.getAllComponentsStatus(bitIds, currentLaneId, currentLaneObject);
242
+ const allComponentsStatus = await this.getAllComponentsStatus(bitIds, currentLaneId, currentLaneObject, mergeStrategy);
243
243
  const failedComponents = allComponentsStatus.filter(c => c.unchangedMessage && !c.unchangedLegitimately);
244
244
  if (failedComponents.length) {
245
245
  const failureMsgs = failedComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default.red(failedComponent.unchangedMessage)}`).join('\n');
@@ -373,12 +373,10 @@ class MergingMain {
373
373
  */
374
374
  async getMergeStatus(bitIds,
375
375
  // the id.version is the version we want to merge to the current component
376
- currentLane,
376
+ options, currentLane,
377
377
  // currently checked out lane. if on main, then it's null.
378
- otherLane,
379
- // the lane we want to merged to our lane. (null if it's "main").
380
- options) {
381
- const mergeStatusProvider = new (_mergeStatusProvider().MergeStatusProvider)(this.workspace, this.logger, this.importer, currentLane || undefined, otherLane || undefined, options);
378
+ otherLane) {
379
+ const mergeStatusProvider = new (_mergeStatusProvider().MergeStatusProvider)(this.workspace, this.logger, this.importer, options, currentLane || undefined, otherLane || undefined);
382
380
  return mergeStatusProvider.getStatus(bitIds);
383
381
  }
384
382
  async applyVersionMultiple(succeededComponents, otherLaneId, mergeStrategy, currentLane) {
@@ -576,7 +574,7 @@ class MergingMain {
576
574
  resolvedComponents: snappedComponents
577
575
  };
578
576
  }
579
- async getAllComponentsStatus(bitIds, laneId, localLaneObject) {
577
+ async getAllComponentsStatus(bitIds, laneId, localLaneObject, mergeStrategy) {
580
578
  const ids = await Promise.all(bitIds.map(async bitId => {
581
579
  const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;
582
580
  const remoteLaneId = _laneId().LaneId.from(laneId.name, remoteScopeName);
@@ -587,9 +585,10 @@ class MergingMain {
587
585
  }
588
586
  return bitId.changeVersion(remoteHead.toString());
589
587
  }));
590
- return this.getMergeStatus(ids, localLaneObject, localLaneObject, {
591
- shouldSquash: false
592
- });
588
+ return this.getMergeStatus(ids, {
589
+ shouldSquash: false,
590
+ mergeStrategy
591
+ }, localLaneObject, localLaneObject);
593
592
  }
594
593
  async snapResolvedComponents(consumer, snapMessage, build) {
595
594
  const unmergedComponents = consumer.scope.objects.unmergedComponents.getComponents();
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_workspace","_interopRequireWildcard","_componentsList","_interopRequireDefault","_mergeVersion","_snapping","_hasWildcard","_pMapSeries","_componentId","_bitError","_generalError","_laneId","_chalk","_config","_remove","_utils","_componentWriter","_importer","_logger","_globalConfig","_lodash","_checkout","_deleteComponentFiles","_configMerger","_install","_mergeCmd","_merging","_mergeStatusProvider","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","MergingMain","constructor","workspace","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","merge","ids","mergeStrategy","abort","resolve","noSnap","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","tag","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","scope","objects","add","persist","unmergedComponents","write","writeBitMap","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","dedupe","updateExisting","import","err","error","consoleError","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","getMergeStatus","otherLane","options","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","compsToWrite","legacyCompToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","laneId","addToCurrentLane","Error","isPartOfLane","isEqualWithoutVersion","addComponent","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","setHead","markVersionAsLocal","values","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","tagMessage","unmodified","idsStr","componentIds","resolveMultipleComponentIds","entry","getEntry","GeneralError","unresolvedComponents","componentsList","ComponentsList","mergePending","listMergePendingComponents","hasWildcard","listComponentsByIdsWithWildcard","getParsedId","provider","cli","loggerMain","compWriter","globalConfig","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","GlobalConfigAspect","ConfigMergerAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport {\n MergeStrategy,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport SnappingAspect, { SnapResults, SnappingMain, TagResults } from '@teambit/snapping';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LaneId } from '@teambit/lane-id';\nimport { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';\nimport { UnmergedComponent } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport chalk from 'chalk';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config';\nimport { compact } from 'lodash';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport {\n ApplyVersionWithComps,\n CheckoutAspect,\n CheckoutMain,\n ComponentStatusBase,\n applyModifiedVersion,\n removeFilesIfNeeded,\n updateFileStatus,\n} from '@teambit/checkout';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport {\n ConfigMergerAspect,\n ConfigMergerMain,\n ConfigMergeResult,\n WorkspaceConfigUpdateResult,\n} from '@teambit/config-merger';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport { MergeStatusProvider, MergeStatusProviderOptions } from './merge-status-provider';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\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 type FailedComponents = { id: ComponentID; unchangedMessage: string; unchangedLegitimately?: boolean };\n\n// fileName is PathLinux. TS doesn't let anything else in the keys other than string and number\nexport type FilesStatus = { [fileName: string]: keyof typeof FileStatus };\n\nexport type ApplyVersionResult = { id: ComponentID; filesStatus: FilesStatus };\n\nexport type ApplyVersionResults = {\n components?: ApplyVersionResult[];\n version?: string;\n failedComponents?: FailedComponents[];\n removedComponents?: ComponentID[];\n addedComponents?: ComponentID[]; // relevant when restoreMissingComponents is true (e.g. bit lane merge-abort)\n resolvedComponents?: ConsumerComponent[]; // relevant for bit merge --resolve\n abortedComponents?: ApplyVersionResult[]; // relevant for bit merge --abort\n mergeSnapResults?: {\n snappedComponents: ConsumerComponent[];\n autoSnappedResults: AutoTagResult[];\n removedComponents?: ComponentIdList;\n } | null;\n mergeSnapError?: Error;\n leftUnresolvedConflicts?: boolean;\n verbose?: boolean;\n newFromLane?: string[];\n newFromLaneAdded?: boolean;\n installationError?: Error; // in case the package manager failed, it won't throw, instead, it'll return error here\n compilationError?: Error; // in case the compiler failed, it won't throw, instead, it'll return error here\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\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 ) {}\n\n async merge(\n ids: string[],\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noSnap: 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(ids, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(ids);\n } else {\n const bitIds = await this.getComponentsToMerge(consumer, ids);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noSnap,\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 noSnap: 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(bitIds, currentLaneId, currentLaneObject);\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 noSnap,\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 noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane: Lane | null;\n noSnap: boolean;\n tag?: boolean;\n snapMessage: string;\n build: boolean;\n skipDependencyInstallation?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\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 componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts } =\n await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge);\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError = await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(\n workspaceDepsConflicts\n );\n }\n await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) consumer.scope.objects.add(currentLane);\n\n await consumer.scope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await consumer.scope.objects.unmergedComponents.write();\n\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n\n if (componentIdsToRemove.length) {\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 if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\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.consoleError(`failed installing packages, see the log for full stacktrace. error: ${err.message}`);\n }\n }\n\n const getSnapOrTagResults = async () => {\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 (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(consumer, snapMessage, build);\n };\n let mergeSnapResults: ApplyVersionResults['mergeSnapResults'] = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace.bitMap.takeSnapshot();\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n mergeSnapError = err;\n 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 workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\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 currentLane: Lane | null, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane | null, // the lane we want to merged to our lane. (null if it's \"main\").\n options?: MergeStatusProviderOptions\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.workspace,\n this.logger,\n this.importer,\n currentLane || undefined,\n otherLane || undefined,\n options\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane: Lane | null\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.workspace.consumer.scope.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 });\n }\n );\n\n const compsToWrite = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\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 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 }: {\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 | null;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n }): Promise<ApplyVersionWithComps> {\n const consumer = this.workspace.consumer;\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\n const modelComponent = await consumer.scope.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 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 consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, 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 consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, 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 = await consumer.loadComponentFromModelImportIfNeeded(idToLoad);\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 await removeFilesIfNeeded(filesStatus, consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\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 consumer.scope.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 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 consumer.scope.objects.add(modelComponent);\n }\n\n return {\n applyVersionResult: { id, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(values: string[]): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(values);\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(values: string[], snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(values);\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 | null\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, localLaneObject, localLaneObject, { shouldSquash: false });\n }\n\n private async snapResolvedComponents(\n consumer: Consumer,\n snapMessage: string,\n build: boolean\n ): Promise<SnapResults | null> {\n const unmergedComponents = consumer.scope.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 return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\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(idsStr?: string[]): Promise<ComponentID[]> {\n if (idsStr && idsStr.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsStr);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new GeneralError(`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 GeneralError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(consumer: Consumer, ids: string[]): Promise<ComponentID[]> {\n const componentsList = new ComponentsList(consumer);\n if (!ids.length) {\n const mergePending = await componentsList.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n if (hasWildcard(ids)) {\n return componentsList.listComponentsByIdsWithWildcard(ids);\n }\n return ids.map((id) => consumer.getParsedId(id));\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n GlobalConfigAspect,\n ConfigMergerAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n globalConfig,\n configMerger,\n ]: [\n CLIMain,\n Workspace,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n GlobalConfigMain,\n ConfigMergerMain\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger\n );\n cli.register(new MergeCmd(merging, globalConfig));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AA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AA;AAAAd,eAAA,CA5jBYc,WAAW,WAigBP,EAAE;AAAAd,eAAA,CAjgBNc,WAAW,kBAkgBA,CACpB8O,gBAAS,EACTC,oBAAe,EACfC,mBAAc,EACdC,0BAAc,EACdC,wBAAa,EACbC,sBAAY,EACZC,wCAAqB,EACrBC,mBAAc,EACdC,sBAAY,EACZC,iBAAY,EACZC,uBAAkB,EAClBC,kCAAkB,CACnB;AAAAvQ,eAAA,CA/gBUc,WAAW,aAghBL0P,kBAAW;AA8C9BjB,wBAAa,CAACkB,UAAU,CAAC3P,WAAW,CAAC"}
1
+ {"version":3,"names":["_cli","data","require","_workspace","_interopRequireWildcard","_componentsList","_interopRequireDefault","_mergeVersion","_snapping","_hasWildcard","_pMapSeries","_componentId","_bitError","_generalError","_laneId","_chalk","_config","_remove","_utils","_componentWriter","_importer","_logger","_globalConfig","_lodash","_checkout","_deleteComponentFiles","_configMerger","_install","_mergeCmd","_merging","_mergeStatusProvider","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","MergingMain","constructor","workspace","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","merge","ids","mergeStrategy","abort","resolve","noSnap","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","tag","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","scope","objects","add","persist","unmergedComponents","write","writeBitMap","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","dedupe","updateExisting","import","err","error","consoleError","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","getMergeStatus","options","otherLane","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","compsToWrite","legacyCompToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","laneId","addToCurrentLane","Error","isPartOfLane","isEqualWithoutVersion","addComponent","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","setHead","markVersionAsLocal","values","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","tagMessage","unmodified","idsStr","componentIds","resolveMultipleComponentIds","entry","getEntry","GeneralError","unresolvedComponents","componentsList","ComponentsList","mergePending","listMergePendingComponents","hasWildcard","listComponentsByIdsWithWildcard","getParsedId","provider","cli","loggerMain","compWriter","globalConfig","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","GlobalConfigAspect","ConfigMergerAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport {\n MergeStrategy,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport SnappingAspect, { SnapResults, SnappingMain, TagResults } from '@teambit/snapping';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LaneId } from '@teambit/lane-id';\nimport { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';\nimport { UnmergedComponent } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport chalk from 'chalk';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config';\nimport { compact } from 'lodash';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport {\n ApplyVersionWithComps,\n CheckoutAspect,\n CheckoutMain,\n ComponentStatusBase,\n applyModifiedVersion,\n removeFilesIfNeeded,\n updateFileStatus,\n} from '@teambit/checkout';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport {\n ConfigMergerAspect,\n ConfigMergerMain,\n ConfigMergeResult,\n WorkspaceConfigUpdateResult,\n} from '@teambit/config-merger';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport { MergeStatusProvider, MergeStatusProviderOptions } from './merge-status-provider';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\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 type FailedComponents = { id: ComponentID; unchangedMessage: string; unchangedLegitimately?: boolean };\n\n// fileName is PathLinux. TS doesn't let anything else in the keys other than string and number\nexport type FilesStatus = { [fileName: string]: keyof typeof FileStatus };\n\nexport type ApplyVersionResult = { id: ComponentID; filesStatus: FilesStatus };\n\nexport type ApplyVersionResults = {\n components?: ApplyVersionResult[];\n version?: string;\n failedComponents?: FailedComponents[];\n removedComponents?: ComponentID[];\n addedComponents?: ComponentID[]; // relevant when restoreMissingComponents is true (e.g. bit lane merge-abort)\n resolvedComponents?: ConsumerComponent[]; // relevant for bit merge --resolve\n abortedComponents?: ApplyVersionResult[]; // relevant for bit merge --abort\n mergeSnapResults?: {\n snappedComponents: ConsumerComponent[];\n autoSnappedResults: AutoTagResult[];\n removedComponents?: ComponentIdList;\n } | null;\n mergeSnapError?: Error;\n leftUnresolvedConflicts?: boolean;\n verbose?: boolean;\n newFromLane?: string[];\n newFromLaneAdded?: boolean;\n installationError?: Error; // in case the package manager failed, it won't throw, instead, it'll return error here\n compilationError?: Error; // in case the compiler failed, it won't throw, instead, it'll return error here\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\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 ) {}\n\n async merge(\n ids: string[],\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noSnap: 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(ids, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(ids);\n } else {\n const bitIds = await this.getComponentsToMerge(consumer, ids);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noSnap,\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 noSnap: 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 noSnap,\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 noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane: Lane | null;\n noSnap: boolean;\n tag?: boolean;\n snapMessage: string;\n build: boolean;\n skipDependencyInstallation?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\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 componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts } =\n await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge);\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError = await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(\n workspaceDepsConflicts\n );\n }\n await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) consumer.scope.objects.add(currentLane);\n\n await consumer.scope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await consumer.scope.objects.unmergedComponents.write();\n\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n\n if (componentIdsToRemove.length) {\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 if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\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.consoleError(`failed installing packages, see the log for full stacktrace. error: ${err.message}`);\n }\n }\n\n const getSnapOrTagResults = async () => {\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 (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(consumer, snapMessage, build);\n };\n let mergeSnapResults: ApplyVersionResults['mergeSnapResults'] = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace.bitMap.takeSnapshot();\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n mergeSnapError = err;\n 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 workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\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 | null, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane | null // the lane we want to merged to our lane. (null if it's \"main\").\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.workspace,\n this.logger,\n this.importer,\n options,\n currentLane || undefined,\n otherLane || undefined\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane: Lane | null\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.workspace.consumer.scope.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 });\n }\n );\n\n const compsToWrite = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\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 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 }: {\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 | null;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n }): Promise<ApplyVersionWithComps> {\n const consumer = this.workspace.consumer;\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\n const modelComponent = await consumer.scope.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 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 consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, 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 consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, 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 = await consumer.loadComponentFromModelImportIfNeeded(idToLoad);\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 await removeFilesIfNeeded(filesStatus, consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\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 consumer.scope.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 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 consumer.scope.objects.add(modelComponent);\n }\n\n return {\n applyVersionResult: { id, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(values: string[]): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(values);\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(values: string[], snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(values);\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 | null,\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 consumer: Consumer,\n snapMessage: string,\n build: boolean\n ): Promise<SnapResults | null> {\n const unmergedComponents = consumer.scope.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 return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\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(idsStr?: string[]): Promise<ComponentID[]> {\n if (idsStr && idsStr.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsStr);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new GeneralError(`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 GeneralError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(consumer: Consumer, ids: string[]): Promise<ComponentID[]> {\n const componentsList = new ComponentsList(consumer);\n if (!ids.length) {\n const mergePending = await componentsList.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n if (hasWildcard(ids)) {\n return componentsList.listComponentsByIdsWithWildcard(ids);\n }\n return ids.map((id) => consumer.getParsedId(id));\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n GlobalConfigAspect,\n ConfigMergerAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n globalConfig,\n configMerger,\n ]: [\n CLIMain,\n Workspace,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n GlobalConfigMain,\n ConfigMergerMain\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger\n );\n cli.register(new MergeCmd(merging, globalConfig));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAO,YAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,YAAA;EAAA,MAAAT,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAQ,WAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;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BC,GAAG,EACHlO,SAAS,EACTE,QAAQ,EACRC,QAAQ,EACRF,OAAO,EACPkO,UAAU,EACVC,UAAU,EACV9N,QAAQ,EACRC,MAAM,EACNC,MAAM,EACN6N,YAAY,EACZ5N,YAAY,CAcb,EAAE;IACD,MAAML,MAAM,GAAG+N,UAAU,CAACG,YAAY,CAACC,wBAAa,CAAC3L,EAAE,CAAC;IACxD,MAAM4L,OAAO,GAAG,IAAI1O,WAAW,CAC7BE,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNgO,UAAU,EACV9N,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,YACF,CAAC;IACDyN,GAAG,CAACO,QAAQ,CAAC,KAAIC,oBAAQ,EAACF,OAAO,EAAEH,YAAY,CAAC,CAAC;IACjD,OAAOG,OAAO;EAChB;AACF;AAACG,OAAA,CAAA7O,WAAA,GAAAA,WAAA;AAAAd,eAAA,CAlkBYc,WAAW,WAugBP,EAAE;AAAAd,eAAA,CAvgBNc,WAAW,kBAwgBA,CACpB8O,gBAAS,EACTC,oBAAe,EACfC,mBAAc,EACdC,0BAAc,EACdC,wBAAa,EACbC,sBAAY,EACZC,wCAAqB,EACrBC,mBAAc,EACdC,sBAAY,EACZC,iBAAY,EACZC,uBAAkB,EAClBC,kCAAkB,CACnB;AAAAvQ,eAAA,CArhBUc,WAAW,aAshBL0P,kBAAW;AA8C9BjB,wBAAa,CAACkB,UAAU,CAAC3P,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/merging",
3
- "version": "1.0.140",
3
+ "version": "1.0.141",
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.140"
9
+ "version": "1.0.141"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,17 +17,17 @@
17
17
  "@teambit/lane-id": "0.0.311",
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/cli": "0.0.848",
20
- "@teambit/config-merger": "0.0.7",
20
+ "@teambit/config-merger": "0.0.8",
21
21
  "@teambit/global-config": "0.0.851",
22
- "@teambit/importer": "1.0.140",
22
+ "@teambit/importer": "1.0.141",
23
23
  "@teambit/logger": "0.0.941",
24
- "@teambit/workspace": "1.0.140",
25
- "@teambit/checkout": "1.0.140",
26
- "@teambit/component-writer": "1.0.140",
27
- "@teambit/config": "0.0.891",
28
- "@teambit/install": "1.0.140",
29
- "@teambit/remove": "1.0.140",
30
- "@teambit/snapping": "1.0.140"
24
+ "@teambit/workspace": "1.0.141",
25
+ "@teambit/checkout": "1.0.141",
26
+ "@teambit/component-writer": "1.0.141",
27
+ "@teambit/config": "0.0.892",
28
+ "@teambit/install": "1.0.141",
29
+ "@teambit/remove": "1.0.141",
30
+ "@teambit/snapping": "1.0.141"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "4.14.165",