@teambit/checkout 0.0.66 → 0.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,10 @@
1
1
  import { CLIMain } from '@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';
4
5
  import { ApplyVersionResults, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
6
+ import { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';
7
+ import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
5
8
  import { ComponentID } from '@teambit/component-id';
6
9
  export declare type CheckoutProps = {
7
10
  version?: string;
@@ -16,6 +19,17 @@ export declare type CheckoutProps = {
16
19
  all?: boolean;
17
20
  isLane?: boolean;
18
21
  };
22
+ export declare type ComponentStatusBeforeMergeAttempt = {
23
+ componentFromFS?: ConsumerComponent;
24
+ componentFromModel?: Version;
25
+ id: BitId;
26
+ failureMessage?: string;
27
+ unchangedLegitimately?: boolean;
28
+ propsForMerge?: {
29
+ currentlyUsedVersion: string;
30
+ componentModel: ModelComponent;
31
+ };
32
+ };
19
33
  declare type CheckoutTo = 'head' | 'reset' | string;
20
34
  export declare class CheckoutMain {
21
35
  private workspace;
@@ -25,7 +39,8 @@ export declare class CheckoutMain {
25
39
  checkoutByCLIValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
26
40
  private syncNewComponents;
27
41
  private parseValues;
28
- private getComponentStatus;
42
+ private getComponentStatusBeforeMergeAttempt;
43
+ private getMergeStatus;
29
44
  static slots: never[];
30
45
  static dependencies: import("@teambit/harmony").Aspect[];
31
46
  static runtime: import("@teambit/harmony").RuntimeDefinition;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.flat.js");
4
5
  require("core-js/modules/es.array.iterator.js");
6
+ require("core-js/modules/es.array.unscopables.flat.js");
5
7
  require("core-js/modules/es.promise.js");
6
8
  Object.defineProperty(exports, "__esModule", {
7
9
  value: true
@@ -154,19 +156,34 @@ class CheckoutMain {
154
156
  const {
155
157
  components
156
158
  } = await consumer.loadComponents(bitIds);
157
- const getAllComponentsStatus = async () => {
159
+ const allComponentStatusBeforeMerge = await Promise.all(components.map(component => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps)));
160
+ const compsNeedMerge = allComponentStatusBeforeMerge.filter(c => c.propsForMerge);
161
+ const compsNotNeedMerge = allComponentStatusBeforeMerge.filter(c => !c.propsForMerge);
162
+
163
+ // in case the requested versions to checkout don't exist locally, import them.
164
+ const toImport = allComponentStatusBeforeMerge.map(compStatus => {
165
+ const idsToImport = [compStatus.id];
166
+ if (compStatus.propsForMerge) {
167
+ idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));
168
+ }
169
+ return idsToImport;
170
+ }).flat();
171
+ await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({
172
+ ids: _bitId().BitIds.fromArray(toImport)
173
+ });
174
+ const getComponentsStatusOfMergeNeeded = async () => {
158
175
  const tmp = new (_repositories().Tmp)(consumer.scope);
159
176
  try {
160
- const componentsStatusP = components.map(component => this.getComponentStatus(component, checkoutProps));
161
- const componentsStatus = await Promise.all(componentsStatusP);
177
+ const afterMergeAttempt = await Promise.all(compsNeedMerge.map(c => this.getMergeStatus(c)));
162
178
  await tmp.clear();
163
- return componentsStatus;
179
+ return afterMergeAttempt;
164
180
  } catch (err) {
165
181
  await tmp.clear();
166
182
  throw err;
167
183
  }
168
184
  };
169
- const allComponentsStatus = await getAllComponentsStatus();
185
+ const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();
186
+ const allComponentsStatus = [...compStatusMergeNeeded, ...compsNotNeedMerge];
170
187
  const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
171
188
  if (componentWithConflict) {
172
189
  if (!promptMergeOptions && !checkoutProps.mergeStrategy) {
@@ -232,7 +249,10 @@ class CheckoutMain {
232
249
  const notExported = ids === null || ids === void 0 ? void 0 : ids.filter(id => !id._legacy.hasScope()).map(id => id._legacy.changeScope(id.scope));
233
250
  const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;
234
251
  try {
235
- await scopeComponentsImporter.importManyDeltaWithoutDeps(_bitId().BitIds.fromArray(notExported || []), true);
252
+ await scopeComponentsImporter.importManyDeltaWithoutDeps({
253
+ ids: _bitId().BitIds.fromArray(notExported || []),
254
+ fromHead: true
255
+ });
236
256
  } catch (err) {
237
257
  // don't stop the process. it's possible that the scope doesn't exist yet because these are new components
238
258
  this.logger.error(`unable to sync new components due to an error`, err);
@@ -264,7 +284,7 @@ class CheckoutMain {
264
284
  const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
265
285
  checkoutProps.ids = ids.map(id => checkoutProps.head || checkoutProps.latest ? id.changeVersion(_constants().LATEST) : id);
266
286
  }
267
- async getComponentStatus(component, checkoutProps) {
287
+ async getComponentStatusBeforeMergeAttempt(component, checkoutProps) {
268
288
  const consumer = this.workspace.consumer;
269
289
  const {
270
290
  version,
@@ -310,7 +330,7 @@ class CheckoutMain {
310
330
  }
311
331
  if (version && currentlyUsedVersion === version) {
312
332
  // it won't be relevant for 'reset' as it doesn't have a version
313
- return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`);
333
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);
314
334
  }
315
335
  if (headVersion && currentlyUsedVersion === newVersion) {
316
336
  return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`, true);
@@ -318,8 +338,47 @@ class CheckoutMain {
318
338
  const currentVersionObject = await componentModel.loadVersion(currentlyUsedVersion, repo);
319
339
  const isModified = await consumer.isComponentModified(currentVersionObject, component);
320
340
  if (!isModified && reset) {
321
- return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`);
341
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);
342
+ }
343
+ const versionRef = componentModel.getRef(newVersion);
344
+ if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);
345
+ const componentVersion = await consumer.scope.getObject(versionRef.hash);
346
+ const newId = component.id.changeVersion(newVersion);
347
+ if (reset || !isModified) {
348
+ // if the component is not modified, no need to try merge the files, they will be written later on according to the
349
+ // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
350
+ return {
351
+ componentFromFS: component,
352
+ componentFromModel: componentVersion,
353
+ id: newId
354
+ };
322
355
  }
356
+ const propsForMerge = {
357
+ currentlyUsedVersion,
358
+ componentModel
359
+ };
360
+ return {
361
+ componentFromFS: component,
362
+ componentFromModel: componentVersion,
363
+ id: newId,
364
+ propsForMerge
365
+ };
366
+ }
367
+ async getMergeStatus({
368
+ componentFromFS,
369
+ componentFromModel,
370
+ id,
371
+ propsForMerge
372
+ }) {
373
+ if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);
374
+ if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);
375
+ const consumer = this.workspace.consumer;
376
+ const repo = consumer.scope.objects;
377
+ const {
378
+ currentlyUsedVersion,
379
+ componentModel
380
+ } = propsForMerge;
381
+
323
382
  // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.
324
383
  // 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
325
384
  // 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
@@ -329,30 +388,21 @@ class CheckoutMain {
329
388
  // to be added to 0.0.1
330
389
  // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.
331
390
  const baseVersion = currentlyUsedVersion;
391
+ const newVersion = id.version;
332
392
  const baseComponent = await componentModel.loadVersion(baseVersion, repo);
333
- let mergeResults;
334
- // if the component is not modified, no need to try merge the files, they will be written later on according to the
335
- // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
336
- if (!reset && isModified) {
337
- const otherComponent = await componentModel.loadVersion(newVersion, repo);
338
- mergeResults = await (0, _mergeVersion().threeWayMerge)({
339
- consumer,
340
- otherComponent,
341
- otherLabel: newVersion,
342
- currentComponent: component,
343
- currentLabel: `${currentlyUsedVersion} modified`,
344
- baseComponent
345
- });
346
- }
347
- const versionRef = componentModel.getRef(newVersion);
348
- // @ts-ignore
349
- const componentVersion = await consumer.scope.getObject(versionRef.hash);
350
- const newId = component.id.changeVersion(newVersion);
351
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
393
+ const otherComponent = await componentModel.loadVersion(newVersion, repo);
394
+ const mergeResults = await (0, _mergeVersion().threeWayMerge)({
395
+ consumer,
396
+ otherComponent,
397
+ otherLabel: newVersion,
398
+ currentComponent: componentFromFS,
399
+ currentLabel: `${currentlyUsedVersion} modified`,
400
+ baseComponent
401
+ });
352
402
  return {
353
- componentFromFS: component,
354
- componentFromModel: componentVersion,
355
- id: newId,
403
+ componentFromFS,
404
+ componentFromModel,
405
+ id,
356
406
  mergeResults
357
407
  };
358
408
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","scope","import","components","loadComponents","getAllComponentsStatus","tmp","Tmp","componentsStatusP","component","getComponentStatus","componentsStatus","Promise","all","clear","err","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","filter","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsWithDependencies","c","leftUnresolvedConflicts","length","manyComponentsWriter","ManyComponentsWriter","installNpmPackages","skipNpmInstall","override","verbose","resetConfig","reset","writeAll","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","parseValues","checkoutResults","onDestroy","head","notExported","hasScope","changeScope","scopeComponentsImporter","scopeImporter","importManyDeltaWithoutDeps","error","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsByPattern","listIds","changeVersion","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","toString","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","bitMap","getBitId","ignoreVersion","currentlyUsedVersion","currentVersionObject","loadVersion","isModified","isComponentModified","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","versionRef","getRef","componentVersion","getObject","hash","newId","componentFromModel","provider","cli","loggerMain","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n ApplyVersionResults,\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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ComponentWithDependencies } from '@teambit/legacy/dist/scope';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\n\nexport type CheckoutProps = {\n version?: string; // if reset 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};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\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 await consumer.scope.import(bitIds, false);\n const { components } = await consumer.loadComponents(bitIds);\n\n const getAllComponentsStatus = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const componentsStatusP = components.map((component) => this.getComponentStatus(component, checkoutProps));\n const componentsStatus = await Promise.all(componentsStatusP);\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const allComponentsStatus: ComponentStatus[] = await getAllComponentsStatus();\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 .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 componentsWithDependencies = componentsResults\n .map((c) => c.component)\n .filter((c) => c) as ComponentWithDependencies[];\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n if (componentsWithDependencies.length) {\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies,\n installNpmPackages: !checkoutProps.skipNpmInstall && !leftUnresolvedConflicts,\n override: true,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n });\n await manyComponentsWriter.writeAll();\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n return { components: appliedVersionComponents, version, failedComponents, leftUnresolvedConflicts };\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 ConsumerNotFound();\n const consumer = this.workspace.consumer;\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.importManyDeltaWithoutDeps(BitIds.fromArray(notExported || []), true);\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 due to an error`, err);\n }\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 const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getComponentStatus(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatus> {\n const consumer = this.workspace.consumer;\n const { version, head: headVersion, reset, latest: latestVersion } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatus = { 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 // @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}`);\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 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`);\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 baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n let mergeResults: MergeResultsThreeWay | null | undefined;\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 if (!reset && isModified) {\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: component,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n }\n const versionRef = componentModel.getRef(newVersion);\n // @ts-ignore\n const componentVersion = await consumer.scope.getObject(versionRef.hash);\n const newId = component.id.changeVersion(newVersion);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger);\n cli.register(new CheckoutCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime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,UAAU,EAAEf,UAAU;QACtBgB,gBAAgB,EAAEtG,SAAS;QAC3BuG,YAAY,EAAG,GAAEX,oBAAqB,WAAU;QAChDM;MACF,CAAC,CAAC;IACJ;IACA,MAAMM,UAAU,GAAG7B,cAAc,CAAC8B,MAAM,CAACnB,UAAU,CAAC;IACpD;IACA,MAAMoB,gBAAgB,GAAG,MAAM7H,QAAQ,CAACW,KAAK,CAACmH,SAAS,CAACH,UAAU,CAACI,IAAI,CAAC;IACxE,MAAMC,KAAK,GAAG7G,SAAS,CAACV,EAAE,CAACgF,aAAa,CAACgB,UAAU,CAAC;IACpD;IACA,OAAO;MAAE7D,eAAe,EAAEzB,SAAS;MAAE8G,kBAAkB,EAAEJ,gBAAgB;MAAEpH,EAAE,EAAEuH,KAAK;MAAEnG;IAAa,CAAC;EACtG;EAOA,aAAaqG,QAAQ,CAAC,CAACC,GAAG,EAAEvI,SAAS,EAAEwI,UAAU,CAAmC,EAAE;IACpF,MAAMvI,MAAM,GAAGuI,UAAU,CAACC,YAAY,CAACC,0BAAc,CAAC7H,EAAE,CAAC;IACzD,MAAM8H,YAAY,GAAG,IAAI7I,YAAY,CAACE,SAAS,EAAEC,MAAM,CAAC;IACxDsI,GAAG,CAACK,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAxOY7I,YAAY,WA6NR,EAAE;AAAA,gCA7NNA,YAAY,kBA8ND,CAACgJ,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAA,gCA9NrDlJ,YAAY,aAgONmJ,kBAAW;AAU9BP,0BAAc,CAACQ,UAAU,CAACpJ,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
1
+ {"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","scope","import","components","loadComponents","allComponentStatusBeforeMerge","Promise","all","component","getComponentStatusBeforeMergeAttempt","compsNeedMerge","filter","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","push","changeVersion","currentlyUsedVersion","flat","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsWithDependencies","leftUnresolvedConflicts","length","manyComponentsWriter","ManyComponentsWriter","installNpmPackages","skipNpmInstall","override","verbose","resetConfig","reset","writeAll","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","parseValues","checkoutResults","onDestroy","head","notExported","hasScope","changeScope","scopeComponentsImporter","importManyDeltaWithoutDeps","fromHead","error","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsByPattern","listIds","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","toString","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","bitMap","getBitId","ignoreVersion","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","provider","cli","loggerMain","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n ApplyVersionResults,\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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ComponentWithDependencies } from '@teambit/legacy/dist/scope';\nimport { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\n\nexport type CheckoutProps = {\n version?: string; // if reset 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};\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 propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\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 await consumer.scope.import(bitIds, false);\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 .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 componentsWithDependencies = componentsResults\n .map((c) => c.component)\n .filter((c) => c) as ComponentWithDependencies[];\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n if (componentsWithDependencies.length) {\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies,\n installNpmPackages: !checkoutProps.skipNpmInstall && !leftUnresolvedConflicts,\n override: true,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n });\n await manyComponentsWriter.writeAll();\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n return { components: appliedVersionComponents, version, failedComponents, leftUnresolvedConflicts };\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 ConsumerNotFound();\n const consumer = this.workspace.consumer;\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.importManyDeltaWithoutDeps({\n ids: BitIds.fromArray(notExported || []),\n fromHead: true,\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 due to an error`, err);\n }\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 const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\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 } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatus = { 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 // @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 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;\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];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger);\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;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;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;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD;AAAA;AA8B5C,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAE;IAAA,KAA9CD,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EAEn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QAAQ;MACR2I,cAAc;MACdE,UAAU,EAAEtB,UAAU;MACtBuB,gBAAgB,EAAElF,eAAe;MACjCmF,YAAY,EAAG,GAAEjH,oBAAqB,WAAU;MAChD4G;IACF,CAAC,CAAC;IAEF,OAAO;MAAE9E,eAAe;MAAE4E,kBAAkB;MAAE/H,EAAE;MAAEqC;IAAa,CAAC;EAClE;EAOA,aAAakG,QAAQ,CAAC,CAACC,GAAG,EAAErJ,SAAS,EAAEsJ,UAAU,CAAmC,EAAE;IACpF,MAAMrJ,MAAM,GAAGqJ,UAAU,CAACC,YAAY,CAACC,0BAAc,CAAC3I,EAAE,CAAC;IACzD,MAAM4I,YAAY,GAAG,IAAI3J,YAAY,CAACE,SAAS,EAAEC,MAAM,CAAC;IACxDoJ,GAAG,CAACK,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAxRY3J,YAAY,WA6QR,EAAE;AAAA,gCA7QNA,YAAY,kBA8QD,CAAC8J,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAA,gCA9QrDhK,YAAY,aAgRNiK,kBAAW;AAU9BP,0BAAc,CAACQ,UAAU,CAAClK,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "homepage": "https://bit.dev/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.66"
9
+ "version": "0.0.67"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -15,11 +15,11 @@
15
15
  "core-js": "^3.0.0",
16
16
  "@teambit/harmony": "0.3.3",
17
17
  "@teambit/bit-error": "0.0.402",
18
- "@teambit/cli": "0.0.599",
18
+ "@teambit/cli": "0.0.600",
19
19
  "@teambit/component-id": "0.0.425",
20
20
  "@teambit/legacy-bit-id": "0.0.421",
21
- "@teambit/logger": "0.0.692",
22
- "@teambit/workspace": "0.0.897"
21
+ "@teambit/logger": "0.0.693",
22
+ "@teambit/workspace": "0.0.898"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/mocha": "9.1.0",
@@ -30,7 +30,7 @@
30
30
  "@types/node": "12.20.4"
31
31
  },
32
32
  "peerDependencies": {
33
- "@teambit/legacy": "1.0.382",
33
+ "@teambit/legacy": "1.0.383",
34
34
  "react-dom": "^16.8.0 || ^17.0.0",
35
35
  "react": "^16.8.0 || ^17.0.0"
36
36
  },