{"version":3,"file":"ngx-mfe.mjs","sources":["../../../projects/ngx-mfe/src/lib/decorators/track-changes.decorator.ts","../../../projects/ngx-mfe/src/lib/helpers/delay.ts","../../../projects/ngx-mfe/src/lib/registry/mfe-registry.ts","../../../projects/ngx-mfe/src/lib/helpers/load-mfe.ts","../../../projects/ngx-mfe/src/lib/injection-tokens/options.token.ts","../../../projects/ngx-mfe/src/lib/interfaces/ngx-mfe-options.interface.ts","../../../projects/ngx-mfe/src/lib/interfaces/remote-component.interface.ts","../../../projects/ngx-mfe/src/lib/services/dynamic-component-binding.ts","../../../projects/ngx-mfe/src/lib/services/remote-components-cache.ts","../../../projects/ngx-mfe/src/lib/services/remote-component-loader.ts","../../../projects/ngx-mfe/src/lib/directives/mfe-outlet.directive.ts","../../../projects/ngx-mfe/src/lib/mfe.module.ts"],"sourcesContent":["import { SimpleChanges } from '@angular/core';\n\n/**\n * Strategy for changing the component's @Input() variable.\n */\nexport enum EChangesStrategy {\n\t/**\n\t * Called on every change.\n\t */\n\tEach,\n\t/**\n\t * Called only on the first change.\n\t */\n\tFirst,\n\t/**\n\t * Called on every change except the first.\n\t */\n\tNonFirst,\n}\n\nexport interface TrackChangesOptions {\n\t/**\n\t * Change strategy.\n\t * @default EChangesStrategy.Each\n\t */\n\tstrategy?: EChangesStrategy;\n\t/**\n\t * Compare the previous value with the current one\n\t * and execute the method only if the values differ.\n\t *\n\t * Values must be immutable, as values are compared by reference.\n\t * @default false\n\t */\n\tcompare?: boolean;\n}\n\nconst defaultOptions: TrackChangesOptions = {\n\tstrategy: EChangesStrategy.Each,\n\tcompare: false,\n};\n\n/**\n * Decorator of lifecycle hook ngOnChanges, that call specified method when changes prop (@Input) value.\n * -------\n *\n * Method decorator.\n *\n * @param prop Variable name of Input, that will be call method when changes.\n * @param methodName The name of the method that will be called when the variable changes.\n * @param options Options.\n */\nexport function TrackChanges<T>(\n\tprop: string,\n\tmethodName: string,\n\toptions?: TrackChangesOptions\n): MethodDecorator {\n\treturn function (\n\t\ttarget: any,\n\t\t_propertyKey: string | symbol,\n\t\tdescriptor: PropertyDescriptor\n\t): TypedPropertyDescriptor<any> {\n\t\tconst _options = { ...defaultOptions, ...options };\n\t\tconst originalMethod = descriptor.value as (changes: SimpleChanges) => void;\n\n\t\tdescriptor.value = function (changes: SimpleChanges): void {\n\t\t\tif (changes && changes[prop] && changes[prop].currentValue !== undefined) {\n\t\t\t\tconst isFirstChange = changes[prop].firstChange;\n\t\t\t\tconst shouldCompareValues = _options.compare;\n\t\t\t\tconst isValuesDifference = changes[prop].previousValue !== changes[prop].currentValue;\n\n\t\t\t\tif (\n\t\t\t\t\t_options.strategy === EChangesStrategy.Each ||\n\t\t\t\t\t(_options.strategy === EChangesStrategy.First && isFirstChange) ||\n\t\t\t\t\t(_options.strategy === EChangesStrategy.NonFirst && !isFirstChange)\n\t\t\t\t) {\n\t\t\t\t\tif (!shouldCompareValues) {\n\t\t\t\t\t\ttarget[methodName].call(this, changes[prop].currentValue as T);\n\t\t\t\t\t} else if (isValuesDifference) {\n\t\t\t\t\t\ttarget[methodName].call(this, changes[prop].currentValue as T);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toriginalMethod.call(this, changes);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n","export const delay = <T>(time: number) => new Promise<T>((resolve) => setTimeout(resolve, time));","import { map, Observable, ReplaySubject, take } from 'rxjs';\nimport { MfeConfig } from '../interfaces';\n\n/**\n * Registry of micro-frontends apps.\n */\nexport class MfeRegistry {\n  private static _instance: MfeRegistry;\n\n  private readonly _mfeConfig$ = new ReplaySubject<MfeConfig>(1);\n\n  /**\n   * Get instance of the MfeRegistry\n   */\n  public static get instance(): MfeRegistry {\n    if (!MfeRegistry._instance) {\n      MfeRegistry._instance = new MfeRegistry();\n    }\n\n    return MfeRegistry._instance;\n  }\n\n  private constructor() {}\n\n  /**\n   * Set config.\n   * @param config Micro-frontends config\n   */\n  public setMfeConfig(config: MfeConfig): void {\n    this._mfeConfig$.next(config);\n  }\n\n  /**\n   * Get the remote entry URL the micro-frontend app\n   * @param mfeApp Micro-frontend app name\n   */\n  public getMfeRemoteEntry(mfeApp: string): Observable<string> {\n    return this._mfeConfig$.pipe(\n      take(1),\n      map((config) => {\n        const remoteEntry = config[mfeApp];\n\n        if (!remoteEntry) {\n          throw new Error(\n            `'${mfeApp}' micro-frontend is not registered in the MfeRegistery using MfeModule.forRoot({ mfeConfig })`\n          );\n        }\n\n        return remoteEntry;\n      })\n    );\n  }\n}\n","import { loadRemoteModule, LoadRemoteModuleOptions } from '@angular-architects/module-federation';\nimport { Type } from '@angular/core';\n\nimport { firstValueFrom } from 'rxjs';\nimport { MfeRegistry } from '../registry';\n\n/**\n *  Options for ```loadMfe``` function.\n */\nexport type LoadMfeOptions = {\n\t/**\n\t * Set custom exposed module name, by default module name = exposedItem + 'Module'.\n\t */\n\tmoduleName?: string,\n\t/**\n\t * Type of loaded module as a ```script``` or as a ```module```.\n\t */\n\ttype?: LoadRemoteModuleOptions['type'];\n};\n\nconst loadMfeDefaultOptions: LoadMfeOptions = { type: 'module' };\n\n/**\n * Loads remote bundle.\n *\n * @param remoteApp The name of the micro-frontend app decalred in ModuleFederationPlugin.\n * @param exposedModule  The key of the exposed module decalred in ModuleFederationPlugin.\n * @param options (Optional) object of options.\n */\nexport async function loadMfe<T = unknown>(\n\tremoteApp: string,\n\texposedModule: string,\n\toptions: LoadMfeOptions = loadMfeDefaultOptions\n): Promise<Type<T>> {\n  const _options: LoadMfeOptions = { ...loadMfeDefaultOptions, ...options };\n  const remoteEntry = await firstValueFrom(MfeRegistry.instance.getMfeRemoteEntry(remoteApp));\n\tconst loadRemoteModuleOptions: LoadRemoteModuleOptions =\n\t\t_options.type === 'module'\n\t\t\t? { type: _options.type, remoteEntry, exposedModule }\n\t\t\t: { type: _options.type, remoteEntry, exposedModule, remoteName: remoteApp };\n\tconst bundle = await loadRemoteModule(loadRemoteModuleOptions);\n  const moduleName = _options.moduleName ?? exposedModule;\n  const module = bundle[moduleName]\n\n  if (!module) {\n    throw new Error(`Module with name \"${moduleName}\" does not exist in the exposed file. Key of exposed file must match with class name in this file (Key of exposed file it is key of  'exposes' object in webpack config inside ModuleFederationPlugin).`);\n  }\n\n\treturn module;\n}\n","import { InjectionToken } from '@angular/core';\nimport { NgxMfeOptions } from '../interfaces';\n\n/**\n * InjectionToken of options.\n */\nexport const NGX_MFE_OPTIONS = new InjectionToken<NgxMfeOptions>('ngx-mfe/options');\n","import { Observable } from 'rxjs';\nimport { MfeConfig } from './mfe-config.interface';\nimport { RemoteComponent } from './remote-component.interface';\n\n/**\n * Sync list of available micro-frontends.\n */\nexport type NgxMfeSyncConfig = MfeConfig;\n\n/**\n * Async list of available micro-frontends.\n */\nexport type NgxMfeAsyncConfig = {\n   /**\n    * A function to invoke to load a `MfeConfig`. The function is invoked with\n    * resolved values of `token`s in the `deps` field.\n    */\n  useLoader: (...deps: any[]) => Observable<NgxMfeSyncConfig> | Promise<NgxMfeSyncConfig>;\n   /**\n    * A list of `token`s to be resolved by the injector. The list of values is then\n    * used as arguments to the `useLoader` function.\n    */\n  deps?: any[];\n};\n\n/**\n * Type of sync / async list of available micro-frontends.\n */\nexport type NgxMfeConfigOption = NgxMfeSyncConfig | NgxMfeAsyncConfig;\n\n/**\n * Type guard check that NgxMfeConfig is async list of available micro-frontends.\n */\nexport const isNgxMfeConfigAsync = (config: NgxMfeConfigOption): config is NgxMfeAsyncConfig => {\n\treturn Object.prototype.hasOwnProperty.call(config, 'useLoader');\n}\n\n/**\n * Global options.\n */\nexport interface NgxMfeOptions {\n\t/**\n   * List of names of remote appls, declared apps will be downloaded immediately and stored in the cache.\n\t */\n\tpreload?: string[];\n\t/**\n\t * Loader remote component.\n\t *\n\t * Shows when load bundle of the micro-frontend.\n\t *\n\t * For better UX, add this micro-frontend to {@link preload} array.\n\t */\n\tloader?: RemoteComponent;\n\t/**\n\t * The delay between displaying the contents of the bootloader and the micro-frontend.\n\t *\n\t * This is to avoid flickering when the micro-frontend loads very quickly.\n\t */\n\tloaderDelay?: number;\n\t/**\n\t * Fallback remote component.\n\t * \n\t * Showing when an error occurs while loading bundle\n\t * or when trying to display the contents of the micro-frontend.\n\t *\n\t * For better UX, add this micro-frontend to {@link preload} array.\n\t */\n\tfallback?: RemoteComponent;\n}\n\n/**\n * Options forRoot configuration of `NgxMfeModule`\n */\nexport type NgxMfeForRootOptions = NgxMfeOptions & {\n  /**\n   * List of available micro-frontends.\n\t */\n  mfeConfig: NgxMfeConfigOption;\n}\n","export interface StandaloneRemoteComponent {\n\t/**\n\t * Remote app name, specified in ModuleFederationPlugin in name config.\n\t */\n\tapp: string;\n\t/**\n\t * The key of the exposed component.\n\t */\n\tcomponent: string;\n}\n\nexport interface RemoteComponentWithModule {\n\t/**\n\t * Remote app name, specified in ModuleFederationPlugin in name config.\n\t */\n\tapp: string;\n\t/**\n\t * The key of the exposed component.\n\t */\n\tcomponent: string;\n\t/**\n\t * The key of the exposed module in which the component is declared.\n\t */\n\tmodule: string;\n}\n\nexport type RemoteComponent = StandaloneRemoteComponent | RemoteComponentWithModule;\n\n/**\n * Type Guard for RemoteComponent, checks if RemoteComponent is Standalone\n * @param remoteComponent Mfe Remote Component\n * @returns\n */\nexport function isStandaloneRemoteComponent(\n\tremoteComponent: RemoteComponent\n): remoteComponent is StandaloneRemoteComponent {\n\treturn !Object.prototype.hasOwnProperty.call(remoteComponent, 'module');\n}\n\n/**\n * Type Guard for RemoteComponent, checks if RemoteComponent is Modular\n * @param remoteComponent Mfe Remote Component\n * @returns\n */\nexport function isRemoteComponentWithModule(\n\tremoteComponent: RemoteComponent\n): remoteComponent is RemoteComponentWithModule {\n\treturn Object.prototype.hasOwnProperty.call(remoteComponent, 'module');\n}\n","import { ComponentRef, EventEmitter, Injectable, OnDestroy } from '@angular/core';\nimport { Subject, takeUntil } from 'rxjs';\n\nimport { MfeOutletInputs, MfeOutletOutputs } from '../types';\n\n/**\n * The service that binds the dynamic component.\n */\n@Injectable()\nexport class DynamicComponentBinding implements OnDestroy {\n\tprivate readonly _destroy$ = new Subject<void>();\n\n\tpublic ngOnDestroy(): void {\n\t\tthis._destroy$.next();\n\t\tthis._destroy$.complete();\n\t}\n\n\t/**\n\t * Bind provided MfeOutletInputs to dynamic component.\n\t * @param componentRef Reference of component.\n\t * @param inputs Provided MfeOutletInputs.\n\t */\n\tpublic bindInputs<T = unknown>(componentRef: ComponentRef<T>, inputs: MfeOutletInputs): void {\n\t\tfor (const key in inputs) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(inputs, key)) {\n\t\t\t\t(componentRef.instance as any)[key] = inputs[key];\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Bind provided MfeOutletOutputs to dynamic component.\n\t * @param componentRef Reference of component.\n\t * @param outputs Provided MfeOutletOutputs.\n\t */\n\tpublic bindOutputs<T = unknown>(\n\t\tcomponentRef: ComponentRef<T>,\n\t\toutputs: MfeOutletOutputs\n\t): void {\n\t\tthis._validateOutputs(componentRef, outputs);\n\n\t\tfor (const key in outputs) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(outputs, key)) {\n\t\t\t\t((componentRef.instance as any)[key] as EventEmitter<any>)\n\t\t\t\t\t.pipe(takeUntil(this._destroy$))\n\t\t\t\t\t.subscribe((event) => {\n\t\t\t\t\t\tconst handler = outputs[key];\n\t\t\t\t\t\tif (handler) {\n\t\t\t\t\t\t\t// in case the output has not been provided at all\n\t\t\t\t\t\t\thandler(event);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Unbind all outputs.\n\t */\n\tpublic unbindOutputs(): void {\n\t\tthis._destroy$.next();\n\t}\n\n\t/**\n\t * Validate MfeOutletOutputs of dynamic component.\n\t * @param componentRef Reference of component.\n\t * @param outputs Provided MfeOutletOutputs.\n\t */\n\tprivate _validateOutputs<T = unknown>(\n\t\tcomponentRef: ComponentRef<T>,\n\t\toutputs: MfeOutletOutputs\n\t): void {\n\t\tObject.keys(outputs).forEach((key) => {\n\t\t\tconst isComponentHaveOutput = Object.prototype.hasOwnProperty.call(\n\t\t\t\tcomponentRef.instance,\n\t\t\t\tkey\n\t\t\t);\n\n\t\t\tif (!isComponentHaveOutput) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Dynamically bound Output \"${key}\" is not declared in target component ${componentRef.componentType.constructor.name}.`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!((componentRef.instance as any)[key] instanceof EventEmitter)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Dynamically bound Output \"${key}\" must be an instance of EventEmitter.`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!(outputs[key] instanceof Function)) {\n\t\t\t\tthrow new Error(`Dynamically bound Output \"${key}\" must be a function.`);\n\t\t\t}\n\t\t});\n\t}\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AsyncSubject, lastValueFrom } from 'rxjs';\n\nimport {\n\tisRemoteComponentWithModule,\n\tRemoteComponentWithModule,\n\tRemoteComponent,\n\tStandaloneRemoteComponent,\n  isStandaloneRemoteComponent,\n} from '../interfaces';\nimport { ComponentWithNgModuleRef } from '../types';\n\n/**\n * Cache of the loaded micro-frontend apps.\n *\n * Main reasons to create cache:\n * 1) Avoid race condition, when same micro-frontend are requested twice or more times at the same time.\n * 2) Cache already loaded MFE component and dont make same request twice.\n */\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class RemoteComponentsCache {\n\tprivate readonly _map = new Map<string, AsyncSubject<ComponentWithNgModuleRef<any, any> | Type<any>>>();\n\n\t/**\n\t * Register a new micro-frontend cache.\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tpublic register(remoteComponent: RemoteComponent): void {\n\t\tif (this.isRegistered(remoteComponent)) return;\n\n\t\tconst key = this.generateKey(remoteComponent);\n\t\tthis._map.set(key, new AsyncSubject<ComponentWithNgModuleRef<any, any> | Type<any>>());\n\t}\n\n\t/**\n\t * Unregister a micro-frontend cache.\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tpublic unregister(remoteComponent: RemoteComponent): void {\n\t\tif (!this.isRegistered(remoteComponent)) return;\n\n\t\tconst key = this.generateKey(remoteComponent);\n\t\tthis._map.delete(key);\n\t}\n\n\t/**\n\t * Checks that specified micro-frontend app already registered.\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tpublic isRegistered(remoteComponent: RemoteComponent): boolean {\n\t\tconst key = this.generateKey(remoteComponent);\n\t\treturn this._map.has(key);\n\t}\n\n\t/**\n\t * Set to cache ComponentWithNgModuleRef of micro-frontend.\n\t * @param remoteComponent Mfe Remote Component\n\t * @param value ComponentWithNgModuleRef for that micro-frontend\n\t */\n\tpublic setValue<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponentWithModule,\n\t\tvalue: ComponentWithNgModuleRef<TComponent, TModule>\n\t): void;\n\n\tpublic setValue<TComponent>(\n\t\tremoteComponent: StandaloneRemoteComponent,\n\t\tvalue: Type<TComponent>\n\t): void;\n\n\tpublic setValue<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponent,\n\t\tvalue: ComponentWithNgModuleRef<TComponent, TModule> | Type<TComponent>\n\t): void {\n\t\tif (!this.isRegistered(remoteComponent)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Error while trying to set value into MFE cache, this key - \"${JSON.stringify(\n\t\t\t\t\tremoteComponent\n\t\t\t\t)}\" does not exist in cache`\n\t\t\t);\n\t\t}\n\n\t\tif (isStandaloneRemoteComponent(remoteComponent)) {\n      const cache = this.getCache<TComponent>(remoteComponent);\n      cache.next(value as Type<TComponent>);\n      cache.complete();\n      return;\n\t\t} \n\n    const cache = this.getCache<TComponent, TModule>(remoteComponent);\n    cache.next(value as ComponentWithNgModuleRef<TComponent, TModule>);\n    cache.complete();\n\t}\n\n\t/**\n\t * Sets the error that occurs in the loading and compiling micro-frontend.\n\t * @param remoteComponent Mfe Remote Component\n\t * @param error Error\n\t */\n\tpublic setError(remoteComponent: RemoteComponent, error: any): void {\n\t\tif (!this.isRegistered(remoteComponent)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Error while trying to set error into MFE cache, this key - \"${JSON.stringify(\n\t\t\t\t\tremoteComponent\n\t\t\t\t)}\" does not exist in cache`\n\t\t\t);\n\t\t}\n\n\t\tconst cache = this.getCache(remoteComponent);\n\t\tcache.error(error);\n\t\tcache.complete();\n\t}\n\n\t/**\n\t * Gets ComponentWithNgModuleRef or Component Class of the micro-frontend.\n\t *\n\t * ---------------------\n\t * Returns ComponentWithNgModuleRef of MFE for component with module,\n\t * or returns Component Class of MFE for standalone component.\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tpublic getValue<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponentWithModule\n\t): Promise<ComponentWithNgModuleRef<TComponent, TModule>>;\n\n\tpublic getValue<TComponent>(\n\t\tremoteComponent: StandaloneRemoteComponent\n\t): Promise<Type<TComponent>>;\n\n\tpublic getValue<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponent\n\t): Promise<ComponentWithNgModuleRef<TComponent, TModule>> | Promise<Type<TComponent>> {\n\t\tif (isStandaloneRemoteComponent(remoteComponent)) {\n\t\t\tconst cache = this.getCache<TComponent>(remoteComponent);\n\t\t\treturn lastValueFrom(cache);\n\t\t}\n\n\t\tconst cache = this.getCache<TComponent, TModule>(remoteComponent);\n\t\treturn lastValueFrom(cache);\n\t}\n\n\t/**\n\t * Gets the AsyncSubject cache value from Map\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tprotected getCache<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponentWithModule\n\t): AsyncSubject<ComponentWithNgModuleRef<TComponent, TModule>>;\n\n\tprotected getCache<TComponent>(\n\t\tremoteComponent: StandaloneRemoteComponent\n\t): AsyncSubject<Type<TComponent>>;\n\n\tprotected getCache<TComponent, TModule>(\n\t\tremoteComponent: RemoteComponent\n\t): AsyncSubject<ComponentWithNgModuleRef<TComponent, TModule>> |  AsyncSubject<Type<TComponent>> {\n\t\tconst key = this.generateKey(remoteComponent);\n\t\tconst value = this._map.get(key);\n\n\t\tif (!value)\n\t\t\tthrow new Error(\n\t\t\t\t`Error MFE \"${JSON.stringify(remoteComponent)}\" does not exist in cache`\n\t\t\t);\n\n\t\tif (isStandaloneRemoteComponent(remoteComponent)) {\n      return value as AsyncSubject<Type<TComponent>>;\n    }\n    \n    return value as AsyncSubject<ComponentWithNgModuleRef<TComponent, TModule>>;\n\t}\n\n\t/**\n\t * Generates a cache key based on RemoteComponent\n\t * @param remoteComponent Mfe Remote Component\n\t */\n\tprotected generateKey(remoteComponent: RemoteComponent): string {\n\t\tif (isRemoteComponentWithModule(remoteComponent)) {\n\t\t\treturn `${remoteComponent.app}/${remoteComponent.component}/${remoteComponent.module}`;\n\t\t}\n\n\t\treturn `${remoteComponent.app}/${remoteComponent.component}`;\n\t}\n}\n","import { createNgModuleRef, Injectable, Injector, NgZone, Type } from '@angular/core';\n\nimport { loadMfe, LoadMfeOptions } from '../helpers';\nimport { RemoteComponentWithModule, StandaloneRemoteComponent } from '../interfaces';\nimport { ComponentWithNgModuleRef } from '../types';\nimport { RemoteComponentsCache } from './remote-components-cache';\n\n/**\n * A low-level service for loading a remote micro-frontend component.\n */\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class RemoteComponentLoader {\n\tconstructor(\n    private readonly _ngZone: NgZone,\n\t\tprivate readonly _injector: Injector,\n\t\tprivate readonly _cache: RemoteComponentsCache\n\t) {}\n\n\t/**\n\t * Loads a remote component with module where was declared this component.\n\t * @param remoteComponent Remote component.\n\t * @param injector (Optional) Injector, use root injector by default.\n\t * @param options (Optional) object of options.\n\t */\n\tpublic async loadComponentWithModule<TComponent = unknown, TModule = unknown>(\n\t\tremoteComponent: RemoteComponentWithModule,\n\t\tinjector: Injector = this._injector,\n\t\toptions?: LoadMfeOptions\n\t): Promise<ComponentWithNgModuleRef<TComponent, TModule>> {\n\t\ttry {\n\t\t\tif (this._cache.isRegistered(remoteComponent)) {\n\t\t\t\treturn this._cache.getValue<TComponent, TModule>(remoteComponent);\n\t\t\t}\n\n\t\t\tthis._cache.register(remoteComponent);\n\n\t\t\tconst { component, module } = await this._ngZone.runOutsideAngular(async () => {\n\t\t\t\tconst component = await loadMfe<TComponent>(\n\t\t\t\t\tremoteComponent.app,\n\t\t\t\t\tremoteComponent.component,\n\t\t\t\t\toptions\n\t\t\t\t);\n\t\t\t\tconst module = await loadMfe<TModule>(\n\t\t\t\t\tremoteComponent.app,\n\t\t\t\t\tremoteComponent.module,\n\t\t\t\t\toptions\n\t\t\t\t);\n\n\t\t\t\treturn { component, module };\n\t\t\t});\n\n      const ngModuleRef = createNgModuleRef(module, injector);\n\n      const componentWithNgModuleRef: ComponentWithNgModuleRef<TComponent, TModule> = { component, ngModuleRef };\n      this._cache.setValue<TComponent, TModule>(remoteComponent, componentWithNgModuleRef);\n      return componentWithNgModuleRef;\n\t\t} catch (error: unknown) {\n\t\t\tthis._cache.setError(remoteComponent, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Loads a standalone remote component.\n\t * @param remoteComponent Remote component\n\t * @param options (Optional) object of options.\n\t */\n\tpublic async loadStandaloneComponent<C = unknown>(\n\t\tremoteComponent: StandaloneRemoteComponent,\n\t\toptions?: LoadMfeOptions\n\t): Promise<Type<C>> {\n\t\ttry {\n\t\t\tif (this._cache.isRegistered(remoteComponent)) {\n\t\t\t\treturn this._cache.getValue<C>(remoteComponent);\n\t\t\t}\n\n\t\t\tthis._cache.register(remoteComponent);\n\t\t\t\n\n\t\t\tconst componentType = await this._ngZone.runOutsideAngular(() =>\n\t\t\t\tloadMfe<C>(remoteComponent.app, remoteComponent.component, options)\n\t\t\t);\n\n\t\t\tthis._cache.setValue<C>(remoteComponent, componentType);\n\n\t\t\treturn componentType;\n\t\t} catch (error: unknown) {\n\t\t\tthis._cache.setError(remoteComponent, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n","import {\n  AfterViewInit,\n  ChangeDetectorRef,\n  ComponentRef,\n  Directive,\n  EmbeddedViewRef,\n  Inject,\n  Injector,\n  Input,\n  OnChanges,\n  OnDestroy,\n  TemplateRef,\n  ViewContainerRef\n} from '@angular/core';\n\nimport { EChangesStrategy, TrackChanges } from '../decorators';\nimport { delay, LoadMfeOptions } from '../helpers';\nimport { NGX_MFE_OPTIONS } from '../injection-tokens';\nimport { isRemoteComponentWithModule, isStandaloneRemoteComponent, NgxMfeOptions, RemoteComponent, RemoteComponentWithModule, StandaloneRemoteComponent } from '../interfaces';\nimport { DynamicComponentBinding, RemoteComponentLoader, RemoteComponentsCache } from '../services';\nimport { MfeOutletInputs, MfeOutletOutputs } from '../types';\n\n/**\n * Micro-frontend directive for plugin-based approach.\n * -------------\n *\n * This directive give you to load micro-frontend inside in HTML template.\n *\n * @example Loads remote component and show as embed view or as a plugin.\n * ```html\n * <!-- Loads EntryComponent that declared in EntryModule from dashboard micro-frontend app. -->\n * <ng-container *mfeOutlet=\"\n *    'dashboard';\n *    module: 'EntryModule';\n *    component: 'EntryComponent';\n * \">\n * </ng-container>\n *\n * <!-- Or you can use ng-template, next example works same as previous example -->\n * <ng-template\n *    mfeOutlet=\"dashboard\"\n *    mfeOutletModule=\"EntryModule\"\n *    mfeOutletComponent=\"EntryComponent\"\n * >\n * </ng-template>\n * ```\n *\n * @example Loads standalone remote component. Standalone component - it is a component that does not depend on anything and does not need dependencies from other modules.\n * ```html\n * <!-- You can load a standalone component without declaring a module in the mfeOutletModule prop. -->\n * <ng-template\n *    mfeOutlet=\"dashboard\"\n *    mfeOutletComponent=\"EntryComponent\"\n * >\n * </ng-template>\n * ```\n *\n * @example You can sets Inputs and sets handlers for Output events of the Remote component.\n * ```html\n * <ng-container *mfeOutlet=\"\n *    'dashboard';\n *    module: 'EntryModule';\n *    component: 'EntryComponent';\n *    inputs: { text: text$ | async };\n *    outputs: { click: onClick }\n * \">\n * </ng-container>\n *```\n *\n * @example Loads remote component and sets custom loader, same approach for fallback view.\n * ```html\n * <ng-template\n *    mfeOutlet=\"dashboard\"\n *    mfeOutletModule=\"EntryModule\"\n *    mfeOutletComponent=\"EntryComponent\"\n *    [mfeOutletLoader]=\"loaderMfe\"\n *    [mfeOutletLoaderDelay]=\"2000\"\n * >\n * </ng-template>\n *\n * <!-- You can specify simple HTML content or declare another MFE component, like in the example below. -->\n * <ng-template #loaderMfe>\n *    <!-- For loader Mfe you should set mfeOutletLoader to undefined, and mfeOutletLoaderDelay to 0. For better UX. -->\n *    <ng-template\n *      mfeOutlet=\"loaders\"\n *      mfeOutletModule=\"SpinnerModule\"\n *      mfeOutletComponent=\"SpinnerComponent\"\n *      [mfeOutletLoader]=\"undefined\"\n *      [mfeOutletLoaderDelay]=\"0\"\n *    >\n *    </ng-template>\n * </ng-template>\n *\n * <!-- Simple HTML content. -->\n * <ng-template #loader>\n *    <div>loading...</div>\n * </ng-template>\n * ```\n */\n@Directive({\n  // eslint-disable-next-line @angular-eslint/directive-selector\n  selector: '[mfeOutlet]',\n  exportAs: 'mfeOutlet',\n  providers: [DynamicComponentBinding],\n})\nexport class MfeOutletDirective implements OnChanges, AfterViewInit, OnDestroy {\n  /**\n   * Sets the Remote app name.\n   */\n  @Input('mfeOutlet')\n  public mfeApp?: string;\n\n  /**\n   * Sets the Remote compoennt.\n   */\n  // eslint-disable-next-line @angular-eslint/no-input-rename\n  @Input('mfeOutletComponent')\n  public mfeComponent?: string;\n\n  /**\n   * Sets the Remote module where declared Remote component (```mfeOutletComponent```)\n   */\n  // eslint-disable-next-line @angular-eslint/no-input-rename\n  @Input('mfeOutletModule')\n  public mfeModule?: string;\n\n  /**\n   * A map of Inputs for a micro-frontend component.\n   */\n  @Input('mfeOutletInputs')\n  public inputs?: MfeOutletInputs;\n\n   /**\n    * A map of Outputs for a micro-frontend component.\n    */\n   @Input('mfeOutletOutputs')\n   public outputs?: MfeOutletOutputs;\n\n  /**\n   * Custom injector for micro-frontend component.\n   * @default current injector\n   */\n  @Input('mfeOutletInjector')\n  public injector?: Injector = this._injector;\n\n  /**\n   * MFE RemoteComponent or TemplateRef.\n   * Displayed when loading the micro-frontend.\n   *\n   * **Overrides the loader specified in the global library settings.**\n   * @default options.loader\n   */\n  @Input('mfeOutletLoader')\n  public set loader(value: TemplateRef<unknown> | undefined) {\n    this._loader = value;\n  }\n\n  /**\n   * The delay between displaying the contents of the bootloader and the micro-frontend .\n   *\n   * This is to avoid flickering when the micro-frontend loads very quickly.\n   *\n   * @default options.delay, if not set, then 0\n   */\n  @Input('mfeOutletLoaderDelay')\n  public loaderDelay = this._options.loaderDelay ?? 0;\n\n  /**\n   * MFE RemoteComponent or TemplateRef.\n   * Displayed when loaded or compiled a micro-frontend with an error.\n   *\n   * **Overrides fallback the specified in the global library settings.**\n   * @default options.fallback\n   */\n  @Input('mfeOutletFallback')\n  public set fallback(value: TemplateRef<unknown> | undefined) {\n    this._fallback = value;\n  }\n\n  /**\n   * Custom options for loading Mfe.\n   */\n  @Input('mfeOutletOptions')\n  public options?: LoadMfeOptions;\n\n  private _loader?: RemoteComponent | TemplateRef<unknown> = this._options.loader;\n  private _fallback?: RemoteComponent | TemplateRef<unknown> = this._options.fallback;\n\n  private _mfeComponentRef?: ComponentRef<unknown>;\n  private _loaderComponentRef?: ComponentRef<unknown> | EmbeddedViewRef<unknown>;\n  private _fallbackComponentRef?: ComponentRef<unknown> | EmbeddedViewRef<unknown>;\n\n  /**\n  * Remote component object.\n  */\n  private get _remoteComponent(): RemoteComponent {\n    if (this.mfeModule) {\n      return {\n        app: this.mfeApp,\n        component: this.mfeComponent,\n        module: this.mfeModule,\n      } as RemoteComponentWithModule;\n    }\n\n    return {\n      app: this.mfeApp,\n      component: this.mfeComponent,\n    } as StandaloneRemoteComponent;\n  }\n\n  constructor(\n    private readonly _vcr: ViewContainerRef,\n    // INSTEAD OF USE THIS REF TO INJECTOR USE `this.injector`\n    private readonly _injector: Injector,\n    private readonly _remoteComponentLoader: RemoteComponentLoader,\n    private readonly _remoteComponentCache: RemoteComponentsCache,\n    private readonly _dynamicBinding: DynamicComponentBinding,\n    @Inject(NGX_MFE_OPTIONS) private readonly _options: NgxMfeOptions\n  ) {}\n\n  @TrackChanges('mfeRemote', 'renderMfe', {\n    compare: true,\n    strategy: EChangesStrategy.NonFirst,\n  })\n  @TrackChanges('mfeComponent', 'renderMfe', {\n    compare: true,\n    strategy: EChangesStrategy.NonFirst,\n  })\n  @TrackChanges('mfeModule', 'renderMfe', {\n    compare: true,\n    strategy: EChangesStrategy.NonFirst,\n  })\n  @TrackChanges('inputs', 'transferInputs', {\n    strategy: EChangesStrategy.NonFirst,\n    compare: true,\n  })\n  public ngOnChanges(): void {\n    return;\n  }\n\n  public ngAfterViewInit(): void {\n    this.renderMfe();\n  }\n\n  public ngOnDestroy(): void {\n    this._clearView();\n  }\n\n  /**\n   * Transfer MfeOutletInputs to micro-frontend component.\n   *\n   * Used when changing input \"inputs\" of this directive.\n   * @internal\n   */\n  protected transferInputs(): void {\n    if (!this._mfeComponentRef) return;\n\n    this._dynamicBinding.bindInputs(this._mfeComponentRef, this.inputs ?? {});\n\n    // Workaround for bug related to Angular and dynamic components.\n    // Link - https://github.com/angular/angular/issues/36667#issuecomment-926526405\n    this._mfeComponentRef?.injector.get(ChangeDetectorRef).detectChanges();\n  }\n\n  /**\n   * Render micro-frontend component.\n   *\n   * While loading bundle of micro-frontend showing loader.\n   * If error occur then showing fallback.\n   *\n   * Used when changing input \"mfe\" of this directive.\n   * @internal\n   */\n  protected async renderMfe(): Promise<void> {\n    try {\n      // If some component already rendered then need to unbind outputs\n      if (this._mfeComponentRef) this._dynamicBinding.unbindOutputs();\n\n      if (this._remoteComponentCache.isRegistered(this._remoteComponent)) {\n        this._showMfe();\n      } else {\n        await this._showLoader();\n        await delay(this.loaderDelay);\n        this._showMfe();\n      }\n    } catch (error) {\n      console.error(error);\n      this._showFallback();\n    }\n  }\n\n  /**\n   * Shows micro-frontend component.\n   * @internal\n   */\n  private async _showMfe(): Promise<void> {\n    try {\n      if (this.mfeApp) {\n        this._mfeComponentRef = await this._createView(this._remoteComponent, this.options);\n        this._bindMfeData();\n      }\n    } catch (error) {\n      console.group(`Error in Microfronted \"${this._remoteComponent.app}\"`);\n      if (isRemoteComponentWithModule(this._remoteComponent)) {\n        console.log('module :>> ', this._remoteComponent.module);\n      }\n\t\t  console.log('component :>> ', this._remoteComponent.component);\n      console.log('is standalone :>> ', isStandaloneRemoteComponent(this._remoteComponent));\n      console.error(error);\n      console.groupEnd();\n      this._showFallback();\n    }\n  }\n\n  /**\n   * Shows loader content.\n   * @internal\n   */\n  private async _showLoader(): Promise<void> {\n    try {\n      if (this._loader) {\n        this._loaderComponentRef = await this._createView(this._loader);\n      }\n    } catch (error) {\n      console.error(error);\n      this._showFallback();\n    }\n  }\n\n  /**\n   * Shows fallback content.\n   * @internal\n   */\n  private async _showFallback(): Promise<void> {\n    if (this._fallback) {\n      try {\n        this._fallbackComponentRef = await this._createView(this._fallback);\n      } catch (error) {\n        console.error(error);\n        this._clearView();\n      }\n    } else {\n      this._clearView();\n    }\n  }\n\n  /**\n   * Shows MFE Component or TemlateRef.\n   * @param content MFE (Remote component) or TemlateRef.\n   * @param options Custom options for MfeComponentFactoryResolver.\n   * @internal\n   */\n  private async _createView<TContext = unknown>(\n    templateRef: TemplateRef<TContext>\n  ): Promise<EmbeddedViewRef<TContext>>;\n\n  private async _createView<TComponent = unknown>(\n    remoteComponent: RemoteComponent,\n    options?: LoadMfeOptions\n  ): Promise<ComponentRef<TComponent>>;\n\n  private async _createView<T = unknown>(\n    remoteComponentOrTemplateRef: RemoteComponent | TemplateRef<T>,\n    options?: LoadMfeOptions\n  ): Promise<EmbeddedViewRef<T> | ComponentRef<T>>;\n\n  private async _createView<T = unknown>(\n    content: RemoteComponent | TemplateRef<T>,\n    options?: LoadMfeOptions\n  ): Promise<EmbeddedViewRef<T> | ComponentRef<T>> {\n    // TemplateRef\n    if (content instanceof TemplateRef) {\n      this._clearView();\n      return this._vcr.createEmbeddedView<T>(content);\n    }\n    // MFE (Remote Component)\n    else {\n      const componentRef: ComponentRef<T> = isRemoteComponentWithModule(content)\n        ? // for modular Angular (any version) components\n        await this._createRemoteComponent(content, options)\n        : // for standalone Angular v13+ components\n        await this._createStandaloneRemoteComponent(content, options)\n\n      componentRef.changeDetectorRef.detectChanges();\n      return componentRef;\n    }\n  }\n\n  // TODO pattern strategy 1\n  /**\n   * Create view for modular remote component.\n   * @param remoteComponent MFE remote component\n   * @param options (Optional) object of options.\n   */\n  private async _createRemoteComponent<TComponent>(\n    remoteComponent: RemoteComponentWithModule,\n    options?: LoadMfeOptions\n  ): Promise<ComponentRef<TComponent>> {\n    const { component, ngModuleRef } = await this._remoteComponentLoader.loadComponentWithModule<TComponent, unknown>(\n      remoteComponent,\n      this.injector,\n      options\n    );\n\n    this._clearView();\n\n    const componentRef = this._vcr.createComponent<TComponent>(component, {\n      ngModuleRef,\n      injector: this.injector,\n    });\n\n    return componentRef;\n  }\n\n  // TODO pattern strategy 2\n  /**\n   * Create view for standalone remote component.\n   * @param remoteComponent MFE remote component\n   * @param options (Optional) object of options.\n   */\n  private async _createStandaloneRemoteComponent<TComponent>(\n    remoteComponent: StandaloneRemoteComponent,\n    options?: LoadMfeOptions\n  ): Promise<ComponentRef<TComponent>> {\n    const component = await this._remoteComponentLoader.loadStandaloneComponent<TComponent>(\n      remoteComponent,\n      options\n    );\n\n    this._clearView();\n\n    const componentRef = this._vcr.createComponent<TComponent>(component, {\n      injector: this.injector,\n    });\n\n    return componentRef;\n  }\n\n  // TODO работает и без этого метода, но не работает output\n  /**\n   * Binding the initial data of the micro-frontend.\n   * @internal\n   */\n  private _bindMfeData(): void {\n    if (!this._mfeComponentRef) {\n      throw new Error(\n        `_bindMfeData method must be called after micro-frontend component \"${this.mfeApp}\" has been initialized.`\n      );\n    }\n\n    this._dynamicBinding.bindInputs(this._mfeComponentRef, this.inputs ?? {});\n    this._dynamicBinding.bindOutputs(this._mfeComponentRef, this.outputs ?? {});\n\n    // TODO похоже что не актуально больше работает все и без этой штуки все\n    \n    // Workaround for bug related to Angular and dynamic components.\n    // Link - https://github.com/angular/angular/issues/36667#issuecomment-926526405\n    this._mfeComponentRef?.injector.get(ChangeDetectorRef).detectChanges();\n  }\n\n  /**\n   * Destroy all displayed components and clear view container ref.\n   * @internal\n   */\n  private _clearView() {\n    this._loaderComponentRef?.destroy();\n    this._fallbackComponentRef?.destroy();\n    this._mfeComponentRef?.destroy();\n    this._vcr.clear();\n  }\n}\n","import { loadRemoteEntry } from '@angular-architects/module-federation';\nimport { APP_INITIALIZER, ModuleWithProviders, NgModule, Provider } from '@angular/core';\nimport { firstValueFrom, from, Observable, tap } from 'rxjs';\nimport { MfeOutletDirective } from './directives';\nimport { NGX_MFE_OPTIONS } from './injection-tokens';\nimport { isNgxMfeConfigAsync, MfeConfig, NgxMfeForRootOptions } from './interfaces';\nimport { MfeRegistry } from './registry';\n\n/**\n * Core lib of micro-frontend architecture.\n * ---------------\n *\n * For core module provide MfeModule.forRoot(options). <br/>\n *\n * For feature modules provide MfeModule.\n */\n@NgModule({\n\tdeclarations: [MfeOutletDirective],\n\texports: [MfeOutletDirective],\n})\nexport class MfeModule {\n\t/**\n\t * Sets global configuration of Mfe lib.\n\t * @param options Object of options.\n\t */\n\tpublic static forRoot(options: NgxMfeForRootOptions): ModuleWithProviders<MfeModule> {\n    const { preload, mfeConfig } = options;\n\t\tconst providers: Provider[] = [\n      {\n        provide: NGX_MFE_OPTIONS,\n        useValue: options,\n      },\n    ];\n\n    if (isNgxMfeConfigAsync(mfeConfig)) {\n      providers.push({\n        provide: APP_INITIALIZER,\n        useFactory: (): (() => Observable<MfeConfig>) => {\n          return () => {\n            return from(mfeConfig.useLoader(...(mfeConfig.deps ?? []))).pipe(\n              tap((config) => initializeMfeRegistry(config, preload))\n            );\n          };\n        },\n        multi: true,\n      });\n    } else {\n      initializeMfeRegistry(mfeConfig, preload);\n    }\n\n    return { ngModule: MfeModule, providers };\n\t}\n}\n\nfunction initializeMfeRegistry(config: MfeConfig, preload?: string[]): MfeRegistry {\n  const mfeRegistry = MfeRegistry.instance;\n  mfeRegistry.setMfeConfig(config);\n  const loadMfeBundle = loadMfeBundleWithMfeRegistry(mfeRegistry);\n\n  if (preload) {\n    preload.map((mfe) => loadMfeBundle(mfe));\n  }\n\n  return mfeRegistry;\n}\n\n/**\n * Loads micro-frontend app bundle (HOF - High Order Function).\n * ------\n *\n * Returns function that can load micro-frontend app by provided name.\n * @param mfeRegistry Registry of micro-frontends apps.\n */\nfunction loadMfeBundleWithMfeRegistry(mfeRegistry: MfeRegistry): (mfe: string) => Promise<void> {\n  return async (mfeString: string): Promise<void> => {\n    const remoteEntry = await firstValueFrom(mfeRegistry.getMfeRemoteEntry(mfeString));\n\n    return loadRemoteEntry({ type: 'module', remoteEntry });\n  };\n}\n"],"names":["i1.RemoteComponentsCache"],"mappings":";;;;;;AAKA,IAAY,gBAaX,CAAA;AAbD,CAAA,UAAY,gBAAgB,EAAA;AAI3B,IAAA,gBAAA,CAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AAIJ,IAAA,gBAAA,CAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AAIL,IAAA,gBAAA,CAAA,gBAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACT,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,GAa3B,EAAA,CAAA,CAAA,CAAA;AAkBD,MAAM,cAAc,GAAwB;IAC3C,QAAQ,EAAE,gBAAgB,CAAC,IAAI;AAC/B,IAAA,OAAO,EAAE,KAAK;CACd,CAAC;SAYc,YAAY,CAC3B,IAAY,EACZ,UAAkB,EAClB,OAA6B,EAAA;AAE7B,IAAA,OAAO,UACN,MAAW,EACX,YAA6B,EAC7B,UAA8B,EAAA;QAE9B,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;AACnD,QAAA,M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