@angular/upgrade 13.0.1 → 13.1.0-next.2

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.0.1
2
+ * @license Angular v13.1.0-next.2
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.0.1", ngImport: i0, type: AngularTestingModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule });
135
- AngularTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AngularTestingModule });
136
- AngularTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AngularTestingModule, providers: [{ provide: $INJECTOR, useFactory: $injectorFactory }] });
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AngularTestingModule, decorators: [{
134
+ AngularTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.2", 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.2", ngImport: i0, type: AngularTestingModule });
136
+ AngularTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: AngularTestingModule, providers: [{ provide: $INJECTOR, useFactory: $injectorFactory }] });
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.2", 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.0.1
2
+ * @license Angular v13.1.0-next.2
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, isDevMode, 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.0.1');
916
+ const VERSION = new Version('13.1.0-next.2');
913
917
 
914
918
  /**
915
919
  * @license
@@ -1003,9 +1007,11 @@ 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
+ * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
1014
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
1009
1015
  * - `Function`: If you pass a function, it is expected to return a promise resolving to an
1010
1016
  * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
1011
1017
  * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
@@ -1094,13 +1100,23 @@ let moduleUid = 0;
1094
1100
  *
1095
1101
  * @publicApi
1096
1102
  */
1097
- function downgradeModule(moduleFactoryOrBootstrapFn) {
1103
+ function downgradeModule(moduleOrBootstrapFn) {
1098
1104
  const lazyModuleName = `${UPGRADE_MODULE_NAME}.lazy${++moduleUid}`;
1099
1105
  const lazyModuleRefKey = `${LAZY_MODULE_REF}${lazyModuleName}`;
1100
1106
  const lazyInjectorKey = `${INJECTOR_KEY}${lazyModuleName}`;
1101
- const bootstrapFn = isFunction(moduleFactoryOrBootstrapFn) ?
1102
- moduleFactoryOrBootstrapFn :
1103
- (extraProviders) => platformBrowser(extraProviders).bootstrapModuleFactory(moduleFactoryOrBootstrapFn);
1107
+ let bootstrapFn;
1108
+ if (isNgModuleType(moduleOrBootstrapFn)) {
1109
+ // NgModule class
1110
+ bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModule(moduleOrBootstrapFn);
1111
+ }
1112
+ else if (!isFunction(moduleOrBootstrapFn)) {
1113
+ // NgModule factory
1114
+ bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModuleFactory(moduleOrBootstrapFn);
1115
+ }
1116
+ else {
1117
+ // bootstrap function
1118
+ bootstrapFn = moduleOrBootstrapFn;
1119
+ }
1104
1120
  let injector;
1105
1121
  // Create an ng1 module to bootstrap.
1106
1122
  module_(lazyModuleName, [])
@@ -1616,9 +1632,9 @@ class UpgradeComponent {
1616
1632
  }
1617
1633
  }
1618
1634
  }
1619
- UpgradeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1620
- UpgradeComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 });
1621
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UpgradeComponent, decorators: [{
1635
+ UpgradeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1636
+ UpgradeComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0-next.2", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 });
1637
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeComponent, decorators: [{
1622
1638
  type: Directive
1623
1639
  }], ctorParameters: function () { return [{ type: undefined }, { type: i0.ElementRef }, { type: i0.Injector }]; } });
1624
1640
 
@@ -1898,10 +1914,10 @@ class UpgradeModule {
1898
1914
  }
1899
1915
  }
1900
1916
  }
1901
- UpgradeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", 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.0.1", ngImport: i0, type: UpgradeModule });
1903
- UpgradeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] });
1904
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UpgradeModule, decorators: [{
1917
+ UpgradeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule });
1918
+ UpgradeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeModule });
1919
+ UpgradeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] });
1920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.2", ngImport: i0, type: UpgradeModule, decorators: [{
1905
1921
  type: NgModule,
1906
1922
  args: [{ providers: [angular1Providers] }]
1907
1923
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.NgZone }, { type: i0.PlatformRef }]; } });