@ngxs/hmr-plugin 20.1.0 → 21.0.0-dev.master-6ca4440
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-hmr-plugin.mjs","sources":["../../../packages/hmr-plugin/src/actions/hmr-init.action.ts","../../../packages/hmr-plugin/src/actions/hmr-before-destroy.action.ts","../../../packages/hmr-plugin/src/internal/hmr-state-context-factory.ts","../../../packages/hmr-plugin/src/internal/hmr-options-builder.ts","../../../packages/hmr-plugin/src/internal/hmr-lifecycle.ts","../../../packages/hmr-plugin/src/hmr-manager.ts","../../../packages/hmr-plugin/src/internal/hmr-storage.ts","../../../packages/hmr-plugin/src/symbols.ts","../../../packages/hmr-plugin/src/utils/internals.ts","../../../packages/hmr-plugin/src/hmr-bootstrap.ts","../../../packages/hmr-plugin/src/utils/externals.ts","../../../packages/hmr-plugin/index.ts","../../../packages/hmr-plugin/ngxs-hmr-plugin.ts"],"sourcesContent":["import { NgxsHmrSnapshot } from '../symbols';\n\nexport class HmrInitAction {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '@@HMR_INIT';\n }\n\n constructor(public payload: Partial<NgxsHmrSnapshot>) {}\n}\n","import { NgxsHmrSnapshot } from '../symbols';\n\nexport class HmrBeforeDestroyAction {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '@@HMR_BEFORE_DESTROY';\n }\n\n constructor(public payload: Partial<NgxsHmrSnapshot>) {}\n}\n","import { StateContext, Store } from '@ngxs/store';\nimport { isStateOperator } from '@ngxs/store/operators';\nimport { NgModuleRef } from '@angular/core';\n\nexport class HmrStateContextFactory<T, S> {\n public store: Store;\n\n constructor(module: NgModuleRef<T>) {\n const store = module.injector.get<Store>(Store, undefined);\n\n if (!store) {\n throw new Error('Store not found, maybe you forgot to import the NgxsModule');\n }\n\n this.store = store;\n }\n\n /**\n * @description\n * must be taken out into @ngxs/store/internals\n */\n public createStateContext(): StateContext<S> {\n return {\n dispatch: actions => this.store!.dispatch(actions),\n getState: () => <S>this.store!.snapshot(),\n setState: val => {\n if (isStateOperator(val)) {\n const currentState = this.store!.snapshot();\n val = val(currentState);\n }\n\n this.store!.reset(val);\n return <S>val;\n },\n patchState: val => {\n const currentState = this.store!.snapshot();\n const newState = { ...currentState, ...(<object>val) };\n this.store!.reset(newState);\n return newState;\n }\n };\n }\n}\n","import { NgxsHmrOptions } from '../symbols';\n\nexport class HmrOptionBuilder {\n public readonly deferTime: number;\n public readonly autoClearLogs: boolean;\n\n constructor({ deferTime, autoClearLogs }: NgxsHmrOptions) {\n this.deferTime = deferTime || 100;\n this.autoClearLogs = autoClearLogs === undefined ? true : autoClearLogs;\n }\n\n public clearLogs(): void {\n if (this.autoClearLogs) {\n console.clear();\n }\n }\n}\n","import { ɵNgxsAppBootstrappedState } from '@ngxs/store/internals';\nimport { Observable, Subscription } from 'rxjs';\nimport { StateContext } from '@ngxs/store';\n\nimport { HmrOptionBuilder } from './hmr-options-builder';\nimport { HmrCallback, NgxsHmrLifeCycle } from '../symbols';\nimport { HmrStateContextFactory } from './hmr-state-context-factory';\nimport { HmrBeforeDestroyAction } from '../actions/hmr-before-destroy.action';\nimport { HmrStorage } from './hmr-storage';\n\nexport class HmrLifecycle<T extends Partial<NgxsHmrLifeCycle<S>>, S> {\n constructor(\n private ngAppModule: T,\n private appBootstrappedState: ɵNgxsAppBootstrappedState,\n private storage: HmrStorage<S>,\n private context: HmrStateContextFactory<T, S>,\n private options: HmrOptionBuilder\n ) {}\n\n public hmrNgxsStoreOnInit(hmrAfterOnInit: HmrCallback<S>) {\n let moduleHmrInit: HmrCallback<S> = this.getModuleHmrInitCallback();\n moduleHmrInit = moduleHmrInit.bind(this.ngAppModule);\n this.detectIvyWithJIT();\n this.stateEventLoop((ctx, state) => {\n moduleHmrInit(ctx, state);\n hmrAfterOnInit(ctx, state);\n });\n }\n\n private getModuleHmrInitCallback(): HmrCallback<S> {\n if (typeof this.ngAppModule.hmrNgxsStoreOnInit === 'function') {\n return this.ngAppModule.hmrNgxsStoreOnInit;\n }\n return function defaultModuleHmrInit(ctx, state) {\n ctx.patchState(state);\n };\n }\n\n public hmrNgxsStoreBeforeOnDestroy(): Partial<S> {\n let state: Partial<S> = {};\n const ctx: StateContext<S> = this.context.createStateContext();\n if (typeof this.ngAppModule.hmrNgxsStoreBeforeOnDestroy === 'function') {\n state = this.ngAppModule.hmrNgxsStoreBeforeOnDestroy(ctx);\n } else {\n state = ctx.getState();\n }\n\n ctx.dispatch(new HmrBeforeDestroyAction(state));\n return state;\n }\n\n private stateEventLoop(callback: HmrCallback<S>): void {\n if (!this.storage.hasData()) return;\n\n const state$: Observable<any> = this.context.store.select(state => state);\n\n this.appBootstrappedState.subscribe(bootstrapped => {\n if (!bootstrapped) return;\n let eventId: number;\n const storeEventId: Subscription = state$.subscribe(() => {\n // setTimeout used for zone detection after set hmr state\n clearInterval(eventId);\n eventId = window.setTimeout(() => {\n // close check on the message queue\n storeEventId.unsubscribe();\n // if events are no longer running on the call stack,\n // then we can update the state\n callback(this.context.createStateContext(), this.storage.snapshot as Partial<S>);\n }, this.options.deferTime);\n });\n });\n }\n\n private detectIvyWithJIT(): void {\n const jit: boolean = this.ngAppModule.constructor.hasOwnProperty('__annotations__');\n const ivy: boolean = this.ngAppModule.constructor.hasOwnProperty('ɵmod');\n if (jit && ivy) {\n throw new Error(\n `@ngxs/hmr-plugin doesn't work with JIT mode in Angular Ivy. Please use AOT mode.`\n );\n }\n }\n}\n","import { ApplicationRef, ComponentRef, NgModuleRef } from '@angular/core';\nimport { ɵInitialState, ɵNgxsAppBootstrappedState } from '@ngxs/store/internals';\n\nimport { HmrStorage } from './internal/hmr-storage';\nimport {\n BootstrapModuleFn,\n NgxsHmrLifeCycle,\n NgxsHmrOptions,\n NgxsHmrSnapshot\n} from './symbols';\nimport { HmrStateContextFactory } from './internal/hmr-state-context-factory';\nimport { HmrOptionBuilder } from './internal/hmr-options-builder';\nimport { HmrInitAction } from './actions/hmr-init.action';\nimport { HmrLifecycle } from './internal/hmr-lifecycle';\n\ntype OldHostRemoverFn = () => void;\n\nexport class HmrManager<T extends Partial<NgxsHmrLifeCycle<S>>, S = NgxsHmrSnapshot> {\n public storage: HmrStorage<S>;\n public context!: HmrStateContextFactory<T, S>;\n public lifecycle!: HmrLifecycle<T, S>;\n public optionsBuilder: HmrOptionBuilder;\n private ngModule!: NgModuleRef<T>;\n\n constructor(options: NgxsHmrOptions, storage: HmrStorage<S>) {\n this.storage = storage;\n this.optionsBuilder = new HmrOptionBuilder(options);\n }\n\n private get applicationRef(): ApplicationRef {\n return this.ngModule.injector.get(ApplicationRef);\n }\n\n private get appBootstrappedState() {\n return this.ngModule.injector.get(ɵNgxsAppBootstrappedState);\n }\n\n public async hmrModule(\n bootstrapFn: BootstrapModuleFn<T>,\n tick: () => void\n ): Promise<NgModuleRef<T>> {\n ɵInitialState.set(this.storage.snapshot);\n this.ngModule = await bootstrapFn();\n this.context = new HmrStateContextFactory(this.ngModule);\n this.lifecycle = this.createLifecycle();\n\n tick();\n\n ɵInitialState.pop();\n return this.ngModule;\n }\n\n public beforeModuleBootstrap(): void {\n this.lifecycle.hmrNgxsStoreOnInit((ctx, state) => {\n ctx.dispatch(new HmrInitAction(state));\n });\n }\n\n public beforeModuleOnDestroy(): Partial<S> {\n this.optionsBuilder.clearLogs();\n return this.lifecycle.hmrNgxsStoreBeforeOnDestroy();\n }\n\n public createNewModule(): void {\n const removeOldHosts: () => void = this.cloneHostsBeforeDestroy();\n this.removeNgStyles();\n this.ngModule.destroy();\n removeOldHosts();\n }\n\n private createLifecycle(): HmrLifecycle<T, S> {\n return new HmrLifecycle(\n this.ngModule.instance,\n this.appBootstrappedState,\n this.storage,\n this.context,\n this.optionsBuilder\n );\n }\n\n private cloneHostsBeforeDestroy(): () => void {\n const elements: Element[] = this.applicationRef.components.map(\n (component: ComponentRef<Element>) => component.location.nativeElement\n );\n\n const removableList: OldHostRemoverFn[] = elements.map((componentNode: Element) => {\n const newNode = document.createElement(componentNode.tagName);\n const parentNode: Node = componentNode.parentNode as Node;\n const currentDisplay: string | null = newNode.style.display;\n\n newNode.style.display = 'none';\n parentNode.insertBefore(newNode, componentNode);\n\n return (): void => {\n newNode.style.display = currentDisplay;\n try {\n parentNode.removeChild(componentNode);\n } catch {}\n };\n });\n\n return function removeOldHosts(): void {\n removableList.forEach((removeOldHost: OldHostRemoverFn) => removeOldHost());\n };\n }\n\n private removeNgStyles(): void {\n const head: HTMLHeadElement = document.head!;\n const styles: HTMLStyleElement[] = Array.from(head!.querySelectorAll('style'));\n\n styles\n .filter((style: HTMLStyleElement) => style.innerText.includes('_ng'))\n .map((style: HTMLStyleElement) => head!.removeChild(style));\n }\n}\n","export class HmrStorage<S> {\n constructor(private _snapshot: Partial<S> = {}) {}\n\n public hasData(): boolean {\n return Object.keys(this._snapshot).length > 0;\n }\n\n public get snapshot(): Partial<S> {\n return this._snapshot;\n }\n}\n","import { StateContext } from '@ngxs/store';\nimport { NgModuleRef } from '@angular/core';\n\nexport const enum HmrRuntime {\n Status = 'NGXS_HMR_LIFECYCLE_STATUS'\n}\n\nexport interface NgxsHmrSnapshot {\n [key: string]: any;\n}\n\nexport interface NgxsHmrLifeCycle<T = NgxsHmrSnapshot> {\n /**\n * hmrNgxsStoreOnInit is called when the AppModule on init\n * @param ctx - StateContext for the current app state from Store\n * @param snapshot - previous state from Store after last hmr on destroy\n */\n hmrNgxsStoreOnInit(ctx: StateContext<T>, snapshot: Partial<T>): void;\n\n /**\n * hmrNgxsStoreOnInit is called when the AppModule on destroy\n * @param ctx - StateContext for the current app state from Store\n */\n hmrNgxsStoreBeforeOnDestroy(ctx: StateContext<T>): Partial<T>;\n}\n\nexport type HmrCallback<T> = (ctx: StateContext<T>, state: Partial<T>) => void;\nexport type BootstrapModuleFn<T = any> = () => Promise<NgModuleRef<T>>;\n\nexport interface NgxsHmrOptions {\n /**\n * @description\n * Clear logs after each refresh\n * (default: true)\n */\n autoClearLogs?: boolean;\n\n /**\n * @description\n * Deferred time before loading the old state\n * (default: 100ms)\n */\n deferTime?: number;\n}\n\ntype ModuleId = string | number;\ninterface WebpackHotModule {\n hot?: {\n data: any;\n accept(dependencies: string[], callback?: (updatedDependencies: ModuleId[]) => void): void;\n accept(dependency: string, callback?: () => void): void;\n accept(errHandler?: (err: Error) => void): void;\n dispose(callback: (data: any) => void): void;\n };\n}\n\n/**\n * @description\n * any - because need setup\n * npm i @types/webpack-env\n */\nexport type WebpackModule = WebpackHotModule | any;\n","import { HmrRuntime } from '../symbols';\n\ndeclare const window: any;\n\nexport function setHmrReloadedTo(value: boolean): void {\n if (window[HmrRuntime.Status]) {\n window[HmrRuntime.Status].hmrReloaded = value;\n }\n}\n\nexport function markApplicationAsHmrReloaded(): void {\n window[HmrRuntime.Status] = window[HmrRuntime.Status] || {\n hmrReloaded: false\n };\n}\n","import { NgModuleRef } from '@angular/core';\nimport { HmrManager } from './hmr-manager';\nimport { BootstrapModuleFn, NgxsHmrOptions, WebpackModule } from './symbols';\nimport { HmrStorage } from './internal/hmr-storage';\nimport { markApplicationAsHmrReloaded, setHmrReloadedTo } from './utils/internals';\n\n/**\n * Hot Module Replacement plugin for NGXS\n * @deprecated As of Angular v10, HMR is no longer supported and will be deprecated.\n * More information [here](https://www.ngxs.io/plugins/hmr).\n */\nexport async function hmr<T>(\n webpackModule: WebpackModule,\n bootstrapFn: BootstrapModuleFn<T>,\n options: NgxsHmrOptions = {}\n): Promise<NgModuleRef<T>> {\n if (!webpackModule.hot) {\n console.error('Are you using the --hmr flag for ng serve?');\n throw new Error('HMR is not enabled for webpack-dev-server!');\n }\n\n markApplicationAsHmrReloaded();\n\n webpackModule.hot.accept();\n\n interface HmrDataTransfer {\n snapshot?: any;\n }\n const dataTransfer: HmrDataTransfer = webpackModule.hot.data || {};\n\n const storage = new HmrStorage<any>(dataTransfer.snapshot || {});\n const manager = new HmrManager<any>(options, storage);\n\n return await manager.hmrModule(bootstrapFn, () => {\n manager.beforeModuleBootstrap();\n\n webpackModule.hot!.dispose((data: HmrDataTransfer) => {\n setHmrReloadedTo(true);\n data.snapshot = manager.beforeModuleOnDestroy();\n manager.createNewModule();\n });\n });\n}\n","import { HmrRuntime } from '../symbols';\n\ndeclare const window: any;\n\nexport function hmrIsReloaded(): boolean {\n return !!(window[HmrRuntime.Status] && window[HmrRuntime.Status].hmrReloaded);\n}\n","/**\n * The public api for consumers of @ngxs/hmr-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵNgxsAppBootstrappedState","ɵInitialState"],"mappings":";;;;;MAEa,aAAa,CAAA;AAML,IAAA,OAAA;AALnB,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,YAAY;;AAGrB,IAAA,WAAA,CAAmB,OAAiC,EAAA;QAAjC,IAAO,CAAA,OAAA,GAAP,OAAO;;AAC3B;;MCPY,sBAAsB,CAAA;AAMd,IAAA,OAAA;AALnB,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,sBAAsB;;AAG/B,IAAA,WAAA,CAAmB,OAAiC,EAAA;QAAjC,IAAO,CAAA,OAAA,GAAP,OAAO;;AAC3B;;MCLY,sBAAsB,CAAA;AAC1B,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,MAAsB,EAAA;AAChC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAQ,KAAK,EAAE,SAAS,CAAC;QAE1D,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC;;AAG/E,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;;AAGpB;;;AAGG;IACI,kBAAkB,GAAA;QACvB,OAAO;AACL,YAAA,QAAQ,EAAE,OAAO,IAAI,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C,GAAG,CAAC,IAAI,IAAI,EAAE;IAElE,MAAM,OAAO,GAAG,IAAI,UAAU,CAAM,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC;IAChE,MAAM,OAAO,GAAG,IAAI,UAAU,CAAM,OAAO,EAAE,OAAO,CAAC;IAErD,OAAO,MAAM,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,MAAK;QAC/C,OAAO,CAAC,qBAAqB,EAAE;QAE/B,aAAa,CAAC,GAAI,CAAC,OAAO,CAAC,CAAC,IAAqB,KAAI;YACnD,gBAAgB,CAAC,IAAI,CAAC;AACtB,YAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,qBAAqB,EAAE;YAC/C,OAAO,CAAC,eAAe,EAAE;AAC3B,SAAC,CAAC;AACJ,KAAC,CAAC;AACJ;;SCtCgB,aAAa,GAAA;AAC3B,IAAA,OAAO,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;AAC/E;;ACNA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-hmr-plugin.mjs","sources":["../../../packages/hmr-plugin/src/actions/hmr-init.action.ts","../../../packages/hmr-plugin/src/actions/hmr-before-destroy.action.ts","../../../packages/hmr-plugin/src/internal/hmr-state-context-factory.ts","../../../packages/hmr-plugin/src/internal/hmr-options-builder.ts","../../../packages/hmr-plugin/src/internal/hmr-lifecycle.ts","../../../packages/hmr-plugin/src/hmr-manager.ts","../../../packages/hmr-plugin/src/internal/hmr-storage.ts","../../../packages/hmr-plugin/src/symbols.ts","../../../packages/hmr-plugin/src/utils/internals.ts","../../../packages/hmr-plugin/src/hmr-bootstrap.ts","../../../packages/hmr-plugin/src/utils/externals.ts","../../../packages/hmr-plugin/index.ts","../../../packages/hmr-plugin/ngxs-hmr-plugin.ts"],"sourcesContent":["import { NgxsHmrSnapshot } from '../symbols';\n\nexport class HmrInitAction {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '@@HMR_INIT';\n }\n\n constructor(public payload: Partial<NgxsHmrSnapshot>) {}\n}\n","import { NgxsHmrSnapshot } from '../symbols';\n\nexport class HmrBeforeDestroyAction {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '@@HMR_BEFORE_DESTROY';\n }\n\n constructor(public payload: Partial<NgxsHmrSnapshot>) {}\n}\n","import { StateContext, Store } from '@ngxs/store';\nimport { isStateOperator } from '@ngxs/store/operators';\nimport { NgModuleRef } from '@angular/core';\n\nexport class HmrStateContextFactory<T, S> {\n public store: Store;\n\n constructor(module: NgModuleRef<T>) {\n const store = module.injector.get<Store>(Store, undefined);\n\n if (!store) {\n throw new Error('Store not found, maybe you forgot to import the NgxsModule');\n }\n\n this.store = store;\n }\n\n /**\n * @description\n * must be taken out into @ngxs/store/internals\n */\n public createStateContext(): StateContext<S> {\n return {\n abortSignal: new AbortController().signal,\n dispatch: actions => this.store!.dispatch(actions),\n getState: () => <S>this.store!.snapshot(),\n setState: val => {\n if (isStateOperator(val)) {\n const currentState = this.store!.snapshot();\n val = val(currentState);\n }\n\n this.store!.reset(val);\n return <S>val;\n },\n patchState: val => {\n const currentState = this.store!.snapshot();\n const newState = { ...currentState, ...(<object>val) };\n this.store!.reset(newState);\n return newState;\n }\n };\n }\n}\n","import { NgxsHmrOptions } from '../symbols';\n\nexport class HmrOptionBuilder {\n public readonly deferTime: number;\n public readonly autoClearLogs: boolean;\n\n constructor({ deferTime, autoClearLogs }: NgxsHmrOptions) {\n this.deferTime = deferTime || 100;\n this.autoClearLogs = autoClearLogs === undefined ? true : autoClearLogs;\n }\n\n public clearLogs(): void {\n if (this.autoClearLogs) {\n console.clear();\n }\n }\n}\n","import { ɵNgxsAppBootstrappedState } from '@ngxs/store/internals';\nimport { Observable, Subscription } from 'rxjs';\nimport { StateContext } from '@ngxs/store';\n\nimport { HmrOptionBuilder } from './hmr-options-builder';\nimport { HmrCallback, NgxsHmrLifeCycle } from '../symbols';\nimport { HmrStateContextFactory } from './hmr-state-context-factory';\nimport { HmrBeforeDestroyAction } from '../actions/hmr-before-destroy.action';\nimport { HmrStorage } from './hmr-storage';\n\nexport class HmrLifecycle<T extends Partial<NgxsHmrLifeCycle<S>>, S> {\n constructor(\n private ngAppModule: T,\n private appBootstrappedState: ɵNgxsAppBootstrappedState,\n private storage: HmrStorage<S>,\n private context: HmrStateContextFactory<T, S>,\n private options: HmrOptionBuilder\n ) {}\n\n public hmrNgxsStoreOnInit(hmrAfterOnInit: HmrCallback<S>) {\n let moduleHmrInit: HmrCallback<S> = this.getModuleHmrInitCallback();\n moduleHmrInit = moduleHmrInit.bind(this.ngAppModule);\n this.detectIvyWithJIT();\n this.stateEventLoop((ctx, state) => {\n moduleHmrInit(ctx, state);\n hmrAfterOnInit(ctx, state);\n });\n }\n\n private getModuleHmrInitCallback(): HmrCallback<S> {\n if (typeof this.ngAppModule.hmrNgxsStoreOnInit === 'function') {\n return this.ngAppModule.hmrNgxsStoreOnInit;\n }\n return function defaultModuleHmrInit(ctx, state) {\n ctx.patchState(state);\n };\n }\n\n public hmrNgxsStoreBeforeOnDestroy(): Partial<S> {\n let state: Partial<S> = {};\n const ctx: StateContext<S> = this.context.createStateContext();\n if (typeof this.ngAppModule.hmrNgxsStoreBeforeOnDestroy === 'function') {\n state = this.ngAppModule.hmrNgxsStoreBeforeOnDestroy(ctx);\n } else {\n state = ctx.getState();\n }\n\n ctx.dispatch(new HmrBeforeDestroyAction(state));\n return state;\n }\n\n private stateEventLoop(callback: HmrCallback<S>): void {\n if (!this.storage.hasData()) return;\n\n const state$: Observable<any> = this.context.store.select(state => state);\n\n this.appBootstrappedState.subscribe(bootstrapped => {\n if (!bootstrapped) return;\n let eventId: number;\n const storeEventId: Subscription = state$.subscribe(() => {\n // setTimeout used for zone detection after set hmr state\n clearInterval(eventId);\n eventId = window.setTimeout(() => {\n // close check on the message queue\n storeEventId.unsubscribe();\n // if events are no longer running on the call stack,\n // then we can update the state\n callback(this.context.createStateContext(), this.storage.snapshot as Partial<S>);\n }, this.options.deferTime);\n });\n });\n }\n\n private detectIvyWithJIT(): void {\n const jit: boolean = this.ngAppModule.constructor.hasOwnProperty('__annotations__');\n const ivy: boolean = this.ngAppModule.constructor.hasOwnProperty('ɵmod');\n if (jit && ivy) {\n throw new Error(\n `@ngxs/hmr-plugin doesn't work with JIT mode in Angular Ivy. Please use AOT mode.`\n );\n }\n }\n}\n","import { ApplicationRef, ComponentRef, NgModuleRef } from '@angular/core';\nimport { ɵInitialState, ɵNgxsAppBootstrappedState } from '@ngxs/store/internals';\n\nimport { HmrStorage } from './internal/hmr-storage';\nimport {\n BootstrapModuleFn,\n NgxsHmrLifeCycle,\n NgxsHmrOptions,\n NgxsHmrSnapshot\n} from './symbols';\nimport { HmrStateContextFactory } from './internal/hmr-state-context-factory';\nimport { HmrOptionBuilder } from './internal/hmr-options-builder';\nimport { HmrInitAction } from './actions/hmr-init.action';\nimport { HmrLifecycle } from './internal/hmr-lifecycle';\n\ntype OldHostRemoverFn = () => void;\n\nexport class HmrManager<T extends Partial<NgxsHmrLifeCycle<S>>, S = NgxsHmrSnapshot> {\n public storage: HmrStorage<S>;\n public context!: HmrStateContextFactory<T, S>;\n public lifecycle!: HmrLifecycle<T, S>;\n public optionsBuilder: HmrOptionBuilder;\n private ngModule!: NgModuleRef<T>;\n\n constructor(options: NgxsHmrOptions, storage: HmrStorage<S>) {\n this.storage = storage;\n this.optionsBuilder = new HmrOptionBuilder(options);\n }\n\n private get applicationRef(): ApplicationRef {\n return this.ngModule.injector.get(ApplicationRef);\n }\n\n private get appBootstrappedState() {\n return this.ngModule.injector.get(ɵNgxsAppBootstrappedState);\n }\n\n public async hmrModule(\n bootstrapFn: BootstrapModuleFn<T>,\n tick: () => void\n ): Promise<NgModuleRef<T>> {\n ɵInitialState.set(this.storage.snapshot);\n this.ngModule = await bootstrapFn();\n this.context = new HmrStateContextFactory(this.ngModule);\n this.lifecycle = this.createLifecycle();\n\n tick();\n\n ɵInitialState.pop();\n return this.ngModule;\n }\n\n public beforeModuleBootstrap(): void {\n this.lifecycle.hmrNgxsStoreOnInit((ctx, state) => {\n ctx.dispatch(new HmrInitAction(state));\n });\n }\n\n public beforeModuleOnDestroy(): Partial<S> {\n this.optionsBuilder.clearLogs();\n return this.lifecycle.hmrNgxsStoreBeforeOnDestroy();\n }\n\n public createNewModule(): void {\n const removeOldHosts: () => void = this.cloneHostsBeforeDestroy();\n this.removeNgStyles();\n this.ngModule.destroy();\n removeOldHosts();\n }\n\n private createLifecycle(): HmrLifecycle<T, S> {\n return new HmrLifecycle(\n this.ngModule.instance,\n this.appBootstrappedState,\n this.storage,\n this.context,\n this.optionsBuilder\n );\n }\n\n private cloneHostsBeforeDestroy(): () => void {\n const elements: Element[] = this.applicationRef.components.map(\n (component: ComponentRef<Element>) => component.location.nativeElement\n );\n\n const removableList: OldHostRemoverFn[] = elements.map((componentNode: Element) => {\n const newNode = document.createElement(componentNode.tagName);\n const parentNode: Node = componentNode.parentNode as Node;\n const currentDisplay: string | null = newNode.style.display;\n\n newNode.style.display = 'none';\n parentNode.insertBefore(newNode, componentNode);\n\n return (): void => {\n newNode.style.display = currentDisplay;\n try {\n parentNode.removeChild(componentNode);\n } catch {}\n };\n });\n\n return function removeOldHosts(): void {\n removableList.forEach((removeOldHost: OldHostRemoverFn) => removeOldHost());\n };\n }\n\n private removeNgStyles(): void {\n const head: HTMLHeadElement = document.head!;\n const styles: HTMLStyleElement[] = Array.from(head!.querySelectorAll('style'));\n\n styles\n .filter((style: HTMLStyleElement) => style.innerText.includes('_ng'))\n .map((style: HTMLStyleElement) => head!.removeChild(style));\n }\n}\n","export class HmrStorage<S> {\n constructor(private _snapshot: Partial<S> = {}) {}\n\n public hasData(): boolean {\n return Object.keys(this._snapshot).length > 0;\n }\n\n public get snapshot(): Partial<S> {\n return this._snapshot;\n }\n}\n","import { StateContext } from '@ngxs/store';\nimport { NgModuleRef } from '@angular/core';\n\nexport const enum HmrRuntime {\n Status = 'NGXS_HMR_LIFECYCLE_STATUS'\n}\n\nexport interface NgxsHmrSnapshot {\n [key: string]: any;\n}\n\nexport interface NgxsHmrLifeCycle<T = NgxsHmrSnapshot> {\n /**\n * hmrNgxsStoreOnInit is called when the AppModule on init\n * @param ctx - StateContext for the current app state from Store\n * @param snapshot - previous state from Store after last hmr on destroy\n */\n hmrNgxsStoreOnInit(ctx: StateContext<T>, snapshot: Partial<T>): void;\n\n /**\n * hmrNgxsStoreOnInit is called when the AppModule on destroy\n * @param ctx - StateContext for the current app state from Store\n */\n hmrNgxsStoreBeforeOnDestroy(ctx: StateContext<T>): Partial<T>;\n}\n\nexport type HmrCallback<T> = (ctx: StateContext<T>, state: Partial<T>) => void;\nexport type BootstrapModuleFn<T = any> = () => Promise<NgModuleRef<T>>;\n\nexport interface NgxsHmrOptions {\n /**\n * @description\n * Clear logs after each refresh\n * (default: true)\n */\n autoClearLogs?: boolean;\n\n /**\n * @description\n * Deferred time before loading the old state\n * (default: 100ms)\n */\n deferTime?: number;\n}\n\ntype ModuleId = string | number;\ninterface WebpackHotModule {\n hot?: {\n data: any;\n accept(dependencies: string[], callback?: (updatedDependencies: ModuleId[]) => void): void;\n accept(dependency: string, callback?: () => void): void;\n accept(errHandler?: (err: Error) => void): void;\n dispose(callback: (data: any) => void): void;\n };\n}\n\n/**\n * @description\n * any - because need setup\n * npm i @types/webpack-env\n */\nexport type WebpackModule = WebpackHotModule | any;\n","import { HmrRuntime } from '../symbols';\n\ndeclare const window: any;\n\nexport function setHmrReloadedTo(value: boolean): void {\n if (window[HmrRuntime.Status]) {\n window[HmrRuntime.Status].hmrReloaded = value;\n }\n}\n\nexport function markApplicationAsHmrReloaded(): void {\n window[HmrRuntime.Status] = window[HmrRuntime.Status] || {\n hmrReloaded: false\n };\n}\n","import { NgModuleRef } from '@angular/core';\nimport { HmrManager } from './hmr-manager';\nimport { BootstrapModuleFn, NgxsHmrOptions, WebpackModule } from './symbols';\nimport { HmrStorage } from './internal/hmr-storage';\nimport { markApplicationAsHmrReloaded, setHmrReloadedTo } from './utils/internals';\n\n/**\n * Hot Module Replacement plugin for NGXS\n * @deprecated As of Angular v10, HMR is no longer supported and will be deprecated.\n * More information [here](https://www.ngxs.io/plugins/hmr).\n */\nexport async function hmr<T>(\n webpackModule: WebpackModule,\n bootstrapFn: BootstrapModuleFn<T>,\n options: NgxsHmrOptions = {}\n): Promise<NgModuleRef<T>> {\n if (!webpackModule.hot) {\n console.error('Are you using the --hmr flag for ng serve?');\n throw new Error('HMR is not enabled for webpack-dev-server!');\n }\n\n markApplicationAsHmrReloaded();\n\n webpackModule.hot.accept();\n\n interface HmrDataTransfer {\n snapshot?: any;\n }\n const dataTransfer: HmrDataTransfer = webpackModule.hot.data || {};\n\n const storage = new HmrStorage<any>(dataTransfer.snapshot || {});\n const manager = new HmrManager<any>(options, storage);\n\n return await manager.hmrModule(bootstrapFn, () => {\n manager.beforeModuleBootstrap();\n\n webpackModule.hot!.dispose((data: HmrDataTransfer) => {\n setHmrReloadedTo(true);\n data.snapshot = manager.beforeModuleOnDestroy();\n manager.createNewModule();\n });\n });\n}\n","import { HmrRuntime } from '../symbols';\n\ndeclare const window: any;\n\nexport function hmrIsReloaded(): boolean {\n return !!(window[HmrRuntime.Status] && window[HmrRuntime.Status].hmrReloaded);\n}\n","/**\n * The public api for consumers of @ngxs/hmr-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵNgxsAppBootstrappedState","ɵInitialState"],"mappings":";;;;;MAEa,aAAa,CAAA;AAML,IAAA,OAAA;AALnB,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,YAAY;;AAGrB,IAAA,WAAA,CAAmB,OAAiC,EAAA;QAAjC,IAAO,CAAA,OAAA,GAAP,OAAO;;AAC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AC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;AAC/E;;ACNA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngxs/hmr-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0-dev.master-6ca4440",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": true,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@angular/core": ">=
|
|
7
|
+
"@angular/core": ">=21.0.0 <22.0.0"
|
|
8
8
|
},
|
|
9
9
|
"module": "fesm2022/ngxs-hmr-plugin.mjs",
|
|
10
10
|
"typings": "index.d.ts",
|
|
@@ -63,4 +63,4 @@
|
|
|
63
63
|
"type": "opencollective",
|
|
64
64
|
"url": "https://opencollective.com/ngxs"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|