@teambit/workspace 1.0.260 → 1.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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.260/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.260/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.261/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.261/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -312,6 +312,7 @@ export declare class Workspace implements ComponentFactory {
312
312
  getDefaultExtensions(): ExtensionDataList;
313
313
  getComponentConfigVinylFile(id: ComponentID, options: EjectConfOptions, excludeLocalChanges?: boolean): Promise<JsonVinyl>;
314
314
  ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]>;
315
+ getAspectConfigForComponent(id: ComponentID, aspectId: string): Promise<object | undefined>;
315
316
  getExtensionsFromScopeAndSpecific(id: ComponentID, excludeComponentJson?: boolean): Promise<ExtensionDataList>;
316
317
  /**
317
318
  * @deprecated use `this.idsByPattern` instead for consistency. also, it supports negation and list of patterns.
package/dist/workspace.js CHANGED
@@ -1060,6 +1060,11 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1060
1060
  await this.bitMap.write(`eject-conf (${ids.length} component(s))`);
1061
1061
  return EjectConfResult;
1062
1062
  }
1063
+ async getAspectConfigForComponent(id, aspectId) {
1064
+ const extensions = await this.getExtensionsFromScopeAndSpecific(id);
1065
+ const obj = extensions.toConfigObject();
1066
+ return obj[aspectId];
1067
+ }
1063
1068
  async getExtensionsFromScopeAndSpecific(id, excludeComponentJson = false) {
1064
1069
  const componentFromScope = await this.scope.get(id);
1065
1070
  const exclude = ['WorkspaceVariants'];
@@ -1520,9 +1525,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1520
1525
  });
1521
1526
  } else {
1522
1527
  if (shouldMergeWithPrevious) {
1523
- const extensions = await this.getExtensionsFromScopeAndSpecific(id);
1524
- const obj = extensions.toConfigObject();
1525
- config = obj[aspectId] ? (0, _lodash().merge)(obj[aspectId], config) : config;
1528
+ const existingConfig = await this.getAspectConfigForComponent(id, aspectId);
1529
+ config = existingConfig ? (0, _lodash().merge)(existingConfig, config) : config;
1526
1530
  }
1527
1531
  this.bitMap.addComponentConfig(id, aspectId, config, shouldMergeWithExisting);
1528
1532
  }