@ngxs/hmr-plugin 3.7.4 → 3.7.5

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.
Files changed (51) hide show
  1. package/README.md +3 -3
  2. package/bundles/ngxs-hmr-plugin.umd.js +665 -665
  3. package/bundles/ngxs-hmr-plugin.umd.js.map +1 -1
  4. package/bundles/ngxs-hmr-plugin.umd.min.js.map +1 -1
  5. package/esm2015/index.js +9 -9
  6. package/esm2015/ngxs-hmr-plugin.js +8 -8
  7. package/esm2015/src/actions/hmr-before-destroy.action.js +24 -24
  8. package/esm2015/src/actions/hmr-init.action.js +24 -24
  9. package/esm2015/src/hmr-bootstrap.js +58 -58
  10. package/esm2015/src/hmr-manager.js +175 -175
  11. package/esm2015/src/internal/hmr-lifecycle.js +160 -160
  12. package/esm2015/src/internal/hmr-options-builder.js +28 -28
  13. package/esm2015/src/internal/hmr-state-context-factory.js +70 -70
  14. package/esm2015/src/internal/hmr-storage.js +35 -35
  15. package/esm2015/src/public_api.js +9 -9
  16. package/esm2015/src/symbols.js +62 -62
  17. package/esm2015/src/utils/externals.js +11 -11
  18. package/esm2015/src/utils/internals.js +22 -22
  19. package/esm5/index.js +9 -9
  20. package/esm5/ngxs-hmr-plugin.js +8 -8
  21. package/esm5/src/actions/hmr-before-destroy.action.js +27 -27
  22. package/esm5/src/actions/hmr-init.action.js +27 -27
  23. package/esm5/src/hmr-bootstrap.js +63 -63
  24. package/esm5/src/hmr-manager.js +222 -222
  25. package/esm5/src/internal/hmr-lifecycle.js +182 -182
  26. package/esm5/src/internal/hmr-options-builder.js +31 -31
  27. package/esm5/src/internal/hmr-state-context-factory.js +86 -86
  28. package/esm5/src/internal/hmr-storage.js +48 -48
  29. package/esm5/src/public_api.js +9 -9
  30. package/esm5/src/symbols.js +62 -62
  31. package/esm5/src/utils/externals.js +11 -11
  32. package/esm5/src/utils/internals.js +22 -22
  33. package/fesm2015/ngxs-hmr-plugin.js +582 -582
  34. package/fesm2015/ngxs-hmr-plugin.js.map +1 -1
  35. package/fesm5/ngxs-hmr-plugin.js +674 -674
  36. package/fesm5/ngxs-hmr-plugin.js.map +1 -1
  37. package/index.d.ts +4 -4
  38. package/ngxs-hmr-plugin.d.ts +4 -4
  39. package/package.json +1 -1
  40. package/src/actions/hmr-before-destroy.action.d.ts +6 -6
  41. package/src/actions/hmr-init.action.d.ts +6 -6
  42. package/src/hmr-bootstrap.d.ts +8 -8
  43. package/src/hmr-manager.d.ts +23 -23
  44. package/src/internal/hmr-lifecycle.d.ts +18 -18
  45. package/src/internal/hmr-options-builder.d.ts +7 -7
  46. package/src/internal/hmr-state-context-factory.d.ts +11 -11
  47. package/src/internal/hmr-storage.d.ts +6 -6
  48. package/src/public_api.d.ts +5 -5
  49. package/src/symbols.d.ts +54 -54
  50. package/src/utils/externals.d.ts +1 -1
  51. package/src/utils/internals.d.ts +2 -2
@@ -223,689 +223,689 @@
223
223
  return value;
224
224
  }
225
225
 
226
- /**
227
- * @fileoverview added by tsickle
228
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
229
- */
230
- var HmrInitAction = /** @class */ (function () {
231
- function HmrInitAction(payload) {
232
- this.payload = payload;
233
- }
234
- Object.defineProperty(HmrInitAction, "type", {
235
- get: /**
236
- * @return {?}
237
- */
238
- function () {
239
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
240
- return '@@HMR_INIT';
241
- },
242
- enumerable: true,
243
- configurable: true
244
- });
245
- return HmrInitAction;
246
- }());
247
- if (false) {
248
- /** @type {?} */
249
- HmrInitAction.prototype.payload;
226
+ /**
227
+ * @fileoverview added by tsickle
228
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
229
+ */
230
+ var HmrInitAction = /** @class */ (function () {
231
+ function HmrInitAction(payload) {
232
+ this.payload = payload;
233
+ }
234
+ Object.defineProperty(HmrInitAction, "type", {
235
+ get: /**
236
+ * @return {?}
237
+ */
238
+ function () {
239
+ // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
240
+ return '@@HMR_INIT';
241
+ },
242
+ enumerable: true,
243
+ configurable: true
244
+ });
245
+ return HmrInitAction;
246
+ }());
247
+ if (false) {
248
+ /** @type {?} */
249
+ HmrInitAction.prototype.payload;
250
250
  }
251
251
 
252
- /**
253
- * @fileoverview added by tsickle
254
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
255
- */
256
- var HmrBeforeDestroyAction = /** @class */ (function () {
257
- function HmrBeforeDestroyAction(payload) {
258
- this.payload = payload;
259
- }
260
- Object.defineProperty(HmrBeforeDestroyAction, "type", {
261
- get: /**
262
- * @return {?}
263
- */
264
- function () {
265
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
266
- return '@@HMR_BEFORE_DESTROY';
267
- },
268
- enumerable: true,
269
- configurable: true
270
- });
271
- return HmrBeforeDestroyAction;
272
- }());
273
- if (false) {
274
- /** @type {?} */
275
- HmrBeforeDestroyAction.prototype.payload;
252
+ /**
253
+ * @fileoverview added by tsickle
254
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
255
+ */
256
+ var HmrBeforeDestroyAction = /** @class */ (function () {
257
+ function HmrBeforeDestroyAction(payload) {
258
+ this.payload = payload;
259
+ }
260
+ Object.defineProperty(HmrBeforeDestroyAction, "type", {
261
+ get: /**
262
+ * @return {?}
263
+ */
264
+ function () {
265
+ // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
266
+ return '@@HMR_BEFORE_DESTROY';
267
+ },
268
+ enumerable: true,
269
+ configurable: true
270
+ });
271
+ return HmrBeforeDestroyAction;
272
+ }());
273
+ if (false) {
274
+ /** @type {?} */
275
+ HmrBeforeDestroyAction.prototype.payload;
276
276
  }
277
277
 
278
- /**
279
- * @fileoverview added by tsickle
280
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
281
- */
282
- /**
283
- * @template T, S
284
- */
285
- var /**
286
- * @template T, S
287
- */
288
- HmrStateContextFactory = /** @class */ (function () {
289
- function HmrStateContextFactory(module) {
290
- /** @type {?} */
291
- var store$1 = module.injector.get(store.Store, undefined);
292
- if (!store$1) {
293
- throw new Error('Store not found, maybe you forgot to import the NgxsModule');
294
- }
295
- this.store = store$1;
296
- }
297
- /**
298
- * @description
299
- * must be taken out into @ngxs/store/internals
300
- */
301
- /**
302
- * \@description
303
- * must be taken out into \@ngxs/store/internals
304
- * @return {?}
305
- */
306
- HmrStateContextFactory.prototype.createStateContext = /**
307
- * \@description
308
- * must be taken out into \@ngxs/store/internals
309
- * @return {?}
310
- */
311
- function () {
312
- var _this = this;
313
- return {
314
- dispatch: (/**
315
- * @param {?} actions
316
- * @return {?}
317
- */
318
- function (actions) { return (/** @type {?} */ (_this.store)).dispatch(actions); }),
319
- getState: (/**
320
- * @return {?}
321
- */
322
- function () { return (/** @type {?} */ ((/** @type {?} */ (_this.store)).snapshot())); }),
323
- setState: (/**
324
- * @param {?} val
325
- * @return {?}
326
- */
327
- function (val) {
328
- if (operators.isStateOperator(val)) {
329
- /** @type {?} */
330
- var currentState = (/** @type {?} */ (_this.store)).snapshot();
331
- val = val(currentState);
332
- }
333
- (/** @type {?} */ (_this.store)).reset(val);
334
- return (/** @type {?} */ (val));
335
- }),
336
- patchState: (/**
337
- * @param {?} val
338
- * @return {?}
339
- */
340
- function (val) {
341
- /** @type {?} */
342
- var currentState = (/** @type {?} */ (_this.store)).snapshot();
343
- /** @type {?} */
344
- var newState = __assign({}, currentState, ((/** @type {?} */ (val))));
345
- (/** @type {?} */ (_this.store)).reset(newState);
346
- return newState;
347
- })
348
- };
349
- };
350
- return HmrStateContextFactory;
351
- }());
352
- if (false) {
353
- /** @type {?} */
354
- HmrStateContextFactory.prototype.store;
278
+ /**
279
+ * @fileoverview added by tsickle
280
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
281
+ */
282
+ /**
283
+ * @template T, S
284
+ */
285
+ var /**
286
+ * @template T, S
287
+ */
288
+ HmrStateContextFactory = /** @class */ (function () {
289
+ function HmrStateContextFactory(module) {
290
+ /** @type {?} */
291
+ var store$1 = module.injector.get(store.Store, undefined);
292
+ if (!store$1) {
293
+ throw new Error('Store not found, maybe you forgot to import the NgxsModule');
294
+ }
295
+ this.store = store$1;
296
+ }
297
+ /**
298
+ * @description
299
+ * must be taken out into @ngxs/store/internals
300
+ */
301
+ /**
302
+ * \@description
303
+ * must be taken out into \@ngxs/store/internals
304
+ * @return {?}
305
+ */
306
+ HmrStateContextFactory.prototype.createStateContext = /**
307
+ * \@description
308
+ * must be taken out into \@ngxs/store/internals
309
+ * @return {?}
310
+ */
311
+ function () {
312
+ var _this = this;
313
+ return {
314
+ dispatch: (/**
315
+ * @param {?} actions
316
+ * @return {?}
317
+ */
318
+ function (actions) { return (/** @type {?} */ (_this.store)).dispatch(actions); }),
319
+ getState: (/**
320
+ * @return {?}
321
+ */
322
+ function () { return (/** @type {?} */ ((/** @type {?} */ (_this.store)).snapshot())); }),
323
+ setState: (/**
324
+ * @param {?} val
325
+ * @return {?}
326
+ */
327
+ function (val) {
328
+ if (operators.isStateOperator(val)) {
329
+ /** @type {?} */
330
+ var currentState = (/** @type {?} */ (_this.store)).snapshot();
331
+ val = val(currentState);
332
+ }
333
+ (/** @type {?} */ (_this.store)).reset(val);
334
+ return (/** @type {?} */ (val));
335
+ }),
336
+ patchState: (/**
337
+ * @param {?} val
338
+ * @return {?}
339
+ */
340
+ function (val) {
341
+ /** @type {?} */
342
+ var currentState = (/** @type {?} */ (_this.store)).snapshot();
343
+ /** @type {?} */
344
+ var newState = __assign({}, currentState, ((/** @type {?} */ (val))));
345
+ (/** @type {?} */ (_this.store)).reset(newState);
346
+ return newState;
347
+ })
348
+ };
349
+ };
350
+ return HmrStateContextFactory;
351
+ }());
352
+ if (false) {
353
+ /** @type {?} */
354
+ HmrStateContextFactory.prototype.store;
355
355
  }
356
356
 
357
- /**
358
- * @fileoverview added by tsickle
359
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
360
- */
361
- var HmrOptionBuilder = /** @class */ (function () {
362
- function HmrOptionBuilder(_a) {
363
- var deferTime = _a.deferTime, autoClearLogs = _a.autoClearLogs;
364
- this.deferTime = deferTime || 100;
365
- this.autoClearLogs = autoClearLogs === undefined ? true : autoClearLogs;
366
- }
367
- /**
368
- * @return {?}
369
- */
370
- HmrOptionBuilder.prototype.clearLogs = /**
371
- * @return {?}
372
- */
373
- function () {
374
- if (this.autoClearLogs) {
375
- console.clear();
376
- }
377
- };
378
- return HmrOptionBuilder;
379
- }());
380
- if (false) {
381
- /** @type {?} */
382
- HmrOptionBuilder.prototype.deferTime;
383
- /** @type {?} */
384
- HmrOptionBuilder.prototype.autoClearLogs;
357
+ /**
358
+ * @fileoverview added by tsickle
359
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
360
+ */
361
+ var HmrOptionBuilder = /** @class */ (function () {
362
+ function HmrOptionBuilder(_a) {
363
+ var deferTime = _a.deferTime, autoClearLogs = _a.autoClearLogs;
364
+ this.deferTime = deferTime || 100;
365
+ this.autoClearLogs = autoClearLogs === undefined ? true : autoClearLogs;
366
+ }
367
+ /**
368
+ * @return {?}
369
+ */
370
+ HmrOptionBuilder.prototype.clearLogs = /**
371
+ * @return {?}
372
+ */
373
+ function () {
374
+ if (this.autoClearLogs) {
375
+ console.clear();
376
+ }
377
+ };
378
+ return HmrOptionBuilder;
379
+ }());
380
+ if (false) {
381
+ /** @type {?} */
382
+ HmrOptionBuilder.prototype.deferTime;
383
+ /** @type {?} */
384
+ HmrOptionBuilder.prototype.autoClearLogs;
385
385
  }
386
386
 
387
- /**
388
- * @fileoverview added by tsickle
389
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
390
- */
391
- /**
392
- * @template T, S
393
- */
394
- var /**
395
- * @template T, S
396
- */
397
- HmrLifecycle = /** @class */ (function () {
398
- function HmrLifecycle(ngAppModule, bootstrap, storage, context, options) {
399
- this.ngAppModule = ngAppModule;
400
- this.bootstrap = bootstrap;
401
- this.storage = storage;
402
- this.context = context;
403
- this.options = options;
404
- }
405
- /**
406
- * @param {?} hmrAfterOnInit
407
- * @return {?}
408
- */
409
- HmrLifecycle.prototype.hmrNgxsStoreOnInit = /**
410
- * @param {?} hmrAfterOnInit
411
- * @return {?}
412
- */
413
- function (hmrAfterOnInit) {
414
- /** @type {?} */
415
- var moduleHmrInit = this.getModuleHmrInitCallback();
416
- moduleHmrInit = moduleHmrInit.bind(this.ngAppModule);
417
- this.detectIvyWithJIT();
418
- this.stateEventLoop((/**
419
- * @param {?} ctx
420
- * @param {?} state
421
- * @return {?}
422
- */
423
- function (ctx, state) {
424
- moduleHmrInit(ctx, state);
425
- hmrAfterOnInit(ctx, state);
426
- }));
427
- };
428
- /**
429
- * @private
430
- * @return {?}
431
- */
432
- HmrLifecycle.prototype.getModuleHmrInitCallback = /**
433
- * @private
434
- * @return {?}
435
- */
436
- function () {
437
- if (typeof this.ngAppModule.hmrNgxsStoreOnInit === 'function') {
438
- return this.ngAppModule.hmrNgxsStoreOnInit;
439
- }
440
- return (/**
441
- * @param {?} ctx
442
- * @param {?} state
443
- * @return {?}
444
- */
445
- function defaultModuleHmrInit(ctx, state) {
446
- ctx.patchState(state);
447
- });
448
- };
449
- /**
450
- * @return {?}
451
- */
452
- HmrLifecycle.prototype.hmrNgxsStoreBeforeOnDestroy = /**
453
- * @return {?}
454
- */
455
- function () {
456
- /** @type {?} */
457
- var state = {};
458
- /** @type {?} */
459
- var ctx = this.context.createStateContext();
460
- if (typeof this.ngAppModule.hmrNgxsStoreBeforeOnDestroy === 'function') {
461
- state = this.ngAppModule.hmrNgxsStoreBeforeOnDestroy(ctx);
462
- }
463
- else {
464
- state = ctx.getState();
465
- }
466
- ctx.dispatch(new HmrBeforeDestroyAction(state));
467
- return state;
468
- };
469
- /**
470
- * @private
471
- * @param {?} callback
472
- * @return {?}
473
- */
474
- HmrLifecycle.prototype.stateEventLoop = /**
475
- * @private
476
- * @param {?} callback
477
- * @return {?}
478
- */
479
- function (callback) {
480
- var _this = this;
481
- if (!this.storage.hasData())
482
- return;
483
- /** @type {?} */
484
- var appBootstrapped$ = this.bootstrap.appBootstrapped$;
485
- /** @type {?} */
486
- var state$ = this.context.store.select((/**
487
- * @param {?} state
488
- * @return {?}
489
- */
490
- function (state) { return state; }));
491
- appBootstrapped$.subscribe((/**
492
- * @return {?}
493
- */
494
- function () {
495
- /** @type {?} */
496
- var eventId;
497
- /** @type {?} */
498
- var storeEventId = state$.subscribe((/**
499
- * @return {?}
500
- */
501
- function () {
502
- // setTimeout used for zone detection after set hmr state
503
- clearInterval(eventId);
504
- eventId = window.setTimeout((/**
505
- * @return {?}
506
- */
507
- function () {
508
- // close check on the message queue
509
- storeEventId.unsubscribe();
510
- // if events are no longer running on the call stack,
511
- // then we can update the state
512
- callback(_this.context.createStateContext(), (/** @type {?} */ (_this.storage.snapshot)));
513
- }), _this.options.deferTime);
514
- }));
515
- }));
516
- };
517
- /**
518
- * @private
519
- * @return {?}
520
- */
521
- HmrLifecycle.prototype.detectIvyWithJIT = /**
522
- * @private
523
- * @return {?}
524
- */
525
- function () {
526
- /** @type {?} */
527
- var jit = this.ngAppModule.constructor.hasOwnProperty('__annotations__');
528
- /** @type {?} */
529
- var ivy = this.ngAppModule.constructor.hasOwnProperty('ɵmod');
530
- if (jit && ivy) {
531
- throw new Error("@ngxs/hmr-plugin doesn't work with JIT mode in Angular Ivy. Please use AOT mode.");
532
- }
533
- };
534
- return HmrLifecycle;
535
- }());
536
- if (false) {
537
- /**
538
- * @type {?}
539
- * @private
540
- */
541
- HmrLifecycle.prototype.ngAppModule;
542
- /**
543
- * @type {?}
544
- * @private
545
- */
546
- HmrLifecycle.prototype.bootstrap;
547
- /**
548
- * @type {?}
549
- * @private
550
- */
551
- HmrLifecycle.prototype.storage;
552
- /**
553
- * @type {?}
554
- * @private
555
- */
556
- HmrLifecycle.prototype.context;
557
- /**
558
- * @type {?}
559
- * @private
560
- */
561
- HmrLifecycle.prototype.options;
387
+ /**
388
+ * @fileoverview added by tsickle
389
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
390
+ */
391
+ /**
392
+ * @template T, S
393
+ */
394
+ var /**
395
+ * @template T, S
396
+ */
397
+ HmrLifecycle = /** @class */ (function () {
398
+ function HmrLifecycle(ngAppModule, bootstrap, storage, context, options) {
399
+ this.ngAppModule = ngAppModule;
400
+ this.bootstrap = bootstrap;
401
+ this.storage = storage;
402
+ this.context = context;
403
+ this.options = options;
404
+ }
405
+ /**
406
+ * @param {?} hmrAfterOnInit
407
+ * @return {?}
408
+ */
409
+ HmrLifecycle.prototype.hmrNgxsStoreOnInit = /**
410
+ * @param {?} hmrAfterOnInit
411
+ * @return {?}
412
+ */
413
+ function (hmrAfterOnInit) {
414
+ /** @type {?} */
415
+ var moduleHmrInit = this.getModuleHmrInitCallback();
416
+ moduleHmrInit = moduleHmrInit.bind(this.ngAppModule);
417
+ this.detectIvyWithJIT();
418
+ this.stateEventLoop((/**
419
+ * @param {?} ctx
420
+ * @param {?} state
421
+ * @return {?}
422
+ */
423
+ function (ctx, state) {
424
+ moduleHmrInit(ctx, state);
425
+ hmrAfterOnInit(ctx, state);
426
+ }));
427
+ };
428
+ /**
429
+ * @private
430
+ * @return {?}
431
+ */
432
+ HmrLifecycle.prototype.getModuleHmrInitCallback = /**
433
+ * @private
434
+ * @return {?}
435
+ */
436
+ function () {
437
+ if (typeof this.ngAppModule.hmrNgxsStoreOnInit === 'function') {
438
+ return this.ngAppModule.hmrNgxsStoreOnInit;
439
+ }
440
+ return (/**
441
+ * @param {?} ctx
442
+ * @param {?} state
443
+ * @return {?}
444
+ */
445
+ function defaultModuleHmrInit(ctx, state) {
446
+ ctx.patchState(state);
447
+ });
448
+ };
449
+ /**
450
+ * @return {?}
451
+ */
452
+ HmrLifecycle.prototype.hmrNgxsStoreBeforeOnDestroy = /**
453
+ * @return {?}
454
+ */
455
+ function () {
456
+ /** @type {?} */
457
+ var state = {};
458
+ /** @type {?} */
459
+ var ctx = this.context.createStateContext();
460
+ if (typeof this.ngAppModule.hmrNgxsStoreBeforeOnDestroy === 'function') {
461
+ state = this.ngAppModule.hmrNgxsStoreBeforeOnDestroy(ctx);
462
+ }
463
+ else {
464
+ state = ctx.getState();
465
+ }
466
+ ctx.dispatch(new HmrBeforeDestroyAction(state));
467
+ return state;
468
+ };
469
+ /**
470
+ * @private
471
+ * @param {?} callback
472
+ * @return {?}
473
+ */
474
+ HmrLifecycle.prototype.stateEventLoop = /**
475
+ * @private
476
+ * @param {?} callback
477
+ * @return {?}
478
+ */
479
+ function (callback) {
480
+ var _this = this;
481
+ if (!this.storage.hasData())
482
+ return;
483
+ /** @type {?} */
484
+ var appBootstrapped$ = this.bootstrap.appBootstrapped$;
485
+ /** @type {?} */
486
+ var state$ = this.context.store.select((/**
487
+ * @param {?} state
488
+ * @return {?}
489
+ */
490
+ function (state) { return state; }));
491
+ appBootstrapped$.subscribe((/**
492
+ * @return {?}
493
+ */
494
+ function () {
495
+ /** @type {?} */
496
+ var eventId;
497
+ /** @type {?} */
498
+ var storeEventId = state$.subscribe((/**
499
+ * @return {?}
500
+ */
501
+ function () {
502
+ // setTimeout used for zone detection after set hmr state
503
+ clearInterval(eventId);
504
+ eventId = window.setTimeout((/**
505
+ * @return {?}
506
+ */
507
+ function () {
508
+ // close check on the message queue
509
+ storeEventId.unsubscribe();
510
+ // if events are no longer running on the call stack,
511
+ // then we can update the state
512
+ callback(_this.context.createStateContext(), (/** @type {?} */ (_this.storage.snapshot)));
513
+ }), _this.options.deferTime);
514
+ }));
515
+ }));
516
+ };
517
+ /**
518
+ * @private
519
+ * @return {?}
520
+ */
521
+ HmrLifecycle.prototype.detectIvyWithJIT = /**
522
+ * @private
523
+ * @return {?}
524
+ */
525
+ function () {
526
+ /** @type {?} */
527
+ var jit = this.ngAppModule.constructor.hasOwnProperty('__annotations__');
528
+ /** @type {?} */
529
+ var ivy = this.ngAppModule.constructor.hasOwnProperty('ɵmod');
530
+ if (jit && ivy) {
531
+ throw new Error("@ngxs/hmr-plugin doesn't work with JIT mode in Angular Ivy. Please use AOT mode.");
532
+ }
533
+ };
534
+ return HmrLifecycle;
535
+ }());
536
+ if (false) {
537
+ /**
538
+ * @type {?}
539
+ * @private
540
+ */
541
+ HmrLifecycle.prototype.ngAppModule;
542
+ /**
543
+ * @type {?}
544
+ * @private
545
+ */
546
+ HmrLifecycle.prototype.bootstrap;
547
+ /**
548
+ * @type {?}
549
+ * @private
550
+ */
551
+ HmrLifecycle.prototype.storage;
552
+ /**
553
+ * @type {?}
554
+ * @private
555
+ */
556
+ HmrLifecycle.prototype.context;
557
+ /**
558
+ * @type {?}
559
+ * @private
560
+ */
561
+ HmrLifecycle.prototype.options;
562
562
  }
563
563
 
564
- /**
565
- * @fileoverview added by tsickle
566
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
567
- */
568
- /**
569
- * @template T, S
570
- */
571
- var /**
572
- * @template T, S
573
- */
574
- HmrManager = /** @class */ (function () {
575
- function HmrManager(options, storage) {
576
- this.storage = storage;
577
- this.optionsBuilder = new HmrOptionBuilder(options);
578
- }
579
- Object.defineProperty(HmrManager.prototype, "applicationRef", {
580
- get: /**
581
- * @private
582
- * @return {?}
583
- */
584
- function () {
585
- return this.ngModule.injector.get(core.ApplicationRef);
586
- },
587
- enumerable: true,
588
- configurable: true
589
- });
590
- Object.defineProperty(HmrManager.prototype, "bootstrap", {
591
- get: /**
592
- * @private
593
- * @return {?}
594
- */
595
- function () {
596
- return this.ngModule.injector.get(internals.NgxsBootstrapper);
597
- },
598
- enumerable: true,
599
- configurable: true
600
- });
601
- /**
602
- * @param {?} bootstrapFn
603
- * @param {?} tick
604
- * @return {?}
605
- */
606
- HmrManager.prototype.hmrModule = /**
607
- * @param {?} bootstrapFn
608
- * @param {?} tick
609
- * @return {?}
610
- */
611
- function (bootstrapFn, tick) {
612
- return __awaiter(this, void 0, void 0, function () {
613
- var _a;
614
- return __generator(this, function (_b) {
615
- switch (_b.label) {
616
- case 0:
617
- internals.InitialState.set(this.storage.snapshot);
618
- _a = this;
619
- return [4 /*yield*/, bootstrapFn()];
620
- case 1:
621
- _a.ngModule = _b.sent();
622
- this.context = new HmrStateContextFactory(this.ngModule);
623
- this.lifecycle = this.createLifecycle();
624
- tick();
625
- internals.InitialState.pop();
626
- return [2 /*return*/, this.ngModule];
627
- }
628
- });
629
- });
630
- };
631
- /**
632
- * @return {?}
633
- */
634
- HmrManager.prototype.beforeModuleBootstrap = /**
635
- * @return {?}
636
- */
637
- function () {
638
- this.lifecycle.hmrNgxsStoreOnInit((/**
639
- * @param {?} ctx
640
- * @param {?} state
641
- * @return {?}
642
- */
643
- function (ctx, state) {
644
- ctx.dispatch(new HmrInitAction(state));
645
- }));
646
- };
647
- /**
648
- * @return {?}
649
- */
650
- HmrManager.prototype.beforeModuleOnDestroy = /**
651
- * @return {?}
652
- */
653
- function () {
654
- this.optionsBuilder.clearLogs();
655
- return this.lifecycle.hmrNgxsStoreBeforeOnDestroy();
656
- };
657
- /**
658
- * @return {?}
659
- */
660
- HmrManager.prototype.createNewModule = /**
661
- * @return {?}
662
- */
663
- function () {
664
- /** @type {?} */
665
- var removeOldHosts = this.cloneHostsBeforeDestroy();
666
- this.removeNgStyles();
667
- this.ngModule.destroy();
668
- removeOldHosts();
669
- };
670
- /**
671
- * @private
672
- * @return {?}
673
- */
674
- HmrManager.prototype.createLifecycle = /**
675
- * @private
676
- * @return {?}
677
- */
678
- function () {
679
- return new HmrLifecycle(this.ngModule.instance, this.bootstrap, this.storage, this.context, this.optionsBuilder);
680
- };
681
- /**
682
- * @private
683
- * @return {?}
684
- */
685
- HmrManager.prototype.cloneHostsBeforeDestroy = /**
686
- * @private
687
- * @return {?}
688
- */
689
- function () {
690
- /** @type {?} */
691
- var elements = this.applicationRef.components.map((/**
692
- * @param {?} component
693
- * @return {?}
694
- */
695
- function (component) { return component.location.nativeElement; }));
696
- /** @type {?} */
697
- var removableList = elements.map((/**
698
- * @param {?} componentNode
699
- * @return {?}
700
- */
701
- function (componentNode) {
702
- /** @type {?} */
703
- var newNode = document.createElement(componentNode.tagName);
704
- /** @type {?} */
705
- var parentNode = (/** @type {?} */ (componentNode.parentNode));
706
- /** @type {?} */
707
- var currentDisplay = newNode.style.display;
708
- newNode.style.display = 'none';
709
- parentNode.insertBefore(newNode, componentNode);
710
- return (/**
711
- * @return {?}
712
- */
713
- function () {
714
- newNode.style.display = currentDisplay;
715
- try {
716
- parentNode.removeChild(componentNode);
717
- }
718
- catch (_a) { }
719
- });
720
- }));
721
- return (/**
722
- * @return {?}
723
- */
724
- function removeOldHosts() {
725
- removableList.forEach((/**
726
- * @param {?} removeOldHost
727
- * @return {?}
728
- */
729
- function (removeOldHost) { return removeOldHost(); }));
730
- });
731
- };
732
- /**
733
- * @private
734
- * @return {?}
735
- */
736
- HmrManager.prototype.removeNgStyles = /**
737
- * @private
738
- * @return {?}
739
- */
740
- function () {
741
- /** @type {?} */
742
- var head = (/** @type {?} */ (document.head));
743
- /** @type {?} */
744
- var styles = Array.from((/** @type {?} */ (head)).querySelectorAll('style'));
745
- styles
746
- .filter((/**
747
- * @param {?} style
748
- * @return {?}
749
- */
750
- function (style) { return style.innerText.includes('_ng'); }))
751
- .map((/**
752
- * @param {?} style
753
- * @return {?}
754
- */
755
- function (style) { return (/** @type {?} */ (head)).removeChild(style); }));
756
- };
757
- return HmrManager;
758
- }());
759
- if (false) {
760
- /** @type {?} */
761
- HmrManager.prototype.storage;
762
- /** @type {?} */
763
- HmrManager.prototype.context;
764
- /** @type {?} */
765
- HmrManager.prototype.lifecycle;
766
- /** @type {?} */
767
- HmrManager.prototype.optionsBuilder;
768
- /**
769
- * @type {?}
770
- * @private
771
- */
772
- HmrManager.prototype.ngModule;
564
+ /**
565
+ * @fileoverview added by tsickle
566
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
567
+ */
568
+ /**
569
+ * @template T, S
570
+ */
571
+ var /**
572
+ * @template T, S
573
+ */
574
+ HmrManager = /** @class */ (function () {
575
+ function HmrManager(options, storage) {
576
+ this.storage = storage;
577
+ this.optionsBuilder = new HmrOptionBuilder(options);
578
+ }
579
+ Object.defineProperty(HmrManager.prototype, "applicationRef", {
580
+ get: /**
581
+ * @private
582
+ * @return {?}
583
+ */
584
+ function () {
585
+ return this.ngModule.injector.get(core.ApplicationRef);
586
+ },
587
+ enumerable: true,
588
+ configurable: true
589
+ });
590
+ Object.defineProperty(HmrManager.prototype, "bootstrap", {
591
+ get: /**
592
+ * @private
593
+ * @return {?}
594
+ */
595
+ function () {
596
+ return this.ngModule.injector.get(internals.NgxsBootstrapper);
597
+ },
598
+ enumerable: true,
599
+ configurable: true
600
+ });
601
+ /**
602
+ * @param {?} bootstrapFn
603
+ * @param {?} tick
604
+ * @return {?}
605
+ */
606
+ HmrManager.prototype.hmrModule = /**
607
+ * @param {?} bootstrapFn
608
+ * @param {?} tick
609
+ * @return {?}
610
+ */
611
+ function (bootstrapFn, tick) {
612
+ return __awaiter(this, void 0, void 0, function () {
613
+ var _a;
614
+ return __generator(this, function (_b) {
615
+ switch (_b.label) {
616
+ case 0:
617
+ internals.InitialState.set(this.storage.snapshot);
618
+ _a = this;
619
+ return [4 /*yield*/, bootstrapFn()];
620
+ case 1:
621
+ _a.ngModule = _b.sent();
622
+ this.context = new HmrStateContextFactory(this.ngModule);
623
+ this.lifecycle = this.createLifecycle();
624
+ tick();
625
+ internals.InitialState.pop();
626
+ return [2 /*return*/, this.ngModule];
627
+ }
628
+ });
629
+ });
630
+ };
631
+ /**
632
+ * @return {?}
633
+ */
634
+ HmrManager.prototype.beforeModuleBootstrap = /**
635
+ * @return {?}
636
+ */
637
+ function () {
638
+ this.lifecycle.hmrNgxsStoreOnInit((/**
639
+ * @param {?} ctx
640
+ * @param {?} state
641
+ * @return {?}
642
+ */
643
+ function (ctx, state) {
644
+ ctx.dispatch(new HmrInitAction(state));
645
+ }));
646
+ };
647
+ /**
648
+ * @return {?}
649
+ */
650
+ HmrManager.prototype.beforeModuleOnDestroy = /**
651
+ * @return {?}
652
+ */
653
+ function () {
654
+ this.optionsBuilder.clearLogs();
655
+ return this.lifecycle.hmrNgxsStoreBeforeOnDestroy();
656
+ };
657
+ /**
658
+ * @return {?}
659
+ */
660
+ HmrManager.prototype.createNewModule = /**
661
+ * @return {?}
662
+ */
663
+ function () {
664
+ /** @type {?} */
665
+ var removeOldHosts = this.cloneHostsBeforeDestroy();
666
+ this.removeNgStyles();
667
+ this.ngModule.destroy();
668
+ removeOldHosts();
669
+ };
670
+ /**
671
+ * @private
672
+ * @return {?}
673
+ */
674
+ HmrManager.prototype.createLifecycle = /**
675
+ * @private
676
+ * @return {?}
677
+ */
678
+ function () {
679
+ return new HmrLifecycle(this.ngModule.instance, this.bootstrap, this.storage, this.context, this.optionsBuilder);
680
+ };
681
+ /**
682
+ * @private
683
+ * @return {?}
684
+ */
685
+ HmrManager.prototype.cloneHostsBeforeDestroy = /**
686
+ * @private
687
+ * @return {?}
688
+ */
689
+ function () {
690
+ /** @type {?} */
691
+ var elements = this.applicationRef.components.map((/**
692
+ * @param {?} component
693
+ * @return {?}
694
+ */
695
+ function (component) { return component.location.nativeElement; }));
696
+ /** @type {?} */
697
+ var removableList = elements.map((/**
698
+ * @param {?} componentNode
699
+ * @return {?}
700
+ */
701
+ function (componentNode) {
702
+ /** @type {?} */
703
+ var newNode = document.createElement(componentNode.tagName);
704
+ /** @type {?} */
705
+ var parentNode = (/** @type {?} */ (componentNode.parentNode));
706
+ /** @type {?} */
707
+ var currentDisplay = newNode.style.display;
708
+ newNode.style.display = 'none';
709
+ parentNode.insertBefore(newNode, componentNode);
710
+ return (/**
711
+ * @return {?}
712
+ */
713
+ function () {
714
+ newNode.style.display = currentDisplay;
715
+ try {
716
+ parentNode.removeChild(componentNode);
717
+ }
718
+ catch (_a) { }
719
+ });
720
+ }));
721
+ return (/**
722
+ * @return {?}
723
+ */
724
+ function removeOldHosts() {
725
+ removableList.forEach((/**
726
+ * @param {?} removeOldHost
727
+ * @return {?}
728
+ */
729
+ function (removeOldHost) { return removeOldHost(); }));
730
+ });
731
+ };
732
+ /**
733
+ * @private
734
+ * @return {?}
735
+ */
736
+ HmrManager.prototype.removeNgStyles = /**
737
+ * @private
738
+ * @return {?}
739
+ */
740
+ function () {
741
+ /** @type {?} */
742
+ var head = (/** @type {?} */ (document.head));
743
+ /** @type {?} */
744
+ var styles = Array.from((/** @type {?} */ (head)).querySelectorAll('style'));
745
+ styles
746
+ .filter((/**
747
+ * @param {?} style
748
+ * @return {?}
749
+ */
750
+ function (style) { return style.innerText.includes('_ng'); }))
751
+ .map((/**
752
+ * @param {?} style
753
+ * @return {?}
754
+ */
755
+ function (style) { return (/** @type {?} */ (head)).removeChild(style); }));
756
+ };
757
+ return HmrManager;
758
+ }());
759
+ if (false) {
760
+ /** @type {?} */
761
+ HmrManager.prototype.storage;
762
+ /** @type {?} */
763
+ HmrManager.prototype.context;
764
+ /** @type {?} */
765
+ HmrManager.prototype.lifecycle;
766
+ /** @type {?} */
767
+ HmrManager.prototype.optionsBuilder;
768
+ /**
769
+ * @type {?}
770
+ * @private
771
+ */
772
+ HmrManager.prototype.ngModule;
773
773
  }
774
774
 
775
- /**
776
- * @fileoverview added by tsickle
777
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
778
- */
779
- /**
780
- * @template S
781
- */
782
- var /**
783
- * @template S
784
- */
785
- HmrStorage = /** @class */ (function () {
786
- function HmrStorage(_snapshot) {
787
- if (_snapshot === void 0) { _snapshot = {}; }
788
- this._snapshot = _snapshot;
789
- }
790
- /**
791
- * @return {?}
792
- */
793
- HmrStorage.prototype.hasData = /**
794
- * @return {?}
795
- */
796
- function () {
797
- return Object.keys(this._snapshot).length > 0;
798
- };
799
- Object.defineProperty(HmrStorage.prototype, "snapshot", {
800
- get: /**
801
- * @return {?}
802
- */
803
- function () {
804
- return this._snapshot;
805
- },
806
- enumerable: true,
807
- configurable: true
808
- });
809
- return HmrStorage;
810
- }());
811
- if (false) {
812
- /**
813
- * @type {?}
814
- * @private
815
- */
816
- HmrStorage.prototype._snapshot;
775
+ /**
776
+ * @fileoverview added by tsickle
777
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
778
+ */
779
+ /**
780
+ * @template S
781
+ */
782
+ var /**
783
+ * @template S
784
+ */
785
+ HmrStorage = /** @class */ (function () {
786
+ function HmrStorage(_snapshot) {
787
+ if (_snapshot === void 0) { _snapshot = {}; }
788
+ this._snapshot = _snapshot;
789
+ }
790
+ /**
791
+ * @return {?}
792
+ */
793
+ HmrStorage.prototype.hasData = /**
794
+ * @return {?}
795
+ */
796
+ function () {
797
+ return Object.keys(this._snapshot).length > 0;
798
+ };
799
+ Object.defineProperty(HmrStorage.prototype, "snapshot", {
800
+ get: /**
801
+ * @return {?}
802
+ */
803
+ function () {
804
+ return this._snapshot;
805
+ },
806
+ enumerable: true,
807
+ configurable: true
808
+ });
809
+ return HmrStorage;
810
+ }());
811
+ if (false) {
812
+ /**
813
+ * @type {?}
814
+ * @private
815
+ */
816
+ HmrStorage.prototype._snapshot;
817
817
  }
818
818
 
819
- /**
820
- * @fileoverview added by tsickle
821
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
822
- */
823
- /**
824
- * @param {?} value
825
- * @return {?}
826
- */
827
- function setHmrReloadedTo(value) {
828
- if (window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */]) {
829
- window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */].hmrReloaded = value;
830
- }
831
- }
832
- /**
833
- * @return {?}
834
- */
835
- function markApplicationAsHmrReloaded() {
836
- window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] = window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] || {
837
- hmrReloaded: false
838
- };
819
+ /**
820
+ * @fileoverview added by tsickle
821
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
822
+ */
823
+ /**
824
+ * @param {?} value
825
+ * @return {?}
826
+ */
827
+ function setHmrReloadedTo(value) {
828
+ if (window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */]) {
829
+ window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */].hmrReloaded = value;
830
+ }
831
+ }
832
+ /**
833
+ * @return {?}
834
+ */
835
+ function markApplicationAsHmrReloaded() {
836
+ window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] = window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] || {
837
+ hmrReloaded: false
838
+ };
839
839
  }
840
840
 
841
- /**
842
- * @fileoverview added by tsickle
843
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
844
- */
845
- /**
846
- * Hot Module Replacement plugin for NGXS
847
- * @deprecated As of Angular v10, HMR is no longer supported and will be deprecated.
848
- * More information [here](https://www.ngxs.io/plugins/hmr).
849
- * @template T
850
- * @param {?} webpackModule
851
- * @param {?} bootstrapFn
852
- * @param {?=} options
853
- * @return {?}
854
- */
855
- function hmr(webpackModule, bootstrapFn, options) {
856
- if (options === void 0) { options = {}; }
857
- return __awaiter(this, void 0, void 0, function () {
858
- /**
859
- * @record
860
- */
861
- function HmrDataTransfer() { }
862
- var dataTransfer, storage, manager;
863
- return __generator(this, function (_a) {
864
- switch (_a.label) {
865
- case 0:
866
- if (!webpackModule.hot) {
867
- console.error('Are you using the --hmr flag for ng serve?');
868
- throw new Error('HMR is not enabled for webpack-dev-server!');
869
- }
870
- markApplicationAsHmrReloaded();
871
- webpackModule.hot.accept();
872
- if (false) {
873
- /** @type {?|undefined} */
874
- HmrDataTransfer.prototype.snapshot;
875
- }
876
- dataTransfer = webpackModule.hot.data || {};
877
- storage = new HmrStorage(dataTransfer.snapshot || {});
878
- manager = new HmrManager(options, storage);
879
- return [4 /*yield*/, manager.hmrModule(bootstrapFn, (/**
880
- * @return {?}
881
- */
882
- function () {
883
- manager.beforeModuleBootstrap();
884
- (/** @type {?} */ (webpackModule.hot)).dispose((/**
885
- * @param {?} data
886
- * @return {?}
887
- */
888
- function (data) {
889
- setHmrReloadedTo(true);
890
- data.snapshot = manager.beforeModuleOnDestroy();
891
- manager.createNewModule();
892
- }));
893
- }))];
894
- case 1: return [2 /*return*/, _a.sent()];
895
- }
896
- });
897
- });
841
+ /**
842
+ * @fileoverview added by tsickle
843
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
844
+ */
845
+ /**
846
+ * Hot Module Replacement plugin for NGXS
847
+ * @deprecated As of Angular v10, HMR is no longer supported and will be deprecated.
848
+ * More information [here](https://www.ngxs.io/plugins/hmr).
849
+ * @template T
850
+ * @param {?} webpackModule
851
+ * @param {?} bootstrapFn
852
+ * @param {?=} options
853
+ * @return {?}
854
+ */
855
+ function hmr(webpackModule, bootstrapFn, options) {
856
+ if (options === void 0) { options = {}; }
857
+ return __awaiter(this, void 0, void 0, function () {
858
+ /**
859
+ * @record
860
+ */
861
+ function HmrDataTransfer() { }
862
+ var dataTransfer, storage, manager;
863
+ return __generator(this, function (_a) {
864
+ switch (_a.label) {
865
+ case 0:
866
+ if (!webpackModule.hot) {
867
+ console.error('Are you using the --hmr flag for ng serve?');
868
+ throw new Error('HMR is not enabled for webpack-dev-server!');
869
+ }
870
+ markApplicationAsHmrReloaded();
871
+ webpackModule.hot.accept();
872
+ if (false) {
873
+ /** @type {?|undefined} */
874
+ HmrDataTransfer.prototype.snapshot;
875
+ }
876
+ dataTransfer = webpackModule.hot.data || {};
877
+ storage = new HmrStorage(dataTransfer.snapshot || {});
878
+ manager = new HmrManager(options, storage);
879
+ return [4 /*yield*/, manager.hmrModule(bootstrapFn, (/**
880
+ * @return {?}
881
+ */
882
+ function () {
883
+ manager.beforeModuleBootstrap();
884
+ (/** @type {?} */ (webpackModule.hot)).dispose((/**
885
+ * @param {?} data
886
+ * @return {?}
887
+ */
888
+ function (data) {
889
+ setHmrReloadedTo(true);
890
+ data.snapshot = manager.beforeModuleOnDestroy();
891
+ manager.createNewModule();
892
+ }));
893
+ }))];
894
+ case 1: return [2 /*return*/, _a.sent()];
895
+ }
896
+ });
897
+ });
898
898
  }
899
899
 
900
- /**
901
- * @fileoverview added by tsickle
902
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
903
- */
904
- /**
905
- * @return {?}
906
- */
907
- function hmrIsReloaded() {
908
- return !!(window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] && window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */].hmrReloaded);
900
+ /**
901
+ * @fileoverview added by tsickle
902
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
903
+ */
904
+ /**
905
+ * @return {?}
906
+ */
907
+ function hmrIsReloaded() {
908
+ return !!(window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */] && window["NGXS_HMR_LIFECYCLE_STATUS" /* Status */].hmrReloaded);
909
909
  }
910
910
 
911
911
  exports.HmrBeforeDestroyAction = HmrBeforeDestroyAction;