@teambit/lanes 0.0.697 → 0.0.698

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.
@@ -19,6 +19,7 @@ import { ComponentWriterMain } from '@teambit/component-writer';
19
19
  import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
20
20
  import { RemoveMain } from '@teambit/remove';
21
21
  import { MergingMain } from '@teambit/merging';
22
+ import { CheckoutMain } from '@teambit/checkout';
22
23
  import { ChangeType } from '@teambit/lanes.entities.lane-diff';
23
24
  import ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list';
24
25
  import { RemoveCompsOpts } from './lane.cmd';
@@ -88,7 +89,8 @@ export declare class LanesMain {
88
89
  private componentCompare;
89
90
  readonly componentWriter: ComponentWriterMain;
90
91
  private remove;
91
- constructor(workspace: Workspace | undefined, scope: ScopeMain, merging: MergingMain, componentAspect: ComponentMain, logger: Logger, importer: ImporterMain, exporter: ExportMain, componentCompare: ComponentCompareMain, componentWriter: ComponentWriterMain, remove: RemoveMain);
92
+ readonly checkout: CheckoutMain;
93
+ constructor(workspace: Workspace | undefined, scope: ScopeMain, merging: MergingMain, componentAspect: ComponentMain, logger: Logger, importer: ImporterMain, exporter: ExportMain, componentCompare: ComponentCompareMain, componentWriter: ComponentWriterMain, remove: RemoveMain, checkout: CheckoutMain);
92
94
  getLanes({ name, remote, merged, showDefaultLane, notMerged, }: {
93
95
  name?: string;
94
96
  remote?: string;
@@ -198,7 +200,7 @@ export declare class LanesMain {
198
200
  static slots: never[];
199
201
  static dependencies: import("@teambit/harmony").Aspect[];
200
202
  static runtime: import("@teambit/harmony").RuntimeDefinition;
201
- static provider([cli, scope, workspace, graphql, merging, component, loggerMain, importer, exporter, express, componentCompare, componentWriter, remove,]: [
203
+ static provider([cli, scope, workspace, graphql, merging, component, loggerMain, importer, exporter, express, componentCompare, componentWriter, remove, checkout,]: [
202
204
  CLIMain,
203
205
  ScopeMain,
204
206
  Workspace,
@@ -211,7 +213,8 @@ export declare class LanesMain {
211
213
  ExpressMain,
212
214
  ComponentCompareMain,
213
215
  ComponentWriterMain,
214
- RemoveMain
216
+ RemoveMain,
217
+ CheckoutMain
215
218
  ]): Promise<LanesMain>;
216
219
  }
217
220
  export default LanesMain;
@@ -203,6 +203,13 @@ function _merging() {
203
203
  };
204
204
  return data;
205
205
  }
206
+ function _checkout() {
207
+ const data = _interopRequireDefault(require("@teambit/checkout"));
208
+ _checkout = function () {
209
+ return data;
210
+ };
211
+ return data;
212
+ }
206
213
  function _lanesEntities() {
207
214
  const data = require("@teambit/lanes.entities.lane-diff");
208
215
  _lanesEntities = function () {
@@ -290,7 +297,7 @@ function _lanesRestore() {
290
297
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
291
298
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
292
299
  class LanesMain {
293
- constructor(workspace, scope, merging, componentAspect, logger, importer, exporter, componentCompare, componentWriter, remove) {
300
+ constructor(workspace, scope, merging, componentAspect, logger, importer, exporter, componentCompare, componentWriter, remove, checkout) {
294
301
  this.workspace = workspace;
295
302
  this.scope = scope;
296
303
  this.merging = merging;
@@ -301,6 +308,7 @@ class LanesMain {
301
308
  this.componentCompare = componentCompare;
302
309
  this.componentWriter = componentWriter;
303
310
  this.remove = remove;
311
+ this.checkout = checkout;
304
312
  }
305
313
  async getLanes({
306
314
  name,
@@ -1062,9 +1070,9 @@ please create a new lane instead, which will include all components of this lane
1062
1070
  get restoreRoutePath() {
1063
1071
  return '/lanes/restore';
1064
1072
  }
1065
- static async provider([cli, scope, workspace, graphql, merging, component, loggerMain, importer, exporter, express, componentCompare, componentWriter, remove]) {
1073
+ static async provider([cli, scope, workspace, graphql, merging, component, loggerMain, importer, exporter, express, componentCompare, componentWriter, remove, checkout]) {
1066
1074
  const logger = loggerMain.createLogger(_lanes().LanesAspect.id);
1067
- const lanesMain = new LanesMain(workspace, scope, merging, component, logger, importer, exporter, componentCompare, componentWriter, remove);
1075
+ const lanesMain = new LanesMain(workspace, scope, merging, component, logger, importer, exporter, componentCompare, componentWriter, remove, checkout);
1068
1076
  const switchCmd = new (_switch().SwitchCmd)(lanesMain);
1069
1077
  const laneCmd = new (_lane().LaneCmd)(lanesMain, workspace, scope);
1070
1078
  laneCmd.commands = [new (_lane().LaneListCmd)(lanesMain, workspace, scope), switchCmd, new (_lane().LaneShowCmd)(lanesMain, workspace, scope), new (_lane().LaneCreateCmd)(lanesMain), new (_lane().LaneRemoveCmd)(lanesMain), new (_lane().LaneChangeScopeCmd)(lanesMain), new (_lane().LaneAliasCmd)(lanesMain), new (_lane().LaneRenameCmd)(lanesMain), new (_lanesModules().LaneDiffCmd)(workspace, scope), new (_lane().LaneAddReadmeCmd)(lanesMain), new (_lane().LaneRemoveReadmeCmd)(lanesMain), new (_lane().LaneImportCmd)(switchCmd), new (_lane().LaneRemoveCompCmd)(workspace, lanesMain)];
@@ -1079,7 +1087,7 @@ please create a new lane instead, which will include all components of this lane
1079
1087
  }
1080
1088
  exports.LanesMain = LanesMain;
1081
1089
  (0, _defineProperty2().default)(LanesMain, "slots", []);
1082
- (0, _defineProperty2().default)(LanesMain, "dependencies", [_cli().CLIAspect, _scope().ScopeAspect, _workspace().WorkspaceAspect, _graphql().GraphqlAspect, _merging().MergingAspect, _component().default, _logger().LoggerAspect, _importer().ImporterAspect, _export().ExportAspect, _express().ExpressAspect, _componentCompare().ComponentCompareAspect, _componentWriter().default, _remove().default]);
1090
+ (0, _defineProperty2().default)(LanesMain, "dependencies", [_cli().CLIAspect, _scope().ScopeAspect, _workspace().WorkspaceAspect, _graphql().GraphqlAspect, _merging().MergingAspect, _component().default, _logger().LoggerAspect, _importer().ImporterAspect, _export().ExportAspect, _express().ExpressAspect, _componentCompare().ComponentCompareAspect, _componentWriter().default, _remove().default, _checkout().default]);
1083
1091
  (0, _defineProperty2().default)(LanesMain, "runtime", _cli().MainRuntime);
1084
1092
  _lanes().LanesAspect.addRuntime(LanesMain);
1085
1093
  var _default = LanesMain;
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_scope","_pMapSeries","_interopRequireDefault","_graphql","_express","_workspace","_getRemoteByName","_lanesModules","_laneId","_bitError","_logger","_mergeVersion","_importer","_component","_removeLanes","_models","_getDivergeData","_legacyBitId","_export","_bitId","_lodash","_componentCompare","_objects","_componentWriter","_remove","_merging","_lanesEntities","_exceptions","_noCommonSnap","_lanes","_lane","_lanes2","_switch","_switchLanes","_createLane","_lanesCreate","_lanesDelete","_lanesRestore","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","LanesMain","constructor","workspace","scope","merging","componentAspect","logger","importer","exporter","componentCompare","componentWriter","remove","getLanes","name","remote","merged","showDefaultLane","notMerged","_this$workspace","showMergeData","Boolean","consumer","laneId","LaneId","from","undefined","remoteObj","getRemoteByName","lanes","listLanes","toString","DEFAULT_LANE","defaultLane","getLaneDataOfDefaultLane","legacyScope","getLanesData","filterSoftRemovedLaneComps","parseLaneId","idStr","parseLaneIdFromString","Promise","all","map","lane","id","isDefault","componentIds","compact","getLaneComponentIds","laneCompId","isComponentRemoved","err","ComponentNotFound","warn","_legacy","head","version","laneData","components","getCurrentLaneName","_this$getCurrentLaneI","getCurrentLaneId","getCurrentLaneNameOrAlias","currentLaneId","trackingData","getLocalTrackedLaneByRemoteName","getCurrentLane","loadLane","getDefaultLaneId","setCurrentLane","alias","exported","_this$workspace2","createLane","forkLaneNewScope","newLane","createLaneInScope","toLaneId","hash","throwForInvalidLaneName","currentLaneScope","BitError","defaultScope","laneObj","trackLaneData","localLane","remoteLane","remoteScope","trackLane","scopeJson","setLaneAsNew","onDestroy","results","localName","remoteName","beforeTrackData","getRemoteTrackedDataByLocalLane","beforeTrackDataCloned","afterTrackData","aliasLane","laneName","includes","LANE_REMOTE_DELIMITER","trackData","laneNameWithoutScope","split","removeTrackLane","changeScope","isNew","isValidScopeName","InvalidScopeName","remoteScopeBefore","newLaneId","saveLane","bitMap","rename","currentName","newName","existingAliasWithNewName","remoteIdStr","objects","remoteLanes","renameRefByNewLaneName","isEqual","isExported","isLaneExported","clonedLaneToExport","clone","exportErr","exportLane","error","message","exportMany","laneObject","ids","BitIds","idsWithFutureScope","allVersions","importLaneObject","persistIfNotExists","getSnapsDistance","componentId","sourceHead","targetHead","throws","Error","modelComponent","getModelComponent","getDivergeData","repo","Ref","getHeadOnMain","_modelComponent$head","fetchLaneWithItsComponents","debug","fetchLaneComponents","removeLanes","laneNames","opts","_this$workspace3","force","laneResults","restoreLane","laneHash","ref","objectsFromTrash","getFromTrash","laneIdFromTrash","existingWithSameId","restoreFromTrash","removeComps","componentsPattern","removeCompsOpts","OutsideWorkspaceError","currentLane","getCurrentLaneObject","workspaceOnly","localResult","removedComponentIds","compIds","resolveMultipleComponentIds","removedFromWs","markedRemoved","idsByPattern","laneBitIds","toBitIds","laneCompIds","mainCompIds","partition","hasWithoutVersion","removeFromWorkspace","removeLocallyByIds","markRemoveComps","switchLanes","merge","pattern","getAll","skipDependencyInstallation","mergeStrategy","mergeOptions","MergeOptions","join","switchProps","existingOnWorkspaceOnly","checkoutProps","skipNpmInstall","verbose","ignorePackageJson","ignoreDist","isLane","promptMergeOptions","writeConfig","reset","LaneSwitcher","switch","getDiff","values","diffOptions","laneDiffGenerator","LaneDiffGenerator","generate","getLaneComponentModels","host","getHost","laneComponentIds","getMany","laneComponents","bitIdsFromBitmap","getAllBitIdsFromAllLanes","filteredComponentIds","laneComponent","some","bitmapComponentId","isEqualWithoutVersion","legacyIdWithVersion","changeVersion","resolveComponentId","getLaneReadmeComponent","laneReadmeComponent","readmeComponent","laneReadmeComponentId","get","removeLaneReadme","currentLaneName","result","readmeComponentId","existingLaneConfig","getSpecificComponentConfig","LanesAspect","remoteLaneIdStr","readme","removeSpecificComponentConfig","addSpecificComponentConfig","setReadmeComponent","write","diffStatus","sourceLaneId","targetLaneId","options","_await$this$getLaneDa","_await$this$loadLane","sourceLaneComponents","main","targetLane","targetLaneIds","targetMainHeads","headOnMain","importObjectsFromMainIfExist","diffProps","_targetLaneIds$search","sourceVersionObj","load","isRemoved","headOnTargetLane","searchWithoutVersion","targetVersionObj","pMapSeries","componentDiffStatus","componentsStatus","_snapsDistance$snapsO","_snapsDistance$snapsO2","_snapsDistance$common","snapsDistance","noCommonSnap","NoCommonSnap","upToDate","isUpToDate","unrelated","changes","commonSnap","commonSnapBeforeDiverge","getChanges","ChangeType","NEW","compare","fields","code","c","status","NONE","changed","f","SOURCE_CODE","ASPECTS","depsFields","field","fieldName","DEPENDENCY","skipChanges","changeType","onSource","snapsOnSourceOnly","s","onTarget","snapsOnTargetOnly","common","recreateNewLaneIfDeleted","addLaneReadme","readmeComponentIdStr","readmeComponentBitId","listUpdatesFromForked","componentsList","_this$workspace4","isOnMain","forkedFromLaneId","forkedFrom","forkedFromLane","workspaceIds","getAllBitIds","duringMergeIds","listDuringMergeStateComponents","componentsFromModel","getModelComponents","compFromModelOnWorkspace","toBitId","remoteForkedLane","getRemoteLane","headOnForked","find","headOnLane","laneHeadLocal","divergeData","_this$workspace5","bitIds","scopeComponents","list","component","getIdsOfDefaultLane","bitId","isMerged","createRoutePath","deleteRoutePath","restoreRoutePath","provider","cli","graphql","loggerMain","express","createLogger","lanesMain","switchCmd","SwitchCmd","laneCmd","LaneCmd","commands","LaneListCmd","LaneShowCmd","LaneCreateCmd","LaneRemoveCmd","LaneChangeScopeCmd","LaneAliasCmd","LaneRenameCmd","LaneDiffCmd","LaneAddReadmeCmd","LaneRemoveReadmeCmd","LaneImportCmd","LaneRemoveCompCmd","register","registerOnStart","lanesSchema","LanesCreateRoute","LanesDeleteRoute","LanesRestoreRoute","exports","CLIAspect","ScopeAspect","WorkspaceAspect","GraphqlAspect","MergingAspect","ComponentAspect","LoggerAspect","ImporterAspect","ExportAspect","ExpressAspect","ComponentCompareAspect","ComponentWriterAspect","RemoveAspect","MainRuntime","addRuntime","_default"],"sources":["lanes.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport { OutsideWorkspaceError, Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport getRemoteByName from '@teambit/legacy/dist/remotes/get-remote-by-name';\nimport { LaneDiffCmd, LaneDiffGenerator, LaneDiffResults } from '@teambit/lanes.modules.diff';\nimport { LaneData } from '@teambit/legacy/dist/scope/lanes/lanes';\nimport { LaneId, DEFAULT_LANE, LANE_REMOTE_DELIMITER } from '@teambit/lane-id';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { DiffOptions } from '@teambit/legacy/dist/consumer/component-ops/components-diff';\nimport { MergeStrategy, MergeOptions } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { TrackLane } from '@teambit/legacy/dist/scope/scope-json';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport removeLanes from '@teambit/legacy/dist/consumer/lanes/remove-lanes';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Scope as LegacyScope } from '@teambit/legacy/dist/scope';\nimport { BitId, InvalidScopeName, isValidScopeName } from '@teambit/legacy-bit-id';\nimport { ExportAspect, ExportMain } from '@teambit/export';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { compact, partition } from 'lodash';\nimport { ComponentCompareMain, ComponentCompareAspect } from '@teambit/component-compare';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { MergingMain, MergingAspect } from '@teambit/merging';\nimport { ChangeType } from '@teambit/lanes.entities.lane-diff';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { LanesAspect } from './lanes.aspect';\nimport {\n LaneCmd,\n LaneCreateCmd,\n LaneImportCmd,\n LaneListCmd,\n LaneRemoveCmd,\n LaneShowCmd,\n LaneChangeScopeCmd,\n LaneAliasCmd,\n LaneRenameCmd,\n LaneAddReadmeCmd,\n LaneRemoveReadmeCmd,\n LaneRemoveCompCmd,\n RemoveCompsOpts,\n} from './lane.cmd';\nimport { lanesSchema } from './lanes.graphql';\nimport { SwitchCmd } from './switch.cmd';\nimport { LaneSwitcher } from './switch-lanes';\nimport { createLane, createLaneInScope, throwForInvalidLaneName } from './create-lane';\nimport { LanesCreateRoute } from './lanes.create.route';\nimport { LanesDeleteRoute } from './lanes.delete.route';\nimport { LanesRestoreRoute } from './lanes.restore.route';\n\nexport { Lane };\n\nexport type SnapsDistanceObj = {\n onSource: string[];\n onTarget: string[];\n common?: string;\n};\n\nexport type LaneResults = {\n lanes: LaneData[];\n currentLane?: string | null;\n};\n\nexport type CreateLaneOptions = {\n scope?: string; // default to the defaultScope in workspace.jsonc\n alias?: string; // default to the remote name\n forkLaneNewScope?: boolean;\n};\n\nexport type SwitchLaneOptions = {\n alias?: string;\n merge?: MergeStrategy;\n getAll?: boolean;\n pattern?: string;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n override?: boolean;\n};\n\nexport type LaneComponentDiffStatus = {\n componentId: ComponentID;\n sourceHead: string;\n targetHead?: string;\n /**\n * @deprecated\n * use changes to get list of all the changes\n */\n changeType?: ChangeType;\n changes?: ChangeType[];\n upToDate?: boolean;\n snapsDistance?: SnapsDistanceObj;\n unrelated?: boolean;\n};\n\nexport type LaneDiffStatusOptions = {\n skipChanges?: boolean;\n};\n\nexport type LaneDiffStatus = {\n source: LaneId;\n target: LaneId;\n componentsStatus: LaneComponentDiffStatus[];\n};\n\nexport type MarkRemoveOnLaneResult = { removedFromWs: ComponentID[]; markedRemoved: ComponentID[] };\n\ntype CreateLaneResult = {\n laneId: LaneId;\n hash: string;\n alias?: string;\n};\n\nexport class LanesMain {\n constructor(\n private workspace: Workspace | undefined,\n private scope: ScopeMain,\n private merging: MergingMain,\n private componentAspect: ComponentMain,\n public logger: Logger,\n readonly importer: ImporterMain,\n private exporter: ExportMain,\n private componentCompare: ComponentCompareMain,\n readonly componentWriter: ComponentWriterMain,\n private remove: RemoveMain\n ) {}\n\n async getLanes({\n name,\n remote,\n merged,\n showDefaultLane,\n notMerged,\n }: {\n name?: string;\n remote?: string;\n merged?: boolean;\n showDefaultLane?: boolean;\n notMerged?: boolean;\n }): Promise<LaneData[]> {\n const showMergeData = Boolean(merged || notMerged);\n const consumer = this.workspace?.consumer;\n\n if (remote) {\n const laneId = name ? LaneId.from(name, remote) : undefined;\n const remoteObj = await getRemoteByName(remote, consumer);\n const lanes = await remoteObj.listLanes(laneId?.toString(), showMergeData);\n // no need to filter soft-removed here. it was filtered already in the remote\n return lanes;\n }\n\n if (name === DEFAULT_LANE) {\n const defaultLane = await this.getLaneDataOfDefaultLane();\n return defaultLane ? [defaultLane] : [];\n }\n\n const lanes = await this.scope.legacyScope.lanes.getLanesData(this.scope.legacyScope, name, showMergeData);\n\n if (showDefaultLane) {\n const defaultLane = await this.getLaneDataOfDefaultLane();\n if (defaultLane) lanes.push(defaultLane);\n }\n\n return this.filterSoftRemovedLaneComps(lanes);\n }\n\n async parseLaneId(idStr: string): Promise<LaneId> {\n const scope: LegacyScope = this.scope.legacyScope;\n return scope.lanes.parseLaneIdFromString(idStr);\n }\n\n private async filterSoftRemovedLaneComps(lanes: LaneData[]): Promise<LaneData[]> {\n return Promise.all(\n lanes.map(async (lane) => {\n if (lane.id.isDefault()) return lane;\n\n const componentIds = compact(\n await Promise.all(\n (\n await this.getLaneComponentIds(lane)\n ).map(async (laneCompId) => {\n try {\n if (await this.scope.isComponentRemoved(laneCompId)) return undefined;\n } catch (err) {\n // if (err instanceof ComponentNotFound)\n // throw new Error(\n // `component \"${laneCompId.toString()}\" from the lane \"${lane.id.toString()}\" not found`\n // );\n // throw err;\n if (err instanceof ComponentNotFound)\n this.logger.warn(\n `component \"${laneCompId.toString()}\" from the lane \"${lane.id.toString()}\" not found`\n );\n\n return undefined;\n }\n return { id: laneCompId._legacy, head: laneCompId.version as string };\n })\n )\n );\n\n const laneData: LaneData = {\n ...lane,\n components: componentIds,\n };\n return laneData;\n })\n );\n }\n\n getCurrentLaneName(): string | null {\n return this.getCurrentLaneId()?.name || null;\n }\n\n getCurrentLaneNameOrAlias(): string | null {\n const currentLaneId = this.getCurrentLaneId();\n if (!currentLaneId) return null;\n const trackingData = this.scope.legacyScope.lanes.getLocalTrackedLaneByRemoteName(\n currentLaneId.name,\n currentLaneId.scope\n );\n return trackingData || currentLaneId.name;\n }\n\n getCurrentLaneId(): LaneId | null {\n if (!this.workspace) return null;\n return this.workspace.consumer.getCurrentLaneId();\n }\n\n /**\n * get the currently checked out lane object, if on main - return null.\n */\n async getCurrentLane(): Promise<Lane | null> {\n const laneId = this.getCurrentLaneId();\n if (!laneId || laneId.isDefault()) return null;\n return this.loadLane(laneId);\n }\n\n getDefaultLaneId(): LaneId {\n return LaneId.from(DEFAULT_LANE, this.scope.name);\n }\n\n setCurrentLane(laneId: LaneId, alias?: string, exported?: boolean) {\n this.workspace?.consumer.setCurrentLane(laneId, exported);\n }\n\n async createLane(\n name: string,\n { scope, alias, forkLaneNewScope }: CreateLaneOptions = {}\n ): Promise<CreateLaneResult> {\n if (!this.workspace) {\n const newLane = await createLaneInScope(name, this.scope);\n return {\n laneId: newLane.toLaneId(),\n hash: newLane.hash().toString(),\n };\n }\n if (alias) {\n throwForInvalidLaneName(alias);\n }\n const currentLaneId = this.workspace.getCurrentLaneId();\n const currentLaneScope = currentLaneId.isDefault() ? undefined : currentLaneId.scope;\n if (!forkLaneNewScope && !currentLaneId.isDefault() && scope && currentLaneScope !== scope) {\n throw new BitError(`you're about to create a lane forked from ${currentLaneId.toString()} and assign it to a different scope \"${scope}\".\nif the lane components have a large history, it would be best to stick with the same scope as the current lane.\nto do that, re-run the command without the \"--scope\" flag. it will create the lane and set the scope to \"${currentLaneScope}\"\nif you wish to keep ${scope} scope, please re-run the command with \"--fork-lane-new-scope\" flag.`);\n }\n scope = scope || (currentLaneId.isDefault() ? this.workspace.defaultScope : currentLaneId.scope);\n const laneObj = await createLane(this.workspace, name, scope);\n const laneId = LaneId.from(name, scope);\n this.setCurrentLane(laneId, alias, false);\n const trackLaneData = {\n localLane: alias || name,\n remoteLane: name,\n remoteScope: scope,\n };\n this.scope.legacyScope.lanes.trackLane(trackLaneData);\n this.scope.legacyScope.scopeJson.setLaneAsNew(name);\n await this.workspace.consumer.onDestroy();\n\n const results = {\n alias,\n laneId: laneObj.toLaneId(),\n hash: laneObj.hash().toString(),\n };\n return results;\n }\n\n async loadLane(id: LaneId): Promise<Lane | null> {\n return this.scope.legacyScope.lanes.loadLane(id);\n }\n\n async trackLane(\n localName: string,\n remoteScope: string,\n remoteName?: string\n ): Promise<{ beforeTrackData?: TrackLane; afterTrackData: TrackLane }> {\n if (!this.workspace) {\n throw new BitError(`unable to track a lane outside of Bit workspace`);\n }\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(localName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${localName}\"`);\n }\n const beforeTrackData = this.scope.legacyScope.lanes.getRemoteTrackedDataByLocalLane(localName);\n const beforeTrackDataCloned = beforeTrackData ? { ...beforeTrackData } : undefined;\n const afterTrackData = {\n localLane: localName,\n remoteLane: remoteName || beforeTrackData?.remoteLane || localName,\n remoteScope,\n };\n this.scope.legacyScope.lanes.trackLane(afterTrackData);\n await this.workspace.consumer.onDestroy();\n\n return { beforeTrackData: beforeTrackDataCloned, afterTrackData };\n }\n\n async aliasLane(laneName: string, alias: string): Promise<{ laneId: LaneId }> {\n if (!this.workspace) {\n throw new BitError(`unable to alias a lane outside of Bit workspace`);\n }\n if (alias.includes(LANE_REMOTE_DELIMITER)) {\n throw new BitError(`an alias cannot include a delimiter \"${LANE_REMOTE_DELIMITER}\"`);\n }\n if (alias === laneName) {\n throw new BitError(`an alias cannot be the same as the lane name`);\n }\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(laneName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${laneName}\"`);\n }\n const trackData = {\n localLane: alias,\n remoteLane: laneId.name,\n remoteScope: laneId.scope,\n };\n const laneNameWithoutScope = laneName.includes(LANE_REMOTE_DELIMITER)\n ? laneName.split(LANE_REMOTE_DELIMITER)[1]\n : laneName;\n this.scope.legacyScope.lanes.removeTrackLane(laneNameWithoutScope);\n this.scope.legacyScope.lanes.trackLane(trackData);\n await this.workspace.consumer.onDestroy();\n\n return { laneId };\n }\n\n async changeScope(laneName: string, remoteScope: string): Promise<{ remoteScopeBefore: string }> {\n if (!this.workspace) {\n throw new BitError(`unable to change-scope of a lane outside of Bit workspace`);\n }\n const laneNameWithoutScope = laneName.includes(LANE_REMOTE_DELIMITER)\n ? laneName.split(LANE_REMOTE_DELIMITER)[1]\n : laneName;\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(laneName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${laneName}\"`);\n }\n if (!lane.isNew) {\n throw new BitError(`changing lane scope-name is allowed for new lanes only. this lane has been exported already.\nplease create a new lane instead, which will include all components of this lane`);\n }\n if (!isValidScopeName(remoteScope)) {\n throw new InvalidScopeName(remoteScope);\n }\n const remoteScopeBefore = lane.scope;\n lane.scope = remoteScope;\n const newLaneId = LaneId.from(laneId.name, remoteScope);\n const trackData = {\n localLane: laneNameWithoutScope,\n remoteLane: laneId.name,\n remoteScope,\n };\n this.scope.legacyScope.lanes.trackLane(trackData);\n await this.scope.legacyScope.lanes.saveLane(lane);\n this.workspace.consumer.bitMap.setCurrentLane(newLaneId, false);\n await this.workspace.consumer.onDestroy();\n\n return { remoteScopeBefore };\n }\n\n /**\n * change a lane-name and if possible, export the lane to the remote\n */\n async rename(currentName: string, newName: string): Promise<{ exported: boolean; exportErr?: Error }> {\n if (!this.workspace) {\n throw new BitError(`unable to rename a lane outside of Bit workspace`);\n }\n throwForInvalidLaneName(newName);\n const existingAliasWithNewName = this.scope.legacyScope.lanes.getRemoteTrackedDataByLocalLane(newName);\n if (existingAliasWithNewName) {\n const remoteIdStr = `${existingAliasWithNewName.remoteLane}/${existingAliasWithNewName.remoteScope}`;\n throw new BitError(`unable to rename to ${newName}. this name is already used to track: ${remoteIdStr}`);\n }\n const laneNameWithoutScope = currentName.includes(LANE_REMOTE_DELIMITER)\n ? currentName.split(LANE_REMOTE_DELIMITER)[1]\n : currentName;\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(currentName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${currentName}\"`);\n }\n\n // rename the ref file\n await this.scope.legacyScope.objects.remoteLanes.renameRefByNewLaneName(laneNameWithoutScope, newName, lane.scope);\n\n // change tracking data\n const afterTrackData = {\n localLane: newName,\n remoteLane: newName,\n remoteScope: lane.scope,\n };\n this.scope.legacyScope.lanes.trackLane(afterTrackData);\n this.scope.legacyScope.lanes.removeTrackLane(laneNameWithoutScope);\n\n // change the lane object\n lane.name = newName;\n await this.scope.legacyScope.lanes.saveLane(lane);\n\n // change current-lane if needed\n const currentLaneId = this.getCurrentLaneId();\n if (currentLaneId?.isEqual(laneId)) {\n const newLaneId = LaneId.from(newName, lane.scope);\n const isExported = this.workspace.consumer.bitMap.isLaneExported;\n this.setCurrentLane(newLaneId, undefined, isExported);\n }\n\n // export the lane with only the name-change\n const clonedLaneToExport = lane.clone();\n clonedLaneToExport.components = []; // otherwise, it'll export the changes done on the components.\n let exported = false;\n let exportErr: Error | undefined;\n try {\n await this.exportLane(clonedLaneToExport);\n exported = true;\n } catch (err: any) {\n this.logger.error(`unable to export ${lane.id.toString()}: ${err.message}`);\n exportErr = err;\n }\n\n await this.workspace.consumer.onDestroy();\n\n return { exported, exportErr };\n }\n\n async exportLane(lane: Lane) {\n await this.exporter.exportMany({\n scope: this.scope.legacyScope,\n laneObject: lane,\n ids: new BitIds(),\n idsWithFutureScope: new BitIds(),\n allVersions: false,\n });\n }\n\n async importLaneObject(laneId: LaneId, persistIfNotExists = true): Promise<Lane> {\n return this.importer.importLaneObject(laneId, persistIfNotExists);\n }\n\n /**\n * get the distance for a component between two lanes. for example, lane-b forked from lane-a and lane-b added some new snaps\n * @param componentId\n * @param sourceHead head on the source lane. leave empty if the source is main\n * @param targetHead head on the target lane. leave empty if the target is main\n * @returns\n */\n async getSnapsDistance(\n componentId: ComponentID,\n sourceHead?: string,\n targetHead?: string,\n throws?: boolean\n ): Promise<SnapsDistance> {\n if (!sourceHead && !targetHead)\n throw new Error(`getDivergeData got sourceHead and targetHead empty. at least one of them should be populated`);\n const modelComponent = await this.scope.legacyScope.getModelComponent(componentId._legacy);\n return getDivergeData({\n modelComponent,\n repo: this.scope.legacyScope.objects,\n sourceHead: sourceHead ? Ref.from(sourceHead) : modelComponent.head || null,\n targetHead: targetHead ? Ref.from(targetHead) : modelComponent.head || null,\n throws,\n });\n }\n\n /**\n * get the head hash (snap) of main. return undefined if the component exists only on a lane and was never merged to main\n */\n async getHeadOnMain(componentId: ComponentID): Promise<string | undefined> {\n const modelComponent = await this.scope.legacyScope.getModelComponent(componentId._legacy);\n return modelComponent.head?.toString();\n }\n\n /**\n * fetch the lane object and its components from the remote.\n * save the objects and the lane to the local scope.\n * this method doesn't change anything in the workspace.\n */\n async fetchLaneWithItsComponents(laneId: LaneId): Promise<Lane> {\n this.logger.debug(`fetching lane ${laneId.toString()}`);\n if (!this.workspace) {\n throw new BitError('unable to fetch lanes outside of Bit workspace');\n }\n const lane = await this.importer.importLaneObject(laneId);\n if (!lane) throw new Error(`unable to import lane ${laneId.toString()} from the remote`);\n\n await this.importer.fetchLaneComponents(lane);\n this.logger.debug(`fetching lane ${laneId.toString()} done, fetched ${lane.components.length} components`);\n return lane;\n }\n\n async removeLanes(laneNames: string[], opts?: { remote: boolean; force: boolean }): Promise<string[]> {\n if (!this.workspace && !opts?.remote) {\n await this.scope.legacyScope.lanes.removeLanes(this.scope.legacyScope, laneNames, true);\n return laneNames;\n }\n const results = await removeLanes(this.workspace?.consumer, laneNames, !!opts?.remote, !!opts?.force);\n if (this.workspace) await this.workspace.consumer.onDestroy();\n\n return results.laneResults;\n }\n\n /**\n * when deleting a lane object, it is sent into the \"trash\" directory in the scope.\n * this method restores it and put it back in the \"objects\" directory.\n * as an argument, it needs a hash. the reason for not supporting lane-id is because the trash may have multiple\n * lanes with the same lane-id but different hashes.\n */\n async restoreLane(laneHash: string) {\n const ref = Ref.from(laneHash);\n const objectsFromTrash = (await this.scope.legacyScope.objects.getFromTrash([ref])) as Lane[];\n const laneIdFromTrash = objectsFromTrash[0].toLaneId();\n const existingWithSameId = await this.loadLane(laneIdFromTrash);\n if (existingWithSameId) {\n if (existingWithSameId.hash().isEqual(ref)) {\n throw new BitError(`unable to restore lane ${laneIdFromTrash.toString()}, as it already exists`);\n }\n throw new BitError(\n `unable to restore lane ${laneIdFromTrash.toString()}, as a lane with the same id already exists`\n );\n }\n await this.scope.legacyScope.objects.restoreFromTrash([ref]);\n }\n\n async removeComps(componentsPattern: string, removeCompsOpts: RemoveCompsOpts): Promise<MarkRemoveOnLaneResult> {\n const workspace = this.workspace;\n if (!workspace) throw new OutsideWorkspaceError();\n const currentLane = await workspace.getCurrentLaneObject();\n if (!currentLane) {\n throw new Error('markRemoveOnLane expects to get called when on a lane');\n }\n if (currentLane.isNew || removeCompsOpts.workspaceOnly) {\n const results = await this.remove.remove({\n componentsPattern,\n force: true,\n });\n const ids = results.localResult.removedComponentIds;\n const compIds = await workspace.resolveMultipleComponentIds(ids);\n return { removedFromWs: compIds, markedRemoved: [] };\n }\n\n const componentIds = await workspace.idsByPattern(componentsPattern);\n const laneBitIds = currentLane.toBitIds();\n const [laneCompIds, mainCompIds] = partition(componentIds, (id) => laneBitIds.hasWithoutVersion(id._legacy));\n\n const removeFromWorkspace = async () => {\n if (!mainCompIds.length) return [];\n const results = await this.remove.removeLocallyByIds(\n mainCompIds.map((id) => id._legacy),\n { force: true }\n );\n const ids = results.localResult.removedComponentIds;\n return workspace.resolveMultipleComponentIds(ids);\n };\n\n const removedFromWs = await removeFromWorkspace();\n const markedRemoved = await this.remove.markRemoveComps(laneCompIds);\n\n return { removedFromWs, markedRemoved };\n }\n\n /**\n * switch to a different local or remote lane.\n * switching to a remote lane also imports and writes the components of that remote lane.\n * by default, only the components existing on the workspace will be imported from that lane, unless the \"getAll\"\n * flag is true.\n */\n async switchLanes(\n laneName: string,\n { alias, merge, pattern, getAll = false, skipDependencyInstallation = false }: SwitchLaneOptions\n ) {\n if (!this.workspace) {\n throw new BitError(`unable to switch lanes outside of Bit workspace`);\n }\n let mergeStrategy;\n if (merge && typeof merge === 'string') {\n const mergeOptions = Object.keys(MergeOptions);\n if (!mergeOptions.includes(merge)) {\n throw new BitError(`merge must be one of the following: ${mergeOptions.join(', ')}`);\n }\n mergeStrategy = merge;\n }\n if (alias) {\n throwForInvalidLaneName(alias);\n }\n\n const switchProps = {\n laneName,\n existingOnWorkspaceOnly: !getAll,\n pattern,\n alias,\n };\n const checkoutProps = {\n mergeStrategy,\n skipNpmInstall: skipDependencyInstallation,\n verbose: false, // not relevant in Harmony\n ignorePackageJson: true, // not relevant in Harmony\n ignoreDist: true, // not relevant in Harmony\n isLane: true,\n promptMergeOptions: false,\n writeConfig: false,\n reset: false,\n all: false,\n };\n return new LaneSwitcher(this.workspace, this.logger, switchProps, checkoutProps, this).switch();\n }\n\n /**\n * the values array may include zero to two values and will be processed as following:\n * [] => diff between the current lane and default lane. (only inside workspace).\n * [to] => diff between the current lane (or default-lane when in scope) and \"to\" lane.\n * [from, to] => diff between \"from\" lane and \"to\" lane.\n */\n public async getDiff(values: string[], diffOptions: DiffOptions = {}, pattern?: string): Promise<LaneDiffResults> {\n const laneDiffGenerator = new LaneDiffGenerator(this.workspace, this.scope);\n return laneDiffGenerator.generate(values, diffOptions, pattern);\n }\n\n async getLaneComponentModels(lane: LaneData): Promise<Component[]> {\n const host = this.componentAspect.getHost();\n const laneComponentIds = await this.getLaneComponentIds(lane);\n const components = await host.getMany(laneComponentIds);\n return components;\n }\n\n async getLaneComponentIds(lane: LaneData): Promise<ComponentID[]> {\n if (!lane) return [];\n\n const laneComponents = lane.components;\n const workspace = this.workspace;\n const bitIdsFromBitmap = workspace ? workspace.consumer.bitMap.getAllBitIdsFromAllLanes() : [];\n\n const filteredComponentIds = workspace\n ? laneComponents.filter((laneComponent) =>\n bitIdsFromBitmap.some((bitmapComponentId) => bitmapComponentId.isEqualWithoutVersion(laneComponent.id))\n )\n : laneComponents;\n\n const host = this.componentAspect.getHost();\n\n return Promise.all(\n filteredComponentIds.map((laneComponent) => {\n const legacyIdWithVersion = laneComponent.id.changeVersion(laneComponent.head);\n return host.resolveComponentId(legacyIdWithVersion);\n })\n );\n }\n\n async getLaneReadmeComponent(lane: LaneData): Promise<Component | undefined> {\n if (!lane) return undefined;\n const laneReadmeComponent = lane.readmeComponent;\n if (!laneReadmeComponent) return undefined;\n const host = this.componentAspect.getHost();\n const laneReadmeComponentId = await host.resolveComponentId(\n laneReadmeComponent.id.changeVersion(laneReadmeComponent.head)\n );\n const readmeComponent = await host.get(laneReadmeComponentId);\n return readmeComponent;\n }\n\n async removeLaneReadme(laneName?: string): Promise<{ result: boolean; message?: string }> {\n if (!this.workspace) {\n throw new BitError('unable to remove the lane readme component outside of Bit workspace');\n }\n const currentLaneName = this.getCurrentLaneName();\n\n if (!laneName && !currentLaneName) {\n return {\n result: false,\n message: 'unable to remove the lane readme component. Either pass a laneName or switch to a lane',\n };\n }\n\n const scope: LegacyScope = this.workspace.scope.legacyScope;\n const laneId: LaneId = laneName\n ? await scope.lanes.parseLaneIdFromString(laneName)\n : (this.getCurrentLaneId() as LaneId);\n const lane: Lane | null | undefined = await scope.loadLane(laneId);\n\n if (!lane?.readmeComponent) {\n throw new BitError(`there is no readme component added to the lane ${laneName || currentLaneName}`);\n }\n\n const readmeComponentId = await this.workspace.resolveComponentId(lane.readmeComponent.id);\n const existingLaneConfig =\n (await this.workspace.getSpecificComponentConfig(readmeComponentId, LanesAspect.id)) || {};\n\n const remoteLaneIdStr = lane.toLaneId().toString();\n\n if (existingLaneConfig.readme) {\n delete existingLaneConfig.readme[remoteLaneIdStr];\n await this.workspace.removeSpecificComponentConfig(readmeComponentId, LanesAspect.id, false);\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, existingLaneConfig);\n }\n\n lane.setReadmeComponent(undefined);\n await scope.lanes.saveLane(lane);\n await this.workspace.bitMap.write();\n\n return { result: true };\n }\n\n async diffStatus(\n sourceLaneId: LaneId,\n targetLaneId?: LaneId,\n options?: LaneDiffStatusOptions\n ): Promise<LaneDiffStatus> {\n const sourceLaneComponents = sourceLaneId.isDefault()\n ? (await this.getLaneDataOfDefaultLane())?.components.map((main) => ({ id: main.id, head: Ref.from(main.head) }))\n : (await this.loadLane(sourceLaneId))?.components;\n\n const targetLane = targetLaneId ? await this.loadLane(targetLaneId) : undefined;\n const targetLaneIds = targetLane?.toBitIds();\n const host = this.componentAspect.getHost();\n\n const targetMainHeads =\n !targetLaneId || targetLaneId?.isDefault()\n ? compact(\n await Promise.all(\n (sourceLaneComponents || []).map(async ({ id }) => {\n const componentId = await host.resolveComponentId(id);\n const headOnMain = await this.getHeadOnMain(componentId);\n return headOnMain ? id.changeVersion(headOnMain) : undefined;\n })\n )\n )\n : [];\n\n await this.importer.importObjectsFromMainIfExist(targetMainHeads);\n\n const diffProps = compact(\n await Promise.all(\n (sourceLaneComponents || []).map(async ({ id, head }) => {\n const componentId = await host.resolveComponentId(id);\n const sourceVersionObj = (await this.scope.legacyScope.objects.load(head, true)) as Version;\n\n if (sourceVersionObj.isRemoved()) {\n return null;\n }\n\n const headOnTargetLane = targetLaneIds\n ? targetLaneIds.searchWithoutVersion(id)?.version\n : await this.getHeadOnMain(componentId);\n\n if (headOnTargetLane) {\n const targetVersionObj = (await this.scope.legacyScope.objects.load(\n Ref.from(headOnTargetLane),\n true\n )) as Version;\n\n if (targetVersionObj.isRemoved()) {\n return null;\n }\n }\n\n const sourceHead = head.toString();\n const targetHead = headOnTargetLane;\n\n return { componentId, sourceHead, targetHead };\n })\n )\n );\n\n const results = await pMapSeries(diffProps, async ({ componentId, sourceHead, targetHead }) =>\n this.componentDiffStatus(componentId, sourceHead, targetHead, options)\n );\n\n return {\n source: sourceLaneId,\n target: targetLaneId || this.getDefaultLaneId(),\n componentsStatus: results,\n };\n }\n\n async componentDiffStatus(\n componentId: ComponentID,\n sourceHead: string,\n targetHead?: string,\n options?: LaneDiffStatusOptions\n ): Promise<LaneComponentDiffStatus> {\n const snapsDistance = await this.getSnapsDistance(componentId, sourceHead, targetHead, false);\n\n if (snapsDistance?.err) {\n const noCommonSnap = snapsDistance.err instanceof NoCommonSnap;\n\n return {\n componentId,\n sourceHead,\n targetHead,\n upToDate: snapsDistance?.isUpToDate(),\n unrelated: noCommonSnap || undefined,\n changes: [],\n };\n }\n\n const commonSnap = snapsDistance?.commonSnapBeforeDiverge;\n\n const getChanges = async (): Promise<ChangeType[]> => {\n if (!commonSnap) return [ChangeType.NEW];\n\n const compare = await this.componentCompare.compare(\n componentId.changeVersion(commonSnap.hash).toString(),\n componentId.changeVersion(sourceHead).toString()\n );\n\n if (!compare.fields.length && (!compare.code.length || !compare.code.some((c) => c.status !== 'UNCHANGED'))) {\n return [ChangeType.NONE];\n }\n\n const changed: ChangeType[] = [];\n\n if (compare.code.some((f) => f.status !== 'UNCHANGED')) {\n changed.push(ChangeType.SOURCE_CODE);\n }\n\n if (compare.fields.length > 0) {\n changed.push(ChangeType.ASPECTS);\n }\n\n const depsFields = ['dependencies', 'devDependencies', 'extensionDependencies'];\n if (compare.fields.some((field) => depsFields.includes(field.fieldName))) {\n changed.push(ChangeType.DEPENDENCY);\n }\n\n return changed;\n };\n\n const changes = !options?.skipChanges ? await getChanges() : undefined;\n const changeType = changes ? changes[0] : undefined;\n\n return {\n componentId,\n changeType,\n changes,\n sourceHead,\n targetHead: commonSnap?.hash,\n upToDate: snapsDistance?.isUpToDate(),\n snapsDistance: {\n onSource: snapsDistance?.snapsOnSourceOnly.map((s) => s.hash) ?? [],\n onTarget: snapsDistance?.snapsOnTargetOnly.map((s) => s.hash) ?? [],\n common: snapsDistance?.commonSnapBeforeDiverge?.hash,\n },\n };\n }\n\n private async recreateNewLaneIfDeleted() {\n if (!this.workspace) return;\n const laneId = this.getCurrentLaneId();\n if (!laneId || laneId.isDefault() || this.workspace.consumer.bitMap.isLaneExported) {\n return;\n }\n const laneObj = await this.scope.legacyScope.getCurrentLaneObject();\n if (laneObj) {\n return;\n }\n await this.createLane(laneId.name, { scope: laneId.scope });\n }\n\n async addLaneReadme(readmeComponentIdStr: string, laneName?: string): Promise<{ result: boolean; message?: string }> {\n if (!this.workspace) {\n throw new BitError(`unable to track a lane readme component outside of Bit workspace`);\n }\n const readmeComponentId = await this.workspace.resolveComponentId(readmeComponentIdStr);\n\n const readmeComponentBitId = readmeComponentId._legacy;\n const scope: LegacyScope = this.workspace.scope.legacyScope;\n const laneId: LaneId = laneName\n ? await scope.lanes.parseLaneIdFromString(laneName)\n : (this.getCurrentLaneId() as LaneId);\n\n const lane: Lane | null | undefined = await scope.loadLane(laneId);\n\n if (!lane) {\n return { result: false, message: `cannot find lane ${laneName}` };\n }\n\n lane.setReadmeComponent(readmeComponentBitId);\n await scope.lanes.saveLane(lane);\n\n const existingLaneConfig =\n (await this.workspace.getSpecificComponentConfig(readmeComponentId, LanesAspect.id)) || {};\n\n const remoteLaneIdStr = lane.toLaneId().toString();\n\n if (existingLaneConfig.readme) {\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, {\n ...existingLaneConfig,\n readme: {\n ...existingLaneConfig.readme,\n [remoteLaneIdStr]: true,\n },\n });\n } else {\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, {\n ...existingLaneConfig,\n readme: {\n [remoteLaneIdStr]: true,\n },\n });\n }\n await this.workspace.bitMap.write();\n return { result: true };\n }\n\n /**\n * if the local lane was forked from another lane, this gets the differences between the two.\n * it also fetches the original lane from the remote to make sure the data is up to date.\n */\n async listUpdatesFromForked(componentsList: ComponentsList): Promise<DivergeDataPerId[]> {\n const consumer = this.workspace?.consumer;\n if (!consumer) throw new Error(`unable to get listUpdatesFromForked outside of a workspace`);\n if (consumer.isOnMain()) {\n return [];\n }\n const lane = await consumer.getCurrentLaneObject();\n const forkedFromLaneId = lane?.forkedFrom;\n if (!forkedFromLaneId) {\n return [];\n }\n const forkedFromLane = await consumer.scope.loadLane(forkedFromLaneId);\n if (!forkedFromLane) return []; // should we fetch it here?\n\n const workspaceIds = consumer.bitMap.getAllBitIds();\n\n const duringMergeIds = componentsList.listDuringMergeStateComponents();\n\n const componentsFromModel = await componentsList.getModelComponents();\n const compFromModelOnWorkspace = componentsFromModel\n .filter((c) => workspaceIds.hasWithoutVersion(c.toBitId()))\n // if a component is merge-pending, it needs to be resolved first before getting more updates from main\n .filter((c) => !duringMergeIds.hasWithoutVersion(c.toBitId()));\n\n // by default, when on a lane, forked is not fetched. we need to fetch it to get the latest updates.\n await this.fetchLaneWithItsComponents(forkedFromLaneId);\n\n const remoteForkedLane = await consumer.scope.objects.remoteLanes.getRemoteLane(forkedFromLaneId);\n if (!remoteForkedLane.length) return [];\n\n const results = await Promise.all(\n compFromModelOnWorkspace.map(async (modelComponent) => {\n const headOnForked = remoteForkedLane.find((c) => c.id.isEqualWithoutVersion(modelComponent.toBitId()));\n const headOnLane = modelComponent.laneHeadLocal;\n if (!headOnForked || !headOnLane) return undefined;\n const divergeData = await getDivergeData({\n repo: consumer.scope.objects,\n modelComponent,\n targetHead: headOnForked.head,\n sourceHead: headOnLane,\n throws: false,\n });\n if (!divergeData.snapsOnTargetOnly.length && !divergeData.err) return undefined;\n return { id: modelComponent.toBitId(), divergeData };\n })\n );\n\n return compact(results);\n }\n\n private async getLaneDataOfDefaultLane(): Promise<LaneData | null> {\n const consumer = this.workspace?.consumer;\n let bitIds: BitId[] = [];\n if (!consumer) {\n const scopeComponents = await this.scope.list();\n bitIds = scopeComponents.filter((component) => component.head).map((component) => component.id._legacy);\n } else {\n bitIds = await consumer.getIdsOfDefaultLane();\n }\n\n return {\n name: DEFAULT_LANE,\n remote: null,\n id: this.getDefaultLaneId(),\n components: bitIds.map((bitId) => ({ id: bitId, head: bitId.version as string })),\n isMerged: null,\n hash: '',\n };\n }\n\n get createRoutePath() {\n return '/lanes/create';\n }\n\n get deleteRoutePath() {\n return '/lanes/delete';\n }\n\n get restoreRoutePath() {\n return '/lanes/restore';\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n ScopeAspect,\n WorkspaceAspect,\n GraphqlAspect,\n MergingAspect,\n ComponentAspect,\n LoggerAspect,\n ImporterAspect,\n ExportAspect,\n ExpressAspect,\n ComponentCompareAspect,\n ComponentWriterAspect,\n RemoveAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n scope,\n workspace,\n graphql,\n merging,\n component,\n loggerMain,\n importer,\n exporter,\n express,\n componentCompare,\n componentWriter,\n remove,\n ]: [\n CLIMain,\n ScopeMain,\n Workspace,\n GraphqlMain,\n MergingMain,\n ComponentMain,\n LoggerMain,\n ImporterMain,\n ExportMain,\n ExpressMain,\n ComponentCompareMain,\n ComponentWriterMain,\n RemoveMain\n ]) {\n const logger = loggerMain.createLogger(LanesAspect.id);\n const lanesMain = new LanesMain(\n workspace,\n scope,\n merging,\n component,\n logger,\n importer,\n exporter,\n componentCompare,\n componentWriter,\n remove\n );\n const switchCmd = new SwitchCmd(lanesMain);\n const laneCmd = new LaneCmd(lanesMain, workspace, scope);\n laneCmd.commands = [\n new LaneListCmd(lanesMain, workspace, scope),\n switchCmd,\n new LaneShowCmd(lanesMain, workspace, scope),\n new LaneCreateCmd(lanesMain),\n new LaneRemoveCmd(lanesMain),\n new LaneChangeScopeCmd(lanesMain),\n new LaneAliasCmd(lanesMain),\n new LaneRenameCmd(lanesMain),\n new LaneDiffCmd(workspace, scope),\n new LaneAddReadmeCmd(lanesMain),\n new LaneRemoveReadmeCmd(lanesMain),\n new LaneImportCmd(switchCmd),\n new LaneRemoveCompCmd(workspace, lanesMain),\n ];\n cli.register(laneCmd, switchCmd);\n cli.registerOnStart(async () => {\n await lanesMain.recreateNewLaneIfDeleted();\n });\n graphql.register(lanesSchema(lanesMain));\n express.register([\n new LanesCreateRoute(lanesMain, logger),\n new LanesDeleteRoute(lanesMain, logger),\n new LanesRestoreRoute(lanesMain, logger),\n ]);\n return lanesMain;\n }\n}\n\nLanesAspect.addRuntime(LanesMain);\n\nexport default LanesMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,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AO,CAACsB,QAAQ,CAAC,IAAAE,qBAAW,EAACpB,SAAS,CAAC,CAAC;IACxCF,OAAO,CAACoB,QAAQ,CAAC,CACf,KAAIG,+BAAgB,EAACrB,SAAS,EAAEjW,MAAM,CAAC,EACvC,KAAIuX,+BAAgB,EAACtB,SAAS,EAAEjW,MAAM,CAAC,EACvC,KAAIwX,iCAAiB,EAACvB,SAAS,EAAEjW,MAAM,CAAC,CACzC,CAAC;IACF,OAAOiW,SAAS;EAClB;AACF;AAACwB,OAAA,CAAA/X,SAAA,GAAAA,SAAA;AAAA,IAAAL,gBAAA,GAAAC,OAAA,EA39BYI,SAAS,WAm4BL,EAAE;AAAA,IAAAL,gBAAA,GAAAC,OAAA,EAn4BNI,SAAS,kBAo4BE,CACpBgY,gBAAS,EACTC,oBAAW,EACXC,4BAAe,EACfC,wBAAa,EACbC,wBAAa,EACbC,oBAAe,EACfC,sBAAY,EACZC,0BAAc,EACdC,sBAAY,EACZC,wBAAa,EACbC,0CAAsB,EACtBC,0BAAqB,EACrBC,iBAAY,CACb;AAAA,IAAAjZ,gBAAA,GAAAC,OAAA,EAl5BUI,SAAS,aAm5BH6Y,kBAAW;AA0E9BrJ,oBAAW,CAACsJ,UAAU,CAAC9Y,SAAS,CAAC;AAAC,IAAA+Y,QAAA,GAEnB/Y,SAAS;AAAA+X,OAAA,CAAAnY,OAAA,GAAAmZ,QAAA"}
1
+ {"version":3,"names":["_cli","data","require","_scope","_pMapSeries","_interopRequireDefault","_graphql","_express","_workspace","_getRemoteByName","_lanesModules","_laneId","_bitError","_logger","_mergeVersion","_importer","_component","_removeLanes","_models","_getDivergeData","_legacyBitId","_export","_bitId","_lodash","_componentCompare","_objects","_componentWriter","_remove","_merging","_checkout","_lanesEntities","_exceptions","_noCommonSnap","_lanes","_lane","_lanes2","_switch","_switchLanes","_createLane","_lanesCreate","_lanesDelete","_lanesRestore","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","LanesMain","constructor","workspace","scope","merging","componentAspect","logger","importer","exporter","componentCompare","componentWriter","remove","checkout","getLanes","name","remote","merged","showDefaultLane","notMerged","_this$workspace","showMergeData","Boolean","consumer","laneId","LaneId","from","undefined","remoteObj","getRemoteByName","lanes","listLanes","toString","DEFAULT_LANE","defaultLane","getLaneDataOfDefaultLane","legacyScope","getLanesData","filterSoftRemovedLaneComps","parseLaneId","idStr","parseLaneIdFromString","Promise","all","map","lane","id","isDefault","componentIds","compact","getLaneComponentIds","laneCompId","isComponentRemoved","err","ComponentNotFound","warn","_legacy","head","version","laneData","components","getCurrentLaneName","_this$getCurrentLaneI","getCurrentLaneId","getCurrentLaneNameOrAlias","currentLaneId","trackingData","getLocalTrackedLaneByRemoteName","getCurrentLane","loadLane","getDefaultLaneId","setCurrentLane","alias","exported","_this$workspace2","createLane","forkLaneNewScope","newLane","createLaneInScope","toLaneId","hash","throwForInvalidLaneName","currentLaneScope","BitError","defaultScope","laneObj","trackLaneData","localLane","remoteLane","remoteScope","trackLane","scopeJson","setLaneAsNew","onDestroy","results","localName","remoteName","beforeTrackData","getRemoteTrackedDataByLocalLane","beforeTrackDataCloned","afterTrackData","aliasLane","laneName","includes","LANE_REMOTE_DELIMITER","trackData","laneNameWithoutScope","split","removeTrackLane","changeScope","isNew","isValidScopeName","InvalidScopeName","remoteScopeBefore","newLaneId","saveLane","bitMap","rename","currentName","newName","existingAliasWithNewName","remoteIdStr","objects","remoteLanes","renameRefByNewLaneName","isEqual","isExported","isLaneExported","clonedLaneToExport","clone","exportErr","exportLane","error","message","exportMany","laneObject","ids","BitIds","idsWithFutureScope","allVersions","importLaneObject","persistIfNotExists","getSnapsDistance","componentId","sourceHead","targetHead","throws","Error","modelComponent","getModelComponent","getDivergeData","repo","Ref","getHeadOnMain","_modelComponent$head","fetchLaneWithItsComponents","debug","fetchLaneComponents","removeLanes","laneNames","opts","_this$workspace3","force","laneResults","restoreLane","laneHash","ref","objectsFromTrash","getFromTrash","laneIdFromTrash","existingWithSameId","restoreFromTrash","removeComps","componentsPattern","removeCompsOpts","OutsideWorkspaceError","currentLane","getCurrentLaneObject","workspaceOnly","localResult","removedComponentIds","compIds","resolveMultipleComponentIds","removedFromWs","markedRemoved","idsByPattern","laneBitIds","toBitIds","laneCompIds","mainCompIds","partition","hasWithoutVersion","removeFromWorkspace","removeLocallyByIds","markRemoveComps","switchLanes","merge","pattern","getAll","skipDependencyInstallation","mergeStrategy","mergeOptions","MergeOptions","join","switchProps","existingOnWorkspaceOnly","checkoutProps","skipNpmInstall","verbose","ignorePackageJson","ignoreDist","isLane","promptMergeOptions","writeConfig","reset","LaneSwitcher","switch","getDiff","values","diffOptions","laneDiffGenerator","LaneDiffGenerator","generate","getLaneComponentModels","host","getHost","laneComponentIds","getMany","laneComponents","bitIdsFromBitmap","getAllBitIdsFromAllLanes","filteredComponentIds","laneComponent","some","bitmapComponentId","isEqualWithoutVersion","legacyIdWithVersion","changeVersion","resolveComponentId","getLaneReadmeComponent","laneReadmeComponent","readmeComponent","laneReadmeComponentId","get","removeLaneReadme","currentLaneName","result","readmeComponentId","existingLaneConfig","getSpecificComponentConfig","LanesAspect","remoteLaneIdStr","readme","removeSpecificComponentConfig","addSpecificComponentConfig","setReadmeComponent","write","diffStatus","sourceLaneId","targetLaneId","options","_await$this$getLaneDa","_await$this$loadLane","sourceLaneComponents","main","targetLane","targetLaneIds","targetMainHeads","headOnMain","importObjectsFromMainIfExist","diffProps","_targetLaneIds$search","sourceVersionObj","load","isRemoved","headOnTargetLane","searchWithoutVersion","targetVersionObj","pMapSeries","componentDiffStatus","componentsStatus","_snapsDistance$snapsO","_snapsDistance$snapsO2","_snapsDistance$common","snapsDistance","noCommonSnap","NoCommonSnap","upToDate","isUpToDate","unrelated","changes","commonSnap","commonSnapBeforeDiverge","getChanges","ChangeType","NEW","compare","fields","code","c","status","NONE","changed","f","SOURCE_CODE","ASPECTS","depsFields","field","fieldName","DEPENDENCY","skipChanges","changeType","onSource","snapsOnSourceOnly","s","onTarget","snapsOnTargetOnly","common","recreateNewLaneIfDeleted","addLaneReadme","readmeComponentIdStr","readmeComponentBitId","listUpdatesFromForked","componentsList","_this$workspace4","isOnMain","forkedFromLaneId","forkedFrom","forkedFromLane","workspaceIds","getAllBitIds","duringMergeIds","listDuringMergeStateComponents","componentsFromModel","getModelComponents","compFromModelOnWorkspace","toBitId","remoteForkedLane","getRemoteLane","headOnForked","find","headOnLane","laneHeadLocal","divergeData","_this$workspace5","bitIds","scopeComponents","list","component","getIdsOfDefaultLane","bitId","isMerged","createRoutePath","deleteRoutePath","restoreRoutePath","provider","cli","graphql","loggerMain","express","createLogger","lanesMain","switchCmd","SwitchCmd","laneCmd","LaneCmd","commands","LaneListCmd","LaneShowCmd","LaneCreateCmd","LaneRemoveCmd","LaneChangeScopeCmd","LaneAliasCmd","LaneRenameCmd","LaneDiffCmd","LaneAddReadmeCmd","LaneRemoveReadmeCmd","LaneImportCmd","LaneRemoveCompCmd","register","registerOnStart","lanesSchema","LanesCreateRoute","LanesDeleteRoute","LanesRestoreRoute","exports","CLIAspect","ScopeAspect","WorkspaceAspect","GraphqlAspect","MergingAspect","ComponentAspect","LoggerAspect","ImporterAspect","ExportAspect","ExpressAspect","ComponentCompareAspect","ComponentWriterAspect","RemoveAspect","CheckoutAspect","MainRuntime","addRuntime","_default"],"sources":["lanes.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport { OutsideWorkspaceError, Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport getRemoteByName from '@teambit/legacy/dist/remotes/get-remote-by-name';\nimport { LaneDiffCmd, LaneDiffGenerator, LaneDiffResults } from '@teambit/lanes.modules.diff';\nimport { LaneData } from '@teambit/legacy/dist/scope/lanes/lanes';\nimport { LaneId, DEFAULT_LANE, LANE_REMOTE_DELIMITER } from '@teambit/lane-id';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { DiffOptions } from '@teambit/legacy/dist/consumer/component-ops/components-diff';\nimport { MergeStrategy, MergeOptions } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { TrackLane } from '@teambit/legacy/dist/scope/scope-json';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport removeLanes from '@teambit/legacy/dist/consumer/lanes/remove-lanes';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Scope as LegacyScope } from '@teambit/legacy/dist/scope';\nimport { BitId, InvalidScopeName, isValidScopeName } from '@teambit/legacy-bit-id';\nimport { ExportAspect, ExportMain } from '@teambit/export';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { compact, partition } from 'lodash';\nimport { ComponentCompareMain, ComponentCompareAspect } from '@teambit/component-compare';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { MergingMain, MergingAspect } from '@teambit/merging';\nimport CheckoutAspect, { CheckoutMain } from '@teambit/checkout';\nimport { ChangeType } from '@teambit/lanes.entities.lane-diff';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { LanesAspect } from './lanes.aspect';\nimport {\n LaneCmd,\n LaneCreateCmd,\n LaneImportCmd,\n LaneListCmd,\n LaneRemoveCmd,\n LaneShowCmd,\n LaneChangeScopeCmd,\n LaneAliasCmd,\n LaneRenameCmd,\n LaneAddReadmeCmd,\n LaneRemoveReadmeCmd,\n LaneRemoveCompCmd,\n RemoveCompsOpts,\n} from './lane.cmd';\nimport { lanesSchema } from './lanes.graphql';\nimport { SwitchCmd } from './switch.cmd';\nimport { LaneSwitcher } from './switch-lanes';\nimport { createLane, createLaneInScope, throwForInvalidLaneName } from './create-lane';\nimport { LanesCreateRoute } from './lanes.create.route';\nimport { LanesDeleteRoute } from './lanes.delete.route';\nimport { LanesRestoreRoute } from './lanes.restore.route';\n\nexport { Lane };\n\nexport type SnapsDistanceObj = {\n onSource: string[];\n onTarget: string[];\n common?: string;\n};\n\nexport type LaneResults = {\n lanes: LaneData[];\n currentLane?: string | null;\n};\n\nexport type CreateLaneOptions = {\n scope?: string; // default to the defaultScope in workspace.jsonc\n alias?: string; // default to the remote name\n forkLaneNewScope?: boolean;\n};\n\nexport type SwitchLaneOptions = {\n alias?: string;\n merge?: MergeStrategy;\n getAll?: boolean;\n pattern?: string;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n override?: boolean;\n};\n\nexport type LaneComponentDiffStatus = {\n componentId: ComponentID;\n sourceHead: string;\n targetHead?: string;\n /**\n * @deprecated\n * use changes to get list of all the changes\n */\n changeType?: ChangeType;\n changes?: ChangeType[];\n upToDate?: boolean;\n snapsDistance?: SnapsDistanceObj;\n unrelated?: boolean;\n};\n\nexport type LaneDiffStatusOptions = {\n skipChanges?: boolean;\n};\n\nexport type LaneDiffStatus = {\n source: LaneId;\n target: LaneId;\n componentsStatus: LaneComponentDiffStatus[];\n};\n\nexport type MarkRemoveOnLaneResult = { removedFromWs: ComponentID[]; markedRemoved: ComponentID[] };\n\ntype CreateLaneResult = {\n laneId: LaneId;\n hash: string;\n alias?: string;\n};\n\nexport class LanesMain {\n constructor(\n private workspace: Workspace | undefined,\n private scope: ScopeMain,\n private merging: MergingMain,\n private componentAspect: ComponentMain,\n public logger: Logger,\n readonly importer: ImporterMain,\n private exporter: ExportMain,\n private componentCompare: ComponentCompareMain,\n readonly componentWriter: ComponentWriterMain,\n private remove: RemoveMain,\n readonly checkout: CheckoutMain\n ) {}\n\n async getLanes({\n name,\n remote,\n merged,\n showDefaultLane,\n notMerged,\n }: {\n name?: string;\n remote?: string;\n merged?: boolean;\n showDefaultLane?: boolean;\n notMerged?: boolean;\n }): Promise<LaneData[]> {\n const showMergeData = Boolean(merged || notMerged);\n const consumer = this.workspace?.consumer;\n\n if (remote) {\n const laneId = name ? LaneId.from(name, remote) : undefined;\n const remoteObj = await getRemoteByName(remote, consumer);\n const lanes = await remoteObj.listLanes(laneId?.toString(), showMergeData);\n // no need to filter soft-removed here. it was filtered already in the remote\n return lanes;\n }\n\n if (name === DEFAULT_LANE) {\n const defaultLane = await this.getLaneDataOfDefaultLane();\n return defaultLane ? [defaultLane] : [];\n }\n\n const lanes = await this.scope.legacyScope.lanes.getLanesData(this.scope.legacyScope, name, showMergeData);\n\n if (showDefaultLane) {\n const defaultLane = await this.getLaneDataOfDefaultLane();\n if (defaultLane) lanes.push(defaultLane);\n }\n\n return this.filterSoftRemovedLaneComps(lanes);\n }\n\n async parseLaneId(idStr: string): Promise<LaneId> {\n const scope: LegacyScope = this.scope.legacyScope;\n return scope.lanes.parseLaneIdFromString(idStr);\n }\n\n private async filterSoftRemovedLaneComps(lanes: LaneData[]): Promise<LaneData[]> {\n return Promise.all(\n lanes.map(async (lane) => {\n if (lane.id.isDefault()) return lane;\n\n const componentIds = compact(\n await Promise.all(\n (\n await this.getLaneComponentIds(lane)\n ).map(async (laneCompId) => {\n try {\n if (await this.scope.isComponentRemoved(laneCompId)) return undefined;\n } catch (err) {\n // if (err instanceof ComponentNotFound)\n // throw new Error(\n // `component \"${laneCompId.toString()}\" from the lane \"${lane.id.toString()}\" not found`\n // );\n // throw err;\n if (err instanceof ComponentNotFound)\n this.logger.warn(\n `component \"${laneCompId.toString()}\" from the lane \"${lane.id.toString()}\" not found`\n );\n\n return undefined;\n }\n return { id: laneCompId._legacy, head: laneCompId.version as string };\n })\n )\n );\n\n const laneData: LaneData = {\n ...lane,\n components: componentIds,\n };\n return laneData;\n })\n );\n }\n\n getCurrentLaneName(): string | null {\n return this.getCurrentLaneId()?.name || null;\n }\n\n getCurrentLaneNameOrAlias(): string | null {\n const currentLaneId = this.getCurrentLaneId();\n if (!currentLaneId) return null;\n const trackingData = this.scope.legacyScope.lanes.getLocalTrackedLaneByRemoteName(\n currentLaneId.name,\n currentLaneId.scope\n );\n return trackingData || currentLaneId.name;\n }\n\n getCurrentLaneId(): LaneId | null {\n if (!this.workspace) return null;\n return this.workspace.consumer.getCurrentLaneId();\n }\n\n /**\n * get the currently checked out lane object, if on main - return null.\n */\n async getCurrentLane(): Promise<Lane | null> {\n const laneId = this.getCurrentLaneId();\n if (!laneId || laneId.isDefault()) return null;\n return this.loadLane(laneId);\n }\n\n getDefaultLaneId(): LaneId {\n return LaneId.from(DEFAULT_LANE, this.scope.name);\n }\n\n setCurrentLane(laneId: LaneId, alias?: string, exported?: boolean) {\n this.workspace?.consumer.setCurrentLane(laneId, exported);\n }\n\n async createLane(\n name: string,\n { scope, alias, forkLaneNewScope }: CreateLaneOptions = {}\n ): Promise<CreateLaneResult> {\n if (!this.workspace) {\n const newLane = await createLaneInScope(name, this.scope);\n return {\n laneId: newLane.toLaneId(),\n hash: newLane.hash().toString(),\n };\n }\n if (alias) {\n throwForInvalidLaneName(alias);\n }\n const currentLaneId = this.workspace.getCurrentLaneId();\n const currentLaneScope = currentLaneId.isDefault() ? undefined : currentLaneId.scope;\n if (!forkLaneNewScope && !currentLaneId.isDefault() && scope && currentLaneScope !== scope) {\n throw new BitError(`you're about to create a lane forked from ${currentLaneId.toString()} and assign it to a different scope \"${scope}\".\nif the lane components have a large history, it would be best to stick with the same scope as the current lane.\nto do that, re-run the command without the \"--scope\" flag. it will create the lane and set the scope to \"${currentLaneScope}\"\nif you wish to keep ${scope} scope, please re-run the command with \"--fork-lane-new-scope\" flag.`);\n }\n scope = scope || (currentLaneId.isDefault() ? this.workspace.defaultScope : currentLaneId.scope);\n const laneObj = await createLane(this.workspace, name, scope);\n const laneId = LaneId.from(name, scope);\n this.setCurrentLane(laneId, alias, false);\n const trackLaneData = {\n localLane: alias || name,\n remoteLane: name,\n remoteScope: scope,\n };\n this.scope.legacyScope.lanes.trackLane(trackLaneData);\n this.scope.legacyScope.scopeJson.setLaneAsNew(name);\n await this.workspace.consumer.onDestroy();\n\n const results = {\n alias,\n laneId: laneObj.toLaneId(),\n hash: laneObj.hash().toString(),\n };\n return results;\n }\n\n async loadLane(id: LaneId): Promise<Lane | null> {\n return this.scope.legacyScope.lanes.loadLane(id);\n }\n\n async trackLane(\n localName: string,\n remoteScope: string,\n remoteName?: string\n ): Promise<{ beforeTrackData?: TrackLane; afterTrackData: TrackLane }> {\n if (!this.workspace) {\n throw new BitError(`unable to track a lane outside of Bit workspace`);\n }\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(localName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${localName}\"`);\n }\n const beforeTrackData = this.scope.legacyScope.lanes.getRemoteTrackedDataByLocalLane(localName);\n const beforeTrackDataCloned = beforeTrackData ? { ...beforeTrackData } : undefined;\n const afterTrackData = {\n localLane: localName,\n remoteLane: remoteName || beforeTrackData?.remoteLane || localName,\n remoteScope,\n };\n this.scope.legacyScope.lanes.trackLane(afterTrackData);\n await this.workspace.consumer.onDestroy();\n\n return { beforeTrackData: beforeTrackDataCloned, afterTrackData };\n }\n\n async aliasLane(laneName: string, alias: string): Promise<{ laneId: LaneId }> {\n if (!this.workspace) {\n throw new BitError(`unable to alias a lane outside of Bit workspace`);\n }\n if (alias.includes(LANE_REMOTE_DELIMITER)) {\n throw new BitError(`an alias cannot include a delimiter \"${LANE_REMOTE_DELIMITER}\"`);\n }\n if (alias === laneName) {\n throw new BitError(`an alias cannot be the same as the lane name`);\n }\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(laneName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${laneName}\"`);\n }\n const trackData = {\n localLane: alias,\n remoteLane: laneId.name,\n remoteScope: laneId.scope,\n };\n const laneNameWithoutScope = laneName.includes(LANE_REMOTE_DELIMITER)\n ? laneName.split(LANE_REMOTE_DELIMITER)[1]\n : laneName;\n this.scope.legacyScope.lanes.removeTrackLane(laneNameWithoutScope);\n this.scope.legacyScope.lanes.trackLane(trackData);\n await this.workspace.consumer.onDestroy();\n\n return { laneId };\n }\n\n async changeScope(laneName: string, remoteScope: string): Promise<{ remoteScopeBefore: string }> {\n if (!this.workspace) {\n throw new BitError(`unable to change-scope of a lane outside of Bit workspace`);\n }\n const laneNameWithoutScope = laneName.includes(LANE_REMOTE_DELIMITER)\n ? laneName.split(LANE_REMOTE_DELIMITER)[1]\n : laneName;\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(laneName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${laneName}\"`);\n }\n if (!lane.isNew) {\n throw new BitError(`changing lane scope-name is allowed for new lanes only. this lane has been exported already.\nplease create a new lane instead, which will include all components of this lane`);\n }\n if (!isValidScopeName(remoteScope)) {\n throw new InvalidScopeName(remoteScope);\n }\n const remoteScopeBefore = lane.scope;\n lane.scope = remoteScope;\n const newLaneId = LaneId.from(laneId.name, remoteScope);\n const trackData = {\n localLane: laneNameWithoutScope,\n remoteLane: laneId.name,\n remoteScope,\n };\n this.scope.legacyScope.lanes.trackLane(trackData);\n await this.scope.legacyScope.lanes.saveLane(lane);\n this.workspace.consumer.bitMap.setCurrentLane(newLaneId, false);\n await this.workspace.consumer.onDestroy();\n\n return { remoteScopeBefore };\n }\n\n /**\n * change a lane-name and if possible, export the lane to the remote\n */\n async rename(currentName: string, newName: string): Promise<{ exported: boolean; exportErr?: Error }> {\n if (!this.workspace) {\n throw new BitError(`unable to rename a lane outside of Bit workspace`);\n }\n throwForInvalidLaneName(newName);\n const existingAliasWithNewName = this.scope.legacyScope.lanes.getRemoteTrackedDataByLocalLane(newName);\n if (existingAliasWithNewName) {\n const remoteIdStr = `${existingAliasWithNewName.remoteLane}/${existingAliasWithNewName.remoteScope}`;\n throw new BitError(`unable to rename to ${newName}. this name is already used to track: ${remoteIdStr}`);\n }\n const laneNameWithoutScope = currentName.includes(LANE_REMOTE_DELIMITER)\n ? currentName.split(LANE_REMOTE_DELIMITER)[1]\n : currentName;\n const laneId = await this.scope.legacyScope.lanes.parseLaneIdFromString(currentName);\n const lane = await this.loadLane(laneId);\n if (!lane) {\n throw new BitError(`unable to find a local lane \"${currentName}\"`);\n }\n\n // rename the ref file\n await this.scope.legacyScope.objects.remoteLanes.renameRefByNewLaneName(laneNameWithoutScope, newName, lane.scope);\n\n // change tracking data\n const afterTrackData = {\n localLane: newName,\n remoteLane: newName,\n remoteScope: lane.scope,\n };\n this.scope.legacyScope.lanes.trackLane(afterTrackData);\n this.scope.legacyScope.lanes.removeTrackLane(laneNameWithoutScope);\n\n // change the lane object\n lane.name = newName;\n await this.scope.legacyScope.lanes.saveLane(lane);\n\n // change current-lane if needed\n const currentLaneId = this.getCurrentLaneId();\n if (currentLaneId?.isEqual(laneId)) {\n const newLaneId = LaneId.from(newName, lane.scope);\n const isExported = this.workspace.consumer.bitMap.isLaneExported;\n this.setCurrentLane(newLaneId, undefined, isExported);\n }\n\n // export the lane with only the name-change\n const clonedLaneToExport = lane.clone();\n clonedLaneToExport.components = []; // otherwise, it'll export the changes done on the components.\n let exported = false;\n let exportErr: Error | undefined;\n try {\n await this.exportLane(clonedLaneToExport);\n exported = true;\n } catch (err: any) {\n this.logger.error(`unable to export ${lane.id.toString()}: ${err.message}`);\n exportErr = err;\n }\n\n await this.workspace.consumer.onDestroy();\n\n return { exported, exportErr };\n }\n\n async exportLane(lane: Lane) {\n await this.exporter.exportMany({\n scope: this.scope.legacyScope,\n laneObject: lane,\n ids: new BitIds(),\n idsWithFutureScope: new BitIds(),\n allVersions: false,\n });\n }\n\n async importLaneObject(laneId: LaneId, persistIfNotExists = true): Promise<Lane> {\n return this.importer.importLaneObject(laneId, persistIfNotExists);\n }\n\n /**\n * get the distance for a component between two lanes. for example, lane-b forked from lane-a and lane-b added some new snaps\n * @param componentId\n * @param sourceHead head on the source lane. leave empty if the source is main\n * @param targetHead head on the target lane. leave empty if the target is main\n * @returns\n */\n async getSnapsDistance(\n componentId: ComponentID,\n sourceHead?: string,\n targetHead?: string,\n throws?: boolean\n ): Promise<SnapsDistance> {\n if (!sourceHead && !targetHead)\n throw new Error(`getDivergeData got sourceHead and targetHead empty. at least one of them should be populated`);\n const modelComponent = await this.scope.legacyScope.getModelComponent(componentId._legacy);\n return getDivergeData({\n modelComponent,\n repo: this.scope.legacyScope.objects,\n sourceHead: sourceHead ? Ref.from(sourceHead) : modelComponent.head || null,\n targetHead: targetHead ? Ref.from(targetHead) : modelComponent.head || null,\n throws,\n });\n }\n\n /**\n * get the head hash (snap) of main. return undefined if the component exists only on a lane and was never merged to main\n */\n async getHeadOnMain(componentId: ComponentID): Promise<string | undefined> {\n const modelComponent = await this.scope.legacyScope.getModelComponent(componentId._legacy);\n return modelComponent.head?.toString();\n }\n\n /**\n * fetch the lane object and its components from the remote.\n * save the objects and the lane to the local scope.\n * this method doesn't change anything in the workspace.\n */\n async fetchLaneWithItsComponents(laneId: LaneId): Promise<Lane> {\n this.logger.debug(`fetching lane ${laneId.toString()}`);\n if (!this.workspace) {\n throw new BitError('unable to fetch lanes outside of Bit workspace');\n }\n const lane = await this.importer.importLaneObject(laneId);\n if (!lane) throw new Error(`unable to import lane ${laneId.toString()} from the remote`);\n\n await this.importer.fetchLaneComponents(lane);\n this.logger.debug(`fetching lane ${laneId.toString()} done, fetched ${lane.components.length} components`);\n return lane;\n }\n\n async removeLanes(laneNames: string[], opts?: { remote: boolean; force: boolean }): Promise<string[]> {\n if (!this.workspace && !opts?.remote) {\n await this.scope.legacyScope.lanes.removeLanes(this.scope.legacyScope, laneNames, true);\n return laneNames;\n }\n const results = await removeLanes(this.workspace?.consumer, laneNames, !!opts?.remote, !!opts?.force);\n if (this.workspace) await this.workspace.consumer.onDestroy();\n\n return results.laneResults;\n }\n\n /**\n * when deleting a lane object, it is sent into the \"trash\" directory in the scope.\n * this method restores it and put it back in the \"objects\" directory.\n * as an argument, it needs a hash. the reason for not supporting lane-id is because the trash may have multiple\n * lanes with the same lane-id but different hashes.\n */\n async restoreLane(laneHash: string) {\n const ref = Ref.from(laneHash);\n const objectsFromTrash = (await this.scope.legacyScope.objects.getFromTrash([ref])) as Lane[];\n const laneIdFromTrash = objectsFromTrash[0].toLaneId();\n const existingWithSameId = await this.loadLane(laneIdFromTrash);\n if (existingWithSameId) {\n if (existingWithSameId.hash().isEqual(ref)) {\n throw new BitError(`unable to restore lane ${laneIdFromTrash.toString()}, as it already exists`);\n }\n throw new BitError(\n `unable to restore lane ${laneIdFromTrash.toString()}, as a lane with the same id already exists`\n );\n }\n await this.scope.legacyScope.objects.restoreFromTrash([ref]);\n }\n\n async removeComps(componentsPattern: string, removeCompsOpts: RemoveCompsOpts): Promise<MarkRemoveOnLaneResult> {\n const workspace = this.workspace;\n if (!workspace) throw new OutsideWorkspaceError();\n const currentLane = await workspace.getCurrentLaneObject();\n if (!currentLane) {\n throw new Error('markRemoveOnLane expects to get called when on a lane');\n }\n if (currentLane.isNew || removeCompsOpts.workspaceOnly) {\n const results = await this.remove.remove({\n componentsPattern,\n force: true,\n });\n const ids = results.localResult.removedComponentIds;\n const compIds = await workspace.resolveMultipleComponentIds(ids);\n return { removedFromWs: compIds, markedRemoved: [] };\n }\n\n const componentIds = await workspace.idsByPattern(componentsPattern);\n const laneBitIds = currentLane.toBitIds();\n const [laneCompIds, mainCompIds] = partition(componentIds, (id) => laneBitIds.hasWithoutVersion(id._legacy));\n\n const removeFromWorkspace = async () => {\n if (!mainCompIds.length) return [];\n const results = await this.remove.removeLocallyByIds(\n mainCompIds.map((id) => id._legacy),\n { force: true }\n );\n const ids = results.localResult.removedComponentIds;\n return workspace.resolveMultipleComponentIds(ids);\n };\n\n const removedFromWs = await removeFromWorkspace();\n const markedRemoved = await this.remove.markRemoveComps(laneCompIds);\n\n return { removedFromWs, markedRemoved };\n }\n\n /**\n * switch to a different local or remote lane.\n * switching to a remote lane also imports and writes the components of that remote lane.\n * by default, only the components existing on the workspace will be imported from that lane, unless the \"getAll\"\n * flag is true.\n */\n async switchLanes(\n laneName: string,\n { alias, merge, pattern, getAll = false, skipDependencyInstallation = false }: SwitchLaneOptions\n ) {\n if (!this.workspace) {\n throw new BitError(`unable to switch lanes outside of Bit workspace`);\n }\n let mergeStrategy;\n if (merge && typeof merge === 'string') {\n const mergeOptions = Object.keys(MergeOptions);\n if (!mergeOptions.includes(merge)) {\n throw new BitError(`merge must be one of the following: ${mergeOptions.join(', ')}`);\n }\n mergeStrategy = merge;\n }\n if (alias) {\n throwForInvalidLaneName(alias);\n }\n\n const switchProps = {\n laneName,\n existingOnWorkspaceOnly: !getAll,\n pattern,\n alias,\n };\n const checkoutProps = {\n mergeStrategy,\n skipNpmInstall: skipDependencyInstallation,\n verbose: false, // not relevant in Harmony\n ignorePackageJson: true, // not relevant in Harmony\n ignoreDist: true, // not relevant in Harmony\n isLane: true,\n promptMergeOptions: false,\n writeConfig: false,\n reset: false,\n all: false,\n };\n return new LaneSwitcher(this.workspace, this.logger, switchProps, checkoutProps, this).switch();\n }\n\n /**\n * the values array may include zero to two values and will be processed as following:\n * [] => diff between the current lane and default lane. (only inside workspace).\n * [to] => diff between the current lane (or default-lane when in scope) and \"to\" lane.\n * [from, to] => diff between \"from\" lane and \"to\" lane.\n */\n public async getDiff(values: string[], diffOptions: DiffOptions = {}, pattern?: string): Promise<LaneDiffResults> {\n const laneDiffGenerator = new LaneDiffGenerator(this.workspace, this.scope);\n return laneDiffGenerator.generate(values, diffOptions, pattern);\n }\n\n async getLaneComponentModels(lane: LaneData): Promise<Component[]> {\n const host = this.componentAspect.getHost();\n const laneComponentIds = await this.getLaneComponentIds(lane);\n const components = await host.getMany(laneComponentIds);\n return components;\n }\n\n async getLaneComponentIds(lane: LaneData): Promise<ComponentID[]> {\n if (!lane) return [];\n\n const laneComponents = lane.components;\n const workspace = this.workspace;\n const bitIdsFromBitmap = workspace ? workspace.consumer.bitMap.getAllBitIdsFromAllLanes() : [];\n\n const filteredComponentIds = workspace\n ? laneComponents.filter((laneComponent) =>\n bitIdsFromBitmap.some((bitmapComponentId) => bitmapComponentId.isEqualWithoutVersion(laneComponent.id))\n )\n : laneComponents;\n\n const host = this.componentAspect.getHost();\n\n return Promise.all(\n filteredComponentIds.map((laneComponent) => {\n const legacyIdWithVersion = laneComponent.id.changeVersion(laneComponent.head);\n return host.resolveComponentId(legacyIdWithVersion);\n })\n );\n }\n\n async getLaneReadmeComponent(lane: LaneData): Promise<Component | undefined> {\n if (!lane) return undefined;\n const laneReadmeComponent = lane.readmeComponent;\n if (!laneReadmeComponent) return undefined;\n const host = this.componentAspect.getHost();\n const laneReadmeComponentId = await host.resolveComponentId(\n laneReadmeComponent.id.changeVersion(laneReadmeComponent.head)\n );\n const readmeComponent = await host.get(laneReadmeComponentId);\n return readmeComponent;\n }\n\n async removeLaneReadme(laneName?: string): Promise<{ result: boolean; message?: string }> {\n if (!this.workspace) {\n throw new BitError('unable to remove the lane readme component outside of Bit workspace');\n }\n const currentLaneName = this.getCurrentLaneName();\n\n if (!laneName && !currentLaneName) {\n return {\n result: false,\n message: 'unable to remove the lane readme component. Either pass a laneName or switch to a lane',\n };\n }\n\n const scope: LegacyScope = this.workspace.scope.legacyScope;\n const laneId: LaneId = laneName\n ? await scope.lanes.parseLaneIdFromString(laneName)\n : (this.getCurrentLaneId() as LaneId);\n const lane: Lane | null | undefined = await scope.loadLane(laneId);\n\n if (!lane?.readmeComponent) {\n throw new BitError(`there is no readme component added to the lane ${laneName || currentLaneName}`);\n }\n\n const readmeComponentId = await this.workspace.resolveComponentId(lane.readmeComponent.id);\n const existingLaneConfig =\n (await this.workspace.getSpecificComponentConfig(readmeComponentId, LanesAspect.id)) || {};\n\n const remoteLaneIdStr = lane.toLaneId().toString();\n\n if (existingLaneConfig.readme) {\n delete existingLaneConfig.readme[remoteLaneIdStr];\n await this.workspace.removeSpecificComponentConfig(readmeComponentId, LanesAspect.id, false);\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, existingLaneConfig);\n }\n\n lane.setReadmeComponent(undefined);\n await scope.lanes.saveLane(lane);\n await this.workspace.bitMap.write();\n\n return { result: true };\n }\n\n async diffStatus(\n sourceLaneId: LaneId,\n targetLaneId?: LaneId,\n options?: LaneDiffStatusOptions\n ): Promise<LaneDiffStatus> {\n const sourceLaneComponents = sourceLaneId.isDefault()\n ? (await this.getLaneDataOfDefaultLane())?.components.map((main) => ({ id: main.id, head: Ref.from(main.head) }))\n : (await this.loadLane(sourceLaneId))?.components;\n\n const targetLane = targetLaneId ? await this.loadLane(targetLaneId) : undefined;\n const targetLaneIds = targetLane?.toBitIds();\n const host = this.componentAspect.getHost();\n\n const targetMainHeads =\n !targetLaneId || targetLaneId?.isDefault()\n ? compact(\n await Promise.all(\n (sourceLaneComponents || []).map(async ({ id }) => {\n const componentId = await host.resolveComponentId(id);\n const headOnMain = await this.getHeadOnMain(componentId);\n return headOnMain ? id.changeVersion(headOnMain) : undefined;\n })\n )\n )\n : [];\n\n await this.importer.importObjectsFromMainIfExist(targetMainHeads);\n\n const diffProps = compact(\n await Promise.all(\n (sourceLaneComponents || []).map(async ({ id, head }) => {\n const componentId = await host.resolveComponentId(id);\n const sourceVersionObj = (await this.scope.legacyScope.objects.load(head, true)) as Version;\n\n if (sourceVersionObj.isRemoved()) {\n return null;\n }\n\n const headOnTargetLane = targetLaneIds\n ? targetLaneIds.searchWithoutVersion(id)?.version\n : await this.getHeadOnMain(componentId);\n\n if (headOnTargetLane) {\n const targetVersionObj = (await this.scope.legacyScope.objects.load(\n Ref.from(headOnTargetLane),\n true\n )) as Version;\n\n if (targetVersionObj.isRemoved()) {\n return null;\n }\n }\n\n const sourceHead = head.toString();\n const targetHead = headOnTargetLane;\n\n return { componentId, sourceHead, targetHead };\n })\n )\n );\n\n const results = await pMapSeries(diffProps, async ({ componentId, sourceHead, targetHead }) =>\n this.componentDiffStatus(componentId, sourceHead, targetHead, options)\n );\n\n return {\n source: sourceLaneId,\n target: targetLaneId || this.getDefaultLaneId(),\n componentsStatus: results,\n };\n }\n\n async componentDiffStatus(\n componentId: ComponentID,\n sourceHead: string,\n targetHead?: string,\n options?: LaneDiffStatusOptions\n ): Promise<LaneComponentDiffStatus> {\n const snapsDistance = await this.getSnapsDistance(componentId, sourceHead, targetHead, false);\n\n if (snapsDistance?.err) {\n const noCommonSnap = snapsDistance.err instanceof NoCommonSnap;\n\n return {\n componentId,\n sourceHead,\n targetHead,\n upToDate: snapsDistance?.isUpToDate(),\n unrelated: noCommonSnap || undefined,\n changes: [],\n };\n }\n\n const commonSnap = snapsDistance?.commonSnapBeforeDiverge;\n\n const getChanges = async (): Promise<ChangeType[]> => {\n if (!commonSnap) return [ChangeType.NEW];\n\n const compare = await this.componentCompare.compare(\n componentId.changeVersion(commonSnap.hash).toString(),\n componentId.changeVersion(sourceHead).toString()\n );\n\n if (!compare.fields.length && (!compare.code.length || !compare.code.some((c) => c.status !== 'UNCHANGED'))) {\n return [ChangeType.NONE];\n }\n\n const changed: ChangeType[] = [];\n\n if (compare.code.some((f) => f.status !== 'UNCHANGED')) {\n changed.push(ChangeType.SOURCE_CODE);\n }\n\n if (compare.fields.length > 0) {\n changed.push(ChangeType.ASPECTS);\n }\n\n const depsFields = ['dependencies', 'devDependencies', 'extensionDependencies'];\n if (compare.fields.some((field) => depsFields.includes(field.fieldName))) {\n changed.push(ChangeType.DEPENDENCY);\n }\n\n return changed;\n };\n\n const changes = !options?.skipChanges ? await getChanges() : undefined;\n const changeType = changes ? changes[0] : undefined;\n\n return {\n componentId,\n changeType,\n changes,\n sourceHead,\n targetHead: commonSnap?.hash,\n upToDate: snapsDistance?.isUpToDate(),\n snapsDistance: {\n onSource: snapsDistance?.snapsOnSourceOnly.map((s) => s.hash) ?? [],\n onTarget: snapsDistance?.snapsOnTargetOnly.map((s) => s.hash) ?? [],\n common: snapsDistance?.commonSnapBeforeDiverge?.hash,\n },\n };\n }\n\n private async recreateNewLaneIfDeleted() {\n if (!this.workspace) return;\n const laneId = this.getCurrentLaneId();\n if (!laneId || laneId.isDefault() || this.workspace.consumer.bitMap.isLaneExported) {\n return;\n }\n const laneObj = await this.scope.legacyScope.getCurrentLaneObject();\n if (laneObj) {\n return;\n }\n await this.createLane(laneId.name, { scope: laneId.scope });\n }\n\n async addLaneReadme(readmeComponentIdStr: string, laneName?: string): Promise<{ result: boolean; message?: string }> {\n if (!this.workspace) {\n throw new BitError(`unable to track a lane readme component outside of Bit workspace`);\n }\n const readmeComponentId = await this.workspace.resolveComponentId(readmeComponentIdStr);\n\n const readmeComponentBitId = readmeComponentId._legacy;\n const scope: LegacyScope = this.workspace.scope.legacyScope;\n const laneId: LaneId = laneName\n ? await scope.lanes.parseLaneIdFromString(laneName)\n : (this.getCurrentLaneId() as LaneId);\n\n const lane: Lane | null | undefined = await scope.loadLane(laneId);\n\n if (!lane) {\n return { result: false, message: `cannot find lane ${laneName}` };\n }\n\n lane.setReadmeComponent(readmeComponentBitId);\n await scope.lanes.saveLane(lane);\n\n const existingLaneConfig =\n (await this.workspace.getSpecificComponentConfig(readmeComponentId, LanesAspect.id)) || {};\n\n const remoteLaneIdStr = lane.toLaneId().toString();\n\n if (existingLaneConfig.readme) {\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, {\n ...existingLaneConfig,\n readme: {\n ...existingLaneConfig.readme,\n [remoteLaneIdStr]: true,\n },\n });\n } else {\n await this.workspace.addSpecificComponentConfig(readmeComponentId, LanesAspect.id, {\n ...existingLaneConfig,\n readme: {\n [remoteLaneIdStr]: true,\n },\n });\n }\n await this.workspace.bitMap.write();\n return { result: true };\n }\n\n /**\n * if the local lane was forked from another lane, this gets the differences between the two.\n * it also fetches the original lane from the remote to make sure the data is up to date.\n */\n async listUpdatesFromForked(componentsList: ComponentsList): Promise<DivergeDataPerId[]> {\n const consumer = this.workspace?.consumer;\n if (!consumer) throw new Error(`unable to get listUpdatesFromForked outside of a workspace`);\n if (consumer.isOnMain()) {\n return [];\n }\n const lane = await consumer.getCurrentLaneObject();\n const forkedFromLaneId = lane?.forkedFrom;\n if (!forkedFromLaneId) {\n return [];\n }\n const forkedFromLane = await consumer.scope.loadLane(forkedFromLaneId);\n if (!forkedFromLane) return []; // should we fetch it here?\n\n const workspaceIds = consumer.bitMap.getAllBitIds();\n\n const duringMergeIds = componentsList.listDuringMergeStateComponents();\n\n const componentsFromModel = await componentsList.getModelComponents();\n const compFromModelOnWorkspace = componentsFromModel\n .filter((c) => workspaceIds.hasWithoutVersion(c.toBitId()))\n // if a component is merge-pending, it needs to be resolved first before getting more updates from main\n .filter((c) => !duringMergeIds.hasWithoutVersion(c.toBitId()));\n\n // by default, when on a lane, forked is not fetched. we need to fetch it to get the latest updates.\n await this.fetchLaneWithItsComponents(forkedFromLaneId);\n\n const remoteForkedLane = await consumer.scope.objects.remoteLanes.getRemoteLane(forkedFromLaneId);\n if (!remoteForkedLane.length) return [];\n\n const results = await Promise.all(\n compFromModelOnWorkspace.map(async (modelComponent) => {\n const headOnForked = remoteForkedLane.find((c) => c.id.isEqualWithoutVersion(modelComponent.toBitId()));\n const headOnLane = modelComponent.laneHeadLocal;\n if (!headOnForked || !headOnLane) return undefined;\n const divergeData = await getDivergeData({\n repo: consumer.scope.objects,\n modelComponent,\n targetHead: headOnForked.head,\n sourceHead: headOnLane,\n throws: false,\n });\n if (!divergeData.snapsOnTargetOnly.length && !divergeData.err) return undefined;\n return { id: modelComponent.toBitId(), divergeData };\n })\n );\n\n return compact(results);\n }\n\n private async getLaneDataOfDefaultLane(): Promise<LaneData | null> {\n const consumer = this.workspace?.consumer;\n let bitIds: BitId[] = [];\n if (!consumer) {\n const scopeComponents = await this.scope.list();\n bitIds = scopeComponents.filter((component) => component.head).map((component) => component.id._legacy);\n } else {\n bitIds = await consumer.getIdsOfDefaultLane();\n }\n\n return {\n name: DEFAULT_LANE,\n remote: null,\n id: this.getDefaultLaneId(),\n components: bitIds.map((bitId) => ({ id: bitId, head: bitId.version as string })),\n isMerged: null,\n hash: '',\n };\n }\n\n get createRoutePath() {\n return '/lanes/create';\n }\n\n get deleteRoutePath() {\n return '/lanes/delete';\n }\n\n get restoreRoutePath() {\n return '/lanes/restore';\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n ScopeAspect,\n WorkspaceAspect,\n GraphqlAspect,\n MergingAspect,\n ComponentAspect,\n LoggerAspect,\n ImporterAspect,\n ExportAspect,\n ExpressAspect,\n ComponentCompareAspect,\n ComponentWriterAspect,\n RemoveAspect,\n CheckoutAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n scope,\n workspace,\n graphql,\n merging,\n component,\n loggerMain,\n importer,\n exporter,\n express,\n componentCompare,\n componentWriter,\n remove,\n checkout,\n ]: [\n CLIMain,\n ScopeMain,\n Workspace,\n GraphqlMain,\n MergingMain,\n ComponentMain,\n LoggerMain,\n ImporterMain,\n ExportMain,\n ExpressMain,\n ComponentCompareMain,\n ComponentWriterMain,\n RemoveMain,\n CheckoutMain\n ]) {\n const logger = loggerMain.createLogger(LanesAspect.id);\n const lanesMain = new LanesMain(\n workspace,\n scope,\n merging,\n component,\n logger,\n importer,\n exporter,\n componentCompare,\n componentWriter,\n remove,\n checkout\n );\n const switchCmd = new SwitchCmd(lanesMain);\n const laneCmd = new LaneCmd(lanesMain, workspace, scope);\n laneCmd.commands = [\n new LaneListCmd(lanesMain, workspace, scope),\n switchCmd,\n new LaneShowCmd(lanesMain, workspace, scope),\n new LaneCreateCmd(lanesMain),\n new LaneRemoveCmd(lanesMain),\n new LaneChangeScopeCmd(lanesMain),\n new LaneAliasCmd(lanesMain),\n new LaneRenameCmd(lanesMain),\n new LaneDiffCmd(workspace, scope),\n new LaneAddReadmeCmd(lanesMain),\n new LaneRemoveReadmeCmd(lanesMain),\n new LaneImportCmd(switchCmd),\n new LaneRemoveCompCmd(workspace, lanesMain),\n ];\n cli.register(laneCmd, switchCmd);\n cli.registerOnStart(async () => {\n await lanesMain.recreateNewLaneIfDeleted();\n });\n graphql.register(lanesSchema(lanesMain));\n express.register([\n new LanesCreateRoute(lanesMain, logger),\n new LanesDeleteRoute(lanesMain, logger),\n new LanesRestoreRoute(lanesMain, logger),\n ]);\n return lanesMain;\n }\n}\n\nLanesAspect.addRuntime(LanesMain);\n\nexport default LanesMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAC,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E,CACpBiY,gBAAS,EACTC,oBAAW,EACXC,4BAAe,EACfC,wBAAa,EACbC,wBAAa,EACbC,oBAAe,EACfC,sBAAY,EACZC,0BAAc,EACdC,sBAAY,EACZC,wBAAa,EACbC,0CAAsB,EACtBC,0BAAqB,EACrBC,iBAAY,EACZC,mBAAc,CACf;AAAA,IAAAnZ,gBAAA,GAAAC,OAAA,EAp5BUI,SAAS,aAq5BH+Y,kBAAW;AA6E9BtJ,oBAAW,CAACuJ,UAAU,CAAChZ,SAAS,CAAC;AAAC,IAAAiZ,QAAA,GAEnBjZ,SAAS;AAAAgY,OAAA,CAAApY,OAAA,GAAAqZ,QAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.697/dist/lanes.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.697/dist/lanes.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.698/dist/lanes.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.698/dist/lanes.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -8,6 +8,7 @@ import { LanesMain } from './lanes.main.runtime';
8
8
  export declare type SwitchProps = {
9
9
  laneName: string;
10
10
  ids?: BitId[];
11
+ laneBitIds?: BitId[];
11
12
  pattern?: string;
12
13
  existingOnWorkspaceOnly: boolean;
13
14
  remoteLane?: Lane;
@@ -29,6 +30,5 @@ export declare class LaneSwitcher {
29
30
  private populatePropsAccordingToRemoteLane;
30
31
  private populatePropsAccordingToDefaultLane;
31
32
  private populatePropsAccordingToLocalLane;
32
- private getAllComponentsStatus;
33
33
  private saveLanesData;
34
34
  }
@@ -14,20 +14,6 @@ function _defineProperty2() {
14
14
  };
15
15
  return data;
16
16
  }
17
- function _pMapSeries() {
18
- const data = _interopRequireDefault(require("p-map-series"));
19
- _pMapSeries = function () {
20
- return data;
21
- };
22
- return data;
23
- }
24
- function _generalError() {
25
- const data = _interopRequireDefault(require("@teambit/legacy/dist/error/general-error"));
26
- _generalError = function () {
27
- return data;
28
- };
29
- return data;
30
- }
31
17
  function _laneId() {
32
18
  const data = require("@teambit/lane-id");
33
19
  _laneId = function () {
@@ -35,30 +21,9 @@ function _laneId() {
35
21
  };
36
22
  return data;
37
23
  }
38
- function _repositories() {
39
- const data = require("@teambit/legacy/dist/scope/repositories");
40
- _repositories = function () {
41
- return data;
42
- };
43
- return data;
44
- }
45
- function _checkout() {
46
- const data = require("@teambit/checkout");
47
- _checkout = function () {
48
- return data;
49
- };
50
- return data;
51
- }
52
- function _mergeVersion() {
53
- const data = require("@teambit/legacy/dist/consumer/versions-ops/merge-version");
54
- _mergeVersion = function () {
55
- return data;
56
- };
57
- return data;
58
- }
59
- function _threeWayMerge() {
60
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge"));
61
- _threeWayMerge = function () {
24
+ function _bitId() {
25
+ const data = require("@teambit/legacy/dist/bit-id");
26
+ _bitId = function () {
62
27
  return data;
63
28
  };
64
29
  return data;
@@ -77,6 +42,8 @@ function _createLane() {
77
42
  };
78
43
  return data;
79
44
  }
45
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
46
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
80
47
  class LaneSwitcher {
81
48
  // populated by `this.populateSwitchProps()`, if default-lane, it's undefined
82
49
  constructor(workspace, logger, switchProps, checkoutProps, Lanes) {
@@ -97,61 +64,36 @@ class LaneSwitcher {
97
64
  await (0, _createLane().throwForStagedComponents)(this.consumer);
98
65
  }
99
66
  await this.populateSwitchProps();
100
- const allComponentsStatus = await this.getAllComponentsStatus();
101
- const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
102
- if (componentWithConflict) {
103
- if (!this.checkoutProps.promptMergeOptions && !this.checkoutProps.mergeStrategy) {
104
- throw new (_generalError().default)(`automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\nplease use "--manual" to manually merge changes or use "--theirs / --ours" to choose one of the conflicted versions`);
105
- }
106
- if (!this.checkoutProps.mergeStrategy) this.checkoutProps.mergeStrategy = await (0, _mergeVersion().getMergeStrategyInteractive)();
107
- }
108
- const failedComponents = allComponentsStatus.filter(componentStatus => componentStatus.failureMessage).map(componentStatus => ({
109
- id: componentStatus.id,
110
- failureMessage: componentStatus.failureMessage,
111
- unchangedLegitimately: componentStatus.unchangedLegitimately
112
- }));
113
- const succeededComponents = allComponentsStatus.filter(componentStatus => !componentStatus.failureMessage);
114
- // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,
115
- // which can be an issue when some components are also dependencies of others
116
- const componentsResults = await (0, _pMapSeries().default)(succeededComponents, ({
117
- id,
118
- currentComponent: componentFromFS,
119
- mergeResults
120
- }) => {
121
- return (0, _checkout().applyVersion)(this.consumer, id, componentFromFS, mergeResults, this.checkoutProps);
67
+ const bitMapIds = this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved;
68
+ const idsToSwitch = this.switchProps.ids || [];
69
+ const idsWithVersion = idsToSwitch.map(id => {
70
+ const bitMapId = bitMapIds.searchWithoutVersion(id);
71
+ return bitMapId || id;
72
+ });
73
+ const ids = await this.workspace.resolveMultipleComponentIds(idsWithVersion);
74
+ const checkoutProps = _objectSpread(_objectSpread({}, this.checkoutProps), {}, {
75
+ ids,
76
+ allowAddingComponentsFromScope: true,
77
+ versionPerId: await this.workspace.resolveMultipleComponentIds(idsToSwitch)
122
78
  });
123
- (0, _checkout().markFilesToBeRemovedIfNeeded)(succeededComponents, componentsResults);
79
+ const results = await this.Lanes.checkout.checkout(checkoutProps);
124
80
  await this.saveLanesData();
125
- const components = componentsResults.map(c => c.component).filter(c => c);
126
- const manyComponentsWriterOpts = {
127
- components,
128
- skipDependencyInstallation: this.checkoutProps.skipNpmInstall,
129
- verbose: this.checkoutProps.verbose,
130
- writeConfig: this.checkoutProps.writeConfig
131
- };
132
- const {
133
- installationError,
134
- compilationError
135
- } = await this.Lanes.componentWriter.writeMany(manyComponentsWriterOpts);
136
- await (0, _checkout().deleteFilesIfNeeded)(componentsResults, this.workspace);
137
- const appliedVersionComponents = componentsResults.map(c => c.applyVersionResult);
138
81
  await this.consumer.onDestroy();
139
- return {
140
- components: appliedVersionComponents,
141
- failedComponents,
142
- installationError,
143
- compilationError
144
- };
82
+ return results;
145
83
  }
146
84
  async populateSwitchProps() {
147
85
  const laneId = await this.consumer.scope.lanes.parseLaneIdFromString(this.switchProps.laneName);
148
86
  const localLane = await this.consumer.scope.loadLane(laneId);
87
+ const mainIds = await this.consumer.getIdsOfDefaultLane();
149
88
  if (laneId.isDefault()) {
150
89
  await this.populatePropsAccordingToDefaultLane();
151
- } else if (localLane) {
152
- this.populatePropsAccordingToLocalLane(localLane);
90
+ this.switchProps.ids = mainIds;
153
91
  } else {
154
- await this.populatePropsAccordingToRemoteLane(laneId);
92
+ const laneIds = localLane ? this.populatePropsAccordingToLocalLane(localLane) : await this.populatePropsAccordingToRemoteLane(laneId);
93
+ const idsOnLaneOnly = laneIds.filter(id => !mainIds.find(i => i.isEqualWithoutVersion(id)));
94
+ const idsOnMainOnly = mainIds.filter(id => !laneIds.find(i => i.isEqualWithoutVersion(id)));
95
+ this.switchProps.ids = [...idsOnMainOnly, ...laneIds];
96
+ this.switchProps.laneBitIds = idsOnLaneOnly;
155
97
  }
156
98
  if (this.switchProps.pattern) {
157
99
  if (this.consumer.bitMap.getAllBitIdsFromAllLanes().length) {
@@ -173,42 +115,25 @@ class LaneSwitcher {
173
115
  }
174
116
  const remoteLane = await this.Lanes.fetchLaneWithItsComponents(remoteLaneId);
175
117
  this.switchProps.laneName = remoteLaneId.name;
176
- this.switchProps.ids = remoteLane.components.map(l => l.id.changeVersion(l.head.toString()));
177
118
  this.switchProps.localTrackedLane = this.consumer.scope.lanes.getAliasByLaneId(remoteLaneId) || undefined;
178
119
  this.switchProps.remoteLane = remoteLane;
179
120
  this.laneToSwitchTo = remoteLane;
180
121
  this.logger.debug(`populatePropsAccordingToRemoteLane, completed`);
122
+ return remoteLane.components.map(l => l.id.changeVersion(l.head.toString()));
181
123
  }
182
124
  async populatePropsAccordingToDefaultLane() {
183
- if (!this.consumer.isOnLane()) {
125
+ if (this.consumer.isOnMain()) {
184
126
  throw new (_bitError().BitError)(`already checked out to "${this.switchProps.laneName}"`);
185
127
  }
186
- this.switchProps.ids = await this.consumer.getIdsOfDefaultLane();
187
128
  this.laneIdToSwitchTo = _laneId().LaneId.from(_laneId().DEFAULT_LANE, this.consumer.scope.name);
188
129
  }
189
130
  populatePropsAccordingToLocalLane(localLane) {
190
131
  if (this.consumer.getCurrentLaneId().name === this.switchProps.laneName) {
191
132
  throw new (_bitError().BitError)(`already checked out to "${this.switchProps.laneName}"`);
192
133
  }
193
- this.switchProps.ids = localLane.components.map(c => c.id.changeVersion(c.head.toString()));
194
134
  this.laneIdToSwitchTo = localLane.toLaneId();
195
135
  this.laneToSwitchTo = localLane;
196
- }
197
- async getAllComponentsStatus() {
198
- const {
199
- ids
200
- } = this.switchProps;
201
- const tmp = new (_repositories().Tmp)(this.consumer.scope);
202
- try {
203
- const componentsStatusP = ids.map(id => getComponentStatus(this.consumer, id, this.switchProps));
204
- const componentsStatus = await Promise.all(componentsStatusP);
205
- await tmp.clear();
206
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
207
- return componentsStatus;
208
- } catch (err) {
209
- await tmp.clear();
210
- throw err;
211
- }
136
+ return localLane.components.map(c => c.id.changeVersion(c.head.toString()));
212
137
  }
213
138
  async saveLanesData() {
214
139
  var _this$laneToSwitchTo;
@@ -223,98 +148,9 @@ class LaneSwitcher {
223
148
  }
224
149
  }
225
150
  this.consumer.setCurrentLane(this.laneIdToSwitchTo, !((_this$laneToSwitchTo = this.laneToSwitchTo) !== null && _this$laneToSwitchTo !== void 0 && _this$laneToSwitchTo.isNew));
226
- this.consumer.bitMap.syncWithLanes(this.laneToSwitchTo);
151
+ this.consumer.bitMap.syncWithIds(_bitId().BitIds.fromArray(this.switchProps.ids || []), _bitId().BitIds.fromArray(this.switchProps.laneBitIds || []));
227
152
  }
228
153
  }
229
154
  exports.LaneSwitcher = LaneSwitcher;
230
- async function getComponentStatus(consumer, id, switchProps) {
231
- const componentStatus = {
232
- id
233
- };
234
- const returnFailure = (msg, unchangedLegitimately = false) => {
235
- componentStatus.failureMessage = msg;
236
- componentStatus.unchangedLegitimately = unchangedLegitimately;
237
- return componentStatus;
238
- };
239
- const modelComponent = await consumer.scope.getModelComponentIfExist(id);
240
- if (!modelComponent) {
241
- return returnFailure(`component ${id.toString()} had never imported`, true);
242
- }
243
- const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);
244
- if (unmerged) {
245
- return returnFailure(`component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use "bit lane merge-abort"/"bit merge --resolve/--abort")`);
246
- }
247
- const version = id.version;
248
- if (!version) {
249
- return returnFailure(`component doesn't have any snaps on ${_laneId().DEFAULT_LANE}`, true);
250
- }
251
- const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, {
252
- ignoreVersion: true
253
- });
254
- const componentOnLane = await modelComponent.loadVersion(version, consumer.scope.objects);
255
- if (componentOnLane.isRemoved()) {
256
- return returnFailure(`component has been removed`, true);
257
- }
258
- if (!existingBitMapId) {
259
- if (switchProps.existingOnWorkspaceOnly) {
260
- return returnFailure(`component ${id.toStringWithoutVersion()} is not in the workspace`, true);
261
- }
262
- return {
263
- componentFromModel: componentOnLane,
264
- id
265
- };
266
- }
267
- if (!existingBitMapId.hasVersion()) {
268
- // happens when switching from main to a lane and a component was snapped on the lane.
269
- // in the .bitmap file, the version is "latest" or empty. so we just need to write the component according to the
270
- // model. we don't care about the componentFromFS
271
- return {
272
- componentFromModel: componentOnLane,
273
- id
274
- };
275
- }
276
- const currentlyUsedVersion = existingBitMapId.version;
277
- if (currentlyUsedVersion === version) {
278
- return returnFailure(`component ${id.toStringWithoutVersion()} is already at version ${version}`, true);
279
- }
280
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
281
- const baseComponent = await modelComponent.loadVersion(currentlyUsedVersion, consumer.scope.objects);
282
- const component = await consumer.loadComponent(existingBitMapId);
283
- // don't use `consumer.isModified` here. otherwise, if there are dependency changes, the user can't discard them
284
- // and won't be able to switch lanes.
285
- const isModified = await consumer.isComponentSourceCodeModified(baseComponent, component);
286
- let mergeResults;
287
- const isHeadSameAsMain = () => {
288
- const head = modelComponent.getHead();
289
- if (!head) return false;
290
- if (!existingBitMapId.version) return false;
291
- const tagVersion = modelComponent.getTagOfRefIfExists(head);
292
- const headVersion = tagVersion || head.toString();
293
- return existingBitMapId.version === headVersion;
294
- };
295
- if (isModified) {
296
- if (!isHeadSameAsMain()) {
297
- throw new (_generalError().default)(`unable to checkout ${id.toStringWithoutVersion()}, the component is modified and belongs to another lane`);
298
- }
299
- const otherComponent = await modelComponent.loadVersion(existingBitMapId.version,
300
- // we are here because the head is same as main. so, existingBitMapId.version must be set
301
- consumer.scope.objects);
302
- mergeResults = await (0, _threeWayMerge().default)({
303
- consumer,
304
- otherComponent,
305
- otherLabel: version,
306
- currentComponent: component,
307
- currentLabel: `${currentlyUsedVersion} modified`,
308
- baseComponent
309
- });
310
- }
311
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
312
- return {
313
- currentComponent: component,
314
- componentFromModel: componentOnLane,
315
- id,
316
- mergeResults
317
- };
318
- }
319
155
 
320
156
  //# sourceMappingURL=switch-lanes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_generalError","_laneId","_repositories","_checkout","_mergeVersion","_threeWayMerge","_bitError","_createLane","LaneSwitcher","constructor","workspace","logger","switchProps","checkoutProps","Lanes","_defineProperty2","default","consumer","switch","setStatusLine","isOnMain","throwForStagedComponents","populateSwitchProps","allComponentsStatus","getAllComponentsStatus","componentWithConflict","find","component","mergeResults","hasConflicts","promptMergeOptions","mergeStrategy","GeneralError","id","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","filter","componentStatus","failureMessage","map","unchangedLegitimately","succeededComponents","componentsResults","mapSeries","currentComponent","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","saveLanesData","components","c","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","writeConfig","installationError","compilationError","componentWriter","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","onDestroy","laneId","scope","lanes","parseLaneIdFromString","laneName","localLane","loadLane","isDefault","populatePropsAccordingToDefaultLane","populatePropsAccordingToLocalLane","populatePropsAccordingToRemoteLane","pattern","bitMap","getAllBitIdsFromAllLanes","length","BitError","allIds","resolveMultipleComponentIds","ids","patternIds","filterIdsFromPoolIdsByPattern","_legacy","remoteLaneId","laneIdToSwitchTo","debug","toString","getCurrentLaneId","isEqual","remoteLane","fetchLaneWithItsComponents","name","l","changeVersion","head","localTrackedLane","getAliasByLaneId","undefined","laneToSwitchTo","isOnLane","getIdsOfDefaultLane","LaneId","from","DEFAULT_LANE","toLaneId","tmp","Tmp","componentsStatusP","getComponentStatus","componentsStatus","Promise","all","clear","err","_this$laneToSwitchTo","localLaneName","alias","trackLane","remoteScope","setCurrentLane","isNew","syncWithLanes","exports","returnFailure","msg","modelComponent","getModelComponentIfExist","unmerged","objects","unmergedComponents","getEntry","version","existingBitMapId","getBitIdIfExist","ignoreVersion","componentOnLane","loadVersion","isRemoved","existingOnWorkspaceOnly","componentFromModel","hasVersion","currentlyUsedVersion","baseComponent","loadComponent","isModified","isComponentSourceCodeModified","isHeadSameAsMain","getHead","tagVersion","getTagOfRefIfExists","headVersion","otherComponent","threeWayMerge","otherLabel","currentLabel"],"sources":["switch-lanes.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { Version, Lane } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport {\n applyVersion,\n ComponentStatus,\n CheckoutPropsLegacy,\n deleteFilesIfNeeded,\n markFilesToBeRemovedIfNeeded,\n} from '@teambit/checkout';\nimport {\n FailedComponents,\n getMergeStrategyInteractive,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport threeWayMerge, {\n MergeResultsThreeWay,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { Workspace } from '@teambit/workspace';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { LanesMain } from './lanes.main.runtime';\nimport { throwForStagedComponents } from './create-lane';\n\nexport type SwitchProps = {\n laneName: string;\n ids?: BitId[];\n pattern?: string;\n existingOnWorkspaceOnly: boolean;\n remoteLane?: Lane;\n localTrackedLane?: string;\n alias?: string;\n};\n\nexport class LaneSwitcher {\n private consumer: Consumer;\n private laneIdToSwitchTo: LaneId; // populated by `this.populateSwitchProps()`\n private laneToSwitchTo: Lane | undefined; // populated by `this.populateSwitchProps()`, if default-lane, it's undefined\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private switchProps: SwitchProps,\n private checkoutProps: CheckoutPropsLegacy,\n private Lanes: LanesMain\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n async switch(): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(`switching lanes`);\n if (this.workspace.isOnMain()) {\n await throwForStagedComponents(this.consumer);\n }\n await this.populateSwitchProps();\n const allComponentsStatus: ComponentStatus[] = await this.getAllComponentsStatus();\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!this.checkoutProps.promptMergeOptions && !this.checkoutProps.mergeStrategy) {\n throw new GeneralError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--manual\" to manually merge changes or use \"--theirs / --ours\" to choose one of the conflicted versions`\n );\n }\n if (!this.checkoutProps.mergeStrategy) this.checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.failureMessage)\n .map((componentStatus) => ({\n id: componentStatus.id,\n failureMessage: componentStatus.failureMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.failureMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const componentsResults = await mapSeries(\n succeededComponents,\n ({ id, currentComponent: componentFromFS, mergeResults }) => {\n return applyVersion(this.consumer, id, componentFromFS, mergeResults, this.checkoutProps);\n }\n );\n\n markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults);\n\n await this.saveLanesData();\n\n const components = componentsResults.map((c) => c.component).filter((c) => c) as ConsumerComponent[];\n\n const manyComponentsWriterOpts = {\n components,\n skipDependencyInstallation: this.checkoutProps.skipNpmInstall,\n verbose: this.checkoutProps.verbose,\n writeConfig: this.checkoutProps.writeConfig,\n };\n const { installationError, compilationError } = await this.Lanes.componentWriter.writeMany(\n manyComponentsWriterOpts\n );\n await deleteFilesIfNeeded(componentsResults, this.workspace);\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n await this.consumer.onDestroy();\n\n return { components: appliedVersionComponents, failedComponents, installationError, compilationError };\n }\n\n private async populateSwitchProps() {\n const laneId = await this.consumer.scope.lanes.parseLaneIdFromString(this.switchProps.laneName);\n\n const localLane = await this.consumer.scope.loadLane(laneId);\n if (laneId.isDefault()) {\n await this.populatePropsAccordingToDefaultLane();\n } else if (localLane) {\n this.populatePropsAccordingToLocalLane(localLane);\n } else {\n await this.populatePropsAccordingToRemoteLane(laneId);\n }\n\n if (this.switchProps.pattern) {\n if (this.consumer.bitMap.getAllBitIdsFromAllLanes().length) {\n // if the workspace is not empty, it's possible that it has components from lane-x, and is now switching\n // partially to lane-y, while lane-y has the same components as lane-x. in which case, the user ends up with\n // an invalid state of components from lane-x and lane-y together.\n throw new BitError('error: use --pattern only when the workspace is empty');\n }\n const allIds = await this.workspace.resolveMultipleComponentIds(this.switchProps.ids || []);\n const patternIds = this.workspace.scope.filterIdsFromPoolIdsByPattern(this.switchProps.pattern, allIds);\n this.switchProps.ids = patternIds.map((id) => id._legacy);\n }\n }\n\n private async populatePropsAccordingToRemoteLane(remoteLaneId: LaneId) {\n this.laneIdToSwitchTo = remoteLaneId;\n this.logger.debug(`populatePropsAccordingToRemoteLane, remoteLaneId: ${remoteLaneId.toString()}`);\n if (this.consumer.getCurrentLaneId().isEqual(remoteLaneId)) {\n throw new BitError(`already checked out to \"${remoteLaneId.toString()}\"`);\n }\n const remoteLane = await this.Lanes.fetchLaneWithItsComponents(remoteLaneId);\n this.switchProps.laneName = remoteLaneId.name;\n this.switchProps.ids = remoteLane.components.map((l) => l.id.changeVersion(l.head.toString()));\n this.switchProps.localTrackedLane = this.consumer.scope.lanes.getAliasByLaneId(remoteLaneId) || undefined;\n this.switchProps.remoteLane = remoteLane;\n this.laneToSwitchTo = remoteLane;\n this.logger.debug(`populatePropsAccordingToRemoteLane, completed`);\n }\n\n private async populatePropsAccordingToDefaultLane() {\n if (!this.consumer.isOnLane()) {\n throw new BitError(`already checked out to \"${this.switchProps.laneName}\"`);\n }\n this.switchProps.ids = await this.consumer.getIdsOfDefaultLane();\n this.laneIdToSwitchTo = LaneId.from(DEFAULT_LANE, this.consumer.scope.name);\n }\n\n private populatePropsAccordingToLocalLane(localLane: Lane) {\n if (this.consumer.getCurrentLaneId().name === this.switchProps.laneName) {\n throw new BitError(`already checked out to \"${this.switchProps.laneName}\"`);\n }\n this.switchProps.ids = localLane.components.map((c) => c.id.changeVersion(c.head.toString()));\n this.laneIdToSwitchTo = localLane.toLaneId();\n this.laneToSwitchTo = localLane;\n }\n\n private async getAllComponentsStatus(): Promise<ComponentStatus[]> {\n const { ids } = this.switchProps;\n const tmp = new Tmp(this.consumer.scope);\n try {\n const componentsStatusP = (ids as BitId[]).map((id) => getComponentStatus(this.consumer, id, this.switchProps));\n const componentsStatus = await Promise.all(componentsStatusP);\n await tmp.clear();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n }\n\n private async saveLanesData() {\n const localLaneName = this.switchProps.alias || this.laneIdToSwitchTo.name;\n if (this.switchProps.remoteLane) {\n if (!this.switchProps.localTrackedLane) {\n this.consumer.scope.lanes.trackLane({\n localLane: localLaneName,\n remoteLane: this.laneIdToSwitchTo.name,\n remoteScope: this.laneIdToSwitchTo.scope,\n });\n }\n }\n\n this.consumer.setCurrentLane(this.laneIdToSwitchTo, !this.laneToSwitchTo?.isNew);\n this.consumer.bitMap.syncWithLanes(this.laneToSwitchTo);\n }\n}\n\nasync function getComponentStatus(consumer: Consumer, id: BitId, switchProps: SwitchProps): Promise<ComponentStatus> {\n const componentStatus: ComponentStatus = { id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.failureMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return returnFailure(`component ${id.toString()} had never imported`, true);\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use \"bit lane merge-abort\"/\"bit merge --resolve/--abort\")`\n );\n }\n const version = id.version;\n if (!version) {\n return returnFailure(`component doesn't have any snaps on ${DEFAULT_LANE}`, true);\n }\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnLane: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n if (componentOnLane.isRemoved()) {\n return returnFailure(`component has been removed`, true);\n }\n if (!existingBitMapId) {\n if (switchProps.existingOnWorkspaceOnly) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is not in the workspace`, true);\n }\n return { componentFromModel: componentOnLane, id };\n }\n if (!existingBitMapId.hasVersion()) {\n // happens when switching from main to a lane and a component was snapped on the lane.\n // in the .bitmap file, the version is \"latest\" or empty. so we just need to write the component according to the\n // model. we don't care about the componentFromFS\n return { componentFromModel: componentOnLane, id };\n }\n const currentlyUsedVersion = existingBitMapId.version;\n if (currentlyUsedVersion === version) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is already at version ${version}`, true);\n }\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const baseComponent: Version = await modelComponent.loadVersion(currentlyUsedVersion, consumer.scope.objects);\n const component = await consumer.loadComponent(existingBitMapId);\n // don't use `consumer.isModified` here. otherwise, if there are dependency changes, the user can't discard them\n // and won't be able to switch lanes.\n const isModified = await consumer.isComponentSourceCodeModified(baseComponent, component);\n let mergeResults: MergeResultsThreeWay | null | undefined;\n const isHeadSameAsMain = () => {\n const head = modelComponent.getHead();\n if (!head) return false;\n if (!existingBitMapId.version) return false;\n const tagVersion = modelComponent.getTagOfRefIfExists(head);\n const headVersion = tagVersion || head.toString();\n return existingBitMapId.version === headVersion;\n };\n if (isModified) {\n if (!isHeadSameAsMain()) {\n throw new GeneralError(\n `unable to checkout ${id.toStringWithoutVersion()}, the component is modified and belongs to another lane`\n );\n }\n\n const otherComponent: Version = await modelComponent.loadVersion(\n existingBitMapId.version as string, // we are here because the head is same as main. so, existingBitMapId.version must be set\n consumer.scope.objects\n );\n mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: version,\n currentComponent: component,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n }\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return { currentComponent: component, componentFromModel: componentOnLane, id, mergeResults };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,aAAA,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;AAKA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAA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tB,OAAO;MACnB1F,gBAAgB,EAAElB,SAAS;MAC3BmI,YAAY,EAAG,GAAEb,oBAAqB,WAAU;MAChDC;IACF,CAAC,CAAC;EACJ;EACA;EACA,OAAO;IAAErG,gBAAgB,EAAElB,SAAS;IAAEoH,kBAAkB,EAAEJ,eAAe;IAAE1G,EAAE;IAAEL;EAAa,CAAC;AAC/F"}
1
+ {"version":3,"names":["_laneId","data","require","_bitId","_bitError","_createLane","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","LaneSwitcher","constructor","workspace","logger","switchProps","checkoutProps","Lanes","consumer","switch","setStatusLine","isOnMain","throwForStagedComponents","populateSwitchProps","bitMapIds","bitmapIdsFromCurrentLaneIncludeRemoved","idsToSwitch","ids","idsWithVersion","map","id","bitMapId","searchWithoutVersion","resolveMultipleComponentIds","allowAddingComponentsFromScope","versionPerId","results","checkout","saveLanesData","onDestroy","laneId","scope","lanes","parseLaneIdFromString","laneName","localLane","loadLane","mainIds","getIdsOfDefaultLane","isDefault","populatePropsAccordingToDefaultLane","laneIds","populatePropsAccordingToLocalLane","populatePropsAccordingToRemoteLane","idsOnLaneOnly","find","isEqualWithoutVersion","idsOnMainOnly","laneBitIds","pattern","bitMap","getAllBitIdsFromAllLanes","BitError","allIds","patternIds","filterIdsFromPoolIdsByPattern","_legacy","remoteLaneId","laneIdToSwitchTo","debug","toString","getCurrentLaneId","isEqual","remoteLane","fetchLaneWithItsComponents","name","localTrackedLane","getAliasByLaneId","undefined","laneToSwitchTo","components","l","changeVersion","head","LaneId","from","DEFAULT_LANE","toLaneId","c","_this$laneToSwitchTo","localLaneName","alias","trackLane","remoteScope","setCurrentLane","isNew","syncWithIds","BitIds","fromArray","exports"],"sources":["switch-lanes.ts"],"sourcesContent":["import { Consumer } from '@teambit/legacy/dist/consumer';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { CheckoutPropsLegacy, CheckoutProps } from '@teambit/checkout';\nimport { Workspace } from '@teambit/workspace';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { LanesMain } from './lanes.main.runtime';\nimport { throwForStagedComponents } from './create-lane';\n\nexport type SwitchProps = {\n laneName: string;\n ids?: BitId[];\n laneBitIds?: BitId[]; // only needed for the deprecated onLanesOnly prop. once this prop is removed, this prop can be removed as well.\n pattern?: string;\n existingOnWorkspaceOnly: boolean;\n remoteLane?: Lane;\n localTrackedLane?: string;\n alias?: string;\n};\n\nexport class LaneSwitcher {\n private consumer: Consumer;\n private laneIdToSwitchTo: LaneId; // populated by `this.populateSwitchProps()`\n private laneToSwitchTo: Lane | undefined; // populated by `this.populateSwitchProps()`, if default-lane, it's undefined\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private switchProps: SwitchProps,\n private checkoutProps: CheckoutPropsLegacy,\n private Lanes: LanesMain\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n async switch(): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(`switching lanes`);\n if (this.workspace.isOnMain()) {\n await throwForStagedComponents(this.consumer);\n }\n await this.populateSwitchProps();\n const bitMapIds = this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved;\n const idsToSwitch = this.switchProps.ids || [];\n const idsWithVersion = idsToSwitch.map((id) => {\n const bitMapId = bitMapIds.searchWithoutVersion(id);\n return bitMapId || id;\n });\n const ids = await this.workspace.resolveMultipleComponentIds(idsWithVersion);\n\n const checkoutProps: CheckoutProps = {\n ...this.checkoutProps,\n ids,\n allowAddingComponentsFromScope: true,\n versionPerId: await this.workspace.resolveMultipleComponentIds(idsToSwitch),\n };\n\n const results = await this.Lanes.checkout.checkout(checkoutProps);\n\n await this.saveLanesData();\n await this.consumer.onDestroy();\n\n return results;\n }\n\n private async populateSwitchProps() {\n const laneId = await this.consumer.scope.lanes.parseLaneIdFromString(this.switchProps.laneName);\n\n const localLane = await this.consumer.scope.loadLane(laneId);\n const mainIds = await this.consumer.getIdsOfDefaultLane();\n if (laneId.isDefault()) {\n await this.populatePropsAccordingToDefaultLane();\n this.switchProps.ids = mainIds;\n } else {\n const laneIds = localLane\n ? this.populatePropsAccordingToLocalLane(localLane)\n : await this.populatePropsAccordingToRemoteLane(laneId);\n const idsOnLaneOnly = laneIds.filter((id) => !mainIds.find((i) => i.isEqualWithoutVersion(id)));\n const idsOnMainOnly = mainIds.filter((id) => !laneIds.find((i) => i.isEqualWithoutVersion(id)));\n this.switchProps.ids = [...idsOnMainOnly, ...laneIds];\n this.switchProps.laneBitIds = idsOnLaneOnly;\n }\n\n if (this.switchProps.pattern) {\n if (this.consumer.bitMap.getAllBitIdsFromAllLanes().length) {\n // if the workspace is not empty, it's possible that it has components from lane-x, and is now switching\n // partially to lane-y, while lane-y has the same components as lane-x. in which case, the user ends up with\n // an invalid state of components from lane-x and lane-y together.\n throw new BitError('error: use --pattern only when the workspace is empty');\n }\n const allIds = await this.workspace.resolveMultipleComponentIds(this.switchProps.ids || []);\n const patternIds = this.workspace.scope.filterIdsFromPoolIdsByPattern(this.switchProps.pattern, allIds);\n this.switchProps.ids = patternIds.map((id) => id._legacy);\n }\n }\n\n private async populatePropsAccordingToRemoteLane(remoteLaneId: LaneId): Promise<BitId[]> {\n this.laneIdToSwitchTo = remoteLaneId;\n this.logger.debug(`populatePropsAccordingToRemoteLane, remoteLaneId: ${remoteLaneId.toString()}`);\n if (this.consumer.getCurrentLaneId().isEqual(remoteLaneId)) {\n throw new BitError(`already checked out to \"${remoteLaneId.toString()}\"`);\n }\n const remoteLane = await this.Lanes.fetchLaneWithItsComponents(remoteLaneId);\n this.switchProps.laneName = remoteLaneId.name;\n this.switchProps.localTrackedLane = this.consumer.scope.lanes.getAliasByLaneId(remoteLaneId) || undefined;\n this.switchProps.remoteLane = remoteLane;\n this.laneToSwitchTo = remoteLane;\n this.logger.debug(`populatePropsAccordingToRemoteLane, completed`);\n return remoteLane.components.map((l) => l.id.changeVersion(l.head.toString()));\n }\n\n private async populatePropsAccordingToDefaultLane() {\n if (this.consumer.isOnMain()) {\n throw new BitError(`already checked out to \"${this.switchProps.laneName}\"`);\n }\n this.laneIdToSwitchTo = LaneId.from(DEFAULT_LANE, this.consumer.scope.name);\n }\n\n private populatePropsAccordingToLocalLane(localLane: Lane): BitId[] {\n if (this.consumer.getCurrentLaneId().name === this.switchProps.laneName) {\n throw new BitError(`already checked out to \"${this.switchProps.laneName}\"`);\n }\n this.laneIdToSwitchTo = localLane.toLaneId();\n this.laneToSwitchTo = localLane;\n return localLane.components.map((c) => c.id.changeVersion(c.head.toString()));\n }\n\n private async saveLanesData() {\n const localLaneName = this.switchProps.alias || this.laneIdToSwitchTo.name;\n if (this.switchProps.remoteLane) {\n if (!this.switchProps.localTrackedLane) {\n this.consumer.scope.lanes.trackLane({\n localLane: localLaneName,\n remoteLane: this.laneIdToSwitchTo.name,\n remoteScope: this.laneIdToSwitchTo.scope,\n });\n }\n }\n\n this.consumer.setCurrentLane(this.laneIdToSwitchTo, !this.laneToSwitchTo?.isNew);\n this.consumer.bitMap.syncWithIds(\n BitIds.fromArray(this.switchProps.ids || []),\n BitIds.fromArray(this.switchProps.laneBitIds || [])\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,S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5,6 +5,7 @@ export declare class SwitchCmd implements Command {
5
5
  private lanes;
6
6
  name: string;
7
7
  description: string;
8
+ extendedDescription: string;
8
9
  private: boolean;
9
10
  alias: string;
10
11
  arguments: {
@@ -33,6 +33,7 @@ class SwitchCmd {
33
33
  this.lanes = lanes;
34
34
  (0, _defineProperty2().default)(this, "name", 'switch <lane> [pattern]');
35
35
  (0, _defineProperty2().default)(this, "description", `switch to the specified lane`);
36
+ (0, _defineProperty2().default)(this, "extendedDescription", ``);
36
37
  (0, _defineProperty2().default)(this, "private", true);
37
38
  (0, _defineProperty2().default)(this, "alias", '');
38
39
  (0, _defineProperty2().default)(this, "arguments", [{
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","SwitchCmd","constructor","lanes","_defineProperty2","default","name","description","report","lane","alias","merge","getAll","skipDependencyInstallation","pattern","json","components","failedComponents","installationError","compilationError","switchLanes","JSON","stringify","getFailureOutput","length","title","body","map","failedComponent","color","unchangedLegitimately","chalk","bold","id","toString","failureMessage","join","getSuccessfulOutput","laneSwitched","green","component","componentName","toStringWithoutVersion","version","applyVersionReport","componentsStr","failedOutput","successOutput","installationErrorOutput","compilationErrorOutput","exports"],"sources":["switch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { applyVersionReport, installationErrorOutput, compilationErrorOutput } from '@teambit/merging';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { LanesMain } from './lanes.main.runtime';\n\nexport class SwitchCmd implements Command {\n name = 'switch <lane> [pattern]';\n description = `switch to the specified lane`;\n private = true;\n alias = '';\n arguments = [\n {\n name: 'lane',\n description: 'lane-name or lane-id (if not exists locally) to switch to',\n },\n ];\n options = [\n [\n 'n',\n 'alias <string>',\n 'relevant when the specified lane is a remote late. name a local lane differently than the remote lane',\n ],\n [\n 'm',\n 'merge [strategy]',\n 'merge local changes with the checked out version. strategy should be \"theirs\", \"ours\" or \"manual\"',\n ],\n ['a', 'get-all', 'checkout all components in a lane include ones that do not exist in the workspace'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\n [\n 'p',\n 'pattern <component-pattern>',\n 'switch only the specified component-pattern. works only when the workspace is empty',\n ],\n ['j', 'json', 'return the output as JSON'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [lane]: [string],\n {\n alias,\n merge,\n getAll = false,\n skipDependencyInstallation = false,\n pattern,\n json = false,\n }: {\n alias?: string;\n merge?: MergeStrategy;\n getAll?: boolean;\n skipDependencyInstallation?: boolean;\n override?: boolean;\n pattern?: string;\n json?: boolean;\n }\n ) {\n const { components, failedComponents, installationError, compilationError } = await this.lanes.switchLanes(lane, {\n alias,\n merge,\n getAll,\n pattern,\n skipDependencyInstallation,\n });\n if (json) {\n return JSON.stringify({ components, failedComponents }, null, 4);\n }\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = 'the switch has been canceled on the following component(s)';\n const body = failedComponents\n .map((failedComponent) => {\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.failureMessage)}`;\n })\n .join('\\n');\n return `${title}\\n${body}\\n\\n`;\n };\n const getSuccessfulOutput = () => {\n const laneSwitched = chalk.green(`\\nsuccessfully set \"${chalk.bold(lane)}\" as the active lane`);\n if (!components || !components.length) return `No component had been changed.${laneSwitched}`;\n if (components.length === 1) {\n const component = components[0];\n const componentName = component.id.toStringWithoutVersion();\n const title = `successfully switched ${chalk.bold(componentName)} to version ${chalk.bold(\n component.id.version as string\n )}\\n`;\n return `${title} ${applyVersionReport(components, false)}${laneSwitched}`;\n }\n const title = `successfully switched the following components to the version of ${lane}\\n\\n`;\n const componentsStr = applyVersionReport(components, true, false);\n return title + componentsStr + laneSwitched;\n };\n const failedOutput = getFailureOutput();\n const successOutput = getSuccessfulOutput();\n return (\n failedOutput +\n successOutput +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMI,SAAS,CAAoB;EAiCxCC,WAAWA,CAASC,KAAgB,EAAE;IAAA,KAAlBA,KAAgB,GAAhBA,KAAgB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAhC7B,yBAAyB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACjB,8BAA6B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBAClC,IAAI;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACN,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBACE,CACV;MACEC,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE;IACf,CAAC,CACF;IAAA,IAAAH,gBAAA,GAAAC,OAAA,mBACS,CACR,CACE,GAAG,EACH,gBAAgB,EAChB,uGAAuG,CACxG,EACD,CACE,GAAG,EACH,kBAAkB,EAClB,mGAAmG,CACpG,EACD,CAAC,GAAG,EAAE,SAAS,EAAE,mFAAmF,CAAC,EACrG,CAAC,GAAG,EAAE,8BAA8B,EAAE,oDAAoD,CAAC,EAC3F,CACE,GAAG,EACH,6BAA6B,EAC7B,qFAAqF,CACtF,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,2BAA2B,CAAC,CAC3C;IAAA,IAAAD,gBAAA,GAAAC,OAAA,kBACQ,IAAI;EAE0B;EAEvC,MAAMG,MAAMA,CACV,CAACC,IAAI,CAAW,EAChB;IACEC,KAAK;IACLC,KAAK;IAC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c,YAAa,EAAC;MAC7F,IAAItB,UAAU,CAACQ,MAAM,KAAK,CAAC,EAAE;QAC3B,MAAMgB,SAAS,GAAGxB,UAAU,CAAC,CAAC,CAAC;QAC/B,MAAMyB,aAAa,GAAGD,SAAS,CAACP,EAAE,CAACS,sBAAsB,CAAC,CAAC;QAC3D,MAAMjB,KAAK,GAAI,yBAAwBM,gBAAK,CAACC,IAAI,CAACS,aAAa,CAAE,eAAcV,gBAAK,CAACC,IAAI,CACvFQ,SAAS,CAACP,EAAE,CAACU,OACf,CAAE,IAAG;QACL,OAAQ,GAAElB,KAAM,IAAG,IAAAmB,6BAAkB,EAAC5B,UAAU,EAAE,KAAK,CAAE,GAAEsB,YAAa,EAAC;MAC3E;MACA,MAAMb,KAAK,GAAI,oEAAmEhB,IAAK,MAAK;MAC5F,MAAMoC,aAAa,GAAG,IAAAD,6BAAkB,EAAC5B,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;MACjE,OAAOS,KAAK,GAAGoB,aAAa,GAAGP,YAAY;IAC7C,CAAC;IACD,MAAMQ,YAAY,GAAGvB,gBAAgB,CAAC,CAAC;IACvC,MAAMwB,aAAa,GAAGV,mBAAmB,CAAC,CAAC;IAC3C,OACES,YAAY,GACZC,aAAa,GACb,IAAAC,kCAAuB,EAAC9B,iBAAiB,CAAC,GAC1C,IAAA+B,iCAAsB,EAAC9B,gBAAgB,CAAC;EAE5C;AACF;AAAC+B,OAAA,CAAAjD,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","SwitchCmd","constructor","lanes","_defineProperty2","default","name","description","report","lane","alias","merge","getAll","skipDependencyInstallation","pattern","json","components","failedComponents","installationError","compilationError","switchLanes","JSON","stringify","getFailureOutput","length","title","body","map","failedComponent","color","unchangedLegitimately","chalk","bold","id","toString","failureMessage","join","getSuccessfulOutput","laneSwitched","green","component","componentName","toStringWithoutVersion","version","applyVersionReport","componentsStr","failedOutput","successOutput","installationErrorOutput","compilationErrorOutput","exports"],"sources":["switch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { applyVersionReport, installationErrorOutput, compilationErrorOutput } from '@teambit/merging';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { LanesMain } from './lanes.main.runtime';\n\nexport class SwitchCmd implements Command {\n name = 'switch <lane> [pattern]';\n description = `switch to the specified lane`;\n extendedDescription = ``;\n private = true;\n alias = '';\n arguments = [\n {\n name: 'lane',\n description: 'lane-name or lane-id (if not exists locally) to switch to',\n },\n ];\n options = [\n [\n 'n',\n 'alias <string>',\n 'relevant when the specified lane is a remote late. name a local lane differently than the remote lane',\n ],\n [\n 'm',\n 'merge [strategy]',\n 'merge local changes with the checked out version. strategy should be \"theirs\", \"ours\" or \"manual\"',\n ],\n ['a', 'get-all', 'checkout all components in a lane include ones that do not exist in the workspace'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\n [\n 'p',\n 'pattern <component-pattern>',\n 'switch only the specified component-pattern. works only when the workspace is empty',\n ],\n ['j', 'json', 'return the output as JSON'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [lane]: [string],\n {\n alias,\n merge,\n getAll = false,\n skipDependencyInstallation = false,\n pattern,\n json = false,\n }: {\n alias?: string;\n merge?: MergeStrategy;\n getAll?: boolean;\n skipDependencyInstallation?: boolean;\n override?: boolean;\n pattern?: string;\n json?: boolean;\n }\n ) {\n const { components, failedComponents, installationError, compilationError } = await this.lanes.switchLanes(lane, {\n alias,\n merge,\n getAll,\n pattern,\n skipDependencyInstallation,\n });\n if (json) {\n return JSON.stringify({ components, failedComponents }, null, 4);\n }\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = 'the switch has been canceled on the following component(s)';\n const body = failedComponents\n .map((failedComponent) => {\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.failureMessage)}`;\n })\n .join('\\n');\n return `${title}\\n${body}\\n\\n`;\n };\n const getSuccessfulOutput = () => {\n const laneSwitched = chalk.green(`\\nsuccessfully set \"${chalk.bold(lane)}\" as the active lane`);\n if (!components || !components.length) return `No component had been changed.${laneSwitched}`;\n if (components.length === 1) {\n const component = components[0];\n const componentName = component.id.toStringWithoutVersion();\n const title = `successfully switched ${chalk.bold(componentName)} to version ${chalk.bold(\n component.id.version as string\n )}\\n`;\n return `${title} ${applyVersionReport(components, false)}${laneSwitched}`;\n }\n const title = `successfully switched the following components to the version of ${lane}\\n\\n`;\n const componentsStr = applyVersionReport(components, true, false);\n return title + componentsStr + laneSwitched;\n };\n const failedOutput = getFailureOutput();\n const successOutput = getSuccessfulOutput();\n return (\n failedOutput +\n successOutput +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMI,SAAS,CAAoB;EAkCxCC,WAAWA,CAASC,KAAgB,EAAE;IAAA,KAAlBA,KAAgB,GAAhBA,KAAgB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAjC7B,yBAAyB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACjB,8BAA6B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BACrB,EAAC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACd,IAAI;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACN,EAAE;IAAA,IAAAD,gBAAA,GAAAC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gBAAgB,CAAC,CAAC;IACvC,MAAMwB,aAAa,GAAGV,mBAAmB,CAAC,CAAC;IAC3C,OACES,YAAY,GACZC,aAAa,GACb,IAAAC,kCAAuB,EAAC9B,iBAAiB,CAAC,GAC1C,IAAA+B,iCAAsB,EAAC9B,gBAAgB,CAAC;EAE5C;AACF;AAAC+B,OAAA,CAAAjD,SAAA,GAAAA,SAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/lanes",
3
- "version": "0.0.697",
3
+ "version": "0.0.698",
4
4
  "homepage": "https://bit.cloud/teambit/lanes/lanes",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.lanes",
8
8
  "name": "lanes",
9
- "version": "0.0.697"
9
+ "version": "0.0.698"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -23,37 +23,37 @@
23
23
  "@teambit/scope.ui.scope-icon": "0.0.91",
24
24
  "@teambit/bit-error": "0.0.402",
25
25
  "@teambit/component-version": "0.0.409",
26
- "@teambit/lane-id": "0.0.267",
27
- "@teambit/scope": "0.0.1125",
28
- "@teambit/snapping": "0.0.440",
29
- "@teambit/workspace": "0.0.1125",
30
- "@teambit/lanes.ui.models.lanes-model": "0.0.167",
31
- "@teambit/cli": "0.0.752",
32
- "@teambit/express": "0.0.850",
33
- "@teambit/logger": "0.0.845",
34
- "@teambit/graphql": "0.0.1125",
35
- "@teambit/component-compare": "0.0.373",
36
- "@teambit/component-writer": "0.0.161",
37
- "@teambit/component": "0.0.1125",
38
- "@teambit/export": "0.0.1125",
39
- "@teambit/importer": "0.0.554",
40
- "@teambit/lanes.entities.lane-diff": "0.0.112",
41
- "@teambit/lanes.modules.diff": "0.0.385",
42
- "@teambit/merging": "0.0.440",
43
- "@teambit/remove": "0.0.302",
44
- "@teambit/lanes.hooks.use-lanes": "0.0.214",
45
- "@teambit/lanes.hooks.use-viewed-lane-from-url": "0.0.176",
46
- "@teambit/lanes.ui.compare.lane-compare-page": "0.0.110",
47
- "@teambit/lanes.ui.compare.lane-compare": "0.0.128",
48
- "@teambit/lanes.ui.lane-overview": "0.0.169",
26
+ "@teambit/lane-id": "0.0.268",
27
+ "@teambit/scope": "0.0.1126",
28
+ "@teambit/snapping": "0.0.441",
29
+ "@teambit/workspace": "0.0.1126",
30
+ "@teambit/lanes.ui.models.lanes-model": "0.0.168",
31
+ "@teambit/cli": "0.0.753",
32
+ "@teambit/express": "0.0.851",
33
+ "@teambit/logger": "0.0.846",
34
+ "@teambit/graphql": "0.0.1126",
35
+ "@teambit/checkout": "0.0.295",
36
+ "@teambit/component-compare": "0.0.374",
37
+ "@teambit/component-writer": "0.0.162",
38
+ "@teambit/component": "0.0.1126",
39
+ "@teambit/export": "0.0.1126",
40
+ "@teambit/importer": "0.0.555",
41
+ "@teambit/lanes.entities.lane-diff": "0.0.113",
42
+ "@teambit/lanes.modules.diff": "0.0.386",
43
+ "@teambit/merging": "0.0.441",
44
+ "@teambit/remove": "0.0.303",
45
+ "@teambit/lanes.hooks.use-lanes": "0.0.215",
46
+ "@teambit/lanes.hooks.use-viewed-lane-from-url": "0.0.177",
47
+ "@teambit/lanes.ui.compare.lane-compare-page": "0.0.111",
48
+ "@teambit/lanes.ui.compare.lane-compare": "0.0.129",
49
+ "@teambit/lanes.ui.lane-overview": "0.0.170",
49
50
  "@teambit/lanes.ui.menus.lanes-overview-menu": "0.0.5",
50
- "@teambit/lanes.ui.menus.use-lanes-menu": "0.0.167",
51
- "@teambit/lanes.ui.navigation.lane-switcher": "0.0.171",
51
+ "@teambit/lanes.ui.menus.use-lanes-menu": "0.0.168",
52
+ "@teambit/lanes.ui.navigation.lane-switcher": "0.0.172",
52
53
  "@teambit/ui-foundation.ui.menu": "0.0.497",
53
54
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
54
55
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.496",
55
- "@teambit/ui": "0.0.1125",
56
- "@teambit/checkout": "0.0.294"
56
+ "@teambit/ui": "0.0.1126"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/lodash": "4.14.165",
@@ -65,13 +65,13 @@
65
65
  "@types/react-dom": "^17.0.5",
66
66
  "@types/jest": "^26.0.0",
67
67
  "@types/testing-library__jest-dom": "5.9.5",
68
- "@teambit/component.testing.mock-components": "0.0.114",
69
- "@teambit/harmony.testing.load-aspect": "0.0.113",
68
+ "@teambit/component.testing.mock-components": "0.0.115",
69
+ "@teambit/harmony.testing.load-aspect": "0.0.114",
70
70
  "@teambit/workspace.testing.mock-workspace": "0.0.14"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react-router-dom": "^6.0.0",
74
- "@teambit/legacy": "1.0.532",
74
+ "@teambit/legacy": "1.0.535",
75
75
  "react": "^16.8.0 || ^17.0.0",
76
76
  "react-dom": "^16.8.0 || ^17.0.0"
77
77
  },