@angular/upgrade 13.1.0-next.0 → 13.1.0

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,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.1.0-next.0
2
+ * @license Angular v13.1.0
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -131,10 +131,10 @@ class AngularTestingModule {
131
131
  injector = i;
132
132
  }
133
133
  }
134
- AngularTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: AngularTestingModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule });
135
- AngularTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: AngularTestingModule });
136
- AngularTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: AngularTestingModule, providers: [{ provide: $INJECTOR, useFactory: $injectorFactory }] });
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: AngularTestingModule, decorators: [{
134
+ AngularTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: AngularTestingModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule });
135
+ AngularTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: AngularTestingModule });
136
+ AngularTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: AngularTestingModule, providers: [{ provide: $INJECTOR, useFactory: $injectorFactory }] });
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: AngularTestingModule, decorators: [{
138
138
  type: NgModule,
139
139
  args: [{ providers: [{ provide: $INJECTOR, useFactory: $injectorFactory }] }]
140
140
  }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v13.1.0-next.0
2
+ * @license Angular v13.1.0
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, isDevMode, NgModule } from '@angular/core';
8
+ import { ɵNG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, NgModule } from '@angular/core';
9
9
  import { platformBrowser } from '@angular/platform-browser';
10
10
 
11
11
  /**
@@ -219,6 +219,10 @@ function getUpgradeAppType($injector) {
219
219
  function isFunction(value) {
220
220
  return typeof value === 'function';
221
221
  }
222
+ function isNgModuleType(value) {
223
+ // NgModule class should have the `ɵmod` static property attached by AOT or JIT compiler.
224
+ return isFunction(value) && !!value[ɵNG_MOD_DEF];
225
+ }
222
226
  function isParentNode(node) {
223
227
  return isFunction(node.querySelectorAll);
224
228
  }
@@ -909,7 +913,7 @@ function downgradeInjectable(token, downgradedModule = '') {
909
913
  /**
910
914
  * @publicApi
911
915
  */
912
- const VERSION = new Version('13.1.0-next.0');
916
+ const VERSION = new Version('13.1.0');
913
917
 
914
918
  /**
915
919
  * @license
@@ -1003,9 +1007,13 @@ let moduleUid = 0;
1003
1007
  * The Angular module will be bootstrapped once (when requested for the first time) and the same
1004
1008
  * reference will be used from that point onwards.
1005
1009
  *
1006
- * `downgradeModule()` requires either an `NgModuleFactory` or a function:
1010
+ * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:
1007
1011
  * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module
1008
1012
  * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.
1013
+ * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a
1014
+ * bootstrap function instead.
1015
+ * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
1016
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
1009
1017
  * - `Function`: If you pass a function, it is expected to return a promise resolving to an
1010
1018
  * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
1011
1019
  * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
@@ -1094,13 +1102,23 @@ let moduleUid = 0;
1094
1102
  *
1095
1103
  * @publicApi
1096
1104
  */
1097
- function downgradeModule(moduleFactoryOrBootstrapFn) {
1105
+ function downgradeModule(moduleOrBootstrapFn) {
1098
1106
  const lazyModuleName = `${UPGRADE_MODULE_NAME}.lazy${++moduleUid}`;
1099
1107
  const lazyModuleRefKey = `${LAZY_MODULE_REF}${lazyModuleName}`;
1100
1108
  const lazyInjectorKey = `${INJECTOR_KEY}${lazyModuleName}`;
1101
- const bootstrapFn = isFunction(moduleFactoryOrBootstrapFn) ?
1102
- moduleFactoryOrBootstrapFn :
1103
- (extraProviders) => platformBrowser(extraProviders).bootstrapModuleFactory(moduleFactoryOrBootstrapFn);
1109
+ let bootstrapFn;
1110
+ if (isNgModuleType(moduleOrBootstrapFn)) {
1111
+ // NgModule class
1112
+ bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModule(moduleOrBootstrapFn);
1113
+ }
1114
+ else if (!isFunction(moduleOrBootstrapFn)) {
1115
+ // NgModule factory
1116
+ bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModuleFactory(moduleOrBootstrapFn);
1117
+ }
1118
+ else {
1119
+ // bootstrap function
1120
+ bootstrapFn = moduleOrBootstrapFn;
1121
+ }
1104
1122
  let injector;
1105
1123
  // Create an ng1 module to bootstrap.
1106
1124
  module_(lazyModuleName, [])
@@ -1616,9 +1634,9 @@ class UpgradeComponent {
1616
1634
  }
1617
1635
  }
1618
1636
  }
1619
- UpgradeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1620
- UpgradeComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0-next.0", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 });
1621
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeComponent, decorators: [{
1637
+ UpgradeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1638
+ UpgradeComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 });
1639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeComponent, decorators: [{
1622
1640
  type: Directive
1623
1641
  }], ctorParameters: function () { return [{ type: undefined }, { type: i0.ElementRef }, { type: i0.Injector }]; } });
1624
1642
 
@@ -1865,7 +1883,7 @@ class UpgradeModule {
1865
1883
  setTimeout(() => {
1866
1884
  const subscription = this.ngZone.onMicrotaskEmpty.subscribe(() => {
1867
1885
  if ($rootScope.$$phase) {
1868
- if (isDevMode()) {
1886
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
1869
1887
  console.warn('A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.');
1870
1888
  }
1871
1889
  return $rootScope.$evalAsync();
@@ -1898,10 +1916,10 @@ class UpgradeModule {
1898
1916
  }
1899
1917
  }
1900
1918
  }
1901
- UpgradeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule });
1902
- UpgradeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeModule });
1903
- UpgradeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] });
1904
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: UpgradeModule, decorators: [{
1919
+ UpgradeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule });
1920
+ UpgradeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeModule });
1921
+ UpgradeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] });
1922
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: UpgradeModule, decorators: [{
1905
1923
  type: NgModule,
1906
1924
  args: [{ providers: [angular1Providers] }]
1907
1925
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.NgZone }, { type: i0.PlatformRef }]; } });