@teambit/remove 0.0.260 → 0.0.261

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.
@@ -47,9 +47,11 @@ export declare class RemoveMain {
47
47
  getRemoveInfo(component: Component): RemoveInfo;
48
48
  isRemoved(component: Component): boolean;
49
49
  /**
50
- * get components that were soft-removed and tagged/snapped but not exported yet.
50
+ * get components that were soft-removed and tagged/snapped/merged but not exported yet.
51
51
  */
52
52
  getRemovedStaged(): Promise<ComponentID[]>;
53
+ private getRemovedStagedFromMain;
54
+ private getRemovedStagedFromLane;
53
55
  private getLocalBitIdsToRemove;
54
56
  private getRemoteBitIdsToRemove;
55
57
  static slots: never[];
@@ -63,6 +63,13 @@ function _importer() {
63
63
  };
64
64
  return data;
65
65
  }
66
+ function _lodash() {
67
+ const data = require("lodash");
68
+ _lodash = function () {
69
+ return data;
70
+ };
71
+ return data;
72
+ }
66
73
  function _hasWildcard() {
67
74
  const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/string/has-wildcard"));
68
75
  _hasWildcard = function () {
@@ -304,15 +311,35 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
304
311
  }
305
312
 
306
313
  /**
307
- * get components that were soft-removed and tagged/snapped but not exported yet.
314
+ * get components that were soft-removed and tagged/snapped/merged but not exported yet.
308
315
  */
309
316
  async getRemovedStaged() {
317
+ return this.workspace.isOnMain() ? this.getRemovedStagedFromMain() : this.getRemovedStagedFromLane();
318
+ }
319
+ async getRemovedStagedFromMain() {
310
320
  const stagedConfig = await this.workspace.scope.getStagedConfig();
311
321
  return stagedConfig.getAll().filter(compConfig => {
312
322
  var _compConfig$config, _compConfig$config$Re;
313
323
  return (_compConfig$config = compConfig.config) === null || _compConfig$config === void 0 ? void 0 : (_compConfig$config$Re = _compConfig$config[_remove().RemoveAspect.id]) === null || _compConfig$config$Re === void 0 ? void 0 : _compConfig$config$Re.removed;
314
324
  }).map(compConfig => compConfig.id);
315
325
  }
326
+ async getRemovedStagedFromLane() {
327
+ const currentLane = await this.workspace.getCurrentLaneObject();
328
+ if (!currentLane) return [];
329
+ const laneIds = currentLane.toBitIds();
330
+ const workspaceIds = await this.workspace.listIds();
331
+ const laneIdsNotInWorkspace = laneIds.filter(id => !workspaceIds.find(wId => wId._legacy.isEqualWithoutVersion(id)));
332
+ if (!laneIdsNotInWorkspace.length) return [];
333
+ const laneCompIdsNotInWorkspace = await this.workspace.scope.resolveMultipleComponentIds(laneIdsNotInWorkspace);
334
+ const comps = await this.workspace.scope.getMany(laneCompIdsNotInWorkspace);
335
+ const removed = comps.filter(c => this.isRemoved(c));
336
+ const staged = await Promise.all(removed.map(async c => {
337
+ const snapDistance = await this.workspace.scope.getSnapDistance(c.id);
338
+ if (snapDistance.isSourceAhead()) return c.id;
339
+ return undefined;
340
+ }));
341
+ return (0, _lodash().compact)(staged);
342
+ }
316
343
  async getLocalBitIdsToRemove(componentsPattern) {
317
344
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
318
345
  const componentIds = await this.workspace.idsByPattern(componentsPattern);
@@ -1 +1 @@
1
- {"version":3,"names":["BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","importer","remove","componentsPattern","force","remote","track","deleteFiles","fromLane","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","BitIds","fromArray","onDestroy","removeLocallyByIds","OutsideWorkspaceError","results","bitMap","write","softRemove","ConsumerNotFound","currentLane","getCurrentLaneObject","isNew","BitError","name","componentIds","idsByPattern","components","getMany","newComps","filter","c","id","hasVersion","length","map","toString","join","throwForMainComponentWhenOnLane","removeComponentsFromNodeModules","state","_consumer","compId","addComponentConfig","RemoveAspect","removed","_legacy","deleteComponentsFiles","recover","compIdStr","options","bitMapEntry","find","compMap","toStringWithoutVersion","importComp","idStr","import","installNpmPackages","skipDependencyInstallation","override","setAsRemovedFalse","addSpecificComponentConfig","config","resolveComponentId","comp","get","isRemoved","scope","compFromScope","getRemoteComponent","laneComps","toBitIds","mainComps","hasWithoutVersion","getRemoveInfo","component","data","extensions","findExtension","getRemovedStaged","stagedConfig","getStagedConfig","getAll","compConfig","hasWildcard","getRemoteBitIdsByWildcards","BitId","parse","provider","cli","loggerMain","componentAspect","importerMain","createLogger","removeMain","registerShowFragments","RemoveFragment","register","RemoveCmd","RecoverCmd","WorkspaceAspect","CLIAspect","LoggerAspect","ComponentAspect","ImporterAspect","MainRuntime","addRuntime"],"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 { BitId } from '@teambit/legacy-bit-id';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport { RecoverCmd, RecoverOptions } from './recover-cmd';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n};\n\nexport class RemoveMain {\n constructor(private workspace: Workspace, public logger: Logger, private importer: ImporterMain) {}\n\n async remove({\n componentsPattern,\n force = false,\n remote = false,\n track = false,\n deleteFiles = true,\n fromLane = false,\n }: {\n componentsPattern: string;\n force?: boolean;\n remote?: boolean;\n track?: boolean;\n deleteFiles?: boolean;\n fromLane?: boolean;\n }): Promise<any> {\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: BitIds.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n });\n if (consumer) await consumer.onDestroy();\n return removeResults;\n }\n\n /**\n * remove components from the workspace.\n */\n async removeLocallyByIds(ids: BitId[], { force = false }: { force?: boolean } = {}) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n consumer: this.workspace.consumer,\n ids: BitIds.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n fromLane: false,\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n async softRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (currentLane?.isNew) {\n throw new BitError(\n `unable to soft-remove on a new (not-exported) lane \"${currentLane.name}\". please remove without --delete`\n );\n }\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const components = await this.workspace.getMany(componentIds);\n const newComps = components.filter((c) => !c.id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `unable to soft-remove the following new component(s), please remove them without --delete\\n${newComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n }\n await this.throwForMainComponentWhenOnLane(components);\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 componentIds.map((compId) =>\n this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, {\n removed: true,\n })\n );\n await this.workspace.bitMap.write();\n const bitIds = BitIds.fromArray(componentIds.map((id) => id._legacy));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\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 * 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.name === 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 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();\n };\n if (bitMapEntry) {\n if (bitMapEntry.config?.[RemoveAspect.id]) {\n // case #1\n delete bitMapEntry.config?.[RemoveAspect.id];\n await importComp(bitMapEntry.id.toString());\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 compFromScope = await this.workspace.scope.get(compId);\n if (compFromScope && this.isRemoved(compFromScope)) {\n // case #2 and #3\n await importComp(compId._legacy.toString());\n await setAsRemovedFalse(compId);\n return true;\n }\n // case #5\n const comp = await this.workspace.scope.getRemoteComponent(compId);\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._legacy));\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 * get components that were soft-removed and tagged/snapped but not exported yet.\n */\n async getRemovedStaged(): 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 getLocalBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id._legacy);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (hasWildcard(componentsPattern)) {\n return getRemoteBitIdsByWildcards(componentsPattern);\n }\n return [BitId.parse(componentsPattern, true)];\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, LoggerAspect, ComponentAspect, ImporterAspect];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain, componentAspect, importerMain]: [\n Workspace,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger, importerMain);\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(new RemoveCmd(removeMain), new RecoverCmd(removeMain));\n return removeMain;\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA2D;AAAA;AAE3D,MAAMA,aAAa,GAAG,qBAAqB;AAMpC,MAAMC,UAAU,CAAC;EACtBC,WAAW,CAASC,SAAoB,EAASC,MAAc,EAAUC,QAAsB,EAAE;IAAA,KAA7EF,SAAoB,GAApBA,SAAoB;IAAA,KAASC,MAAc,GAAdA,MAAc;IAAA,KAAUC,QAAsB,GAAtBA,QAAsB;EAAG;EAElG,MAAMC,MAAM,CAAC;IACXC,iBAAiB;IACjBC,KAAK,GAAG,K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,CAAC,KAAIC,sBAAS,EAACJ,UAAU,CAAC,EAAE,KAAIK,wBAAU,EAACL,UAAU,CAAC,CAAC;IACnE,OAAOA,UAAU;EACnB;AACF;AAAC;AAAA,gCAzNYzG,UAAU,WAwMN,EAAE;AAAA,gCAxMNA,UAAU,kBAyMC,CAAC+G,oBAAe,EAAEC,gBAAS,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,mBAAc,CAAC;AAAA,gCAzMtFnH,UAAU,aA0MJoH,kBAAW;AAiB9B9D,sBAAY,CAAC+D,UAAU,CAACrH,UAAU,CAAC;AAAC,eAErBA,UAAU;AAAA"}
1
+ {"version":3,"names":["BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","importer","remove","componentsPattern","force","remote","track","deleteFiles","fromLane","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","BitIds","fromArray","onDestroy","removeLocallyByIds","OutsideWorkspaceError","results","bitMap","write","softRemove","ConsumerNotFound","currentLane","getCurrentLaneObject","isNew","BitError","name","componentIds","idsByPattern","components","getMany","newComps","filter","c","id","hasVersion","length","map","toString","join","throwForMainComponentWhenOnLane","removeComponentsFromNodeModules","state","_consumer","compId","addComponentConfig","RemoveAspect","removed","_legacy","deleteComponentsFiles","recover","compIdStr","options","bitMapEntry","find","compMap","toStringWithoutVersion","importComp","idStr","import","installNpmPackages","skipDependencyInstallation","override","setAsRemovedFalse","addSpecificComponentConfig","config","resolveComponentId","comp","get","isRemoved","scope","compFromScope","getRemoteComponent","laneComps","toBitIds","mainComps","hasWithoutVersion","getRemoveInfo","component","data","extensions","findExtension","getRemovedStaged","isOnMain","getRemovedStagedFromMain","getRemovedStagedFromLane","stagedConfig","getStagedConfig","getAll","compConfig","laneIds","workspaceIds","listIds","laneIdsNotInWorkspace","wId","isEqualWithoutVersion","laneCompIdsNotInWorkspace","resolveMultipleComponentIds","comps","staged","Promise","all","snapDistance","getSnapDistance","isSourceAhead","undefined","compact","hasWildcard","getRemoteBitIdsByWildcards","BitId","parse","provider","cli","loggerMain","componentAspect","importerMain","createLogger","removeMain","registerShowFragments","RemoveFragment","register","RemoveCmd","RecoverCmd","WorkspaceAspect","CLIAspect","LoggerAspect","ComponentAspect","ImporterAspect","MainRuntime","addRuntime"],"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 { BitId } from '@teambit/legacy-bit-id';\nimport { BitIds } from '@teambit/legacy/dist/bit-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 { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\nimport { RecoverCmd, RecoverOptions } from './recover-cmd';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n};\n\nexport class RemoveMain {\n constructor(private workspace: Workspace, public logger: Logger, private importer: ImporterMain) {}\n\n async remove({\n componentsPattern,\n force = false,\n remote = false,\n track = false,\n deleteFiles = true,\n fromLane = false,\n }: {\n componentsPattern: string;\n force?: boolean;\n remote?: boolean;\n track?: boolean;\n deleteFiles?: boolean;\n fromLane?: boolean;\n }): Promise<any> {\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: BitIds.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n });\n if (consumer) await consumer.onDestroy();\n return removeResults;\n }\n\n /**\n * remove components from the workspace.\n */\n async removeLocallyByIds(ids: BitId[], { force = false }: { force?: boolean } = {}) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const results = await removeComponents({\n consumer: this.workspace.consumer,\n ids: BitIds.fromArray(ids),\n force,\n remote: false,\n track: false,\n deleteFiles: true,\n fromLane: false,\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n async softRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (currentLane?.isNew) {\n throw new BitError(\n `unable to soft-remove on a new (not-exported) lane \"${currentLane.name}\". please remove without --delete`\n );\n }\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const components = await this.workspace.getMany(componentIds);\n const newComps = components.filter((c) => !c.id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `unable to soft-remove the following new component(s), please remove them without --delete\\n${newComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n }\n await this.throwForMainComponentWhenOnLane(components);\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 componentIds.map((compId) =>\n this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, {\n removed: true,\n })\n );\n await this.workspace.bitMap.write();\n const bitIds = BitIds.fromArray(componentIds.map((id) => id._legacy));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\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 * 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.name === 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 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();\n };\n if (bitMapEntry) {\n if (bitMapEntry.config?.[RemoveAspect.id]) {\n // case #1\n delete bitMapEntry.config?.[RemoveAspect.id];\n await importComp(bitMapEntry.id.toString());\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 compFromScope = await this.workspace.scope.get(compId);\n if (compFromScope && this.isRemoved(compFromScope)) {\n // case #2 and #3\n await importComp(compId._legacy.toString());\n await setAsRemovedFalse(compId);\n return true;\n }\n // case #5\n const comp = await this.workspace.scope.getRemoteComponent(compId);\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._legacy));\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 * 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 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(\n (id) => !workspaceIds.find((wId) => wId._legacy.isEqualWithoutVersion(id))\n );\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);\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<BitId[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id._legacy);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (hasWildcard(componentsPattern)) {\n return getRemoteBitIdsByWildcards(componentsPattern);\n }\n return [BitId.parse(componentsPattern, true)];\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, LoggerAspect, ComponentAspect, ImporterAspect];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain, componentAspect, importerMain]: [\n Workspace,\n CLIMain,\n LoggerMain,\n ComponentMain,\n ImporterMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger, importerMain);\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(new RemoveCmd(removeMain), new RecoverCmd(removeMain));\n return removeMain;\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EA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AC;IACzE,OAAO6B,YAAY,CAACU,GAAG,CAAEH,EAAE,IAAKA,EAAE,CAACc,OAAO,CAAC;EAC7C;EAEA,MAAc1C,uBAAuB,CAACR,iBAAyB,EAAoB;IACjF,IAAI,IAAA6G,sBAAW,EAAC7G,iBAAiB,CAAC,EAAE;MAClC,OAAO,IAAA8G,uCAA0B,EAAC9G,iBAAiB,CAAC;IACtD;IACA,OAAO,CAAC+G,oBAAK,CAACC,KAAK,CAAChH,iBAAiB,EAAE,IAAI,CAAC,CAAC;EAC/C;EAMA,aAAaiH,QAAQ,CAAC,CAACrH,SAAS,EAAEsH,GAAG,EAAEC,UAAU,EAAEC,eAAe,EAAEC,YAAY,CAM/E,EAAE;IACD,MAAMxH,MAAM,GAAGsH,UAAU,CAACG,YAAY,CAACtE,sBAAY,CAACZ,EAAE,CAAC;IACvD,MAAMmF,UAAU,GAAG,IAAI7H,UAAU,CAACE,SAAS,EAAEC,MAAM,EAAEwH,YAAY,CAAC;IAClED,eAAe,CAACI,qBAAqB,CAAC,CAAC,KAAIC,yBAAc,EAACF,UAAU,CAAC,CAAC,CAAC;IACvEL,GAAG,CAACQ,QAAQ,CAAC,KAAIC,sBAAS,EAACJ,UAAU,CAAC,EAAE,KAAIK,wBAAU,EAACL,UAAU,CAAC,CAAC;IACnE,OAAOA,UAAU;EACnB;AACF;AAAC;AAAA,gCAnPY7H,UAAU,WAkON,EAAE;AAAA,gCAlONA,UAAU,kBAmOC,CAACmI,oBAAe,EAAEC,gBAAS,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,mBAAc,CAAC;AAAA,gCAnOtFvI,UAAU,aAoOJwI,kBAAW;AAiB9BlF,sBAAY,CAACmF,UAAU,CAACzI,UAAU,CAAC;AAAC,eAErBA,UAAU;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/remove",
3
- "version": "0.0.260",
3
+ "version": "0.0.261",
4
4
  "homepage": "https://bit.cloud/teambit/component/remove",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "remove",
9
- "version": "0.0.260"
9
+ "version": "0.0.261"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -15,19 +15,21 @@
15
15
  "lodash.partition": "4.6.0",
16
16
  "p-map-series": "2.1.0",
17
17
  "ramda": "0.27.1",
18
+ "lodash": "4.17.21",
18
19
  "core-js": "^3.0.0",
19
20
  "@babel/runtime": "7.20.0",
20
21
  "@teambit/harmony": "0.4.6",
21
22
  "@teambit/component-id": "0.0.427",
22
23
  "@teambit/legacy-bit-id": "0.0.423",
23
24
  "@teambit/bit-error": "0.0.402",
24
- "@teambit/cli": "0.0.727",
25
- "@teambit/component": "0.0.1083",
26
- "@teambit/importer": "0.0.512",
27
- "@teambit/logger": "0.0.820",
28
- "@teambit/workspace": "0.0.1083"
25
+ "@teambit/cli": "0.0.728",
26
+ "@teambit/component": "0.0.1084",
27
+ "@teambit/importer": "0.0.513",
28
+ "@teambit/logger": "0.0.821",
29
+ "@teambit/workspace": "0.0.1084"
29
30
  },
30
31
  "devDependencies": {
32
+ "@types/lodash": "4.14.165",
31
33
  "@types/mocha": "9.1.0",
32
34
  "@types/node": "12.20.4",
33
35
  "@types/react": "^17.0.8",
@@ -36,7 +38,7 @@
36
38
  "@types/testing-library__jest-dom": "5.9.5"
37
39
  },
38
40
  "peerDependencies": {
39
- "@teambit/legacy": "1.0.507",
41
+ "@teambit/legacy": "1.0.509",
40
42
  "react": "^16.8.0 || ^17.0.0",
41
43
  "react-dom": "^16.8.0 || ^17.0.0"
42
44
  },