@teambit/workspace 1.0.157 → 1.0.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.157/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.157/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.159/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.159/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -214,8 +214,9 @@ export declare class Workspace implements ComponentFactory {
214
214
  listInvalid(): Promise<InvalidComponent[]>;
215
215
  /**
216
216
  * get ids of all workspace components.
217
+ * @todo: remove the "async", it's not a promise anymore.
217
218
  */
218
- listIds(): Promise<ComponentID[]>;
219
+ listIds(): Promise<ComponentIdList>;
219
220
  listIdsIncludeRemoved(): ComponentIdList;
220
221
  /**
221
222
  * Check if a specific id exist in the workspace
@@ -267,7 +268,7 @@ export declare class Workspace implements ComponentFactory {
267
268
  /**
268
269
  * given component ids, find their dependents in the workspace
269
270
  */
270
- getDependentsIds(ids: ComponentID[]): Promise<ComponentID[]>;
271
+ getDependentsIds(ids: ComponentID[], filterOutNowWorkspaceIds?: boolean): Promise<ComponentID[]>;
271
272
  createAspectList(extensionDataList: ExtensionDataList): Promise<import("@teambit/component").AspectList>;
272
273
  private extensionDataEntryToAspectEntry;
273
274
  /**
package/dist/workspace.js CHANGED
@@ -32,13 +32,6 @@ function _graph() {
32
32
  };
33
33
  return data;
34
34
  }
35
- function _scopeGraph() {
36
- const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/graph/scope-graph"));
37
- _scopeGraph = function () {
38
- return data;
39
- };
40
- return data;
41
- }
42
35
  function _dependenciesModules() {
43
36
  const data = require("@teambit/dependencies.modules.packages-excluder");
44
37
  _dependenciesModules = function () {
@@ -570,13 +563,14 @@ class Workspace {
570
563
 
571
564
  /**
572
565
  * get ids of all workspace components.
566
+ * @todo: remove the "async", it's not a promise anymore.
573
567
  */
574
568
  async listIds() {
575
569
  if (this._cachedListIds && this.bitMap.hasChanged()) {
576
570
  delete this._cachedListIds;
577
571
  }
578
572
  if (!this._cachedListIds) {
579
- this._cachedListIds = await this.resolveMultipleComponentIds(this.consumer.bitmapIdsFromCurrentLane);
573
+ this._cachedListIds = this.consumer.bitmapIdsFromCurrentLane;
580
574
  }
581
575
  return this._cachedListIds;
582
576
  }
@@ -772,14 +766,13 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
772
766
  /**
773
767
  * given component ids, find their dependents in the workspace
774
768
  */
775
- async getDependentsIds(ids) {
776
- const workspaceGraph = await _scopeGraph().default.buildGraphFromWorkspace(this.consumer, true);
777
- const workspaceDependencyGraph = new (_scopeGraph().default)(workspaceGraph);
778
- const workspaceDependents = ids.map(id => workspaceDependencyGraph.getDependentsInfo(id));
779
- const dependentsLegacyIds = workspaceDependents.flat().map(_ => _.id);
780
- const dependentsLegacyNoDup = _componentId().ComponentIdList.uniqFromArray(dependentsLegacyIds);
781
- const dependentsIds = await this.resolveMultipleComponentIds(dependentsLegacyNoDup);
782
- return dependentsIds;
769
+ async getDependentsIds(ids, filterOutNowWorkspaceIds = true) {
770
+ const graph = await this.getGraphIds();
771
+ const dependents = ids.map(id => graph.predecessors(id.toString())).flat().map(node => node.attr);
772
+ const uniq = _componentId().ComponentIdList.uniqFromArray(dependents);
773
+ if (!filterOutNowWorkspaceIds) return uniq;
774
+ const workspaceIds = await this.listIds();
775
+ return uniq.filter(id => workspaceIds.has(id));
783
776
  }
784
777
  async createAspectList(extensionDataList) {
785
778
  const entiresP = extensionDataList.map(entry => this.extensionDataEntryToAspectEntry(entry));