import { GlobalConfigMain } from '@teambit/global-config';
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
import { Harmony } from '@teambit/harmony';
import { AspectDefinition, AspectLoaderMain } from '@teambit/aspect-loader';
import { ComponentID } from '@teambit/component-id';
import { LoadAspectsOptions, ResolveAspectsOptions } from '@teambit/component';
import { ScopeMain } from '@teambit/scope';
import { Logger } from '@teambit/logger';
import { EnvsMain } from '@teambit/envs';
import { DependencyResolverMain } from '@teambit/dependency-resolver';
import type { Workspace } from './workspace';
import { OnAspectsResolveSlot, OnRootAspectAddedSlot } from './workspace.main.runtime';
export type GetConfiguredUserAspectsPackagesOptions = {
    externalsOnly?: boolean;
};
export type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {
    useScopeAspectsCapsule?: boolean;
    runSubscribers?: boolean;
    skipDeps?: boolean;
    resolveEnvsFromRoots?: boolean;
};
export type AspectPackage = {
    packageName: string;
    version: string;
};
export declare class WorkspaceAspectsLoader {
    private workspace;
    private scope;
    private aspectLoader;
    private envs;
    private dependencyResolver;
    private logger;
    private globalConfig;
    private harmony;
    private onAspectsResolveSlot;
    private onRootAspectAddedSlot;
    private resolveAspectsFromNodeModules;
    private resolveEnvsFromRoots;
    private consumer;
    private resolvedInstalledAspects;
    constructor(workspace: Workspace, scope: ScopeMain, aspectLoader: AspectLoaderMain, envs: EnvsMain, dependencyResolver: DependencyResolverMain, logger: Logger, globalConfig: GlobalConfigMain, harmony: Harmony, onAspectsResolveSlot: OnAspectsResolveSlot, onRootAspectAddedSlot: OnRootAspectAddedSlot, resolveAspectsFromNodeModules?: boolean, resolveEnvsFromRoots?: boolean);
    /**
     * load aspects from the workspace and if not exists in the workspace, load from the node_modules.
     * keep in mind that the graph may have circles.
     */
    loadAspects(ids?: string[], throwOnError?: boolean, neededFor?: string, opts?: WorkspaceLoadAspectsOptions): Promise<string[]>;
    private loadFromScopeAspectsCapsule;
    throwWsJsoncAspectNotFoundError(err: any): void;
    private loadAspectDefsByOrder;
    resolveAspects(runtimeName?: string, componentIds?: ComponentID[], opts?: ResolveAspectsOptions): Promise<AspectDefinition[]>;
    shouldUseHashForCapsules(): boolean;
    getCapsulePath(): string;
    private logFoundWorkspaceVsScope;
    use(aspectIdStr: string): Promise<string>;
    getConfiguredUserAspectsPackages(options?: GetConfiguredUserAspectsPackagesOptions): Promise<AspectPackage[]>;
    private aspectDefsToRequireableComponents;
    private linkIfMissingWorkspaceAspects;
    /**
     * This will return a resolver that knows to resolve aspects which are part of the workspace.
     * means aspects exist in the bitmap file
     * @param stringIds
     * @param runtimeName
     * @returns
     */
    private getWorkspaceAspectResolver;
    private runOnAspectsResolveFunctions;
    private getOnAspectsResolveFunctions;
    private runOnRootAspectAddedFunctions;
    private getOnRootAspectAddedFunctions;
    /**
     * This will return a resolver that knows to resolve aspects which are not part of the workspace.
     * means aspects that does not exist in the bitmap file
     * instead it will resolve them from the node_modules recursively
     * @param graph
     * @param rootIds
     * @param runtimeName
     * @returns
     */
    private getInstalledAspectResolver;
    private resolveInstalledAspectRecursively;
    /**
     * Create a graph of aspects without the core aspects.
     * @param components
     * @param isAspect
     * @returns
     */
    private getAspectsGraphWithoutCore;
    /**
     * Load all unloaded extensions from an extension list
     * this will resolve the extensions from the scope aspects capsules if they are not in the ws
     * Only use it for component extensions
     * for workspace/scope root aspect use the load aspects directly
     *
     * The reason we are loading component extensions with "scope aspects capsules" is because for component extensions
     * we might have the same extension in multiple versions
     * (for example I might have 2 components using different versions of the same env)
     * in such case, I can't install both version into the root of the node_modules so I need to place it somewhere else (capsules)
     * @param extensions list of extensions with config to load
     */
    loadComponentsExtensions(extensions: ExtensionDataList, originatedFrom?: ComponentID, opts?: WorkspaceLoadAspectsOptions): Promise<void>;
    private isAspect;
    /**
     * same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound
     */
    private importAndGetAspects;
    /**
     * split the provided components into 2 groups, one which are workspace components and the other which are not.
     * @param components
     * @returns
     */
    private groupComponentsByWorkspaceExistence;
    private groupComponentsByLoadFromRootComps;
    private shouldLoadFromRootComps;
    /**
     * split the provided components into 2 groups, one which are workspace components and the other which are not.
     * @param components
     * @returns
     */
    private groupAspectDefsByWorkspaceExistence;
    private groupIdsByWorkspaceExistence;
}
