import type { CLIMain } from '@teambit/cli'; import type { AspectLoaderMain } from '@teambit/aspect-loader'; import type { SlotRegistry, Harmony } from '@teambit/harmony'; import type { Workspace } from '@teambit/workspace'; import type { WatcherMain } from '@teambit/watcher'; import type { BuilderMain } from '@teambit/builder'; import type { ScopeMain } from '@teambit/scope'; import type { Logger, LoggerMain } from '@teambit/logger'; import type { EnvsMain } from '@teambit/envs'; import type { ComponentMain, ComponentID, Component } from '@teambit/component'; import type { ApplicationType } from './application-type'; import type { Application } from './application'; import type { DeploymentProvider } from './deployment-provider'; import { AppService } from './application.service'; import { AppContext } from './app-context'; export type ApplicationTypeSlot = SlotRegistry[]>; export type ApplicationSlot = SlotRegistry; export type DeploymentProviderSlot = SlotRegistry; export type ApplicationAspectConfig = { /** * envs ids to load app types. */ envs?: string[]; }; /** * Application meta data that is stored on the component on load if it's an application. */ export type ApplicationMetadata = { appName: string; type?: string; }; export type ServeAppOptions = { /** * default port range used to serve applications. */ defaultPortRange?: [start: number, end: number]; /** * determine whether to start the application in dev mode. */ dev: boolean; /** * actively watch and compile the workspace (like the bit watch command) * @default true */ watch?: boolean; /** * determine whether to start the application in server side mode. * @default false */ ssr?: boolean; /** * exact port to run the app */ port?: number; /** * arguments passing to the app. */ args?: string; }; export declare class ApplicationMain { private appSlot; private appTypeSlot; private deploymentProviderSlot; private config; private envs; private componentAspect; private appService; private aspectLoader; private workspace; private logger; private watcher; private harmony; constructor(appSlot: ApplicationSlot, appTypeSlot: ApplicationTypeSlot, deploymentProviderSlot: DeploymentProviderSlot, config: ApplicationAspectConfig, envs: EnvsMain, componentAspect: ComponentMain, appService: AppService, aspectLoader: AspectLoaderMain, workspace: Workspace, logger: Logger, watcher: WatcherMain, harmony: Harmony); /** * register a new app. */ registerApp(app: Application): this; /** * list all registered apps. */ listApps(): Application[]; listAppsIdsAndNames(): Promise<{ id: string; name: string; }[]>; /** * map all apps by component ID. */ mapApps(): [string, Application[]][]; /** * instead of adding apps to workspace.jsonc, this method gets all apps components and load them as aspects so then * they could register to the apps slots and be available to list/run etc. * if poolIds is provided, it will load only the apps that are part of the pool. */ loadAllAppsAsAspects(poolIds?: ComponentID[]): Promise; /** * list apps by a component id. * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc */ listAppsById(id?: ComponentID): Application[] | undefined; /** * get an application by a component id. * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc */ getAppById(id: ComponentID): Promise; /** * calculate an application by a component. * This should be only used during the on component load slot */ calculateAppByComponent(component: Component): Application | undefined; listAppTypes(): ApplicationType[]; /** * @deprecated use `listAppsComponents` instead. * @returns */ listAppsFromComponents(): Promise; /** * list all components that are apps. * if poolIds is provided, it will load only the apps that are part of the pool. */ listAppsComponents(poolIds?: ComponentID[]): Promise; private hasAppTypePattern; getAppPatterns(): string[]; loadApps(): Promise; loadAppsFromComponent(component: Component, rootDir: string): Promise; /** * get an app. * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc */ getApp(appName: string, id?: ComponentID): Application | undefined; getAppByNameOrId(appNameOrId: string): Application | undefined; getAppPattern(appType: ApplicationType): string; /** * registers a new app and sets a plugin for it. */ registerAppType(...appTypes: Array>): this; /** * get an app AspectId. */ getAppAspect(appName: string): string | undefined; /** * get app to throw. * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc */ getAppOrThrow(appName: string): Application; defaultOpts: ServeAppOptions; private computeOptions; loadAppsToSlot(): Promise; /** * run an app. * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc */ runApp(appName: string, options?: ServeAppOptions): Promise<{ app: Application; port: number | undefined; errors?: Error[]; isOldApi: boolean; }>; /** * get the component ID of a certain app. */ getAppIdOrThrow(appName: string): Promise; private createAppContext; createAppBuildContext(id: ComponentID, appName: string, capsuleRootDir: string, rootDir?: string): Promise; static runtime: import("@teambit/harmony").RuntimeDefinition; static dependencies: import("@teambit/harmony").Aspect[]; static slots: (((registerFn: () => string) => SlotRegistry[]>) | ((registerFn: () => string) => SlotRegistry) | ((registerFn: () => string) => SlotRegistry))[]; static provider([cli, loggerAspect, builder, envs, component, aspectLoader, workspace, watcher, scope]: [ CLIMain, LoggerMain, BuilderMain, EnvsMain, ComponentMain, AspectLoaderMain, Workspace, WatcherMain, ScopeMain ], config: ApplicationAspectConfig, [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot], harmony: Harmony): Promise; }