@teambit/remove 1.0.107 → 1.0.108

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.
package/delete-cmd.ts ADDED
@@ -0,0 +1,109 @@
1
+ import chalk from 'chalk';
2
+ import yesno from 'yesno';
3
+ import { Command, CommandOptions } from '@teambit/cli';
4
+ import { Workspace } from '@teambit/workspace';
5
+ import { BitError } from '@teambit/bit-error';
6
+ import RemovedObjects from '@teambit/legacy/dist/scope/removed-components';
7
+ import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
8
+ import { RemoveMain } from './remove.main.runtime';
9
+ import { removeTemplate } from './remove-template';
10
+
11
+ export class DeleteCmd implements Command {
12
+ name = 'delete <component-pattern>';
13
+ description = 'mark components as deleted on the remote';
14
+ extendedDescription = `to remove components from your local workspace only, use "bit remove" command.
15
+ 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.
16
+ `;
17
+ arguments = [
18
+ {
19
+ name: 'component-pattern',
20
+ description: COMPONENT_PATTERN_HELP,
21
+ },
22
+ ];
23
+ group = 'collaborate';
24
+ helpUrl = 'reference/components/removing-components';
25
+ skipWorkspace = true;
26
+ alias = '';
27
+ options = [
28
+ ['', 'lane', 'when on a lane, delete the component from this lane only. avoid merging it to main or other lanes'],
29
+ ['', 'update-main', 'EXPERIMENTAL. delete component/s on the main lane after merging this lane into main'],
30
+ ['s', 'silent', 'skip confirmation'],
31
+ [
32
+ '',
33
+ 'hard',
34
+ 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.',
35
+ ],
36
+ [
37
+ 'f',
38
+ 'force',
39
+ 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt',
40
+ ],
41
+ ] as CommandOptions;
42
+ loader = true;
43
+ migration = true;
44
+ remoteOp = true;
45
+
46
+ constructor(private remove: RemoveMain, private workspace?: Workspace) {}
47
+
48
+ async report(
49
+ [componentsPattern]: [string],
50
+ {
51
+ force = false,
52
+ lane = false,
53
+ updateMain = false,
54
+ hard = false,
55
+ silent = false,
56
+ }: {
57
+ force?: boolean;
58
+ lane?: boolean;
59
+ updateMain?: boolean;
60
+ hard?: boolean;
61
+ silent?: boolean;
62
+ }
63
+ ) {
64
+ if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {
65
+ throw new BitError(`error: to delete components when on a lane, use --lane flag`);
66
+ }
67
+ if (this.workspace?.isOnMain() && updateMain) {
68
+ throw new BitError(`--update-main is relevant only when on a lane`);
69
+ }
70
+
71
+ if (!silent) {
72
+ await this.removePrompt(hard);
73
+ }
74
+
75
+ if (hard) {
76
+ const { localResult, remoteResult = [] } = await this.remove.remove({ componentsPattern, remote: true, force });
77
+ // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
78
+ let localMessage = removeTemplate(localResult, false);
79
+ if (localMessage !== '') localMessage += '\n';
80
+ return `${localMessage}${this.paintArray(remoteResult)}`;
81
+ }
82
+
83
+ const removedCompIds = await this.remove.deleteComps(componentsPattern, { updateMain });
84
+ return `${chalk.green('successfully deleted the following components:')}
85
+ ${removedCompIds.join('\n')}
86
+
87
+ ${chalk.bold('to update the remote, please tag/snap and then export. to revert, please use "bit recover"')}`;
88
+ }
89
+
90
+ private paintArray(removedObjectsArray: RemovedObjects[]) {
91
+ return removedObjectsArray.map((item) => removeTemplate(item, true));
92
+ }
93
+
94
+ private async removePrompt(hard?: boolean) {
95
+ this.remove.logger.clearStatusLine();
96
+ const remoteOrLocalOutput = hard
97
+ ? `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 deleted`
98
+ : `this command will mark the component as deleted, and it won’t be shown on the remote scope after tag/snap and export.
99
+ if your intent, is to remove the component only from your local workspace, refer to bit remove.`;
100
+
101
+ const ok = await yesno({
102
+ question: `${remoteOrLocalOutput}
103
+ ${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,
104
+ });
105
+ if (!ok) {
106
+ throw new BitError('the operation has been canceled');
107
+ }
108
+ }
109
+ }
@@ -19,7 +19,7 @@ export declare class DeleteCmd implements Command {
19
19
  loader: boolean;
20
20
  migration: boolean;
21
21
  remoteOp: boolean;
22
- constructor(remove: RemoveMain, workspace?: Workspace | undefined);
22
+ constructor(remove: RemoveMain, workspace?: Workspace);
23
23
  report([componentsPattern]: [string], { force, lane, updateMain, hard, silent, }: {
24
24
  force?: boolean;
25
25
  lane?: boolean;
@@ -72,11 +72,10 @@ this command marks the components as deleted, and after snap/tag and export they
72
72
  hard = false,
73
73
  silent = false
74
74
  }) {
75
- var _this$workspace, _this$workspace2;
76
- if ((_this$workspace = this.workspace) !== null && _this$workspace !== void 0 && _this$workspace.isOnLane() && !hard && !lane && !updateMain) {
75
+ if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {
77
76
  throw new (_bitError().BitError)(`error: to delete components when on a lane, use --lane flag`);
78
77
  }
79
- if ((_this$workspace2 = this.workspace) !== null && _this$workspace2 !== void 0 && _this$workspace2.isOnMain() && updateMain) {
78
+ if (this.workspace?.isOnMain() && updateMain) {
80
79
  throw new (_bitError().BitError)(`--update-main is relevant only when on a lane`);
81
80
  }
82
81
  if (!silent) {
@@ -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","String","r","e","Symbol","toPrimitive","call","TypeError","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","_this$workspace","_this$workspace2","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","removedCompIds","deleteComps","chalk","green","join","bold","removedObjectsArray","map","item","logger","clearStatusLine","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 migration = 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);\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 removedCompIds = await this.remove.deleteComps(componentsPattern, { updateMain });\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) {\n this.remove.logger.clearStatusLine();\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 deleted`\n : `this command will mark the component as deleted, and it won’t be shown on the remote scope after tag/snap and export.\nif your intent, is to remove the component only from your local workspace, refer to bit remove.`;\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,GAA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,2CAA2C,CAAE;IACtD,CAAC,CAAC;IACF,IAAI,CAACO,EAAE,EAAE;MACP,MAAM,KAAIrB,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACwB,OAAA,CAAAzC,SAAA,GAAAA,SAAA"}
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","String","r","e","Symbol","toPrimitive","call","TypeError","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","removedCompIds","deleteComps","chalk","green","join","bold","removedObjectsArray","map","item","logger","clearStatusLine","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 migration = 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);\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 removedCompIds = await this.remove.deleteComps(componentsPattern, { updateMain });\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) {\n this.remove.logger.clearStatusLine();\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 deleted`\n : `this command will mark the component as deleted, and it won’t be shown on the remote scope after tag/snap and export.\nif your intent, is to remove the component only from your local workspace, refer to bit remove.`;\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,MAAAN,IAAA,GAAAE,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAA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CAACG,IAAI,CAAC,4FAA4F,CAAE,EAAC;EAC1G;EAEQN,UAAUA,CAACO,mBAAqC,EAAE;IACxD,OAAOA,mBAAmB,CAACC,GAAG,CAAEC,IAAI,IAAK,IAAAV,gCAAc,EAACU,IAAI,EAAE,IAAI,CAAC,CAAC;EACtE;EAEA,MAAcf,YAAYA,CAACL,IAAc,EAAE;IACzC,IAAI,CAACV,MAAM,CAAC+B,MAAM,CAACC,eAAe,CAAC,CAAC;IACpC,MAAMC,mBAAmB,GAAGvB,IAAI,GAC3B,+JAA8J,GAC9J;AACT,gGAAgG;IAE5F,MAAMwB,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,KAAIrB,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACwB,OAAA,CAAAvC,SAAA,GAAAA,SAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Command, CommandOptions } from '@teambit/cli';
2
2
  import { RemoveMain } from './remove.main.runtime';
3
- export declare type RecoverOptions = {
3
+ export type RecoverOptions = {
4
4
  skipDependencyInstallation?: boolean;
5
5
  skipWriteConfigFiles?: boolean;
6
6
  };
@@ -19,7 +19,7 @@ export declare class RemoveCmd implements Command {
19
19
  loader: boolean;
20
20
  migration: boolean;
21
21
  remoteOp: boolean;
22
- constructor(remove: RemoveMain, workspace?: Workspace | undefined);
22
+ constructor(remove: RemoveMain, workspace?: Workspace);
23
23
  report([componentsPattern]: [string], { force, track, silent, keepFiles, }: {
24
24
  force?: boolean;
25
25
  track?: boolean;
@@ -2,7 +2,7 @@ import { Consumer } from '@teambit/legacy/dist/consumer';
2
2
  import { ComponentIdList } from '@teambit/component-id';
3
3
  import RemovedObjects from '@teambit/legacy/dist/scope/removed-components';
4
4
  import { RemovedLocalObjects } from './removed-local-objects';
5
- export declare type RemoveComponentsResult = {
5
+ export type RemoveComponentsResult = {
6
6
  localResult: RemovedLocalObjects;
7
7
  remoteResult: RemovedObjects[];
8
8
  };
@@ -182,7 +182,7 @@ async function removeRemote(consumer, bitIds, force) {
182
182
  const context = {};
183
183
  (0, _enrichContextFromGlobal().default)(context);
184
184
  const removeP = Object.keys(groupedBitsByScope).map(async key => {
185
- const resolvedRemote = await remotes.resolve(key, consumer === null || consumer === void 0 ? void 0 : consumer.scope);
185
+ const resolvedRemote = await remotes.resolve(key, consumer?.scope);
186
186
  const idsStr = groupedBitsByScope[key].map(id => id.toStringWithoutVersion());
187
187
  return resolvedRemote.deleteMany(idsStr, force, context);
188
188
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_groupArray","data","_interopRequireDefault","require","_lodash","_ramda","_componentId","_constants","_generalError","_enrichContextFromGlobal","_logger","_http","_remotes","_scopeRemotes","_deleteComponentFiles","_componentsList","_consumerComponent","packageJsonUtils","_interopRequireWildcard","_pMapSeries","_removedLocalObjects","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","removeComponents","consumer","ids","force","remote","track","deleteFiles","logger","debugAndAddBreadCrumb","toString","bitIdsLatest","ComponentIdList","fromArray","map","id","changeVersion","LATEST_BIT_VERSION","localIds","remoteIds","partition","isLocal","length","GeneralError","join","remoteResult","R","isEmpty","removeRemote","localResult","removeLocal","RemovedLocalObjects","bitIds","groupedBitsByScope","groupArray","remotes","getScopeRemotes","scope","Remotes","getGlobalRemotes","shouldGoToCentralHub","keys","http","Http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","deleteViaCentralHub","idsAreLanes","context","enrichContextFromGlobal","removeP","key","resolvedRemote","resolve","idsStr","toStringWithoutVersion","deleteMany","Promise","all","modifiedComponents","nonModifiedComponents","pMapSeries","componentStatus","getComponentStatusById","modified","push","err","Component","isComponentInvalidByErrorType","idsToRemove","componentsList","ComponentsList","newComponents","listNewComponents","idsToRemoveFromScope","filter","hasWithoutVersion","idsToCleanFromWorkspace","components","componentsToRemove","invalidComponents","loadComponents","removedComponentIds","missingComponents","dependentBits","removedFromLane","removeMany","deleteComponentsFiles","invalidComponentsIds","removedComponents","c","removeComponentsFromWorkspacesAndDependencies","cleanFromBitMap","uniqFromArray"],"sources":["remove-components.ts"],"sourcesContent":["import groupArray from 'group-array';\nimport partition from 'lodash.partition';\nimport R from 'ramda';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, LATEST_BIT_VERSION } from '@teambit/legacy/dist/constants';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport enrichContextFromGlobal from '@teambit/legacy/dist/hooks/utils/enrich-context-from-global';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Http } from '@teambit/legacy/dist/scope/network/http';\nimport { Remotes } from '@teambit/legacy/dist/remotes';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport pMapSeries from 'p-map-series';\nimport { RemovedLocalObjects } from './removed-local-objects';\n\nexport type RemoveComponentsResult = { localResult: RemovedLocalObjects; remoteResult: RemovedObjects[] };\n\n/**\n * Remove components local and remote\n * splits array of ids into local and remote and removes according to flags\n * @param {string[]} ids - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} remote - delete component from a remote scope\n * @param {boolean} track - keep tracking local staged components in bitmap.\n * @param {boolean} deleteFiles - delete local added files from fs.\n */\nexport async function removeComponents({\n consumer,\n ids,\n force,\n remote,\n track,\n deleteFiles,\n}: {\n consumer: Consumer | null | undefined; // when remote is false, it's always set\n ids: ComponentIdList;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n}): Promise<RemoveComponentsResult> {\n logger.debugAndAddBreadCrumb('removeComponents', `{ids}. force: ${force.toString()}`, { ids: ids.toString() });\n // added this to remove support for remove only one version from a component\n const bitIdsLatest = ComponentIdList.fromArray(\n ids.map((id) => {\n return id.changeVersion(LATEST_BIT_VERSION);\n })\n );\n const [localIds, remoteIds] = partition(bitIdsLatest, (id) => id.isLocal());\n if (remote && localIds.length) {\n throw new GeneralError(\n `unable to remove the remote components: ${localIds.join(',')} as they don't contain a scope-name`\n );\n }\n const remoteResult = remote && !R.isEmpty(remoteIds) ? await removeRemote(consumer, remoteIds, force) : [];\n const localResult = !remote\n ? await removeLocal(consumer as Consumer, bitIdsLatest, force, track, deleteFiles)\n : new RemovedLocalObjects();\n\n return { localResult, remoteResult };\n}\n\n/**\n * Remove remote component from ssh server\n * this method groups remote components by remote name and deletes remote components together\n * @param {ComponentIdList} bitIds - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n */\nasync function removeRemote(\n consumer: Consumer | null | undefined,\n bitIds: ComponentIdList,\n force: boolean\n): Promise<RemovedObjects[]> {\n const groupedBitsByScope = groupArray(bitIds, 'scope');\n const remotes = consumer ? await getScopeRemotes(consumer.scope) : await Remotes.getGlobalRemotes();\n const shouldGoToCentralHub = remotes.shouldGoToCentralHub(Object.keys(groupedBitsByScope));\n if (shouldGoToCentralHub) {\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n return http.deleteViaCentralHub(\n bitIds.map((id) => id.toString()),\n { force, idsAreLanes: false }\n );\n }\n const context = {};\n enrichContextFromGlobal(context);\n const removeP = Object.keys(groupedBitsByScope).map(async (key) => {\n const resolvedRemote = await remotes.resolve(key, consumer?.scope);\n const idsStr = groupedBitsByScope[key].map((id) => id.toStringWithoutVersion());\n return resolvedRemote.deleteMany(idsStr, force, context);\n });\n\n return Promise.all(removeP);\n}\n\n/**\n * removeLocal - remove local (imported, new staged components) from modules and bitmap according to flags\n * @param {ComponentIdList} bitIds - list of component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} deleteFiles - delete component that are used by other components.\n */\nasync function removeLocal(\n consumer: Consumer,\n bitIds: ComponentIdList,\n force: boolean,\n track: boolean,\n deleteFiles: boolean\n): Promise<RemovedLocalObjects> {\n // local remove in case user wants to delete tagged components\n const modifiedComponents = new ComponentIdList();\n const nonModifiedComponents = new ComponentIdList();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (R.isEmpty(bitIds)) return new RemovedLocalObjects();\n if (!force) {\n await pMapSeries(bitIds, async (id) => {\n try {\n const componentStatus = await consumer.getComponentStatusById(id);\n if (componentStatus.modified) modifiedComponents.push(id);\n else nonModifiedComponents.push(id);\n } catch (err: any) {\n // if a component has an error, such as, missing main file, we do want to allow removing that component\n if (Component.isComponentInvalidByErrorType(err)) {\n nonModifiedComponents.push(id);\n } else {\n throw err;\n }\n }\n });\n }\n const idsToRemove = force ? bitIds : nonModifiedComponents;\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents(false)) as ComponentIdList;\n const idsToRemoveFromScope = ComponentIdList.fromArray(\n idsToRemove.filter((id) => !newComponents.hasWithoutVersion(id))\n );\n const idsToCleanFromWorkspace = ComponentIdList.fromArray(\n idsToRemove.filter((id) => newComponents.hasWithoutVersion(id))\n );\n const { components: componentsToRemove, invalidComponents } = await consumer.loadComponents(idsToRemove, false);\n const { removedComponentIds, missingComponents, dependentBits, removedFromLane } = await consumer.scope.removeMany(\n idsToRemoveFromScope,\n force,\n consumer\n );\n // otherwise, components should still be in .bitmap file\n idsToCleanFromWorkspace.push(...removedComponentIds);\n if (idsToCleanFromWorkspace.length) {\n if (deleteFiles) await deleteComponentsFiles(consumer, idsToCleanFromWorkspace);\n if (!track) {\n const invalidComponentsIds = invalidComponents.map((i) => i.id);\n const removedComponents = componentsToRemove.filter((c) => idsToCleanFromWorkspace.hasWithoutVersion(c.id));\n await packageJsonUtils.removeComponentsFromWorkspacesAndDependencies(\n consumer,\n removedComponents,\n invalidComponentsIds\n );\n await consumer.cleanFromBitMap(idsToCleanFromWorkspace);\n }\n }\n return new RemovedLocalObjects(\n ComponentIdList.uniqFromArray([...idsToCleanFromWorkspace, ...removedComponentIds]),\n missingComponents,\n modifiedComponents,\n dependentBits,\n removedFromLane\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,cAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAA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MAC3G,MAAMxC,gBAAgB,CAAD,CAAC,CAACqH,6CAA6C,CAClE1F,QAAQ,EACRwF,iBAAiB,EACjBD,oBACF,CAAC;MACD,MAAMvF,QAAQ,CAAC2F,eAAe,CAACf,uBAAuB,CAAC;IACzD;EACF;EACA,OAAO,KAAI/C,0CAAmB,EAC5BnB,8BAAe,CAACkF,aAAa,CAAC,CAAC,GAAGhB,uBAAuB,EAAE,GAAGK,mBAAmB,CAAC,CAAC,EACnFC,iBAAiB,EACjBxB,kBAAkB,EAClByB,aAAa,EACbC,eACF,CAAC;AACH"}
1
+ {"version":3,"names":["_groupArray","data","_interopRequireDefault","require","_lodash","_ramda","_componentId","_constants","_generalError","_enrichContextFromGlobal","_logger","_http","_remotes","_scopeRemotes","_deleteComponentFiles","_componentsList","_consumerComponent","packageJsonUtils","_interopRequireWildcard","_pMapSeries","_removedLocalObjects","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","removeComponents","consumer","ids","force","remote","track","deleteFiles","logger","debugAndAddBreadCrumb","toString","bitIdsLatest","ComponentIdList","fromArray","map","id","changeVersion","LATEST_BIT_VERSION","localIds","remoteIds","partition","isLocal","length","GeneralError","join","remoteResult","R","isEmpty","removeRemote","localResult","removeLocal","RemovedLocalObjects","bitIds","groupedBitsByScope","groupArray","remotes","getScopeRemotes","scope","Remotes","getGlobalRemotes","shouldGoToCentralHub","keys","http","Http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","deleteViaCentralHub","idsAreLanes","context","enrichContextFromGlobal","removeP","key","resolvedRemote","resolve","idsStr","toStringWithoutVersion","deleteMany","Promise","all","modifiedComponents","nonModifiedComponents","pMapSeries","componentStatus","getComponentStatusById","modified","push","err","Component","isComponentInvalidByErrorType","idsToRemove","componentsList","ComponentsList","newComponents","listNewComponents","idsToRemoveFromScope","filter","hasWithoutVersion","idsToCleanFromWorkspace","components","componentsToRemove","invalidComponents","loadComponents","removedComponentIds","missingComponents","dependentBits","removedFromLane","removeMany","deleteComponentsFiles","invalidComponentsIds","removedComponents","c","removeComponentsFromWorkspacesAndDependencies","cleanFromBitMap","uniqFromArray"],"sources":["remove-components.ts"],"sourcesContent":["import groupArray from 'group-array';\nimport partition from 'lodash.partition';\nimport R from 'ramda';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, LATEST_BIT_VERSION } from '@teambit/legacy/dist/constants';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport enrichContextFromGlobal from '@teambit/legacy/dist/hooks/utils/enrich-context-from-global';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Http } from '@teambit/legacy/dist/scope/network/http';\nimport { Remotes } from '@teambit/legacy/dist/remotes';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport pMapSeries from 'p-map-series';\nimport { RemovedLocalObjects } from './removed-local-objects';\n\nexport type RemoveComponentsResult = { localResult: RemovedLocalObjects; remoteResult: RemovedObjects[] };\n\n/**\n * Remove components local and remote\n * splits array of ids into local and remote and removes according to flags\n * @param {string[]} ids - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} remote - delete component from a remote scope\n * @param {boolean} track - keep tracking local staged components in bitmap.\n * @param {boolean} deleteFiles - delete local added files from fs.\n */\nexport async function removeComponents({\n consumer,\n ids,\n force,\n remote,\n track,\n deleteFiles,\n}: {\n consumer: Consumer | null | undefined; // when remote is false, it's always set\n ids: ComponentIdList;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n}): Promise<RemoveComponentsResult> {\n logger.debugAndAddBreadCrumb('removeComponents', `{ids}. force: ${force.toString()}`, { ids: ids.toString() });\n // added this to remove support for remove only one version from a component\n const bitIdsLatest = ComponentIdList.fromArray(\n ids.map((id) => {\n return id.changeVersion(LATEST_BIT_VERSION);\n })\n );\n const [localIds, remoteIds] = partition(bitIdsLatest, (id) => id.isLocal());\n if (remote && localIds.length) {\n throw new GeneralError(\n `unable to remove the remote components: ${localIds.join(',')} as they don't contain a scope-name`\n );\n }\n const remoteResult = remote && !R.isEmpty(remoteIds) ? await removeRemote(consumer, remoteIds, force) : [];\n const localResult = !remote\n ? await removeLocal(consumer as Consumer, bitIdsLatest, force, track, deleteFiles)\n : new RemovedLocalObjects();\n\n return { localResult, remoteResult };\n}\n\n/**\n * Remove remote component from ssh server\n * this method groups remote components by remote name and deletes remote components together\n * @param {ComponentIdList} bitIds - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n */\nasync function removeRemote(\n consumer: Consumer | null | undefined,\n bitIds: ComponentIdList,\n force: boolean\n): Promise<RemovedObjects[]> {\n const groupedBitsByScope = groupArray(bitIds, 'scope');\n const remotes = consumer ? await getScopeRemotes(consumer.scope) : await Remotes.getGlobalRemotes();\n const shouldGoToCentralHub = remotes.shouldGoToCentralHub(Object.keys(groupedBitsByScope));\n if (shouldGoToCentralHub) {\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n return http.deleteViaCentralHub(\n bitIds.map((id) => id.toString()),\n { force, idsAreLanes: false }\n );\n }\n const context = {};\n enrichContextFromGlobal(context);\n const removeP = Object.keys(groupedBitsByScope).map(async (key) => {\n const resolvedRemote = await remotes.resolve(key, consumer?.scope);\n const idsStr = groupedBitsByScope[key].map((id) => id.toStringWithoutVersion());\n return resolvedRemote.deleteMany(idsStr, force, context);\n });\n\n return Promise.all(removeP);\n}\n\n/**\n * removeLocal - remove local (imported, new staged components) from modules and bitmap according to flags\n * @param {ComponentIdList} bitIds - list of component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} deleteFiles - delete component that are used by other components.\n */\nasync function removeLocal(\n consumer: Consumer,\n bitIds: ComponentIdList,\n force: boolean,\n track: boolean,\n deleteFiles: boolean\n): Promise<RemovedLocalObjects> {\n // local remove in case user wants to delete tagged components\n const modifiedComponents = new ComponentIdList();\n const nonModifiedComponents = new ComponentIdList();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (R.isEmpty(bitIds)) return new RemovedLocalObjects();\n if (!force) {\n await pMapSeries(bitIds, async (id) => {\n try {\n const componentStatus = await consumer.getComponentStatusById(id);\n if (componentStatus.modified) modifiedComponents.push(id);\n else nonModifiedComponents.push(id);\n } catch (err: any) {\n // if a component has an error, such as, missing main file, we do want to allow removing that component\n if (Component.isComponentInvalidByErrorType(err)) {\n nonModifiedComponents.push(id);\n } else {\n throw err;\n }\n }\n });\n }\n const idsToRemove = force ? bitIds : nonModifiedComponents;\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents(false)) as ComponentIdList;\n const idsToRemoveFromScope = ComponentIdList.fromArray(\n idsToRemove.filter((id) => !newComponents.hasWithoutVersion(id))\n );\n const idsToCleanFromWorkspace = ComponentIdList.fromArray(\n idsToRemove.filter((id) => newComponents.hasWithoutVersion(id))\n );\n const { components: componentsToRemove, invalidComponents } = await consumer.loadComponents(idsToRemove, false);\n const { removedComponentIds, missingComponents, dependentBits, removedFromLane } = await consumer.scope.removeMany(\n idsToRemoveFromScope,\n force,\n consumer\n );\n // otherwise, components should still be in .bitmap file\n idsToCleanFromWorkspace.push(...removedComponentIds);\n if (idsToCleanFromWorkspace.length) {\n if (deleteFiles) await deleteComponentsFiles(consumer, idsToCleanFromWorkspace);\n if (!track) {\n const invalidComponentsIds = invalidComponents.map((i) => i.id);\n const removedComponents = componentsToRemove.filter((c) => idsToCleanFromWorkspace.hasWithoutVersion(c.id));\n await packageJsonUtils.removeComponentsFromWorkspacesAndDependencies(\n consumer,\n removedComponents,\n invalidComponentsIds\n );\n await consumer.cleanFromBitMap(idsToCleanFromWorkspace);\n }\n }\n return new RemovedLocalObjects(\n ComponentIdList.uniqFromArray([...idsToCleanFromWorkspace, ...removedComponentIds]),\n missingComponents,\n modifiedComponents,\n dependentBits,\n removedFromLane\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,cAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,yBAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,wBAAA,YAAAA,CAAA;IA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2F,eAAe,CAACf,uBAAuB,CAAC;IACzD;EACF;EACA,OAAO,KAAI/C,0CAAmB,EAC5BnB,8BAAe,CAACkF,aAAa,CAAC,CAAC,GAAGhB,uBAAuB,EAAE,GAAGK,mBAAmB,CAAC,CAAC,EACnFC,iBAAiB,EACjBxB,kBAAkB,EAClByB,aAAa,EACbC,eACF,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
1
  export declare function removeTemplate({ dependentBits, modifiedComponents, removedComponentIds, missingComponents, removedFromLane }: {
2
2
  dependentBits: any;
3
- modifiedComponents?: never[] | undefined;
3
+ modifiedComponents?: any[];
4
4
  removedComponentIds: any;
5
5
  missingComponents: any;
6
6
  removedFromLane: any;
@@ -8,7 +8,7 @@ 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
- export declare type RemoveInfo = {
11
+ export type RemoveInfo = {
12
12
  removed: boolean;
13
13
  /**
14
14
  * whether to remove the component from default lane once merged
@@ -68,7 +68,7 @@ export declare class RemoveMain {
68
68
  private getRemovedStagedFromLane;
69
69
  private getLocalBitIdsToRemove;
70
70
  private getRemoteBitIdsToRemove;
71
- static slots: never[];
71
+ static slots: any[];
72
72
  static dependencies: import("@teambit/harmony").Aspect[];
73
73
  static runtime: import("@teambit/harmony").RuntimeDefinition;
74
74
  static provider([workspace, cli, loggerMain, componentAspect, importerMain, depResolver, issues]: [
@@ -193,11 +193,10 @@ class RemoveMain {
193
193
  track = false,
194
194
  deleteFiles = true
195
195
  }) {
196
- var _this$workspace;
197
196
  this.logger.setStatusLine(BEFORE_REMOVE);
198
197
  const bitIds = remote ? await this.getRemoteBitIdsToRemove(componentsPattern) : await this.getLocalBitIdsToRemove(componentsPattern);
199
198
  this.logger.setStatusLine(BEFORE_REMOVE); // again because the loader might changed when talking to the remote
200
- const consumer = (_this$workspace = this.workspace) === null || _this$workspace === void 0 ? void 0 : _this$workspace.consumer;
199
+ const consumer = this.workspace?.consumer;
201
200
  const removeResults = await (0, _removeComponents().removeComponents)({
202
201
  consumer,
203
202
  ids: _componentId().ComponentIdList.fromArray(bitIds),
@@ -254,7 +253,7 @@ class RemoveMain {
254
253
  const {
255
254
  updateMain
256
255
  } = opts;
257
- if (!updateMain && currentLane !== null && currentLane !== void 0 && currentLane.isNew) {
256
+ if (!updateMain && currentLane?.isNew) {
258
257
  throw new Error('no need to delete components from an un-exported lane, you can remove them by running "bit remove"');
259
258
  }
260
259
  return this.markRemoveComps(componentIds, updateMain);
@@ -292,8 +291,7 @@ class RemoveMain {
292
291
  await this.workspace.bitMap.write('recover');
293
292
  };
294
293
  if (bitMapEntry) {
295
- var _bitMapEntry$config;
296
- if ((_bitMapEntry$config = bitMapEntry.config) !== null && _bitMapEntry$config !== void 0 && _bitMapEntry$config[_remove().RemoveAspect.id]) {
294
+ if (bitMapEntry.config?.[_remove().RemoveAspect.id]) {
297
295
  // case #1
298
296
  const compFromScope = await this.workspace.scope.get(bitMapEntry.id);
299
297
  if (compFromScope) {
@@ -303,8 +301,7 @@ class RemoveMain {
303
301
  this.workspace.bitMap.removeComponentConfig(bitMapEntry.id, _remove().RemoveAspect.id, false);
304
302
  await this.workspace.bitMap.write('recover');
305
303
  } else {
306
- var _bitMapEntry$config2;
307
- (_bitMapEntry$config2 = bitMapEntry.config) === null || _bitMapEntry$config2 === void 0 || delete _bitMapEntry$config2[_remove().RemoveAspect.id];
304
+ delete bitMapEntry.config?.[_remove().RemoveAspect.id];
308
305
  await importComp(bitMapEntry.id.toString());
309
306
  }
310
307
  return true;
@@ -320,7 +317,7 @@ class RemoveMain {
320
317
  }
321
318
  const compId = await this.workspace.scope.resolveComponentId(compIdStr);
322
319
  const currentLane = await this.workspace.getCurrentLaneObject();
323
- const idOnLane = currentLane === null || currentLane === void 0 ? void 0 : currentLane.getComponent(compId);
320
+ const idOnLane = currentLane?.getComponent(compId);
324
321
  const compIdWithPossibleVer = idOnLane ? compId.changeVersion(idOnLane.head.toString()) : compId;
325
322
  const compFromScope = await this.workspace.scope.get(compIdWithPossibleVer);
326
323
  if (compFromScope && this.isRemoved(compFromScope)) {
@@ -357,10 +354,9 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
357
354
  }
358
355
  }
359
356
  getRemoveInfo(component) {
360
- var _component$config$ext;
361
- const data = (_component$config$ext = component.config.extensions.findExtension(_remove().RemoveAspect.id)) === null || _component$config$ext === void 0 ? void 0 : _component$config$ext.config;
357
+ const data = component.config.extensions.findExtension(_remove().RemoveAspect.id)?.config;
362
358
  return {
363
- removed: (data === null || data === void 0 ? void 0 : data.removed) || false
359
+ removed: data?.removed || false
364
360
  };
365
361
  }
366
362
  isRemoved(component) {
@@ -407,10 +403,7 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
407
403
  }
408
404
  async getRemovedStagedFromMain() {
409
405
  const stagedConfig = await this.workspace.scope.getStagedConfig();
410
- return stagedConfig.getAll().filter(compConfig => {
411
- var _compConfig$config;
412
- return (_compConfig$config = compConfig.config) === null || _compConfig$config === void 0 || (_compConfig$config = _compConfig$config[_remove().RemoveAspect.id]) === null || _compConfig$config === void 0 ? void 0 : _compConfig$config.removed;
413
- }).map(compConfig => compConfig.id);
406
+ return stagedConfig.getAll().filter(compConfig => compConfig.config?.[_remove().RemoveAspect.id]?.removed).map(compConfig => compConfig.id);
414
407
  }
415
408
  async getRemovedStagedFromLane() {
416
409
  const currentLane = await this.workspace.getCurrentLaneObject();
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_workspace","_interopRequireWildcard","_componentId","_exceptions","_importer","_interopRequireDefault","_lodash","_hasWildcard","_listScope","_bitError","_deleteComponentFiles","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_noHeadNoVersion","_component","_packageJsonUtils","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","importer","depResolver","remove","componentsPattern","force","remote","track","deleteFiles","_this$workspace","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","ComponentIdList","fromArray","onDestroy","removeLocallyByIds","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","_bitMapEntry$config","compFromScope","scope","rootDir","removeComponentConfig","_bitMapEntry$config2","resolveComponentId","comp","isRemoved","idOnLane","getComponent","compIdWithPossibleVer","changeVersion","head","_legacy","getRemoteComponent","err","NoHeadNoVersion","throwForMainComponentWhenOnLane","laneComps","toBitIds","mainComps","hasWithoutVersion","getRemoveInfo","component","_component$config$ext","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","_compConfig$config","laneIds","workspaceIds","listIds","laneIdsNotInWorkspace","wId","isEqualWithoutVersion","laneCompIdsNotInWorkspace","resolveMultipleComponentIds","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 consumer,\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(ids: ComponentID[], { force = false }: { force?: boolean } = {}) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n consumer: this.workspace.consumer,\n ids: ComponentIdList.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n });\n await this.workspace.bitMap.write('remove');\n\n return results;\n }\n\n async markRemoveComps(componentIds: ComponentID[], shouldUpdateMain = false) {\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.map((id) => id));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\n }\n\n async deleteComps(componentsPattern: string, opts: { updateMain?: boolean } = {}): Promise<ComponentID[]> {\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 = await this.workspace.resolveComponentId(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.toBitIds();\n const workspaceIds = await this.workspace.listIds();\n const laneIdsNotInWorkspace = laneIds.filter((id) => !workspaceIds.find((wId) => wId.isEqualWithoutVersion(id)));\n if (!laneIdsNotInWorkspace.length) return [];\n const laneCompIdsNotInWorkspace = await this.workspace.scope.resolveMultipleComponentIds(laneIdsNotInWorkspace);\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,GAAAI,uBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAQ,sBAAA,CAAAP,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA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U,QAAQ,CACV,KAAIC,sBAAS,EAACN,UAAU,EAAEtK,SAAS,CAAC,EACpC,KAAI6K,sBAAS,EAACP,UAAU,EAAEtK,SAAS,CAAC,EACpC,KAAI8K,wBAAU,EAACR,UAAU,CAC3B,CAAC;IACD,OAAOA,UAAU;EACnB;AACF;AAACS,OAAA,CAAAjL,UAAA,GAAAA,UAAA;AAAAd,eAAA,CAvUYc,UAAU,WAuSN,EAAE;AAAAd,eAAA,CAvSNc,UAAU,kBAwSC,CACpBkL,oBAAe,EACfC,gBAAS,EACTC,sBAAY,EACZC,oBAAe,EACfC,mBAAc,EACdC,8CAAwB,EACxBC,iBAAY,CACb;AAAAtM,eAAA,CAhTUc,UAAU,aAiTJyL,kBAAW;AAwB9B7I,sBAAY,CAAC8I,UAAU,CAAC1L,UAAU,CAAC;AAAC,IAAA2L,QAAA,GAAAV,OAAA,CAAAnN,OAAA,GAErBkC,UAAU"}
1
+ {"version":3,"names":["_cli","data","require","_logger","_workspace","_interopRequireWildcard","_componentId","_exceptions","_importer","_interopRequireDefault","_lodash","_hasWildcard","_listScope","_bitError","_deleteComponentFiles","_dependencyResolver","_componentIssues","_issues","_pMapSeries","_noHeadNoVersion","_component","_packageJsonUtils","_removeCmd","_removeComponents","_remove","_remove2","_recoverCmd","_deleteCmd","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","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","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","rootDir","removeComponentConfig","resolveComponentId","comp","isRemoved","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","workspaceIds","listIds","laneIdsNotInWorkspace","wId","isEqualWithoutVersion","laneCompIdsNotInWorkspace","resolveMultipleComponentIds","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 consumer,\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(ids: ComponentID[], { force = false }: { force?: boolean } = {}) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n consumer: this.workspace.consumer,\n ids: ComponentIdList.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n });\n await this.workspace.bitMap.write('remove');\n\n return results;\n }\n\n async markRemoveComps(componentIds: ComponentID[], shouldUpdateMain = false) {\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.map((id) => id));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\n }\n\n async deleteComps(componentsPattern: string, opts: { updateMain?: boolean } = {}): Promise<ComponentID[]> {\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 = await this.workspace.resolveComponentId(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.toBitIds();\n const workspaceIds = await this.workspace.listIds();\n const laneIdsNotInWorkspace = laneIds.filter((id) => !workspaceIds.find((wId) => wId.isEqualWithoutVersion(id)));\n if (!laneIdsNotInWorkspace.length) return [];\n const laneCompIdsNotInWorkspace = await this.workspace.scope.resolveMultipleComponentIds(laneIdsNotInWorkspace);\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(RemoveM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sBAAY,CAACC,EAAE,CAAC;IACvD,MAAMuH,UAAU,GAAG,IAAInK,UAAU,CAACE,SAAS,EAAEC,MAAM,EAAE8J,YAAY,EAAE5J,WAAW,CAAC;IAC/E6H,MAAM,CAACkC,2BAA2B,CAACD,UAAU,CAAC5C,4BAA4B,CAAC8C,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,EAAEjK,SAAS,CAAC,EACpC,KAAIwK,sBAAS,EAACP,UAAU,EAAEjK,SAAS,CAAC,EACpC,KAAIyK,wBAAU,EAACR,UAAU,CAC3B,CAAC;IACD,OAAOA,UAAU;EACnB;AACF;AAACS,OAAA,CAAA5K,UAAA,GAAAA,UAAA;AAAAd,eAAA,CAvUYc,UAAU,WAuSN,EAAE;AAAAd,eAAA,CAvSNc,UAAU,kBAwSC,CACpB6K,oBAAe,EACfC,gBAAS,EACTC,sBAAY,EACZC,oBAAe,EACfC,mBAAc,EACdC,8CAAwB,EACxBC,iBAAY,CACb;AAAAjM,eAAA,CAhTUc,UAAU,aAiTJoL,kBAAW;AAwB9BzI,sBAAY,CAAC0I,UAAU,CAACrL,UAAU,CAAC;AAAC,IAAAsL,QAAA,GAAAV,OAAA,CAAA9M,OAAA,GAErBkC,UAAU"}
package/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { RemoveAspect } from './remove.aspect';
2
+
3
+ export type { RemoveMain, RemoveInfo } from './remove.main.runtime';
4
+ export type { RemovedLocalObjects } from './removed-local-objects';
5
+ export { removeTemplate } from './remove-template';
6
+ export default RemoveAspect;
7
+ export { RemoveAspect };