@ngxs/store 3.7.3-dev.master-5b116c1 → 3.7.3-dev.master-d470dff

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,6 +1,6 @@
1
1
  import { __assign, __spread, __extends, __values } from 'tslib';
2
2
  import { NgZone, Injectable, Inject, PLATFORM_ID, InjectionToken, Optional, SkipSelf, ErrorHandler, Injector, defineInjectable, inject, ɵivyEnabled, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core';
3
- import { memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
3
+ import { isAngularInTestMode, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
4
4
  import { isPlatformServer } from '@angular/common';
5
5
  import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from } from 'rxjs';
6
6
  import { filter, map, shareReplay, take, exhaustMap, mergeMap, defaultIfEmpty, catchError, takeUntil, tap, distinctUntilChanged } from 'rxjs/operators';
@@ -254,6 +254,9 @@ if (false) {
254
254
  * Run in development mode. This will add additional debugging features:
255
255
  * - Object.freeze on the state and actions to guarantee immutability
256
256
  * (default: false)
257
+ *
258
+ * @deprecated This property is no longer necessary when the Ivy compiler is used.
259
+ * We'll determine the development mode through the `ngDevMode`. It's still essential with View Engine.
257
260
  * @type {?}
258
261
  */
259
262
  NgxsConfig.prototype.developmentMode;
@@ -2043,9 +2046,22 @@ var InternalStateOperations = /** @class */ (function () {
2043
2046
  */
2044
2047
  function (actionOrActions) { return _this._dispatcher.dispatch(actionOrActions); })
2045
2048
  };
2046
- return this._config.developmentMode
2047
- ? ensureStateAndActionsAreImmutable(rootStateOperations)
2048
- : rootStateOperations;
2049
+ // We have to have that duplication since this will allow us to tree-shake `ensureStateAndActionsAreImmutable`
2050
+ // and `deepFreeze` in Ivy production build.
2051
+ // The below `if` condition checks 2 things:
2052
+ // 1) if we're in View Engine (`ngDevMode` is `undefined`)
2053
+ // 2) if we're running tests, we should fallback to `config.developmentMode` to be backwards-compatible
2054
+ if (typeof ngDevMode === 'undefined' || (ngDevMode && isAngularInTestMode())) {
2055
+ return this._config.developmentMode
2056
+ ? ensureStateAndActionsAreImmutable(rootStateOperations)
2057
+ : rootStateOperations;
2058
+ }
2059
+ else {
2060
+ // If we're in Ivy and not running tests, then tree-shake `ensureStateAndActionsAreImmutable` and `deepFreeze`.
2061
+ return ngDevMode
2062
+ ? ensureStateAndActionsAreImmutable(rootStateOperations)
2063
+ : rootStateOperations;
2064
+ }
2049
2065
  };
2050
2066
  /**
2051
2067
  * @param {?} results
@@ -2092,7 +2108,6 @@ if (false) {
2092
2108
  */
2093
2109
  InternalStateOperations.prototype._config;
2094
2110
  }
2095
- // We make it as a separate function and not the class method to tree-shake it in the future.
2096
2111
  /**
2097
2112
  * @param {?} root
2098
2113
  * @return {?}