@teambit/checkout 1.0.667 → 1.0.669

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,6 +1,6 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { ApplyVersionResults, MergeStrategy } from '@teambit/merging';
3
- import { CheckoutMain, CheckoutProps } from './checkout.main.runtime';
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { ApplyVersionResults, MergeStrategy } from '@teambit/merging';
3
+ import type { CheckoutMain, CheckoutProps } from './checkout.main.runtime';
4
4
  export declare class CheckoutCmd implements Command {
5
5
  private checkout;
6
6
  name: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_merging","_legacy","_componentId","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","startsWith","ancestor","parseInt","split","isNaN","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","workspaceConfigUpdateResult","newFromLane","newFromLaneAdded","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","getNotCheckedOutOutput","chalk","green","bold","toString","title","body","map","failedComponent","id","unchangedMessage","join","underline","getWsConfigUpdateLogs","logs","logsStr","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictStr","yellow","getSuccessfulOutput","newLine","switchedOrReverted","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","compact","getRemovedOutput","getAddedOutput","getWorkspaceConfigUpdateOutput","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport {\n ApplyVersionResults,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n MergeStrategy,\n getWorkspaceConfigUpdateOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy.constants';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: [head, latest, reset, {specific-version}, {head~x}]. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'version-control';\n extendedDescription = `\n\\`bit checkout <version> [component-pattern]\\` => checkout the specified ids (or all components when --all is used) to the specified version\n\\`bit checkout head [component-pattern]\\` => checkout to the last snap/tag (use --latest if you only want semver tags), omit [component-pattern] to checkout head for all\n\\`bit checkout head~x [component-pattern]\\` => go backward x generations from the head and checkout to that version\n\\`bit checkout latest [component-pattern]\\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all\n\\`bit checkout reset [component-pattern]\\` => remove local modifications from the specified ids (or all components when --all is used). also, if a component dir is deleted from the filesystem, it'll be restored\nwhen on a lane, \"checkout head\" only checks out components on this lane. to update main components, run \"bit lane merge main\"`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'do not merge, preserve local files as is'],\n ['', 'force-theirs', 'do not merge, just overwrite with incoming files'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n manual,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n if (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n };\n to = String(to); // it can be a number in case short-hash is used\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 if (to === 'main') checkoutProps.main = true;\n else if (to.startsWith(`${HEAD}~`)) {\n const ancestor = parseInt(to.split('~')[1]);\n if (Number.isNaN(ancestor))\n throw new BitError(`the character after \"${HEAD}~\" must be a number, got ${ancestor}`);\n checkoutProps.ancestor = ancestor;\n } else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n) {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n workspaceConfigUpdateResult,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const getNotCheckedOutOutput = () => {\n if (!notCheckedOutComponents.length) return '';\n if (!verbose && all) {\n return chalk.green(\n `checkout was not needed for ${chalk.bold(\n notCheckedOutComponents.length.toString()\n )} components (use --verbose to get more details)\\n`\n );\n }\n const title = 'checkout was not required for the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getWsConfigUpdateLogs = () => {\n const logs = workspaceConfigUpdateResult?.logs;\n if (!logs || !logs.length) return '';\n const logsStr = logs.join('\\n');\n return `${chalk.underline('verbose logs of workspace config update')}\\n${logsStr}`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `files with conflicts summary\\n`;\n const suggestion = `\\n\\nfix the conflicts above manually and then run \"bit install\".\nonce ready, snap/tag the components to persist the changes`;\n const conflictSummary = conflictSummaryReport(components);\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const newLine = '\\n';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !reset\n head || latest ? component.id.version : version\n )}`;\n return chalk.bold(title) + newLine + applyVersionReport(components, false);\n }\n if (reset) {\n const title = 'successfully reset the following components\\n\\n';\n const body = components.map((component) => chalk.bold(component.id.toString())).join('\\n');\n return chalk.underline(title) + body;\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n // @ts-ignore version is defined when !reset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return chalk.bold(title) + newLine + applyVersionReport(components, true, showVersion);\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded\n ? `successfully added the following components from the lane`\n : `the following components exist on the lane but were not added to the workspace. omit --workspace-only flag to add them`;\n const body = newFromLane.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const title = chalk.bold.underline('Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n\n return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;\n };\n\n return compact([\n getWsConfigUpdateLogs(),\n getNotCheckedOutOutput(),\n getSuccessfulOutput(),\n getRemovedOutput(removedComponents),\n getAddedOutput(addedComponents),\n getNewOnLaneOutput(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getSummary(),\n installationErrorOutput(installationError),\n compilationErrorOutput(compilationError),\n ]).join('\\n\\n');\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWA,SAAAK,QAAA;EAAA,MA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CAAC,EAAE;IAC7E,MAAMiC,wBAAwB,GAAG,sBAAsBpC,gBAAK,CAACE,IAAI,CAACgC,yBAAyB,CAAC/B,QAAQ,CAAC,CAAC,CAAC,EAAE;IACzG,MAAMkC,YAAY,GAAGjD,WAAW,EAAEQ,MAAM,IAAI,CAAC;IAC7C,MAAM0C,iBAAiB,GAAGjD,gBAAgB,GAAG,UAAU,GAAG,cAAc;IACxE,MAAMkD,YAAY,GAAGF,YAAY,GAC7B,gBAAgBC,iBAAiB,KAAKtC,gBAAK,CAACE,IAAI,CAACmC,YAAY,CAAClC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAC3E,EAAE;IAEN,OAAOC,KAAK,GAAG+B,aAAa,GAAGC,wBAAwB,GAAGG,YAAY;EACxE,CAAC;EAED,OAAO,IAAAC,iBAAO,EAAC,CACb5B,qBAAqB,CAAC,CAAC,EACvBb,sBAAsB,CAAC,CAAC,EACxBsB,mBAAmB,CAAC,CAAC,EACrB,IAAAoB,2BAAgB,EAACzD,iBAAiB,CAAC,EACnC,IAAA0D,yBAAc,EAACzD,eAAe,CAAC,EAC/B8C,kBAAkB,CAAC,CAAC,EACpB,IAAAY,yCAA8B,EAACxD,2BAA2B,CAAC,EAC3D4B,kBAAkB,CAAC,CAAC,EACpBiB,UAAU,CAAC,CAAC,EACZ,IAAAY,kCAAuB,EAACtD,iBAAiB,CAAC,EAC1C,IAAAuD,iCAAsB,EAACtD,gBAAgB,CAAC,CACzC,CAAC,CAACmB,IAAI,CAAC,MAAM,CAAC;AACjB","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_merging","_legacy","_componentId","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","startsWith","ancestor","parseInt","split","isNaN","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","workspaceConfigUpdateResult","newFromLane","newFromLaneAdded","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","getNotCheckedOutOutput","chalk","green","bold","toString","title","body","map","failedComponent","id","unchangedMessage","join","underline","getWsConfigUpdateLogs","logs","logsStr","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictStr","yellow","getSuccessfulOutput","newLine","switchedOrReverted","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","compact","getRemovedOutput","getAddedOutput","getWorkspaceConfigUpdateOutput","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport type { ApplyVersionResults, MergeStrategy } from '@teambit/merging';\nimport {\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n getWorkspaceConfigUpdateOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy.constants';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport type { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: [head, latest, reset, {specific-version}, {head~x}]. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'version-control';\n extendedDescription = `\n\\`bit checkout <version> [component-pattern]\\` => checkout the specified ids (or all components when --all is used) to the specified version\n\\`bit checkout head [component-pattern]\\` => checkout to the last snap/tag (use --latest if you only want semver tags), omit [component-pattern] to checkout head for all\n\\`bit checkout head~x [component-pattern]\\` => go backward x generations from the head and checkout to that version\n\\`bit checkout latest [component-pattern]\\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all\n\\`bit checkout reset [component-pattern]\\` => remove local modifications from the specified ids (or all components when --all is used). also, if a component dir is deleted from the filesystem, it'll be restored\nwhen on a lane, \"checkout head\" only checks out components on this lane. to update main components, run \"bit lane merge main\"`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'do not merge, preserve local files as is'],\n ['', 'force-theirs', 'do not merge, just overwrite with incoming files'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n manual,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n if (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n };\n to = String(to); // it can be a number in case short-hash is used\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 if (to === 'main') checkoutProps.main = true;\n else if (to.startsWith(`${HEAD}~`)) {\n const ancestor = parseInt(to.split('~')[1]);\n if (Number.isNaN(ancestor))\n throw new BitError(`the character after \"${HEAD}~\" must be a number, got ${ancestor}`);\n checkoutProps.ancestor = ancestor;\n } else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n) {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n workspaceConfigUpdateResult,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const getNotCheckedOutOutput = () => {\n if (!notCheckedOutComponents.length) return '';\n if (!verbose && all) {\n return chalk.green(\n `checkout was not needed for ${chalk.bold(\n notCheckedOutComponents.length.toString()\n )} components (use --verbose to get more details)\\n`\n );\n }\n const title = 'checkout was not required for the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getWsConfigUpdateLogs = () => {\n const logs = workspaceConfigUpdateResult?.logs;\n if (!logs || !logs.length) return '';\n const logsStr = logs.join('\\n');\n return `${chalk.underline('verbose logs of workspace config update')}\\n${logsStr}`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `files with conflicts summary\\n`;\n const suggestion = `\\n\\nfix the conflicts above manually and then run \"bit install\".\nonce ready, snap/tag the components to persist the changes`;\n const conflictSummary = conflictSummaryReport(components);\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const newLine = '\\n';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !reset\n head || latest ? component.id.version : version\n )}`;\n return chalk.bold(title) + newLine + applyVersionReport(components, false);\n }\n if (reset) {\n const title = 'successfully reset the following components\\n\\n';\n const body = components.map((component) => chalk.bold(component.id.toString())).join('\\n');\n return chalk.underline(title) + body;\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n // @ts-ignore version is defined when !reset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return chalk.bold(title) + newLine + applyVersionReport(components, true, showVersion);\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded\n ? `successfully added the following components from the lane`\n : `the following components exist on the lane but were not added to the workspace. omit --workspace-only flag to add them`;\n const body = newFromLane.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const title = chalk.bold.underline('Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n\n return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;\n };\n\n return compact([\n getWsConfigUpdateLogs(),\n getNotCheckedOutOutput(),\n getSuccessfulOutput(),\n getRemovedOutput(removedComponents),\n getAddedOutput(addedComponents),\n getNewOnLaneOutput(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getSummary(),\n installationErrorOutput(installationError),\n compilationErrorOutput(compilationError),\n ]).join('\\n\\n');\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAA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C/B8C,kBAAkB,CAAC,CAAC,EACpB,IAAAY,yCAA8B,EAACxD,2BAA2B,CAAC,EAC3D4B,kBAAkB,CAAC,CAAC,EACpBiB,UAAU,CAAC,CAAC,EACZ,IAAAY,kCAAuB,EAACtD,iBAAiB,CAAC,EAC1C,IAAAuD,iCAAsB,EAACtD,gBAAgB,CAAC,CACzC,CAAC,CAACmB,IAAI,CAAC,MAAM,CAAC;AACjB","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import { Consumer } from '@teambit/legacy.consumer';
2
- import { ComponentID } from '@teambit/component-id';
3
- import { Version } from '@teambit/objects';
4
- import { SourceFile } from '@teambit/component.sources';
5
- import { ConsumerComponent } from '@teambit/legacy.consumer-component';
6
- import { ApplyVersionResult, FilesStatus, MergeStrategy, MergeResultsThreeWay } from '@teambit/merging';
7
- import { CheckoutProps } from './checkout.main.runtime';
1
+ import type { Consumer } from '@teambit/legacy.consumer';
2
+ import type { ComponentID } from '@teambit/component-id';
3
+ import type { Version } from '@teambit/objects';
4
+ import type { SourceFile } from '@teambit/component.sources';
5
+ import type { ConsumerComponent } from '@teambit/legacy.consumer-component';
6
+ import type { ApplyVersionResult, FilesStatus, MergeStrategy, MergeResultsThreeWay } from '@teambit/merging';
7
+ import type { CheckoutProps } from './checkout.main.runtime';
8
8
  export type ComponentStatusBase = {
9
9
  currentComponent?: ConsumerComponent;
10
10
  componentFromModel?: Version;
@@ -1 +1 @@
1
- {"version":3,"names":["path","data","_interopRequireWildcard","require","_component","_legacy","_bitError","_chalk","_interopRequireDefault","_merging","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","BitError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","areFilesEqual","Buffer","compare","contents","updated","isExistOnFs","getComponentIdIfExist","ignoreVersion","filePathsFromFS","dataToPersist","DataToPersist","filename","removed","removePath","RemovePath","persistAllToFS","componentFiles","map","clone","manual","filePath","normalize","foundFile","componentFile","conflict","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","added","deletedConflictFiles","removeFiles","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","failedComponent","chalk","bold","red","join"],"sources":["checkout-version.ts"],"sourcesContent":["import * as path from 'path';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentID } from '@teambit/component-id';\nimport { Version } from '@teambit/objects';\nimport { SourceFile, RemovePath, DataToPersist } from '@teambit/component.sources';\nimport { pathNormalizeToLinux, PathOsBased } from '@teambit/legacy.utils';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport {\n ApplyVersionResult,\n FilesStatus,\n FileStatus,\n MergeOptions,\n MergeStrategy,\n MergeResultsThreeWay,\n} from '@teambit/merging';\nimport { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\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 * 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: ComponentID,\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, forceOurs } = checkoutProps;\n let filesStatus = {};\n if ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs) {\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 BitError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);\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 // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n // @ts-ignore should be fixed after upgrading @types/node from '12.20.4' to > 20\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(\n filesStatus: FilesStatus,\n consumer: Consumer,\n componentFromFS?: ConsumerComponent\n) {\n if (!componentFromFS) return;\n // @todo: if the component is not in the FS, it should be passed as undefined here.\n // in the case this is coming from merge-lane, it's sometimes populated from the scope.\n const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, { ignoreVersion: true });\n if (!isExistOnFs) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n }\n if (filesStatus[filename] === FileStatus.removed) {\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\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 BitError(`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 BitError(`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 BitError(`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 BitError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to proceed due to the following failures:\\n${failureM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nE,WAAW,CAACK,IAAI,CAACwC,QAAQ,CAAC,GAAGrC,qBAAU,CAACqB,OAAO;EACjD,CAAC,CAAC;EAEF,OAAO;IAAE7B,WAAW;IAAEqB;EAAc,CAAC;AACvC;AAEO,SAAS+C,gBAAgBA,CAACC,mBAA0C,EAAE;EAC3E,MAAMC,gBAAgB,GAAGD,mBAAmB,CAACrG,MAAM,CAAEuG,CAAC,IAAKA,CAAC,CAACC,gBAAgB,IAAI,CAACD,CAAC,CAACE,qBAAqB,CAAC;EAC1G,IAAIH,gBAAgB,CAAChG,MAAM,EAAE;IAC3B,MAAMoG,WAAW,GAAGJ,gBAAgB,CACjC5B,GAAG,CACDiC,eAAe,IACd,GAAGC,gBAAK,CAACC,IAAI,CAACF,eAAe,CAACpF,EAAE,CAACM,QAAQ,CAAC,CAAC,CAAC,MAAM+E,gBAAK,CAACE,GAAG,CAACH,eAAe,CAACH,gBAA0B,CAAC,EAC3G,CAAC,CACAO,IAAI,CAAC,IAAI,CAAC;IACb,MAAM,KAAI/D,oBAAQ,EAAC,qDAAqD0D,WAAW,EAAE,CAAC;EACxF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["path","data","_interopRequireWildcard","require","_component","_legacy","_bitError","_chalk","_interopRequireDefault","_merging","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","BitError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","areFilesEqual","Buffer","compare","contents","updated","isExistOnFs","getComponentIdIfExist","ignoreVersion","filePathsFromFS","dataToPersist","DataToPersist","filename","removed","removePath","RemovePath","persistAllToFS","componentFiles","map","clone","manual","filePath","normalize","foundFile","componentFile","conflict","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","added","deletedConflictFiles","removeFiles","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","failedComponent","chalk","bold","red","join"],"sources":["checkout-version.ts"],"sourcesContent":["import * as path from 'path';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { Version } from '@teambit/objects';\nimport type { SourceFile } from '@teambit/component.sources';\nimport { RemovePath, DataToPersist } from '@teambit/component.sources';\nimport type { PathOsBased } from '@teambit/legacy.utils';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport type { ApplyVersionResult, FilesStatus, MergeStrategy, MergeResultsThreeWay } from '@teambit/merging';\nimport { FileStatus, MergeOptions } from '@teambit/merging';\nimport type { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\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 * 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: ComponentID,\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, forceOurs } = checkoutProps;\n let filesStatus = {};\n if ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs) {\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 BitError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);\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 // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n // @ts-ignore should be fixed after upgrading @types/node from '12.20.4' to > 20\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(\n filesStatus: FilesStatus,\n consumer: Consumer,\n componentFromFS?: ConsumerComponent\n) {\n if (!componentFromFS) return;\n // @todo: if the component is not in the FS, it should be passed as undefined here.\n // in the case this is coming from merge-lane, it's sometimes populated from the scope.\n const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, { ignoreVersion: true });\n if (!isExistOnFs) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n }\n if (filesStatus[filename] === FileStatus.removed) {\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\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 BitError(`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 BitError(`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 BitError(`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 BitError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to proceed due to the following failures:\\n${failureMsgs}`);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA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Ac,CAAC;AACvC;AAEO,SAAS+C,gBAAgBA,CAACC,mBAA0C,EAAE;EAC3E,MAAMC,gBAAgB,GAAGD,mBAAmB,CAACrG,MAAM,CAAEuG,CAAC,IAAKA,CAAC,CAACC,gBAAgB,IAAI,CAACD,CAAC,CAACE,qBAAqB,CAAC;EAC1G,IAAIH,gBAAgB,CAAChG,MAAM,EAAE;IAC3B,MAAMoG,WAAW,GAAGJ,gBAAgB,CACjC5B,GAAG,CACDiC,eAAe,IACd,GAAGC,gBAAK,CAACC,IAAI,CAACF,eAAe,CAACpF,EAAE,CAACM,QAAQ,CAAC,CAAC,CAAC,MAAM+E,gBAAK,CAACE,GAAG,CAACH,eAAe,CAACH,gBAA0B,CAAC,EAC3G,CAAC,CACAO,IAAI,CAAC,IAAI,CAAC;IACb,MAAM,KAAI/D,oBAAQ,EAAC,qDAAqD0D,WAAW,EAAE,CAAC;EACxF;AACF","ignoreList":[]}
@@ -1,14 +1,15 @@
1
- import { CLIMain } from '@teambit/cli';
2
- import { Logger, LoggerMain } from '@teambit/logger';
3
- import { Workspace } from '@teambit/workspace';
4
- import { RemoveMain } from '@teambit/remove';
5
- import { ApplyVersionResults, MergeStrategy } from '@teambit/merging';
6
- import { ImporterMain } from '@teambit/importer';
7
- import { ComponentWriterMain } from '@teambit/component-writer';
1
+ import type { CLIMain } from '@teambit/cli';
2
+ import type { Logger, LoggerMain } from '@teambit/logger';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import type { RemoveMain } from '@teambit/remove';
5
+ import type { ApplyVersionResults, MergeStrategy } from '@teambit/merging';
6
+ import type { ImporterMain } from '@teambit/importer';
7
+ import type { ComponentWriterMain } from '@teambit/component-writer';
8
8
  import { ComponentID } from '@teambit/component-id';
9
- import { ModelComponent, Lane } from '@teambit/objects';
10
- import { ComponentStatusBase } from './checkout-version';
11
- import { ComponentMap } from '@teambit/legacy.bit-map';
9
+ import type { Lane } from '@teambit/objects';
10
+ import { ModelComponent } from '@teambit/objects';
11
+ import type { ComponentStatusBase } from './checkout-version';
12
+ import type { ComponentMap } from '@teambit/legacy.bit-map';
12
13
  export type CheckoutProps = {
13
14
  version?: string;
14
15
  ids?: ComponentID[];
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_workspace","_bitError","_lodash","_remove","_merging","_importer","_legacy","_componentWriter","_pMapSeries","_interopRequireDefault","_componentId","_objects","_legacy2","_legacy3","_checkoutCmd","_checkout","_checkoutVersion","_revertCmd","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","ensureCheckoutConfiguration","inInstallContext","version","ids","promptMergeOptions","syncNewComponents","addedComponents","restoreMissingComponents","newComponents","addNewComponents","bitIds","ComponentIdList","fromArray","map","id","allComponentStatusBeforeMerge","mapSeries","getComponentStatusBeforeMergeAttempt","compsNeedMerge","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importWithoutDeps","cache","lane","consumer","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","Promise","all","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","component","mergeResults","hasConflicts","mergeStrategy","BitError","toStringWithoutVersion","getMergeStrategyInteractive","throwForFailures","failedComponents","componentStatus","unchangedMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","currentComponent","applyVersion","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","manyComponentsWriterOpts","components","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","revert","shouldUpdateWorkspaceConfig","reasonForBitmapChange","writeMany","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","reasonForRemoval","removedComponents","n","toString","workspaceConfigUpdateResult","installationError","compilationError","missing","bitMapEntry","bitMap","getBitmapEntry","ignoreVersion","noFilesError","ComponentNotFoundInPath","comps","getMany","state","_consumer","stashedBitmapEntries","newBitmapEntries","entry","defaultScope","newComps","bitmapEntry","existingId","getBitmapEntryIfExist","modelComponent","ModelComponent","fromBitId","repo","objects","consumerComp","toConsumerComponent","newCompId","ComponentID","fromObject","name","fullName","writeToPath","rootDir","addComponent","componentId","files","f","basename","relativePath","relative","test","mainFile","config","triggerOnComponentAdd","compile","write","checkoutByCLIValues","componentPattern","setStatusLine","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","isExported","changeScope","scopeComponentsImporter","toVersionLatest","reason","includeUnexported","error","unavailableOnMain","getUnavailableOnMainComponents","makeComponentsAvailableOnMain","includeLocallyDeleted","latest","idsOnWorkspace","listIdsIncludeRemoved","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toComponentIds","hasWithoutVersion","LATEST","console","HEAD","getIds","idsByPattern","includeDeleted","laneBitIds","newComponentIds","bitId","isEqualWithoutVersion","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","ancestor","main","latestVersion","versionPerId","forceOurs","forceTheirs","loadStash","existingBitMapId","getComponentIdIfExist","getComponent","results","loadComponents","allowAddingComponentsFromScope","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","getNewVersion","headIncludeRemote","previousParent","getRefOfAncestor","getTagOfRefIfExists","latestVersionIfExist","newVersion","hasVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","isModified","currentVersionObject","loadVersion","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","componentFromFS","baseVersion","baseComponent","otherComponent","parents","parent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","RevertCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","MainRuntime","addRuntime","_default"],"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 { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { RemoveAspect, RemoveMain } from '@teambit/remove';\nimport {\n ApplyVersionResults,\n FailedComponents,\n threeWayMerge,\n getMergeStrategyInteractive,\n MergeStrategy,\n} from '@teambit/merging';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy.constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport mapSeries from 'p-map-series';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport { Version, ModelComponent, Lane } from '@teambit/objects';\nimport { Tmp } from '@teambit/legacy.scope';\nimport { ComponentNotFoundInPath } from '@teambit/legacy.consumer-component';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport { applyVersion, ComponentStatus, ComponentStatusBase, throwForFailures } from './checkout-version';\nimport { RevertCmd } from './revert-cmd';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n ancestor?: number; // how many generations to go backward\n latest?: boolean;\n main?: boolean; // relevant for \"revert\" only\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy; // strategy to use in case of conflicts\n forceOurs?: boolean; // regardless of conflicts, use ours\n forceTheirs?: boolean; // regardless of conflicts, use theirs\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n revert?: boolean; // change the files according to the given version, but don't change the bitmap version and don't try to merge\n all?: boolean; // checkout all ids\n isLane?: boolean;\n lane?: Lane; // currently needed for \"bit switch\" to tell the \"fetch\" where to fetch from\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n loadStash?: boolean;\n stashedBitmapEntries?: Array<Partial<ComponentMap>>;\n restoreMissingComponents?: boolean; // in case .bitmap has a component and it's missing from the workspace, restore it (from model)\n allowAddingComponentsFromScope?: boolean; // in case the id doesn't exist in .bitmap, add it from the scope (relevant for switch)\n includeLocallyDeleted?: boolean; // include components that were deleted locally. currently enabled for \"bit checkout reset\" only.\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\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 await this.ensureCheckoutConfiguration(checkoutProps);\n this.workspace.inInstallContext = true;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const addedComponents = await this.restoreMissingComponents(checkoutProps);\n const newComponents = await this.addNewComponents(checkoutProps);\n const bitIds = ComponentIdList.fromArray(ids?.map((id) => id) || []);\n // don't use Promise.all, it loads the components and this operation must be in sequence.\n const allComponentStatusBeforeMerge = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id, 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\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n cache: true,\n lane: checkoutProps.lane,\n });\n const consumer = this.workspace.consumer;\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, checkoutProps)));\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 BitError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--auto-merge-resolve\" with 'manual', 'ours' or 'theirs' to resolve the conflict/s`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n\n throwForFailures(allComponentsStatus);\n\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\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) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, currentComponent, mergeResults }) => {\n return applyVersion(consumer, id, currentComponent, mergeResults, checkoutPropsLegacy);\n });\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))\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 || checkoutProps.revert,\n shouldUpdateWorkspaceConfig: true,\n reasonForBitmapChange: 'checkout',\n mergeStrategy: checkoutProps.mergeStrategy,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\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, reasonForRemoval: 'checkout' });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n addedComponents,\n newComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n workspaceConfigUpdateResult: componentWriterResults?.workspaceConfigUpdateResult,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n /**\n * if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.\n * returns the restored component ids.\n */\n async restoreMissingComponents(checkoutProps: CheckoutProps): Promise<ComponentID[] | undefined> {\n if (checkoutProps.reset) {\n checkoutProps.restoreMissingComponents = true;\n }\n if (!checkoutProps.restoreMissingComponents) return undefined;\n const ids = checkoutProps.ids || [];\n const missing: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const bitMapEntry = this.workspace.bitMap.getBitmapEntry(id, { ignoreVersion: true });\n if (bitMapEntry.noFilesError && bitMapEntry.noFilesError instanceof ComponentNotFoundInPath) {\n delete bitMapEntry.noFilesError;\n missing.push(id);\n }\n })\n );\n if (!missing.length) return undefined;\n const comps = await this.workspace.scope.getMany(missing);\n await this.componentWriter.writeMany({\n components: comps.map((c) => c.state._consumer),\n skipDependencyInstallation: true,\n skipUpdatingBitMap: true,\n });\n\n return missing;\n }\n\n async addNewComponents(checkoutProps: CheckoutProps): Promise<undefined | ComponentID[]> {\n const stashedBitmapEntries = checkoutProps.stashedBitmapEntries;\n if (!stashedBitmapEntries) return;\n const newBitmapEntries = stashedBitmapEntries.filter((entry) => entry.defaultScope);\n if (!newBitmapEntries.length) return;\n const newComps = await mapSeries(newBitmapEntries, async (bitmapEntry) => {\n const id = bitmapEntry.id!;\n const existingId = this.workspace.bitMap.getBitmapEntryIfExist(id, { ignoreVersion: true });\n if (existingId) return;\n const modelComponent = ModelComponent.fromBitId(id);\n const repo = this.workspace.scope.legacyScope.objects;\n const consumerComp = await modelComponent.toConsumerComponent(id.version, id.scope, repo);\n const newCompId = ComponentID.fromObject({ name: id.fullName }, bitmapEntry.defaultScope!);\n await this.componentWriter.writeMany({\n components: [consumerComp],\n skipDependencyInstallation: true,\n writeToPath: bitmapEntry.rootDir,\n skipUpdatingBitMap: true,\n });\n\n this.workspace.consumer.bitMap.addComponent({\n componentId: newCompId,\n files: consumerComp.files.map((f) => ({\n name: f.basename,\n relativePath: f.relative,\n test: f.test,\n })),\n mainFile: bitmapEntry.mainFile!,\n config: bitmapEntry.config,\n defaultScope: bitmapEntry.defaultScope,\n });\n await this.workspace.triggerOnComponentAdd(newCompId, { compile: true });\n return newCompId;\n });\n await this.workspace.bitMap.write();\n return compact(newComps);\n }\n\n async checkoutByCLIValues(componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const { revert, head } = checkoutProps;\n this.logger.setStatusLine(revert ? 'reverting components...' : 'switching component version...');\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 (head) await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy(`checkout (${componentPattern})`);\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !this.workspace.isExported(id)).map((id) => id.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(ComponentIdList.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n reason: 'for making sure the new components are really new and are not out-of-sync',\n includeUnexported: 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, 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 ensureCheckoutConfiguration(checkoutProps: CheckoutProps) {\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n if (checkoutProps.ids?.length) {\n return;\n }\n if (checkoutProps.head || checkoutProps.latest) {\n checkoutProps.all = true;\n }\n if (!checkoutProps.all) {\n return; // no ids and no all.\n }\n const idsOnWorkspace = checkoutProps.includeLocallyDeleted\n ? this.workspace.listIdsIncludeRemoved()\n : this.workspace.listIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n\n // When on a lane and doing head checkout, only checkout lane components\n const ids =\n currentLaneIds && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async parseValues(componentPattern: string, checkoutProps: CheckoutProps) {\n // CLI-specific validations and deprecation warnings\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 BitError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new BitError('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 if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n\n const getIds = async () => {\n if (componentPattern) {\n return this.workspace.idsByPattern(componentPattern, true, {\n includeDeleted: checkoutProps.includeLocallyDeleted,\n });\n }\n return checkoutProps.includeLocallyDeleted ? this.workspace.listIdsIncludeRemoved() : this.workspace.listIds();\n };\n\n const idsOnWorkspace = await getIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n // when no ids were given and the user is on a lane, return lane-ids only.\n // it's relevant for cases like \"bit checkout head\" when on a lane to not checkout main components. (see https://github.com/teambit/bit/pull/6853)\n const ids =\n currentLaneIds && !componentPattern && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\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.toComponentIds();\n const newComponentIds = laneBitIds.filter((bitId) => !ids.find((id) => id.isEqualWithoutVersion(bitId)));\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 // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const {\n version,\n head: headVersion,\n ancestor,\n reset,\n revert,\n main,\n latest: latestVersion,\n versionPerId,\n forceOurs,\n forceTheirs,\n loadStash,\n } = checkoutProps;\n const repo = consumer.scope.objects;\n\n let existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const getComponent = async () => {\n try {\n const results = await consumer.loadComponents(ComponentIdList.fromArray([id]));\n if (results.components[0]) return results.components[0];\n if (checkoutProps.includeLocallyDeleted && results.removedComponents[0]) {\n return results.removedComponents[0];\n }\n } catch (err) {\n if (checkoutProps.allowAddingComponentsFromScope && !existingBitMapId) return undefined;\n throw err;\n }\n return undefined;\n };\n const component = await getComponent();\n if (component) {\n // the component might fix an out-of-sync issue and as a result, the id has changed\n id = component.id;\n existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n }\n\n const componentModel = await consumer.scope.getModelComponentIfExist(id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${id.toString()} is new, no version to checkout`, true);\n }\n if (main && !componentModel.head) {\n return returnFailure(`component ${id.toString()} is not available on main`);\n }\n const unmerged = repo.unmergedComponents.getEntry(id);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n\n const getNewVersion = async (): Promise<string> => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (reset) return component!.id.version as string;\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (ancestor) {\n const previousParent = await componentModel.getRefOfAncestor(repo, ancestor);\n return componentModel.getTagOfRefIfExists(previousParent)?.toString() || previousParent.toString();\n }\n // we verified previously that head exists in case of \"main\"\n if (main) return componentModel.head?.toString() as string;\n if (latestVersion) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((bitId) => bitId.isEqualWithoutVersion(id))?.version as string;\n }\n\n // if all above are false, the version is defined\n return version as string;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion) return returnFailure(`component ${id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const currentlyUsedVersion = existingBitMapId?.version;\n if (existingBitMapId && !currentlyUsedVersion) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is new`);\n }\n\n if ((version && currentlyUsedVersion === version) || (versionPerId && currentlyUsedVersion === newVersion)) {\n // it won't be relevant for 'reset' as it doesn't have a version/versionPerId\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at version ${version || newVersion}`,\n true\n );\n }\n if ((headVersion || latestVersion) && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `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 let isModified = false;\n if (currentlyUsedVersion) {\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n isModified = await consumer.isComponentModified(currentVersionObject, component!);\n const isRemoved = component && component.isRemoved();\n if (!isModified && !isRemoved && reset) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is not modified`, true);\n }\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()) {\n if (existingBitMapId) componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = id.changeVersion(newVersion);\n\n if (reset || (!isModified && !loadStash) || revert || !currentlyUsedVersion || forceTheirs || forceOurs) {\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 // in case of \"loadStash\", we want to merge the stashed modifications regardless whether it's modified currently.\n\n // if !currentlyUsedVersion it only exists in the model, so just write it. (happening during bit-switch/bit-lane-import)\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, componentFromModel, id, propsForMerge }: ComponentStatusBeforeMergeAttempt,\n checkoutProps: CheckoutProps\n ): 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 let baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n let baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const { loadStash } = checkoutProps;\n if (loadStash && otherComponent.parents.length) {\n // for stash, we want the stashed modifications to be added on top of the current version.\n // for this to happen, the \"base\" must be the parent of the stashed version.\n const parent = otherComponent.parents[0];\n baseVersion = parent.toString();\n baseComponent = await componentModel.loadVersion(baseVersion, repo);\n }\n\n const mergeResults = await threeWayMerge({\n scope: consumer.scope,\n otherComponent,\n otherLabel: loadStash ? 'stash' : 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), new RevertCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAA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AY,kBA0hBD,CAAC0Q,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,0BAAc,EAAEC,sBAAY,CAAC;AAAA/R,eAAA,CA1hB1GgB,YAAY,aA4hBNgR,kBAAW;AAiB9BZ,0BAAc,CAACa,UAAU,CAACjR,YAAY,CAAC;AAAC,IAAAkR,QAAA,GAAAT,OAAA,CAAA1S,OAAA,GAEzBiC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_logger","_workspace","_bitError","_lodash","_remove","_merging","_importer","_legacy","_componentWriter","_pMapSeries","_interopRequireDefault","_componentId","_objects","_legacy2","_legacy3","_checkoutCmd","_checkout","_checkoutVersion","_revertCmd","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","ensureCheckoutConfiguration","inInstallContext","version","ids","promptMergeOptions","syncNewComponents","addedComponents","restoreMissingComponents","newComponents","addNewComponents","bitIds","ComponentIdList","fromArray","map","id","allComponentStatusBeforeMerge","mapSeries","getComponentStatusBeforeMergeAttempt","compsNeedMerge","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importWithoutDeps","cache","lane","consumer","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","Promise","all","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","component","mergeResults","hasConflicts","mergeStrategy","BitError","toStringWithoutVersion","getMergeStrategyInteractive","throwForFailures","failedComponents","componentStatus","unchangedMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","currentComponent","applyVersion","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","manyComponentsWriterOpts","components","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","revert","shouldUpdateWorkspaceConfig","reasonForBitmapChange","writeMany","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","reasonForRemoval","removedComponents","n","toString","workspaceConfigUpdateResult","installationError","compilationError","missing","bitMapEntry","bitMap","getBitmapEntry","ignoreVersion","noFilesError","ComponentNotFoundInPath","comps","getMany","state","_consumer","stashedBitmapEntries","newBitmapEntries","entry","defaultScope","newComps","bitmapEntry","existingId","getBitmapEntryIfExist","modelComponent","ModelComponent","fromBitId","repo","objects","consumerComp","toConsumerComponent","newCompId","ComponentID","fromObject","name","fullName","writeToPath","rootDir","addComponent","componentId","files","f","basename","relativePath","relative","test","mainFile","config","triggerOnComponentAdd","compile","write","checkoutByCLIValues","componentPattern","setStatusLine","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","isExported","changeScope","scopeComponentsImporter","toVersionLatest","reason","includeUnexported","error","unavailableOnMain","getUnavailableOnMainComponents","makeComponentsAvailableOnMain","includeLocallyDeleted","latest","idsOnWorkspace","listIdsIncludeRemoved","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toComponentIds","hasWithoutVersion","LATEST","console","HEAD","getIds","idsByPattern","includeDeleted","laneBitIds","newComponentIds","bitId","isEqualWithoutVersion","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","ancestor","main","latestVersion","versionPerId","forceOurs","forceTheirs","loadStash","existingBitMapId","getComponentIdIfExist","getComponent","results","loadComponents","allowAddingComponentsFromScope","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","getNewVersion","headIncludeRemote","previousParent","getRefOfAncestor","getTagOfRefIfExists","latestVersionIfExist","newVersion","hasVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","isModified","currentVersionObject","loadVersion","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","componentFromFS","baseVersion","baseComponent","otherComponent","parents","parent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","RevertCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","MainRuntime","addRuntime","_default"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport type { ApplyVersionResults, FailedComponents, MergeStrategy } from '@teambit/merging';\nimport { threeWayMerge, getMergeStrategyInteractive } from '@teambit/merging';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy.constants';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport mapSeries from 'p-map-series';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport type { Version, Lane } from '@teambit/objects';\nimport { ModelComponent } from '@teambit/objects';\nimport { Tmp } from '@teambit/legacy.scope';\nimport { ComponentNotFoundInPath } from '@teambit/legacy.consumer-component';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport type { ComponentStatus, ComponentStatusBase } from './checkout-version';\nimport { applyVersion, throwForFailures } from './checkout-version';\nimport { RevertCmd } from './revert-cmd';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n ancestor?: number; // how many generations to go backward\n latest?: boolean;\n main?: boolean; // relevant for \"revert\" only\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy; // strategy to use in case of conflicts\n forceOurs?: boolean; // regardless of conflicts, use ours\n forceTheirs?: boolean; // regardless of conflicts, use theirs\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n revert?: boolean; // change the files according to the given version, but don't change the bitmap version and don't try to merge\n all?: boolean; // checkout all ids\n isLane?: boolean;\n lane?: Lane; // currently needed for \"bit switch\" to tell the \"fetch\" where to fetch from\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n loadStash?: boolean;\n stashedBitmapEntries?: Array<Partial<ComponentMap>>;\n restoreMissingComponents?: boolean; // in case .bitmap has a component and it's missing from the workspace, restore it (from model)\n allowAddingComponentsFromScope?: boolean; // in case the id doesn't exist in .bitmap, add it from the scope (relevant for switch)\n includeLocallyDeleted?: boolean; // include components that were deleted locally. currently enabled for \"bit checkout reset\" only.\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\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 await this.ensureCheckoutConfiguration(checkoutProps);\n this.workspace.inInstallContext = true;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const addedComponents = await this.restoreMissingComponents(checkoutProps);\n const newComponents = await this.addNewComponents(checkoutProps);\n const bitIds = ComponentIdList.fromArray(ids?.map((id) => id) || []);\n // don't use Promise.all, it loads the components and this operation must be in sequence.\n const allComponentStatusBeforeMerge = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id, 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\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n cache: true,\n lane: checkoutProps.lane,\n });\n const consumer = this.workspace.consumer;\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, checkoutProps)));\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 BitError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--auto-merge-resolve\" with 'manual', 'ours' or 'theirs' to resolve the conflict/s`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n\n throwForFailures(allComponentsStatus);\n\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\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) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, currentComponent, mergeResults }) => {\n return applyVersion(consumer, id, currentComponent, mergeResults, checkoutPropsLegacy);\n });\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))\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 || checkoutProps.revert,\n shouldUpdateWorkspaceConfig: true,\n reasonForBitmapChange: 'checkout',\n mergeStrategy: checkoutProps.mergeStrategy,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\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, reasonForRemoval: 'checkout' });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n addedComponents,\n newComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n workspaceConfigUpdateResult: componentWriterResults?.workspaceConfigUpdateResult,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n /**\n * if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.\n * returns the restored component ids.\n */\n async restoreMissingComponents(checkoutProps: CheckoutProps): Promise<ComponentID[] | undefined> {\n if (checkoutProps.reset) {\n checkoutProps.restoreMissingComponents = true;\n }\n if (!checkoutProps.restoreMissingComponents) return undefined;\n const ids = checkoutProps.ids || [];\n const missing: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const bitMapEntry = this.workspace.bitMap.getBitmapEntry(id, { ignoreVersion: true });\n if (bitMapEntry.noFilesError && bitMapEntry.noFilesError instanceof ComponentNotFoundInPath) {\n delete bitMapEntry.noFilesError;\n missing.push(id);\n }\n })\n );\n if (!missing.length) return undefined;\n const comps = await this.workspace.scope.getMany(missing);\n await this.componentWriter.writeMany({\n components: comps.map((c) => c.state._consumer),\n skipDependencyInstallation: true,\n skipUpdatingBitMap: true,\n });\n\n return missing;\n }\n\n async addNewComponents(checkoutProps: CheckoutProps): Promise<undefined | ComponentID[]> {\n const stashedBitmapEntries = checkoutProps.stashedBitmapEntries;\n if (!stashedBitmapEntries) return;\n const newBitmapEntries = stashedBitmapEntries.filter((entry) => entry.defaultScope);\n if (!newBitmapEntries.length) return;\n const newComps = await mapSeries(newBitmapEntries, async (bitmapEntry) => {\n const id = bitmapEntry.id!;\n const existingId = this.workspace.bitMap.getBitmapEntryIfExist(id, { ignoreVersion: true });\n if (existingId) return;\n const modelComponent = ModelComponent.fromBitId(id);\n const repo = this.workspace.scope.legacyScope.objects;\n const consumerComp = await modelComponent.toConsumerComponent(id.version, id.scope, repo);\n const newCompId = ComponentID.fromObject({ name: id.fullName }, bitmapEntry.defaultScope!);\n await this.componentWriter.writeMany({\n components: [consumerComp],\n skipDependencyInstallation: true,\n writeToPath: bitmapEntry.rootDir,\n skipUpdatingBitMap: true,\n });\n\n this.workspace.consumer.bitMap.addComponent({\n componentId: newCompId,\n files: consumerComp.files.map((f) => ({\n name: f.basename,\n relativePath: f.relative,\n test: f.test,\n })),\n mainFile: bitmapEntry.mainFile!,\n config: bitmapEntry.config,\n defaultScope: bitmapEntry.defaultScope,\n });\n await this.workspace.triggerOnComponentAdd(newCompId, { compile: true });\n return newCompId;\n });\n await this.workspace.bitMap.write();\n return compact(newComps);\n }\n\n async checkoutByCLIValues(componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const { revert, head } = checkoutProps;\n this.logger.setStatusLine(revert ? 'reverting components...' : 'switching component version...');\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 (head) await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy(`checkout (${componentPattern})`);\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !this.workspace.isExported(id)).map((id) => id.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(ComponentIdList.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n reason: 'for making sure the new components are really new and are not out-of-sync',\n includeUnexported: 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, 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 ensureCheckoutConfiguration(checkoutProps: CheckoutProps) {\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n if (checkoutProps.ids?.length) {\n return;\n }\n if (checkoutProps.head || checkoutProps.latest) {\n checkoutProps.all = true;\n }\n if (!checkoutProps.all) {\n return; // no ids and no all.\n }\n const idsOnWorkspace = checkoutProps.includeLocallyDeleted\n ? this.workspace.listIdsIncludeRemoved()\n : this.workspace.listIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n\n // When on a lane and doing head checkout, only checkout lane components\n const ids =\n currentLaneIds && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async parseValues(componentPattern: string, checkoutProps: CheckoutProps) {\n // CLI-specific validations and deprecation warnings\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 BitError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new BitError('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 if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n\n const getIds = async () => {\n if (componentPattern) {\n return this.workspace.idsByPattern(componentPattern, true, {\n includeDeleted: checkoutProps.includeLocallyDeleted,\n });\n }\n return checkoutProps.includeLocallyDeleted ? this.workspace.listIdsIncludeRemoved() : this.workspace.listIds();\n };\n\n const idsOnWorkspace = await getIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n // when no ids were given and the user is on a lane, return lane-ids only.\n // it's relevant for cases like \"bit checkout head\" when on a lane to not checkout main components. (see https://github.com/teambit/bit/pull/6853)\n const ids =\n currentLaneIds && !componentPattern && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\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.toComponentIds();\n const newComponentIds = laneBitIds.filter((bitId) => !ids.find((id) => id.isEqualWithoutVersion(bitId)));\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 // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const {\n version,\n head: headVersion,\n ancestor,\n reset,\n revert,\n main,\n latest: latestVersion,\n versionPerId,\n forceOurs,\n forceTheirs,\n loadStash,\n } = checkoutProps;\n const repo = consumer.scope.objects;\n\n let existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const getComponent = async () => {\n try {\n const results = await consumer.loadComponents(ComponentIdList.fromArray([id]));\n if (results.components[0]) return results.components[0];\n if (checkoutProps.includeLocallyDeleted && results.removedComponents[0]) {\n return results.removedComponents[0];\n }\n } catch (err) {\n if (checkoutProps.allowAddingComponentsFromScope && !existingBitMapId) return undefined;\n throw err;\n }\n return undefined;\n };\n const component = await getComponent();\n if (component) {\n // the component might fix an out-of-sync issue and as a result, the id has changed\n id = component.id;\n existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n }\n\n const componentModel = await consumer.scope.getModelComponentIfExist(id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${id.toString()} is new, no version to checkout`, true);\n }\n if (main && !componentModel.head) {\n return returnFailure(`component ${id.toString()} is not available on main`);\n }\n const unmerged = repo.unmergedComponents.getEntry(id);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n\n const getNewVersion = async (): Promise<string> => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (reset) return component!.id.version as string;\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (ancestor) {\n const previousParent = await componentModel.getRefOfAncestor(repo, ancestor);\n return componentModel.getTagOfRefIfExists(previousParent)?.toString() || previousParent.toString();\n }\n // we verified previously that head exists in case of \"main\"\n if (main) return componentModel.head?.toString() as string;\n if (latestVersion) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((bitId) => bitId.isEqualWithoutVersion(id))?.version as string;\n }\n\n // if all above are false, the version is defined\n return version as string;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion) return returnFailure(`component ${id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const currentlyUsedVersion = existingBitMapId?.version;\n if (existingBitMapId && !currentlyUsedVersion) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is new`);\n }\n\n if ((version && currentlyUsedVersion === version) || (versionPerId && currentlyUsedVersion === newVersion)) {\n // it won't be relevant for 'reset' as it doesn't have a version/versionPerId\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at version ${version || newVersion}`,\n true\n );\n }\n if ((headVersion || latestVersion) && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `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 let isModified = false;\n if (currentlyUsedVersion) {\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n isModified = await consumer.isComponentModified(currentVersionObject, component!);\n const isRemoved = component && component.isRemoved();\n if (!isModified && !isRemoved && reset) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is not modified`, true);\n }\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()) {\n if (existingBitMapId) componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = id.changeVersion(newVersion);\n\n if (reset || (!isModified && !loadStash) || revert || !currentlyUsedVersion || forceTheirs || forceOurs) {\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 // in case of \"loadStash\", we want to merge the stashed modifications regardless whether it's modified currently.\n\n // if !currentlyUsedVersion it only exists in the model, so just write it. (happening during bit-switch/bit-lane-import)\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, componentFromModel, id, propsForMerge }: ComponentStatusBeforeMergeAttempt,\n checkoutProps: CheckoutProps\n ): 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 let baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n let baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const { loadStash } = checkoutProps;\n if (loadStash && otherComponent.parents.length) {\n // for stash, we want the stashed modifications to be added on top of the current version.\n // for this to happen, the \"base\" must be the parent of the stashed version.\n const parent = otherComponent.parents[0];\n baseVersion = parent.toString();\n baseComponent = await componentModel.loadVersion(baseVersion, repo);\n }\n\n const mergeResults = await threeWayMerge({\n scope: consumer.scope,\n otherComponent,\n otherLabel: loadStash ? 'stash' : 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), new RevertCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA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AAS,EAAEC,MAAM,EAAE+P,UAAU,EAAE7P,QAAQ,EAAEC,MAAM,CAAC;IACtF0P,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,EAAE,KAAIG,sBAAS,EAACH,YAAY,CAAC,CAAC;IACxE,OAAOA,YAAY;EACrB;AACF;AAACI,OAAA,CAAAzQ,YAAA,GAAAA,YAAA;AAAAhB,eAAA,CA3iBYgB,YAAY,WAyhBR,EAAE;AAAAhB,eAAA,CAzhBNgB,YAAY,kBA0hBD,CAAC0Q,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,0BAAc,EAAEC,sBAAY,CAAC;AAAA/R,eAAA,CA1hB1GgB,YAAY,aA4hBNgR,kBAAW;AAiB9BZ,0BAAc,CAACa,UAAU,CAACjR,YAAY,CAAC;AAAC,IAAAkR,QAAA,GAAAT,OAAA,CAAA1S,OAAA,GAEzBiC,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_chai","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_harmonyTesting","_snapping","_workspace","_workspaceTesting","_componentTesting","_lister","_checkout","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","chai","use","describe","timeout","checkout","workspace","workspaceData","compDir","compId","before","mockWorkspace","workspacePath","compsDir","mockComponents","snapping","loadAspect","SnappingAspect","tag","ids","build","ignoreIssues","id","dir","fs","remove","expect","to","not","be","a","path","WorkspaceAspect","components","invalidComponents","componentLoader","getMany","undefined","have","lengthOf","CheckoutAspect","reset","after","destroyWorkspace","it","harmony","numOfComponents","loadManyAspects","ListerAspect","tagOpts","unmodified","checkoutByCLIValues","ancestor","all","skipNpmInstall","lister","list","localList","currentlyUsedVersion","equal"],"sources":["checkout.spec.ts"],"sourcesContent":["import chai, { expect } from 'chai';\nimport fs from 'fs-extra';\nimport { Harmony } from '@teambit/harmony';\nimport { ComponentID } from '@teambit/component-id';\nimport { loadAspect, loadManyAspects } from '@teambit/harmony.testing.load-aspect';\nimport { SnappingAspect, SnappingMain } from '@teambit/snapping';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { mockWorkspace, destroyWorkspace, WorkspaceData } from '@teambit/workspace.testing.mock-workspace';\nimport { mockComponents } from '@teambit/component.testing.mock-components';\nimport { ListerAspect, ListerMain } from '@teambit/lister';\nimport { CheckoutMain } from './checkout.main.runtime';\nimport { CheckoutAspect } from './checkout.aspect';\n\nchai.use(require('chai-fs'));\n\ndescribe('CheckoutAspect', function () {\n this.timeout(0);\n\n describe('checkout reset when the component files were deleted', () => {\n let checkout: CheckoutMain;\n let workspace: Workspace;\n let workspaceData: WorkspaceData;\n let compDir: string;\n let compId: ComponentID;\n before(async () => {\n workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n const compsDir = await mockComponents(workspacePath);\n const snapping: SnappingMain = await loadAspect(SnappingAspect, workspacePath);\n await snapping.tag({ ids: ['comp1'], build: false, ignoreIssues: 'MissingManuallyConfiguredPackages' });\n const { id, dir } = compsDir[0];\n compId = id;\n compDir = dir;\n await fs.remove(dir);\n\n // an intermediate step, check sure that the dir is not there and the component is invalid\n expect(dir).to.not.be.a.path();\n workspace = await loadAspect(WorkspaceAspect, workspacePath);\n const { components, invalidComponents } = await workspace.componentLoader.getMany([id], undefined, false);\n expect(components).to.have.lengthOf(0);\n expect(invalidComponents).to.have.lengthOf(1);\n\n checkout = await loadAspect(CheckoutAspect, workspacePath);\n await checkout.checkout({ reset: true, ids: [id] });\n });\n after(async () => {\n await destroyWorkspace(workspaceData);\n });\n it('should bring the files back', () => {\n expect(compDir).to.be.a.path();\n });\n it('the workspace should get the component as a valid component', async () => {\n workspace = await loadAspect(WorkspaceAspect, workspaceData.workspacePath);\n const { components, invalidComponents } = await workspace.componentLoader.getMany([compId], undefined, false);\n expect(components).to.have.lengthOf(1);\n expect(invalidComponents).to.have.lengthOf(0);\n });\n });\n\n describe('checkout to an ancestor', () => {\n let workspaceData: WorkspaceData;\n let harmony: Harmony;\n before(async () => {\n workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n await mockComponents(workspacePath, { numOfComponents: 2 });\n harmony = await loadManyAspects([SnappingAspect, ListerAspect, CheckoutAspect], workspacePath);\n const snapping: SnappingMain = harmony.get(SnappingAspect.id);\n const tagOpts = { build: false, ignoreIssues: 'MissingManuallyConfiguredPackages', unmodified: true };\n await snapping.tag(tagOpts); // 0.0.1\n await snapping.tag(tagOpts); // 0.0.2\n await snapping.tag(tagOpts); // 0.0.3\n await snapping.tag(tagOpts); // 0.0.4\n\n const checkout: CheckoutMain = harmony.get(CheckoutAspect.id);\n await checkout.checkoutByCLIValues('', { ancestor: 2, all: true, skipNpmInstall: true });\n });\n it('should checkout according to the number of generations specified', async () => {\n const lister: ListerMain = harmony.get(ListerAspect.id);\n const list = await lister.localList();\n expect(list).to.have.lengthOf(2);\n expect(list[0].currentlyUsedVersion).to.equal('0.0.2');\n expect(list[1].currentlyUsedVersion).to.equal('0.0.2');\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA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GAAG,CAAC+B,OAAO,CAAC,CAAC,CAAC;;MAE7B,MAAM5C,QAAsB,GAAGwC,OAAO,CAACnD,GAAG,CAAC8C,0BAAc,CAAClB,EAAE,CAAC;MAC7D,MAAMjB,QAAQ,CAAC8C,mBAAmB,CAAC,EAAE,EAAE;QAAEC,QAAQ,EAAE,CAAC;QAAEC,GAAG,EAAE,IAAI;QAAEC,cAAc,EAAE;MAAK,CAAC,CAAC;IAC1F,CAAC,CAAC;IACFV,EAAE,CAAC,kEAAkE,EAAE,YAAY;MACjF,MAAMW,MAAkB,GAAGV,OAAO,CAACnD,GAAG,CAACsD,sBAAY,CAAC1B,EAAE,CAAC;MACvD,MAAMkC,IAAI,GAAG,MAAMD,MAAM,CAACE,SAAS,CAAC,CAAC;MACrC,IAAA/B,cAAM,EAAC8B,IAAI,CAAC,CAAC7B,EAAE,CAACW,IAAI,CAACC,QAAQ,CAAC,CAAC,CAAC;MAChC,IAAAb,cAAM,EAAC8B,IAAI,CAAC,CAAC,CAAC,CAACE,oBAAoB,CAAC,CAAC/B,EAAE,CAACgC,KAAK,CAAC,OAAO,CAAC;MACtD,IAAAjC,cAAM,EAAC8B,IAAI,CAAC,CAAC,CAAC,CAACE,oBAAoB,CAAC,CAAC/B,EAAE,CAACgC,KAAK,CAAC,OAAO,CAAC;IACxD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_chai","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_harmonyTesting","_snapping","_workspace","_workspaceTesting","_componentTesting","_lister","_checkout","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","chai","use","describe","timeout","checkout","workspace","workspaceData","compDir","compId","before","mockWorkspace","workspacePath","compsDir","mockComponents","snapping","loadAspect","SnappingAspect","tag","ids","build","ignoreIssues","id","dir","fs","remove","expect","to","not","be","a","path","WorkspaceAspect","components","invalidComponents","componentLoader","getMany","undefined","have","lengthOf","CheckoutAspect","reset","after","destroyWorkspace","it","harmony","numOfComponents","loadManyAspects","ListerAspect","tagOpts","unmodified","checkoutByCLIValues","ancestor","all","skipNpmInstall","lister","list","localList","currentlyUsedVersion","equal"],"sources":["checkout.spec.ts"],"sourcesContent":["import chai, { expect } from 'chai';\nimport fs from 'fs-extra';\nimport type { Harmony } from '@teambit/harmony';\nimport type { ComponentID } from '@teambit/component-id';\nimport { loadAspect, loadManyAspects } from '@teambit/harmony.testing.load-aspect';\nimport type { SnappingMain } from '@teambit/snapping';\nimport { SnappingAspect } from '@teambit/snapping';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { WorkspaceData } from '@teambit/workspace.testing.mock-workspace';\nimport { mockWorkspace, destroyWorkspace } from '@teambit/workspace.testing.mock-workspace';\nimport { mockComponents } from '@teambit/component.testing.mock-components';\nimport type { ListerMain } from '@teambit/lister';\nimport { ListerAspect } from '@teambit/lister';\nimport type { CheckoutMain } from './checkout.main.runtime';\nimport { CheckoutAspect } from './checkout.aspect';\n\nchai.use(require('chai-fs'));\n\ndescribe('CheckoutAspect', function () {\n this.timeout(0);\n\n describe('checkout reset when the component files were deleted', () => {\n let checkout: CheckoutMain;\n let workspace: Workspace;\n let workspaceData: WorkspaceData;\n let compDir: string;\n let compId: ComponentID;\n before(async () => {\n workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n const compsDir = await mockComponents(workspacePath);\n const snapping: SnappingMain = await loadAspect(SnappingAspect, workspacePath);\n await snapping.tag({ ids: ['comp1'], build: false, ignoreIssues: 'MissingManuallyConfiguredPackages' });\n const { id, dir } = compsDir[0];\n compId = id;\n compDir = dir;\n await fs.remove(dir);\n\n // an intermediate step, check sure that the dir is not there and the component is invalid\n expect(dir).to.not.be.a.path();\n workspace = await loadAspect(WorkspaceAspect, workspacePath);\n const { components, invalidComponents } = await workspace.componentLoader.getMany([id], undefined, false);\n expect(components).to.have.lengthOf(0);\n expect(invalidComponents).to.have.lengthOf(1);\n\n checkout = await loadAspect(CheckoutAspect, workspacePath);\n await checkout.checkout({ reset: true, ids: [id] });\n });\n after(async () => {\n await destroyWorkspace(workspaceData);\n });\n it('should bring the files back', () => {\n expect(compDir).to.be.a.path();\n });\n it('the workspace should get the component as a valid component', async () => {\n workspace = await loadAspect(WorkspaceAspect, workspaceData.workspacePath);\n const { components, invalidComponents } = await workspace.componentLoader.getMany([compId], undefined, false);\n expect(components).to.have.lengthOf(1);\n expect(invalidComponents).to.have.lengthOf(0);\n });\n });\n\n describe('checkout to an ancestor', () => {\n let workspaceData: WorkspaceData;\n let harmony: Harmony;\n before(async () => {\n workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n await mockComponents(workspacePath, { numOfComponents: 2 });\n harmony = await loadManyAspects([SnappingAspect, ListerAspect, CheckoutAspect], workspacePath);\n const snapping: SnappingMain = harmony.get(SnappingAspect.id);\n const tagOpts = { build: false, ignoreIssues: 'MissingManuallyConfiguredPackages', unmodified: true };\n await snapping.tag(tagOpts); // 0.0.1\n await snapping.tag(tagOpts); // 0.0.2\n await snapping.tag(tagOpts); // 0.0.3\n await snapping.tag(tagOpts); // 0.0.4\n\n const checkout: CheckoutMain = harmony.get(CheckoutAspect.id);\n await checkout.checkoutByCLIValues('', { ancestor: 2, all: true, skipNpmInstall: true });\n });\n it('should checkout according to the number of generations specified', async () => {\n const lister: ListerMain = harmony.get(ListerAspect.id);\n const list = await lister.localList();\n expect(list).to.have.lengthOf(2);\n expect(list[0].currentlyUsedVersion).to.equal('0.0.2');\n expect(list[1].currentlyUsedVersion).to.equal('0.0.2');\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IA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}
@@ -1,5 +1,5 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { CheckoutMain } from './checkout.main.runtime';
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { CheckoutMain } from './checkout.main.runtime';
3
3
  export declare class RevertCmd implements Command {
4
4
  private checkout;
5
5
  name: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_legacy","data","require","_checkoutCmd","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RevertCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","to","verbose","skipDependencyInstallation","CheckoutCmd","revert","exports"],"sources":["revert-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport { CheckoutMain } from './checkout.main.runtime';\nimport { CheckoutCmd } from './checkout-cmd';\n\nexport class RevertCmd implements Command {\n name = 'revert <component-pattern> <to>';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'to',\n description: \"permitted values: [main, specific-version]. 'main' - head version on main.\",\n },\n ];\n description = 'replace the current component files by the specified version, leave the version intact';\n group = 'version-control';\n alias = '';\n options = [\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [componentPattern, to]: [string, string],\n {\n verbose = false,\n skipDependencyInstallation = false,\n }: {\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n }\n ) {\n return new CheckoutCmd(this.checkout).report([to, componentPattern], {\n verbose,\n skipDependencyInstallation,\n revert: true,\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAA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E;IAAAA,eAAA,kBACA,CACR,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,EACzD,CAAC,GAAG,EAAE,8BAA8B,EAAE,oDAAoD,CAAC,CAC5F;IAAAA,eAAA,iBACQ,IAAI;EAEgC;EAE7C,MAAMyB,MAAMA,CACV,CAACC,gBAAgB,EAAEC,EAAE,CAAmB,EACxC;IACEC,OAAO,GAAG,KAAK;IACfC,0BAA0B,GAAG;EAI/B,CAAC,EACD;IACA,OAAO,KAAIC,0BAAW,EAAC,IAAI,CAACT,QAAQ,CAAC,CAACI,MAAM,CAAC,CAACE,EAAE,EAAED,gBAAgB,CAAC,EAAE;MACnEE,OAAO;MACPC,0BAA0B;MAC1BE,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAb,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_legacy","data","require","_checkoutCmd","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RevertCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","to","verbose","skipDependencyInstallation","CheckoutCmd","revert","exports"],"sources":["revert-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { CheckoutMain } from './checkout.main.runtime';\nimport { CheckoutCmd } from './checkout-cmd';\n\nexport class RevertCmd implements Command {\n name = 'revert <component-pattern> <to>';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'to',\n description: \"permitted values: [main, specific-version]. 'main' - head version on main.\",\n },\n ];\n description = 'replace the current component files by the specified version, leave the version intact';\n group = 'version-control';\n alias = '';\n options = [\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [componentPattern, to]: [string, string],\n {\n verbose = false,\n skipDependencyInstallation = false,\n }: {\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n }\n ) {\n return new CheckoutCmd(this.checkout).report([to, componentPattern], {\n verbose,\n skipDependencyInstallation,\n revert: true,\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6C,SAAAG,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEtC,MAAMgB,SAAS,CAAoB;EAqBxCC,WAAWA,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAArB,eAAA,eApBnC,iCAAiC;IAAAA,eAAA,oBAC5B,CACV;MACEsB,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,EACD;MACEF,IAAI,EAAE,IAAI;MACVC,WAAW,EAAE;IACf,CAAC,CACF;IAAAvB,eAAA,sBACa,wFAAwF;IAAAA,eAAA,gBAC9F,iBAAiB;IAAAA,eAAA,gBACjB,EAAE;IAAAA,eAAA,kBACA,CACR,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,EACzD,CAAC,GAAG,EAAE,8BAA8B,EAAE,oDAAoD,CAAC,CAC5F;IAAAA,eAAA,iBACQ,IAAI;EAEgC;EAE7C,MAAMyB,MAAMA,CACV,CAACC,gBAAgB,EAAEC,EAAE,CAAmB,EACxC;IACEC,OAAO,GAAG,KAAK;IACfC,0BAA0B,GAAG;EAI/B,CAAC,EACD;IACA,OAAO,KAAIC,0BAAW,EAAC,IAAI,CAACT,QAAQ,CAAC,CAACI,MAAM,CAAC,CAACE,EAAE,EAAED,gBAAgB,CAAC,EAAE;MACnEE,OAAO;MACPC,0BAA0B;MAC1BE,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAb,SAAA,GAAAA,SAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "1.0.667",
3
+ "version": "1.0.669",
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": "1.0.667"
9
+ "version": "1.0.669"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -15,33 +15,33 @@
15
15
  "@teambit/bit-error": "0.0.404",
16
16
  "@teambit/component-id": "1.2.4",
17
17
  "@teambit/legacy.constants": "0.0.13",
18
- "@teambit/component.sources": "0.0.109",
19
- "@teambit/legacy.consumer-component": "0.0.58",
20
- "@teambit/legacy.consumer": "0.0.57",
18
+ "@teambit/component.sources": "0.0.110",
19
+ "@teambit/legacy.consumer-component": "0.0.59",
20
+ "@teambit/legacy.consumer": "0.0.58",
21
21
  "@teambit/legacy.utils": "0.0.22",
22
22
  "@teambit/harmony": "0.4.7",
23
- "@teambit/legacy.bit-map": "0.0.114",
24
- "@teambit/legacy.scope": "0.0.57",
25
- "@teambit/cli": "0.0.1244",
26
- "@teambit/merging": "1.0.667",
27
- "@teambit/objects": "0.0.174",
28
- "@teambit/component-writer": "1.0.667",
29
- "@teambit/importer": "1.0.667",
30
- "@teambit/logger": "0.0.1337",
31
- "@teambit/remove": "1.0.667",
32
- "@teambit/workspace": "1.0.667"
23
+ "@teambit/legacy.bit-map": "0.0.115",
24
+ "@teambit/legacy.scope": "0.0.58",
25
+ "@teambit/cli": "0.0.1246",
26
+ "@teambit/merging": "1.0.669",
27
+ "@teambit/objects": "0.0.176",
28
+ "@teambit/component-writer": "1.0.669",
29
+ "@teambit/importer": "1.0.669",
30
+ "@teambit/logger": "0.0.1339",
31
+ "@teambit/remove": "1.0.669",
32
+ "@teambit/workspace": "1.0.669"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/lodash": "4.14.165",
36
36
  "@types/fs-extra": "9.0.7",
37
37
  "fs-extra": "10.0.0",
38
38
  "@types/mocha": "9.1.0",
39
- "@teambit/component.testing.mock-components": "0.0.321",
40
- "@teambit/harmony.testing.load-aspect": "0.0.316",
39
+ "@teambit/component.testing.mock-components": "0.0.322",
40
+ "@teambit/harmony.testing.load-aspect": "0.0.317",
41
+ "@teambit/workspace.testing.mock-workspace": "0.0.101",
41
42
  "@teambit/harmony.envs.core-aspect-env": "0.0.72",
42
- "@teambit/lister": "1.0.667",
43
- "@teambit/snapping": "1.0.667",
44
- "@teambit/workspace.testing.mock-workspace": "0.0.100"
43
+ "@teambit/lister": "1.0.669",
44
+ "@teambit/snapping": "1.0.669"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "chai": "5.2.1",