@teambit/remove 0.0.0-df97f10b385de851205fd957ff2dc5f4a8bb03ee → 0.0.0-e052d5731fb731cd52696d03c7e39cbdf038def7

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.
@@ -18,6 +18,13 @@ function _yesno() {
18
18
  };
19
19
  return data;
20
20
  }
21
+ function _cli() {
22
+ const data = require("@teambit/cli");
23
+ _cli = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
21
28
  function _bitError() {
22
29
  const data = require("@teambit/bit-error");
23
30
  _bitError = function () {
@@ -48,11 +55,10 @@ class DeleteCmd {
48
55
  this.remove = remove;
49
56
  this.workspace = workspace;
50
57
  _defineProperty(this, "name", 'delete <component-pattern>');
51
- _defineProperty(this, "description", 'mark components as deleted on the remote');
52
- _defineProperty(this, "extendedDescription", `to remove components from your local workspace only, use "bit remove" command.
53
- this command marks the components as deleted, and after snap/tag and export they will be marked as deleted from the remote scope as well.
54
- unless the '--hard' flag is used (not recommended!), in which case, the component will be deleted from the remote scope immediately.
55
- `);
58
+ _defineProperty(this, "description", 'soft-delete components from remote scopes');
59
+ _defineProperty(this, "extendedDescription", `marks components as deleted so they won't be visible on remote scopes after export.
60
+ components remain recoverable using "bit recover" unless --hard is used (permanent deletion, not recommended).
61
+ to remove components from your local workspace only, use "bit remove" instead.`);
56
62
  _defineProperty(this, "arguments", [{
57
63
  name: 'component-pattern',
58
64
  description: _legacy().COMPONENT_PATTERN_HELP
@@ -61,7 +67,7 @@ unless the '--hard' flag is used (not recommended!), in which case, the componen
61
67
  _defineProperty(this, "helpUrl", 'reference/components/removing-components');
62
68
  _defineProperty(this, "skipWorkspace", true);
63
69
  _defineProperty(this, "alias", '');
64
- _defineProperty(this, "options", [['', 'lane', 'when on a lane, delete the component from this lane only. avoid merging it to main or other lanes'], ['', 'update-main', 'delete component/s on the main lane after merging this lane into main'], ['', 'range <string>', 'EXPERIMENTAL. enter a Semver range to delete specific tags (cannot be used for snaps). see https://www.npmjs.com/package/semver#ranges for the range syntax'], ['s', 'silent', 'skip confirmation'], ['', 'hard', 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.'], ['f', 'force', 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt'], ['', 'snaps <string>', 'comma-separated list of snap hashes to mark as deleted (e.g. --snaps "hash1,hash2,hash3")']]);
70
+ _defineProperty(this, "options", [['', 'lane', 'when on a lane, delete the component from this lane only. this removal will not affect main when the lane is merged'], ['', 'update-main', 'delete component/s on the main lane after merging this lane into main'], ['', 'range <string>', 'EXPERIMENTAL. enter a Semver range to delete specific tags (cannot be used for snaps). see https://www.npmjs.com/package/semver#ranges for the range syntax'], ['s', 'silent', 'skip confirmation'], ['', 'hard', 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.'], ['f', 'force', 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt'], ['', 'snaps <string>', 'comma-separated list of snap hashes to mark as deleted (e.g. --snaps "hash1,hash2,hash3")']]);
65
71
  _defineProperty(this, "loader", true);
66
72
  _defineProperty(this, "remoteOp", true);
67
73
  }
@@ -75,13 +81,15 @@ unless the '--hard' flag is used (not recommended!), in which case, the componen
75
81
  snaps
76
82
  }) {
77
83
  if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {
78
- throw new (_bitError().BitError)(`error: to delete components when on a lane, use --lane flag`);
84
+ throw new (_bitError().BitError)(`error: to delete components when on a lane, use either --lane or --update-main flag.
85
+ --lane: delete the component from this lane only
86
+ --update-main: delete the component from main after this lane is merged`);
79
87
  }
80
88
  if (this.workspace?.isOnMain() && updateMain) {
81
89
  throw new (_bitError().BitError)(`--update-main is relevant only when on a lane`);
82
90
  }
83
91
  if (!silent) {
84
- await this.removePrompt(hard, lane);
92
+ await this.removePrompt(hard, lane, updateMain);
85
93
  }
86
94
  if (hard) {
87
95
  if (range) throw new (_bitError().BitError)(`--range is not supported with --hard flag`);
@@ -106,18 +114,23 @@ unless the '--hard' flag is used (not recommended!), in which case, the componen
106
114
  deleteOpts.snaps = snaps.split(',').map(s => s.trim()).filter(Boolean);
107
115
  }
108
116
  const removedComps = await this.remove.deleteComps(componentsPattern, deleteOpts);
109
- const removedCompIds = removedComps.map(comp => comp.id.toString());
110
- return `${_chalk().default.green('successfully deleted the following components:')}
111
- ${removedCompIds.join('\n')}
112
-
113
- ${_chalk().default.bold('to update the remote, please tag/snap and then export. to revert, please use "bit recover"')}`;
117
+ const items = removedComps.map(comp => (0, _cli().formatItem)(comp.id.toString()));
118
+ return (0, _cli().joinSections)([(0, _cli().formatSuccessSummary)('successfully deleted the following components'), items.join('\n'), (0, _cli().formatHint)('to update the remote, please tag/snap and then export. to revert, please use "bit recover"')]);
114
119
  }
115
120
  paintArray(removedObjectsArray) {
116
121
  return removedObjectsArray.map(item => (0, _removeTemplate().removeTemplate)(item, true));
117
122
  }
118
- async removePrompt(hard, lane) {
123
+ async removePrompt(hard, lane, updateMain) {
119
124
  this.remove.logger.clearStatusLine();
120
- const laneOrMainWarning = lane ? `this command will mark the component as removed from this lane, resetting the component to its pre-lane state and content (after tag/snap and export)` : `this command will mark the component as deleted, and it won’t be visible on the remote scope (after tag/snap and export).`;
125
+ let laneOrMainWarning;
126
+ if (updateMain) {
127
+ laneOrMainWarning = `once this lane is merged, the component will be deleted from main (it won't be visible on the remote scope after tag/snap and export).
128
+ if your intent was to undo all changes to this component done as part of the lane so the component in main will be intact, use --lane instead.`;
129
+ } else if (lane) {
130
+ laneOrMainWarning = `this command will mark the component as removed from this lane, resetting the component to its pre-lane state and content (after tag/snap and export)`;
131
+ } else {
132
+ laneOrMainWarning = `this command will mark the component as deleted, and it won't be visible on the remote scope (after tag/snap and export).`;
133
+ }
121
134
  const remoteOrLocalOutput = hard ? `WARNING: the component(s) will be permanently deleted from the remote with no option to recover. prefer omitting --hard to only mark the component as soft deleted` : `${laneOrMainWarning}
122
135
  if your intent is to remove the component only from your local workspace, refer to bit remove or bit eject.`;
123
136
  const ok = await (0, _yesno().default)({
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","range","snaps","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","deleteOpts","split","map","s","trim","filter","Boolean","removedComps","deleteComps","removedCompIds","comp","id","toString","chalk","green","join","bold","removedObjectsArray","item","logger","clearStatusLine","laneOrMainWarning","remoteOrLocalOutput","ok","yesno","question","exports"],"sources":["delete-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport type { RemovedObjects } from '@teambit/legacy.scope';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class DeleteCmd implements Command {\n name = 'delete <component-pattern>';\n description = 'mark components as deleted on the remote';\n extendedDescription = `to remove components from your local workspace only, use \"bit remove\" command.\nthis command marks the components as deleted, and after snap/tag and export they will be marked as deleted from the remote scope as well.\nunless the '--hard' flag is used (not recommended!), in which case, the component will be deleted from the remote scope immediately.\n`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = '';\n options = [\n ['', 'lane', 'when on a lane, delete the component from this lane only. avoid merging it to main or other lanes'],\n ['', 'update-main', 'delete component/s on the main lane after merging this lane into main'],\n [\n '',\n 'range <string>',\n 'EXPERIMENTAL. enter a Semver range to delete specific tags (cannot be used for snaps). see https://www.npmjs.com/package/semver#ranges for the range syntax',\n ],\n ['s', 'silent', 'skip confirmation'],\n [\n '',\n 'hard',\n 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.',\n ],\n [\n 'f',\n 'force',\n 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt',\n ],\n ['', 'snaps <string>', 'comma-separated list of snap hashes to mark as deleted (e.g. --snaps \"hash1,hash2,hash3\")'],\n ] as CommandOptions;\n loader = true;\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n lane = false,\n updateMain = false,\n hard = false,\n silent = false,\n range,\n snaps,\n }: {\n force?: boolean;\n lane?: boolean;\n updateMain?: boolean;\n hard?: boolean;\n silent?: boolean;\n range?: string;\n snaps?: string;\n }\n ) {\n if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {\n throw new BitError(`error: to delete components when on a lane, use --lane flag`);\n }\n if (this.workspace?.isOnMain() && updateMain) {\n throw new BitError(`--update-main is relevant only when on a lane`);\n }\n\n if (!silent) {\n await this.removePrompt(hard, lane);\n }\n\n if (hard) {\n if (range) throw new BitError(`--range is not supported with --hard flag`);\n const { localResult, remoteResult = [] } = await this.remove.remove({ componentsPattern, remote: true, force });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n let localMessage = removeTemplate(localResult, false);\n if (localMessage !== '') localMessage += '\\n';\n return `${localMessage}${this.paintArray(remoteResult)}`;\n }\n\n const deleteOpts: any = { updateMain, range };\n if (snaps) {\n deleteOpts.snaps = snaps\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean);\n }\n const removedComps = await this.remove.deleteComps(componentsPattern, deleteOpts);\n const removedCompIds = removedComps.map((comp) => comp.id.toString());\n return `${chalk.green('successfully deleted the following components:')}\n${removedCompIds.join('\\n')}\n\n${chalk.bold('to update the remote, please tag/snap and then export. to revert, please use \"bit recover\"')}`;\n }\n\n private paintArray(removedObjectsArray: RemovedObjects[]) {\n return removedObjectsArray.map((item) => removeTemplate(item, true));\n }\n\n private async removePrompt(hard?: boolean, lane?: boolean) {\n this.remove.logger.clearStatusLine();\n const laneOrMainWarning = lane\n ? `this command will mark the component as removed from this lane, resetting the component to its pre-lane state and content (after tag/snap and export)`\n : `this command will mark the component as deleted, and it won’t be visible on the remote scope (after tag/snap and export).`;\n const remoteOrLocalOutput = hard\n ? `WARNING: the component(s) will be permanently deleted from the remote with no option to recover. prefer omitting --hard to only mark the component as soft deleted`\n : `${laneOrMainWarning}\nif your intent is to remove the component only from your local workspace, refer to bit remove or bit eject.`;\n\n const ok = await yesno({\n question: `${remoteOrLocalOutput}\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,G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YA,CAACP,IAAc,EAAEF,IAAc,EAAE;IACzD,IAAI,CAACR,MAAM,CAAC2C,MAAM,CAACC,eAAe,CAAC,CAAC;IACpC,MAAMC,iBAAiB,GAAGrC,IAAI,GAC1B,uJAAuJ,GACvJ,2HAA2H;IAC/H,MAAMsC,mBAAmB,GAAGpC,IAAI,GAC5B,oKAAoK,GACpK,GAAGmC,iBAAiB;AAC5B,4GAA4G;IAExG,MAAME,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAE,GAAGH,mBAAmB;AACtC,EAAET,gBAAK,CAACG,IAAI,CAAC,2CAA2C,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACO,EAAE,EAAE;MACP,MAAM,KAAIhC,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACmC,OAAA,CAAApD,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_cli","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","range","snaps","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","deleteOpts","split","map","s","trim","filter","Boolean","removedComps","deleteComps","items","comp","formatItem","id","toString","joinSections","formatSuccessSummary","join","formatHint","removedObjectsArray","item","logger","clearStatusLine","laneOrMainWarning","remoteOrLocalOutput","ok","yesno","question","chalk","bold","exports"],"sources":["delete-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { formatItem, formatSuccessSummary, formatHint, joinSections } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport type { RemovedObjects } from '@teambit/legacy.scope';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class DeleteCmd implements Command {\n name = 'delete <component-pattern>';\n description = 'soft-delete components from remote scopes';\n extendedDescription = `marks components as deleted so they won't be visible on remote scopes after export.\ncomponents remain recoverable using \"bit recover\" unless --hard is used (permanent deletion, not recommended).\nto remove components from your local workspace only, use \"bit remove\" instead.`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = '';\n options = [\n [\n '',\n 'lane',\n 'when on a lane, delete the component from this lane only. this removal will not affect main when the lane is merged',\n ],\n ['', 'update-main', 'delete component/s on the main lane after merging this lane into main'],\n [\n '',\n 'range <string>',\n 'EXPERIMENTAL. enter a Semver range to delete specific tags (cannot be used for snaps). see https://www.npmjs.com/package/semver#ranges for the range syntax',\n ],\n ['s', 'silent', 'skip confirmation'],\n [\n '',\n 'hard',\n 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.',\n ],\n [\n 'f',\n 'force',\n 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt',\n ],\n ['', 'snaps <string>', 'comma-separated list of snap hashes to mark as deleted (e.g. --snaps \"hash1,hash2,hash3\")'],\n ] as CommandOptions;\n loader = true;\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n lane = false,\n updateMain = false,\n hard = false,\n silent = false,\n range,\n snaps,\n }: {\n force?: boolean;\n lane?: boolean;\n updateMain?: boolean;\n hard?: boolean;\n silent?: boolean;\n range?: string;\n snaps?: string;\n }\n ) {\n if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {\n throw new BitError(`error: to delete components when on a lane, use either --lane or --update-main flag.\n--lane: delete the component from this lane only\n--update-main: delete the component from main after this lane is merged`);\n }\n if (this.workspace?.isOnMain() && updateMain) {\n throw new BitError(`--update-main is relevant only when on a lane`);\n }\n\n if (!silent) {\n await this.removePrompt(hard, lane, updateMain);\n }\n\n if (hard) {\n if (range) throw new BitError(`--range is not supported with --hard flag`);\n const { localResult, remoteResult = [] } = await this.remove.remove({ componentsPattern, remote: true, force });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n let localMessage = removeTemplate(localResult, false);\n if (localMessage !== '') localMessage += '\\n';\n return `${localMessage}${this.paintArray(remoteResult)}`;\n }\n\n const deleteOpts: any = { updateMain, range };\n if (snaps) {\n deleteOpts.snaps = snaps\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean);\n }\n const removedComps = await this.remove.deleteComps(componentsPattern, deleteOpts);\n const items = removedComps.map((comp) => formatItem(comp.id.toString()));\n return joinSections([\n formatSuccessSummary('successfully deleted the following components'),\n items.join('\\n'),\n formatHint('to update the remote, please tag/snap and then export. to revert, please use \"bit recover\"'),\n ]);\n }\n\n private paintArray(removedObjectsArray: RemovedObjects[]) {\n return removedObjectsArray.map((item) => removeTemplate(item, true));\n }\n\n private async removePrompt(hard?: boolean, lane?: boolean, updateMain?: boolean) {\n this.remove.logger.clearStatusLine();\n\n let laneOrMainWarning: string;\n if (updateMain) {\n laneOrMainWarning = `once this lane is merged, the component will be deleted from main (it won't be visible on the remote scope after tag/snap and export).\nif your intent was to undo all changes to this component done as part of the lane so the component in main will be intact, use --lane instead.`;\n } else if (lane) {\n laneOrMainWarning = `this command will mark the component as removed from this lane, resetting the component to its pre-lane state and content (after tag/snap and export)`;\n } else {\n laneOrMainWarning = `this command will mark the component as deleted, and it won't be visible on the remote scope (after tag/snap and export).`;\n }\n\n const remoteOrLocalOutput = hard\n ? `WARNING: the component(s) will be permanently deleted from the remote with no option to recover. prefer omitting --hard to only mark the component as soft deleted`\n : `${laneOrMainWarning}\nif your intent is to remove the component only from your local workspace, refer to bit remove or bit eject.`;\n\n const ok = await yesno({\n question: `${remoteOrLocalOutput}\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,gBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,eAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,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,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CAAC,MAAM;MACLA,iBAAiB,GAAG,2HAA2H;IACjJ;IAEA,MAAMC,mBAAmB,GAAGrC,IAAI,GAC5B,oKAAoK,GACpK,GAAGoC,iBAAiB;AAC5B,4GAA4G;IAExG,MAAME,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAE,GAAGH,mBAAmB;AACtC,EAAEI,gBAAK,CAACC,IAAI,CAAC,2CAA2C,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACJ,EAAE,EAAE;MACP,MAAM,KAAIjC,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACsC,OAAA,CAAAvD,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -8,9 +8,14 @@ export declare class RecoverCmd implements Command {
8
8
  private remove;
9
9
  name: string;
10
10
  description: string;
11
+ extendedDescription: string;
12
+ arguments: {
13
+ name: string;
14
+ description: string;
15
+ }[];
11
16
  group: string;
12
17
  options: CommandOptions;
13
18
  loader: boolean;
14
19
  constructor(remove: RemoveMain);
15
- report([componentName]: [string], options: RecoverOptions): Promise<string>;
20
+ report([componentPattern]: [string], options: RecoverOptions): Promise<string>;
16
21
  }
@@ -4,39 +4,51 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RecoverCmd = void 0;
7
- function _chalk() {
8
- const data = _interopRequireDefault(require("chalk"));
9
- _chalk = function () {
7
+ function _bitError() {
8
+ const data = require("@teambit/bit-error");
9
+ _bitError = function () {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- function _bitError() {
15
- const data = require("@teambit/bit-error");
16
- _bitError = function () {
14
+ function _cli() {
15
+ const data = require("@teambit/cli");
16
+ _cli = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _legacy() {
22
+ const data = require("@teambit/legacy.constants");
23
+ _legacy = function () {
17
24
  return data;
18
25
  };
19
26
  return data;
20
27
  }
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
28
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
23
29
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
24
30
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
25
31
  class RecoverCmd {
26
32
  constructor(remove) {
27
33
  this.remove = remove;
28
- _defineProperty(this, "name", 'recover <component-name>');
29
- _defineProperty(this, "description", 'recover component(s) soft-deleted from the workspace, or a remote scope');
34
+ _defineProperty(this, "name", 'recover <component-pattern>');
35
+ _defineProperty(this, "description", 'restore soft-deleted components');
36
+ _defineProperty(this, "extendedDescription", 'reverses the soft-deletion of components marked with "bit delete", restoring them to their previous state. works for both local and remote soft-deleted components. supports patterns like "comp1", "org.scope/*", etc.');
37
+ _defineProperty(this, "arguments", [{
38
+ name: 'component-pattern',
39
+ description: _legacy().COMPONENT_PATTERN_HELP
40
+ }]);
30
41
  _defineProperty(this, "group", 'collaborate');
31
42
  _defineProperty(this, "options", [['x', 'skip-dependency-installation', 'do not install packages in case of importing components'], ['', 'skip-write-config-files', 'do not write config files (such as eslint, tsconfig, prettier, etc...)']]);
32
43
  _defineProperty(this, "loader", true);
33
44
  }
34
- async report([componentName], options) {
35
- const hasRecovered = await this.remove.recover(componentName, options);
36
- if (!hasRecovered) {
37
- throw new (_bitError().BitError)(`component ${componentName} was not soft-deleted, nothing to recover`);
45
+ async report([componentPattern], options) {
46
+ const recovered = await this.remove.recover(componentPattern, options);
47
+ if (recovered.length === 0) {
48
+ throw new (_bitError().BitError)(`no soft-deleted components found matching pattern "${componentPattern}"`);
38
49
  }
39
- return _chalk().default.green(`successfully recovered ${componentName}`);
50
+ const items = recovered.map(id => (0, _cli().formatItem)(id.toString()));
51
+ return `${(0, _cli().formatSuccessSummary)('successfully recovered the following component(s)')}\n${items.join('\n')}`;
40
52
  }
41
53
  }
42
54
  exports.RecoverCmd = RecoverCmd;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RecoverCmd","constructor","remove","report","componentName","options","hasRecovered","recover","BitError","chalk","green","exports"],"sources":["recover-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { RemoveMain } from './remove.main.runtime';\n\nexport type RecoverOptions = {\n skipDependencyInstallation?: boolean;\n skipWriteConfigFiles?: boolean;\n};\n\nexport class RecoverCmd implements Command {\n name = 'recover <component-name>';\n description = 'recover component(s) soft-deleted from the workspace, or a remote scope';\n group = 'collaborate';\n options = [\n ['x', 'skip-dependency-installation', 'do not install packages in case of importing components'],\n ['', 'skip-write-config-files', 'do not write config files (such as eslint, tsconfig, prettier, etc...)'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private remove: RemoveMain) {}\n\n async report([componentName]: [string], options: RecoverOptions) {\n const hasRecovered = await this.remove.recover(componentName, options);\n if (!hasRecovered) {\n throw new BitError(`component ${componentName} was not soft-deleted, nothing to recover`);\n }\n return chalk.green(`successfully recovered ${componentName}`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAA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AAEC,OAAuB,EAAE;IAC/D,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,OAAO,CAACH,aAAa,EAAEC,OAAO,CAAC;IACtE,IAAI,CAACC,YAAY,EAAE;MACjB,MAAM,KAAIE,oBAAQ,EAAC,aAAaJ,aAAa,2CAA2C,CAAC;IAC3F;IACA,OAAOK,gBAAK,CAACC,KAAK,CAAC,0BAA0BN,aAAa,EAAE,CAAC;EAC/D;AACF;AAACO,OAAA,CAAAX,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_bitError","data","require","_cli","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RecoverCmd","constructor","remove","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","options","recovered","recover","length","BitError","items","map","id","formatItem","toString","formatSuccessSummary","join","exports"],"sources":["recover-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { formatItem, formatSuccessSummary } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { RemoveMain } from './remove.main.runtime';\n\nexport type RecoverOptions = {\n skipDependencyInstallation?: boolean;\n skipWriteConfigFiles?: boolean;\n};\n\nexport class RecoverCmd implements Command {\n name = 'recover <component-pattern>';\n description = 'restore soft-deleted components';\n extendedDescription =\n 'reverses the soft-deletion of components marked with \"bit delete\", restoring them to their previous state. works for both local and remote soft-deleted components. supports patterns like \"comp1\", \"org.scope/*\", etc.';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n options = [\n ['x', 'skip-dependency-installation', 'do not install packages in case of importing components'],\n ['', 'skip-write-config-files', 'do not write config files (such as eslint, tsconfig, prettier, etc...)'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private remove: RemoveMain) {}\n\n async report([componentPattern]: [string], options: RecoverOptions) {\n const recovered = await this.remove.recover(componentPattern, options);\n if (recovered.length === 0) {\n throw new BitError(`no soft-deleted components found matching pattern \"${componentPattern}\"`);\n }\n const items = recovered.map((id) => formatItem(id.toString()));\n return `${formatSuccessSummary('successfully recovered the following component(s)')}\\n${items.join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAI,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,uCAAA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 'remove <component-pattern>');
51
- _defineProperty(this, "description", 'remove component(s) from the local workspace');
52
- _defineProperty(this, "extendedDescription", `to mark components as deleted on the remote scope, use "bit delete".`);
51
+ _defineProperty(this, "description", 'untrack components from the workspace');
52
+ _defineProperty(this, "extendedDescription", `removes components from the local workspace only - stops tracking them in .bitmap and deletes their files by default.
53
+ does not affect remote scopes - to delete components from remotes, use "bit delete" instead.
54
+ use --keep-files to preserve component files while only removing the tracking.`);
53
55
  _defineProperty(this, "arguments", [{
54
56
  name: 'component-pattern',
55
57
  description: _legacy().COMPONENT_PATTERN_HELP
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RemoveCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","cmd","report","componentsPattern","force","track","silent","keepFiles","removePrompt","localResult","deleteFiles","localMessage","removeTemplate","logger","clearStatusLine","filesDeletionStr","ok","yesno","question","chalk","bold","BitError","exports"],"sources":["remove-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { RemovedLocalObjects } from './removed-local-objects';\nimport type { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class RemoveCmd implements Command {\n name = 'remove <component-pattern>';\n description = 'remove component(s) from the local workspace';\n extendedDescription = `to mark components as deleted on the remote scope, use \"bit delete\".`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'component-development';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = 'rm';\n options = [\n ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'],\n ['', 'keep-files', 'keep component files (just untrack the component)'],\n [\n 'f',\n 'force',\n 'removes the component from the scope, even if used as a dependency. WARNING: you will need to fix the components that depend on this component',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n examples = [\n {\n cmd: 'remove \"$deprecated\"',\n description: 'remove all components that are deprecated',\n },\n ];\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n track = false,\n silent = false,\n keepFiles = false,\n }: {\n force?: boolean;\n track?: boolean;\n silent?: boolean;\n keepFiles?: boolean;\n }\n ) {\n if (!silent) {\n await this.removePrompt(!keepFiles);\n }\n const {\n localResult,\n }: {\n localResult: RemovedLocalObjects;\n } = await this.remove.remove({ componentsPattern, force, track, deleteFiles: !keepFiles });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const localMessage = removeTemplate(localResult, false);\n // if (localMessage !== '')\n // localMessage +=\n // '. Note: these components were not deleted from the remote - if you want to delete components run \"bit delete\"\\n';\n return localMessage;\n }\n\n private async removePrompt(deleteFiles?: boolean) {\n this.remove.logger.clearStatusLine();\n const filesDeletionStr = deleteFiles\n ? ' and the files will be deleted from the filesystem (can be avoided by entering --keep-files)'\n : '';\n const ok = await yesno({\n question: `this command will remove the component/s only from your local workspace. if your intent is to delete the component/s also from the remote scope, refer to \"bit delete\".\nthe component(s) will be untracked${filesDeletionStr}.\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;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MAAEO,iBAAiB;MAAEC,KAAK;MAAEC,KAAK;MAAEK,WAAW,EAAE,CAACH;IAAU,CAAC,CAAC;IAC1F;IACA,MAAMI,YAAY,GAAG,IAAAC,gCAAc,EAACH,WAAW,EAAE,KAAK,CAAC;IACvD;IACA;IACA;IACA,OAAOE,YAAY;EACrB;EAEA,MAAcH,YAAYA,CAACE,WAAqB,EAAE;IAChD,IAAI,CAACd,MAAM,CAACiB,MAAM,CAACC,eAAe,CAAC,CAAC;IACpC,MAAMC,gBAAgB,GAAGL,WAAW,GAChC,8FAA8F,GAC9F,EAAE;IACN,MAAMM,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAE;AAChB,oCAAoCH,gBAAgB;AACpD,EAAEI,gBAAK,CAACC,IAAI,CAAC,2CAA2C,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACJ,EAAE,EAAE;MACP,MAAM,KAAIK,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACC,OAAA,CAAA5B,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RemoveCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","cmd","report","componentsPattern","force","track","silent","keepFiles","removePrompt","localResult","deleteFiles","localMessage","removeTemplate","logger","clearStatusLine","filesDeletionStr","ok","yesno","question","chalk","bold","BitError","exports"],"sources":["remove-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { RemovedLocalObjects } from './removed-local-objects';\nimport type { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class RemoveCmd implements Command {\n name = 'remove <component-pattern>';\n description = 'untrack components from the workspace';\n extendedDescription = `removes components from the local workspace only - stops tracking them in .bitmap and deletes their files by default.\ndoes not affect remote scopes - to delete components from remotes, use \"bit delete\" instead.\nuse --keep-files to preserve component files while only removing the tracking.`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'component-development';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = 'rm';\n options = [\n ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'],\n ['', 'keep-files', 'keep component files (just untrack the component)'],\n [\n 'f',\n 'force',\n 'removes the component from the scope, even if used as a dependency. WARNING: you will need to fix the components that depend on this component',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n examples = [\n {\n cmd: 'remove \"$deprecated\"',\n description: 'remove all components that are deprecated',\n },\n ];\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n track = false,\n silent = false,\n keepFiles = false,\n }: {\n force?: boolean;\n track?: boolean;\n silent?: boolean;\n keepFiles?: boolean;\n }\n ) {\n if (!silent) {\n await this.removePrompt(!keepFiles);\n }\n const {\n localResult,\n }: {\n localResult: RemovedLocalObjects;\n } = await this.remove.remove({ componentsPattern, force, track, deleteFiles: !keepFiles });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const localMessage = removeTemplate(localResult, false);\n // if (localMessage !== '')\n // localMessage +=\n // '. Note: these components were not deleted from the remote - if you want to delete components run \"bit delete\"\\n';\n return localMessage;\n }\n\n private async removePrompt(deleteFiles?: boolean) {\n this.remove.logger.clearStatusLine();\n const filesDeletionStr = deleteFiles\n ? ' and the files will be deleted from the filesystem (can be avoided by entering --keep-files)'\n : '';\n const ok = await yesno({\n question: `this command will remove the component/s only from your local workspace. if your intent is to delete the component/s also from the remote scope, refer to \"bit delete\".\nthe component(s) will be untracked${filesDeletionStr}.\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,SAAAC,uBAAAM,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,MAAAC,QAAA,UAAAZ,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AW,EAAE;IACf,CAAC,CACF;IAAAvB,eAAA,mBACU,IAAI;EAKZ;EAEH,MAAM0B,MAAMA,CACV,CAACC,iBAAiB,CAAW,EAC7B;IACEC,KAAK,GAAG,KAAK;IACbC,KAAK,GAAG,KAAK;IACbC,MAAM,GAAG,KAAK;IACdC,SAAS,GAAG;EAMd,CAAC,EACD;IACA,IAAI,CAACD,MAAM,EAAE;MACX,MAAM,IAAI,CAACE,YAAY,CAAC,CAACD,SAAS,CAAC;IACrC;IACA,MAAM;MACJE;IAGF,CAAC,GAAG,MAAM,IAAI,CAACb,MAAM,CAACA,MAAM,CAAC;MAAEO,iBAAiB;MAAEC,KAAK;MAAEC,KAAK;MAAEK,WAAW,EAAE,CAACH;IAAU,CAAC,CAAC;IAC1F;IACA,MAAMI,YAAY,GAAG,IAAAC,gCAAc,EAACH,WAAW,EAAE,KAAK,CAAC;IACvD;IACA;IACA;IACA,OAAOE,YAAY;EACrB;EAEA,MAAcH,YAAYA,CAACE,WAAqB,EAAE;IAChD,IAAI,CAACd,MAAM,CAACiB,MAAM,CAACC,eAAe,CAAC,CAAC;IACpC,MAAMC,gBAAgB,GAAGL,WAAW,GAChC,8FAA8F,GAC9F,EAAE;IACN,MAAMM,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAE;AAChB,oCAAoCH,gBAAgB;AACpD,EAAEI,gBAAK,CAACC,IAAI,CAAC,2CAA2C,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACJ,EAAE,EAAE;MACP,MAAM,KAAIK,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACC,OAAA,CAAA5B,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -11,21 +11,20 @@ function _componentId() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _chalk() {
15
- const data = _interopRequireDefault(require("chalk"));
16
- _chalk = function () {
14
+ function _lodash() {
15
+ const data = require("lodash");
16
+ _lodash = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- function _lodash() {
22
- const data = require("lodash");
23
- _lodash = function () {
21
+ function _cli() {
22
+ const data = require("@teambit/cli");
23
+ _cli = function () {
24
24
  return data;
25
25
  };
26
26
  return data;
27
27
  }
28
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
28
  function removeTemplate({
30
29
  dependentBits,
31
30
  modifiedComponents = [],
@@ -35,47 +34,37 @@ function removeTemplate({
35
34
  }, isRemote) {
36
35
  const paintMissingComponents = () => {
37
36
  if ((0, _lodash().isEmpty)(missingComponents)) return '';
38
- return _chalk().default.red('missing components:') + (0, _chalk().default)(` ${missingComponents.map(id => {
39
- if (!(id instanceof _componentId().ComponentID)) id = _componentId().ComponentID.fromObject(id); // when the id was received from a remote it's not an instance of ComponentID
40
- return id.version === 'latest' ? id.toStringWithoutVersion() : id.toString();
41
- })}\n`);
37
+ const items = missingComponents.map(id => {
38
+ if (!(id instanceof _componentId().ComponentID)) id = _componentId().ComponentID.fromObject(id);
39
+ return (0, _cli().formatItem)(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString(), _cli().errorSymbol);
40
+ });
41
+ return `${_cli().errorSymbol} ${(0, _cli().formatTitle)('missing components')}\n${items.join('\n')}`;
42
42
  };
43
43
  const paintRemoved = () => {
44
44
  if ((0, _lodash().isEmpty)(removedComponentIds) && (0, _lodash().isEmpty)(removedFromLane)) return '';
45
- const compToStr = comps => (0, _chalk().default)(` ${comps.map(id => id.version === 'latest' ? id.toStringWithoutVersion() : id.toString())}\n`);
45
+ const compToItems = comps => comps.map(id => (0, _cli().formatItem)(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString()));
46
46
  const getMsg = (isLane = false) => {
47
47
  const removedFrom = isLane ? 'lane' : 'scope';
48
- const msg = isRemote ? `successfully removed components from the remote ${removedFrom}:` : `successfully removed components from the local ${removedFrom}:`;
49
- return _chalk().default.green(msg);
48
+ return isRemote ? `successfully removed components from the remote ${removedFrom}` : `successfully removed components from the local ${removedFrom}`;
50
49
  };
51
- const newLine = '\n';
52
- const compOutput = (0, _lodash().isEmpty)(removedComponentIds) ? '' : getMsg(false) + compToStr(removedComponentIds) + newLine;
53
- const laneOutput = (0, _lodash().isEmpty)(removedFromLane) ? '' : getMsg(true) + compToStr(removedFromLane);
54
- return `${compOutput}${laneOutput}`;
50
+ const compOutput = (0, _lodash().isEmpty)(removedComponentIds) ? '' : `${(0, _cli().formatSuccessSummary)(getMsg(false))}\n${compToItems(removedComponentIds).join('\n')}`;
51
+ const laneOutput = (0, _lodash().isEmpty)(removedFromLane) ? '' : `${(0, _cli().formatSuccessSummary)(getMsg(true))}\n${compToItems(removedFromLane).join('\n')}`;
52
+ return (0, _cli().joinSections)([compOutput, laneOutput]);
55
53
  };
56
54
  const paintUnRemovedComponents = () => {
57
55
  if ((0, _lodash().isEmpty)(dependentBits)) return '';
58
56
  return Object.keys(dependentBits).map(key => {
59
- const header = _chalk().default.underline.red(`error: unable to delete ${key}, because the following components depend on it:`);
60
- const body = dependentBits[key].join('\n');
57
+ const header = `${_cli().errorSymbol} ${(0, _cli().formatTitle)(`unable to delete ${key}, because the following components depend on it`)}`;
58
+ const body = dependentBits[key].map(dep => (0, _cli().formatItem)(dep, _cli().errorSymbol)).join('\n');
61
59
  return `${header}\n${body}`;
62
60
  }).join('\n\n');
63
61
  };
64
62
  const paintModifiedComponents = () => {
65
63
  if ((0, _lodash().isEmpty)(modifiedComponents)) return '';
66
- const modifiedStr = modifiedComponents.map(id => id.version === 'latest' ? id.toStringWithoutVersion() : id.toString());
67
- return `${_chalk().default.red('error: unable to remove modified components (please use --force to remove modified components)\n') + (0, _chalk().default)(`- ${modifiedStr}`)}`;
64
+ const items = modifiedComponents.map(id => (0, _cli().formatItem)(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString(), _cli().errorSymbol));
65
+ return `${_cli().errorSymbol} ${(0, _cli().formatTitle)('unable to remove modified components (use --force to remove)')}\n${items.join('\n')}`;
68
66
  };
69
- return (
70
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
71
- paintUnRemovedComponents(dependentBits) +
72
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
73
- paintRemoved(removedComponentIds) +
74
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
75
- paintMissingComponents(missingComponents) +
76
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
77
- paintModifiedComponents(modifiedComponents)
78
- );
67
+ return (0, _cli().joinSections)([paintUnRemovedComponents(), paintRemoved(), paintMissingComponents(), paintModifiedComponents()]);
79
68
  }
80
69
 
81
70
  //# sourceMappingURL=remove-template.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_componentId","data","require","_chalk","_interopRequireDefault","_lodash","e","__esModule","default","removeTemplate","dependentBits","modifiedComponents","removedComponentIds","missingComponents","removedFromLane","isRemote","paintMissingComponents","isEmpty","chalk","red","map","id","ComponentID","fromObject","version","toStringWithoutVersion","toString","paintRemoved","compToStr","comps","getMsg","isLane","removedFrom","msg","green","newLine","compOutput","laneOutput","paintUnRemovedComponents","Object","keys","key","header","underline","body","join","paintModifiedComponents","modifiedStr"],"sources":["remove-template.ts"],"sourcesContent":["import type { ComponentIdList } from '@teambit/component-id';\nimport { ComponentID } from '@teambit/component-id';\nimport chalk from 'chalk';\nimport { isEmpty } from 'lodash';\n\nexport function removeTemplate(\n { dependentBits, modifiedComponents = [], removedComponentIds, missingComponents, removedFromLane },\n isRemote\n) {\n const paintMissingComponents = () => {\n if (isEmpty(missingComponents)) return '';\n return (\n chalk.red('missing components:') +\n chalk(\n ` ${missingComponents.map((id) => {\n if (!(id instanceof ComponentID)) id = ComponentID.fromObject(id); // when the id was received from a remote it's not an instance of ComponentID\n return id.version === 'latest' ? id.toStringWithoutVersion() : id.toString();\n })}\\n`\n )\n );\n };\n const paintRemoved = () => {\n if (isEmpty(removedComponentIds) && isEmpty(removedFromLane)) return '';\n const compToStr = (comps: ComponentIdList) =>\n chalk(` ${comps.map((id) => (id.version === 'latest' ? id.toStringWithoutVersion() : id.toString()))}\\n`);\n const getMsg = (isLane = false) => {\n const removedFrom = isLane ? 'lane' : 'scope';\n const msg = isRemote\n ? `successfully removed components from the remote ${removedFrom}:`\n : `successfully removed components from the local ${removedFrom}:`;\n return chalk.green(msg);\n };\n const newLine = '\\n';\n const compOutput = isEmpty(removedComponentIds) ? '' : getMsg(false) + compToStr(removedComponentIds) + newLine;\n const laneOutput = isEmpty(removedFromLane) ? '' : getMsg(true) + compToStr(removedFromLane);\n\n return `${compOutput}${laneOutput}`;\n };\n\n const paintUnRemovedComponents = () => {\n if (isEmpty(dependentBits)) return '';\n return Object.keys(dependentBits)\n .map((key) => {\n const header = chalk.underline.red(\n `error: unable to delete ${key}, because the following components depend on it:`\n );\n const body = dependentBits[key].join('\\n');\n return `${header}\\n${body}`;\n })\n .join('\\n\\n');\n };\n\n const paintModifiedComponents = () => {\n if (isEmpty(modifiedComponents)) return '';\n const modifiedStr = modifiedComponents.map((id: ComponentID) =>\n id.version === 'latest' ? id.toStringWithoutVersion() : id.toString()\n );\n return `${\n chalk.red('error: unable to remove modified components (please use --force to remove modified components)\\n') +\n chalk(`- ${modifiedStr}`)\n }`;\n };\n\n return (\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n paintUnRemovedComponents(dependentBits) +\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n paintRemoved(removedComponentIds) +\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n paintMissingComponents(missingComponents) +\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n paintModifiedComponents(modifiedComponents)\n );\n}\n"],"mappings":";;;;;;AACA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IA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E,IAAI,EAAE;IAC7B,CAAC,CAAC,CACDC,IAAI,CAAC,MAAM,CAAC;EACjB,CAAC;EAED,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;IACpC,IAAI,IAAA7B,iBAAO,EAACN,kBAAkB,CAAC,EAAE,OAAO,EAAE;IAC1C,MAAMoC,WAAW,GAAGpC,kBAAkB,CAACS,GAAG,CAAEC,EAAe,IACzDA,EAAE,CAACG,OAAO,KAAK,QAAQ,GAAGH,EAAE,CAACI,sBAAsB,CAAC,CAAC,GAAGJ,EAAE,CAACK,QAAQ,CAAC,CACtE,CAAC;IACD,OAAO,GACLR,gBAAK,CAACC,GAAG,CAAC,kGAAkG,CAAC,GAC7G,IAAAD,gBAAK,EAAC,KAAK6B,WAAW,EAAE,CAAC,EACzB;EACJ,CAAC;EAED;IACE;IACAT,wBAAwB,CAAC5B,aAAa,CAAC;IACvC;IACAiB,YAAY,CAACf,mBAAmB,CAAC;IACjC;IACAI,sBAAsB,CAACH,iBAAiB,CAAC;IACzC;IACAiC,uBAAuB,CAACnC,kBAAkB;EAAC;AAE/C","ignoreList":[]}
1
+ {"version":3,"names":["_componentId","data","require","_lodash","_cli","removeTemplate","dependentBits","modifiedComponents","removedComponentIds","missingComponents","removedFromLane","isRemote","paintMissingComponents","isEmpty","items","map","id","ComponentID","fromObject","formatItem","version","toStringWithoutVersion","toString","errorSymbol","formatTitle","join","paintRemoved","compToItems","comps","getMsg","isLane","removedFrom","compOutput","formatSuccessSummary","laneOutput","joinSections","paintUnRemovedComponents","Object","keys","key","header","body","dep","paintModifiedComponents"],"sources":["remove-template.ts"],"sourcesContent":["import type { ComponentIdList } from '@teambit/component-id';\nimport { ComponentID } from '@teambit/component-id';\nimport { isEmpty } from 'lodash';\nimport { formatTitle, formatItem, formatSuccessSummary, errorSymbol, joinSections } from '@teambit/cli';\n\nexport function removeTemplate(\n { dependentBits, modifiedComponents = [], removedComponentIds, missingComponents, removedFromLane },\n isRemote\n) {\n const paintMissingComponents = () => {\n if (isEmpty(missingComponents)) return '';\n const items = missingComponents.map((id) => {\n if (!(id instanceof ComponentID)) id = ComponentID.fromObject(id);\n return formatItem(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString(), errorSymbol);\n });\n return `${errorSymbol} ${formatTitle('missing components')}\\n${items.join('\\n')}`;\n };\n const paintRemoved = () => {\n if (isEmpty(removedComponentIds) && isEmpty(removedFromLane)) return '';\n const compToItems = (comps: ComponentIdList) =>\n comps.map((id) => formatItem(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString()));\n const getMsg = (isLane = false) => {\n const removedFrom = isLane ? 'lane' : 'scope';\n return isRemote\n ? `successfully removed components from the remote ${removedFrom}`\n : `successfully removed components from the local ${removedFrom}`;\n };\n const compOutput = isEmpty(removedComponentIds)\n ? ''\n : `${formatSuccessSummary(getMsg(false))}\\n${compToItems(removedComponentIds).join('\\n')}`;\n const laneOutput = isEmpty(removedFromLane)\n ? ''\n : `${formatSuccessSummary(getMsg(true))}\\n${compToItems(removedFromLane).join('\\n')}`;\n\n return joinSections([compOutput, laneOutput]);\n };\n\n const paintUnRemovedComponents = () => {\n if (isEmpty(dependentBits)) return '';\n return Object.keys(dependentBits)\n .map((key) => {\n const header = `${errorSymbol} ${formatTitle(`unable to delete ${key}, because the following components depend on it`)}`;\n const body = dependentBits[key].map((dep) => formatItem(dep, errorSymbol)).join('\\n');\n return `${header}\\n${body}`;\n })\n .join('\\n\\n');\n };\n\n const paintModifiedComponents = () => {\n if (isEmpty(modifiedComponents)) return '';\n const items = modifiedComponents.map((id: ComponentID) =>\n formatItem(id.version === 'latest' ? id.toStringWithoutVersion() : id.toString(), errorSymbol)\n );\n return `${errorSymbol} ${formatTitle('unable to remove modified components (use --force to remove)')}\\n${items.join('\\n')}`;\n };\n\n return joinSections([\n paintUnRemovedComponents(),\n paintRemoved(),\n paintMissingComponents(),\n paintModifiedComponents(),\n ]);\n}\n"],"mappings":";;;;;;AACA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GA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GAAG,CAAC,CAACxB,GAAG,CAAE2B,GAAG,IAAK,IAAAvB,iBAAU,EAACuB,GAAG,EAAEnB,kBAAW,CAAC,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;MACrF,OAAO,GAAGe,MAAM,KAAKC,IAAI,EAAE;IAC7B,CAAC,CAAC,CACDhB,IAAI,CAAC,MAAM,CAAC;EACjB,CAAC;EAED,MAAMkB,uBAAuB,GAAGA,CAAA,KAAM;IACpC,IAAI,IAAA9B,iBAAO,EAACN,kBAAkB,CAAC,EAAE,OAAO,EAAE;IAC1C,MAAMO,KAAK,GAAGP,kBAAkB,CAACQ,GAAG,CAAEC,EAAe,IACnD,IAAAG,iBAAU,EAACH,EAAE,CAACI,OAAO,KAAK,QAAQ,GAAGJ,EAAE,CAACK,sBAAsB,CAAC,CAAC,GAAGL,EAAE,CAACM,QAAQ,CAAC,CAAC,EAAEC,kBAAW,CAC/F,CAAC;IACD,OAAO,GAAGA,kBAAW,IAAI,IAAAC,kBAAW,EAAC,8DAA8D,CAAC,KAAKV,KAAK,CAACW,IAAI,CAAC,IAAI,CAAC,EAAE;EAC7H,CAAC;EAED,OAAO,IAAAU,mBAAY,EAAC,CAClBC,wBAAwB,CAAC,CAAC,EAC1BV,YAAY,CAAC,CAAC,EACdd,sBAAsB,CAAC,CAAC,EACxB+B,uBAAuB,CAAC,CAAC,CAC1B,CAAC;AACJ","ignoreList":[]}
@@ -55,18 +55,20 @@ export declare class RemoveMain {
55
55
  private markRemoveComps;
56
56
  deleteComps(componentsPattern: string, opts?: DeleteOpts): Promise<Component[]>;
57
57
  /**
58
- * recover a soft-removed component.
59
- * there are 4 different scenarios.
60
- * 1. a component was just soft-removed, it wasn't snapped yet. so it's now in .bitmap with the "removed" aspect entry.
61
- * 1.a. the component still exists in the local scope. no need to import. write it from there.
62
- * 1.b. the component doesn't exist in the local scope. import it.
63
- * 2. soft-removed and then snapped. It's not in .bitmap now.
64
- * 3. soft-removed, snapped, exported. it's not in .bitmap now.
65
- * 4. a soft-removed components was imported, so it's now in .bitmap without the "removed" aspect entry.
66
- * 5. workspace is empty. the soft-removed component is on the remote.
67
- * returns `true` if it was recovered. `false` if the component wasn't soft-removed, so nothing to recover from.
58
+ * recover soft-removed component(s) matching a pattern.
59
+ * supports component patterns (e.g., "comp1", "org.scope/*", etc.)
60
+ * returns array of recovered component IDs
68
61
  */
69
- recover(compIdStr: string, options: RecoverOptions): Promise<boolean>;
62
+ recover(pattern: string, options: RecoverOptions): Promise<ComponentID[]>;
63
+ /**
64
+ * Classify a component to determine how it should be recovered.
65
+ * This implements the 5 different recovery scenarios.
66
+ */
67
+ private classifyComponentForRecovery;
68
+ /**
69
+ * get all components matching the pattern that are soft-removed and can be recovered
70
+ */
71
+ private getComponentsToRecover;
70
72
  private throwForMainComponentWhenOnLane;
71
73
  getRemoveInfo(component: Component): Promise<RemoveInfo>;
72
74
  private getHeadComponent;
@@ -301,74 +301,125 @@ to delete them eventually from main, use "--update-main" flag and make sure to r
301
301
  }
302
302
 
303
303
  /**
304
- * recover a soft-removed component.
305
- * there are 4 different scenarios.
306
- * 1. a component was just soft-removed, it wasn't snapped yet. so it's now in .bitmap with the "removed" aspect entry.
307
- * 1.a. the component still exists in the local scope. no need to import. write it from there.
308
- * 1.b. the component doesn't exist in the local scope. import it.
309
- * 2. soft-removed and then snapped. It's not in .bitmap now.
310
- * 3. soft-removed, snapped, exported. it's not in .bitmap now.
311
- * 4. a soft-removed components was imported, so it's now in .bitmap without the "removed" aspect entry.
312
- * 5. workspace is empty. the soft-removed component is on the remote.
313
- * returns `true` if it was recovered. `false` if the component wasn't soft-removed, so nothing to recover from.
304
+ * recover soft-removed component(s) matching a pattern.
305
+ * supports component patterns (e.g., "comp1", "org.scope/*", etc.)
306
+ * returns array of recovered component IDs
314
307
  */
315
- async recover(compIdStr, options) {
308
+ async recover(pattern, options) {
316
309
  if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
317
- const bitMapEntry = this.workspace.consumer.bitMap.components.find(compMap => {
318
- return compMap.id.fullName === compIdStr || compMap.id.toStringWithoutVersion() === compIdStr;
319
- });
320
- const importComp = async idStr => {
310
+ const componentsToRecover = await this.getComponentsToRecover(pattern);
311
+ if (componentsToRecover.length === 0) {
312
+ return [];
313
+ }
314
+
315
+ // Classify components by recovery scenario
316
+ const componentsToProcess = await Promise.all(componentsToRecover.map(compId => this.classifyComponentForRecovery(compId)));
317
+
318
+ // Collect all components that need importing
319
+ const idsToImport = componentsToProcess.filter(item => item.action === 'import' || item.action === 'deleteConfigAndImport').map(item => item.idToImport);
320
+
321
+ // Import all at once for better performance
322
+ if (idsToImport.length > 0) {
321
323
  await this.importer.import({
322
- ids: [idStr],
324
+ ids: idsToImport,
323
325
  installNpmPackages: !options.skipDependencyInstallation,
324
326
  writeConfigFiles: !options.skipWriteConfigFiles,
325
327
  override: true
326
328
  });
327
- };
328
- const setAsRemovedFalse = async compId => {
329
- await this.workspace.addSpecificComponentConfig(compId, _remove().RemoveAspect.id, {
330
- removed: false
331
- });
332
- await this.workspace.bitMap.write('recover');
333
- };
334
- if (bitMapEntry) {
335
- if (bitMapEntry.config?.[_remove().RemoveAspect.id]) {
336
- // case #1
337
- const compFromScope = await this.workspace.scope.get(bitMapEntry.id);
329
+ }
330
+
331
+ // Process each component according to its classification
332
+ for (const item of componentsToProcess) {
333
+ if (!item.shouldRecover) continue;
334
+ if (item.action === 'writeFromScope') {
335
+ // Case #1a: write from local scope and remove the "removed" config
336
+ const compFromScope = await this.workspace.scope.get(item.bitMapEntry.id);
338
337
  if (compFromScope) {
339
- // in the case the component is in the scope, we prefer to write it from the scope rather than import it.
340
- // because in some cases the "import" throws an error, e.g. when the component is diverged.
341
- await this.workspace.write(compFromScope, bitMapEntry.rootDir);
342
- this.workspace.bitMap.removeComponentConfig(bitMapEntry.id, _remove().RemoveAspect.id, false);
343
- await this.workspace.bitMap.write('recover');
344
- } else {
345
- delete bitMapEntry.config?.[_remove().RemoveAspect.id];
346
- await importComp(bitMapEntry.id.toString());
338
+ await this.workspace.write(compFromScope, item.bitMapEntry.rootDir);
339
+ this.workspace.bitMap.removeComponentConfig(item.bitMapEntry.id, _remove().RemoveAspect.id, false);
347
340
  }
348
- return true;
341
+ } else if (item.action === 'deleteConfigAndImport') {
342
+ // Case #1b: delete config entry before import
343
+ delete item.bitMapEntry.config?.[_remove().RemoveAspect.id];
344
+ } else {
345
+ // Cases #2, #3, #4, #5: set removed: false
346
+ await this.workspace.addSpecificComponentConfig(item.compId, _remove().RemoveAspect.id, {
347
+ removed: false
348
+ });
349
+ }
350
+ }
351
+
352
+ // Write bitmap once at the end
353
+ await this.workspace.bitMap.write('recover');
354
+ return componentsToRecover.filter((_, idx) => componentsToProcess[idx].shouldRecover);
355
+ }
356
+
357
+ /**
358
+ * Classify a component to determine how it should be recovered.
359
+ * This implements the 5 different recovery scenarios.
360
+ */
361
+ async classifyComponentForRecovery(compId) {
362
+ if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
363
+ const bitMapEntry = this.workspace.bitMap.getBitmapEntryIfExist(compId, {
364
+ ignoreVersion: true
365
+ });
366
+
367
+ // Case #1: Component in .bitmap with "removed" aspect entry
368
+ if (bitMapEntry?.config?.[_remove().RemoveAspect.id]) {
369
+ const compFromScope = await this.workspace.scope.get(bitMapEntry.id);
370
+ if (compFromScope) {
371
+ // Case #1a: exists in local scope - write from there
372
+ return {
373
+ compId: bitMapEntry.id,
374
+ shouldRecover: true,
375
+ action: 'writeFromScope',
376
+ bitMapEntry
377
+ };
349
378
  }
350
- // case #4
351
- const compId = bitMapEntry.id;
379
+ // Case #1b: not in local scope - import it
380
+ return {
381
+ compId: bitMapEntry.id,
382
+ shouldRecover: true,
383
+ action: 'deleteConfigAndImport',
384
+ bitMapEntry,
385
+ idToImport: bitMapEntry.id.toString()
386
+ };
387
+ }
388
+
389
+ // Case #4: Component in .bitmap without "removed" aspect entry
390
+ if (bitMapEntry) {
352
391
  const comp = await this.workspace.get(compId);
353
392
  const removeInfo = await this.getRemoveInfo(comp);
354
393
  if (!removeInfo.removed && !removeInfo.range && !removeInfo.snaps) {
355
- return false;
394
+ return {
395
+ compId,
396
+ shouldRecover: false,
397
+ action: 'none'
398
+ };
356
399
  }
357
- await setAsRemovedFalse(compId);
358
- return true;
400
+ return {
401
+ compId,
402
+ shouldRecover: true,
403
+ action: 'updateConfig'
404
+ };
359
405
  }
360
- const compId = await this.workspace.scope.resolveComponentId(compIdStr);
406
+
407
+ // Cases #2, #3, #5: Component not in .bitmap
361
408
  const currentLane = await this.workspace.getCurrentLaneObject();
362
409
  const idOnLane = currentLane?.getComponent(compId);
363
410
  const compIdWithPossibleVer = idOnLane ? compId.changeVersion(idOnLane.head.toString()) : compId;
364
411
  const compFromScope = await this.workspace.scope.get(compIdWithPossibleVer);
365
412
  if (compFromScope && (await this.isDeleted(compFromScope))) {
366
- // case #2 and #3
367
- await importComp(compIdWithPossibleVer._legacy.toString());
368
- await setAsRemovedFalse(compIdWithPossibleVer);
369
- return true;
413
+ // Cases #2 and #3: soft-removed and snapped/exported
414
+ return {
415
+ compId: compIdWithPossibleVer,
416
+ shouldRecover: true,
417
+ action: 'import',
418
+ idToImport: compIdWithPossibleVer._legacy.toString()
419
+ };
370
420
  }
371
- // case #5
421
+
422
+ // Case #5: workspace is empty, component on remote
372
423
  let comp;
373
424
  try {
374
425
  comp = await this.workspace.scope.getRemoteComponent(compId);
@@ -379,11 +430,54 @@ to delete them eventually from main, use "--update-main" flag and make sure to r
379
430
  throw err;
380
431
  }
381
432
  if (!(await this.isDeleted(comp))) {
382
- return false;
433
+ return {
434
+ compId,
435
+ shouldRecover: false,
436
+ action: 'none'
437
+ };
438
+ }
439
+ return {
440
+ compId,
441
+ shouldRecover: true,
442
+ action: 'import',
443
+ idToImport: compId._legacy.toString()
444
+ };
445
+ }
446
+
447
+ /**
448
+ * get all components matching the pattern that are soft-removed and can be recovered
449
+ */
450
+ async getComponentsToRecover(pattern) {
451
+ if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
452
+
453
+ // Check if pattern contains wildcards
454
+ if ((0, _legacy2().hasWildcard)(pattern)) {
455
+ // Get all soft-removed components from different sources
456
+ const locallySoftRemoved = this.workspace.consumer.bitMap.getRemoved();
457
+ const componentsList = this.workspace.componentList;
458
+ const remotelySoftRemoved = await componentsList.listRemotelySoftRemoved();
459
+ const remotelySoftRemovedIds = remotelySoftRemoved.map(c => c.componentId);
460
+
461
+ // Also check components on the current lane that might be soft-removed
462
+ const removedStaged = await this.getRemovedStaged();
463
+
464
+ // Combine all soft-removed components
465
+ const allSoftRemoved = [...locallySoftRemoved, ...remotelySoftRemovedIds, ...removedStaged];
466
+
467
+ // Use the same pattern matching logic as filterIdsFromPoolIdsByPattern
468
+ const matches = await this.workspace.scope.filterIdsFromPoolIdsByPattern(pattern, allSoftRemoved, false);
469
+ return _componentId().ComponentIdList.uniqFromArray(matches);
470
+ }
471
+
472
+ // Single component - try to resolve it
473
+ const bitMapEntry = this.workspace.consumer.bitMap.components.find(compMap => {
474
+ return compMap.id.fullName === pattern || compMap.id.toStringWithoutVersion() === pattern;
475
+ });
476
+ if (bitMapEntry) {
477
+ return [bitMapEntry.id];
383
478
  }
384
- await importComp(compId._legacy.toString());
385
- await setAsRemovedFalse(compId);
386
- return true;
479
+ const compId = await this.workspace.scope.resolveComponentId(pattern);
480
+ return [compId];
387
481
  }
388
482
  async throwForMainComponentWhenOnLane(components) {
389
483
  const currentLane = await this.workspace.getCurrentLaneObject();
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_semver","_interopRequireDefault","_logger","_workspace","_componentId","_legacy","_importer","_lodash","_legacy2","_bitError","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_legacy3","_component","_deleteComponentFiles","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","_scope","_lister","_chalk","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","BEFORE_REMOVE","RemoveMain","constructor","workspace","scope","logger","importer","depResolver","lister","remove","componentsPattern","force","remote","track","deleteFiles","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","ComponentIdList","fromArray","onDestroy","removeLocallyByIds","reasonForRemoval","OutsideWorkspaceError","results","bitMap","write","markRemoveComps","componentIds","updateMain","range","snaps","allComponentsToMarkDeleted","getMany","componentsToDeleteFromFs","componentsIdsToDeleteFromFs","map","c","id","removeComponentsFromNodeModules","state","_consumer","config","removed","removeOnMain","compId","addComponentConfig","RemoveAspect","deleteComponentsFiles","deleteComps","opts","ConsumerNotFound","idsByPattern","newComps","hasVersion","BitError","toString","join","currentLane","getCurrentLaneObject","isNew","Error","laneComp","toComponentIds","compIdsNotOnLane","hasWithoutVersion","chalk","bold","recover","compIdStr","options","bitMapEntry","components","find","compMap","fullName","toStringWithoutVersion","importComp","idStr","import","installNpmPackages","skipDependencyInstallation","writeConfigFiles","skipWriteConfigFiles","override","setAsRemovedFalse","addSpecificComponentConfig","compFromScope","get","rootDir","removeComponentConfig","comp","removeInfo","getRemoveInfo","resolveComponentId","idOnLane","getComponent","compIdWithPossibleVer","changeVersion","head","isDeleted","getRemoteComponent","err","NoHeadNoVersion","throwForMainComponentWhenOnLane","laneComps","toBitIds","mainComps","component","headComponent","getHeadComponent","extensions","findExtension","isDeletedByRange","currentTag","getTag","Boolean","semver","satisfies","version","isDeletedBySnaps","includes","hash","headTag","headComp","undefined","isRemoved","isRemovedByIdWithoutLoadingComponent","componentId","bitmapEntry","getBitmapEntryIfExist","isRecovered","modelComp","getBitObjectModelComponent","legacyScope","objects","isEnvByIdWithoutLoadingComponent","versionObj","getBitObjectVersionById","envData","findCoreExtension","type","getRemovedStaged","isOnMain","getRemovedStagedFromMain","getRemovedStagedFromLane","addRemovedDependenciesIssues","workspacePolicyManifest","getWorkspacePolicyManifest","workspaceDependencies","dependencies","peerDependencies","installedDeps","pMapSeries","addRemovedDepIssue","getComponentDependencies","removedDependencies","removedEnv","Promise","all","dep","packageName","getPackageName","isAvailableAsInstalledPackage","isEnv","issues","getOrCreate","IssuesClasses","RemovedDependencies","RemovedEnv","stagedConfig","getStagedConfig","getAll","compConfig","laneIds","workspaceIds","listIds","laneCompIdsNotInWorkspace","wId","isEqualWithoutVersion","comps","staged","snapDistance","getSnapDistance","warn","name","isSourceAhead","compact","hasWildcard","getRemoteCompIdsByWildcards","ComponentID","fromString","provider","cli","loggerMain","componentAspect","importerMain","createLogger","removeMain","registerAddComponentsIssues","bind","registerShowFragments","RemoveFragment","register","RemoveCmd","DeleteCmd","RecoverCmd","exports","WorkspaceAspect","ScopeAspect","CLIAspect","LoggerAspect","ComponentAspect","ImporterAspect","DependencyResolverAspect","IssuesAspect","ListerAspect","MainRuntime","addRuntime","_default"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\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 { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy.consumer';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport { compact } from 'lodash';\nimport { hasWildcard } from '@teambit/legacy.utils';\nimport { BitError } from '@teambit/bit-error';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport type { IssuesMain } from '@teambit/issues';\nimport { IssuesAspect } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { NoHeadNoVersion } from '@teambit/legacy.scope';\nimport type { Component, ComponentMain } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { deleteComponentsFiles } from './delete-component-files';\nimport { RemoveCmd } from './remove-cmd';\nimport type { RemoveComponentsResult } from './remove-components';\nimport { removeComponents, removeComponentsFromNodeModules } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport type { RecoverOptions } from './recover-cmd';\nimport { RecoverCmd } from './recover-cmd';\nimport { DeleteCmd } from './delete-cmd';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ListerMain } from '@teambit/lister';\nimport { ListerAspect } from '@teambit/lister';\nimport chalk from 'chalk';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n /**\n * whether to remove the component from default lane once merged\n */\n removeOnMain?: boolean;\n /**\n * Semver range to mark specific versions as deleted\n */\n range?: string;\n /**\n * Array of snap hashes to mark as deleted\n */\n snaps?: string[];\n};\n\nexport type DeleteOpts = { updateMain?: boolean; range?: string; snaps?: string[] };\n\nexport class RemoveMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n public logger: Logger,\n private importer: ImporterMain,\n private depResolver: DependencyResolverMain,\n private lister: ListerMain\n ) {}\n\n async remove({\n componentsPattern,\n force = false,\n remote = false,\n track = false,\n deleteFiles = true,\n }: {\n componentsPattern: string;\n force?: boolean;\n remote?: boolean;\n track?: boolean;\n deleteFiles?: boolean;\n }): Promise<RemoveComponentsResult> {\n this.logger.setStatusLine(BEFORE_REMOVE);\n const bitIds = remote\n ? await this.getRemoteBitIdsToRemove(componentsPattern)\n : await this.getLocalBitIdsToRemove(componentsPattern);\n this.logger.setStatusLine(BEFORE_REMOVE); // again because the loader might changed when talking to the remote\n const consumer = this.workspace?.consumer;\n const removeResults = await removeComponents({\n workspace: this.workspace,\n ids: ComponentIdList.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n });\n if (consumer) await consumer.onDestroy('remove');\n return removeResults;\n }\n\n /**\n * remove components from the workspace.\n */\n async removeLocallyByIds(\n ids: ComponentID[],\n { force = false, reasonForRemoval }: { force?: boolean; reasonForRemoval?: string } = {}\n ) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n workspace: this.workspace,\n ids: ComponentIdList.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n });\n await this.workspace.bitMap.write(`remove (by ${reasonForRemoval || 'N/A'})`);\n\n return results;\n }\n\n private async markRemoveComps(\n componentIds: ComponentID[],\n { updateMain, range, snaps }: DeleteOpts\n ): Promise<Component[]> {\n const allComponentsToMarkDeleted = await this.workspace.getMany(componentIds);\n\n const componentsToDeleteFromFs = range || snaps ? [] : allComponentsToMarkDeleted;\n const componentsIdsToDeleteFromFs = ComponentIdList.fromArray(componentsToDeleteFromFs.map((c) => c.id));\n await removeComponentsFromNodeModules(\n this.workspace.consumer,\n componentsToDeleteFromFs.map((c) => c.state._consumer)\n );\n // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted\n // during this removal along with the entire component dir.\n // in case this is range, the \"removed\" property is set to false. even when the range overlap the current version.\n // the reason is that if we set it to true, then, the component is considered as \"deleted\" for *all* versions.\n // remember that this config is always passed to the next version and if we set removed: true, it'll be copied\n // to the next version even when that version is not in the range.\n const config: RemoveInfo = { removed: !(range || snaps) };\n if (updateMain) config.removeOnMain = true;\n if (range) config.range = range;\n if (snaps && snaps.length) config.snaps = snaps;\n componentIds.forEach((compId) => this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, config));\n await this.workspace.bitMap.write('delete');\n await deleteComponentsFiles(this.workspace.consumer, componentsIdsToDeleteFromFs);\n\n return componentsToDeleteFromFs;\n }\n\n async deleteComps(componentsPattern: string, opts: DeleteOpts = {}): Promise<Component[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const newComps = componentIds.filter((id) => !id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `no need to delete the following new component(s), please remove them by \"bit remove\"\\n${newComps\n .map((id) => id.toString())\n .join('\\n')}`\n );\n }\n const currentLane = await this.workspace.getCurrentLaneObject();\n const { updateMain } = opts;\n if (!updateMain && currentLane?.isNew) {\n throw new Error(\n 'no need to delete components from an un-exported lane, you can remove them by running \"bit remove\"'\n );\n }\n if (currentLane && !updateMain && opts.range) {\n throw new BitError(`--range is not needed when deleting components from a lane, unless --update-main is used`);\n }\n if (currentLane && !updateMain) {\n const laneComp = currentLane.toComponentIds();\n const compIdsNotOnLane = componentIds.filter((id) => !laneComp.hasWithoutVersion(id));\n if (compIdsNotOnLane.length) {\n throw new BitError(\n `unable to delete the following component(s) because they are not part of the current lane.\n${chalk.bold(compIdsNotOnLane.map((id) => id.toString()).join('\\n'))}\nto simply remove them from the workspace, use \"bit remove\".\nto delete them eventually from main, use \"--update-main\" flag and make sure to remove all occurrences from the code.`\n );\n }\n }\n return this.markRemoveComps(componentIds, opts);\n }\n\n /**\n * recover a soft-removed component.\n * there are 4 different scenarios.\n * 1. a component was just soft-removed, it wasn't snapped yet. so it's now in .bitmap with the \"removed\" aspect entry.\n * 1.a. the component still exists in the local scope. no need to import. write it from there.\n * 1.b. the component doesn't exist in the local scope. import it.\n * 2. soft-removed and then snapped. It's not in .bitmap now.\n * 3. soft-removed, snapped, exported. it's not in .bitmap now.\n * 4. a soft-removed components was imported, so it's now in .bitmap without the \"removed\" aspect entry.\n * 5. workspace is empty. the soft-removed component is on the remote.\n * returns `true` if it was recovered. `false` if the component wasn't soft-removed, so nothing to recover from.\n */\n async recover(compIdStr: string, options: RecoverOptions): Promise<boolean> {\n if (!this.workspace) throw new ConsumerNotFound();\n const bitMapEntry = this.workspace.consumer.bitMap.components.find((compMap) => {\n return compMap.id.fullName === compIdStr || compMap.id.toStringWithoutVersion() === compIdStr;\n });\n const importComp = async (idStr: string) => {\n await this.importer.import({\n ids: [idStr],\n installNpmPackages: !options.skipDependencyInstallation,\n writeConfigFiles: !options.skipWriteConfigFiles,\n override: true,\n });\n };\n const setAsRemovedFalse = async (compId: ComponentID) => {\n await this.workspace.addSpecificComponentConfig(compId, RemoveAspect.id, { removed: false });\n await this.workspace.bitMap.write('recover');\n };\n if (bitMapEntry) {\n if (bitMapEntry.config?.[RemoveAspect.id]) {\n // case #1\n const compFromScope = await this.workspace.scope.get(bitMapEntry.id);\n if (compFromScope) {\n // in the case the component is in the scope, we prefer to write it from the scope rather than import it.\n // because in some cases the \"import\" throws an error, e.g. when the component is diverged.\n await this.workspace.write(compFromScope, bitMapEntry.rootDir);\n this.workspace.bitMap.removeComponentConfig(bitMapEntry.id, RemoveAspect.id, false);\n await this.workspace.bitMap.write('recover');\n } else {\n delete bitMapEntry.config?.[RemoveAspect.id];\n await importComp(bitMapEntry.id.toString());\n }\n return true;\n }\n // case #4\n const compId = bitMapEntry.id;\n const comp = await this.workspace.get(compId);\n const removeInfo = await this.getRemoveInfo(comp);\n if (!removeInfo.removed && !removeInfo.range && !removeInfo.snaps) {\n return false;\n }\n await setAsRemovedFalse(compId);\n return true;\n }\n const compId = await this.workspace.scope.resolveComponentId(compIdStr);\n const currentLane = await this.workspace.getCurrentLaneObject();\n const idOnLane = currentLane?.getComponent(compId);\n const compIdWithPossibleVer = idOnLane ? compId.changeVersion(idOnLane.head.toString()) : compId;\n const compFromScope = await this.workspace.scope.get(compIdWithPossibleVer);\n if (compFromScope && (await this.isDeleted(compFromScope))) {\n // case #2 and #3\n await importComp(compIdWithPossibleVer._legacy.toString());\n await setAsRemovedFalse(compIdWithPossibleVer);\n return true;\n }\n // case #5\n let comp: Component | undefined;\n try {\n comp = await this.workspace.scope.getRemoteComponent(compId);\n } catch (err: any) {\n if (err instanceof NoHeadNoVersion) {\n throw new BitError(\n `unable to find the component ${compIdWithPossibleVer.toString()} in the current lane or main`\n );\n }\n throw err;\n }\n if (!(await this.isDeleted(comp))) {\n return false;\n }\n await importComp(compId._legacy.toString());\n await setAsRemovedFalse(compId);\n\n return true;\n }\n\n private async throwForMainComponentWhenOnLane(components: Component[]) {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return; // user on main\n const laneComps = currentLane.toBitIds();\n const mainComps = components.filter((comp) => !laneComps.hasWithoutVersion(comp.id));\n if (mainComps.length) {\n throw new BitError(`the following components belong to main, they cannot be soft-removed when on a lane. consider removing them without --soft.\n${mainComps.map((c) => c.id.toString()).join('\\n')}`);\n }\n }\n\n async getRemoveInfo(component: Component): Promise<RemoveInfo> {\n const headComponent = await this.getHeadComponent(component);\n const data = headComponent.config.extensions.findExtension(RemoveAspect.id)?.config as RemoveInfo | undefined;\n\n const isDeletedByRange = () => {\n if (!data?.range) return false;\n const currentTag = component.getTag();\n return Boolean(currentTag && semver.satisfies(currentTag.version, data.range));\n };\n const isDeletedBySnaps = () => {\n if (!data?.snaps || !component.id.version) return false;\n return data.snaps.includes(component.id.version);\n };\n\n return {\n removed: data?.removed || isDeletedByRange() || isDeletedBySnaps() || false,\n range: data?.range,\n snaps: data?.snaps,\n };\n }\n\n private async getHeadComponent(component: Component): Promise<Component> {\n if (\n component.id.version &&\n component.head &&\n component.id.version !== component.head?.hash &&\n component.id.version !== component.headTag?.version.version\n ) {\n const headComp = this.workspace // if workspace exits, prefer using the workspace as it may be modified\n ? await this.workspace.get(component.id.changeVersion(undefined))\n : await this.scope.get(component.id.changeVersion(component.head.hash));\n if (!headComp) throw new Error(`unable to get the head of ${component.id.toString()}`);\n return headComp;\n }\n return component;\n }\n\n /**\n * @deprecated use `isDeleted` instead.\n */\n async isRemoved(component: Component): Promise<boolean> {\n return this.isDeleted(component);\n }\n\n /**\n * whether a component is marked as deleted.\n */\n async isDeleted(component: Component): Promise<boolean> {\n const removeInfo = await this.getRemoveInfo(component);\n return removeInfo.removed;\n }\n\n /**\n * performant version of isRemoved() in case the component object is not available and loading it is expensive.\n */\n async isRemovedByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {\n if (!componentId.hasVersion()) return false;\n const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(componentId);\n if (bitmapEntry && bitmapEntry.isRemoved()) return true;\n if (bitmapEntry && bitmapEntry.isRecovered()) return false;\n const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId.changeVersion(undefined));\n if (!modelComp) return false;\n const isRemoved = await modelComp.isRemoved(\n this.workspace.scope.legacyScope.objects,\n componentId.version as string\n );\n return Boolean(isRemoved);\n }\n\n async isEnvByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {\n const versionObj = await this.workspace.scope.getBitObjectVersionById(componentId);\n const envData = versionObj?.extensions.findCoreExtension('teambit.envs/envs');\n return envData?.data.type === 'env';\n }\n\n /**\n * get components that were soft-removed and tagged/snapped/merged but not exported yet.\n */\n async getRemovedStaged(): Promise<ComponentID[]> {\n return this.workspace.isOnMain() ? this.getRemovedStagedFromMain() : this.getRemovedStagedFromLane();\n }\n\n async addRemovedDependenciesIssues(components: Component[]) {\n const workspacePolicyManifest = this.depResolver.getWorkspacePolicyManifest();\n const workspaceDependencies = {\n ...workspacePolicyManifest.dependencies,\n ...workspacePolicyManifest.peerDependencies,\n };\n const installedDeps = Object.keys(workspaceDependencies);\n await pMapSeries(components, async (component) => {\n await this.addRemovedDepIssue(component, installedDeps);\n });\n }\n\n private async addRemovedDepIssue(component: Component, installedDeps: string[]) {\n const dependencies = this.depResolver.getComponentDependencies(component);\n const removedDependencies: ComponentID[] = [];\n let removedEnv: ComponentID | undefined;\n\n await Promise.all(\n dependencies.map(async (dep) => {\n const isRemoved = await this.isRemovedByIdWithoutLoadingComponent(dep.componentId);\n if (!isRemoved) return;\n\n // a component can be deleted from the workspace and installed as a package in different version.\n // normally, this is happening when checked out to a lane and a component is deleted from the lane.\n // the user still wants to use it but not as part of the lane.\n const packageName = dep.getPackageName();\n const isAvailableAsInstalledPackage = installedDeps.includes(packageName);\n const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(dep.componentId);\n if (bitmapEntry && isAvailableAsInstalledPackage && bitmapEntry.version !== dep.version) {\n return;\n }\n\n const isEnv = await this.isEnvByIdWithoutLoadingComponent(dep.componentId);\n if (isEnv) {\n removedEnv = dep.componentId;\n } else {\n removedDependencies.push(dep.componentId);\n }\n })\n );\n if (removedDependencies.length) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedDependencies).data = removedDependencies.map((r) =>\n r.toString()\n );\n }\n if (removedEnv) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedEnv).data = removedEnv.toString();\n }\n }\n\n private async getRemovedStagedFromMain(): Promise<ComponentID[]> {\n const stagedConfig = await this.workspace.scope.getStagedConfig();\n return stagedConfig\n .getAll()\n .filter((compConfig) => compConfig.config?.[RemoveAspect.id]?.removed)\n .map((compConfig) => compConfig.id);\n }\n\n private async getRemovedStagedFromLane(): Promise<ComponentID[]> {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return [];\n const laneIds = currentLane.toComponentIds();\n const workspaceIds = this.workspace.listIds();\n const laneCompIdsNotInWorkspace = laneIds.filter(\n (id) => !workspaceIds.find((wId) => wId.isEqualWithoutVersion(id))\n );\n if (!laneCompIdsNotInWorkspace.length) return [];\n const comps = await this.workspace.scope.getMany(laneCompIdsNotInWorkspace);\n const removed = comps.filter((c) => this.isDeleted(c));\n const staged = await Promise.all(\n removed.map(async (c) => {\n const snapDistance = await this.workspace.scope.getSnapDistance(c.id, false);\n if (snapDistance.err) {\n this.logger.warn(\n `getRemovedStagedFromLane unable to get snapDistance for ${c.id.toString()} due to ${snapDistance.err.name}`\n );\n // todo: not clear what should be done here. should we consider it as removed-staged or not.\n }\n if (snapDistance.isSourceAhead()) return c.id;\n return undefined;\n })\n );\n return compact(staged);\n }\n\n private async getLocalBitIdsToRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (hasWildcard(componentsPattern)) {\n return this.lister.getRemoteCompIdsByWildcards(componentsPattern);\n }\n return [ComponentID.fromString(componentsPattern)];\n }\n\n static slots = [];\n static dependencies = [\n WorkspaceAspect,\n ScopeAspect,\n CLIAspect,\n LoggerAspect,\n ComponentAspect,\n ImporterAspect,\n DependencyResolverAspect,\n IssuesAspect,\n ListerAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider([\n workspace,\n scope,\n cli,\n loggerMain,\n componentAspect,\n importerMain,\n depResolver,\n issues,\n lister,\n ]: [\n Workspace,\n ScopeMain,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain,\n DependencyResolverMain,\n IssuesMain,\n ListerMain,\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, scope, logger, importerMain, depResolver, lister);\n issues.registerAddComponentsIssues(removeMain.addRemovedDependenciesIssues.bind(removeMain));\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(\n new RemoveCmd(removeMain, workspace),\n new DeleteCmd(removeMain, workspace),\n new RecoverCmd(removeMain)\n );\n return removeMain;\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;AACA,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,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;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Y,EACZlM,WAAW,EACXmK,MAAM,EACNlK,MAAM,CAWP,EAAE;IACD,MAAMH,MAAM,GAAGkM,UAAU,CAACG,YAAY,CAACtJ,sBAAY,CAACT,EAAE,CAAC;IACvD,MAAMgK,UAAU,GAAG,IAAI1M,UAAU,CAACE,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEoM,YAAY,EAAElM,WAAW,EAAEC,MAAM,CAAC;IAC9FkK,MAAM,CAACkC,2BAA2B,CAACD,UAAU,CAACpD,4BAA4B,CAACsD,IAAI,CAACF,UAAU,CAAC,CAAC;IAC5FH,eAAe,CAACM,qBAAqB,CAAC,CAAC,KAAIC,yBAAc,EAACJ,UAAU,CAAC,CAAC,CAAC;IACvEL,GAAG,CAACU,QAAQ,CACV,KAAIC,sBAAS,EAACN,UAAU,EAAExM,SAAS,CAAC,EACpC,KAAI+M,sBAAS,EAACP,UAAU,EAAExM,SAAS,CAAC,EACpC,KAAIgN,wBAAU,EAACR,UAAU,CAC3B,CAAC;IACD,OAAOA,UAAU;EACnB;AACF;AAACS,OAAA,CAAAnN,UAAA,GAAAA,UAAA;AAAAjB,eAAA,CAncYiB,UAAU,WAqZN,EAAE;AAAAjB,eAAA,CArZNiB,UAAU,kBAsZC,CACpBoN,4BAAe,EACfC,oBAAW,EACXC,gBAAS,EACTC,sBAAY,EACZC,4BAAe,EACfC,0BAAc,EACdC,8CAAwB,EACxBC,sBAAY,EACZC,sBAAY,CACb;AAAA7O,eAAA,CAhaUiB,UAAU,aAiaJ6N,kBAAW;AAoC9B1K,sBAAY,CAAC2K,UAAU,CAAC9N,UAAU,CAAC;AAAC,IAAA+N,QAAA,GAAAZ,OAAA,CAAArP,OAAA,GAErBkC,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_semver","_interopRequireDefault","_logger","_workspace","_componentId","_legacy","_importer","_lodash","_legacy2","_bitError","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_legacy3","_component","_deleteComponentFiles","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","_scope","_lister","_chalk","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","BEFORE_REMOVE","RemoveMain","constructor","workspace","scope","logger","importer","depResolver","lister","remove","componentsPattern","force","remote","track","deleteFiles","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","ComponentIdList","fromArray","onDestroy","removeLocallyByIds","reasonForRemoval","OutsideWorkspaceError","results","bitMap","write","markRemoveComps","componentIds","updateMain","range","snaps","allComponentsToMarkDeleted","getMany","componentsToDeleteFromFs","componentsIdsToDeleteFromFs","map","c","id","removeComponentsFromNodeModules","state","_consumer","config","removed","removeOnMain","compId","addComponentConfig","RemoveAspect","deleteComponentsFiles","deleteComps","opts","ConsumerNotFound","idsByPattern","newComps","hasVersion","BitError","toString","join","currentLane","getCurrentLaneObject","isNew","Error","laneComp","toComponentIds","compIdsNotOnLane","hasWithoutVersion","chalk","bold","recover","pattern","options","componentsToRecover","getComponentsToRecover","componentsToProcess","Promise","all","classifyComponentForRecovery","idsToImport","item","action","idToImport","import","installNpmPackages","skipDependencyInstallation","writeConfigFiles","skipWriteConfigFiles","override","shouldRecover","compFromScope","get","bitMapEntry","rootDir","removeComponentConfig","addSpecificComponentConfig","_","idx","getBitmapEntryIfExist","ignoreVersion","comp","removeInfo","getRemoveInfo","idOnLane","getComponent","compIdWithPossibleVer","changeVersion","head","isDeleted","getRemoteComponent","err","NoHeadNoVersion","hasWildcard","locallySoftRemoved","getRemoved","componentsList","componentList","remotelySoftRemoved","listRemotelySoftRemoved","remotelySoftRemovedIds","componentId","removedStaged","getRemovedStaged","allSoftRemoved","matches","filterIdsFromPoolIdsByPattern","uniqFromArray","components","find","compMap","fullName","toStringWithoutVersion","resolveComponentId","throwForMainComponentWhenOnLane","laneComps","toBitIds","mainComps","component","headComponent","getHeadComponent","extensions","findExtension","isDeletedByRange","currentTag","getTag","Boolean","semver","satisfies","version","isDeletedBySnaps","includes","hash","headTag","headComp","undefined","isRemoved","isRemovedByIdWithoutLoadingComponent","bitmapEntry","isRecovered","modelComp","getBitObjectModelComponent","legacyScope","objects","isEnvByIdWithoutLoadingComponent","versionObj","getBitObjectVersionById","envData","findCoreExtension","type","isOnMain","getRemovedStagedFromMain","getRemovedStagedFromLane","addRemovedDependenciesIssues","workspacePolicyManifest","getWorkspacePolicyManifest","workspaceDependencies","dependencies","peerDependencies","installedDeps","pMapSeries","addRemovedDepIssue","getComponentDependencies","removedDependencies","removedEnv","dep","packageName","getPackageName","isAvailableAsInstalledPackage","isEnv","issues","getOrCreate","IssuesClasses","RemovedDependencies","RemovedEnv","stagedConfig","getStagedConfig","getAll","compConfig","laneIds","workspaceIds","listIds","laneCompIdsNotInWorkspace","wId","isEqualWithoutVersion","comps","staged","snapDistance","getSnapDistance","warn","name","isSourceAhead","compact","getRemoteCompIdsByWildcards","ComponentID","fromString","provider","cli","loggerMain","componentAspect","importerMain","createLogger","removeMain","registerAddComponentsIssues","bind","registerShowFragments","RemoveFragment","register","RemoveCmd","DeleteCmd","RecoverCmd","exports","WorkspaceAspect","ScopeAspect","CLIAspect","LoggerAspect","ComponentAspect","ImporterAspect","DependencyResolverAspect","IssuesAspect","ListerAspect","MainRuntime","addRuntime","_default"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\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 { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy.consumer';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport { compact } from 'lodash';\nimport { hasWildcard } from '@teambit/legacy.utils';\nimport { BitError } from '@teambit/bit-error';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport type { IssuesMain } from '@teambit/issues';\nimport { IssuesAspect } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { NoHeadNoVersion } from '@teambit/legacy.scope';\nimport type { Component, ComponentMain } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { deleteComponentsFiles } from './delete-component-files';\nimport { RemoveCmd } from './remove-cmd';\nimport type { RemoveComponentsResult } from './remove-components';\nimport { removeComponents, removeComponentsFromNodeModules } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport type { RecoverOptions } from './recover-cmd';\nimport { RecoverCmd } from './recover-cmd';\nimport { DeleteCmd } from './delete-cmd';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ListerMain } from '@teambit/lister';\nimport { ListerAspect } from '@teambit/lister';\nimport chalk from 'chalk';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n /**\n * whether to remove the component from default lane once merged\n */\n removeOnMain?: boolean;\n /**\n * Semver range to mark specific versions as deleted\n */\n range?: string;\n /**\n * Array of snap hashes to mark as deleted\n */\n snaps?: string[];\n};\n\nexport type DeleteOpts = { updateMain?: boolean; range?: string; snaps?: string[] };\n\nexport class RemoveMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n public logger: Logger,\n private importer: ImporterMain,\n private depResolver: DependencyResolverMain,\n private lister: ListerMain\n ) {}\n\n async remove({\n componentsPattern,\n force = false,\n remote = false,\n track = false,\n deleteFiles = true,\n }: {\n componentsPattern: string;\n force?: boolean;\n remote?: boolean;\n track?: boolean;\n deleteFiles?: boolean;\n }): Promise<RemoveComponentsResult> {\n this.logger.setStatusLine(BEFORE_REMOVE);\n const bitIds = remote\n ? await this.getRemoteBitIdsToRemove(componentsPattern)\n : await this.getLocalBitIdsToRemove(componentsPattern);\n this.logger.setStatusLine(BEFORE_REMOVE); // again because the loader might changed when talking to the remote\n const consumer = this.workspace?.consumer;\n const removeResults = await removeComponents({\n workspace: this.workspace,\n ids: ComponentIdList.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n });\n if (consumer) await consumer.onDestroy('remove');\n return removeResults;\n }\n\n /**\n * remove components from the workspace.\n */\n async removeLocallyByIds(\n ids: ComponentID[],\n { force = false, reasonForRemoval }: { force?: boolean; reasonForRemoval?: string } = {}\n ) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n workspace: this.workspace,\n ids: ComponentIdList.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n });\n await this.workspace.bitMap.write(`remove (by ${reasonForRemoval || 'N/A'})`);\n\n return results;\n }\n\n private async markRemoveComps(\n componentIds: ComponentID[],\n { updateMain, range, snaps }: DeleteOpts\n ): Promise<Component[]> {\n const allComponentsToMarkDeleted = await this.workspace.getMany(componentIds);\n\n const componentsToDeleteFromFs = range || snaps ? [] : allComponentsToMarkDeleted;\n const componentsIdsToDeleteFromFs = ComponentIdList.fromArray(componentsToDeleteFromFs.map((c) => c.id));\n await removeComponentsFromNodeModules(\n this.workspace.consumer,\n componentsToDeleteFromFs.map((c) => c.state._consumer)\n );\n // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted\n // during this removal along with the entire component dir.\n // in case this is range, the \"removed\" property is set to false. even when the range overlap the current version.\n // the reason is that if we set it to true, then, the component is considered as \"deleted\" for *all* versions.\n // remember that this config is always passed to the next version and if we set removed: true, it'll be copied\n // to the next version even when that version is not in the range.\n const config: RemoveInfo = { removed: !(range || snaps) };\n if (updateMain) config.removeOnMain = true;\n if (range) config.range = range;\n if (snaps && snaps.length) config.snaps = snaps;\n componentIds.forEach((compId) => this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, config));\n await this.workspace.bitMap.write('delete');\n await deleteComponentsFiles(this.workspace.consumer, componentsIdsToDeleteFromFs);\n\n return componentsToDeleteFromFs;\n }\n\n async deleteComps(componentsPattern: string, opts: DeleteOpts = {}): Promise<Component[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const newComps = componentIds.filter((id) => !id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `no need to delete the following new component(s), please remove them by \"bit remove\"\\n${newComps\n .map((id) => id.toString())\n .join('\\n')}`\n );\n }\n const currentLane = await this.workspace.getCurrentLaneObject();\n const { updateMain } = opts;\n if (!updateMain && currentLane?.isNew) {\n throw new Error(\n 'no need to delete components from an un-exported lane, you can remove them by running \"bit remove\"'\n );\n }\n if (currentLane && !updateMain && opts.range) {\n throw new BitError(`--range is not needed when deleting components from a lane, unless --update-main is used`);\n }\n if (currentLane && !updateMain) {\n const laneComp = currentLane.toComponentIds();\n const compIdsNotOnLane = componentIds.filter((id) => !laneComp.hasWithoutVersion(id));\n if (compIdsNotOnLane.length) {\n throw new BitError(\n `unable to delete the following component(s) because they are not part of the current lane.\n${chalk.bold(compIdsNotOnLane.map((id) => id.toString()).join('\\n'))}\nto simply remove them from the workspace, use \"bit remove\".\nto delete them eventually from main, use \"--update-main\" flag and make sure to remove all occurrences from the code.`\n );\n }\n }\n return this.markRemoveComps(componentIds, opts);\n }\n\n /**\n * recover soft-removed component(s) matching a pattern.\n * supports component patterns (e.g., \"comp1\", \"org.scope/*\", etc.)\n * returns array of recovered component IDs\n */\n async recover(pattern: string, options: RecoverOptions): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n\n const componentsToRecover = await this.getComponentsToRecover(pattern);\n if (componentsToRecover.length === 0) {\n return [];\n }\n\n // Classify components by recovery scenario\n const componentsToProcess = await Promise.all(\n componentsToRecover.map((compId) => this.classifyComponentForRecovery(compId))\n );\n\n // Collect all components that need importing\n const idsToImport = componentsToProcess\n .filter((item) => item.action === 'import' || item.action === 'deleteConfigAndImport')\n .map((item) => item.idToImport!);\n\n // Import all at once for better performance\n if (idsToImport.length > 0) {\n await this.importer.import({\n ids: idsToImport,\n installNpmPackages: !options.skipDependencyInstallation,\n writeConfigFiles: !options.skipWriteConfigFiles,\n override: true,\n });\n }\n\n // Process each component according to its classification\n for (const item of componentsToProcess) {\n if (!item.shouldRecover) continue;\n\n if (item.action === 'writeFromScope') {\n // Case #1a: write from local scope and remove the \"removed\" config\n const compFromScope = await this.workspace.scope.get(item.bitMapEntry!.id);\n if (compFromScope) {\n await this.workspace.write(compFromScope, item.bitMapEntry!.rootDir);\n this.workspace.bitMap.removeComponentConfig(item.bitMapEntry!.id, RemoveAspect.id, false);\n }\n } else if (item.action === 'deleteConfigAndImport') {\n // Case #1b: delete config entry before import\n delete item.bitMapEntry!.config?.[RemoveAspect.id];\n } else {\n // Cases #2, #3, #4, #5: set removed: false\n await this.workspace.addSpecificComponentConfig(item.compId, RemoveAspect.id, { removed: false });\n }\n }\n\n // Write bitmap once at the end\n await this.workspace.bitMap.write('recover');\n\n return componentsToRecover.filter((_, idx) => componentsToProcess[idx].shouldRecover);\n }\n\n /**\n * Classify a component to determine how it should be recovered.\n * This implements the 5 different recovery scenarios.\n */\n private async classifyComponentForRecovery(compId: ComponentID): Promise<{\n compId: ComponentID;\n shouldRecover: boolean;\n action: 'writeFromScope' | 'deleteConfigAndImport' | 'updateConfig' | 'import' | 'none';\n bitMapEntry?: any;\n idToImport?: string;\n }> {\n if (!this.workspace) throw new ConsumerNotFound();\n\n const bitMapEntry = this.workspace.bitMap.getBitmapEntryIfExist(compId, { ignoreVersion: true });\n\n // Case #1: Component in .bitmap with \"removed\" aspect entry\n if (bitMapEntry?.config?.[RemoveAspect.id]) {\n const compFromScope = await this.workspace.scope.get(bitMapEntry.id);\n if (compFromScope) {\n // Case #1a: exists in local scope - write from there\n return {\n compId: bitMapEntry.id,\n shouldRecover: true,\n action: 'writeFromScope',\n bitMapEntry,\n };\n }\n // Case #1b: not in local scope - import it\n return {\n compId: bitMapEntry.id,\n shouldRecover: true,\n action: 'deleteConfigAndImport',\n bitMapEntry,\n idToImport: bitMapEntry.id.toString(),\n };\n }\n\n // Case #4: Component in .bitmap without \"removed\" aspect entry\n if (bitMapEntry) {\n const comp = await this.workspace.get(compId);\n const removeInfo = await this.getRemoveInfo(comp);\n if (!removeInfo.removed && !removeInfo.range && !removeInfo.snaps) {\n return { compId, shouldRecover: false, action: 'none' };\n }\n return {\n compId,\n shouldRecover: true,\n action: 'updateConfig',\n };\n }\n\n // Cases #2, #3, #5: Component not in .bitmap\n const currentLane = await this.workspace.getCurrentLaneObject();\n const idOnLane = currentLane?.getComponent(compId);\n const compIdWithPossibleVer = idOnLane ? compId.changeVersion(idOnLane.head.toString()) : compId;\n const compFromScope = await this.workspace.scope.get(compIdWithPossibleVer);\n\n if (compFromScope && (await this.isDeleted(compFromScope))) {\n // Cases #2 and #3: soft-removed and snapped/exported\n return {\n compId: compIdWithPossibleVer,\n shouldRecover: true,\n action: 'import',\n idToImport: compIdWithPossibleVer._legacy.toString(),\n };\n }\n\n // Case #5: workspace is empty, component on remote\n let comp: Component | undefined;\n try {\n comp = await this.workspace.scope.getRemoteComponent(compId);\n } catch (err: any) {\n if (err instanceof NoHeadNoVersion) {\n throw new BitError(\n `unable to find the component ${compIdWithPossibleVer.toString()} in the current lane or main`\n );\n }\n throw err;\n }\n if (!(await this.isDeleted(comp))) {\n return { compId, shouldRecover: false, action: 'none' };\n }\n return {\n compId,\n shouldRecover: true,\n action: 'import',\n idToImport: compId._legacy.toString(),\n };\n }\n\n /**\n * get all components matching the pattern that are soft-removed and can be recovered\n */\n private async getComponentsToRecover(pattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n\n // Check if pattern contains wildcards\n if (hasWildcard(pattern)) {\n // Get all soft-removed components from different sources\n const locallySoftRemoved = this.workspace.consumer.bitMap.getRemoved();\n const componentsList = this.workspace.componentList;\n const remotelySoftRemoved = await componentsList.listRemotelySoftRemoved();\n const remotelySoftRemovedIds = remotelySoftRemoved.map((c) => c.componentId);\n\n // Also check components on the current lane that might be soft-removed\n const removedStaged = await this.getRemovedStaged();\n\n // Combine all soft-removed components\n const allSoftRemoved = [...locallySoftRemoved, ...remotelySoftRemovedIds, ...removedStaged];\n\n // Use the same pattern matching logic as filterIdsFromPoolIdsByPattern\n const matches = await this.workspace.scope.filterIdsFromPoolIdsByPattern(pattern, allSoftRemoved, false);\n\n return ComponentIdList.uniqFromArray(matches);\n }\n\n // Single component - try to resolve it\n const bitMapEntry = this.workspace.consumer.bitMap.components.find((compMap) => {\n return compMap.id.fullName === pattern || compMap.id.toStringWithoutVersion() === pattern;\n });\n if (bitMapEntry) {\n return [bitMapEntry.id];\n }\n const compId = await this.workspace.scope.resolveComponentId(pattern);\n return [compId];\n }\n\n private async throwForMainComponentWhenOnLane(components: Component[]) {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return; // user on main\n const laneComps = currentLane.toBitIds();\n const mainComps = components.filter((comp) => !laneComps.hasWithoutVersion(comp.id));\n if (mainComps.length) {\n throw new BitError(`the following components belong to main, they cannot be soft-removed when on a lane. consider removing them without --soft.\n${mainComps.map((c) => c.id.toString()).join('\\n')}`);\n }\n }\n\n async getRemoveInfo(component: Component): Promise<RemoveInfo> {\n const headComponent = await this.getHeadComponent(component);\n const data = headComponent.config.extensions.findExtension(RemoveAspect.id)?.config as RemoveInfo | undefined;\n\n const isDeletedByRange = () => {\n if (!data?.range) return false;\n const currentTag = component.getTag();\n return Boolean(currentTag && semver.satisfies(currentTag.version, data.range));\n };\n const isDeletedBySnaps = () => {\n if (!data?.snaps || !component.id.version) return false;\n return data.snaps.includes(component.id.version);\n };\n\n return {\n removed: data?.removed || isDeletedByRange() || isDeletedBySnaps() || false,\n range: data?.range,\n snaps: data?.snaps,\n };\n }\n\n private async getHeadComponent(component: Component): Promise<Component> {\n if (\n component.id.version &&\n component.head &&\n component.id.version !== component.head?.hash &&\n component.id.version !== component.headTag?.version.version\n ) {\n const headComp = this.workspace // if workspace exits, prefer using the workspace as it may be modified\n ? await this.workspace.get(component.id.changeVersion(undefined))\n : await this.scope.get(component.id.changeVersion(component.head.hash));\n if (!headComp) throw new Error(`unable to get the head of ${component.id.toString()}`);\n return headComp;\n }\n return component;\n }\n\n /**\n * @deprecated use `isDeleted` instead.\n */\n async isRemoved(component: Component): Promise<boolean> {\n return this.isDeleted(component);\n }\n\n /**\n * whether a component is marked as deleted.\n */\n async isDeleted(component: Component): Promise<boolean> {\n const removeInfo = await this.getRemoveInfo(component);\n return removeInfo.removed;\n }\n\n /**\n * performant version of isRemoved() in case the component object is not available and loading it is expensive.\n */\n async isRemovedByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {\n if (!componentId.hasVersion()) return false;\n const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(componentId);\n if (bitmapEntry && bitmapEntry.isRemoved()) return true;\n if (bitmapEntry && bitmapEntry.isRecovered()) return false;\n const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId.changeVersion(undefined));\n if (!modelComp) return false;\n const isRemoved = await modelComp.isRemoved(\n this.workspace.scope.legacyScope.objects,\n componentId.version as string\n );\n return Boolean(isRemoved);\n }\n\n async isEnvByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {\n const versionObj = await this.workspace.scope.getBitObjectVersionById(componentId);\n const envData = versionObj?.extensions.findCoreExtension('teambit.envs/envs');\n return envData?.data.type === 'env';\n }\n\n /**\n * get components that were soft-removed and tagged/snapped/merged but not exported yet.\n */\n async getRemovedStaged(): Promise<ComponentID[]> {\n return this.workspace.isOnMain() ? this.getRemovedStagedFromMain() : this.getRemovedStagedFromLane();\n }\n\n async addRemovedDependenciesIssues(components: Component[]) {\n const workspacePolicyManifest = this.depResolver.getWorkspacePolicyManifest();\n const workspaceDependencies = {\n ...workspacePolicyManifest.dependencies,\n ...workspacePolicyManifest.peerDependencies,\n };\n const installedDeps = Object.keys(workspaceDependencies);\n await pMapSeries(components, async (component) => {\n await this.addRemovedDepIssue(component, installedDeps);\n });\n }\n\n private async addRemovedDepIssue(component: Component, installedDeps: string[]) {\n const dependencies = this.depResolver.getComponentDependencies(component);\n const removedDependencies: ComponentID[] = [];\n let removedEnv: ComponentID | undefined;\n\n await Promise.all(\n dependencies.map(async (dep) => {\n const isRemoved = await this.isRemovedByIdWithoutLoadingComponent(dep.componentId);\n if (!isRemoved) return;\n\n // a component can be deleted from the workspace and installed as a package in different version.\n // normally, this is happening when checked out to a lane and a component is deleted from the lane.\n // the user still wants to use it but not as part of the lane.\n const packageName = dep.getPackageName();\n const isAvailableAsInstalledPackage = installedDeps.includes(packageName);\n const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(dep.componentId);\n if (bitmapEntry && isAvailableAsInstalledPackage && bitmapEntry.version !== dep.version) {\n return;\n }\n\n const isEnv = await this.isEnvByIdWithoutLoadingComponent(dep.componentId);\n if (isEnv) {\n removedEnv = dep.componentId;\n } else {\n removedDependencies.push(dep.componentId);\n }\n })\n );\n if (removedDependencies.length) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedDependencies).data = removedDependencies.map((r) =>\n r.toString()\n );\n }\n if (removedEnv) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedEnv).data = removedEnv.toString();\n }\n }\n\n private async getRemovedStagedFromMain(): Promise<ComponentID[]> {\n const stagedConfig = await this.workspace.scope.getStagedConfig();\n return stagedConfig\n .getAll()\n .filter((compConfig) => compConfig.config?.[RemoveAspect.id]?.removed)\n .map((compConfig) => compConfig.id);\n }\n\n private async getRemovedStagedFromLane(): Promise<ComponentID[]> {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return [];\n const laneIds = currentLane.toComponentIds();\n const workspaceIds = this.workspace.listIds();\n const laneCompIdsNotInWorkspace = laneIds.filter(\n (id) => !workspaceIds.find((wId) => wId.isEqualWithoutVersion(id))\n );\n if (!laneCompIdsNotInWorkspace.length) return [];\n const comps = await this.workspace.scope.getMany(laneCompIdsNotInWorkspace);\n const removed = comps.filter((c) => this.isDeleted(c));\n const staged = await Promise.all(\n removed.map(async (c) => {\n const snapDistance = await this.workspace.scope.getSnapDistance(c.id, false);\n if (snapDistance.err) {\n this.logger.warn(\n `getRemovedStagedFromLane unable to get snapDistance for ${c.id.toString()} due to ${snapDistance.err.name}`\n );\n // todo: not clear what should be done here. should we consider it as removed-staged or not.\n }\n if (snapDistance.isSourceAhead()) return c.id;\n return undefined;\n })\n );\n return compact(staged);\n }\n\n private async getLocalBitIdsToRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (hasWildcard(componentsPattern)) {\n return this.lister.getRemoteCompIdsByWildcards(componentsPattern);\n }\n return [ComponentID.fromString(componentsPattern)];\n }\n\n static slots = [];\n static dependencies = [\n WorkspaceAspect,\n ScopeAspect,\n CLIAspect,\n LoggerAspect,\n ComponentAspect,\n ImporterAspect,\n DependencyResolverAspect,\n IssuesAspect,\n ListerAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider([\n workspace,\n scope,\n cli,\n loggerMain,\n componentAspect,\n importerMain,\n depResolver,\n issues,\n lister,\n ]: [\n Workspace,\n ScopeMain,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain,\n DependencyResolverMain,\n IssuesMain,\n ListerMain,\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, scope, logger, importerMain, depResolver, lister);\n issues.registerAddComponentsIssues(removeMain.addRemovedDependenciesIssues.bind(removeMain));\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(\n new RemoveCmd(removeMain, workspace),\n new DeleteCmd(removeMain, workspace),\n new RecoverCmd(removeMain)\n );\n return removeMain;\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;AACA,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,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,UAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,SAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,QAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,OAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;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,CAAC,CAAC,CAAC;IACvEL,GAAG,CAACU,QAAQ,CACV,KAAIC,sBAAS,EAACN,UAAU,EAAE7N,SAAS,CAAC,EACpC,KAAIoO,sBAAS,EAACP,UAAU,EAAE7N,SAAS,CAAC,EACpC,KAAIqO,wBAAU,EAACR,UAAU,CAC3B,CAAC;IACD,OAAOA,UAAU;EACnB;AACF;AAACS,OAAA,CAAAxO,UAAA,GAAAA,UAAA;AAAAjB,eAAA,CAtiBYiB,UAAU,WAwfN,EAAE;AAAAjB,eAAA,CAxfNiB,UAAU,kBAyfC,CACpByO,4BAAe,EACfC,oBAAW,EACXC,gBAAS,EACTC,sBAAY,EACZC,4BAAe,EACfC,0BAAc,EACdC,8CAAwB,EACxBC,sBAAY,EACZC,sBAAY,CACb;AAAAlQ,eAAA,CAngBUiB,UAAU,aAogBJkP,kBAAW;AAoC9B/L,sBAAY,CAACgM,UAAU,CAACnP,UAAU,CAAC;AAAC,IAAAoP,QAAA,GAAAZ,OAAA,CAAA1Q,OAAA,GAErBkC,UAAU","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/remove",
3
- "version": "0.0.0-df97f10b385de851205fd957ff2dc5f4a8bb03ee",
3
+ "version": "0.0.0-e052d5731fb731cd52696d03c7e39cbdf038def7",
4
4
  "homepage": "https://bit.cloud/teambit/component/remove",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "remove",
9
- "version": "df97f10b385de851205fd957ff2dc5f4a8bb03ee"
9
+ "version": "e052d5731fb731cd52696d03c7e39cbdf038def7"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -18,36 +18,36 @@
18
18
  "p-map-series": "2.1.0",
19
19
  "semver": "7.7.1",
20
20
  "@teambit/bit-error": "0.0.404",
21
- "@teambit/cli": "0.0.1272",
22
- "@teambit/legacy.constants": "0.0.17",
23
- "@teambit/legacy.scope": "0.0.73",
21
+ "@teambit/cli": "0.0.1315",
22
+ "@teambit/legacy.constants": "0.0.26",
23
+ "@teambit/legacy.scope": "0.0.107",
24
24
  "@teambit/component-id": "1.2.4",
25
- "@teambit/component.sources": "0.0.125",
26
- "@teambit/legacy.consumer": "0.0.73",
27
- "@teambit/legacy.logger": "0.0.27",
28
- "@teambit/legacy.component-list": "0.0.127",
29
- "@teambit/legacy.consumer-component": "0.0.74",
30
- "@teambit/pkg.modules.component-package-name": "0.0.80",
31
- "@teambit/scope.network": "0.0.73",
32
- "@teambit/scope.remotes": "0.0.73",
25
+ "@teambit/component.sources": "0.0.159",
26
+ "@teambit/legacy.consumer": "0.0.107",
27
+ "@teambit/legacy.logger": "0.0.38",
28
+ "@teambit/legacy.component-list": "0.0.161",
29
+ "@teambit/legacy.consumer-component": "0.0.108",
30
+ "@teambit/pkg.modules.component-package-name": "0.0.114",
31
+ "@teambit/scope.network": "0.0.107",
32
+ "@teambit/scope.remotes": "0.0.107",
33
33
  "@teambit/harmony": "0.4.7",
34
- "@teambit/component-issues": "0.0.163",
35
- "@teambit/legacy.utils": "0.0.26",
36
- "@teambit/logger": "0.0.1365",
37
- "@teambit/workspace": "0.0.0-6cdc2f5047553c65581f136d8c6470046ac19e3e",
38
- "@teambit/component": "0.0.0-c9feffff4ea478e7dea07c0181a65b16ac11b54e",
39
- "@teambit/dependency-resolver": "0.0.0-9b39fc6281f2675c8cbc5b7881eaa96ee3a31983",
40
- "@teambit/importer": "0.0.0-bb4852f44ac5b4137ff273fecfd3725505917730",
41
- "@teambit/issues": "0.0.0-b7dc4d1ed375faf8daaabd1c6992621f3d58fe63",
42
- "@teambit/lister": "0.0.0-dbbe1510c9ded66dcf7f67780ad5f49ac425e3c7",
43
- "@teambit/scope": "0.0.0-052e47214a05d926f9030d791bfb39e681b56964"
34
+ "@teambit/component-issues": "0.0.171",
35
+ "@teambit/legacy.utils": "0.0.34",
36
+ "@teambit/logger": "0.0.1408",
37
+ "@teambit/workspace": "0.0.0-4c0d54b19d13dd59b87e28a9adba00592b361372",
38
+ "@teambit/component": "0.0.0-e12766925d2cb2dd72bf8c21fc6974f7dffe0f91",
39
+ "@teambit/dependency-resolver": "0.0.0-55126344a4e2e9e2d06781703c4c9330bc235578",
40
+ "@teambit/importer": "0.0.0-974706353dd655267c7affaeb38d586f30c3bcd4",
41
+ "@teambit/issues": "0.0.0-e29b4d4516fd02140a5c0d10531b9d62f23f4033",
42
+ "@teambit/lister": "0.0.0-966ea7606710384c6374bf9897638bd8706ae49c",
43
+ "@teambit/scope": "0.0.0-2b651eda511fca4ac9437fd33d72119c28c56ba2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/fs-extra": "9.0.7",
47
47
  "@types/lodash": "4.14.165",
48
48
  "@types/semver": "7.5.8",
49
49
  "@types/mocha": "9.1.0",
50
- "@teambit/harmony.envs.core-aspect-env": "0.0.78"
50
+ "@teambit/harmony.envs.core-aspect-env": "0.1.4"
51
51
  },
52
52
  "peerDependencies": {},
53
53
  "license": "Apache-2.0",