@teambit/workspace
Version:
60 lines (59 loc) • 2.92 kB
TypeScript
import type { Harmony } from '@teambit/harmony';
import type { Component } from '@teambit/component';
import type { ComponentID } from '@teambit/component-id';
import type { VariantPolicyConfigArr } from '@teambit/dependency-resolver';
import { ExtensionDataList } from '@teambit/legacy.extension-data';
import type { ExtensionsOrigin, Workspace } from './workspace';
import { MergeConflictFile } from './merge-conflict-file';
export declare class AspectsMerger {
private workspace;
private harmony;
readonly mergeConflictFile: MergeConflictFile;
private mergeConfigDepsResolverDataCache;
constructor(workspace: Workspace, harmony: Harmony);
getDepsDataOfMergeConfig(id: ComponentID): VariantPolicyConfigArr;
/**
* Calculate the component config based on:
* the config property in the .bitmap file
* the component.json file in the component folder
* matching pattern in the variants config
* defaults extensions from workspace config
* extensions from the model.
*/
merge(componentId: ComponentID, componentFromScope?: Component, excludeOrigins?: ExtensionsOrigin[]): Promise<{
extensions: ExtensionDataList;
beforeMerge: Array<{
extensions: ExtensionDataList;
origin: ExtensionsOrigin;
extraData: any;
}>;
errors?: Error[];
}>;
/**
* before version 0.0.882 it was possible to save Version object with the same extension twice.
*/
private getComponentFromScopeWithoutDuplications;
/**
* from the merge-config we get the dep-resolver policy as an array, because it needs to support "force" prop.
* however, when we save the config, we want to save it as an object, so we need split the data into two:
* 1. force: true, which gets saved into the config.
* 2. force: false, which gets saved into the data.dependencies later on. see the workspace.getAutoDetectOverrides()
*/
private removeAutoDepsFromConfig;
/**
* this is needed because if the mergeConfig has a policy, it will be used, and any other policy along the line will be ignored.
* in case the model has some dependencies that were set explicitly they're gonna be ignored.
* this makes sure to add them to the policy of the mergeConfig.
* in a way, this is similar to what we do when a user is running `bit deps set` and the component had previous dependencies set,
* we copy those dependencies along with the current one to the .bitmap file, so they won't get lost.
*/
private addConfigDepsFromModelToConfigMerge;
private getUnmergedData;
private filterEnvsFromExtensionsIfNeeded;
/**
* This will mutate the entries with extensionId prop to have resolved legacy id
* This should be worked on the extension data list not the new aspect list
* @param extensionList
*/
private resolveExtensionListIds;
}