import { Class } from '#di'; import { SystemLogMediator } from '#logger/system-log-mediator.js'; import { AnyObj, GuardItem, ModuleType, NormalizedGuard, Provider } from '#types/mix.js'; import { ModuleWithParams, AppendsWithParams, ModuleMetadata } from '#types/module-metadata.js'; import { ExtensionProvider } from '#types/extension-types.js'; import { NormalizedModuleMetadata } from '#types/normalized-module-metadata.js'; import { ExtensionOptions } from '#utils/get-extension-provider.js'; import { ModuleMetadataWithContext } from '#utils/get-module-metadata.js'; export type ModulesMap = Map; export type ModulesMapId = Map; /** * Don't use this for public API (worse readable). */ type AnyModule = ModuleType | ModuleWithParams | AppendsWithParams; type ModuleId = string | ModuleType | ModuleWithParams; /** * Scans modules, normalizes, stores and checks their metadata for correctness, * adds and removes imports of one module into another. */ export declare class ModuleManager { protected systemLogMediator: SystemLogMediator; protected map: ModulesMap; protected mapId: Map; protected oldMap: ModulesMap; protected oldMapId: Map; protected unfinishedScanModules: Set; protected scanedModules: Set; /** * The directory in which the class was declared. */ protected rootDeclaredInDir: string; constructor(systemLogMediator: SystemLogMediator); /** * Creates a snapshot of `NormalizedModuleMetadata` for the root module, stores locally and returns it. * You can also get the result this way: `moduleManager.getMetadata('root')`. */ scanRootModule(appModule: ModuleType): NormalizedModuleMetadata; /** * Returns a snapshot of `NormalizedModuleMetadata` for a module. */ scanModule(modOrObj: ModuleType | ModuleWithParams): NormalizedModuleMetadata; /** * Returns a snapshot of `NormalizedModuleMetadata` for given module or module ID. */ getMetadata(moduleId: ModuleId, throwErrIfNotFound?: false): NormalizedModuleMetadata | undefined; getMetadata(moduleId: ModuleId, throwErrIfNotFound: true): NormalizedModuleMetadata; /** * If `inputModule` added, returns `true`, otherwise - returns `false`. * * @param inputModule Module to be added. * @param targetModuleId Module ID to which the input module will be added. */ addImport(inputModule: ModuleType | ModuleWithParams, targetModuleId?: ModuleId): boolean | void; /** * @param targetModuleId Module ID from where the input module will be removed. */ removeImport(inputModuleId: ModuleId, targetModuleId?: ModuleId): boolean | void; commit(): void; rollback(err?: Error): void; /** * Returns shapshot of current map for all modules. */ getModulesMap(): Map>; /** * Here "raw" means that it returns "raw" normalized metadata (without `this.copyMeta()`). */ protected scanRawModule(modOrObj: AnyModule): NormalizedModuleMetadata; protected copyMeta(meta: NormalizedModuleMetadata): NormalizedModuleMetadata; /** * Returns normalized metadata, but without `this.copyMeta()`. */ protected getRawMetadata(moduleId: ModuleId, throwErrIfNotFound?: boolean): NormalizedModuleMetadata | undefined; protected getRawMetadata(moduleId: ModuleId, throwErrIfNotFound: true): NormalizedModuleMetadata; protected startTransaction(): boolean; /** * Recursively searches for input module. * Returns true if input module includes in imports/exports of target module. * * @param inputModuleId The module you need to find. * @param targetModuleId Module where to search `inputModule`. */ protected includesInSomeModule(inputModuleId: ModuleId, targetModuleId: ModuleId): boolean; /** * Returns normalized module metadata. */ protected normalizeMetadata(mod: AnyModule): NormalizedModuleMetadata; protected checkController(modName: string, Controller: Class): void; protected checkExtensionOptions(modName: string, extensionOptions: ExtensionOptions, i: number): void; protected pickMeta(targetObject: NormalizedModuleMetadata, ...sourceObjects: ModuleMetadataWithContext[]): any; protected checkWhetherIsExternalModule(rawMeta: ModuleMetadataWithContext, meta: NormalizedModuleMetadata): void; protected exportFromRawMeta(rawMeta: ModuleMetadata, modName: string, providersTokens: any[], meta: NormalizedModuleMetadata): void; protected checkReexportModules(meta: NormalizedModuleMetadata): void; protected normalizeGuards(guards?: GuardItem[]): NormalizedGuard[]; protected checkGuardsPerMod(guards: NormalizedGuard[], moduleName: string): void; protected quickCheckMetadata(meta: NormalizedModuleMetadata): void; protected throwIfUndefined(modName: string, action: 'Imports' | 'Exports' | 'Appends', imp: AnyModule | Provider, i: number): void; protected checkInitMethodForExtension(modName: string, extensionsProvider: ExtensionProvider): void; protected throwUnidentifiedToken(modName: string, token: any): void; protected throwPath(modName: string): string; protected throwIfNormalizedProvider(moduleName: string, provider: any): void; protected throwExportsIfNormalizedProvider(moduleName: string, provider: any): void; protected findAndSetProviders(token: any, rawMeta: ModuleMetadata, meta: NormalizedModuleMetadata): void; } export {}; //# sourceMappingURL=module-manager.d.ts.map