@teambit/remove 1.0.257 → 1.0.259

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,12 +19,13 @@ export declare class DeleteCmd implements Command {
19
19
  loader: boolean;
20
20
  remoteOp: boolean;
21
21
  constructor(remove: RemoveMain, workspace?: Workspace | undefined);
22
- report([componentsPattern]: [string], { force, lane, updateMain, hard, silent, }: {
22
+ report([componentsPattern]: [string], { force, lane, updateMain, hard, silent, range, }: {
23
23
  force?: boolean;
24
24
  lane?: boolean;
25
25
  updateMain?: boolean;
26
26
  hard?: boolean;
27
27
  silent?: boolean;
28
+ range?: string;
28
29
  }): Promise<string>;
29
30
  private paintArray;
30
31
  private removePrompt;
@@ -60,7 +60,7 @@ this command marks the components as deleted, and after snap/tag and export they
60
60
  _defineProperty(this, "helpUrl", 'reference/components/removing-components');
61
61
  _defineProperty(this, "skipWorkspace", true);
62
62
  _defineProperty(this, "alias", '');
63
- _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', 'EXPERIMENTAL. delete component/s on the main lane after merging this lane into main'], ['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']]);
63
+ _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', 'EXPERIMENTAL. 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']]);
64
64
  _defineProperty(this, "loader", true);
65
65
  _defineProperty(this, "remoteOp", true);
66
66
  }
@@ -69,7 +69,8 @@ this command marks the components as deleted, and after snap/tag and export they
69
69
  lane = false,
70
70
  updateMain = false,
71
71
  hard = false,
72
- silent = false
72
+ silent = false,
73
+ range
73
74
  }) {
74
75
  if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {
75
76
  throw new (_bitError().BitError)(`error: to delete components when on a lane, use --lane flag`);
@@ -81,6 +82,7 @@ this command marks the components as deleted, and after snap/tag and export they
81
82
  await this.removePrompt(hard, lane);
82
83
  }
83
84
  if (hard) {
85
+ if (range) throw new (_bitError().BitError)(`--range is not supported with --hard flag`);
84
86
  const {
85
87
  localResult,
86
88
  remoteResult = []
@@ -95,7 +97,8 @@ this command marks the components as deleted, and after snap/tag and export they
95
97
  return `${localMessage}${this.paintArray(remoteResult)}`;
96
98
  }
97
99
  const removedComps = await this.remove.deleteComps(componentsPattern, {
98
- updateMain
100
+ updateMain,
101
+ range
99
102
  });
100
103
  const removedCompIds = removedComps.map(comp => comp.id.toString());
101
104
  return `${_chalk().default.green('successfully deleted the following components:')}
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_constants","_removeTemplate","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","removedComps","deleteComps","removedCompIds","map","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 { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { 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.\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', 'EXPERIMENTAL. delete component/s on the main lane after merging this lane into main'],\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 ] as CommandOptions;\n loader = true;\n remoteOp = true;\n\n constructor(private remove: RemoveMain, private workspace?: Workspace) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n lane = false,\n updateMain = false,\n hard = false,\n silent = false,\n }: {\n force?: boolean;\n lane?: boolean;\n updateMain?: boolean;\n hard?: boolean;\n silent?: boolean;\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 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 removedComps = await this.remove.deleteComps(componentsPattern, { updateMain });\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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,oKAAmK,GACnK,GAAE2B,iBAAkB;AAC7B,4GAA4G;IAExG,MAAME,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAG,GAAEH,mBAAoB;AACvC,EAAET,gBAAK,CAACG,IAAI,CAAC,2CAA2C,CAAE;IACtD,CAAC,CAAC;IACF,IAAI,CAACO,EAAE,EAAE;MACP,MAAM,KAAI1B,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAAC6B,OAAA,CAAA5C,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_constants","_removeTemplate","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","range","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","removedComps","deleteComps","removedCompIds","map","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 { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { 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.\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', 'EXPERIMENTAL. 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 ] as CommandOptions;\n loader = true;\n remoteOp = true;\n\n constructor(private remove: RemoveMain, private workspace?: Workspace) {}\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 }: {\n force?: boolean;\n lane?: boolean;\n updateMain?: boolean;\n hard?: boolean;\n silent?: boolean;\n range?: 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 removedComps = await this.remove.deleteComps(componentsPattern, { updateMain, range });\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,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,gBAAA;EAAA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IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAG,GAAEH,mBAAoB;AACvC,EAAET,gBAAK,CAACG,IAAI,CAAC,2CAA2C,CAAE;IACtD,CAAC,CAAC;IACF,IAAI,CAACO,EAAE,EAAE;MACP,MAAM,KAAI1B,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAAC6B,OAAA,CAAA7C,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -14,17 +14,20 @@ class RemoveFragment {
14
14
  _defineProperty(this, "weight", 3);
15
15
  }
16
16
  async renderRow(component) {
17
- const isRemoved = this.remove.isRemoved(component);
17
+ const removedInfo = await this.remove.getRemoveInfo(component);
18
+ const isRemoved = removedInfo.removed;
19
+ const isRemovedStr = isRemoved.toString();
20
+ const range = removedInfo.range ? ` (range: ${removedInfo.range})` : '';
18
21
  return {
19
22
  title: this.title,
20
23
  // when it's not removed, set as an empty string so then it won't be shown in bit-show
21
- content: isRemoved ? isRemoved.toString() : ''
24
+ content: isRemoved || range ? isRemovedStr + range : ''
22
25
  };
23
26
  }
24
27
  async json(component) {
25
28
  return {
26
29
  title: this.title,
27
- json: this.remove.getRemoveInfo(component)
30
+ json: await this.remove.getRemoveInfo(component)
28
31
  };
29
32
  }
30
33
  }
@@ -1 +1 @@
1
- {"version":3,"names":["RemoveFragment","constructor","remove","_defineProperty","renderRow","component","isRemoved","title","content","toString","json","getRemoveInfo","exports"],"sources":["remove.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { RemoveMain } from './remove.main.runtime';\n\nexport class RemoveFragment implements ShowFragment {\n constructor(private remove: RemoveMain) {}\n\n title = 'removed';\n\n async renderRow(component: Component) {\n const isRemoved = this.remove.isRemoved(component);\n return {\n title: this.title,\n // when it's not removed, set as an empty string so then it won't be shown in bit-show\n content: isRemoved ? isRemoved.toString() : '',\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.remove.getRemoveInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;AAGO,MAAMA,cAAc,CAAyB;EAClDC,WAAWA,CAASC,MAAkB,EAAE;IAAA,KAApBA,MAAkB,GAAlBA,MAAkB;IAAAC,eAAA,gBAE9B,SAAS;IAAAA,eAAA,iBAkBR,CAAC;EApB+B;EAIzC,MAAMC,SAASA,CAACC,SAAoB,EAAE;IACpC,MAAMC,SAAS,GAAG,IAAI,CAACJ,MAAM,CAACI,SAAS,CAACD,SAAS,CAAC;IAClD,OAAO;MACLE,KAAK,EAAE,IAAI,CAACA,KAAK;MACjB;MACAC,OAAO,EAAEF,SAAS,GAAGA,SAAS,CAACG,QAAQ,CAAC,CAAC,GAAG;IAC9C,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACL,SAAoB,EAAE;IAC/B,OAAO;MACLE,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBG,IAAI,EAAE,IAAI,CAACR,MAAM,CAACS,aAAa,CAACN,SAAS;IAC3C,CAAC;EACH;AAGF;AAACO,OAAA,CAAAZ,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["RemoveFragment","constructor","remove","_defineProperty","renderRow","component","removedInfo","getRemoveInfo","isRemoved","removed","isRemovedStr","toString","range","title","content","json","exports"],"sources":["remove.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { RemoveMain } from './remove.main.runtime';\n\nexport class RemoveFragment implements ShowFragment {\n constructor(private remove: RemoveMain) {}\n\n title = 'removed';\n\n async renderRow(component: Component) {\n const removedInfo = await this.remove.getRemoveInfo(component);\n const isRemoved = removedInfo.removed;\n const isRemovedStr = isRemoved.toString();\n const range = removedInfo.range ? ` (range: ${removedInfo.range})` : '';\n\n return {\n title: this.title,\n // when it's not removed, set as an empty string so then it won't be shown in bit-show\n content: isRemoved || range ? isRemovedStr + range : '',\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: await this.remove.getRemoveInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;AAGO,MAAMA,cAAc,CAAyB;EAClDC,WAAWA,CAASC,MAAkB,EAAE;IAAA,KAApBA,MAAkB,GAAlBA,MAAkB;IAAAC,eAAA,gBAE9B,SAAS;IAAAA,eAAA,iBAsBR,CAAC;EAxB+B;EAIzC,MAAMC,SAASA,CAACC,SAAoB,EAAE;IACpC,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,aAAa,CAACF,SAAS,CAAC;IAC9D,MAAMG,SAAS,GAAGF,WAAW,CAACG,OAAO;IACrC,MAAMC,YAAY,GAAGF,SAAS,CAACG,QAAQ,CAAC,CAAC;IACzC,MAAMC,KAAK,GAAGN,WAAW,CAACM,KAAK,GAAI,YAAWN,WAAW,CAACM,KAAM,GAAE,GAAG,EAAE;IAEvE,OAAO;MACLC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjB;MACAC,OAAO,EAAEN,SAAS,IAAII,KAAK,GAAGF,YAAY,GAAGE,KAAK,GAAG;IACvD,CAAC;EACH;EAEA,MAAMG,IAAIA,CAACV,SAAoB,EAAE;IAC/B,OAAO;MACLQ,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBE,IAAI,EAAE,MAAM,IAAI,CAACb,MAAM,CAACK,aAAa,CAACF,SAAS;IACjD,CAAC;EACH;AAGF;AAACW,OAAA,CAAAhB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -8,19 +8,29 @@ import { IssuesMain } from '@teambit/issues';
8
8
  import { Component, ComponentMain } from '@teambit/component';
9
9
  import { RemoveComponentsResult } from './remove-components';
10
10
  import { RecoverOptions } from './recover-cmd';
11
+ import { ScopeMain } from '@teambit/scope';
11
12
  export type RemoveInfo = {
12
13
  removed: boolean;
13
14
  /**
14
15
  * whether to remove the component from default lane once merged
15
16
  */
16
17
  removeOnMain?: boolean;
18
+ /**
19
+ * Semver range to mark specific versions as deleted
20
+ */
21
+ range?: string;
22
+ };
23
+ export type DeleteOpts = {
24
+ updateMain?: boolean;
25
+ range?: string;
17
26
  };
18
27
  export declare class RemoveMain {
19
28
  private workspace;
29
+ private scope;
20
30
  logger: Logger;
21
31
  private importer;
22
32
  private depResolver;
23
- constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, depResolver: DependencyResolverMain);
33
+ constructor(workspace: Workspace, scope: ScopeMain, logger: Logger, importer: ImporterMain, depResolver: DependencyResolverMain);
24
34
  remove({ componentsPattern, force, remote, track, deleteFiles, }: {
25
35
  componentsPattern: string;
26
36
  force?: boolean;
@@ -36,9 +46,7 @@ export declare class RemoveMain {
36
46
  reasonForRemoval?: string;
37
47
  }): Promise<RemoveComponentsResult>;
38
48
  private markRemoveComps;
39
- deleteComps(componentsPattern: string, opts?: {
40
- updateMain?: boolean;
41
- }): Promise<Component[]>;
49
+ deleteComps(componentsPattern: string, opts?: DeleteOpts): Promise<Component[]>;
42
50
  /**
43
51
  * recover a soft-removed component.
44
52
  * there are 4 different scenarios.
@@ -53,8 +61,16 @@ export declare class RemoveMain {
53
61
  */
54
62
  recover(compIdStr: string, options: RecoverOptions): Promise<boolean>;
55
63
  private throwForMainComponentWhenOnLane;
56
- getRemoveInfo(component: Component): RemoveInfo;
57
- isRemoved(component: Component): boolean;
64
+ getRemoveInfo(component: Component): Promise<RemoveInfo>;
65
+ private getHeadComponent;
66
+ /**
67
+ * @deprecated use `isDeleted` instead.
68
+ */
69
+ isRemoved(component: Component): Promise<boolean>;
70
+ /**
71
+ * whether a component is marked as deleted.
72
+ */
73
+ isDeleted(component: Component): Promise<boolean>;
58
74
  /**
59
75
  * performant version of isRemoved() in case the component object is not available and loading it is expensive.
60
76
  */
@@ -72,8 +88,9 @@ export declare class RemoveMain {
72
88
  static slots: never[];
73
89
  static dependencies: import("@teambit/harmony").Aspect[];
74
90
  static runtime: import("@teambit/harmony").RuntimeDefinition;
75
- static provider([workspace, cli, loggerMain, componentAspect, importerMain, depResolver, issues]: [
91
+ static provider([workspace, scope, cli, loggerMain, componentAspect, importerMain, depResolver, issues]: [
76
92
  Workspace,
93
+ ScopeMain,
77
94
  CLIMain,
78
95
  LoggerMain,
79
96
  ComponentMain,
@@ -11,6 +11,13 @@ function _cli() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _semver() {
15
+ const data = _interopRequireDefault(require("semver"));
16
+ _semver = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _logger() {
15
22
  const data = require("@teambit/logger");
16
23
  _logger = function () {
@@ -172,14 +179,22 @@ function _deleteCmd() {
172
179
  };
173
180
  return data;
174
181
  }
182
+ function _scope() {
183
+ const data = _interopRequireDefault(require("@teambit/scope"));
184
+ _scope = function () {
185
+ return data;
186
+ };
187
+ return data;
188
+ }
175
189
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
176
190
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
177
191
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
178
192
  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); }
179
193
  const BEFORE_REMOVE = 'removing components';
180
194
  class RemoveMain {
181
- constructor(workspace, logger, importer, depResolver) {
195
+ constructor(workspace, scope, logger, importer, depResolver) {
182
196
  this.workspace = workspace;
197
+ this.scope = scope;
183
198
  this.logger = logger;
184
199
  this.importer = importer;
185
200
  this.depResolver = depResolver;
@@ -226,20 +241,29 @@ class RemoveMain {
226
241
  await this.workspace.bitMap.write(`remove (by ${reasonForRemoval || 'N/A'})`);
227
242
  return results;
228
243
  }
229
- async markRemoveComps(componentIds, shouldUpdateMain = false) {
230
- const components = await this.workspace.getMany(componentIds);
231
- await (0, _packageJsonUtils().removeComponentsFromNodeModules)(this.workspace.consumer, components.map(c => c.state._consumer));
244
+ async markRemoveComps(componentIds, {
245
+ updateMain,
246
+ range
247
+ }) {
248
+ const allComponentsToMarkDeleted = await this.workspace.getMany(componentIds);
249
+ const componentsToDeleteFromFs = range ? [] : allComponentsToMarkDeleted;
250
+ const componentsIdsToDeleteFromFs = _componentId().ComponentIdList.fromArray(componentsToDeleteFromFs.map(c => c.id));
251
+ await (0, _packageJsonUtils().removeComponentsFromNodeModules)(this.workspace.consumer, componentsToDeleteFromFs.map(c => c.state._consumer));
232
252
  // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted
233
253
  // during this removal along with the entire component dir.
254
+ // in case this is range, the "removed" property is set to false. even when the range overlap the current version.
255
+ // the reason is that if we set it to true, then, the component is considered as "deleted" for *all* versions.
256
+ // remember that this config is always passed to the next version and if we set removed: true, it'll be copied
257
+ // to the next version even when that version is not in the range.
234
258
  const config = {
235
- removed: true
259
+ removed: !range
236
260
  };
237
- if (shouldUpdateMain) config.removeOnMain = true;
238
- componentIds.map(compId => this.workspace.bitMap.addComponentConfig(compId, _remove().RemoveAspect.id, config));
261
+ if (updateMain) config.removeOnMain = true;
262
+ if (range) config.range = range;
263
+ componentIds.forEach(compId => this.workspace.bitMap.addComponentConfig(compId, _remove().RemoveAspect.id, config));
239
264
  await this.workspace.bitMap.write('delete');
240
- const bitIds = _componentId().ComponentIdList.fromArray(componentIds);
241
- await (0, _deleteComponentFiles().default)(this.workspace.consumer, bitIds);
242
- return components;
265
+ await (0, _deleteComponentFiles().default)(this.workspace.consumer, componentsIdsToDeleteFromFs);
266
+ return componentsToDeleteFromFs;
243
267
  }
244
268
  async deleteComps(componentsPattern, opts = {}) {
245
269
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
@@ -255,7 +279,10 @@ class RemoveMain {
255
279
  if (!updateMain && currentLane?.isNew) {
256
280
  throw new Error('no need to delete components from an un-exported lane, you can remove them by running "bit remove"');
257
281
  }
258
- return this.markRemoveComps(componentIds, updateMain);
282
+ if (currentLane && !updateMain && opts.range) {
283
+ throw new (_bitError().BitError)(`--range is not needed when deleting components from a lane, unless --update-main is used`);
284
+ }
285
+ return this.markRemoveComps(componentIds, opts);
259
286
  }
260
287
 
261
288
  /**
@@ -308,7 +335,8 @@ class RemoveMain {
308
335
  // case #4
309
336
  const compId = bitMapEntry.id;
310
337
  const comp = await this.workspace.get(compId);
311
- if (!this.isRemoved(comp)) {
338
+ const removeInfo = await this.getRemoveInfo(comp);
339
+ if (!removeInfo.removed && !removeInfo.range) {
312
340
  return false;
313
341
  }
314
342
  await setAsRemovedFalse(compId);
@@ -319,7 +347,7 @@ class RemoveMain {
319
347
  const idOnLane = currentLane?.getComponent(compId);
320
348
  const compIdWithPossibleVer = idOnLane ? compId.changeVersion(idOnLane.head.toString()) : compId;
321
349
  const compFromScope = await this.workspace.scope.get(compIdWithPossibleVer);
322
- if (compFromScope && this.isRemoved(compFromScope)) {
350
+ if (compFromScope && (await this.isDeleted(compFromScope))) {
323
351
  // case #2 and #3
324
352
  await importComp(compIdWithPossibleVer._legacy.toString());
325
353
  await setAsRemovedFalse(compIdWithPossibleVer);
@@ -335,7 +363,7 @@ class RemoveMain {
335
363
  }
336
364
  throw err;
337
365
  }
338
- if (!this.isRemoved(comp)) {
366
+ if (!(await this.isDeleted(comp))) {
339
367
  return false;
340
368
  }
341
369
  await importComp(compId._legacy.toString());
@@ -352,14 +380,42 @@ class RemoveMain {
352
380
  ${mainComps.map(c => c.id.toString()).join('\n')}`);
353
381
  }
354
382
  }
355
- getRemoveInfo(component) {
356
- const data = component.config.extensions.findExtension(_remove().RemoveAspect.id)?.config;
383
+ async getRemoveInfo(component) {
384
+ const headComponent = await this.getHeadComponent(component);
385
+ const data = headComponent.config.extensions.findExtension(_remove().RemoveAspect.id)?.config;
386
+ const isDeletedByRange = () => {
387
+ if (!data?.range) return false;
388
+ const currentTag = component.getTag();
389
+ return Boolean(currentTag && _semver().default.satisfies(currentTag.version, data.range));
390
+ };
357
391
  return {
358
- removed: data?.removed || false
392
+ removed: data?.removed || isDeletedByRange() || false,
393
+ range: data?.range
359
394
  };
360
395
  }
361
- isRemoved(component) {
362
- return this.getRemoveInfo(component).removed;
396
+ async getHeadComponent(component) {
397
+ if (component.id.version && component.head && component.id.version !== component.head?.hash && component.id.version !== component.headTag?.version.version) {
398
+ const headComp = this.workspace // if workspace exits, prefer using the workspace as it may be modified
399
+ ? await this.workspace.get(component.id.changeVersion(undefined)) : await this.scope.get(component.id.changeVersion(component.head.hash));
400
+ if (!headComp) throw new Error(`unable to get the head of ${component.id.toString()}`);
401
+ return headComp;
402
+ }
403
+ return component;
404
+ }
405
+
406
+ /**
407
+ * @deprecated use `isDeleted` instead.
408
+ */
409
+ async isRemoved(component) {
410
+ return this.isDeleted(component);
411
+ }
412
+
413
+ /**
414
+ * whether a component is marked as deleted.
415
+ */
416
+ async isDeleted(component) {
417
+ const removeInfo = await this.getRemoveInfo(component);
418
+ return removeInfo.removed;
363
419
  }
364
420
 
365
421
  /**
@@ -372,9 +428,8 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
372
428
  if (bitmapEntry && bitmapEntry.isRecovered()) return false;
373
429
  const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId);
374
430
  if (!modelComp) return false;
375
- const versionObj = await this.workspace.scope.getBitObjectVersion(modelComp, componentId.version);
376
- if (!versionObj) return false;
377
- return versionObj.isRemoved();
431
+ const isRemoved = await modelComp.isRemoved(this.workspace.scope.legacyScope.objects, componentId.version);
432
+ return Boolean(isRemoved);
378
433
  }
379
434
 
380
435
  /**
@@ -412,7 +467,7 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
412
467
  const laneCompIdsNotInWorkspace = laneIds.filter(id => !workspaceIds.find(wId => wId.isEqualWithoutVersion(id)));
413
468
  if (!laneCompIdsNotInWorkspace.length) return [];
414
469
  const comps = await this.workspace.scope.getMany(laneCompIdsNotInWorkspace);
415
- const removed = comps.filter(c => this.isRemoved(c));
470
+ const removed = comps.filter(c => this.isDeleted(c));
416
471
  const staged = await Promise.all(removed.map(async c => {
417
472
  const snapDistance = await this.workspace.scope.getSnapDistance(c.id, false);
418
473
  if (snapDistance.err) {
@@ -435,9 +490,9 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
435
490
  }
436
491
  return [_componentId().ComponentID.fromString(componentsPattern)];
437
492
  }
438
- static async provider([workspace, cli, loggerMain, componentAspect, importerMain, depResolver, issues]) {
493
+ static async provider([workspace, scope, cli, loggerMain, componentAspect, importerMain, depResolver, issues]) {
439
494
  const logger = loggerMain.createLogger(_remove().RemoveAspect.id);
440
- const removeMain = new RemoveMain(workspace, logger, importerMain, depResolver);
495
+ const removeMain = new RemoveMain(workspace, scope, logger, importerMain, depResolver);
441
496
  issues.registerAddComponentsIssues(removeMain.addRemovedDependenciesIssues.bind(removeMain));
442
497
  componentAspect.registerShowFragments([new (_remove2().RemoveFragment)(removeMain)]);
443
498
  cli.register(new (_removeCmd().RemoveCmd)(removeMain, workspace), new (_deleteCmd().DeleteCmd)(removeMain, workspace), new (_recoverCmd().RecoverCmd)(removeMain));
@@ -446,7 +501,7 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
446
501
  }
447
502
  exports.RemoveMain = RemoveMain;
448
503
  _defineProperty(RemoveMain, "slots", []);
449
- _defineProperty(RemoveMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _component().ComponentAspect, _importer().ImporterAspect, _dependencyResolver().DependencyResolverAspect, _issues().IssuesAspect]);
504
+ _defineProperty(RemoveMain, "dependencies", [_workspace().WorkspaceAspect, _scope().default, _cli().CLIAspect, _logger().LoggerAspect, _component().ComponentAspect, _importer().ImporterAspect, _dependencyResolver().DependencyResolverAspect, _issues().IssuesAspect]);
450
505
  _defineProperty(RemoveMain, "runtime", _cli().MainRuntime);
451
506
  _remove().RemoveAspect.addRuntime(RemoveMain);
452
507
  var _default = exports.default = RemoveMain;
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_workspace","_componentId","_exceptions","_importer","_lodash","_hasWildcard","_interopRequireDefault","_listScope","_bitError","_deleteComponentFiles","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_noHeadNoVersion","_component","_packageJsonUtils","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","importer","depResolver","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","shouldUpdateMain","components","getMany","removeComponentsFromNodeModules","map","c","state","_consumer","config","removed","removeOnMain","compId","addComponentConfig","RemoveAspect","id","deleteComponentsFiles","deleteComps","opts","ConsumerNotFound","idsByPattern","newComps","filter","hasVersion","length","BitError","toString","join","currentLane","getCurrentLaneObject","updateMain","isNew","Error","recover","compIdStr","options","bitMapEntry","find","compMap","fullName","toStringWithoutVersion","importComp","idStr","import","installNpmPackages","skipDependencyInstallation","writeConfigFiles","skipWriteConfigFiles","override","setAsRemovedFalse","addSpecificComponentConfig","compFromScope","scope","get","rootDir","removeComponentConfig","comp","isRemoved","resolveComponentId","idOnLane","getComponent","compIdWithPossibleVer","changeVersion","head","_legacy","getRemoteComponent","err","NoHeadNoVersion","throwForMainComponentWhenOnLane","laneComps","toBitIds","mainComps","hasWithoutVersion","getRemoveInfo","component","extensions","findExtension","isRemovedByIdWithoutLoadingComponent","componentId","bitmapEntry","getBitmapEntryIfExist","isRecovered","modelComp","getBitObjectModelComponent","versionObj","getBitObjectVersion","version","getRemovedStaged","isOnMain","getRemovedStagedFromMain","getRemovedStagedFromLane","addRemovedDependenciesIssues","pMapSeries","addRemovedDepIssue","dependencies","getComponentDependencies","removedWithUndefined","Promise","all","dep","undefined","compact","issues","getOrCreate","IssuesClasses","RemovedDependencies","stagedConfig","getStagedConfig","getAll","compConfig","laneIds","toComponentIds","workspaceIds","listIds","laneCompIdsNotInWorkspace","wId","isEqualWithoutVersion","comps","staged","snapDistance","getSnapDistance","warn","name","isSourceAhead","hasWildcard","getRemoteBitIdsByWildcards","ComponentID","fromString","provider","cli","loggerMain","componentAspect","importerMain","createLogger","removeMain","registerAddComponentsIssues","bind","registerShowFragments","RemoveFragment","register","RemoveCmd","DeleteCmd","RecoverCmd","exports","WorkspaceAspect","CLIAspect","LoggerAspect","ComponentAspect","ImporterAspect","DependencyResolverAspect","IssuesAspect","MainRuntime","addRuntime","_default"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { compact } from 'lodash';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { NoHeadNoVersion } from '@teambit/legacy/dist/scope/exceptions/no-head-no-version';\nimport { ComponentAspect, Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { RemoveComponentsResult, removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport { RecoverCmd, RecoverOptions } from './recover-cmd';\nimport { DeleteCmd } from './delete-cmd';\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\nexport class RemoveMain {\n constructor(\n private workspace: Workspace,\n public logger: Logger,\n private importer: ImporterMain,\n private depResolver: DependencyResolverMain\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(componentIds: ComponentID[], shouldUpdateMain = false): Promise<Component[]> {\n const components = await this.workspace.getMany(componentIds);\n await removeComponentsFromNodeModules(\n this.workspace.consumer,\n components.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 const config: RemoveInfo = { removed: true };\n if (shouldUpdateMain) config.removeOnMain = true;\n componentIds.map((compId) => this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, config));\n await this.workspace.bitMap.write('delete');\n const bitIds = ComponentIdList.fromArray(componentIds);\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return components;\n }\n\n async deleteComps(componentsPattern: string, opts: { updateMain?: boolean } = {}): 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\n return this.markRemoveComps(componentIds, updateMain);\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 if (!this.isRemoved(comp)) {\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 && this.isRemoved(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 (!this.isRemoved(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 getRemoveInfo(component: Component): RemoveInfo {\n const data = component.config.extensions.findExtension(RemoveAspect.id)?.config as RemoveInfo | undefined;\n return {\n removed: data?.removed || false,\n };\n }\n\n isRemoved(component: Component): boolean {\n return this.getRemoveInfo(component).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);\n if (!modelComp) return false;\n const versionObj = await this.workspace.scope.getBitObjectVersion(modelComp, componentId.version as string);\n if (!versionObj) return false;\n return versionObj.isRemoved();\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 await pMapSeries(components, async (component) => {\n await this.addRemovedDepIssue(component);\n });\n }\n\n private async addRemovedDepIssue(component: Component) {\n const dependencies = await this.depResolver.getComponentDependencies(component);\n const removedWithUndefined = await Promise.all(\n dependencies.map(async (dep) => {\n const isRemoved = await this.isRemovedByIdWithoutLoadingComponent(dep.componentId);\n if (isRemoved) return dep.componentId;\n return undefined;\n })\n );\n const removed = compact(removedWithUndefined).map((id) => id.toString());\n if (removed.length) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedDependencies).data = removed;\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.isRemoved(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 getRemoteBitIdsByWildcards(componentsPattern);\n }\n return [ComponentID.fromString(componentsPattern)];\n }\n\n static slots = [];\n static dependencies = [\n WorkspaceAspect,\n CLIAspect,\n LoggerAspect,\n ComponentAspect,\n ImporterAspect,\n DependencyResolverAspect,\n IssuesAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain, componentAspect, importerMain, depResolver, issues]: [\n Workspace,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain,\n DependencyResolverMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger, importerMain, depResolver);\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":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,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AC;AAAC,IAAAuL,QAAA,GAAAV,OAAA,CAAAnM,OAAA,GAErBsB,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_semver","_interopRequireDefault","_logger","_workspace","_componentId","_exceptions","_importer","_lodash","_hasWildcard","_listScope","_bitError","_deleteComponentFiles","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_noHeadNoVersion","_component","_packageJsonUtils","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","_scope","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","BEFORE_REMOVE","RemoveMain","constructor","workspace","scope","logger","importer","depResolver","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","allComponentsToMarkDeleted","getMany","componentsToDeleteFromFs","componentsIdsToDeleteFromFs","map","c","id","removeComponentsFromNodeModules","state","_consumer","config","removed","removeOnMain","forEach","compId","addComponentConfig","RemoveAspect","deleteComponentsFiles","deleteComps","opts","ConsumerNotFound","idsByPattern","newComps","filter","hasVersion","length","BitError","toString","join","currentLane","getCurrentLaneObject","isNew","Error","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","_legacy","getRemoteComponent","err","NoHeadNoVersion","throwForMainComponentWhenOnLane","laneComps","toBitIds","mainComps","hasWithoutVersion","component","headComponent","getHeadComponent","extensions","findExtension","isDeletedByRange","currentTag","getTag","Boolean","semver","satisfies","version","hash","headTag","headComp","undefined","isRemoved","isRemovedByIdWithoutLoadingComponent","componentId","bitmapEntry","getBitmapEntryIfExist","isRecovered","modelComp","getBitObjectModelComponent","legacyScope","objects","getRemovedStaged","isOnMain","getRemovedStagedFromMain","getRemovedStagedFromLane","addRemovedDependenciesIssues","pMapSeries","addRemovedDepIssue","dependencies","getComponentDependencies","removedWithUndefined","Promise","all","dep","compact","issues","getOrCreate","IssuesClasses","RemovedDependencies","stagedConfig","getStagedConfig","getAll","compConfig","laneIds","toComponentIds","workspaceIds","listIds","laneCompIdsNotInWorkspace","wId","isEqualWithoutVersion","comps","staged","snapDistance","getSnapDistance","warn","name","isSourceAhead","hasWildcard","getRemoteBitIdsByWildcards","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","MainRuntime","addRuntime","_default"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { compact } from 'lodash';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { NoHeadNoVersion } from '@teambit/legacy/dist/scope/exceptions/no-head-no-version';\nimport { ComponentAspect, Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { RemoveComponentsResult, removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport { RecoverCmd, RecoverOptions } from './recover-cmd';\nimport { DeleteCmd } from './delete-cmd';\nimport ScopeAspect, { ScopeMain } from '@teambit/scope';\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\nexport type DeleteOpts = { updateMain?: boolean; range?: 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 ) {}\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(componentIds: ComponentID[], { updateMain, range }: DeleteOpts): Promise<Component[]> {\n const allComponentsToMarkDeleted = await this.workspace.getMany(componentIds);\n\n const componentsToDeleteFromFs = range ? [] : 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 };\n if (updateMain) config.removeOnMain = true;\n if (range) config.range = range;\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\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) {\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\n return {\n removed: data?.removed || isDeletedByRange() || false,\n range: data?.range,\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);\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 /**\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 await pMapSeries(components, async (component) => {\n await this.addRemovedDepIssue(component);\n });\n }\n\n private async addRemovedDepIssue(component: Component) {\n const dependencies = await this.depResolver.getComponentDependencies(component);\n const removedWithUndefined = await Promise.all(\n dependencies.map(async (dep) => {\n const isRemoved = await this.isRemovedByIdWithoutLoadingComponent(dep.componentId);\n if (isRemoved) return dep.componentId;\n return undefined;\n })\n );\n const removed = compact(removedWithUndefined).map((id) => id.toString());\n if (removed.length) {\n component.state.issues.getOrCreate(IssuesClasses.RemovedDependencies).data = removed;\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 getRemoteBitIdsByWildcards(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 ];\n static runtime = MainRuntime;\n\n static async provider([workspace, scope, cli, loggerMain, componentAspect, importerMain, depResolver, issues]: [\n Workspace,\n ScopeMain,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain,\n DependencyResolverMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, scope, logger, importerMain, depResolver);\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":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA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