@teambit/checkout 0.0.243 → 0.0.245

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.
@@ -5,6 +5,7 @@ import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';
5
5
  import { ApplyVersionResult, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
6
6
  import { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';
7
7
  import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
8
+ import { Workspace } from '@teambit/workspace';
8
9
  export declare type CheckoutProps = {
9
10
  version?: string;
10
11
  ids?: BitId[];
@@ -20,16 +21,18 @@ export declare type CheckoutProps = {
20
21
  ignoreDist?: boolean;
21
22
  isLane?: boolean;
22
23
  };
23
- export declare type ComponentStatus = {
24
- componentFromFS?: ConsumerComponent;
24
+ export declare type ComponentStatusBase = {
25
+ currentComponent?: ConsumerComponent;
25
26
  componentFromModel?: Version;
26
27
  id: BitId;
28
+ shouldBeRemoved?: boolean;
29
+ };
30
+ export declare type ComponentStatus = ComponentStatusBase & {
27
31
  failureMessage?: string;
28
32
  unchangedLegitimately?: boolean;
29
- shouldBeRemoved?: boolean;
30
33
  mergeResults?: MergeResultsThreeWay | null | undefined;
31
34
  };
32
- declare type ApplyVersionWithComps = {
35
+ export declare type ApplyVersionWithComps = {
33
36
  applyVersionResult: ApplyVersionResult;
34
37
  component?: ConsumerComponent;
35
38
  };
@@ -72,5 +75,4 @@ export declare function markFilesToBeRemovedIfNeeded(succeededComponents: Compon
72
75
  * it's needed in case the checked out version removed files that exist on the current version.
73
76
  * without this function, these files would be left on the filesystem.
74
77
  */
75
- export declare function deleteFilesIfNeeded(componentsResults: ApplyVersionWithComps[], consumer: Consumer): Promise<void>;
76
- export {};
78
+ export declare function deleteFilesIfNeeded(componentsResults: ApplyVersionWithComps[], workspace: Workspace): Promise<void>;
@@ -221,17 +221,17 @@ function applyModifiedVersion(componentFiles, mergeResults, mergeStrategy) {
221
221
  * this function only mark them as such. later `deleteFilesIfNeeded()` will delete them
222
222
  */
223
223
  function markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults) {
224
- const succeededComponentsByBitId = succeededComponents.reduce((accum, next) => {
225
- const bitId = next.id.toString();
226
- if (!accum[bitId]) accum[bitId] = next;
224
+ const succeededComponentsByBitId = succeededComponents.reduce((accum, current) => {
225
+ const bitId = current.id.toStringWithoutVersion();
226
+ if (!accum[bitId]) accum[bitId] = current;
227
227
  return accum;
228
228
  }, {});
229
229
  componentsResults.forEach(componentResult => {
230
230
  var _succeededComponent$c;
231
231
  const existingFilePathsFromModel = componentResult.applyVersionResult.filesStatus;
232
- const bitId = componentResult.applyVersionResult.id.toString();
232
+ const bitId = componentResult.applyVersionResult.id.toStringWithoutVersion();
233
233
  const succeededComponent = succeededComponentsByBitId[bitId];
234
- const filePathsFromFS = ((_succeededComponent$c = succeededComponent.componentFromFS) === null || _succeededComponent$c === void 0 ? void 0 : _succeededComponent$c.files) || [];
234
+ const filePathsFromFS = ((_succeededComponent$c = succeededComponent.currentComponent) === null || _succeededComponent$c === void 0 ? void 0 : _succeededComponent$c.files) || [];
235
235
  filePathsFromFS.forEach(file => {
236
236
  const filename = (0, _path2().pathNormalizeToLinux)(file.relative);
237
237
  if (!existingFilePathsFromModel[filename]) {
@@ -246,13 +246,15 @@ function markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults) {
246
246
  * it's needed in case the checked out version removed files that exist on the current version.
247
247
  * without this function, these files would be left on the filesystem.
248
248
  */
249
- async function deleteFilesIfNeeded(componentsResults, consumer) {
249
+ async function deleteFilesIfNeeded(componentsResults, workspace) {
250
250
  const pathsToRemoveIncludeNull = componentsResults.map(compResult => {
251
251
  return Object.keys(compResult.applyVersionResult.filesStatus).map(filePath => {
252
252
  if (compResult.applyVersionResult.filesStatus[filePath] === _mergeVersion().FileStatus.removed) {
253
- var _compResult$component, _compResult$component2;
254
- if (!((_compResult$component = compResult.component) !== null && _compResult$component !== void 0 && _compResult$component.writtenPath)) return null;
255
- return path().join((_compResult$component2 = compResult.component) === null || _compResult$component2 === void 0 ? void 0 : _compResult$component2.writtenPath, filePath);
253
+ var _compResult$component;
254
+ if (!compResult.component) return null;
255
+ const compDir = compResult.component.writtenPath || ((_compResult$component = compResult.component.componentMap) === null || _compResult$component === void 0 ? void 0 : _compResult$component.rootDir);
256
+ if (!compDir) return null;
257
+ return path().join(compDir, filePath);
256
258
  }
257
259
  return null;
258
260
  });
@@ -260,7 +262,7 @@ async function deleteFilesIfNeeded(componentsResults, consumer) {
260
262
  const pathsToRemove = (0, _lodash().compact)(pathsToRemoveIncludeNull.flat());
261
263
  const dataToPersist = new (_dataToPersist().default)();
262
264
  dataToPersist.removeManyPaths(pathsToRemove.map(p => new (_removePath().default)(p, true)));
263
- dataToPersist.addBasePath(consumer.getPath());
265
+ dataToPersist.addBasePath(workspace.path);
264
266
  await dataToPersist.persistAllToFS();
265
267
  }
266
268
 
@@ -1 +1 @@
1
- {"version":3,"names":["applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","filesStatus","hasConflicts","MergeOptions","ours","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","GeneralError","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","componentFiles","map","clone","manual","filePath","path","normalize","foundFile","find","componentFile","conflict","contents","Buffer","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","push","added","deletedConflictFiles","removeFiles","removed","filter","f","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","markFilesToBeRemovedIfNeeded","succeededComponents","componentsResults","succeededComponentsByBitId","reduce","accum","next","bitId","componentResult","existingFilePathsFromModel","succeededComponent","filePathsFromFS","filename","deleteFilesIfNeeded","pathsToRemoveIncludeNull","compResult","Object","keys","writtenPath","join","pathsToRemove","compact","flat","dataToPersist","DataToPersist","removeManyPaths","p","RemovePath","addBasePath","getPath","persistAllToFS"],"sources":["checkout-version.ts"],"sourcesContent":["import { compact } from 'lodash';\nimport * as path from 'path';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport {\n ApplyVersionResult,\n FileStatus,\n MergeOptions,\n MergeStrategy,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\n\nexport type CheckoutProps = {\n version?: string; // if reset is true, the version is undefined\n ids?: BitId[];\n latestVersion?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n ignorePackageJson?: boolean;\n writeConfig?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n ignoreDist?: boolean;\n isLane?: boolean;\n};\nexport type ComponentStatus = {\n componentFromFS?: ConsumerComponent;\n componentFromModel?: Version;\n id: BitId;\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n shouldBeRemoved?: boolean;\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\ntype ApplyVersionWithComps = { applyVersionResult: ApplyVersionResult; component?: ConsumerComponent };\n\n/**\n * 1) when the files are modified with conflicts and the strategy is \"ours\", leave the FS as is\n * and update only bitmap id version. (not the componentMap object).\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", write the component\n * according to id.version.\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * 4) when --reset flag is used, write the component according to the bitmap version\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: BitId,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy } = checkoutProps;\n let filesStatus = {};\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n // even when isLane is true, the mergeResults is possible only when the component is on the filesystem\n // otherwise it's impossible to have conflicts\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new GeneralError('applyVersion: componentMap was not found');\n\n const files = component.files;\n files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\n/**\n * relevant only when\n * 1) there is no conflict => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.output.\n * 2) there is conflict and mergeStrategy is manual => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.conflict.\n *\n * this function only updates the files content, it doesn't write the files\n */\nexport function applyModifiedVersion(\n componentFiles: SourceFile[],\n mergeResults: MergeResultsThreeWay,\n mergeStrategy: MergeStrategy | null | undefined\n): { filesStatus: Record<string, any>; modifiedFiles: SourceFile[] } {\n let modifiedFiles = componentFiles.map((file) => file.clone());\n const filesStatus = {};\n if (mergeResults.hasConflicts && mergeStrategy !== MergeOptions.manual) {\n return { filesStatus, modifiedFiles };\n }\n mergeResults.modifiedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n if (file.conflict) {\n foundFile.contents = Buffer.from(file.conflict);\n filesStatus[file.filePath] = FileStatus.manual;\n } else if (typeof file.output === 'string') {\n foundFile.contents = Buffer.from(file.output);\n filesStatus[file.filePath] = FileStatus.merged;\n } else if (file.isBinaryConflict) {\n // leave the file as is and notify the user later about it.\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.binaryConflict;\n } else {\n throw new GeneralError(`file ${filePath} does not have output nor conflict`);\n }\n });\n\n mergeResults.addFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n if (!file.fsFile) return;\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.removeFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n filesStatus[file.filePath] = FileStatus.removed;\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n });\n mergeResults.remainDeletedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n filesStatus[file.filePath] = FileStatus.remainDeleted;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n filesStatus[file.filePath] = FileStatus.deletedConflict;\n });\n\n mergeResults.overrideFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.overridden;\n });\n mergeResults.updatedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * this function only mark them as such. later `deleteFilesIfNeeded()` will delete them\n */\nexport function markFilesToBeRemovedIfNeeded(\n succeededComponents: ComponentStatus[],\n componentsResults: ApplyVersionWithComps[]\n) {\n const succeededComponentsByBitId: { [K in string]: ComponentStatus } = succeededComponents.reduce((accum, next) => {\n const bitId = next.id.toString();\n if (!accum[bitId]) accum[bitId] = next;\n return accum;\n }, {});\n\n componentsResults.forEach((componentResult) => {\n const existingFilePathsFromModel = componentResult.applyVersionResult.filesStatus;\n const bitId = componentResult.applyVersionResult.id.toString();\n const succeededComponent = succeededComponentsByBitId[bitId];\n const filePathsFromFS = succeededComponent.componentFromFS?.files || [];\n\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!existingFilePathsFromModel[filename]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n existingFilePathsFromModel[filename] = FileStatus.removed;\n }\n });\n });\n}\n\n/**\n * it's needed in case the checked out version removed files that exist on the current version.\n * without this function, these files would be left on the filesystem.\n */\nexport async function deleteFilesIfNeeded(\n componentsResults: ApplyVersionWithComps[],\n consumer: Consumer\n): Promise<void> {\n const pathsToRemoveIncludeNull = componentsResults.map((compResult) => {\n return Object.keys(compResult.applyVersionResult.filesStatus).map((filePath) => {\n if (compResult.applyVersionResult.filesStatus[filePath] === FileStatus.removed) {\n if (!compResult.component?.writtenPath) return null;\n return path.join(compResult.component?.writtenPath, filePath);\n }\n return null;\n });\n });\n const pathsToRemove = compact(pathsToRemoveIncludeNull.flat());\n const dataToPersist = new DataToPersist();\n dataToPersist.removeManyPaths(pathsToRemove.map((p) => new RemovePath(p, true)));\n dataToPersist.addBasePath(consumer.getPath());\n await dataToPersist.persistAllToFS();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKkE;AAAA;AAAA;AAAA;AA+BlE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,YAAY,CAChCC,QAAkB,EAClBC,EAAS,EACTC,eAAqD;AAAE;AACvDC,YAAqD,EACrDC,aAA4B,EACI;EAChC,IAAI,CAACA,aAAa,CAACC,MAAM,IAAI,CAACH,eAAe,EAC3C,MAAM,IAAII,KAAK,CAAE,kDAAiDL,EAAE,CAACM,QAAQ,EAAG,EAAC,CAAC;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AU,EAACD,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;EAChFH,aAAa,CAACK,WAAW,CAAC9F,QAAQ,CAAC+F,OAAO,EAAE,CAAC;EAC7C,MAAMN,aAAa,CAACO,cAAc,EAAE;AACtC"}
1
+ {"version":3,"names":["applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","filesStatus","hasConflicts","MergeOptions","ours","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","GeneralError","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","componentFiles","map","clone","manual","filePath","path","normalize","foundFile","find","componentFile","conflict","contents","Buffer","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","push","added","deletedConflictFiles","removeFiles","removed","filter","f","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","markFilesToBeRemovedIfNeeded","succeededComponents","componentsResults","succeededComponentsByBitId","reduce","accum","current","bitId","toStringWithoutVersion","componentResult","existingFilePathsFromModel","succeededComponent","filePathsFromFS","currentComponent","filename","deleteFilesIfNeeded","workspace","pathsToRemoveIncludeNull","compResult","Object","keys","compDir","writtenPath","rootDir","join","pathsToRemove","compact","flat","dataToPersist","DataToPersist","removeManyPaths","p","RemovePath","addBasePath","persistAllToFS"],"sources":["checkout-version.ts"],"sourcesContent":["import { compact } from 'lodash';\nimport * as path from 'path';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport {\n ApplyVersionResult,\n FileStatus,\n MergeOptions,\n MergeStrategy,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Workspace } from '@teambit/workspace';\n\nexport type CheckoutProps = {\n version?: string; // if reset is true, the version is undefined\n ids?: BitId[];\n latestVersion?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n ignorePackageJson?: boolean;\n writeConfig?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n ignoreDist?: boolean;\n isLane?: boolean;\n};\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: BitId;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = { applyVersionResult: ApplyVersionResult; component?: ConsumerComponent };\n\n/**\n * 1) when the files are modified with conflicts and the strategy is \"ours\", leave the FS as is\n * and update only bitmap id version. (not the componentMap object).\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", write the component\n * according to id.version.\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * 4) when --reset flag is used, write the component according to the bitmap version\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: BitId,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy } = checkoutProps;\n let filesStatus = {};\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n // even when isLane is true, the mergeResults is possible only when the component is on the filesystem\n // otherwise it's impossible to have conflicts\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new GeneralError('applyVersion: componentMap was not found');\n\n const files = component.files;\n files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\n/**\n * relevant only when\n * 1) there is no conflict => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.output.\n * 2) there is conflict and mergeStrategy is manual => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.conflict.\n *\n * this function only updates the files content, it doesn't write the files\n */\nexport function applyModifiedVersion(\n componentFiles: SourceFile[],\n mergeResults: MergeResultsThreeWay,\n mergeStrategy: MergeStrategy | null | undefined\n): { filesStatus: Record<string, any>; modifiedFiles: SourceFile[] } {\n let modifiedFiles = componentFiles.map((file) => file.clone());\n const filesStatus = {};\n if (mergeResults.hasConflicts && mergeStrategy !== MergeOptions.manual) {\n return { filesStatus, modifiedFiles };\n }\n mergeResults.modifiedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n if (file.conflict) {\n foundFile.contents = Buffer.from(file.conflict);\n filesStatus[file.filePath] = FileStatus.manual;\n } else if (typeof file.output === 'string') {\n foundFile.contents = Buffer.from(file.output);\n filesStatus[file.filePath] = FileStatus.merged;\n } else if (file.isBinaryConflict) {\n // leave the file as is and notify the user later about it.\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.binaryConflict;\n } else {\n throw new GeneralError(`file ${filePath} does not have output nor conflict`);\n }\n });\n\n mergeResults.addFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n if (!file.fsFile) return;\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.removeFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n filesStatus[file.filePath] = FileStatus.removed;\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n });\n mergeResults.remainDeletedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n filesStatus[file.filePath] = FileStatus.remainDeleted;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n filesStatus[file.filePath] = FileStatus.deletedConflict;\n });\n\n mergeResults.overrideFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.overridden;\n });\n mergeResults.updatedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * this function only mark them as such. later `deleteFilesIfNeeded()` will delete them\n */\nexport function markFilesToBeRemovedIfNeeded(\n succeededComponents: ComponentStatus[],\n componentsResults: ApplyVersionWithComps[]\n) {\n const succeededComponentsByBitId: {\n [K in string]: ComponentStatus;\n } = succeededComponents.reduce((accum, current) => {\n const bitId = current.id.toStringWithoutVersion();\n if (!accum[bitId]) accum[bitId] = current;\n return accum;\n }, {});\n\n componentsResults.forEach((componentResult) => {\n const existingFilePathsFromModel = componentResult.applyVersionResult.filesStatus;\n const bitId = componentResult.applyVersionResult.id.toStringWithoutVersion();\n const succeededComponent = succeededComponentsByBitId[bitId];\n const filePathsFromFS = succeededComponent.currentComponent?.files || [];\n\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!existingFilePathsFromModel[filename]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n existingFilePathsFromModel[filename] = FileStatus.removed;\n }\n });\n });\n}\n\n/**\n * it's needed in case the checked out version removed files that exist on the current version.\n * without this function, these files would be left on the filesystem.\n */\nexport async function deleteFilesIfNeeded(\n componentsResults: ApplyVersionWithComps[],\n workspace: Workspace\n): Promise<void> {\n const pathsToRemoveIncludeNull = componentsResults.map((compResult) => {\n return Object.keys(compResult.applyVersionResult.filesStatus).map((filePath) => {\n if (compResult.applyVersionResult.filesStatus[filePath] === FileStatus.removed) {\n if (!compResult.component) return null;\n const compDir = compResult.component.writtenPath || compResult.component.componentMap?.rootDir;\n if (!compDir) return null;\n return path.join(compDir, filePath);\n }\n return null;\n });\n });\n const pathsToRemove = compact(pathsToRemoveIncludeNull.flat());\n const dataToPersist = new DataToPersist();\n dataToPersist.removeManyPaths(pathsToRemove.map((p) => new RemovePath(p, true)));\n dataToPersist.addBasePath(workspace.path);\n await dataToPersist.persistAllToFS();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKkE;AAAA;AAAA;AAAA;AAoClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,YAAY,CAChCC,QAAkB,EAClBC,EAAS,EACTC,eAAqD;AAAE;AACvDC,YAAqD,EACrDC,aAA4B,EACI;EAChC,IAAI,CAACA,aAAa,CAACC,MAAM,IAAI,CAACH,eAAe,EAC3C,MAAM,IAAII,KAAK,CAAE,kDAAiDL,EAAE,CAACM,QAAQ,EAAG,EAAC,CAAC;EACpF,MAAM;IAAEC;EAAc,CAAC,GAAGJ,aAAa;EACvC,IAAIK,WAAW,GAAG,CAAC,CAAC;EACpB,IAAIN,YAAY,IAAIA,YAAY,CAACO,YAAY,IAAIF,aAAa,KAAKG,4BAAY,CAACC,IAAI,EAAE;IACpF;IACA;IACA,IAAI,CAACV,eAAe,EAAE,MAAM,IAAII,KAAK,CAAE,kDAAiDL,EAAE,CAACM,QAAQ,EAAG,EAAC,CAAC;IACxGL,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'@teambit/cli';
2
2
  import { Logger, LoggerMain } from '@teambit/logger';
3
3
  import { Workspace } from '@teambit/workspace';
4
- import { BitId } from '@teambit/legacy-bit-id';
5
4
  import { RemoveMain } from '@teambit/remove';
6
5
  import { ApplyVersionResults } from '@teambit/merging';
7
6
  import { ImporterMain } from '@teambit/importer';
8
7
  import { ComponentWriterMain } from '@teambit/component-writer';
9
8
  import { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
10
- import { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';
11
- import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
9
+ import { ModelComponent } from '@teambit/legacy/dist/scope/models';
12
10
  import { ComponentID } from '@teambit/component-id';
11
+ import { ComponentStatusBase } from './checkout-version';
13
12
  export declare type CheckoutProps = {
14
13
  version?: string;
15
14
  ids?: ComponentID[];
@@ -26,13 +25,9 @@ export declare type CheckoutProps = {
26
25
  versionPerId?: ComponentID[];
27
26
  skipUpdatingBitmap?: boolean;
28
27
  };
29
- export declare type ComponentStatusBeforeMergeAttempt = {
30
- componentFromFS?: ConsumerComponent;
31
- componentFromModel?: Version;
32
- id: BitId;
28
+ export declare type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {
33
29
  failureMessage?: string;
34
30
  unchangedLegitimately?: boolean;
35
- shouldBeRemoved?: boolean;
36
31
  propsForMerge?: {
37
32
  currentlyUsedVersion: string;
38
33
  componentModel: ModelComponent;
@@ -222,7 +222,7 @@ class CheckoutMain {
222
222
  });
223
223
  const componentsResults = await (0, _pMapSeries().default)(succeededComponents, ({
224
224
  id,
225
- componentFromFS,
225
+ currentComponent: componentFromFS,
226
226
  mergeResults
227
227
  }) => {
228
228
  return (0, _checkoutVersion().applyVersion)(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);
@@ -250,7 +250,7 @@ class CheckoutMain {
250
250
  skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap
251
251
  };
252
252
  componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);
253
- await (0, _checkoutVersion().deleteFilesIfNeeded)(componentsResults, consumer);
253
+ await (0, _checkoutVersion().deleteFilesIfNeeded)(componentsResults, this.workspace);
254
254
  }
255
255
  const appliedVersionComponents = componentsResults.map(c => c.applyVersionResult);
256
256
  const componentIdsToRemove = allComponentsStatus.filter(componentStatus => componentStatus.shouldBeRemoved).map(c => c.id.changeVersion(undefined));
@@ -430,7 +430,7 @@ class CheckoutMain {
430
430
  // if the component is not modified, no need to try merge the files, they will be written later on according to the
431
431
  // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
432
432
  return {
433
- componentFromFS: component,
433
+ currentComponent: component,
434
434
  componentFromModel: componentVersion,
435
435
  id: newId
436
436
  };
@@ -440,14 +440,14 @@ class CheckoutMain {
440
440
  componentModel
441
441
  };
442
442
  return {
443
- componentFromFS: component,
443
+ currentComponent: component,
444
444
  componentFromModel: componentVersion,
445
445
  id: newId,
446
446
  propsForMerge
447
447
  };
448
448
  }
449
449
  async getMergeStatus({
450
- componentFromFS,
450
+ currentComponent: componentFromFS,
451
451
  componentFromModel,
452
452
  id,
453
453
  propsForMerge
@@ -482,7 +482,7 @@ class CheckoutMain {
482
482
  baseComponent
483
483
  });
484
484
  return {
485
- componentFromFS,
485
+ currentComponent: componentFromFS,
486
486
  componentFromModel,
487
487
  id,
488
488
  mergeResults
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","components","loadComponents","allComponentStatusBeforeMerge","Promise","all","component","getComponentStatusBeforeMergeAttempt","compsNeedMerge","filter","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","push","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","removedComponents","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importWithoutDeps","toVersionLatest","cache","error","unavailableOnMain","getUnavailableOnMainComponents","bitMap","makeComponentsAvailableOnMain","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsOnWorkspace","idsByPattern","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toBitIds","hasWithoutVersion","lane","laneBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","latestVersion","versionPerId","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport {\n FailedComponents,\n getMergeStrategyInteractive,\n MergeStrategy,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport { applyVersion, markFilesToBeRemovedIfNeeded, ComponentStatus, deleteFilesIfNeeded } from './checkout-version';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n latest?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n isLane?: boolean;\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n};\n\nexport type ComponentStatusBeforeMergeAttempt = {\n componentFromFS?: ConsumerComponent;\n componentFromModel?: Version;\n id: BitId;\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain\n ) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const bitIds = BitIds.fromArray(ids?.map((id) => id._legacy) || []);\n const { components } = await consumer.loadComponents(bitIds);\n\n const allComponentStatusBeforeMerge = await Promise.all(\n components.map((component) => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps))\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({\n ids: BitIds.fromArray(toImport),\n });\n\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!promptMergeOptions && !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 (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.failureMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\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 checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id._legacy) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n });\n\n markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults);\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n if (!checkoutProps.workspaceOnly) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id._legacy))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n async checkoutByCLIValues(\n to: CheckoutTo,\n componentPattern: string,\n checkoutProps: CheckoutProps\n ): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(BEFORE_CHECKOUT);\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\n if (to === 'head') await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(to, componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy();\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !id._legacy.hasScope()).map((id) => id._legacy.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(BitIds.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components, if these components are really new, ignore the error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async parseValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps) {\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else {\n if (!BitId.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new GeneralError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new GeneralError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.workspaceOnly && !checkoutProps.head) {\n throw new BitError(`--workspace-only flag can only be used with \"head\" (bit checkout head --workspace-only)`);\n }\n const idsOnWorkspace = componentPattern\n ? await this.workspace.idsByPattern(componentPattern)\n : await this.workspace.listIds();\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toBitIds();\n const ids = currentLaneIds\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id._legacy))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n // current lane object is up to date due to the previous `importCurrentObjects()` call\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toBitIds();\n const newIds = laneBitIds.filter((bitId) => !ids.find((id) => id._legacy.isEqualWithoutVersion(bitId)));\n const newComponentIds = await this.workspace.resolveMultipleComponentIds(newIds);\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const { version, head: headVersion, reset, latest: latestVersion, versionPerId } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id: component.id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.failureMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);\n }\n const unmerged = repo.unmergedComponents.getEntry(component.name);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const getNewVersion = async (): Promise<string> => {\n if (reset) return component.id.version as string;\n\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (latestVersion) return componentModel.latestVersion();\n if (versionPerId)\n return versionPerId.find((id) => id._legacy.isEqualWithoutVersion(component.id))?.version as string;\n\n // @ts-ignore if !reset the version is defined\n return version;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion)\n return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const existingBitMapId = consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const currentlyUsedVersion = existingBitMapId.version;\n if (!currentlyUsedVersion) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);\n }\n if (version && currentlyUsedVersion === version) {\n // it won't be relevant for 'reset' as it doesn't have a version\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);\n }\n if (headVersion && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\n }\n }\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n const isModified = await consumer.isComponentModified(currentVersionObject, component);\n if (!isModified && reset) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version | undefined;\n if (componentVersion?.isRemoved() && existingBitMapId) {\n componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = component.id.changeVersion(newVersion);\n\n if (reset || !isModified) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n componentFromFS,\n componentFromModel,\n id,\n propsForMerge,\n }: ComponentStatusBeforeMergeAttempt): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n const baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n const baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: componentFromFS,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n\n return { componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect, ImporterAspect, RemoveAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove);\n cli.register(new CheckoutCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAsH;AAAA;AAAA;AAAA;AAkC/G,MAAMA,YAAY,CAAC;EACxBC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,eAAoC,EACpCC,QAAsB,EACtBC,MAAkB,EAC1B;IAAA,KALQJ,SAAoB,GAAp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E7H,eAAe;MACjC8H,YAAY,EAAG,GAAE9J,oBAAqB,WAAU;MAChDyJ;IACF,CAAC,CAAC;IAEF,OAAO;MAAEzH,eAAe;MAAEuH,kBAAkB;MAAE1K,EAAE;MAAEoC;IAAa,CAAC;EAClE;EAOA,aAAa8I,QAAQ,CAAC,CAACC,GAAG,EAAEnM,SAAS,EAAEoM,UAAU,EAAEC,UAAU,EAAElM,QAAQ,EAAEC,MAAM,CAO9E,EAAE;IACD,MAAMH,MAAM,GAAGmM,UAAU,CAACE,YAAY,CAACC,0BAAc,CAACvL,EAAE,CAAC;IACzD,MAAMwL,YAAY,GAAG,IAAI1M,YAAY,CAACE,SAAS,EAAEC,MAAM,EAAEoM,UAAU,EAAElM,QAAQ,EAAEC,MAAM,CAAC;IACtF+L,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAtXY1M,YAAY,WAoWR,EAAE;AAAA,gCApWNA,YAAY,kBAqWD,CAAC6M,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,mBAAc,EAAEC,iBAAY,CAAC;AAAA,gCArW1GlN,YAAY,aAuWNmN,kBAAW;AAiB9BV,0BAAc,CAACW,UAAU,CAACpN,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
1
+ {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","components","loadComponents","allComponentStatusBeforeMerge","Promise","all","component","getComponentStatusBeforeMergeAttempt","compsNeedMerge","filter","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","push","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","currentComponent","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","removedComponents","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importWithoutDeps","toVersionLatest","cache","error","unavailableOnMain","getUnavailableOnMainComponents","bitMap","makeComponentsAvailableOnMain","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsOnWorkspace","idsByPattern","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toBitIds","hasWithoutVersion","lane","laneBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","latestVersion","versionPerId","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport {\n FailedComponents,\n getMergeStrategyInteractive,\n MergeStrategy,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n ComponentStatusBase,\n} from './checkout-version';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n latest?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n isLane?: boolean;\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain\n ) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const bitIds = BitIds.fromArray(ids?.map((id) => id._legacy) || []);\n const { components } = await consumer.loadComponents(bitIds);\n\n const allComponentStatusBeforeMerge = await Promise.all(\n components.map((component) => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps))\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({\n ids: BitIds.fromArray(toImport),\n });\n\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!promptMergeOptions && !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 (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.failureMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\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 checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id._legacy) };\n const componentsResults = await mapSeries(\n succeededComponents,\n ({ id, currentComponent: componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n }\n );\n\n markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults);\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n if (!checkoutProps.workspaceOnly) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id._legacy))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, this.workspace);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n async checkoutByCLIValues(\n to: CheckoutTo,\n componentPattern: string,\n checkoutProps: CheckoutProps\n ): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(BEFORE_CHECKOUT);\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\n if (to === 'head') await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(to, componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy();\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !id._legacy.hasScope()).map((id) => id._legacy.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(BitIds.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components, if these components are really new, ignore the error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async parseValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps) {\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else {\n if (!BitId.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new GeneralError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new GeneralError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.workspaceOnly && !checkoutProps.head) {\n throw new BitError(`--workspace-only flag can only be used with \"head\" (bit checkout head --workspace-only)`);\n }\n const idsOnWorkspace = componentPattern\n ? await this.workspace.idsByPattern(componentPattern)\n : await this.workspace.listIds();\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toBitIds();\n const ids = currentLaneIds\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id._legacy))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n // current lane object is up to date due to the previous `importCurrentObjects()` call\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toBitIds();\n const newIds = laneBitIds.filter((bitId) => !ids.find((id) => id._legacy.isEqualWithoutVersion(bitId)));\n const newComponentIds = await this.workspace.resolveMultipleComponentIds(newIds);\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const { version, head: headVersion, reset, latest: latestVersion, versionPerId } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id: component.id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.failureMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);\n }\n const unmerged = repo.unmergedComponents.getEntry(component.name);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const getNewVersion = async (): Promise<string> => {\n if (reset) return component.id.version as string;\n\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (latestVersion) return componentModel.latestVersion();\n if (versionPerId)\n return versionPerId.find((id) => id._legacy.isEqualWithoutVersion(component.id))?.version as string;\n\n // @ts-ignore if !reset the version is defined\n return version;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion)\n return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const existingBitMapId = consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const currentlyUsedVersion = existingBitMapId.version;\n if (!currentlyUsedVersion) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);\n }\n if (version && currentlyUsedVersion === version) {\n // it won't be relevant for 'reset' as it doesn't have a version\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);\n }\n if (headVersion && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\n }\n }\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n const isModified = await consumer.isComponentModified(currentVersionObject, component);\n if (!isModified && reset) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version | undefined;\n if (componentVersion?.isRemoved() && existingBitMapId) {\n componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = component.id.changeVersion(newVersion);\n\n if (reset || !isModified) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n return { currentComponent: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { currentComponent: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n currentComponent: componentFromFS,\n componentFromModel,\n id,\n propsForMerge,\n }: ComponentStatusBeforeMergeAttempt): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n const baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n const baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: componentFromFS,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n\n return { currentComponent: componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect, ImporterAspect, RemoveAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove);\n cli.register(new CheckoutCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAM4B;AAAA;AAAA;AAAA;AA8BrB,MAAMA,YAAY,CAAC;EACxBC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,eAAoC,EACpCC,QAAsB,EACtBC,MAAkB,EAC1B;IAAA,KALQJ,SAAoB,GAApBA,SAAoB;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cAAc;MACdE,UAAU,EAAEzB,UAAU;MACtBpG,gBAAgB,EAAEC,eAAe;MACjC6H,YAAY,EAAG,GAAE9J,oBAAqB,WAAU;MAChD0J;IACF,CAAC,CAAC;IAEF,OAAO;MAAE1H,gBAAgB,EAAEC,eAAe;MAAEuH,kBAAkB;MAAE3K,EAAE;MAAEoC;IAAa,CAAC;EACpF;EAOA,aAAa8I,QAAQ,CAAC,CAACC,GAAG,EAAEnM,SAAS,EAAEoM,UAAU,EAAEC,UAAU,EAAElM,QAAQ,EAAEC,MAAM,CAO9E,EAAE;IACD,MAAMH,MAAM,GAAGmM,UAAU,CAACE,YAAY,CAACC,0BAAc,CAACvL,EAAE,CAAC;IACzD,MAAMwL,YAAY,GAAG,IAAI1M,YAAY,CAACE,SAAS,EAAEC,MAAM,EAAEoM,UAAU,EAAElM,QAAQ,EAAEC,MAAM,CAAC;IACtF+L,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAzXY1M,YAAY,WAuWR,EAAE;AAAA,gCAvWNA,YAAY,kBAwWD,CAAC6M,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,mBAAc,EAAEC,iBAAY,CAAC;AAAA,gCAxW1GlN,YAAY,aA0WNmN,kBAAW;AAiB9BV,0BAAc,CAACW,UAAU,CAACpN,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ import { CheckoutAspect } from './checkout.aspect';
2
2
  export type { CheckoutMain } from './checkout.main.runtime';
3
3
  export default CheckoutAspect;
4
4
  export { CheckoutAspect };
5
- export { CheckoutProps, ComponentStatus, applyModifiedVersion, applyVersion, deleteFilesIfNeeded, markFilesToBeRemovedIfNeeded, } from './checkout-version';
5
+ export { CheckoutProps, ComponentStatus, applyModifiedVersion, applyVersion, deleteFilesIfNeeded, markFilesToBeRemovedIfNeeded, ComponentStatusBase, ApplyVersionWithComps, } from './checkout-version';
package/dist/index.js CHANGED
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ApplyVersionWithComps", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _checkoutVersion().ApplyVersionWithComps;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "CheckoutAspect", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -21,6 +27,12 @@ Object.defineProperty(exports, "ComponentStatus", {
21
27
  return _checkoutVersion().ComponentStatus;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "ComponentStatusBase", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _checkoutVersion().ComponentStatusBase;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "applyModifiedVersion", {
25
37
  enumerable: true,
26
38
  get: function () {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutAspect"],"sources":["index.ts"],"sourcesContent":["import { CheckoutAspect } from './checkout.aspect';\n\nexport type { CheckoutMain } from './checkout.main.runtime';\nexport default CheckoutAspect;\nexport { CheckoutAspect };\n\nexport {\n CheckoutProps,\n ComponentStatus,\n applyModifiedVersion,\n applyVersion,\n deleteFilesIfNeeded,\n markFilesToBeRemovedIfNeeded,\n} from './checkout-version';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAO4B,eAVbA,0BAAc;AAAA"}
1
+ {"version":3,"names":["CheckoutAspect"],"sources":["index.ts"],"sourcesContent":["import { CheckoutAspect } from './checkout.aspect';\n\nexport type { CheckoutMain } from './checkout.main.runtime';\nexport default CheckoutAspect;\nexport { CheckoutAspect };\n\nexport {\n CheckoutProps,\n ComponentStatus,\n applyModifiedVersion,\n applyVersion,\n deleteFilesIfNeeded,\n markFilesToBeRemovedIfNeeded,\n ComponentStatusBase,\n ApplyVersionWithComps,\n} from './checkout-version';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAS4B,eAZbA,0BAAc;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.243",
3
+ "version": "0.0.245",
4
4
  "homepage": "https://bit.cloud/teambit/component/checkout",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "checkout",
9
- "version": "0.0.243"
9
+ "version": "0.0.245"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,14 +17,14 @@
17
17
  "@teambit/legacy-bit-id": "0.0.423",
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/component-id": "0.0.427",
20
- "@teambit/cli": "0.0.724",
21
- "@teambit/merging": "0.0.389",
20
+ "@teambit/cli": "0.0.725",
21
+ "@teambit/merging": "0.0.391",
22
+ "@teambit/workspace": "0.0.1076",
22
23
  "@teambit/bit-error": "0.0.402",
23
- "@teambit/component-writer": "0.0.110",
24
- "@teambit/importer": "0.0.503",
25
- "@teambit/logger": "0.0.817",
26
- "@teambit/remove": "0.0.251",
27
- "@teambit/workspace": "0.0.1074"
24
+ "@teambit/component-writer": "0.0.112",
25
+ "@teambit/importer": "0.0.505",
26
+ "@teambit/logger": "0.0.818",
27
+ "@teambit/remove": "0.0.253"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/lodash": "4.14.165",
@@ -36,7 +36,7 @@
36
36
  "@types/testing-library__jest-dom": "5.9.5"
37
37
  },
38
38
  "peerDependencies": {
39
- "@teambit/legacy": "1.0.504",
39
+ "@teambit/legacy": "1.0.505",
40
40
  "react": "^16.8.0 || ^17.0.0",
41
41
  "react-dom": "^16.8.0 || ^17.0.0"
42
42
  },